A stack which works with or without an Mbed os library. Provides IPv4 or IPv6 with a full 1500 byte buffer.

Dependents:   oldheating gps motorhome heating

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers dnslabel.h Source File

dnslabel.h

00001 extern void DnsLabelCopy(char* dst, char* src);
00002 extern bool DnsLabelIsExternal(char* p);
00003 extern bool DnsLabelIsSame(char* pA, char* pB);
00004 extern int  DnsLabelMakeFullNameFromName (int protocol, const char* name, int size, char* fqdn);
00005 extern int  DnsLabelStripNameFromFullName(int protocol, char* fqdn, int size, char* name);
00006 
00007 #define DNS_MAX_LABEL_LENGTH 63
00008 
00009 /*
00010 rfc1035/rfc1123 label (DNS_LABEL):
00011 An alphanumeric (a-z, and 0-9) string, with a maximum length of 63 characters,
00012 with the '-' character allowed anywhere except the first or last character,
00013 suitable for use as a hostname or segment in a domain name.
00014 
00015 Labels are stored in DNS as <length><label>, length is a single byte
00016 two high bits of the length field reserved for something else (compression) thus leaving 6 bits for the length itself
00017 2^6=64 possible values - 0..63.
00018 
00019 In our case reserve 64 bytes for all labels which leaves room for a terminating null
00020 so always delare labels, hostnames or segments as [DNS_MAX_LABEL_LENGTH+1].
00021 */