summaryrefslogtreecommitdiffstats
path: root/src/plugins/supervisor.c
diff options
context:
space:
mode:
authorFrederic Marec <frederic.marec@iot.bzh>2019-05-09 18:56:06 +0200
committerFrederic Marec <frederic.marec@iot.bzh>2019-05-09 18:56:06 +0200
commit395554e75a52056ff6cbff9c2a9a62f401e287a9 (patch)
treeee779fe56b0ba9e87ccae8cad0d1fe1a0ae73e8e /src/plugins/supervisor.c
parentd285cf2515dc1f65cae7c685f6da18351a0a5429 (diff)
Git submodule migration to separated libraries
Bug-AGL: SPEC-2139 Change-Id: Ie96b5a51b8e725a175a824236a11eb29de3631fc Signed-off-by: Frederic Marec <frederic.marec@iot.bzh>
Diffstat (limited to 'src/plugins/supervisor.c')
-rw-r--r--src/plugins/supervisor.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/plugins/supervisor.c b/src/plugins/supervisor.c
index 598ba68..168e298 100644
--- a/src/plugins/supervisor.c
+++ b/src/plugins/supervisor.c
@@ -37,7 +37,7 @@ static const char* null_str = "null";
struct decode_daemon_str {
DAEMONS_T* daemons;
- AFB_ApiT api;
+ afb_api_t api;
const char* ignored_daemon;
int* ret_code;
};
@@ -62,19 +62,19 @@ static void decode_daemons_cb(void* closure, json_object* obj, const char* fName
return;
}
- AFB_ApiInfo(clStr->api, "Get supervisor/config - pid %d", cred.pid);
+ AFB_API_INFO(clStr->api, "Get supervisor/config - pid %d", cred.pid);
daemon->pid = cred.pid;
// Get config
wrap_json_pack(&j_query, "{s:i}", "pid", cred.pid);
- rc = AFB_ServiceSync(clStr->api, SRV_SUPERVISOR_NAME, "config", j_query, &j_response);
+ rc = afb_api_call_sync_legacy(clStr->api, SRV_SUPERVISOR_NAME, "config", j_query, &j_response);
if (rc < 0) {
- AFB_ApiError(clStr->api, "Cannot get config of pid %d", cred.pid);
+ AFB_API_ERROR(clStr->api, "Cannot get config of pid %d", cred.pid);
*clStr->ret_code = rc;
return;
}
- AFB_ApiDebug(clStr->api, "%s config result, res=%s", SRV_SUPERVISOR_NAME,
+ AFB_API_DEBUG(clStr->api, "%s config result, res=%s", SRV_SUPERVISOR_NAME,
json_object_to_json_string(j_response));
if (json_object_object_get_ex(j_response, "response", &j_config)) {
@@ -86,7 +86,7 @@ static void decode_daemons_cb(void* closure, json_object* obj, const char* fName
"ws_servers", &j_ws_servers,
"ws_clients", &j_ws_clients);
if (rc < 0) {
- AFB_ApiError(clStr->api, "Error decoding config response %s", wrap_json_get_error_string(rc));
+ AFB_API_ERROR(clStr->api, "Error decoding config response %s", wrap_json_get_error_string(rc));
return;
}
@@ -105,7 +105,7 @@ static void decode_daemons_cb(void* closure, json_object* obj, const char* fName
}
// Get apis
- AFB_ApiInfo(clStr->api, "Get supervisor/do monitor get apis - pid %d", cred.pid);
+ AFB_API_INFO(clStr->api, "Get supervisor/do monitor get apis - pid %d", cred.pid);
// '{"pid":6262,"api":"monitor","verb":"get","args":{"apis":true}}
wrap_json_pack(&j_query, "{si ss ss s {sb}}",
@@ -113,12 +113,12 @@ static void decode_daemons_cb(void* closure, json_object* obj, const char* fName
"api", "monitor",
"verb", "get",
"args", "apis", true);
- rc = AFB_ServiceSync(clStr->api, SRV_SUPERVISOR_NAME, "do", j_query, &j_response);
+ rc = afb_api_call_sync_legacy(clStr->api, SRV_SUPERVISOR_NAME, "do", j_query, &j_response);
if (rc < 0) {
- AFB_ApiError(clStr->api, "Cannot get apis of pid %d", cred.pid);
+ AFB_API_ERROR(clStr->api, "Cannot get apis of pid %d", cred.pid);
return;
} else {
- AFB_ApiDebug(clStr->api, "%s do ...get apis result, res=%s", SRV_SUPERVISOR_NAME, json_object_to_json_string(j_response));
+ AFB_API_DEBUG(clStr->api, "%s do ...get apis result, res=%s", SRV_SUPERVISOR_NAME, json_object_to_json_string(j_response));
if (json_object_object_get_ex(j_response, "response", &j_config) && json_object_object_get_ex(j_config, "apis", &j_apis)) {
// Don't forward monitor config details
@@ -138,29 +138,29 @@ static void decode_daemons_cb(void* closure, json_object* obj, const char* fName
clStr->daemons->count++;
}
-int getDaemons(AFB_ApiT apiHandle, DAEMONS_T** daemons)
+int getDaemons(afb_api_t apiHandle, DAEMONS_T** daemons)
{
int rc;
json_object *j_response, *j_daemons = NULL;
*daemons = calloc(sizeof(DAEMONS_T), 1);
- AFB_ApiInfo(apiHandle, "Call supervisor/discover");
- if ((rc = AFB_ServiceSync(apiHandle, SRV_SUPERVISOR_NAME, "discover", NULL,
+ AFB_API_INFO(apiHandle, "Call supervisor/discover");
+ if ((rc = afb_api_call_sync_legacy(apiHandle, SRV_SUPERVISOR_NAME, "discover", NULL,
&j_response))
< 0) {
return rc;
}
- AFB_ApiInfo(apiHandle, "Call supervisor/list");
- if ((rc = AFB_ServiceSync(apiHandle, SRV_SUPERVISOR_NAME, "list", NULL,
+ AFB_API_INFO(apiHandle, "Call supervisor/list");
+ if ((rc = afb_api_call_sync_legacy(apiHandle, SRV_SUPERVISOR_NAME, "list", NULL,
&j_response))
< 0) {
return rc;
}
- AFB_ApiInfo(apiHandle, "Get details info for each daemon");
- AFB_ApiDebug(apiHandle, "%s list result, res=%s", SRV_SUPERVISOR_NAME, json_object_to_json_string(j_response));
+ AFB_API_INFO(apiHandle, "Get details info for each daemon");
+ AFB_API_DEBUG(apiHandle, "%s list result, res=%s", SRV_SUPERVISOR_NAME, json_object_to_json_string(j_response));
if (!json_object_object_get_ex(j_response, "response", &j_daemons)) {
}
@@ -179,7 +179,7 @@ int getDaemons(AFB_ApiT apiHandle, DAEMONS_T** daemons)
#define XDS_TAG_EVENT "xds:trace/event"
#define XDS_TRACE_NAME "xds-trace"
-int trace_daemon(AFB_ApiT apiHandle, DAEMON_T* dm, const char* level)
+int trace_daemon(afb_api_t apiHandle, DAEMON_T* dm, const char* level)
{
int rc;
json_object *j_response, *j_query, *j_tracereq, *j_traceevt;
@@ -214,8 +214,8 @@ int trace_daemon(AFB_ApiT apiHandle, DAEMON_T* dm, const char* level)
"tag", XDS_TAG_REQUEST, "name", XDS_TRACE_NAME, "request", j_tracereq,
"tag", XDS_TAG_EVENT, "name", XDS_TRACE_NAME, "event", j_traceevt);
- if ((rc = AFB_ServiceSync(apiHandle, SRV_SUPERVISOR_NAME, "trace", j_query, &j_response)) < 0) {
- AFB_ApiError(apiHandle, "ERROR tracing pid %d result: %s", dm->pid,
+ if ((rc = afb_api_call_sync_legacy(apiHandle, SRV_SUPERVISOR_NAME, "trace", j_query, &j_response)) < 0) {
+ AFB_API_ERROR(apiHandle, "ERROR tracing pid %d result: %s", dm->pid,
json_object_to_json_string(j_response));
return rc;
}
@@ -223,14 +223,14 @@ int trace_daemon(AFB_ApiT apiHandle, DAEMON_T* dm, const char* level)
return 0;
}
-// FIXME prototype must be int trace_drop(AFB_ApiT apiHandle, DAEMON_T* dm)
-int trace_drop(AFB_ApiT apiHandle, int pid)
+// FIXME prototype must be int trace_drop(afb_api_t apiHandle, DAEMON_T* dm)
+int trace_drop(afb_api_t apiHandle, int pid)
{
json_object *j_response, *j_query;
// monitor/trace({ "drop": { "tag": "trace/request" } })
wrap_json_pack(&j_query, "{s:i s:{s:[s s]}}", "pid", pid, "drop", "tag", XDS_TAG_REQUEST, XDS_TAG_EVENT);
- return AFB_ServiceSync(apiHandle, SRV_SUPERVISOR_NAME, "trace", j_query, &j_response);
+ return afb_api_call_sync_legacy(apiHandle, SRV_SUPERVISOR_NAME, "trace", j_query, &j_response);
}
int supervisor_init(void)