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: net.cpp
- Revision:
- 59:e0e556c8bd46
- Parent:
- 57:e0fb648acf48
--- a/net.cpp Thu Dec 07 20:44:32 2017 +0000 +++ b/net.cpp Thu Dec 14 20:55:40 2017 +0000 @@ -1,5 +1,5 @@ #include "mbed.h" -#include "phy.h" +#include "link.h" #include "net.h" #include "tcb.h" #include "dhcp.h" @@ -17,9 +17,11 @@ bool NetTraceStack = false; bool NetTraceNewLine = false; bool NetTraceVerbose = false; +bool NetPreferIp4Polled = false; +const char* NetName4; +const char* NetName6; static bool hostMatched = false; -char NetTraceHost[] = { 0, 0 }; bool NetTraceHostGetMatched() { return hostMatched; @@ -28,6 +30,7 @@ { hostMatched = false; } +char NetTraceHost[2]; void NetTraceHostCheckIp6(char* ip) { if (!ip[0]) return; @@ -41,11 +44,6 @@ if (NetTraceHost[1] != mac[5]) return; hostMatched = true; } -bool NetPreferIp4Polled = false; - -char* NetName4; -char* NetName6; - int16_t NetToHost16(int16_t n) { int16_t h; @@ -115,11 +113,11 @@ return ~onesComplement(0, count, pData); } -int NetInit(char* name4, char* name6) -{ +int NetInit(const char* name4, const char* name6) +{ NetName4 = name4; NetName6 = name6; - PhyInit(); + LinkInit(); TcbInit(); Ar4Init(); Ar6Init(); @@ -130,7 +128,7 @@ } int NetMain() { - PhyMain(); + LinkMain(); TcbMain(); Ar4Main(); Ar6Main();