2 * Copyright (C) 2016, 2017 "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 */
49 * Definition of the interface for the API
53 /* CAUTION: respect the order, add at the end */
64 /* gets the common systemd's event loop */
65 struct sd_event *(*get_event_loop)(
68 /* gets the common systemd's user d-bus */
69 struct sd_bus *(*get_user_bus)(
72 /* gets the common systemd's system d-bus */
73 struct sd_bus *(*get_system_bus)(
76 int (*rootdir_get_fd)(
79 int (*rootdir_open_locale)(
87 void (*callback)(int signum, void *arg),
101 /* broadcasts event 'name' with 'object' */
102 int (*event_broadcast)(
105 struct json_object *object);
107 /* creates an event of 'name' */
108 struct afb_eventid *(*eventid_make)(
113 struct afb_dynapi *dynapi,
116 struct json_object *args,
117 void (*callback)(void*, int, struct json_object*, struct afb_dynapi *),
118 void *callback_closure);
124 struct json_object *args,
125 struct json_object **result);
131 int (*preinit)(void*, struct afb_dynapi *),
134 int (*api_set_verbs_v2)(
135 struct afb_dynapi *dynapi,
136 const struct afb_verb_v2 *verbs);
139 struct afb_dynapi *dynapi,
142 void (*callback)(struct afb_request *request),
143 const struct afb_auth *auth,
147 struct afb_dynapi *dynapi,
150 int (*api_set_on_event)(
151 struct afb_dynapi *dynapi,
152 void (*onevent)(struct afb_dynapi *dynapi, const char *event, struct json_object *object));
154 int (*api_set_on_init)(
155 struct afb_dynapi *dynapi,
156 int (*oninit)(struct afb_dynapi *dynapi));
159 struct afb_dynapi *dynapi);