X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=formats%2Flttng-live%2Flttng-live.h;h=ef799fd7f5d402fc420cde3bd76e6fea765b1739;hp=137a296d58d38cb248c539d62be9b1d22d538e98;hb=21fe3eb3b83998d6fad94f7ec346d57593afe8c1;hpb=c98627ca822e1284ccbda17597c8b057f0997acf diff --git a/formats/lttng-live/lttng-live.h b/formats/lttng-live/lttng-live.h index 137a296d..ef799fd7 100644 --- a/formats/lttng-live/lttng-live.h +++ b/formats/lttng-live/lttng-live.h @@ -25,19 +25,31 @@ */ #include +#include +#include +#include "lttng-viewer-abi.h" -#define LTTNG_METADATA_PATH_TEMPLATE "/tmp/lttng-live-XXXXXX" #define LTTNG_DEFAULT_NETWORK_VIEWER_PORT 5344 #define LTTNG_LIVE_MAJOR 2 #define LTTNG_LIVE_MINOR 4 +/* + * The lttng-live output file pointer is currently hardcoded to stdout, + * and is expected to be hardcoded to this by fflush() performed between + * each packet. + */ +#define LTTNG_LIVE_OUTPUT_FP stdout + struct lttng_live_ctx { - char traced_hostname[NAME_MAX]; - char session_name[NAME_MAX]; - char relay_hostname[NAME_MAX]; + char traced_hostname[MAXNAMLEN]; + char session_name[MAXNAMLEN]; + char relay_hostname[MAXNAMLEN]; int control_sock; int port; + /* Protocol version to use for this connection. */ + uint32_t major; + uint32_t minor; struct lttng_live_session *session; struct bt_context *bt_ctx; GArray *session_ids; @@ -46,11 +58,15 @@ struct lttng_live_ctx { struct lttng_live_viewer_stream { uint64_t id; uint64_t mmap_size; - int fd; + uint64_t ctf_stream_id; + FILE *metadata_fp_write; + ssize_t metadata_len; int metadata_flag; - int first_read; + int data_pending; struct lttng_live_session *session; struct lttng_live_ctf_trace *ctf_trace; + struct lttng_viewer_index current_index; + struct bt_list_head stream_node; char path[PATH_MAX]; }; @@ -58,7 +74,7 @@ struct lttng_live_session { uint64_t live_timer_interval; uint64_t stream_count; struct lttng_live_ctx *ctx; - struct lttng_live_viewer_stream *streams; + struct bt_list_head stream_list; GHashTable *ctf_traces; }; @@ -67,6 +83,7 @@ struct lttng_live_ctf_trace { struct lttng_live_viewer_stream *metadata_stream; GPtrArray *streams; FILE *metadata_fp; + struct bt_trace_handle *handle; int trace_id; int in_use; }; @@ -84,7 +101,8 @@ int lttng_live_connect_viewer(struct lttng_live_ctx *ctx); int lttng_live_establish_connection(struct lttng_live_ctx *ctx); int lttng_live_list_sessions(struct lttng_live_ctx *ctx, const char *path); int lttng_live_attach_session(struct lttng_live_ctx *ctx, uint64_t id); -void lttng_live_read(struct lttng_live_ctx *ctx); +int lttng_live_read(struct lttng_live_ctx *ctx); int lttng_live_get_new_streams(struct lttng_live_ctx *ctx, uint64_t id); +int lttng_live_should_quit(void); #endif /* _LTTNG_LIVE_H */