netstats.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Cenk Gündoğan <cenk.guendogan@haw-hamburg.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 GNRC_RPL_NETSTATS_MULTICAST (0)
29 #define GNRC_RPL_NETSTATS_UNICAST (1)
30 
38 static inline void gnrc_rpl_netstats_rx_DIO(netstats_rpl_t *netstats, size_t len, int cast)
39 {
40  if (cast == GNRC_RPL_NETSTATS_MULTICAST) {
41  netstats->dio_rx_mcast_count++;
42  netstats->dio_rx_mcast_bytes += len;
43  }
44  else if (cast == GNRC_RPL_NETSTATS_UNICAST) {
45  netstats->dio_rx_ucast_count++;
46  netstats->dio_rx_ucast_bytes += len;
47  }
48 }
49 
57 static inline void gnrc_rpl_netstats_tx_DIO(netstats_rpl_t *netstats, size_t len, int cast)
58 {
59  if (cast == GNRC_RPL_NETSTATS_MULTICAST) {
60  netstats->dio_tx_mcast_count++;
61  netstats->dio_tx_mcast_bytes += len;
62  }
63  else if (cast == GNRC_RPL_NETSTATS_UNICAST) {
64  netstats->dio_tx_ucast_count++;
65  netstats->dio_tx_ucast_bytes += len;
66  }
67 }
68 
76 static inline void gnrc_rpl_netstats_rx_DIS(netstats_rpl_t *netstats, size_t len, int cast)
77 {
78  if (cast == GNRC_RPL_NETSTATS_MULTICAST) {
79  netstats->dis_rx_mcast_count++;
80  netstats->dis_rx_mcast_bytes += len;
81  }
82  else if (cast == GNRC_RPL_NETSTATS_UNICAST) {
83  netstats->dis_rx_ucast_count++;
84  netstats->dis_rx_ucast_bytes += len;
85  }
86 }
87 
95 static inline void gnrc_rpl_netstats_tx_DIS(netstats_rpl_t *netstats, size_t len, int cast)
96 {
97  if (cast == GNRC_RPL_NETSTATS_MULTICAST) {
98  netstats->dis_tx_mcast_count++;
99  netstats->dis_tx_mcast_bytes += len;
100  }
101  else if (cast == GNRC_RPL_NETSTATS_UNICAST) {
102  netstats->dis_tx_ucast_count++;
103  netstats->dis_tx_ucast_bytes += len;
104  }
105 }
106 
114 static inline void gnrc_rpl_netstats_rx_DAO(netstats_rpl_t *netstats, size_t len, int cast)
115 {
116  if (cast == GNRC_RPL_NETSTATS_MULTICAST) {
117  netstats->dao_rx_mcast_count++;
118  netstats->dao_rx_mcast_bytes += len;
119  }
120  else if (cast == GNRC_RPL_NETSTATS_UNICAST) {
121  netstats->dao_rx_ucast_count++;
122  netstats->dao_rx_ucast_bytes += len;
123  }
124 }
125 
133 static inline void gnrc_rpl_netstats_tx_DAO(netstats_rpl_t *netstats, size_t len, int cast)
134 {
135  if (cast == GNRC_RPL_NETSTATS_MULTICAST) {
136  netstats->dao_tx_mcast_count++;
137  netstats->dao_tx_mcast_bytes += len;
138  }
139  else if (cast == GNRC_RPL_NETSTATS_UNICAST) {
140  netstats->dao_tx_ucast_count++;
141  netstats->dao_tx_ucast_bytes += len;
142  }
143 }
144 
152 static inline void gnrc_rpl_netstats_rx_DAO_ACK(netstats_rpl_t *netstats, size_t len, int cast)
153 {
154  if (cast == GNRC_RPL_NETSTATS_MULTICAST) {
155  netstats->dao_ack_rx_mcast_count++;
156  netstats->dao_ack_rx_mcast_bytes += len;
157  }
158  else if (cast == GNRC_RPL_NETSTATS_UNICAST) {
159  netstats->dao_ack_rx_ucast_count++;
160  netstats->dao_ack_rx_ucast_bytes += len;
161  }
162 }
163 
171 static inline void gnrc_rpl_netstats_tx_DAO_ACK(netstats_rpl_t *netstats, size_t len, int cast)
172 {
173  if (cast == GNRC_RPL_NETSTATS_MULTICAST) {
174  netstats->dao_ack_tx_mcast_count++;
175  netstats->dao_ack_tx_mcast_bytes += len;
176  }
177  else if (cast == GNRC_RPL_NETSTATS_UNICAST) {
178  netstats->dao_ack_tx_ucast_count++;
179  netstats->dao_ack_tx_ucast_bytes += len;
180  }
181 }
182 
183 #ifdef __cplusplus
184 }
185 #endif
186 
187 #endif /* NETSTATS_H */
188 
rpl_netstats.h
Definition of RPL related packet statistics.
netstats_rpl_t::dao_ack_rx_mcast_count
uint32_t dao_ack_rx_mcast_count
multicast dao_ack received in packets
Definition: rpl_netstats.h:64
netstats_rpl_t::dio_rx_mcast_bytes
uint32_t dio_rx_mcast_bytes
multicast dio received in bytes
Definition: rpl_netstats.h:38
netstats_rpl_t::dao_ack_tx_ucast_count
uint32_t dao_ack_tx_ucast_count
unicast dao_ack sent in packets
Definition: rpl_netstats.h:66
netstats_rpl_t::dao_ack_tx_mcast_bytes
uint32_t dao_ack_tx_mcast_bytes
multicast dao_ack sent in bytes
Definition: rpl_netstats.h:69
netstats_rpl_t::dao_rx_mcast_count
uint32_t dao_rx_mcast_count
multicast dao received in packets
Definition: rpl_netstats.h:55
gnrc_rpl_netstats_rx_DAO
static void gnrc_rpl_netstats_rx_DAO(netstats_rpl_t *netstats, size_t len, int cast)
Increase statistics for received DAO.
Definition: netstats.h:114
gnrc_rpl_netstats_tx_DIS
static void gnrc_rpl_netstats_tx_DIS(netstats_rpl_t *netstats, size_t len, int cast)
Increase statistics for sent DIS.
Definition: netstats.h:95
netstats_rpl_t::dao_ack_rx_ucast_count
uint32_t dao_ack_rx_ucast_count
unicast dao_ack received in packets
Definition: rpl_netstats.h:62
netstats_rpl_t::dao_tx_mcast_bytes
uint32_t dao_tx_mcast_bytes
multicast dao sent in bytes
Definition: rpl_netstats.h:60
netstats_rpl_t::dio_rx_ucast_bytes
uint32_t dio_rx_ucast_bytes
unicast dio received in bytes
Definition: rpl_netstats.h:36
netstats_rpl_t::dio_tx_mcast_bytes
uint32_t dio_tx_mcast_bytes
multicast dio sent in bytes
Definition: rpl_netstats.h:42
netstats_rpl_t
RPL statistics struct.
Definition: rpl_netstats.h:33
gnrc_rpl_netstats_rx_DIO
static void gnrc_rpl_netstats_rx_DIO(netstats_rpl_t *netstats, size_t len, int cast)
Increase statistics for received DIO.
Definition: netstats.h:38
netstats_rpl_t::dio_tx_ucast_count
uint32_t dio_tx_ucast_count
unicast dio sent in packets
Definition: rpl_netstats.h:39
netstats_rpl_t::dis_tx_ucast_bytes
uint32_t dis_tx_ucast_bytes
unicast dis sent in bytes
Definition: rpl_netstats.h:49
netstats_rpl_t::dio_rx_mcast_count
uint32_t dio_rx_mcast_count
multicast dio received in packets
Definition: rpl_netstats.h:37
netstats_rpl_t::dis_rx_mcast_bytes
uint32_t dis_rx_mcast_bytes
multicast dis received in bytes
Definition: rpl_netstats.h:47
netstats_rpl_t::dao_tx_mcast_count
uint32_t dao_tx_mcast_count
multicast dao sent in packets
Definition: rpl_netstats.h:59
netstats_rpl_t::dio_tx_ucast_bytes
uint32_t dio_tx_ucast_bytes
unicast dio sent in bytes
Definition: rpl_netstats.h:40
netstats_rpl_t::dao_ack_tx_mcast_count
uint32_t dao_ack_tx_mcast_count
multicast dao_ack sent in packets
Definition: rpl_netstats.h:68
netstats_rpl_t::dis_rx_ucast_bytes
uint32_t dis_rx_ucast_bytes
unicast dis received in bytes
Definition: rpl_netstats.h:45
gnrc_rpl_netstats_rx_DIS
static void gnrc_rpl_netstats_rx_DIS(netstats_rpl_t *netstats, size_t len, int cast)
Increase statistics for received DIS.
Definition: netstats.h:76
netstats_rpl_t::dis_tx_mcast_bytes
uint32_t dis_tx_mcast_bytes
multicast dis sent in bytes
Definition: rpl_netstats.h:51
netstats_rpl_t::dis_tx_mcast_count
uint32_t dis_tx_mcast_count
multicast dis sent in packets
Definition: rpl_netstats.h:50
netstats_rpl_t::dio_tx_mcast_count
uint32_t dio_tx_mcast_count
multicast dio sent in packets
Definition: rpl_netstats.h:41
netstats_rpl_t::dao_tx_ucast_count
uint32_t dao_tx_ucast_count
unicast dao sent in packets
Definition: rpl_netstats.h:57
gnrc_rpl_netstats_rx_DAO_ACK
static void gnrc_rpl_netstats_rx_DAO_ACK(netstats_rpl_t *netstats, size_t len, int cast)
Increase statistics for received DAO-ACK.
Definition: netstats.h:152
gnrc_rpl_netstats_tx_DAO_ACK
static void gnrc_rpl_netstats_tx_DAO_ACK(netstats_rpl_t *netstats, size_t len, int cast)
Increase statistics for sent DAO-ACK.
Definition: netstats.h:171
netstats_rpl_t::dis_rx_mcast_count
uint32_t dis_rx_mcast_count
multicast dis received in packets
Definition: rpl_netstats.h:46
netstats_rpl_t::dao_rx_ucast_count
uint32_t dao_rx_ucast_count
unicast dao received in packets
Definition: rpl_netstats.h:53
netstats_rpl_t::dis_tx_ucast_count
uint32_t dis_tx_ucast_count
unicast dis sent in packets
Definition: rpl_netstats.h:48
netstats_rpl_t::dao_tx_ucast_bytes
uint32_t dao_tx_ucast_bytes
unicast dao sent in bytes
Definition: rpl_netstats.h:58
netstats_rpl_t::dio_rx_ucast_count
uint32_t dio_rx_ucast_count
unicast dio received in packets
Definition: rpl_netstats.h:35
netstats_rpl_t::dao_ack_tx_ucast_bytes
uint32_t dao_ack_tx_ucast_bytes
unicast dao_ack sent in bytes
Definition: rpl_netstats.h:67
gnrc_rpl_netstats_tx_DAO
static void gnrc_rpl_netstats_tx_DAO(netstats_rpl_t *netstats, size_t len, int cast)
Increase statistics for sent DIO.
Definition: netstats.h:133
netstats_rpl_t::dis_rx_ucast_count
uint32_t dis_rx_ucast_count
unicast dis received in packets
Definition: rpl_netstats.h:44
netstats_rpl_t::dao_ack_rx_ucast_bytes
uint32_t dao_ack_rx_ucast_bytes
unicast dao_ack received in bytes
Definition: rpl_netstats.h:63
gnrc_rpl_netstats_tx_DIO
static void gnrc_rpl_netstats_tx_DIO(netstats_rpl_t *netstats, size_t len, int cast)
Increase statistics for sent DIO.
Definition: netstats.h:57
netstats_rpl_t::dao_ack_rx_mcast_bytes
uint32_t dao_ack_rx_mcast_bytes
multicast dao_ack received in bytes
Definition: rpl_netstats.h:65
netstats_rpl_t::dao_rx_mcast_bytes
uint32_t dao_rx_mcast_bytes
multicast dao received in bytes
Definition: rpl_netstats.h:56
netstats_rpl_t::dao_rx_ucast_bytes
uint32_t dao_rx_ucast_bytes
unicast dao received in bytes
Definition: rpl_netstats.h:54