- int runid, status;
- if (onrunid(smsg, obj, "resume", &runid)) {
- status = afm_urun_resume(runid);
- reply_status(smsg, status, error_not_found);
- }
-}
-
-/*
- * On query "stop" from 'smsg' with parameters of 'obj'.
- */
-static void on_stop(struct sd_bus_message *smsg, struct json_object *obj, void *unused)
-{
- NOTICE("call to obsolete 'stop'");
- on_pause(smsg, obj, unused);
-}
-
-/*
- * On query "continue" from 'smsg' with parameters of 'obj'.
- */
-static void on_continue(struct sd_bus_message *smsg, struct json_object *obj, void *unused)
-{
- NOTICE("call to obsolete 'continue'");
- on_resume(smsg, obj, unused);
-}
-
-/*
- * On query "terminate" from 'smsg' with parameters of 'obj'.
- */
-static void on_terminate(struct sd_bus_message *smsg, struct json_object *obj, void *unused)
-{
- int runid, status;
- if (onrunid(smsg, obj, "terminate", &runid)) {
- status = afm_urun_terminate(runid);
- reply_status(smsg, status, error_not_found);
- }
-}
-
-/*
- * On query "runners" from 'smsg' with parameters of 'obj'.
- */
-static void on_runners(struct sd_bus_message *smsg, struct json_object *obj, void *unused)
-{
- struct json_object *resp;
- INFO("method runners called");
- resp = afm_urun_list(afudb);
- jbus_reply_j(smsg, resp);
- json_object_put(resp);
-}
-
-/*
- * On query "state" from 'smsg' with parameters of 'obj'.
- */
-static void on_state(struct sd_bus_message *smsg, struct json_object *obj, void *unused)
-{
- int runid;
- struct json_object *resp;
- if (onrunid(smsg, obj, "state", &runid)) {
- resp = afm_urun_state(afudb, runid);
- reply(smsg, resp, error_not_found);
- json_object_put(resp);
- }
-}
-
-/*
- * Calls the system daemon to achieve application management of
- * the 'method' gotten from 'smsg' with the parameter's string 'msg'.
- *
- * The principle is very simple: call the corresponding system method
- * and reply its response to the caller.
- *
- * The request and reply is synchronous and is blocking.
- * It is possible to implment it in an asynchrounous way but it
- * would brake the common behaviour. It would be a call like
- * jbus_call_ss(system_bus, method, msg, callback, smsg)
- */
-static void propagate(struct sd_bus_message *smsg, const char *msg, const char *method)
-{
- char *reply;
- INFO("method %s propagated with %s", method, msg);
- reply = jbus_call_ss_sync(system_bus, method, msg);
- if (reply) {
- jbus_reply_s(smsg, reply);
- free(reply);
- }