sink.text.pretty: print inactivity msg handling with BT_LOGD_STR
[babeltrace.git] / plugins / ctf / lttng-live / lttng-live-internal.h
index 3d8b5fa71c07f20b503b11bd5540f92c6dd868a3..fe35314316a8f30b108c058163b2e2dd0affb680 100644 (file)
  * SOFTWARE.
  */
 
-extern int bt_lttng_live_log_level;
-
 #include <stdbool.h>
 
 #include <babeltrace/babeltrace-internal.h>
-
-#define BT_LOG_OUTPUT_LEVEL bt_lttng_live_log_level
-#include <babeltrace/logging-internal.h>
-
-#include <babeltrace/graph/component.h>
-#include <babeltrace/graph/notification-iterator.h>
-#include <babeltrace/graph/clock-class-priority-map.h>
+#include <babeltrace/babeltrace.h>
 #include "viewer-connection.h"
 
 //TODO: this should not be used by plugins. Should copy code into plugin
@@ -77,18 +69,18 @@ struct lttng_live_stream_iterator_generic {
 struct lttng_live_stream_iterator {
        struct lttng_live_stream_iterator_generic p;
 
-       struct bt_ctf_stream *stream;
+       const bt_stream *stream;
        struct lttng_live_trace *trace;
-       struct bt_private_port *port;
+       struct bt_private_port *port;   /* weak ref. */
 
        /* Node of stream list within the trace. */
        struct bt_list_head node;
 
        /*
         * Since only a single iterator per viewer connection, we have
-        * only a single notification iterator per stream.
+        * only a single message iterator per stream.
         */
-       struct bt_ctf_notif_iter *notif_iter;
+       struct bt_msg_iter *msg_iter;
 
        uint64_t viewer_stream_id;
 
@@ -103,7 +95,7 @@ struct lttng_live_stream_iterator {
        enum lttng_live_stream_state state;
 
        uint64_t current_packet_end_timestamp;
-       struct bt_notification *packet_end_notif_queue;
+       const bt_message *packet_end_msg_queue;
 
        uint8_t *buf;
        size_t buflen;
@@ -115,7 +107,7 @@ struct lttng_live_no_stream_iterator {
        struct lttng_live_stream_iterator_generic p;
 
        struct lttng_live_component *lttng_live;
-       struct bt_private_port *port;
+       struct bt_private_port *port;   /* weak ref. */
 };
 
 struct lttng_live_component_options {
@@ -136,7 +128,7 @@ struct lttng_live_metadata {
 };
 
 struct lttng_live_trace {
-       struct bt_object obj;
+       bt_object obj;
 
        /* Node of trace list within the session. */
        struct bt_list_head node;
@@ -146,10 +138,10 @@ struct lttng_live_trace {
 
        uint64_t id;    /* ctf trace ID within the session. */
 
-       struct bt_ctf_trace *trace;
+       const bt_trace *trace;
 
        struct lttng_live_metadata *metadata;
-       struct bt_clock_class_priority_map *cc_prio_map;
+       bt_clock_class_priority_map *cc_prio_map;
 
        /* List of struct lttng_live_stream_iterator */
        struct bt_list_head streams;
@@ -163,6 +155,9 @@ struct lttng_live_session {
 
        struct lttng_live_component *lttng_live;
 
+       GString *hostname;
+       GString *session_name;
+
        uint64_t id;
 
        /* List of struct lttng_live_trace */
@@ -170,7 +165,7 @@ struct lttng_live_session {
 
        bool attached;
        bool new_streams_needed;
-       bool lazy_stream_notif_init;
+       bool lazy_stream_msg_init;
        bool closed;
 };
 
@@ -178,8 +173,8 @@ struct lttng_live_session {
  * A component instance is an iterator on a single session.
  */
 struct lttng_live_component {
-       struct bt_object obj;
-       struct bt_private_component *private_component; /* weak */
+       bt_object obj;
+       bt_self_component *private_component;   /* weak */
        struct bt_live_viewer_connection *viewer_connection;
 
        /* List of struct lttng_live_session */
@@ -189,64 +184,73 @@ struct lttng_live_component {
        size_t max_query_size;
        struct lttng_live_component_options options;
 
-       struct bt_private_port *no_stream_port;
+       struct bt_private_port *no_stream_port; /* weak */
        struct lttng_live_no_stream_iterator *no_stream_iter;
+
+       bt_component *downstream_component;
 };
 
-enum bt_ctf_lttng_live_iterator_status {
+bt_lttng_live_iterator_status {
        /** Iterator state has progressed. Continue iteration immediately. */
-       BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE = 3,
-       /** No notification available for now. Try again later. */
-       BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_AGAIN = 2,
+       BT_LTTNG_LIVE_ITERATOR_STATUS_CONTINUE = 3,
+       /** No message available for now. Try again later. */
+       BT_LTTNG_LIVE_ITERATOR_STATUS_AGAIN = 2,
        /** No more CTF_LTTNG_LIVEs to be delivered. */
-       BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_END = 1,
+       BT_LTTNG_LIVE_ITERATOR_STATUS_END = 1,
        /** No error, okay. */
-       BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_OK = 0,
+       BT_LTTNG_LIVE_ITERATOR_STATUS_OK = 0,
        /** Invalid arguments. */
-       BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_INVAL = -1,
+       BT_LTTNG_LIVE_ITERATOR_STATUS_INVAL = -1,
        /** General error. */
-       BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_ERROR = -2,
+       BT_LTTNG_LIVE_ITERATOR_STATUS_ERROR = -2,
        /** Out of memory. */
-       BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_NOMEM = -3,
+       BT_LTTNG_LIVE_ITERATOR_STATUS_NOMEM = -3,
        /** Unsupported iterator feature. */
-       BT_CTF_LTTNG_LIVE_ITERATOR_STATUS_UNSUPPORTED = -4,
+       BT_LTTNG_LIVE_ITERATOR_STATUS_UNSUPPORTED = -4,
 };
 
-BT_HIDDEN
-enum bt_component_status lttng_live_component_init(struct bt_private_component *source,
-               struct bt_value *params, void *init_method_data);
+bt_component_status lttng_live_component_init(bt_self_component *source,
+               bt_value *params, void *init_method_data);
 
-struct bt_value *lttng_live_query(struct bt_component_class *comp_class,
-               const char *object, struct bt_value *params);
+bt_component_class_query_method_return lttng_live_query(
+               const bt_component_class *comp_class,
+               const bt_query_executor *query_exec,
+               const char *object, bt_value *params);
 
-void lttng_live_component_finalize(struct bt_private_component *component);
+void lttng_live_component_finalize(bt_self_component *component);
 
-BT_HIDDEN
-struct bt_notification_iterator_next_return lttng_live_iterator_next(
-        struct bt_private_notification_iterator *iterator);
+bt_message_iterator_next_method_return lttng_live_iterator_next(
+        bt_self_message_iterator *iterator);
 
+bt_component_status lttng_live_accept_port_connection(
+               bt_self_component *private_component,
+               struct bt_private_port *self_private_port,
+               const bt_port *other_port);
 
-enum bt_notification_iterator_status lttng_live_iterator_init(
-               struct bt_private_notification_iterator *it,
+bt_message_iterator_status lttng_live_iterator_init(
+               bt_self_message_iterator *it,
                struct bt_private_port *port);
 
-void lttng_live_iterator_finalize(struct bt_private_notification_iterator *it);
+void lttng_live_iterator_finalize(bt_self_message_iterator *it);
 
 int lttng_live_create_viewer_session(struct lttng_live_component *lttng_live);
 int lttng_live_attach_session(struct lttng_live_session *session);
 int lttng_live_detach_session(struct lttng_live_session *session);
-enum bt_ctf_lttng_live_iterator_status lttng_live_get_new_streams(
+bt_lttng_live_iterator_status lttng_live_get_new_streams(
                struct lttng_live_session *session);
 
-int lttng_live_add_session(struct lttng_live_component *lttng_live, uint64_t session_id);
+int lttng_live_add_session(struct lttng_live_component *lttng_live,
+               uint64_t session_id,
+               const char *hostname,
+               const char *session_name);
 
 ssize_t lttng_live_get_one_metadata_packet(struct lttng_live_trace *trace,
                FILE *fp);
-enum bt_ctf_lttng_live_iterator_status lttng_live_get_next_index(
+bt_lttng_live_iterator_status lttng_live_get_next_index(
                struct lttng_live_component *lttng_live,
                struct lttng_live_stream_iterator *stream,
                struct packet_index *index);
-enum bt_ctf_notif_iter_medium_status lttng_live_get_stream_bytes(
+enum bt_msg_iter_medium_status lttng_live_get_stream_bytes(
                struct lttng_live_component *lttng_live,
                struct lttng_live_stream_iterator *stream, uint8_t *buf, uint64_t offset,
                uint64_t req_len, uint64_t *recv_len);
@@ -261,4 +265,6 @@ struct lttng_live_trace *lttng_live_ref_trace(
 void lttng_live_unref_trace(struct lttng_live_trace *trace);
 void lttng_live_need_new_streams(struct lttng_live_component *lttng_live);
 
+bt_bool lttng_live_is_canceled(struct lttng_live_component *lttng_live);
+
 #endif /* BABELTRACE_PLUGIN_CTF_LTTNG_LIVE_INTERNAL_H */
This page took 0.027266 seconds and 4 git commands to generate.