Basic Asio connection socket component.
More...
#include <none.hpp>
|
typedef connection | type |
| Type of this connection socket component.
|
|
typedef lib::shared_ptr< type > | ptr |
| Type of a shared pointer to this connection socket component.
|
|
typedef lib::asio::io_service * | io_service_ptr |
| Type of a pointer to the Asio io_service being used.
|
|
typedef lib::shared_ptr< lib::asio::io_service::strand > | strand_ptr |
| Type of a pointer to the Asio io_service strand being used.
|
|
typedef lib::asio::ip::tcp::socket | socket_type |
| Type of the ASIO socket being used.
|
|
typedef lib::shared_ptr< socket_type > | socket_ptr |
| Type of a shared pointer to the socket being used.
|
|
transport::asio::basic_socket::connection implements a connection socket component using Asio ip::tcp::socket.
Definition at line 58 of file none.hpp.
◆ io_service_ptr
◆ ptr
◆ socket_ptr
◆ socket_type
◆ strand_ptr
◆ type
◆ connection()
websocketpp::transport::asio::basic_socket::connection::connection |
( |
| ) |
|
|
inlineexplicit |
Definition at line 74 of file none.hpp.
74 : m_state(UNINITIALIZED) {
75
76
77 }
◆ async_shutdown()
Definition at line 253 of file none.hpp.
253 {
254 lib::asio::error_code ec;
255 m_socket->shutdown(lib::asio::ip::tcp::socket::shutdown_both, ec);
256 h(ec);
257 }
◆ cancel_socket()
lib::asio::error_code websocketpp::transport::asio::basic_socket::connection::cancel_socket |
( |
| ) |
|
|
inlineprotected |
Attempts to cancel all async operations on this socket and reports any failures.
NOTE: Windows XP and earlier do not support socket cancellation.
- Returns
- The error that occurred, if any.
Definition at line 247 of file none.hpp.
247 {
248 lib::asio::error_code ec;
249 m_socket->cancel(ec);
250 return ec;
251 }
◆ get_ec()
lib::error_code websocketpp::transport::asio::basic_socket::connection::get_ec |
( |
| ) |
const |
|
inlineprotected |
Definition at line 259 of file none.hpp.
259 {
260 return lib::error_code();
261 }
◆ get_next_layer()
lib::asio::ip::tcp::socket & websocketpp::transport::asio::basic_socket::connection::get_next_layer |
( |
| ) |
|
|
inline |
This is used internally.
Definition at line 116 of file none.hpp.
116 {
117 return *m_socket;
118 }
◆ get_raw_socket()
lib::asio::ip::tcp::socket & websocketpp::transport::asio::basic_socket::connection::get_raw_socket |
( |
| ) |
|
|
inline |
This is used internally. It can also be used to set socket options, etc
Definition at line 124 of file none.hpp.
124 {
125 return *m_socket;
126 }
◆ get_remote_endpoint()
std::string websocketpp::transport::asio::basic_socket::connection::get_remote_endpoint |
( |
lib::error_code & | ec | ) |
const |
|
inline |
The iostream transport has no information about the ultimate remote endpoint. It will return the string "iostream transport". To indicate this.
TODO: allow user settable remote endpoint addresses if this seems useful
- Returns
- A string identifying the address of the remote endpoint
Definition at line 138 of file none.hpp.
138 {
140
141 lib::asio::error_code aec;
142 lib::asio::ip::tcp::endpoint ep = m_socket->remote_endpoint(aec);
143
144 if (aec) {
145 ec = aec;
146 s <<
"Error getting remote endpoint: " << aec
147 << " (" << aec.message() << ")";
149 } else {
150 ec = lib::error_code();
153 }
154 }
◆ get_shared()
ptr websocketpp::transport::asio::basic_socket::connection::get_shared |
( |
| ) |
|
|
inline |
Definition at line 80 of file none.hpp.
80 {
81 return shared_from_this();
82 }
◆ get_socket()
lib::asio::ip::tcp::socket & websocketpp::transport::asio::basic_socket::connection::get_socket |
( |
| ) |
|
|
inline |
This is used internally. It can also be used to set socket options, etc
Definition at line 108 of file none.hpp.
108 {
109 return *m_socket;
110 }
◆ init_asio()
lib::error_code websocketpp::transport::asio::basic_socket::connection::init_asio |
( |
io_service_ptr | service, |
|
|
strand_ptr | , |
|
|
bool | ) |
|
inlineprotected |
init_asio is called once immediately after construction to initialize Asio components to the io_service
- Parameters
-
service | A pointer to the endpoint's io_service |
strand | A shared pointer to the connection's asio strand |
is_server | Whether or not the endpoint is a server or not. |
Definition at line 165 of file none.hpp.
166 {
167 if (m_state != UNINITIALIZED) {
169 }
170
171 m_socket = lib::make_shared<lib::asio::ip::tcp::socket>(*service);
172
173 m_state = READY;
174
175 return lib::error_code();
176 }
@ invalid_state
A function was called in a state that it was illegal to do so.
lib::error_code make_error_code(error::value e)
◆ is_secure()
bool websocketpp::transport::asio::basic_socket::connection::is_secure |
( |
| ) |
const |
|
inline |
- Returns
- Whether or not this connection is secure
Definition at line 88 of file none.hpp.
88 {
89 return false;
90 }
◆ post_init()
void websocketpp::transport::asio::basic_socket::connection::post_init |
( |
init_handler | callback | ) |
|
|
inlineprotected |
Called by the transport after all intermediate proxies have been negotiated. This gives the security policy the chance to talk with the real remote endpoint for a bit before the websocket handshake.
- Parameters
-
callback | Handler to call back with completion information |
Definition at line 223 of file none.hpp.
223 {
224 callback(lib::error_code());
225 }
◆ pre_init()
void websocketpp::transport::asio::basic_socket::connection::pre_init |
( |
init_handler | callback | ) |
|
|
inlineprotected |
Called by the transport after a new connection is created to initialize the socket component of the connection. This method is not allowed to write any bytes to the wire. This initialization happens before any proxies or other intermediate wrappers are negotiated.
- Parameters
-
callback | Handler to call back with completion information |
Definition at line 200 of file none.hpp.
200 {
201 if (m_state != READY) {
203 return;
204 }
205
206 if (m_socket_init_handler) {
207 m_socket_init_handler(m_hdl,*m_socket);
208 }
209
210 m_state = READING;
211
212 callback(lib::error_code());
213 }
◆ set_handle()
void websocketpp::transport::asio::basic_socket::connection::set_handle |
( |
connection_hdl | hdl | ) |
|
|
inlineprotected |
The connection handle is passed to any handlers to identify the connection
- Parameters
-
Definition at line 234 of file none.hpp.
234 {
235 m_hdl = hdl;
236 }
◆ set_socket_init_handler()
void websocketpp::transport::asio::basic_socket::connection::set_socket_init_handler |
( |
socket_init_handler | h | ) |
|
|
inline |
The socket initialization handler is called after the socket object is created but before it is used. This gives the application a chance to set any Asio socket options it needs.
- Parameters
-
h | The new socket_init_handler |
Definition at line 100 of file none.hpp.
100 {
101 m_socket_init_handler = h;
102 }
◆ set_uri()
void websocketpp::transport::asio::basic_socket::connection::set_uri |
( |
uri_ptr | | ) |
|
|
inlineprotected |
Called by the transport as a connection is being established to provide the uri being connected to to the security/socket layer.
This socket policy doesn't use the uri so it is ignored.
- Since
- 0.6.0
- Parameters
-
Definition at line 189 of file none.hpp.
◆ translate_ec() [1/2]
template<typename ErrorCodeType >
lib::error_code websocketpp::transport::asio::basic_socket::connection::translate_ec |
( |
ErrorCodeType | | ) |
|
|
inlineprotected |
Translate_ec takes an Asio error code and attempts to convert its value to an appropriate websocketpp error code. In the case that the Asio and Websocketpp error types are the same (such as using boost::asio and boost::system_error or using standalone asio and std::system_error the code will be passed through natively.
In the case of a mismatch (boost::asio with std::system_error) a translated code will be returned. The plain socket policy does not have any additional information so all such errors will be reported as the generic transport pass_through error.
- Since
- 0.3.0
- Parameters
-
ec | The error code to translate_ec |
- Returns
- The translated error code
Definition at line 282 of file none.hpp.
282 {
283
285 }
@ pass_through
underlying transport pass through
◆ translate_ec() [2/2]
lib::error_code websocketpp::transport::asio::basic_socket::connection::translate_ec |
( |
lib::error_code | ec | ) |
|
|
inlineprotected |
Overload of translate_ec to catch cases where lib::error_code is the same type as lib::asio::error_code
Definition at line 289 of file none.hpp.
289 {
290
291
292
293 return ec;
294 }
The documentation for this class was generated from the following file:
- libraries/fc/vendor/websocketpp/websocketpp/transport/asio/security/none.hpp