*/
/**
- * Medium operations status codes.
+ * Medium operations status codes. These use the same values as
+ * libbabeltrace2.
*/
enum ctf_msg_iter_medium_status {
/**
*/
CTF_MSG_ITER_MEDIUM_STATUS_AGAIN = 11,
- /** Unsupported operation. */
- CTF_MSG_ITER_MEDIUM_STATUS_UNSUPPORTED = -3,
-
- /** Invalid argument. */
- CTF_MSG_ITER_MEDIUM_STATUS_INVAL = -2,
-
/** General error. */
CTF_MSG_ITER_MEDIUM_STATUS_ERROR = -1,
+ /** Memory error. */
+ CTF_MSG_ITER_MEDIUM_STATUS_MEMORY_ERROR = -12,
+
/** Everything okay. */
CTF_MSG_ITER_MEDIUM_STATUS_OK = 0,
};
*/
CTF_MSG_ITER_STATUS_AGAIN = CTF_MSG_ITER_MEDIUM_STATUS_AGAIN,
- /** Invalid argument. */
- CTF_MSG_ITER_STATUS_INVAL = CTF_MSG_ITER_MEDIUM_STATUS_INVAL,
-
- /** Unsupported operation. */
- CTF_MSG_ITER_STATUS_UNSUPPORTED = CTF_MSG_ITER_MEDIUM_STATUS_UNSUPPORTED,
-
/** General error. */
CTF_MSG_ITER_STATUS_ERROR = CTF_MSG_ITER_MEDIUM_STATUS_ERROR,
+ /** Memory error. */
+ CTF_MSG_ITER_STATUS_MEMORY_ERROR = CTF_MSG_ITER_MEDIUM_STATUS_MEMORY_ERROR,
+
/** Everything okay. */
CTF_MSG_ITER_STATUS_OK = CTF_MSG_ITER_MEDIUM_STATUS_OK,
};
-/**
- * CTF message iterator seek operation directives.
- */
-enum ctf_msg_iter_seek_whence {
- /**
- * Set the iterator's position to an absolute offset in the underlying
- * medium.
- */
- CTF_MSG_ITER_SEEK_WHENCE_SET,
-};
-
/**
* Medium operations.
*
* #CTF_MSG_ITER_MEDIUM_STATUS_EOF on the \em following
* call.
* - <b>#CTF_MSG_ITER_MEDIUM_STATUS_ERROR</b>: A fatal
- * error occured during this operation. In this case, the
+ * error occurred during this operation. In this case, the
* message iterator function called by the user returns
* #CTF_MSG_ITER_STATUS_ERROR.
*
* Repositions the underlying stream's position.
*
* This *optional* method repositions the underlying stream
- * to a given absolute or relative position, as indicated by
- * the whence directive.
+ * to a given absolute position in the medium.
*
- * @param whence One of #ctf_msg_iter_seek_whence values
* @param offset Offset to use for the given directive
* @param data User data
* @returns One of #ctf_msg_iter_medium_status values
*/
- enum ctf_msg_iter_medium_status (* seek)(
- enum ctf_msg_iter_seek_whence whence,
- off_t offset, void *data);
+ enum ctf_msg_iter_medium_status (* seek)(off_t offset, void *data);
+
+ /**
+ * Called when the message iterator wishes to inform the medium that it
+ * is about to start a new packet.
+ *
+ * After the iterator has called switch_packet, the following call to
+ * request_bytes must return the content at the start of the next
+ * packet. */
+ enum ctf_msg_iter_medium_status (* switch_packet)(void *data);
/**
* Returns a stream instance (weak reference) for the given
* success, or \c NULL on error
*/
BT_HIDDEN
-struct ctf_msg_iter *ctf_msg_iter_create(struct ctf_trace_class *tc,
- size_t max_request_sz, struct ctf_msg_iter_medium_ops medops,
- void *medops_data, bt_logging_level log_level,
- bt_self_component *self_comp);
+struct ctf_msg_iter *ctf_msg_iter_create(
+ struct ctf_trace_class *tc,
+ size_t max_request_sz,
+ struct ctf_msg_iter_medium_ops medops,
+ void *medops_data,
+ bt_logging_level log_level,
+ bt_self_component *self_comp,
+ bt_self_message_iterator *self_msg_iter);
/**
* Destroys a CTF message iterator, freeing all internal resources.
BT_HIDDEN
enum ctf_msg_iter_status ctf_msg_iter_get_next_message(
struct ctf_msg_iter *msg_it,
- bt_self_message_iterator *msg_iter,
- bt_message **message);
+ const bt_message **message);
struct ctf_msg_iter_packet_properties {
int64_t exp_packet_total_size;
enum ctf_msg_iter_status ctf_msg_iter_curr_packet_last_event_clock_snapshot(
struct ctf_msg_iter *msg_it, uint64_t *last_event_cs);
-BT_HIDDEN
-void ctf_msg_iter_set_medops_data(struct ctf_msg_iter *msg_it,
- void *medops_data);
-
BT_HIDDEN
enum ctf_msg_iter_status ctf_msg_iter_seek(
struct ctf_msg_iter *msg_it, off_t offset);
BT_HIDDEN
void ctf_msg_iter_reset_for_next_stream_file(struct ctf_msg_iter *msg_it);
-BT_HIDDEN
-void ctf_msg_iter_set_emit_stream_beginning_message(struct ctf_msg_iter *msg_it,
- bool val);
-
-BT_HIDDEN
-void ctf_msg_iter_set_emit_stream_end_message(struct ctf_msg_iter *msg_it,
- bool val);
-
BT_HIDDEN
void ctf_msg_iter_set_dry_run(struct ctf_msg_iter *msg_it,
bool val);
return "EOF";
case CTF_MSG_ITER_MEDIUM_STATUS_AGAIN:
return "AGAIN";
- case CTF_MSG_ITER_MEDIUM_STATUS_INVAL:
- return "INVAL";
case CTF_MSG_ITER_MEDIUM_STATUS_ERROR:
return "ERROR";
case CTF_MSG_ITER_MEDIUM_STATUS_OK:
return "EOF";
case CTF_MSG_ITER_STATUS_AGAIN:
return "AGAIN";
- case CTF_MSG_ITER_STATUS_INVAL:
- return "INVAL";
case CTF_MSG_ITER_STATUS_ERROR:
return "ERROR";
case CTF_MSG_ITER_STATUS_OK: