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
ip6/slaac.cpp
- Committer:
- andrewboyson
- Date:
- 2017-05-09
- Revision:
- 15:6ca6778168b1
- Parent:
- 13:9cd54f7db57a
- Child:
- 35:93c39d260a83
File content as of revision 15:6ca6778168b1:
#include "mbed.h" #include "mac.h" char SlaacLinkLocalIp[16]; char SlaacGlobalIp[16]; void SlaacMakeGlobal(char* pPrefix) { memcpy(SlaacGlobalIp, pPrefix, 8); char* p = SlaacGlobalIp + 8; *p++ = MacLocal[0] | 0x02; //Modified EUI-64 *p++ = MacLocal[1]; *p++ = MacLocal[2]; *p++ = 0xFF; *p++ = 0xFE; *p++ = MacLocal[3]; *p++ = MacLocal[4]; *p++ = MacLocal[5]; } void SlaacInit() { char* p = SlaacLinkLocalIp; *p++ = 0xFE; *p++ = 0x80; *p++ = 0x00; *p++ = 0x00; *p++ = 0x00; *p++ = 0x00; *p++ = 0x00; *p++ = 0x00; *p++ = MacLocal[0] | 0x02; //Modified EUI-64 *p++ = MacLocal[1]; *p++ = MacLocal[2]; *p++ = 0xFF; *p++ = 0xFE; *p++ = MacLocal[3]; *p++ = MacLocal[4]; *p++ = MacLocal[5]; }