📄 winsock2.inc
字号:
; Winsock2.h -- definitions to be used with the WinSock 2 DLL and
; * WinSock 2 applications.
; *
; * This header file corresponds to version 2.2.x of the WinSock API
; * specification.
; *
; * This file includes parts which are Copyright (c) 1982-1986 Regents
; * of the University of California. All rights reserved. The
; * Berkeley Software License Agreement specifies the terms and
; * conditions for redistribution.
; */
WSADESCRIPTION_LEN = 256
WSASYS_STATUS_LEN = 128
WSAData STRUCT
wVersion WORD ?
wHighVersion WORD ?
szDescription db WSADESCRIPTION_LEN+1 dup (?)
szSystemStatus db WSASYS_STATUS_LEN+1 dup (?)
iMaxSockets WORD ?
iMaxUdpDg WORD ?
lpVendorInfo DWORD ?
WSAData ENDS
; ======= Address families =========
AF_UNSPEC = 0 ; unspecified */
AF_UNIX = 1 ; local to host (pipes, portals) */
AF_INET = 2 ; internetwork: UDP, TCP, etc. */
AF_IMPLINK = 3 ; arpanet imp addresses */
AF_PUP = 4 ; pup protocols: e.g. BSP */
AF_CHAOS = 5 ; mit CHAOS protocols */
AF_NS = 6 ; XEROX NS protocols */
AF_IPX = AF_NS ; IPX protocols: IPX, SPX, etc. */
AF_ISO = 7 ; ISO protocols */
AF_OSI = AF_ISO ; OSI is ISO */
AF_ECMA = 8 ; european computer manufacturers */
AF_DATAKIT = 9 ; datakit protocols */
AF_CCITT = 10 ; CCITT protocols, X.25 etc */
AF_SNA = 11 ; IBM SNA */
AF_DECnet = 12 ; DECnet */
AF_DLI = 13 ; Direct data link interface */
AF_LAT = 14 ; LAT */
AF_HYLINK = 15 ; NSC Hyperchannel */
AF_APPLETALK = 16 ; AppleTalk */
AF_NETBIOS = 17 ; NetBios-style addresses */
AF_VOICEVIEW = 18 ; VoiceView */
AF_FIREFOX = 19 ; Protocols from Firefox */
AF_UNKNOWN1 = 20 ; Somebody is using this! */
AF_BAN = 21 ; Banyan */
AF_ATM = 22 ; Native ATM Services */
AF_INET6 = 23 ; Internetwork Version 6 */
AF_MAX = 24
; ====== Types =======
SOCK_STREAM = 1 ; stream socket */
SOCK_DGRAM = 2 ; datagram socket */
SOCK_RAW = 3 ; raw-protocol interface */
SOCK_RDM = 4 ; reliably-delivered message */
SOCK_SEQPACKET = 5 ; sequenced packet stream */
; ====== Protocols ========
IPPROTO_IP = 0 ; dummy for IP */
IPPROTO_ICMP = 1 ; control message protocol */
IPPROTO_IGMP = 2 ; internet group management protocol */
IPPROTO_GGP = 3 ; gateway^2 (deprecated) */
IPPROTO_TCP = 6 ; tcp */
IPPROTO_PUP = 12 ; pup */
IPPROTO_UDP = 17 ; user datagram protocol */
IPPROTO_IDP = 22 ; xns idp */
IPPROTO_ND = 77 ; UNOFFICIAL net disk proto */
IPPROTO_RAW = 255 ; raw IP packet */
IPPROTO_MAX = 256
SOCKET equ <DWORD>
IN_ADDR equ <DWORD>
SOCKET_ERROR = -1
INVALID_SOCKET = -1
; Level number for (get/set)sockopt() to apply to socket itself.
SOL_SOCKET = 0ffffh ; options for socket level */
; The sockaddr structure varies depending on the the protocol selected.
; The structure below is used with TCP/IP.
; Other protocols use similar structures.
; * Socket address, internet style. *
SOCKADDR_IN STRUCT
sin_family WORD ?
sin_port WORD ?
sin_addr IN_ADDR ?
sin_zero db 8 dup(0)
SOCKADDR_IN ENDS
SOCKADDR_INsize = 2+2+4+8
INADDR_NONE = 0ffffffffh
HOSTENT STRUCT
h_name DWORD ?
h_aliases DWORD ?
h_addrtype WORD ?
h_length WORD ?
h_addr_list DWORD ?
HOSTENT ENDS
SERVENT STRUCT
s_name DWORD ?
s_aliases DWORD ?
s_port WORD ?
s_proto DWORD ?
SERVENT ENDS
; ======= Option flags per-socket ========
SO_DEBUG = 0001h ; turn on debugging info recording */
SO_ACCEPTCONN = 0002h ; socket has had listen() */
SO_REUSEADDR = 0004h ; allow local address reuse */
SO_KEEPALIVE = 0008h ; keep connections alive */
SO_DONTROUTE = 0010h ; just use interface addresses */
SO_BROADCAST = 0020h ; permit sending of broadcast msgs */
SO_USELOOPBACK = 0040h ; bypass hardware when possible */
SO_LINGER = 0080h ; linger on close if data present */
SO_OOBINLINE = 0100h ; leave received OOB data in line */
;SO_DONTLINGER (int)(~SO_LINGER)
; Additional options.
SO_SNDBUF = 1001h ; send buffer size */
SO_RCVBUF = 1002h ; receive buffer size */
SO_SNDLOWAT = 1003h ; send low-water mark */
SO_RCVLOWAT = 1004h ; receive low-water mark */
SO_SNDTIMEO = 1005h ; send timeout */
SO_RCVTIMEO = 1006h ; receive timeout */
SO_ERROR = 1007h ; get error status and clear */
SO_TYPE = 1008h ; get socket type */
; WinSock 2 extension -- new options
SO_GROUP_ID = 2001h ; ID of a socket group */
SO_GROUP_PRIORITY = 2002h ; the relative priority within a group*/
SO_MAX_MSG_SIZE = 2003h ; maximum message size */
SO_PROTOCOL_INFOA = 2004h ; WSAPROTOCOL_INFOA structure */
SO_PROTOCOL_INFOW = 2005h ; WSAPROTOCOL_INFOW structure */
;SO_PROTOCOL_INFO = SO_PROTOCOL_INFOW
SO_PROTOCOL_INFO = SO_PROTOCOL_INFOA
PVD_CONFIG = 3001h ; configuration info for service provider */
; TCP options.
TCP_NODELAY = 0001h
; WinSock 2 extension - bit values and indices for FD_XXX network events
FD_READ = 0001h
FD_WRITE = 0002h
FD_OOB = 0004h
FD_ACCEPT = 0008h
FD_CONNECT = 0010h
FD_CLOSE = 0020h
FD_QOS = 0040h
FD_GROUP_QOS = 0080h
FD_ALL_EVENTS = 00FFh
; ***************************** ERRORS ***********************************
; * All Windows Sockets error constants are biased
; by WSABASEERR from the "normal" *
WSABASEERR = 10000
; Windows Sockets definitions of regular Microsoft C error constants
WSAEINTR = WSABASEERR+4
WSAEBADF = WSABASEERR+9
WSAEACCES = WSABASEERR+13
WSAEFAULT = WSABASEERR+14
WSAEINVAL = WSABASEERR+22
WSAEMFILE = WSABASEERR+24
; Windows Sockets definitions of regular Berkeley error constants
WSAEWOULDBLOCK = WSABASEERR+35
WSAEINPROGRESS = WSABASEERR+36
WSAEALREADY = WSABASEERR+37
WSAENOTSOCK = WSABASEERR+38
WSAEDESTADDRREQ = WSABASEERR+39
WSAEMSGSIZE = WSABASEERR+40
WSAEPROTOTYPE = WSABASEERR+41
WSAENOPROTOOPT = WSABASEERR+42
WSAEPROTONOSUPPORT = WSABASEERR+43
WSAESOCKTNOSUPPORT = WSABASEERR+44
WSAEOPNOTSUPP = WSABASEERR+45
WSAEPFNOSUPPORT = WSABASEERR+46
WSAEAFNOSUPPORT = WSABASEERR+47
WSAEADDRINUSE = WSABASEERR+48
WSAEADDRNOTAVAIL = WSABASEERR+49
WSAENETDOWN = WSABASEERR+50
WSAENETUNREACH = WSABASEERR+51
WSAENETRESET = WSABASEERR+52
WSAECONNABORTED = WSABASEERR+53
WSAECONNRESET = WSABASEERR+54
WSAENOBUFS = WSABASEERR+55
WSAEISCONN = WSABASEERR+56
WSAENOTCONN = WSABASEERR+57
WSAESHUTDOWN = WSABASEERR+58
WSAETOOMANYREFS = WSABASEERR+59
WSAETIMEDOUT = WSABASEERR+60
WSAECONNREFUSED = WSABASEERR+61
WSAELOOP = WSABASEERR+62
WSAENAMETOOLONG = WSABASEERR+63
WSAEHOSTDOWN = WSABASEERR+64
WSAEHOSTUNREACH = WSABASEERR+65
WSAENOTEMPTY = WSABASEERR+66
WSAEPROCLIM = WSABASEERR+67
WSAEUSERS = WSABASEERR+68
WSAEDQUOT = WSABASEERR+69
WSAESTALE = WSABASEERR+70
WSAEREMOTE = WSABASEERR+71
; Extended Windows Sockets error constant definitions
WSASYSNOTREADY = WSABASEERR+91
WSAVERNOTSUPPORTED = WSABASEERR+92
WSANOTINITIALISED = WSABASEERR+93
WSAEDISCON = WSABASEERR+101
WSAENOMORE = WSABASEERR+102
WSAECANCELLED = WSABASEERR+103
WSAEINVALIDPROCTABLE = WSABASEERR+104
WSAEINVALIDPROVIDER = WSABASEERR+105
WSAEPROVIDERFAILEDINIT = WSABASEERR+106
WSASYSCALLFAILURE = WSABASEERR+107
WSASERVICE_NOT_FOUND = WSABASEERR+108
WSATYPE_NOT_FOUND = WSABASEERR+109
WSA_E_NO_MORE = WSABASEERR+110
WSA_E_CANCELLED = WSABASEERR+111
WSAEREFUSED = WSABASEERR+112
; * Error return codes from gethostbyname= and gethostbyaddr=
; * = when using the resolver. Note that these errors are
; * retrieved via WSAGetLastError= and must therefore follow
; * the rules for avoiding clashes with error numbers from
; * specific implementations or language run-time systems.
; * For this reason the codes are based at WSABASEERR+1001.
; * Note also that [WSA]NO_ADDRESS is defined only for
; * compatibility purposes.
; Authoritative Answer: Host not found
WSAHOST_NOT_FOUND = WSABASEERR+1001
HOST_NOT_FOUND = WSAHOST_NOT_FOUND
; Non-Authoritative: Host not found, or SERVERFAIL
WSATRY_AGAIN = WSABASEERR+1002
TRY_AGAIN = WSATRY_AGAIN
; Non-recoverable errors, FORMERR, REFUSED, NOTIMP
WSANO_RECOVERY = WSABASEERR+1003
NO_RECOVERY = WSANO_RECOVERY
; Valid name, no data record of requested type
WSANO_DATA = WSABASEERR+1004
NO_DATA = WSANO_DATA
; no address, look for MX record
WSANO_ADDRESS = WSANO_DATA
NO_ADDRESS = WSANO_ADDRESS
; * Windows Sockets errors redefined as regular Berkeley error constants.
; * These are commented out in Windows NT to avoid conflicts with errno.h.
; * Use the WSA constants instead.
EWOULDBLOCK = WSAEWOULDBLOCK
EINPROGRESS = WSAEINPROGRESS
EALREADY = WSAEALREADY
ENOTSOCK = WSAENOTSOCK
EDESTADDRREQ = WSAEDESTADDRREQ
EMSGSIZE = WSAEMSGSIZE
EPROTOTYPE = WSAEPROTOTYPE
ENOPROTOOPT = WSAENOPROTOOPT
EPROTONOSUPPORT = WSAEPROTONOSUPPORT
ESOCKTNOSUPPORT = WSAESOCKTNOSUPPORT
EOPNOTSUPP = WSAEOPNOTSUPP
EPFNOSUPPORT = WSAEPFNOSUPPORT
EAFNOSUPPORT = WSAEAFNOSUPPORT
EADDRINUSE = WSAEADDRINUSE
EADDRNOTAVAIL = WSAEADDRNOTAVAIL
ENETDOWN = WSAENETDOWN
ENETUNREACH = WSAENETUNREACH
ENETRESET = WSAENETRESET
ECONNABORTED = WSAECONNABORTED
ECONNRESET = WSAECONNRESET
ENOBUFS = WSAENOBUFS
EISCONN = WSAEISCONN
ENOTCONN = WSAENOTCONN
ESHUTDOWN = WSAESHUTDOWN
ETOOMANYREFS = WSAETOOMANYREFS
ETIMEDOUT = WSAETIMEDOUT
ECONNREFUSED = WSAECONNREFUSED
ELOOP = WSAELOOP
ENAMETOOLONG = WSAENAMETOOLONG
EHOSTDOWN = WSAEHOSTDOWN
EHOSTUNREACH = WSAEHOSTUNREACH
ENOTEMPTY = WSAENOTEMPTY
EPROCLIM = WSAEPROCLIM
EUSERS = WSAEUSERS
EDQUOT = WSAEDQUOT
ESTALE = WSAESTALE
EREMOTE = WSAEREMOTE
; ************************************************************************
; Maximum queue length specifiable by listen.
SOMAXCONN = 07fffffffh
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -