libcaf  0.15.3
Public Member Functions | Friends | List of all members
caf::io::network::asio_multiplexer Class Reference

A wrapper for the boost::asio multiplexer. More...

#include <asio_multiplexer.hpp>

Inheritance diagram for caf::io::network::asio_multiplexer:
caf::io::network::multiplexer caf::execution_unit

Public Member Functions

expected< connection_handlenew_tcp_scribe (const std::string &, uint16_t) override
 Tries to connect to host on given port and returns an unbound connection handle on success. More...
 
expected< void > assign_tcp_scribe (abstract_broker *, connection_handle hdl) override
 Assigns an unbound scribe identified by hdl to ptr. More...
 
template<class Socket >
connection_handle add_tcp_scribe (abstract_broker *, Socket &&sock)
 
connection_handle add_tcp_scribe (abstract_broker *, native_socket fd) override
 Creates a new TCP doorman from a native socket handle. More...
 
expected< connection_handleadd_tcp_scribe (abstract_broker *, const std::string &, uint16_t) override
 Tries to connect to host on port and returns a new scribe managing the connection on success. More...
 
expected< std::pair< accept_handle, uint16_t > > new_tcp_doorman (uint16_t p, const char *in, bool rflag) override
 Tries to create an unbound TCP doorman bound to port, optionally accepting only connections from IP address in. More...
 
expected< void > assign_tcp_doorman (abstract_broker *, accept_handle hdl) override
 Assigns an unbound doorman identified by hdl to ptr. More...
 
accept_handle add_tcp_doorman (abstract_broker *, asio_tcp_socket_acceptor &&sock)
 
accept_handle add_tcp_doorman (abstract_broker *, native_socket fd) override
 Creates a new TCP doorman from a native socket handle. More...
 
expected< std::pair< accept_handle, uint16_t > > add_tcp_doorman (abstract_broker *, uint16_t, const char *, bool) override
 Tries to create a new TCP doorman running on port p, optionally accepting only connections from IP address in. More...
 
void exec_later (resumable *ptr) override
 Enqueues ptr to the job list of the execution unit. More...
 
 asio_multiplexer (actor_system *sys)
 
supervisor_ptr make_supervisor () override
 Creates a supervisor to keep the event loop running.
 
void run () override
 Runs the multiplexers event loop.
 
boost::asio::io_service * pimpl () override
 Retrieves a pointer to the implementation or nullptr if CAF was compiled using the default backend. More...
 
boost::asio::io_service & service ()
 
- Public Member Functions inherited from caf::io::network::multiplexer
 multiplexer (actor_system *sys)
 
template<class F >
void dispatch (F fun)
 Invokes fun in the multiplexer's event loop, calling fun() immediately when called from inside the event loop. More...
 
template<class F >
void post (F fun)
 Invokes fun in the multiplexer's event loop, forcing execution to be delayed when called from inside the event loop. More...
 
const std::thread::id & thread_id () const
 
void thread_id (std::thread::id tid)
 
- Public Member Functions inherited from caf::execution_unit
 execution_unit (actor_system *sys)
 
 execution_unit (execution_unit &&)=delete
 
 execution_unit (const execution_unit &)=delete
 
actor_systemsystem () const
 Returns the enclosing actor system. More...
 
proxy_registryproxy_registry_ptr ()
 Returns a pointer to the proxy factory currently associated to this unit.
 
void proxy_registry_ptr (proxy_registry *ptr)
 Associated a new proxy factory to this unit.
 

Friends

class io::middleman
 
class supervisor
 

Additional Inherited Members

- Public Types inherited from caf::io::network::multiplexer
using supervisor_ptr = std::unique_ptr< supervisor >
 
- Static Public Member Functions inherited from caf::io::network::multiplexer
static std::unique_ptr< multiplexermake (actor_system &sys)
 Creates an instance using the networking backend compiled with CAF.
 
- Protected Attributes inherited from caf::io::network::multiplexer
std::thread::id tid_
 Identifies the thread this multiplexer is running in. More...
 
- Protected Attributes inherited from caf::execution_unit
actor_systemsystem_
 
proxy_registryproxies_
 

Detailed Description

A wrapper for the boost::asio multiplexer.

Member Function Documentation

accept_handle caf::io::network::asio_multiplexer::add_tcp_doorman ( abstract_broker ptr,
native_socket  fd 
)
overridevirtual

Creates a new TCP doorman from a native socket handle.

Warning
Do not call from outside the multiplexer's event loop.

Implements caf::io::network::multiplexer.

expected< std::pair< accept_handle, uint16_t > > caf::io::network::asio_multiplexer::add_tcp_doorman ( abstract_broker ptr,
uint16_t  port,
const char *  in,
bool  reuse_addr 
)
overridevirtual

Tries to create a new TCP doorman running on port p, optionally accepting only connections from IP address in.

Warning
Do not call from outside the multiplexer's event loop.

Implements caf::io::network::multiplexer.

connection_handle caf::io::network::asio_multiplexer::add_tcp_scribe ( abstract_broker ptr,
native_socket  fd 
)
overridevirtual

Creates a new TCP doorman from a native socket handle.

Warning
Do not call from outside the multiplexer's event loop.

Implements caf::io::network::multiplexer.

expected< connection_handle > caf::io::network::asio_multiplexer::add_tcp_scribe ( abstract_broker ,
const std::string &  host,
uint16_t  port 
)
overridevirtual

Tries to connect to host on port and returns a new scribe managing the connection on success.

Warning
Do not call from outside the multiplexer's event loop.

Implements caf::io::network::multiplexer.

expected< void > caf::io::network::asio_multiplexer::assign_tcp_doorman ( abstract_broker ptr,
accept_handle  hdl 
)
overridevirtual

Assigns an unbound doorman identified by hdl to ptr.

Warning
Do not call from outside the multiplexer's event loop.

Implements caf::io::network::multiplexer.

expected< void > caf::io::network::asio_multiplexer::assign_tcp_scribe ( abstract_broker ptr,
connection_handle  hdl 
)
overridevirtual

Assigns an unbound scribe identified by hdl to ptr.

Warning
Do not call from outside the multiplexer's event loop.

Implements caf::io::network::multiplexer.

void caf::io::network::asio_multiplexer::exec_later ( resumable ptr)
overridevirtual

Enqueues ptr to the job list of the execution unit.

Warning
Must only be called from a resumable currently executed by this execution unit.

Implements caf::execution_unit.

expected< std::pair< accept_handle, uint16_t > > caf::io::network::asio_multiplexer::new_tcp_doorman ( uint16_t  port,
const char *  in,
bool  reuse_addr 
)
overridevirtual

Tries to create an unbound TCP doorman bound to port, optionally accepting only connections from IP address in.

Warning
Do not call from outside the multiplexer's event loop.

Implements caf::io::network::multiplexer.

expected< connection_handle > caf::io::network::asio_multiplexer::new_tcp_scribe ( const std::string &  host,
uint16_t  port 
)
overridevirtual

Tries to connect to host on given port and returns an unbound connection handle on success.

Implements caf::io::network::multiplexer.

boost::asio::io_service * caf::io::network::asio_multiplexer::pimpl ( )
overridevirtual

Retrieves a pointer to the implementation or nullptr if CAF was compiled using the default backend.

Reimplemented from caf::io::network::multiplexer.


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