sessiond: Add msgpack-c 3.3.0 to the tree
[lttng-tools.git] / src / vendor / msgpack / object.h
CommitLineData
116a02e3
JG
1/*
2 * MessagePack for C dynamic typing routine
3 *
4 * Copyright (C) 2008-2009 FURUHASHI Sadayuki
5 *
6 * Distributed under the Boost Software License, Version 1.0.
7 * (See accompanying file LICENSE_1_0.txt or copy at
8 * http://www.boost.org/LICENSE_1_0.txt)
9 */
10#ifndef MSGPACK_OBJECT_H
11#define MSGPACK_OBJECT_H
12
13#include "zone.h"
14#include <stdio.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20
21/**
22 * @defgroup msgpack_object Dynamically typed object
23 * @ingroup msgpack
24 * @{
25 */
26
27typedef enum {
28 MSGPACK_OBJECT_NIL = 0x00,
29 MSGPACK_OBJECT_BOOLEAN = 0x01,
30 MSGPACK_OBJECT_POSITIVE_INTEGER = 0x02,
31 MSGPACK_OBJECT_NEGATIVE_INTEGER = 0x03,
32 MSGPACK_OBJECT_FLOAT32 = 0x0a,
33 MSGPACK_OBJECT_FLOAT64 = 0x04,
34 MSGPACK_OBJECT_FLOAT = 0x04,
35#if defined(MSGPACK_USE_LEGACY_NAME_AS_FLOAT)
36 MSGPACK_OBJECT_DOUBLE = MSGPACK_OBJECT_FLOAT, /* obsolete */
37#endif /* MSGPACK_USE_LEGACY_NAME_AS_FLOAT */
38 MSGPACK_OBJECT_STR = 0x05,
39 MSGPACK_OBJECT_ARRAY = 0x06,
40 MSGPACK_OBJECT_MAP = 0x07,
41 MSGPACK_OBJECT_BIN = 0x08,
42 MSGPACK_OBJECT_EXT = 0x09
43} msgpack_object_type;
44
45
46struct msgpack_object;
47struct msgpack_object_kv;
48
49typedef struct {
50 uint32_t size;
51 struct msgpack_object* ptr;
52} msgpack_object_array;
53
54typedef struct {
55 uint32_t size;
56 struct msgpack_object_kv* ptr;
57} msgpack_object_map;
58
59typedef struct {
60 uint32_t size;
61 const char* ptr;
62} msgpack_object_str;
63
64typedef struct {
65 uint32_t size;
66 const char* ptr;
67} msgpack_object_bin;
68
69typedef struct {
70 int8_t type;
71 uint32_t size;
72 const char* ptr;
73} msgpack_object_ext;
74
75typedef union {
76 bool boolean;
77 uint64_t u64;
78 int64_t i64;
79#if defined(MSGPACK_USE_LEGACY_NAME_AS_FLOAT)
80 double dec; /* obsolete*/
81#endif /* MSGPACK_USE_LEGACY_NAME_AS_FLOAT */
82 double f64;
83 msgpack_object_array array;
84 msgpack_object_map map;
85 msgpack_object_str str;
86 msgpack_object_bin bin;
87 msgpack_object_ext ext;
88} msgpack_object_union;
89
90typedef struct msgpack_object {
91 msgpack_object_type type;
92 msgpack_object_union via;
93} msgpack_object;
94
95typedef struct msgpack_object_kv {
96 msgpack_object key;
97 msgpack_object val;
98} msgpack_object_kv;
99
100#if !defined(_KERNEL_MODE)
101MSGPACK_DLLEXPORT
102void msgpack_object_print(FILE* out, msgpack_object o);
103#endif
104
105MSGPACK_DLLEXPORT
106int msgpack_object_print_buffer(char *buffer, size_t buffer_size, msgpack_object o);
107
108MSGPACK_DLLEXPORT
109bool msgpack_object_equal(const msgpack_object x, const msgpack_object y);
110
111/** @} */
112
113
114#ifdef __cplusplus
115}
116#endif
117
118#endif /* msgpack/object.h */
This page took 0.026324 seconds and 4 git commands to generate.