#ifndef LTTNG_LIVE_VIEWER_CONNECTION_H
#define LTTNG_LIVE_VIEWER_CONNECTION_H
+#include <string>
+
#include <glib.h>
-#include <stdbool.h>
#include <stdint.h>
-#include <stdio.h>
#include <babeltrace2/babeltrace.h>
-#include "common/macros.h"
-#include "compat/socket.h"
+#include "compat/socket.hpp"
+#include "cpp-common/bt2c/glib-up.hpp"
+#include "cpp-common/bt2c/logging.hpp"
#define LTTNG_DEFAULT_NETWORK_VIEWER_PORT 5344
LTTNG_LIVE_GET_ONE_METADATA_STATUS_CLOSED = -3,
};
-struct lttng_live_component;
-
struct live_viewer_connection
{
- bt_logging_level log_level;
- bt_self_component *self_comp;
- bt_self_component_class *self_comp_class;
+ explicit live_viewer_connection(const bt2c::Logger& parentLogger) :
+ logger {parentLogger, "PLUGIN/SRC.CTF.LTTNG-LIVE/VIEWER"}
+ {
+ }
+
+ ~live_viewer_connection();
- GString *url;
+ bt2c::Logger logger;
- GString *relay_hostname;
- GString *target_hostname;
- GString *session_name;
- GString *proto;
+ std::string url;
- BT_SOCKET control_sock;
- int port;
+ bt2c::GStringUP relay_hostname;
+ bt2c::GStringUP target_hostname;
+ bt2c::GStringUP session_name;
+ bt2c::GStringUP proto;
- int32_t major;
- int32_t minor;
+ BT_SOCKET control_sock {};
+ int port = 0;
- bool in_query;
- struct lttng_live_msg_iter *lttng_live_msg_iter;
+ int32_t major = 0;
+ int32_t minor = 0;
+
+ bool in_query = false;
+ struct lttng_live_msg_iter *lttng_live_msg_iter = nullptr;
};
struct packet_index_time
uint64_t packet_seq_num; /* packet sequence number */
};
-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 live_viewer_connection **viewer_connection);
-
-void live_viewer_connection_destroy(struct live_viewer_connection *conn);
+enum lttng_live_viewer_status live_viewer_connection_create(
+ const char *url, bool in_query, struct lttng_live_msg_iter *lttng_live_msg_iter,
+ const bt2c::Logger& parentLogger, struct live_viewer_connection **viewer);
enum lttng_live_viewer_status
lttng_live_create_viewer_session(struct lttng_live_msg_iter *lttng_live_msg_iter);