Fix: Namespace lttng-viewer-abi
authorJulien Desfossez <jdesfossez@efficios.com>
Thu, 30 Jan 2014 16:11:44 +0000 (11:11 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Mon, 10 Feb 2014 19:55:17 +0000 (14:55 -0500)
This header is copied to all the viewers that implement the lttng-live
protocol, we need to make sure it is properly namespaced.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
src/bin/lttng-relayd/live.c
src/bin/lttng-relayd/lttng-viewer-abi.h
src/bin/lttng-relayd/viewer-stream.c
tests/regression/tools/live/live_test.c

index 23cf09eebb6960b0e5436900ffa6e2250529d9cc..b3b7ee427268ff6d24169a037b44eab134eddef9 100644 (file)
@@ -712,9 +712,9 @@ int viewer_connect(struct relay_connection *conn)
                conn->minor = be32toh(msg.minor);
        }
 
-       if (be32toh(msg.type) == VIEWER_CLIENT_COMMAND) {
+       if (be32toh(msg.type) == LTTNG_VIEWER_CLIENT_COMMAND) {
                conn->type = RELAY_VIEWER_COMMAND;
-       } else if (be32toh(msg.type) == VIEWER_CLIENT_NOTIFICATION) {
+       } else if (be32toh(msg.type) == LTTNG_VIEWER_CLIENT_NOTIFICATION) {
                conn->type = RELAY_VIEWER_NOTIFICATION;
        } else {
                ERR("Unknown connection type : %u", be32toh(msg.type));
@@ -841,17 +841,17 @@ int viewer_get_new_streams(struct relay_connection *conn)
        if (!session) {
                DBG("Relay session %" PRIu64 " not found",
                                be64toh(request.session_id));
-               response.status = htobe32(VIEWER_NEW_STREAMS_ERR);
+               response.status = htobe32(LTTNG_VIEWER_NEW_STREAMS_ERR);
                goto send_reply;
        }
 
        if (conn->session_id == session->id) {
                /* We confirmed the viewer is asking for the same session. */
                send_streams = 1;
-               response.status = htobe32(VIEWER_NEW_STREAMS_OK);
+               response.status = htobe32(LTTNG_VIEWER_NEW_STREAMS_OK);
        } else {
                send_streams = 0;
-               response.status = htobe32(VIEWER_NEW_STREAMS_ERR);
+               response.status = htobe32(LTTNG_VIEWER_NEW_STREAMS_ERR);
                goto send_reply;
        }
 
@@ -859,7 +859,7 @@ int viewer_get_new_streams(struct relay_connection *conn)
                goto send_reply;
        }
 
-       ret = make_viewer_streams(session, VIEWER_SEEK_LAST, NULL, &nb_unsent,
+       ret = make_viewer_streams(session, LTTNG_VIEWER_SEEK_LAST, NULL, &nb_unsent,
                        &nb_created);
        if (ret < 0) {
                goto end_unlock;
@@ -932,7 +932,7 @@ int viewer_attach_session(struct relay_connection *conn)
        if (!session) {
                DBG("Relay session %" PRIu64 " not found",
                                be64toh(request.session_id));
-               response.status = htobe32(VIEWER_ATTACH_UNK);
+               response.status = htobe32(LTTNG_VIEWER_ATTACH_UNK);
                goto send_reply;
        }
        session_viewer_attach(session);
@@ -940,28 +940,28 @@ int viewer_attach_session(struct relay_connection *conn)
 
        if (uatomic_read(&session->viewer_refcount) > 1) {
                DBG("Already a viewer attached");
-               response.status = htobe32(VIEWER_ATTACH_ALREADY);
+               response.status = htobe32(LTTNG_VIEWER_ATTACH_ALREADY);
                session_viewer_detach(session);
                goto send_reply;
        } else if (session->live_timer == 0) {
                DBG("Not live session");
-               response.status = htobe32(VIEWER_ATTACH_NOT_LIVE);
+               response.status = htobe32(LTTNG_VIEWER_ATTACH_NOT_LIVE);
                goto send_reply;
        } else {
                send_streams = 1;
-               response.status = htobe32(VIEWER_ATTACH_OK);
+               response.status = htobe32(LTTNG_VIEWER_ATTACH_OK);
                conn->session_id = session->id;
                conn->session = session;
        }
 
        switch (be32toh(request.seek)) {
-       case VIEWER_SEEK_BEGINNING:
-       case VIEWER_SEEK_LAST:
+       case LTTNG_VIEWER_SEEK_BEGINNING:
+       case LTTNG_VIEWER_SEEK_LAST:
                seek_type = be32toh(request.seek);
                break;
        default:
                ERR("Wrong seek parameter");
-               response.status = htobe32(VIEWER_ATTACH_SEEK_ERR);
+               response.status = htobe32(LTTNG_VIEWER_ATTACH_SEEK_ERR);
                send_streams = 0;
                goto send_reply;
        }
@@ -1056,7 +1056,7 @@ int viewer_get_next_index(struct relay_connection *conn)
         * The viewer should not ask for index on metadata stream.
         */
        if (vstream->metadata_flag) {
-               viewer_index.status = htobe32(VIEWER_INDEX_HUP);
+               viewer_index.status = htobe32(LTTNG_VIEWER_INDEX_HUP);
                goto send_reply;
        }
 
@@ -1069,10 +1069,10 @@ int viewer_get_next_index(struct relay_connection *conn)
                         * The index is created only when the first data packet arrives, it
                         * might not be ready at the beginning of the session
                         */
-                       viewer_index.status = htobe32(VIEWER_INDEX_RETRY);
+                       viewer_index.status = htobe32(LTTNG_VIEWER_INDEX_RETRY);
                        goto send_reply;
                } else if (ret < 0) {
-                       viewer_index.status = htobe32(VIEWER_INDEX_ERR);
+                       viewer_index.status = htobe32(LTTNG_VIEWER_INDEX_ERR);
                        goto send_reply;
                }
                vstream->index_read_fd = ret;
@@ -1089,7 +1089,7 @@ int viewer_get_next_index(struct relay_connection *conn)
                        if (ret < 0) {
                                goto end_unlock;
                        } else if (ret == 1) {
-                               viewer_index.status = htobe32(VIEWER_INDEX_HUP);
+                               viewer_index.status = htobe32(LTTNG_VIEWER_INDEX_HUP);
                                viewer_stream_delete(vstream);
                                viewer_stream_destroy(ctf_trace, vstream);
                                goto send_reply;
@@ -1101,7 +1101,7 @@ int viewer_get_next_index(struct relay_connection *conn)
                if (rstream->tracefile_count_current == vstream->tracefile_count_current) {
                        if (rstream->beacon_ts_end != -1ULL &&
                                vstream->last_sent_index == rstream->total_index_received) {
-                               viewer_index.status = htobe32(VIEWER_INDEX_INACTIVE);
+                               viewer_index.status = htobe32(LTTNG_VIEWER_INDEX_INACTIVE);
                                viewer_index.timestamp_end = htobe64(rstream->beacon_ts_end);
                                pthread_mutex_unlock(&rstream->viewer_stream_rotation_lock);
                                goto send_reply;
@@ -1114,7 +1114,7 @@ int viewer_get_next_index(struct relay_connection *conn)
                                 */
                                pthread_mutex_unlock(&rstream->viewer_stream_rotation_lock);
                                /* No new index to send, retry later. */
-                               viewer_index.status = htobe32(VIEWER_INDEX_RETRY);
+                               viewer_index.status = htobe32(LTTNG_VIEWER_INDEX_RETRY);
                                goto send_reply;
                        }
                }
@@ -1122,7 +1122,7 @@ int viewer_get_next_index(struct relay_connection *conn)
        } else if (rstream->close_flag && vstream->close_write_flag &&
                        vstream->total_index_received == vstream->last_sent_index) {
                /* Last index sent and current tracefile closed in write */
-               viewer_index.status = htobe32(VIEWER_INDEX_HUP);
+               viewer_index.status = htobe32(LTTNG_VIEWER_INDEX_HUP);
                viewer_stream_delete(vstream);
                viewer_stream_destroy(ctf_trace, vstream);
                goto send_reply;
@@ -1147,13 +1147,13 @@ int viewer_get_next_index(struct relay_connection *conn)
                /*
                 * The file is being overwritten by the writer, we cannot * use it.
                 */
-               viewer_index.status = htobe32(VIEWER_INDEX_RETRY);
+               viewer_index.status = htobe32(LTTNG_VIEWER_INDEX_RETRY);
                pthread_mutex_unlock(&vstream->overwrite_lock);
                ret = viewer_stream_rotate(vstream, rstream);
                if (ret < 0) {
                        goto end_unlock;
                } else if (ret == 1) {
-                       viewer_index.status = htobe32(VIEWER_INDEX_HUP);
+                       viewer_index.status = htobe32(LTTNG_VIEWER_INDEX_HUP);
                        viewer_stream_delete(vstream);
                        viewer_stream_destroy(ctf_trace, vstream);
                        goto send_reply;
@@ -1169,24 +1169,24 @@ int viewer_get_next_index(struct relay_connection *conn)
                 * The tracefile is closed in write, so we read up to EOF.
                 */
                if (vstream->close_write_flag == 1) {
-                       viewer_index.status = htobe32(VIEWER_INDEX_RETRY);
+                       viewer_index.status = htobe32(LTTNG_VIEWER_INDEX_RETRY);
                        /* Rotate on normal EOF */
                        ret = viewer_stream_rotate(vstream, rstream);
                        if (ret < 0) {
                                goto end_unlock;
                        } else if (ret == 1) {
-                               viewer_index.status = htobe32(VIEWER_INDEX_HUP);
+                               viewer_index.status = htobe32(LTTNG_VIEWER_INDEX_HUP);
                                viewer_stream_delete(vstream);
                                viewer_stream_destroy(ctf_trace, vstream);
                                goto send_reply;
                        }
                } else {
                        PERROR("Relay reading index file %d", vstream->index_read_fd);
-                       viewer_index.status = htobe32(VIEWER_INDEX_ERR);
+                       viewer_index.status = htobe32(LTTNG_VIEWER_INDEX_ERR);
                }
                goto send_reply;
        } else {
-               viewer_index.status = htobe32(VIEWER_INDEX_OK);
+               viewer_index.status = htobe32(LTTNG_VIEWER_INDEX_OK);
                vstream->last_sent_index++;
        }
 
@@ -1292,7 +1292,7 @@ int viewer_get_packet(struct relay_connection *conn)
 
        if (!ctf_trace->metadata_received ||
                        ctf_trace->metadata_received > ctf_trace->metadata_sent) {
-               reply.status = htobe32(VIEWER_GET_PACKET_ERR);
+               reply.status = htobe32(LTTNG_VIEWER_GET_PACKET_ERR);
                reply.flags |= LTTNG_VIEWER_FLAG_NEW_METADATA;
                goto send_reply;
        }
@@ -1301,7 +1301,7 @@ int viewer_get_packet(struct relay_connection *conn)
        if (ret < 0) {
                goto end_unlock;
        } else if (ret == 1) {
-               reply.status = htobe32(VIEWER_GET_PACKET_ERR);
+               reply.status = htobe32(LTTNG_VIEWER_GET_PACKET_ERR);
                reply.flags |= LTTNG_VIEWER_FLAG_NEW_STREAM;
                goto send_reply;
        }
@@ -1323,7 +1323,7 @@ int viewer_get_packet(struct relay_connection *conn)
                        PERROR("lseek");
                        goto error;
                }
-               reply.status = htobe32(VIEWER_GET_PACKET_EOF);
+               reply.status = htobe32(LTTNG_VIEWER_GET_PACKET_EOF);
                goto send_reply;
        }
        read_len = lttng_read(stream->read_fd, data, len);
@@ -1338,17 +1338,17 @@ int viewer_get_packet(struct relay_connection *conn)
                                        be64toh(get_packet_info.offset));
                        goto error;
                } else {
-                       reply.status = htobe32(VIEWER_GET_PACKET_EOF);
+                       reply.status = htobe32(LTTNG_VIEWER_GET_PACKET_EOF);
                        goto send_reply;
                }
        }
-       reply.status = htobe32(VIEWER_GET_PACKET_OK);
+       reply.status = htobe32(LTTNG_VIEWER_GET_PACKET_OK);
        reply.len = htobe32(len);
        send_data = 1;
        goto send_reply;
 
 error:
-       reply.status = htobe32(VIEWER_GET_PACKET_ERR);
+       reply.status = htobe32(LTTNG_VIEWER_GET_PACKET_ERR);
 
 send_reply:
        reply.flags = htobe32(reply.flags);
@@ -1424,7 +1424,7 @@ int viewer_get_metadata(struct relay_connection *conn)
 
        len = ctf_trace->metadata_received - ctf_trace->metadata_sent;
        if (len == 0) {
-               reply.status = htobe32(VIEWER_NO_NEW_METADATA);
+               reply.status = htobe32(LTTNG_VIEWER_NO_NEW_METADATA);
                goto send_reply;
        }
 
@@ -1458,11 +1458,11 @@ int viewer_get_metadata(struct relay_connection *conn)
                goto error;
        }
        ctf_trace->metadata_sent += read_len;
-       reply.status = htobe32(VIEWER_METADATA_OK);
+       reply.status = htobe32(LTTNG_VIEWER_METADATA_OK);
        goto send_reply;
 
 error:
-       reply.status = htobe32(VIEWER_METADATA_ERR);
+       reply.status = htobe32(LTTNG_VIEWER_METADATA_ERR);
 
 send_reply:
        health_code_update();
@@ -1522,32 +1522,32 @@ int process_control(struct lttng_viewer_cmd *recv_hdr,
         * Make sure we've done the version check before any command other then a
         * new client connection.
         */
-       if (msg_value != VIEWER_CONNECT && !conn->version_check_done) {
+       if (msg_value != LTTNG_VIEWER_CONNECT && !conn->version_check_done) {
                ERR("Viewer conn value %" PRIu32 " before version check", msg_value);
                ret = -1;
                goto end;
        }
 
        switch (msg_value) {
-       case VIEWER_CONNECT:
+       case LTTNG_VIEWER_CONNECT:
                ret = viewer_connect(conn);
                break;
-       case VIEWER_LIST_SESSIONS:
+       case LTTNG_VIEWER_LIST_SESSIONS:
                ret = viewer_list_sessions(conn);
                break;
-       case VIEWER_ATTACH_SESSION:
+       case LTTNG_VIEWER_ATTACH_SESSION:
                ret = viewer_attach_session(conn);
                break;
-       case VIEWER_GET_NEXT_INDEX:
+       case LTTNG_VIEWER_GET_NEXT_INDEX:
                ret = viewer_get_next_index(conn);
                break;
-       case VIEWER_GET_PACKET:
+       case LTTNG_VIEWER_GET_PACKET:
                ret = viewer_get_packet(conn);
                break;
-       case VIEWER_GET_METADATA:
+       case LTTNG_VIEWER_GET_METADATA:
                ret = viewer_get_metadata(conn);
                break;
-       case VIEWER_GET_NEW_STREAMS:
+       case LTTNG_VIEWER_GET_NEW_STREAMS:
                ret = viewer_get_new_streams(conn);
                break;
        default:
index 1f6955b05907b6f290cbff93a85844b7aa340995..3a91da8a6a587002fbbafaf810f87e132bcfa708 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef LTTNG_VIEWER_ABI_H
-#define LTTNG_VIEWER_ABI_H
+#ifndef LTTNG_VIEWER_H
+#define LTTNG_VIEWER_H
 
 /*
  * Copyright (C) 2013 - Julien Desfossez <jdesfossez@efficios.com>
 
 #define LTTNG_VIEWER_PATH_MAX          4096
 #define LTTNG_VIEWER_NAME_MAX          255
-#define LTTNG_VIEWER_ABI_HOST_NAME_MAX 64
+#define LTTNG_VIEWER_HOST_NAME_MAX     64
 
 /* Flags in reply to get_next_index and get_packet. */
-/* New metadata is required to read this packet. */
-#define LTTNG_VIEWER_FLAG_NEW_METADATA (1 << 0)
-/* New stream got added to the trace. */
-#define LTTNG_VIEWER_FLAG_NEW_STREAM   (1 << 1)
+enum {
+       /* New metadata is required to read this packet. */
+       LTTNG_VIEWER_FLAG_NEW_METADATA  = (1 << 0),
+       /* New stream got added to the trace. */
+       LTTNG_VIEWER_FLAG_NEW_STREAM    = (1 << 1),
+};
 
 enum lttng_viewer_command {
-       VIEWER_CONNECT          = 1,
-       VIEWER_LIST_SESSIONS    = 2,
-       VIEWER_ATTACH_SESSION   = 3,
-       VIEWER_GET_NEXT_INDEX   = 4,
-       VIEWER_GET_PACKET       = 5,
-       VIEWER_GET_METADATA     = 6,
-       VIEWER_GET_NEW_STREAMS  = 7,
+       LTTNG_VIEWER_CONNECT            = 1,
+       LTTNG_VIEWER_LIST_SESSIONS      = 2,
+       LTTNG_VIEWER_ATTACH_SESSION     = 3,
+       LTTNG_VIEWER_GET_NEXT_INDEX     = 4,
+       LTTNG_VIEWER_GET_PACKET         = 5,
+       LTTNG_VIEWER_GET_METADATA       = 6,
+       LTTNG_VIEWER_GET_NEW_STREAMS    = 7,
 };
 
 enum lttng_viewer_attach_return_code {
-       VIEWER_ATTACH_OK        = 1, /* If the attach command succeeded. */
-       VIEWER_ATTACH_ALREADY   = 2, /* If a viewer is already attached. */
-       VIEWER_ATTACH_UNK       = 3, /* If the session ID is unknown. */
-       VIEWER_ATTACH_NOT_LIVE  = 4, /* If the session is not live. */
-       VIEWER_ATTACH_SEEK_ERR  = 5, /* Seek error. */
+       LTTNG_VIEWER_ATTACH_OK          = 1, /* The attach command succeeded. */
+       LTTNG_VIEWER_ATTACH_ALREADY     = 2, /* A viewer is already attached. */
+       LTTNG_VIEWER_ATTACH_UNK         = 3, /* The session ID is unknown. */
+       LTTNG_VIEWER_ATTACH_NOT_LIVE    = 4, /* The session is not live. */
+       LTTNG_VIEWER_ATTACH_SEEK_ERR    = 5, /* Seek error. */
 };
 
 enum lttng_viewer_next_index_return_code {
-       VIEWER_INDEX_OK         = 1, /* Index is available. */
-       VIEWER_INDEX_RETRY      = 2, /* Index not yet available. */
-       VIEWER_INDEX_HUP        = 3, /* Index closed (trace destroyed). */
-       VIEWER_INDEX_ERR        = 4, /* Unknow error. */
-       VIEWER_INDEX_INACTIVE   = 5, /* Inactive stream beacon. */
-       VIEWER_INDEX_EOF        = 6, /* End of index file. */
+       LTTNG_VIEWER_INDEX_OK           = 1, /* Index is available. */
+       LTTNG_VIEWER_INDEX_RETRY        = 2, /* Index not yet available. */
+       LTTNG_VIEWER_INDEX_HUP          = 3, /* Index closed (trace destroyed). */
+       LTTNG_VIEWER_INDEX_ERR          = 4, /* Unknow error. */
+       LTTNG_VIEWER_INDEX_INACTIVE     = 5, /* Inactive stream beacon. */
+       LTTNG_VIEWER_INDEX_EOF          = 6, /* End of index file. */
 };
 
 enum lttng_viewer_get_packet_return_code {
-       VIEWER_GET_PACKET_OK            = 1,
-       VIEWER_GET_PACKET_RETRY         = 2,
-       VIEWER_GET_PACKET_ERR           = 3,
-       VIEWER_GET_PACKET_EOF           = 4,
+       LTTNG_VIEWER_GET_PACKET_OK      = 1,
+       LTTNG_VIEWER_GET_PACKET_RETRY   = 2,
+       LTTNG_VIEWER_GET_PACKET_ERR     = 3,
+       LTTNG_VIEWER_GET_PACKET_EOF     = 4,
 };
 
 enum lttng_viewer_get_metadata_return_code {
-       VIEWER_METADATA_OK      = 1,
-       VIEWER_NO_NEW_METADATA  = 2,
-       VIEWER_METADATA_ERR     = 3,
+       LTTNG_VIEWER_METADATA_OK        = 1,
+       LTTNG_VIEWER_NO_NEW_METADATA    = 2,
+       LTTNG_VIEWER_METADATA_ERR       = 3,
 };
 
 enum lttng_viewer_connection_type {
-       VIEWER_CLIENT_COMMAND           = 1,
-       VIEWER_CLIENT_NOTIFICATION      = 2,
+       LTTNG_VIEWER_CLIENT_COMMAND             = 1,
+       LTTNG_VIEWER_CLIENT_NOTIFICATION        = 2,
 };
 
 enum lttng_viewer_seek {
        /* Receive the trace packets from the beginning. */
-       VIEWER_SEEK_BEGINNING   = 1,
+       LTTNG_VIEWER_SEEK_BEGINNING     = 1,
        /* Receive the trace packets from now. */
-       VIEWER_SEEK_LAST        = 2,
+       LTTNG_VIEWER_SEEK_LAST          = 2,
 };
 
 enum lttng_viewer_new_streams_return_code {
-       VIEWER_NEW_STREAMS_OK           = 1, /* If new streams are being sent. */
-       VIEWER_NEW_STREAMS_NO_NEW       = 2, /* If no new streams are available. */
-       VIEWER_NEW_STREAMS_ERR          = 3, /* Error. */
+       LTTNG_VIEWER_NEW_STREAMS_OK           = 1, /* If new streams are being sent. */
+       LTTNG_VIEWER_NEW_STREAMS_NO_NEW       = 2, /* If no new streams are available. */
+       LTTNG_VIEWER_NEW_STREAMS_ERR          = 3, /* Error. */
 };
 
 struct lttng_viewer_session {
@@ -100,7 +102,7 @@ struct lttng_viewer_session {
        uint32_t live_timer;
        uint32_t clients;
        uint32_t streams;
-       char hostname[LTTNG_VIEWER_ABI_HOST_NAME_MAX];
+       char hostname[LTTNG_VIEWER_HOST_NAME_MAX];
        char session_name[LTTNG_VIEWER_NAME_MAX];
 } __attribute__((__packed__));
 
@@ -119,26 +121,26 @@ struct lttng_viewer_cmd {
 } __attribute__((__packed__));
 
 /*
- * CONNECT payload.
+ * LTTNG_VIEWER_CONNECT payload.
  */
 struct lttng_viewer_connect {
        /* session ID assigned by the relay for command connections */
        uint64_t viewer_session_id;
        uint32_t major;
        uint32_t minor;
-       uint32_t type; /* enum lttng_viewer_connection_type */
+       uint32_t type;          /* enum lttng_viewer_connection_type */
 } __attribute__((__packed__));
 
 /*
- * VIEWER_LIST_SESSIONS payload.
+ * LTTNG_VIEWER_LIST_SESSIONS payload.
  */
 struct lttng_viewer_list_sessions {
        uint32_t sessions_count;
-       char session_list[];            /* struct lttng_viewer_session */
+       char session_list[];    /* struct lttng_viewer_session */
 } __attribute__((__packed__));
 
 /*
- * VIEWER_ATTACH_SESSION payload.
+ * LTTNG_VIEWER_ATTACH_SESSION payload.
  */
 struct lttng_viewer_attach_session_request {
        uint64_t session_id;
@@ -155,7 +157,7 @@ struct lttng_viewer_attach_session_response {
 } __attribute__((__packed__));
 
 /*
- * VIEWER_GET_NEXT_INDEX payload.
+ * LTTNG_VIEWER_GET_NEXT_INDEX payload.
  */
 struct lttng_viewer_get_next_index {
        uint64_t stream_id;
@@ -169,13 +171,12 @@ struct lttng_viewer_index {
        uint64_t timestamp_end;
        uint64_t events_discarded;
        uint64_t stream_id;
-       /* enum lttng_viewer_next_index_return_code */
-       uint32_t status;
-       uint32_t flags; /* LTTNG_VIEWER_FLAG_* */
+       uint32_t status;        /* enum lttng_viewer_next_index_return_code */
+       uint32_t flags;         /* LTTNG_VIEWER_FLAG_* */
 } __attribute__ ((__packed__));
 
 /*
- * VIEWER_GET_PACKET payload.
+ * LTTNG_VIEWER_GET_PACKET payload.
  */
 struct lttng_viewer_get_packet {
        uint64_t stream_id;
@@ -184,15 +185,14 @@ struct lttng_viewer_get_packet {
 } __attribute__((__packed__));
 
 struct lttng_viewer_trace_packet {
-       /* enum lttng_viewer_get_packet_return_code */
-       uint32_t status;
+       uint32_t status;        /* enum lttng_viewer_get_packet_return_code */
        uint32_t len;
-       uint32_t flags; /* LTTNG_VIEWER_FLAG_* */
+       uint32_t flags;         /* LTTNG_VIEWER_FLAG_* */
        char data[];
 } __attribute__((__packed__));
 
 /*
- * VIEWER_GET_METADATA payload.
+ * LTTNG_VIEWER_GET_METADATA payload.
  */
 struct lttng_viewer_get_metadata {
        uint64_t stream_id;
@@ -200,13 +200,12 @@ struct lttng_viewer_get_metadata {
 
 struct lttng_viewer_metadata_packet {
        uint64_t len;
-       /* enum lttng_viewer_get_metadata_return_code */
-       uint32_t status;
+       uint32_t status;        /* enum lttng_viewer_get_metadata_return_code */
        char data[];
 } __attribute__((__packed__));
 
 /*
- * VIEWER_GET_NEW_STREAMS payload.
+ * LTTNG_VIEWER_GET_NEW_STREAMS payload.
  */
 struct lttng_viewer_new_streams_request {
        uint64_t session_id;
@@ -220,5 +219,4 @@ struct lttng_viewer_new_streams_response {
        char stream_list[];
 } __attribute__((__packed__));
 
-
-#endif /* LTTNG_VIEWER_ABI_H */
+#endif /* LTTNG_VIEWER_H */
index a16f331b8f795607389a1efa2c20263ac7609b6f..8ed84a1d118163d7a74c5f2e47b7c9a5a29b0ded 100644 (file)
@@ -64,10 +64,10 @@ struct relay_viewer_stream *viewer_stream_create(struct relay_stream *stream,
        vstream->tracefile_count_last = -1ULL;
 
        switch (seek_t) {
-       case VIEWER_SEEK_BEGINNING:
+       case LTTNG_VIEWER_SEEK_BEGINNING:
                vstream->tracefile_count_current = stream->oldest_tracefile_id;
                break;
-       case VIEWER_SEEK_LAST:
+       case LTTNG_VIEWER_SEEK_LAST:
                vstream->tracefile_count_current = stream->tracefile_count_current;
                break;
        default:
@@ -112,7 +112,7 @@ struct relay_viewer_stream *viewer_stream_create(struct relay_stream *stream,
                vstream->index_read_fd = read_fd;
        }
 
-       if (seek_t == VIEWER_SEEK_LAST && vstream->index_read_fd >= 0) {
+       if (seek_t == LTTNG_VIEWER_SEEK_LAST && vstream->index_read_fd >= 0) {
                off_t lseek_ret;
 
                lseek_ret = lseek(vstream->index_read_fd,
index e597890f4a0bcd01153bda8b6b8bd8b80b97623c..864f6702bebc7d3cabea7f20d8f7eea30e423465 100644 (file)
@@ -125,14 +125,14 @@ int establish_connection(void)
        struct lttng_viewer_connect connect;
        int ret;
 
-       cmd.cmd = htobe32(VIEWER_CONNECT);
+       cmd.cmd = htobe32(LTTNG_VIEWER_CONNECT);
        cmd.data_size = sizeof(connect);
        cmd.cmd_version = 0;
 
        memset(&connect, 0, sizeof(connect));
        connect.major = htobe32(VERSION_MAJOR);
        connect.minor = htobe32(VERSION_MINOR);
-       connect.type = htobe32(VIEWER_CLIENT_COMMAND);
+       connect.type = htobe32(LTTNG_VIEWER_CLIENT_COMMAND);
 
        do {
                ret = send(control_sock, &cmd, sizeof(cmd), 0);
@@ -173,7 +173,7 @@ int list_sessions(int *session_id)
        int i, ret;
        int first_session = 0;
 
-       cmd.cmd = htobe32(VIEWER_LIST_SESSIONS);
+       cmd.cmd = htobe32(LTTNG_VIEWER_LIST_SESSIONS);
        cmd.data_size = 0;
        cmd.cmd_version = 0;
 
@@ -227,13 +227,13 @@ int attach_session(int id)
                goto error;
        }
 
-       cmd.cmd = htobe32(VIEWER_ATTACH_SESSION);
+       cmd.cmd = htobe32(LTTNG_VIEWER_ATTACH_SESSION);
        cmd.data_size = sizeof(rq);
        cmd.cmd_version = 0;
 
        memset(&rq, 0, sizeof(rq));
        rq.session_id = htobe64(id);
-       rq.seek = htobe32(VIEWER_SEEK_BEGINNING);
+       rq.seek = htobe32(LTTNG_VIEWER_SEEK_BEGINNING);
 
        do {
                ret = send(control_sock, &cmd, sizeof(cmd), 0);
@@ -257,7 +257,7 @@ int attach_session(int id)
                fprintf(stderr, "Error receiving attach response\n");
                goto error;
        }
-       if (be32toh(rp.status) != VIEWER_ATTACH_OK) {
+       if (be32toh(rp.status) != LTTNG_VIEWER_ATTACH_OK) {
                ret = -1;
                goto end;
        }
@@ -312,7 +312,7 @@ int get_metadata(void)
        uint64_t len = 0;
        int metadata_stream_id = -1;
 
-       cmd.cmd = htobe32(VIEWER_GET_METADATA);
+       cmd.cmd = htobe32(LTTNG_VIEWER_GET_METADATA);
        cmd.data_size = sizeof(rq);
        cmd.cmd_version = 0;
 
@@ -353,13 +353,13 @@ int get_metadata(void)
                goto error;
        }
        switch (be32toh(rp.status)) {
-               case VIEWER_METADATA_OK:
+               case LTTNG_VIEWER_METADATA_OK:
                        break;
-               case VIEWER_NO_NEW_METADATA:
+               case LTTNG_VIEWER_NO_NEW_METADATA:
                        fprintf(stderr, "NO NEW\n");
                        ret = -1;
                        goto end;
-               case VIEWER_METADATA_ERR:
+               case LTTNG_VIEWER_METADATA_ERR:
                        fprintf(stderr, "ERR\n");
                        ret = -1;
                        goto end;
@@ -403,7 +403,7 @@ int get_next_index(void)
        int ret;
        int id;
 
-       cmd.cmd = htobe32(VIEWER_GET_NEXT_INDEX);
+       cmd.cmd = htobe32(LTTNG_VIEWER_GET_NEXT_INDEX);
        cmd.data_size = sizeof(rq);
        cmd.cmd_version = 0;
 
@@ -439,20 +439,20 @@ retry:
                rp.flags = be32toh(rp.flags);
 
                switch (be32toh(rp.status)) {
-                       case VIEWER_INDEX_INACTIVE:
+                       case LTTNG_VIEWER_INDEX_INACTIVE:
                                fprintf(stderr, "(INACTIVE)\n");
                                break;
-                       case VIEWER_INDEX_OK:
+                       case LTTNG_VIEWER_INDEX_OK:
                                break;
-                       case VIEWER_INDEX_RETRY:
+                       case LTTNG_VIEWER_INDEX_RETRY:
                                sleep(1);
                                goto retry;
-                       case VIEWER_INDEX_HUP:
+                       case LTTNG_VIEWER_INDEX_HUP:
                                fprintf(stderr, "(HUP)\n");
                                session->streams[id].id = -1ULL;
                                session->streams[id].fd = -1;
                                break;
-                       case VIEWER_INDEX_ERR:
+                       case LTTNG_VIEWER_INDEX_ERR:
                                fprintf(stderr, "(ERR)\n");
                                ret = -1;
                                goto error;
@@ -482,7 +482,7 @@ int get_data_packet(int id, uint64_t offset,
        struct lttng_viewer_trace_packet rp;
        int ret;
 
-       cmd.cmd = htobe32(VIEWER_GET_PACKET);
+       cmd.cmd = htobe32(LTTNG_VIEWER_GET_PACKET);
        cmd.data_size = sizeof(rq);
        cmd.cmd_version = 0;
 
@@ -515,13 +515,13 @@ int get_data_packet(int id, uint64_t offset,
        rp.flags = be32toh(rp.flags);
 
        switch (be32toh(rp.status)) {
-       case VIEWER_GET_PACKET_OK:
+       case LTTNG_VIEWER_GET_PACKET_OK:
                break;
-       case VIEWER_GET_PACKET_RETRY:
+       case LTTNG_VIEWER_GET_PACKET_RETRY:
                fprintf(stderr, "RETRY\n");
                ret = -1;
                goto end;
-       case VIEWER_GET_PACKET_ERR:
+       case LTTNG_VIEWER_GET_PACKET_ERR:
                if (rp.flags & LTTNG_VIEWER_FLAG_NEW_METADATA) {
                        fprintf(stderr, "NEW_METADATA\n");
                        ret = 0;
This page took 0.058865 seconds and 4 git commands to generate.