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_BINARY_PROTOCOL_H 21 #define _THRIFT_BINARY_PROTOCOL_H 22 23 #include <glib-object.h> 24 25 #include <thrift/c_glib/protocol/thrift_protocol.h> 26 #include <thrift/c_glib/transport/thrift_transport.h> 27 28 G_BEGIN_DECLS 29 30 /*! \file thrift_binary_protocol.h 31 * \brief Binary protocol implementation of a Thrift protocol. Implements the 32 * ThriftProtocol interface. 33 */ 34 35 /* type macros */ 36 #define THRIFT_TYPE_BINARY_PROTOCOL (thrift_binary_protocol_get_type ()) 37 #define THRIFT_BINARY_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_BINARY_PROTOCOL, ThriftBinaryProtocol)) 38 #define THRIFT_IS_BINARY_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_BINARY_PROTOCOL)) 39 #define THRIFT_BINARY_PROTOCOL_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_BINARY_PROTOCOL, ThriftBinaryProtocolClass)) 40 #define THRIFT_IS_BINARY_PROTOCOL_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_BINARY_PROTOCOL)) 41 #define THRIFT_BINARY_PROTOCOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_BINARY_PROTOCOL, ThriftBinaryProtocolClass)) 42 43 /* version numbers */ 44 #define THRIFT_BINARY_PROTOCOL_VERSION_1 0x80010000 45 #define THRIFT_BINARY_PROTOCOL_VERSION_MASK 0xffff0000 46 47 typedef struct _ThriftBinaryProtocol ThriftBinaryProtocol; 48 49 /*! 50 * Thrift Binary Protocol instance. 51 */ 52 struct _ThriftBinaryProtocol 53 { 54 ThriftProtocol parent; 55 }; 56 57 typedef struct _ThriftBinaryProtocolClass ThriftBinaryProtocolClass; 58 59 /*! 60 * Thrift Binary Protocol class. 61 */ 62 struct _ThriftBinaryProtocolClass 63 { 64 ThriftProtocolClass parent; 65 }; 66 67 /* used by THRIFT_TYPE_BINARY_PROTOCOL */ 68 GType thrift_binary_protocol_get_type (void); 69 70 gint 71 thrift_binary_protocol_get_min_serialized_size(ThriftProtocol *protocol, ThriftType type, GError **error); 72 73 G_END_DECLS 74 75 #endif /* _THRIFT_BINARY_PROTOCOL_H */ 76