autobahn::wamp_rawsocket_transport< Socket > Class Template Reference

A class that represents a rawsocket transport. More...

#include <wamp_rawsocket_transport.hpp>

Inheritance diagram for autobahn::wamp_rawsocket_transport< Socket >:
autobahn::wamp_transport

Public Types

typedef Socket socket_type
 Convenience type for the socket being used.
 
typedef Socket::endpoint_type endpoint_type
 Convenience type for the endpoint being used.
 
- Public Types inherited from autobahn::wamp_transport
using pause_handler = std::function< void()>
 Handler to invoke when pausing transport transmission.
 
using resume_handler = std::function< void()>
 Handler to invoke when resuming transport transmission.
 

Public Member Functions

 wamp_rawsocket_transport (boost::asio::io_service &io_service, const endpoint_type &remote_endpoint, bool debug_enabled=false)
 Constructs a rawsocket transport. More...
 
virtual boost::future< void > connect () override
 Attempts to connect the transport. More...
 
virtual boost::future< void > disconnect () override
 Attempts to disconnect the transport. More...
 
virtual bool is_connected () const override
 Determines if the transport is connected. More...
 
virtual void send_message (wamp_message &&message) override
 Send the message synchronously over the transport. More...
 
virtual void set_pause_handler (pause_handler &&handler) override
 Set the handler to be invoked when the transport detects congestion sending to the remote peer and needs to apply backpressure on the application. More...
 
virtual void set_resume_handler (resume_handler &&handler) override
 Set the handler to be invoked when the transport detects congestion has subsided on the remote peer and the application can resume sending messages. More...
 
virtual void pause () override
 Pause receiving of messages. More...
 
virtual void resume () override
 Resume receiving of messages. More...
 
virtual void attach (const std::shared_ptr< wamp_transport_handler > &handler) override
 Attaches a handler to the transport. More...
 
virtual void detach () override
 Detaches the handler currently attached to the transport. More...
 
virtual bool has_handler () const override
 Determines if the transport has a handler attached. More...
 
- Public Member Functions inherited from autobahn::wamp_transport
virtual ~wamp_transport ()=default
 Default virtual destructor.
 

Protected Member Functions

socket_typesocket ()
 

Detailed Description

template<typename Socket>
class autobahn::wamp_rawsocket_transport< Socket >

A class that represents a rawsocket transport.

It is templated based on the socket type

Template Parameters
SocketThe socket type for the transport.
EndpointThe endpoint type for the socket to connect to.

Definition at line 55 of file wamp_rawsocket_transport.hpp.

Constructor & Destructor Documentation

template<typename Socket>
autobahn::wamp_rawsocket_transport< Socket >::wamp_rawsocket_transport ( boost::asio::io_service &  io_service,
const endpoint_type remote_endpoint,
bool  debug_enabled = false 
)

Constructs a rawsocket transport.

Parameters
io_serviceThe io service to use for asynchronous operations.
remote_endpointThe remote endpoint to connect to.

Member Function Documentation

template<typename Socket>
virtual void autobahn::wamp_rawsocket_transport< Socket >::attach ( const std::shared_ptr< wamp_transport_handler > &  handler)
overridevirtual

Attaches a handler to the transport.

Only one handler may be attached at any given time.

Parameters
handlerThe handler to attach to this transport.

Implements autobahn::wamp_transport.

template<typename Socket>
virtual boost::future<void> autobahn::wamp_rawsocket_transport< Socket >::connect ( )
overridevirtual

Attempts to connect the transport.

Returns
A future that will be satisfied when the connect attempt has been made.

Implements autobahn::wamp_transport.

Reimplemented in autobahn::wamp_tcp_transport.

template<typename Socket>
virtual void autobahn::wamp_rawsocket_transport< Socket >::detach ( )
overridevirtual

Detaches the handler currently attached to the transport.

Implements autobahn::wamp_transport.

template<typename Socket>
virtual boost::future<void> autobahn::wamp_rawsocket_transport< Socket >::disconnect ( )
overridevirtual

Attempts to disconnect the transport.

Returns
A future that will be satisfied when the disconnect attempt has been made.

Implements autobahn::wamp_transport.

template<typename Socket>
virtual bool autobahn::wamp_rawsocket_transport< Socket >::has_handler ( ) const
overridevirtual

Determines if the transport has a handler attached.

Returns
Whether or not a handler is attached.

Implements autobahn::wamp_transport.

template<typename Socket>
virtual bool autobahn::wamp_rawsocket_transport< Socket >::is_connected ( ) const
overridevirtual

Determines if the transport is connected.

Returns
Whether or not the transport is connected.

Implements autobahn::wamp_transport.

template<typename Socket>
virtual void autobahn::wamp_rawsocket_transport< Socket >::pause ( )
overridevirtual

Pause receiving of messages.

This will prevent the transport from receiving any more messages until it has been resumed. This is used to excert backpressure on the sending peer.

Implements autobahn::wamp_transport.

template<typename Socket>
virtual void autobahn::wamp_rawsocket_transport< Socket >::resume ( )
overridevirtual

Resume receiving of messages.

The transport will now begin receiving messsages again and lift backpressure from the sending peer.

Implements autobahn::wamp_transport.

template<typename Socket>
virtual void autobahn::wamp_rawsocket_transport< Socket >::send_message ( wamp_message &&  message)
overridevirtual

Send the message synchronously over the transport.

Parameters
messageThe message to be sent.

Implements autobahn::wamp_transport.

template<typename Socket>
virtual void autobahn::wamp_rawsocket_transport< Socket >::set_pause_handler ( pause_handler &&  handler)
overridevirtual

Set the handler to be invoked when the transport detects congestion sending to the remote peer and needs to apply backpressure on the application.

Parameters
handlerThe pause handler to be invoked.

Implements autobahn::wamp_transport.

template<typename Socket>
virtual void autobahn::wamp_rawsocket_transport< Socket >::set_resume_handler ( resume_handler &&  handler)
overridevirtual

Set the handler to be invoked when the transport detects congestion has subsided on the remote peer and the application can resume sending messages.

Parameters
handlerThe resume handler to be invoked.

Implements autobahn::wamp_transport.