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 /**   Multicast Domain Name System (mDNS)                                 */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 /**************************************************************************/
24 /*                                                                        */
25 /*  APPLICATION INTERFACE DEFINITION                       RELEASE        */
26 /*                                                                        */
27 /*    nxd_mdns.h                                          PORTABLE C      */
28 /*                                                           6.3.0        */
29 /*  AUTHOR                                                                */
30 /*                                                                        */
31 /*    Yuxin Zhou, Microsoft Corporation                                   */
32 /*                                                                        */
33 /*  DESCRIPTION                                                           */
34 /*                                                                        */
35 /*    This file defines the NetX Multicast Domain Name System (mDNS)      */
36 /*    component, including all data types and external references.        */
37 /*    It is assumed that nx_api.h and nx_port.h have already been         */
38 /*    included.                                                           */
39 /*                                                                        */
40 /*  RELEASE HISTORY                                                       */
41 /*                                                                        */
42 /*    DATE              NAME                      DESCRIPTION             */
43 /*                                                                        */
44 /*  05-19-2020     Yuxin Zhou               Initial Version 6.0           */
45 /*  09-30-2020     Yuxin Zhou               Modified comment(s), improved */
46 /*                                            buffer length verification, */
47 /*                                            resulting in version 6.1    */
48 /*  12-31-2020     Yuxin Zhou               Modified comment(s),          */
49 /*                                            prevented infinite loop in  */
50 /*                                            name compression,           */
51 /*                                            resulting in version 6.1.3  */
52 /*  04-25-2022     Yuxin Zhou               Modified comment(s),          */
53 /*                                            fixed the issue of timer,   */
54 /*                                            resulting in version 6.1.11 */
55 /*  10-31-2023     Bo Chen                  Modified comment(s), and      */
56 /*                                            corrected the symbols check,*/
57 /*                                            resulting in version 6.3.0  */
58 /*                                                                        */
59 /**************************************************************************/
60 
61 #ifndef NXD_MDNS_H
62 #define NXD_MDNS_H
63 
64 /* Determine if a C++ compiler is being used.  If so, ensure that standard
65    C is used to process the API information.  */
66 
67 
68 
69 #ifdef   __cplusplus
70 
71 /* Yes, C++ compiler is present.  Use standard C.  */
72 extern   "C" {
73 
74 #endif
75 
76 #include "nx_api.h"
77 #include "nx_udp.h"
78 #include "nx_ip.h"
79 #ifdef FEATURE_NX_IPV6
80 #include "nx_ipv6.h"
81 #endif /* FEATURE_NX_IPV6  */
82 
83 
84 /* Define the Multicast DNS ID.  */
85 #define NX_MDNS_ID                              0x4d444e53UL
86 
87 /* Define macros that get the data on unaligned address.  */
88 #define NX_MDNS_GET_USHORT_DATA(data)           (USHORT)((*(data) << 8) | (*(data + 1)))
89 #define NX_MDNS_GET_ULONG_DATA(data)            (ULONG)((*(data) << 24) | (*(data + 1) << 16) | (*(data + 2) << 8) | (*(data + 3)))
90 
91 /* Disable the mDNS Server functionality.  By default mDNS server
92    function is enabled.  To remove the mDNS server function from
93    the mDNS library, uncomment the following line.  */
94 /*
95 #define NX_MDNS_DISABLE_SERVER
96 */
97 
98 /* Disable the mDNS Client functionality.  By default mDNS client
99    function is enabled.  To remove the mDNS client function from
100    the mDNS library, uncomment the following line.  */
101 /*
102 #define NX_MDNS_DISABLE_CLIENT
103 */
104 
105 /* Enable the feature to check the address and port of mDNS message.
106    By default is enabled. To remove it from the mDNS library,
107    comment the following line.  */
108 #define NX_MDNS_ENABLE_ADDRESS_CHECK
109 
110 /* Enable the Passive Observation Of Failures feature for Client.
111    By default is enabled. To remove it from the mDNS library,
112    comment the following line.
113    Note: This will have no effect if NX_MDNS_DISABLE_CLIENT is defined.  */
114 #define NX_MDNS_ENABLE_CLIENT_POOF
115 
116 /* Enable the feature for Server to generate the Negative Responses.
117    By default is enabled. To remove it from the mDNS library,
118    comment the following line.
119    Note: This will have no effect if NX_MDNS_DISABLE_SERVER is defined.  */
120 #define NX_MDNS_ENABLE_SERVER_NEGATIVE_RESPONSES
121 
122 
123 /* Enable mDNS IPv6 feature, send/process mDNS message over IPv6 address.
124    By default mDNS IPv6 function is disabled. To enable this feature,
125    uncomment the following line.  */
126 /*
127 #define NX_MDNS_ENABLE_IPV6
128 */
129 
130 #ifdef NX_MDNS_ENABLE_IPV6
131 
132 #ifndef FEATURE_NX_IPV6
133 #error "mDNS IPv6 is not supported if IPv6 is not enabled."
134 #endif /* FEATURE_NX_IPV6  */
135 
136 #ifndef NX_ENABLE_IPV6_MULTICAST
137 #error "mDNS IPv6 is not supported if IPv6 multicast is not enabled."
138 #endif /* NX_ENABLE_IPV6_MULTICAST  */
139 
140 #ifndef NX_MDNS_DISABLE_SERVER
141 #ifndef NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY
142 #error "mDNS IPv6 is not supported if IPv6 address change notify is not enabled."
143 #endif /* NX_ENABLE_IPV6_ADDRESS_CHANGE_NOTIFY  */
144 #endif /* NX_MDNS_DISABLE_SERVER  */
145 
146 #endif /* NX_MDNS_ENABLE_IPV6  */
147 
148 
149 /* Define the IPV6 address count of the host name. */
150 #ifndef NX_MDNS_IPV6_ADDRESS_COUNT
151 #define NX_MDNS_IPV6_ADDRESS_COUNT              2
152 #endif /* NX_MDNS_IPV6_ADDRESS_COUNT  */
153 
154 
155 /* Define message and name limits.  */
156 #define NX_MDNS_TYPE_MAX                        21          /* Maximum Type size, <sn>._tcp, <sn> may be up to 15 bytes,
157                                                                plus the underscore and length byte. Including the "_udp" or "_tcp". */
158 #define NX_MDNS_LABEL_MAX                       63          /* Maximum Label (between two dots) size                 */
159 #define NX_MDNS_NAME_MAX                        255         /* Maximum Name size                                     */
160 #define NX_MDNS_IP_LOOKUP_SIZE                  75          /* IPv6 needs 66 characters for the address plus 8 for the ip6.arpa plus null           */
161                                                             /* IPv4 needs 12 characters max for the address plus 12 for the IN-ADDR.ARPA plus null  */
162 
163 
164 /* Define the mDNS's host name cache size. Keep four-byte alignment.   */
165 /* Note: The real host name size plus conflict size (4)
166          must not exceed NX_MDNS_LABEL_MAX and NX_MDNS_HOST_NAME_MAX.
167          such as:
168          the real host name: "NETX-MDNS-HOST"
169          the conflict name: " (2)"
170          the final name: "NETX-MDNS-HOST (2)".  */
171 #ifndef NX_MDNS_HOST_NAME_MAX
172 #define NX_MDNS_HOST_NAME_MAX                   64
173 #endif /* NX_MDNS_HOST_NAME_MAX  */
174 
175 
176 /* Define the mDNS's service name cache size. Keep four-byte alignment.  */
177 /* Note: The real service name size plus conflict size (4)
178          must not exceed NX_MDNS_LABEL_MAX and NX_MDNS_SERVICE_NAME_MAX.
179          such as:
180          the real service name: "NETX-MDNS-SERVICE"
181          the conflict name: " (2)"
182          the final service name: "NETX-MDNS-SERVICE (2)".  */
183 #ifndef NX_MDNS_SERVICE_NAME_MAX
184 #define NX_MDNS_SERVICE_NAME_MAX                64
185 #endif /* NX_MDNS_SERVICE_NAME_MAX  */
186 
187 
188 /* Define the mDNS's domain name max size. */
189 #ifndef NX_MDNS_DOMAIN_NAME_MAX
190 #define NX_MDNS_DOMAIN_NAME_MAX                 16
191 #endif /* NX_MDNS_DOMAIN_NAME_MAX  */
192 
193 /* NX_MDNS_DOMAIN_NAME_MAX must be at least 5 bytes to hold "local". */
194 #if (NX_MDNS_DOMAIN_NAME_MAX < 5)
195 #error "NX_MDNS_DOMAIN_NAME_MAX must be at least 5 bytes!"
196 #endif /* (NX_MDNS_DOMAIN_NAME_MAX < 5) */
197 
198 /* (NX_MDNS_HOST_NAME_MAX + "."(1) + NX_MDNS_DOMAIN_NAME_MAX) must be no more than NX_MDNS_NAME_MAX. */
199 #if ((NX_MDNS_HOST_NAME_MAX + 1 + NX_MDNS_DOMAIN_NAME_MAX) > NX_MDNS_NAME_MAX)
200 #error "(NX_MDNS_HOST_NAME_MAX + 1 + NX_MDNS_DOMAIN_NAME_MAX) must be no more than NX_MDNS_NAME_MAX!"
201 #endif
202 
203 /* Define the conflict count of service name or host name.   */
204 /* Note: the confilict count should be less than 8, since we just append " (x)"
205          between " (2)" and " (9)" during the conflict resolution process.  */
206 #ifndef NX_MDNS_CONFLICT_COUNT
207 #define NX_MDNS_CONFLICT_COUNT                  8
208 #endif/* NX_MDNS_CONFLICT_COUNT  */
209 
210 
211 /* Define the DNS-SD buffer size for storing "_services._dns-sd._udp.local"  */
212 /* Note: the domain can be updated, so the max size should be NX_MDNS_DOMAIN_NAME_MAX + 23.
213          "_services._dns-sd._udp." (23) + NX_MDNS_DOMAIN_NAME_MAX. */
214 #define NX_MDNS_DNS_SD_MAX                      (NX_MDNS_DOMAIN_NAME_MAX + 23)
215 
216 
217 /* Define mDNS Multicast Address.  */
218 #define NX_MDNS_IPV4_MULTICAST_ADDRESS          (IP_ADDRESS(224,0,0,251))
219 
220 
221 /* Define mDNS port.  */
222 #define NX_MDNS_UDP_PORT                        5353
223 
224 
225 /* Define UDP socket create options.  */
226 #ifndef NX_MDNS_UDP_TYPE_OF_SERVICE
227 #define NX_MDNS_UDP_TYPE_OF_SERVICE             NX_IP_NORMAL
228 #endif /* NX_MDNS_UDP_TYPE_OF_SERVICE  */
229 
230 #ifndef NX_MDNS_UDP_FRAGMENT_OPTION
231 #define NX_MDNS_UDP_FRAGMENT_OPTION             NX_DONT_FRAGMENT
232 #endif /* NX_MDNS_UDP_FRAGMENT_OPTION  */
233 
234 #ifndef NX_MDNS_UDP_TIME_TO_LIVE
235 #define NX_MDNS_UDP_TIME_TO_LIVE                0xFF
236 #endif /* NX_MDNS_UDP_TIME_TO_LIVE  */
237 
238 #ifndef NX_MDNS_UDP_QUEUE_DEPTH
239 #define NX_MDNS_UDP_QUEUE_DEPTH                 4
240 #endif /* NX_MDNS_UDP_QUEUE_DEPTH  */
241 
242 
243 /* Define the resource record TTL. In second.  */
244 /* The recommended TTL value for Multicast DNS resource records with a host name as the resource record's name
245    (e.g., A, AAAA, HINFO) or a host name contaned within the resource record's rdata (e.g., SRV, reverse mapping PTR record)
246    should be 120 seconds. The recommended TTL value for other Multicast DNS resource records is 75 minutes.
247    RFC6762, Section10, Page33.  */
248 #ifndef NX_MDNS_RR_TTL_HOST
249 #define NX_MDNS_RR_TTL_HOST                     120
250 #endif /* NX_MDNS_RR_TTL_HOST  */
251 
252 #ifndef NX_MDNS_RR_TTL_OTHER
253 #define NX_MDNS_RR_TTL_OTHER                    4500        /* 75 minutes.  */
254 #endif /* NX_MDNS_RR_TTL_OTHER  */
255 
256 
257 /* Define the mDNS's probing timer interval, default 250ms in spec. In tick.
258    should be: 250 * NX_IP_PERIODIC_RATE / 1000.  */
259 #ifndef NX_MDNS_PROBING_TIMER_COUNT
260 #define NX_MDNS_PROBING_TIMER_COUNT             (250 * NX_IP_PERIODIC_RATE / 1000)
261 #endif /* NX_MDNS_PROBING_TIMER_COUNT  */
262 
263 
264 /* Define the mDNS's announcing timer interval, default 250ms in spec. In tick.
265    should be: 250 * NX_IP_PERIODIC_RATE / 1000.  */
266 #ifndef NX_MDNS_ANNOUNCING_TIMER_COUNT
267 #define NX_MDNS_ANNOUNCING_TIMER_COUNT          (250 * NX_IP_PERIODIC_RATE / 1000)
268 #endif /* NX_MDNS_ANNOUNCING_TIMER_COUNT  */
269 
270 
271 /* Define the mDNS's goodbye timer interval, default 250ms in spec. In tick.
272    should be: 250 * NX_IP_PERIODIC_RATE / 1000.  */
273 #ifndef NX_MDNS_GOODBYE_TIMER_COUNT
274 #define NX_MDNS_GOODBYE_TIMER_COUNT             (250 * NX_IP_PERIODIC_RATE / 1000)
275 #endif /* NX_MDNS_GOODBYE_TIMER_COUNT  */
276 
277 
278 /* Define the mDNS's min query timer interval between two queries, 1 second. In tick.  */
279 #ifndef NX_MDNS_QUERY_MIN_TIMER_COUNT
280 #define NX_MDNS_QUERY_MIN_TIMER_COUNT           NX_IP_PERIODIC_RATE
281 #endif /* NX_MDNS_QUERY_MIN_TIMER_COUNT  */
282 
283 
284 /* Define the mDNS's max query timer interval between first two queries, 60 minutes. In tick.  */
285 #ifndef NX_MDNS_QUERY_MAX_TIMER_COUNT
286 #define NX_MDNS_QUERY_MAX_TIMER_COUNT           (3600 * NX_IP_PERIODIC_RATE)
287 #endif /* NX_MDNS_QUERY_MAX_TIMER_COUNT  */
288 
289 
290 /* Define the mDNS's query delay timer interval, 20-120ms. In tick. */
291 #ifndef NX_MDNS_QUERY_DELAY_MIN
292 #define NX_MDNS_QUERY_DELAY_MIN                 (20 * NX_IP_PERIODIC_RATE / 1000)
293 #endif /* NX_MDNS_QUERY_DELAY_MIN  */
294 
295 #ifndef NX_MDNS_QUERY_DELAY_RANGE
296 #define NX_MDNS_QUERY_DELAY_RANGE               (100 * NX_IP_PERIODIC_RATE / 1000)
297 #endif /* NX_MDNS_QUERY_DELAY_RANGE  */
298 
299 
300 /* Define the mDNS's response delay time interval for multicast query.  */
301 /* The time interval, in ticks, in responding to a query to ensure an interval of at least 1s
302    since the last time the record was multicast. The default value is NX_IP_PERIODIC_RATE ticks.  */
303 #ifndef NX_MDNS_RESPONSE_INTERVAL
304 #define NX_MDNS_RESPONSE_INTERVAL               NX_IP_PERIODIC_RATE
305 #endif /* NX_MDNS_RESPONSE_INTERVAL  */
306 
307 
308 /* Define the mDNS's response delay time interval for probe message.  */
309 /* The time interval, in ticks, in responding to a probe queries to ensure an interval of
310    at least 250ms since the last time the record was multicast. The default value is (250 * NX_IP_PERIODIC_RATE / 1000) ticks.  */
311 #ifndef NX_MDNS_RESPONSE_PROBING_TIMER_COUNT
312 #define NX_MDNS_RESPONSE_PROBING_TIMER_COUNT    (250 * NX_IP_PERIODIC_RATE / 1000)
313 #endif /* NX_MDNS_RESPONSE_PROBING_TIMER_COUNT  */
314 
315 
316 /* Define the mDNS's response delay time interval for unicast query, 10 ms. In tick.  */
317 #ifndef NX_MDNS_RESPONSE_UNIQUE_DELAY
318 #define NX_MDNS_RESPONSE_UNIQUE_DELAY           (10 * NX_IP_PERIODIC_RATE / 1000)
319 #endif /* NX_MDNS_RESPONSE_UNIQUE_DELAY  */
320 
321 
322 /* Define the mDNS's response delay time interval for shared message, 20-120ms. In tick.  */
323 #ifndef NX_MDNS_RESPONSE_SHARED_DELAY_MIN
324 #define NX_MDNS_RESPONSE_SHARED_DELAY_MIN       (20 * NX_IP_PERIODIC_RATE / 1000)
325 #endif /* NX_MDNS_RESPONSE_SHARED_DELAY_MIN */
326 
327 #ifndef NX_MDNS_RESPONSE_SHARED_DELAY_RANGE
328 #define NX_MDNS_RESPONSE_SHARED_DELAY_RANGE     (100 * NX_IP_PERIODIC_RATE / 1000)
329 #endif /* NX_MDNS_RESPONSE_SHARED_DELAY_RANGE  */
330 
331 
332 /* Define the mDNS's response delay time interval for query with TC, 400-500 ms. In tick.  */
333 #ifndef NX_MDNS_RESPONSE_TC_DELAY_MIN
334 #define NX_MDNS_RESPONSE_TC_DELAY_MIN           (400 * NX_IP_PERIODIC_RATE / 1000)
335 #endif /* NX_MDNS_RESPONSE_TC_DELAY_MIN  */
336 
337 #ifndef NX_MDNS_RESPONSE_TC_DELAY_RANGE
338 #define NX_MDNS_RESPONSE_TC_DELAY_RANGE         (100 * NX_IP_PERIODIC_RATE / 1000)
339 #endif /* NX_MDNS_RESPONSE_TC_DELAY_RANGE  */
340 
341 
342 /* Define the mDNS's random delay timer count, 120 ms. In tick.  */
343 /* This value allows a response to include messages that would be sent within
344    the next 120ms range.  */
345 #ifndef NX_MDNS_TIMER_COUNT_RANGE
346 #define NX_MDNS_TIMER_COUNT_RANGE               (120 * NX_IP_PERIODIC_RATE / 1000)
347 #endif /* NX_MDNS_TIMER_COUNT_RANGE  */
348 
349 
350 /* Define the mDNS's probing retransmit count. The defaul value is 3.  */
351 #ifndef NX_MDNS_PROBING_RETRANSMIT_COUNT
352 #define NX_MDNS_PROBING_RETRANSMIT_COUNT        3
353 #endif /* NX_MDNS_PROBING_RETRANSMIT_COUNT  */
354 
355 
356 /* Define the mDNS's goodbye retransmit count. The defaul value is 1.  */
357 #ifndef NX_MDNS_GOODBYE_RETRANSMIT_COUNT
358 #define NX_MDNS_GOODBYE_RETRANSMIT_COUNT        1
359 #endif /* NX_MDNS_GOODBYE_RETRANSMIT_COUNT  */
360 
361 
362 /* Passive Observation Of Failures.
363    If a host sees queries, for which a record in its cache would be
364    expected to be given as an answer in a multicast response, but no
365    such answer is seen, then the host may take this as an indication
366    that the record may no longer be valid.
367    After seesing NX_MDNS_POOF_MIN_COUNT of these queries, and seeing
368    no multicast response containing the expected answer with in
369    NX_MDNS_POOF_TIMER_COUNT, delete the RR from the cache.
370    RFC6762, Section10.5, Page38.  */
371 
372 /* Define the Passive Observation Of Failures min count. The defaul value is 2.  */
373 #ifndef NX_MDNS_POOF_MIN_COUNT
374 #define NX_MDNS_POOF_MIN_COUNT                  2
375 #endif /* NX_MDNS_POOF_MIN_COUNT  */
376 
377 /* Define the Passive Observation Of Failures timer count, 10 seconds in spec. In tick. */
378 #ifndef NX_MDNS_POOF_TIMER_COUNT
379 #define NX_MDNS_POOF_TIMER_COUNT                (10 * NX_IP_PERIODIC_RATE)
380 #endif /* NX_MDNS_POOF_TIMER_COUNT  */
381 
382 
383 /* Define the RR delete delay timer.  */
384 /* Queriers receiving a Multicast DNS response with a TTL of zero SHOULD
385    NOT immediately delete the record from the cache, but instead record
386    a TTL of 1 and then delete the record one second later. In tick.  */
387 #ifndef NX_MDNS_RR_DELETE_DELAY_TIMER_COUNT
388 #define NX_MDNS_RR_DELETE_DELAY_TIMER_COUNT     NX_IP_PERIODIC_RATE
389 #endif /* NX_MDNS_RR_DELETE_DELAY_TIMER_COUNT  */
390 
391 /* Define the maximum number of pointers allowed in name compression.  */
392 #ifndef NX_MDNS_MAX_COMPRESSION_POINTERS
393 #define NX_MDNS_MAX_COMPRESSION_POINTERS        16
394 #endif /* NX_MDNS_MAX_COMPRESSION_POINTERS  */
395 
396 
397 /* Define the default mDNS's announcing value.  */
398 #define NX_MDNS_ANNOUNCING_PERIOD               NX_IP_PERIODIC_RATE
399 #define NX_MDNS_ANNOUNCING_COUNT                1
400 #define NX_MDNS_ANNOUNCING_FACTOR               1
401 #define NX_MDNS_ANNOUNCING_RETRANS_INTERVAL     0
402 #define NX_MDNS_ANNOUNCING_PERIOD_INTERVAL      0xFFFFFFFF
403 #define NX_MDNS_ANNOUNCING_MAX_TIME             3
404 #define NX_MDNS_ANNOUNCING_FOREVER              0xFF
405 
406 
407 /* Define the max ttl. In second.  */
408 #define NX_MDNS_RR_MAX_TTL                      0xFFFFFFFF/NX_IP_PERIODIC_RATE
409 
410 
411 /* Define the RR update retransmit count.
412    The querier should plan to issure a query at 80%, 85%, 90%, 95% of the record lifetime.  */
413 #define NX_MDNS_RR_UPDATE_COUNT                 4
414 
415 
416 /* Define the Address length.  */
417 #define NX_MDNS_IPV4_ADDRESS_LENGTH             4
418 #define NX_MDNS_IPV6_ADDRESS_LENGTH             16
419 
420 
421 /* Define mDNS event flags.  */
422 #define NX_MDNS_ALL_EVENTS                      ((ULONG) 0xFFFFFFFF)    /* All event flags.                         */
423 #define NX_MDNS_PKT_RX_EVENT                    ((ULONG) 0x00000001)    /* Receive the mDNS packet.                 */
424 #define NX_MDNS_QUERY_SEND_EVENT                ((ULONG) 0x00000002)    /* Send the mDNS Query packet.              */
425 #define NX_MDNS_RESPONSE_SEND_EVENT             ((ULONG) 0x00000004)    /* Send the mDNS Response packet.           */
426 #define NX_MDNS_PROBING_SEND_EVENT              ((ULONG) 0x00000008)    /* Send the mDNS Probing packet.            */
427 #define NX_MDNS_ANNOUNCING_SEND_EVENT           ((ULONG) 0x00000010)    /* Send the mDNS Announcing packet.         */
428 #define NX_MDNS_GOODBYE_SEND_EVENT              ((ULONG) 0x00000020)    /* Send the mDNS Goodbye packet.            */
429 #define NX_MDNS_TIMER_EVENT                     ((ULONG) 0x00000040)    /* Process the mDNS timer event.            */
430 #define NX_MDNS_ADDRESS_CHANGE_EVENT            ((ULONG) 0x00000080)    /* Process the mDNS address change event.   */
431 #define NX_MDNS_RR_ELAPSED_TIMER_EVENT          ((ULONG) 0x00000100)    /* Process the mDNS rr elapsed tiemr event. */
432 
433 
434 /* Define return code constants.  */
435 #define NX_MDNS_SUCCESS                         0x00        /* mDNS Success.                                        */
436 #define NX_MDNS_ERROR                           0xA1        /* mDNS internal error.                                 */
437 #define NX_MDNS_PARAM_ERROR                     0xA2        /* mDNS parameters error.                               */
438 #define NX_MDNS_CACHE_ERROR                     0xA3        /* The Cache size is not enough.                        */
439 #define NX_MDNS_UNSUPPORTED_TYPE                0xA4        /* The unsupported resource record type.                */
440 #define NX_MDNS_DATA_SIZE_ERROR                 0xA5        /* The data size is too big.                            */
441 #define NX_MDNS_AUTH_ERROR                      0xA6        /* Attempting to parse too large a data.                */
442 #define NX_MDNS_PACKET_ERROR                    0xA7        /* The packet can not add the resource record.          */
443 #define NX_MDNS_DEST_ADDRESS_ERROR              0xA9        /* The destination address error.                       */
444 #define NX_MDNS_UDP_PORT_ERROR                  0xB0        /* The udp port error.                                  */
445 #define NX_MDNS_NOT_LOCAL_LINK                  0xB1        /* The message that not originate from the local link.  */
446 #define NX_MDNS_EXCEED_MAX_LABEL                0xB2        /* The data exceed the max laber size.                  */
447 #define NX_MDNS_EXIST_UNIQUE_RR                 0xB3        /* At least one Unqiue record in the cache.             */
448 #define NX_MDNS_EXIST_SHARED_RR                 0xB4        /* At least one shared record in the cache.             */
449 #define NX_MDNS_EXIST_SAME_QUERY                0xB5        /* Exist the same query record in the cache.            */
450 #define NX_MDNS_EXIST_SAME_SERVICE              0xB6        /* Exist the same service.                              */
451 #define NX_MDNS_NO_RR                           0xB7        /* No response for one-shot query.                      */
452 #define NX_MDNS_NO_KNOWN_ANSWER                 0xB8        /* No known answer for query.                           */
453 #define NX_MDNS_NAME_MISMATCH                   0xB9        /* The name mismatch.                                   */
454 #define NX_MDNS_NOT_STARTED                     0xC0        /* mDNS does not start.                                 */
455 #define NX_MDNS_HOST_NAME_ERROR                 0xC1        /* mDNS host name error.                                */
456 #define NX_MDNS_NO_MORE_ENTRIES                 0xC2        /* No more entries be found.                            */
457 #define NX_MDNS_SERVICE_TYPE_MISMATCH           0xC3        /* The service type mismatch                            */
458 #define NX_MDNS_NOT_ENABLED                     0xC4        /* mDNS does not enable.                                */
459 #define NX_MDNS_ALREADY_ENABLED                 0xC5        /* mDNS already enabled.                                */
460 
461 
462 /* Define the local host/service register notify state.  */
463 #define NX_MDNS_LOCAL_HOST_REGISTERED_SUCCESS   1           /* mDNS Server: Local host registered success.          */
464 #define NX_MDNS_LOCAL_HOST_REGISTERED_FAILURE   2           /* mDNS Server: Local host registered failure.          */
465 #define NX_MDNS_LOCAL_SERVICE_REGISTERED_SUCCESS 3          /* mDNS Server: Local service registered success.       */
466 #define NX_MDNS_LOCAL_SERVICE_REGISTERED_FAILURE 4          /* mDNS Server: Local service registered failure.       */
467 
468 /* Define the peer service change notify state.  */
469 #define NX_MDNS_PEER_SERVICE_RECEIVED           1           /* mDNS Client: Peer service received.                  */
470 #define NX_MDNS_PEER_SERVICE_DELETED            2           /* mDNS Client: Peer service deleted.                   */
471 #define NX_MDNS_PEER_SERVICE_UPDATED            3           /* mDNS Client: Peer service address updated.           */
472 
473 /* Define the cache notify state.  */
474 #define NX_MDNS_CACHE_STATE_FULL                1           /* mDNS Cache is full, and cannot fill the RR.          */
475 #define NX_MDNS_CACHE_STATE_FRAGMENTED          2           /* mDNS Cache is fragmented, and cannot fill the RR.    */
476 
477 /* Define cache type.  */
478 #define NX_MDNS_CACHE_TYPE_LOCAL                0           /* Local cache.                                         */
479 #define NX_MDNS_CACHE_TYPE_PEER                 1           /* Peer cache.                                          */
480 
481 
482 /* Define offsets into the DNS message buffer.  */
483 #define NX_MDNS_ID_OFFSET                       0           /* Offset to ID code in DNS buffer                      */
484 #define NX_MDNS_FLAGS_OFFSET                    2           /* Offset to flags in DNS buffer                        */
485 #define NX_MDNS_QDCOUNT_OFFSET                  4           /* Offset to Question Count in DNS buffer               */
486 #define NX_MDNS_ANCOUNT_OFFSET                  6           /* Offset to Answer Count in DNS buffer                 */
487 #define NX_MDNS_NSCOUNT_OFFSET                  8           /* Offset to Authority Count in DNS buffer              */
488 #define NX_MDNS_ARCOUNT_OFFSET                  10          /* Offset to Additional Info. Count in DNS buffer       */
489 #define NX_MDNS_QDSECT_OFFSET                   12          /* Offset to Question Section in DNS buffer             */
490 
491 
492 /* Define constants for the flags word.  */
493 #define NX_MDNS_QUERY_MASK                      0x0000
494 #define NX_MDNS_QUERY_FLAG                      0x0000
495 #define NX_MDNS_RESPONSE_FLAG                   0x8000
496 #define NX_MDNS_ERROR_MASK                      0x000F
497 #define NX_MDNS_TOP_BIT_MASK                    0x7FFF
498 
499 #define NX_MDNS_OPCODE_QUERY                    (0 << 12)   /* Shifted right 12 is still 0                          */
500 #define NX_MDNS_OPCODE_IQUERY                   (1 << 12)   /* 1 shifted right by 12                                */
501 #define NX_MDNS_OPCODE_STATUS                   (2 << 12)   /* 2 shifted right by 12                                */
502 
503 #define NX_MDNS_AA_FLAG                         0x0400      /* Authoritative Answer                                 */
504 #define NX_MDNS_TC_FLAG                         0x0200      /* Truncated                                            */
505 #define NX_MDNS_RD_FLAG                         0x0100      /* Recursive Query                                      */
506 #define NX_MDNS_RA_FLAG                         0x0080      /* Recursion Available                                  */
507 #define NX_MDNS_FA_FLAG                         0x0010      /* Force Authentication                                 */
508 
509 /* Define name compression masks.  */
510 #define NX_MDNS_COMPRESS_MASK                   0xc0
511 #define NX_MDNS_COMPRESS_VALUE                  0xc0
512 #define NX_MDNS_POINTER_MASK                    0xc000
513 
514 /* Define resource record types.  */
515 #define NX_MDNS_RR_TYPE_A                       1           /* Host address                                         */
516 #define NX_MDNS_RR_TYPE_NS                      2           /* Authoritative name server                            */
517 #define NX_MDNS_RR_TYPE_MD                      3           /* Mail destination (Obsolete - use MX)                 */
518 #define NX_MDNS_RR_TYPE_MF                      4           /* Mail forwarder (Obsolete - use MX)                   */
519 #define NX_MDNS_RR_TYPE_CNAME                   5           /* Canonical name for an alias                          */
520 #define NX_MDNS_RR_TYPE_SOA                     6           /* Marks the start of a zone of authority               */
521 #define NX_MDNS_RR_TYPE_MB                      7           /* Mailbox domain name (EXPERIMENTAL)                   */
522 #define NX_MDNS_RR_TYPE_MG                      8           /* Mail group member (EXPERIMENTAL)                     */
523 #define NX_MDNS_RR_TYPE_MR                      9           /* Mail rename domain name (EXPERIMENTAL)               */
524 #define NX_MDNS_RR_TYPE_NULL                    10          /* Null RR (EXPERIMENTAL)                               */
525 #define NX_MDNS_RR_TYPE_WKS                     11          /* Well known service description                       */
526 #define NX_MDNS_RR_TYPE_PTR                     12          /* Domain name pointer                                  */
527 #define NX_MDNS_RR_TYPE_HINFO                   13          /* Host information                                     */
528 #define NX_MDNS_RR_TYPE_MINFO                   14          /* Mailbox or mail list information                     */
529 #define NX_MDNS_RR_TYPE_MX                      15          /* Mail exchange                                        */
530 #define NX_MDNS_RR_TYPE_TXT                     16          /* Text strings                                         */
531 #define NX_MDNS_RR_TYPE_AAAA                    28          /* IPv6 Host address                                    */
532 #define NX_MDNS_RR_TYPE_SRV                     33          /* The location of services                             */
533 #define NX_MDNS_RR_TYPE_NSEC                    47          /* The type of NSEC RR.                                 */
534 
535 
536 /* Define constants for Qtypes (queries).  */
537 #define NX_MDNS_RR_TYPE_AXFR                    252         /* Request for a transfer of an entire zone             */
538 #define NX_MDNS_RR_TYPE_MAILB                   253         /* Request for mailbox-related records (MB, MG or MR)   */
539 #define NX_MDNS_RR_TYPE_MAILA                   254         /* Request for mail agent RRs (Obsolete - see MX)       */
540 #define NX_MDNS_RR_TYPE_ALL                     255         /* Request for all records                              */
541 
542 
543 /* Define resource record classes.  */
544 #define NX_MDNS_RR_CLASS_IN                     1           /* Internet                                             */
545 #define NX_MDNS_RR_CLASS_CS                     2           /* CSNET class (Obsolete)                               */
546 #define NX_MDNS_RR_CLASS_CH                     3           /* CHAOS class                                          */
547 #define NX_MDNS_RR_CLASS_HS                     4           /* Hesiod [Dyer 87]                                     */
548 #define NX_MDNS_RR_CLASS_ALL                    255         /* Any class                                            */
549 #define NX_MDNS_RR_CLASS_TOP_BIT                0x8000      /* The top bit of class.                                */
550 
551 
552 /* Define the resource record state value.  */
553 #define NX_MDNS_RR_STATE_INVALID                0           /* Invalid resource records.                            */
554 #define NX_MDNS_RR_STATE_PROBING                1           /* mDNS Server probing the resource records.            */
555 #define NX_MDNS_RR_STATE_ANNOUNCING             2           /* mDNS Server announcing the resource records.         */
556 #define NX_MDNS_RR_STATE_GOODBYE                3           /* mDNS Server send the Goodbye.                        */
557 #define NX_MDNS_RR_STATE_SUSPEND                4           /* mDNS Server suspend the resource record.             */
558 #define NX_MDNS_RR_STATE_QUERY                  5           /* mDNS Client send the initial query.                  */
559 #define NX_MDNS_RR_STATE_UPDATING               6           /* mDNS Client send the query to update the RR.         */
560 #define NX_MDNS_RR_STATE_DELETE                 7           /* mDNS Client delete the resource records.             */
561 #define NX_MDNS_RR_STATE_POOF_DELETE            8           /* mDNS Client delete the resource records by Passive Observation Of Failures.*/
562 #define NX_MDNS_RR_STATE_VALID                  9           /* Valid resource records.                              */
563 
564 
565 /* Define the sending type of resource records.  */
566 #define NX_MDNS_RR_SEND_FLAG_CLEAR              0x00        /* Response should not send the Resource records.       */
567 #define NX_MDNS_RR_SEND_MULTICAST               0x01        /* Send the Resource records via multicast.             */
568 #define NX_MDNS_RR_SEND_UNICAST                 0x02        /* Send the Resource records via unicast.               */
569 #define NX_MDNS_RR_SEND_FLAG_MASK               0xF0        /* The mask of send flag.                               */
570 
571 
572 /* Define resource record owner.  */
573 #define NX_MDNS_RR_OWNER_LOCAL                  0           /* Local Resource records.                              */
574 #define NX_MDNS_RR_OWNER_REMOTE                 1           /* Remote Resource records.                             */
575 
576 
577 /* Define resource record set.  */
578 #define NX_MDNS_RR_SET_SHARED                   0           /* Shared Resource records.                             */
579 #define NX_MDNS_RR_SET_UNIQUE                   1           /* Unique Resource records.                             */
580 
581 
582 /* Define the resource record state mask.  */
583 #define NX_MDNS_RR_FLAG_PEER                    0x0001      /* RR owner flag.                                       */
584 #define NX_MDNS_RR_FLAG_UNIQUE                  0x0002      /* RR set flag.                                         */
585 #define NX_MDNS_RR_FLAG_CONTINUOUS_QUERY        0x0004      /* RR query type flag.                                  */
586 #define NX_MDNS_RR_FLAG_DUPLICATE_QUERY         0x0008      /* RR duplicate query flag.                             */
587 #define NX_MDNS_RR_FLAG_ADDITIONAL              0x0010      /* RR additional flag.                                  */
588 #define NX_MDNS_RR_FLAG_UPDATING                0x0020      /* RR updating flag.                                    */
589 #define NX_MDNS_RR_FLAG_DELETE                  0x0040      /* RR delete flag.                                      */
590 #define NX_MDNS_RR_FLAG_ANSWER                  0x0080      /* RR answer flag.                                      */
591 #define NX_MDNS_RR_FLAG_KNOWN_ANSWER            0x0100      /* RR known answer flag.                                */
592 #define NX_MDNS_RR_FLAG_AUTHORIY_ANSWER         0x0200      /* RR authority answer flag.                            */
593 
594 
595 /* Define the type to search the same resource record.  */
596 #define NX_MDNS_RR_MATCH_ALL                    1           /* Match all data: name, type, class, rdata.            */
597 #define NX_MDNS_RR_MATCH_EXCEPT_RDATA           2           /* Match the name, type, class, except rdata.           */
598 
599 
600 /* Define the type to set/add the resource record in cache from packet.  */
601 #define NX_MDNS_RR_OP_LOCAL_SET_QUESTION        0           /* Set resource record question in local cache.         */
602 #define NX_MDNS_RR_OP_LOCAL_SET_ANSWER          1           /* Set resource record answer in local cache.           */
603 #define NX_MDNS_RR_OP_PEER_SET_QUESTION         2           /* Set resource record question in peer cache.          */
604 #define NX_MDNS_RR_OP_PEER_ADD_ANSWER           3           /* Add resource record answer in peer cache.            */
605 
606 
607 /* Define the type for adding question/answer RR into the packet.  */
608 #define NX_MDNS_PACKET_ADD_RR_QUESTION          1           /* Add the question resource record into packet.        */
609 #define NX_MDNS_PACKET_ADD_RR_ANSWER            2           /* Add the answer resource record into packet.          */
610 
611 
612 /* Define mDNS packet type.  */
613 #define NX_MDNS_PACKET_QUERY                    1           /* Query packet.                                        */
614 #define NX_MDNS_PACKET_PROBING                  2           /* Probing packet. Is specific query.                   */
615 #define NX_MDNS_PACKET_RESPONSE                 3           /* Response packet.                                     */
616 
617 
618 /* Define the Add NSEC type.  */
619 #define NX_MDNS_ADD_NSEC_FOR_HOST               0           /* Add the NSEC for host name.                          */
620 #define NX_MDNS_ADD_NSEC_FOR_SERVICE            1           /* Add the NSEC for service.                            */
621 
622 
623 /* Define the RDATA structure.  */
624 
625 /* A RDATA format
626       0                             1
627       0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
628     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
629     |                     ADDRESS                   |
630     |                                               |
631     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
632 */
633 
634 typedef struct NX_MDNS_RR_A_STRUCT
635 {
636     ULONG           nx_mdns_rr_a_address;
637 } NX_MDNS_RR_A;
638 
639 
640 /* NS RDATA format
641       0                             1
642       0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
643     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
644     /                     NSDNAME                   /
645     /                                               /
646     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
647 */
648 
649 typedef struct NX_MDNS_RR_NS_STRUCT
650 {
651     UCHAR*          nx_mdns_rr_ns_name;
652 } NX_MDNS_RR_NS;
653 
654 /* MD RDATA format
655       0                             1
656       0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
657     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
658     /                     MADNAME                   /
659     /                                               /
660     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
661 */
662 
663 typedef struct NX_MDNS_RR_MD_STRUCT
664 {
665     UCHAR*          nx_mdns_rr_md_name;
666 } NX_MDNS_RR_MD;
667 
668 /* MF RDATA format
669       0                             1
670       0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
671     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
672     /                     MADNAME                   /
673     /                                               /
674     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
675 */
676 
677 typedef struct NX_MDNS_RR_MF_STRUCT
678 {
679     UCHAR*          nx_mdns_rr_mf_name;
680 } NX_MDNS_RR_MF;
681 
682 /* CNMAE RDATA format
683       0                             1
684       0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
685     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
686     /                     CNAME                     /
687     /                                               /
688     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
689 */
690 
691 typedef struct NX_MDNS_RR_CNAME_STRUCT
692 {
693     UCHAR*          nx_mdns_rr_cname_name;
694 } NX_MDNS_RR_CNAME;
695 
696 /* SOA RDATA format
697       0                             1
698       0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
699     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
700     /                     MNAME                     /
701     /                                               /
702     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
703     /                     RNAME                     /
704     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
705     |                     SERIAL                    |
706     |                                               |
707     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
708     |                     REFRESH                   |
709     |                                               |
710     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
711     |                     RETRY                     |
712     |                                               |
713     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
714     |                     EXPIRE                    |
715     |                                               |
716     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
717     |                     MINMUM                    |
718     |                                               |
719     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
720 */
721 
722 typedef struct NX_MDNS_RR_SOA_STRUCT
723 {
724     UCHAR*          nx_mdns_rr_soa_mname;
725     UCHAR*          nx_mdns_rr_soa_rname;
726     ULONG           nx_mdns_rr_soa_serial;
727     ULONG           nx_mdns_rr_soa_refresh;
728     ULONG           nx_mdns_rr_soa_retry;
729     ULONG           nx_mdns_rr_soa_expire;
730     ULONG           nx_mdns_rr_soa_minmum;
731 } NX_MDNS_RR_SOA;
732 
733 /* MB RDATA format
734       0                             1
735       0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
736     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
737     /                     MADNAME                   /
738     /                                               /
739     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
740 */
741 
742 typedef struct NX_MDNS_RR_MB_STRUCT
743 {
744     UCHAR*          nx_mdns_rr_mb_name;
745 } NX_MDNS_RR_MB;
746 
747 /* MG RDATA format
748       0                             1
749       0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
750     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
751     /                     MGMNAME                   /
752     /                                               /
753     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
754 */
755 
756 typedef struct NX_MDNS_RR_MG_STRUCT
757 {
758     UCHAR*          nx_mdns_rr_mg_name;
759 } NX_MDNS_RR_MG;
760 
761 /* MR RDATA format
762       0                             1
763       0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
764     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
765     /                     NEWNAME                   /
766     /                                               /
767     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
768 */
769 
770 typedef struct NX_MDNS_RR_MR_STRUCT
771 {
772     UCHAR*          nx_mdns_rr_mr_name;
773 } NX_MDNS_RR_MR;
774 
775 /* NULL RDATA format
776       0                             1
777       0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
778     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
779     /                   <anything>                  /
780     /                                               /
781     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
782 */
783 
784 typedef struct NX_MDNS_RR_NULL_STRUCT
785 {
786     UCHAR*          nx_mdns_rr_null_ptr;
787 } NX_MDNS_RR_NULL;
788 
789 /* WKS RDATA format
790       0                             1
791       0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
792     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
793     |                     ADDRESS                   |
794     |                                               |
795     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
796     |      PROTOCOL         |                       |
797     |--+--+--+--+--+--+--+--+                       |
798     /                   <BIT MAP>                   /
799     /                                               /
800     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
801 */
802 
803 typedef struct NX_MDNS_RR_WKS_STRUCT
804 {
805     ULONG           nx_mdns_rr_wks_address;
806     UCHAR           nx_mdns_rr_wks_protocol;
807     UCHAR           nx_mdns_rr_wks_reserved[3];
808     UCHAR*          nx_mdns_rr_wks_bit_map;
809 } NX_MDNS_RR_WKS;
810 
811 /* PTR RDATA format
812       0                             1
813       0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
814     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
815     /                     PTRDNAME                  /
816     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
817 */
818 
819 typedef struct NX_MDNS_RR_PTR_STRUCT
820 {
821     UCHAR*          nx_mdns_rr_ptr_name;
822 } NX_MDNS_RR_PTR;
823 
824 /* HINFO RDATA format
825       0                             1
826       0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
827     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
828     /                     CPU                       /
829     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
830     /                     OS                        /
831     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
832 */
833 
834 typedef struct NX_MDNS_RR_HINFO_STRUCT
835 {
836     UCHAR*          nx_mdns_rr_hinfo_cpu;
837     UCHAR*          nx_mdns_rr_hinfo_os;
838 } NX_MDNS_RR_HINFO;
839 
840 /* MINFO RDATA format
841       0                             1
842       0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
843     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
844     /                     RMAILBX                   /
845     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
846     /                     EMAILBX                   /
847     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
848 */
849 
850 typedef struct NX_MDNS_RR_MINFO_STRUCT
851 {
852     UCHAR*          nx_mdns_rr_minfo_cpu;
853     UCHAR*          nx_mdns_rr_minfo_os;
854 } NX_MDNS_RR_MINFO;
855 
856 /* MX RDATA format
857       0                             1
858       0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
859     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
860     |                     PREFERENCE                |
861     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
862     /                     NEWNAME                   /
863     /                                               /
864     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
865 */
866 
867 typedef struct NX_MDNS_RR_MX_STRUCT
868 {
869     UCHAR*          nx_mdns_rr_mx_name;
870     USHORT          nx_mdns_rr_mx_preference;
871     USHORT          nx_mdns_rr_mx_reserved;
872 } NX_MDNS_RR_MX;
873 
874 /* TXT RDATA format
875       0                             1
876       0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
877     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
878     /                     TXT-DATA                  /
879     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
880 */
881 
882 typedef struct NX_MDNS_RR_TXT_STRUCT
883 {
884     UCHAR*          nx_mdns_rr_txt_data;
885 } NX_MDNS_RR_TXT;
886 
887 /* AAAA RDATA format
888       0                             1
889       0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
890     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
891     |                                               |
892     |                                               |
893     |                                               |
894     |                   IPv6 ADDRESS                |
895     |                                               |
896     |                                               |
897     |                                               |
898     |                                               |
899     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
900 */
901 
902 typedef struct NX_MDNS_RR_AAAA_STRUCT
903 {
904     ULONG           nx_mdns_rr_aaaa_address[4];
905 } NX_MDNS_RR_AAAA;
906 
907 /* SRV RDATA format
908       0                             1
909       0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
910     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
911     |                     PRIORITY                  |
912     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
913     |                     WEIGHTS                   |
914     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
915     |                     PORT                      |
916     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
917     /                     TARGET                    /
918     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
919 */
920 
921 typedef struct NX_MDNS_RR_SRV_STRUCT
922 {
923     UCHAR*          nx_mdns_rr_srv_target;
924     USHORT          nx_mdns_rr_srv_priority;
925     USHORT          nx_mdns_rr_srv_weights;
926     USHORT          nx_mdns_rr_srv_port;
927     USHORT          nx_mdns_rr_srv_reserved;
928 } NX_MDNS_RR_SRV;
929 
930 
931 /* NSEC RDATA format
932       0                             1
933       0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
934     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
935     /                Next Domain Name               /
936     /                                               /
937     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
938     /                Type Bit Maps                  /
939     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
940 */
941 
942 typedef struct NX_MDNS_RR_NSEC_STRUCT
943 {
944     UCHAR*          nx_mdns_rr_nsec_next_domain;
945     UCHAR           nx_mdns_rr_nsec_window_block;
946     UCHAR           nx_mdns_rr_nsec_bitmap_length;
947     UCHAR           nx_mdns_rr_nsec_bitmap[5];          /* Can match the max rr type 6 * 7 = 42.  */
948     UCHAR           nx_mdns_rr_nsec_additional_send;    /* 0 indicate answer, 1 indicate additional.  */
949 } NX_MDNS_RR_NSEC;
950 
951 
952 /* RR definitions. RFC1035.  */
953 /* RR Format.
954       0                             1
955       0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
956     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
957     |                                               |
958     /                      NAME                     /
959     /                                               /
960     |                                               |
961     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
962     |                      TYPE                     |
963     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
964     |                      CLASS                    |
965     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
966     |                      TTL                      |
967     |                                               |
968     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
969     |                      RDLENGTH                 |
970     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
971     /                      RDATA                    /
972     /                                               /
973     |--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
974 */
975 
976 /* The following data structure is used to store the resource records(RRs). */
977 typedef struct NX_MDNS_RR_STRUCT
978 {
979 
980     UCHAR*  nx_mdns_rr_name;                    /* Owner's name,i.e., the name of the node to
981                                                    which this resource record pertains.                                 */
982 
983     USHORT  nx_mdns_rr_type;                    /* RR TYPE.                                                             */
984 
985     USHORT  nx_mdns_rr_class;                   /* RR CLASS.                                                            */
986 
987     ULONG   nx_mdns_rr_ttl;                     /* The time interval that the RR may be cached before the source of
988                                                    the information should again be consulted.                           */
989 
990     USHORT  nx_mdns_rr_rdata_length;            /* The length of rdata. nx_mdns_rr_rdata                                */
991 
992     UCHAR   nx_mdns_rr_state;                   /* The resource records state, Probing, Annoncing, Valid.               */
993 
994     UCHAR   nx_mdns_rr_retransmit_count;        /* Define the count for the retransmit the RR.                          */
995 
996     ULONG   nx_mdns_rr_retransmit_lifetime;     /* Define the lifetime for retransmit the RR.                           */
997 
998     ULONG   nx_mdns_rr_timer_count;             /* Define the timer count for the retransmit the RR.                    */
999 
1000     ULONG   nx_mdns_rr_elapsed_time;            /* Define the time elasped for the peer RR.                             */
1001 
1002     ULONG   nx_mdns_rr_remaining_ticks;         /* Define the remaining ticks of the peer RR.                           */
1003 
1004     ULONG   nx_mdns_rr_response_interval;       /* Define the time interval for two responses. Local RR.                */
1005 
1006     UCHAR   nx_mdns_rr_interface_index;         /* RR interface index.                                                  */
1007 
1008     UCHAR   nx_mdns_rr_announcing_max_time;     /* RR announcing max time. Local RR.                                    */
1009 
1010     UCHAR   nx_mdns_rr_conflict_count;          /* The conflict count of service name or host name. Local RR.           */
1011 
1012     UCHAR   nx_mdns_rr_poof_count;              /* The Passive Observation Of Failures count of resource record. Peer RR.*/
1013 
1014     UCHAR   nx_mdns_rr_count;                   /* The count of same _services._dns-sd._udp.local PTR resource reocrd.  */
1015 
1016     UCHAR   nx_mdns_rr_send_flag;               /* The flag for seding resource record.                                 */
1017 
1018     USHORT  nx_mdns_rr_word;
1019 
1020     /* Define the state, owner, flag, set of the resource records. This word contains
1021        the following information:
1022 
1023             bits 0      RR Owner, the owner of resource record,
1024                         0 indicates local RR, 1 indicates peer RR.
1025             bits 1      RR Set, the set of resource record,
1026                         0 indicates shared RR, 1 indicates unique RR.
1027             bits 2      RR query type, the query type of resource record,
1028                         0 indicates query the RR use One-shot method, 1 indicates query the RR use Continuous method.
1029             bits 3      RR additional flag, send this resource record as the additional RR.
1030             bits 4      RR query duplicate flag, this resource record is the duplicate quesiton.
1031             bits 5      RR updating flag, this resource record need to be maintenance.
1032             bits 6      RR delete flag, this resource record need to be deleted.
1033             bits 7      RR answer flag, this resource record has been added in answer section.
1034             bits 8      RR known answer flag, send this resource record as the known answer.
1035             bits 9      RR authority answer flag, send this resource record as the authority answer.
1036     */
1037 
1038     /* Union that holds resource record data. */
1039     union   nx_mdns_rr_rdata_union
1040     {
1041         NX_MDNS_RR_A        nx_mdns_rr_rdata_a;
1042         NX_MDNS_RR_AAAA     nx_mdns_rr_rdata_aaaa;
1043         NX_MDNS_RR_PTR      nx_mdns_rr_rdata_ptr;
1044         NX_MDNS_RR_SRV      nx_mdns_rr_rdata_srv;
1045         NX_MDNS_RR_TXT      nx_mdns_rr_rdata_txt;
1046 
1047 #ifdef NX_MDNS_ENABLE_SERVER_NEGATIVE_RESPONSES
1048         NX_MDNS_RR_NSEC     nx_mdns_rr_rdata_nsec;
1049 #endif /* NX_MDNS_ENABLE_SERVER_NEGATIVE_RESPONSES  */
1050 
1051 #ifdef NX_MDNS_ENABLE_EXTENDED_RR_TYPES
1052         NX_MDNS_RR_CNAME    nx_mdns_rr_rdata_cname;
1053         NX_MDNS_RR_NS       nx_mdns_rr_rdata_ns;
1054         NX_MDNS_RR_MX       nx_mdns_rr_rdata_mx;
1055 #endif /* NX_MDNS_ENABLE_EXTENDED_RR_TYPES  */
1056     } nx_mdns_rr_rdata;
1057 
1058 }NX_MDNS_RR;
1059 
1060 /* Buffer usage. */
1061 /*
1062 
1063     |-----------+-----------+-----------+-----------+-----------+------------+-----------+------------+------------|
1064     |   HEAD    |NX_MDNS_RR |NX_MDNS_RR | ..........|  STRING   | CNT | LEN  |  STRING   | CNT | LEN  |    TAIL    |
1065     |-----------+-----------+-----------+-----------+-----------+------------+-----------+------------+------------|
1066 
1067     HEAD: First unused memory at the front of cache. The size is 4 bytes.
1068     NX_MDNS_RR: The Resource Record struct, the size is sizeof(NX_MDNS_RR).
1069     TAIL: It points to the last used memory at the back of cache. Its size is 4 bytes.
1070     LEN: It is the length of STRING, plus the CNT and LEN fields. This field takes 2 bytes.
1071     CNT: It is the reference count of STRING. It takes 2 bytes.
1072     STRING: The content of name string and rdata string, must be null-terminated. Padded with 0s to be 4 byte aligned.
1073 */
1074 
1075 
1076 /* Define the Service structure.  */
1077 typedef struct NX_MDNS_SERVICE_STRUCT
1078 {
1079 
1080     UCHAR*                  service_name;           /* Service instance.                                    */
1081 
1082     UCHAR*                  service_type;           /* Service type.                                        */
1083 
1084     UCHAR*                  service_domain;         /* Service domain.                                      */
1085 
1086     UCHAR                   service_text[NX_MDNS_NAME_MAX+1];       /* Service txt information.             */
1087 
1088     UCHAR                   service_host[NX_MDNS_HOST_NAME_MAX + 1];    /* The target host of the service.  */
1089 
1090     USHORT                  service_port;           /* Service port.                                        */
1091 
1092     USHORT                  service_weight;         /* Service weight.                                      */
1093 
1094     USHORT                  service_priority;       /* Service priority.                                    */
1095 
1096     UCHAR                   interface_index;        /* Service interface idnex.                             */
1097 
1098     UCHAR                   service_text_valid;     /* Flag indicating text fields are valid.               */
1099 
1100     ULONG                   service_ipv4;           /* The IPv4 address for service.                        */
1101 
1102     ULONG                   service_ipv6[NX_MDNS_IPV6_ADDRESS_COUNT][4];    /* The IPv6 address for service.*/
1103 
1104     UCHAR                   buffer[NX_MDNS_NAME_MAX+1]; /* The buffer for service instance, type and domain.*/
1105 
1106 } NX_MDNS_SERVICE;
1107 
1108 
1109 /* Define the basic Multicast DNS data structure.  */
1110 
1111 typedef struct NX_MDNS_STRUCT
1112 {
1113     ULONG                   nx_mdns_id;             /* Multicast DNS ID.                                    */
1114 
1115     NX_IP*                  nx_mdns_ip_ptr;         /* Pointer to associated IP structure.                  */
1116 
1117     NX_UDP_SOCKET           nx_mdns_socket;         /* Multicast DNS Socket.                                */
1118 
1119     TX_MUTEX                nx_mdns_mutex;          /* Multicast DNS Mutex.                                 */
1120 
1121     TX_TIMER                nx_mdns_timer;          /* Multicast DNS TIMER.                                 */
1122 
1123     TX_THREAD               nx_mdns_thread;         /* Multicast DNS processing thread.                     */
1124 
1125     TX_EVENT_FLAGS_GROUP    nx_mdns_events;         /* Multicast DNS event.                                 */
1126 
1127     NX_PACKET_POOL*         nx_mdns_packet_pool_ptr;    /* Pointer to the packet pool.                      */
1128 
1129     UCHAR                   nx_mdns_host_name[NX_MDNS_HOST_NAME_MAX];   /* The Embedded Device name supplied at create.  */
1130 
1131     UCHAR                   nx_mdns_domain_name[NX_MDNS_DOMAIN_NAME_MAX + 1];   /* The mDNS domain name.    */
1132 
1133     UINT                    nx_mdns_interface_enabled[NX_MAX_PHYSICAL_INTERFACES];  /* Interface enable status. */
1134 
1135 #ifdef NX_MDNS_ENABLE_IPV6
1136     UINT                    nx_mdns_ipv6_address_index[NX_MAX_PHYSICAL_INTERFACES]; /* IPv6 link local address index.   */
1137 #endif /* NX_MDNS_ENABLE_IPV6  */
1138 
1139     /* Define the UDP receive suspension list head associated with a count of
1140        how many threads are suspended attempting to receive from the same TCP port.  */
1141     TX_THREAD*              nx_mdns_rr_receive_suspension_list;                 /* The suspended thread.    */
1142 
1143     ULONG                   nx_mdns_rr_receive_suspended_count;                 /* The suspended count.     */
1144 
1145     UCHAR*                  nx_mdns_local_service_cache;        /* Pointer to the cache.                    */
1146 
1147     UINT                    nx_mdns_local_service_cache_size;   /* The size of cache.                       */
1148 
1149     UCHAR*                  nx_mdns_peer_service_cache;         /* Pointer to the cache.                    */
1150 
1151     UINT                    nx_mdns_peer_service_cache_size;    /* The size of cache.                       */
1152 
1153     ULONG                   nx_mdns_service_ignore_mask;        /* The mask specifying services types to be ignored.                        */
1154 
1155     ULONG                   nx_mdns_service_notify_mask;        /* The service mask for listen the service and notify the applicaiton.      */
1156 
1157     ULONG                   nx_mdns_timer_min_count;            /* The minimum timer count indicate the intervals between last timer event and next timer event. */
1158 
1159     USHORT                  nx_mdns_announcing_period;          /* Number of ticks for the initial period. Default value is 1 second.       */
1160 
1161     USHORT                  nx_mdns_announcing_retrans_interval;    /* Number of ticks to wait ticks before sending out repeated announcement message. */
1162 
1163     ULONG                   nx_mdns_announcing_period_interval;     /* Number of ticks between two announcing period.                       */
1164 
1165     UCHAR                   nx_mdns_announcing_count;           /* Number of repetitions between one announcing period. Default value is 1. */
1166 
1167     UCHAR                   nx_mdns_announcing_factor;          /* Telescopic factor, default value is 0. 2^k.                              */
1168 
1169     UCHAR                   nx_mdns_announcing_max_time;        /* Max time of Announcing period, default value is 3.                       */
1170 
1171     UCHAR                   nx_mdns_started;                    /* mDNS task has been started.                                              */
1172 
1173     ULONG                   nx_mdns_local_rr_count;             /* The number of resource records in the local cache.                       */
1174 
1175     ULONG                   nx_mdns_local_string_count;         /* The number of strings in the local cache.                                */
1176 
1177     ULONG                   nx_mdns_local_string_bytes;         /* The number of total bytes in string table in the local cache.            */
1178 
1179     ULONG                   nx_mdns_peer_rr_count;              /* The number of resource records in the peer cache.                        */
1180 
1181     ULONG                   nx_mdns_peer_string_count;          /* The number of strings in the peer cache.                                 */
1182 
1183     ULONG                   nx_mdns_peer_string_bytes;          /* The number of total bytes in string table in the peer cache.             */
1184 
1185     ULONG                   nx_mdns_first_probing_delay;        /* The delay of first probing for unique RR.                                */
1186 
1187     VOID                    (*nx_mdns_probing_notify)(struct NX_MDNS_STRUCT *, UCHAR *, UINT);
1188 
1189     VOID                    (*nx_mdns_service_change_notify)(struct NX_MDNS_STRUCT *, struct NX_MDNS_SERVICE_STRUCT *, UINT);
1190 
1191     VOID                    (*nx_mdns_cache_full_notify)(struct NX_MDNS_STRUCT *, UINT, UINT);
1192 
1193 } NX_MDNS;
1194 
1195 
1196 #ifndef NX_MDNS_SOURCE_CODE
1197 
1198 /* Application caller is present, perform API mapping.  */
1199 
1200 /* Determine if error checking is desired. If so, map mDNS API functions
1201    to the appropriate error checking front-ends.  Otherwise, map API
1202    functions to the core functions that actually perform the work.
1203    Note: error checking is enabled by default.  */
1204 
1205 #ifdef NX_DISABLE_ERROR_CHECKING
1206 
1207 /* Services without error checking.  */
1208 
1209 #define nx_mdns_create                          _nx_mdns_create
1210 #define nx_mdns_delete                          _nx_mdns_delete
1211 #define nx_mdns_enable                          _nx_mdns_enable
1212 #define nx_mdns_disable                         _nx_mdns_disable
1213 #define nx_mdns_cache_notify_set                _nx_mdns_cache_notify_set
1214 #define nx_mdns_cache_notify_clear              _nx_mdns_cache_notify_clear
1215 #define nx_mdns_domain_name_set                 _nx_mdns_domain_name_set
1216 
1217 #ifndef NX_MDNS_DISABLE_SERVER
1218 #define nx_mdns_service_announcement_timing_set _nx_mdns_service_announcement_timing_set
1219 #define nx_mdns_service_add                     _nx_mdns_service_add
1220 #define nx_mdns_service_delete                  _nx_mdns_service_delete
1221 #define nx_mdns_local_cache_clear               _nx_mdns_local_cache_clear
1222 #endif /* NX_MDNS_DISABLE_SERVER  */
1223 
1224 #ifndef NX_MDNS_DISABLE_CLIENT
1225 #define nx_mdns_service_one_shot_query          _nx_mdns_service_one_shot_query
1226 #define nx_mdns_service_continuous_query        _nx_mdns_service_continuous_query
1227 #define nx_mdns_service_query_stop              _nx_mdns_service_query_stop
1228 #define nx_mdns_service_lookup                  _nx_mdns_service_lookup
1229 #define nx_mdns_service_ignore_set              _nx_mdns_service_ignore_set
1230 #define nx_mdns_service_notify_set              _nx_mdns_service_notify_set
1231 #define nx_mdns_service_notify_clear            _nx_mdns_service_notify_clear
1232 #define nx_mdns_host_address_get                _nx_mdns_host_address_get
1233 #define nx_mdns_peer_cache_clear                _nx_mdns_peer_cache_clear
1234 #endif /* NX_MDNS_DISABLE_CLIENT  */
1235 
1236 #else
1237 
1238 #define nx_mdns_create                          _nxe_mdns_create
1239 #define nx_mdns_delete                          _nxe_mdns_delete
1240 #define nx_mdns_enable                          _nxe_mdns_enable
1241 #define nx_mdns_disable                         _nxe_mdns_disable
1242 #define nx_mdns_cache_notify_set                _nxe_mdns_cache_notify_set
1243 #define nx_mdns_cache_notify_clear              _nxe_mdns_cache_notify_clear
1244 #define nx_mdns_domain_name_set                 _nxe_mdns_domain_name_set
1245 
1246 #ifndef NX_MDNS_DISABLE_SERVER
1247 #define nx_mdns_service_announcement_timing_set _nxe_mdns_service_announcement_timing_set
1248 #define nx_mdns_service_add                     _nxe_mdns_service_add
1249 #define nx_mdns_service_delete                  _nxe_mdns_service_delete
1250 #define nx_mdns_local_cache_clear               _nxe_mdns_local_cache_clear
1251 #endif /* NX_MDNS_DISABLE_SERVER  */
1252 
1253 #ifndef NX_MDNS_DISABLE_CLIENT
1254 #define nx_mdns_service_one_shot_query          _nxe_mdns_service_one_shot_query
1255 #define nx_mdns_service_continuous_query        _nxe_mdns_service_continuous_query
1256 #define nx_mdns_service_query_stop              _nxe_mdns_service_query_stop
1257 #define nx_mdns_service_lookup                  _nxe_mdns_service_lookup
1258 #define nx_mdns_service_ignore_set              _nxe_mdns_service_ignore_set
1259 #define nx_mdns_service_notify_set              _nxe_mdns_service_notify_set
1260 #define nx_mdns_service_notify_clear            _nxe_mdns_service_notify_clear
1261 #define nx_mdns_host_address_get                _nxe_mdns_host_address_get
1262 #define nx_mdns_peer_cache_clear                _nxe_mdns_peer_cache_clear
1263 #endif /* NX_MDNS_DISABLE_CLIENT  */
1264 
1265 #endif  /* NX_DISABLE_ERROR_CHECKING */
1266 
1267 #endif   /* NX_MDNS_SOURCE_CODE */
1268 
1269 
1270 /* Define Thread function prototypes.  */
1271 UINT        _nx_mdns_create(NX_MDNS *mdns_ptr, NX_IP *ip_ptr, NX_PACKET_POOL *packet_pool,
1272                             UINT priority, VOID *stack_ptr, ULONG stack_size, UCHAR *host_name,
1273                             VOID *local_cache_ptr, UINT local_cache_size,
1274                             VOID *peer_cache_ptr, UINT peer_cache_size,
1275                             VOID (*probing_notify)(NX_MDNS *mdns_ptr, UCHAR *name, UINT probing_state));
1276 UINT        _nxe_mdns_create(NX_MDNS *mdns_ptr, NX_IP *ip_ptr, NX_PACKET_POOL *packet_pool,
1277                              UINT priority, VOID *stack_ptr, ULONG stack_size, UCHAR *host_name,
1278                              VOID *local_cache_ptr, UINT local_cache_size,
1279                              VOID *peer_cache_ptr, UINT peer_cache_size,
1280                              VOID (*probing_notify)(NX_MDNS *mdns_ptr, UCHAR *name, UINT probing_state));
1281 UINT        _nx_mdns_delete(NX_MDNS *mdns_ptr);
1282 UINT        _nxe_mdns_delete(NX_MDNS *mdns_ptr);
1283 UINT        _nx_mdns_enable(NX_MDNS *mdns_ptr, UINT interface_index);
1284 UINT        _nxe_mdns_enable(NX_MDNS *mdns_ptr, UINT interface_index);
1285 UINT        _nx_mdns_disable(NX_MDNS *mdns_ptr, UINT interface_index);
1286 UINT        _nxe_mdns_disable(NX_MDNS *mdns_ptr, UINT interface_index);
1287 UINT        _nx_mdns_cache_notify_set(NX_MDNS *mdns_ptr, VOID (*cache_full_notify_cb)(NX_MDNS *mdns_ptr, UINT state, UINT cache_type));
1288 UINT        _nxe_mdns_cache_notify_set(NX_MDNS *mdns_ptr, VOID (*cache_full_notify_cb)(NX_MDNS *mdns_ptr, UINT state, UINT cache_type));
1289 UINT        _nx_mdns_cache_notify_clear(NX_MDNS *mdns_ptr);
1290 UINT        _nxe_mdns_cache_notify_clear(NX_MDNS *mdns_ptr);
1291 UINT        _nx_mdns_domain_name_set(NX_MDNS *mdns_ptr, UCHAR *domain_name);
1292 UINT        _nxe_mdns_domain_name_set(NX_MDNS *mdns_ptr, UCHAR *domain_name);
1293 
1294 #ifndef NX_MDNS_DISABLE_SERVER
1295 UINT        _nx_mdns_service_announcement_timing_set(NX_MDNS *mdns_ptr, UINT t, UINT p, UINT k, UINT retrans_interval, ULONG period_interval, UINT max_time);
1296 UINT        _nxe_mdns_service_announcement_timing_set(NX_MDNS *mdns_ptr, UINT t, UINT p, UINT k, UINT retrans_interval, ULONG period_interval, UINT max_time);
1297 UINT        _nx_mdns_service_add(NX_MDNS *mdns_ptr, UCHAR *name, UCHAR *type, UCHAR *sub_type, UCHAR *txt, ULONG ttl,
1298                                  USHORT priority, USHORT weights, USHORT port, UCHAR is_unique, UINT interface_index);
1299 UINT        _nxe_mdns_service_add(NX_MDNS *mdns_ptr, UCHAR *name, UCHAR *type, UCHAR *sub_type, UCHAR *txt, ULONG ttl,
1300                                   USHORT priority, USHORT weights, USHORT port, UCHAR is_unique, UINT interface_index);
1301 UINT        _nx_mdns_service_delete(NX_MDNS *mdns_ptr, UCHAR *name, UCHAR *type, UCHAR *sub_type);
1302 UINT        _nxe_mdns_service_delete(NX_MDNS *mdns_ptr, UCHAR *name, UCHAR *type, UCHAR *sub_type);
1303 UINT        _nx_mdns_local_cache_clear(NX_MDNS *mdns_ptr);
1304 UINT        _nxe_mdns_local_cache_clear(NX_MDNS *mdns_ptr);
1305 #endif /* NX_MDNS_DISABLE_SERVER  */
1306 
1307 #ifndef NX_MDNS_DISABLE_CLIENT
1308 UINT        _nx_mdns_service_one_shot_query(NX_MDNS *mdns_ptr, UCHAR *name, UCHAR *type, UCHAR *sub_type, NX_MDNS_SERVICE *service, UINT timeout);
1309 UINT        _nxe_mdns_service_one_shot_query(NX_MDNS *mdns_ptr, UCHAR *name, UCHAR *type, UCHAR *sub_type, NX_MDNS_SERVICE *service, UINT timeout);
1310 UINT        _nx_mdns_service_continuous_query(NX_MDNS *mdns_ptr, UCHAR *name, UCHAR *type, UCHAR *sub_type);
1311 UINT        _nxe_mdns_service_continuous_query(NX_MDNS *mdns_ptr, UCHAR *name, UCHAR *type, UCHAR *sub_type);
1312 UINT        _nx_mdns_service_query_stop(NX_MDNS *mdns_ptr, UCHAR *name, UCHAR *type, UCHAR *sub_type);
1313 UINT        _nxe_mdns_service_query_stop(NX_MDNS *mdns_ptr, UCHAR *name, UCHAR *type, UCHAR *sub_type);
1314 UINT        _nx_mdns_service_lookup(NX_MDNS *mdns_ptr, UCHAR *name, UCHAR *type, UCHAR *sub_type, UINT service_index, NX_MDNS_SERVICE *service);
1315 UINT        _nxe_mdns_service_lookup(NX_MDNS *mdns_ptr, UCHAR *name, UCHAR *type, UCHAR *sub_type, UINT service_index, NX_MDNS_SERVICE *service);
1316 UINT        _nx_mdns_service_ignore_set(NX_MDNS *mdns_ptr, ULONG service_mask);
1317 UINT        _nxe_mdns_service_ignore_set(NX_MDNS *mdns_ptr, ULONG service_mask);
1318 UINT        _nx_mdns_service_notify_set(NX_MDNS *mdns_ptr, ULONG service_mask,
1319                                         VOID (*service_change_notify)(NX_MDNS *mdns_ptr, NX_MDNS_SERVICE *service_ptr, UINT state));
1320 UINT        _nxe_mdns_service_notify_set(NX_MDNS *mdns_ptr, ULONG service_mask,
1321                                         VOID (*service_change_notify)(NX_MDNS *mdns_ptr, NX_MDNS_SERVICE *service_ptr, UINT state));
1322 UINT        _nx_mdns_service_notify_clear(NX_MDNS *mdns_ptr);
1323 UINT        _nxe_mdns_service_notify_clear(NX_MDNS *mdns_ptr);
1324 UINT        _nx_mdns_host_address_get(NX_MDNS *mdns_ptr, UCHAR *host_name, ULONG *ipv4_address, ULONG *ipv6_address, UINT timeout);
1325 UINT        _nxe_mdns_host_address_get(NX_MDNS *mdns_ptr, UCHAR *host_name, ULONG *ipv4_address, ULONG *ipv6_address, UINT timeout);
1326 UINT        _nx_mdns_peer_cache_clear(NX_MDNS *mdns_ptr);
1327 UINT        _nxe_mdns_peer_cache_clear(NX_MDNS *mdns_ptr);
1328 #endif /* NX_MDNS_DISABLE_CLIENT  */
1329 
1330 
1331 /* Determine if a C++ compiler is being used.  If so, complete the standard
1332    C conditional started above.  */
1333 #ifdef   __cplusplus
1334         }
1335 #endif
1336 
1337 #endif  /* NXD_MDNS_H */
1338 
1339