sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
mdns_out.h
Go to the documentation of this file.
1
6
7 /*
8 * Copyright (c) 2015 Verisure Innovation AB
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without modification,
12 * are permitted provided that the following conditions are met:
13 *
14 * 1. Redistributions of source code must retain the above copyright notice,
15 * this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright notice,
17 * this list of conditions and the following disclaimer in the documentation
18 * and/or other materials provided with the distribution.
19 * 3. The name of the author may not be used to endorse or promote products
20 * derived from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
25 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
27 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
31 * OF SUCH DAMAGE.
32 *
33 * This file is part of the lwIP TCP/IP stack.
34 *
35 * Author: Erik Ekman <erik@kryo.se>
36 * Author: Jasper Verschueren <jasper.verschueren@apart-audio.com>
37 *
38 */
39
40#ifndef LWIP_HDR_APPS_MDNS_OUT_H
41#define LWIP_HDR_APPS_MDNS_OUT_H
42
43#include "lwip/apps/mdns_opts.h"
44#include "lwip/apps/mdns_priv.h"
45#include "lwip/netif.h"
46#include "lwip/timeouts.h"
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51
52#if LWIP_MDNS_RESPONDER
53
55/* Probe for ALL types with hostname */
56#define QUESTION_PROBE_HOST_ANY 0x10
57/* Probe for ALL types with service instance name */
58#define QUESTION_PROBE_SERVICE_NAME_ANY 0x10
59
60/* Lookup from hostname -> IPv4 */
61#define REPLY_HOST_A 0x01
62/* Lookup from IPv4/v6 -> hostname */
63#define REPLY_HOST_PTR_V4 0x02
64/* Lookup from hostname -> IPv6 */
65#define REPLY_HOST_AAAA 0x04
66/* Lookup from hostname -> IPv6 */
67#define REPLY_HOST_PTR_V6 0x08
68
69/* Lookup for service types */
70#define REPLY_SERVICE_TYPE_PTR 0x10
71/* Lookup for instances of service */
72#define REPLY_SERVICE_NAME_PTR 0x20
73/* Lookup for location of service instance */
74#define REPLY_SERVICE_SRV 0x40
75/* Lookup for text info on service instance */
76#define REPLY_SERVICE_TXT 0x80
77
78/* RFC6762 section 6:
79 * To protect the network against excessive packet flooding due to software bugs
80 * or malicious attack, a Multicast DNS responder MUST NOT (except in the one
81 * special case of answering probe queries) multicast a record on a given
82 * interface until at least one second has elapsed since the last time that
83 * record was multicast on that particular interface.
84 */
85#define MDNS_MULTICAST_TIMEOUT 1000
86
87/* RFC6762 section 6:
88 * In this special case only, when responding via multicast to a probe, a
89 * Multicast DNS responder is only required to delay its transmission as
90 * necessary to ensure an interval of at least 250 ms since the last time the
91 * record was multicast on that interface.
92 */
93#define MDNS_MULTICAST_PROBE_TIMEOUT 250
94
95/* RFC6762 section 5.4:
96 * When receiving a question with the unicast-response bit set, a responder
97 * SHOULD usually respond with a unicast packet directed back to the querier.
98 * However, if the responder has not multicast that record recently (within one
99 * quarter of its TTL), then the responder SHOULD instead multicast the response
100 * so as to keep all the peer caches up to date, and to permit passive conflict
101 * detection.
102 * -> we implement a stripped down version. Depending on a timeout of 30s
103 * (25% of 120s) all QU questions are send via multicast or unicast.
104 */
105#define MDNS_MULTICAST_TIMEOUT_25TTL 30000
106
107err_t mdns_create_outpacket(struct netif *netif, struct mdns_outmsg *msg,
108 struct mdns_outpacket *outpkt);
109err_t mdns_send_outpacket(struct mdns_outmsg *msg, struct netif *netif);
110void mdns_set_timeout(struct netif *netif, u32_t msecs,
111 sys_timeout_handler handler, u8_t *busy_flag);
112#if LWIP_IPV4
113void mdns_multicast_timeout_reset_ipv4(void *arg);
114void mdns_multicast_probe_timeout_reset_ipv4(void *arg);
115void mdns_multicast_timeout_25ttl_reset_ipv4(void *arg);
116void mdns_send_multicast_msg_delayed_ipv4(void *arg);
117void mdns_send_unicast_msg_delayed_ipv4(void *arg);
118void mdns_start_multicast_timeouts_ipv4(struct netif *netif);
119#endif
120#if LWIP_IPV6
121void mdns_multicast_timeout_reset_ipv6(void *arg);
122void mdns_multicast_probe_timeout_reset_ipv6(void *arg);
123void mdns_multicast_timeout_25ttl_reset_ipv6(void *arg);
124void mdns_send_multicast_msg_delayed_ipv6(void *arg);
125void mdns_send_unicast_msg_delayed_ipv6(void *arg);
126void mdns_start_multicast_timeouts_ipv6(struct netif *netif);
127#endif
128void mdns_prepare_txtdata(struct mdns_service *service);
129#ifdef LWIP_MDNS_SEARCH
130err_t mdns_send_request(struct mdns_request *req, struct netif *netif, const ip_addr_t *destination);
131#endif
132
133#endif /* LWIP_MDNS_RESPONDER */
134
135#ifdef __cplusplus
136}
137#endif
138
139#endif /* LWIP_HDR_APPS_MDNS_OUT_H */