Contiki-NG
|
Files | |
file | deployment.c |
Code managing id<->mac address<->IPv6 address mapping, and doing this for different deployment scenarios: Cooja, Nodes, Indriya or Twist testbeds | |
file | deployment.h |
Per-deployment MAC <-> nodeid mapping. | |
Data Structures | |
struct | id_mac |
ID<->MAC address mapping structure. More... | |
Functions | |
void | deployment_init (void) |
DEPLOYMENT_MAPPING: A table of struct id_mac that provides ID-MAC mapping for a deployment. More... | |
int | deployment_node_count (void) |
Get the number of nodes for the deployment (length of mapping table) More... | |
uint16_t | deployment_id_from_lladdr (const linkaddr_t *lladdr) |
Get node ID from a link-layer address, from the deployment mapping table. More... | |
void | deployment_lladdr_from_id (linkaddr_t *lladdr, uint16_t id) |
Get node link-layer address from a node ID, from the deployment mapping table. More... | |
uint16_t | deployment_id_from_iid (const uip_ipaddr_t *ipaddr) |
Get node ID from the IID of an IPv6 address. More... | |
void | deployment_iid_from_id (uip_ipaddr_t *ipaddr, uint16_t id) |
Get IPv6 IID from node IDs. More... | |
uint16_t | deployment_id_from_index (uint16_t index) |
Get node ID from index in mapping table. More... | |
Variables | |
const struct id_mac | DEPLOYMENT_MAPPING [] |
List of ID<->MAC mapping used for different deployments. | |
static int | node_count = 0 |
The number of nodes in the deployment. | |
uint16_t deployment_id_from_iid | ( | const uip_ipaddr_t * | ipaddr | ) |
Get node ID from the IID of an IPv6 address.
ipaddr | The IPv6 (global or link-local) address that contains the IID |
Definition at line 115 of file deployment.c.
References deployment_id_from_lladdr(), and uip_ds6_set_lladdr_from_iid().
uint16_t deployment_id_from_index | ( | uint16_t | index | ) |
Get node ID from index in mapping table.
index | The index in the deployment mapping table |
Definition at line 131 of file deployment.c.
References DEPLOYMENT_MAPPING, and deployment_node_count().
uint16_t deployment_id_from_lladdr | ( | const linkaddr_t * | lladdr | ) |
Get node ID from a link-layer address, from the deployment mapping table.
lladdr | The link-layer address to look up for |
Definition at line 82 of file deployment.c.
References DEPLOYMENT_MAPPING.
Referenced by deployment_id_from_iid().
void deployment_iid_from_id | ( | uip_ipaddr_t * | ipaddr, |
uint16_t | id | ||
) |
Get IPv6 IID from node IDs.
ipaddr | The IPv6 where to write the IID |
id | The node ID |
Definition at line 123 of file deployment.c.
References deployment_lladdr_from_id(), and uip_ds6_set_addr_iid().
void deployment_init | ( | void | ) |
DEPLOYMENT_MAPPING: A table of struct id_mac that provides ID-MAC mapping for a deployment.
Example with four nodes: In configuration file: #define DEPLOYMENT_MAPPING custom_array In a .c file: const struct id_mac custom_array[] = { { 1, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb6,0x14}}}, { 2, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb1,0xe7}}}, { 3, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb4,0x35}}}, { 4, {{0x00,0x12,0x4b,0x00,0x06,0x0d,0xb1,0xcf}}}, { 0, {{0}}} }; Initialize the deployment module
Definition at line 62 of file deployment.c.
References DEPLOYMENT_MAPPING.
Referenced by node_id_init().
void deployment_lladdr_from_id | ( | linkaddr_t * | lladdr, |
uint16_t | id | ||
) |
Get node link-layer address from a node ID, from the deployment mapping table.
lladdr | A pointer where to write the link-layer address |
id | The node ID to look up for |
Definition at line 99 of file deployment.c.
References DEPLOYMENT_MAPPING.
Referenced by deployment_iid_from_id().
int deployment_node_count | ( | void | ) |
Get the number of nodes for the deployment (length of mapping table)
Definition at line 76 of file deployment.c.
References node_count.
Referenced by deployment_id_from_index().