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
Diff: ip4/ip4.cpp
- Revision:
- 48:952dddb74b8b
- Parent:
- 47:73af5c0b0dc2
- Child:
- 49:1a6336f2b3f9
diff -r 73af5c0b0dc2 -r 952dddb74b8b ip4/ip4.cpp --- a/ip4/ip4.cpp Thu Oct 26 14:50:24 2017 +0000 +++ b/ip4/ip4.cpp Tue Oct 31 21:25:09 2017 +0000 @@ -4,7 +4,7 @@ #include "action.h" #include "icmp4.h" #include "udptcp4.h" -#include "ar.h" +#include "ar4.h" #include "nr.h" #include "dhcp.h" #include "eth.h" @@ -14,7 +14,7 @@ #include "mac.h" #include "http-reply.h" -#define SHOW_FILTERED true +bool Ip4Trace = true; #define IP4_BROADCAST_ADDRESS 0xFFFFFFFF #define IP4_MULTICAST_ALL_HOSTS 0x010000E0 @@ -202,7 +202,7 @@ bool doIt = isMe || isLocalBroadcast || isBroadcast || isMulticast; if (!doIt) { - if (SHOW_FILTERED) + if (Ip4Trace); { LogTimeF("IP4 filtered out ip "); Ip4AddressLog(dstIp); Log(" from "); @@ -212,7 +212,7 @@ return DO_NOTHING; } - ArAddIp4Record(pSrcMac, srcIp); + if (srcIp) Ar4AddIpRecord(trace, pSrcMac, srcIp); NrMakeRequestForNameFromIp4(srcIp); int action = DO_NOTHING; @@ -229,7 +229,7 @@ } if (!action) return DO_NOTHING; - if (DhcpIpNeedsToBeRouted(dstIp)) ArIpToMac4(DhcpRouter, pDstMac); //Send back to the router + if (DhcpIpNeedsToBeRouted(dstIp)) Ar4IpToMac(DhcpRouter, pDstMac); //Send back to the router else MacCopy(pDstMac, pSrcMac); //Send back to the source writeHeader(pHeader); @@ -264,8 +264,8 @@ case UNICAST_DNS: case UNICAST_DHCP: case UNICAST_NTP: - if (DhcpIpNeedsToBeRouted(dstIp)) ArIpToMac4(DhcpRouter, pDstMac); //send via router - else ArIpToMac4(dstIp, pDstMac); //Send direct + if (DhcpIpNeedsToBeRouted(dstIp)) Ar4IpToMac(DhcpRouter, pDstMac); //send via router + else Ar4IpToMac(dstIp, pDstMac); //Send direct break; case MULTICAST_NODE: case MULTICAST_ROUTER: