CNDP  22.08.0
cne_event.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2010-2022 Intel Corporation
3  */
4 
10 #ifndef _CNE_EVENT_H_
11 #define _CNE_EVENT_H_
12 
13 #include <stdint.h>
14 #include <stdlib.h>
15 #include <fcntl.h>
16 #include <unistd.h>
17 #include <sys/types.h>
18 #include <sys/socket.h>
19 #include <sys/ioctl.h>
20 #include <sys/queue.h>
21 #include <errno.h>
22 #include <bsd/string.h>
23 
24 #include <cne_common.h>
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 enum cne_ev_handle_type { CNE_EV_HANDLE_MEM, CNE_EV_HANDLE_EXT, CNE_EV_HANDLE_MAX };
31 
33 struct cne_ev_handle {
34  int fd;
35  void *handle;
36  enum cne_ev_handle_type type;
37 };
38 
45 typedef void (*cne_ev_callback_fn)(void *cb_arg);
46 
56 typedef void (*cne_ev_unregister_callback_fn)(struct cne_ev_handle *ev_handle, void *cb_arg);
57 
62  char charbuf[16]; /* for others */
63 };
64 
81 CNDP_API int cne_ev_callback_register(const struct cne_ev_handle *ev_handle,
82  cne_ev_callback_fn cb_fn, void *cb_arg);
83 
100 CNDP_API int cne_ev_callback_unregister(const struct cne_ev_handle *ev_handle,
101  cne_ev_callback_fn cb_fn, void *cb_arg);
102 
122 CNDP_API int cne_ev_callback_unregister_pending(const struct cne_ev_handle *ev_handle,
123  cne_ev_callback_fn cb_fn, void *cb_arg,
125 
126 #ifdef __cplusplus
127 }
128 #endif
129 
130 #endif /* _CNE_EVENT_H_ */
void(* cne_ev_unregister_callback_fn)(struct cne_ev_handle *ev_handle, void *cb_arg)
Definition: cne_event.h:56
CNDP_API int cne_ev_callback_unregister_pending(const struct cne_ev_handle *ev_handle, cne_ev_callback_fn cb_fn, void *cb_arg, cne_ev_unregister_callback_fn ucb_fn)
void(* cne_ev_callback_fn)(void *cb_arg)
Definition: cne_event.h:45
CNDP_API int cne_ev_callback_register(const struct cne_ev_handle *ev_handle, cne_ev_callback_fn cb_fn, void *cb_arg)
CNDP_API int cne_ev_callback_unregister(const struct cne_ev_handle *ev_handle, cne_ev_callback_fn cb_fn, void *cb_arg)
void * handle
Definition: cne_event.h:35