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
Diff: ip4/icmp/icmp4.cpp
- Revision:
- 47:73af5c0b0dc2
- Parent:
- 43:bc028d5a6424
- Child:
- 52:fbc5a46b5e16
--- a/ip4/icmp/icmp4.cpp Tue Oct 24 07:01:35 2017 +0000
+++ b/ip4/icmp/icmp4.cpp Thu Oct 26 14:50:24 2017 +0000
@@ -26,24 +26,21 @@
static int dataLength;
static void* pData;
-static void typeToString(uint16_t type, int size, char* text)
+static void logType(uint16_t type)
{
switch (type)
{
- case ECHO_REPLY: strncpy (text, "Echo Reply" , size); break;
- case ECHO_REQUEST: strncpy (text, "Echo Request" , size); break;
- default: snprintf(text, size, "Unknown type %d", type); break;
+ case ECHO_REPLY: Log ("Echo Reply" ); break;
+ case ECHO_REQUEST: Log ("Echo Request" ); break;
+ default: LogF("Unknown type %d", type); break;
}
}
static void logHeader()
-{
- char text[20];
-
+{
if (NetTraceVerbose)
{
Log ("ICMP4 header\r\n");
- typeToString(type, sizeof(text), text);
- LogF(" Type %s\r\n", text);
+ LogF(" Type "); logType(type); Log("\r\n");
LogF(" Code %u\r\n", code);
LogF(" Checksum (hex) %04hX\r\n", checksum);
LogF(" Calculated %04hX\r\n", calculated);
@@ -52,8 +49,7 @@
else
{
Log("ICMP4 header ");
- typeToString(type, sizeof(text), text);
- Log(text);
+ logType(type);
Log("\r\n");
}
}