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

ip.cpp

Committer:
andrewboyson
Date:
2017-05-05
Revision:
14:e75a59c1123d
Child:
33:714a0345e59b

File content as of revision 14:e75a59c1123d:

#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;
    }
}