1 /* 2 * COPYRIGHT: See COPYING in the top level directory 3 * PROJECT: ReactOS Ancillary Function Driver DLL 4 * FILE: include/mswsock.h 5 * PURPOSE: Ancillary Function Driver DLL header 6 */ 7 8 #pragma once 9 10 /* INCLUDES ******************************************************************/ 11 #include <ws2atm.h> 12 13 /* ENUMERATIONS **************************************************************/ 14 15 typedef enum _DNS_STRING_TYPE 16 { 17 UnicodeString = 1, 18 Utf8String, 19 AnsiString, 20 } DNS_STRING_TYPE; 21 22 #define IpV4Address 3 23 24 /* TYPES *********************************************************************/ 25 26 typedef struct _DNS_IPV6_ADDRESS 27 { 28 ULONG Unknown; 29 ULONG Unknown2; 30 IP6_ADDRESS Address; 31 ULONG Unknown3; 32 ULONG Unknown4; 33 DWORD Reserved; 34 ULONG Unknown5; 35 } DNS_IPV6_ADDRESS, *PDNS_IPV6_ADDRESS; 36 37 typedef struct _DNS_ADDRESS 38 { 39 union 40 { 41 struct 42 { 43 WORD AddressFamily; 44 WORD Port; 45 ATM_ADDRESS AtmAddress; 46 }; 47 SOCKADDR_IN Ip4Address; 48 SOCKADDR_IN6 Ip6Address; 49 }; 50 ULONG AddressLength; 51 DWORD Sub; 52 ULONG Flag; 53 } DNS_ADDRESS, *PDNS_ADDRESS; 54 55 typedef struct _DNS_ARRAY 56 { 57 ULONG AllocatedAddresses; 58 ULONG UsedAddresses; 59 ULONG Unknown[0x6]; 60 DNS_ADDRESS Addresses[1]; 61 } DNS_ARRAY, *PDNS_ARRAY; 62 63 typedef struct _DNS_BLOB 64 { 65 LPWSTR Name; 66 PDNS_ARRAY DnsAddrArray; 67 PHOSTENT Hostent; 68 ULONG AliasCount; 69 ULONG Unknown; 70 LPWSTR Aliases[8]; 71 } DNS_BLOB, *PDNS_BLOB; 72 73 typedef struct _DNS_FAMILY_INFO 74 { 75 WORD AddrType; 76 WORD DnsType; 77 DWORD AddressSize; 78 DWORD SockaddrSize; 79 DWORD AddressOffset; 80 } DNS_FAMILY_INFO, *PDNS_FAMILY_INFO; 81 82 typedef struct _FLATBUFF 83 { 84 PVOID Buffer; 85 PVOID BufferEnd; 86 ULONG_PTR BufferPos; 87 SIZE_T BufferSize; 88 SIZE_T BufferFreeSize; 89 } FLATBUFF, *PFLATBUFF; 90 91 /* 92 * memory.c 93 */ 94 VOID 95 WINAPI 96 Dns_Free(IN PVOID Address); 97 98 PVOID 99 WINAPI 100 Dns_AllocZero(IN SIZE_T Size); 101 102 /* 103 * addr.c 104 */ 105 PDNS_FAMILY_INFO 106 WINAPI 107 FamilyInfo_GetForFamily(IN WORD AddressFamily); 108 109 /* 110 * dnsaddr.c 111 */ 112 VOID 113 WINAPI 114 DnsAddr_BuildFromIp4( 115 IN PDNS_ADDRESS DnsAddress, 116 IN IN_ADDR Address, 117 IN WORD Unknown 118 ); 119 120 VOID 121 WINAPI 122 DnsAddr_BuildFromIp6( 123 IN PDNS_ADDRESS DnsAddress, 124 IN PIN6_ADDR Address, 125 IN ULONG ScopeId, 126 IN WORD Port 127 ); 128 129 PDNS_ARRAY 130 WINAPI 131 DnsAddrArray_Create(ULONG Count); 132 133 BOOL 134 WINAPI 135 DnsAddrArray_AddAddr( 136 IN PDNS_ARRAY DnsAddrArray, 137 IN PDNS_ADDRESS DnsAddress, 138 IN WORD AddressFamily OPTIONAL, 139 IN DWORD AddressType OPTIONAL 140 ); 141 142 VOID 143 WINAPI 144 DnsAddrArray_Free(IN PDNS_ARRAY DnsAddrArray); 145 146 BOOL 147 WINAPI 148 DnsAddrArray_AddIp4( 149 IN PDNS_ARRAY DnsAddrArray, 150 IN IN_ADDR Address, 151 IN DWORD AddressType 152 ); 153 154 BOOL 155 WINAPI 156 DnsAddrArray_ContainsAddr( 157 IN PDNS_ARRAY DnsAddrArray, 158 IN PDNS_ADDRESS DnsAddress, 159 IN DWORD AddressType 160 ); 161 162 BOOLEAN 163 WINAPI 164 DnsAddr_BuildFromDnsRecord( 165 IN PDNS_RECORD DnsRecord, 166 OUT PDNS_ADDRESS DnsAddr 167 ); 168 169 /* 170 * hostent.c 171 */ 172 PHOSTENT 173 WINAPI 174 Hostent_Init( 175 IN PVOID *Buffer, 176 IN WORD AddressFamily, 177 IN ULONG AddressSize, 178 IN ULONG AddressCount, 179 IN ULONG AliasCount 180 ); 181 182 VOID 183 WINAPI 184 Hostent_ConvertToOffsets(IN PHOSTENT Hostent); 185 186 /* 187 * flatbuf.c 188 */ 189 VOID 190 WINAPI 191 FlatBuf_Init( 192 IN PFLATBUFF FlatBuffer, 193 IN PVOID Buffer, 194 IN SIZE_T Size 195 ); 196 197 PVOID 198 WINAPI 199 FlatBuf_Arg_CopyMemory( 200 IN OUT PULONG_PTR Position, 201 IN OUT PSIZE_T FreeSize, 202 IN PVOID Buffer, 203 IN SIZE_T Size, 204 IN ULONG Align 205 ); 206 207 PVOID 208 WINAPI 209 FlatBuf_Arg_Reserve( 210 IN OUT PULONG_PTR Position, 211 IN OUT PSIZE_T FreeSize, 212 IN SIZE_T Size, 213 IN ULONG Align 214 ); 215 216 PVOID 217 WINAPI 218 FlatBuf_Arg_WriteString( 219 IN OUT PULONG_PTR Position, 220 IN OUT PSIZE_T FreeSize, 221 IN PVOID String, 222 IN BOOLEAN IsUnicode 223 ); 224 225 /* 226 * sablob.c 227 */ 228 PDNS_BLOB 229 WINAPI 230 SaBlob_Create( 231 IN ULONG Count 232 ); 233 234 PDNS_BLOB 235 WINAPI 236 SaBlob_CreateFromIp4( 237 IN LPWSTR Name, 238 IN ULONG Count, 239 IN PIN_ADDR AddressArray 240 ); 241 242 VOID 243 WINAPI 244 SaBlob_Free(IN PDNS_BLOB Blob); 245 246 PHOSTENT 247 WINAPI 248 SaBlob_CreateHostent( 249 IN OUT PULONG_PTR BufferPosition, 250 IN OUT PSIZE_T RemainingBufferSpace, 251 IN OUT PSIZE_T HostEntrySize, 252 IN PDNS_BLOB Blob, 253 IN DWORD StringType, 254 IN BOOLEAN Relative, 255 IN BOOLEAN BufferAllocated 256 ); 257 258 INT 259 WINAPI 260 SaBlob_WriteNameOrAlias( 261 IN PDNS_BLOB Blob, 262 IN LPWSTR String, 263 IN BOOLEAN IsAlias 264 ); 265 266 PDNS_BLOB 267 WINAPI 268 SaBlob_Query( 269 IN LPWSTR Name, 270 IN WORD DnsType, 271 IN ULONG Flags, 272 IN PVOID *Reserved, 273 IN DWORD AddressFamily 274 ); 275 276 /* 277 * string.c 278 */ 279 ULONG 280 WINAPI 281 Dns_StringCopy( 282 OUT PVOID Destination, 283 IN OUT PULONG DestinationSize, 284 IN PVOID String, 285 IN ULONG StringSize OPTIONAL, 286 IN DWORD InputType, 287 IN DWORD OutputType 288 ); 289 290 LPWSTR 291 WINAPI 292 Dns_CreateStringCopy_W(IN LPWSTR Name); 293 294 ULONG 295 WINAPI 296 Dns_GetBufferLengthForStringCopy( 297 IN PVOID String, 298 IN ULONG Size OPTIONAL, 299 IN DWORD InputType, 300 IN DWORD OutputType 301 ); 302 303 /* 304 * straddr.c 305 */ 306 BOOLEAN 307 WINAPI 308 Dns_StringToAddressW( 309 OUT PVOID Address, 310 IN OUT PULONG AddressSize, 311 IN LPWSTR AddressName, 312 IN OUT PDWORD AddressFamily 313 ); 314 315 LPWSTR 316 WINAPI 317 Dns_Ip4AddressToReverseName_W( 318 OUT LPWSTR Name, 319 IN IN_ADDR Address 320 ); 321 322 LPWSTR 323 WINAPI 324 Dns_Ip6AddressToReverseName_W( 325 OUT LPWSTR Name, 326 IN IN6_ADDR Address 327 ); 328 329 BOOLEAN 330 WINAPI 331 Dns_ReverseNameToDnsAddr_W( 332 OUT PDNS_ADDRESS DnsAddr, 333 IN LPWSTR Name 334 ); 335 336 BOOLEAN 337 WINAPI 338 Dns_Ip4ReverseNameToAddress_W( 339 OUT PIN_ADDR Address, 340 IN LPWSTR Name 341 ); 342