Loading...
Searching...
No Matches
websocketpp::transport::stub::connection< config > Class Template Reference
Inheritance diagram for websocketpp::transport::stub::connection< config >:

## Public Types

typedef connection< config > | type
| Type of this connection transport component.
typedef lib::shared_ptr< type > | ptr
| Type of a shared pointer to this connection transport component.
typedef config::concurrency_type | concurrency_type
| transport concurrency policy
typedef config::alog_type | alog_type
| Type of this transport's access logging policy.
typedef config::elog_type | elog_type
| Type of this transport's error logging policy.
typedef concurrency_type::scoped_lock_type | scoped_lock_type
typedef concurrency_type::mutex_type | mutex_type
typedef lib::shared_ptr< timer > | timer_ptr

## Public Member Functions

| connection (bool is_server, const lib::shared_ptr< alog_type > &alog, const lib::shared_ptr< elog_type > &elog)
ptr | get_shared ()
| Get a shared pointer to this component.
void | set_secure (bool value)
| Set whether or not this connection is secure.
bool | is_secure () const
| Tests whether or not the underlying transport is secure.
void | set_uri (uri_ptr)
| Set uri hook.
void | set_remote_endpoint (std::string value)
| Set human readable remote endpoint address.
std::string | get_remote_endpoint () const
| Get human readable remote endpoint address.
connection_hdl | get_handle () const
| Get the connection handle.
timer_ptr | set_timer (long duration, timer_handler handler)
| Call back a function after a period of time.

## Protected Member Functions

void | init (init_handler handler)
| Initialize the connection transport.
void | async_read_at_least (size_t num_bytes, char *buf, size_t len, read_handler handler)
| Initiate an async_read for at least num_bytes bytes into buf.
void | async_write (char const *buf, size_t len, write_handler handler)
| Asyncronous Transport Write.
void | async_write (std::vector< buffer > const &bufs, write_handler handler)
| Asyncronous Transport Write (scatter-gather).
void | set_handle (connection_hdl hdl)
| Set Connection Handle.
lib::error_code | dispatch (dispatch_handler handler)
| Call given handler back within the transport's event system (if present).
void | async_shutdown (shutdown_handler handler)
| Perform cleanup on socket shutdown_handler.

## Detailed Description

template<typename config>
class websocketpp::transport::stub::connection< config >

Definition at line 55 of file connection.hpp.

## Member Typedef Documentation

## alog_type

template<typename config>

typedef config::alog_type websocketpp::transport::stub::connection< config >::alog_type

Type of this transport's access logging policy.

Definition at line 65 of file connection.hpp.

## concurrency_type

template<typename config>

typedef config::concurrency_type websocketpp::transport::stub::connection< config >::concurrency_type

transport concurrency policy

Definition at line 63 of file connection.hpp.

## elog_type

template<typename config>

typedef config::elog_type websocketpp::transport::stub::connection< config >::elog_type

Type of this transport's error logging policy.

Definition at line 67 of file connection.hpp.

## mutex_type

template<typename config>

typedef concurrency_type::mutex_type websocketpp::transport::stub::connection< config >::mutex_type

Definition at line 71 of file connection.hpp.

## ptr

template<typename config>

typedef lib::shared_ptr<type> websocketpp::transport::stub::connection< config >::ptr

Type of a shared pointer to this connection transport component.

Definition at line 60 of file connection.hpp.

## scoped_lock_type

template<typename config>

typedef concurrency_type::scoped_lock_type websocketpp::transport::stub::connection< config >::scoped_lock_type

Definition at line 70 of file connection.hpp.

## timer_ptr

template<typename config>

typedef lib::shared_ptr<timer> websocketpp::transport::stub::connection< config >::timer_ptr

Definition at line 73 of file connection.hpp.

## type

template<typename config>

typedef connection<config> websocketpp::transport::stub::connection< config >::type

Type of this connection transport component.

Definition at line 58 of file connection.hpp.

## Constructor & Destructor Documentation

## connection()

template<typename config>

websocketpp::transport::stub::connection< config >::connection | ( | bool | is_server,
|  | const lib::shared_ptr< alog_type > & | alog,
|  | const lib::shared_ptr< elog_type > & | elog )

inline explicit

Definition at line 75 of file connection.hpp.

## Member Function Documentation

## async_read_at_least()

template<typename config>

void websocketpp::transport::stub::connection< config >::async_read_at_least | ( | size_t | num_bytes,
|  | char * | buf,
|  | size_t | len,
|  | read_handler | handler )

inline protected

Initiate an async_read for at least num_bytes bytes into buf.

Initiates an async_read request for at least num_bytes bytes. The input will be read into buf. A maximum of len bytes will be input. When the operation is complete, handler will be called with the status and number of bytes read.

This method may or may not call handler from within the initial call. The application should be prepared to accept either.

The application should never call this method a second time before it has been called back for the first read. If this is done, the second read will be called back immediately with a double_read error.

If num_bytes or len are zero handler will be called back immediately indicating success.

Parameters

  num_bytes | Don't call handler until at least this many bytes have been read.
  buf | The buffer to read bytes into
  len | The size of buf. At maximum, this many bytes will be read.
  handler | The callback to invoke when the operation is complete or ends in an error

Definition at line 206 of file connection.hpp.

## async_shutdown()

template<typename config>

void websocketpp::transport::stub::connection< config >::async_shutdown | ( | shutdown_handler | handler | ) |

inline protected

Perform cleanup on socket shutdown_handler.

Parameters

  h | The shutdown_handler to call back when complete

Definition at line 272 of file connection.hpp.

## async_write() [1/2]

template<typename config>

void websocketpp::transport::stub::connection< config >::async_write | ( | char const * | buf,
|  | size_t | len,
|  | write_handler | handler )

inline protected

Asyncronous Transport Write.

Write len bytes in buf to the output stream. Call handler to report success or failure. handler may or may not be called during async_write, but it must be safe for this to happen.

Will return 0 on success.

Parameters

  buf | buffer to read bytes from
  len | number of bytes to write
  handler | Callback to invoke with operation status.

Definition at line 225 of file connection.hpp.

## async_write() [2/2]

template<typename config>

void websocketpp::transport::stub::connection< config >::async_write | ( | std::vector< buffer > const & | bufs,
|  | write_handler | handler )

inline protected

Asyncronous Transport Write (scatter-gather).

Write a sequence of buffers to the output stream. Call handler to report success or failure. handler may or may not be called during async_write, but it must be safe for this to happen.

Will return 0 on success.

Parameters

  bufs | vector of buffers to write
  handler | Callback to invoke with operation status.

Definition at line 241 of file connection.hpp.

## dispatch()

template<typename config>

lib::error_code websocketpp::transport::stub::connection< config >::dispatch | ( | dispatch_handler | handler | ) |

inline protected

Call given handler back within the transport's event system (if present).

Invoke a callback within the transport's event system if it has one. If it doesn't, the handler will be invoked immediately before this function returns.

Parameters

  handler | The callback to invoke

Returns
  Whether or not the transport was able to register the handler for callback.

Definition at line 263 of file connection.hpp.

## get_handle()

template<typename config>

connection_hdl websocketpp::transport::stub::connection< config >::get_handle | ( |  | ) | const

inline

Get the connection handle.

Returns
  The handle for this connection.

Definition at line 153 of file connection.hpp.

## get_remote_endpoint()

template<typename config>

std::string websocketpp::transport::stub::connection< config >::get_remote_endpoint | ( |  | ) | const

inline

Get human readable remote endpoint address.

TODO: docs

This value is used in access and error logs and is available to the end application for including in user facing interfaces and messages.

Returns
  A string identifying the address of the remote endpoint

Definition at line 145 of file connection.hpp.

## get_shared()

template<typename config>

ptr websocketpp::transport::stub::connection< config >::get_shared | ( |  | ) |

inline

Get a shared pointer to this component.

Definition at line 82 of file connection.hpp.

## init()

template<typename config>

void websocketpp::transport::stub::connection< config >::init | ( | init_handler | handler | ) |

inline protected

Initialize the connection transport.

Initialize the connection's transport component.

Parameters

  handler | The init_handler to call when initialization is done

Definition at line 177 of file connection.hpp.

## is_secure()

template<typename config>

bool websocketpp::transport::stub::connection< config >::is_secure | ( |  | ) | const

inline

Tests whether or not the underlying transport is secure.

TODO: docs

Returns
  Whether or not the underlying transport is secure

Definition at line 102 of file connection.hpp.

## set_handle()

template<typename config>

void websocketpp::transport::stub::connection< config >::set_handle | ( | connection_hdl | hdl | ) |

inline protected

Set Connection Handle.

Parameters

  hdl | The new handle

Definition at line 250 of file connection.hpp.

## set_remote_endpoint()

template<typename config>

void websocketpp::transport::stub::connection< config >::set_remote_endpoint | ( | std::string | value | ) |

inline

Set human readable remote endpoint address.

Sets the remote endpoint address returned by get_remote_endpoint. This value should be a human readable string that describes the remote endpoint. Typically an IP address or hostname, perhaps with a port. But may be something else depending on the nature of the underlying transport.

If none is set a default is returned.

Since
  0.3.0-alpha4

Parameters

  value | The remote endpoint address to set.

Definition at line 134 of file connection.hpp.

## set_secure()

template<typename config>

void websocketpp::transport::stub::connection< config >::set_secure | ( | bool | value | ) |

inline

Set whether or not this connection is secure.

Todo: docs

Since
  0.3.0-alpha4

Parameters

  value | Whether or not this connection is secure.

Definition at line 94 of file connection.hpp.

## set_timer()

template<typename config>

timer_ptr websocketpp::transport::stub::connection< config >::set_timer | ( | long | duration,
|  | timer_handler | handler )

inline

Call back a function after a period of time.

Timers are not implemented in this transport. The timer pointer will always be empty. The handler will never be called.

Parameters

  duration | Length of time to wait in milliseconds
  callback | The function to call back when the timer has expired

Returns
  A handle that can be used to cancel the timer if it is no longer needed.

Definition at line 167 of file connection.hpp.

## set_uri()

template<typename config>

void websocketpp::transport::stub::connection< config >::set_uri | ( | uri_ptr |  | ) |

inline

Set uri hook.

Called by the endpoint as a connection is being established to provide the uri being connected to to the transport layer.

Implementation is optional and can be ignored if the transport has no need for this information.

Since
  0.6.0

Parameters

  u | The uri to set

Definition at line 118 of file connection.hpp.

The documentation for this class was generated from the following file:

- websocketpp/transport/stub/connection.hpp