sdk-core
v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Toggle main menu visibility
Loading...
Searching...
No Matches
mdns_priv.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
#ifndef LWIP_HDR_MDNS_PRIV_H
40
#define LWIP_HDR_MDNS_PRIV_H
41
42
#include "
lwip/apps/mdns.h
"
43
#include "
lwip/apps/mdns_opts.h
"
44
#include "
lwip/pbuf.h
"
45
46
#ifdef __cplusplus
47
extern
"C"
{
48
#endif
49
50
#if LWIP_MDNS_RESPONDER
51
52
#define MDNS_READNAME_ERROR 0xFFFF
53
#define NUM_DOMAIN_OFFSETS 10
54
55
#define SRV_PRIORITY 0
56
#define SRV_WEIGHT 0
57
58
/* mDNS TTL: (RFC6762 section 10)
59
* - 120 seconds if the hostname appears somewhere in the RR
60
* - 75 minutes if not (4500 seconds)
61
* - 10 seconds if responding to a legacy query
62
*/
63
#define MDNS_TTL_10 10
64
#define MDNS_TTL_120 120
65
#define MDNS_TTL_4500 4500
66
67
/* RFC6762 section 8.1: If fifteen conflicts occur within any ten-second period,
68
* then the host MUST wait at least five seconds before each successive
69
* additional probe attempt.
70
*/
71
#define MDNS_PROBE_MAX_CONFLICTS_BEFORE_RATE_LIMIT 15
72
#define MDNS_PROBE_MAX_CONFLICTS_TIME_WINDOW 10000
73
#define MDNS_PROBE_MAX_CONFLICTS_TIMEOUT 5000
74
75
#if LWIP_MDNS_SEARCH
77
struct
mdns_request {
79
char
name[MDNS_LABEL_MAXLEN + 1];
81
struct
mdns_domain service;
83
search_result_fn_t result_fn;
84
void
*arg;
86
u16_t proto;
88
u8_t qtype;
90
u16_t only_ptr;
91
};
92
#endif
93
95
struct
mdns_service {
97
struct
mdns_domain txtdata;
99
char
name[MDNS_LABEL_MAXLEN + 1];
101
char
service[MDNS_LABEL_MAXLEN + 1];
104
service_get_txt_fn_t txt_fn;
105
void
*txt_userdata;
107
u16_t proto;
109
u16_t port;
110
};
111
113
struct
mdns_outpacket {
115
struct
pbuf *pbuf;
117
u16_t write_offset;
119
u16_t questions;
121
u16_t answers;
123
u16_t authoritative;
125
u16_t additional;
128
u16_t domain_offsets[NUM_DOMAIN_OFFSETS];
129
};
130
132
struct
mdns_outmsg {
134
u16_t tx_id;
136
u8_t flags;
138
ip_addr_t dest_addr;
139
u16_t dest_port;
141
u8_t cache_flush;
143
u8_t unicast_reply_requested;
146
u8_t legacy_query;
149
u8_t probe_query_recv;
150
/* Question bitmask for host information */
151
u8_t host_questions;
152
/* Questions bitmask per service */
153
u8_t serv_questions[
MDNS_MAX_SERVICES
];
154
/* Reply bitmask for host information */
155
u8_t host_replies;
156
/* Bitmask for which reverse IPv6 hosts to answer */
157
u8_t host_reverse_v6_replies;
158
/* Reply bitmask per service */
159
u8_t serv_replies[
MDNS_MAX_SERVICES
];
160
#ifdef LWIP_MDNS_SEARCH
162
struct
mdns_request *query;
163
#endif
164
};
165
167
struct
mdns_delayed_msg {
169
u8_t multicast_msg_waiting;
171
u8_t multicast_timeout;
173
u8_t multicast_probe_timeout;
175
struct
mdns_outmsg delayed_msg_multicast;
178
u8_t multicast_timeout_25TTL;
180
u8_t unicast_msg_in_use;
182
struct
mdns_outmsg delayed_msg_unicast;
183
};
184
185
/* MDNS states */
186
typedef
enum
{
187
/* MDNS module is off */
188
MDNS_STATE_OFF,
189
/* Waiting before probing can be started */
190
MDNS_STATE_PROBE_WAIT,
191
/* Probing the unique records */
192
MDNS_STATE_PROBING,
193
/* Waiting before announcing the probed unique records */
194
MDNS_STATE_ANNOUNCE_WAIT,
195
/* Announcing all records */
196
MDNS_STATE_ANNOUNCING,
197
/* Probing and announcing completed */
198
MDNS_STATE_COMPLETE
199
} mdns_resp_state_enum_t;
200
202
struct
mdns_host {
204
char
name[MDNS_LABEL_MAXLEN + 1];
206
struct
mdns_service *services[
MDNS_MAX_SERVICES
];
208
u8_t sent_num;
210
mdns_resp_state_enum_t state;
211
#if LWIP_IPV4
213
struct
mdns_delayed_msg ipv4;
214
#endif
215
#if LWIP_IPV6
217
struct
mdns_delayed_msg ipv6;
218
#endif
220
u32_t conflict_time[MDNS_PROBE_MAX_CONFLICTS_BEFORE_RATE_LIMIT];
222
u8_t rate_limit_activated;
224
u8_t index;
226
u8_t num_conflicts;
227
};
228
229
struct
mdns_host* netif_mdns_data(
struct
netif
*
netif
);
230
struct
udp_pcb* get_mdns_pcb(
void
);
231
232
#endif
/* LWIP_MDNS_RESPONDER */
233
234
#ifdef __cplusplus
235
}
236
#endif
237
238
#endif
/* LWIP_HDR_MDNS_PRIV_H */
MDNS_MAX_SERVICES
#define MDNS_MAX_SERVICES
Definition
mdns_opts.h:60
mdns.h
mdns_opts.h
pbuf.h
netif
Definition
tcpip.h:1271
core
ps2ip
include
lwip_include
lwip
apps
mdns_priv.h
Generated by
1.18.0