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:
176:7eb916c22084
Parent:
172:9bc3c7b2cca1
Child:
187:122fc1996c86
--- a/ip6/ip6addr.c	Thu Dec 24 19:17:06 2020 +0000
+++ b/ip6/ip6addr.c	Sat Dec 26 17:07:02 2020 +0000
@@ -13,31 +13,10 @@
 void Ip6AddrClear(char* ip)
 {
     ip[ 0] = 0; //Just set the first byte to zero
-    ip[12] = 0; //and the 12 (the first byte of a IP4 address)
 }
 bool Ip6AddrIsEmpty(const char* ip)
 {
-    return !ip[0] && !ip[12]; //Check for the first and 12th byte being non zero
-}
-void Ip6AddrFromIp4(char* ip6, uint32_t ip4)
-{
-    memset(ip6, 0, 16);
-    *ip6++ = 0; *ip6++ = 0; *ip6++ = 0; *ip6++ = 0;
-    *ip6++ = 0; *ip6++ = 0; *ip6++ = 0; *ip6++ = 0;
-    *ip6++ = 0; *ip6++ = 0; *ip6++ = 0; *ip6++ = 0;
-    *ip6++ =  (ip4 >>  0) & 0xFF;
-    *ip6++ =  (ip4 >>  8) & 0xFF;
-    *ip6++ =  (ip4 >> 16) & 0xFF;
-    *ip6++ =  (ip4 >> 24) & 0xFF;
-}
-uint32_t Ip6AddrToIp4(char* ip6)
-{
-    uint32_t ip4;
-    ip4  = ip6[12] << 0;
-    ip4 |= ip6[13] << 8;
-    ip4 |= ip6[14] << 16;
-    ip4 |= ip6[15] << 24;
-    return ip4;
+    return !ip[0]; //Check for the first byte being non zero
 }
 static void addHexNibble(bool* pAdded, int number, int index, char** pp)
 {
@@ -152,12 +131,6 @@
     memcpy(ipTo, ipFrom, 16);
 }
 
-bool Ip6AddrIsIp4(const char *p)
-{
-    if (p[ 0] != 0) return false;
-    if (p[12] != 0) return false;
-    return true;
-}
 bool Ip6AddrIsLinkLocal(const char* p)
 {
     if (p[0] != 0xFE) return false;