dnp3 (C++ API) 1.1.0
dnp3::OutstationServer Class Reference

TCP server that listens for connections and routes the messages to outstations. More...

#include <dnp3.hpp>

Public Member Functions

 OutstationServer (OutstationServer &&other) noexcept
 Transfer ownership of the underlying C-type to this instance and invalidate the other instance. More...
 
 ~OutstationServer ()
 Gracefully shutdown all the outstations associated to this server, stops the server and release resources. More...
 
Outstation add_outstation (const OutstationConfig &config, std::unique_ptr< OutstationApplication > application, std::unique_ptr< OutstationInformation > information, std::unique_ptr< ControlHandler > control_handler, std::unique_ptr< ConnectionStateListener > listener, AddressFilter &filter)
 Add an outstation to the server. More...
 
void bind ()
 Bind the server to the port and starts listening. Also starts all the outstations associated to it. More...
 

Static Public Member Functions

static OutstationServer create_tcp_server (Runtime &runtime, LinkErrorMode link_error_mode, const std::string &address)
 Create a new TCP server. More...
 
static OutstationServer create_tls_server (Runtime &runtime, LinkErrorMode link_error_mode, const std::string &address, const TlsServerConfig &tls_config)
 Create a new TLS server. More...
 

Friends

class CppOutstationServerFriend
 

Detailed Description

TCP server that listens for connections and routes the messages to outstations.

To add outstations to it, use OutstationServer::add_outstation(). Once all the outstations are added, the server can be started with OutstationServer::bind().

OutstationServer::~OutstationServer() is used to gracefully shutdown all the outstations and the server.

Constructor & Destructor Documentation

◆ OutstationServer()

dnp3::OutstationServer::OutstationServer ( OutstationServer &&  other)
inlinenoexcept

Transfer ownership of the underlying C-type to this instance and invalidate the other instance.

Note
the moved class will now throw an exception if any method is called
Parameters
otherClass from which ownership will be transfer to this instance

◆ ~OutstationServer()

dnp3::OutstationServer::~OutstationServer ( )

Gracefully shutdown all the outstations associated to this server, stops the server and release resources.

Member Function Documentation

◆ add_outstation()

Outstation dnp3::OutstationServer::add_outstation ( const OutstationConfig config,
std::unique_ptr< OutstationApplication application,
std::unique_ptr< OutstationInformation information,
std::unique_ptr< ControlHandler control_handler,
std::unique_ptr< ConnectionStateListener listener,
AddressFilter filter 
)

Add an outstation to the server.

The returned Outstation can be used to modify points of the outstation.

In order for the outstation to run, the TCP server must be running. Use OutstationServer::bind() to run it.

Parameters
configOutstation configuration
applicationOutstation application callbacks
informationOutstation information callbacks
control_handlerOutstation control handler
listenerListener for the connection state
filterAddress filter
Returns
Outstation handle
Exceptions
ParamException

◆ bind()

void dnp3::OutstationServer::bind ( )

Bind the server to the port and starts listening. Also starts all the outstations associated to it.

Exceptions
ParamException

◆ create_tcp_server()

static OutstationServer dnp3::OutstationServer::create_tcp_server ( Runtime runtime,
LinkErrorMode  link_error_mode,
const std::string &  address 
)
static

Create a new TCP server.

To start it, use OutstationServer::bind().

Parameters
runtimeRuntime to execute the server on
link_error_modeControls how link errors are handled with respect to the TCP session
addressAddress to bind the server to e.g. 127.0.0.1:20000
Returns
New TCP server instance
Exceptions
ParamException

◆ create_tls_server()

static OutstationServer dnp3::OutstationServer::create_tls_server ( Runtime runtime,
LinkErrorMode  link_error_mode,
const std::string &  address,
const TlsServerConfig tls_config 
)
static

Create a new TLS server.

To start it, use OutstationServer::bind().

Parameters
runtimeRuntime to execute the server on
link_error_modeControls how link errors are handled with respect to the session
addressAddress to bind the server to e.g. 127.0.0.1:20000
tls_configTLS server configuration
Returns
New TLS server instance
Exceptions
ParamException

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