Update date of copyright notices
[src/app-framework-binder.git] / src / afb-export.h
1 /*
2  * Copyright (C) 2016, 2017, 2018 "IoT.bzh"
3  * Author: José Bollo <jose.bollo@iot.bzh>
4  *
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
8  *
9  *   http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  */
17
18 #pragma once
19
20 struct json_object;
21
22 struct afb_export;
23 struct afb_apiset;
24 struct afb_api_dyn;
25
26 struct afb_service;
27 struct afb_binding_data_v2;
28 struct afb_binding_interface_v1;
29 struct afb_dynapi;
30
31 extern struct afb_export *afb_export_create_v1(struct afb_apiset *apiset, const char *apiname, int (*init)(struct afb_service), void (*onevent)(const char*, struct json_object*));
32 extern struct afb_export *afb_export_create_v2(struct afb_apiset *apiset, const char *apiname, struct afb_binding_data_v2 *data, int (*init)(), void (*onevent)(const char*, struct json_object*));
33 extern struct afb_export *afb_export_create_vdyn(struct afb_apiset *apiset, const char *apiname, struct afb_api_dyn *dynapi);
34
35 extern void afb_export_destroy(struct afb_export *export);
36
37 extern const char *afb_export_apiname(const struct afb_export *export);
38 extern void afb_export_rename(struct afb_export *export, const char *apiname);
39 extern void afb_export_update_hook(struct afb_export *export);
40
41 extern int afb_export_unshare_session(struct afb_export *export);
42 extern void afb_export_set_apiset(struct afb_export *export, struct afb_apiset *apiset);
43 extern struct afb_apiset *afb_export_get_apiset(struct afb_export *export);
44         
45 extern struct afb_binding_v1 *afb_export_register_v1(struct afb_export *export, struct afb_binding_v1 *(*regfun)(const struct afb_binding_interface_v1*));
46 extern int afb_export_preinit_vdyn(struct afb_export *export, int (*preinit)(void*, struct afb_dynapi*), void *closure);
47
48 extern int afb_export_handle_events_v12(struct afb_export *export, void (*on_event)(const char *event, struct json_object *object));
49 extern int afb_export_handle_events_vdyn(struct afb_export *export, void (*on_event)(struct afb_dynapi *dynapi, const char *event, struct json_object *object));
50 extern int afb_export_handle_init_vdyn(struct afb_export *export, int (*oninit)(struct afb_dynapi *dynapi));
51
52 extern int afb_export_start(struct afb_export *export, int share_session, int onneed, struct afb_apiset *apiset);
53
54 extern int afb_export_verbosity_get(const struct afb_export *export);
55 extern void afb_export_verbosity_set(struct afb_export *export, int level);
56