const struct lttng_session_descriptor *descriptor,
const char **name);
+/*
+ * Get a session descriptor's trace format descriptor.
+ *
+ * The 'trace_format_descriptor' parameter is used as an output parameter and will point to
+ * the session descriptor's trace format descriptor on success
+ * (LTTNG_SESSION_DESCRIPTOR_STATUS_OK). Its content of is left unspecified
+ * for other return codes. The pointer returned through 'trace_format_descriptor' is only
+ * guaranteed to remain valid until the next method call on the session
+ * descriptor.
+ *
+ * Returns LTTNG_SESSION_DESCRIPTOR_STATUS_OK on success,
+ * LTTNG_SESSION_DESCRIPTOR_STATUS_INVALID if 'descriptor' or 'trace_format_descriptor' are
+ * NULL.
+ */
+LTTNG_EXPORT extern enum lttng_session_descriptor_status
+lttng_session_descriptor_get_trace_format_descriptor(
+ const struct lttng_session_descriptor *session_descriptor,
+ const struct lttng_trace_format_descriptor **trace_format_descriptor);
+
+/*
+ * Set a session descriptor's trace format descriptor.
+ *
+ * The trace format descriptor is copied internally.
+ *
+ * Returns LTTNG_SESSION_DESCRIPTOR_STATUS_OK on success,
+ * LTTNG_SESSION_DESCRIPTOR_STATUS_INVALID if 'descriptor' or 'trace_format_descriptor' are
+ * NULL.
+ */
+LTTNG_EXPORT extern enum lttng_session_descriptor_status
+lttng_session_descriptor_set_trace_format_descriptor(
+ struct lttng_session_descriptor *session_descriptor,
+ const struct lttng_trace_format_descriptor *trace_format_descriptor);
+
/*
* Destroy a local lttng_session object.
*
end:
return ret;
}
+
+enum lttng_session_descriptor_status lttng_session_descriptor_get_trace_format_descriptor(
+ const struct lttng_session_descriptor *session_descriptor,
+ const struct lttng_trace_format_descriptor **trace_format_descriptor)
+{
+ *trace_format_descriptor = reinterpret_cast<const lttng_trace_format_descriptor *>(
+ session_descriptor->format_descriptor);
+ return LTTNG_SESSION_DESCRIPTOR_STATUS_OK;
+}
+
+/* trace_format_descriptor is copied internally */
+enum lttng_session_descriptor_status lttng_session_descriptor_set_trace_format_descriptor(
+ struct lttng_session_descriptor *session_descriptor,
+ const struct lttng_trace_format_descriptor *trace_format_descriptor)
+{
+ if (!session_descriptor || !trace_format_descriptor) {
+ return LTTNG_SESSION_DESCRIPTOR_STATUS_INVALID;
+ }
+
+ try {
+ lttng::trace_format_descriptor::uptr copy =
+ reinterpret_cast<const lttng::trace_format_descriptor *>(
+ trace_format_descriptor)
+ ->clone();
+ delete session_descriptor->format_descriptor;
+ session_descriptor->format_descriptor = copy.release();
+ } catch (const std::exception& ex) {
+ return LTTNG_SESSION_DESCRIPTOR_STATUS_INVALID;
+ }
+
+ return LTTNG_SESSION_DESCRIPTOR_STATUS_OK;
+}
lttng_session_descriptor_create
lttng_session_descriptor_destroy
lttng_session_descriptor_get_session_name
+lttng_session_descriptor_get_trace_format_descriptor
lttng_session_descriptor_live_create
lttng_session_descriptor_live_network_create
lttng_session_descriptor_local_create
lttng_session_descriptor_network_create
+lttng_session_descriptor_set_trace_format_descriptor
lttng_session_descriptor_snapshot_create
lttng_session_descriptor_snapshot_local_create
lttng_session_descriptor_snapshot_network_create