1 /**************************************************************************/ 2 /* */ 3 /* Copyright (c) Microsoft Corporation. All rights reserved. */ 4 /* */ 5 /* This software is licensed under the Microsoft Software License */ 6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */ 7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ 8 /* and in the root directory of this software. */ 9 /* */ 10 /**************************************************************************/ 11 12 13 /**************************************************************************/ 14 /**************************************************************************/ 15 /** */ 16 /** NetX Component */ 17 /** */ 18 /** Domain Name System (DNS) */ 19 /** */ 20 /**************************************************************************/ 21 /**************************************************************************/ 22 23 24 /**************************************************************************/ 25 /* */ 26 /* APPLICATION INTERFACE DEFINITION RELEASE */ 27 /* */ 28 /* nxd_dns.h PORTABLE C */ 29 /* 6.1.5 */ 30 /* AUTHOR */ 31 /* */ 32 /* Yuxin Zhou, Microsoft Corporation */ 33 /* */ 34 /* DESCRIPTION */ 35 /* */ 36 /* This file defines the NetX Domain Name System Protocol (DNS) */ 37 /* component, including all data types and external references. */ 38 /* It is assumed that nx_api.h and nx_port.h have already been */ 39 /* included. */ 40 /* */ 41 /* RELEASE HISTORY */ 42 /* */ 43 /* DATE NAME DESCRIPTION */ 44 /* */ 45 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ 46 /* 09-30-2020 Yuxin Zhou Modified comment(s), */ 47 /* resulting in version 6.1 */ 48 /* 12-31-2020 Yuxin Zhou Modified comment(s), prevented*/ 49 /* infinite loop in name */ 50 /* compression, resulting in */ 51 /* version 6.1.3 */ 52 /* 03-02-2021 Yuxin Zhou Modified comment(s), and */ 53 /* improved the logic of */ 54 /* receiving dns response, */ 55 /* resulting in version 6.1.5 */ 56 /* */ 57 /**************************************************************************/ 58 59 #ifndef NXD_DNS_H 60 #define NXD_DNS_H 61 62 /* Determine if a C++ compiler is being used. If so, ensure that standard 63 C is used to process the API information. */ 64 65 #ifdef __cplusplus 66 67 /* Yes, C++ compiler is present. Use standard C. */ 68 extern "C" { 69 70 #endif 71 72 #include "nx_udp.h" 73 #include "nx_ipv4.h" 74 #include "nx_ipv6.h" 75 76 /* Define the DNS ID. */ 77 78 #define NX_DNS_ID 0x444e5320UL 79 80 /* Define message and name limits. */ 81 82 #define NX_DNS_LABEL_MAX 63 /* Maximum Label (between to dots) size */ 83 #define NX_DNS_NAME_MAX 255 /* Maximum Name size */ 84 #define NX_DNS_IP_LOOKUP_SIZE 75 /* IPv6 needs 66 characters for the address plus 8 for the ip6.arpa plus null */ 85 /* IPv4 needs 12 characters max for the address plus 12 for the IN-ADDR.ARPA plus null */ 86 87 88 /* Define offsets into the DNS message buffer. */ 89 90 #define NX_DNS_ID_OFFSET 0 /* Offset to ID code in DNS buffer */ 91 #define NX_DNS_FLAGS_OFFSET 2 /* Offset to flags in DNS buffer */ 92 #define NX_DNS_QDCOUNT_OFFSET 4 /* Offset to Question Count in DNS buffer */ 93 #define NX_DNS_ANCOUNT_OFFSET 6 /* Offset to Answer Count in DNS buffer */ 94 #define NX_DNS_NSCOUNT_OFFSET 8 /* Offset to Authority Count in DNS buffer */ 95 #define NX_DNS_ARCOUNT_OFFSET 10 /* Offset to Additional Info. Count in DNS buffer */ 96 #define NX_DNS_QDSECT_OFFSET 12 /* Offset to Question Section in DNS buffer */ 97 98 99 /* Define return code constants. */ 100 101 #define NX_DNS_SUCCESS 0x00 /* DNS success */ 102 #define NX_DNS_ERROR 0xA0 /* DNS internal error */ 103 #define NX_DNS_NO_SERVER 0xA1 /* No DNS server was specified */ 104 #define NX_DNS_TIMEOUT 0xA2 /* DNS timeout occurred */ 105 #define NX_DNS_QUERY_FAILED 0xA3 /* DNS query failed; no DNS server sent an 'answer' */ 106 #define NX_DNS_BAD_ADDRESS_ERROR 0xA4 /* Improperly formatted IPv4 or IPv6 address */ 107 #define NX_DNS_SIZE_ERROR 0xA5 /* DNS destination size is too small */ 108 #define NX_DNS_MALFORMED_PACKET 0xA6 /* Improperly formed or corrupted DNS packet received */ 109 #define NX_DNS_BAD_ID_ERROR 0xA7 /* DNS packet from server does not match query ID */ 110 #define NX_DNS_PARAM_ERROR 0xA8 /* Invalid non pointer input to API */ 111 #define NX_DNS_SERVER_NOT_FOUND 0xA9 /* Server not found in Client list of DNS servers */ 112 #define NX_DNS_PACKET_CREATE_ERROR 0xAA /* Error creating DNS packet */ 113 #define NX_DNS_EMPTY_DNS_SERVER_LIST 0xAB /* DNS Client's list of DNS servers is empty */ 114 #define NX_DNS_SERVER_AUTH_ERROR 0xAC /* Server not able to authenticate answer/authority data*/ 115 #define NX_DNS_ZERO_GATEWAY_IP_ADDRESS 0xAD /* DNS Client IP instance has a zero gateway IP address */ 116 #define NX_DNS_MISMATCHED_RESPONSE 0xAE /* Server response type does not match the query request*/ 117 #define NX_DNS_DUPLICATE_ENTRY 0xAF /* Duplicate entry exists in DNS server table */ 118 #define NX_DNS_RETRY_A_QUERY 0xB0 /* SOA status returned; web site only exists as IPv4 */ 119 #define NX_DNS_IPV6_DISABLED_ERROR 0xB1 /* Cannot process AAAA or PTR record with IPv6 disabled */ 120 #define NX_DNS_INVALID_ADDRESS_TYPE 0xB2 /* IP address type (e.g. IPv6) not supported */ 121 #define NX_DNS_IPV6_NOT_SUPPORTED 0xB3 /* Cannot process AAAA or PTR record with IPv6 disabled */ 122 #define NX_DNS_NEED_MORE_RECORD_BUFFER 0xB4 /* The buffer size is not enough. */ 123 #define NX_DNS_FEATURE_NOT_SUPPORTED 0xB5 /* The requested feature is not supported in this build */ 124 #define NX_DNS_NAME_MISMATCH 0xB6 /* The name mismatch. */ 125 #define NX_DNS_CACHE_ERROR 0xB7 /* The Cache size is not enough. */ 126 127 128 /* Define constants for the flags word. */ 129 130 #define NX_DNS_QUERY_MASK 0x8000 131 #define NX_DNS_RESPONSE_FLAG 0x8000 132 #define NX_DNS_ERROR_MASK 0x8002 /* Server response indicates an error or data not authenticated by server */ 133 134 135 #define NX_DNS_OPCODE_QUERY (0 << 12) /* Shifted right 12 is still 0 */ 136 #define NX_DNS_OPCODE_IQUERY (1 << 12) /* 1 shifted right by 12 */ 137 #define NX_DNS_OPCODE_STATUS (2 << 12) /* 2 shifted right by 12 */ 138 139 #define NX_DNS_AA_FLAG 0x0400 /* Authoritative Answer */ 140 #define NX_DNS_TC_FLAG 0x0200 /* Truncated */ 141 #define NX_DNS_RD_FLAG 0x0100 /* Recursive Query */ 142 #define NX_DNS_RA_FLAG 0x0080 /* Recursion Available */ 143 #define NX_DNS_FA_FLAG 0x0010 /* Force Authentication */ 144 145 #define NX_DNS_RCODE_MASK 0x000f /* Isolate the Result Code */ 146 #define NX_DNS_RCODE_SUCCESS 0 147 #define NX_DNS_RCODE_FORMAT_ERR 1 148 #define NX_DNS_RCODE_SERVER_ERR 2 149 #define NX_DNS_RCODE_NAME_ERR 3 150 #define NX_DNS_RCODE_NOT_IMPL 4 151 #define NX_DNS_RCODE_REFUSED 5 152 153 #define NX_DNS_QUERY_FLAGS (NX_DNS_OPCODE_QUERY | NX_DNS_RD_FLAG) /* | NX_DNS_FA_FLAG */ 154 155 /* Define name compression masks. */ 156 157 #define NX_DNS_COMPRESS_MASK 0xc0 158 #define NX_DNS_COMPRESS_VALUE 0xc0 159 #define NX_DNS_POINTER_MASK 0xc000 160 161 /* Define resource record types. */ 162 163 #define NX_DNS_RR_TYPE_A 1 /* Host address */ 164 #define NX_DNS_RR_TYPE_NS 2 /* Authoritative name server */ 165 #define NX_DNS_RR_TYPE_MD 3 /* Mail destination (Obsolete - use MX) */ 166 #define NX_DNS_RR_TYPE_MF 4 /* Mail forwarder (Obsolete - use MX) */ 167 #define NX_DNS_RR_TYPE_CNAME 5 /* Canonical name for an alias */ 168 #define NX_DNS_RR_TYPE_SOA 6 /* Marks the start of a zone of authority */ 169 #define NX_DNS_RR_TYPE_MB 7 /* Mailbox domain name (EXPERIMENTAL) */ 170 #define NX_DNS_RR_TYPE_MG 8 /* Mail group member (EXPERIMENTAL) */ 171 #define NX_DNS_RR_TYPE_MR 9 /* Mail rename domain name (EXPERIMENTAL) */ 172 #define NX_DNS_RR_TYPE_NULL 10 /* Null RR (EXPERIMENTAL) */ 173 #define NX_DNS_RR_TYPE_WKS 11 /* Well known service description */ 174 #define NX_DNS_RR_TYPE_PTR 12 /* Domain name pointer */ 175 #define NX_DNS_RR_TYPE_HINFO 13 /* Host information */ 176 #define NX_DNS_RR_TYPE_MINFO 14 /* Mailbox or mail list information */ 177 #define NX_DNS_RR_TYPE_MX 15 /* Mail exchange */ 178 #define NX_DNS_RR_TYPE_TXT 16 /* Text strings */ 179 #define NX_DNS_RR_TYPE_AAAA 28 /* IPv6 Host address */ 180 #define NX_DNS_RR_TYPE_SRV 33 /* The location of services */ 181 182 183 /* Define constants for Qtypes (queries). */ 184 185 #define NX_DNS_RR_TYPE_AXFR 252 /* Request for a transfer of an entire zone */ 186 #define NX_DNS_RR_TYPE_MAILB 253 /* Request for mailbox-related records (MB, MG or MR) */ 187 #define NX_DNS_RR_TYPE_MAILA 254 /* Request for mail agent RRs (Obsolete - see MX) */ 188 #define NX_DNS_RR_TYPE_ALL 255 /* Request for all records */ 189 190 /* Define resource record classes. */ 191 192 #define NX_DNS_RR_CLASS_IN 1 /* Internet */ 193 #define NX_DNS_RR_CLASS_CS 2 /* CSNET class (Obsolete) */ 194 #define NX_DNS_RR_CLASS_CH 3 /* CHAOS class */ 195 #define NX_DNS_RR_CLASS_HS 4 /* Hesiod [Dyer 87] */ 196 197 198 /* Define constant valid for Qtypes (queries). */ 199 200 #define NX_DNS_RR_CLASS_ALL 255 /* Any class */ 201 202 /* Define the TCP and UDP port number */ 203 204 #define NX_DNS_PORT 53 /* Port for TX,RX and TCP/UDP */ 205 206 207 /* Start of configurable options. */ 208 209 /* Set the IP instance gateway server to be the DNS server if the gateway address is non zero. */ 210 /* 211 #define NX_DNS_IP_GATEWAY_AND_DNS_SERVER 212 */ 213 214 /* Determine if the Client will create its own packet pool 215 or let the host application create one. See nx_dns_packet_pool_set 216 for how to set the DNS packet pool from the host application. */ 217 /* 218 #define NX_DNS_CLIENT_USER_CREATE_PACKET_POOL 219 */ 220 221 /* Enable the feature to clear off old DNS packets before sending a fresh query. */ 222 /* 223 #define NX_DNS_CLIENT_CLEAR_QUEUE 224 */ 225 226 /* Enable the feature to send the TXT, CNAME, NS, MX, SRV, SOA DNS types query. */ 227 /* 228 #define NX_DNS_ENABLE_EXTENDED_RR_TYPES 229 */ 230 231 /* Enable the cache to store the resource record. */ 232 /* 233 #define NX_DNS_CACHE_ENABLE 234 */ 235 236 /* Define UDP socket create options. */ 237 238 #ifndef NX_DNS_TYPE_OF_SERVICE 239 #define NX_DNS_TYPE_OF_SERVICE NX_IP_NORMAL 240 #endif 241 242 #ifndef NX_DNS_FRAGMENT_OPTION 243 #define NX_DNS_FRAGMENT_OPTION NX_DONT_FRAGMENT 244 #endif 245 246 #ifndef NX_DNS_TIME_TO_LIVE 247 #define NX_DNS_TIME_TO_LIVE 0x80 248 #endif 249 250 /* Define the queue depth of the DNS Client socket. */ 251 252 #ifndef NX_DNS_QUEUE_DEPTH 253 #define NX_DNS_QUEUE_DEPTH 5 254 #endif 255 256 /* Define the maximum size of DNS message. 512 is the maximum size defined in RFC 1035 section 2.3.4. */ 257 258 #ifndef NX_DNS_MESSAGE_MAX 259 #define NX_DNS_MESSAGE_MAX 512 260 #endif 261 262 /* Define a payload to include the maximum size DNS message plus the Ethernet, IP and UDP overhead. */ 263 264 #ifndef NX_DNS_PACKET_PAYLOAD_UNALIGNED 265 #define NX_DNS_PACKET_PAYLOAD_UNALIGNED (NX_UDP_PACKET + NX_DNS_MESSAGE_MAX) 266 #endif 267 268 /* Round up to a 4 byte aligned packet payload. */ 269 270 #define NX_DNS_PACKET_PAYLOAD (((NX_DNS_PACKET_PAYLOAD_UNALIGNED + sizeof(ULONG) - 1)/sizeof(ULONG)) * sizeof(ULONG)) 271 272 /* Define the size (e.g. number of packets) of the DNS Client 273 packet pool for sending out DNS messages. */ 274 275 #ifndef NX_DNS_PACKET_POOL_SIZE 276 #define NX_DNS_PACKET_POOL_SIZE (16 * (NX_DNS_PACKET_PAYLOAD + sizeof(NX_PACKET))) 277 #endif 278 279 280 /* Define the maximum number of retries to a DNS server. */ 281 282 #ifndef NX_DNS_MAX_RETRIES 283 #define NX_DNS_MAX_RETRIES 3 284 #endif 285 286 /* Define size of the DNS server list. Remember to allow for one 'null' terminating 287 e.g. zero IP address entry for this list. */ 288 289 #ifndef NX_DNS_MAX_SERVERS 290 #define NX_DNS_MAX_SERVERS 5 291 #endif 292 293 /* Define the maximum amount of time to retransmit a DNS query. The default wait time is 64 seconds. 294 the retransmission policy are recommended in RFC1035 page 32. */ 295 #ifndef NX_DNS_MAX_RETRANS_TIMEOUT 296 #define NX_DNS_MAX_RETRANS_TIMEOUT (64 * NX_IP_PERIODIC_RATE) 297 #endif 298 299 /* Define the timeout option in timer ticks for allocating a packet 300 from the DNS Client packet pool. */ 301 302 #ifndef NX_DNS_PACKET_ALLOCATE_TIMEOUT 303 #define NX_DNS_PACKET_ALLOCATE_TIMEOUT NX_IP_PERIODIC_RATE 304 #endif 305 306 /* Define the maximum number of pointers allowed in name compression. */ 307 #ifndef NX_DNS_MAX_COMPRESSION_POINTERS 308 #define NX_DNS_MAX_COMPRESSION_POINTERS 16 309 #endif 310 311 /* Define the basic DNS data structure. */ 312 313 typedef struct NX_IP_DNS_STRUCT 314 { 315 ULONG nx_dns_id; /* DNS ID */ 316 UCHAR *nx_dns_domain; /* Pointer to domain name */ 317 USHORT nx_dns_lookup_type; /* DNS look up type */ 318 USHORT nx_dns_transmit_id; /* DNS message transmit identifier */ 319 NX_IP *nx_dns_ip_ptr; /* Pointer to associated IP structure */ 320 NXD_ADDRESS nx_dns_server_ip_array[NX_DNS_MAX_SERVERS]; /* List of DNS server IP addresses */ 321 ULONG nx_dns_retries; /* DNS query retries */ 322 #ifndef NX_DNS_CLIENT_USER_CREATE_PACKET_POOL 323 NX_PACKET_POOL nx_dns_pool; /* The pool of UDP data packets for DNS messages */ 324 UCHAR nx_dns_pool_area[NX_DNS_PACKET_POOL_SIZE]; 325 #endif 326 NX_PACKET_POOL *nx_dns_packet_pool_ptr; /* Pointer to DNS Client packet pool */ 327 NX_UDP_SOCKET nx_dns_socket; /* DNS Socket */ 328 TX_MUTEX nx_dns_mutex; /* DNS Mutex to protect DNS instance */ 329 #ifdef NX_DNS_CACHE_ENABLE 330 UCHAR* nx_dns_cache; /* Pointer to the cache. */ 331 UINT nx_dns_cache_size; /* The size of cache. */ 332 ULONG nx_dns_rr_count; /* The number of resource records in the cache. */ 333 ULONG nx_dns_string_count; /* The number of strings in the cache. */ 334 ULONG nx_dns_string_bytes; /* The number of total bytes in string table in the cache. */ 335 VOID (*nx_dns_cache_full_notify)(struct NX_IP_DNS_STRUCT *); 336 #endif /* NX_DNS_CACHE_ENABLE */ 337 } NX_DNS; 338 339 340 /* Define the RDATA structure. */ 341 /********************************************************************************/ 342 /* Type A */ 343 /********************************************************************************/ 344 345 /* A RDATA format 346 1 2 3 347 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 348 |-------------------------------------------------------------| 349 | ADDRESS | 350 |-------------------------------------------------------------| 351 */ 352 /* The host name may have multiple addresses,so we need a buffer to record the all addresses. 353 return_buffer must be 4-byte aligned. This return buffer is used to store IP addresses returned from the server. 354 record_number stores the number of entries in the buffer. If the server returns more entries than the buffer 355 can hold, the entries exceeding the buffer size are dropped. */ 356 357 /* Layout of the buffer 358 |-------------------------------------------------------------------------------------| 359 |ip.address.0|ip.address.1|ip.address.2|....... |ip.address.n| 360 |-------------------------------------------------------------------------------------| 361 */ 362 363 /********************************************************************************/ 364 /* Type AAAA */ 365 /********************************************************************************/ 366 /* AAAA RDATA format 367 1 2 3 368 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 369 |-------------------------------------------------------------| 370 | ADDRESS | 371 |-------------------------------------------------------------| 372 | ADDRESS | 373 |-------------------------------------------------------------| 374 | ADDRESS | 375 |-------------------------------------------------------------| 376 | ADDRESS | 377 |-------------------------------------------------------------| 378 */ 379 380 typedef struct NX_DNS_IPV6_ADDRESS_STRUCT 381 { 382 ULONG ipv6_address[4]; 383 } NX_DNS_IPV6_ADDRESS; 384 385 386 /* The return_buffer must be 4-byte aligned. This return buffer is used to store IP addresses returned from the server. */ 387 /* The record_number in the query stores the number of entries in the buffer. If the server returns more entries than the buffer 388 can hold, the entries exceeding the buffer size are dropped. */ 389 390 /* Layout of the buffer 391 |---------------------------------------------------------------| 392 |ip.address.0[0]|ip.address.0[1]|ip.address.0[2]|ip.address.0[3]| 393 |---------------------------------------------------------------| 394 |ip.address.1[0]|ip.address.1[1]|ip.address.1[2]|ip.address.1[3]| 395 |---------------------------------------------------------------| 396 | | 397 | .......................................... | 398 | | 399 |---------------------------------------------------------------| 400 |ip.address.n[0]|ip.address.n[1]|ip.address.n[2]|ip.address.n[3]| 401 |---------------------------------------------------------------| 402 403 */ 404 405 /********************************************************************************/ 406 /* PTR */ 407 /********************************************************************************/ 408 /* PTR RDATA format 409 1 2 3 410 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 411 |-------------------------------------------------------------| 412 / PTRDNAME / 413 / / 414 |-------------------------------------------------------------| 415 */ 416 417 418 #ifdef NX_DNS_ENABLE_EXTENDED_RR_TYPES 419 420 /********************************************************************************/ 421 /* Type NS */ 422 /********************************************************************************/ 423 /* NS RDATA format 424 1 2 3 425 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 426 |-------------------------------------------------------------| 427 / NSDNAME / 428 / / 429 |-------------------------------------------------------------| 430 */ 431 432 typedef struct NX_DNS_NS_ENTRY_STRUCT 433 { 434 ULONG nx_dns_ns_ipv4_address; /* The name server ipv4 address. */ 435 UCHAR *nx_dns_ns_hostname_ptr; /* The name server. */ 436 } NX_DNS_NS_ENTRY; 437 438 /* Store the message in one buffer. Layout of the buffer: 439 440 record_buffer |---------------------------------------------------------------| 441 entry 0 |xx.xx.xx.xx |Pointer to the host name string | 442 record_buffer + 8 |---------------------------------------------------------------| 443 entry 1 |xx.xx.xx.xx |Pointer to the host name string | 444 record_buffer + 16 |---------------------------------------------------------------| 445 entry 2 |xx.xx.xx.xx |Pointer to the host name string | 446 record_buffer + 24 |---------------------------------------------------------------| 447 entry 3 |xx.xx.xx.xx |Pointer to the host name string | 448 record_buffer + 32 |---------------------------------------------------------------| 449 entry 4 |xx.xx.xx.xx |Pointer to the host name string | 450 record_buffer + 40 |---------------------------------------------------------------| 451 |xx.xx.xx.xx |Pointer to the host name string | 452 |---------------------------------------------------------------| 453 | | ns_hostname 4 | 454 |ns_hostname 3 | ns_hostname 2 | 455 |ns_hostname 1 | ns_hostname 0 | 456 record_buffer + max |---------------------------------------------------------------| 457 */ 458 459 /********************************************************************************/ 460 /* CNAME */ 461 /********************************************************************************/ 462 /* CNAME RDATA format 463 1 2 3 464 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 465 |-------------------------------------------------------------| 466 / CNAME / 467 / / 468 |-------------------------------------------------------------| 469 */ 470 471 472 /********************************************************************************/ 473 /* MX */ 474 /********************************************************************************/ 475 /* MX RDATA format 476 1 477 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 478 |-----------------------------| 479 | PREFERECE | 480 |-----------------------------| 481 / EXCHANGE / 482 / / 483 |-----------------------------| 484 */ 485 486 /* Define the mail exchange record type */ 487 typedef struct NX_DNS_MAIL_EXCHANGE_ENTRY_STRUCT 488 { 489 ULONG nx_dns_mx_ipv4_address; /* The mail exchange server ipv4 address. */ 490 USHORT nx_dns_mx_preference; /* The preference given to this RR, Lower values are preferred. */ 491 USHORT nx_dns_mx_reserved0; /* Keep 4-byte aligned. */ 492 UCHAR *nx_dns_mx_hostname_ptr; /* The mail exchange server host name. */ 493 } NX_DNS_MX_ENTRY; 494 495 /* Layout of the buffer 496 record_buffer |---------------------------------------------------------| 497 entry 0 |xx.xx.xx.xx|preference|res|pointer to host name string | 498 record_buffer + 12 |---------------------------------------------------------| 499 entry 1 |xx.xx.xx.xx|preference|res|pointer to host name string | 500 record_buffer + 24 |---------------------------------------------------------| 501 entry 2 |xx.xx.xx.xx|preference|res|pointer to host name string | 502 record_buffer + 36 |---------------------------------------------------------| 503 entry 3 |xx.xx.xx.xx|preference|res|pointer to host name string | 504 record_buffer + 48 |---------------------------------------------------------| 505 entry 4 |xx.xx.xx.xx|preference|res|pointer to host name string | 506 record_buffer + 60 |---------------------------------------------------------| 507 |xx.xx.xx.xx|preference|res|pointer to host name string | 508 |---------------------------------------------------------| 509 | | mx_hostname 4 | 510 |mx_hostname 3 | mx_hostname 2 | 511 |mx_hostname 1 | mx_hostname 0 | 512 record_buffer + max |---------------------------------------------------------| 513 */ 514 515 /********************************************************************************/ 516 /* SRV */ 517 /********************************************************************************/ 518 519 /* Define the service record type. */ 520 typedef struct NX_DNS_SERVICE_ENTRY_STRUCT 521 { 522 ULONG nx_dns_srv_ipv4_address; 523 USHORT nx_dns_srv_priority; 524 USHORT nx_dns_srv_weight; 525 USHORT nx_dns_srv_port_number; 526 USHORT nx_dns_srv_reserved0; 527 UCHAR *nx_dns_srv_hostname_ptr; 528 } NX_DNS_SRV_ENTRY; 529 530 /* Layout of the buffer: 531 532 record_buffer |-------------------------------------------------------------------| 533 entry 0 |xx.xx.xx.xx|priority|weight|port|res|pointer to host name string | 534 record_buffer + 16 |-------------------------------------------------------------------| 535 entry 1 |xx.xx.xx.xx|priority|weight|port|res|pointer to host name string | 536 record_buffer + 32 |-------------------------------------------------------------------| 537 entry 2 |xx.xx.xx.xx|priority|weight|port|res|pointer to host name string | 538 record_buffer + 48 |-------------------------------------------------------------------| 539 entry 3 |xx.xx.xx.xx|priority|weight|port|res|pointer to host name string | 540 record_buffer + 64 |-------------------------------------------------------------------| 541 entry 4 |xx.xx.xx.xx|priority|weight|port|res|pointer to host name string | 542 record_buffer + 80 |-------------------------------------------------------------------| 543 |xx.xx.xx.xx|priority|weight|port|res|pointer to host name string | 544 | | srv_hostname 4 | 545 |srv_hostname 3 | srv_hostname 2 | 546 |srv_hostname 1 | srv_hostname 0 | 547 record_buffer + max |-------------------------------------------------------------------| 548 549 */ 550 /********************************************************************************/ 551 /* TXT */ 552 /********************************************************************************/ 553 /* TXT RDATA format 554 1 2 3 555 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 556 |-------------------------------------------------------------| 557 / TXT-DATA / 558 / / 559 |-------------------------------------------------------------| 560 */ 561 562 /********************************************************************************/ 563 /* SOA */ 564 /********************************************************************************/ 565 /* SOA RDATA format 566 1 2 3 567 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 568 |-------------------------------------------------------------| 569 / MNAME / 570 / / 571 |-------------------------------------------------------------| 572 / RNAME / 573 / / 574 |-------------------------------------------------------------| 575 | SERIAL | 576 |-------------------------------------------------------------| 577 | REFRESH | 578 |-------------------------------------------------------------| 579 | RETRY | 580 |-------------------------------------------------------------| 581 | EXPIRE | 582 |-------------------------------------------------------------| 583 | MINMUM | 584 |-------------------------------------------------------------| 585 */ 586 587 /* Define the service record type. */ 588 589 typedef struct NX_DNS_SOA_ENTRY_STRUCT 590 { 591 592 UCHAR *nx_dns_soa_host_mname_ptr; 593 UCHAR *nx_dns_soa_host_rname_ptr; 594 ULONG nx_dns_soa_serial; 595 ULONG nx_dns_soa_refresh; 596 ULONG nx_dns_soa_retry; 597 ULONG nx_dns_soa_expire; 598 ULONG nx_dns_soa_minmum; 599 } NX_DNS_SOA_ENTRY; 600 601 /* Layout of the buffer 602 record_buffer 603 604 |-------------------------------------------------------------------| 605 | pointer to primary name server| pointer to responsible mailbox | 606 |-------------------------------------------------------------------| 607 | serial | refresh | retry | expire | minmum | 608 |-------------------------------------------------------------------| 609 | soa_host_mname | soa_host_rname | 610 |-------------------------------------------------------------------| 611 */ 612 613 /********************************************************************************/ 614 /* LOC */ 615 /********************************************************************************/ 616 /* To be implemented */ 617 618 /********************************************************************************/ 619 /* NAPTR */ 620 /********************************************************************************/ 621 /* To be implemented */ 622 623 /********************************************************************************/ 624 /* DNAME */ 625 /********************************************************************************/ 626 /* To be implemented */ 627 628 #endif 629 630 631 /* Define the RDATA structure. */ 632 633 /* A RDATA format 634 0 1 635 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 636 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 637 | ADDRESS | 638 | | 639 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 640 */ 641 642 typedef struct NX_DNS_RR_A_STRUCT 643 { 644 ULONG nx_dns_rr_a_address; 645 } NX_DNS_RR_A; 646 647 /* AAAA RDATA format 648 0 1 649 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 650 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 651 | | 652 | | 653 | | 654 | IPv6 ADDRESS | 655 | | 656 | | 657 | | 658 | | 659 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 660 */ 661 662 typedef struct NX_DNS_RR_AAAA_STRUCT 663 { 664 ULONG* nx_dns_rr_aaaa_address; /* Keep the same resource record structure size, store the rdata information into cache with string. */ 665 } NX_DNS_RR_AAAA; 666 667 668 /* PTR RDATA format 669 0 1 670 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 671 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 672 / PTRDNAME / 673 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 674 */ 675 676 typedef struct NX_DNS_RR_PTR_STRUCT 677 { 678 UCHAR* nx_dns_rr_ptr_name; 679 } NX_DNS_RR_PTR; 680 681 682 /* NS RDATA format 683 0 1 684 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 685 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 686 / NSDNAME / 687 / / 688 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 689 */ 690 691 typedef struct NX_DNS_RR_NS_STRUCT 692 { 693 UCHAR* nx_dns_rr_ns_name; 694 } NX_DNS_RR_NS; 695 696 /* CNMAE RDATA format 697 0 1 698 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 699 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 700 / CNAME / 701 / / 702 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 703 */ 704 705 typedef struct NX_DNS_RR_CNAME_STRUCT 706 { 707 UCHAR* nx_dns_rr_cname_name; 708 } NX_DNS_RR_CNAME; 709 710 711 /* MX RDATA format 712 0 1 713 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 714 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 715 | PREFERENCE | 716 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 717 / NEWNAME / 718 / / 719 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 720 */ 721 722 typedef struct NX_DNS_RR_MX_STRUCT 723 { 724 UCHAR* nx_dns_rr_mx_rdata; /* Keep the same resource record structure size, store the rdata information into cache with string. "preference, newname" */ 725 } NX_DNS_RR_MX; 726 727 /* TXT RDATA format 728 0 1 729 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 730 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 731 / TXT-DATA / 732 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 733 */ 734 735 typedef struct NX_DNS_RR_TXT_STRUCT 736 { 737 UCHAR* nx_dns_rr_txt_data; 738 } NX_DNS_RR_TXT; 739 740 /* SRV RDATA format 741 0 1 742 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 743 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 744 | PRIORITY | 745 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 746 | WEIGHTS | 747 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 748 | PORT | 749 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 750 / TARGET / 751 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 752 */ 753 754 typedef struct NX_DNS_RR_SRV_STRUCT 755 { 756 UCHAR* nx_dns_rr_srv_rdata; /* Keep the same resource record structure size, store the rdata information into cache with string, "priority, weights, port,target". */ 757 } NX_DNS_RR_SRV; 758 759 760 /* SOA RDATA format 761 0 1 762 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 763 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 764 / MNAME / 765 / / 766 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 767 / RNAME / 768 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 769 | SERIAL | 770 | | 771 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 772 | REFRESH | 773 | | 774 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 775 | RETRY | 776 | | 777 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 778 | EXPIRE | 779 | | 780 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 781 | MINMUM | 782 | | 783 |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--| 784 */ 785 786 typedef struct NX_DNS_RR_SOA_STRUCT 787 { 788 UCHAR* nx_dns_rr_soa_rdata; /* Keep the same resource record structure size, store the rdata information into cache with string. 789 "Mname, Rname, Serial, Refresh, Retry, Expire, Minmum" */ 790 } NX_DNS_RR_SOA; 791 792 793 /* The following data structure is used to store the resource records(RRs). */ 794 typedef struct NX_DNS_RR_STRUCT 795 { 796 797 UCHAR* nx_dns_rr_name; /* Owner's name,i.e., the name of the node to which this resource record pertains. */ 798 799 USHORT nx_dns_rr_type; /* RR TYPE. */ 800 801 USHORT nx_dns_rr_class; /* RR CLASS. */ 802 803 ULONG nx_dns_rr_ttl; /* The time interval that the RR may be cached before the source of the information should again be consulted. */ 804 805 ULONG nx_dns_rr_last_used_time; /* Define the last used time for the peer RR. */ 806 807 /* Union that holds resource record data. */ 808 union nx_dns_rr_rdata_union 809 { 810 NX_DNS_RR_A nx_dns_rr_rdata_a; 811 NX_DNS_RR_AAAA nx_dns_rr_rdata_aaaa; 812 NX_DNS_RR_PTR nx_dns_rr_rdata_ptr; 813 NX_DNS_RR_SRV nx_dns_rr_rdata_srv; 814 NX_DNS_RR_TXT nx_dns_rr_rdata_txt; 815 NX_DNS_RR_CNAME nx_dns_rr_rdata_cname; 816 NX_DNS_RR_NS nx_dns_rr_rdata_ns; 817 NX_DNS_RR_MX nx_dns_rr_rdata_mx; 818 NX_DNS_RR_SOA nx_dns_rr_rdata_soa; 819 } nx_dns_rr_rdata; 820 821 }NX_DNS_RR; 822 823 824 #ifndef NX_DNS_SOURCE_CODE 825 826 /* Application caller is present, perform API mapping. */ 827 828 /* Determine if error checking is desired. If so, map API functions 829 to the appropriate error checking front-ends. Otherwise, map API 830 functions to the core functions that actually perform the work. 831 Note: error checking is enabled by default. */ 832 833 #ifdef NX_DISABLE_ERROR_CHECKING 834 835 /* Services without error checking. */ 836 837 #define nx_dns_create _nx_dns_create 838 #define nx_dns_delete _nx_dns_delete 839 #define nx_dns_packet_pool_set _nx_dns_packet_pool_set 840 #define nx_dns_host_by_address_get _nx_dns_host_by_address_get 841 #define nx_dns_host_by_name_get _nx_dns_host_by_name_get 842 #define nx_dns_ipv4_address_by_name_get _nx_dns_ipv4_address_by_name_get 843 844 #ifdef NX_DNS_ENABLE_EXTENDED_RR_TYPES 845 #define nx_dns_cname_get _nx_dns_cname_get 846 #define nx_dns_domain_name_server_get _nx_dns_domain_name_server_get 847 #define nx_dns_host_text_get _nx_dns_host_text_get 848 #define nx_dns_domain_mail_exchange_get _nx_dns_domain_mail_exchange_get 849 #define nx_dns_domain_service_get _nx_dns_domain_service_get 850 #define nx_dns_authority_zone_start_get _nx_dns_authority_zone_start_get 851 #define nx_dns_info_by_name_get _nx_dns_info_by_name_get 852 #endif 853 854 #define nx_dns_server_add _nx_dns_server_add 855 #define nx_dns_server_remove _nx_dns_server_remove 856 #define nx_dns_server_remove_all _nx_dns_server_remove_all 857 #define nx_dns_server_get _nx_dns_server_get 858 #define nx_dns_get_serverlist_size _nx_dns_get_serverlist_size 859 860 #define nxd_dns_ipv6_address_by_name_get _nxd_dns_ipv6_address_by_name_get 861 #define nxd_dns_host_by_address_get _nxd_dns_host_by_address_get 862 #define nxd_dns_host_by_name_get _nxd_dns_host_by_name_get 863 #define nxd_dns_server_add _nxd_dns_server_add 864 #define nxd_dns_server_remove _nxd_dns_server_remove 865 #define nxd_dns_server_get _nxd_dns_server_get 866 867 #ifdef NX_DNS_CACHE_ENABLE 868 #define nx_dns_cache_initialize _nx_dns_cache_initialize 869 #define nx_dns_cache_notify_set _nx_dns_cache_notify_set 870 #define nx_dns_cache_notify_clear _nx_dns_cache_notify_clear 871 #endif /* NX_DNS_CACHE_ENABLE */ 872 873 #else 874 875 /* Services with error checking. */ 876 877 #define nx_dns_create _nxe_dns_create 878 #define nx_dns_delete _nxe_dns_delete 879 #define nx_dns_packet_pool_set _nxe_dns_packet_pool_set 880 #define nx_dns_host_by_address_get _nxe_dns_host_by_address_get 881 #define nx_dns_host_by_name_get _nxe_dns_host_by_name_get 882 #define nx_dns_ipv4_address_by_name_get _nxe_dns_ipv4_address_by_name_get 883 884 #ifdef NX_DNS_ENABLE_EXTENDED_RR_TYPES 885 #define nx_dns_cname_get _nxe_dns_cname_get 886 #define nx_dns_domain_name_server_get _nxe_dns_domain_name_server_get 887 #define nx_dns_host_text_get _nxe_dns_host_text_get 888 #define nx_dns_domain_mail_exchange_get _nxe_dns_domain_mail_exchange_get 889 #define nx_dns_domain_service_get _nxe_dns_domain_service_get 890 #define nx_dns_authority_zone_start_get _nxe_dns_authority_zone_start_get 891 #define nx_dns_info_by_name_get _nxe_dns_info_by_name_get 892 #endif 893 894 #define nx_dns_server_add _nxe_dns_server_add 895 #define nx_dns_server_remove _nxe_dns_server_remove 896 #define nx_dns_server_remove_all _nxe_dns_server_remove_all 897 #define nx_dns_server_get _nxe_dns_server_get 898 #define nx_dns_get_serverlist_size _nxe_dns_get_serverlist_size 899 900 #define nxd_dns_ipv6_address_by_name_get _nxde_dns_ipv6_address_by_name_get 901 #define nxd_dns_host_by_address_get _nxde_dns_host_by_address_get 902 #define nxd_dns_host_by_name_get _nxde_dns_host_by_name_get 903 #define nxd_dns_server_add _nxde_dns_server_add 904 #define nxd_dns_server_remove _nxde_dns_server_remove 905 #define nxd_dns_server_get _nxde_dns_server_get 906 907 #ifdef NX_DNS_CACHE_ENABLE 908 #define nx_dns_cache_initialize _nxe_dns_cache_initialize 909 #define nx_dns_cache_notify_set _nxe_dns_cache_notify_set 910 #define nx_dns_cache_notify_clear _nxe_dns_cache_notify_clear 911 #endif /* NX_DNS_CACHE_ENABLE */ 912 913 #endif 914 915 /* Define the prototypes accessible to the application software. */ 916 917 UINT nx_dns_create(NX_DNS *dns_ptr, NX_IP *ip_ptr, UCHAR *domain_name); 918 UINT nx_dns_delete(NX_DNS *dns_ptr); 919 UINT nx_dns_packet_pool_set(NX_DNS *dns_ptr, NX_PACKET_POOL *packet_pool_ptr); 920 UINT nx_dns_server_add(NX_DNS *dns_ptr, ULONG server_address); 921 UINT nx_dns_server_remove(NX_DNS *dns_ptr, ULONG server_address); 922 UINT nx_dns_server_remove_all(NX_DNS *dns_ptr); 923 UINT nx_dns_server_get(NX_DNS *dns_ptr, UINT index, ULONG *dns_server_address); 924 UINT nx_dns_get_serverlist_size(NX_DNS *dns_ptr, UINT *server_list_size); 925 UINT nx_dns_host_by_name_get(NX_DNS *dns_ptr, UCHAR *host_name, ULONG *host_address_ptr, ULONG wait_option); 926 UINT nx_dns_host_by_address_get(NX_DNS *dns_ptr, ULONG ip_address, UCHAR *host_name_ptr, UINT host_name_buffer_size, ULONG wait_option); 927 UINT nx_dns_ipv4_address_by_name_get(NX_DNS *dns_ptr, UCHAR *host_name, VOID *record_buffer, UINT buffer_size, UINT *record_count, ULONG wait_option); 928 929 #ifdef NX_DNS_ENABLE_EXTENDED_RR_TYPES 930 UINT nx_dns_cname_get (NX_DNS *dns_ptr, UCHAR *host_name, UCHAR *record_buffer, UINT buffer_size, ULONG wait_option); 931 UINT nx_dns_domain_name_server_get(NX_DNS *dns_ptr, UCHAR *host_name, VOID *record_buffer, UINT buffer_size, UINT *record_count, ULONG wait_option); 932 UINT nx_dns_host_text_get(NX_DNS *dns_ptr, UCHAR *host_name, UCHAR *record_buffer, UINT buffer_size, ULONG wait_option); 933 UINT nx_dns_domain_mail_exchange_get(NX_DNS *dns_ptr, UCHAR *host_name, VOID *record_buffer, UINT buffer_size, UINT *record_count, ULONG wait_option); 934 UINT nx_dns_domain_service_get(NX_DNS *dns_ptr, UCHAR *host_name, VOID *record_buffer, UINT buffer_size, UINT *record_count, ULONG wait_option); 935 UINT nx_dns_authority_zone_start_get (NX_DNS *dns_ptr, UCHAR *host_name, UCHAR *record_buffer, UINT buffer_size, ULONG wait_option); 936 UINT nx_dns_info_by_name_get(NX_DNS *dns_ptr, UCHAR *host_name, ULONG *host_address_ptr, USHORT* host_port, ULONG wait_option); 937 #endif 938 939 UINT nxd_dns_ipv6_address_by_name_get(NX_DNS *dns_ptr, UCHAR *host_name, VOID *record_buffer, UINT buffer_size, UINT *record_count, ULONG wait_option); 940 UINT nxd_dns_host_by_address_get(NX_DNS *dns_ptr, NXD_ADDRESS *ip_address, UCHAR *host_name_ptr, UINT host_name_buffer_size, ULONG wait_option); 941 UINT nxd_dns_host_by_name_get(NX_DNS *dns_ptr, UCHAR *host_name, NXD_ADDRESS *host_address_ptr, ULONG wait_option, UINT lookup_type); 942 UINT nxd_dns_server_add(NX_DNS *dns_ptr, NXD_ADDRESS *dns_server_address); 943 UINT nxd_dns_server_remove(NX_DNS *dns_ptr, NXD_ADDRESS *server_address); 944 UINT nxd_dns_server_get(NX_DNS *dns_ptr, UINT index, NXD_ADDRESS *dns_server_address); 945 946 #ifdef NX_DNS_CACHE_ENABLE 947 UINT nx_dns_cache_initialize(NX_DNS *dns_ptr, VOID *cache_ptr, UINT cache_size); 948 UINT nx_dns_cache_notify_set(NX_DNS *dns_ptr, VOID (*cache_full_notify_cb)(NX_DNS *dns_ptr)); 949 UINT nx_dns_cache_notify_clear(NX_DNS *dns_ptr); 950 #endif /* NX_DNS_CACHE_ENABLE */ 951 952 #else 953 954 /* DNS source code is being compiled, do not perform any API mapping. */ 955 956 UINT _nxe_dns_create(NX_DNS *dns_ptr, NX_IP *ip_ptr, UCHAR *domain_name); 957 UINT _nx_dns_create(NX_DNS *dns_ptr, NX_IP *ip_ptr, UCHAR *domain_name); 958 UINT _nxe_dns_delete(NX_DNS *dns_ptr); 959 UINT _nx_dns_delete(NX_DNS *dns_ptr); 960 UINT _nxe_dns_packet_pool_set(NX_DNS *dns_ptr, NX_PACKET_POOL *packet_pool_ptr); 961 UINT _nx_dns_packet_pool_set(NX_DNS *dns_ptr, NX_PACKET_POOL *packet_pool_ptr); 962 UINT _nxe_dns_host_by_address_get(NX_DNS *dns_ptr, ULONG ip_address, UCHAR *host_name_ptr, UINT host_name_buffer_size, ULONG wait_option); 963 UINT _nx_dns_host_by_address_get(NX_DNS *dns_ptr, ULONG ip_address, UCHAR *host_name_ptr, UINT host_name_buffer_size, ULONG wait_option); 964 UINT _nxe_dns_host_by_name_get(NX_DNS *dns_ptr, UCHAR *host_name, ULONG *host_address_ptr, ULONG wait_option); 965 UINT _nx_dns_host_by_name_get(NX_DNS *dns_ptr, UCHAR *host_name, ULONG *host_address_ptr, ULONG wait_option); 966 UINT _nxe_dns_ipv4_address_by_name_get(NX_DNS *dns_ptr, UCHAR *host_name, VOID *record_buffer, UINT buffer_size, UINT *record_count, ULONG wait_option); 967 UINT _nx_dns_ipv4_address_by_name_get(NX_DNS *dns_ptr, UCHAR *host_name, VOID *record_buffer, UINT buffer_size, UINT *record_count, ULONG wait_option); 968 969 #ifdef NX_DNS_ENABLE_EXTENDED_RR_TYPES 970 UINT _nxe_dns_cname_get (NX_DNS *dns_ptr, UCHAR *host_name, UCHAR *record_buffer, UINT buffer_size,ULONG wait_option); 971 UINT _nx_dns_cname_get (NX_DNS *dns_ptr, UCHAR *host_name, UCHAR *record_buffer, UINT buffer_size,ULONG wait_option); 972 UINT _nxe_dns_domain_name_server_get(NX_DNS *dns_ptr, UCHAR *host_name, VOID *record_buffer, UINT buffer_size, UINT *record_count, ULONG wait_option); 973 UINT _nx_dns_domain_name_server_get(NX_DNS *dns_ptr, UCHAR *host_name, VOID *record_buffer, UINT buffer_size, UINT *record_count, ULONG wait_option); 974 UINT _nxe_dns_host_text_get(NX_DNS *dns_ptr, UCHAR *host_name, UCHAR *record_buffer, UINT buffer_size, ULONG wait_option); 975 UINT _nx_dns_host_text_get(NX_DNS *dns_ptr, UCHAR *host_name, UCHAR *record_buffer, UINT buffer_size, ULONG wait_option); 976 UINT _nxe_dns_domain_mail_exchange_get(NX_DNS *dns_ptr, UCHAR *host_name, VOID *record_buffer, UINT buffer_size, UINT *record_count, ULONG wait_option); 977 UINT _nx_dns_domain_mail_exchange_get(NX_DNS *dns_ptr, UCHAR *host_name, VOID *record_buffer, UINT buffer_size, UINT *record_count, ULONG wait_option); 978 UINT _nxe_dns_domain_service_get(NX_DNS *dns_ptr, UCHAR *host_name, VOID *record_buffer, UINT buffer_size, UINT *record_count, ULONG wait_option); 979 UINT _nx_dns_domain_service_get(NX_DNS *dns_ptr, UCHAR *host_name, VOID *record_buffer, UINT buffer_size, UINT *record_count, ULONG wait_option); 980 UINT _nxe_dns_authority_zone_start_get (NX_DNS *dns_ptr, UCHAR *host_name, UCHAR *record_buffer, UINT buffer_size, ULONG wait_option); 981 UINT _nx_dns_authority_zone_start_get (NX_DNS *dns_ptr, UCHAR *host_name, UCHAR *record_buffer, UINT buffer_size, ULONG wait_option); 982 UINT _nxe_dns_info_by_name_get(NX_DNS *dns_ptr, UCHAR *host_name, ULONG *host_address_ptr, USHORT* host_port, ULONG wait_option); 983 UINT _nx_dns_info_by_name_get(NX_DNS *dns_ptr, UCHAR *host_name, ULONG *host_address_ptr, USHORT* host_port, ULONG wait_option); 984 #endif 985 986 UINT _nxe_dns_server_add(NX_DNS *dns_ptr, ULONG server_address); 987 UINT _nx_dns_server_add(NX_DNS *dns_ptr, ULONG server_address); 988 UINT _nxe_dns_server_remove(NX_DNS *dns_ptr, ULONG server_address); 989 UINT _nx_dns_server_remove(NX_DNS *dns_ptr, ULONG server_address); 990 UINT _nxe_dns_server_remove_all(NX_DNS *dns_ptr); 991 UINT _nx_dns_server_remove_all(NX_DNS *dns_ptr); 992 UINT _nxe_dns_server_get(NX_DNS *dns_ptr, UINT index, ULONG *dns_server_address); 993 UINT _nx_dns_server_get(NX_DNS *dns_ptr, UINT index, ULONG *dns_server_address); 994 UINT _nxe_dns_get_serverlist_size(NX_DNS *dns_ptr, UINT *server_list_size); 995 UINT _nx_dns_get_serverlist_size(NX_DNS *dns_ptr, UINT *server_list_size); 996 UINT _nxde_dns_ipv6_address_by_name_get(NX_DNS *dns_ptr, UCHAR *host_name, VOID *record_buffer, UINT buffer_size, UINT *record_count, ULONG wait_option); 997 UINT _nxd_dns_ipv6_address_by_name_get(NX_DNS *dns_ptr, UCHAR *host_name, VOID *record_buffer, UINT buffer_size, UINT *record_count, ULONG wait_option); 998 UINT _nxde_dns_host_by_address_get(NX_DNS *dns_ptr, NXD_ADDRESS *host_address_ptr, UCHAR *host_name_ptr, UINT host_name_buffer_size, ULONG wait_option); 999 UINT _nxd_dns_host_by_address_get(NX_DNS *dns_ptr, NXD_ADDRESS *host_address_ptr, UCHAR *host_name_ptr, UINT host_name_buffer_size, ULONG wait_option); 1000 UINT _nxde_dns_host_by_name_get(NX_DNS *dns_ptr, UCHAR *host_name, NXD_ADDRESS *host_address_ptr, ULONG wait_option, UINT lookup_type); 1001 UINT _nxd_dns_host_by_name_get(NX_DNS *dns_ptr, UCHAR *host_name, NXD_ADDRESS *host_address_ptr, ULONG wait_option, UINT lookup_type); 1002 UINT _nxde_dns_server_add(NX_DNS *dns_ptr, NXD_ADDRESS *server_address); 1003 UINT _nxd_dns_server_add(NX_DNS *dns_ptr, NXD_ADDRESS *server_address); 1004 UINT _nxde_dns_server_remove(NX_DNS *dns_ptr, NXD_ADDRESS *server_address); 1005 UINT _nxd_dns_server_remove(NX_DNS *dns_ptr, NXD_ADDRESS *server_address); 1006 UINT _nxde_dns_server_get(NX_DNS *dns_ptr, UINT index, NXD_ADDRESS *dns_server_address); 1007 UINT _nxd_dns_server_get(NX_DNS *dns_ptr, UINT index, NXD_ADDRESS *dns_server_address); 1008 1009 #ifdef NX_DNS_CACHE_ENABLE 1010 UINT _nxe_dns_cache_initialize(NX_DNS *dns_ptr, VOID *cache_ptr, UINT cache_size); 1011 UINT _nx_dns_cache_initialize(NX_DNS *dns_ptr, VOID *cache_ptr, UINT cache_size); 1012 UINT _nxe_dns_cache_notify_set(NX_DNS *dns_ptr, VOID (*cache_full_notify_cb)(NX_DNS *dns_ptr)); 1013 UINT _nx_dns_cache_notify_set(NX_DNS *dns_ptr, VOID (*cache_full_notify_cb)(NX_DNS *dns_ptr)); 1014 UINT _nxe_dns_cache_notify_clear(NX_DNS *dns_ptr); 1015 UINT _nx_dns_cache_notify_clear(NX_DNS *dns_ptr); 1016 #endif /* NX_DNS_CACHE_ENABLE */ 1017 1018 #endif 1019 1020 /* Internal DNS response getting function. */ 1021 UINT _nx_dns_response_get(NX_DNS *dns_ptr, UCHAR *host_name, UCHAR *record_buffer, UINT buffer_size, 1022 UINT *record_count, ULONG wait_option); 1023 1024 /* Determine if a C++ compiler is being used. If so, complete the standard 1025 C conditional started above. */ 1026 #ifdef __cplusplus 1027 } 1028 #endif 1029 1030 #endif /* NXD_DNS_H */ 1031 1032