X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fconsumer.h;h=ab36a685c448de22e4645752d7e4beb69b567aba;hp=21d762a1582028a8ac206104943f8e57a16d9cfa;hb=37278a1e7efe00011260569fa90909601e8c5184;hpb=f1e1679499bf3e76127c8812c72a6e9ba69e02e5 diff --git a/src/bin/lttng-sessiond/consumer.h b/src/bin/lttng-sessiond/consumer.h index 21d762a15..ab36a685c 100644 --- a/src/bin/lttng-sessiond/consumer.h +++ b/src/bin/lttng-sessiond/consumer.h @@ -21,6 +21,14 @@ #include #include +#include + +#include "health.h" + +enum consumer_dst_type { + CONSUMER_DST_LOCAL, + CONSUMER_DST_NET, +}; struct consumer_data { enum lttng_consumer_type type; @@ -38,6 +46,90 @@ struct consumer_data { /* consumer error and command Unix socket path */ char err_unix_sock_path[PATH_MAX]; char cmd_unix_sock_path[PATH_MAX]; + + /* Health check of the thread */ + struct health_state health; }; +/* + * Network URIs + */ +struct consumer_net { + /* + * Indicate if URI type is set. Those flags should only be set when the + * created URI is done AND valid. + */ + int control_isset; + int data_isset; + + /* + * The following two URIs MUST have the same destination address for + * network streaming to work. Network hop are not yet supported. + */ + + /* Control path for network streaming. */ + struct lttng_uri control; + + /* Data path for network streaming. */ + struct lttng_uri data; +}; + +/* + * Consumer output object describing where and how to send data. + */ +struct consumer_output { + /* Consumer socket file descriptor */ + int sock; + /* If the consumer is enabled meaning that should be used */ + unsigned int enabled; + enum consumer_dst_type type; + /* + * The net_seq_index is the index of the network stream on the consumer + * side. It's basically the relayd socket file descriptor value so the + * consumer can identify which streams goes with which socket. + */ + int net_seq_index; + /* + * Subdirectory path name used for both local and network consumer. + */ + char subdir[PATH_MAX]; + union { + char trace_path[PATH_MAX]; + struct consumer_net net; + } dst; +}; + +struct consumer_output *consumer_create_output(enum consumer_dst_type type); +struct consumer_output *consumer_copy_output(struct consumer_output *obj); +void consumer_destroy_output(struct consumer_output *obj); +int consumer_set_network_uri(struct consumer_output *obj, + struct lttng_uri *uri); +int consumer_send_fds(int sock, int *fds, size_t nb_fd); +int consumer_send_stream(int sock, struct consumer_output *dst, + struct lttcomm_consumer_msg *msg, int *fds, size_t nb_fd); +int consumer_send_channel(int sock, struct lttcomm_consumer_msg *msg); +int consumer_send_relayd_socket(int consumer_sock, + struct lttcomm_sock *sock, struct consumer_output *consumer, + enum lttng_stream_type type); + +void consumer_init_stream_comm_msg(struct lttcomm_consumer_msg *msg, + enum lttng_consumer_command cmd, + int channel_key, + int stream_key, + uint32_t state, + enum lttng_event_output output, + uint64_t mmap_len, + uid_t uid, + gid_t gid, + int net_index, + unsigned int metadata_flag, + const char *name, + const char *pathname); +void consumer_init_channel_comm_msg(struct lttcomm_consumer_msg *msg, + enum lttng_consumer_command cmd, + int channel_key, + uint64_t max_sb_size, + uint64_t mmap_len, + const char *name); + #endif /* _CONSUMER_H */