38#ifndef DNS_NAME_MAX_RECURSION
39 #define DNS_NAME_MAX_RECURSION 4
40#elif (DNS_NAME_MAX_RECURSION < 1 || DNS_NAME_MAX_RECURSION > 8)
41 #error DNS_NAME_MAX_RECURSION parameter is not valid
45#define DNS_MESSAGE_MAX_SIZE 512
47#define DNS_NAME_MAX_SIZE 255
49#define DNS_LABEL_MAX_SIZE 63
52#define DNS_MAX_IPV4_REVERSE_NAME_LEN 15
54#define DNS_MAX_IPV6_REVERSE_NAME_LEN 63
60#define DNS_COMPRESSION_TAG 0xC0
63#define DNS_GET_QUESTION(message, offset) (DnsQuestion *) ((uint8_t *) (message) + (offset))
64#define DNS_GET_RESOURCE_RECORD(message, offset) (DnsResourceRecord *) ((uint8_t *) (message) + (offset))
66#define DNS_SET_NSEC_BITMAP(bitmap, type) bitmap[(type) / 8] |= 0x80 >> ((type) % 8)
67#define DNS_CLR_NSEC_BITMAP(bitmap, type) bitmap[(type) / 8] &= ~(0x80 >> ((type) % 8))
161#if defined(__CWCC__) || defined(_WIN32)
162 #pragma pack(push, 1)
173#if defined(_CPU_BIG_ENDIAN) && !defined(__ICCRX__)
236} DnsIpv4AddrResourceRecord;
250} DnsIpv6AddrResourceRecord;
267} DnsSrvResourceRecord;
271#if defined(__CWCC__) || defined(_WIN32)
276size_t dnsEncodeName(
const char_t *src, uint8_t *dest);
278size_t dnsParseName(
const DnsHeader *message,
size_t length,
size_t pos,
279 char_t *dest, uint_t level);
281int_t dnsCompareName(
const DnsHeader *message,
size_t length,
size_t pos,
282 const char_t *name, uint_t level);
284int_t dnsCompareEncodedName(
const DnsHeader *message1,
size_t length1,
285 size_t pos1,
const DnsHeader *message2,
size_t length2,
size_t pos2,
288void dnsGenerateIpv4ReverseName(
Ipv4Addr ipv4Addr, char_t *buffer);
289void dnsGenerateIpv6ReverseName(
const Ipv6Addr *ipv6Addr, char_t *buffer);
DnsResponseCode
DNS response codes.
Definition dns_common.h:94
@ DNS_RCODE_BADALG
Algorithm not supported.
Definition dns_common.h:112
@ DNS_RCODE_SERVFAIL
Server failure.
Definition dns_common.h:97
@ DNS_RCODE_BADKEY
Key not recognized.
Definition dns_common.h:108
@ DNS_RCODE_REFUSED
Query refused.
Definition dns_common.h:100
@ DNS_RCODE_NXRRSET
RR set that should exist does not.
Definition dns_common.h:103
@ DNS_RCODE_NXDOMAIN
Non-existent domain.
Definition dns_common.h:98
@ DNS_RCODE_BADVERS
Bad OPT version.
Definition dns_common.h:106
@ DNS_RCODE_BADTIME
Signature out of time window.
Definition dns_common.h:109
@ DNS_RCODE_BADNAME
Duplicate key name.
Definition dns_common.h:111
@ DNS_RCODE_BADCOOKIE
Bad server cookie.
Definition dns_common.h:114
@ DNS_RCODE_BADTRUC
Bad truncation.
Definition dns_common.h:113
@ DNS_RCODE_NOERROR
No error.
Definition dns_common.h:95
@ DNS_RCODE_NOTAUTH
Server not authoritative for zone.
Definition dns_common.h:104
@ DNS_RCODE_YXDOMAIN
Name exists when it should not.
Definition dns_common.h:101
@ DNS_RCODE_YXRRSET
RR set exists when it should not.
Definition dns_common.h:102
@ DNS_RCODE_BADMODE
Bad TKEY mode.
Definition dns_common.h:110
@ DNS_RCODE_NOTIMP
Not implemented.
Definition dns_common.h:99
@ DNS_RCODE_NOTZONE
Name not contained in zone.
Definition dns_common.h:105
@ DNS_RCODE_BADSIG
TSIG signature failure.
Definition dns_common.h:107
@ DNS_RCODE_FORMERR
Format error.
Definition dns_common.h:96
DnsOpcode
DNS opcodes.
Definition dns_common.h:80
@ DNS_OPCODE_NOTIFY
Notify.
Definition dns_common.h:84
@ DNS_OPCODE_IQUERY
Inverse query.
Definition dns_common.h:82
@ DNS_OPCODE_UPDATE
Update.
Definition dns_common.h:85
@ DNS_OPCODE_STATUS
Status.
Definition dns_common.h:83
@ DNS_OPCODE_QUERY
Query.
Definition dns_common.h:81
DnsResourceRecordType
DNS resource record types.
Definition dns_common.h:136
@ DNS_RR_TYPE_MX
Mail exchange.
Definition dns_common.h:145
@ DNS_RR_TYPE_PTR
Domain name pointer.
Definition dns_common.h:142
@ DNS_RR_TYPE_CNAME
Canonical name for an alias.
Definition dns_common.h:139
@ DNS_RR_TYPE_NB
NetBIOS name service.
Definition dns_common.h:148
@ DNS_RR_TYPE_SRV
Server selection.
Definition dns_common.h:149
@ DNS_RR_TYPE_WKS
Well known service description.
Definition dns_common.h:141
@ DNS_RR_TYPE_HINFO
Host information.
Definition dns_common.h:143
@ DNS_RR_TYPE_A
Host address.
Definition dns_common.h:137
@ DNS_RR_TYPE_AXFR
Transfer of an entire zone.
Definition dns_common.h:154
@ DNS_RR_TYPE_AAAA
IPv6 address.
Definition dns_common.h:147
@ DNS_RR_TYPE_EUI64
EUI-64 address.
Definition dns_common.h:153
@ DNS_RR_TYPE_TXT
Text strings.
Definition dns_common.h:146
@ DNS_RR_TYPE_ANY
A request for all records.
Definition dns_common.h:155
@ DNS_RR_TYPE_NS
Authoritative name server.
Definition dns_common.h:138
@ DNS_RR_TYPE_URI
Uniform resource identifier.
Definition dns_common.h:156
@ DNS_RR_TYPE_MINFO
Mailbox or mail list information.
Definition dns_common.h:144
@ DNS_RR_TYPE_NAPTR
Naming authority pointer.
Definition dns_common.h:150
@ DNS_RR_TYPE_NSEC
NSEC record.
Definition dns_common.h:151
@ DNS_RR_TYPE_SOA
Start of a zone of authority.
Definition dns_common.h:140
@ DNS_RR_TYPE_EUI48
EUI-48 address.
Definition dns_common.h:152
DnsResourceRecordClass
DNS resource record classes.
Definition dns_common.h:123
@ DNS_RR_CLASS_HS
Hesiod.
Definition dns_common.h:126
@ DNS_RR_CLASS_ANY
Any class.
Definition dns_common.h:127
@ DNS_RR_CLASS_CH
Chaos.
Definition dns_common.h:125
@ DNS_RR_CLASS_IN
Internet.
Definition dns_common.h:124
typedef __packed_struct
DNS message header.
Definition dns_common.h:171
uint32_t Ipv4Addr
IPv4 network address.
Definition ipv4.h:267