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: ip.cpp
- Revision:
- 14:e75a59c1123d
- Child:
- 33:714a0345e59b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ip.cpp Fri May 05 17:44:16 2017 +0000 @@ -0,0 +1,15 @@ +#include "mbed.h" +#include "ip.h" + +void IpProtocolToString(uint8_t protocol, int size, char* text) +{ + switch (protocol) + { + case ICMP: strncpy (text, "ICMP", size); break; + case IGMP: strncpy (text, "IGMP", size); break; + case ICMP6: strncpy (text, "ICMP6", size); break; + case TCP: strncpy (text, "TCP" , size); break; + case UDP: strncpy (text, "UDP" , size); break; + default: snprintf(text, size, "%d", protocol); break; + } +}