Trivial: Clean up some typos.
[vpp.git] / src / plugins / igmp / igmp_timer.h
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  */
26 typedef u32 igmp_timer_id_t;
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  */
42 extern igmp_timer_id_t igmp_timer_schedule (f64 when,
43                                             u32 obj,
44                                             igmp_timer_function_t fn,
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
50 extern f64 igmp_timer_get_expiry_time (igmp_timer_id_t t);
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,
69   foreach_igmp_timer_type
70 #undef _
71 } igmp_timer_type_t;
72
73 extern u32 igmp_timer_type_get (igmp_timer_type_t t);
74 extern void igmp_timer_type_set (igmp_timer_type_t t, u32 v);
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  */