Hazelcast C++ Client
Hazelcast C++ Client Library
socket_options.h
1 /*
2  * Copyright (c) 2008-2022, Hazelcast, Inc. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
18 #include "hazelcast/util/export.h"
19 
20 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
21 #pragma warning(push)
22 #pragma warning(disable : 4251) // for dll export
23 #endif
24 
25 namespace hazelcast {
26 namespace client {
27 namespace config {
31 class HAZELCAST_API socket_options
32 {
33 public:
37  static const int KILO_BYTE = 1024;
38 
42  static const int DEFAULT_BUFFER_SIZE_BYTE = 128 * KILO_BYTE;
43 
45 
51  bool is_tcp_no_delay() const;
52 
58  socket_options& set_tcp_no_delay(bool tcp_no_delay);
59 
65  bool is_keep_alive() const;
66 
73  socket_options& set_keep_alive(bool keep_alive);
74 
80  bool is_reuse_address() const;
81 
88  socket_options& set_reuse_address(bool reuse_address);
89 
94  int get_linger_seconds() const;
95 
106  socket_options& set_linger_seconds(int linger_seconds);
107 
116  int get_buffer_size_in_bytes() const;
117 
128  socket_options& set_buffer_size_in_bytes(int buffer_size);
129 
130 private:
131  // socket options
132 
133  bool tcp_no_delay_;
134 
135  bool keep_alive_;
136 
137  bool reuse_address_;
138 
139  int linger_seconds_;
140 
141  int buffer_size_;
142 };
143 
144 } // namespace config
145 } // namespace client
146 } // namespace hazelcast
147 
148 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
149 #pragma warning(pop)
150 #endif