xref: /openbmc/linux/include/net/af_rxrpc.h (revision e138aa7d3271ac1b0690ae2c9b04d51468dce1d6)
12874c5fdSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
2651350d1SDavid Howells /* RxRPC kernel service interface definitions
317926a79SDavid Howells  *
4651350d1SDavid Howells  * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
517926a79SDavid Howells  * Written by David Howells (dhowells@redhat.com)
617926a79SDavid Howells  */
717926a79SDavid Howells 
817926a79SDavid Howells #ifndef _NET_RXRPC_H
917926a79SDavid Howells #define _NET_RXRPC_H
1017926a79SDavid Howells 
1117926a79SDavid Howells #include <linux/rxrpc.h>
122070a3e4SDavid Howells #include <linux/ktime.h>
1317926a79SDavid Howells 
144de48af6SDavid Howells struct key;
154de48af6SDavid Howells struct sock;
164de48af6SDavid Howells struct socket;
17651350d1SDavid Howells struct rxrpc_call;
18651350d1SDavid Howells 
19*e138aa7dSDavid Howells enum rxrpc_interruptibility {
20*e138aa7dSDavid Howells 	RXRPC_INTERRUPTIBLE,	/* Call is interruptible */
21*e138aa7dSDavid Howells 	RXRPC_PREINTERRUPTIBLE,	/* Call can be cancelled whilst waiting for a slot */
22*e138aa7dSDavid Howells 	RXRPC_UNINTERRUPTIBLE,	/* Call should not be interruptible at all */
23*e138aa7dSDavid Howells };
24*e138aa7dSDavid Howells 
25c038a58cSDavid Howells /*
26a25e21f0SDavid Howells  * Debug ID counter for tracing.
27a25e21f0SDavid Howells  */
28a25e21f0SDavid Howells extern atomic_t rxrpc_debug_id;
29a25e21f0SDavid Howells 
30d001648eSDavid Howells typedef void (*rxrpc_notify_rx_t)(struct sock *, struct rxrpc_call *,
31d001648eSDavid Howells 				  unsigned long);
32e833251aSDavid Howells typedef void (*rxrpc_notify_end_tx_t)(struct sock *, struct rxrpc_call *,
33e833251aSDavid Howells 				      unsigned long);
3400e90712SDavid Howells typedef void (*rxrpc_notify_new_call_t)(struct sock *, struct rxrpc_call *,
3500e90712SDavid Howells 					unsigned long);
3600e90712SDavid Howells typedef void (*rxrpc_discard_new_call_t)(struct rxrpc_call *, unsigned long);
3700e90712SDavid Howells typedef void (*rxrpc_user_attach_call_t)(struct rxrpc_call *, unsigned long);
38651350d1SDavid Howells 
39d001648eSDavid Howells void rxrpc_kernel_new_call_notification(struct socket *,
4000e90712SDavid Howells 					rxrpc_notify_new_call_t,
4100e90712SDavid Howells 					rxrpc_discard_new_call_t);
42cd2cf63aSJoe Perches struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *,
43651350d1SDavid Howells 					   struct sockaddr_rxrpc *,
44651350d1SDavid Howells 					   struct key *,
45651350d1SDavid Howells 					   unsigned long,
46e754eba6SDavid Howells 					   s64,
47d001648eSDavid Howells 					   gfp_t,
48a68f4a27SDavid Howells 					   rxrpc_notify_rx_t,
49a25e21f0SDavid Howells 					   bool,
50*e138aa7dSDavid Howells 					   enum rxrpc_interruptibility,
51a25e21f0SDavid Howells 					   unsigned int);
524de48af6SDavid Howells int rxrpc_kernel_send_data(struct socket *, struct rxrpc_call *,
53e833251aSDavid Howells 			   struct msghdr *, size_t,
54e833251aSDavid Howells 			   rxrpc_notify_end_tx_t);
55d001648eSDavid Howells int rxrpc_kernel_recv_data(struct socket *, struct rxrpc_call *,
56eb9950ebSDavid Howells 			   struct iov_iter *, bool, u32 *, u16 *);
5784a4c09cSDavid Howells bool rxrpc_kernel_abort_call(struct socket *, struct rxrpc_call *,
585a42976dSDavid Howells 			     u32, int, const char *);
594de48af6SDavid Howells void rxrpc_kernel_end_call(struct socket *, struct rxrpc_call *);
608324f0bcSDavid Howells void rxrpc_kernel_get_peer(struct socket *, struct rxrpc_call *,
618324f0bcSDavid Howells 			   struct sockaddr_rxrpc *);
62f4d15fb6SDavid Howells u64 rxrpc_kernel_get_rtt(struct socket *, struct rxrpc_call *);
6300e90712SDavid Howells int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t,
64a25e21f0SDavid Howells 			       rxrpc_user_attach_call_t, unsigned long, gfp_t,
65a25e21f0SDavid Howells 			       unsigned int);
66e754eba6SDavid Howells void rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64);
674611da30SMarc Dionne bool rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *,
684611da30SMarc Dionne 			     u32 *);
697150ceaaSDavid Howells void rxrpc_kernel_probe_life(struct socket *, struct rxrpc_call *);
70e908bcf4SDavid Howells u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *);
712070a3e4SDavid Howells bool rxrpc_kernel_get_reply_time(struct socket *, struct rxrpc_call *,
722070a3e4SDavid Howells 				 ktime_t *);
734611da30SMarc Dionne bool rxrpc_kernel_call_is_complete(struct rxrpc_call *);
74bbd172e3SDavid Howells void rxrpc_kernel_set_max_life(struct socket *, struct rxrpc_call *,
75bbd172e3SDavid Howells 			       unsigned long);
76651350d1SDavid Howells 
7717926a79SDavid Howells #endif /* _NET_RXRPC_H */
78