X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-api-ws.c;h=c1ccd3297162fe270b93bfc657b341bbe9445dcf;hb=4521c1e7ae5371ab9d639adc617d17fb4e8ded0c;hp=190c2fd8bdeb906bb27cc01640c8ca928c00383e;hpb=63682b4da9d3e892d1d0a671de860adc43068142;p=src%2Fapp-framework-binder.git diff --git a/src/afb-api-ws.c b/src/afb-api-ws.c index 190c2fd8..c1ccd329 100644 --- a/src/afb-api-ws.c +++ b/src/afb-api-ws.c @@ -34,6 +34,7 @@ #include "afb-systemd.h" #include "afb-api.h" #include "afb-apiset.h" +#include "afb-api-ws.h" #include "afb-stub-ws.h" #include "verbose.h" #include "fdev.h" @@ -72,7 +73,7 @@ static struct api_ws *api_ws_make(const char *path) while (length && path[length - 1] != '/' && path[length - 1] != ':') length = length - 1; api->api = &api->path[length]; - if (api->api == NULL || !afb_api_is_valid_name(api->api, 1)) { + if (api->api == NULL || !afb_api_is_valid_name(api->api)) { errno = EINVAL; goto error2; } @@ -219,7 +220,7 @@ static struct fdev *api_ws_socket_fdev(const char *path, int server) /**********************************************************************************/ -int afb_api_ws_add_client(const char *path, struct afb_apiset *apiset, int strong) +int afb_api_ws_add_client(const char *path, struct afb_apiset *declare_set, struct afb_apiset *call_set, int strong) { struct api_ws *apiws; struct afb_stub_ws *stubws; @@ -234,12 +235,12 @@ int afb_api_ws_add_client(const char *path, struct afb_apiset *apiset, int stron if (!apiws->fdev) goto error2; - stubws = afb_stub_ws_create_client(apiws->fdev, apiws->api, apiset); + stubws = afb_stub_ws_create_client(apiws->fdev, apiws->api, call_set); if (!stubws) { ERROR("can't setup client ws service to %s", apiws->path); goto error3; } - if (afb_stub_ws_client_add(stubws, apiset) < 0) { + if (afb_stub_ws_client_add(stubws, declare_set) < 0) { ERROR("can't add the client to the apiset for service %s", apiws->path); goto error3; } @@ -253,14 +254,14 @@ error: return -!!strong; } -int afb_api_ws_add_client_strong(const char *path, struct afb_apiset *apiset) +int afb_api_ws_add_client_strong(const char *path, struct afb_apiset *declare_set, struct afb_apiset *call_set) { - return afb_api_ws_add_client(path, apiset, 1); + return afb_api_ws_add_client(path, declare_set, call_set, 1); } -int afb_api_ws_add_client_weak(const char *path, struct afb_apiset *apiset) +int afb_api_ws_add_client_weak(const char *path, struct afb_apiset *declare_set, struct afb_apiset *call_set) { - return afb_api_ws_add_client(path, apiset, 0); + return afb_api_ws_add_client(path, declare_set, call_set, 0); } static int api_ws_server_accept_client(struct api_ws *apiws, struct fdev *fdev) @@ -329,7 +330,7 @@ static int api_ws_server_connect(struct api_ws *apiws) } /* create the service */ -int afb_api_ws_add_server(const char *path, struct afb_apiset *apiset) +int afb_api_ws_add_server(const char *path, struct afb_apiset *declare_set, struct afb_apiset *call_set) { int rc; struct api_ws *apiws; @@ -340,7 +341,7 @@ int afb_api_ws_add_server(const char *path, struct afb_apiset *apiset) goto error; /* check api name */ - if (!afb_apiset_lookup(apiset, apiws->api, 1)) { + if (!afb_apiset_lookup(call_set, apiws->api, 1)) { ERROR("Can't provide ws-server for %s: API %s doesn't exist", path, apiws->api); goto error2; } @@ -350,7 +351,7 @@ int afb_api_ws_add_server(const char *path, struct afb_apiset *apiset) if (rc < 0) goto error2; - apiws->apiset = afb_apiset_addref(apiset); + apiws->apiset = afb_apiset_addref(call_set); return 0; error2: