David Reiss | ea2cba8 | 2009-03-30 21:35:00 +0000 | [diff] [blame] | 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 | */ |
Mark Slee | 9f0c651 | 2007-02-28 23:58:26 +0000 | [diff] [blame] | 19 | |
Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 20 | #ifndef _THRIFT_PROTOCOL_TBINARYPROTOCOL_H_ |
| 21 | #define _THRIFT_PROTOCOL_TBINARYPROTOCOL_H_ 1 |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 22 | |
Roger Meier | 4285ba2 | 2013-06-10 21:17:23 +0200 | [diff] [blame] | 23 | #include <thrift/protocol/TProtocol.h> |
| 24 | #include <thrift/protocol/TVirtualProtocol.h> |
Marc Slemko | 1669885 | 2006-08-04 03:16:10 +0000 | [diff] [blame] | 25 | |
| 26 | #include <boost/shared_ptr.hpp> |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 27 | |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 28 | namespace apache { |
| 29 | namespace thrift { |
| 30 | namespace protocol { |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 31 | |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 32 | /** |
| 33 | * The default binary protocol for thrift. Writes all data in a very basic |
| 34 | * binary format, essentially just spitting out the raw bytes. |
| 35 | * |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 36 | */ |
Ben Craig | 384f976 | 2015-07-08 20:33:03 -0500 | [diff] [blame] | 37 | template <class Transport_, class ByteOrder_ = TNetworkBigEndian> |
| 38 | class TBinaryProtocolT : public TVirtualProtocol<TBinaryProtocolT<Transport_, ByteOrder_> > { |
Dave Watson | 792db4e | 2015-01-16 11:22:01 -0800 | [diff] [blame] | 39 | public: |
Roger Meier | 406fc74 | 2011-12-08 11:32:21 +0000 | [diff] [blame] | 40 | static const int32_t VERSION_MASK = ((int32_t)0xffff0000); |
| 41 | static const int32_t VERSION_1 = ((int32_t)0x80010000); |
Randy Abernethy | 8dbe5f6 | 2015-08-01 22:57:02 -0700 | [diff] [blame] | 42 | // VERSION_2 (0x80020000) was taken by TDenseProtocol (which has since been removed) |
Mark Slee | 808454e | 2007-06-20 21:51:57 +0000 | [diff] [blame] | 43 | |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 44 | TBinaryProtocolT(boost::shared_ptr<Transport_> trans) |
Ben Craig | 384f976 | 2015-07-08 20:33:03 -0500 | [diff] [blame] | 45 | : TVirtualProtocol<TBinaryProtocolT<Transport_, ByteOrder_> >(trans), |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 46 | trans_(trans.get()), |
| 47 | string_limit_(0), |
| 48 | container_limit_(0), |
| 49 | strict_read_(false), |
Konrad Grochowski | 37b7a0a | 2014-12-04 22:35:39 +0100 | [diff] [blame] | 50 | strict_write_(true) {} |
Mark Slee | 4af6ed7 | 2006-10-25 19:02:49 +0000 | [diff] [blame] | 51 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 52 | TBinaryProtocolT(boost::shared_ptr<Transport_> trans, |
| 53 | int32_t string_limit, |
| 54 | int32_t container_limit, |
| 55 | bool strict_read, |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 56 | bool strict_write) |
Ben Craig | 384f976 | 2015-07-08 20:33:03 -0500 | [diff] [blame] | 57 | : TVirtualProtocol<TBinaryProtocolT<Transport_, ByteOrder_> >(trans), |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 58 | trans_(trans.get()), |
| 59 | string_limit_(string_limit), |
| 60 | container_limit_(container_limit), |
| 61 | strict_read_(strict_read), |
Konrad Grochowski | 37b7a0a | 2014-12-04 22:35:39 +0100 | [diff] [blame] | 62 | strict_write_(strict_write) {} |
Mark Slee | f983108 | 2007-02-20 20:59:21 +0000 | [diff] [blame] | 63 | |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 64 | void setStringSizeLimit(int32_t string_limit) { string_limit_ = string_limit; } |
Mark Slee | f983108 | 2007-02-20 20:59:21 +0000 | [diff] [blame] | 65 | |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 66 | void setContainerSizeLimit(int32_t container_limit) { container_limit_ = container_limit; } |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 67 | |
Mark Slee | 808454e | 2007-06-20 21:51:57 +0000 | [diff] [blame] | 68 | void setStrict(bool strict_read, bool strict_write) { |
| 69 | strict_read_ = strict_read; |
| 70 | strict_write_ = strict_write; |
| 71 | } |
| 72 | |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 73 | /** |
| 74 | * Writing functions. |
| 75 | */ |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 76 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 77 | /*ol*/ uint32_t writeMessageBegin(const std::string& name, |
| 78 | const TMessageType messageType, |
| 79 | const int32_t seqid); |
Marc Slemko | 1669885 | 2006-08-04 03:16:10 +0000 | [diff] [blame] | 80 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 81 | /*ol*/ uint32_t writeMessageEnd(); |
Marc Slemko | 1669885 | 2006-08-04 03:16:10 +0000 | [diff] [blame] | 82 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 83 | inline uint32_t writeStructBegin(const char* name); |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 84 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 85 | inline uint32_t writeStructEnd(); |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 86 | |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 87 | inline uint32_t writeFieldBegin(const char* name, const TType fieldType, const int16_t fieldId); |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 88 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 89 | inline uint32_t writeFieldEnd(); |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 90 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 91 | inline uint32_t writeFieldStop(); |
David Reiss | 0c90f6f | 2008-02-06 22:18:40 +0000 | [diff] [blame] | 92 | |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 93 | inline uint32_t writeMapBegin(const TType keyType, const TType valType, const uint32_t size); |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 94 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 95 | inline uint32_t writeMapEnd(); |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 96 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 97 | inline uint32_t writeListBegin(const TType elemType, const uint32_t size); |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 98 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 99 | inline uint32_t writeListEnd(); |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 100 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 101 | inline uint32_t writeSetBegin(const TType elemType, const uint32_t size); |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 102 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 103 | inline uint32_t writeSetEnd(); |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 104 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 105 | inline uint32_t writeBool(const bool value); |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 106 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 107 | inline uint32_t writeByte(const int8_t byte); |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 108 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 109 | inline uint32_t writeI16(const int16_t i16); |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 110 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 111 | inline uint32_t writeI32(const int32_t i32); |
Marc Slemko | 0b4ffa9 | 2006-08-11 02:49:29 +0000 | [diff] [blame] | 112 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 113 | inline uint32_t writeI64(const int64_t i64); |
Marc Slemko | 0b4ffa9 | 2006-08-11 02:49:29 +0000 | [diff] [blame] | 114 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 115 | inline uint32_t writeDouble(const double dub); |
Mark Slee | c98d050 | 2006-09-06 02:42:25 +0000 | [diff] [blame] | 116 | |
Jake Farrell | f42ae01 | 2012-06-22 03:22:53 +0000 | [diff] [blame] | 117 | template <typename StrType> |
| 118 | inline uint32_t writeString(const StrType& str); |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 119 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 120 | inline uint32_t writeBinary(const std::string& str); |
David Reiss | c005b1b | 2008-02-15 01:38:18 +0000 | [diff] [blame] | 121 | |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 122 | /** |
| 123 | * Reading functions |
| 124 | */ |
| 125 | |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 126 | /*ol*/ uint32_t readMessageBegin(std::string& name, TMessageType& messageType, int32_t& seqid); |
Marc Slemko | 1669885 | 2006-08-04 03:16:10 +0000 | [diff] [blame] | 127 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 128 | /*ol*/ uint32_t readMessageEnd(); |
Marc Slemko | 1669885 | 2006-08-04 03:16:10 +0000 | [diff] [blame] | 129 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 130 | inline uint32_t readStructBegin(std::string& name); |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 131 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 132 | inline uint32_t readStructEnd(); |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 133 | |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 134 | inline uint32_t readFieldBegin(std::string& name, TType& fieldType, int16_t& fieldId); |
David Reiss | 0c90f6f | 2008-02-06 22:18:40 +0000 | [diff] [blame] | 135 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 136 | inline uint32_t readFieldEnd(); |
David Reiss | 0c90f6f | 2008-02-06 22:18:40 +0000 | [diff] [blame] | 137 | |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 138 | inline uint32_t readMapBegin(TType& keyType, TType& valType, uint32_t& size); |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 139 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 140 | inline uint32_t readMapEnd(); |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 141 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 142 | inline uint32_t readListBegin(TType& elemType, uint32_t& size); |
David Reiss | 0c90f6f | 2008-02-06 22:18:40 +0000 | [diff] [blame] | 143 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 144 | inline uint32_t readListEnd(); |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 145 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 146 | inline uint32_t readSetBegin(TType& elemType, uint32_t& size); |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 147 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 148 | inline uint32_t readSetEnd(); |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 149 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 150 | inline uint32_t readBool(bool& value); |
David Reiss | 8dfc732 | 2010-10-06 17:09:58 +0000 | [diff] [blame] | 151 | // Provide the default readBool() implementation for std::vector<bool> |
Ben Craig | 384f976 | 2015-07-08 20:33:03 -0500 | [diff] [blame] | 152 | using TVirtualProtocol<TBinaryProtocolT<Transport_, ByteOrder_> >::readBool; |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 153 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 154 | inline uint32_t readByte(int8_t& byte); |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 155 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 156 | inline uint32_t readI16(int16_t& i16); |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 157 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 158 | inline uint32_t readI32(int32_t& i32); |
Mark Slee | 8d7e1f6 | 2006-06-07 06:48:56 +0000 | [diff] [blame] | 159 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 160 | inline uint32_t readI64(int64_t& i64); |
Marc Slemko | 0b4ffa9 | 2006-08-11 02:49:29 +0000 | [diff] [blame] | 161 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 162 | inline uint32_t readDouble(double& dub); |
Mark Slee | c98d050 | 2006-09-06 02:42:25 +0000 | [diff] [blame] | 163 | |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 164 | template <typename StrType> |
Jake Farrell | f42ae01 | 2012-06-22 03:22:53 +0000 | [diff] [blame] | 165 | inline uint32_t readString(StrType& str); |
Mark Slee | f983108 | 2007-02-20 20:59:21 +0000 | [diff] [blame] | 166 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 167 | inline uint32_t readBinary(std::string& str); |
David Reiss | c005b1b | 2008-02-15 01:38:18 +0000 | [diff] [blame] | 168 | |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 169 | protected: |
| 170 | template <typename StrType> |
Jake Farrell | f42ae01 | 2012-06-22 03:22:53 +0000 | [diff] [blame] | 171 | uint32_t readStringBody(StrType& str, int32_t sz); |
Mark Slee | 808454e | 2007-06-20 21:51:57 +0000 | [diff] [blame] | 172 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 173 | Transport_* trans_; |
| 174 | |
Mark Slee | f983108 | 2007-02-20 20:59:21 +0000 | [diff] [blame] | 175 | int32_t string_limit_; |
| 176 | int32_t container_limit_; |
| 177 | |
Mark Slee | 808454e | 2007-06-20 21:51:57 +0000 | [diff] [blame] | 178 | // Enforce presence of version identifier |
| 179 | bool strict_read_; |
| 180 | bool strict_write_; |
Mark Slee | 4af6ed7 | 2006-10-25 19:02:49 +0000 | [diff] [blame] | 181 | }; |
| 182 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 183 | typedef TBinaryProtocolT<TTransport> TBinaryProtocol; |
Ben Craig | 384f976 | 2015-07-08 20:33:03 -0500 | [diff] [blame] | 184 | typedef TBinaryProtocolT<TTransport, TNetworkLittleEndian> TLEBinaryProtocol; |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 185 | |
Mark Slee | 4af6ed7 | 2006-10-25 19:02:49 +0000 | [diff] [blame] | 186 | /** |
| 187 | * Constructs binary protocol handlers |
| 188 | */ |
Ben Craig | 384f976 | 2015-07-08 20:33:03 -0500 | [diff] [blame] | 189 | template <class Transport_, class ByteOrder_ = TNetworkBigEndian> |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 190 | class TBinaryProtocolFactoryT : public TProtocolFactory { |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 191 | public: |
| 192 | TBinaryProtocolFactoryT() |
| 193 | : string_limit_(0), container_limit_(0), strict_read_(false), strict_write_(true) {} |
Mark Slee | f983108 | 2007-02-20 20:59:21 +0000 | [diff] [blame] | 194 | |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 195 | TBinaryProtocolFactoryT(int32_t string_limit, |
| 196 | int32_t container_limit, |
| 197 | bool strict_read, |
| 198 | bool strict_write) |
| 199 | : string_limit_(string_limit), |
| 200 | container_limit_(container_limit), |
| 201 | strict_read_(strict_read), |
| 202 | strict_write_(strict_write) {} |
Mark Slee | 4af6ed7 | 2006-10-25 19:02:49 +0000 | [diff] [blame] | 203 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 204 | virtual ~TBinaryProtocolFactoryT() {} |
Mark Slee | 4af6ed7 | 2006-10-25 19:02:49 +0000 | [diff] [blame] | 205 | |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 206 | void setStringSizeLimit(int32_t string_limit) { string_limit_ = string_limit; } |
Mark Slee | f983108 | 2007-02-20 20:59:21 +0000 | [diff] [blame] | 207 | |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 208 | void setContainerSizeLimit(int32_t container_limit) { container_limit_ = container_limit; } |
Mark Slee | f983108 | 2007-02-20 20:59:21 +0000 | [diff] [blame] | 209 | |
Mark Slee | 808454e | 2007-06-20 21:51:57 +0000 | [diff] [blame] | 210 | void setStrict(bool strict_read, bool strict_write) { |
| 211 | strict_read_ = strict_read; |
| 212 | strict_write_ = strict_write; |
| 213 | } |
| 214 | |
Mark Slee | f983108 | 2007-02-20 20:59:21 +0000 | [diff] [blame] | 215 | boost::shared_ptr<TProtocol> getProtocol(boost::shared_ptr<TTransport> trans) { |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 216 | boost::shared_ptr<Transport_> specific_trans = boost::dynamic_pointer_cast<Transport_>(trans); |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 217 | TProtocol* prot; |
| 218 | if (specific_trans) { |
Konrad Grochowski | 7f4be5f | 2015-11-05 20:23:11 +0100 | [diff] [blame] | 219 | prot = new TBinaryProtocolT<Transport_, ByteOrder_>(specific_trans, |
| 220 | string_limit_, |
| 221 | container_limit_, |
| 222 | strict_read_, |
| 223 | strict_write_); |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 224 | } else { |
Konrad Grochowski | 7f4be5f | 2015-11-05 20:23:11 +0100 | [diff] [blame] | 225 | prot = new TBinaryProtocolT<TTransport, ByteOrder_>(trans, |
| 226 | string_limit_, |
| 227 | container_limit_, |
| 228 | strict_read_, |
| 229 | strict_write_); |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 230 | } |
| 231 | |
| 232 | return boost::shared_ptr<TProtocol>(prot); |
Mark Slee | f983108 | 2007-02-20 20:59:21 +0000 | [diff] [blame] | 233 | } |
| 234 | |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 235 | private: |
Mark Slee | f983108 | 2007-02-20 20:59:21 +0000 | [diff] [blame] | 236 | int32_t string_limit_; |
| 237 | int32_t container_limit_; |
Mark Slee | 808454e | 2007-06-20 21:51:57 +0000 | [diff] [blame] | 238 | bool strict_read_; |
| 239 | bool strict_write_; |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 240 | }; |
| 241 | |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 242 | typedef TBinaryProtocolFactoryT<TTransport> TBinaryProtocolFactory; |
Ben Craig | 384f976 | 2015-07-08 20:33:03 -0500 | [diff] [blame] | 243 | typedef TBinaryProtocolFactoryT<TTransport, TNetworkLittleEndian> TLEBinaryProtocolFactory; |
Konrad Grochowski | 16a23a6 | 2014-11-13 15:33:38 +0100 | [diff] [blame] | 244 | } |
| 245 | } |
| 246 | } // apache::thrift::protocol |
Marc Slemko | 6f038a7 | 2006-08-03 18:58:09 +0000 | [diff] [blame] | 247 | |
Roger Meier | 4285ba2 | 2013-06-10 21:17:23 +0200 | [diff] [blame] | 248 | #include <thrift/protocol/TBinaryProtocol.tcc> |
David Reiss | e71115b | 2010-10-06 17:09:56 +0000 | [diff] [blame] | 249 | |
Mark Slee | f5f2be4 | 2006-09-05 21:05:31 +0000 | [diff] [blame] | 250 | #endif // #ifndef _THRIFT_PROTOCOL_TBINARYPROTOCOL_H_ |