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
Diff: udp/dns/dns.cpp
- Revision:
- 33:714a0345e59b
- Parent:
- 32:679654f2d023
- Child:
- 37:793b39683406
diff -r 679654f2d023 -r 714a0345e59b udp/dns/dns.cpp --- a/udp/dns/dns.cpp Thu Aug 17 14:21:02 2017 +0000 +++ b/udp/dns/dns.cpp Wed Aug 23 18:02:42 2017 +0000 @@ -41,6 +41,20 @@ default: LogTimeF("DNS invalid protocol %d\r\n", protocol); return DNS_PROTOCOL_NONE; } } +bool DnsHostNamesEquate(char* pA, char* pB) +{ + while(true) + { + char a = *pA++; + char b = *pB++; + if (a >= 'A' && a <= 'Z') a |= 0x20; //Make lower case + if (b >= 'A' && b <= 'Z') b |= 0x20; //Make lower case + if (a != b) return false; //If different then stop and return the fact + if (!a) break; //No need to check 'b' too as it will necessarily be equal to 'a' at this point. + } + return true; //If we get here the strings must equate. +} + int DnsMakeFullNameFromName(int protocol, char* p, int size, char* result) { int i = 0; @@ -91,7 +105,6 @@ while (i < size - 1) { c = *p++; - if (c >= 'A' && c <= 'Z') c |= 0x20; //Make lower case if (c == 0) break; //End of the fqdn so stop if (c == '.') {