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
ip6/icmp/ndp/rs.c
- Committer:
- andrewboyson
- Date:
- 2018-01-11
- Revision:
- 61:aad055f1b0d1
- Parent:
- ip6/icmp/ndp/rs.cpp@ 47:73af5c0b0dc2
- Child:
- 103:9cf35a5b9d56
File content as of revision 61:aad055f1b0d1:
#include <stdint.h> #include <stdbool.h> #include "log.h" #include "net.h" #include "ndp.h" #include "ip6.h" #include "slaac.h" #include "clock.h" #include "action.h" #include "mac.h" bool RsTrace = false; bool RsSendSolicitation = false; __packed struct header { uint32_t reserved; }; static void logHeader(void* pPacket, int size) { struct header* pHeader = (struct header*)pPacket; char* pData = (char*)pHeader + sizeof(struct header); int dataLength = size - sizeof(struct header); if (NetTraceVerbose) { Log("RS header\r\n"); LogF(" Size %d\r\n", size); NdpLogOptionsVerbose(pData, dataLength); } else { Log("RS header"); NdpLogOptionsQuiet(pData, dataLength); Log("\r\n"); } } int RsGetWaitingSolicitation(void* pPacket, int* pSize, uint8_t* pType, uint8_t* pCode) { if (!RsSendSolicitation) return DO_NOTHING; RsSendSolicitation = false; *pType = 133; //Router solicitation *pCode = 0; struct header* pHeader = (struct header*)pPacket; pHeader->reserved = 0; char* pData = (char*)pHeader + sizeof(struct header); char* p = pData; p += NdpAddOptionSourceMac(p, MacLocal); *pSize = sizeof(struct header) + p - pData; if (RsTrace) { if (NetTraceNewLine) Log("\r\n"); LogTime("NDP send router solicit\r\n"); logHeader(pPacket, *pSize); } return ActionMakeFromDestAndTrace(MULTICAST_ROUTER, RsTrace && NetTraceStack); }