Documentation ¶
Index ¶
- Constants
- Variables
- func Bind(s SOCKET, addr unsafe.Pointer, addrLen int32) (int, error)
- func BytePtrToString(bptr *byte) string
- func CloseSocket(s SOCKET) (int, error)
- func Connect(s SOCKET, name unsafe.Pointer, nameLen int32) (int, error)
- func FreeAddrInfoA(addrInfo *AddrInfoA) error
- func FreeAddrInfoW(addrInfo *AddrInfoW) error
- func GUIDToString(guid GUID) string
- func GetAddrInfoA(nodeName *byte, serviceName *byte, hints *AddrInfoA, result **AddrInfoA) (int, error)
- func GetAddrInfoW(nodeName *uint16, serviceName *uint16, hints *AddrInfoW, result **AddrInfoW) (int, error)
- func GetHostNameA(name *byte, namelen int) (int, error)
- func GetHostNameW(name *uint16, namelen int) (int, error)
- func GetNameInfoA(sockaddr unsafe.Pointer, sockaddrLength int32, nodeBuffer *byte, ...) (int, error)
- func GetNameInfoW(sockaddr unsafe.Pointer, sockaddrLength int32, nodeBuffer *uint16, ...) (int, error)
- func GetPeerName(s SOCKET, name unsafe.Pointer, nameLen int32) (int, error)
- func GetSockName(s SOCKET, name unsafe.Pointer, nameLen *int32) (int, error)
- func GetSockOpt(s SOCKET, level int32, optName int32, optVal unsafe.Pointer, optLen *int32) (int, error)
- func Htond(value float64) uint64
- func Htonf(value float32) uint32
- func Htonl(hostlong uint32) uint32
- func Htonll(value uint64) uint64
- func Htons(hostshort uint16) uint16
- func InetAddr(cp *byte) uint32
- func InetNtoa(addr *InAddr) string
- func InetNtop(family uint16, addr unsafe.Pointer, stringBuf *byte, stringBufSize int32) (*byte, error)
- func InetNtopW(family uint16, addr unsafe.Pointer, stringBuf *uint16, stringBufSize int32) (*uint16, error)
- func InetPton(family uint16, addrString *byte, addrBuf unsafe.Pointer) (int, error)
- func InetPtonW(family uint16, addrString *uint16, addrBuf unsafe.Pointer) (int, error)
- func IoctlSocket(s SOCKET, cmd uint32, argp *uint32) (int, error)
- func Listen(s SOCKET, backlog int32) (int, error)
- func Ntohl(netlong uint32) uint32
- func Ntohs(netshort uint16) uint16
- func Recv(s SOCKET, buf unsafe.Pointer, len int32, flags int32) (int, error)
- func RecvFrom(s SOCKET, buf unsafe.Pointer, len int32, flags int32, from unsafe.Pointer, ...) (int, error)
- func Select(nfds int32, readfds *FDSet, writefds *FDSet, exceptfds *FDSet, ...) (int, error)
- func Send(s SOCKET, buf unsafe.Pointer, len int32, flags int32) (int, error)
- func SendTo(s SOCKET, buf unsafe.Pointer, len int32, flags int32, to unsafe.Pointer, ...) (int, error)
- func SetSockOpt(s SOCKET, level int32, optName int32, optVal unsafe.Pointer, optLen int32) (int, error)
- func Shutdown(s SOCKET, how int32) (int, error)
- func UTF16PtrToString(ptr *uint16) (string, error)
- func WSAAddressToStringA(address unsafe.Pointer, addressLength uint32, protocolInfo *WSAProtocolInfoA, ...) (int, error)
- func WSAAddressToStringW(address unsafe.Pointer, addressLength uint32, protocolInfo *WSAProtocolInfoW, ...) (int, error)
- func WSACleanup() (bool, error)
- func WSACloseEvent(event WSAEVENT) (bool, error)
- func WSAConnect(s SOCKET, name unsafe.Pointer, namelen int32, callerData *WSABuf, ...) (int, error)
- func WSAConnectByNameA(s SOCKET, nodename *byte, servicename *byte, localAddressLength *uint32, ...) (bool, error)
- func WSAConnectByNameW(s SOCKET, nodename *uint16, servicename *uint16, localAddressLength *uint32, ...) (bool, error)
- func WSADuplicateSocketA(s SOCKET, processId uint32, protocolInfo *WSAProtocolInfoA) (bool, error)
- func WSADuplicateSocketW(s SOCKET, processId uint32, protocolInfo *WSAProtocolInfoW) (bool, error)
- func WSAEnumNameSpaceProvidersA(bufferLength *uint32, buffer *WSANameSpaceInfoA) (int, error)
- func WSAEnumNameSpaceProvidersExA(bufferLength *uint32, buffer *WSANameSpaceInfoExA) (int, error)
- func WSAEnumNameSpaceProvidersExW(bufferLength *uint32, buffer *WSANameSpaceInfoExW) (int, error)
- func WSAEnumNameSpaceProvidersW(bufferLength *uint32, buffer *WSANameSpaceInfoW) (int, error)
- func WSAEnumNetworkEvents(s SOCKET, eventObject WSAEVENT, networkEvents *WSANetworkEvents) (int, error)
- func WSAEnumProtocolsA(protocols *int32, protocolBuffer *WSAProtocolInfoA, bufferLength *uint32) (int, error)
- func WSAEnumProtocolsW(protocols *int32, protocolBuffer *WSAProtocolInfoW, bufferLength *uint32) (int, error)
- func WSAEventSelect(s SOCKET, eventObject WSAEVENT, networkEvents int32) (int, error)
- func WSAGetErrorCode(err error) int32
- func WSAGetOverlappedResult(s SOCKET, overlapped *WSAOverlapped, transfer *uint32, wait bool, ...) (bool, error)
- func WSAHtonl(s SOCKET, hostLong uint32, netLong *uint32) (int, error)
- func WSAHtons(s SOCKET, hostShort uint16, netShort *uint16) (int, error)
- func WSAIoctl(s SOCKET, ioControlCode uint32, inBuffer unsafe.Pointer, inBufferSize uint32, ...) (int, error)
- func WSALookupServiceBeginA(restrictions *WSAQuerySetA, controlFlags uint32, lookup *HANDLE) (int, error)
- func WSALookupServiceBeginW(restrictions *WSAQuerySetW, controlFlags uint32, lookup *HANDLE) (int, error)
- func WSALookupServiceEnd(lookup HANDLE) (int, error)
- func WSALookupServiceNextA(lookup HANDLE, controlFlags uint32, bufferLength *uint32, ...) (int, error)
- func WSANSPIoctl(lookup HANDLE, controlCode uint32, inBuffer unsafe.Pointer, ...) (int, error)
- func WSANtohl(s SOCKET, netlong uint32, hostlong *uint32) (int, error)
- func WSANtohs(s SOCKET, netshort uint16, hostshort *uint16) (int, error)
- func WSAPoll(fdArray []WSAPollFD, fds uint32, timeout int32) (int, error)
- func WSAProviderConfigChange(notificationHandle *HANDLE, overlapped *WSAOverlapped, ...) (int, error)
- func WSARecv(s SOCKET, buffers *WSABuf, bufferCount uint32, numberOfBytesRecvd *uint32, ...) (int, error)
- func WSARecvDisconnect(s SOCKET, inboundDisconnectData *WSABuf) (int, error)
- func WSARecvFrom(s SOCKET, buffers *WSABuf, bufferCount uint32, numberOfBytesRecvd *uint32, ...) (int, error)
- func WSARemoveServiceClass(serviceClassId *GUID) (int, error)
- func WSAResetEvent(event WSAEVENT) (bool, error)
- func WSASend(s SOCKET, buffers *WSABuf, bufferCount uint32, numberOfBytesSent *uint32, ...) (int, error)
- func WSASendDisconnect(s SOCKET, inboundDisconnectData *WSABuf) (int, error)
- func WSASendMsg(socket SOCKET, msg *WSAMsg, flags uint32, numberOfBytesSent *uint32, ...) (int, error)
- func WSASendTo(s SOCKET, buffers *WSABuf, bufferCount uint32, numberOfBytesSent *uint32, ...) (int, error)
- func WSASetEvent(event WSAEVENT) (bool, error)
- func WSASetLastError(errorCode int) error
- func WSASetServiceA(regInfo *WSAQuerySetA, essoperation WSAESETSERVICEOP, controlFlags uint32) (int, error)
- func WSASetServiceW(regInfo *WSAQuerySetW, essoperation WSAESETSERVICEOP, controlFlags uint32) (int, error)
- func WSAStartup(versionRequired uint16, wsData *WSAData) (int, error)
- func WSAStringToAddressA(addressString *byte, addressFamily uint16, protocolInfo *WSAProtocolInfoA, ...) (int, error)
- func WSAStringToAddressW(addressString *uint16, addressFamily uint16, protocolInfo *WSAProtocolInfoW, ...) (int, error)
- func WSAWaitForMultipleEvents(eventsCount uint32, events *WSAEVENT, waitAll bool, timeout uint32, ...) (int, error)
- type AFProtocols
- type AddrInfoA
- type AddrInfoW
- type BLOB
- type CSAddrInfo
- type FDSet
- type FlowSpec
- type GROUP
- type GUID
- type HANDLE
- type HostEnt
- type InAddr
- type InAddr6
- type NetEnt
- type Overlapped
- type ProtoEnt
- type QOS
- type SERVICETYPE
- type SOCKET
- func Accept(s SOCKET, addr unsafe.Pointer, addrLen *int32) (SOCKET, error)
- func Socket(af int32, stype int32, protocol int32) (SOCKET, error)
- func WSAAccept(s SOCKET, addr unsafe.Pointer, addrLen *int32, condition unsafe.Pointer, ...) (SOCKET, error)
- func WSAJoinLeaf(s SOCKET, sockaddr unsafe.Pointer, nameLen int32, callerData *WSABuf, ...) (SOCKET, error)
- func WSASocketA(af int32, stype int32, protocol int32, protocolInfo *WSAProtocolInfoA, g GROUP, ...) (SOCKET, error)
- func WSASocketW(af int32, stype int32, protocol int32, protocolInfo *WSAProtocolInfoW, g GROUP, ...) (SOCKET, error)
- type ScopeLevel
- type ServEnt
- type SockAddr
- func (sa *SockAddr) FromNetIP(ip net.IP, port int) error
- func (sa *SockAddr) Is4() bool
- func (sa *SockAddr) Is6() bool
- func (sa *SockAddr) To4() (v4 *SockAddrInet4)
- func (sa *SockAddr) To6() (v6 *SockAddrInet6)
- func (sa *SockAddr) ToIP() (ip net.IP)
- func (sa *SockAddr) ToIPPort() (ip net.IP, port int)
- type SockAddrInet4
- type SockAddrInet6
- type SocketAddress
- type SocketAddressList
- type Timeval
- type WSABuf
- type WSAData
- type WSAECOMPARATOR
- type WSAESETSERVICEOP
- type WSAEVENT
- type WSAMsg
- type WSANSClassInfoA
- type WSANSClassInfoW
- type WSANameSpaceInfoA
- type WSANameSpaceInfoExA
- type WSANameSpaceInfoExW
- type WSANameSpaceInfoW
- type WSANetworkEvents
- type WSAOverlapped
- type WSAPollFD
- type WSAProtocolChainA
- type WSAProtocolChainW
- type WSAProtocolInfoA
- type WSAProtocolInfoW
- type WSAQuerySetA
- type WSAQuerySetW
- type WSAServiceClassInfoA
- type WSAServiceClassInfoW
- type WSAVersion
Constants ¶
const ( IOC_VOID = 0x20000000 IOC_OUT = 0x40000000 IOC_IN = 0x80000000 IOC_INOUT = IOC_IN | IOC_OUT IOCPARM_MASK = 0x7f )
const ( 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_CLUSTER = 24 // Microsoft Wolfpack AF_12844 = 25 // IEEE 1284.4 WG AF AF_IRDA = 26 // IrDA AF_NETDES = 28 // Network Designers OSI & gateway AF_TCNPROCESS = 29 // AF_TCNMESSAGE = 30 // AF_ICLFXBM = 31 // AF_BTH = 32 // Bluetooth RFCOMM/L2CAP protocols AF_LINK = 33 // AF_HYPERV = 34 // AF_MAX = 35 // )
Address families
const ( SOL_SOCKET = 0xffff SOL_IP = (SOL_SOCKET - 4) SOL_IPV6 = (SOL_SOCKET - 5) )
Levels for socket I/O controls
const ( SO_DEBUG = 0x0001 // Turn on debugging info recording SO_ACCEPTCONN = 0x0002 // Docket has had listen() SO_REUSEADDR = 0x0004 // Sllow local address reuse SO_KEEPALIVE = 0x0008 // Keep connections alive SO_DONTROUTE = 0x0010 // Just use interface addresses SO_BROADCAST = 0x0020 // Permit sending of broadcast msgs SO_USELOOPBACK = 0x0040 // Bypass hardware when possible SO_LINGER = 0x0080 // Linger on close if data present SO_OOBINLINE = 0x0100 // Leave received OOB data in line SO_DONTLINGER = ^(SO_LINGER) // SO_EXCLUSIVEADDRUSE = ^(SO_REUSEADDR) // Disallow local address reuse SO_SNDBUF = 0x1001 // Send buffer size SO_RCVBUF = 0x1002 // Receive buffer size SO_SNDLOWAT = 0x1003 // Send low-water mark SO_RCVLOWAT = 0x1004 // Receive low-water mark SO_SNDTIMEO = 0x1005 // Send timeout SO_RCVTIMEO = 0x1006 // Receive timeout SO_ERROR = 0x1007 // Get error status and clear SO_TYPE = 0x1008 // Get socket type SO_BSP_STATE = 0x1009 // Get socket 5-tuple state SO_GROUP_ID = 0x2001 // ID of a socket group SO_GROUP_PRIORITY = 0x2002 // The relative priority within a group SO_MAX_MSG_SIZE = 0x2003 // Maximum message size SO_CONDITIONAL_ACCEPT = 0x3002 // Rnable true conditional accept: connection is not ack-ed to the other side until conditional function returns CF_ACCEPT SO_PAUSE_ACCEPT = 0x3003 // Pause accepting new connections SO_COMPARTMENT_ID = 0x3004 // Get/set the compartment for a socket SO_RANDOMIZE_PORT = 0x3005 // Randomize assignment of wildcard ports SO_PORT_SCALABILITY = 0x3006 // Enable port scalability SO_REUSE_UNICASTPORT = 0x3007 // Defer ephemeral port allocation for outbound connections SO_REUSE_MULTICASTPORT = 0x3008 // Enable port reuse and disable unicast reception. SO_ORIGINAL_DST = 0x300F // Query the original destination address of a redirected connection. IP6T_SO_ORIGINAL_DST = SO_ORIGINAL_DST // )
Socket options
const ( IOC_UNIX = 0x00000000 IOC_WS2 = 0x08000000 IOC_PROTOCOL = 0x10000000 IOC_VENDOR = 0x18000000 )
WinSock 2 extension -- manifest constants for WSAIoctl()
const ( SIO_ASSOCIATE_HANDLE = uint32(IOC_IN | IOC_WS2 | 1) SIO_ENABLE_CIRCULAR_QUEUEING = uint32(IOC_VOID | IOC_WS2 | 2) SIO_FIND_ROUTE = uint32(IOC_OUT | IOC_WS2 | 3) SIO_FLUSH = uint32(IOC_VOID | IOC_WS2 | 4) SIO_GET_BROADCAST_ADDRESS = uint32(IOC_OUT | IOC_WS2 | 5) SIO_GET_EXTENSION_FUNCTION_POINTER = uint32(IOC_INOUT | IOC_WS2 | 6) SIO_GET_QOS = uint32(IOC_INOUT | IOC_WS2 | 7) SIO_GET_GROUP_QOS = uint32(IOC_INOUT | IOC_WS2 | 8) SIO_MULTIPOINT_LOOPBACK = uint32(IOC_IN | IOC_WS2 | 9) SIO_MULTICAST_SCOPE = uint32(IOC_IN | IOC_WS2 | 10) SIO_SET_QOS = uint32(IOC_IN | IOC_WS2 | 11) SIO_SET_GROUP_QOS = uint32(IOC_IN | IOC_WS2 | 12) SIO_TRANSLATE_HANDLE = uint32(IOC_INOUT | IOC_WS2 | 13) SIO_ROUTING_INTERFACE_QUERY = uint32(IOC_INOUT | IOC_WS2 | 20) SIO_ROUTING_INTERFACE_CHANGE = uint32(IOC_IN | IOC_WS2 | 21) SIO_ADDRESS_LIST_QUERY = uint32(IOC_OUT | IOC_WS2 | 22) SIO_ADDRESS_LIST_CHANGE = uint32(IOC_VOID | IOC_WS2 | 23) SIO_QUERY_TARGET_PNP_HANDLE = uint32(IOC_OUT | IOC_WS2 | 24) SIO_NSP_NOTIFY_CHANGE = uint32(IOC_IN | IOC_WS2 | 25) SIO_ADDRESS_LIST_SORT = uint32(IOC_INOUT | IOC_WS2 | 25) SIO_QUERY_RSS_PROCESSOR_INFO = uint32(IOC_INOUT | IOC_WS2 | 37) SIO_RESERVED_1 = uint32(IOC_IN | IOC_WS2 | 26) SIO_RESERVED_2 = uint32(IOC_IN | IOC_WS2 | 33) )
const ( IPPROTO_HOPOPTS = 0 // IPv6 Hop-by-Hop options IPPROTO_ICMP = 1 // IPPROTO_IGMP = 2 // IPPROTO_GGP = 3 // IPPROTO_IPV4 = 4 // IPPROTO_ST = 5 // IPPROTO_TCP = 6 // IPPROTO_CBT = 7 // IPPROTO_EGP = 8 // IPPROTO_IGP = 9 // IPPROTO_PUP = 12 // IPPROTO_UDP = 17 // IPPROTO_IDP = 22 // IPPROTO_RDP = 27 // IPPROTO_IPV6 = 41 // IPv6 header IPPROTO_ROUTING = 43 // IPv6 Routing header IPPROTO_FRAGMENT = 44 // IPv6 fragmentation header IPPROTO_ESP = 50 // Encapsulating security payload IPPROTO_AH = 51 // Authentication header IPPROTO_ICMPV6 = 58 // ICMPv6 IPPROTO_NONE = 59 // IPv6 no next header IPPROTO_DSTOPTS = 60 // IPv6 Destination options IPPROTO_ND = 77 // IPPROTO_ICLFXBM = 78 // IPPROTO_PIM = 103 // IPPROTO_PGM = 113 // IPPROTO_L2TP = 115 // IPPROTO_SCTP = 132 // IPPROTO_RAW = 255 // 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_WNV = 260 IPPROTO_RESERVED_MAX = 261 )
Protocols.
const ( IPPORT_TCPMUX = 1 IPPORT_ECHO = 7 IPPORT_DISCARD = 9 IPPORT_SYSTAT = 11 IPPORT_DAYTIME = 13 IPPORT_NETSTAT = 15 IPPORT_QOTD = 17 IPPORT_MSP = 18 IPPORT_CHARGEN = 19 IPPORT_FTP_DATA = 20 IPPORT_FTP = 21 IPPORT_TELNET = 23 IPPORT_SMTP = 25 IPPORT_TIMESERVER = 37 IPPORT_NAMESERVER = 42 IPPORT_WHOIS = 43 IPPORT_MTP = 57 )
Port/socket numbers: network standard functions
const ( IPPORT_TFTP = 69 IPPORT_RJE = 77 IPPORT_FINGER = 79 IPPORT_TTYLINK = 87 IPPORT_SUPDUP = 95 )
Port/socket numbers: host specific functions
const ( IPPORT_POP3 = 110 IPPORT_NTP = 123 IPPORT_EPMAP = 135 IPPORT_NETBIOS_NS = 137 IPPORT_NETBIOS_DGM = 138 IPPORT_NETBIOS_SSN = 139 IPPORT_IMAP = 143 IPPORT_SNMP = 161 IPPORT_SNMP_TRAP = 162 IPPORT_IMAP3 = 220 IPPORT_LDAP = 389 IPPORT_HTTPS = 443 IPPORT_MICROSOFT_DS = 445 IPPORT_EXECSERVER = 512 IPPORT_LOGINSERVER = 513 IPPORT_CMDSERVER = 514 IPPORT_EFSSERVER = 520 )
UNIX TCP sockets
const ( IPPORT_BIFFUDP = 512 IPPORT_WHOSERVER = 513 IPPORT_ROUTESERVER = 520 )
UNIX UDP sockets
const ( IPPORT_RESERVED = 1024 IPPORT_REGISTERED_MIN = IPPORT_RESERVED IPPORT_REGISTERED_MAX = 0xbfff IPPORT_DYNAMIC_MIN = 0xc000 IPPORT_DYNAMIC_MAX = 0xffff )
Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root).
const ( INADDR_ANY = 0x00000000 INADDR_LOOPBACK = 0x7f000001 INADDR_BROADCAST = 0xffffffff INADDR_NONE = 0xffffffff )
Common internet addresses
const ( MSG_TRUNC = 0x0100 MSG_CTRUNC = 0x0200 MSG_BCAST = 0x0400 MSG_MCAST = 0x0800 MSG_ERRQUEUE = 0x1000 )
Definition for flags member of the WSAMsg structure
const ( AI_PASSIVE = 0x00000001 // Socket address will be used in bind() call AI_CANONNAME = 0x00000002 // Return canonical name in first ai_canonname AI_NUMERICHOST = 0x00000004 // Nodename must be a numeric address string AI_NUMERICSERV = 0x00000008 // Servicename must be a numeric port number AI_DNS_ONLY = 0x00000010 // Restrict queries to unicast DNS only (no LLMNR, netbios, etc.) AI_FORCE_CLEAR_TEXT = 0x00000020 // Force clear text DNS query AI_BYPASS_DNS_CACHE = 0x00000040 // Bypass DNS cache AI_RETURN_TTL = 0x00000080 // Return record TTL AI_ALL = 0x00000100 // Query both IP6 and IP4 with AI_V4MAPPED AI_ADDRCONFIG = 0x00000400 // Resolution only if global address configured AI_V4MAPPED = 0x00000800 // On v6 failure, query v4 and convert to V4MAPPED format AI_NON_AUTHORITATIVE = 0x00004000 // LUP_NON_AUTHORITATIVE AI_SECURE = 0x00008000 // LUP_SECURE AI_RETURN_PREFERRED_NAMES = 0x00010000 // LUP_RETURN_PREFERRED_NAMES AI_FQDN = 0x00020000 // Return the FQDN in ai_canonname AI_FILESERVER = 0x00040000 // Resolving fileserver name resolution AI_DISABLE_IDN_ENCODING = 0x00080000 // Disable Internationalized Domain Names handling AI_SECURE_WITH_FALLBACK = 0x00100000 // Forces clear text fallback if the secure DNS query fails AI_EXCLUSIVE_CUSTOM_SERVERS = 0x00200000 // Use exclusively the custom DNS servers AI_RETURN_RESPONSE_FLAGS = 0x10000000 // Requests extra information about the DNS results AI_REQUIRE_SECURE = 0x20000000 // Forces the DNS query to be done over secure protocols AI_RESOLUTION_HANDLE = 0x40000000 // Request resolution handle AI_EXTENDED = 0x80000000 // Indicates this is extended AddrInfoEx(2/..) struct )
Flags used in "hints" argument to GetAddrInfo()
const ( ADDRINFOEX_VERSION_2 = 2 ADDRINFOEX_VERSION_3 = 3 ADDRINFOEX_VERSION_4 = 4 ADDRINFOEX_VERSION_5 = 5 ADDRINFOEX_VERSION_6 = 6 )
AddrInfoEx versions
const ( AI_DNS_SERVER_TYPE_UDP = 0x1 AI_DNS_SERVER_TYPE_DOH = 0x2 )
Types of custom DNS servers specified in the ai_servers parameter.
const ( AI_DNS_RESPONSE_SECURE = 0x1 // Present if the resolution was done through secure protocols. AI_DNS_RESPONSE_HOSTFILE = 0x2 )
Flags returned through ai_returnflags, when AI_RETURN_RESPONSE_FLAGS is set.
const ( NS_ALL = 0 // NS_SAP = 1 // NS_NDS = 2 // NS_PEER_BROWSE = 3 // NS_SLP = 5 // NS_DHCP = 6 // NS_TCPIP_LOCAL = 10 // NS_TCPIP_HOSTS = 11 // NS_DNS = 12 // NS_NETBT = 13 // NS_WINS = 14 // NS_NLA = 15 // Network Location Awareness NS_BTH = 16 // Bluetooth SDP Namespace NS_NBP = 20 // NS_MS = 30 // NS_STDA = 31 // NS_NTDS = 32 // NS_EMAIL = 37 // NS_PNRPNAME = 38 // NS_PNRPCLOUD = 39 // NS_X500 = 40 // NS_NIS = 41 // NS_NISPLUS = 42 // NS_WRQ = 50 // NS_NETDES = 60 // Network Designers Limited )
Name Spaces
const ( NI_NOFQDN = 0x01 // Only return nodename portion for local hosts NI_NUMERICHOST = 0x02 // Return numeric form of the host's address NI_NAMEREQD = 0x04 // Error if the host's name not in DNS NI_NUMERICSERV = 0x08 // Return numeric form of the service (port #) NI_DGRAM = 0x10 // Service is a datagram service NI_MAXHOST = 1025 // Max size of a fully-qualified domain name NI_MAXSERV = 32 // Max size of a service name )
Flags for getnameinfo()
const ( IFF_UP = 0x00000001 // Interface is up. IFF_BROADCAST = 0x00000002 // Broadcast is supported. IFF_LOOPBACK = 0x00000004 // This is a loopback interface. IFF_POINTTOPOINT = 0x00000008 // This is a point-to-point interface. IFF_MULTICAST = 0x00000010 // Multicast is supported. )
Interface flags
const ( IP_OPTIONS = 1 // Set/get IP options. IP_HDRINCL = 2 // Header is included with data. IP_TOS = 3 // IP type of service. IP_TTL = 4 // IP TTL (hop limit). IP_MULTICAST_IF = 9 // IP multicast interface. IP_MULTICAST_TTL = 10 // IP multicast TTL (hop limit). IP_MULTICAST_LOOP = 11 // IP multicast loopback. IP_ADD_MEMBERSHIP = 12 // Add an IP group membership. IP_DROP_MEMBERSHIP = 13 // Drop an IP group membership. IP_DONTFRAGMENT = 14 // Don't fragment IP datagrams. IP_ADD_SOURCE_MEMBERSHIP = 15 // Join IP group/source. IP_DROP_SOURCE_MEMBERSHIP = 16 // Leave IP group/source. IP_BLOCK_SOURCE = 17 // Block IP group/source. IP_UNBLOCK_SOURCE = 18 // Unblock IP group/source. IP_PKTINFO = 19 // Receive packet information. IP_HOPLIMIT = 21 // Receive packet hop limit. IP_RECVTTL = 21 // Receive packet Time To Live (TTL). IP_RECEIVE_BROADCAST = 22 // Allow/block broadcast reception. IP_RECVIF = 24 // Receive arrival interface. IP_RECVDSTADDR = 25 // Receive destination address. IP_IFLIST = 28 // Enable/Disable an interface list. IP_ADD_IFLIST = 29 // Add an interface list entry. IP_DEL_IFLIST = 30 // Delete an interface list entry. IP_UNICAST_IF = 31 // IP unicast interface. IP_RTHDR = 32 // Set/get IPv6 routing header. IP_GET_IFLIST = 33 // Get an interface list. IP_RECVRTHDR = 38 // Receive the routing header. IP_TCLASS = 39 // Packet traffic class. IP_RECVTCLASS = 40 // Receive packet traffic class. IP_RECVTOS = 40 // Receive packet Type Of Service (TOS). IP_ORIGINAL_ARRIVAL_IF = 47 // Original Arrival Interface Index. IP_ECN = 50 // IP ECN codepoint. IP_RECVECN = 50 // Receive ECN codepoints in the IP header. IP_PKTINFO_EX = 51 // Receive extended packet information. IP_WFP_REDIRECT_RECORDS = 60 // WFP's Connection Redirect Records. IP_WFP_REDIRECT_CONTEXT = 70 // WFP's Connection Redirect Context. IP_MTU_DISCOVER = 71 // Set/get path MTU discover state. IP_MTU = 73 // Get path MTU. IP_NRT_INTERFACE = 74 // Set NRT interface constraint (outbound). IP_RECVERR = 75 // Receive ICMP errors. IP_USER_MTU = 76 // Set/get app defined upper bound IP layer MTU. IP_UNSPECIFIED_TYPE_OF_SERVICE = -1 IP_UNSPECIFIED_USER_MTU = 1<<32 - 1 )
Options to use with [gs]etsockopt at the IPPROTO_IP level. The values should be consistent with the IPv6 equivalents.
Options to use with setsockopt and getsockopt at the IPPROTO_IP level.
const ( IN6ADDR_LINKLOCALPREFIX_LENGTH = 64 IN6ADDR_MULTICASTPREFIX_LENGTH = 8 IN6ADDR_SOLICITEDNODEMULTICASTPREFIX_LENGTH = 104 IN6ADDR_V4MAPPEDPREFIX_LENGTH = 96 IN6ADDR_6TO4PREFIX_LENGTH = 16 IN6ADDR_TEREDOPREFIX_LENGTH = 32 )
Prefix lengths
const ( SIO_GET_INTERFACE_LIST = 0x80000007 | 0x20000000 | (0x74 << 16) | (127 << 8) | 4 SIO_GET_INTERFACE_LIST_EX = 0x80000007 | 0x20000000 | (0x74 << 16) | (126 << 8) | 4 SIO_SET_MULTICAST_FILTER = 0x80000008 | 0x40000000 | (0x74 << 16) | (125 << 8) | 4 SIO_GET_MULTICAST_FILTER = 0x80000008 | 0x40000000 | (0x74 << 16) | (124 << 8) | 4 SIOCSIPMSFILTER = SIO_SET_MULTICAST_FILTER SIOCGIPMSFILTER = SIO_GET_MULTICAST_FILTER )
TCP/IP specific Ioctl codes.
const ( SIOCSMSFILTER = 0x80000008 | 0x40000000 | (0x74 << 16) | (126 << 8) | 4 SIOCGMSFILTER = 0x80000008 | 0x40000000 | (0x74 << 16) | (127 << 8) | 4 )
Protocol independent ioctls for setting and retrieving multicast filters.
const ( SIO_IDEAL_SEND_BACKLOG_QUERY = 0x80000007 | 0x20000000 | (0x74 << 16) | (123 << 8) | 4 SIO_IDEAL_SEND_BACKLOG_CHANGE = 0x80000007 | 0x20000000 | (0x74 << 16) | (122 << 8) )
Query and change notification ioctls for the ideal send backlog size for a given connection. Clients should use the wrappers defined in ws2tcpip.h rather than using these ioctls directly.
const ( MCAST_JOIN_GROUP = 41 // Join all sources for a group MCAST_LEAVE_GROUP = 42 // Drop all sources for a group MCAST_BLOCK_SOURCE = 43 // Block IP group/source MCAST_UNBLOCK_SOURCE = 44 // Unblock IP group/source MCAST_JOIN_SOURCE_GROUP = 45 // Join IP group/source MCAST_LEAVE_SOURCE_GROUP = 46 // Leave IP group/source )
Protocol independent multicast source filter options.
const ( IPV6_HOPOPTS = 1 // Set/get IPv6 hop-by-hop options. IPV6_HDRINCL = 2 // Header is included with data. IPV6_UNICAST_HOPS = 4 // IP unicast hop limit. IPV6_MULTICAST_IF = 9 // IP multicast interface. IPV6_MULTICAST_HOPS = 10 // IP multicast hop limit. IPV6_MULTICAST_LOOP = 11 // IP multicast loopback. IPV6_ADD_MEMBERSHIP = 12 // Add an IP group membership. IPV6_JOIN_GROUP = IPV6_ADD_MEMBERSHIP // IPV6_DROP_MEMBERSHIP = 13 // Drop an IP group membership. IPV6_LEAVE_GROUP = IPV6_DROP_MEMBERSHIP // IPV6_DONTFRAG = 14 // Don't fragment IP datagrams. IPV6_PKTINFO = 19 // Receive packet information. IPV6_HOPLIMIT = 21 // Receive packet hop limit. IPV6_PROTECTION_LEVEL = 23 // Set/get IPv6 protection level. IPV6_RECVIF = 24 // Receive arrival interface. IPV6_RECVDSTADDR = 25 // Receive destination address. IPV6_CHECKSUM = 26 // Offset to checksum for raw IP socket send. IPV6_V6ONLY = 27 // Treat wildcard bind as AF_INET6-only. IPV6_IFLIST = 28 // Enable/Disable an interface list. IPV6_ADD_IFLIST = 29 // Add an interface list entry. IPV6_DEL_IFLIST = 30 // Delete an interface list entry. IPV6_UNICAST_IF = 31 // IP unicast interface. IPV6_RTHDR = 32 // Set/get IPv6 routing header. IPV6_GET_IFLIST = 33 // Get an interface list. IPV6_RECVRTHDR = 38 // Receive the routing header. IPV6_TCLASS = 39 // Packet traffic class. IPV6_RECVTCLASS = 40 // Receive packet traffic class. IPV6_ECN = 50 // IPv6 ECN codepoint. IPV6_RECVECN = 50 // Receive ECN codepoints in the IPv6 header. IPV6_PKTINFO_EX = 51 // Receive extended packet information. IPV6_WFP_REDIRECT_RECORDS = 60 // WFP's Connection Redirect Records IPV6_WFP_REDIRECT_CONTEXT = 70 // WFP's Connection Redirect Context IPV6_MTU_DISCOVER = 71 // Set/get path MTU discover state. IPV6_MTU = 72 // Get path MTU. IPV6_NRT_INTERFACE = 74 // Set NRT interface constraint (outbound). IPV6_RECVERR = 75 // Receive ICMPv6 errors. IPV6_USER_MTU = 76 // Set/get app defined upper bound IP layer MTU. )
Options to use with [gs]etsockopt at the IPPROTO_IPV6 level. These are specified in RFCs 3493 and 3542. The values should be consistent with the IPv6 equivalents.
const ( PROTECTION_LEVEL_UNRESTRICTED = 10 // For peer-to-peer apps. PROTECTION_LEVEL_EDGERESTRICTED = 20 // Same as unrestricted. Except for Teredo. PROTECTION_LEVEL_RESTRICTED = 30 // For Intranet apps. PROTECTION_LEVEL_DEFAULT = ^uint(0) // Use UINT_MAX as the default value. )
Values of IPV6_PROTECTION_LEVEL.
const ( INET_ADDRSTRLEN = 22 INET6_ADDRSTRLEN = 65 )
Maximum length of address literals (potentially including a port number) generated by any address-to-string conversion routine. This length can be used when declaring buffers used with getnameinfo, WSAAddressToString, inet_ntoa, etc. We just provide one define, rather than one per api, to avoid confusion.
The totals are derived from the following data:
15: IPv4 address 45: IPv6 address including embedded IPv4 address 11: Scope Id 2: Brackets around IPv6 address when port is present 6: Port (including colon) 1: Terminating null byte
const ( TCP_OFFLOAD_NO_PREFERENCE = 0 TCP_OFFLOAD_NOT_PREFERRED = 1 TCP_OFFLOAD_PREFERRED = 2 )
Offload preferences supported.
const ( TCP_EXPEDITED_1122 = 0x0002 TCP_KEEPALIVE = 3 TCP_MAXSEG = 4 TCP_MAXRT = 5 TCP_STDURG = 6 TCP_NOURG = 7 TCP_ATMARK = 8 TCP_NOSYNRETRIES = 9 TCP_TIMESTAMPS = 10 TCP_OFFLOAD_PREFERENCE = 11 TCP_CONGESTION_ALGORITHM = 12 TCP_DELAY_FIN_ACK = 13 TCP_MAXRTMS = 14 TCP_FASTOPEN = 15 TCP_KEEPCNT = 16 TCP_KEEPIDLE = TCP_KEEPALIVE TCP_KEEPINTVL = 17 TCP_FAIL_CONNECT_ON_ICMP_ERROR = 18 TCP_ICMP_ERROR_INFO = 19 )
const ( UDP_SEND_MSG_SIZE = 2 UDP_RECV_MAX_COALESCED_SIZE = 3 )
const ( FIONREAD = 0x4004667f // Get # bytes to read FIONBIO = 0x8004667e // Set/clear non-blocking i/o FIOASYNC = 0x8004667d // Set/clear async i/o )
const ( SIOCSHIWAT = 0x80730000 // Set high watermark SIOCGHIWAT = (0x40000000 | (4 << 16) | ('s' << 8) | 1) // Get high watermark SIOCSLOWAT = (0x80000000 | (4 << 16) | ('s' << 8) | 2) // Set low watermark SIOCGLOWAT = (0x40000000 | (4 << 16) | ('s' << 8) | 3) // Get low watermark SIOCATMARK = (0x40000000 | (4 << 16) | ('s' << 8) | 7) // At oob mark? )
Constants for socket I/O controls
const ( IMPLINK_IP = 155 IMPLINK_LOWEXPER = 156 IMPLINK_HIGHEXPER = 158 )
Link numbers
const ( WSADESCRIPTION_LEN = 256 WSASYS_STATUS_LEN = 128 )
const ( 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 )
Types
const ( SO_PROTOCOL_INFOA = 0x2004 // WSAProtocolInfoA structure SO_PROTOCOL_INFOW = 0x2005 // WSAProtocolInfoW structure PVD_CONFIG = 0x3001 // Configuration info for service provider connection is not ack-ed to the other side until conditional function returns CF_ACCEPT )
WinSock 2 extension -- new options
const ( 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_VOICEVIEW = AF_VOICEVIEW PF_FIREFOX = AF_FIREFOX PF_UNKNOWN1 = AF_UNKNOWN1 PF_BAN = AF_BAN PF_ATM = AF_ATM PF_INET6 = AF_INET6 PF_BTH = AF_BTH PF_MAX = AF_MAX )
Protocol families, same as address families for now.
const ( MSG_OOB = 0x1 // Process out-of-band data MSG_PEEK = 0x2 // Peek at incoming message MSG_DONTROUTE = 0x4 // Send without using routing tables MSG_WAITALL = 0x8 // Do not complete until packet is completely filled MSG_PUSH_IMMEDIATE = 0x20 // Do not delay receive request completion if data is available MSG_PARTIAL = 0x8000 // Partial send or recv for message xport )
const ( MSG_INTERRUPT = 0x10 // Send/Recv in the interrupt context MSG_MAXIOVLEN = 16 )
WinSock 2 extension -- new flags for WSASend(), WSASendTo(), WSARecv() and WSARecvFrom()
const ( FD_READ_BIT = 0 FD_READ = 1 << FD_READ_BIT FD_WRITE_BIT = 1 FD_WRITE = 1 << FD_WRITE_BIT FD_OOB_BIT = 2 FD_OOB = 1 << FD_OOB_BIT FD_ACCEPT_BIT = 3 FD_ACCEPT = 1 << FD_ACCEPT_BIT FD_CONNECT_BIT = 4 FD_CONNECT = 1 << FD_CONNECT_BIT FD_CLOSE_BIT = 5 FD_CLOSE = 1 << FD_CLOSE_BIT FD_QOS_BIT = 6 FD_QOS = 1 << FD_QOS_BIT FD_GROUP_QOS_BIT = 7 FD_GROUP_QOS = 1 << FD_GROUP_QOS_BIT FD_ROUTING_INTERFACE_CHANGE_BIT = 8 FD_ROUTING_INTERFACE_CHANGE = 1 << FD_ROUTING_INTERFACE_CHANGE_BIT FD_ADDRESS_LIST_CHANGE_BIT = 9 FD_ADDRESS_LIST_CHANGE = 1 << FD_ADDRESS_LIST_CHANGE_BIT FD_MAX_EVENTS = 10 FD_ALL_EVENTS = (1 << FD_MAX_EVENTS) - 1 )
WinSock 2 extension -- bit values and indices for FD_XXX network events
const ( WSAEINTR = WSABASEERR + 4 WSAEBADF = WSABASEERR + 9 WSAEACCES = WSABASEERR + 13 WSAEFAULT = WSABASEERR + 14 WSAEINVAL = WSABASEERR + 22 WSAEMFILE = WSABASEERR + 24 )
Windows Sockets definitions of regular Microsoft C error constants
const ( 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 )
Windows Sockets definitions of regular Berkeley error constants
const ( 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 )
Extended Windows Sockets error constant definitions
const ( WSA_QOS_RECEIVERS = WSABASEERR + 1005 // At least one Reserve has arrived WSA_QOS_SENDERS = WSABASEERR + 1006 // At least one Path has arrived WSA_QOS_NO_SENDERS = WSABASEERR + 1007 // There are no senders WSA_QOS_NO_RECEIVERS = WSABASEERR + 1008 // There are no receivers WSA_QOS_REQUEST_CONFIRMED = WSABASEERR + 1009 // Reserve has been confirmed WSA_QOS_ADMISSION_FAILURE = WSABASEERR + 1010 // Error due to lack of resources WSA_QOS_POLICY_FAILURE = WSABASEERR + 1011 // Rejected for administrative reasons - bad credentials WSA_QOS_BAD_STYLE = WSABASEERR + 1012 // Unknown or conflicting style WSA_QOS_BAD_OBJECT = WSABASEERR + 1013 // Problem with some part of the filterspec or providerspecific buffer in general WSA_QOS_TRAFFIC_CTRL_ERROR = WSABASEERR + 1014 // Problem with some part of the flowspec WSA_QOS_GENERIC_ERROR = WSABASEERR + 1015 // General error WSA_QOS_ESERVICETYPE = WSABASEERR + 1016 // Invalid service type in flowspec WSA_QOS_EFLOWSPEC = WSABASEERR + 1017 // Invalid flowspec WSA_QOS_EPROVSPECBUF = WSABASEERR + 1018 // Invalid provider specific buffer WSA_QOS_EFILTERSTYLE = WSABASEERR + 1019 // Invalid filter style WSA_QOS_EFILTERTYPE = WSABASEERR + 1020 // Invalid filter type WSA_QOS_EFILTERCOUNT = WSABASEERR + 1021 // Incorrect number of filters WSA_QOS_EOBJLENGTH = WSABASEERR + 1022 // Invalid object length WSA_QOS_EFLOWCOUNT = WSABASEERR + 1023 // Incorrect number of flows WSA_QOS_EUNKOWNPSOBJ = WSABASEERR + 1024 // Unknown object in provider specific buffer WSA_QOS_EPOLICYOBJ = WSABASEERR + 1025 // Invalid policy object in provider specific buffer WSA_QOS_EFLOWDESC = WSABASEERR + 1026 // Invalid flow descriptor in the list WSA_QOS_EPSFLOWSPEC = WSABASEERR + 1027 // Inconsistent flow spec in provider specific buffer WSA_QOS_EPSFILTERSPEC = WSABASEERR + 1028 // Invalid filter spec in provider specific buffer WSA_QOS_ESDMODEOBJ = WSABASEERR + 1029 // Invalid shape discard mode object in provider specific buffer WSA_QOS_ESHAPERATEOBJ = WSABASEERR + 1030 // Invalid shaping rate object in provider specific buffer WSA_QOS_RESERVED_PETYPE = WSABASEERR + 1031 // Reserved policy element in provider specific buffer )
Define QOS related error return codes
const ( WSA_IO_PENDING = 997 WSA_IO_INCOMPLETE = 996 WSA_INVALID_HANDLE = 6 WSA_INVALID_PARAMETER = 87 WSA_NOT_ENOUGH_MEMORY = 8 WSA_OPERATION_ABORTED = 995 )
const ( WSA_INVALID_EVENT = WSAEVENT(0) WSA_MAXIMUM_WAIT_EVENTS = 64 WSA_WAIT_FAILED = uint32(0xFFFFFFFF) WSA_WAIT_EVENT_0 = 0x00000000 WSA_WAIT_IO_COMPLETION = 0x00000100 WSA_WAIT_TIMEOUT = 0x00000102 WSA_INFINITE = 0xFFFFFFFF )
const ( CF_ACCEPT = 0x0000 CF_REJECT = 0x0001 CF_DEFER = 0x0002 )
WinSock 2 extension -- manifest constants for return values of the condition function
const ( SD_RECEIVE = 0x00 SD_SEND = 0x01 SD_BOTH = 0x02 )
WinSock 2 extension -- manifest constants for Shutdown()
const ( SG_UNCONSTRAINED_GROUP = 0x01 SG_CONSTRAINED_GROUP = 0x02 )
WinSock 2 extension -- data type and manifest constants for socket groups
const ( BASE_PROTOCOL = 1 LAYERED_PROTOCOL = 0 WSAPROTOCOL_LEN = 255 )
const ( PFL_MULTIPLE_PROTO_ENTRIES = 0x00000001 PFL_RECOMMENDED_PROTO_ENTRY = 0x00000002 PFL_HIDDEN = 0x00000004 PFL_MATCHES_PROTOCOL_ZERO = 0x00000008 PFL_NETWORKDIRECT_PROVIDER = 0x00000010 )
Flag bit definitions for ProviderFlags
const ( XP1_CONNECTIONLESS = 0x00000001 XP1_GUARANTEED_DELIVERY = 0x00000002 XP1_GUARANTEED_ORDER = 0x00000004 XP1_MESSAGE_ORIENTED = 0x00000008 XP1_PSEUDO_STREAM = 0x00000010 XP1_GRACEFUL_CLOSE = 0x00000020 XP1_EXPEDITED_DATA = 0x00000040 XP1_CONNECT_DATA = 0x00000080 XP1_DISCONNECT_DATA = 0x00000100 XP1_SUPPORT_BROADCAST = 0x00000200 XP1_SUPPORT_MULTIPOINT = 0x00000400 XP1_MULTIPOINT_CONTROL_PLANE = 0x00000800 XP1_MULTIPOINT_DATA_PLANE = 0x00001000 XP1_QOS_SUPPORTED = 0x00002000 XP1_INTERRUPT = 0x00004000 XP1_UNI_SEND = 0x00008000 XP1_UNI_RECV = 0x00010000 XP1_IFS_HANDLES = 0x00020000 XP1_PARTIAL_MESSAGE = 0x00040000 XP1_SAN_SUPPORT_SDP = 0x00080000 )
Flag bit definitions for ServiceFlags1
const ( BIGENDIAN = 0x0000 LITTLEENDIAN = 0x0001 )
const ( JL_SENDER_ONLY = 0x01 JL_RECEIVER_ONLY = 0x02 JL_BOTH = 0x04 )
WinSock 2 extension -- manifest constants for WSAJoinLeaf()
const ( WSA_FLAG_OVERLAPPED = 0x01 WSA_FLAG_MULTIPOINT_C_ROOT = 0x02 WSA_FLAG_MULTIPOINT_C_LEAF = 0x04 WSA_FLAG_MULTIPOINT_D_ROOT = 0x08 WSA_FLAG_MULTIPOINT_D_LEAF = 0x10 WSA_FLAG_ACCESS_SYSTEM_SECURITY = 0x40 WSA_FLAG_NO_HANDLE_INHERIT = 0x80 WSA_FLAG_REGISTERED_IO = 0x100 )
WinSock 2 extension -- manifest constants for WSASocket()
const ( TH_NETDEV = 0x00000001 TH_TAPI = 0x00000002 )
WinSock 2 extension -- manifest constants for SIO_TRANSLATE_HANDLE ioctl
const ( RES_UNUSED_1 = 0x00000001 RES_FLUSH_CACHE = 0x00000002 RES_SERVICE = 0x00000004 )
Resolution flags for WSAGetAddressByName(). Note these are also used by the 1.1 API GetAddressByName, so leave them around.
const ( SERVICE_TYPE_VALUE_IPXPORTA = "IpxSocket" SERVICE_TYPE_VALUE_IPXPORTW = "IpxSocket" SERVICE_TYPE_VALUE_SAPIDA = "SapId" SERVICE_TYPE_VALUE_SAPIDW = "SapId" SERVICE_TYPE_VALUE_TCPPORTA = "TcpPort" SERVICE_TYPE_VALUE_TCPPORTW = "TcpPort" SERVICE_TYPE_VALUE_UDPPORTA = "UdpPort" SERVICE_TYPE_VALUE_UDPPORTW = "UdpPort" SERVICE_TYPE_VALUE_OBJECTIDA = "ObjectId" SERVICE_TYPE_VALUE_OBJECTIDW = "ObjectId" )
Well known value names for Service Types
const ( LUP_DEEP = 0x00000001 LUP_CONTAINERS = 0x00000002 LUP_NOCONTAINERS = 0x00000004 LUP_NEAREST = 0x00000008 LUP_RETURN_NAME = 0x00000010 LUP_RETURN_TYPE = 0x00000020 LUP_RETURN_VERSION = 0x00000040 LUP_RETURN_COMMENT = 0x00000080 LUP_RETURN_ADDR = 0x00000100 LUP_RETURN_BLOB = 0x00000200 LUP_RETURN_ALIASES = 0x00000400 LUP_RETURN_QUERY_STRING = 0x00000800 LUP_RETURN_ALL = 0x00000FF0 LUP_RES_SERVICE = 0x00008000 LUP_FLUSHCACHE = 0x00001000 LUP_FLUSHPREVIOUS = 0x00002000 LUP_NON_AUTHORITATIVE = 0x00004000 LUP_SECURE = 0x00008000 LUP_RETURN_PREFERRED_NAMES = 0x00010000 LUP_DNS_ONLY = 0x00020000 LUP_RETURN_RESPONSE_FLAGS = 0x00040000 LUP_ADDRCONFIG = 0x00100000 LUP_DUAL_ADDR = 0x00200000 LUP_FILESERVER = 0x00400000 LUP_DISABLE_IDN_ENCODING = 0x00800000 LUP_API_ANSI = 0x01000000 LUP_EXTENDED_QUERYSET = 0x02000000 LUP_SECURE_WITH_FALLBACK = 0x04000000 LUP_EXCLUSIVE_CUSTOM_SERVERS = 0x08000000 LUP_REQUIRE_SECURE = 0x10000000 LUP_RETURN_TTL = 0x20000000 LUP_FORCE_CLEAR_TEXT = 0x40000000 LUP_RESOLUTION_HANDLE = 0x80000000 )
Lookup flags for WSALookupServiceBegin/Next.
const ( RESULT_IS_ALIAS = 0x0001 RESULT_IS_ADDED = 0x0010 RESULT_IS_CHANGED = 0x0020 RESULT_IS_DELETED = 0x0040 )
Return flags
const ( POLLRDNORM = 0x0100 POLLRDBAND = 0x0200 POLLIN = POLLRDNORM | POLLRDBAND POLLPRI = 0x0400 POLLWRNORM = 0x0010 POLLOUT = POLLWRNORM POLLWRBAND = 0x0020 POLLERR = 0x0001 POLLHUP = 0x0002 POLLNVAL = 0x0004 )
Event flag definitions for WSAPoll().
const ( SOCK_NOTIFY_REGISTER_EVENT_NONE = 0x00 SOCK_NOTIFY_REGISTER_EVENT_IN = 0x01 // Input is available from the socket without blocking. SOCK_NOTIFY_REGISTER_EVENT_OUT = 0x02 // Output can be provided to the socket without blocking. SOCK_NOTIFY_REGISTER_EVENT_HANGUP = 0x04 // The socket connection has been terminated. )
Socket notification registration events. Supplied during registration. Indicates that a notification should be issued for the event if its condition holds.
const ( SOCK_NOTIFY_EVENT_IN = SOCK_NOTIFY_REGISTER_EVENT_IN // Input is available from the socket without blocking. SOCK_NOTIFY_EVENT_OUT = SOCK_NOTIFY_REGISTER_EVENT_OUT // Output can be provided to the socket without blocking. SOCK_NOTIFY_EVENT_HANGUP = SOCK_NOTIFY_REGISTER_EVENT_HANGUP // The socket connection has been terminated. SOCK_NOTIFY_EVENT_ERR = 0x40 // The socket is in an error state. SOCK_NOTIFY_EVENT_REMOVE = 0x80 // The notification has been deregistered. )
Socket notification events. These are the events possible when a notification is received.
The SOCK_NOTIFY_EVENT_ERR and SOCK_NOTIFY_EVENT_REMOVE events may be indicated regardless of registration.
If a SOCK_NOTIFY_EVENT_REMOVE event is indicated, no more notifications will be provided.
const ( SOCK_NOTIFY_OP_NONE = 0x00 SOCK_NOTIFY_OP_ENABLE = 0x01 // Enables the registration. SOCK_NOTIFY_OP_DISABLE = 0x02 // Disables the registration. SOCK_NOTIFY_OP_REMOVE = 0x04 // Removes the registration. )
Socket notification registration operations. One operation must be supplied at a time.
A SOCK_NOTIFY_OP_DISABLE operation will not destroy the underlying structures.
A SOCK_NOTIFY_OP_REMOVE operation will cause a SOCK_NOTIFY_REMOVE notification to be delivered when the operation completes successfully.
const ( SOCK_NOTIFY_TRIGGER_ONESHOT = 0x01 // The registration will be disabled (not removed) upon delivery of the next notification. SOCK_NOTIFY_TRIGGER_PERSISTENT = 0x02 // The registration will remain active until it is explicitly disabled or removed. SOCK_NOTIFY_TRIGGER_LEVEL = 0x04 // The registration is for level-triggered notifications. SOCK_NOTIFY_TRIGGER_EDGE = 0x08 // The registration is for edge-triggered notifications. )
Socket notification trigger behaviors.
When operation is SOCK_NOTIFY_OP_ENABLE:
- One of SOCK_NOTIFY_TRIGGER_PERSISTENT or SOCK_NOTIFY_TRIGGER_ONESHOT must be supplied
- One of SOCK_NOTIFY_TRIGGER_LEVEL or SOCK_NOTIFY_TRIGGER_EDGE must be supplied
SOCK_NOTIFY_TRIGGER_PERSISTENT is not compatible with SOCK_NOTIFY_TRIGGER_ONESHOT. SOCK_NOTIFY_TRIGGER_LEVEL is not compatible with SOCK_NOTIFY_TRIGGER_EDGE.
Socket notification trigger types.
const ( SO_CONNDATA = 0x7000 SO_CONNOPT = 0x7001 SO_DISCDATA = 0x7002 SO_DISCOPT = 0x7003 SO_CONNDATALEN = 0x7004 SO_CONNOPTLEN = 0x7005 SO_DISCDATALEN = 0x7006 SO_DISCOPTLEN = 0x7007 )
Options for connect and disconnect data and options. Used only by non-TCP/IP transports such as DECNet, OSI TP4, etc.
const ( SO_OPENTYPE = 0x7008 SO_SYNCHRONOUS_ALERT = 0x10 SO_SYNCHRONOUS_NONALERT = 0x20 )
Option for opening sockets for synchronous access.
const ( SO_MAXDG = 0x7009 SO_MAXPATHDG = 0x700A SO_UPDATE_ACCEPT_CONTEXT = 0x700B SO_CONNECT_TIME = 0x700C SO_UPDATE_CONNECT_CONTEXT = 0x7010 )
Other NT-specific options.
const ( TF_DISCONNECT = 0x01 TF_REUSE_SOCKET = 0x02 TF_WRITE_BEHIND = 0x04 TF_USE_DEFAULT_WORKER = 0x00 TF_USE_SYSTEM_THREAD = 0x10 TF_USE_KERNEL_APC = 0x20 )
const ( TP_ELEMENT_MEMORY = 1 TP_ELEMENT_FILE = 2 TP_ELEMENT_EOP = 4 TP_DISCONNECT = TF_DISCONNECT TP_REUSE_SOCKET = TF_REUSE_SOCKET TP_USE_DEFAULT_WORKER = TF_USE_DEFAULT_WORKER TP_USE_SYSTEM_THREAD = TF_USE_SYSTEM_THREAD TP_USE_KERNEL_APC = TF_USE_KERNEL_APC )
const ( SIO_BSP_HANDLE = 0x4800001B SIO_BSP_HANDLE_SELECT = 0x4800001C SIO_BSP_HANDLE_POLL = 0x4800001D )
Ioctl codes for translating socket handles to the base provider handle. This is performed to prevent breaking non-IFS LSPs when new Winsock extension funtions are added.
const ( SIO_EXT_SELECT = 0xC800001E SIO_EXT_POLL = 0xC800001F SIO_EXT_SENDMSG = 0xC8000020 )
Ioctl codes for Winsock extension functions.
const ( WSA_SECURE_HOST_NOT_FOUND = WSABASEERR + 1032 // No such host is known securely WSA_IPSEC_NAME_POLICY_ERROR = WSABASEERR + 1033 // Name based IPSEC policy could not be added )
const (
AI_DNS_SERVER_UDP_FALLBACK = 0x1
)
Flags for custom servers.
const DE_REUSE_SOCKET = TF_REUSE_SOCKET
const FD_SETSIZE = 64
const FROM_PROTOCOL_INFO = -1
The following may be used in place of the address family, socket type, or protocol in a call to WSASocket to indicate that the corresponding value should be taken from the supplied WSAPROTOCOL_INFO structure instead of the parameter itself.
const INVALID_SOCKET = ^SOCKET(0)
This is used instead of -1, since the SOCKET type is unsigned.
const (
IOC_WSK = IOC_WS2 | 0x07000000
)
WSK-specific IO control codes are Winsock2 codes with the highest-order 3 bits of the Vendor/AddressFamily-specific field set to 1.
const IPPROTO_IP = 0
N.B. required for backwards compatability to support 0 = IP for the level argument to get/setsockopt.
const IP_PROTECTION_LEVEL = IPV6_PROTECTION_LEVEL
IP_PROTECTION_LEVEL is an alias for IPV6_PROTECTION_LEVEL
const IP_UNSPECIFIED_HOP_LIMIT = -1
IP_UNSPECIFIED_HOP_LIMIT represents an unspecified hop limit
const MAXGETHOSTSTRUCT = 1024
Define constant based on rfc883, used by GetHostByxxxx() calls.
const (
MAX_PROTOCOL_CHAIN = 7
)
WinSock 2 extension -- WSAProtocolInfo structure and associated manifest constants
const NLA_ALLUSERS_NETWORK = 0x00000001
const NLA_FRIENDLY_NAME = 0x00000002
const SECURITY_PROTOCOL_NONE = 0x0000
const SERVICE_MULTIPLE = 0x00000001
Service Install Flags
const (
SIO_BASE_HANDLE = 0x48000022
)
Ioctl code used to translate a socket handle into the base provider's handle. This is not used by any Winsock extension function and should not be intercepted by Winsock LSPs.
const SIO_GET_MULTIPLE_EXTENSION_FUNCTION_POINTER uint32 = 0xC8000024
const SIO_SOCKET_CLOSE_NOTIFY = IOC_IN | IOC_VENDOR | 13
MS Transport Provider IOCTL to request notification when a given socket is closed. Input buffer must be a pointer to the socket handle. Input buffer size must be exactly sizeof(HANDLE). Output buffer and output buffer length must be NULL and 0 respectively. This IOCTL must always be issued with an overlapped structure.
This Ioctl code is available only on WinXP SP2 and Win2k3 SP1.
const SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12
MS Transport Provider IOCTL to control reporting PORT_UNREACHABLE messages on UDP sockets via Recv/WSARecv/etc. Pass TRUE in input buffer to enable (default if supported), FALSE to disable.
const SIO_UDP_NETRESET = 0x9800000F
MS Transport Provider IOCTL to control reporting NET_UNREACHABLE (TTL expired) messages on UDP sockets via Recv/WSARecv/Etc. Pass TRUE in input buffer to enabled (default if supported), FALSE to disable.
const SOCKET_ERROR = -1
const SOCK_NOTIFY_EVENTS_ALL = SOCK_NOTIFY_REGISTER_EVENTS_ALL | SOCK_NOTIFY_EVENT_ERR | SOCK_NOTIFY_EVENT_REMOVE
const SOCK_NOTIFY_REGISTER_EVENTS_ALL = SOCK_NOTIFY_REGISTER_EVENT_IN | SOCK_NOTIFY_REGISTER_EVENT_OUT | SOCK_NOTIFY_REGISTER_EVENT_HANGUP
const SOCK_NOTIFY_TRIGGER_ALL = SOCK_NOTIFY_TRIGGER_ONESHOT | SOCK_NOTIFY_TRIGGER_PERSISTENT | SOCK_NOTIFY_TRIGGER_LEVEL | SOCK_NOTIFY_TRIGGER_EDGE
const SOMAXCONN = 0x7fffffff
Maximum queue length specifiable by listen.
const TCP_BSDURGENT = 0x7000
TCP options.
const (
TCP_NODELAY = 0x0001
)
Options to use with [gs]etsockopt at the IPPROTO_TCP level.
const (
UDP_COALESCED_INFO = 3
)
Control message types at the IPPROTO_UDP level.
const WINSOCK_VERSION = 0x0202
const WSABASEERR = 10000
All Windows Sockets error constants are biased by WSABASEERR from the "normal"
const WSAHOST_NOT_FOUND = WSABASEERR + 1001
Authoritative Answer: Host not found
const WSANO_DATA = WSABASEERR + 1004
Valid name, no data record of requested type
const WSANO_RECOVERY = WSABASEERR + 1003
Non-recoverable errors, FORMERR, REFUSED, NOTIMP
const WSATRY_AGAIN = WSABASEERR + 1002
Non-Authoritative: Host not found, or SERVERFAIL
const WSK_SO_BASE = 0x4000
Base constant used for defining WSK-specific options.
Variables ¶
var ( IPV6_ADDRESS_BITS = 128 IN6ADDR_ANY_INIT = [16]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} IN6ADDR_LOOPBACK_INIT = [16]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1} IN6ADDR_ALLNODESONNODE_INIT = [16]byte{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, } IN6ADDR_ALLNODESONLINK_INIT = [16]byte{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, } IN6ADDR_ALLROUTERSONLINK_INIT = [16]byte{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, } IN6ADDR_ALLMLDV2ROUTERSONLINK_INIT = [16]byte{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, } IN6ADDR_TEREDOINITIALLINKLOCALADDRESS_INIT = [16]byte{ 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, } IN6ADDR_TEREDOOLDLINKLOCALADDRESSXP_INIT = [16]byte{ 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 'T', 'E', 'R', 'E', 'D', 'O', } IN6ADDR_TEREDOOLDLINKLOCALADDRESSVISTA_INIT = [16]byte{ 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, } IN6ADDR_LINKLOCALPREFIX_INIT = [2]byte{0xfe, 0x80} IN6ADDR_MULTICASTPREFIX_INIT = [2]byte{0xff, 0x00} IN6ADDR_SOLICITEDNODEMULTICASTPREFIX_INIT = [13]byte{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, } IN6ADDR_V4MAPPEDPREFIX_INIT = [12]byte{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, } IN6ADDR_6TO4PREFIX_INIT = [2]byte{0x20, 0x02} IN6ADDR_TEREDOPREFIX_INIT = [4]byte{0x20, 0x01, 0x00, 0x00} IN6ADDR_TEREDOPREFIX_INIT_OLD = [4]byte{0x3f, 0xfe, 0x83, 0x1f} IN6ADDR_ULAPREFIX_INIT = [1]byte{0xfc} IN6ADDR_SITELOCALPREFIX_INIT = [2]byte{0xfe, 0xc0} IN6ADDR_6BONETESTPREFIX_INIT = [2]byte{0x3f, 0xfe} )
N.B. These addresses are in network byte order.
var NLA_NAMESPACE = GUID{ Data1: 0x6642243a, Data2: 0x3ba8, Data3: 0x4aa6, Data4: [8]byte{0xba, 0xa5, 0x2e, 0x0b, 0xd7, 0x1f, 0xdd, 0x83}, }
Network-location awareness -- Name registration values for use with WSASetService and other structures.
var NLA_SERVICE_CLASS = GUID{ Data1: 0x0037e515, Data2: 0xb5c9, Data3: 0x4a43, Data4: [8]byte{0xba, 0xda, 0x8b, 0x48, 0xa8, 0x7a, 0xd2, 0x39}, }
var WSAID_ACCEPTEX = GUID{ Data1: 0xb5367df1, Data2: 0xcbac, Data3: 0x11cf, Data4: [8]byte{0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}, }
var WSAID_CONNECTEX = GUID{ Data1: 0x25a207b9, Data2: 0xddf3, Data3: 0x4660, Data4: [8]byte{0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e}, }
var WSAID_DISCONNECTEX = GUID{ Data1: 0x7fda2e11, Data2: 0x8630, Data3: 0x436f, Data4: [8]byte{0xa0, 0x31, 0xf5, 0x36, 0xa6, 0xee, 0xc1, 0x57}, }
var WSAID_GETACCEPTEXSOCKADDRS = GUID{ Data1: 0xb5367df2, Data2: 0xcbac, Data3: 0x11cf, Data4: [8]byte{0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}, }
var WSAID_MULTIPLE_RIO = GUID{ Data1: 0x8509e081, Data2: 0x96dd, Data3: 0x4005, Data4: [8]byte{0xb1, 0x65, 0x9e, 0x2e, 0xe8, 0xc7, 0x9e, 0x3f}, }
var WSAID_TRANSMITFILE = GUID{ Data1: 0xb5367df0, Data2: 0xcbac, Data3: 0x11cf, Data4: [8]byte{0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}, }
var WSAID_TRANSMITPACKETS = GUID{ Data1: 0xd9689da0, Data2: 0x1f90, Data3: 0x11d3, Data4: [8]byte{0x99, 0x71, 0x00, 0xc0, 0x4f, 0x68, 0xc8, 0x76}, }
var WSAID_WSAPOLL = GUID{ Data1: 0x18C76F85, Data2: 0xDC66, Data3: 0x4964, Data4: [8]byte{0x97, 0x2E, 0x23, 0xC2, 0x72, 0x38, 0x31, 0x2B}, }
var WSAID_WSARECVMSG = GUID{ Data1: 0xf689d7c8, Data2: 0x6f1f, Data3: 0x436b, Data4: [8]byte{0x8a, 0x53, 0xe5, 0x4f, 0xe3, 0x51, 0xc3, 0x22}, }
var WSAID_WSASENDMSG = GUID{ Data1: 0xa441e712, Data2: 0x754f, Data3: 0x43ca, Data4: [8]byte{0x84, 0xa7, 0x0d, 0xee, 0x44, 0xcf, 0x60, 0x6d}, }
Functions ¶
func BytePtrToString ¶
BytePtrToString converts a byte pointer to a string.
It iterates over the memory pointed to by the byte pointer until it encounters a null terminator (0 byte), appending each byte to a byte slice. It then constructs a string from the byte slice and returns it.
func FreeAddrInfoA ¶
FreeAddrInfoA frees address information that the GetAddrInfoA function dynamically allocates in AddrInfoA structures.
func FreeAddrInfoW ¶
FreeAddrInfoW frees address information that the GetAddrInfoW function dynamically allocates in AddrInfoW structures.
func GUIDToString ¶
GUIDToString returns the string representation of the given GUID.
func GetAddrInfoA ¶
func GetAddrInfoA(nodeName *byte, serviceName *byte, hints *AddrInfoA, result **AddrInfoA) (int, error)
GetAddrInfoA provides protocol-independent translation from a ANSI host name to an address.
func GetAddrInfoW ¶
func GetAddrInfoW(nodeName *uint16, serviceName *uint16, hints *AddrInfoW, result **AddrInfoW) (int, error)
GetAddrInfoW provides protocol-independent translation from a Unicode host name to an address.
func GetHostNameA ¶
GetHostNameA retrieves the standard host name for the local computer.
func GetHostNameW ¶
GetHostNameW retrieves the standard host name for the local computer as a Unicode string.
func GetNameInfoA ¶
func GetNameInfoA( sockaddr unsafe.Pointer, sockaddrLength int32, nodeBuffer *byte, nodeBufferSize int32, serviceBuffer *byte, serviceBufferSize int32, flags int32, ) (int, error)
GetNameInfoA provides protocol-independent name resolution from an address to an ANSI host name and from a port number to the ANSI service name.
func GetNameInfoW ¶
func GetNameInfoW( sockaddr unsafe.Pointer, sockaddrLength int32, nodeBuffer *uint16, nodeBufferSize int32, serviceBuffer *uint16, serviceBufferSize int32, flags int32, ) (int, error)
GetNameInfoW provides protocol-independent name resolution from an address to a Unicode host name and from a port number to the Unicode service name.
func GetPeerName ¶
GetPeerName retrieves the address of the peer to which a socket is connected.
func GetSockName ¶
GetSockName retrieves the local name for a socket.
func GetSockOpt ¶
func GetSockOpt(s SOCKET, level int32, optName int32, optVal unsafe.Pointer, optLen *int32) (int, error)
GetSockOpt retrieves a socket option.
func Htonl ¶
Htonl converts a unsigned long (uint32) from host to TCP/IP network byte order (which is big-endian).
func Htons ¶
Htons converts a unsigned short (uint16) from host to TCP/IP network byte order (which is big-endian).
func InetAddr ¶
InetAddr converts a string containing an IPv4 dotted-decimal address into a proper address for the InAddr structure.
func InetNtoa ¶
InetNtoa converts an (IPv4) Internet network address into an ASCII string in Internet standard dotted-decimal format.
func InetNtop ¶
func InetNtop(family uint16, addr unsafe.Pointer, stringBuf *byte, stringBufSize int32) (*byte, error)
InetNtop converts an IPv4 or IPv6 Internet network address into a string in Internet standard format (ANSI).
func InetNtopW ¶
func InetNtopW(family uint16, addr unsafe.Pointer, stringBuf *uint16, stringBufSize int32) (*uint16, error)
InetNtopW converts an IPv4 or IPv6 Internet network address into a string in Internet standard format (Unicode).
func InetPton ¶
InetPton converts an IPv4 or IPv6 Internet network address in its standard text presentation form into its numeric binary form (ANSI).
func InetPtonW ¶
InetPtonW converts an IPv4 or IPv6 Internet network address in its standard text presentation form into its numeric binary form (Unicode).
func IoctlSocket ¶
IoctlSocket controls the I/O mode of a socket.
func Listen ¶
Listen places a socket in a state in which it is listening for an incoming connection.
func Ntohl ¶
Ntohl converts a unsigned long (uint32) from TCP/IP network order to host byte order (which is little-endian on Intel processors).
func Ntohs ¶
Ntohs converts a unsigned short (uint16) from TCP/IP network byte order to host byte order (which is little-endian on Intel processors).
func RecvFrom ¶
func RecvFrom(s SOCKET, buf unsafe.Pointer, len int32, flags int32, from unsafe.Pointer, fromLen *int32) (int, error)
RecvFrom receives a datagram, and stores the source address.
func Select ¶
func Select(nfds int32, readfds *FDSet, writefds *FDSet, exceptfds *FDSet, timeout *Timeval) (int, error)
Select determines the status of one or more sockets, waiting if necessary, to perform synchronous I/O.
func SendTo ¶
func SendTo(s SOCKET, buf unsafe.Pointer, len int32, flags int32, to unsafe.Pointer, toLen int32) (int, error)
SendTo sends data to a specific destination.
func SetSockOpt ¶
func SetSockOpt(s SOCKET, level int32, optName int32, optVal unsafe.Pointer, optLen int32) (int, error)
SetSockOpt sets a socket option.
func UTF16PtrToString ¶
UTF16PtrToString converts a uint16 pointer to a string.
Returns the populated string and nil if valid, otherwise returns a empty string and an error.
func WSAAddressToStringA ¶
func WSAAddressToStringA( address unsafe.Pointer, addressLength uint32, protocolInfo *WSAProtocolInfoA, addressString *byte, addressStringLength *uint32, ) (int, error)
WSAAddressToStringA converts all components of a sockaddr structure into a human-readable string representation of the address.
func WSAAddressToStringW ¶
func WSAAddressToStringW( address unsafe.Pointer, addressLength uint32, protocolInfo *WSAProtocolInfoW, addressString *uint16, addressStringLength *uint32, ) (int, error)
WSAAddressToStringW converts all components of a sockaddr structure into a human-readable string representation of the address.
func WSACloseEvent ¶
WSACloseEvent closes an open event object handle.
func WSAConnect ¶
func WSAConnect( s SOCKET, name unsafe.Pointer, namelen int32, callerData *WSABuf, calleeData *WSABuf, cQOS *QOS, gQOS *QOS, ) (int, error)
WSAConnect establishes a connection to another socket application, exchanges connect data, and specifies required quality of service based on the specified FlowSpec structure.
func WSAConnectByNameA ¶
func WSAConnectByNameA( s SOCKET, nodename *byte, servicename *byte, localAddressLength *uint32, localAddress unsafe.Pointer, remoteAddressLength *uint32, remoteAddress unsafe.Pointer, timeout *Timeval, reserved *WSAOverlapped, ) (bool, error)
WSAConnectByNameA establishes a connection to a specified host and port.
This function is provided to allow a quick connection to a network endpoint given a host name and port.
This function supports both IPv4 and IPv6 addresses.
func WSAConnectByNameW ¶
func WSAConnectByNameW( s SOCKET, nodename *uint16, servicename *uint16, localAddressLength *uint32, localAddress unsafe.Pointer, remoteAddressLength *uint32, remoteAddress unsafe.Pointer, timeout *Timeval, reserved *WSAOverlapped, ) (bool, error)
WSAConnectByNameW establishes a connection to a specified host and port.
This function is provided to allow a quick connection to a network endpoint given a host name and port.
This function supports both IPv4 and IPv6 addresses.
func WSADuplicateSocketA ¶
func WSADuplicateSocketA(s SOCKET, processId uint32, protocolInfo *WSAProtocolInfoA) (bool, error)
WSADuplicateSocketA returns a WSAProtocolInfoA structure that can be used to create a new socket descriptor for a shared socket.
The WSADuplicateSocket function cannot be used on a QOS-enabled socket.
func WSADuplicateSocketW ¶
func WSADuplicateSocketW(s SOCKET, processId uint32, protocolInfo *WSAProtocolInfoW) (bool, error)
WSADuplicateSocketW returns a WSAProtocolInfoW structure that can be used to create a new socket descriptor for a shared socket.
The WSADuplicateSocket function cannot be used on a QOS-enabled socket.
func WSAEnumNameSpaceProvidersA ¶
func WSAEnumNameSpaceProvidersA(bufferLength *uint32, buffer *WSANameSpaceInfoA) (int, error)
WSAEnumNameSpaceProvidersA retrieves information on available namespace providers.
NOTE: lpnspBuffer should be a pointer to the first element of a WSANameSpaceInfoA slice.
func WSAEnumNameSpaceProvidersExA ¶
func WSAEnumNameSpaceProvidersExA(bufferLength *uint32, buffer *WSANameSpaceInfoExA) (int, error)
WSAEnumNameSpaceProvidersExA retrieves information on available namespace providers.
NOTE: buffer should be a pointer to the first element of a WSANameSpaceInfoExA slice.
func WSAEnumNameSpaceProvidersExW ¶
func WSAEnumNameSpaceProvidersExW(bufferLength *uint32, buffer *WSANameSpaceInfoExW) (int, error)
WSAEnumNameSpaceProvidersExW retrieves information on available namespace providers.
NOTE: buffer should be a pointer to the first element of a WSANameSpaceInfoExW slice.
func WSAEnumNameSpaceProvidersW ¶
func WSAEnumNameSpaceProvidersW(bufferLength *uint32, buffer *WSANameSpaceInfoW) (int, error)
WSAEnumNameSpaceProvidersW retrieves information on available namespace providers.
NOTE: buffer should be a pointer to the first element of a WSANameSpaceInfoW slice.
func WSAEnumNetworkEvents ¶
func WSAEnumNetworkEvents(s SOCKET, eventObject WSAEVENT, networkEvents *WSANetworkEvents) (int, error)
WSAEnumNetworkEvents discovers occurrences of network events for the indicated socket, clear internal network event records, and reset event objects (optional).
func WSAEnumProtocolsA ¶
func WSAEnumProtocolsA(protocols *int32, protocolBuffer *WSAProtocolInfoA, bufferLength *uint32) (int, error)
WSAEnumProtocolsA retrieves information about available transport protocols.
func WSAEnumProtocolsW ¶
func WSAEnumProtocolsW(protocols *int32, protocolBuffer *WSAProtocolInfoW, bufferLength *uint32) (int, error)
WSAEnumProtocolsW retrieves information about available transport protocols.
func WSAEventSelect ¶
WSAEventSelect specifies an event object to be associated with the specified set of FD_XXX network events.
func WSAGetErrorCode ¶
WSAGetErrorCode returns the corresponding error code of the given WinSocket error message or 0 if not found.
func WSAGetOverlappedResult ¶
func WSAGetOverlappedResult(s SOCKET, overlapped *WSAOverlapped, transfer *uint32, wait bool, flags *uint32) (bool, error)
WSAGetOverlappedResult retrieves the results of an overlapped operation on the specified socket.
func WSAHtonl ¶
WSAHtonl converts a unsigned long (uint32) from host byte order to network byte order.
func WSAHtons ¶
WSAHtons converts a unsigned short (uint16) from host byte order to network byte order.
func WSAIoctl ¶
func WSAIoctl( s SOCKET, ioControlCode uint32, inBuffer unsafe.Pointer, inBufferSize uint32, outBuffer unsafe.Pointer, outBufferSize uint32, bytesReturned *uint32, overlapped *WSAOverlapped, completionRoutine unsafe.Pointer, ) (int, error)
WSAIoctl controls the mode of a socket.
WARNING: Partially implemented, the completionRoutine parameter is always ignored.
func WSALookupServiceBeginA ¶
func WSALookupServiceBeginA(restrictions *WSAQuerySetA, controlFlags uint32, lookup *HANDLE) (int, error)
WSALookupServiceBeginA initiates a client query that is constrained by the information contained within a WSAQuerySetA structure.
WSALookupServiceBeginA only returns a handle, which should be used by subsequent calls to WSALookupServiceNext to get the actual results.
func WSALookupServiceBeginW ¶
func WSALookupServiceBeginW(restrictions *WSAQuerySetW, controlFlags uint32, lookup *HANDLE) (int, error)
WSALookupServiceBeginW initiates a client query that is constrained by the information contained within a WSAQuerySetW structure.
WSALookupServiceBeginW only returns a handle, which should be used by subsequent calls to WSALookupServiceNext to get the actual results.
func WSALookupServiceEnd ¶
WSALookupServiceEnd is called to free the handle after previous calls to WSALookupServiceBegin and WSALookupServiceNext.
If you call WSALookupServiceEnd from another thread while an existing WSALookupServiceNext is blocked, the end call will have the same effect as a cancel and will cause the WSALookupServiceNext call to return immediately.
func WSALookupServiceNextA ¶
func WSALookupServiceNextA(lookup HANDLE, controlFlags uint32, bufferLength *uint32, results *WSAQuerySetA) (int, error)
WSALookupServiceNextA is called after obtaining a handle from a previous call to WSALookupServiceBegin in order to retrieve the requested service information.
The provider will pass back a WSAQuerySet structure in the results buffer.
The client should continue to call this function until it returns WSA_E_NO_MORE, indicating that all of WSAQuerySet has been returned.
func WSANSPIoctl ¶
func WSANSPIoctl( lookup HANDLE, controlCode uint32, inBuffer unsafe.Pointer, inBufferSize uint32, outBuffer unsafe.Pointer, outBufferSize uint32, bytesReturned *uint32, completion unsafe.Pointer, ) (int, error)
WSANSPIoctl enables developers to make I/O control calls to a registered namespace.
WARNING: Partially implemented, the completion parameter is always ignored.
func WSANtohl ¶
WSANtohl converts a unsigned long (uint32) from network byte order to host byte order.
func WSANtohs ¶
WSANtohs converts a unsigned short (uint16) from network byte order to host byte order.
func WSAProviderConfigChange ¶
func WSAProviderConfigChange( notificationHandle *HANDLE, overlapped *WSAOverlapped, completionRoutine unsafe.Pointer, ) (int, error)
WSAProviderConfigChange notifies the application when the provider configuration is changed.
WARNING: Partially implemented, the completionRoutine parameter is always ignored.
func WSARecv ¶
func WSARecv( s SOCKET, buffers *WSABuf, bufferCount uint32, numberOfBytesRecvd *uint32, flags *uint32, overlapped *WSAOverlapped, completionRoutine unsafe.Pointer, ) (int, error)
WSARecv receives data from a connected socket or a bound connectionless socket.
WARNING: Partially implemented, the completionRoutine parameter is always ignored.
func WSARecvDisconnect ¶
WSARecvDisconnect terminates reception on a socket, and retrieves the disconnect data if the socket is connection oriented.
func WSARecvFrom ¶
func WSARecvFrom( s SOCKET, buffers *WSABuf, bufferCount uint32, numberOfBytesRecvd *uint32, flags *uint32, from unsafe.Pointer, fromLen *int32, overlapped *WSAOverlapped, completionRoutine unsafe.Pointer, ) (int, error)
WSARecvFrom receives a datagram and stores the source address.
WARNING: Partially implemented, the completionRoutine parameter is always ignored.
func WSARemoveServiceClass ¶
WSARemoveServiceClass permanently removes the service class schema from the registry.
func WSAResetEvent ¶
WSAResetEvent resets the state of the specified event object to nonsignaled.
func WSASend ¶
func WSASend( s SOCKET, buffers *WSABuf, bufferCount uint32, numberOfBytesSent *uint32, flags uint32, overlapped *WSAOverlapped, completionRoutine unsafe.Pointer, ) (int, error)
WSASend sends data on a connected socket.
WARNING: Partially implemented, the completionRoutine parameter is always ignored.
func WSASendDisconnect ¶
WSASendDisconnect initiates termination of the connection for the socket and sends disconnect data.
func WSASendMsg ¶
func WSASendMsg( socket SOCKET, msg *WSAMsg, flags uint32, numberOfBytesSent *uint32, overlapped *WSAOverlapped, completionRoutine unsafe.Pointer, ) (int, error)
WSASendMsg sends data and optional control information from connected and unconnected sockets.
WARNING: Partially implemented, the completionRoutine parameter is always ignored.
func WSASendTo ¶
func WSASendTo( s SOCKET, buffers *WSABuf, bufferCount uint32, numberOfBytesSent *uint32, flags uint32, to unsafe.Pointer, tolen int32, overlapped *WSAOverlapped, completionRoutine unsafe.Pointer, ) (int, error)
WSASendTo sends data to a specific destination, using overlapped I/O where applicable.
WARNING: Partially implemented, the completionRoutine parameter is always ignored.
func WSASetEvent ¶
WSASetEvent sets the state of the specified event object to signaled.
func WSASetLastError ¶
WSASetLastError sets the error code that can be retrieved through the WSAGetLastError function.
func WSASetServiceA ¶
func WSASetServiceA(regInfo *WSAQuerySetA, essoperation WSAESETSERVICEOP, controlFlags uint32) (int, error)
WSASetServiceA registers or removes from the registry a service instance within one or more namespaces.
func WSASetServiceW ¶
func WSASetServiceW(regInfo *WSAQuerySetW, essoperation WSAESETSERVICEOP, controlFlags uint32) (int, error)
WSASetServiceW registers or removes from the registry a service instance within one or more namespaces.
func WSAStartup ¶
WSAStartup initiates use of the Winsock DLL by a process.
func WSAStringToAddressA ¶
func WSAStringToAddressA( addressString *byte, addressFamily uint16, protocolInfo *WSAProtocolInfoA, address unsafe.Pointer, addressLength *int32, ) (int, error)
WSAStringToAddressA converts a network address in its standard text presentation form into its numeric binary form in a sockaddr structure, suitable for passing to Windows Sockets routines that take such a structure.
func WSAStringToAddressW ¶
func WSAStringToAddressW( addressString *uint16, addressFamily uint16, protocolInfo *WSAProtocolInfoW, address unsafe.Pointer, addressLength *int32, ) (int, error)
WSAStringToAddressW converts a network address in its standard text presentation form into its numeric binary form in a sockaddr structure, suitable for passing to Windows Sockets routines that take such a structure.
func WSAWaitForMultipleEvents ¶
func WSAWaitForMultipleEvents(eventsCount uint32, events *WSAEVENT, waitAll bool, timeout uint32, alertable bool) (int, error)
WSAWaitForMultipleEvents returns when one or all of the specified event objects are in the signaled state, when the time-out interval expires, or when an I/O completion routine has executed.
Types ¶
type AFProtocols ¶
type AFProtocols struct { AddressFamily int32 // Address family to which the query is to be constrained. Protocol int32 // Protocol to which the query is to be constrained. }
AFProtocols supplies a list of protocols to which application programmers can constrain queries.
The AFPROTOCOLS structure is used for query purposes only.
type AddrInfoA ¶
type AddrInfoA struct { Flags int32 // AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST. Family int32 // PF_xxx. SockType int32 // SOCK_xxx. Protocol int32 // 0 or IPPROTO_xxx for IPv4 and IPv6. AddrLength uint32 // Length of Addr. CanonName *byte // Canonical name for nodename. Addr unsafe.Pointer // Binary address. Next *AddrInfoA // Next structure in linked list. }
AddrInfoA is used by the GetAddrInfoA function to hold host address information.
type AddrInfoW ¶
type AddrInfoW struct { Flags int32 // AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST. Family int32 // PF_xxx. SockType int32 // SOCK_xxx. Protocol int32 // 0 or IPPROTO_xxx for IPv4 and IPv6. AddrLength uint32 // Length of Addr. CanonName *uint16 // Canonical name for nodename. Addr unsafe.Pointer // Binary address. Next *AddrInfoW // Next structure in linked list. }
AddrInfoW is used by the GetAddrInfoW function to hold host address information.
type BLOB ¶
BLOB represents a structure derived from Binary Large Object, contains information about a block of data.
type CSAddrInfo ¶
type CSAddrInfo struct { LocalAddr SocketAddress // Specifies a Windows Sockets local address. RemoteAddr SocketAddress // Specifies a Windows Sockets remote address. SocketType int32 // Specifies the type of the Windows Socket. Protocol int32 // Specifies a value to pass as the protocol parameter to the socket (Windows Sockets) function to open a socket for this service. }
CSAddrInfo contains Windows Sockets address information for a socket, network service, or namespace provider.
type FDSet ¶
type FDSet struct { Count uint32 Array [FD_SETSIZE]SOCKET }
FDSet is used by various Windows Sockets functions and service providers, such as the select function, to place sockets into a "set" for various purposes, such as testing a given socket for readability using the readfds parameter of the select function.
func (*FDSet) Clear ¶
Clear removes the specified socket from the FDSet. It iterates through the array, finds the socket, and removes it by shifting the remaining sockets.
func (*FDSet) IsSet ¶
IsSet checks whether the specified socket is present in the FDSet. It calls the helper function __WSAFDIsSet to perform the check.
type FlowSpec ¶
type FlowSpec struct { TokenRate uint32 // Rate at which data can be transmitted over the life of the flow TokenBucketSize uint32 // Maximum amount of credits a given direction of a flow can accrue, regardless of time, in bytes. PeakBandwidth uint32 // Upper limit on time-based transmission permission for a given flow, in bytes per second. Latency uint32 // Maximum acceptable delay between transmission of a bit by the sender and its receipt by one or more intended receivers, in microseconds. DelayVariation uint32 // Difference between the maximum and minimum possible delay a packet will experience, in microseconds. ServiceType SERVICETYPE // Specifies the level of service to negotiate for the flow. MaxSduSize uint32 // Specifies the maximum packet size permitted or used in the traffic flow, in bytes. MinimumPolicedSize uint32 // Specifies the minimum packet size for which the requested quality of service will be provided, in bytes. }
FlowSpec provides quality of service parameters to the RSVP SP.
This allows QOS-aware applications to invoke, modify, or remove QOS settings for a given flow.
type GUID ¶
GUID identifies an object such as a COM interfaces, or a COM class object, or a manager entry-point vector(EPV).
A GUID is a 128-bit value consisting of one group of 8 hexadecimal digits, followed by three groups of 4 hexadecimal digits each, followed by one group of 12 hexadecimal digits.
The GUID structure stores a GUID.
type HostEnt ¶
type HostEnt struct { HName *byte // Official name of host HAliases **byte // Alias list HAddrType int16 // Host address type HLength int16 // Length of address HAddrList **byte // List of addresses }
HostEnt is used by functions to store information about a given host, such as host name, IPv4 address, and so forth. An application should never attempt to modify this structure or to free any of its components.
Furthermore, only one copy of the hostent structure is allocated per thread, and an application should therefore copy any information that it needs before issuing any other Windows Sockets API calls.
func GetHostByName
deprecated
type InAddr ¶
type InAddr struct {
Addr [4]byte // IPv4 address.
}
InAddr represents an IPv4 Internet address.
type InAddr6 ¶
type InAddr6 struct {
Addr [16]byte // IPv6 address.
}
InAddr6 represents an IPv6 Internet address.
type NetEnt ¶
type NetEnt struct { NName *byte // Official name of net NAliases **byte // Alias list NAddrType int16 // Net address type NNet uint32 // Network # }
It is assumed here that a network number fits in 32 bits.
type Overlapped ¶
type Overlapped struct { Internal uint32 // Reserved for internal use. The Internal member is used internally by the entity that implements overlapped I/O. InternalHigh uint32 // Reserved. Used internally by the entity that implements overlapped I/O. Offset uint32 // Reserved for use by service providers. OffsetHigh uint32 // Reserved for use by service providers. HEvent WSAEVENT // Either contain a valid handle to a WSAEVENT object or be null. }
Overlapped contains information used in asynchronous (or overlapped) input and output (I/O).
type ProtoEnt ¶
type ProtoEnt struct { PName *byte // Official protocol name PAliases **byte // Alias list PProto int16 // Protocol # }
ProtoEnt contains the name and protocol numbers that correspond to a given protocol name. Applications must never attempt to modify this structure or to free any of its components.
Furthermore, only one copy of this structure is allocated per thread, and therefore, the application should copy any information it needs before issuing any other Windows Sockets function calls.
func GetProtoByName ¶
GetProtoByName retrieves the protocol information corresponding to a protocol name.
func GetProtoByNumber ¶
GetProtoByNumber retrieves protocol information corresponding to a protocol number.
type QOS ¶
type QOS struct { SendingFlowspec FlowSpec // Specifies QOS parameters for the sending direction of a particular flow. ReceivingFlowspec FlowSpec // Specifies QOS parameters for the receiving direction of a particular flow. ProviderSpecific WSABuf // Pointer to a structure of type WSABUF that can provide additional provider-specific quality of service parameters to the RSVP SP for a given flow. }
QOS provides the means by which QOS-enabled applications can specify quality of service parameters for sent and received traffic on a particular flow.
type SOCKET ¶
type SOCKET uintptr
Basic types.
func WSAAccept ¶
func WSAAccept(s SOCKET, addr unsafe.Pointer, addrLen *int32, condition unsafe.Pointer, callbackData uintptr) (SOCKET, error)
WSAAccept accepts a connection based on the return value of a condition function, provides quality of service flow specifications, and allows the transfer of connection data.
WARNING: Partially implemented, the condition and callbackData parameters are always ignored.
func WSAJoinLeaf ¶
func WSAJoinLeaf( s SOCKET, sockaddr unsafe.Pointer, nameLen int32, callerData *WSABuf, calleeData *WSABuf, sQOS *QOS, gQOS *QOS, flags uint32, ) (SOCKET, error)
WSAJoinLeaf joins a leaf node into a multipoint session, exchanges connect data, and specifies needed quality of service based on the specified FlowSpec structures.
func WSASocketA ¶
func WSASocketA(af int32, stype int32, protocol int32, protocolInfo *WSAProtocolInfoA, g GROUP, flags uint32) (SOCKET, error)
WSASocketA creates a socket that is bound to a specific transport-service provider.
func WSASocketW ¶
func WSASocketW(af int32, stype int32, protocol int32, protocolInfo *WSAProtocolInfoW, g GROUP, flags uint32) (SOCKET, error)
WSASocketW creates a socket that is bound to a specific transport-service provider.
type ScopeLevel ¶
type ScopeLevel int
Scope ID definition
ScopeLevel enumeration
const ( ScopeLevelInterface ScopeLevel = 1 ScopeLevelLink ScopeLevel = 2 ScopeLevelSubnet ScopeLevel = 3 ScopeLevelAdmin ScopeLevel = 4 ScopeLevelSite ScopeLevel = 5 ScopeLevelOrganization ScopeLevel = 8 ScopeLevelGlobal ScopeLevel = 14 ScopeLevelCount ScopeLevel = 16 )
type ServEnt ¶
type ServEnt struct { SName *byte // Official service name SAliases **byte // Alias list SProto *byte // Protocol to use SPort int16 // Port # }
ServEnt is used to store or return the name and service number for a given service name.
func GetServByName ¶
GetServByName retrieves service information corresponding to a service name and protocol.
type SockAddr ¶
SockAddr varies depending on the protocol selected.
func NewSockAddress ¶
NewSockAddress creates a new generic socket address structure.
It takes an IPv4 or IPv6 address string and a port number as input.
Returns the SockAddr structure and its length or nil if the IP is invalid.
func PtrToSockAddr ¶
PtrToSockAddr converts an pointer to a SockAddr.
Returns the SockAddr and nil if valid, otherwise returns an error.
func (*SockAddr) FromNetIP ¶
FromNetIP populates the SockAddr structure with the given net.IP and port number.
func (*SockAddr) To4 ¶
func (sa *SockAddr) To4() (v4 *SockAddrInet4)
To4 returns the socket address converted to an SockAddrInet4 structure or nil.
func (*SockAddr) To6 ¶
func (sa *SockAddr) To6() (v6 *SockAddrInet6)
To6 returns the socket address converted to an SockAddrInet6 structure or nil.
type SockAddrInet4 ¶
type SockAddrInet4 struct { Family uint16 // Address family (AF_INET). Port uint16 // Port number. Addr [4]byte // IPv4 address. // contains filtered or unexported fields }
SockAddrInet4 represents an IPv4 socket address structure.
The address family is in host byte order and the IPv6 address is in network byte order.
func NewV4SockAddress ¶
func NewV4SockAddress(address string, port int) (addr *SockAddrInet4, length int32)
NewV4SockAddress creates a new IPv4 socket address structure.
It takes an IPv4 address string and a port number as input.
Returns the SockAddrInet4 structure and its length or nil if the IP is invalid.
type SockAddrInet6 ¶
type SockAddrInet6 struct { Family uint16 // Address family (AF_INET6). Port uint16 // Port number. FlowInfo uint32 // IPv6 flow information. Addr [16]byte // IPv6 address. ScopeID uint32 // Scope identifier. }
SockAddrInet6 represents an IPv6 socket address structure.
The address family is in host byte order and the IPv6 address is in network byte order.
func NewV6SockAddress ¶
func NewV6SockAddress(address string, port int) (addr *SockAddrInet6, length int32)
NewV6SockAddress creates a new IPv6 socket address structure.
It takes an IPv6 address string and a port number as input.
Returns the SockAddrInet6 structure and its length or nil if the IP is invalid.
type SocketAddress ¶
type SocketAddress struct { Sockaddr unsafe.Pointer // Pointer to a socket address represented as a SockAddr structure. SockaddrLength int32 // length, in bytes, of the socket address. }
SocketAddress stores protocol-specific address information.
type SocketAddressList ¶
type SocketAddressList struct { AddressCount int32 // Number of address structures in the Address member. Address []SocketAddress // Slice of SocketAddress structures that are specific to a protocol family. }
SocketAddressList stores an array of SocketAddress structures that contain protocol-specific address information.
type Timeval ¶
Timeval is used to specify a time interval.
It is associated with the Berkeley Software Distribution (BSD) Time.h header file.
type WSABuf ¶
type WSABuf struct { Length uint32 // Length of the buffer, in bytes. Buf *byte // Pointer to the buffer. }
WSABuf enables the creation or manipulation of a data buffer used by some Winsock functions.
type WSAData ¶
type WSAData struct { Version uint16 // Version of the Windows Sockets specification that the Ws2_32.dll expects the caller to use. HighVersion uint16 // Highest version of the Windows Sockets specification that the Ws2_32.dll can support. Description [WSADESCRIPTION_LEN + 1]byte // NULL-terminated ASCII string into which the Ws2_32.dll copies a description of the Windows Sockets implementation. SystemStatus [WSASYS_STATUS_LEN + 1]byte // NULL-terminated ASCII string into which the Ws2_32.dll copies relevant status or configuration information. }
WSAData contains information about the Windows Sockets implementation.
type WSAECOMPARATOR ¶
type WSAECOMPARATOR int32
Basic types.
const ( COMP_EQUAL WSAECOMPARATOR = 0 COMP_NOTLESS WSAECOMPARATOR = 1 )
type WSAESETSERVICEOP ¶
type WSAESETSERVICEOP int32
Basic types.
const ( RNRSERVICE_REGISTER WSAESETSERVICEOP = iota RNRSERVICE_DEREGISTER RNRSERVICE_DELETE )
Service Address Registration and Deregistration Data Types.
type WSAEVENT ¶
type WSAEVENT HANDLE
Basic types.
func WSACreateEvent ¶
WSACreateEvent creates a new event object.
type WSAMsg ¶
type WSAMsg struct { Name unsafe.Pointer // Pointer to a SocketAddress structure that stores information about the remote address. Used only with unconnected sockets. NameLength int32 // Length, in bytes, of the SocketAddress structure pointed to in the pAddr member. Used only with unconnected sockets. Buffers *WSABuf // Array of WSABUF structures used to receive the message data. The capability of the Buffers member to contain multiple buffers enables the use of scatter/gather I/O. BufferCount uint32 // Number of buffers pointed to in the Buffers member. Control WSABuf // A structure of WSABUF type used to specify optional control data. Flags uint32 // One or more control flags, specified as the logical OR of values. }
WSAMsg is used with the WSARecvMsg and WSASendMsg functions to store address and optional control information about connected and unconnected sockets as well as an array of buffers used to store message data.
type WSANSClassInfoA ¶
type WSANSClassInfoA struct { Name *byte // String value associated with the parameter, such as SAPID, TCPPORT, and so forth. NameSpace uint32 // GUID associated with the namespace. ValueType uint32 // Value type for the parameter, such as REG_DWORD or REG_SZ, and so forth. ValueSize uint32 // Size of the parameter provided in Value, in bytes. Value unsafe.Pointer // Pointer to the value of the parameter. }
WSANSClassInfoA provides individual parameter information for a specific Windows Sockets namespace.
type WSANSClassInfoW ¶
type WSANSClassInfoW struct { Name *uint16 // String value associated with the parameter, such as SAPID, TCPPORT, and so forth. NameSpace uint32 // GUID associated with the namespace. ValueType uint32 // Value type for the parameter, such as REG_DWORD or REG_SZ, and so forth. ValueSize uint32 // Size of the parameter provided in Value, in bytes. Value unsafe.Pointer // Pointer to the value of the parameter. }
WSANSClassInfoW provides individual parameter information for a specific Windows Sockets namespace.
type WSANameSpaceInfoA ¶
type WSANameSpaceInfoA struct { NSProviderId GUID // Unique GUID for this namespace provider. NameSpace uint32 // Namespace supported by this provider. Active bool // If TRUE, indicates that this namespace provider is active. Version uint32 // Version number of the namespace provider. Identifier *byte // Display string that identifies the namespace provider. }
WSANameSpaceInfoA contains all registration information for a namespace provider.
type WSANameSpaceInfoExA ¶
type WSANameSpaceInfoExA struct { NSProviderId GUID // Unique GUID for this namespace provider. NameSpace uint32 // Namespace supported by this provider. Active bool // If TRUE, indicates that this namespace provider is active. Version uint32 // Version number of the namespace provider. Identifier *byte // Display string that identifies the namespace provider. ProviderSpecific BLOB // Provider-specific data blob associated with namespace entry. }
WSANameSpaceInfoExA contains all registration information for a namespace provider.
type WSANameSpaceInfoExW ¶
type WSANameSpaceInfoExW struct { NSProviderId GUID // Unique GUID for this namespace provider. NameSpace uint32 // Namespace supported by this provider. Active bool // If TRUE, indicates that this namespace provider is active. Version uint32 // Version number of the namespace provider. Identifier *uint16 // Display string that identifies the namespace provider. ProviderSpecific BLOB // Provider-specific data blob associated with namespace entry. }
WSANameSpaceInfoExW contains all registration information for a namespace provider.
type WSANameSpaceInfoW ¶
type WSANameSpaceInfoW struct { NSProviderId GUID // Unique GUID for this namespace provider. NameSpace uint32 // Namespace supported by this provider. Active bool // If TRUE, indicates that this namespace provider is active. Version uint32 // Version number of the namespace provider. Identifier *uint16 // Display string that identifies the namespace provider. }
WSANameSpaceInfoW contains all registration information for a namespace provider.
type WSANetworkEvents ¶
type WSANetworkEvents struct { NetworkEvents int32 // Indicates which of the FD_XXX network events have occurred. ErrorCode [FD_MAX_EVENTS]int32 // Array that contains any associated error codes. }
WSANetworkEvents is used to store a socket's internal information about network events.
type WSAOverlapped ¶
type WSAOverlapped struct {
Overlapped
}
WSAOverlapped provides a communication medium between the initiation of an overlapped I/O operation and its subsequent completion.
The WSAOverlapped structure is compatible with the Windows Overlapped structure.
type WSAPollFD ¶
type WSAPollFD struct { FD SOCKET // Identifier of the socket for which to find status. This parameter is ignored if set to a negative value. Events int16 // Set of flags indicating the type of status being requested. Revents int16 // Set of flags that indicate, upon return from the WSAPoll function call, the results of the status query. }
WSAPollFD stores socket information used by the WSAPoll function.
type WSAProtocolChainA ¶
type WSAProtocolChainA struct { ChainLength int32 // Length of the chain, in bytes. (0 = layered protocol, 1 = base protocol, >1 = protocol chain) ChainEntries [MAX_PROTOCOL_CHAIN]uint32 // Array of protocol chain entries. }
WSAProtocolChainA contains a counted list of Catalog Entry identifiers that comprise a protocol chain.
type WSAProtocolChainW ¶
type WSAProtocolChainW struct { ChainLength int32 // Length of the chain, in bytes. (0 = layered protocol, 1 = base protocol, >1 = protocol chain) ChainEntries *uint32 // Array of protocol chain entries. }
WSAProtocolChainW contains a counted list of Catalog Entry identifiers that comprise a protocol chain.
type WSAProtocolInfoA ¶
type WSAProtocolInfoA struct { ServiceFlags1 uint32 // Bitmask that describes the services provided by the protocol. ServiceFlags2 uint32 // Reserved for additional protocol-attribute definitions. ServiceFlags3 uint32 // Reserved for additional protocol-attribute definitions. ServiceFlags4 uint32 // Reserved for additional protocol-attribute definitions. ProviderFlags uint32 // Set of flags that provides information on how this protocol is represented in the Winsock catalog. ProviderId GUID // A globally unique identifier (GUID) assigned to the provider by the service provider vendor. CatalogEntryId uint32 // Unique identifier assigned by the WS2_32.DLL for each WSAProtocolInfo structure. ProtocolChain WSAProtocolChainA // The WSAProtocolChain structure associated with the protocol. Version int32 // Protocol version identifier. AddressFamily int32 // Value to pass as the address family parameter to the socket or WSASocket function in order to open a socket for this protocol. MaxSockAddr int32 // Maximum address length, in bytes. MinSockAddr int32 // Minimum address length, in bytes. SocketType int32 // Value to pass as the socket type parameter to the socket or WSASocket function in order to open a socket for this protocol. Protocol int32 // Value to pass as the protocol parameter to the socket or WSASocket function in order to open a socket for this protocol. ProtocolMaxOffset int32 // Maximum value that may be added to iProtocol when supplying a value for the protocol parameter to socket or WSASocket function. NetworkByteOrder int32 // Currently these values are manifest constants (BIGENDIAN and LITTLEENDIAN) that indicate either big-endian or little-endian with the values 0 and 1 respectively. SecurityScheme int32 // Type of security scheme employed (if any). A value of SECURITY_PROTOCOL_NONE (0) is used for protocols that do not incorporate security provisions. MessageSize uint32 // Maximum message size, in bytes, supported by the protocol. ProviderReserved uint32 // Reserved for use by service providers. ProtocolName [WSAPROTOCOL_LEN + 1]byte // Array of characters that contains a human-readable name identifying the protocol (max. 255 char.). }
WSAProtocolInfoA is used to store or retrieve complete information for a given protocol. The protocol name is represented as an array of ANSI characters.
type WSAProtocolInfoW ¶
type WSAProtocolInfoW struct { ServiceFlags1 uint32 // Bitmask that describes the services provided by the protocol. ServiceFlags2 uint32 // Reserved for additional protocol-attribute definitions. ServiceFlags3 uint32 // Reserved for additional protocol-attribute definitions. ServiceFlags4 uint32 // Reserved for additional protocol-attribute definitions. ProviderFlags uint32 // Set of flags that provides information on how this protocol is represented in the Winsock catalog. ProviderId GUID // A globally unique identifier (GUID) assigned to the provider by the service provider vendor. CatalogEntryId uint32 // Unique identifier assigned by the WS2_32.DLL for each WSAProtocolInfo structure. ProtocolChain WSAProtocolChainW // The WSAProtocolChain structure associated with the protocol. Version int32 // Protocol version identifier. AddressFamily int32 // Value to pass as the address family parameter to the socket or WSASocket function in order to open a socket for this protocol. MaxSockAddr int32 // Maximum address length, in bytes. MinSockAddr int32 // Minimum address length, in bytes. SocketType int32 // Value to pass as the socket type parameter to the socket or WSASocket function in order to open a socket for this protocol. Protocol int32 // Value to pass as the protocol parameter to the socket or WSASocket function in order to open a socket for this protocol. ProtocolMaxOffset int32 // Maximum value that may be added to iProtocol when supplying a value for the protocol parameter to socket or WSASocket function. NetworkByteOrder int32 // Currently these values are manifest constants (BIGENDIAN and LITTLEENDIAN) that indicate either big-endian or little-endian with the values 0 and 1 respectively. SecurityScheme int32 // Type of security scheme employed (if any). A value of SECURITY_PROTOCOL_NONE (0) is used for protocols that do not incorporate security provisions. MessageSize uint32 // Maximum message size, in bytes, supported by the protocol. ProviderReserved uint32 // Reserved for use by service providers. ProtocolName [WSAPROTOCOL_LEN + 1]uint16 // Array of characters that contains a human-readable name identifying the protocol (max. 255 char.). }
WSAProtocolInfoW is used to store or retrieve complete information for a given protocol. The protocol name is represented as an array of Unicode characters.
type WSAQuerySetA ¶
type WSAQuerySetA struct { Size uint32 // Size, in bytes, of the WSAQuerySetA structure. ServiceInstanceName *byte // Pointer to an optional NULL-terminated string that contains service name. ServiceClassId *GUID // GUID corresponding to the service class. This member is required to be set. Version *WSAVersion // Pointer to an optional desired version number of the namespace provider. Comment *byte // Ignored for queries. NameSpace uint32 // Namespace identifier that determines which namespace providers are queried. NSProviderId *GUID // Pointer to an optional GUID of a specific namespace provider to query in the case where multiple namespace providers are registered under a single namespace such as NS_DNS. Context *byte // Pointer to an optional starting point of the query in a hierarchical namespace. NumberOfProtocols uint32 // Size, in bytes, of the protocol constraint array. This member can be zero. AFProtocols *AFProtocols // Pointer to an optional array of AFProtocols structures. Only services that utilize these protocols will be returned. QueryString *byte // Pointer to an optional NULL-terminated query string. NumberOfCsAddrs uint32 // Ignored for queries. CSABuffer *CSAddrInfo // Ignored for queries. OutputFlags uint32 // Ignored for queries. Blob *WSABuf // Optional pointer to data that is used to query or set provider-specific namespace information. }
WSAQuerySetA provides relevant information about a given service, including service class ID, service name, applicable namespace identifier and protocol information, as well as a set of transport addresses at which the service listens.
type WSAQuerySetW ¶
type WSAQuerySetW struct { Size uint32 // Size, in bytes, of the WSAQuerySetW structure. ServiceInstanceName *uint16 // Pointer to an optional NULL-terminated string that contains service name. ServiceClassId *GUID // GUID corresponding to the service class. This member is required to be set. Version *WSAVersion // Pointer to an optional desired version number of the namespace provider. Comment *uint16 // Ignored for queries. NameSpace uint32 // Namespace identifier that determines which namespace providers are queried. NSProviderId *GUID // Pointer to an optional GUID of a specific namespace provider to query in the case where multiple namespace providers are registered under a single namespace such as NS_DNS. Context *uint16 // Pointer to an optional starting point of the query in a hierarchical namespace. NumberOfProtocols uint32 // Size, in bytes, of the protocol constraint array. This member can be zero. AFProtocols *AFProtocols // Pointer to an optional array of AFProtocols structures. Only services that utilize these protocols will be returned. QueryString *uint16 // Pointer to an optional NULL-terminated query string. NumberOfCsAddrs uint32 // Ignored for queries. CSABuffer *CSAddrInfo // Ignored for queries. OutputFlags uint32 // Ignored for queries. Blob *WSABuf // Optional pointer to data that is used to query or set provider-specific namespace information. }
WSAQuerySetW provides relevant information about a given service, including service class ID, service name, applicable namespace identifier and protocol information, as well as a set of transport addresses at which the service listens.
type WSAServiceClassInfoA ¶
type WSAServiceClassInfoA struct { ServiceClassId *GUID // Unique Identifier (GUID) for the service class. ServiceClassName *byte // Well known name associated with the service class. Count uint32 // Number of entries in ClassInfos. ClassInfos *WSANSClassInfoA // Array of WSANSClassInfoA structures that contains information about the service class. }
WSAServiceClassInfoA contains information about a specified service class.
type WSAServiceClassInfoW ¶
type WSAServiceClassInfoW struct { ServiceClassId *GUID // Unique Identifier (GUID) for the service class. ServiceClassName *uint16 // Well known name associated with the service class. Count uint32 // Number of entries in ClassInfos. ClassInfos *WSANSClassInfoW // Array of WSANSClassInfoW structures that contains information about the service class. }
WSAServiceClassInfoW contains information about a specified service class.
type WSAVersion ¶
type WSAVersion struct { Version uint32 // Version of Windows Sockets. ECHow WSAECOMPARATOR // WSAECOMPARATOR enumeration, used in the comparison. }
WSAVersion provides version comparison in Windows Sockets.