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:
74:c3756bfa960e
Parent:
71:736a5747ade1
Child:
93:580fc113d9e9
--- a/eth/ar6.c	Tue Oct 23 06:46:50 2018 +0000
+++ b/eth/ar6.c	Mon Oct 29 09:33:44 2018 +0000
@@ -92,7 +92,7 @@
     records[i].elapsed  = elapsed;
     MacClear(records[i].mac);
 }
-char* Ar6AddIpRecord(void (*traceback)(void), char* mac, char* ip)
+int Ar6AddIpRecord(void (*traceback)(void), char* mac, char* ip)
 {
     //Don't treat non ips
     if (!ip[0])
@@ -102,7 +102,7 @@
             LogTime("Ar6AddIpRecord had blank ip\r\n");
             if (NetTraceStack) traceback();
         }
-        return NULL;
+        return -1;
     }
     if (MacIsEmpty(mac))
     {
@@ -111,7 +111,7 @@
             LogTime("Ar6AddIpRecord had blank mac\r\n");
             if (NetTraceStack) traceback();
         }
-        return NULL;
+        return -1;
     }
     int i;
     
@@ -122,7 +122,7 @@
         records[i].elapsed = elapsed;
         records[i].state = STATE_VALID;
         MacCopy(records[i].mac, mac);
-        return records[i].ip;
+        return i;
     }
     
     //Otherwise find the first empty slot and add the MAC, IP and date
@@ -131,7 +131,7 @@
     Ip6AddressCopy(records[i].ip, ip);
     records[i].elapsed   = elapsed;
     records[i].state = STATE_VALID;
-    return records[i].ip;
+    return i;
 }
 void Ar6IpToMac(char* ip, char* mac)
 {
@@ -145,6 +145,10 @@
     }
     MacClear(mac);
 }
+void Ar6IndexToIp(int i, char* ip)
+{
+    Ip6AddressCopy(ip, records[i].ip);
+}
 void Ar6SendHttp()
 {
     for (int i = 0; i < RECORDS_COUNT; i++)