; _______________________________________________________________________________________
;|                                                                                       |
;| ..::FreshLib::..  Free, open source. Licensed under "BSD 2-clause" license."          |
;|_______________________________________________________________________________________|
;
;  Description: wsock32.dll API calls
;
;  Target OS: Win32
;
;  Dependencies:
;
;  Notes:
;_________________________________________________________________________________________


import_proto wsock32,  \
    AcceptEx, <.sListenSocket, .sAcceptSocket, .lpOutputBuffer, .dwReceiveDataLength, .dwLocalAddressLength, .dwRemoteAddressLength,  \
        .lpdwBytesReceived, .lpOverlapped>,  'AcceptEx',  \
    EnumProtocolsA, <.lpiProtocols, .lpProtocolBuffer, .lpdwBufferLength>,  'EnumProtocolsA',  \
    EnumProtocolsW, <.lpiProtocols, .lpProtocolBuffer, .lpdwBufferLength>,  'EnumProtocolsW',  \
    GetAcceptExSockaddrs, <.lpOutputBuffer, .dwReceiveDataLength, .dwLocalAddressLength, .dwRemoteAddressLength, .LocalSockaddr, .LocalSockaddrLength,  \
        .RemoteSockaddr, .RemoteSockaddrLength>,  'GetAcceptExSockaddrs',  \
    GetAddressByNameA, <.dwNameSpace, .lpServiceType, .lpServiceName, .lpiProtocols, .dwResolution, .lpServiceAs, .lpCsaddrBuffer,  \
        .lpdwBufferLength, .lpAliasBuffer, .lpdwAliasBufferLength>,  'GetAddressByNameA',  \
    GetAddressByNameW, <.dwNameSpace, .lpServiceType, .lpServiceName, .lpiProtocols, .dwResolution, .lpServiceAs, .lpCsaddrBuffer,  \
        .lpdwBufferLength, .lpAliasBuffer, .lpdwAliasBufferLength>,  'GetAddressByNameW',  \
    GetNameByTypeA, <.lpServiceType, .lpServiceName, .dwNameLength>,  'GetNameByTypeA',  \
    GetNameByTypeW, <.lpServiceType, .lpServiceName, .dwNameLength>,  'GetNameByTypeW',  \
    GetServiceA, <.dwNameSpace, .lpGuid, .lpServiceName, .dwProperties, .lpBuffer, .lpdwBufferSize, .lpServiceAs>,  'GetServiceA',  \
    GetServiceW, <.dwNameSpace, .lpGuid, .lpServiceName, .dwProperties, .lpBuffer, .lpdwBufferSize, .lpServiceAs>,  'GetServiceW',  \
    GetTypeByNameA, <.lpServiceName, .lpServiceType>,  'GetTypeByNameA',  \
    GetTypeByNameW, <.lpServiceName, .lpServiceType>,  'GetTypeByNameW',  \
    MigrateWinsockConfiguration, <NONE>,  'MigrateWinsockConfiguration',  \
    NPLoadNameSpaces, <NONE>,  'NPLoadNameSpaces',  \
    SetServiceA, <.dwNameSpace, .dwOperation, .dwFlags, .lpServiceInfo, .lpServiceAsyncInfo, .lpdwStatusFlags>,  'SetServiceA',  \
    SetServiceW, <.dwNameSpace, .dwOperation, .dwFlags, .lpServiceInfo, .lpServiceAsyncInfo, .lpdwStatusFlags>,  'SetServiceW',  \
    TransmitFile, <.hSocket, .hFile, .nNumberOfBytesToWrite, .nNumberOfBytesPerSend, .lpOverlapped, .lpTransmitBuffers, .dwReserved,  \
      >,  'TransmitFile',  \
    WEP, <NONE>,  'WEP',  \
    WSAAsyncGetHostByAddr, <.hWnd, .wMsg, .addr, .lLen, .lType, .buf, .buflen>,  'WSAAsyncGetHostByAddr',  \
    WSAAsyncGetHostByName, <.hWnd, .wMsg, .name, .buf, .buflen>,  'WSAAsyncGetHostByName',  \
    WSAAsyncGetProtoByName, <.hWnd, .wMsg, .name, .buf, .buflen>,  'WSAAsyncGetProtoByName',  \
    WSAAsyncGetProtoByNumber, <.hWnd, .wMsg, .number, .buf, .buflen>,  'WSAAsyncGetProtoByNumber',  \
    WSAAsyncGetServByName, <.hWnd, .wMsg, .name, .proto, .buf, .buflen>,  'WSAAsyncGetServByName',  \
    WSAAsyncGetServByPort, <.hWnd, .wMsg, .port, .proto, .buf, .buflen>,  'WSAAsyncGetServByPort',  \
    WSAAsyncSelect, <.s, .hWnd, .wMsg, .lEvent>,  'WSAAsyncSelect',  \
    WSACancelAsyncRequest, <.hAsyncTaskHandle>,  'WSACancelAsyncRequest',  \
    WSACancelBlockingCall, <VOID>,  'WSACancelBlockingCall',  \
    WSACleanup, <VOID>,  'WSACleanup',  \
    WSAGetLastError, <VOID>,  'WSAGetLastError',  \
    WSAIsBlocking, <VOID>,  'WSAIsBlocking',  \
    WSARecvEx, <.s, .buf, .lLen, .flags>,  'WSARecvEx',  \
    WSASetBlockingHook, <.lpBlockFunc>,  'WSASetBlockingHook',  \
    WSASetLastError, <.iError>,  'WSASetLastError',  \
    WSAStartup, <.wVersionRequired, .lpWSAData>,  'WSAStartup',  \
    WSAUnhookBlockingHook, <VOID>,  'WSAUnhookBlockingHook',  \
    WSApSetPostRoutine, <NONE>,  'WSApSetPostRoutine',  \
    __WSAFDIsSet, <NONE>,  '__WSAFDIsSet',  \
    accept, <.s, .addr, .addrlen>,  'accept',  \
    bind, <.s, .addr, .namelen>,  'bind',  \
    closesocket, <.s>,  'closesocket',  \
    connect, <.s, .name, .namelen>,  'connect',  \
    dn_expand, <NONE>,  'dn_expand',  \
    gethostbyaddr, <.addr, .len, .type>,  'gethostbyaddr',  \
    gethostbyname, <.name>,  'gethostbyname',  \
    gethostname, <.name, .namelen>,  'gethostname',  \
    getnetbyname, <NONE>,  'getnetbyname',  \
    getpeername, <.s, .name, .namelen>,  'getpeername',  \
    getprotobyname, <.name>,  'getprotobyname',  \
    getprotobynumber, <.number>,  'getprotobynumber',  \
    getservbyname, <.name, .proto>,  'getservbyname',  \
    getservbyport, <.port, .proto>,  'getservbyport',  \
    getsockname, <.s, .name, .namelen>,  'getsockname',  \
    getsockopt, <.s, .level, .optname, .optval, .optlen>,  'getsockopt',  \
    htonl, <.hostlong>,  'htonl',  \
    htons, <.hostshort>,  'htons',  \
    inet_addr, <.cp>,  'inet_addr',  \
    inet_network, <NONE>,  'inet_network',  \
    inet_ntoa, <.lIn>,  'inet_ntoa',  \
    ioctlsocket, <.s, .cmd, .argp>,  'ioctlsocket',  \
    listen, <.s, .backlog>,  'listen',  \
    ntohl, <.netlong>,  'ntohl',  \
    ntohs, <.netshort>,  'ntohs',  \
    rcmd, <NONE>,  'rcmd',  \
    recv, <.s, .buf, .lLen, .flags>,  'recv',  \
    recvfrom, <.s, .buf, .lLen, .flags, .from, .fromlen>,  'recvfrom',  \
    rexec, <NONE>,  'rexec',  \
    rresvport, <NONE>,  'rresvport',  \
    s_perror, <NONE>,  's_perror',  \
    select, <NONE>,  'select',  \
    send, <.s, .buf, .lLen, .flags>,  'send',  \
    sendto, <.s, .buf, .lLen, .flags, .to, .tolen>,  'sendto',  \
    sethostname, <NONE>,  'sethostname',  \
    setsockopt, <.s, .level, .optname, .optval, .optlen>,  'setsockopt',  \
    shutdown, <.s, .how>,  'shutdown',  \
    socket, <.af, .lType, .protocol>,  'socket'


import_proto ws2_32,  \
    freeaddrinfo, <.pAddrInfo>,                                    'freeaddrinfo',           \
    FreeAddrInfoW, <.pAddrInfo>,                                   'FreeAddrInfoW',          \
    getaddrinfo, <.pNodeName, .pServiceName, .pHints, .ppResult>, 'getaddrinfo',             \
    GetAddrInfoW, <.pNodeName, .pServiceName, .pHints, .ppResult>, 'GetAddrInfoW'
