Blame include/ntapi/nt_socket.h

dd89bb
#ifndef _NT_SOCKET_H_
dd89bb
#define _NT_SOCKET_H_
dd89bb
dd89bb
/**
dd89bb
 *  socket api:
dd89bb
 *  -----------
dd89bb
 *  here we provide native libraries and applications
dd89bb
 *  with a minimal socket abstraction layer;
dd89bb
 *  if you are interested in posix socket semantics
dd89bb
 *  then this header is REALLY NOT what you
dd89bb
 *  are looking for, as the most portable scenario
dd89bb
 *  (psxscl+libc) neither requires nor allows for
dd89bb
 *  direct interaction with the below interfaces.
dd89bb
 *
dd89bb
 *  (additional information for the yet curious...)
dd89bb
 *
dd89bb
 *  client libraries and applications are responsible
dd89bb
 *  for the entire bookkeeping, which should be
dd89bb
 *  easy using the nt_socket structure.
dd89bb
 *
dd89bb
 *  kernel sockets are created using ZwCreateFile,
dd89bb
 *  and are then manipulated (bind, connect, send,
dd89bb
 *  recv, listen, accept, getsockname, etc.) using
dd89bb
 *  ZwDeviceIoControlFile.  accordingly, the main
dd89bb
 *  objective of the below interfaces is to provide
dd89bb
 *  thin wrappers around the above NT system calls,
dd89bb
 *  thereby releasing you from the tedious task
dd89bb
 *  of formatting control messages according to
dd89bb
 *  individual IOCTL codes, protocol types, or
dd89bb
 *  different versions of the operating system.
dd89bb
 *
dd89bb
 *  another noteworthy objective is the direct
dd89bb
 *  translation between posix socket semantics on the
dd89bb
 *  one hand, and the interfaces that this module
dd89bb
 *  provides on the other.  functions in this module
dd89bb
 *  normally take the same arguments as their
dd89bb
 *  posix equivalents, yet require a pointer
dd89bb
 *  to an nt_socket structure in place of an integer
dd89bb
 *  file descriptor (in the posix library, the task
dd89bb
 *  of converting an integer file descriptor to the
dd89bb
 *  above pointer is a trivial one).  for functions
dd89bb
 *  such as send() and recv(), the return value is
dd89bb
 *  the system's native NTSTATUS; the number of bytes
dd89bb
 *  sent or received is then returned in a separate
dd89bb
 *  argument, and can also be obtained, along with
dd89bb
 *  extended status, from the info member of the iosb
dd89bb
 *  argument.  last but not least, each function in
dd89bb
 *  this module accepts one or more optional arguments
dd89bb
 *  of questionable relevance:-)
dd89bb
**/
dd89bb
dd89bb
#include <psxtypes/psxtypes.h>
dd89bb
#include "nt_status.h"
dd89bb
#include "nt_object.h"
dd89bb
#include "nt_tty.h"
dd89bb
dd89bb
/* afd socket domains */
dd89bb
#define NT_AF_UNSPEC		(0x0000u)
dd89bb
#define NT_AF_UNIX		(0x0001u)
dd89bb
#define NT_AF_INET		(0x0002u)
dd89bb
#define NT_AF_IMPLINK		(0x0003u)
dd89bb
#define NT_AF_PUP		(0x0004u)
dd89bb
#define NT_AF_CHAOS		(0x0005u)
dd89bb
#define NT_AF_NS		(0x0006u)
dd89bb
#define NT_AF_IPX		(0x0006u) /* synonym */
dd89bb
#define NT_AF_ISO		(0x0007u)
dd89bb
#define NT_AF_OSI		(0x0007u) /* synonym */
dd89bb
#define NT_AF_ECMA		(0x0008u)
dd89bb
#define NT_AF_DATAKIT		(0x0009u)
dd89bb
#define NT_AF_CCITT		(0x000Au)
dd89bb
#define NT_AF_SNA		(0x000Bu)
dd89bb
#define NT_AF_DECnet		(0x000Cu)
dd89bb
#define NT_AF_DLI		(0x000Du)
dd89bb
#define NT_AF_LAT		(0x000Eu)
dd89bb
#define NT_AF_HYLINK		(0x000Fu)
dd89bb
#define NT_AF_APPLETALK		(0x0010u)
dd89bb
#define NT_AF_NETBIOS		(0x0011u)
dd89bb
#define NT_AF_VOICEVIEW		(0x0012u)
dd89bb
#define NT_AF_FIREFOX		(0x0013u)
dd89bb
#define NT_AF_UNKNOWN_1ST	(0x0014u)
dd89bb
#define NT_AF_BAN		(0x0015u)
dd89bb
#define NT_AF_ATM		(0x0016u)
dd89bb
#define NT_AF_INET6		(0x0017u)
dd89bb
#define NT_AF_CLUSTER		(0x0018u)
dd89bb
#define NT_AF_12844		(0x0019u)
dd89bb
#define NT_AF_IRDA		(0x001Au)
dd89bb
#define NT_AF_NETDES		(0x001Cu)
dd89bb
#define NT_AF_TCNPROCESS	(0x001Du)
dd89bb
#define NT_AF_TCNMESSAGE	(0x001Eu)
dd89bb
#define NT_AF_ICLFXBM		(0x001Fu)
dd89bb
#define NT_AF_BTH		(0x0020u)
dd89bb
#define NT_AF_LINK		(0x0021u)
dd89bb
dd89bb
dd89bb
/* afd socket types */
dd89bb
#define NT_SOCK_STREAM		(0x0001u)
dd89bb
#define NT_SOCK_DGRAM		(0x0002u)
dd89bb
#define NT_SOCK_RAW		(0x0003u)
dd89bb
#define NT_SOCK_RDM		(0x0004u)
dd89bb
#define NT_SOCK_SEQPACKET	(0x0005u)
dd89bb
dd89bb
dd89bb
/* afd socket protocols */
dd89bb
#define NT_IPPROTO_IP				0
dd89bb
#define NT_IPPROTO_HOPOPTS			0
dd89bb
#define NT_IPPROTO_ICMP				1
dd89bb
#define NT_IPPROTO_IGMP				2
dd89bb
#define NT_IPPROTO_GGP				3
dd89bb
#define NT_IPPROTO_IPV4				4
dd89bb
#define NT_IPPROTO_ST				5
dd89bb
#define NT_IPPROTO_TCP				6
dd89bb
#define NT_IPPROTO_CBT				7
dd89bb
#define NT_IPPROTO_EGP				8
dd89bb
#define NT_IPPROTO_IGP				9
dd89bb
#define NT_IPPROTO_PUP				12
dd89bb
#define NT_IPPROTO_UDP				17
dd89bb
#define NT_IPPROTO_IDP				22
dd89bb
#define NT_IPPROTO_RDP				27
dd89bb
#define NT_IPPROTO_IPV6				41
dd89bb
#define NT_IPPROTO_ROUTING			43
dd89bb
#define NT_IPPROTO_FRAGMENT			44
dd89bb
#define NT_IPPROTO_ESP				50
dd89bb
#define NT_IPPROTO_AH				51
dd89bb
#define NT_IPPROTO_ICMPV6			58
dd89bb
#define NT_IPPROTO_NONE				59
dd89bb
#define NT_IPPROTO_DSTOPTS			60
dd89bb
#define NT_IPPROTO_ND				77
dd89bb
#define NT_IPPROTO_ICLFXBM			78
dd89bb
#define NT_IPPROTO_PIM				103
dd89bb
#define NT_IPPROTO_PGM				113
dd89bb
#define NT_IPPROTO_L2TP				115
dd89bb
#define NT_IPPROTO_SCTP				132
dd89bb
#define NT_IPPROTO_RAW				255
dd89bb
#define NT_IPPROTO_MAX				256
dd89bb
#define NT_IPPROTO_RESERVED_RAW			257
dd89bb
#define NT_IPPROTO_RESERVED_IPSEC		258
dd89bb
#define NT_IPPROTO_RESERVED_IPSECOFFLOAD	259
dd89bb
#define NT_IPPROTO_RESERVED_WNV			260
dd89bb
#define NT_IPPROTO_RESERVED_MAX			261
dd89bb
dd89bb
dd89bb
1af137
/* afd ipv6 socket options */
1af137
#define NT_IPV6_HOPOPTS				1
1af137
#define NT_IPV6_HDRINCL				2
1af137
#define NT_IPV6_UNICAST_HOPS			4
1af137
#define NT_IPV6_MULTICAST_IF			9
1af137
#define NT_IPV6_MULTICAST_HOPS			10
1af137
#define NT_IPV6_MULTICAST_LOOP			11
1af137
#define NT_IPV6_ADD_MEMBERSHIP			12
1af137
#define NT_IPV6_DROP_MEMBERSHIP			13
1af137
#define NT_IPV6_DONTFRAG			14
1af137
#define NT_IPV6_PKTINFO				19
1af137
#define NT_IPV6_HOPLIMIT			21
1af137
#define NT_IPV6_PROTECTION_LEVEL		23
1af137
#define NT_IPV6_RECVIF				24
1af137
#define NT_IPV6_RECVDSTADDR			25
1af137
#define NT_IPV6_CHECKSUM			26
1af137
#define NT_IPV6_V6ONLY				27
1af137
#define NT_IPV6_IFLIST				28
1af137
#define NT_IPV6_ADD_IFLIST			29
1af137
#define NT_IPV6_DEL_IFLIST			30
1af137
#define NT_IPV6_UNICAST_IF			31
1af137
#define NT_IPV6_RTHDR				32
1af137
#define NT_IPV6_RECVRTHDR			38
1af137
#define NT_IPV6_TCLASS				39
1af137
#define NT_IPV6_RECVTCLASS			40
1af137
1af137
#define NT_IPV6_JOIN_GROUP			IPV6_ADD_MEMBERSHIP
1af137
#define NT_IPV6_LEAVE_GROUP			IPV6_DROP_MEMBERSHIP
1af137
1af137
1af137
dd89bb
/* tdi receive modes */
dd89bb
#define NT_TDI_RECEIVE_BROADCAST		(0x0004u)
dd89bb
#define NT_TDI_RECEIVE_MULTICAST		(0x0008u)
dd89bb
#define NT_TDI_RECEIVE_PARTIAL			(0x0010u)
dd89bb
#define NT_TDI_RECEIVE_NORMAL			(0x0020u)
dd89bb
#define NT_TDI_RECEIVE_EXPEDITED		(0x0040u)
dd89bb
#define NT_TDI_RECEIVE_PEEK			(0x0080u)
dd89bb
#define NT_TDI_RECEIVE_NO_RESPONSE_EXP		(0x0100u)
dd89bb
#define NT_TDI_RECEIVE_COPY_LOOKAHEAD		(0x0200u)
dd89bb
#define NT_TDI_RECEIVE_ENTIRE_MESSAGE		(0x0400u)
dd89bb
#define NT_TDI_RECEIVE_AT_DISPATCH_LEVEL	(0x0800u)
dd89bb
#define NT_TDI_RECEIVE_CONTROL_INFO		(0x1000u)
dd89bb
#define NT_TDI_RECEIVE_FORCE_INDICATION		(0x2000u)
dd89bb
#define NT_TDI_RECEIVE_NO_PUSH			(0x4000u)
dd89bb
dd89bb
/* tdi send modes */
dd89bb
#define NT_TDI_SEND_EXPEDITED			(0x0020u)
dd89bb
#define NT_TDI_SEND_PARTIAL			(0x0040u)
dd89bb
#define NT_TDI_SEND_NO_RESPONSE_EXPECTED	(0x0080u)
dd89bb
#define NT_TDI_SEND_NON_BLOCKING		(0x0100u)
dd89bb
#define NT_TDI_SEND_AND_DISCONNECT		(0x0200u)
dd89bb
dd89bb
/* tdi listen modes */
dd89bb
#define NT_TDI_QUERY_ACCEPT			(0x0001u)
dd89bb
dd89bb
/* tdi disconnect modes */
dd89bb
#define NT_TDI_DISCONNECT_WAIT			(0x0001u)
dd89bb
#define NT_TDI_DISCONNECT_ABORT			(0x0002u)
dd89bb
#define NT_TDI_DISCONNECT_RELEASE		(0x0004u)
dd89bb
dd89bb
/* afd ioctl codes */
dd89bb
#define NT_AFD_IOCTL_BIND			(0x12003u)
dd89bb
#define NT_AFD_IOCTL_CONNECT			(0x12007u)
dd89bb
#define NT_AFD_IOCTL_LISTEN			(0x1200Bu)
dd89bb
#define NT_AFD_IOCTL_ACCEPT			(0x1200Cu)
dd89bb
#define NT_AFD_IOCTL_DUPLICATE			(0x12010u)
dd89bb
#define NT_AFD_IOCTL_SEND			(0x1201Fu)
dd89bb
#define NT_AFD_IOCTL_UDP_SEND			(0x12023u)
dd89bb
#define NT_AFD_IOCTL_RECV			(0x12017u)
f6c77a
#define NT_AFD_IOCTL_UDP_RECV			(0x1201bu)
dd89bb
#define NT_AFD_IOCTL_DISCONNECT			(0x1202Bu)
dd89bb
#define NT_AFD_IOCTL_SELECT			(0x12024u)
dd89bb
#define NT_AFD_IOCTL_GET_SOCK_NAME		(0x1202Fu)
f5a78b
#define NT_AFD_IOCTL_GET_PEER_NAME		(0x12033u)
f5a78b
#define NT_AFD_IOCTL_SET_CONTEXT		(0x12047u)
f5a78b
#define NT_AFD_IOCTL_GET_CONTEXT		(0x12043u)
f5a78b
#define NT_AFD_IOCTL_SET_INFO			(0x1203bu)
f5a78b
#define NT_AFD_IOCTL_GET_INFO			(0x1207bu)
a867b0
#define NT_AFD_IOCTL_SOCKOPT			(0x120bfu)
a867b0
a867b0
/* afd sockopt mode bits */
a867b0
#define NT_AFD_SOCKOPT_SET			(0x01u)
a867b0
#define NT_AFD_SOCKOPT_GET			(0x02u)
dd89bb
072ce8
/* afd poll socket info bits */
072ce8
#define NT_AFD_POLL_RECEIVE			(0x01u)
072ce8
#define NT_AFD_POLL_RECEIVE_EXPEDITED		(0x02u)
072ce8
#define NT_AFD_POLL_SEND			(0x04u)
072ce8
#define NT_AFD_POLL_DISCONNECT			(0x08u)
072ce8
#define NT_AFD_POLL_ABORT			(0x10u)
072ce8
#define NT_AFD_POLL_LOCAL_CLOSE			(0x20u)
072ce8
#define NT_AFD_POLL_CONNECT			(0x40u)
072ce8
#define NT_AFD_POLL_ACCEPT			(0x80u)
31d413
#define NT_AFD_POLL_CONNECT_FAIL		(0x100u)
072ce8
dd89bb
/* afd socket shutdown bits */
dd89bb
#define NT_AFD_DISCONNECT_WR	(0x01u)
dd89bb
#define NT_AFD_DISCONNECT_RD	(0x02u)
dd89bb
dd89bb
/* send, sendto, sendmsg: *nix flags and bit place-holders */
dd89bb
#define NT_MSG_OOB		(0x00000001u)
dd89bb
#define NT_MSG_PEEK		(0x00000002u)
dd89bb
#define NT_MSG_DONTROUTE	(0x00000004u)
dd89bb
#define NT_MSG_CTRUNC		(0x00000008u)
dd89bb
#define NT_MSG_PROXY		(0x00000010u)
dd89bb
#define NT_MSG_TRUNC		(0x00000020u)
dd89bb
#define NT_MSG_DONTWAIT		(0x00000040u)
dd89bb
#define NT_MSG_EOR		(0x00000080u)
dd89bb
#define NT_MSG_WAITALL		(0x00000100u)
dd89bb
#define NT_MSG_FIN		(0x00000200u)
dd89bb
#define NT_MSG_SYN		(0x00000400u)
dd89bb
#define NT_MSG_CONFIRM		(0x00000800u)
dd89bb
#define NT_MSG_RST		(0x00001000u)
dd89bb
#define NT_MSG_ERRQUEUE		(0x00002000u)
dd89bb
#define NT_MSG_NOSIGNAL		(0x00004000u)
dd89bb
#define NT_MSG_MORE		(0x00008000u)
dd89bb
#define NT_MSG_WAITFORONE	(0x00010000u)
dd89bb
#define NT_MSG_CMSG_CLOEXEC	(0x40000000u)
dd89bb
dd89bb
dd89bb
/* socket structures */
dd89bb
typedef struct _nt_socket {
dd89bb
	union {
dd89bb
		void *		hsocket;
dd89bb
		void *		hfile;
dd89bb
		void *		hpipe;
dd89bb
		nt_pty *	hpty;
dd89bb
	};
dd89bb
dd89bb
	void *			hevent;
dd89bb
	int32_t			refcnt;		/* reserved for client */
dd89bb
	uint16_t		fdtype;		/* reserved for client */
dd89bb
	uint16_t		sctype;		/* reserved for client */
f6998c
	uint16_t		state;		/* reserved for client */
f6998c
	uint16_t		iomode;		/* reserved for client */
dd89bb
	uint32_t		ctxid;		/* reserved for client */
dd89bb
	uint32_t		psxflags;	/* reserved for client */
dd89bb
	uint32_t		ntflags;	/* sc_wait alert flags */
dd89bb
	nt_large_integer	timeout;
dd89bb
	int32_t			iostatus;
dd89bb
	int32_t			waitstatus;
dd89bb
dd89bb
	union {
dd89bb
		struct {
dd89bb
			uint16_t	domain;
dd89bb
			uint16_t	type;
dd89bb
			uint32_t	protocol;
dd89bb
		};
dd89bb
dd89bb
		void *	vfd;
dd89bb
		void *	vmount;
dd89bb
		void *	hpair;
dd89bb
		void *	dirctx;
dd89bb
	};
dd89bb
} nt_socket;
dd89bb
dd89bb
dd89bb
typedef struct _nt_scope_id{
dd89bb
	union {
dd89bb
		struct {
dd89bb
			uint32_t	zone  : 28;
dd89bb
			uint32_t	level : 4;
dd89bb
		};
dd89bb
dd89bb
		uint32_t	value;
dd89bb
	};
dd89bb
} nt_scope_id;
dd89bb
dd89bb
dd89bb
typedef struct _nt_sockaddr_in4 {
dd89bb
	uint16_t	sa_family;
dd89bb
	char		sa_data[14];
dd89bb
} nt_sockaddr_in4;
dd89bb
dd89bb
dd89bb
typedef struct _nt_sockaddr_in6 {
dd89bb
	uint16_t	sa_family;
dd89bb
	uint16_t	sa_port;
dd89bb
	uint32_t	sa_flow;
dd89bb
	unsigned char	sa_data[16];
dd89bb
	nt_scope_id	sa_scope;
dd89bb
} nt_sockaddr_in6;
dd89bb
dd89bb
dd89bb
typedef union _nt_sockaddr {
dd89bb
	nt_sockaddr_in4	sa_addr_in4;
dd89bb
	nt_sockaddr_in6 sa_addr_in6;
dd89bb
} nt_sockaddr;
dd89bb
dd89bb
f6c77a
typedef struct _nt_sockaddr_reply {
f6c77a
	uint32_t	addrlen;
f6c77a
	nt_sockaddr	addr;
f6c77a
} nt_sockaddr_reply;
f6c77a
f6c77a
dd89bb
typedef struct _nt_afd_buffer {
dd89bb
	size_t		length;
dd89bb
	char *		buffer;
dd89bb
} nt_afd_buffer;
dd89bb
dd89bb
dd89bb
typedef struct _nt_afd_listen_info {
0dbb40
	uint32_t	unknown;
dd89bb
	uint32_t	backlog;
0dbb40
	uint32_t	flags;
dd89bb
} nt_afd_listen_info;
dd89bb
dd89bb
dd89bb
typedef struct _nt_afd_accept_info {
dd89bb
	uint32_t	sequence;
dd89bb
	nt_sockaddr	addr;
dd89bb
	uint32_t	legacy[2];
dd89bb
} nt_afd_accept_info;
dd89bb
dd89bb
dd89bb
typedef struct _nt_afd_duplicate_info {
dd89bb
	uint32_t	unknown;
dd89bb
	uint32_t	sequence;
dd89bb
	void *		hsocket_dedicated;
dd89bb
} nt_afd_duplicate_info;
dd89bb
dd89bb
dd89bb
typedef struct _nt_afd_send_info {
dd89bb
	nt_afd_buffer *		afd_buffer_array;
dd89bb
	uint32_t		buffer_count;
dd89bb
	uint32_t		afd_flags;
dd89bb
	uint32_t		tdi_flags;
dd89bb
} nt_afd_send_info;
dd89bb
dd89bb
dd89bb
typedef struct _nt_afd_recv_info {
dd89bb
	nt_afd_buffer *		afd_buffer_array;
dd89bb
	uint32_t		buffer_count;
dd89bb
	uint32_t		afd_flags;
dd89bb
	uint32_t		tdi_flags;
dd89bb
} nt_afd_recv_info;
dd89bb
dd89bb
a867b0
typedef struct _nt_afd_sockopt_info {
a867b0
	uint32_t		mode;
a867b0
	uint32_t		level;
a867b0
	uint32_t		optname;
a867b0
	uint32_t		ding;
a867b0
	const void *		optval;
a867b0
	size_t			optlen;
a867b0
} nt_afd_sockopt_info;
a867b0
a867b0
072ce8
typedef struct _nt_afd_poll_socket_info {
072ce8
	void *			hsocket;
072ce8
	uint32_t		events;
072ce8
	int32_t			status;
072ce8
} nt_afd_poll_socket_info;
072ce8
072ce8
072ce8
typedef struct _nt_afd_poll_info {
072ce8
	nt_timeout		timeout;
072ce8
	uint32_t		nfds;
072ce8
	uint32_t		options;
072ce8
	nt_afd_poll_socket_info	pollfds[];
072ce8
} nt_afd_poll_info;
072ce8
072ce8
dd89bb
typedef struct _nt_afd_disconnect_info {
dd89bb
	uint32_t	shutdown_flags;
dd89bb
	uint32_t	unknown[3];
dd89bb
} nt_afd_disconnect_info;
dd89bb
dd89bb
dd89bb
/* socket functions */
dd89bb
typedef int32_t __cdecl ntapi_sc_socket(
dd89bb
	__out	nt_socket *		hssocket,
dd89bb
	__in	uint16_t		domain,
dd89bb
	__in	uint16_t		type,
dd89bb
	__in	uint32_t		protocol,
dd89bb
	__in	uint32_t		desired_access	__optional,
dd89bb
	__in	nt_sqos *		sqos		__optional,
dd89bb
	__out	nt_io_status_block *	iosb		__optional);
dd89bb
dd89bb
dd89bb
typedef int32_t __cdecl ntapi_sc_bind(
dd89bb
	__in	nt_socket *		hssocket,
dd89bb
	__in	const nt_sockaddr *	addr,
dd89bb
	__in	uintptr_t		addrlen,
3260d1
	__in	uint32_t		afdflags	__optional,
3260d1
	__in	uint32_t		srvflags	__optional,
dd89bb
	__out	nt_sockaddr *		sockaddr	__optional,
dd89bb
	__out	nt_io_status_block *	iosb		__optional);
dd89bb
dd89bb
dd89bb
typedef int32_t __cdecl ntapi_sc_listen(
dd89bb
	__in	nt_socket *		hssocket,
dd89bb
	__in	uintptr_t		backlog,
dd89bb
	__out	nt_io_status_block *	iosb		__optional);
dd89bb
dd89bb
dd89bb
typedef int32_t __cdecl ntapi_sc_accept(
dd89bb
	__in	nt_socket *		hssock_listen,
dd89bb
	__in	nt_sockaddr *		addr,
dd89bb
	__in	uint16_t *		addrlen,
dd89bb
	__out	nt_socket *		hssock_dedicated,
dd89bb
	__in	uintptr_t		afdflags	__optional,
dd89bb
	__in	uintptr_t		tdiflags	__optional,
dd89bb
	__out	nt_io_status_block *	iosb		__optional);
dd89bb
dd89bb
dd89bb
typedef int32_t __cdecl ntapi_sc_connect(
dd89bb
	__in	nt_socket *		hssocket,
dd89bb
	__in	nt_sockaddr *		addr,
dd89bb
	__in	uintptr_t		addrlen,
dd89bb
	__in	uintptr_t		service_flags	__optional,
dd89bb
	__out	nt_io_status_block *	iosb		__optional);
dd89bb
dd89bb
dd89bb
typedef int32_t __cdecl ntapi_sc_send(
dd89bb
	__in	nt_socket *		hssocket,
dd89bb
	__in	const void *		buffer,
dd89bb
	__in	size_t			len,
dd89bb
	__out	ssize_t *		bytes_sent	__optional,
eb53e6
	__in	const nt_sockaddr *	addr		__optional,
eb53e6
	__in	size_t			addrlen		__optional,
dd89bb
	__in	uintptr_t		afdflags	__optional,
dd89bb
	__in	uintptr_t		tdiflags	__optional,
dd89bb
	__out	nt_io_status_block *	iosb		__optional);
dd89bb
dd89bb
dd89bb
typedef int32_t __cdecl ntapi_sc_recv(
dd89bb
	__in	nt_socket *		hssocket,
dd89bb
	__in	const void *		buffer,
dd89bb
	__in	size_t			len,
dd89bb
	__out	ssize_t *		bytes_received	__optional,
f6c77a
	__in	nt_sockaddr_reply *	raddr		__optional,
dd89bb
	__in	uintptr_t		afdflags	__optional,
dd89bb
	__in	uintptr_t		tdiflags	__optional,
dd89bb
	__out	nt_io_status_block *	iosb		__optional);
dd89bb
dd89bb
dd89bb
typedef int32_t __cdecl ntapi_sc_shutdown(
dd89bb
	__in	nt_socket *		hssocket,
20ee45
	__in	uint32_t		afdhow,
dd89bb
	__out	nt_io_status_block *	iosb	__optional);
dd89bb
dd89bb
dd89bb
typedef int32_t __cdecl ntapi_sc_getsockname(
dd89bb
	__in	nt_socket *		hssocket,
dd89bb
	__in	nt_sockaddr *		addr,
dd89bb
	__in	uint16_t *		addrlen,
dd89bb
	__out	nt_io_status_block *	iosb		__optional);
dd89bb
5d8625
typedef int32_t __cdecl ntapi_sc_getpeername(
5d8625
	__in	nt_socket *		hssocket,
5d8625
	__in	nt_sockaddr *		addr,
5d8625
	__in	uint16_t *		addrlen,
5d8625
	__out	nt_io_status_block *	iosb		__optional);
dd89bb
dd89bb
typedef int32_t __cdecl ntapi_sc_server_accept_connection(
dd89bb
	__in	nt_socket *		hssocket,
dd89bb
	__out	nt_afd_accept_info *	accept_info,
dd89bb
	__out	nt_io_status_block *	iosb		__optional);
dd89bb
dd89bb
dd89bb
typedef int32_t __cdecl ntapi_sc_server_duplicate_socket(
dd89bb
	__in	nt_socket *		hssock_listen,
dd89bb
	__in	nt_socket *		hssock_dedicated,
dd89bb
	__in	nt_afd_accept_info *	accept_info,
dd89bb
	__out	nt_io_status_block *	iosb		__optional);
dd89bb
dd89bb
830346
typedef int32_t __cdecl ntapi_sc_setsockopt(
830346
	__in	nt_socket *		hssocket,
830346
	__in	int32_t			level,
830346
	__in	int32_t			optname,
830346
	__in	const void *		optval,
830346
	__in	uint32_t		optlen,
830346
	__out	nt_io_status_block *	iosb		__optional);
830346
830346
419228
typedef int32_t __cdecl ntapi_sc_getsockopt(
419228
	__in	nt_socket *		hssocket,
419228
	__in	int32_t			level,
419228
	__in	int32_t			optname,
419228
	__out	void *			optval,
419228
	__in	uint32_t		optlen,
419228
	__out	nt_io_status_block *	iosb);
419228
419228
dd89bb
typedef int32_t __cdecl ntapi_sc_wait(nt_socket * hssocket, nt_iosb * iosb, nt_timeout * timeout);
dd89bb
dd89bb
#endif