ctf: decoding: accommodate LTTng `event-after-packet` timestamp quirk
[babeltrace.git] / src / plugins / ctf / common / msg-iter / msg-iter.c
index 7c4756716d3321f22980cefef5e2aa9b58f42032..537ad1367df9d5676b6dc58095e21a536d87c963 100644 (file)
@@ -80,6 +80,7 @@ struct stack {
 /* State */
 enum state {
        STATE_INIT,
+       STATE_SWITCH_PACKET,
        STATE_DSCOPE_TRACE_PACKET_HEADER_BEGIN,
        STATE_DSCOPE_TRACE_PACKET_HEADER_CONTINUE,
        STATE_AFTER_TRACE_PACKET_HEADER,
@@ -132,6 +133,12 @@ struct bt_msg_iter {
        /* True to emit a stream end message. */
        bool emit_stream_end_msg;
 
+       /*
+        * True if library objects are unavailable during the decoding and
+        * should not be created/used.
+        */
+       bool dry_run;
+
        /* True to set the stream */
        bool set_stream;
 
@@ -259,6 +266,8 @@ const char *state_string(enum state state)
        switch (state) {
        case STATE_INIT:
                return "INIT";
+       case STATE_SWITCH_PACKET:
+               return "SWITCH_PACKET";
        case STATE_DSCOPE_TRACE_PACKET_HEADER_BEGIN:
                return "DSCOPE_TRACE_PACKET_HEADER_BEGIN";
        case STATE_DSCOPE_TRACE_PACKET_HEADER_CONTINUE:
@@ -314,9 +323,6 @@ const char *state_string(enum state state)
        }
 }
 
-static
-int bt_msg_iter_switch_packet(struct bt_msg_iter *notit);
-
 static
 struct stack *stack_new(struct bt_msg_iter *notit)
 {
@@ -677,6 +683,71 @@ void release_all_dscopes(struct bt_msg_iter *notit)
        release_event_dscopes(notit);
 }
 
+static
+enum bt_msg_iter_status switch_packet_state(struct bt_msg_iter *notit)
+{
+       enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+
+       /*
+        * We don't put the stream class here because we need to make
+        * sure that all the packets processed by the same message
+        * iterator refer to the same stream class (the first one).
+        */
+       BT_ASSERT(notit);
+
+       if (notit->cur_exp_packet_total_size != -1) {
+               notit->cur_packet_offset += notit->cur_exp_packet_total_size;
+       }
+
+       BT_COMP_LOGD("Switching packet: notit-addr=%p, cur=%zu, "
+               "packet-offset=%" PRId64, notit, notit->buf.at,
+               notit->cur_packet_offset);
+       stack_clear(notit->stack);
+       notit->meta.ec = NULL;
+       BT_PACKET_PUT_REF_AND_RESET(notit->packet);
+       BT_MESSAGE_PUT_REF_AND_RESET(notit->event_msg);
+       release_all_dscopes(notit);
+       notit->cur_dscope_field = NULL;
+
+       /*
+        * Adjust current buffer so that addr points to the beginning of the new
+        * packet.
+        */
+       if (notit->buf.addr) {
+               size_t consumed_bytes = (size_t) (notit->buf.at / CHAR_BIT);
+
+               /* Packets are assumed to start on a byte frontier. */
+               if (notit->buf.at % CHAR_BIT) {
+                       BT_COMP_LOGW("Cannot switch packet: current position is not a multiple of 8: "
+                               "notit-addr=%p, cur=%zu", notit, notit->buf.at);
+                       status = BT_MSG_ITER_STATUS_ERROR;
+                       goto end;
+               }
+
+               notit->buf.addr += consumed_bytes;
+               notit->buf.sz -= consumed_bytes;
+               notit->buf.at = 0;
+               notit->buf.packet_offset = 0;
+               BT_COMP_LOGD("Adjusted buffer: addr=%p, size=%zu",
+                       notit->buf.addr, notit->buf.sz);
+       }
+
+       notit->cur_exp_packet_content_size = -1;
+       notit->cur_exp_packet_total_size = -1;
+       notit->cur_stream_class_id = -1;
+       notit->cur_event_class_id = -1;
+       notit->cur_data_stream_id = -1;
+       notit->prev_packet_snapshots = notit->snapshots;
+       notit->snapshots.discarded_events = UINT64_C(-1);
+       notit->snapshots.packets = UINT64_C(-1);
+       notit->snapshots.beginning_clock = UINT64_C(-1);
+       notit->snapshots.end_clock = UINT64_C(-1);
+       notit->state = STATE_DSCOPE_TRACE_PACKET_HEADER_BEGIN;
+
+end:
+       return status;
+}
+
 static
 enum bt_msg_iter_status read_packet_header_begin_state(
                struct bt_msg_iter *notit)
@@ -684,12 +755,6 @@ enum bt_msg_iter_status read_packet_header_begin_state(
        struct ctf_field_class *packet_header_fc = NULL;
        enum bt_msg_iter_status ret = BT_MSG_ITER_STATUS_OK;
 
-       if (bt_msg_iter_switch_packet(notit)) {
-               BT_COMP_LOGW("Cannot switch packet: notit-addr=%p", notit);
-               ret = BT_MSG_ITER_STATUS_ERROR;
-               goto end;
-       }
-
        /*
         * Make sure at least one bit is available for this packet. An
         * empty packet is impossible. If we reach the end of the medium
@@ -918,7 +983,7 @@ enum bt_msg_iter_status read_packet_context_begin_state(
 
        BT_ASSERT(!notit->packet_context_field);
 
-       if (packet_context_fc->in_ir) {
+       if (packet_context_fc->in_ir && !notit->dry_run) {
                /*
                 * Create free packet context field from stream class.
                 * This field is going to be moved to the packet once we
@@ -1237,6 +1302,10 @@ enum bt_msg_iter_status after_event_header_state(
                goto end;
        }
 
+       if (G_UNLIKELY(notit->dry_run)) {
+               goto next_state;
+       }
+
        status = set_current_event_message(notit);
        if (status != BT_MSG_ITER_STATUS_OK) {
                goto end;
@@ -1245,6 +1314,8 @@ enum bt_msg_iter_status after_event_header_state(
        notit->event = bt_message_event_borrow_event(
                notit->event_msg);
        BT_ASSERT(notit->event);
+
+next_state:
        notit->state = STATE_DSCOPE_EVENT_COMMON_CONTEXT_BEGIN;
 
 end:
@@ -1264,7 +1335,7 @@ enum bt_msg_iter_status read_event_common_context_begin_state(
                goto end;
        }
 
-       if (event_common_context_fc->in_ir) {
+       if (event_common_context_fc->in_ir && !notit->dry_run) {
                BT_ASSERT(!notit->dscopes.event_common_context);
                notit->dscopes.event_common_context =
                        bt_event_borrow_common_context_field(
@@ -1317,7 +1388,7 @@ enum bt_msg_iter_status read_event_spec_context_begin_state(
                goto end;
        }
 
-       if (event_spec_context_fc->in_ir) {
+       if (event_spec_context_fc->in_ir && !notit->dry_run) {
                BT_ASSERT(!notit->dscopes.event_spec_context);
                notit->dscopes.event_spec_context =
                        bt_event_borrow_specific_context_field(
@@ -1373,7 +1444,7 @@ enum bt_msg_iter_status read_event_payload_begin_state(
                goto end;
        }
 
-       if (event_payload_fc->in_ir) {
+       if (event_payload_fc->in_ir && !notit->dry_run) {
                BT_ASSERT(!notit->dscopes.event_payload);
                notit->dscopes.event_payload =
                        bt_event_borrow_payload_field(
@@ -1420,11 +1491,12 @@ enum bt_msg_iter_status skip_packet_padding_state(struct bt_msg_iter *notit)
 {
        enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
        size_t bits_to_skip;
+       const enum state next_state = STATE_SWITCH_PACKET;
 
        BT_ASSERT(notit->cur_exp_packet_total_size > 0);
        bits_to_skip = notit->cur_exp_packet_total_size - packet_at(notit);
        if (bits_to_skip == 0) {
-               notit->state = STATE_DSCOPE_TRACE_PACKET_HEADER_BEGIN;
+               notit->state = next_state;
                goto end;
        } else {
                size_t bits_to_consume;
@@ -1443,7 +1515,7 @@ enum bt_msg_iter_status skip_packet_padding_state(struct bt_msg_iter *notit)
                bits_to_skip = notit->cur_exp_packet_total_size -
                        packet_at(notit);
                if (bits_to_skip == 0) {
-                       notit->state = STATE_DSCOPE_TRACE_PACKET_HEADER_BEGIN;
+                       notit->state = next_state;
                        goto end;
                }
        }
@@ -1585,7 +1657,10 @@ enum bt_msg_iter_status handle_state(struct bt_msg_iter *notit)
        // TODO: optimalize!
        switch (state) {
        case STATE_INIT:
-               notit->state = STATE_DSCOPE_TRACE_PACKET_HEADER_BEGIN;
+               notit->state = STATE_SWITCH_PACKET;
+               break;
+       case STATE_SWITCH_PACKET:
+               status = switch_packet_state(notit);
                break;
        case STATE_DSCOPE_TRACE_PACKET_HEADER_BEGIN:
                status = read_packet_header_begin_state(notit);
@@ -1728,8 +1803,6 @@ void bt_msg_iter_reset(struct bt_msg_iter *notit)
        bt_msg_iter_reset_for_next_stream_file(notit);
        notit->cur_stream_class_id = -1;
        notit->cur_data_stream_id = -1;
-       notit->emit_stream_begin_msg = true;
-       notit->emit_stream_end_msg = true;
        notit->snapshots.discarded_events = UINT64_C(-1);
        notit->snapshots.packets = UINT64_C(-1);
        notit->prev_packet_snapshots.discarded_events = UINT64_C(-1);
@@ -1738,70 +1811,6 @@ void bt_msg_iter_reset(struct bt_msg_iter *notit)
        notit->prev_packet_snapshots.end_clock = UINT64_C(-1);
 }
 
-static
-int bt_msg_iter_switch_packet(struct bt_msg_iter *notit)
-{
-       int ret = 0;
-
-       /*
-        * We don't put the stream class here because we need to make
-        * sure that all the packets processed by the same message
-        * iterator refer to the same stream class (the first one).
-        */
-       BT_ASSERT(notit);
-
-       if (notit->cur_exp_packet_total_size != -1) {
-               notit->cur_packet_offset += notit->cur_exp_packet_total_size;
-       }
-
-       BT_COMP_LOGD("Switching packet: notit-addr=%p, cur=%zu, "
-               "packet-offset=%" PRId64, notit, notit->buf.at,
-               notit->cur_packet_offset);
-       stack_clear(notit->stack);
-       notit->meta.ec = NULL;
-       BT_PACKET_PUT_REF_AND_RESET(notit->packet);
-       BT_MESSAGE_PUT_REF_AND_RESET(notit->event_msg);
-       release_all_dscopes(notit);
-       notit->cur_dscope_field = NULL;
-
-       /*
-        * Adjust current buffer so that addr points to the beginning of the new
-        * packet.
-        */
-       if (notit->buf.addr) {
-               size_t consumed_bytes = (size_t) (notit->buf.at / CHAR_BIT);
-
-               /* Packets are assumed to start on a byte frontier. */
-               if (notit->buf.at % CHAR_BIT) {
-                       BT_COMP_LOGW("Cannot switch packet: current position is not a multiple of 8: "
-                               "notit-addr=%p, cur=%zu", notit, notit->buf.at);
-                       ret = -1;
-                       goto end;
-               }
-
-               notit->buf.addr += consumed_bytes;
-               notit->buf.sz -= consumed_bytes;
-               notit->buf.at = 0;
-               notit->buf.packet_offset = 0;
-               BT_COMP_LOGD("Adjusted buffer: addr=%p, size=%zu",
-                       notit->buf.addr, notit->buf.sz);
-       }
-
-       notit->cur_exp_packet_content_size = -1;
-       notit->cur_exp_packet_total_size = -1;
-       notit->cur_stream_class_id = -1;
-       notit->cur_event_class_id = -1;
-       notit->cur_data_stream_id = -1;
-       notit->prev_packet_snapshots = notit->snapshots;
-       notit->snapshots.discarded_events = UINT64_C(-1);
-       notit->snapshots.packets = UINT64_C(-1);
-       notit->snapshots.beginning_clock = UINT64_C(-1);
-       notit->snapshots.end_clock = UINT64_C(-1);
-
-end:
-       return ret;
-}
-
 static
 bt_field *borrow_next_field(struct bt_msg_iter *notit)
 {
@@ -1961,7 +1970,7 @@ update_def_clock:
                        (uint64_t) int_fc->storing_index) = value;
        }
 
-       if (G_UNLIKELY(!fc->in_ir)) {
+       if (G_UNLIKELY(!fc->in_ir || notit->dry_run)) {
                goto end;
        }
 
@@ -1998,7 +2007,7 @@ enum bt_bfcr_status bfcr_unsigned_int_char_cb(uint64_t value,
        BT_ASSERT(!int_fc->mapped_clock_class);
        BT_ASSERT(int_fc->storing_index < 0);
 
-       if (G_UNLIKELY(!fc->in_ir)) {
+       if (G_UNLIKELY(!fc->in_ir || notit->dry_run)) {
                goto end;
        }
 
@@ -2050,7 +2059,7 @@ enum bt_bfcr_status bfcr_signed_int_cb(int64_t value,
                        (uint64_t) int_fc->storing_index) = (uint64_t) value;
        }
 
-       if (G_UNLIKELY(!fc->in_ir)) {
+       if (G_UNLIKELY(!fc->in_ir || notit->dry_run)) {
                goto end;
        }
 
@@ -2081,7 +2090,7 @@ enum bt_bfcr_status bfcr_floating_point_cb(double value,
                "fc-type=%d, fc-in-ir=%d, value=%f",
                notit, notit->bfcr, fc, fc->type, fc->in_ir, value);
 
-       if (G_UNLIKELY(!fc->in_ir)) {
+       if (G_UNLIKELY(!fc->in_ir || notit->dry_run)) {
                goto end;
        }
 
@@ -2109,7 +2118,7 @@ enum bt_bfcr_status bfcr_string_begin_cb(
                "fc-type=%d, fc-in-ir=%d",
                notit, notit->bfcr, fc, fc->type, fc->in_ir);
 
-       if (G_UNLIKELY(!fc->in_ir)) {
+       if (G_UNLIKELY(!fc->in_ir || notit->dry_run)) {
                goto end;
        }
 
@@ -2146,7 +2155,7 @@ enum bt_bfcr_status bfcr_string_cb(const char *value,
                notit, notit->bfcr, fc, fc->type, fc->in_ir,
                len);
 
-       if (G_UNLIKELY(!fc->in_ir)) {
+       if (G_UNLIKELY(!fc->in_ir || notit->dry_run)) {
                goto end;
        }
 
@@ -2178,7 +2187,7 @@ enum bt_bfcr_status bfcr_string_end_cb(
                "fc-type=%d, fc-in-ir=%d",
                notit, notit->bfcr, fc, fc->type, fc->in_ir);
 
-       if (G_UNLIKELY(!fc->in_ir)) {
+       if (G_UNLIKELY(!fc->in_ir || notit->dry_run)) {
                goto end;
        }
 
@@ -2203,7 +2212,7 @@ enum bt_bfcr_status bfcr_compound_begin_cb(
                "fc-type=%d, fc-in-ir=%d",
                notit, notit->bfcr, fc, fc->type, fc->in_ir);
 
-       if (!fc->in_ir) {
+       if (G_UNLIKELY(!fc->in_ir || notit->dry_run)) {
                goto end;
        }
 
@@ -2253,7 +2262,7 @@ enum bt_bfcr_status bfcr_compound_end_cb(
                "fc-type=%d, fc-in-ir=%d",
                notit, notit->bfcr, fc, fc->type, fc->in_ir);
 
-       if (!fc->in_ir) {
+       if (G_UNLIKELY(!fc->in_ir || notit->dry_run)) {
                goto end;
        }
 
@@ -2301,6 +2310,11 @@ int64_t bfcr_get_sequence_length_cb(struct ctf_field_class *fc, void *data)
 
        length = (uint64_t) g_array_index(notit->stored_values, uint64_t,
                seq_fc->stored_length_index);
+
+       if (G_UNLIKELY(notit->dry_run)){
+               goto end;
+       }
+
        seq_field = stack_top(notit->stack)->base;
        BT_ASSERT(seq_field);
 
@@ -2322,6 +2336,7 @@ int64_t bfcr_get_sequence_length_cb(struct ctf_field_class *fc, void *data)
                }
        }
 
+end:
        return length;
 }
 
@@ -2384,7 +2399,7 @@ struct ctf_field_class *bfcr_borrow_variant_selected_field_class_cb(
        selected_option = ctf_field_class_variant_borrow_option_by_index(
                var_fc, (uint64_t) option_index);
 
-       if (selected_option->fc->in_ir) {
+       if (selected_option->fc->in_ir && !notit->dry_run) {
                bt_field *var_field = stack_top(notit->stack)->base;
 
                ret = bt_field_variant_select_option_field_by_index(
@@ -2514,13 +2529,47 @@ static
 void create_msg_packet_end(struct bt_msg_iter *notit, bt_message **message)
 {
        bt_message *msg;
+       bool update_default_cs = true;
 
        if (!notit->packet) {
                return;
        }
 
-       /* Update default clock from packet's end time */
-       if (notit->snapshots.end_clock != UINT64_C(-1)) {
+       /* Check if may be affected by lttng-crash timestamp_end quirk. */
+       if (G_UNLIKELY(notit->meta.tc->quirks.lttng_crash)) {
+               /*
+                * Check if the `timestamp_begin` field is non-zero but
+                * `timestamp_end` is zero. It means the trace is affected by
+                * the lttng-crash packet `timestamp_end` quirk and must be
+                * fixed up by omitting to update the default clock snapshot to
+                * the `timestamp_end` as is typically done.
+                */
+               if (notit->snapshots.beginning_clock != 0 &&
+                               notit->snapshots.end_clock == 0) {
+                       update_default_cs = false;
+               }
+       }
+
+       /*
+        * Check if may be affected by lttng event-after-packet `timestamp_end`
+        * quirk.
+        */
+       if (notit->meta.tc->quirks.lttng_event_after_packet) {
+               /*
+                * Check if `timestamp_end` is smaller then the current
+                * default_clock_snapshot (which is set to the last event
+                * decoded). It means the trace is affected by the lttng
+                * `event-after-packet` packet `timestamp_end` quirk and must
+                * be fixed up by omitting to update the default clock snapshot
+                * to the `timestamp_end` as is typically done.
+                */
+               if (notit->snapshots.end_clock < notit->default_clock_snapshot) {
+                       update_default_cs = false;
+               }
+       }
+
+       /* Update default clock from packet's end time. */
+       if (notit->snapshots.end_clock != UINT64_C(-1) && update_default_cs) {
                notit->default_clock_snapshot = notit->snapshots.end_clock;
        }
 
@@ -2530,7 +2579,7 @@ void create_msg_packet_end(struct bt_msg_iter *notit, bt_message **message)
                BT_ASSERT(notit->snapshots.end_clock != UINT64_C(-1));
                msg = bt_message_packet_end_create_with_default_clock_snapshot(
                        notit->msg_iter, notit->packet,
-                       notit->snapshots.end_clock);
+                       notit->default_clock_snapshot);
        } else {
                msg = bt_message_packet_end_create(notit->msg_iter,
                        notit->packet);
@@ -2836,21 +2885,24 @@ end:
 }
 
 static
-enum bt_msg_iter_status read_packet_header_context_fields(
-               struct bt_msg_iter *notit)
+enum bt_msg_iter_status decode_until_state( struct bt_msg_iter *notit,
+               enum state target_state_1, enum state target_state_2)
 {
-       int ret;
        enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
 
        BT_ASSERT(notit);
        notit->set_stream = false;
 
-       if (notit->state == STATE_EMIT_MSG_PACKET_BEGINNING) {
-               /* We're already there */
-               goto end;
-       }
+       do {
+               /*
+                * Check if we reached the state at which we want to stop
+                * decoding.
+                */
+               if (notit->state == target_state_1 ||
+                               notit->state == target_state_2) {
+                       goto end;
+               }
 
-       while (true) {
                status = handle_state(notit);
                if (G_UNLIKELY(status == BT_MSG_ITER_STATUS_AGAIN)) {
                        BT_COMP_LOGD_STR("Medium returned BT_MSG_ITER_STATUS_AGAIN.");
@@ -2862,13 +2914,8 @@ enum bt_msg_iter_status read_packet_header_context_fields(
                }
 
                switch (notit->state) {
-               case STATE_EMIT_MSG_PACKET_BEGINNING:
-                       /*
-                        * Packet header and context fields are
-                        * potentially decoded (or they don't exist).
-                        */
-                       goto end;
                case STATE_INIT:
+               case STATE_SWITCH_PACKET:
                case STATE_DSCOPE_TRACE_PACKET_HEADER_BEGIN:
                case STATE_DSCOPE_TRACE_PACKET_HEADER_CONTINUE:
                case STATE_AFTER_TRACE_PACKET_HEADER:
@@ -2881,25 +2928,56 @@ enum bt_msg_iter_status read_packet_header_context_fields(
                case STATE_EMIT_MSG_DISCARDED_EVENTS:
                case STATE_CHECK_EMIT_MSG_DISCARDED_PACKETS:
                case STATE_EMIT_MSG_DISCARDED_PACKETS:
-                       /* Non-emitting state: continue */
+               case STATE_EMIT_MSG_PACKET_BEGINNING:
+               case STATE_DSCOPE_EVENT_HEADER_BEGIN:
+               case STATE_DSCOPE_EVENT_HEADER_CONTINUE:
+               case STATE_AFTER_EVENT_HEADER:
+               case STATE_DSCOPE_EVENT_COMMON_CONTEXT_BEGIN:
+               case STATE_DSCOPE_EVENT_COMMON_CONTEXT_CONTINUE:
+               case STATE_DSCOPE_EVENT_SPEC_CONTEXT_BEGIN:
+               case STATE_DSCOPE_EVENT_SPEC_CONTEXT_CONTINUE:
+               case STATE_DSCOPE_EVENT_PAYLOAD_BEGIN:
+               case STATE_DSCOPE_EVENT_PAYLOAD_CONTINUE:
+               case STATE_EMIT_MSG_EVENT:
+               case STATE_SKIP_PACKET_PADDING:
+               case STATE_EMIT_MSG_PACKET_END_MULTI:
+               case STATE_EMIT_MSG_PACKET_END_SINGLE:
+               case STATE_CHECK_EMIT_MSG_STREAM_END:
+               case STATE_EMIT_MSG_STREAM_END:
                        break;
+               case STATE_DONE:
+                       /* fall-through */
                default:
-                       /*
-                        * We should never get past the
-                        * STATE_EMIT_MSG_PACKET_BEGINNING state.
-                        */
+                       /* We should never get to the STATE_DONE state. */
                        BT_COMP_LOGF("Unexpected state: notit-addr=%p, state=%s",
                                notit, state_string(notit->state));
                        abort();
                }
-       }
+       } while (true);
 
 end:
+       return status;
+}
+
+static
+enum bt_msg_iter_status read_packet_header_context_fields(
+               struct bt_msg_iter *notit)
+{
+       int ret;
+       enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+
+       status = decode_until_state(notit, STATE_EMIT_MSG_PACKET_BEGINNING, -1);
+       if (status != BT_MSG_ITER_STATUS_OK) {
+               goto end;
+       }
+
        ret = set_current_packet_content_sizes(notit);
        if (ret) {
                status = BT_MSG_ITER_STATUS_ERROR;
+               goto end;
        }
 
+end:
        return status;
 }
 
@@ -2949,6 +3027,42 @@ end:
        return ret;
 }
 
+static
+enum bt_msg_iter_status clock_snapshot_at_msg_iter_state(
+               struct bt_msg_iter *notit, enum state target_state_1,
+               enum state target_state_2, uint64_t *clock_snapshot)
+{
+       enum bt_msg_iter_status status = BT_MSG_ITER_STATUS_OK;
+
+       BT_ASSERT(notit);
+       BT_ASSERT(clock_snapshot);
+       status = decode_until_state(notit, target_state_1, target_state_2);
+       if (status != BT_MSG_ITER_STATUS_OK) {
+               goto end;
+       }
+
+       *clock_snapshot = notit->default_clock_snapshot;
+end:
+       return status;
+}
+
+BT_HIDDEN
+enum bt_msg_iter_status bt_msg_iter_curr_packet_first_event_clock_snapshot(
+               struct bt_msg_iter *notit, uint64_t *first_clock_snapshot)
+{
+       return clock_snapshot_at_msg_iter_state(notit,
+               STATE_AFTER_EVENT_HEADER, -1, first_clock_snapshot);
+}
+
+BT_HIDDEN
+enum bt_msg_iter_status bt_msg_iter_curr_packet_last_event_clock_snapshot(
+               struct bt_msg_iter *notit, uint64_t *last_clock_snapshot)
+{
+       return clock_snapshot_at_msg_iter_state(notit,
+               STATE_EMIT_MSG_PACKET_END_SINGLE,
+               STATE_EMIT_MSG_PACKET_END_MULTI, last_clock_snapshot);
+}
+
 BT_HIDDEN
 enum bt_msg_iter_status bt_msg_iter_get_packet_properties(
                struct bt_msg_iter *notit,
@@ -2989,3 +3103,10 @@ void bt_msg_iter_set_emit_stream_end_message(struct bt_msg_iter *notit,
 {
        notit->emit_stream_end_msg = val;
 }
+
+BT_HIDDEN
+void bt_msg_iter_set_dry_run(struct bt_msg_iter *notit,
+               bool val)
+{
+       notit->dry_run = val;
+}
This page took 0.046587 seconds and 4 git commands to generate.