OpenSDN source code
gmp.h
Go to the documentation of this file.
1 /* $Id: gmp.h 514187 2012-05-06 12:25:25Z ib-builder $
2  *
3  * gmp.h - General definitions for GMP support
4  *
5  * Dave Katz, March 2008
6  *
7  * Copyright (c) 2008, Juniper Networks, Inc.
8  * All rights reserved.
9  *
10  * This file defines general, common definitions for both host-side and
11  * router-side GMP, and is expected to be included in external code that
12  * uses the GMP toolkit.
13  */
14 
15 #ifndef __GMP_H__
16 #define __GMP_H__
17 
18 /*
19  * Basic address lengths
20  *
21  * This will never change, and we don't have to pull in a bunch of IP gorp
22  * to use it.
23  */
24 #define IPV4_ADDR_LEN 4 /* Length of a v4 address */
25 #define IPV6_ADDR_LEN 16 /* Length of a v6 address */
26 
27 
28 /*
29  * Instance ID. Used to identify an instance of gmp_host or gmp_router.
30  * This is actually a pointer to the associated instance block.
31  */
32 typedef void *gmp_instance_id;
33 
34 
35 /*
36  * Client ID. Used to identify clients of gmp_host and gmp_router. This
37  * is actually a pointer to the associated client block.
38  */
39 typedef void *gmp_client_id; /* Client ID */
40 
41 
42 /*
43  * Protocol. Used to identify which GMP protocol is in use.
44  */
45 typedef enum {
46  GMP_PROTO_IGMP, /* IGMP */
47  GMP_PROTO_MLD, /* MLD */
48  GMP_NUM_PROTOS /* Number of protocols */
50 
51 
52 /*
53  * GMP roles. They are HOST and ROUTER. We can support both at the
54  * same time.
55  */
56 typedef enum {
57  GMP_ROLE_HOST, /* Host-side GMP */
58  GMP_ROLE_ROUTER, /* Router-side GMP */
59  GMP_NUM_ROLES /* Number of roles */
61 
62 
63 /*
64  * Filter mode. Identifies whether a source list inclusive or exclusive.
65  */
68 
69 
70 /*
71  * Address string
72  *
73  * This is an address, either IPv4 or IPv6, in network byte order. The
74  * address type is contextualized by its environment (IGMP vs. MLD).
75  */
76 typedef union gmp_addrstring_ {
77  uint8_t gmp_v4_addr[IPV4_ADDR_LEN]; /* IPv4 address */
78  uint8_t gmp_v6_addr[IPV6_ADDR_LEN]; /* IPv6 address */
79  uint8_t gmp_addr[1]; /* Generic address pointer */
81 
82 
83 /*
84  * GMP host interface parameters
85  *
86  * Passed via the gmph_set_intf_params call
87  */
88 typedef struct gmph_intf_params_ {
89  uint8_t gmph_version; /* Protocol version */
91 
92 /*
93  * GMP router interface parameters
94  *
95  * Passed via the gmpr_set_intf_params call
96  */
97 typedef struct gmpr_intf_params_ {
98  uint8_t gmpr_ifparm_version; /* Protocol version */
99  uint8_t gmpr_ifparm_robustness; /* Robustness value */
100  uint32_t gmpr_ifparm_qivl; /* Query interval */
101  uint32_t gmpr_ifparm_qrivl; /* Query response interval */
102  uint32_t gmpr_ifparm_lmqi; /* Last member query interval */
103  uint32_t gmpr_ifparm_chan_limit; /* Channel limit */
104  uint32_t gmpr_ifparm_chan_threshold; /* Channel threshold */
105  uint32_t gmpr_ifparm_log_interval; /* Time between consecutive similar limit log events */
106  boolean gmpr_ifparm_fast_leave; /* Fast leaves */
107  boolean gmpr_ifparm_querier_enabled; /* Allowed to be V1 querier */
108  boolean gmpr_ifparm_passive_receive; /* Passive receive */
109  boolean gmpr_ifparm_suppress_gen_query; /* Suppress general queries */
110  boolean gmpr_ifparm_suppress_gs_query; /* Suppress GS/GSS queries */
112 
113 /*
114  * IGMP versions
115  */
116 typedef enum {
122 
123 
124 /*
125  * MLD versions
126  */
127 typedef enum {
132 
133 
134 /*
135  * Timer groups
136  *
137  * Timers in GMP are organized into groups by type. This allows for a group
138  * to be treated as an equivalence class by the environment, for such things
139  * as timer smearing.
140  */
141 typedef enum {
142  GMP_TIMER_GROUP_DEFAULT, /* Default */
143  GMP_TIMER_GROUP_GEN_QUERY, /* General query timers */
144 
145  GMP_NUM_TIMER_GROUPS /* Number of timer groups */
147 
148 
149 /*
150  * Address thread, address thread entry
151  *
152  * These are opaque types that carry a thread of addresses. The
153  * actual definitions are hidden.
154  */
155 typedef struct gmp_addr_thread_ gmp_addr_thread;
157 typedef struct gmp_packet_ gmp_packet;
158 
159 #endif /* __GMP_H__ */
#define IPV6_ADDR_LEN
Definition: gmp.h:25
void * gmp_client_id
Definition: gmp.h:39
mld_version
Definition: gmp.h:127
@ GMP_MLD_VERSION_2
Definition: gmp.h:130
@ GMP_MLD_VERSION_UNSPEC
Definition: gmp.h:128
@ GMP_MLD_VERSION_1
Definition: gmp.h:129
gmp_filter_mode
Definition: gmp.h:66
@ GMP_FILTER_MODE_EXCLUDE
Definition: gmp.h:66
@ GMP_FILTER_MODE_INCLUDE
Definition: gmp.h:66
gmp_timer_group
Definition: gmp.h:141
@ GMP_NUM_TIMER_GROUPS
Definition: gmp.h:145
@ GMP_TIMER_GROUP_DEFAULT
Definition: gmp.h:142
@ GMP_TIMER_GROUP_GEN_QUERY
Definition: gmp.h:143
void * gmp_instance_id
Definition: gmp.h:32
struct gmph_intf_params_ gmph_intf_params
#define IPV4_ADDR_LEN
Definition: gmp.h:24
union gmp_addrstring_ gmp_addr_string
igmp_version
Definition: gmp.h:116
@ GMP_IGMP_VERSION_UNSPEC
Definition: gmp.h:117
@ GMP_IGMP_VERSION_2
Definition: gmp.h:119
@ GMP_IGMP_VERSION_3
Definition: gmp.h:120
@ GMP_IGMP_VERSION_1
Definition: gmp.h:118
struct gmpr_intf_params_ gmpr_intf_params
gmp_proto
Definition: gmp.h:45
@ GMP_PROTO_MLD
Definition: gmp.h:47
@ GMP_NUM_PROTOS
Definition: gmp.h:48
@ GMP_PROTO_IGMP
Definition: gmp.h:46
gmp_role
Definition: gmp.h:56
@ GMP_ROLE_HOST
Definition: gmp.h:57
@ GMP_NUM_ROLES
Definition: gmp.h:59
@ GMP_ROLE_ROUTER
Definition: gmp.h:58
Definition: gmp_private.h:355
uint8_t gmph_version
Definition: gmp.h:89
uint32_t gmpr_ifparm_qivl
Definition: gmp.h:100
boolean gmpr_ifparm_fast_leave
Definition: gmp.h:106
uint32_t gmpr_ifparm_chan_threshold
Definition: gmp.h:104
boolean gmpr_ifparm_suppress_gen_query
Definition: gmp.h:109
boolean gmpr_ifparm_suppress_gs_query
Definition: gmp.h:110
uint32_t gmpr_ifparm_chan_limit
Definition: gmp.h:103
boolean gmpr_ifparm_passive_receive
Definition: gmp.h:108
uint32_t gmpr_ifparm_lmqi
Definition: gmp.h:102
uint8_t gmpr_ifparm_robustness
Definition: gmp.h:99
uint8_t gmpr_ifparm_version
Definition: gmp.h:98
uint32_t gmpr_ifparm_log_interval
Definition: gmp.h:105
uint32_t gmpr_ifparm_qrivl
Definition: gmp.h:101
boolean gmpr_ifparm_querier_enabled
Definition: gmp.h:107
uint8_t gmp_v6_addr[IPV6_ADDR_LEN]
Definition: gmp.h:78
uint8_t gmp_v4_addr[IPV4_ADDR_LEN]
Definition: gmp.h:77
uint8_t gmp_addr[1]
Definition: gmp.h:79