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:
22:914b970356f0
Parent:
14:e75a59c1123d
Child:
23:b641979389b2
--- a/net.cpp	Thu Jun 29 19:42:28 2017 +0000
+++ b/net.cpp	Mon Jul 03 14:29:07 2017 +0000
@@ -7,6 +7,9 @@
 #include   "dns.h"
 #include "slaac.h"
 #include   "ndp.h"
+#include   "ntp.h"
+#include    "io.h"
+#include "clock.h"
 
 char* NetName;
 
@@ -79,21 +82,12 @@
     return ~onesComplement(0, count, pData);
 }
 
-static bool ticked()
-{
-    static time_t lastT = 0;
-    time_t thisT = time(NULL);
-    bool oneshot = lastT != thisT;
-    lastT = thisT;
-    return oneshot;
-}
-
 int NetInit(char* name)
 {
     NetName = name;
-    PhyInit();
-    TcpInit();
-     ArInit();
+      PhyInit();
+      TcpInit();
+       ArInit();
     SlaacInit();
     return 0;
 }
@@ -101,12 +95,13 @@
 {
     PhyMain();
      ArMain();
-    if (ticked())
+    if (ClockTicked())
     {
-        DhcpTick();
+       DhcpTick();
          ArTick();
         DnsTick();
         NdpTick();
+        NtpTick();
     }
     return 0;
 }
\ No newline at end of file