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:
83:08c983006a6e
Parent:
61:aad055f1b0d1
Child:
95:b9a99049016a
--- a/udp/udp.c	Thu Nov 15 18:42:42 2018 +0000
+++ b/udp/udp.c	Sat Nov 17 15:49:03 2018 +0000
@@ -102,7 +102,6 @@
 static int pollForPacketToSend(int type, int* pDataLength, void* pData)
 {
     int action = DO_NOTHING;
-    uint16_t preferredPolledIpType = NetPreferIp4Polled ? IPV4 : IPV6;
     
     if (!action && type == IPV4) //DHCP only works under IPv4
     {
@@ -114,7 +113,7 @@
         }
     }
     
-    if (!action && type == preferredPolledIpType) //DNS is agnostic
+    if (!action && type == (DnsSendRequestsViaIp4 ? IPV4 : IPV6)) //DNS is agnostic
     {
         action = DnsPollForPacketToSend(pData, pDataLength);
         int dest = ActionGetDestPart(action);
@@ -133,7 +132,7 @@
             }
         }
     }
-    if (!action && type == preferredPolledIpType) //NTP is agnostic
+    if (!action && type == (NtpSendRequestsViaIp4 ? IPV4 : IPV6)) //NTP is agnostic
     {
         action = NtpPollForPacketToSend(type, pData, pDataLength);
         if (action)
@@ -142,7 +141,7 @@
             dstPort = NTP_PORT;
         }
     }
-    if (!action && type == preferredPolledIpType) //TFTP is agnostic
+    if (!action && type == (TftpSendRequestsViaIp4 ? IPV4 : IPV6)) //TFTP is agnostic
     {
         action = TftpPollForPacketToSend(type, pData, pDataLength);
         if (action)