aboutsummaryrefslogtreecommitdiffstats
path: root/bindings/samples
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/samples')
-rw-r--r--bindings/samples/AuthLogin.c36
-rw-r--r--bindings/samples/DemoContext.c16
-rw-r--r--bindings/samples/DemoPost.c2
-rw-r--r--bindings/samples/HelloWorld.c8
4 files changed, 31 insertions, 31 deletions
diff --git a/bindings/samples/AuthLogin.c b/bindings/samples/AuthLogin.c
index efecf240..ceb833e9 100644
--- a/bindings/samples/AuthLogin.c
+++ b/bindings/samples/AuthLogin.c
@@ -23,7 +23,7 @@
// Dummy sample of Client Application Context
typedef struct {
- int something;
+ int something;
void *whateveryouwant;
} MyClientApplicationHandle;
@@ -45,33 +45,33 @@ static void clientContextConnect (struct afb_req request)
// do something intelligent to check if we should or not update level of assurance from 0(anonymous) to 1(logged)
afb_req_session_set_LOA(request, 1);
-
+
// Send response to UI
- jresp = json_object_new_object();
+ jresp = json_object_new_object();
json_object_object_add(jresp, "token", json_object_new_string ("A New Token and Session Context Was Created"));
afb_req_success(request, jresp, NULL);
-
+
}
// Before entering here token will be check and renew
static void clientContextRefresh (struct afb_req request) {
json_object *jresp;
-
+
jresp = json_object_new_object();
- json_object_object_add(jresp, "token", json_object_new_string ("Token was refreshed"));
-
+ json_object_object_add(jresp, "token", json_object_new_string ("Token was refreshed"));
+
afb_req_success(request, jresp, NULL);
}
// Session token will we verified before entering here
static void clientContextCheck (struct afb_req request) {
-
- json_object *jresp = json_object_new_object();
- json_object_object_add(jresp, "isvalid", json_object_new_boolean (TRUE));
-
+
+ json_object *jresp = json_object_new_object();
+ json_object_object_add(jresp, "isvalid", json_object_new_boolean (TRUE));
+
afb_req_success(request, jresp, NULL);
}
@@ -79,18 +79,18 @@ static void clientContextCheck (struct afb_req request) {
// Close and Free context
static void clientContextLogout (struct afb_req request) {
json_object *jresp;
-
+
/* after this call token will be reset
- * - no further access to API will be possible
+ * - no further access to API will be possible
* - every context from any used plugin will be freed
*/
-
+
jresp = json_object_new_object();
json_object_object_add(jresp, "info", json_object_new_string ("Token and all resources are released"));
-
- // WARNING: if you free context resource manually here do not forget to set *request.context=NULL;
+
+ // WARNING: if you free context resource manually here do not forget to set *request.context=NULL;
afb_req_success(request, jresp, NULL);
-
+
afb_req_session_set_LOA(request, 0);
}
// Close and Free context
@@ -100,7 +100,7 @@ static void clientGetPing (struct afb_req request) {
jresp = json_object_new_object();
json_object_object_add(jresp, "count", json_object_new_int (count ++));
-
+
afb_req_success(request, jresp, NULL);
}
diff --git a/bindings/samples/DemoContext.c b/bindings/samples/DemoContext.c
index ef703759..243ed687 100644
--- a/bindings/samples/DemoContext.c
+++ b/bindings/samples/DemoContext.c
@@ -22,10 +22,10 @@
#include <afb/afb-plugin.h>
typedef struct {
- /*
+ /*
* client context is attached a session but private to a each plugin.
* Context is passed to each API under request->context
- *
+ *
* Note:
* -client context is free when a session is closed. Developer should not
* forget that even if context is private to each plugin, session is unique
@@ -38,13 +38,13 @@ typedef struct {
* -when an API use AFB_SESSION_RESET this close the session and each plugin
* will be notified to free ressources.
*/
-
+
int count;
char *abcd;
-
+
} MyClientContextT;
-// This function is call at session open time. Any client trying to
+// This function is call at session open time. Any client trying to
// call it with an already open session will be denied.
// Ex: http://localhost:1234/api/context/create?token=123456789
static void myCreate (struct afb_req request)
@@ -53,7 +53,7 @@ static void myCreate (struct afb_req request)
// store something in our plugin private client context
ctx->count = 0;
- ctx->abcd = "SomeThingUseful";
+ ctx->abcd = "SomeThingUseful";
afb_req_context_set(request, ctx, free);
afb_req_success_f(request, NULL, "SUCCESS: create client context for plugin [%s]", ctx->abcd);
@@ -66,7 +66,7 @@ static void myCreate (struct afb_req request)
static void myAction (struct afb_req request)
{
MyClientContextT *ctx = (MyClientContextT*) afb_req_context_get(request);
-
+
// store something in our plugin private client context
ctx->count++;
afb_req_success_f(request, NULL, "SUCCESS: plugin [%s] Check=[%d]\n", ctx->abcd, ctx->count);
@@ -79,7 +79,7 @@ static void myAction (struct afb_req request)
static void myClose (struct afb_req request)
{
MyClientContextT *ctx = (MyClientContextT*) afb_req_context_get(request);
-
+
// store something in our plugin private client context
ctx->count++;
afb_req_success_f(request, NULL, "SUCCESS: plugin [%s] Close=[%d]\n", ctx->abcd, ctx->count);
diff --git a/bindings/samples/DemoPost.c b/bindings/samples/DemoPost.c
index b61b91c4..69de5572 100644
--- a/bindings/samples/DemoPost.c
+++ b/bindings/samples/DemoPost.c
@@ -67,7 +67,7 @@ static void UploadMusic (struct afb_req request)
}
// PostForm callback is called multiple times (one or each key within form, or once per file buffer)
-// When file has been fully uploaded call is call with item==NULL
+// When file has been fully uploaded call is call with item==NULL
static void UploadImage (struct afb_req request)
{
Uploads(request, "images");
diff --git a/bindings/samples/HelloWorld.c b/bindings/samples/HelloWorld.c
index b6f49b78..15544895 100644
--- a/bindings/samples/HelloWorld.c
+++ b/bindings/samples/HelloWorld.c
@@ -144,16 +144,16 @@ static void pingEvent(struct afb_req request)
// For samples https://linuxprograms.wordpress.com/2010/05/20/json-c-libjson-tutorial/
static void pingJson (struct afb_req request) {
- json_object *jresp, *embed;
-
+ json_object *jresp, *embed;
+
jresp = json_object_new_object();
json_object_object_add(jresp, "myString", json_object_new_string ("Some String"));
json_object_object_add(jresp, "myInt", json_object_new_int (1234));
-
+
embed = json_object_new_object();
json_object_object_add(embed, "subObjString", json_object_new_string ("Some String"));
json_object_object_add(embed, "subObjInt", json_object_new_int (5678));
-
+
json_object_object_add(jresp,"eobj", embed);
ping(request, jresp, "pingJson");