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:
8 * http://www.apache.org/licenses/LICENSE-2.0
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 *------------------------------------------------------------------
18 #ifndef _IGMP_TIMER_H_
19 #define _IGMP_TIMER_H_
21 #include <vlib/vlib.h>
24 * The id of a running timer
26 typedef u32 igmp_timer_id_t;
28 #define IGMP_TIMER_ID_INVALID (~0)
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.
35 typedef void (*igmp_timer_function_t) (u32 obj, void *data);
39 * Schedule a timer to expire in 'when' seconds
42 extern igmp_timer_id_t igmp_timer_schedule (f64 when,
44 igmp_timer_function_t fn,
47 extern void igmp_timer_retire (igmp_timer_id_t * tid);
48 extern int igmp_timer_is_running (igmp_timer_id_t tid);
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);
54 extern u8 *format_igmp_timer_id (u8 * s, va_list * args);
57 * IGMP timer types and their values
58 * QUERY - the general query timer
59 * SRC - source expiration
60 * LEAVE - leave latency
62 #define foreach_igmp_timer_type \
66 _ (0x4, REPORT_INTERVAL)
68 typedef enum igmp_timer_type_t_
70 #define _(n,f) IGMP_TIMER_##f = n,
71 foreach_igmp_timer_type
75 extern u32 igmp_timer_type_get (igmp_timer_type_t t);
76 extern void igmp_timer_type_set (igmp_timer_type_t t, u32 v);
78 #endif /* IGMP_TIMER_H_ */
81 * fd.io coding-style-patch-verification: ON
84 * eval: (c-set-style "gnu")