trigger: implement listing of registered trigger
[lttng-tools.git] / src / bin / lttng-sessiond / notification-thread-commands.c
index a3b41f989e72d5de6e116af5f5730a03f8f05c33..a434b08cf47966309dc759d485d5ea23ce805bb3 100644 (file)
@@ -117,9 +117,11 @@ enum lttng_error_code notification_thread_command_register_trigger(
        enum lttng_error_code ret_code;
        struct notification_thread_command cmd = {};
 
+       assert(trigger);
        init_notification_thread_command(&cmd);
 
        cmd.type = NOTIFICATION_COMMAND_TYPE_REGISTER_TRIGGER;
+       lttng_trigger_get(trigger);
        cmd.parameters.trigger = trigger;
 
        ret = run_command_wait(handle, &cmd);
@@ -268,6 +270,36 @@ end:
        return ret_code;
 }
 
+enum lttng_error_code notification_thread_command_list_triggers(
+               struct notification_thread_handle *handle,
+               uid_t uid,
+               struct lttng_triggers **triggers)
+{
+       int ret;
+       enum lttng_error_code ret_code;
+       struct notification_thread_command cmd = {};
+
+       assert(handle);
+       assert(triggers);
+
+       init_notification_thread_command(&cmd);
+
+       cmd.type = NOTIFICATION_COMMAND_TYPE_LIST_TRIGGERS;
+       cmd.parameters.list_triggers.uid = uid;
+
+       ret = run_command_wait(handle, &cmd);
+       if (ret) {
+               ret_code = LTTNG_ERR_UNK;
+               goto end;
+       }
+
+       ret_code = cmd.reply_code;
+       *triggers = cmd.reply.list_triggers.triggers;
+
+end:
+       return ret_code;
+}
+
 void notification_thread_command_quit(
                struct notification_thread_handle *handle)
 {
@@ -280,3 +312,18 @@ void notification_thread_command_quit(
        ret = run_command_wait(handle, &cmd);
        assert(!ret && cmd.reply_code == LTTNG_OK);
 }
+
+int notification_thread_client_communication_update(
+               struct notification_thread_handle *handle,
+               notification_client_id id,
+               enum client_transmission_status transmission_status)
+{
+       struct notification_thread_command cmd = {};
+
+       init_notification_thread_command(&cmd);
+
+       cmd.type = NOTIFICATION_COMMAND_TYPE_CLIENT_COMMUNICATION_UPDATE;
+       cmd.parameters.client_communication_update.id = id;
+       cmd.parameters.client_communication_update.status = transmission_status;
+       return run_command_no_wait(handle, &cmd);
+}
This page took 0.024504 seconds and 4 git commands to generate.