blob: de587948042a4ab6ce9e00dac021ce492a026621 [file] [log] [blame]
David Howells651350d2007-04-26 15:50:17 -07001/* RxRPC kernel service interface definitions
David Howells17926a72007-04-26 15:48:28 -07002 *
David Howells651350d2007-04-26 15:50:17 -07003 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
David Howells17926a72007-04-26 15:48:28 -07004 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _NET_RXRPC_H
13#define _NET_RXRPC_H
14
15#include <linux/rxrpc.h>
David Howells2070a3e2018-10-04 09:42:29 +010016#include <linux/ktime.h>
David Howells17926a72007-04-26 15:48:28 -070017
David Howells4de48af2016-08-30 12:00:48 +010018struct key;
19struct sock;
20struct socket;
David Howells651350d2007-04-26 15:50:17 -070021struct rxrpc_call;
22
David Howellsc038a582017-08-29 10:19:01 +010023/*
24 * Call completion condition (state == RXRPC_CALL_COMPLETE).
25 */
26enum rxrpc_call_completion {
27 RXRPC_CALL_SUCCEEDED, /* - Normal termination */
28 RXRPC_CALL_REMOTELY_ABORTED, /* - call aborted by peer */
29 RXRPC_CALL_LOCALLY_ABORTED, /* - call aborted locally on error or close */
30 RXRPC_CALL_LOCAL_ERROR, /* - call failed due to local error */
31 RXRPC_CALL_NETWORK_ERROR, /* - call terminated by network error */
32 NR__RXRPC_CALL_COMPLETIONS
33};
34
David Howellsa25e21f2018-03-27 23:03:00 +010035/*
36 * Debug ID counter for tracing.
37 */
38extern atomic_t rxrpc_debug_id;
39
David Howellsd0016482016-08-30 20:42:14 +010040typedef void (*rxrpc_notify_rx_t)(struct sock *, struct rxrpc_call *,
41 unsigned long);
David Howellse8332512017-08-29 10:18:56 +010042typedef void (*rxrpc_notify_end_tx_t)(struct sock *, struct rxrpc_call *,
43 unsigned long);
David Howells00e90712016-09-08 11:10:12 +010044typedef void (*rxrpc_notify_new_call_t)(struct sock *, struct rxrpc_call *,
45 unsigned long);
46typedef void (*rxrpc_discard_new_call_t)(struct rxrpc_call *, unsigned long);
47typedef void (*rxrpc_user_attach_call_t)(struct rxrpc_call *, unsigned long);
David Howells651350d2007-04-26 15:50:17 -070048
David Howellsd0016482016-08-30 20:42:14 +010049void rxrpc_kernel_new_call_notification(struct socket *,
David Howells00e90712016-09-08 11:10:12 +010050 rxrpc_notify_new_call_t,
51 rxrpc_discard_new_call_t);
Joe Perchescd2cf632013-07-31 17:31:34 -070052struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *,
53 struct sockaddr_rxrpc *,
54 struct key *,
55 unsigned long,
David Howellse754eba2017-06-07 12:40:03 +010056 s64,
David Howellsd0016482016-08-30 20:42:14 +010057 gfp_t,
David Howellsa68f4a22017-10-18 11:36:39 +010058 rxrpc_notify_rx_t,
David Howellsa25e21f2018-03-27 23:03:00 +010059 bool,
60 unsigned int);
David Howells4de48af2016-08-30 12:00:48 +010061int rxrpc_kernel_send_data(struct socket *, struct rxrpc_call *,
David Howellse8332512017-08-29 10:18:56 +010062 struct msghdr *, size_t,
63 rxrpc_notify_end_tx_t);
David Howellsd0016482016-08-30 20:42:14 +010064int rxrpc_kernel_recv_data(struct socket *, struct rxrpc_call *,
David Howellseb9950e2018-08-03 17:06:56 +010065 struct iov_iter *, bool, u32 *, u16 *);
David Howells84a4c092017-04-06 10:11:59 +010066bool rxrpc_kernel_abort_call(struct socket *, struct rxrpc_call *,
David Howells5a429762016-09-06 22:19:51 +010067 u32, int, const char *);
David Howells4de48af2016-08-30 12:00:48 +010068void rxrpc_kernel_end_call(struct socket *, struct rxrpc_call *);
David Howells8324f0b2016-08-30 09:49:29 +010069void rxrpc_kernel_get_peer(struct socket *, struct rxrpc_call *,
70 struct sockaddr_rxrpc *);
David Howellsf4d15fb2017-10-18 11:07:31 +010071u64 rxrpc_kernel_get_rtt(struct socket *, struct rxrpc_call *);
David Howells00e90712016-09-08 11:10:12 +010072int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t,
David Howellsa25e21f2018-03-27 23:03:00 +010073 rxrpc_user_attach_call_t, unsigned long, gfp_t,
74 unsigned int);
David Howellse754eba2017-06-07 12:40:03 +010075void rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64);
David Howellsc038a582017-08-29 10:19:01 +010076int rxrpc_kernel_retry_call(struct socket *, struct rxrpc_call *,
77 struct sockaddr_rxrpc *, struct key *);
78int rxrpc_kernel_check_call(struct socket *, struct rxrpc_call *,
79 enum rxrpc_call_completion *, u32 *);
David Howellsf4d15fb2017-10-18 11:07:31 +010080u32 rxrpc_kernel_check_life(struct socket *, struct rxrpc_call *);
David Howellse908bcf2018-10-04 09:54:29 +010081u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *);
David Howells2070a3e2018-10-04 09:42:29 +010082bool rxrpc_kernel_get_reply_time(struct socket *, struct rxrpc_call *,
83 ktime_t *);
David Howells651350d2007-04-26 15:50:17 -070084
David Howells17926a72007-04-26 15:48:28 -070085#endif /* _NET_RXRPC_H */