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/dnsreply.cpp
- Revision:
- 58:d48c899e482f
- Parent:
- 57:e0fb648acf48
- Child:
- 59:e0e556c8bd46
diff -r e0fb648acf48 -r d48c899e482f udp/dns/dnsreply.cpp --- a/udp/dns/dnsreply.cpp Tue Nov 28 17:05:46 2017 +0000 +++ b/udp/dns/dnsreply.cpp Thu Dec 07 20:44:32 2017 +0000 @@ -20,10 +20,10 @@ uint32_t DnsReplyIp4 = 0; char DnsReplyIp6[16]; -static char *p; -static int recordNameOffset; -static int recordType; -static int recordDataLength; +static char* p; +static char* pRecordName; +static int recordType; +static int recordDataLength; static char* pRecordData; static int scanQuery() @@ -31,7 +31,7 @@ int recordNameLength = DnsNameLength(p); if (!recordNameLength) return -1; //failure - recordNameOffset = DnsNameIndexFromPointer(p); + pRecordName = p; p += recordNameLength; p++ ; //skip the first byte of the type @@ -47,7 +47,7 @@ int recordNameLength = DnsNameLength(p); if (!recordNameLength) return -1; //failure - recordNameOffset = DnsNameIndexFromPointer(p); + pRecordName = p; p += recordNameLength; p++ ; //skip the first byte of the type @@ -85,9 +85,9 @@ return; } - DnsNameDecodePtr(recordNameOffset, sizeof(DnsReplyRecordName), DnsReplyRecordName); - DnsNameDecodeIp4(recordNameOffset, &DnsReplyRecordNameAsIp4); - DnsNameDecodeIp6(recordNameOffset, DnsReplyRecordNameAsIp6); + DnsNameDecodePtr(pRecordName, sizeof(DnsReplyRecordName), DnsReplyRecordName); + DnsNameDecodeIp4(pRecordName, &DnsReplyRecordNameAsIp4); + DnsNameDecodeIp6(pRecordName, DnsReplyRecordNameAsIp6); switch (recordType) { @@ -101,7 +101,7 @@ break; case DNS_RECORD_PTR: if (recordDataLength > DNS_MAX_LABEL_LENGTH) return; - DnsNameDecodePtr(DnsNameIndexFromPointer(pRecordData), sizeof(DnsReplyName), DnsReplyName); + DnsNameDecodePtr(pRecordData, sizeof(DnsReplyName), DnsReplyName); break; } }