xref: /openbmc/linux/include/net/af_rxrpc.h (revision 1ac731c529cd4d6adbce134754b51ff7d822b145)
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;
1857af281eSDavid Howells enum rxrpc_abort_reason;
19651350d1SDavid Howells 
20e138aa7dSDavid Howells enum rxrpc_interruptibility {
21e138aa7dSDavid Howells 	RXRPC_INTERRUPTIBLE,	/* Call is interruptible */
22e138aa7dSDavid Howells 	RXRPC_PREINTERRUPTIBLE,	/* Call can be cancelled whilst waiting for a slot */
23e138aa7dSDavid Howells 	RXRPC_UNINTERRUPTIBLE,	/* Call should not be interruptible at all */
24e138aa7dSDavid Howells };
25e138aa7dSDavid Howells 
26c038a58cSDavid Howells /*
27a25e21f0SDavid Howells  * Debug ID counter for tracing.
28a25e21f0SDavid Howells  */
29a25e21f0SDavid Howells extern atomic_t rxrpc_debug_id;
30a25e21f0SDavid Howells 
31d001648eSDavid Howells typedef void (*rxrpc_notify_rx_t)(struct sock *, struct rxrpc_call *,
32d001648eSDavid Howells 				  unsigned long);
33e833251aSDavid Howells typedef void (*rxrpc_notify_end_tx_t)(struct sock *, struct rxrpc_call *,
34e833251aSDavid Howells 				      unsigned long);
3500e90712SDavid Howells typedef void (*rxrpc_notify_new_call_t)(struct sock *, struct rxrpc_call *,
3600e90712SDavid Howells 					unsigned long);
3700e90712SDavid Howells typedef void (*rxrpc_discard_new_call_t)(struct rxrpc_call *, unsigned long);
3800e90712SDavid Howells typedef void (*rxrpc_user_attach_call_t)(struct rxrpc_call *, unsigned long);
39651350d1SDavid Howells 
40d001648eSDavid Howells void rxrpc_kernel_new_call_notification(struct socket *,
4100e90712SDavid Howells 					rxrpc_notify_new_call_t,
4200e90712SDavid Howells 					rxrpc_discard_new_call_t);
43*db099c62SDavid Howells struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *sock,
44*db099c62SDavid Howells 					   struct sockaddr_rxrpc *srx,
45*db099c62SDavid Howells 					   struct key *key,
46*db099c62SDavid Howells 					   unsigned long user_call_ID,
47*db099c62SDavid Howells 					   s64 tx_total_len,
48*db099c62SDavid Howells 					   u32 hard_timeout,
49*db099c62SDavid Howells 					   gfp_t gfp,
50*db099c62SDavid Howells 					   rxrpc_notify_rx_t notify_rx,
51*db099c62SDavid Howells 					   bool upgrade,
52*db099c62SDavid Howells 					   enum rxrpc_interruptibility interruptibility,
53*db099c62SDavid Howells 					   unsigned int debug_id);
544de48af6SDavid Howells int rxrpc_kernel_send_data(struct socket *, struct rxrpc_call *,
55e833251aSDavid Howells 			   struct msghdr *, size_t,
56e833251aSDavid Howells 			   rxrpc_notify_end_tx_t);
57d001648eSDavid Howells int rxrpc_kernel_recv_data(struct socket *, struct rxrpc_call *,
58f105da1aSDavid Howells 			   struct iov_iter *, size_t *, bool, u32 *, u16 *);
5984a4c09cSDavid Howells bool rxrpc_kernel_abort_call(struct socket *, struct rxrpc_call *,
6057af281eSDavid Howells 			     u32, int, enum rxrpc_abort_reason);
61e0416e7dSDavid Howells void rxrpc_kernel_shutdown_call(struct socket *sock, struct rxrpc_call *call);
62e0416e7dSDavid Howells void rxrpc_kernel_put_call(struct socket *sock, struct rxrpc_call *call);
638324f0bcSDavid Howells void rxrpc_kernel_get_peer(struct socket *, struct rxrpc_call *,
648324f0bcSDavid Howells 			   struct sockaddr_rxrpc *);
651d4adfafSDavid Howells bool rxrpc_kernel_get_srtt(struct socket *, struct rxrpc_call *, u32 *);
6600e90712SDavid Howells int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t,
67a25e21f0SDavid Howells 			       rxrpc_user_attach_call_t, unsigned long, gfp_t,
68a25e21f0SDavid Howells 			       unsigned int);
69e754eba6SDavid Howells void rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64);
707d7587dbSDavid Howells bool rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *);
71e908bcf4SDavid Howells u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *);
72bbd172e3SDavid Howells void rxrpc_kernel_set_max_life(struct socket *, struct rxrpc_call *,
73bbd172e3SDavid Howells 			       unsigned long);
74651350d1SDavid Howells 
75298cd88aSChristoph Hellwig int rxrpc_sock_set_min_security_level(struct sock *sk, unsigned int val);
7675bfdbf2SDavid Howells int rxrpc_sock_set_security_keyring(struct sock *, struct key *);
77298cd88aSChristoph Hellwig 
7817926a79SDavid Howells #endif /* _NET_RXRPC_H */
79