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:
- 18:accfcb80d9c3
- Parent:
- 15:6ca6778168b1
- Child:
- 22:914b970356f0
--- a/ip4/ip4.cpp Mon Jun 26 10:03:48 2017 +0000 +++ b/ip4/ip4.cpp Mon Jun 26 15:24:06 2017 +0000 @@ -26,6 +26,13 @@ return snprintf(text, size, "%d.%d.%d.%d", a3, a2, a1, a0); } +uint32_t Ip4Parse(char* text) +{ + int ints[4]; + sscanf(text, "%d.%d.%d.%d", &ints[3], &ints[2], &ints[1], &ints[0]); + return (ints[0] << 24) + (ints[1] << 16) + (ints[2] << 8) + ints[3]; +} + void Ip4DestIpFromAction(int action, uint32_t* pDstIp) { switch (action)