Hybrid ICN (hICN) plugin  v21.06-rc0-4-g18fa668
loop.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2019 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
21 #ifndef FACEMGR_LOOP_H
22 #define FACEMGR_LOOP_H
23 
24 #include <hicn/facemgr/api.h>
25 
26 /* fd & timer callbacks */
27 
28 typedef int (*fd_callback_t)(void * owner, int fd, void * data);
29 
30 typedef struct {
31  int fd;
32  void *owner;
33  fd_callback_t callback;
34  //int (*callback)(void * owner, int fd, void * data);
35  void *data;
37 
38 /* timer callbacks */
39 typedef struct {
40  unsigned delay_ms;
41  void *owner;
42  fd_callback_t callback;
43  //int (*callback)(void * owner, int fd, void * data);
44  void *data;
46 
47 /* loop */
48 
49 typedef struct loop_s loop_t;
50 
55 loop_t * loop_create();
56 
61 void loop_free(loop_t * loop);
62 
68 int loop_dispatch(loop_t * loop);
69 
74 int loop_undispatch(loop_t * loop);
75 
80 void loop_break(loop_t * loop);
81 
82 
89 int loop_callback(loop_t * loop, facemgr_cb_type_t type, void * data);
90 
91 #endif /* FACEMGR_LOOP_H */
loop_undispatch
int loop_undispatch(loop_t *loop)
Terminates the dispatching of events.
loop_dispatch
int loop_dispatch(loop_t *loop)
Runs the loop instance to process events.
loop_callback
int loop_callback(loop_t *loop, facemgr_cb_type_t type, void *data)
Callback for loop helpers.
loop_free
void loop_free(loop_t *loop)
Releases a loop instance and frees all associated memory.
loop_break
void loop_break(loop_t *loop)
Breaks out of the loop.
fd_callback_data_t
Definition: loop.h:30
timer_callback_data_t
Definition: loop.h:39
loop_create
loop_t * loop_create()
Creates a main loop.