Move all sources to 'src/'
[lttng-ust.git] / src / libmsgpack / msgpack.h
1 /*
2 * SPDX-License-Identifier: LGPL-2.1-only
3 *
4 * Copyright (C) 2020 Francis Deslauriers <francis.deslauriers@efficios.com>
5 */
6
7 #ifndef _LTTNG_UST_MSGPACK_H
8 #define _LTTNG_UST_MSGPACK_H
9
10 #include <stddef.h>
11 #ifdef __KERNEL__
12 #include <linux/types.h>
13 #else /* __KERNEL__ */
14 #include <stdint.h>
15 #endif /* __KERNEL__ */
16
17 struct lttng_msgpack_writer {
18 uint8_t *buffer;
19 uint8_t *write_pos;
20 const uint8_t *end_write_pos;
21 uint8_t array_nesting;
22 uint8_t map_nesting;
23 };
24
25 void lttng_msgpack_writer_init(
26 struct lttng_msgpack_writer *writer,
27 uint8_t *buffer, size_t size)
28 __attribute__((visibility("hidden")));
29
30 void lttng_msgpack_writer_fini(struct lttng_msgpack_writer *writer)
31 __attribute__((visibility("hidden")));
32
33 int lttng_msgpack_write_nil(struct lttng_msgpack_writer *writer)
34 __attribute__((visibility("hidden")));
35
36 int lttng_msgpack_write_true(struct lttng_msgpack_writer *writer)
37 __attribute__((visibility("hidden")));
38
39 int lttng_msgpack_write_false(struct lttng_msgpack_writer *writer)
40 __attribute__((visibility("hidden")));
41
42 int lttng_msgpack_write_unsigned_integer(
43 struct lttng_msgpack_writer *writer, uint64_t value)
44 __attribute__((visibility("hidden")));
45
46 int lttng_msgpack_write_signed_integer(
47 struct lttng_msgpack_writer *writer, int64_t value)
48 __attribute__((visibility("hidden")));
49
50 int lttng_msgpack_write_double(struct lttng_msgpack_writer *writer, double value)
51 __attribute__((visibility("hidden")));
52
53 int lttng_msgpack_write_str(struct lttng_msgpack_writer *writer,
54 const char *value)
55 __attribute__((visibility("hidden")));
56
57 int lttng_msgpack_begin_map(struct lttng_msgpack_writer *writer, size_t count)
58 __attribute__((visibility("hidden")));
59
60 int lttng_msgpack_end_map(struct lttng_msgpack_writer *writer)
61 __attribute__((visibility("hidden")));
62
63 int lttng_msgpack_begin_array(
64 struct lttng_msgpack_writer *writer, size_t count)
65 __attribute__((visibility("hidden")));
66
67 int lttng_msgpack_end_array(struct lttng_msgpack_writer *writer)
68 __attribute__((visibility("hidden")));
69
70 #endif /* _LTTNG_UST_MSGPACK_H */
This page took 0.030072 seconds and 4 git commands to generate.