2 * Copyright (C) 2016, 2017, 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.
22 struct afb_dynapi_itf;
34 * structure for the dynapi
38 /* interface for the dynapi */
39 const struct afb_dynapi_itf *itf;
41 /* user defined data */
44 /* current verbosity level */
47 /* the name of the api */
52 * Definition of the interface for the API
56 /* CAUTION: respect the order, add at the end */
67 /* gets the common systemd's event loop */
68 struct sd_event *(*get_event_loop)(
71 /* gets the common systemd's user d-bus */
72 struct sd_bus *(*get_user_bus)(
75 /* gets the common systemd's system d-bus */
76 struct sd_bus *(*get_system_bus)(
79 int (*rootdir_get_fd)(
82 int (*rootdir_open_locale)(
90 void (*callback)(int signum, void *arg),
104 /* broadcasts event 'name' with 'object' */
105 int (*event_broadcast)(
108 struct json_object *object);
110 /* creates an event of 'name' */
111 struct afb_eventid *(*eventid_make)(
116 struct afb_dynapi *dynapi,
119 struct json_object *args,
120 void (*callback)(void*, int, struct json_object*, struct afb_dynapi *),
121 void *callback_closure);
127 struct json_object *args,
128 struct json_object **result);
135 int (*preinit)(void*, struct afb_dynapi *),
138 int (*api_set_verbs_v2)(
139 struct afb_dynapi *dynapi,
140 const struct afb_verb_v2 *verbs);
143 struct afb_dynapi *dynapi,
146 void (*callback)(struct afb_request *request),
148 const struct afb_auth *auth,
152 struct afb_dynapi *dynapi,
155 int (*api_set_on_event)(
156 struct afb_dynapi *dynapi,
157 void (*onevent)(struct afb_dynapi *dynapi, const char *event, struct json_object *object));
159 int (*api_set_on_init)(
160 struct afb_dynapi *dynapi,
161 int (*oninit)(struct afb_dynapi *dynapi));
164 struct afb_dynapi *dynapi);