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/payload.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. */
47 /* Number of FDs sent. */
52 struct lttng_notification_channel_command_handshake
{
57 struct lttng_notification_channel_command_reply
{
58 /* enum lttng_notification_channel_status */
62 struct pending_notification
{
63 /* NULL means "notification dropped". */
64 struct lttng_notification
*notification
;
65 struct cds_list_head node
;
69 * The notification channel protocol is bidirectional and accommodates
70 * synchronous and asynchronous communication modes:
72 * - Synchronous: commands emitted by the client to which a reply is expected
73 * (e.g. subscribing/unsubscribing to conditions),
74 * - Asynchronous: notifications which are sent by the lttng_endpoint to the
75 * client as one of the subscribed condition has occurred.
77 * The nature of this hybrid communication mode means that asynchronous messages
78 * (e.g. notifications) may be interleaved between synchronous messages (e.g. a
79 * command and its reply).
81 * Notifications that are received between a command and its reply and enqueued
82 * in the pending_notifications list.
84 struct lttng_notification_channel
{
88 /* Count of pending notifications. */
90 /* List of struct pending_notification. */
91 struct cds_list_head list
;
92 } pending_notifications
;
93 struct lttng_payload reception_payload
;
94 /* Sessiond notification protocol version. */
101 #endif /* LTTNG_NOTIFICATION_CHANNEL_INTERNAL_H */