af_rxrpc.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /* RxRPC kernel service interface definitions
  3. *
  4. * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
  5. * Written by David Howells (dhowells@redhat.com)
  6. */
  7. #ifndef _NET_RXRPC_H
  8. #define _NET_RXRPC_H
  9. #include <linux/rxrpc.h>
  10. #include <linux/ktime.h>
  11. struct key;
  12. struct sock;
  13. struct socket;
  14. struct rxrpc_call;
  15. struct rxrpc_peer;
  16. enum rxrpc_abort_reason;
  17. enum rxrpc_interruptibility {
  18. RXRPC_INTERRUPTIBLE, /* Call is interruptible */
  19. RXRPC_PREINTERRUPTIBLE, /* Call can be cancelled whilst waiting for a slot */
  20. RXRPC_UNINTERRUPTIBLE, /* Call should not be interruptible at all */
  21. };
  22. /*
  23. * Debug ID counter for tracing.
  24. */
  25. extern atomic_t rxrpc_debug_id;
  26. typedef void (*rxrpc_notify_rx_t)(struct sock *, struct rxrpc_call *,
  27. unsigned long);
  28. typedef void (*rxrpc_notify_end_tx_t)(struct sock *, struct rxrpc_call *,
  29. unsigned long);
  30. typedef void (*rxrpc_notify_new_call_t)(struct sock *, struct rxrpc_call *,
  31. unsigned long);
  32. typedef void (*rxrpc_discard_new_call_t)(struct rxrpc_call *, unsigned long);
  33. typedef void (*rxrpc_user_attach_call_t)(struct rxrpc_call *, unsigned long);
  34. void rxrpc_kernel_new_call_notification(struct socket *,
  35. rxrpc_notify_new_call_t,
  36. rxrpc_discard_new_call_t);
  37. struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *sock,
  38. struct rxrpc_peer *peer,
  39. struct key *key,
  40. unsigned long user_call_ID,
  41. s64 tx_total_len,
  42. u32 hard_timeout,
  43. gfp_t gfp,
  44. rxrpc_notify_rx_t notify_rx,
  45. u16 service_id,
  46. bool upgrade,
  47. enum rxrpc_interruptibility interruptibility,
  48. unsigned int debug_id);
  49. int rxrpc_kernel_send_data(struct socket *, struct rxrpc_call *,
  50. struct msghdr *, size_t,
  51. rxrpc_notify_end_tx_t);
  52. int rxrpc_kernel_recv_data(struct socket *, struct rxrpc_call *,
  53. struct iov_iter *, size_t *, bool, u32 *, u16 *);
  54. bool rxrpc_kernel_abort_call(struct socket *, struct rxrpc_call *,
  55. u32, int, enum rxrpc_abort_reason);
  56. void rxrpc_kernel_shutdown_call(struct socket *sock, struct rxrpc_call *call);
  57. void rxrpc_kernel_put_call(struct socket *sock, struct rxrpc_call *call);
  58. struct rxrpc_peer *rxrpc_kernel_lookup_peer(struct socket *sock,
  59. struct sockaddr_rxrpc *srx, gfp_t gfp);
  60. void rxrpc_kernel_put_peer(struct rxrpc_peer *peer);
  61. struct rxrpc_peer *rxrpc_kernel_get_peer(struct rxrpc_peer *peer);
  62. struct rxrpc_peer *rxrpc_kernel_get_call_peer(struct socket *sock, struct rxrpc_call *call);
  63. const struct sockaddr_rxrpc *rxrpc_kernel_remote_srx(const struct rxrpc_peer *peer);
  64. const struct sockaddr *rxrpc_kernel_remote_addr(const struct rxrpc_peer *peer);
  65. unsigned int rxrpc_kernel_get_srtt(const struct rxrpc_peer *);
  66. int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t,
  67. rxrpc_user_attach_call_t, unsigned long, gfp_t,
  68. unsigned int);
  69. void rxrpc_kernel_set_tx_length(struct socket *, struct rxrpc_call *, s64);
  70. bool rxrpc_kernel_check_life(const struct socket *, const struct rxrpc_call *);
  71. u32 rxrpc_kernel_get_epoch(struct socket *, struct rxrpc_call *);
  72. void rxrpc_kernel_set_max_life(struct socket *, struct rxrpc_call *,
  73. unsigned long);
  74. int rxrpc_sock_set_min_security_level(struct sock *sk, unsigned int val);
  75. int rxrpc_sock_set_security_keyring(struct sock *, struct key *);
  76. #endif /* _NET_RXRPC_H */