Fedora 30 packaging fix issu
[src/app-framework-binder.git] / src / afb-calls.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_xreq;
24
25 struct afb_api_x3;
26 struct afb_req_x1;
27 struct afb_req_x2;
28
29 /******************************************************************************/
30
31 extern
32 void afb_calls_call(
33                 struct afb_export *export,
34                 const char *api,
35                 const char *verb,
36                 struct json_object *args,
37                 void (*callback)(void*, struct json_object*, const char *error, const char *info, struct afb_api_x3*),
38                 void *closure);
39
40 extern
41 void afb_calls_hooked_call(
42                 struct afb_export *export,
43                 const char *api,
44                 const char *verb,
45                 struct json_object *args,
46                 void (*callback)(void*, struct json_object*, const char *error, const char *info, struct afb_api_x3*),
47                 void *closure);
48
49 extern
50 int afb_calls_call_sync(
51                 struct afb_export *export,
52                 const char *api,
53                 const char *verb,
54                 struct json_object *args,
55                 struct json_object **object,
56                 char **error,
57                 char **info);
58
59 extern
60 int afb_calls_hooked_call_sync(
61                 struct afb_export *export,
62                 const char *api,
63                 const char *verb,
64                 struct json_object *args,
65                 struct json_object **object,
66                 char **error,
67                 char **info);
68
69 extern
70 void afb_calls_subcall(
71                         struct afb_xreq *xreq,
72                         const char *api,
73                         const char *verb,
74                         struct json_object *args,
75                         int flags,
76                         void (*callback)(void *closure, struct json_object *object, const char *error, const char * info, struct afb_req_x2 *req),
77                         void *closure);
78
79 extern
80 void afb_calls_hooked_subcall(
81                         struct afb_xreq *xreq,
82                         const char *api,
83                         const char *verb,
84                         struct json_object *args,
85                         int flags,
86                         void (*callback)(void *closure, struct json_object *object, const char *error, const char * info, struct afb_req_x2 *req),
87                         void *closure);
88
89 extern
90 int afb_calls_subcall_sync(
91                         struct afb_xreq *xreq,
92                         const char *api,
93                         const char *verb,
94                         struct json_object *args,
95                         int flags,
96                         struct json_object **object,
97                         char **error,
98                         char **info);
99
100 extern
101 int afb_calls_hooked_subcall_sync(
102                         struct afb_xreq *xreq,
103                         const char *api,
104                         const char *verb,
105                         struct json_object *args,
106                         int flags,
107                         struct json_object **object,
108                         char **error,
109                         char **info);
110
111 /******************************************************************************/
112
113 extern
114 void afb_calls_legacy_call_v12(
115                 struct afb_export *export,
116                 const char *api,
117                 const char *verb,
118                 struct json_object *args,
119                 void (*callback)(void*, int, struct json_object*),
120                 void *closure);
121
122 extern
123 void afb_calls_legacy_hooked_call_v12(
124                 struct afb_export *export,
125                 const char *api,
126                 const char *verb,
127                 struct json_object *args,
128                 void (*callback)(void*, int, struct json_object*),
129                 void *closure);
130
131 extern
132 void afb_calls_legacy_call_v3(
133                 struct afb_export *export,
134                 const char *api,
135                 const char *verb,
136                 struct json_object *args,
137                 void (*callback)(void*, int, struct json_object*, struct afb_api_x3 *),
138                 void *closure);
139
140 extern
141 void afb_calls_legacy_hooked_call_v3(
142                 struct afb_export *export,
143                 const char *api,
144                 const char *verb,
145                 struct json_object *args,
146                 void (*callback)(void*, int, struct json_object*, struct afb_api_x3 *),
147                 void *closure);
148
149 extern
150 int afb_calls_legacy_call_sync(
151                 struct afb_export *export,
152                 const char *api,
153                 const char *verb,
154                 struct json_object *args,
155                 struct json_object **result);
156
157 extern
158 int afb_calls_legacy_hooked_call_sync(
159                 struct afb_export *export,
160                 const char *api,
161                 const char *verb,
162                 struct json_object *args,
163                 struct json_object **result);
164
165 /******************************************************************************/
166
167 extern
168 void afb_calls_legacy_subcall_v1(
169                 struct afb_xreq *caller,
170                 const char *api,
171                 const char *verb,
172                 struct json_object *args,
173                 void (*callback)(void*, int, struct json_object*),
174                 void *closure);
175
176 extern
177 void afb_calls_legacy_hooked_subcall_v1(
178                 struct afb_xreq *caller,
179                 const char *api,
180                 const char *verb,
181                 struct json_object *args,
182                 void (*callback)(void*, int, struct json_object*),
183                 void *closure);
184
185 extern
186 void afb_calls_legacy_subcall_v2(
187                 struct afb_xreq *caller,
188                 const char *api,
189                 const char *verb,
190                 struct json_object *args,
191                 void (*callback)(void*, int, struct json_object*, struct afb_req_x1),
192                 void *closure);
193
194 extern
195 void afb_calls_legacy_hooked_subcall_v2(
196                 struct afb_xreq *caller,
197                 const char *api,
198                 const char *verb,
199                 struct json_object *args,
200                 void (*callback)(void*, int, struct json_object*, struct afb_req_x1),
201                 void *closure);
202
203 extern
204 void afb_calls_legacy_subcall_v3(
205                 struct afb_xreq *caller,
206                 const char *api,
207                 const char *verb,
208                 struct json_object *args,
209                 void (*callback)(void*, int, struct json_object*, struct afb_req_x2 *),
210                 void *closure);
211
212 extern
213 void afb_calls_legacy_hooked_subcall_v3(
214                 struct afb_xreq *caller,
215                 const char *api,
216                 const char *verb,
217                 struct json_object *args,
218                 void (*callback)(void*, int, struct json_object*, struct afb_req_x2 *),
219                 void *closure);
220
221 extern
222 int afb_calls_legacy_subcall_sync(
223                 struct afb_xreq *caller,
224                 const char *api,
225                 const char *verb,
226                 struct json_object *args,
227                 struct json_object **result);
228
229 extern
230 int afb_calls_legacy_hooked_subcall_sync(
231                 struct afb_xreq *caller,
232                 const char *api,
233                 const char *verb,
234                 struct json_object *args,
235                 struct json_object **result);