LibQuicR
quicr::SessionManager Class Reference

Owns transports and sessions and routes generic track handlers to a session. More...

#include <session_manager.h>

Classes

struct  Callbacks
 Notifications for sessions owned by a manager. More...
 

Public Member Functions

 SessionManager (std::shared_ptr< Logger > logger=nullptr)
 Construct with default callbacks and an internally created tick service per transport. More...
 
 SessionManager (std::shared_ptr< Callbacks > callbacks, std::shared_ptr< Logger > logger=nullptr)
 Construct with callbacks and an internally created tick service per transport. More...
 
 SessionManager (std::shared_ptr< Clock > clock, std::shared_ptr< Logger > logger=nullptr)
 Construct with default callbacks and a shared tick service. More...
 
 SessionManager (std::shared_ptr< Callbacks > callbacks, std::shared_ptr< Clock > clock, std::shared_ptr< Logger > logger=nullptr)
 Construct with callbacks and a shared tick service. More...
 
 ~SessionManager ()
 Shut down all transports owned by the manager. More...
 
std::weak_ptr< Session > AddTransport (const ClientConfig &config, std::shared_ptr< Session::ClientCallbacks > callbacks=nullptr)
 Create a client transport and wait for its session to be established. More...
 
void AddTransport (const ServerConfig &config, std::shared_ptr< Session::ServerCallbacks > callbacks=nullptr)
 Create and start a server transport. More...
 
void AddHandler (const std::shared_ptr< Session > &session, std::shared_ptr< TrackHandler > handler)
 Register a concrete track or namespace handler with a session. More...
 
void RemoveHandler (const std::shared_ptr< Session > &session, const std::shared_ptr< TrackHandler > &handler)
 Remove a concrete track or namespace handler from a session. More...
 

Detailed Description

Owns transports and sessions and routes generic track handlers to a session.

The manager retains every server session until its connection closes. A client session is likewise retained internally; callers receive a weak reference. Destruction shuts down all transports.

Examples
simple_publish/main.cpp, and simple_subscribe/main.cpp.

Constructor & Destructor Documentation

◆ SessionManager() [1/4]

quicr::SessionManager::SessionManager ( std::shared_ptr< Logger >  logger = nullptr)

Construct with default callbacks and an internally created tick service per transport.

Parameters
loggerOptional logger shared by created transports and sessions.

◆ SessionManager() [2/4]

quicr::SessionManager::SessionManager ( std::shared_ptr< Callbacks >  callbacks,
std::shared_ptr< Logger >  logger = nullptr 
)

Construct with callbacks and an internally created tick service per transport.

Parameters
callbacksCallback receiver.
loggerOptional logger shared by created transports and sessions.
Precondition
callbacks must not be null.

◆ SessionManager() [3/4]

quicr::SessionManager::SessionManager ( std::shared_ptr< Clock >  clock,
std::shared_ptr< Logger >  logger = nullptr 
)

Construct with default callbacks and a shared tick service.

Parameters
clockClock service shared by created transports; null selects an internal clock service per transport.
loggerOptional logger shared by created transports and sessions.

◆ SessionManager() [4/4]

quicr::SessionManager::SessionManager ( std::shared_ptr< Callbacks >  callbacks,
std::shared_ptr< Clock >  clock,
std::shared_ptr< Logger >  logger = nullptr 
)

Construct with callbacks and a shared tick service.

Parameters
callbacksCallback receiver.
clockService shared by created transports; null selects an internal service per transport.
loggerOptional logger shared by created transports and sessions.
Precondition
callbacks must not be null.

◆ ~SessionManager()

quicr::SessionManager::~SessionManager ( )

Shut down all transports owned by the manager.

Member Function Documentation

◆ AddHandler()

void quicr::SessionManager::AddHandler ( const std::shared_ptr< Session > &  session,
std::shared_ptr< TrackHandler >  handler 
)

Register a concrete track or namespace handler with a session.

Parameters
sessionTarget session; the manager does not take additional ownership.
handlerHandler whose dynamic type selects the session operation.
Exceptions
std::invalid_argumentif session is null or handler has an unsupported dynamic type.
Examples
simple_publish/main.cpp, and simple_subscribe/main.cpp.

◆ AddTransport() [1/2]

std::weak_ptr<Session> quicr::SessionManager::AddTransport ( const ClientConfig &  config,
std::shared_ptr< Session::ClientCallbacks >  callbacks = nullptr 
)

Create a client transport and wait for its session to be established.

Parameters
configClient and transport configuration.
callbacksSession callbacks; null uses no application callbacks.
Returns
Weak reference to the manager-owned session, or an empty reference if the URI is invalid, transport startup fails, or no session appears before the configured idle timeout.
Examples
simple_publish/main.cpp, and simple_subscribe/main.cpp.

◆ AddTransport() [2/2]

void quicr::SessionManager::AddTransport ( const ServerConfig &  config,
std::shared_ptr< Session::ServerCallbacks >  callbacks = nullptr 
)

Create and start a server transport.

Parameters
configServer and transport configuration.
callbacksCallbacks shared by sessions accepted by this transport; null uses no session callbacks.
Note
Accepted sessions are reported asynchronously through Callbacks::OnNewServerSession.

◆ RemoveHandler()

void quicr::SessionManager::RemoveHandler ( const std::shared_ptr< Session > &  session,
const std::shared_ptr< TrackHandler > &  handler 
)

Remove a concrete track or namespace handler from a session.

Parameters
sessionTarget session.
handlerPreviously registered handler whose dynamic type selects the removal operation.
Exceptions
std::invalid_argumentif session is null or handler has an unsupported dynamic type.

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