162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/* RxRPC kernel service interface definitions
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
562306a36Sopenharmony_ci * Written by David Howells (dhowells@redhat.com)
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef _NET_RXRPC_H
962306a36Sopenharmony_ci#define _NET_RXRPC_H
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#include <linux/rxrpc.h>
1262306a36Sopenharmony_ci#include <linux/ktime.h>
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_cistruct key;
1562306a36Sopenharmony_cistruct sock;
1662306a36Sopenharmony_cistruct socket;
1762306a36Sopenharmony_cistruct rxrpc_call;
1862306a36Sopenharmony_cienum rxrpc_abort_reason;
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_cienum rxrpc_interruptibility {
2162306a36Sopenharmony_ci	RXRPC_INTERRUPTIBLE,	/* Call is interruptible */
2262306a36Sopenharmony_ci	RXRPC_PREINTERRUPTIBLE,	/* Call can be cancelled whilst waiting for a slot */
2362306a36Sopenharmony_ci	RXRPC_UNINTERRUPTIBLE,	/* Call should not be interruptible at all */
2462306a36Sopenharmony_ci};
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci/*
2762306a36Sopenharmony_ci * Debug ID counter for tracing.
2862306a36Sopenharmony_ci */
2962306a36Sopenharmony_ciextern atomic_t rxrpc_debug_id;
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_citypedef void (*rxrpc_notify_rx_t)(struct sock *, struct rxrpc_call *,
3262306a36Sopenharmony_ci				  unsigned long);
3362306a36Sopenharmony_citypedef void (*rxrpc_notify_end_tx_t)(struct sock *, struct rxrpc_call *,
3462306a36Sopenharmony_ci				      unsigned long);
3562306a36Sopenharmony_citypedef void (*rxrpc_notify_new_call_t)(struct sock *, struct rxrpc_call *,
3662306a36Sopenharmony_ci					unsigned long);
3762306a36Sopenharmony_citypedef void (*rxrpc_discard_new_call_t)(struct rxrpc_call *, unsigned long);
3862306a36Sopenharmony_citypedef void (*rxrpc_user_attach_call_t)(struct rxrpc_call *, unsigned long);
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_civoid rxrpc_kernel_new_call_notification(struct socket *,
4162306a36Sopenharmony_ci					rxrpc_notify_new_call_t,
4262306a36Sopenharmony_ci					rxrpc_discard_new_call_t);
4362306a36Sopenharmony_cistruct rxrpc_call *rxrpc_kernel_begin_call(struct socket *sock,
4462306a36Sopenharmony_ci					   struct sockaddr_rxrpc *srx,
4562306a36Sopenharmony_ci					   struct key *key,
4662306a36Sopenharmony_ci					   unsigned long user_call_ID,
4762306a36Sopenharmony_ci					   s64 tx_total_len,
4862306a36Sopenharmony_ci					   u32 hard_timeout,
4962306a36Sopenharmony_ci					   gfp_t gfp,
5062306a36Sopenharmony_ci					   rxrpc_notify_rx_t notify_rx,
5162306a36Sopenharmony_ci					   bool upgrade,
5262306a36Sopenharmony_ci					   enum rxrpc_interruptibility interruptibility,
5362306a36Sopenharmony_ci					   unsigned int debug_id);
5462306a36Sopenharmony_ciint rxrpc_kernel_send_data(struct socket *, struct rxrpc_call *,
5562306a36Sopenharmony_ci			   struct msghdr *, size_t,
5662306a36Sopenharmony_ci			   rxrpc_notify_end_tx_t);
5762306a36Sopenharmony_ciint rxrpc_kernel_recv_data(struct socket *, struct rxrpc_call *,
5862306a36Sopenharmony_ci			   struct iov_iter *, size_t *, bool, u32 *, u16 *);
5962306a36Sopenharmony_cibool rxrpc_kernel_abort_call(struct socket *, struct rxrpc_call *,
6062306a36Sopenharmony_ci			     u32, int, enum rxrpc_abort_reason);
6162306a36Sopenharmony_civoid rxrpc_kernel_shutdown_call(struct socket *sock, struct rxrpc_call *call);
6262306a36Sopenharmony_civoid rxrpc_kernel_put_call(struct socket *sock, struct rxrpc_call *call);
6362306a36Sopenharmony_civoid rxrpc_kernel_get_peer(struct socket *, struct rxrpc_call *,
6462306a36Sopenharmony_ci			   struct sockaddr_rxrpc *);
6562306a36Sopenharmony_cibool rxrpc_kernel_get_srtt(struct socket *, struct rxrpc_call *, u32 *);
6662306a36Sopenharmony_ciint rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t,
6762306a36Sopenharmony_ci			       rxrpc_user_attach_call_t, unsigned long, gfp_t,
6862306a36Sopenharmony_ci			       unsigned int);
6962306a36Sopenharmony_civoid rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64);
7062306a36Sopenharmony_cibool rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *);
7162306a36Sopenharmony_ciu32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *);
7262306a36Sopenharmony_civoid rxrpc_kernel_set_max_life(struct socket *, struct rxrpc_call *,
7362306a36Sopenharmony_ci			       unsigned long);
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ciint rxrpc_sock_set_min_security_level(struct sock *sk, unsigned int val);
7662306a36Sopenharmony_ciint rxrpc_sock_set_security_keyring(struct sock *, struct key *);
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci#endif /* _NET_RXRPC_H */
79