Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: oldheating gps motorhome heating
ip.c
- Committer:
- andrewboyson
- Date:
- 2021-05-20
- Revision:
- 200:5acbc41bf469
- Parent:
- 61:aad055f1b0d1
File content as of revision 200:5acbc41bf469:
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include "log.h"
#include "ip.h"
void IpProtocolString(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;
case IP6IN4: strncpy(text, "IP6IN4", size); break;
default: snprintf(text, size, "%d", protocol); break;
}
}
void IpProtocolLog(uint8_t protocol)
{
switch (protocol)
{
case ICMP: Log("ICMP" ); break;
case IGMP: Log("IGMP" ); break;
case ICMP6: Log("ICMP6" ); break;
case TCP: Log("TCP" ); break;
case UDP: Log("UDP" ); break;
case IP6IN4: Log("IP6IN4"); break;
default: LogF("%d", protocol); break;
}
}