Hazelcast C++ Client
Hazelcast C++ Client Library
client_network_config.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 #include "hazelcast/client/config/ssl_config.h"
20 #include "hazelcast/client/config/client_aws_config.h"
21 #include "hazelcast/client/config/socket_options.h"
22 #include "hazelcast/client/config/cloud_config.h"
23 
24 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
25 #pragma warning(push)
26 #pragma warning(disable : 4251) // for dll export
27 #endif
28 
29 namespace hazelcast {
30 namespace client {
31 namespace config {
35 class HAZELCAST_API client_network_config
36 {
37 public:
43 
50  ssl_config& get_ssl_config();
51 
59  client_network_config& set_ssl_config(const config::ssl_config& config);
60 
68  client_network_config& set_connection_timeout(
69  const std::chrono::milliseconds& timeout);
70 
76  std::chrono::milliseconds get_connection_timeout() const;
77 
84  client_network_config& set_aws_config(
86 
92  client_aws_config& get_aws_config();
93 
99  cloud_config& get_cloud_config();
100 
106  bool is_smart_routing() const;
107 
122  client_network_config& set_smart_routing(bool smart_routing);
123 
130  std::vector<address> get_addresses() const;
131 
139  client_network_config& add_addresses(const std::vector<address>& addresses);
140 
148  client_network_config& set_addresses(const std::vector<address>& addresses);
149 
157  client_network_config& add_address(const address& address);
158 
159  socket_options& get_socket_options();
160 
166  bool use_public_address() const;
167 
175  client_network_config& use_public_address(bool should_use_public_address);
176 
177 private:
178  config::ssl_config ssl_config_;
179  config::client_aws_config client_aws_config_;
180  config::cloud_config cloud_config_;
181 
182  std::chrono::milliseconds connection_timeout_;
183  bool smart_routing_;
184 
185  std::vector<address> address_list_;
186 
187  socket_options socket_options_;
188 
189  bool use_public_address_{ false };
190 };
191 } // namespace config
192 } // namespace client
193 } // namespace hazelcast
194 
195 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
196 #pragma warning(pop)
197 #endif
Represents an address of a client or member in the cluster.
Definition: address.h:37
The client_aws_config contains the configuration for client to connect to nodes in aws environment.
Contains configuration parameters for client network related behaviour.
Contains configuration parameters for ssl related behaviour.
Definition: ssl_config.h:67
hazelcast.cloud configuration to let the client connect the cluster via hazelcast....
Definition: cloud_config.h:33