X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fafb-ditf.c;h=66bdb9df146ec0fab4876a29049535437c506011;hb=197626868aaf84e9a68e8e7e5397ef1c6883a0f1;hp=66136760b0865ccf180aa81f6bec49b4b4b00ec1;hpb=c6380108964e71f533d8c672bb9c217020a95e8d;p=src%2Fapp-framework-binder.git diff --git a/src/afb-ditf.c b/src/afb-ditf.c index 66136760..66bdb9df 100644 --- a/src/afb-ditf.c +++ b/src/afb-ditf.c @@ -30,10 +30,14 @@ #include "afb-evt.h" #include "afb-common.h" #include "afb-xreq.h" +#include "afb-api.h" +#include "afb-apiset.h" #include "afb-hook.h" #include "jobs.h" #include "verbose.h" +extern struct afb_apiset *main_apiset; + /********************************************** * normal flow **********************************************/ @@ -106,6 +110,12 @@ static struct afb_req unstore_req_cb(void *closure, struct afb_stored_req *sreq) return afb_xreq_unstore(sreq); } +static int require_api_cb(void *closure, const char *name, int initialized) +{ + struct afb_api a; + return (initialized ? afb_apiset_get_started : afb_apiset_get)(main_apiset, name, &a); +} + /********************************************** * hooked flow **********************************************/ @@ -192,6 +202,15 @@ static struct afb_req hooked_unstore_req_cb(void *closure, struct afb_stored_req return unstore_req_cb(closure, sreq); } +static int hooked_require_api_cb(void *closure, const char *name, int initialized) +{ + int result; + struct afb_ditf *ditf = closure; + afb_hook_ditf_require_api(ditf, name, initialized); + result = require_api_cb(closure, name, initialized); + return afb_hook_ditf_require_api_result(ditf, name, initialized, result); +} + /********************************************** * vectors **********************************************/ @@ -206,7 +225,8 @@ static const struct afb_daemon_itf daemon_itf = { .rootdir_get_fd = afb_common_rootdir_get_fd, .rootdir_open_locale = rootdir_open_locale_cb, .queue_job = queue_job_cb, - .unstore_req = unstore_req_cb + .unstore_req = unstore_req_cb, + .require_api = require_api_cb }; static const struct afb_daemon_itf hooked_daemon_itf = { @@ -220,7 +240,8 @@ static const struct afb_daemon_itf hooked_daemon_itf = { .rootdir_get_fd = hooked_rootdir_get_fd, .rootdir_open_locale = hooked_rootdir_open_locale_cb, .queue_job = hooked_queue_job_cb, - .unstore_req = hooked_unstore_req_cb + .unstore_req = hooked_unstore_req_cb, + .require_api = hooked_require_api_cb }; void afb_ditf_init_v2(struct afb_ditf *ditf, const char *api, struct afb_binding_data_v2 *data)