1 #ifndef HEADER_CARES_IPHLPAPI_H 2 #define HEADER_CARES_IPHLPAPI_H 3 4 /* Copyright 1998 by the Massachusetts Institute of Technology. 5 * Copyright (C) 2004 - 2011 by Daniel Stenberg et al 6 * 7 * Permission to use, copy, modify, and distribute this 8 * software and its documentation for any purpose and without 9 * fee is hereby granted, provided that the above copyright 10 * notice appear in all copies and that both that copyright 11 * notice and this permission notice appear in supporting 12 * documentation, and that the name of M.I.T. not be used in 13 * advertising or publicity pertaining to distribution of the 14 * software without specific, written prior permission. 15 * M.I.T. makes no representations about the suitability of 16 * this software for any purpose. It is provided "as is" 17 * without express or implied warranty. 18 */ 19 20 #if defined(USE_WINSOCK) 21 22 #ifndef INET_ADDRSTRLEN 23 #define INET_ADDRSTRLEN 22 24 #endif 25 26 #ifndef INET6_ADDRSTRLEN 27 #define INET6_ADDRSTRLEN 65 28 #endif 29 30 /* ---------------------------------- */ 31 #if !defined(_WS2DEF_) && \ 32 !defined(__CSADDR_DEFINED__) && \ 33 !defined(__CSADDR_T_DEFINED) 34 /* ---------------------------------- */ 35 36 typedef struct _SOCKET_ADDRESS { 37 LPSOCKADDR lpSockaddr; 38 INT iSockaddrLength; 39 } SOCKET_ADDRESS, *PSOCKET_ADDRESS; 40 41 typedef struct _CSADDR_INFO { 42 SOCKET_ADDRESS LocalAddr; 43 SOCKET_ADDRESS RemoteAddr; 44 INT iSocketType; 45 INT iProtocol; 46 } CSADDR_INFO, *PCSADDR_INFO; 47 48 /* --------------------------------- */ 49 #endif /* ! _WS2DEF_ && \ */ 50 /* ! __CSADDR_DEFINED__ && \ */ 51 /* ! __CSADDR_T_DEFINED */ 52 /* --------------------------------- */ 53 54 /* ------------------------------- */ 55 #if !defined(IP_ADAPTER_DDNS_ENABLED) 56 /* ------------------------------- */ 57 58 #define IP_ADAPTER_ADDRESS_DNS_ELIGIBLE 0x0001 59 #define IP_ADAPTER_ADDRESS_TRANSIENT 0x0002 60 61 #define IP_ADAPTER_DDNS_ENABLED 0x0001 62 #define IP_ADAPTER_REGISTER_ADAPTER_SUFFIX 0x0002 63 #define IP_ADAPTER_DHCP_ENABLED 0x0004 64 #define IP_ADAPTER_RECEIVE_ONLY 0x0008 65 #define IP_ADAPTER_NO_MULTICAST 0x0010 66 #define IP_ADAPTER_IPV6_OTHER_STATEFUL_CONFIG 0x0020 67 68 #define GAA_FLAG_SKIP_UNICAST 0x0001 69 #define GAA_FLAG_SKIP_ANYCAST 0x0002 70 #define GAA_FLAG_SKIP_MULTICAST 0x0004 71 #define GAA_FLAG_SKIP_DNS_SERVER 0x0008 72 #define GAA_FLAG_INCLUDE_PREFIX 0x0010 73 #define GAA_FLAG_SKIP_FRIENDLY_NAME 0x0020 74 75 typedef enum { 76 IpPrefixOriginOther = 0, 77 IpPrefixOriginManual, 78 IpPrefixOriginWellKnown, 79 IpPrefixOriginDhcp, 80 IpPrefixOriginRouterAdvertisement 81 } IP_PREFIX_ORIGIN; 82 83 typedef enum { 84 IpSuffixOriginOther = 0, 85 IpSuffixOriginManual, 86 IpSuffixOriginWellKnown, 87 IpSuffixOriginDhcp, 88 IpSuffixOriginLinkLayerAddress, 89 IpSuffixOriginRandom 90 } IP_SUFFIX_ORIGIN; 91 92 typedef enum { 93 IpDadStateInvalid = 0, 94 IpDadStateTentative, 95 IpDadStateDuplicate, 96 IpDadStateDeprecated, 97 IpDadStatePreferred 98 } IP_DAD_STATE; 99 100 typedef enum { 101 IfOperStatusUp = 1, 102 IfOperStatusDown, 103 IfOperStatusTesting, 104 IfOperStatusUnknown, 105 IfOperStatusDormant, 106 IfOperStatusNotPresent, 107 IfOperStatusLowerLayerDown 108 } IF_OPER_STATUS; 109 110 typedef enum { 111 ScopeLevelInterface = 0x0001, 112 ScopeLevelLink = 0x0002, 113 ScopeLevelSubnet = 0x0003, 114 ScopeLevelAdmin = 0x0004, 115 ScopeLevelSite = 0x0005, 116 ScopeLevelOrganization = 0x0008, 117 ScopeLevelGlobal = 0x000E 118 } SCOPE_LEVEL; 119 120 typedef struct _IP_ADAPTER_UNICAST_ADDRESS { 121 union { 122 ULONGLONG Alignment; 123 struct { 124 ULONG Length; 125 DWORD Flags; 126 } s; 127 } u; 128 struct _IP_ADAPTER_UNICAST_ADDRESS *Next; 129 SOCKET_ADDRESS Address; 130 IP_PREFIX_ORIGIN PrefixOrigin; 131 IP_SUFFIX_ORIGIN SuffixOrigin; 132 IP_DAD_STATE DadState; 133 ULONG ValidLifetime; 134 ULONG PreferredLifetime; 135 ULONG LeaseLifetime; 136 } IP_ADAPTER_UNICAST_ADDRESS, *PIP_ADAPTER_UNICAST_ADDRESS; 137 138 typedef struct _IP_ADAPTER_ANYCAST_ADDRESS { 139 union { 140 ULONGLONG Alignment; 141 struct { 142 ULONG Length; 143 DWORD Flags; 144 } s; 145 } u; 146 struct _IP_ADAPTER_ANYCAST_ADDRESS *Next; 147 SOCKET_ADDRESS Address; 148 } IP_ADAPTER_ANYCAST_ADDRESS, *PIP_ADAPTER_ANYCAST_ADDRESS; 149 150 typedef struct _IP_ADAPTER_MULTICAST_ADDRESS { 151 union { 152 ULONGLONG Alignment; 153 struct { 154 ULONG Length; 155 DWORD Flags; 156 } s; 157 } u; 158 struct _IP_ADAPTER_MULTICAST_ADDRESS *Next; 159 SOCKET_ADDRESS Address; 160 } IP_ADAPTER_MULTICAST_ADDRESS, *PIP_ADAPTER_MULTICAST_ADDRESS; 161 162 typedef struct _IP_ADAPTER_DNS_SERVER_ADDRESS { 163 union { 164 ULONGLONG Alignment; 165 struct { 166 ULONG Length; 167 DWORD Reserved; 168 } s; 169 } u; 170 struct _IP_ADAPTER_DNS_SERVER_ADDRESS *Next; 171 SOCKET_ADDRESS Address; 172 } IP_ADAPTER_DNS_SERVER_ADDRESS, *PIP_ADAPTER_DNS_SERVER_ADDRESS; 173 174 typedef struct _IP_ADAPTER_PREFIX { 175 union { 176 ULONGLONG Alignment; 177 struct { 178 ULONG Length; 179 DWORD Flags; 180 } s; 181 } u; 182 struct _IP_ADAPTER_PREFIX *Next; 183 SOCKET_ADDRESS Address; 184 ULONG PrefixLength; 185 } IP_ADAPTER_PREFIX, *PIP_ADAPTER_PREFIX; 186 187 typedef struct _IP_ADAPTER_ADDRESSES { 188 union { 189 ULONGLONG Alignment; 190 struct { 191 ULONG Length; 192 DWORD IfIndex; 193 } s; 194 } u; 195 struct _IP_ADAPTER_ADDRESSES *Next; 196 PCHAR AdapterName; 197 PIP_ADAPTER_UNICAST_ADDRESS FirstUnicastAddress; 198 PIP_ADAPTER_ANYCAST_ADDRESS FirstAnycastAddress; 199 PIP_ADAPTER_MULTICAST_ADDRESS FirstMulticastAddress; 200 PIP_ADAPTER_DNS_SERVER_ADDRESS FirstDnsServerAddress; 201 PWCHAR DnsSuffix; 202 PWCHAR Description; 203 PWCHAR FriendlyName; 204 BYTE PhysicalAddress[MAX_ADAPTER_ADDRESS_LENGTH]; 205 DWORD PhysicalAddressLength; 206 DWORD Flags; 207 DWORD Mtu; 208 DWORD IfType; 209 IF_OPER_STATUS OperStatus; 210 DWORD Ipv6IfIndex; 211 DWORD ZoneIndices[16]; 212 PIP_ADAPTER_PREFIX FirstPrefix; 213 } IP_ADAPTER_ADDRESSES, *PIP_ADAPTER_ADDRESSES; 214 215 /* -------------------------------- */ 216 #endif /* ! IP_ADAPTER_DDNS_ENABLED */ 217 /* -------------------------------- */ 218 219 #endif /* USE_WINSOCK */ 220 221 #endif /* HEADER_CARES_IPHLPAPI_H */ 222