FD.io VPP  v20.09-64-g4f7b92f0a
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  * Schedule 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 extern u8 *format_igmp_timer_id (u8 * s, va_list * args);
55 
56 /**
57  * IGMP timer types and their values
58  * QUERY - the general query timer
59  * SRC - source expiration
60  * LEAVE - leave latency
61  */
62 #define foreach_igmp_timer_type \
63  _ (0x1, QUERY) \
64  _ (0x2, SRC) \
65  _ (0x3, LEAVE) \
66  _ (0x4, REPORT_INTERVAL)
67 
68 typedef enum igmp_timer_type_t_
69 {
70 #define _(n,f) IGMP_TIMER_##f = n,
72 #undef _
74 
76 extern void igmp_timer_type_set (igmp_timer_type_t t, u32 v);
77 
78 #endif /* IGMP_TIMER_H_ */
79 
80 /*
81  * fd.io coding-style-patch-verification: ON
82  *
83  * Local Variables:
84  * eval: (c-set-style "gnu")
85  * End:
86  */
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:111
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:62
unsigned char u8
Definition: types.h:56
u8 data[128]
Definition: ipsec_types.api:89
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:131
igmp_timer_type_t_
Definition: igmp_timer.h:68
unsigned int u32
Definition: types.h:88
u8 * format_igmp_timer_id(u8 *s, va_list *args)
Definition: igmp_timer.c:235
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)
Schedule a timer to expire in &#39;when&#39; seconds.
Definition: igmp_timer.c:195
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:221
void igmp_timer_set_data(igmp_timer_id_t t, void *data)
Definition: igmp_timer.c:121