source: branch/egtra-stream-without-en_dec/api_ws2tcpip.sbp@ 682

Last change on this file since 682 was 596, checked in by OverTaker, 16 years ago

適当かつ最低限に宣言

File size: 3.9 KB
Line 
1/*
2#ifdef UNICODE
3Const _FuncName_getaddrinfo = "GetAddrInfoW"
4Const _FuncName_freeaddrinfo = "FreeAddrInfoW"
5Const _FuncName_getnameinfo = "GetNameInfoW"
6Const _FuncName_inet_pton = "InetPtonW"
7Const _FuncName_inet_ntop = "InetNtopW"
8#else
9Const _FuncName_getaddrinfo = "GetAddrInfoA"
10Const _FuncName_freeaddrinfo = "FreeAddrInfoA"
11Const _FuncName_getnameinfo = "GetNameInfoA"
12Const _FuncName_inet_pton = "InetPton"
13Const _FuncName_inet_ntop = "InetNtop"
14#endif
15*/
16
17Const _FuncName_getaddrinfo = "getaddrinfo"
18Const _FuncName_freeaddrinfo = "freeaddrinfo"
19Const _FuncName_getnameinfo = "getnameinfo"
20
21Const INET_ADDRSTRLEN = 22
22Const INET6_ADDRSTRLEN = 65
23
24Const EAI_AGAIN = WSATRY_AGAIN
25Const EAI_BADFLAGS = WSAEINVAL
26Const EAI_FAIL = WSANO_RECOVERY
27Const EAI_FAMILY = WSAEAFNOSUPPORT
28Const EAI_MEMORY = WSA_NOT_ENOUGH_MEMORY
29'Const EAI_NODATA = WSANO_DATA
30Const EAI_NONAME = WSAHOST_NOT_FOUND
31Const EAI_SERVICE = WSATYPE_NOT_FOUND
32Const EAI_SOCKTYPE = WSAESOCKTNOSUPPORT
33
34Const EAI_NODATA = EAI_NONAME
35
36Type addrinfo
37 ai_flags As Long
38 ai_family As Long
39 ai_socktype As Long
40 ai_protocol As Long
41 ai_addrlen As DWord
42 ai_canonname As PTSTR
43 ai_addr As *sockaddr
44 ai_next As *addrinfo
45End Type
46
47Const AI_PASSIVE = &H00000001 ' Socket address will be used in bind() call
48Const AI_CANONNAME = &H00000002 ' Return canonical name in first ai_canonname
49Const AI_NUMERICHOST = &H00000004 ' Nodename must be a numeric address string
50Const AI_NUMERICSERV = &H00000008 ' Servicename must be a numeric port number
51
52Const AI_ALL = &H00000100 ' Query both IP6 and IP4 with AI_V4MAPPED
53Const AI_ADDRCONFIG = &H00000400 ' Resolution only if global address configured
54Const AI_V4MAPPED = &H00000800 ' On v6 failure, query v4 and convert to V4MAPPED format
55
56
57Const AI_NON_AUTHORITATIVE = &H4000 ' LUP_NON_AUTHORITATIVE
58Const AI_SECURE = &H8000 'LUP_SECURE
59Const AI_RETURN_PREFERRED_NAMES = &H10000 ' LUP_RETURN_PREFERRED_NAMES
60
61TypeDef socklen_t = Long
62
63Declare Function getaddrinfo Lib "Ws2_32" Alias _FuncName_getaddrinfo (pNodeName As LPCTSTR, pServiceName As LPCTSTR, ByRef pHints As addrinfo, ByRef ppResult As *addrinfo) As Long
64Declare Sub freeaddrinfo Lib "Ws2_32" Alias _FuncName_freeaddrinfo (ByRef ai As addrinfo)
65Declare Function getnameinfo Lib "Ws2_32" Alias _FuncName_getnameinfo (ByRef sa As sockaddr, salen As socklen_t, host As LPTSTR, hostlen As SIZE_T, serv As LPTSTR, servlen As SIZE_T, flags As Long) As Long
66
67/*
68Declare Function inet_pton Lib "Ws2_32" Alias _FuncName_inet_pton (family As Long, pszAddrString As LPCTSTR, pAddrBuf As VoidPtr) As Long
69Declare Function inet_ntop Lib "Ws2_32" Alias _FuncName_inet_ntop (family As Long, pAddr As VoidPtr, pStringBuf As LPTSTR, StringBufSize As SIZE_T) As LPCTSTR
70*/
71
72Const GAI_STRERROR_BUFFER_SIZE = 1024
73Function gai_strerror( ecode As Long) As LPCTSTR
74 Dim dwMsgLen As DWord
75 Dim buff[GAI_STRERROR_BUFFER_SIZE] As SByte
76 dwMsgLen = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM or FORMAT_MESSAGE_IGNORE_INSERTS,
77 NULL,
78 ecode,
79 LANG_USER_DEFAULT,
80 buff,
81 GAI_STRERROR_BUFFER_SIZE,
82 NULL)
83 Return buff
84End Function
85
86Const NI_MAXHOST = 1025 /* Max size of a fully-qualified domain name */
87Const NI_MAXSERV = 32 /* Max size of a service name */
88
89/* Flags for getnameinfo() */
90
91Const NI_NOFQDN = &H01 /* Only return nodename portion for local hosts */
92Const NI_NUMERICHOST = &H02 /* Return numeric form of the host's address */
93Const NI_NAMEREQD = &H04 /* Error if the host's name not in DNS */
94Const NI_NUMERICSERV = &H08 /* Return numeric form of the service (port #) */
95Const NI_DGRAM = &H10 /* Service is a datagram service */
Note: See TracBrowser for help on using the repository browser.