]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/thrift/lib/c_glib/src/thrift/c_glib/protocol/thrift_compact_protocol.h
buildsys: switch source download to quincy
[ceph.git] / ceph / src / jaegertracing / thrift / lib / c_glib / src / thrift / c_glib / protocol / thrift_compact_protocol.h
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20 #ifndef _THRIFT_COMPACT_PROTOCOL_H
21 #define _THRIFT_COMPACT_PROTOCOL_H
22
23 #include <glib.h>
24 #include <glib-object.h>
25
26 #include <thrift/c_glib/protocol/thrift_protocol.h>
27 #include <thrift/c_glib/transport/thrift_transport.h>
28
29 G_BEGIN_DECLS
30
31 /*! \file thrift_compact_protocol.h
32 * \brief Compact protocol implementation of a Thrift protocol. Implements the
33 * ThriftProtocol interface.
34 */
35
36 /* type macros */
37 #define THRIFT_TYPE_COMPACT_PROTOCOL (thrift_compact_protocol_get_type ())
38 #define THRIFT_COMPACT_PROTOCOL(obj) \
39 (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_COMPACT_PROTOCOL, \
40 ThriftCompactProtocol))
41 #define THRIFT_IS_COMPACT_PROTOCOL(obj) \
42 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_COMPACT_PROTOCOL))
43 #define THRIFT_COMPACT_PROTOCOL_CLASS(c) \
44 (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_COMPACT_PROTOCOL, \
45 ThriftCompactProtocolClass))
46 #define THRIFT_IS_COMPACT_PROTOCOL_CLASS(c) \
47 (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_COMPACT_PROTOCOL))
48 #define THRIFT_COMPACT_PROTOCOL_GET_CLASS(obj) \
49 (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_COMPACT_PROTOCOL, \
50 ThriftCompactProtocolClass))
51
52
53 typedef struct _ThriftCompactProtocol ThriftCompactProtocol;
54
55 /*!
56 * Thrift Compact Protocol instance.
57 */
58 struct _ThriftCompactProtocol
59 {
60 ThriftProtocol parent;
61
62 /* protected */
63 gint32 string_limit;
64 gint32 container_limit;
65
66 /* private */
67
68 /**
69 * (Writing) If we encounter a boolean field begin, save the TField here
70 * so it can have the value incorporated.
71 */
72 const gchar* _bool_field_name;
73 ThriftType _bool_field_type;
74 gint16 _bool_field_id;
75
76 /**
77 * (Reading) If we read a field header, and it's a boolean field, save
78 * the boolean value here so that read_bool can use it.
79 */
80 gboolean _has_bool_value;
81 gboolean _bool_value;
82
83 /**
84 * Used to keep track of the last field for the current and previous structs,
85 * so we can do the delta stuff.
86 */
87
88 GQueue _last_field;
89 gint16 _last_field_id;
90 };
91
92 typedef struct _ThriftCompactProtocolClass ThriftCompactProtocolClass;
93
94 /*!
95 * Thrift Compact Protocol class.
96 */
97 struct _ThriftCompactProtocolClass
98 {
99 ThriftProtocolClass parent;
100 };
101
102 /* used by THRIFT_TYPE_COMPACT_PROTOCOL */
103 GType thrift_compact_protocol_get_type (void);
104
105 G_END_DECLS
106
107 #endif /* _THRIFT_COMPACT_PROTOCOL_H */