FD.io VPP  v18.11-rc0-18-g2a3fb1a
Vector Packet Processing
igmp_timer.h
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * Copyright (c) 2017 Cisco and/or its affiliates.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *------------------------------------------------------------------
16  */
17 
18 #ifndef _IGMP_TIMER_H_
19 #define _IGMP_TIMER_H_
20 
21 #include <vlib/vlib.h>
22 
23 /**
24  * The id of a running timer
25  */
27 
28 #define IGMP_TIMER_ID_INVALID (~0)
29 
30 /**
31  * A call-back function invoked when a timer expires;
32  * @param obj - the [pool] index of the object that scheduled the timer
33  * @param data - Data registered by the client at schedule time.
34  */
35 typedef void (*igmp_timer_function_t) (u32 obj, void *data);
36 
37 /**
38  * @brief
39  * Scehdule a timer to expire in 'when' seconds
40  *
41  */
43  u32 obj,
45  void *data);
46 
47 extern void igmp_timer_retire (igmp_timer_id_t * tid);
48 extern int igmp_timer_is_running (igmp_timer_id_t tid);
49 
51 extern void *igmp_timer_get_data (igmp_timer_id_t t);
52 extern void igmp_timer_set_data (igmp_timer_id_t t, void *data);
53 
54 /**
55  * IGMP timer types and their values
56  * QUERY - the general query timer
57  * SRC - source expiration
58  * LEAVE - leave latency
59  */
60 #define foreach_igmp_timer_type \
61  _ (0x1, QUERY) \
62  _ (0x2, SRC) \
63  _ (0x3, LEAVE) \
64  _ (0x4, REPORT_INTERVAL)
65 
66 typedef enum igmp_timer_type_t_
67 {
68 #define _(n,f) IGMP_TIMER_##f = n,
70 #undef _
72 
75 
76 #endif /* IGMP_TIMER_H_ */
77 
78 /*
79  * fd.io coding-style-patch-verification: ON
80  *
81  * Local Variables:
82  * eval: (c-set-style "gnu")
83  * End:
84  */
enum igmp_timer_type_t_ igmp_timer_type_t
u32 igmp_timer_type_get(igmp_timer_type_t t)
Definition: igmp_timer.c:68
void * igmp_timer_get_data(igmp_timer_id_t t)
Definition: igmp_timer.c:112
f64 igmp_timer_get_expiry_time(igmp_timer_id_t t)
#define foreach_igmp_timer_type
IGMP timer types and their values QUERY - the general query timer SRC - source expiration LEAVE - lea...
Definition: igmp_timer.h:60
void igmp_timer_type_set(igmp_timer_type_t t, u32 v)
Definition: igmp_timer.c:75
double f64
Definition: types.h:142
int igmp_timer_is_running(igmp_timer_id_t tid)
Definition: igmp_timer.c:132
igmp_timer_type_t_
Definition: igmp_timer.h:66
unsigned int u32
Definition: types.h:88
#define v
Definition: acl.c:491
u32 igmp_timer_id_t
The id of a running timer.
Definition: igmp_timer.h:26
igmp_timer_id_t igmp_timer_schedule(f64 when, u32 obj, igmp_timer_function_t fn, void *data)
Scehdule a timer to expire in &#39;when&#39; seconds.
Definition: igmp_timer.c:196
void(* igmp_timer_function_t)(u32 obj, void *data)
A call-back function invoked when a timer expires;.
Definition: igmp_timer.h:35
void igmp_timer_retire(igmp_timer_id_t *tid)
Definition: igmp_timer.c:222
void igmp_timer_set_data(igmp_timer_id_t t, void *data)
Definition: igmp_timer.c:122