' ########################################################################################
' Microsoft Windows
' File: ws2def.inc
' Contents: Core definitions for the Winsock2 specification that can be used by both
' user-mode and kernel mode modules.
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
' // Note: Winsock2.inc must be included first.
#IF NOT %DEF(PBX_ws2def_PBI)
#DEFINE PBX_ws2def_PBI
#INCLUDE ONCE "Core/Windows.inc"
'/*++
'Copyright (c) Microsoft Corporation. All rights reserved.
'Module Name:
' ws2def.h
'Abstract:
' This file contains the core definitions for the Winsock2
' specification that can be used by both user-mode and
' kernel mode modules.
' This file is included in WINSOCK2.H. User mode applications
' should include WINSOCK2.H rather than including this file
' directly. This file can not be included by a module that also
' includes WINSOCK.H.
'Environment:
' user mode or kernel mode
'--*/
#IF NOT %DEF(%WINSOCK_INC)
'#IF NOT %DEF(%WINSOCK2_INC)
#IF NOT %DEF(%WS2DEF_INC)
 %WS2DEF_INC = 1
' %WINSOCK2_INC = 1 ' Prevent inclusion of winsock2.inc
 %WINSOCK_INC = 1 ' Prevent inclusion of winsock.inc
'#if !defined(_WINSOCK2API_) && defined(_WINSOCKAPI_)
'#error Do not include winsock.h and ws2def.h in the same module. Instead include only winsock2.h.
'#endif
'//
'// Allow Winsock components to disable PREfast errors.
'//
'#if defined(_PREFAST_) && defined(IPV6_PREFAST_SAFE)
'#include <ipv6prefast.h>
'#endif // _PREFAST_
#INCLUDE ONCE "Core/Windows.inc"
#INCLUDE ONCE "Legacy/System/inaddr.inc"
'//#if(_WIN32_WINNT >= 0x0600)
'//
'// Address families.
'//
'typedef USHORT ADDRESS_FAMILY;
'//#endif//(_WIN32_WINNT >= 0x0600)
'//
'// Although AF_UNSPEC is defined for backwards compatibility, using
'// AF_UNSPEC for the "af" parameter when creating a socket is STRONGLY
'// DISCOURAGED. The interpretation of the "protocol" parameter
'// depends on the actual address family chosen. As environments grow
'// to include more and more address families that use overlapping
'// protocol values there is more and more chance of choosing an
'// undesired address family when AF_UNSPEC is used.
'//
%EQUATE `AF_UNSPEC = 0 ' unspecified
%EQUATE `AF_UNIX = 1 ' local to host (pipes, portals)
%EQUATE `AF_INET = 2 ' internetwork: UDP, TCP, etc.
%EQUATE `AF_IMPLINK = 3 ' arpanet imp addresses
%EQUATE `AF_PUP = 4 ' pup protocols: e.g. BSP
%EQUATE `AF_CHAOS = 5 ' mit CHAOS protocols
%EQUATE `AF_NS = 6 ' XEROX NS protocols
%EQUATE `AF_IPX = %AF_NS ' IPX and SPX
%EQUATE `AF_ISO = 7 ' ISO protocols
%EQUATE `AF_OSI = %AF_ISO ' OSI is ISO
%EQUATE `AF_ECMA = 8 ' european computer manufacturers
%EQUATE `AF_DATAKIT = 9 ' datakit protocols
%EQUATE `AF_CCITT = 10 ' CCITT protocols, X.25 etc
%EQUATE `AF_SNA = 11 ' IBM SNA
%EQUATE `AF_DECnet = 12 ' DECnet
%EQUATE `AF_DLI = 13 ' Direct data link interface
%EQUATE `AF_LAT = 14 ' LAT
%EQUATE `AF_HYLINK = 15 ' NSC Hyperchannel
%EQUATE `AF_APPLETALK = 16 ' AppleTalk
%EQUATE `AF_NETBIOS = 17 ' NetBios-style addresses
%EQUATE `AF_VOICEVIEW = 18 ' VoiceView
%EQUATE `AF_FIREFOX = 19 ' Protocols from Firefox
%EQUATE `AF_UNKNOWN1 = 20 ' Somebody is using this!
%EQUATE `AF_BAN = 21 ' Banyan
%EQUATE `AF_ATM = 22 ' Native ATM Services
%EQUATE `AF_INET6 = 23 ' Internetwork Version 6
%EQUATE `AF_CLUSTER = 24 ' Microsoft Wolfpack
%EQUATE `AF_12844 = 25 ' IEEE 1284.4 WG AF
%EQUATE `AF_IRDA = 26 ' IrDA
%EQUATE `AF_NETDES = 28 ' Network Designers OSI & gateway enabled protocols
'#if(_WIN32_WINNT < 0x0501)
#IF %WINVER < &H0501
 %AF_MAX = 29
#ELSE ' //(_WIN32_WINNT < 0x0501)
 %AF_TCNPROCESS = 29
 %AF_TCNMESSAGE = 30
 %AF_ICLFXBM = 31
 '#if(_WIN32_WINNT < 0x0600)
 #IF %WINVER < &H0600
 %AF_MAX = 32
 '#else //(_WIN32_WINNT < 0x0600)
 #ELSE
 %AF_BTH = 32 ' // Bluetooth RFCOMM/L2CAP protocols
 '#if(_WIN32_WINNT < 0x0601)
 #IF %WINVER < &H0601
 %AF_MAX = 33
 #ELSE ' //(_WIN32_WINNT < 0x0601)
 %AF_LINK = 33
 %AF_MAX = 34
 #ENDIF ' //(_WIN32_WINNT < 0x0601)
 #ENDIF ' //(_WIN32_WINNT < 0x0600)
#ENDIF ' //(_WIN32_WINNT < 0x0501)
'//
'// Socket types.
'//
%EQUATE `SOCK_STREAM = 1
%EQUATE `SOCK_DGRAM = 2
%EQUATE `SOCK_RAW = 3
%EQUATE `SOCK_RDM = 4
%EQUATE `SOCK_SEQPACKET = 5
'//
'// Define a level for socket I/O controls in the same numbering space as
'// IPPROTO_TCP, IPPROTO_IP, etc.
'//
%EQUATE `SOL_SOCKET = &HFFFF
'//
'// Define socket-level options.
'//
%EQUATE `SO_DEBUG = &H0001 ' turn on debugging info recording
%EQUATE `SO_ACCEPTCONN = &H0002 ' socket has had listen()
%EQUATE `SO_REUSEADDR = &H0004 ' allow local address reuse
%EQUATE `SO_KEEPALIVE = &H0008 ' keep connections alive
%EQUATE `SO_DONTROUTE = &H0010 ' just use interface addresses
%EQUATE `SO_BROADCAST = &H0020 ' permit sending of broadcast msgs
%EQUATE `SO_USELOOPBACK = &H0040 ' bypass hardware when possible
%EQUATE `SO_LINGER = &H0080 ' linger on close if data present
%EQUATE `SO_OOBINLINE = &H0100 ' leave received OOB data in line
'#define SO_DONTLINGER (int)(~SO_LINGER)
'#define SO_EXCLUSIVEADDRUSE \
' ((int)(~SO_REUSEADDR)) // disallow local address reuse
%EQUATE `SO_DONTLINGER = &HFFFFFF7F ' CLNG(NOT SO_LINGER)
%EQUATE `SO_EXCLUSIVEADDRUSE = &HFFFFFFFB ' CLNG(NOT S0_REUSEADDR) disallow local address reuse
%EQUATE `SO_SNDBUF = &H1001 ' // send buffer size
%EQUATE `SO_RCVBUF = &H1002 ' // receive buffer size
%EQUATE `SO_SNDLOWAT = &H1003 ' // send low-water mark
%EQUATE `SO_RCVLOWAT = &H1004 ' // receive low-water mark
%EQUATE `SO_SNDTIMEO = &H1005 ' // send timeout
%EQUATE `SO_RCVTIMEO = &H1006 ' // receive timeout
%EQUATE `SO_ERROR = &H1007 ' // get error status and clear
%EQUATE `SO_TYPE = &H1008 ' // get socket type
%EQUATE `SO_BSP_STATE = &H1009 ' // get socket 5-tuple state
%EQUATE `SO_GROUP_ID = &H2001 ' ID of a socket group
%EQUATE `SO_GROUP_PRIORITY = &H2002 ' the relative priority within a group
%EQUATE `SO_MAX_MSG_SIZE = &H2003 ' maximum message size
%EQUATE `SO_CONDITIONAL_ACCEPT = &H3002 ' // enable true conditional accept:
 ' // connection is not ack-ed to the
 ' // other side until conditional
 ' // function returns CF_ACCEPT
%EQUATE `SO_PAUSE_ACCEPT = &H3003 ' // pause accepting new connections
%EQUATE `SO_COMPARTMENT_ID = &H3004 ' // get/set the compartment for a socket
'#if (_WIN32_WINNT >= 0x0600)
%EQUATE `SO_RANDOMIZE_PORT = &H3005 ' // randomize assignment of wildcard ports
%EQUATE `SO_PORT_SCALABILITY = &H3006 ' // enable port scalability
'#endif //(_WIN32_WINNT >= 0x0600)
'//
'// Base constant used for defining WSK-specific options.
'//
%EQUATE `WSK_SO_BASE = &H4000
'//
'// Options to use with [gs]etsockopt at the IPPROTO_TCP level.
'//
%EQUATE `TCP_NODELAY = &H0001
'//
'// Structure used to store most addresses.
'//
'typedef struct sockaddr {
'#if (_WIN32_WINNT < 0x0600)
' u_short sa_family;
'#else
' ADDRESS_FAMILY sa_family; // Address family.
'#endif //(_WIN32_WINNT < 0x0600)
' CHAR sa_data[14]; // Up to 14 bytes of direct address.
'} SOCKADDR, *PSOCKADDR, FAR *LPSOCKADDR;
UNION sockaddr_DATA_UNION
 sa_data AS STRING * 14 ' up to 14 bytes of direct address
 ' // For compatibility with the PB declares
 sa_data(13) AS BYTE ' Up to 14 bytes of direct address.
END UNION
' // Size = 16 bytes
TYPE sockaddr BYTE
 sa_family AS WORD ' address family
 sockaddr_DATA_UNION
END TYPE
#IF NOT %DEF(%CSADDR_DEFINED)
 %CSADDR_DEFINED = 1
'/*
' * SockAddr Information
' */
' // Size = 8 bytes
TYPE SOCKET_ADDRESS DWORD
 lpSocaddr AS SOCKADDR PTR
 iSockaddrLength AS LONG ' INT iSockaddrLength
END TYPE
'/*
' * Address list returned via SIO_ADDRESS_LIST_QUERY
' */
' // Size = 12 bytes
TYPE SOCKET_ADDRESS_LIST DWORD
 iAddressCount AS LONG ' INT
 Address(0) AS SOCKET_ADDRESS ' SOCKET_ADDRESS Address[1]
END TYPE
'#if (_WIN32_WINNT >= 0x0600)
'#define SIZEOF_SOCKET_ADDRESS_LIST(AddressCount) \
' (FIELD_OFFSET(SOCKET_ADDRESS_LIST, Address) + \
' AddressCount * sizeof(SOCKET_ADDRESS))
'#endif //(_WIN32_WINNT >= 0x0600)
'/*
' * CSAddr Information
' */
' // Size = 24 bytes
TYPE CSADDR_INFO DWORD
 LocalAddr AS SOCKET_ADDRESS ' SOCKET_ADDRESS
 RemoteAddr AS SOCKET_ADDRESS ' SOCKET_ADDRESS
 iSocketType AS LONG ' INT
 iProtocol AS LONG ' INT
END TYPE
#ENDIF ' /* __CSADDR_DEFINED__ */
'//
'// Portable socket structure (RFC 2553).
'//
'//
'// Desired design of maximum size and alignment.
'// These are implementation specific.
'//
'#define _SS_MAXSIZE 128 // Maximum size
'#define _SS_ALIGNSIZE (sizeof(__int64)) // Desired alignment
'//
'// Definitions used for sockaddr_storage structure paddings design.
'//
'#if(_WIN32_WINNT >= 0x0600)
'#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(USHORT))
'#define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof(USHORT) + _SS_PAD1SIZE + _SS_ALIGNSIZE))
'#else
'#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof (short))
'#define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof (short) + _SS_PAD1SIZE \
' + _SS_ALIGNSIZE))
'#endif //(_WIN32_WINNT >= 0x0600)
'typedef struct sockaddr_storage {
' ADDRESS_FAMILY ss_family; // address family
' CHAR __ss_pad1[_SS_PAD1SIZE]; // 6 byte pad, this is to make
' // implementation specific pad up to
' // alignment field that follows explicit
' // in the data structure
' CHAR __ss_pad2[_SS_PAD2SIZE]; // 112 byte pad to achieve desired size;
' // _SS_MAXSIZE value minus size of
' // ss_family, __ss_pad1, and
' // __ss_align fields is 112
'} SOCKADDR_STORAGE_LH, *PSOCKADDR_STORAGE_LH, FAR *LPSOCKADDR_STORAGE_LH;
' // Size = 128 bytes
TYPE SOCKADDR_STORAGE QWORD FILL
 ss_family AS WORD
 ss_pad1 AS STRING * 6
 ss_align AS QUAD
 ss_pad2 AS STRING * 112
END TYPE
MACRO SOCKADDR_STORAGE_LH = SOCKADDR_STORAGE
'typedef struct sockaddr_storage_xp {
' short ss_family; // Address family.
' CHAR __ss_pad1[_SS_PAD1SIZE]; // 6 byte pad, this is to make
' // implementation specific pad up to
' // alignment field that follows explicit
' // in the data structure
' CHAR __ss_pad2[_SS_PAD2SIZE]; // 112 byte pad to achieve desired size;
' // _SS_MAXSIZE value minus size of
' // ss_family, __ss_pad1, and
' // __ss_align fields is 112
'} SOCKADDR_STORAGE_XP, *PSOCKADDR_STORAGE_XP, FAR *LPSOCKADDR_STORAGE_XP;
MACRO SOCKADDR_STORAGE_XP = SOCKADDR_STORAGE
'#if(_WIN32_WINNT >= 0x0600)
'typedef SOCKADDR_STORAGE_LH SOCKADDR_STORAGE;
'typedef SOCKADDR_STORAGE *PSOCKADDR_STORAGE, FAR *LPSOCKADDR_STORAGE;
'#elif (_WIN32_WINNT >= 0x0501)
'typedef SOCKADDR_STORAGE_XP SOCKADDR_STORAGE;
'typedef SOCKADDR_STORAGE *PSOCKADDR_STORAGE, FAR *LPSOCKADDR_STORAGE;
'#endif
'/*
' * WinSock 2 extension -- manifest constants for WSAIoctl()
' */
%EQUATE `IOC_UNIX = &H00000000
%EQUATE `IOC_WS2 = &H08000000
%EQUATE `IOC_PROTOCOL = &H10000000
%EQUATE `IOC_VENDOR = &H18000000
'#if (_WIN32_WINNT >= 0x0600)
'/*
' * WSK-specific IO control codes are Winsock2 codes with the highest-order
' * 3 bits of the Vendor/AddressFamily-specific field set to 1.
' */
%EQUATE `IOC_WSK = %IOC_WS2 OR &H07000000
'#endif //(_WIN32_WINNT >= 0x0600)
'#define _WSAIO(x,y) (IOC_VOID|(x)|(y))
'#define _WSAIOR(x,y) (IOC_OUT|(x)|(y))
'#define _WSAIOW(x,y) (IOC_IN|(x)|(y))
'#define _WSAIORW(x,y) (IOC_INOUT|(x)|(y))
MACRO WSAIO_ (x,y) = %IOC_VOID OR x OR y
MACRO WSAIOR_ (x,y) = %IOC_OUT OR x OR y
MACRO WSAIOW_ (x,y) = %IOC_IN OR x OR y
MACRO WSAIORW_ (x,y) = %IOC_INOUT OR x OR y
'#define SIO_ASSOCIATE_HANDLE _WSAIOW(IOC_WS2,1)
'#define SIO_ENABLE_CIRCULAR_QUEUEING _WSAIO(IOC_WS2,2)
'#define SIO_FIND_ROUTE _WSAIOR(IOC_WS2,3)
'#define SIO_FLUSH _WSAIO(IOC_WS2,4)
'#define SIO_GET_BROADCAST_ADDRESS _WSAIOR(IOC_WS2,5)
'#define SIO_GET_EXTENSION_FUNCTION_POINTER _WSAIORW(IOC_WS2,6)
'#define SIO_GET_QOS _WSAIORW(IOC_WS2,7)
'#define SIO_GET_GROUP_QOS _WSAIORW(IOC_WS2,8)
'#define SIO_MULTIPOINT_LOOPBACK _WSAIOW(IOC_WS2,9)
'#define SIO_MULTICAST_SCOPE _WSAIOW(IOC_WS2,10)
'#define SIO_SET_QOS _WSAIOW(IOC_WS2,11)
'#define SIO_SET_GROUP_QOS _WSAIOW(IOC_WS2,12)
'#define SIO_TRANSLATE_HANDLE _WSAIORW(IOC_WS2,13)
'#define SIO_ROUTING_INTERFACE_QUERY _WSAIORW(IOC_WS2,20)
'#define SIO_ROUTING_INTERFACE_CHANGE _WSAIOW(IOC_WS2,21)
'#define SIO_ADDRESS_LIST_QUERY _WSAIOR(IOC_WS2,22)
'#define SIO_ADDRESS_LIST_CHANGE _WSAIO(IOC_WS2,23)
'#define SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(IOC_WS2,24)
%EQUATE `SIO_ASSOCIATE_HANDLE = &H88000001
%EQUATE `SIO_ENABLE_CIRCULAR_QUEUEING = &H28000002
%EQUATE `SIO_FIND_ROUTE = &H48000003
%EQUATE `SIO_FLUSH = &H28000004
%EQUATE `SIO_GET_BROADCAST_ADDRESS = &H48000005
%EQUATE `SIO_GET_EXTENSION_FUNCTION_POINTER = &HC8000006
%EQUATE `SIO_GET_QOS = &HC8000007
%EQUATE `SIO_GET_GROUP_QOS = &HC8000008
%EQUATE `SIO_MULTIPOINT_LOOPBACK = &H88000009
%EQUATE `SIO_MULTICAST_SCOPE = &H8800000A
%EQUATE `SIO_SET_QOS = &H8800000B
%EQUATE `SIO_SET_GROUP_QOS = &H8800000C
%EQUATE `SIO_TRANSLATE_HANDLE = &HC800000D
%EQUATE `SIO_ROUTING_INTERFACE_QUERY = &HC8000014
%EQUATE `SIO_ROUTING_INTERFACE_CHANGE = &H88000015
%EQUATE `SIO_ADDRESS_LIST_QUERY = &H48000016
%EQUATE `SIO_ADDRESS_LIST_CHANGE = &H28000017
%EQUATE `SIO_QUERY_TARGET_PNP_HANDLE = &H48000018
'#if(_WIN32_WINNT >= 0x0501)
'#define SIO_ADDRESS_LIST_SORT _WSAIORW(IOC_WS2,25)
%EQUATE `SIO_ADDRESS_LIST_SORT = &HC8000019
'#endif //(_WIN32_WINNT >= 0x0501)
'#if (_WIN32_WINNT >= 0x0600)
'#define SIO_RESERVED_1 _WSAIOW(IOC_WS2,26)
'#define SIO_RESERVED_2 _WSAIOW(IOC_WS2,33)
%EQUATE `SIO_RESERVED_1 = &HC800001A
%EQUATE `SIO_RESERVED_2 = &HC8000021
'#endif //(_WIN32_WINNT >= 0x0600)
'//
'// Constants and structures defined by the internet system (RFC 790)
'//
'//
'// N.B. required for backwards compatability to support 0 = IP for the
'// level argument to get/setsockopt.
'//
%EQUATE `IPPROTO_IP = 0
'//
'// Protocols. The IPv6 defines are specified in RFC 2292.
'//
'typedef enum {
'#if(_WIN32_WINNT >= 0x0501)
%EQUATE `IPPROTO_HOPOPTS = 0 ' // IPv6 Hop-by-Hop options
'#endif//(_WIN32_WINNT >= 0x0501)
%EQUATE `IPPROTO_ICMP = 1
%EQUATE `IPPROTO_IGMP = 2
%EQUATE `IPPROTO_GGP = 3
'#if(_WIN32_WINNT >= 0x0501)
%EQUATE `IPPROTO_IPV4 = 4
'#endif//(_WIN32_WINNT >= 0x0501)
'#if(_WIN32_WINNT >= 0x0600)
%EQUATE `IPPROTO_ST = 5
'#endif//(_WIN32_WINNT >= 0x0600)
%EQUATE `IPPROTO_TCP = 6
'#if(_WIN32_WINNT >= 0x0600)
%EQUATE `IPPROTO_CBT = 7
%EQUATE `IPPROTO_EGP = 8
%EQUATE `IPPROTO_IGP = 9
'#endif//(_WIN32_WINNT >= 0x0600)
%EQUATE `IPPROTO_PUP = 12
%EQUATE `IPPROTO_UDP = 17
%EQUATE `IPPROTO_IDP = 22
'#if(_WIN32_WINNT >= 0x0600)
%EQUATE `IPPROTO_RDP = 27
'#endif//(_WIN32_WINNT >= 0x0600)
'#if(_WIN32_WINNT >= 0x0501)
%EQUATE `IPPROTO_IPV6 = 41 ' /* IPv6 */
%EQUATE `IPPROTO_ROUTING = 43 ' /* IPv6 routing header */
%EQUATE `IPPROTO_FRAGMENT = 44 ' /* IPv6 fragmentation header */
%EQUATE `IPPROTO_ESP = 50 ' /* IPsec ESP header */
%EQUATE `IPPROTO_AH = 51 ' /* IPsec AH */
%EQUATE `IPPROTO_ICMPV6 = 58 ' /* ICMPv6 */
%EQUATE `IPPROTO_NONE = 59 ' /* IPv6 no next header */
%EQUATE `IPPROTO_DSTOPTS = 60 ' /* IPv6 destination options */
'#endif//(_WIN32_WINNT >= 0x0501)
%EQUATE `IPPROTO_ND = 77
'#if(_WIN32_WINNT >= 0x0501)
%EQUATE `IPPROTO_ICLFXBM = 78
'#endif//(_WIN32_WINNT >= 0x0501)
'#if(_WIN32_WINNT >= 0x0600)
%EQUATE `IPPROTO_PIM = 103
%EQUATE `IPPROTO_PGM = 113
%EQUATE `IPPROTO_L2TP = 115
%EQUATE `IPPROTO_SCTP = 132
'#endif//(_WIN32_WINNT >= 0x0600)
%EQUATE `IPPROTO_RAW = 255
%EQUATE `IPPROTO_MAX = 256
'//
'// These are reserved for internal use by Windows.
'//
' IPPROTO_RESERVED_RAW = 257,
' IPPROTO_RESERVED_IPSEC = 258,
' IPPROTO_RESERVED_IPSECOFFLOAD = 259,
' IPPROTO_RESERVED_MAX = 260
'} IPPROTO, *PIPROTO;
'//
'// Port/socket numbers: network standard functions
'//
%EQUATE `IPPORT_TCPMUX = 1
%EQUATE `IPPORT_ECHO = 7
%EQUATE `IPPORT_DISCARD = 9
%EQUATE `IPPORT_SYSTAT = 11
%EQUATE `IPPORT_DAYTIME = 13
%EQUATE `IPPORT_NETSTAT = 15
%EQUATE `IPPORT_QOTD = 17
%EQUATE `IPPORT_MSP = 18
%EQUATE `IPPORT_CHARGEN = 19
%EQUATE `IPPORT_FTP_DATA = 20
%EQUATE `IPPORT_FTP = 21
%EQUATE `IPPORT_TELNET = 23
%EQUATE `IPPORT_SMTP = 25
%EQUATE `IPPORT_TIMESERVER = 37
%EQUATE `IPPORT_NAMESERVER = 42
%EQUATE `IPPORT_WHOIS = 43
%EQUATE `IPPORT_MTP = 57
'/*
' * Port/socket numbers: host specific functions
' */
%EQUATE `IPPORT_TFTP = 69
%EQUATE `IPPORT_RJE = 77
%EQUATE `IPPORT_FINGER = 79
%EQUATE `IPPORT_TTYLINK = 87
%EQUATE `IPPORT_SUPDUP = 95
'/*
' * UNIX TCP sockets
' */
%EQUATE `IPPORT_POP3 = 110
%EQUATE `IPPORT_NTP = 123
%EQUATE `IPPORT_EPMAP = 135
%EQUATE `IPPORT_NETBIOS_NS = 137
%EQUATE `IPPORT_NETBIOS_DGM = 138
%EQUATE `IPPORT_NETBIOS_SSN = 139
%EQUATE `IPPORT_IMAP = 143
%EQUATE `IPPORT_SNMP = 161
%EQUATE `IPPORT_SNMP_TRAP = 162
%EQUATE `IPPORT_IMAP3 = 220
%EQUATE `IPPORT_LDAP = 389
%EQUATE `IPPORT_HTTPS = 443
%EQUATE `IPPORT_MICROSOFT_DS = 445
%EQUATE `IPPORT_EXECSERVER = 512
%EQUATE `IPPORT_LOGINSERVER = 513
%EQUATE `IPPORT_CMDSERVER = 514
%EQUATE `IPPORT_EFSSERVER = 520
'/*
' * UNIX UDP sockets
' */
%EQUATE `IPPORT_BIFFUDP = 512
%EQUATE `IPPORT_WHOSERVER = 513
%EQUATE `IPPORT_ROUTESERVER = 520
 ' /* 520+1 also used */
'/*
' * Ports < IPPORT_RESERVED are reserved for
' * privileged processes (e.g. root).
' */
%EQUATE `IPPORT_RESERVED = 1024
'#if (_WIN32_WINNT >= 0x0600)
%EQUATE `IPPORT_REGISTERED_MIN = %IPPORT_RESERVED
%EQUATE `IPPORT_REGISTERED_MAX = &Hbfff
%EQUATE `IPPORT_DYNAMIC_MIN = &Hc000
%EQUATE `IPPORT_DYNAMIC_MAX = &Hffff
'#endif //(_WIN32_WINNT >= 0x0600)
'/*
' * Definitions of bits in internet address integers.
' * On subnets, the decomposition of addresses to host and net parts
' * is done according to subnet mask, not the masks here.
' *
' * N.B. RFC-compliant definitions for host-order elements are named IN_xxx,
' * while network-order elements are named IN4_xxx.
' */
'#define IN_CLASSA(i) (((LONG)(i) & 0x80000000) == 0)
'#define IN_CLASSA_NET 0xff000000
'#define IN_CLASSA_NSHIFT 24
'#define IN_CLASSA_HOST 0x00ffffff
'#define IN_CLASSA_MAX 128
FUNCTION IN_CLASSA (BYVAL i AS DWORD) AS LONG
 FUNCTION = ((i AND &H80000000) = 0)
END FUNCTION
%EQUATE `IN_CLASSA_NET = &HFF000000
%EQUATE `IN_CLASSA_NSHIFT = 24
%EQUATE `IN_CLASSA_HOST = &H00FFFFFF
%EQUATE `IN_CLASSA_MAX = 128
'#define IN_CLASSB(i) (((LONG)(i) & 0xc0000000) == 0x80000000)
'#define IN_CLASSB_NET 0xffff0000
'#define IN_CLASSB_NSHIFT 16
'#define IN_CLASSB_HOST 0x0000ffff
'#define IN_CLASSB_MAX 65536
FUNCTION IN_CLASSB (BYVAL i AS DWORD) AS LONG
 FUNCTION = ((i AND &HC0000000) = &H80000000)
END FUNCTION
%EQUATE `IN_CLASSB_NET = &HFFFF0000
%EQUATE `IN_CLASSB_NSHIFT = 16
%EQUATE `IN_CLASSB_HOST = &H0000FFFF
%EQUATE `IN_CLASSB_MAX = 65536
'#define IN_CLASSC(i) (((LONG)(i) & 0xe0000000) == 0xc0000000)
'#define IN_CLASSC_NET 0xffffff00
'#define IN_CLASSC_NSHIFT 8
'#define IN_CLASSC_HOST 0x000000ff
FUNCTION IN_CLASSC (BYVAL i AS DWORD) AS LONG
 FUNCTION = ((i AND &He0000000) = &Hc0000000)
END FUNCTION
%EQUATE `IN_CLASSC_NET = &HFFFFFF00
%EQUATE `IN_CLASSC_NSHIFT = 8
%EQUATE `IN_CLASSC_HOST = &H000000FF
'#define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000)
'#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */
'#define IN_CLASSD_NSHIFT 28 /* net and host fields, but */
'#define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */
'#define IN_MULTICAST(i) IN_CLASSD(i)
FUNCTION IN_CLASSD (BYVAL i AS DWORD) AS LONG
 FUNCTION = -((i AND &HF0000000) = &HE0000000)
END FUNCTION
%EQUATE `IN_CLASSD_NET = &HF0000000 ' These ones aren't really
%EQUATE `IN_CLASSD_NSHIFT = 28 ' net and host fields, but
%EQUATE `IN_CLASSD_HOST = &H0FFFFFFF ' routing needn't know.
FUNCTION IN_MULTICAST (BYVAL i AS DWORD) AS LONG
 FUNCTION = IN_CLASSD(i)
END FUNCTION
'#define INADDR_ANY (ULONG)0x00000000
'#define INADDR_LOOPBACK 0x7f000001
'#define INADDR_BROADCAST (ULONG)0xffffffff
'#define INADDR_NONE 0xffffffff
%EQUATE `INADDR_ANY = &H00000000
%EQUATE `INADDR_LOOPBACK = &H7F000001
%EQUATE `INADDR_BROADCAST = &HFFFFFFFF
%EQUATE `INADDR_NONE = &HFFFFFFFF
'//
'// Scope ID definition
'//
' enum SCOPE_LEVEL
%EQUATE `ScopeLevelInterface = 1
%EQUATE `ScopeLevelLink = 2
%EQUATE `ScopeLevelSubnet = 3
%EQUATE `ScopeLevelAdmin = 4
%EQUATE `ScopeLevelSite = 5
%EQUATE `ScopeLevelOrganization = 8
%EQUATE `ScopeLevelGlobal = 14
%EQUATE `ScopeLevelCount = 16
'typedef struct {
' union {
' struct {
' ULONG Zone : 28;
' ULONG Level : 4;
' };
' ULONG Value;
' };
'} SCOPE_ID, *PSCOPE_ID;
' // Size = 4 bytes
TYPE SCOPE_ID_UNION_STRUCT DWORD
 Zone AS BIT * 28 IN DWORD
 Level AS BIT * 4
END TYPE
' // Size = 4 bytes
UNION SCOPE_ID_UNION DWORD
 SCOPE_ID_UNION_STRUCT
 Value AS DWORD
END UNION
' // Size = 4 bytes
TYPE SCOPE_ID DWORD
 SCOPE_ID_UNION
END TYPE
%EQUATE `SCOPEID_UNSPECIFIED_INIT = 0
'//
'// IPv4 Socket address, Internet style
'//
'typedef struct sockaddr_in {
'#if(_WIN32_WINNT < 0x0600)
' short sin_family;
'#else //(_WIN32_WINNT < 0x0600)
' ADDRESS_FAMILY sin_family;
'#endif //(_WIN32_WINNT < 0x0600)
' USHORT sin_port;
' IN_ADDR sin_addr;
' CHAR sin_zero[8];
'} SOCKADDR_IN, *PSOCKADDR_IN;
UNION SOCKADDR_IN_SIN_ZERO_UNION
 sin_zero AS STRING * 8
 ' // For compatibility with the PB declares
 sin_zero(7) AS BYTE
END UNION
' // Size = 16 bytes
TYPE SOCKADDR_IN BYTE
 sin_family AS INTEGER
 sin_port AS WORD
 sin_addr AS in_addr
 SOCKADDR_IN_SIN_ZERO_UNION
END TYPE
'//
'// Datalink (MAC) address
'//
'// If you don't use the entire sdl_data field, then fill it starting with the low
'// bytes...
'//
'#if(_WIN32_WINNT >= 0x0601)
' // Size = 14 bytes
TYPE SOCKADDR_DL BYTE
 sdl_family AS WORD ' ADDRESS_FAMILY
 sdl_data(7) AS BYTE ' UCHAR[8]
 sdl_zero(3) AS BYTE ' UCHAR[4]
END TYPE
'#endif //(_WIN32_WINNT >= 0x0601)
'#define IOCPARM_MASK 0x7f /* parameters must be < 128 bytes */
'#define IOC_VOID 0x20000000 /* no parameters */
'#define IOC_OUT 0x40000000 /* copy out parameters */
'#define IOC_IN 0x80000000 /* copy in parameters */
'#define IOC_INOUT (IOC_IN|IOC_OUT)
' /* 0x20000000 distinguishes new &
' old ioctl's */
'#define _IO(x,y) (IOC_VOID|((x)<<8)|(y))
'#define _IOR(x,y,t) (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
'#define _IOW(x,y,t) (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
%EQUATE `IOCPARM_MASK = &H7F ' parameters must be < 128 bytes
%EQUATE `IOC_VOID = &H20000000 ' no parameters
%EQUATE `IOC_OUT = &H40000000 ' copy out parameters
%EQUATE `IOC_IN = &H80000000 ' copy in parameters
%EQUATE `IOC_INOUT = (%IOC_IN OR %IOC_OUT) ' &H20000000 distinguishes new &
 ' old ioctl's
FUNCTION IO_ (BYVAL x AS STRING, BYVAL y AS BYTE) AS DWORD
 LOCAL t AS DWORD
 t = ASC(x)
 SHIFT LEFT t, 8
 FUNCTION = (%IOC_VOID OR t OR y)
END FUNCTION
FUNCTION IOR_ (BYVAL x AS STRING, BYVAL y AS BYTE, BYVAL t AS DWORD) AS DWORD
 LOCAL t1 AS DWORD
 LOCAL t2 AS DWORD
 t1 = t AND %IOCPARM_MASK
 SHIFT LEFT t1, 16
 t2 = ASC(x)
 SHIFT LEFT t2, 8
 FUNCTION = (%IOC_OUT OR t1 OR t2 OR y)
END FUNCTION
FUNCTION IOW_ (BYVAL x AS STRING, BYVAL y AS BYTE, BYVAL t AS DWORD) AS DWORD
 LOCAL t1 AS DWORD
 LOCAL t2 AS DWORD
 t1 = t AND %IOCPARM_MASK
 SHIFT LEFT t1, 16
 t2 = ASC(x)
 SHIFT LEFT t2, 8
 FUNCTION = (%IOC_IN OR t1 OR t2 OR y)
END FUNCTION
'/*
' * WinSock 2 extension -- WSABUF and QOS struct, include qos.h
' * to pull in FLOWSPEC and related definitions
' */
'typedef struct _WSABUF {
' ULONG len; /* the length of the buffer */
'} WSABUF, FAR * LPWSABUF;
' // Size = 8 bytes
TYPE WSABUF DWORD
 dLen AS DWORD ' the length of the buffer
 buf AS BYTE PTR ' the pointer to the buffer
END TYPE
'/*
' * WSAMSG -- for WSASendMsg
' */
'typedef struct _WSAMSG {
' INT namelen; /* Remote address length */
' LPWSABUF lpBuffers; /* Data buffer array */
'#if(_WIN32_WINNT >= 0x0600)
' ULONG dwBufferCount; /* Number of elements in the array */
'#else
' DWORD dwBufferCount; /* Number of elements in the array */
'#endif //(_WIN32_WINNT>=0x0600)
' WSABUF Control; /* Control buffer */
'#if(_WIN32_WINNT >= 0x0600)
' ULONG dwFlags; /* Flags */
'#else
' DWORD dwFlags; /* Flags */
'#endif //(_WIN32_WINNT>=0x0600)
'} WSAMSG, *PWSAMSG, * FAR LPWSAMSG;
UNION WSAMSG_NAME_UNION
 name AS SOCKADDR PTR ' LPSOCKADDR /* Remote address */
 saName AS SOCKADDR PTR ' LPSOCKADDR /* Remote address */
END UNION
' // Size = 28 bytes
TYPE WSAMSG BYTE
 WSAMSG_NAME_UNION
 namelen AS LONG ' INT /* Remote address length */
 lpBuffers AS WSABUF PTR ' LPWSABUF /* Data buffer array */
 dwBufferCount AS DWORD ' DWORD /* Number of elements in the array */
 Control AS WSABUF ' WSABUF /* Control buffer */
 dwFlags AS DWORD ' DWORD /* Flags */
END TYPE
'/*
' * Layout of ancillary data objects in the control buffer (RFC 2292).
' */
'#if(_WIN32_WINNT >= 0x0600)
'#define _WSACMSGHDR cmsghdr
'#endif //(_WIN32_WINNT>=0x0600)
' // Size = 12 bytes
TYPE WSACMSGHDR DWORD
 cmsg_len AS DWORD ' SIZE_T
 cmsg_level AS LONG ' INT
 cmsg_type AS LONG ' INT
 ' /* followed by UCHAR cmsg_data[] */
END TYPE
'#if(_WIN32_WINNT >= 0x0600)
'typedef WSACMSGHDR CMSGHDR, *PCMSGHDR;
'#endif //(_WIN32_WINNT>=0x0600)
'/*
' * Alignment macros for header and data members of
' * the control buffer.
' */
'#define WSA_CMSGHDR_ALIGN(length) \
' ( ((length) + TYPE_ALIGNMENT(WSACMSGHDR)-1) & \
' (~(TYPE_ALIGNMENT(WSACMSGHDR)-1)) ) \
'#define WSA_CMSGDATA_ALIGN(length) \
' ( ((length) + MAX_NATURAL_ALIGNMENT-1) & \
' (~(MAX_NATURAL_ALIGNMENT-1)) )
'#if(_WIN32_WINNT >= 0x0600)
'#define CMSGHDR_ALIGN WSA_CMSGHDR_ALIGN
'#define CMSGDATA_ALIGN WSA_CMSGDATA_ALIGN
'#endif //(_WIN32_WINNT>=0x0600)
'/*
' * WSA_CMSG_FIRSTHDR
' *
' * Returns a pointer to the first ancillary data object,
' * or a null pointer if there is no ancillary data in the
' * control buffer of the WSAMSG structure.
' *
' * LPCMSGHDR
' * WSA_CMSG_FIRSTHDR (
' * LPWSAMSG msg
' * );
' */
'#define WSA_CMSG_FIRSTHDR(msg) \
' ( ((msg)->Control.len >= sizeof(WSACMSGHDR)) \
' ? (LPWSACMSGHDR)(msg)->Control.buf \
' : (LPWSACMSGHDR)NULL )
'#if(_WIN32_WINNT >= 0x0600)
'#define CMSG_FIRSTHDR WSA_CMSG_FIRSTHDR
'#endif //(_WIN32_WINNT>=0x0600)
'/*
' * WSA_CMSG_NXTHDR
' *
' * Returns a pointer to the next ancillary data object,
' * or a null if there are no more data objects.
' *
' * LPCMSGHDR
' * WSA_CMSG_NEXTHDR (
' * LPWSAMSG msg,
' * LPWSACMSGHDR cmsg
' * );
' */
'#define WSA_CMSG_NXTHDR(msg, cmsg) \
' ( ((cmsg) == NULL) \
' ? WSA_CMSG_FIRSTHDR(msg) \
' : ( ( ((PUCHAR)(cmsg) + \
' WSA_CMSGHDR_ALIGN((cmsg)->cmsg_len) + \
' sizeof(WSACMSGHDR) ) > \
' (PUCHAR)((msg)->Control.buf) + \
' (msg)->Control.len ) \
' ? (LPWSACMSGHDR)NULL \
' : (LPWSACMSGHDR)((PUCHAR)(cmsg) + \
' WSA_CMSGHDR_ALIGN((cmsg)->cmsg_len)) ) )
'#if(_WIN32_WINNT >= 0x0600)
'#define CMSG_NXTHDR WSA_CMSG_NXTHDR
'#endif //(_WIN32_WINNT>=0x0600)
'/*
' * WSA_CMSG_DATA
' *
' * Returns a pointer to the first byte of data (what is referred
' * to as the cmsg_data member though it is not defined in
' * the structure).
' *
' * Note that RFC 2292 defines this as CMSG_DATA, but that name
' * is already used by wincrypt.h, and so Windows has used WSA_CMSG_DATA.
' *
' * PUCHAR
' * WSA_CMSG_DATA (
' * LPWSACMSGHDR pcmsg
' * );
' */
'#define WSA_CMSG_DATA(cmsg) \
' ( (PUCHAR)(cmsg) + WSA_CMSGDATA_ALIGN(sizeof(WSACMSGHDR)) )
'/*
' * WSA_CMSG_SPACE
' *
' * Returns total size of an ancillary data object given
' * the amount of data. Used to allocate the correct amount
' * of space.
' *
' * SIZE_T
' * WSA_CMSG_SPACE (
' * SIZE_T length
' * );
' */
'#define WSA_CMSG_SPACE(length) \
' (WSA_CMSGDATA_ALIGN(sizeof(WSACMSGHDR) + WSA_CMSGHDR_ALIGN(length)))
'#if(_WIN32_WINNT >= 0x0600)
'#define CMSG_SPACE WSA_CMSG_SPACE
'#endif //(_WIN32_WINNT>=0x0600)
'/*
' * WSA_CMSG_LEN
' *
' * Returns the value to store in cmsg_len given the amount of data.
' *
' * SIZE_T
' * WSA_CMSG_LEN (
' * SIZE_T length
' * );
' */
'#define WSA_CMSG_LEN(length) \
' (WSA_CMSGDATA_ALIGN(sizeof(WSACMSGHDR)) + length)
'#if(_WIN32_WINNT >= 0x0600)
'#define CMSG_LEN WSA_CMSG_LEN
'#endif //(_WIN32_WINNT>=0x0600)
'/*
' * Definition for flags member of the WSAMSG structure
' * This is in addition to other MSG_xxx flags defined
' * for recv/recvfrom/send/sendto.
' */
%EQUATE `MSG_TRUNC = &H0100
%EQUATE `MSG_CTRUNC = &H0200
%EQUATE `MSG_BCAST = &H0400
%EQUATE `MSG_MCAST = &H0800
'//
'// Flags used in "hints" argument to getaddrinfo()
'// - AI_ADDRCONFIG is supported starting with Vista
'// - default is AI_ADDRCONFIG ON whether the flag is set or not
'// because the performance penalty in not having ADDRCONFIG in
'// the multi-protocol stack environment is severe;
'// this defaulting may be disabled by specifying the AI_ALL flag,
'// in that case AI_ADDRCONFIG must be EXPLICITLY specified to
'// enable ADDRCONFIG behavior
'//
%EQUATE `AI_PASSIVE = &H00000001 ' // Socket address will be used in bind() call
%EQUATE `AI_CANONNAME = &H00000002 ' // Return canonical name in first ai_canonname
%EQUATE `AI_NUMERICHOST = &H00000004 ' // Nodename must be a numeric address string
%EQUATE `AI_NUMERICSERV = &H00000008 ' // Servicename must be a numeric port number
%EQUATE `AI_ALL = &H00000100 ' // Query both IP6 and IP4 with AI_V4MAPPED
%EQUATE `AI_ADDRCONFIG = &H00000400 ' // Resolution only if global address configured
%EQUATE `AI_V4MAPPED = &H00000800 ' // On v6 failure, query v4 and convert to V4MAPPED format
%EQUATE `AI_NON_AUTHORITATIVE = &H00004000 ' // LUP_NON_AUTHORITATIVE
%EQUATE `AI_SECURE = &H00008000 ' // LUP_SECURE
%EQUATE `AI_RETURN_PREFERRED_NAMES = &H00010000 ' // LUP_RETURN_PREFERRED_NAMES
%EQUATE `AI_FQDN = &H00020000 ' // Return the FQDN in ai_canonname
%EQUATE `AI_FILESERVER = &H00040000 ' // Resolving fileserver name resolution
'//
'// Structure used in getaddrinfo() call
'//
' // Size = 32 bytes
TYPE ADDRINFOA DWORD
 ai_flags AS LONG ' int // AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST
 ai_family AS LONG ' int // PF_xxx
 ai_socktype AS LONG ' int // SOCK_xxx
 ai_protocol AS LONG ' int // 0 or IPPROTO_xxx for IPv4 and IPv6
 ai_addrlen AS DWORD ' size_t // Length of ai_addr
 ai_canonname AS ASCIIZ PTR ' char * // Canonical name for nodename
 ai_addr AS SOCKADDR PTR
 ai_next AS ADDRINFOA PTR ' struct addrinfo * // Next structure in linked list
END TYPE
' // Size = 32 bytes
TYPE ADDRINFOW DWORD
 ai_flags AS LONG ' int // AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST
 ai_family AS LONG ' int // PF_xxx
 ai_socktype AS LONG ' int // SOCK_xxx
 ai_protocol AS LONG ' int // 0 or IPPROTO_xxx for IPv4 and IPv6
 ai_addrlen AS DWORD ' size_t // Length of ai_addr
 ai_canonname AS WSTRINGZ PTR ' PWSTR // Canonical name for nodename
 ai_addr AS SOCKADDR PTR
 ai_next AS ADDRINFOW PTR ' struct addrinfo * // Next structure in linked list
END TYPE
#IF %DEF(%UNICODE)
 MACRO ADDRINFO = ADDRINFOW
#ELSE
 MACRO ADDRINFO = ADDRINFOA
#ENDIF
'#if (_WIN32_WINNT >= 0x0600)
' // Size = 44 bytes
TYPE ADDRINFOEXA DWORD
 ai_flags AS LONG ' int // AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST
 ai_family AS LONG ' int // PF_xxx
 ai_socktype AS LONG ' int // SOCK_xxx
 ai_protocol AS LONG ' int // 0 or IPPROTO_xxx for IPv4 and IPv6
 ai_addrlen AS DWORD ' size_t // Length of ai_addr
 ai_canonname AS ASCIIZ PTR ' char * // Canonical name for nodename
 ai_addr AS SOCKADDR PTR ' struct sockaddr * // Binary address
 ai_blob AS DWORD ' void *
 ai_bloblen AS DWORD ' size_t
 ai_provider AS GUID PTR
 ai_next AS ADDRINFOEXA PTR ' struct addrinfoexA * // Next structure in linked list
END TYPE
' // Size = 44 bytes
TYPE ADDRINFOEXW DWORD
 ai_flags AS LONG ' int // AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST
 ai_family AS LONG ' int // PF_xxx
 ai_socktype AS LONG ' int // SOCK_xxx
 ai_protocol AS LONG ' int // 0 or IPPROTO_xxx for IPv4 and IPv6
 ai_addrlen AS DWORD ' size_t // Length of ai_addr
 ai_canonname AS WSTRINGZ PTR ' PWSTR // Canonical name for nodename
 ai_addr AS SOCKADDR PTR
 ai_blob AS DWORD
 ai_bloblen AS DWORD ' size_t
 ai_provider AS GUID PTR
 ai_next AS ADDRINFOEXW PTR ' struct addrinfoexW * // Next structure in linked list
END TYPE
#IF %DEF(%UNICODE)
 MACRO ADDRINFOEX = ADDRINFOEXW
#ELSE
 MACRO ADDRINFOEX = ADDRINFOEXA
#ENDIF
'#endif
'//
'// Flags for getaddrinfo()
'//
'// Name Spaces
%EQUATE `NS_ALL = 0
%EQUATE `NS_SAP = 1
%EQUATE `NS_NDS = 2
%EQUATE `NS_PEER_BROWSE = 3
%EQUATE `NS_SLP = 5
%EQUATE `NS_DHCP = 6
%EQUATE `NS_TCPIP_LOCAL = 10
%EQUATE `NS_TCPIP_HOSTS = 11
%EQUATE `NS_DNS = 12
%EQUATE `NS_NETBT = 13
%EQUATE `NS_WINS = 14
'#if(_WIN32_WINNT >= 0x0501)
%EQUATE `NS_NLA = 15 ' /* Network Location Awareness */
'#endif //(_WIN32_WINNT >= 0x0501)
'#if(_WIN32_WINNT >= 0x0600)
%EQUATE `NS_BTH = 16 ' /* Bluetooth SDP Namespace */
'#endif //(_WIN32_WINNT >= 0x0600)
%EQUATE `NS_NBP = 20
%EQUATE `NS_MS = 30
%EQUATE `NS_STDA = 31
%EQUATE `NS_NTDS = 32
'#if(_WIN32_WINNT >= 0x0600)
%EQUATE `NS_EMAIL = 37
%EQUATE `NS_PNRPNAME = 38
%EQUATE `NS_PNRPCLOUD = 39
'#endif //(_WIN32_WINNT >= 0x0600)
%EQUATE `NS_X500 = 40
%EQUATE `NS_NIS = 41
%EQUATE `NS_NISPLUS = 42
%EQUATE `NS_WRQ = 50
%EQUATE `NS_NETDES = 60 ' /* Network Designers Limited */
'//
'// Flags for getnameinfo()
'//
%EQUATE `NI_NOFQDN = &H01 ' /* Only return nodename portion for local hosts */
%EQUATE `NI_NUMERICHOST = &H02 ' /* Return numeric form of the host's address */
%EQUATE `NI_NAMEREQD = &H04 ' /* Error if the host's name not in DNS */
%EQUATE `NI_NUMERICSERV = &H08 ' /* Return numeric form of the service (port #) */
%EQUATE `NI_DGRAM = &H10 ' /* Service is a datagram service */
%EQUATE `NI_MAXHOST = 1025 ' /* Max size of a fully-qualified domain name */
%EQUATE `NI_MAXSERV = 32 ' /* Max size of a service name */
'#pragma warning(pop)
#ENDIF ' #IF NOT %DEF(%WS2DEF_INC)
'#ENDIF ' #IF NOT %DEF(%WINSOCK2_INC)
#ENDIF ' #IF NOT %DEF(%WINSOCK_INC)
#ENDIF
