blob: 1abae3c340a5fba6a1b26224ce6c3e35f108760f [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 Howellsc038a582017-08-29 10:19:01 +010019/*
David Howellsa25e21f2018-03-27 23:03:00 +010020 * Debug ID counter for tracing.
21 */
22extern atomic_t rxrpc_debug_id;
23
David Howellsd0016482016-08-30 20:42:14 +010024typedef void (*rxrpc_notify_rx_t)(struct sock *, struct rxrpc_call *,
25 unsigned long);
David Howellse8332512017-08-29 10:18:56 +010026typedef void (*rxrpc_notify_end_tx_t)(struct sock *, struct rxrpc_call *,
27 unsigned long);
David Howells00e90712016-09-08 11:10:12 +010028typedef void (*rxrpc_notify_new_call_t)(struct sock *, struct rxrpc_call *,
29 unsigned long);
30typedef void (*rxrpc_discard_new_call_t)(struct rxrpc_call *, unsigned long);
31typedef void (*rxrpc_user_attach_call_t)(struct rxrpc_call *, unsigned long);
David Howells651350d2007-04-26 15:50:17 -070032
David Howellsd0016482016-08-30 20:42:14 +010033void rxrpc_kernel_new_call_notification(struct socket *,
David Howells00e90712016-09-08 11:10:12 +010034 rxrpc_notify_new_call_t,
35 rxrpc_discard_new_call_t);
Joe Perchescd2cf632013-07-31 17:31:34 -070036struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *,
37 struct sockaddr_rxrpc *,
38 struct key *,
39 unsigned long,
David Howellse754eba2017-06-07 12:40:03 +010040 s64,
David Howellsd0016482016-08-30 20:42:14 +010041 gfp_t,
David Howellsa68f4a22017-10-18 11:36:39 +010042 rxrpc_notify_rx_t,
David Howellsa25e21f2018-03-27 23:03:00 +010043 bool,
David Howellsb960a342019-05-09 08:21:21 +010044 bool,
David Howellsa25e21f2018-03-27 23:03:00 +010045 unsigned int);
David Howells4de48af2016-08-30 12:00:48 +010046int rxrpc_kernel_send_data(struct socket *, struct rxrpc_call *,
David Howellse8332512017-08-29 10:18:56 +010047 struct msghdr *, size_t,
48 rxrpc_notify_end_tx_t);
David Howellsd0016482016-08-30 20:42:14 +010049int rxrpc_kernel_recv_data(struct socket *, struct rxrpc_call *,
David Howellseb9950e2018-08-03 17:06:56 +010050 struct iov_iter *, bool, u32 *, u16 *);
David Howells84a4c092017-04-06 10:11:59 +010051bool rxrpc_kernel_abort_call(struct socket *, struct rxrpc_call *,
David Howells5a429762016-09-06 22:19:51 +010052 u32, int, const char *);
David Howells4de48af2016-08-30 12:00:48 +010053void rxrpc_kernel_end_call(struct socket *, struct rxrpc_call *);
David Howells8324f0b2016-08-30 09:49:29 +010054void rxrpc_kernel_get_peer(struct socket *, struct rxrpc_call *,
55 struct sockaddr_rxrpc *);
David Howellsf4d15fb2017-10-18 11:07:31 +010056u64 rxrpc_kernel_get_rtt(struct socket *, struct rxrpc_call *);
David Howells00e90712016-09-08 11:10:12 +010057int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t,
David Howellsa25e21f2018-03-27 23:03:00 +010058 rxrpc_user_attach_call_t, unsigned long, gfp_t,
59 unsigned int);
David Howellse754eba2017-06-07 12:40:03 +010060void rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64);
Marc Dionne4611da32019-04-12 16:33:47 +010061bool rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *,
62 u32 *);
David Howells7150cea2018-11-12 22:33:22 +000063void rxrpc_kernel_probe_life(struct socket *, struct rxrpc_call *);
David Howellse908bcf2018-10-04 09:54:29 +010064u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *);
David Howells2070a3e2018-10-04 09:42:29 +010065bool rxrpc_kernel_get_reply_time(struct socket *, struct rxrpc_call *,
66 ktime_t *);
Marc Dionne4611da32019-04-12 16:33:47 +010067bool rxrpc_kernel_call_is_complete(struct rxrpc_call *);
David Howellsbbd172e2019-05-16 13:50:31 +010068void rxrpc_kernel_set_max_life(struct socket *, struct rxrpc_call *,
69 unsigned long);
David Howells651350d2007-04-26 15:50:17 -070070
David Howells17926a72007-04-26 15:48:28 -070071#endif /* _NET_RXRPC_H */