Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
roc::netio::IConnHandler Class Referenceabstract

Connection event handler interface. More...

#include <iconn_handler.h>

Inheritance diagram for roc::netio::IConnHandler:
Collaboration diagram for roc::netio::IConnHandler:

Public Member Functions

virtual void connection_refused (IConn &conn)=0
 Connection can't be established. More...
 
virtual void connection_established (IConn &conn)=0
 Connection successfully established. More...
 
virtual void connection_writable (IConn &conn)=0
 Connection becomes available for writing. More...
 
virtual void connection_readable (IConn &conn)=0
 Connection becomes available for reading. More...
 
virtual void connection_terminated (IConn &conn)=0
 Connection is terminated and can't be accessed after this call. More...
 
- Public Member Functions inherited from roc::core::RefCounted< IConnHandler, core::ManualAllocation >
 RefCounted ()
 Initialize. More...
 
 RefCounted (const core::ManualAllocation &policy)
 Initialize. More...
 
int getref () const
 Get reference counter. More...
 
void incref () const
 Increment reference counter. More...
 
void decref () const
 Decrement reference counter. More...
 

Additional Inherited Members

- Protected Member Functions inherited from roc::core::ManualAllocation
template<class T >
void destroy (T &)
 No-op. When SharedPtr or ScopedPtr "destroys" object, nothing happens. The user is responsible for destroying it manually. More...
 

Detailed Description

Connection event handler interface.

Workflow

  • first, either connection_refused() or connection_established() is called excactly once for connection
  • these two calls are the point where the user can obtain IConn reference for the first time; the same reference will be then passed to other callbacks
  • after obtaining IConn reference, the user is responsible for terminating connection when it's no longer needed
  • connection_refused() call is possible only for client-side conenction
  • after connection is established, connection_writable() and connection_readable() are called repeatedly whenever it becomes possible to write or read data from connection
  • if an established connection fails asynchronously, it becomes readable and writable, and the next I/O operation will return error
  • after an asynchronous terminate is issued, no other callbacks except connection_terminated() are ever called
  • when an asynchronous terminate is completed, connection_terminated() is called; connection is still usable inside this callback
  • after connection_terminated() returns, the handler is never ever used for this connection, and the connection is destroyed
  • even after connection_terminated() call, the handler should not be destroyed until IConnAcceptor callback
Note
  • Methods are called from the network loop thread.
  • Methods should not block.

Definition at line 60 of file iconn_handler.h.

Member Function Documentation

◆ connection_established()

virtual void roc::netio::IConnHandler::connection_established ( IConn conn)
pure virtual

Connection successfully established.

◆ connection_readable()

virtual void roc::netio::IConnHandler::connection_readable ( IConn conn)
pure virtual

Connection becomes available for reading.

◆ connection_refused()

virtual void roc::netio::IConnHandler::connection_refused ( IConn conn)
pure virtual

Connection can't be established.

◆ connection_terminated()

virtual void roc::netio::IConnHandler::connection_terminated ( IConn conn)
pure virtual

Connection is terminated and can't be accessed after this call.

◆ connection_writable()

virtual void roc::netio::IConnHandler::connection_writable ( IConn conn)
pure virtual

Connection becomes available for writing.


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