+static
+int notification_append_capture(
+ struct lttng_event_notifier_notification *notif,
+ struct lttng_interpreter_output *output)
+{
+ struct lttng_msgpack_writer *writer = ¬if->writer;
+ int ret = 0;
+
+ switch (output->type) {
+ case LTTNG_INTERPRETER_TYPE_S64:
+ ret = lttng_msgpack_write_signed_integer(writer, output->u.s);
+ if (ret) {
+ WARN_ON_ONCE(1);
+ goto end;
+ }
+ break;
+ case LTTNG_INTERPRETER_TYPE_U64:
+ ret = lttng_msgpack_write_unsigned_integer(writer, output->u.u);
+ if (ret) {
+ WARN_ON_ONCE(1);
+ goto end;
+ }
+ break;
+ case LTTNG_INTERPRETER_TYPE_STRING:
+ ret = lttng_msgpack_write_str(writer, output->u.str.str);
+ if (ret) {
+ WARN_ON_ONCE(1);
+ goto end;
+ }
+ break;
+ case LTTNG_INTERPRETER_TYPE_SEQUENCE:
+ ret = capture_sequence(writer, output);
+ if (ret) {
+ WARN_ON_ONCE(1);
+ goto end;
+ }
+ break;
+ case LTTNG_INTERPRETER_TYPE_SIGNED_ENUM:
+ case LTTNG_INTERPRETER_TYPE_UNSIGNED_ENUM:
+ ret = capture_enum(writer, output);
+ if (ret) {
+ WARN_ON_ONCE(1);
+ goto end;
+ }
+ break;
+ default:
+ ret = -1;
+ WARN_ON(1);
+ }
+end:
+ return ret;
+}
+
+static
+int notification_append_empty_capture(
+ struct lttng_event_notifier_notification *notif)
+{
+ int ret = lttng_msgpack_write_nil(¬if->writer);
+ if (ret)
+ WARN_ON_ONCE(1);
+
+ return ret;
+}
+
+static
+int notification_init(struct lttng_event_notifier_notification *notif,
+ struct lttng_event_notifier *event_notifier)
+{
+ struct lttng_msgpack_writer *writer = ¬if->writer;
+ int ret = 0;
+
+ notif->has_captures = false;
+
+ if (event_notifier->num_captures > 0) {
+ lttng_msgpack_writer_init(writer, notif->capture_buf,
+ CAPTURE_BUFFER_SIZE);
+
+ ret = lttng_msgpack_begin_array(writer, event_notifier->num_captures);
+ if (ret) {
+ WARN_ON_ONCE(1);
+ goto end;
+ }
+
+ notif->has_captures = true;
+ }
+
+end:
+ return ret;
+}
+
+static
+void notification_send(struct lttng_event_notifier_notification *notif,
+ struct lttng_event_notifier *event_notifier)