logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

mptcp.h (3871B)


  1. /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
  2. #ifndef _MPTCP_H
  3. #define _MPTCP_H
  4. #include <netinet/in.h> /* for sockaddr_in and sockaddr_in6 */
  5. #include <sys/socket.h> /* for struct sockaddr */
  6. #include <linux/const.h>
  7. #include <linux/types.h>
  8. #include <linux/in.h> /* for sockaddr_in */
  9. #include <linux/in6.h> /* for sockaddr_in6 */
  10. #include <linux/socket.h> /* for sockaddr_storage and sa_family */
  11. #define MPTCP_SUBFLOW_FLAG_MCAP_REM _BITUL(0)
  12. #define MPTCP_SUBFLOW_FLAG_MCAP_LOC _BITUL(1)
  13. #define MPTCP_SUBFLOW_FLAG_JOIN_REM _BITUL(2)
  14. #define MPTCP_SUBFLOW_FLAG_JOIN_LOC _BITUL(3)
  15. #define MPTCP_SUBFLOW_FLAG_BKUP_REM _BITUL(4)
  16. #define MPTCP_SUBFLOW_FLAG_BKUP_LOC _BITUL(5)
  17. #define MPTCP_SUBFLOW_FLAG_FULLY_ESTABLISHED _BITUL(6)
  18. #define MPTCP_SUBFLOW_FLAG_CONNECTED _BITUL(7)
  19. #define MPTCP_SUBFLOW_FLAG_MAPVALID _BITUL(8)
  20. #define MPTCP_PM_CMD_GRP_NAME "mptcp_pm_cmds"
  21. #define MPTCP_PM_EV_GRP_NAME "mptcp_pm_events"
  22. #include <linux/mptcp_pm.h>
  23. #define MPTCP_INFO_FLAG_FALLBACK _BITUL(0)
  24. #define MPTCP_INFO_FLAG_REMOTE_KEY_RECEIVED _BITUL(1)
  25. #define MPTCP_PM_ADDR_FLAG_SIGNAL (1 << 0)
  26. #define MPTCP_PM_ADDR_FLAG_SUBFLOW (1 << 1)
  27. #define MPTCP_PM_ADDR_FLAG_BACKUP (1 << 2)
  28. #define MPTCP_PM_ADDR_FLAG_FULLMESH (1 << 3)
  29. #define MPTCP_PM_ADDR_FLAG_IMPLICIT (1 << 4)
  30. struct mptcp_info {
  31. __u8 mptcpi_subflows;
  32. __u8 mptcpi_add_addr_signal;
  33. __u8 mptcpi_add_addr_accepted;
  34. __u8 mptcpi_subflows_max;
  35. __u8 mptcpi_add_addr_signal_max;
  36. __u8 mptcpi_add_addr_accepted_max;
  37. __u32 mptcpi_flags;
  38. __u32 mptcpi_token;
  39. __u64 mptcpi_write_seq;
  40. __u64 mptcpi_snd_una;
  41. __u64 mptcpi_rcv_nxt;
  42. __u8 mptcpi_local_addr_used;
  43. __u8 mptcpi_local_addr_max;
  44. __u8 mptcpi_csum_enabled;
  45. __u32 mptcpi_retransmits;
  46. __u64 mptcpi_bytes_retrans;
  47. __u64 mptcpi_bytes_sent;
  48. __u64 mptcpi_bytes_received;
  49. __u64 mptcpi_bytes_acked;
  50. __u8 mptcpi_subflows_total;
  51. __u8 reserved[3];
  52. __u32 mptcpi_last_data_sent;
  53. __u32 mptcpi_last_data_recv;
  54. __u32 mptcpi_last_ack_recv;
  55. };
  56. /* MPTCP Reset reason codes, rfc8684 */
  57. #define MPTCP_RST_EUNSPEC 0
  58. #define MPTCP_RST_EMPTCP 1
  59. #define MPTCP_RST_ERESOURCE 2
  60. #define MPTCP_RST_EPROHIBIT 3
  61. #define MPTCP_RST_EWQ2BIG 4
  62. #define MPTCP_RST_EBADPERF 5
  63. #define MPTCP_RST_EMIDDLEBOX 6
  64. struct mptcp_subflow_data {
  65. __u32 size_subflow_data; /* size of this structure in userspace */
  66. __u32 num_subflows; /* must be 0, set by kernel */
  67. __u32 size_kernel; /* must be 0, set by kernel */
  68. __u32 size_user; /* size of one element in data[] */
  69. } __attribute__((aligned(8)));
  70. struct mptcp_subflow_addrs {
  71. union {
  72. __kernel_sa_family_t sa_family;
  73. struct sockaddr sa_local;
  74. struct sockaddr_in sin_local;
  75. struct sockaddr_in6 sin6_local;
  76. struct __kernel_sockaddr_storage ss_local;
  77. };
  78. union {
  79. struct sockaddr sa_remote;
  80. struct sockaddr_in sin_remote;
  81. struct sockaddr_in6 sin6_remote;
  82. struct __kernel_sockaddr_storage ss_remote;
  83. };
  84. };
  85. struct mptcp_subflow_info {
  86. __u32 id;
  87. struct mptcp_subflow_addrs addrs;
  88. };
  89. struct mptcp_full_info {
  90. __u32 size_tcpinfo_kernel; /* must be 0, set by kernel */
  91. __u32 size_tcpinfo_user;
  92. __u32 size_sfinfo_kernel; /* must be 0, set by kernel */
  93. __u32 size_sfinfo_user;
  94. __u32 num_subflows; /* must be 0, set by kernel (real subflow count) */
  95. __u32 size_arrays_user; /* max subflows that userspace is interested in;
  96. * the buffers at subflow_info/tcp_info
  97. * are respectively at least:
  98. * size_arrays * size_sfinfo_user
  99. * size_arrays * size_tcpinfo_user
  100. * bytes wide
  101. */
  102. __aligned_u64 subflow_info;
  103. __aligned_u64 tcp_info;
  104. struct mptcp_info mptcp_info;
  105. };
  106. /* MPTCP socket options */
  107. #define MPTCP_INFO 1
  108. #define MPTCP_TCPINFO 2
  109. #define MPTCP_SUBFLOW_ADDRS 3
  110. #define MPTCP_FULL_INFO 4
  111. #endif /* _MPTCP_H */