2 * Copyright (C) 2016-2019 "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.
31 extern void afb_export_set_config(struct json_object *config);
33 extern struct afb_export *afb_export_create_none_for_path(
34 struct afb_apiset *declare_set,
35 struct afb_apiset *call_set,
37 int (*creator)(void*, struct afb_api_x3*),
40 extern struct afb_export *afb_export_create_v3(struct afb_apiset *declare_set,
41 struct afb_apiset *call_set,
43 struct afb_api_v3 *api,
44 struct afb_export* creator,
47 extern struct afb_export *afb_export_addref(struct afb_export *export);
48 extern void afb_export_unref(struct afb_export *export);
50 extern void afb_export_destroy(struct afb_export *export);
52 extern int afb_export_declare(struct afb_export *export, int noconcurrency);
53 extern void afb_export_undeclare(struct afb_export *export);
55 extern const char *afb_export_apiname(const struct afb_export *export);
56 extern int afb_export_add_alias(struct afb_export *export, const char *apiname, const char *aliasname);
57 extern int afb_export_rename(struct afb_export *export, const char *apiname);
59 extern int afb_export_unshare_session(struct afb_export *export);
61 extern int afb_export_preinit_x3(
62 struct afb_export *export,
63 int (*preinit)(void *,struct afb_api_x3*),
66 extern int afb_export_handle_events_v3(
67 struct afb_export *export,
68 void (*on_event)(struct afb_api_x3 *api, const char *event, struct json_object *object));
71 extern int afb_export_handle_init_v3(
72 struct afb_export *export,
73 int (*oninit)(struct afb_api_x3 *api));
75 extern int afb_export_start(struct afb_export *export);
77 extern int afb_export_logmask_get(const struct afb_export *export);
78 extern void afb_export_logmask_set(struct afb_export *export, int mask);
80 extern void *afb_export_userdata_get(const struct afb_export *export);
81 extern void afb_export_userdata_set(struct afb_export *export, void *data);
83 extern int afb_export_event_handler_add(
84 struct afb_export *export,
86 void (*callback)(void *, const char*, struct json_object*, struct afb_api_x3*),
89 extern int afb_export_event_handler_del(
90 struct afb_export *export,
94 extern int afb_export_subscribe(struct afb_export *export, struct afb_event_x2 *event);
95 extern int afb_export_unsubscribe(struct afb_export *export, struct afb_event_x2 *event);
96 extern void afb_export_process_xreq(struct afb_export *export, struct afb_xreq *xreq);
97 extern void afb_export_context_init(struct afb_export *export, struct afb_context *context);
98 extern struct afb_export *afb_export_from_api_x3(struct afb_api_x3 *api);
99 extern struct afb_api_x3 *afb_export_to_api_x3(struct afb_export *export);
102 extern void afb_export_update_hooks(struct afb_export *export);
105 #if WITH_LEGACY_BINDING_V1
107 struct afb_service_x1;
108 struct afb_binding_interface_v1;
110 extern struct afb_export *afb_export_create_v1(struct afb_apiset *declare_set,
111 struct afb_apiset *call_set,
113 int (*init)(struct afb_service_x1),
114 void (*onevent)(const char*, struct json_object*),
117 extern struct afb_binding_v1 *afb_export_register_v1(
118 struct afb_export *export,
119 struct afb_binding_v1 *(*regfun)(const struct afb_binding_interface_v1*));
123 #if WITH_LEGACY_BINDING_V2
125 struct afb_binding_v2;
126 struct afb_binding_data_v2;
128 extern struct afb_export *afb_export_create_v2(struct afb_apiset *declare_set,
129 struct afb_apiset *call_set,
131 const struct afb_binding_v2 *binding,
132 struct afb_binding_data_v2 *data,
134 void (*onevent)(const char*, struct json_object*),
139 #if WITH_LEGACY_BINDING_V1 || WITH_LEGACY_BINDING_V2
140 extern int afb_export_handle_events_v12(
141 struct afb_export *export,
142 void (*on_event)(const char *event, struct json_object *object));