18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/* RxRPC kernel service interface definitions
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
58c2ecf20Sopenharmony_ci * Written by David Howells (dhowells@redhat.com)
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef _NET_RXRPC_H
98c2ecf20Sopenharmony_ci#define _NET_RXRPC_H
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <linux/rxrpc.h>
128c2ecf20Sopenharmony_ci#include <linux/ktime.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_cistruct key;
158c2ecf20Sopenharmony_cistruct sock;
168c2ecf20Sopenharmony_cistruct socket;
178c2ecf20Sopenharmony_cistruct rxrpc_call;
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_cienum rxrpc_interruptibility {
208c2ecf20Sopenharmony_ci	RXRPC_INTERRUPTIBLE,	/* Call is interruptible */
218c2ecf20Sopenharmony_ci	RXRPC_PREINTERRUPTIBLE,	/* Call can be cancelled whilst waiting for a slot */
228c2ecf20Sopenharmony_ci	RXRPC_UNINTERRUPTIBLE,	/* Call should not be interruptible at all */
238c2ecf20Sopenharmony_ci};
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/*
268c2ecf20Sopenharmony_ci * Debug ID counter for tracing.
278c2ecf20Sopenharmony_ci */
288c2ecf20Sopenharmony_ciextern atomic_t rxrpc_debug_id;
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_citypedef void (*rxrpc_notify_rx_t)(struct sock *, struct rxrpc_call *,
318c2ecf20Sopenharmony_ci				  unsigned long);
328c2ecf20Sopenharmony_citypedef void (*rxrpc_notify_end_tx_t)(struct sock *, struct rxrpc_call *,
338c2ecf20Sopenharmony_ci				      unsigned long);
348c2ecf20Sopenharmony_citypedef void (*rxrpc_notify_new_call_t)(struct sock *, struct rxrpc_call *,
358c2ecf20Sopenharmony_ci					unsigned long);
368c2ecf20Sopenharmony_citypedef void (*rxrpc_discard_new_call_t)(struct rxrpc_call *, unsigned long);
378c2ecf20Sopenharmony_citypedef void (*rxrpc_user_attach_call_t)(struct rxrpc_call *, unsigned long);
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_civoid rxrpc_kernel_new_call_notification(struct socket *,
408c2ecf20Sopenharmony_ci					rxrpc_notify_new_call_t,
418c2ecf20Sopenharmony_ci					rxrpc_discard_new_call_t);
428c2ecf20Sopenharmony_cistruct rxrpc_call *rxrpc_kernel_begin_call(struct socket *,
438c2ecf20Sopenharmony_ci					   struct sockaddr_rxrpc *,
448c2ecf20Sopenharmony_ci					   struct key *,
458c2ecf20Sopenharmony_ci					   unsigned long,
468c2ecf20Sopenharmony_ci					   s64,
478c2ecf20Sopenharmony_ci					   gfp_t,
488c2ecf20Sopenharmony_ci					   rxrpc_notify_rx_t,
498c2ecf20Sopenharmony_ci					   bool,
508c2ecf20Sopenharmony_ci					   enum rxrpc_interruptibility,
518c2ecf20Sopenharmony_ci					   unsigned int);
528c2ecf20Sopenharmony_ciint rxrpc_kernel_send_data(struct socket *, struct rxrpc_call *,
538c2ecf20Sopenharmony_ci			   struct msghdr *, size_t,
548c2ecf20Sopenharmony_ci			   rxrpc_notify_end_tx_t);
558c2ecf20Sopenharmony_ciint rxrpc_kernel_recv_data(struct socket *, struct rxrpc_call *,
568c2ecf20Sopenharmony_ci			   struct iov_iter *, bool, u32 *, u16 *);
578c2ecf20Sopenharmony_cibool rxrpc_kernel_abort_call(struct socket *, struct rxrpc_call *,
588c2ecf20Sopenharmony_ci			     u32, int, const char *);
598c2ecf20Sopenharmony_civoid rxrpc_kernel_end_call(struct socket *, struct rxrpc_call *);
608c2ecf20Sopenharmony_civoid rxrpc_kernel_get_peer(struct socket *, struct rxrpc_call *,
618c2ecf20Sopenharmony_ci			   struct sockaddr_rxrpc *);
628c2ecf20Sopenharmony_cibool rxrpc_kernel_get_srtt(struct socket *, struct rxrpc_call *, u32 *);
638c2ecf20Sopenharmony_ciint rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t,
648c2ecf20Sopenharmony_ci			       rxrpc_user_attach_call_t, unsigned long, gfp_t,
658c2ecf20Sopenharmony_ci			       unsigned int);
668c2ecf20Sopenharmony_civoid rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64);
678c2ecf20Sopenharmony_cibool rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *);
688c2ecf20Sopenharmony_ciu32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *);
698c2ecf20Sopenharmony_cibool rxrpc_kernel_get_reply_time(struct socket *, struct rxrpc_call *,
708c2ecf20Sopenharmony_ci				 ktime_t *);
718c2ecf20Sopenharmony_cibool rxrpc_kernel_call_is_complete(struct rxrpc_call *);
728c2ecf20Sopenharmony_civoid rxrpc_kernel_set_max_life(struct socket *, struct rxrpc_call *,
738c2ecf20Sopenharmony_ci			       unsigned long);
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ciint rxrpc_sock_set_min_security_level(struct sock *sk, unsigned int val);
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci#endif /* _NET_RXRPC_H */
78