File "WSCONST.INC"
Path: /zrok launcher/inc/WSCONST.INC
File size: 14.07 KB
MIME-type: text/plain
Charset: utf-8
'
' wsconst.inc
'
' Winsock constants and structures for use with 32-bit Power Basic
' Copied from winsock.inc as distributed by Power Basic with PB-DLL 5
'
#If Not %Def(%WSCONST_INC)
%WSCONST_INC = 1
%WSADESCRIPTION_LEN = 256
%WSASYS_STATUS_LEN = 128
%IPPROTO_IP = 0 ' dummy for IP
%IPPROTO_ICMP = 1 ' control message protocol
%IPPROTO_GGP = 2 ' 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
%IOCPARM_MASK = &H7F ' parameters must be < 128 bytes */
%IOC_VOID = &H20000000 ' no parameters */
%IOC_OUT = &H40000000 ' copy out parameters */
%IOC_IN = &H80000000 ' copy in parameters */
%IOC_INOUT = (%IOC_IN Or %IOC_OUT) ' 20000000 distinguishes new & old ioctl's
%FIONBIO = &H8004667E
%FIONSYNC = &H8004667D
%FIONREAD = &H4004667F
'
' Port/socket numbers: network standard functions
'
%IPPORT_ECHO = 7
%IPPORT_DISCARD = 9
%IPPORT_SYSTAT = 11
%IPPORT_DAYTIME = 13
%IPPORT_NETSTAT = 15
%IPPORT_FTP = 21
%IPPORT_TELNET = 23
%IPPORT_SMTP = 25
%IPPORT_TIMESERVER = 37
%IPPORT_NAMESERVER = 42
%IPPORT_WHOIS = 43
%IPPORT_MTP = 57
' * Port/socket numbers: host specific functions
%IPPORT_TFTP = 69
%IPPORT_RJE = 77
%IPPORT_FINGER = 79
%IPPORT_TTYLINK = 87
%IPPORT_SUPDUP = 95
' * UNIX TCP sockets
%IPPORT_EXECSERVER = 512
%IPPORT_LOGINSERVER = 513
%IPPORT_CMDSERVER = 514
%IPPORT_EFSSERVER = 520
' * UNIX UDP sockets
%IPPORT_BIFFUDP = 512
%IPPORT_WHOSERVER = 513
%IPPORT_ROUTESERVER = 520
' 520+1 also used
' * Ports < IPPORT_RESERVED are reserved for
' * privileged processes (e.g. root).
%IPPORT_RESERVED = 1024
' * Link numbers
%IMPLINK_IP = 155
%IMPLINK_LOWEXPER = 156
%IMPLINK_HIGHEXPER = 158
'%IN_CLASSA(i) = (((long)(i) & 0x80000000) == 0)
%IN_CLASSA_NET = &H0FF000000
%IN_CLASSA_NSHIFT = 24
%IN_CLASSA_HOST = &H000FFFFFF
%IN_CLASSA_MAX = 128
'%IN_CLASSB(i) = (((long)(i) & 0xc0000000) == 0x80000000)
%IN_CLASSB_NET = &H0FFFF0000
%IN_CLASSB_NSHIFT = 16
%IN_CLASSB_HOST = &H00000FFFF
%IN_CLASSB_MAX = 65536
'%IN_CLASSC(i) = (((long)(i) & 0xe0000000) == 0xc0000000)
%IN_CLASSC_NET = &H0FFFFFF00
%IN_CLASSC_NSHIFT = 8
%IN_CLASSC_HOST = &H0000000FF
%INADDR_ANY = &H000000000
%INADDR_LOOPBACK = &H07F000001
%INADDR_BROADCAST = &H0FFFFFFFF
%INADDR_NONE = &H0FFFFFFFF
%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
' * Option flags per-socket.
%SO_DEBUG = &H00001 ' turn on debugging info recording
%SO_ACCEPTCONN = &H00002 ' socket has had listen()
%SO_REUSEADDR = &H00004 ' allow local address reuse
%SO_KEEPALIVE = &H00008 ' keep connections alive
%SO_DONTROUTE = &H00010 ' just use interface addresses
%SO_BROADCAST = &H00020 ' permit sending of broadcast msgs
%SO_USELOOPBACK = &H00040 ' bypass hardware when possible
%SO_LINGER = &H00080 ' linger on close if data present
%SO_OOBINLINE = &H00100 ' leave received OOB data in line
%SOL_SOCKET = &H0FFFF 'options for socket level
%SO_DONTLINGER = Not %SO_LINGER
' * Additional options.
%SO_SNDBUF = &H01001 ' send buffer size
%SO_RCVBUF = &H01002 ' receive buffer size
%SO_SNDLOWAT = &H01003 ' send low-water mark
%SO_RCVLOWAT = &H01004 ' receive low-water mark
%SO_SNDTIMEO = &H01005 ' send timeout
%SO_RCVTIMEO = &H01006 ' receive timeout
%SO_ERROR = &H01007 ' get error status and clear
%SO_TYPE = &H01008 ' get socket type
' * TCP options.
%TCP_NODELAY = &H00001
' * 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 = 6 ' IPX and SPX
%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_MAX = 18
' * Protocol families, same as address families for now.
%PF_UNSPEC = %AF_UNSPEC
%PF_UNIX = %AF_UNIX
%PF_INET = %AF_INET
%PF_IMPLINK = %AF_IMPLINK
%PF_PUP = %AF_PUP
%PF_CHAOS = %AF_CHAOS
%PF_NS = %AF_NS
%PF_IPX = %AF_IPX
%PF_ISO = %AF_ISO
%PF_OSI = %AF_OSI
%PF_ECMA = %AF_ECMA
%PF_DATAKIT = %AF_DATAKIT
%PF_CCITT = %AF_CCITT
%PF_SNA = %AF_SNA
%PF_DECnet = %AF_DECnet
%PF_DLI = %AF_DLI
%PF_LAT = %AF_LAT
%PF_HYLINK = %AF_HYLINK
%PF_APPLETALK = %AF_APPLETALK
%PF_MAX = %AF_MAX
%SOMAXCONN = 5
%MSG_OOB = &H01 ' process out-of-band data
%MSG_PEEK = &H02 ' peek at incoming message
%MSG_DONTROUTE = &H04 ' send without using routing tables
%MSG_MAXIOVLEN = 16
' * Define constant based on rfc883, used by gethostbyxxxx() calls.
%MAXGETHOSTSTRUCT = 1024
' * Define flags to be used with the WSAAsyncSelect() call.
%FD_READ = &H001
%FD_WRITE = &H002
%FD_OOB = &H004
%FD_ACCEPT = &H008
%FD_CONNECT = &H010
%FD_CLOSE = &H020
' * 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
' * 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.
'%h_errno = WSAGetLastError()
' 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
%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
%FD_SETSIZE = 64
%INVALID_SOCKET = Not 0
%SOCKET_ERROR = -1
%SOCKET_BUFFER_SIZE = 512
%ICMP_ECHOREPLY = 0 'echo reply
%ICMP_ECHOREQ = 8 'echo request
Type fd_setstruc
fd_count As Long
fd_array (%FD_SETSIZE) As Long
End Type
Type timeval
tv_sec As Long
tv_usec As Long
End Type
Union in_addr
s_addr As Long
s As String * 4
End Union
Type sockaddr_in
sin_family As Integer
sin_port As Integer
sin_addr As in_addr
sin_zero As String * 8
End Type
Type sockaddr
sa_family As Integer
sa_data (14) As Integer
End Type
Type WSAdata
wVersion As Integer
wHighVersion As Integer
szDescription As Asciiz * %WSADESCRIPTION_LEN + 1
szSystemStatus As Asciiz * %WSASYS_STATUS_LEN + 1
iMaxSockets As Integer
iMaxUdpDg As Integer
lpVendorInfo As Asciiz Ptr
End Type
Type sockproto
sp_family As Integer
sp_protocol As Integer
End Type
Type linger
l_onoff As Integer
l_linger As Integer
End Type
Type hostentStru
h_name As Asciiz Ptr
h_alias As Asciiz Ptr
h_addr As Integer
h_len As Integer
h_list As Long Ptr
End Type
Type netent
n_name As Asciiz Ptr
n_aliases As Asciiz Ptr
n_addrtype As Integer
n_net As Long
End Type
Type servent
s_name As Asciiz Ptr
s_aliases As Asciiz Ptr
s_port As Integer
s_proto As Asciiz Ptr
End Type
Type netent2
p_name As Asciiz Ptr
p_aliases As Asciiz Ptr
p_proto As Integer
End Type
Type icmp_hdr
icmp_type As Byte
icmp_code As Byte
icmp_cksum As Integer
icmp_id As Integer
icmp_seq As Integer
icmp_data As String * 1
End Type
Type ip_hdr
ip_hlv As Byte ' header length+ version (4 bits each)
ip_tos As Byte 'type of service
ip_len As Word 'total len
ip_id As Word 'id
ip_off As Word 'fragment offset
ip_ttl As Byte 'time to live
ip_p As Byte 'protocol
ip_cksum As Word
ip_src As in_addr 'source address
ip_dest As in_addr 'dest address
End Type
Type ICMP_OPTIONS
Ttl As Byte
Tos As Byte
Flags As Byte
OptionsSize As Byte
OptionsData As Long
End Type
Type ICMP_ECHO_REPLY
Address As Long
Status As Long
RoundTripTime As Long
DataSize As Integer
Reserved As Integer
DataPointer As Long
Options As ICMP_OPTIONS
zData As Asciiz * 250
End Type
#ENDIF