CNDP  22.08.0
cne.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2019-2022 Intel Corporation
3  */
4 
5 // IWYU pragma: no_include "cne_private.h"
6 
7 #include <stdio.h> // for FILE
8 #include <stdint.h> // for uint16_t
9 
10 #ifndef _CNE_H_
11 #define _CNE_H_
12 
13 #include <cne_common.h> // for CNDP_API
14 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 enum {
31 };
32 
33 /* Maybe defined first in the cne_private.h file, so guard for this case. */
34 #ifndef _CNE_PRIVATE_H_
45 typedef void (*on_exit_fn_t)(int sig, void *arg, int exit_type);
46 #endif
47 
48 #define COPYRIGHT_MSG "Copyright (c) 2020-2022 Intel Corporation. All rights reserved."
49 #define COPYRIGHT_MSG_SHORT "Copyright (c) 2020-2022 Intel Corporation"
50 #define POWERED_BY_CNDP "Powered by CNDP"
51 
63 CNDP_API int cne_init(void);
64 
84 CNDP_API int cne_on_exit(on_exit_fn_t exit_fn, void *arg, int *signals, int nb_signals);
85 
92 CNDP_API int cne_initial_uid(void);
93 
100 CNDP_API int cne_entry_uid(void);
101 
114 CNDP_API int cne_register(const char *name);
115 
129 CNDP_API int cne_unregister(int tidx);
130 
141 CNDP_API int cne_set_private(int tidx, void *v);
142 
153 CNDP_API int cne_get_private(int tidx, void **v);
154 
161 CNDP_API int cne_id(void);
162 
169 CNDP_API int cne_max_threads(void);
170 
183 CNDP_API int cne_next_id(int uid, int skip, int wrap);
184 
191 CNDP_API int cne_active_threads(void);
192 
199 CNDP_API void cne_dump(FILE *f);
200 
206 static inline const char *
208 {
209  return COPYRIGHT_MSG;
210 }
211 
217 static inline const char *
219 {
220  return COPYRIGHT_MSG_SHORT;
221 }
222 
228 static inline const char *
230 {
231  return POWERED_BY_CNDP;
232 }
233 
234 #ifdef __cplusplus
235 }
236 #endif
237 
238 #endif /* _CNE_H_ */
CNDP_API int cne_id(void)
CNDP_API int cne_get_private(int tidx, void **v)
CNDP_API int cne_max_threads(void)
CNDP_API int cne_init(void)
static const char * copyright_msg_short(void)
Definition: cne.h:218
CNDP_API int cne_next_id(int uid, int skip, int wrap)
CNDP_API int cne_unregister(int tidx)
CNDP_API int cne_entry_uid(void)
static const char * copyright_msg(void)
Definition: cne.h:207
CNDP_API void cne_dump(FILE *f)
static const char * powered_by(void)
Definition: cne.h:229
CNDP_API int cne_set_private(int tidx, void *v)
void(* on_exit_fn_t)(int sig, void *arg, int exit_type)
Definition: cne.h:45
CNDP_API int cne_on_exit(on_exit_fn_t exit_fn, void *arg, int *signals, int nb_signals)
@ CNE_CALLED_EXIT
Definition: cne.h:28
@ CNE_USER_EXIT
Definition: cne.h:29
@ CNE_CAUGHT_SIGNAL
Definition: cne.h:27
@ MAX_EXIT_TYPES
Definition: cne.h:30
CNDP_API int cne_initial_uid(void)
CNDP_API int cne_active_threads(void)
CNDP_API int cne_register(const char *name)