X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-proto-ws.h;h=2dcb142bc6ce9384c10a23d2aabd81dc5acf5e67;hb=7386e1c5090b4e76036bc212f2a2cf32920bb160;hp=506960eab1ed9149c6c884bb364b9a11453cfa26;hpb=b55f3cd48507105e85894be89557787eccfbe22f;p=src%2Fapp-framework-binder.git diff --git a/src/afb-proto-ws.h b/src/afb-proto-ws.h index 506960ea..2dcb142b 100644 --- a/src/afb-proto-ws.h +++ b/src/afb-proto-ws.h @@ -20,9 +20,13 @@ /* * Defined since version 3, the value AFB_PROTO_WS_VERSION can be used to - * track versions of afb-proto-ws. + * track versions of afb-proto-ws. History: + * + * date version comment + * 2018/04/09 3 introduced for bindings v3 + * 2019/11/20 4 introduced for tokens */ -#define AFB_PROTO_WS_VERSION 3 +#define AFB_PROTO_WS_VERSION 4 struct fdev; struct afb_proto_ws; @@ -37,17 +41,21 @@ struct afb_proto_ws_client_itf void (*on_reply)(void *closure, void *request, struct json_object *obj, const char *error, const char *info); /* can be NULL */ - void (*on_event_create)(void *closure, const char *event_name, int event_id); - void (*on_event_remove)(void *closure, const char *event_name, int event_id); - void (*on_event_subscribe)(void *closure, void *request, const char *event_name, int event_id); - void (*on_event_unsubscribe)(void *closure, void *request, const char *event_name, int event_id); - void (*on_event_push)(void *closure, const char *event_name, int event_id, struct json_object *data); + void (*on_event_create)(void *closure, uint16_t event_id, const char *event_name); + void (*on_event_remove)(void *closure, uint16_t event_id); + void (*on_event_subscribe)(void *closure, void *request, uint16_t event_id); + void (*on_event_unsubscribe)(void *closure, void *request, uint16_t event_id); + void (*on_event_push)(void *closure, uint16_t event_id, struct json_object *data); void (*on_event_broadcast)(void *closure, const char *event_name, struct json_object *data, const afb_proto_ws_uuid_t uuid, uint8_t hop); }; struct afb_proto_ws_server_itf { - void (*on_call)(void *closure, struct afb_proto_ws_call *call, const char *verb, struct json_object *args, const char *sessionid, const char *user_creds); + void (*on_session_create)(void *closure, uint16_t sessionid, const char *sessionstr); + void (*on_session_remove)(void *closure, uint16_t sessionid); + void (*on_token_create)(void *closure, uint16_t tokenid, const char *tokenstr); + void (*on_token_remove)(void *closure, uint16_t tokenid); + void (*on_call)(void *closure, struct afb_proto_ws_call *call, const char *verb, struct json_object *args, uint16_t sessionid, uint16_t tokenid, const char *user_creds); void (*on_describe)(void *closure, struct afb_proto_ws_describe *describe); }; @@ -66,12 +74,16 @@ extern void afb_proto_ws_on_hangup(struct afb_proto_ws *protows, void (*on_hangu extern void afb_proto_ws_set_queuing(struct afb_proto_ws *protows, int (*queuing)(struct afb_proto_ws *, void (*)(int,void*), void*)); -extern int afb_proto_ws_client_call(struct afb_proto_ws *protows, const char *verb, struct json_object *args, const char *sessionid, void *request, const char *user_creds); +extern int afb_proto_ws_client_session_create(struct afb_proto_ws *protows, uint16_t sessionid, const char *sessionstr); +extern int afb_proto_ws_client_session_remove(struct afb_proto_ws *protows, uint16_t sessionid); +extern int afb_proto_ws_client_token_create(struct afb_proto_ws *protows, uint16_t tokenid, const char *tokenstr); +extern int afb_proto_ws_client_token_remove(struct afb_proto_ws *protows, uint16_t tokenid); +extern int afb_proto_ws_client_call(struct afb_proto_ws *protows, const char *verb, struct json_object *args, uint16_t sessionid, uint16_t tokenid, void *request, const char *user_creds); extern int afb_proto_ws_client_describe(struct afb_proto_ws *protows, void (*callback)(void*, struct json_object*), void *closure); -extern int afb_proto_ws_server_event_create(struct afb_proto_ws *protows, const char *event_name, int event_id); -extern int afb_proto_ws_server_event_remove(struct afb_proto_ws *protows, const char *event_name, int event_id); -extern int afb_proto_ws_server_event_push(struct afb_proto_ws *protows, const char *event_name, int event_id, struct json_object *data); +extern int afb_proto_ws_server_event_create(struct afb_proto_ws *protows, uint16_t event_id, const char *event_name); +extern int afb_proto_ws_server_event_remove(struct afb_proto_ws *protows, uint16_t event_id); +extern int afb_proto_ws_server_event_push(struct afb_proto_ws *protows, uint16_t event_id, struct json_object *data); extern int afb_proto_ws_server_event_broadcast(struct afb_proto_ws *protows, const char *event_name, struct json_object *data, const afb_proto_ws_uuid_t uuid, uint8_t hop); extern void afb_proto_ws_call_addref(struct afb_proto_ws_call *call); @@ -79,7 +91,7 @@ extern void afb_proto_ws_call_unref(struct afb_proto_ws_call *call); extern int afb_proto_ws_call_reply(struct afb_proto_ws_call *call, struct json_object *obj, const char *error, const char *info); -extern int afb_proto_ws_call_subscribe(struct afb_proto_ws_call *call, const char *event_name, int event_id); -extern int afb_proto_ws_call_unsubscribe(struct afb_proto_ws_call *call, const char *event_name, int event_id); +extern int afb_proto_ws_call_subscribe(struct afb_proto_ws_call *call, uint16_t event_id); +extern int afb_proto_ws_call_unsubscribe(struct afb_proto_ws_call *call, uint16_t event_id); extern int afb_proto_ws_describe_put(struct afb_proto_ws_describe *describe, struct json_object *description);