Hazelcast C++ Client
Hazelcast C++ Client Library
All Classes Functions Variables Enumerations Enumerator Pages
socket.h
1 /*
2  * Copyright (c) 2008-2021, 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 <boost/asio.hpp>
19 
20 #include "hazelcast/client/config/socket_options.h"
21 #include "hazelcast/client/address.h"
22 
23 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
24 #pragma warning(push)
25 #pragma warning(disable: 4251) //for dll export
26 #endif
27 
28 namespace hazelcast {
29  namespace client {
30  namespace connection {
31  class Connection;
32  }
33 
34  namespace spi {
35  namespace impl {
36  class ClientInvocation;
37  }
38  }
39 
40  class HAZELCAST_API socket {
41  public:
42  virtual ~socket() = default;
43 
44  virtual void connect(const std::shared_ptr<connection::Connection> connection) = 0;
45 
46  virtual void
47  async_write(const std::shared_ptr<connection::Connection> connection,
48  const std::shared_ptr<spi::impl::ClientInvocation> invocation) = 0;
49 
50  virtual void close() = 0;
51 
52  virtual address get_address() const = 0;
53 
60  virtual boost::optional<address> local_socket_address() const = 0;
61 
62  virtual const address &get_remote_endpoint() const = 0;
63 
64  virtual boost::asio::io_context::strand &get_executor() noexcept = 0;
65  };
66  }
67 }
68 
69 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
70 #pragma warning(pop)
71 #endif
72 
73 
Represents an address of a client or member in the cluster.
Definition: address.h:36
virtual boost::optional< address > local_socket_address() const =0
This function is used to obtain the locally bound endpoint of the socket.