blob: 04e97bab6f28b9eff4d1efba213c667b9ad596af [file] [log] [blame]
Thomas Gleixner2874c5f2019-05-27 08:55:01 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
David Howells651350d2007-04-26 15:50:17 -07002/* RxRPC kernel service interface definitions
David Howells17926a72007-04-26 15:48:28 -07003 *
David Howells651350d2007-04-26 15:50:17 -07004 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
David Howells17926a72007-04-26 15:48:28 -07005 * Written by David Howells (dhowells@redhat.com)
David Howells17926a72007-04-26 15:48:28 -07006 */
7
8#ifndef _NET_RXRPC_H
9#define _NET_RXRPC_H
10
11#include <linux/rxrpc.h>
David Howells2070a3e2018-10-04 09:42:29 +010012#include <linux/ktime.h>
David Howells17926a72007-04-26 15:48:28 -070013
David Howells4de48af2016-08-30 12:00:48 +010014struct key;
15struct sock;
16struct socket;
David Howells651350d2007-04-26 15:50:17 -070017struct rxrpc_call;
18
David Howellse138aa72020-03-13 09:22:09 +000019enum rxrpc_interruptibility {
20 RXRPC_INTERRUPTIBLE, /* Call is interruptible */
21 RXRPC_PREINTERRUPTIBLE, /* Call can be cancelled whilst waiting for a slot */
22 RXRPC_UNINTERRUPTIBLE, /* Call should not be interruptible at all */
23};
24
David Howellsc038a582017-08-29 10:19:01 +010025/*
David Howellsa25e21f2018-03-27 23:03:00 +010026 * Debug ID counter for tracing.
27 */
28extern atomic_t rxrpc_debug_id;
29
David Howellsd0016482016-08-30 20:42:14 +010030typedef void (*rxrpc_notify_rx_t)(struct sock *, struct rxrpc_call *,
31 unsigned long);
David Howellse8332512017-08-29 10:18:56 +010032typedef void (*rxrpc_notify_end_tx_t)(struct sock *, struct rxrpc_call *,
33 unsigned long);
David Howells00e90712016-09-08 11:10:12 +010034typedef void (*rxrpc_notify_new_call_t)(struct sock *, struct rxrpc_call *,
35 unsigned long);
36typedef void (*rxrpc_discard_new_call_t)(struct rxrpc_call *, unsigned long);
37typedef void (*rxrpc_user_attach_call_t)(struct rxrpc_call *, unsigned long);
David Howells651350d2007-04-26 15:50:17 -070038
David Howellsd0016482016-08-30 20:42:14 +010039void rxrpc_kernel_new_call_notification(struct socket *,
David Howells00e90712016-09-08 11:10:12 +010040 rxrpc_notify_new_call_t,
41 rxrpc_discard_new_call_t);
Joe Perchescd2cf632013-07-31 17:31:34 -070042struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *,
43 struct sockaddr_rxrpc *,
44 struct key *,
45 unsigned long,
David Howellse754eba2017-06-07 12:40:03 +010046 s64,
David Howellsd0016482016-08-30 20:42:14 +010047 gfp_t,
David Howellsa68f4a22017-10-18 11:36:39 +010048 rxrpc_notify_rx_t,
David Howellsa25e21f2018-03-27 23:03:00 +010049 bool,
David Howellse138aa72020-03-13 09:22:09 +000050 enum rxrpc_interruptibility,
David Howellsa25e21f2018-03-27 23:03:00 +010051 unsigned int);
David Howells4de48af2016-08-30 12:00:48 +010052int rxrpc_kernel_send_data(struct socket *, struct rxrpc_call *,
David Howellse8332512017-08-29 10:18:56 +010053 struct msghdr *, size_t,
54 rxrpc_notify_end_tx_t);
David Howellsd0016482016-08-30 20:42:14 +010055int rxrpc_kernel_recv_data(struct socket *, struct rxrpc_call *,
David Howellseb9950e2018-08-03 17:06:56 +010056 struct iov_iter *, bool, u32 *, u16 *);
David Howells84a4c092017-04-06 10:11:59 +010057bool rxrpc_kernel_abort_call(struct socket *, struct rxrpc_call *,
David Howells5a429762016-09-06 22:19:51 +010058 u32, int, const char *);
David Howells4de48af2016-08-30 12:00:48 +010059void rxrpc_kernel_end_call(struct socket *, struct rxrpc_call *);
David Howells8324f0b2016-08-30 09:49:29 +010060void rxrpc_kernel_get_peer(struct socket *, struct rxrpc_call *,
61 struct sockaddr_rxrpc *);
David Howellsf4d15fb2017-10-18 11:07:31 +010062u64 rxrpc_kernel_get_rtt(struct socket *, struct rxrpc_call *);
David Howells00e90712016-09-08 11:10:12 +010063int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t,
David Howellsa25e21f2018-03-27 23:03:00 +010064 rxrpc_user_attach_call_t, unsigned long, gfp_t,
65 unsigned int);
David Howellse754eba2017-06-07 12:40:03 +010066void rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64);
David Howells7d7587d2020-03-12 21:40:06 +000067bool rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *);
David Howellse908bcf2018-10-04 09:54:29 +010068u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *);
David Howells2070a3e2018-10-04 09:42:29 +010069bool rxrpc_kernel_get_reply_time(struct socket *, struct rxrpc_call *,
70 ktime_t *);
Marc Dionne4611da32019-04-12 16:33:47 +010071bool rxrpc_kernel_call_is_complete(struct rxrpc_call *);
David Howellsbbd172e2019-05-16 13:50:31 +010072void rxrpc_kernel_set_max_life(struct socket *, struct rxrpc_call *,
73 unsigned long);
David Howells651350d2007-04-26 15:50:17 -070074
David Howells17926a72007-04-26 15:48:28 -070075#endif /* _NET_RXRPC_H */