xref: /openbmc/linux/include/net/af_rxrpc.h (revision 75bfdbf2fca372e2709bcaa43e8cf1147766ae96)
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 
19e138aa7dSDavid Howells enum rxrpc_interruptibility {
20e138aa7dSDavid Howells 	RXRPC_INTERRUPTIBLE,	/* Call is interruptible */
21e138aa7dSDavid Howells 	RXRPC_PREINTERRUPTIBLE,	/* Call can be cancelled whilst waiting for a slot */
22e138aa7dSDavid Howells 	RXRPC_UNINTERRUPTIBLE,	/* Call should not be interruptible at all */
23e138aa7dSDavid Howells };
24e138aa7dSDavid 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,
50e138aa7dSDavid 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 *,
56f105da1aSDavid Howells 			   struct iov_iter *, size_t *, 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 *);
621d4adfafSDavid Howells bool rxrpc_kernel_get_srtt(struct socket *, struct rxrpc_call *, u32 *);
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);
677d7587dbSDavid Howells bool rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *);
68e908bcf4SDavid Howells u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *);
694611da30SMarc Dionne bool rxrpc_kernel_call_is_complete(struct rxrpc_call *);
70bbd172e3SDavid Howells void rxrpc_kernel_set_max_life(struct socket *, struct rxrpc_call *,
71bbd172e3SDavid Howells 			       unsigned long);
72651350d1SDavid Howells 
73298cd88aSChristoph Hellwig int rxrpc_sock_set_min_security_level(struct sock *sk, unsigned int val);
74*75bfdbf2SDavid Howells int rxrpc_sock_set_security_keyring(struct sock *, struct key *);
75298cd88aSChristoph Hellwig 
7617926a79SDavid Howells #endif /* _NET_RXRPC_H */
77