Sergey Pastor / 1

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

dns_common.h File Reference

dns_common.h File Reference

Common DNS routines. More...

Go to the source code of this file.

Enumerations

enum  DnsOpcode
 

DNS opcodes.

More...
enum  DnsReturnCode
 

DNS return codes.

More...
enum  DnsResourceRecordClass { DNS_RR_CLASS_IN = 1, DNS_RR_CLASS_CH = 3, DNS_RR_CLASS_HS = 4, DNS_RR_CLASS_ANY = 255 }
 

DNS resource record classes.

More...
enum  DnsResourceRecordType {
  DNS_RR_TYPE_A = 1, DNS_RR_TYPE_NS = 2, DNS_RR_TYPE_CNAME = 5, DNS_RR_TYPE_SOA = 6,
  DNS_RR_TYPE_WKS = 11, DNS_RR_TYPE_PTR = 12, DNS_RR_TYPE_HINFO = 13, DNS_RR_TYPE_MINFO = 14,
  DNS_RR_TYPE_MX = 15, DNS_RR_TYPE_TXT = 16, DNS_RR_TYPE_AAAA = 28, DNS_RR_TYPE_NB = 32,
  DNS_RR_TYPE_SRV = 33, DNS_RR_TYPE_NAPTR = 35, DNS_RR_TYPE_NSEC = 47, DNS_RR_TYPE_EUI48 = 108,
  DNS_RR_TYPE_EUI64 = 109, DNS_RR_TYPE_AXFR = 252, DNS_RR_TYPE_ANY = 255, DNS_RR_TYPE_URI = 256
}
 

DNS resource record types.

More...

Functions

size_t dnsEncodeName (const char_t *src, uint8_t *dest)
 Encode a domain name using the DNS name notation.
size_t dnsParseName (const DnsHeader *message, size_t length, size_t pos, char_t *dest, uint_t level)
 Decode a domain name that uses the DNS name encoding.
int_t dnsCompareName (const DnsHeader *message, size_t length, size_t pos, const char_t *name, uint_t level)
 Compare domain names.
int_t dnsCompareEncodedName (const DnsHeader *message1, size_t length1, size_t pos1, const DnsHeader *message2, size_t length2, size_t pos2, uint_t level)
 Compare domain names encoded with DNS notation.

Detailed Description

Common DNS routines.

License

Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author:
Oryx Embedded SARL (www.oryx-embedded.com)
Version:
1.7.6

Definition in file dns_common.h.


Enumeration Type Documentation

enum DnsOpcode

DNS opcodes.

Definition at line 72 of file dns_common.h.

DNS resource record classes.

Enumerator:
DNS_RR_CLASS_IN 

Internet.

DNS_RR_CLASS_CH 

Chaos.

DNS_RR_CLASS_HS 

Hesiod.

DNS_RR_CLASS_ANY 

Any class.

Definition at line 101 of file dns_common.h.

DNS resource record types.

Enumerator:
DNS_RR_TYPE_A 

Host address.

DNS_RR_TYPE_NS 

Authoritative name server.

DNS_RR_TYPE_CNAME 

Canonical name for an alias.

DNS_RR_TYPE_SOA 

Start of a zone of authority.

DNS_RR_TYPE_WKS 

Well known service description.

DNS_RR_TYPE_PTR 

Domain name pointer.

DNS_RR_TYPE_HINFO 

Host information.

DNS_RR_TYPE_MINFO 

Mailbox or mail list information.

DNS_RR_TYPE_MX 

Mail exchange.

DNS_RR_TYPE_TXT 

Text strings.

DNS_RR_TYPE_AAAA 

IPv6 address.

DNS_RR_TYPE_NB 

NetBIOS name service.

DNS_RR_TYPE_SRV 

Server selection.

DNS_RR_TYPE_NAPTR 

Naming authority pointer.

DNS_RR_TYPE_NSEC 

NSEC record.

DNS_RR_TYPE_EUI48 

EUI-48 address.

DNS_RR_TYPE_EUI64 

EUI-64 address.

DNS_RR_TYPE_AXFR 

Transfer of an entire zone.

DNS_RR_TYPE_ANY 

A request for all records.

DNS_RR_TYPE_URI 

Uniform resource identifier.

Definition at line 114 of file dns_common.h.

DNS return codes.

Definition at line 86 of file dns_common.h.


Function Documentation

int_t dnsCompareEncodedName ( const DnsHeader *  message1,
size_t  length1,
size_t  pos1,
const DnsHeader *  message2,
size_t  length2,
size_t  pos2,
uint_t  level 
)

Compare domain names encoded with DNS notation.

Parameters:
[in]message1Pointer to the first DNS message
[in]length1Length of the first DNS message
[in]pos1Offset of the encoded domain name within the first message
[in]message2Pointer to the second DNS message
[in]length2Length of the second DNS message
[in]pos2Offset of the encoded domain name within the second message
[in]levelCurrent level of recursion
Returns:
The function returns 0 if the domain names match, -1 if the first domain name lexicographically precedes the second name, or 1 if the second domain name lexicographically precedes the first name

Definition at line 337 of file dns_common.c.

int_t dnsCompareName ( const DnsHeader *  message,
size_t  length,
size_t  pos,
const char_t *  name,
uint_t  level 
)

Compare domain names.

Parameters:
[in]messagePointer to the DNS message
[in]lengthLength of the DNS message
[in]posOffset of the encoded domain name
[in]nameNULL-terminated string that holds a domain name
[in]levelCurrent level of recursion
Returns:
The function returns 0 if the domain names match, -1 if the first domain name lexicographically precedes the second name, or 1 if the second domain name lexicographically precedes the first name

Definition at line 238 of file dns_common.c.

size_t dnsEncodeName ( const char_t *  src,
uint8_t *  dest 
)

Encode a domain name using the DNS name notation.

Parameters:
[in]srcPointer to the domain name to encode
[out]destPointer to the encoded domain name (optional parameter)
Returns:
Length of the encoded domain name

Definition at line 54 of file dns_common.c.

size_t dnsParseName ( const DnsHeader *  message,
size_t  length,
size_t  pos,
char_t *  dest,
uint_t  level 
)

Decode a domain name that uses the DNS name encoding.

Parameters:
[in]messagePointer to the DNS message
[in]lengthLength of the DNS message
[in]posOffset of the name to decode
[out]destPointer to the decoded name (optional)
[in]levelCurrent level of recursion
Returns:
The position of the resource record that immediately follows the domain name

Definition at line 128 of file dns_common.c.