diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/ntapi/nt_socket.h | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/include/ntapi/nt_socket.h b/include/ntapi/nt_socket.h index b3a1f69..b0448b7 100644 --- a/include/ntapi/nt_socket.h +++ b/include/ntapi/nt_socket.h @@ -54,6 +54,22 @@ #include "nt_object.h" #include "nt_tty.h" +/* afd tcp state */ +typedef enum _nt_afd_tcp_state { + NT_AFD_TCP_STATE_CLOSED, + NT_AFD_TCP_STATE_LISTEN, + NT_AFD_TCP_STATE_SYN_SENT, + NT_AFD_TCP_STATE_SYN_RCVD, + NT_AFD_TCP_STATE_ESTABLISHED, + NT_AFD_TCP_STATE_FIN_WAIT_1, + NT_AFD_TCP_STATE_FIN_WAIT_2, + NT_AFD_TCP_STATE_CLOSE_WAIT, + NT_AFD_TCP_STATE_CLOSING, + NT_AFD_TCP_STATE_LAST_ACK, + NT_AFD_TCP_STATE_TIME_WAIT, + NT_AFD_TCP_STATE_MAX, +} nt_afd_tcp_state; + /* afd socket domains */ #define NT_AF_UNSPEC (0x0000u) #define NT_AF_UNIX (0x0001u) @@ -145,6 +161,73 @@ #define NT_SOL_SOCKET 0xffff +/* afd socket ioctl primitives */ +#define NT_SO_IOCTL_IN (1 << 31) +#define NT_SO_IOCTL_OUT (1 << 30) +#define NT_SO_IOCTL_VOID (1 << 29) + +#define NT_SO_IOCTL_TYPE_UNIX ((0 << 28) | (0 << 27)) +#define NT_SO_IOCTL_TYPE_WS2 ((0 << 28) | (1 << 27)) +#define NT_SO_IOCTL_TYPE_PROTOCOL ((1 << 28) | (0 << 27)) +#define NT_SO_IOCTL_TYPE_VENDOR ((1 << 28) | (1 << 27)) + +#define NT_SO_IOCTL_UNIX_VOID(x) (x | NT_SO_IOCTL_TYPE_UNIX | NT_SO_IOCTL_VOID) +#define NT_SO_IOCTL_UNIX_GET(x) (x | NT_SO_IOCTL_TYPE_UNIX | NT_SO_IOCTL_OUT) +#define NT_SO_IOCTL_UNIX_SET(x) (x | NT_SO_IOCTL_TYPE_UNIX | NT_SO_IOCTL_IN) +#define NT_SO_IOCTL_UNIX_EX(x) (x | NT_SO_IOCTL_TYPE_UNIX | NT_SO_IOCTL_IN|NT_SO_IOCTL_OUT) + +#define NT_SO_IOCTL_WS2_VOID(x) (x | NT_SO_IOCTL_TYPE_WS2 | NT_SO_IOCTL_VOID) +#define NT_SO_IOCTL_WS2_GET(x) (x | NT_SO_IOCTL_TYPE_WS2 | NT_SO_IOCTL_OUT) +#define NT_SO_IOCTL_WS2_SET(x) (x | NT_SO_IOCTL_TYPE_WS2 | NT_SO_IOCTL_IN) +#define NT_SO_IOCTL_WS2_EX(x) (x | NT_SO_IOCTL_TYPE_WS2 | NT_SO_IOCTL_IN|NT_SO_IOCTL_OUT) + +#define NT_SO_IOCTL_PROTOCOL_VOID(x) (x | NT_SO_IOCTL_TYPE_PROTOCOL | NT_SO_IOCTL_VOID) +#define NT_SO_IOCTL_PROTOCOL_GET(x) (x | NT_SO_IOCTL_TYPE_PROTOCOL | NT_SO_IOCTL_OUT) +#define NT_SO_IOCTL_PROTOCOL_SET(x) (x | NT_SO_IOCTL_TYPE_PROTOCOL | NT_SO_IOCTL_IN) +#define NT_SO_IOCTL_PROTOCOL_EX(x) (x | NT_SO_IOCTL_TYPE_PROTOCOL | NT_SO_IOCTL_IN|NT_SO_IOCTL_OUT) + +#define NT_SO_IOCTL_VENDOR_VOID(x) (x | NT_SO_IOCTL_TYPE_VENDOR | NT_SO_IOCTL_VOID) +#define NT_SO_IOCTL_VENDOR_GET(x) (x | NT_SO_IOCTL_TYPE_VENDOR | NT_SO_IOCTL_OUT) +#define NT_SO_IOCTL_VENDOR_SET(x) (x | NT_SO_IOCTL_TYPE_VENDOR | NT_SO_IOCTL_IN) +#define NT_SO_IOCTL_VENDOR_EX(x) (x | NT_SO_IOCTL_TYPE_VENDOR | NT_SO_IOCTL_IN|NT_SO_IOCTL_OUT) + + +/* afd socket ws2 ioctl codes */ +#define NT_SO_IOCTL_ASSOCIATE_HANDLE NT_SO_IOCTL_WS2_SET(1) +#define NT_SO_IOCTL_ENABLE_CIRCULAR_QUEUEING NT_SO_IOCTL_WS2_VOID(2) +#define NT_SO_IOCTL_FIND_ROUTE NT_SO_IOCTL_WS2_GET(3) +#define NT_SO_IOCTL_FLUSH NT_SO_IOCTL_WS2_VOID(4) +#define NT_SO_IOCTL_GET_BROADCAST_ADDRESS NT_SO_IOCTL_WS2_GET(5) +#define NT_SO_IOCTL_GET_EXTENSION_FUNC_PTR NT_SO_IOCTL_WS2_EX((6) +#define NT_SO_IOCTL_GET_QOS NT_SO_IOCTL_WS2_EX((7) +#define NT_SO_IOCTL_GET_GROUP_QOS NT_SO_IOCTL_WS2_EX((8) +#define NT_SO_IOCTL_MULTIPOINT_LOOPBACK NT_SO_IOCTL_WS2_SET(9) +#define NT_SO_IOCTL_MULTICAST_SCOPE NT_SO_IOCTL_WS2_SET(10) +#define NT_SO_IOCTL_SET_QOS NT_SO_IOCTL_WS2_SET(11) +#define NT_SO_IOCTL_SET_GROUP_QOS NT_SO_IOCTL_WS2_SET(12) +#define NT_SO_IOCTL_TRANSLATE_HANDLE NT_SO_IOCTL_WS2_EX((13) +#define NT_SO_IOCTL_ROUTING_INTERFACE_QUERY NT_SO_IOCTL_WS2_EX((20) +#define NT_SO_IOCTL_ROUTING_INTERFACE_CHANGE NT_SO_IOCTL_WS2_SET(21) +#define NT_SO_IOCTL_ADDRESS_LIST_QUERY NT_SO_IOCTL_WS2_GET(22) +#define NT_SO_IOCTL_ADDRESS_LIST_CHANGE NT_SO_IOCTL_WS2_VOID(23) +#define NT_SO_IOCTL_QUERY_TARGET_PNP_HANDLE NT_SO_IOCTL_WS2_GET(24) +#define SIO_ADDRESS_LIST_SORT NT_SO_IOCTL_WS2_EX((25) + +/* afd socket vendor ioctl codes */ +#define NT_SO_IOCTL_RCVALL NT_SO_IOCTL_VENDOR_GET(1) +#define NT_SO_IOCTL_RCVALL_MCAST NT_SO_IOCTL_VENDOR_GET(2) +#define NT_SO_IOCTL_RCVALL_IGMPMCAST NT_SO_IOCTL_VENDOR_GET(3) +#define NT_SO_IOCTL_KEEPALIVE_VALS NT_SO_IOCTL_VENDOR_GET(4) +#define NT_SO_IOCTL_ABSORB_RTRALERT NT_SO_IOCTL_VENDOR_GET(5) +#define NT_SO_IOCTL_UCAST_IF NT_SO_IOCTL_VENDOR_GET(6) +#define NT_SO_IOCTL_LIMIT_BROADCASTS NT_SO_IOCTL_VENDOR_GET(7) +#define NT_SO_IOCTL_INDEX_BIND NT_SO_IOCTL_VENDOR_GET(8) +#define NT_SO_IOCTL_INDEX_MCASTIF NT_SO_IOCTL_VENDOR_GET(9) +#define NT_SO_IOCTL_INDEX_ADD_MCAST NT_SO_IOCTL_VENDOR_GET(10) +#define NT_SO_IOCTL_INDEX_DEL_MCAST NT_SO_IOCTL_VENDOR_GET(11) +#define NT_SO_IOCTL_RCVALL_MCAST_IF NT_SO_IOCTL_VENDOR_GET(13) +#define NT_SO_IOCTL_RCVALL_IF NT_SO_IOCTL_VENDOR_GET(14) +#define NT_SO_IOCTL_GET_TCP_INFO NT_SO_IOCTL_VENDOR_EX(39) /* afd socket-level socket options */ #define NT_SO_DEBUG (0x0001) @@ -438,6 +521,29 @@ typedef struct _nt_afd_disconnect_info { } nt_afd_disconnect_info; +typedef struct _nt_afd_tcp_info_v0 { + nt_afd_tcp_state state; + uint32_t mss; + uint64_t conn_time_ms; + int time_stamp_enabled; + uint32_t rtt_us; + uint32_t min_rtt_us; + uint32_t bytes_in_flight; + uint32_t c_wnd; + uint32_t snd_wnd; + uint32_t rcv_wnd; + uint32_t rcv_buf; + uint64_t bytes_out; + uint64_t bytes_in; + uint32_t bytes_reordered; + uint32_t bytes_retrans; + uint32_t dup_acks_in; + uint32_t timeout_episodes; + uint8_t syn_retrans; + uint32_t __pad; +} nt_afd_tcp_info_v0; + + /* socket functions */ typedef int32_t __cdecl ntapi_sc_socket( __out nt_socket * hssocket, |