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

slaac.cpp

Committer:
andrewboyson
Date:
2017-03-12
Revision:
7:b794780e33b4

File content as of revision 7:b794780e33b4:

#include "eth.h"

char SlaacLinkLocalIp[16];

void SlaacInit()
{
    char* p = SlaacLinkLocalIp;
    *p++ = 0xFE;
    *p++ = 0x80;
    *p++ = 0x00;
    *p++ = 0x00;
    *p++ = 0x00;
    *p++ = 0x00;
    *p++ = 0x00;
    *p++ = 0x00;
    *p++ = EthLocalMac[0] | 0x02; //Modified EUI-64
    *p++ = EthLocalMac[1];
    *p++ = EthLocalMac[2];
    *p++ = 0xFF;
    *p++ = 0xFE;
    *p++ = EthLocalMac[3];
    *p++ = EthLocalMac[4];
    *p++ = EthLocalMac[5];
}