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:
15:6ca6778168b1
Child:
29:39277bf2003d
--- a/udp/udp.cpp	Thu Jun 29 19:42:28 2017 +0000
+++ b/udp/udp.cpp	Mon Jul 03 14:29:07 2017 +0000
@@ -33,7 +33,7 @@
     {
         //Handle these
         case DHCP_CLIENT_PORT:          return DhcpHandleResponse      (                    pDataLength, pData);  //   68
-        case NTP_PORT:                  return  NtpHandleRequest       (                    pDataLength, pData);  //  123
+        case NTP_PORT:                  return  NtpHandlePacketReceived(                    pDataLength, pData);  //  123
         case DNS_UNICAST_CLIENT_PORT:   return  DnsHandlePacketReceived(DNS_PROTOCOL_UDNS,  pDataLength, pData);  //53053
         case DNS_MDNS_PORT:             return  DnsHandlePacketReceived(DNS_PROTOCOL_MDNS,  pDataLength, pData);  // 5353
         case DNS_LLMNR_CLIENT_PORT:     return  DnsHandlePacketReceived(DNS_PROTOCOL_LLMNR, pDataLength, pData);  //53055
@@ -106,6 +106,15 @@
             }
         }
     }
+    if (!action) //NTP needs to choose depending of what address is specified
+    {
+        action = NtpPollForPacketToSend(type, pData, pDataLength);
+        if (action)
+        {
+            UdpSrcPort = NTP_PORT;
+            UdpDstPort = NTP_PORT;
+        }
+    }
     return action;
 }
 int UdpPollForPacketToSend(int type, int* pSize, void* pPacket)