opendnp3
3.1.0
Reference implementation of DNP3 (IEEE-1815)
|
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< IChannel > | AddSerial (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< IChannel > | 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. More... | |
std::shared_ptr< IChannel > | 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. More... | |
std::shared_ptr< IChannel > | 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. More... | |
std::shared_ptr< IChannel > | 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. More... | |
std::shared_ptr< IChannel > | 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. More... | |
std::shared_ptr< IListener > | 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. More... | |
std::shared_ptr< IListener > | 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. More... | |
void | Shutdown () |
Permanently shutdown the manager and all sub-objects that have been created. More... | |
Private Attributes | |
std::unique_ptr< DNP3ManagerImpl > | impl |
Root DNP3 object used to create channels and sessions.
Definition at line 50 of file DNP3Manager.h.
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.
concurrencyHint | How many threads to allocate in the thread pool |
handler | Callback interface for log messages |
onThreadStart | Action to run when a thread pool thread starts |
onThreadExit | Action to run just before a thread pool thread exits |
opendnp3::DNP3Manager::~DNP3Manager | ( | ) |
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.
id | Alias that will be used for logging purposes with this channel |
levels | Bitfield that describes the logging level for this channel and associated sessions |
retry | Retry parameters for failed channels |
settings | settings object that fully parameterizes the serial port |
listener | optional callback interface (can be nullptr) for info about the running channel |
DNP3Error | if the manager was already shutdown |
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.
id | Alias that will be used for logging purposes with this channel |
levels | Bitfield that describes the logging level for this channel and associated sessions |
retry | Retry parameters for failed channels |
hosts | List of host addresses to use to connect to the remote outstation (i.e. 127.0.0.1 or www.google.com) |
local | adapter address on which to attempt the connection (use 0.0.0.0 for all adapters) |
listener | optional callback interface (can be nullptr) for info about the running channel |
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.
id | Alias that will be used for logging purposes with this channel |
levels | Bitfield that describes the logging level for this channel and associated sessions |
mode | Describes how new connections are treated when another session already exists |
endpoint | Network adapter to listen on (i.e. 127.0.0.1 or 0.0.0.0) and port |
listener | optional callback interface (can be nullptr) for info about the running channel |
DNP3Error | if the manager was already shutdown or if the server could not be binded properly |
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.
std::system_error | Throws underlying ASIO exception of TLS configuration is invalid |
id | Alias that will be used for logging purposes with this channel |
levels | Bitfield that describes the logging level for this channel and associated sessions |
retry | Retry parameters for failed channels |
hosts | IP address of remote outstation (i.e. 127.0.0.1 or www.google.com) |
local | adapter address on which to attempt the connection (use 0.0.0.0 for all adapters) |
config | TLS configuration information |
listener | optional callback interface (can be nullptr) for info about the running channel |
DNP3Error | if the manager was already shutdown or if the library was compiled without TLS support |
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.
std::system_error | Throws underlying ASIO exception of TLS configuration is invalid |
id | Alias that will be used for logging purposes with this channel |
levels | Bitfield that describes the logging level for this channel and associated sessions |
mode | Describes how new connections are treated when another session already exists |
endpoint | Network adapter to listen on (i.e. 127.0.0.1 or 0.0.0.0) and port |
config | TLS configuration information |
listener | optional callback interface (can be nullptr) for info about the running channel |
DNP3Error | if the manager was already shutdown, if the library was compiled without TLS support or if the server could not be binded properly |
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.
id | Alias that will be used for logging purposes with this channel |
levels | Bitfield that describes the logging level for this channel and associated sessions |
retry | Retry parameters for failed channels |
localEndpoint | Local endpoint from which datagrams will be received |
remoteEndpoint | Remote endpoint where datagrams will be sent to |
listener | optional callback interface (can be nullptr) for info about the running channel |
DNP3Error | if the manager was already shutdown |
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.
DNP3Error | if the manager was already shutdown or if the server could not be binded properly |
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.
DNP3Error | if the manager was already shutdown, if the library was compiled without TLS support or if the server could not be binded properly |
void opendnp3::DNP3Manager::Shutdown | ( | ) |
Permanently shutdown the manager and all sub-objects that have been created.
Stop the thead pool.
|
private |
Definition at line 212 of file DNP3Manager.h.