sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
dns.h
Go to the documentation of this file.
1
6
7/*
8 * Port to lwIP from uIP
9 * by Jim Pettinato April 2007
10 *
11 * security fixes and more by Simon Goldschmidt
12 *
13 * uIP version Copyright (c) 2002-2003, Adam Dunkels.
14 * All rights reserved.
15 *
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
18 * are met:
19 * 1. Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution.
24 * 3. The name of the author may not be used to endorse or promote
25 * products derived from this software without specific prior
26 * written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
29 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
30 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
32 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
34 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
36 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 */
40
41#ifndef LWIP_HDR_PROT_DNS_H
42#define LWIP_HDR_PROT_DNS_H
43
44#include "lwip/arch.h"
45
46#ifdef __cplusplus
47extern "C" {
48#endif
49
51#ifndef DNS_SERVER_PORT
52#define DNS_SERVER_PORT 53
53#endif
54
55/* DNS field TYPE used for "Resource Records" */
56#define DNS_RRTYPE_A 1 /* a host address */
57#define DNS_RRTYPE_NS 2 /* an authoritative name server */
58#define DNS_RRTYPE_MD 3 /* a mail destination (Obsolete - use MX) */
59#define DNS_RRTYPE_MF 4 /* a mail forwarder (Obsolete - use MX) */
60#define DNS_RRTYPE_CNAME 5 /* the canonical name for an alias */
61#define DNS_RRTYPE_SOA 6 /* marks the start of a zone of authority */
62#define DNS_RRTYPE_MB 7 /* a mailbox domain name (EXPERIMENTAL) */
63#define DNS_RRTYPE_MG 8 /* a mail group member (EXPERIMENTAL) */
64#define DNS_RRTYPE_MR 9 /* a mail rename domain name (EXPERIMENTAL) */
65#define DNS_RRTYPE_NULL 10 /* a null RR (EXPERIMENTAL) */
66#define DNS_RRTYPE_WKS 11 /* a well known service description */
67#define DNS_RRTYPE_PTR 12 /* a domain name pointer */
68#define DNS_RRTYPE_HINFO 13 /* host information */
69#define DNS_RRTYPE_MINFO 14 /* mailbox or mail list information */
70#define DNS_RRTYPE_MX 15 /* mail exchange */
71#define DNS_RRTYPE_TXT 16 /* text strings */
72#define DNS_RRTYPE_AAAA 28 /* IPv6 address */
73#define DNS_RRTYPE_SRV 33 /* service location */
74#define DNS_RRTYPE_ANY 255 /* any type */
75
76/* DNS field CLASS used for "Resource Records" */
77#define DNS_RRCLASS_IN 1 /* the Internet */
78#define DNS_RRCLASS_CS 2 /* the CSNET class (Obsolete - used only for examples in some obsolete RFCs) */
79#define DNS_RRCLASS_CH 3 /* the CHAOS class */
80#define DNS_RRCLASS_HS 4 /* Hesiod [Dyer 87] */
81#define DNS_RRCLASS_ANY 255 /* any class */
82#define DNS_RRCLASS_FLUSH 0x800 /* Flush bit */
83
84/* DNS protocol flags */
85#define DNS_FLAG1_RESPONSE 0x80
86#define DNS_FLAG1_OPCODE_STATUS 0x10
87#define DNS_FLAG1_OPCODE_INVERSE 0x08
88#define DNS_FLAG1_OPCODE_STANDARD 0x00
89#define DNS_FLAG1_AUTHORATIVE 0x04
90#define DNS_FLAG1_TRUNC 0x02
91#define DNS_FLAG1_RD 0x01
92#define DNS_FLAG2_RA 0x80
93#define DNS_FLAG2_ERR_MASK 0x0f
94#define DNS_FLAG2_ERR_NONE 0x00
95#define DNS_FLAG2_ERR_NAME 0x03
96
97#define DNS_HDR_GET_OPCODE(hdr) ((((hdr)->flags1) >> 3) & 0xF)
98
99#ifdef PACK_STRUCT_USE_INCLUDES
100# include "arch/bpstruct.h"
101#endif
102PACK_STRUCT_BEGIN
104struct dns_hdr {
105 PACK_STRUCT_FIELD(u16_t id);
106 PACK_STRUCT_FLD_8(u8_t flags1);
107 PACK_STRUCT_FLD_8(u8_t flags2);
108 PACK_STRUCT_FIELD(u16_t numquestions);
109 PACK_STRUCT_FIELD(u16_t numanswers);
110 PACK_STRUCT_FIELD(u16_t numauthrr);
111 PACK_STRUCT_FIELD(u16_t numextrarr);
112} PACK_STRUCT_STRUCT;
113PACK_STRUCT_END
114#ifdef PACK_STRUCT_USE_INCLUDES
115# include "arch/epstruct.h"
116#endif
117#define SIZEOF_DNS_HDR 12
118
119
120/* Multicast DNS definitions */
121
123#ifndef DNS_MQUERY_PORT
124#define DNS_MQUERY_PORT 5353
125#endif
126
127/* IPv4 group for multicast DNS queries: 224.0.0.251 */
128#ifndef DNS_MQUERY_IPV4_GROUP_INIT
129#define DNS_MQUERY_IPV4_GROUP_INIT IPADDR4_INIT_BYTES(224,0,0,251)
130#endif
131
132/* IPv6 group for multicast DNS queries: FF02::FB */
133#ifndef DNS_MQUERY_IPV6_GROUP_INIT
134#define DNS_MQUERY_IPV6_GROUP_INIT IPADDR6_INIT_HOST(0xFF020000,0,0,0xFB)
135#endif
136
137#ifdef __cplusplus
138}
139#endif
140
141#endif /* LWIP_HDR_PROT_DNS_H */
Definition dns.h:104