NetSim Source Code Help
Loading...
Searching...
No Matches
SequenceNumber.c
Go to the documentation of this file.
1/************************************************************************************
2* Copyright (C) 2020 *
3* TETCOS, Bangalore. India *
4* *
5* Tetcos owns the intellectual property rights in the Product and its content. *
6* The copying, redistribution, reselling or publication of any or all of the *
7* Product or its content without express prior written consent of Tetcos is *
8* prohibited. Ownership and / or any other right relating to the software and all *
9* intellectual property rights therein shall remain at all times with Tetcos. *
10* *
11* Author: Shashi Kant Suman *
12* *
13* ---------------------------------------------------------------------------------*/
14#include "main.h"
15#include "RPL.h"
16
19
21{
22 UINT16 i;
23 for (i = 0; i < seq_num_mapping_count; i++)
24 {
26
27 bool in_use = FALSE;
28
29 UINT16 j;
30 for (j = 0; j < NETWORK->nDeviceCount; j++)
31 {
32 PRPL_NODE rpl = GET_RPL_NODE(j + 1);
33 if(!rpl)
34 continue; // RPL is not configured for this device.
35 if (!rpl_node_is_root(rpl))
36 { /* only root nodes modify sequence numbers */
37 continue;
38 }
39 if (!rpl->root_info->dodag_id)
40 fnNetSimError("DODAG Id is NULL. This may occur because some RPL configuration is wrong. Don't know what?");
41
42 if (IP_COMPARE(rpl->root_info->dodag_id, mapping->dodag_id) == 0)
43 {
44 in_use = TRUE;
45 break;
46 }
47 }
48
49 if (in_use)
50 {
51 continue;
52 }
53
54 for (j = i; j < seq_num_mapping_count - 1; j++)
55 {
57 }
58
59 free(mapping);
60
62 }
63}
64
66{
67 UINT16 i;
68 for (i = 0; i < seq_num_mapping_count; i++)
69 {
71
72 if (IP_COMPARE(mapping->dodag_id, dodag_id) == 0)
73 return mapping;
74 }
75
77
81
83}
NETSIM_IPAddress IP_COPY(NETSIM_IPAddress ip)
#define IP_COMPARE(ip1, ip2)
Definition: IP_Addressing.h:67
#define fnNetSimError(x,...)
Definition: Linux.h:56
#define TRUE
Definition: Linux.h:77
#define FALSE
Definition: Linux.h:76
#define UINT16
Definition: Linux.h:33
#define realloc(p, s)
Definition: Memory.h:32
#define malloc(s)
Definition: Memory.h:30
#define free(p)
Definition: Memory.h:31
#define GET_RPL_NODE(d)
Definition: RPL.h:212
bool rpl_node_is_root(PRPL_NODE r)
static UINT16 seq_num_mapping_count
static seq_num_mapping_t ** seq_num_mapping_list
void seq_num_mapping_cleanup()
seq_num_mapping_t * seq_num_mapping_get(NETSIM_IPAddress dodag_id)
EXPORTED struct stru_NetSim_Network * NETWORK
Definition: Stack.h:742
NETSIM_IPAddress dodag_id
Definition: RPL.h:110
UINT8 seq_num
Definition: RPL.h:109
PRPL_ROOT root_info
Definition: RPL.h:177
DODAGID dodag_id
Definition: RPL.h:124