1 Functions of class **afb_service**
2 ==============================
4 All the functions of the class **afb_daemon** use the default api.
5 These are internally aliased to the corresponding legacy function of
10 * Calls the 'verb' of the 'api' with the arguments 'args' and 'verb' in the name of the binding.
11 * The result of the call is delivered to the 'callback' function with the 'callback_closure'.
13 * For convenience, the function calls 'json_object_put' for 'args'.
14 * Thus, in the case where 'args' should remain available after
15 * the function returns, the function 'json_object_get' shall be used.
17 * The 'callback' receives 3 arguments:
18 * 1. 'closure' the user defined closure pointer 'callback_closure',
19 * 2. 'status' a status being 0 on success or negative when an error occured,
20 * 2. 'result' the resulting data as a JSON object.
22 * @param api The api name of the method to call
23 * @param verb The verb name of the method to call
24 * @param args The arguments to pass to the method
25 * @param callback The to call on completion
26 * @param callback_closure The closure to pass to the callback
28 * @see also 'afb_req_subcall'
30 void afb_service_call(
33 struct json_object *args,
34 void (*callback)(void*closure, int status, struct json_object *result),
35 void *callback_closure);
38 * Calls the 'verb' of the 'api' with the arguments 'args' and 'verb' in the name of the binding.
39 * 'result' will receive the response.
41 * For convenience, the function calls 'json_object_put' for 'args'.
42 * Thus, in the case where 'args' should remain available after
43 * the function returns, the function 'json_object_get' shall be used.
45 * @param api The api name of the method to call
46 * @param verb The verb name of the method to call
47 * @param args The arguments to pass to the method
48 * @param result Where to store the result - should call json_object_put on it -
50 * @returns 0 in case of success or a negative value in case of error.
52 * @see also 'afb_req_subcall'
54 int afb_service_call_sync(
57 struct json_object *args,
58 struct json_object **result);