OpenWSN Firmware
Topology

Functions

bool topology_isAcceptablePacket (ieee802154_header_iht *ieee802514_header)
 Force a topology. More...
 

Detailed Description

Function Documentation

bool topology_isAcceptablePacket ( ieee802154_header_iht ieee802514_header)

Force a topology.

This function is used to force a certain topology, by hard-coding the list of acceptable neighbors for a given mote. This function is invoked each time a packet is received. If it returns FALSE, the packet is silently dropped, as if it were never received. If it returns TRUE, the packet is accepted.

Typically, filtering packets is done by analyzing the IEEE802.15.4 header. An example body for this function which forces a topology is:

switch (idmanager_getMyID(ADDR_64B)->addr_64b[7]) { case TOPOLOGY_MOTE1: if (ieee802514_header->src.addr_64b[7]==TOPOLOGY_MOTE2) { returnVal=TRUE; } else { returnVal=FALSE; } break; case TOPOLOGY_MOTE2: if (ieee802514_header->src.addr_64b[7]==TOPOLOGY_MOTE1 || ieee802514_header->src.addr_64b[7]==TOPOLOGY_MOTE3) { returnVal=TRUE; } else { returnVal=FALSE; } break; default: returnVal=TRUE; } return returnVal;

By default, however, the function should return TRUE to not force any topology.

Parameters
[in]ieee802514_headerThe parsed IEEE802.15.4 MAC header.
Returns
TRUE if the packet can be received.
FALSE if the packet should be silently dropped.