2 * Copyright (C) 2018 "IoT.bzh"
3 * Author: José Bollo <jose.bollo@iot.bzh>
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
20 /******************************************************************************/
22 #if AFB_BINDING_VERSION == 1 || AFB_BINDING_VERSION == 2
24 #define afb_req afb_req_x1
25 #define afb_req_is_valid afb_req_x1_is_valid
26 #define afb_req_get afb_req_x1_get
27 #define afb_req_value afb_req_x1_value
28 #define afb_req_path afb_req_x1_path
29 #define afb_req_json afb_req_x1_json
30 #define afb_req_reply afb_req_x1_reply
31 #define afb_req_reply_f afb_req_x1_reply_f
32 #define afb_req_reply_v afb_req_x1_reply_v
33 #define afb_req_success(r,o,i) afb_req_x1_reply(r,o,0,i)
34 #define afb_req_success_f(r,o,...) afb_req_x1_reply_f(r,o,0,__VA_ARGS__)
35 #define afb_req_success_v(r,o,f,v) afb_req_x1_reply_v(r,o,0,f,v)
36 #define afb_req_fail(r,e,i) afb_req_x1_reply(r,0,e,i)
37 #define afb_req_fail_f(r,e,...) afb_req_x1_reply_f(r,0,e,__VA_ARGS__)
38 #define afb_req_fail_v(r,e,f,v) afb_req_x1_reply_v(r,0,e,f,v)
39 #define afb_req_context_get afb_req_x1_context_get
40 #define afb_req_context_set afb_req_x1_context_set
41 #define afb_req_context afb_req_x1_context
42 #define afb_req_context_make afb_req_x1_context_make
43 #define afb_req_context_clear afb_req_x1_context_clear
44 #define afb_req_addref afb_req_x1_addref
45 #define afb_req_unref afb_req_x1_unref
46 #define afb_req_session_close afb_req_x1_session_close
47 #define afb_req_session_set_LOA afb_req_x1_session_set_LOA
48 #define afb_req_subscribe afb_req_x1_subscribe
49 #define afb_req_unsubscribe afb_req_x1_unsubscribe
50 #define afb_req_subcall afb_req_x1_subcall
51 #define afb_req_subcall_req afb_req_x1_subcall_req
52 #define afb_req_subcall_sync afb_req_x1_subcall_sync
53 #define afb_req_verbose afb_req_x1_verbose
54 #define afb_req_has_permission afb_req_x1_has_permission
55 #define afb_req_get_application_id afb_req_x1_get_application_id
56 #define afb_req_get_uid afb_req_x1_get_uid
57 #define afb_req_get_client_info afb_req_x1_get_client_info
59 #define afb_event afb_event_x1
60 #define afb_event_to_event_x2 afb_event_x1_to_event_x2
61 #define afb_event_is_valid afb_event_x1_is_valid
62 #define afb_event_broadcast afb_event_x1_broadcast
63 #define afb_event_push afb_event_x1_push
64 #define afb_event_drop afb_event_x1_unref
65 #define afb_event_name afb_event_x1_name
66 #define afb_event_unref afb_event_x1_unref
67 #define afb_event_addref afb_event_x1_addref
69 #define afb_service afb_service_x1
70 #define afb_daemon afb_daemon_x1
72 #define _AFB_SYSLOG_LEVEL_EMERGENCY_ AFB_SYSLOG_LEVEL_EMERGENCY
73 #define _AFB_SYSLOG_LEVEL_ALERT_ AFB_SYSLOG_LEVEL_ALERT
74 #define _AFB_SYSLOG_LEVEL_CRITICAL_ AFB_SYSLOG_LEVEL_CRITICAL
75 #define _AFB_SYSLOG_LEVEL_ERROR_ AFB_SYSLOG_LEVEL_ERROR
76 #define _AFB_SYSLOG_LEVEL_WARNING_ AFB_SYSLOG_LEVEL_WARNING
77 #define _AFB_SYSLOG_LEVEL_NOTICE_ AFB_SYSLOG_LEVEL_NOTICE
78 #define _AFB_SYSLOG_LEVEL_INFO_ AFB_SYSLOG_LEVEL_INFO
79 #define _AFB_SYSLOG_LEVEL_DEBUG_ AFB_SYSLOG_LEVEL_DEBUG
83 /******************************************************************************/
84 #if AFB_BINDING_VERSION == 1
86 #define afb_req_store afb_req_x1_store_v1
87 #define afb_req_unstore afb_req_x1_unstore_v1
89 #define afb_binding afb_binding_v1
90 #define afb_binding_interface afb_binding_interface_v1
92 #define afb_daemon_get_event_loop afb_daemon_get_event_loop_v1
93 #define afb_daemon_get_user_bus afb_daemon_get_user_bus_v1
94 #define afb_daemon_get_system_bus afb_daemon_get_system_bus_v1
95 #define afb_daemon_broadcast_event afb_daemon_broadcast_event_v1
96 #define afb_daemon_make_event afb_daemon_make_event_v1
97 #define afb_daemon_verbose afb_daemon_verbose_v1
98 #define afb_daemon_rootdir_get_fd afb_daemon_rootdir_get_fd_v1
99 #define afb_daemon_rootdir_open_locale afb_daemon_rootdir_open_locale_v1
100 #define afb_daemon_queue_job afb_daemon_queue_job_v1
101 #define afb_daemon_require_api afb_daemon_require_api_v1
102 #define afb_daemon_rename_api afb_daemon_add_alias_v1
104 #define afb_service_call afb_service_call_v1
105 #define afb_service_call_sync afb_service_call_sync_v1
107 # define AFB_ERROR AFB_ERROR_V1
108 # define AFB_WARNING AFB_WARNING_V1
109 # define AFB_NOTICE AFB_NOTICE_V1
110 # define AFB_INFO AFB_INFO_V1
111 # define AFB_DEBUG AFB_DEBUG_V1
113 # define AFB_REQ_ERROR AFB_REQ_ERROR_V1
114 # define AFB_REQ_WARNING AFB_REQ_WARNING_V1
115 # define AFB_REQ_NOTICE AFB_REQ_NOTICE_V1
116 # define AFB_REQ_INFO AFB_REQ_INFO_V1
117 # define AFB_REQ_DEBUG AFB_REQ_DEBUG_V1
119 #define AFB_REQ_VERBOSE AFB_REQ_VERBOSE_V1
121 # define AFB_SESSION_NONE AFB_SESSION_NONE_X1
122 # define AFB_SESSION_CREATE AFB_SESSION_CREATE_X1
123 # define AFB_SESSION_CLOSE AFB_SESSION_CLOSE_X1
124 # define AFB_SESSION_RENEW AFB_SESSION_RENEW_X1
125 # define AFB_SESSION_CHECK AFB_SESSION_CHECK_X1
127 # define AFB_SESSION_LOA_GE AFB_SESSION_LOA_GE_X1
128 # define AFB_SESSION_LOA_LE AFB_SESSION_LOA_LE_X1
129 # define AFB_SESSION_LOA_EQ AFB_SESSION_LOA_EQ_X1
131 # define AFB_SESSION_LOA_SHIFT AFB_SESSION_LOA_SHIFT_X1
132 # define AFB_SESSION_LOA_MASK AFB_SESSION_LOA_MASK_X1
134 # define AFB_SESSION_LOA_0 AFB_SESSION_LOA_0_X1
135 # define AFB_SESSION_LOA_1 AFB_SESSION_LOA_1_X1
136 # define AFB_SESSION_LOA_2 AFB_SESSION_LOA_2_X1
137 # define AFB_SESSION_LOA_3 AFB_SESSION_LOA_3_X1
138 # define AFB_SESSION_LOA_4 AFB_SESSION_LOA_4_X1
140 # define AFB_SESSION_LOA_LE_0 AFB_SESSION_LOA_LE_0_X1
141 # define AFB_SESSION_LOA_LE_1 AFB_SESSION_LOA_LE_1_X1
142 # define AFB_SESSION_LOA_LE_2 AFB_SESSION_LOA_LE_2_X1
143 # define AFB_SESSION_LOA_LE_3 AFB_SESSION_LOA_LE_3_X1
145 # define AFB_SESSION_LOA_EQ_0 AFB_SESSION_LOA_EQ_0_X1
146 # define AFB_SESSION_LOA_EQ_1 AFB_SESSION_LOA_EQ_1_X1
147 # define AFB_SESSION_LOA_EQ_2 AFB_SESSION_LOA_EQ_2_X1
148 # define AFB_SESSION_LOA_EQ_3 AFB_SESSION_LOA_EQ_3_X1
150 # define AFB_SESSION_LOA_GE_0 AFB_SESSION_LOA_GE_0_X1
151 # define AFB_SESSION_LOA_GE_1 AFB_SESSION_LOA_GE_1_X1
152 # define AFB_SESSION_LOA_GE_2 AFB_SESSION_LOA_GE_2_X1
153 # define AFB_SESSION_LOA_GE_3 AFB_SESSION_LOA_GE_3_X1
157 /******************************************************************************/
158 #if AFB_BINDING_VERSION == 2
160 #define afb_req_store afb_req_x1_store_v2
161 #define afb_req_unstore afb_daemon_unstore_req_v2
163 #define afb_binding afb_binding_v2
165 #define afb_get_verbosity afb_get_verbosity_v2
166 #define afb_get_daemon afb_get_daemon_v2
167 #define afb_get_service afb_get_service_v2
169 #define afb_daemon_get_event_loop afb_daemon_get_event_loop_v2
170 #define afb_daemon_get_user_bus afb_daemon_get_user_bus_v2
171 #define afb_daemon_get_system_bus afb_daemon_get_system_bus_v2
172 #define afb_daemon_broadcast_event afb_daemon_broadcast_event_v2
173 #define afb_daemon_make_event afb_daemon_make_event_v2
174 #define afb_daemon_verbose afb_daemon_verbose_v2
175 #define afb_daemon_rootdir_get_fd afb_daemon_rootdir_get_fd_v2
176 #define afb_daemon_rootdir_open_locale afb_daemon_rootdir_open_locale_v2
177 #define afb_daemon_queue_job afb_daemon_queue_job_v2
178 #define afb_daemon_unstore_req afb_daemon_unstore_req_v2
179 #define afb_daemon_require_api afb_daemon_require_api_v2
180 #define afb_daemon_rename_api(x) afb_daemon_add_alias_v2(0,x)
181 #define afb_daemon_add_alias afb_daemon_add_alias_v2
183 #define afb_service_call afb_service_call_v2
184 #define afb_service_call_sync afb_service_call_sync_v2
186 #define AFB_ERROR AFB_ERROR_V2
187 #define AFB_WARNING AFB_WARNING_V2
188 #define AFB_NOTICE AFB_NOTICE_V2
189 #define AFB_INFO AFB_INFO_V2
190 #define AFB_DEBUG AFB_DEBUG_V2
192 #define AFB_REQ_ERROR AFB_REQ_ERROR_V2
193 #define AFB_REQ_WARNING AFB_REQ_WARNING_V2
194 #define AFB_REQ_NOTICE AFB_REQ_NOTICE_V2
195 #define AFB_REQ_INFO AFB_REQ_INFO_V2
196 #define AFB_REQ_DEBUG AFB_REQ_DEBUG_V2
198 #define AFB_REQ_VERBOSE AFB_REQ_VERBOSE_V2
202 /******************************************************************************/
203 #if AFB_BINDING_VERSION == 2 || AFB_BINDING_VERSION == 3
205 #define AFB_SESSION_NONE AFB_SESSION_NONE_X2
206 #define AFB_SESSION_CLOSE AFB_SESSION_CLOSE_X2
207 #define AFB_SESSION_RENEW AFB_SESSION_REFRESH_X2
208 #define AFB_SESSION_REFRESH AFB_SESSION_REFRESH_X2
209 #define AFB_SESSION_CHECK AFB_SESSION_CHECK_X2
211 #define AFB_SESSION_LOA_MASK AFB_SESSION_LOA_MASK_X2
213 #define AFB_SESSION_LOA_0 AFB_SESSION_LOA_0_X2
214 #define AFB_SESSION_LOA_1 AFB_SESSION_LOA_1_X2
215 #define AFB_SESSION_LOA_2 AFB_SESSION_LOA_2_X2
216 #define AFB_SESSION_LOA_3 AFB_SESSION_LOA_3_X2
220 /******************************************************************************/
221 #if AFB_BINDING_VERSION == 2
223 #define AFB_SESSION_NONE_V2 AFB_SESSION_NONE_X2
224 #define AFB_SESSION_CLOSE_V2 AFB_SESSION_CLOSE_X2
225 #define AFB_SESSION_RENEW_V2 AFB_SESSION_REFRESH_X2
226 #define AFB_SESSION_REFRESH_V2 AFB_SESSION_REFRESH_X2
227 #define AFB_SESSION_CHECK_V2 AFB_SESSION_CHECK_X2
229 #define AFB_SESSION_LOA_MASK_V2 AFB_SESSION_LOA_MASK_X2
231 #define AFB_SESSION_LOA_0_V2 AFB_SESSION_LOA_0_X2
232 #define AFB_SESSION_LOA_1_V2 AFB_SESSION_LOA_1_X2
233 #define AFB_SESSION_LOA_2_V2 AFB_SESSION_LOA_2_X2
234 #define AFB_SESSION_LOA_3_V2 AFB_SESSION_LOA_3_X2
238 /******************************************************************************/
239 #if AFB_BINDING_VERSION == 3
241 #define afb_req_x2 afb_req
243 #define afb_req_x2_is_valid afb_req_is_valid
244 #define afb_req_x2_get_api afb_req_get_api
245 #define afb_req_x2_get_vcbdata afb_req_get_vcbdata
246 #define afb_req_x2_get_called_api afb_req_get_called_api
247 #define afb_req_x2_get_called_verb afb_req_get_called_verb
248 #define afb_req_x2_wants_log_level afb_req_wants_log_level
250 #define afb_req_x2_get afb_req_get
251 #define afb_req_x2_value afb_req_value
252 #define afb_req_x2_path afb_req_path
253 #define afb_req_x2_json afb_req_json
254 #define afb_req_x2_reply afb_req_reply
255 #define afb_req_x2_reply_f afb_req_reply_f
256 #define afb_req_x2_reply_v afb_req_reply_v
257 #define afb_req_success(r,o,i) afb_req_reply(r,o,0,i)
258 #define afb_req_success_f(r,o,...) afb_req_reply_f(r,o,0,__VA_ARGS__)
259 #define afb_req_success_v(r,o,f,v) afb_req_reply_v(r,o,0,f,v)
260 #define afb_req_fail(r,e,i) afb_req_reply(r,0,e,i)
261 #define afb_req_fail_f(r,e,...) afb_req_reply_f(r,0,e,__VA_ARGS__)
262 #define afb_req_fail_v(r,e,f,v) afb_req_reply_v(r,0,e,f,v)
263 #define afb_req_x2_context_get afb_req_context_get
264 #define afb_req_x2_context_set afb_req_context_set
265 #define afb_req_x2_context afb_req_context
266 #define afb_req_x2_context_make afb_req_context_make
267 #define afb_req_x2_context_clear afb_req_context_clear
268 #define afb_req_x2_addref afb_req_addref
269 #define afb_req_x2_unref afb_req_unref
270 #define afb_req_x2_session_close afb_req_session_close
271 #define afb_req_x2_session_set_LOA afb_req_session_set_LOA
272 #define afb_req_x2_subscribe afb_req_subscribe
273 #define afb_req_x2_unsubscribe afb_req_unsubscribe
274 #define afb_req_x2_subcall afb_req_subcall
275 #define afb_req_x2_subcall_legacy afb_req_subcall_legacy
276 #define afb_req_x2_subcall_req afb_req_subcall_req
277 #define afb_req_x2_subcall_sync_legacy afb_req_subcall_sync_legacy
278 #define afb_req_x2_subcall_sync afb_req_subcall_sync
279 #define afb_req_x2_verbose afb_req_verbose
280 #define afb_req_x2_has_permission afb_req_has_permission
281 #define afb_req_x2_get_application_id afb_req_get_application_id
282 #define afb_req_x2_get_uid afb_req_get_uid
283 #define afb_req_x2_get_client_info afb_req_get_client_info
285 #define afb_req_x2_subcall_flags afb_req_subcall_flags
286 #define afb_req_x2_subcall_catch_events afb_req_subcall_catch_events
287 #define afb_req_x2_subcall_pass_events afb_req_subcall_pass_events
288 #define afb_req_x2_subcall_on_behalf afb_req_subcall_on_behalf
289 #define afb_req_x2_subcall_api_session afb_req_subcall_api_session
291 #define afb_event_x2 afb_event
292 #define afb_event_x2_is_valid afb_event_is_valid
293 #define afb_event_x2_broadcast afb_event_broadcast
294 #define afb_event_x2_push afb_event_push
295 #define afb_event_x2_name afb_event_name
296 #define afb_event_x2_unref afb_event_unref
297 #define afb_event_x2_addref afb_event_addref
299 #define afb_api_x3 afb_api
301 #define afb_api_x3_name afb_api_name
302 #define afb_api_x3_get_userdata afb_api_get_userdata
303 #define afb_api_x3_set_userdata afb_api_set_userdata
304 #define afb_api_x3_wants_log_level afb_api_wants_log_level
306 #define afb_api_x3_verbose afb_api_verbose
307 #define afb_api_x3_get_event_loop afb_api_get_event_loop
308 #define afb_api_x3_get_user_bus afb_api_get_user_bus
309 #define afb_api_x3_get_system_bus afb_api_get_system_bus
310 #define afb_api_x3_rootdir_get_fd afb_api_rootdir_get_fd
311 #define afb_api_x3_rootdir_open_locale afb_api_rootdir_open_locale
312 #define afb_api_x3_queue_job afb_api_queue_job
313 #define afb_api_x3_require_api afb_api_require_api
314 #define afb_api_x3_broadcast_event afb_api_broadcast_event
315 #define afb_api_x3_make_event_x2 afb_api_make_event
316 #define afb_api_x3_call afb_api_call
317 #define afb_api_x3_call_sync afb_api_call_sync
318 #define afb_api_x3_call_legacy afb_api_call_legacy
319 #define afb_api_x3_call_sync_legacy afb_api_call_sync_legacy
320 #define afb_api_x3_new_api afb_api_new_api
321 #define afb_api_x3_delete_api afb_api_delete_api
322 #define afb_api_x3_set_verbs_v2 afb_api_set_verbs_v2
323 #define afb_api_x3_set_verbs_v3 afb_api_set_verbs_v3
324 #define afb_api_x3_add_verb afb_api_add_verb
325 #define afb_api_x3_del_verb afb_api_del_verb
326 #define afb_api_x3_on_event afb_api_on_event
327 #define afb_api_x3_on_init afb_api_on_init
328 #define afb_api_x3_seal afb_api_seal
329 #define afb_api_x3_add_alias afb_api_add_alias
330 #define afb_api_x3_event_handler_add afb_api_event_handler_add
331 #define afb_api_x3_event_handler_del afb_api_event_handler_del
332 #define afb_api_x3_require_class afb_api_require_class
333 #define afb_api_x3_provide_class afb_api_provide_class
334 #define afb_api_x3_settings afb_api_settings
336 #define AFB_API_ERROR AFB_API_ERROR_V3
337 #define AFB_API_WARNING AFB_API_WARNING_V3
338 #define AFB_API_NOTICE AFB_API_NOTICE_V3
339 #define AFB_API_INFO AFB_API_INFO_V3
340 #define AFB_API_DEBUG AFB_API_DEBUG_V3
342 #define AFB_REQ_ERROR AFB_REQ_ERROR_V3
343 #define AFB_REQ_WARNING AFB_REQ_WARNING_V3
344 #define AFB_REQ_NOTICE AFB_REQ_NOTICE_V3
345 #define AFB_REQ_INFO AFB_REQ_INFO_V3
346 #define AFB_REQ_DEBUG AFB_REQ_DEBUG_V3
348 #define AFB_REQ_VERBOSE AFB_REQ_VERBOSE_V3
350 #define afb_stored_req afb_req_x2
351 #define afb_req_store(x) afb_req_x2_addref(x)
352 #define afb_req_unstore(x) (x)
354 #define afb_get_verbosity afb_get_verbosity_v3
355 #define afb_get_logmask afb_get_logmask_v3
356 #define afb_get_daemon afb_get_root_api_v3
357 #define afb_get_service afb_get_root_api_v3
359 #define afb_daemon_get_event_loop afb_daemon_get_event_loop_v3
360 #define afb_daemon_get_user_bus afb_daemon_get_user_bus_v3
361 #define afb_daemon_get_system_bus afb_daemon_get_system_bus_v3
362 #define afb_daemon_broadcast_event afb_daemon_broadcast_event_v3
363 #define afb_daemon_make_event afb_daemon_make_event_v3
364 #define afb_daemon_verbose afb_daemon_verbose_v3
365 #define afb_daemon_rootdir_get_fd afb_daemon_rootdir_get_fd_v3
366 #define afb_daemon_rootdir_open_locale afb_daemon_rootdir_open_locale_v3
367 #define afb_daemon_queue_job afb_daemon_queue_job_v3
368 #define afb_daemon_require_api afb_daemon_require_api_v3
369 #define afb_daemon_add_alias afb_daemon_add_alias_v3
371 # define afb_service_call afb_service_call_v3
372 # define afb_service_call_sync afb_service_call_sync_v3
373 # define afb_service_call_legacy afb_service_call_legacy_v3
374 # define afb_service_call_sync_legacy afb_service_call_sync_legacy_v3
376 # define AFB_ERROR AFB_ERROR_V3
377 # define AFB_WARNING AFB_WARNING_V3
378 # define AFB_NOTICE AFB_NOTICE_V3
379 # define AFB_INFO AFB_INFO_V3
380 # define AFB_DEBUG AFB_DEBUG_V3