net/gnrc/routing/rpl/gnrc_rpl_internal/netstats.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Cenk Gündoğan <mail@cgundogan.de>
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
19 #ifndef NETSTATS_H
20 #define NETSTATS_H
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #include "net/rpl/rpl_netstats.h"
27 
28 #define ENABLE_DEBUG (0)
29 #include "debug.h"
30 
31 #define GNRC_RPL_NETSTATS_MULTICAST (0)
32 #define GNRC_RPL_NETSTATS_UNICAST (1)
33 
41 static inline void gnrc_rpl_netstats_rx_DIO(netstats_rpl_t *netstats, size_t len, int cast)
42 {
43  if (cast == GNRC_RPL_NETSTATS_MULTICAST) {
44  netstats->dio_rx_mcast_count++;
45  netstats->dio_rx_mcast_bytes += len;
46  }
47  else if (cast == GNRC_RPL_NETSTATS_UNICAST) {
48  netstats->dio_rx_ucast_count++;
49  netstats->dio_rx_ucast_bytes += len;
50  }
51 }
52 
60 static inline void gnrc_rpl_netstats_tx_DIO(netstats_rpl_t *netstats, size_t len, int cast)
61 {
62  if (cast == GNRC_RPL_NETSTATS_MULTICAST) {
63  netstats->dio_tx_mcast_count++;
64  netstats->dio_tx_mcast_bytes += len;
65  }
66  else if (cast == GNRC_RPL_NETSTATS_UNICAST) {
67  netstats->dio_tx_ucast_count++;
68  netstats->dio_tx_ucast_bytes += len;
69  }
70 }
71 
79 static inline void gnrc_rpl_netstats_rx_DIS(netstats_rpl_t *netstats, size_t len, int cast)
80 {
81  if (cast == GNRC_RPL_NETSTATS_MULTICAST) {
82  netstats->dis_rx_mcast_count++;
83  netstats->dis_rx_mcast_bytes += len;
84  }
85  else if (cast == GNRC_RPL_NETSTATS_UNICAST) {
86  netstats->dis_rx_ucast_count++;
87  netstats->dis_rx_ucast_bytes += len;
88  }
89 }
90 
98 static inline void gnrc_rpl_netstats_tx_DIS(netstats_rpl_t *netstats, size_t len, int cast)
99 {
100  if (cast == GNRC_RPL_NETSTATS_MULTICAST) {
101  netstats->dis_tx_mcast_count++;
102  netstats->dis_tx_mcast_bytes += len;
103  }
104  else if (cast == GNRC_RPL_NETSTATS_UNICAST) {
105  netstats->dis_tx_ucast_count++;
106  netstats->dis_tx_ucast_bytes += len;
107  }
108 }
109 
117 static inline void gnrc_rpl_netstats_rx_DAO(netstats_rpl_t *netstats, size_t len, int cast)
118 {
119  if (cast == GNRC_RPL_NETSTATS_MULTICAST) {
120  netstats->dao_rx_mcast_count++;
121  netstats->dao_rx_mcast_bytes += len;
122  }
123  else if (cast == GNRC_RPL_NETSTATS_UNICAST) {
124  netstats->dao_rx_ucast_count++;
125  netstats->dao_rx_ucast_bytes += len;
126  }
127 }
128 
136 static inline void gnrc_rpl_netstats_tx_DAO(netstats_rpl_t *netstats, size_t len, int cast)
137 {
138  if (cast == GNRC_RPL_NETSTATS_MULTICAST) {
139  netstats->dao_tx_mcast_count++;
140  netstats->dao_tx_mcast_bytes += len;
141  }
142  else if (cast == GNRC_RPL_NETSTATS_UNICAST) {
143  netstats->dao_tx_ucast_count++;
144  netstats->dao_tx_ucast_bytes += len;
145  }
146 }
147 
155 static inline void gnrc_rpl_netstats_rx_DAO_ACK(netstats_rpl_t *netstats, size_t len, int cast)
156 {
157  if (cast == GNRC_RPL_NETSTATS_MULTICAST) {
158  netstats->dao_ack_rx_mcast_count++;
159  netstats->dao_ack_rx_mcast_bytes += len;
160  }
161  else if (cast == GNRC_RPL_NETSTATS_UNICAST) {
162  netstats->dao_ack_rx_ucast_count++;
163  netstats->dao_ack_rx_ucast_bytes += len;
164  }
165 }
166 
174 static inline void gnrc_rpl_netstats_tx_DAO_ACK(netstats_rpl_t *netstats, size_t len, int cast)
175 {
176  if (cast == GNRC_RPL_NETSTATS_MULTICAST) {
177  netstats->dao_ack_tx_mcast_count++;
178  netstats->dao_ack_tx_mcast_bytes += len;
179  }
180  else if (cast == GNRC_RPL_NETSTATS_UNICAST) {
181  netstats->dao_ack_tx_ucast_count++;
182  netstats->dao_ack_tx_ucast_bytes += len;
183  }
184 }
185 
186 #ifdef __cplusplus
187 }
188 #endif
189 
190 #endif /* NETSTATS_H */
191 
static void gnrc_rpl_netstats_rx_DIO(netstats_rpl_t *netstats, size_t len, int cast)
Increase statistics for received DIO.
uint32_t dao_ack_tx_ucast_count
unicast dao_ack sent in packets
Definition: rpl_netstats.h:66
uint32_t dao_rx_mcast_bytes
multicast dao received in bytes
Definition: rpl_netstats.h:56
uint32_t dao_rx_ucast_bytes
unicast dao received in bytes
Definition: rpl_netstats.h:54
uint32_t dis_rx_ucast_count
unicast dis received in packets
Definition: rpl_netstats.h:44
uint32_t dao_ack_rx_mcast_count
multicast dao_ack received in packets
Definition: rpl_netstats.h:64
uint32_t dao_ack_tx_mcast_bytes
multicast dao_ack sent in bytes
Definition: rpl_netstats.h:69
static void gnrc_rpl_netstats_rx_DIS(netstats_rpl_t *netstats, size_t len, int cast)
Increase statistics for received DIS.
Debug-header.
uint32_t dio_tx_mcast_bytes
multicast dio sent in bytes
Definition: rpl_netstats.h:42
static void gnrc_rpl_netstats_rx_DAO_ACK(netstats_rpl_t *netstats, size_t len, int cast)
Increase statistics for received DAO-ACK.
uint32_t dio_rx_ucast_bytes
unicast dio received in bytes
Definition: rpl_netstats.h:36
uint32_t dao_ack_rx_ucast_count
unicast dao_ack received in packets
Definition: rpl_netstats.h:62
uint32_t dao_tx_mcast_bytes
multicast dao sent in bytes
Definition: rpl_netstats.h:60
uint32_t dis_rx_mcast_bytes
multicast dis received in bytes
Definition: rpl_netstats.h:47
static void gnrc_rpl_netstats_tx_DAO(netstats_rpl_t *netstats, size_t len, int cast)
Increase statistics for sent DIO.
uint32_t dio_tx_ucast_count
unicast dio sent in packets
Definition: rpl_netstats.h:39
static void gnrc_rpl_netstats_tx_DAO_ACK(netstats_rpl_t *netstats, size_t len, int cast)
Increase statistics for sent DAO-ACK.
uint32_t dao_ack_tx_mcast_count
multicast dao_ack sent in packets
Definition: rpl_netstats.h:68
static void gnrc_rpl_netstats_tx_DIO(netstats_rpl_t *netstats, size_t len, int cast)
Increase statistics for sent DIO.
uint32_t dao_tx_ucast_count
unicast dao sent in packets
Definition: rpl_netstats.h:57
uint32_t dao_tx_mcast_count
multicast dao sent in packets
Definition: rpl_netstats.h:59
uint32_t dio_tx_mcast_count
multicast dio sent in packets
Definition: rpl_netstats.h:41
static void gnrc_rpl_netstats_tx_DIS(netstats_rpl_t *netstats, size_t len, int cast)
Increase statistics for sent DIS.
uint32_t dis_rx_mcast_count
multicast dis received in packets
Definition: rpl_netstats.h:46
uint32_t dis_tx_ucast_bytes
unicast dis sent in bytes
Definition: rpl_netstats.h:49
uint32_t dio_rx_mcast_count
multicast dio received in packets
Definition: rpl_netstats.h:37
uint32_t dis_tx_mcast_bytes
multicast dis sent in bytes
Definition: rpl_netstats.h:51
uint32_t dio_tx_ucast_bytes
unicast dio sent in bytes
Definition: rpl_netstats.h:40
uint32_t dis_tx_ucast_count
unicast dis sent in packets
Definition: rpl_netstats.h:48
uint32_t dio_rx_ucast_count
unicast dio received in packets
Definition: rpl_netstats.h:35
Definition of RPL related packet statistics.
uint32_t dis_rx_ucast_bytes
unicast dis received in bytes
Definition: rpl_netstats.h:45
static void gnrc_rpl_netstats_rx_DAO(netstats_rpl_t *netstats, size_t len, int cast)
Increase statistics for received DAO.
uint32_t dao_ack_tx_ucast_bytes
unicast dao_ack sent in bytes
Definition: rpl_netstats.h:67
uint32_t dao_rx_ucast_count
unicast dao received in packets
Definition: rpl_netstats.h:53
uint32_t dis_tx_mcast_count
multicast dis sent in packets
Definition: rpl_netstats.h:50
RPL statistics struct.
Definition: rpl_netstats.h:33
uint32_t dao_ack_rx_mcast_bytes
multicast dao_ack received in bytes
Definition: rpl_netstats.h:65
uint32_t dao_tx_ucast_bytes
unicast dao sent in bytes
Definition: rpl_netstats.h:58
uint32_t dao_ack_rx_ucast_bytes
unicast dao_ack received in bytes
Definition: rpl_netstats.h:63
uint32_t dio_rx_mcast_bytes
multicast dio received in bytes
Definition: rpl_netstats.h:38
uint32_t dao_rx_mcast_count
multicast dao received in packets
Definition: rpl_netstats.h:55