CNDP  22.08.0
ibroker.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2021-2022 Intel Corporation
3  */
4 
5 #ifndef _IBROKER_H_
6 #define _IBROKER_H_
7 
18 #include <cne_atomic.h>
19 #include <stdio.h>
20 #include <stdint.h>
21 #include <stddef.h>
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #define IBROKER_API __attribute__((visibility("default")))
28 
29 #define IBROKER_NAME_SIZE 64
30 #define IBROKER_MAX_SERVICES 64
31 #define IBROKER_MAX_COUNT 128
33 typedef int32_t broker_id_t;
34 typedef int32_t service_id_t;
39 typedef int (*ibroker_walk_t)(broker_id_t bid, void *arg);
40 
44 typedef int (*ibroker_func_t)(int vector, void *arg);
45 
46 struct service_info {
47  char name[IBROKER_NAME_SIZE];
48  int valid;
49  int uintr_fd;
50  int16_t index;
51  int16_t sid;
52  uint64_t call_cnt;
53  uint64_t err_cnt;
54 };
55 
56 typedef struct ibroker_info {
57  char name[IBROKER_NAME_SIZE];
58  int tid;
59  broker_id_t bid;
60  uint64_t intrs;
61  uint64_t invalid_service;
62  struct service_info services[IBROKER_MAX_SERVICES];
63 } ibroker_info_t;
64 
73 IBROKER_API broker_id_t ibroker_create(const char *name);
74 
83 IBROKER_API void ibroker_destroy(broker_id_t bid);
84 
93 IBROKER_API const char *ibroker_get_name(broker_id_t id);
94 
111 IBROKER_API service_id_t ibroker_add_service(broker_id_t id, const char *service, int vector,
112  ibroker_func_t func, void *arg);
113 
124 IBROKER_API int ibroker_del_service(broker_id_t bid, service_id_t sid);
125 
136 IBROKER_API int ibroker_send(broker_id_t bid, service_id_t sid);
137 
146 IBROKER_API broker_id_t ibroker_find(const char *name);
147 
158 IBROKER_API service_id_t ibroker_find_service(broker_id_t bid, const char *name);
159 
171 
182 IBROKER_API int ibroker_service_fd(broker_id_t bid, service_id_t sid);
183 
194 IBROKER_API const char *ibroker_service_name(broker_id_t bid, service_id_t sid);
195 
206 IBROKER_API int ibroker_walk(ibroker_walk_t func, void *arg);
207 
218 IBROKER_API int ibroker_id_list(broker_id_t *ids, int len);
219 
230 IBROKER_API int ibroker_info(broker_id_t bid, ibroker_info_t *info);
231 
232 #ifdef __cplusplus
233 }
234 #endif
235 
236 #endif /* _IBROKER_H_ */
IBROKER_API broker_id_t ibroker_create(const char *name)
IBROKER_API broker_id_t ibroker_find(const char *name)
IBROKER_API int ibroker_send(broker_id_t bid, service_id_t sid)
IBROKER_API int ibroker_info(broker_id_t bid, ibroker_info_t *info)
IBROKER_API const char * ibroker_get_name(broker_id_t id)
int(* ibroker_walk_t)(broker_id_t bid, void *arg)
Definition: ibroker.h:39
IBROKER_API void ibroker_destroy(broker_id_t bid)
int32_t broker_id_t
Definition: ibroker.h:33
IBROKER_API service_id_t ibroker_find_service(broker_id_t bid, const char *name)
IBROKER_API int ibroker_register_sender(broker_id_t bid, service_id_t sid)
int32_t service_id_t
Definition: ibroker.h:34
IBROKER_API service_id_t ibroker_add_service(broker_id_t id, const char *service, int vector, ibroker_func_t func, void *arg)
#define IBROKER_NAME_SIZE
Definition: ibroker.h:29
IBROKER_API int ibroker_del_service(broker_id_t bid, service_id_t sid)
IBROKER_API int ibroker_service_fd(broker_id_t bid, service_id_t sid)
IBROKER_API int ibroker_id_list(broker_id_t *ids, int len)
int(* ibroker_func_t)(int vector, void *arg)
Definition: ibroker.h:44
IBROKER_API int ibroker_walk(ibroker_walk_t func, void *arg)
#define IBROKER_MAX_SERVICES
Definition: ibroker.h:30
IBROKER_API const char * ibroker_service_name(broker_id_t bid, service_id_t sid)