src.ctf.lttng-live: Add logging statements across the component class
[babeltrace.git] / src / plugins / ctf / lttng-live / viewer-connection.h
index 09adc6cf497c8d8b7da6baa81011f815ea9f9102..39f6a210f27b8233165843f57107fbe3fe601774 100644 (file)
  * SOFTWARE.
  */
 
+#include <stdbool.h>
+#include <stdint.h>
 #include <stdio.h>
+
 #include <glib.h>
 
-#include "common/babeltrace.h"
-#include "compat/socket.h"
+#include <babeltrace2/babeltrace.h>
 
-//TODO: this should not be used by plugins. Should copy code into plugin
-//instead.
-#include "lib/object.h"
+#include "common/macros.h"
+#include "compat/socket.h"
 
 #define LTTNG_DEFAULT_NETWORK_VIEWER_PORT      5344
 
 #define LTTNG_LIVE_MAJOR                       2
 #define LTTNG_LIVE_MINOR                       4
 
+enum lttng_live_viewer_status {
+       LTTNG_LIVE_VIEWER_STATUS_OK             = 0,
+       LTTNG_LIVE_VIEWER_STATUS_ERROR          = -1,
+       LTTNG_LIVE_VIEWER_STATUS_INTERRUPTED    = -2,
+};
+
+enum lttng_live_get_one_metadata_status {
+       /* The end of the metadata stream was reached. */
+       LTTNG_LIVE_GET_ONE_METADATA_STATUS_END          = 1,
+       /* One metadata packet was received and written to file. */
+       LTTNG_LIVE_GET_ONE_METADATA_STATUS_OK           = LTTNG_LIVE_VIEWER_STATUS_OK,
+       /*
+        * A critical error occurred when contacting the relay or while
+        * handling its response.
+        */
+       LTTNG_LIVE_GET_ONE_METADATA_STATUS_ERROR        = LTTNG_LIVE_VIEWER_STATUS_ERROR,
+
+       LTTNG_LIVE_GET_ONE_METADATA_STATUS_INTERRUPTED  = LTTNG_LIVE_VIEWER_STATUS_INTERRUPTED,
+
+       /* The metadata stream was not found on the relay. */
+       LTTNG_LIVE_GET_ONE_METADATA_STATUS_CLOSED       = -3,
+};
+
 struct lttng_live_component;
 
 struct live_viewer_connection {
-       bt_object obj;
+       bt_logging_level log_level;
+       bt_self_component *self_comp;
+       bt_self_component_class *self_comp_class;
 
        GString *url;
 
        GString *relay_hostname;
        GString *target_hostname;
        GString *session_name;
+       GString *proto;
 
        BT_SOCKET control_sock;
        int port;
@@ -78,14 +105,18 @@ struct packet_index {
        uint64_t packet_seq_num;        /* packet sequence number */
 };
 
-struct live_viewer_connection * live_viewer_connection_create(
+enum lttng_live_viewer_status live_viewer_connection_create(
+               bt_self_component *self_comp,
+               bt_self_component_class *self_comp_class,
+               bt_logging_level log_level,
                const char *url, bool in_query,
-               struct lttng_live_msg_iter *lttng_live_msg_iter);
+               struct lttng_live_msg_iter *lttng_live_msg_iter,
+               struct live_viewer_connection **viewer_connection);
 
 void live_viewer_connection_destroy(
                struct live_viewer_connection *conn);
 
-bt_query_status live_viewer_connection_list_sessions(
+bt_component_class_query_method_status live_viewer_connection_list_sessions(
                struct live_viewer_connection *viewer_connection,
                const bt_value **user_result);
 
This page took 0.024604 seconds and 4 git commands to generate.