Contiki-NG
uip-mcast6-stats.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014, University of Bristol - http://www.bris.ac.uk
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the copyright holder nor the names of its
14  * contributors may be used to endorse or promote products derived
15  * from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28  * OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 /**
31  * \addtogroup uip-multicast
32  * @{
33  */
34 /**
35  * \file
36  * Header file for IPv6 multicast forwarding stats maintenance
37  *
38  * \author
39  * George Oikonomou - <oikonomou@users.sourceforge.net>
40  */
41 #ifndef UIP_MCAST6_STATS_H_
42 #define UIP_MCAST6_STATS_H_
43 /*---------------------------------------------------------------------------*/
44 #include "contiki.h"
45 
46 #include <stdint.h>
47 /*---------------------------------------------------------------------------*/
48 /* The platform can override the stats datatype */
49 #ifdef UIP_MCAST6_CONF_STATS_DATATYPE
50 #define UIP_MCAST6_STATS_DATATYPE UIP_MCAST6_CONF_STATS_DATATYPE
51 #else
52 #define UIP_MCAST6_STATS_DATATYPE uint16_t
53 #endif
54 /*---------------------------------------------------------------------------*/
55 #ifdef UIP_MCAST6_CONF_STATS
56 #define UIP_MCAST6_STATS UIP_MCAST6_CONF_STATS
57 #else
58 #define UIP_MCAST6_STATS 0
59 #endif
60 /*---------------------------------------------------------------------------*/
61 /* Stats datatype */
62 /*---------------------------------------------------------------------------*/
63 /**
64  * \brief A data structure used to maintain multicast stats
65  *
66  * Each engine can extend this structure via the engine_stats field
67  */
68 typedef struct uip_mcast6_stats {
69  /** Count of unique datagrams received */
70  UIP_MCAST6_STATS_DATATYPE mcast_in_unique;
71 
72  /** Count of all datagrams received */
73  UIP_MCAST6_STATS_DATATYPE mcast_in_all;
74 
75  /** Count of datagrams received for a group that we have joined */
76  UIP_MCAST6_STATS_DATATYPE mcast_in_ours;
77 
78  /** Count of datagrams forwarded by us but we are not the seed */
79  UIP_MCAST6_STATS_DATATYPE mcast_fwd;
80 
81  /** Count of multicast datagrams originated by us */
82  UIP_MCAST6_STATS_DATATYPE mcast_out;
83 
84  /** Count of malformed multicast datagrams seen by us */
85  UIP_MCAST6_STATS_DATATYPE mcast_bad;
86 
87  /** Count of multicast datagrams correclty formed but dropped by us */
88  UIP_MCAST6_STATS_DATATYPE mcast_dropped;
89 
90  /** Opaque pointer to an engine's additional stats */
91  void *engine_stats;
93 /*---------------------------------------------------------------------------*/
94 /* Access macros */
95 /*---------------------------------------------------------------------------*/
96 #if UIP_MCAST6_STATS
97 /* Don't access this variable directly, use the macros below */
99 
100 #define UIP_MCAST6_STATS_ADD(x) uip_mcast6_stats.x++
101 #define UIP_MCAST6_STATS_GET(x) uip_mcast6_stats.x
102 #define UIP_MCAST6_STATS_INIT(s) uip_mcast6_stats_init(s)
103 #else /* UIP_MCAST6_STATS */
104 #define UIP_MCAST6_STATS_ADD(x)
105 #define UIP_MCAST6_STATS_GET(x) 0
106 #define UIP_MCAST6_STATS_INIT(s)
107 #endif /* UIP_MCAST6_STATS */
108 /*---------------------------------------------------------------------------*/
109 /**
110  * \brief Initialise multicast stats
111  * \param stats A pointer to a struct holding an engine's additional statistics
112  */
113 void uip_mcast6_stats_init(void *stats);
114 /*---------------------------------------------------------------------------*/
115 #endif /* UIP_MCAST6_STATS_H_ */
116 /*---------------------------------------------------------------------------*/
117 /** @} */
void uip_mcast6_stats_init(void *stats)
Initialise multicast stats.
UIP_MCAST6_STATS_DATATYPE mcast_bad
Count of malformed multicast datagrams seen by us.
UIP_MCAST6_STATS_DATATYPE mcast_in_unique
Count of unique datagrams received.
void * engine_stats
Opaque pointer to an engine&#39;s additional stats.
UIP_MCAST6_STATS_DATATYPE mcast_in_all
Count of all datagrams received.
UIP_MCAST6_STATS_DATATYPE mcast_out
Count of multicast datagrams originated by us.
UIP_MCAST6_STATS_DATATYPE mcast_fwd
Count of datagrams forwarded by us but we are not the seed.
UIP_MCAST6_STATS_DATATYPE mcast_in_ours
Count of datagrams received for a group that we have joined.
A data structure used to maintain multicast stats.
struct uip_mcast6_stats uip_mcast6_stats_t
A data structure used to maintain multicast stats.
UIP_MCAST6_STATS_DATATYPE mcast_dropped
Count of multicast datagrams correclty formed but dropped by us.