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
udp/dns/dnslabel.h@200:5acbc41bf469, 2021-05-20 (annotated)
- Committer:
- andrewboyson
- Date:
- Thu May 20 14:32:52 2021 +0000
- Revision:
- 200:5acbc41bf469
- Parent:
- 183:ee809769bf89
Increased number of arp entries from 20 to 30 to accommodate the number of WIZ devices plus a few incoming port 80 calls from the internet.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andrewboyson | 128:79052cb4a41c | 1 | extern void DnsLabelCopy(char* dst, char* src); |
andrewboyson | 183:ee809769bf89 | 2 | extern bool DnsLabelIsExternal(char* p); |
andrewboyson | 128:79052cb4a41c | 3 | extern bool DnsLabelIsSame(char* pA, char* pB); |
andrewboyson | 128:79052cb4a41c | 4 | extern int DnsLabelMakeFullNameFromName (int protocol, const char* name, int size, char* fqdn); |
andrewboyson | 128:79052cb4a41c | 5 | extern int DnsLabelStripNameFromFullName(int protocol, char* fqdn, int size, char* name); |
andrewboyson | 128:79052cb4a41c | 6 | |
andrewboyson | 128:79052cb4a41c | 7 | #define DNS_MAX_LABEL_LENGTH 63 |
andrewboyson | 128:79052cb4a41c | 8 | |
andrewboyson | 128:79052cb4a41c | 9 | /* |
andrewboyson | 128:79052cb4a41c | 10 | rfc1035/rfc1123 label (DNS_LABEL): |
andrewboyson | 128:79052cb4a41c | 11 | An alphanumeric (a-z, and 0-9) string, with a maximum length of 63 characters, |
andrewboyson | 128:79052cb4a41c | 12 | with the '-' character allowed anywhere except the first or last character, |
andrewboyson | 128:79052cb4a41c | 13 | suitable for use as a hostname or segment in a domain name. |
andrewboyson | 128:79052cb4a41c | 14 | |
andrewboyson | 128:79052cb4a41c | 15 | Labels are stored in DNS as <length><label>, length is a single byte |
andrewboyson | 128:79052cb4a41c | 16 | two high bits of the length field reserved for something else (compression) thus leaving 6 bits for the length itself |
andrewboyson | 128:79052cb4a41c | 17 | 2^6=64 possible values - 0..63. |
andrewboyson | 128:79052cb4a41c | 18 | |
andrewboyson | 128:79052cb4a41c | 19 | In our case reserve 64 bytes for all labels which leaves room for a terminating null |
andrewboyson | 128:79052cb4a41c | 20 | so always delare labels, hostnames or segments as [DNS_MAX_LABEL_LENGTH+1]. |
andrewboyson | 128:79052cb4a41c | 21 | */ |