2 * Copyright (C) 2020 Jérémie Galarneau <jeremie.galarneau@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
8 #ifndef LTTNG_PAYLOAD_H
9 #define LTTNG_PAYLOAD_H
11 #include <common/dynamic-buffer.h>
12 #include <common/dynamic-array.h>
15 * An lttng_payload encompasses the 'data' (bytes) and any passed file
16 * descriptors as part of a message between liblttng-ctl and the session
19 struct lttng_payload
{
20 struct lttng_dynamic_buffer buffer
;
22 struct lttng_dynamic_array _fds
;
26 * Initialize a payload. This performs no allocation and is meant
30 void lttng_payload_init(struct lttng_payload
*payload
);
32 /* Release any memory used by the payload. */
34 void lttng_payload_reset(struct lttng_payload
*payload
);
37 * Add an fd to the payload.
38 * No ownership of the file descriptor is assumed by the payload.
40 * @payload Payload instance
41 * @fd File descriptor to add to the payload
43 * Returns 0 on success, -1 on allocation error.
46 int lttng_payload_push_fd(struct lttng_payload
*payload
, int fd
);
48 #endif /* LTTNG_PAYLOAD_H */