Make status common
[src/app-framework-binder.git] / docs / afb-binding-references.md
index 7d6cdd1..7cc5ba8 100644 (file)
@@ -41,8 +41,8 @@ struct afb_verb_v2
 {
         const char *verb;                       /* name of the verb */
         void (*callback)(struct afb_req req);   /* callback function implementing the verb */
-        const struct afb_auth *auth;           /* required authorisation */
-        uint32_t session;                       /* authorisation and session requirements of the verb */
+        const struct afb_auth *auth;               /* required authorization */
+        uint32_t session;                       /* authorization and session requirements of the verb */
 };
 ```
 
@@ -155,7 +155,7 @@ struct afb_event afb_daemon_make_event(const char *name);
 ```
 
 The following function is used by logging macros and should normally
-not be used. Instead, you should use the macros 
+not be used. Instead, you should use the macros
 **AFB\_ERROR**, **AFB\_WARNING**, **AFB\_NOTICE**,
 **AFB\_INFO**, **AFB\_DEBUG**
 
@@ -208,7 +208,7 @@ The following function is used to queue jobs.
  * If 'timeout' is not 0, it represent the maximum execution time for the job in seconds.
  * At first, the job is called with 0 as signum and the given argument.
  * The job is executed with the monitoring of its time and some signals like SIGSEGV and
- * SIGFPE. When a such signal is catched, the job is terminated and reexecuted but with
+ * SIGFPE. When a such signal is catched, the job is terminated and re-executed but with
  * signum being the signal number (SIGALRM when timeout expired).
  *
  * Returns 0 in case of success or -1 in case of error.
@@ -217,7 +217,7 @@ int afb_daemon_queue_job(void (*callback)(int signum, void *arg), void *argument
 ```
 
 The following function must be used when a binding depends on other
-bindings at its initialisation.
+bindings at its initialization.
 
 ```C
 /*
@@ -245,7 +245,7 @@ bindings for themselves.
  *
  * The 'callback' receives 3 arguments:
  *  1. 'closure' the user defined closure pointer 'callback_closure',
- *  2. 'iserror' a boolean status being true (not null) when an error occured,
+ *  2. 'status' a status being 0 on success or negative when an error occured,
  *  2. 'result' the resulting data as a JSON object.
  *
  * @param api      The api name of the method to call
@@ -260,7 +260,7 @@ void afb_service_call(
        const char *api,
        const char *verb,
        struct json_object *args,
-       void (*callback)(void*closure, int iserror, struct json_object *result),
+       void (*callback)(void*closure, int status, struct json_object *result),
        void *callback_closure);
 
 /**
@@ -276,7 +276,7 @@ void afb_service_call(
  * @param args     The arguments to pass to the method
  * @param result   Where to store the result - should call json_object_put on it -
  *
- * @returns 1 in case of success or 0 in case of error.
+ * @returns 0 in case of success or a negative value in case of error.
  *
  * @see also 'afb_req_subcall'
  */
@@ -449,7 +449,7 @@ void afb_req_success_v(struct afb_req req, struct json_object *obj, const char *
  *
  * Note that calling afb_req_fail("success", info) is equivalent
  * to call afb_req_success(NULL, info). Thus even if possible it
- * is strongly recommanded to NEVER use "success" for status.
+ * is strongly recommended to NEVER use "success" for status.
  */
 void afb_req_fail(struct afb_req req, const char *status, const char *info);
 
@@ -533,7 +533,7 @@ void afb_req_addref(struct afb_req req);
 void afb_req_unref(struct afb_req req);
 
 /*
- * Stores 'req' on heap for asynchrnous use.
+ * Stores 'req' on heap for asynchronous use.
  * Returns a handler to the stored 'req' or NULL on memory depletion.
  * The count of reference to 'req' is incremented on success
  * (see afb_req_addref).
@@ -578,7 +578,7 @@ client (with its permissions).
  * This call is made in the context of the request 'req'.
  * On completion, the function 'callback' is invoked with the
  * 'closure' given at call and two other parameters: 'iserror' and 'result'.
- * 'iserror' is a boolean that indicates if the reply is an error reply.
+ * 'status' is 0 on success or negative when on an error reply.
  * 'result' is the json object of the reply, you must not call json_object_put
  * on the result.
  *
@@ -591,14 +591,14 @@ void afb_req_subcall(
                 const char *api,
                 const char *verb,
                 struct json_object *args,
-                void (*callback)(void *closure, int iserror, struct json_object *result),
+                void (*callback)(void *closure, int status, struct json_object *result),
                 void *closure);
 
 /*
  * Makes a call to the method of name 'api' / 'verb' with the object 'args'.
  * This call is made in the context of the request 'req'.
  * This call is synchronous, it waits untill completion of the request.
- * It returns 0 on an error answer and returns 1 when no error was detected.
+ * It returns 0 on success or a negative value on error answer.
  * The object pointed by 'result' is filled and must be released by the caller
  * after its use by calling 'json_object_put'.
  *
@@ -615,7 +615,7 @@ int afb_req_subcall_sync(
 ```
 
 The following function is used by logging macros and should normally
-not be used. Instead, you should use the macros 
+not be used. Instead, you should use the macros
 **AFB_REQ_ERROR**, **AFB_REQ_WARNING**, **AFB_REQ_NOTICE**,
 **AFB_REQ_INFO**, **AFB_REQ_DEBUG**
 
@@ -666,7 +666,3 @@ AFB_REQ_DEBUG(req,fmt,...)
 
 By default, the logging macros add file, line and function
 indication.
-
-Some definitions can be used to 
-
-