Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-17 08:35:04

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one
0003  * or more contributor license agreements. See the NOTICE file
0004  * distributed with this work for additional information
0005  * regarding copyright ownership. The ASF licenses this file
0006  * to you under the Apache License, Version 2.0 (the
0007  * "License"); you may not use this file except in compliance
0008  * with the License. You may obtain a copy of the License at
0009  *
0010  *   http://www.apache.org/licenses/LICENSE-2.0
0011  *
0012  * Unless required by applicable law or agreed to in writing,
0013  * software distributed under the License is distributed on an
0014  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
0015  * KIND, either express or implied. See the License for the
0016  * specific language governing permissions and limitations
0017  * under the License.
0018  */
0019 
0020 #ifndef THRIFT_TCONFIGURATION_H
0021 #define THRIFT_TCONFIGURATION_H
0022 
0023 namespace apache {
0024 namespace thrift {
0025 
0026 class TConfiguration
0027 {
0028 public:
0029   TConfiguration(int maxMessageSize = DEFAULT_MAX_MESSAGE_SIZE, 
0030                 int maxFrameSize = DEFAULT_MAX_FRAME_SIZE, int recursionLimit = DEFAULT_RECURSION_DEPTH)
0031     : maxMessageSize_(maxMessageSize), maxFrameSize_(maxFrameSize), recursionLimit_(recursionLimit) {}
0032 
0033   const static int DEFAULT_MAX_MESSAGE_SIZE = 100 * 1024 * 1024;
0034   const static int DEFAULT_MAX_FRAME_SIZE = 16384000;      // this value is used consistently across all Thrift libraries
0035   const static int DEFAULT_RECURSION_DEPTH = 64;
0036 
0037   inline int  getMaxMessageSize() { return maxMessageSize_; }
0038   inline void setMaxMessageSize(int maxMessageSize) { maxMessageSize_ = maxMessageSize; } 
0039   inline int getMaxFrameSize() { return maxFrameSize_; }
0040   inline void setMaxFrameSize(int maxFrameSize) { maxFrameSize_ = maxFrameSize; }
0041   inline int getRecursionLimit() { return recursionLimit_; }
0042   inline void setRecursionLimit(int recursionLimit) { recursionLimit_ = recursionLimit; }
0043 
0044 private:
0045   int maxMessageSize_ = DEFAULT_MAX_MESSAGE_SIZE;
0046   int maxFrameSize_ = DEFAULT_MAX_FRAME_SIZE;
0047   int recursionLimit_ = DEFAULT_RECURSION_DEPTH;
0048 
0049   // TODO(someone_smart): add connection and i/o timeouts
0050 };
0051 }
0052 } // apache::thrift
0053 
0054 #endif /* THRIFT_TCONFIGURATION_H */
0055