X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fplugins%2Fctf%2Flttng-live%2Fviewer-connection.h;h=45cc8e212248432722c2e593dcd182e5b3511e4a;hb=a043c3621976126dfaaaf8ffa2ee7fd5d98ea33b;hp=2840473608ad3327c4621a149646ce93b292edad;hpb=737cacd27067f6dd35d1c781449374b4f91aaf76;p=babeltrace.git diff --git a/src/plugins/ctf/lttng-live/viewer-connection.h b/src/plugins/ctf/lttng-live/viewer-connection.h index 28404736..45cc8e21 100644 --- a/src/plugins/ctf/lttng-live/viewer-connection.h +++ b/src/plugins/ctf/lttng-live/viewer-connection.h @@ -1,59 +1,64 @@ -#ifndef LTTNG_LIVE_VIEWER_CONNECTION_H -#define LTTNG_LIVE_VIEWER_CONNECTION_H - /* - * Copyright 2016 - Mathieu Desnoyers - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. + * SPDX-License-Identifier: MIT * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. + * Copyright 2016 Mathieu Desnoyers */ +#ifndef LTTNG_LIVE_VIEWER_CONNECTION_H +#define LTTNG_LIVE_VIEWER_CONNECTION_H + +#include +#include #include + #include +#include + #include "common/macros.h" #include "compat/socket.h" -/* - * FIXME: This is an internal Babeltrace library header; it is not meant - * to be generic as it is now. Make sure this included code does not - * log because it won't find our local log level. - */ -#define BT_OBJECT_DONT_LOG -#include "lib/object.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; @@ -84,14 +89,20 @@ 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, - bt_logging_level log_level); + struct live_viewer_connection **viewer_connection); void live_viewer_connection_destroy( struct live_viewer_connection *conn); +enum lttng_live_viewer_status lttng_live_create_viewer_session( + struct lttng_live_msg_iter *lttng_live_msg_iter); + bt_component_class_query_method_status live_viewer_connection_list_sessions( struct live_viewer_connection *viewer_connection, const bt_value **user_result);