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

Revision:
58:d48c899e482f
Parent:
47:73af5c0b0dc2
Child:
59:e0e556c8bd46
--- a/udp/dns/dnsname.cpp	Tue Nov 28 17:05:46 2017 +0000
+++ b/udp/dns/dnsname.cpp	Thu Dec 07 20:44:32 2017 +0000
@@ -46,22 +46,6 @@
     }
 }
 
-int DnsNameIndexFromPointer(char* p)
-{
-    int depth = 0;
-    while (isOffset(*p))                  //it's a pointer so jump to the new offset eg ^C0 ^0C
-    {
-        depth++;
-        if (depth > MAX_DEPTH)
-        {
-            if (DnsNameTrace) LogTimeF("DnsNameIndexFromPointer exceeded depth limit\r\n");
-            return -1;
-        }
-        p = derefOffset(p);
-    }
-    return p - DnsHdrPacket;
-}
-
 bool DnsNameComparePtr(char* pStart, char* pTarget)
 {
     char* p = pStart;
@@ -233,11 +217,11 @@
     }
 }
 
-void DnsNameDecodePtr(int offset, int lenName, char* pName)
+void DnsNameDecodePtr(char* pStart, int lenName, char* pName)
 {   
     bool nameStarted = false;
     int depth = 0;
-    char* p = DnsHdrPacket + offset;
+    char* p = pStart;
     while (true)
     {
         if (p > DnsHdrPacket + MAX_PACKET_SIZE)
@@ -287,11 +271,11 @@
         }
     }
 }
-void DnsNameLogPtr(int offset)
+void DnsNameLogPtr(char* pStart)
 {   
     bool nameStarted = false;
     int depth = 0;
-    char* p = DnsHdrPacket + offset;
+    char* p = pStart;
     while (true)
     {
         if (p > DnsHdrPacket + MAX_PACKET_SIZE)
@@ -324,11 +308,11 @@
         }
     }
 }
-void DnsNameDecodeIp4(int offset, uint32_t* pIp)
+void DnsNameDecodeIp4(char* pStart, uint32_t* pIp)
 {
     int field = 0;
     int depth = 0;
-    char* p = DnsHdrPacket + offset;
+    char* p = pStart;
     while (true)
     {
         if (p > DnsHdrPacket + MAX_PACKET_SIZE)
@@ -390,11 +374,11 @@
         }
     }
 }
-void DnsNameDecodeIp6(int offset, char* pIp)
+void DnsNameDecodeIp6(char* pStart, char* pIp)
 {
     int field = 0;
     int depth = 0;
-    char* p = DnsHdrPacket + offset;
+    char* p = pStart;
     while (true)
     {
         if (p > DnsHdrPacket + MAX_PACKET_SIZE)