2 * Copyright (C) 2017 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
8 #ifndef LTTNG_NOTIFICATION_CHANNEL_INTERNAL_H
9 #define LTTNG_NOTIFICATION_CHANNEL_INTERNAL_H
11 #include <lttng/notification/channel.h>
12 #include <common/macros.h>
13 #include <common/dynamic-buffer.h>
17 #include <urcu/list.h>
20 * Protocol version change log:
22 * - Initial implementation of the notification channel protocol,
23 * - Supported conditions are LOW/HIGH buffer usage conditions,
25 * - New condition type "LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE" added,
26 * - New condition type "LTTNG_CONDITION_TYPE_SESSION_ROTATION_ONGOING" added,
27 * - New condition type "LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED" added,
29 #define LTTNG_NOTIFICATION_CHANNEL_VERSION_MAJOR 1
30 #define LTTNG_NOTIFICATION_CHANNEL_VERSION_MINOR 1
32 enum lttng_notification_channel_message_type
{
33 LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_UNKNOWN
= -1,
34 LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_HANDSHAKE
= 0,
35 LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_SUBSCRIBE
= 1,
36 LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_UNSUBSCRIBE
= 2,
37 LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_COMMAND_REPLY
= 3,
38 LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_NOTIFICATION
= 4,
39 LTTNG_NOTIFICATION_CHANNEL_MESSAGE_TYPE_NOTIFICATION_DROPPED
= 5,
42 struct lttng_notification_channel_message
{
43 /* enum lttng_notification_channel_message_type */
45 /* Size of the payload following this field. */
50 struct lttng_notification_channel_command_handshake
{
55 struct lttng_notification_channel_command_reply
{
56 /* enum lttng_notification_channel_status */
60 struct pending_notification
{
61 /* NULL means "notification dropped". */
62 struct lttng_notification
*notification
;
63 struct cds_list_head node
;
67 * The notification channel protocol is bidirectional and accommodates
68 * synchronous and asynchronous communication modes:
70 * - Synchronous: commands emitted by the client to which a reply is expected
71 * (e.g. subscribing/unsubscribing to conditions),
72 * - Asynchronous: notifications which are sent by the lttng_endpoint to the
73 * client as one of the subscribed condition has occurred.
75 * The nature of this hybrid communication mode means that asynchronous messages
76 * (e.g. notifications) may be interleaved between synchronous messages (e.g. a
77 * command and its reply).
79 * Notifications that are received between a command and its reply and enqueued
80 * in the pending_notifications list.
82 struct lttng_notification_channel
{
86 /* Count of pending notifications. */
88 /* List of struct pending_notification. */
89 struct cds_list_head list
;
90 } pending_notifications
;
91 struct lttng_dynamic_buffer reception_buffer
;
92 /* Sessiond notification protocol version. */
99 #endif /* LTTNG_NOTIFICATION_CHANNEL_INTERNAL_H */