1651350d1SDavid Howells /* RxRPC kernel service interface definitions 217926a79SDavid Howells * 3651350d1SDavid Howells * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. 417926a79SDavid Howells * Written by David Howells (dhowells@redhat.com) 517926a79SDavid Howells * 617926a79SDavid Howells * This program is free software; you can redistribute it and/or 717926a79SDavid Howells * modify it under the terms of the GNU General Public License 817926a79SDavid Howells * as published by the Free Software Foundation; either version 917926a79SDavid Howells * 2 of the License, or (at your option) any later version. 1017926a79SDavid Howells */ 1117926a79SDavid Howells 1217926a79SDavid Howells #ifndef _NET_RXRPC_H 1317926a79SDavid Howells #define _NET_RXRPC_H 1417926a79SDavid Howells 1517926a79SDavid Howells #include <linux/rxrpc.h> 162070a3e4SDavid Howells #include <linux/ktime.h> 1717926a79SDavid Howells 184de48af6SDavid Howells struct key; 194de48af6SDavid Howells struct sock; 204de48af6SDavid Howells struct socket; 21651350d1SDavid Howells struct rxrpc_call; 22651350d1SDavid Howells 23c038a58cSDavid Howells /* 24c038a58cSDavid Howells * Call completion condition (state == RXRPC_CALL_COMPLETE). 25c038a58cSDavid Howells */ 26c038a58cSDavid Howells enum rxrpc_call_completion { 27c038a58cSDavid Howells RXRPC_CALL_SUCCEEDED, /* - Normal termination */ 28c038a58cSDavid Howells RXRPC_CALL_REMOTELY_ABORTED, /* - call aborted by peer */ 29c038a58cSDavid Howells RXRPC_CALL_LOCALLY_ABORTED, /* - call aborted locally on error or close */ 30c038a58cSDavid Howells RXRPC_CALL_LOCAL_ERROR, /* - call failed due to local error */ 31c038a58cSDavid Howells RXRPC_CALL_NETWORK_ERROR, /* - call terminated by network error */ 32c038a58cSDavid Howells NR__RXRPC_CALL_COMPLETIONS 33c038a58cSDavid Howells }; 34c038a58cSDavid Howells 35a25e21f0SDavid Howells /* 36a25e21f0SDavid Howells * Debug ID counter for tracing. 37a25e21f0SDavid Howells */ 38a25e21f0SDavid Howells extern atomic_t rxrpc_debug_id; 39a25e21f0SDavid Howells 40d001648eSDavid Howells typedef void (*rxrpc_notify_rx_t)(struct sock *, struct rxrpc_call *, 41d001648eSDavid Howells unsigned long); 42e833251aSDavid Howells typedef void (*rxrpc_notify_end_tx_t)(struct sock *, struct rxrpc_call *, 43e833251aSDavid Howells unsigned long); 4400e90712SDavid Howells typedef void (*rxrpc_notify_new_call_t)(struct sock *, struct rxrpc_call *, 4500e90712SDavid Howells unsigned long); 4600e90712SDavid Howells typedef void (*rxrpc_discard_new_call_t)(struct rxrpc_call *, unsigned long); 4700e90712SDavid Howells typedef void (*rxrpc_user_attach_call_t)(struct rxrpc_call *, unsigned long); 48651350d1SDavid Howells 49d001648eSDavid Howells void rxrpc_kernel_new_call_notification(struct socket *, 5000e90712SDavid Howells rxrpc_notify_new_call_t, 5100e90712SDavid Howells rxrpc_discard_new_call_t); 52cd2cf63aSJoe Perches struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *, 53651350d1SDavid Howells struct sockaddr_rxrpc *, 54651350d1SDavid Howells struct key *, 55651350d1SDavid Howells unsigned long, 56e754eba6SDavid Howells s64, 57d001648eSDavid Howells gfp_t, 58a68f4a27SDavid Howells rxrpc_notify_rx_t, 59a25e21f0SDavid Howells bool, 60a25e21f0SDavid Howells unsigned int); 614de48af6SDavid Howells int rxrpc_kernel_send_data(struct socket *, struct rxrpc_call *, 62e833251aSDavid Howells struct msghdr *, size_t, 63e833251aSDavid Howells rxrpc_notify_end_tx_t); 64d001648eSDavid Howells int rxrpc_kernel_recv_data(struct socket *, struct rxrpc_call *, 65eb9950ebSDavid Howells struct iov_iter *, bool, u32 *, u16 *); 6684a4c09cSDavid Howells bool rxrpc_kernel_abort_call(struct socket *, struct rxrpc_call *, 675a42976dSDavid Howells u32, int, const char *); 684de48af6SDavid Howells void rxrpc_kernel_end_call(struct socket *, struct rxrpc_call *); 698324f0bcSDavid Howells void rxrpc_kernel_get_peer(struct socket *, struct rxrpc_call *, 708324f0bcSDavid Howells struct sockaddr_rxrpc *); 71f4d15fb6SDavid Howells u64 rxrpc_kernel_get_rtt(struct socket *, struct rxrpc_call *); 7200e90712SDavid Howells int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t, 73a25e21f0SDavid Howells rxrpc_user_attach_call_t, unsigned long, gfp_t, 74a25e21f0SDavid Howells unsigned int); 75e754eba6SDavid Howells void rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64); 76c038a58cSDavid Howells int rxrpc_kernel_retry_call(struct socket *, struct rxrpc_call *, 77c038a58cSDavid Howells struct sockaddr_rxrpc *, struct key *); 78c038a58cSDavid Howells int rxrpc_kernel_check_call(struct socket *, struct rxrpc_call *, 79c038a58cSDavid Howells enum rxrpc_call_completion *, u32 *); 80f4d15fb6SDavid Howells u32 rxrpc_kernel_check_life(struct socket *, struct rxrpc_call *); 81*e908bcf4SDavid Howells u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *); 822070a3e4SDavid Howells bool rxrpc_kernel_get_reply_time(struct socket *, struct rxrpc_call *, 832070a3e4SDavid Howells ktime_t *); 84651350d1SDavid Howells 8517926a79SDavid Howells #endif /* _NET_RXRPC_H */ 86