opendnp3  3.1.0
Reference implementation of DNP3 (IEEE-1815)
opendnp3::DNP3Manager Class Reference

Root DNP3 object used to create channels and sessions. More...

#include <opendnp3/DNP3Manager.h>

Public Member Functions

 DNP3Manager (uint32_t concurrencyHint, std::shared_ptr< opendnp3::ILogHandler > handler=std::shared_ptr< opendnp3::ILogHandler >(), std::function< void(uint32_t)> onThreadStart=[](uint32_t) {}, std::function< void(uint32_t)> onThreadExit=[](uint32_t) {})
 Construct a manager. More...
 
 ~DNP3Manager ()
 
std::shared_ptr< IChannelAddSerial (const std::string &id, const opendnp3::LogLevels &levels, const ChannelRetry &retry, SerialSettings settings, std::shared_ptr< IChannelListener > listener)
 Add a persistent serial channel. More...
 
std::shared_ptr< IChannelAddTCPClient (const std::string &id, const opendnp3::LogLevels &levels, const ChannelRetry &retry, const std::vector< IPEndpoint > &hosts, const std::string &local, std::shared_ptr< IChannelListener > listener)
 Add a persistent TCP client channel. More...
 
std::shared_ptr< IChannelAddTCPServer (const std::string &id, const opendnp3::LogLevels &levels, ServerAcceptMode mode, const IPEndpoint &endpoint, std::shared_ptr< IChannelListener > listener)
 Add a persistent TCP server channel. More...
 
std::shared_ptr< IChannelAddTLSClient (const std::string &id, const opendnp3::LogLevels &levels, const ChannelRetry &retry, const std::vector< IPEndpoint > &hosts, const std::string &local, const TLSConfig &config, std::shared_ptr< IChannelListener > listener)
 Add a TLS client channel. More...
 
std::shared_ptr< IChannelAddTLSServer (const std::string &id, const opendnp3::LogLevels &levels, ServerAcceptMode mode, const IPEndpoint &endpoint, const TLSConfig &config, std::shared_ptr< IChannelListener > listener)
 Add a TLS server channel. More...
 
std::shared_ptr< IChannelAddUDPChannel (const std::string &id, const opendnp3::LogLevels &levels, const ChannelRetry &retry, const IPEndpoint &localEndpoint, const IPEndpoint &remoteEndpoint, std::shared_ptr< IChannelListener > listener)
 Add a persistent UDP channel. More...
 
std::shared_ptr< IListenerCreateListener (std::string loggerid, const opendnp3::LogLevels &loglevel, const IPEndpoint &endpoint, const std::shared_ptr< IListenCallbacks > &callbacks)
 Create a TCP listener that will be used to accept incoming connections. More...
 
std::shared_ptr< IListenerCreateListener (std::string loggerid, const opendnp3::LogLevels &loglevel, const IPEndpoint &endpoint, const TLSConfig &config, const std::shared_ptr< IListenCallbacks > &callbacks)
 Create a TLS listener that will be used to accept incoming connections. More...
 
void Shutdown ()
 Permanently shutdown the manager and all sub-objects that have been created. More...
 

Private Attributes

std::unique_ptr< DNP3ManagerImpl > impl
 

Detailed Description

Root DNP3 object used to create channels and sessions.

Definition at line 50 of file DNP3Manager.h.

Constructor & Destructor Documentation

◆ DNP3Manager()

opendnp3::DNP3Manager::DNP3Manager ( uint32_t  concurrencyHint,
std::shared_ptr< opendnp3::ILogHandler handler = std::shared_ptr< opendnp3::ILogHandler >(),
std::function< void(uint32_t)>  onThreadStart = [](uint32_t) {},
std::function< void(uint32_t)>  onThreadExit = [](uint32_t) {} 
)

Construct a manager.

Parameters
concurrencyHintHow many threads to allocate in the thread pool
handlerCallback interface for log messages
onThreadStartAction to run when a thread pool thread starts
onThreadExitAction to run just before a thread pool thread exits

◆ ~DNP3Manager()

opendnp3::DNP3Manager::~DNP3Manager ( )

Member Function Documentation

◆ AddSerial()

std::shared_ptr<IChannel> opendnp3::DNP3Manager::AddSerial ( const std::string &  id,
const opendnp3::LogLevels levels,
const ChannelRetry retry,
SerialSettings  settings,
std::shared_ptr< IChannelListener listener 
)

Add a persistent serial channel.

Parameters
idAlias that will be used for logging purposes with this channel
levelsBitfield that describes the logging level for this channel and associated sessions
retryRetry parameters for failed channels
settingssettings object that fully parameterizes the serial port
listeneroptional callback interface (can be nullptr) for info about the running channel
Exceptions
DNP3Errorif the manager was already shutdown
Returns
shared_ptr to a channel interface

◆ AddTCPClient()

std::shared_ptr<IChannel> opendnp3::DNP3Manager::AddTCPClient ( const std::string &  id,
const opendnp3::LogLevels levels,
const ChannelRetry retry,
const std::vector< IPEndpoint > &  hosts,
const std::string &  local,
std::shared_ptr< IChannelListener listener 
)

Add a persistent TCP client channel.

Automatically attempts to reconnect.

Parameters
idAlias that will be used for logging purposes with this channel
levelsBitfield that describes the logging level for this channel and associated sessions
retryRetry parameters for failed channels
hostsList of host addresses to use to connect to the remote outstation (i.e. 127.0.0.1 or www.google.com)
localadapter address on which to attempt the connection (use 0.0.0.0 for all adapters)
listeneroptional callback interface (can be nullptr) for info about the running channel
Returns
shared_ptr to a channel interface

◆ AddTCPServer()

std::shared_ptr<IChannel> opendnp3::DNP3Manager::AddTCPServer ( const std::string &  id,
const opendnp3::LogLevels levels,
ServerAcceptMode  mode,
const IPEndpoint endpoint,
std::shared_ptr< IChannelListener listener 
)

Add a persistent TCP server channel.

Only accepts a single connection at a time.

Parameters
idAlias that will be used for logging purposes with this channel
levelsBitfield that describes the logging level for this channel and associated sessions
modeDescribes how new connections are treated when another session already exists
endpointNetwork adapter to listen on (i.e. 127.0.0.1 or 0.0.0.0) and port
listeneroptional callback interface (can be nullptr) for info about the running channel
Exceptions
DNP3Errorif the manager was already shutdown or if the server could not be binded properly
Returns
shared_ptr to a channel interface

◆ AddTLSClient()

std::shared_ptr<IChannel> opendnp3::DNP3Manager::AddTLSClient ( const std::string &  id,
const opendnp3::LogLevels levels,
const ChannelRetry retry,
const std::vector< IPEndpoint > &  hosts,
const std::string &  local,
const TLSConfig config,
std::shared_ptr< IChannelListener listener 
)

Add a TLS client channel.

Exceptions
std::system_errorThrows underlying ASIO exception of TLS configuration is invalid
Parameters
idAlias that will be used for logging purposes with this channel
levelsBitfield that describes the logging level for this channel and associated sessions
retryRetry parameters for failed channels
hostsIP address of remote outstation (i.e. 127.0.0.1 or www.google.com)
localadapter address on which to attempt the connection (use 0.0.0.0 for all adapters)
configTLS configuration information
listeneroptional callback interface (can be nullptr) for info about the running channel
Exceptions
DNP3Errorif the manager was already shutdown or if the library was compiled without TLS support
Returns
shared_ptr to a channel interface

◆ AddTLSServer()

std::shared_ptr<IChannel> opendnp3::DNP3Manager::AddTLSServer ( const std::string &  id,
const opendnp3::LogLevels levels,
ServerAcceptMode  mode,
const IPEndpoint endpoint,
const TLSConfig config,
std::shared_ptr< IChannelListener listener 
)

Add a TLS server channel.

Exceptions
std::system_errorThrows underlying ASIO exception of TLS configuration is invalid
Parameters
idAlias that will be used for logging purposes with this channel
levelsBitfield that describes the logging level for this channel and associated sessions
modeDescribes how new connections are treated when another session already exists
endpointNetwork adapter to listen on (i.e. 127.0.0.1 or 0.0.0.0) and port
configTLS configuration information
listeneroptional callback interface (can be nullptr) for info about the running channel
Exceptions
DNP3Errorif the manager was already shutdown, if the library was compiled without TLS support or if the server could not be binded properly
Returns
shared_ptr to a channel interface

◆ AddUDPChannel()

std::shared_ptr<IChannel> opendnp3::DNP3Manager::AddUDPChannel ( const std::string &  id,
const opendnp3::LogLevels levels,
const ChannelRetry retry,
const IPEndpoint localEndpoint,
const IPEndpoint remoteEndpoint,
std::shared_ptr< IChannelListener listener 
)

Add a persistent UDP channel.

Parameters
idAlias that will be used for logging purposes with this channel
levelsBitfield that describes the logging level for this channel and associated sessions
retryRetry parameters for failed channels
localEndpointLocal endpoint from which datagrams will be received
remoteEndpointRemote endpoint where datagrams will be sent to
listeneroptional callback interface (can be nullptr) for info about the running channel
Exceptions
DNP3Errorif the manager was already shutdown
Returns
shared_ptr to a channel interface

◆ CreateListener() [1/2]

std::shared_ptr<IListener> opendnp3::DNP3Manager::CreateListener ( std::string  loggerid,
const opendnp3::LogLevels loglevel,
const IPEndpoint endpoint,
const std::shared_ptr< IListenCallbacks > &  callbacks 
)

Create a TCP listener that will be used to accept incoming connections.

Exceptions
DNP3Errorif the manager was already shutdown or if the server could not be binded properly

◆ CreateListener() [2/2]

std::shared_ptr<IListener> opendnp3::DNP3Manager::CreateListener ( std::string  loggerid,
const opendnp3::LogLevels loglevel,
const IPEndpoint endpoint,
const TLSConfig config,
const std::shared_ptr< IListenCallbacks > &  callbacks 
)

Create a TLS listener that will be used to accept incoming connections.

Exceptions
DNP3Errorif the manager was already shutdown, if the library was compiled without TLS support or if the server could not be binded properly

◆ Shutdown()

void opendnp3::DNP3Manager::Shutdown ( )

Permanently shutdown the manager and all sub-objects that have been created.

Stop the thead pool.

Member Data Documentation

◆ impl

std::unique_ptr<DNP3ManagerImpl> opendnp3::DNP3Manager::impl
private

Definition at line 212 of file DNP3Manager.h.


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