dnp3 (C++ API) 1.8.0-RC1
Loading...
Searching...
No Matches
dnp3::Outstation Class Reference

Outstation handle. More...

#include <dnp3.hpp>

Public Member Functions

 Outstation (Outstation &&other) noexcept
 Transfer ownership of the underlying C-type to this instance and invalidate the other instance. More...
 
 ~Outstation ()
 Free resources of the outstation. More...
 
void enable ()
 enable communications More...
 
void disable ()
 disable communications More...
 
void transaction (DatabaseTransaction &callback)
 Acquire a mutex on the underlying database and apply a set of changes as a transaction. More...
 
void set_decode_level (const DecodeLevel &level)
 Set decoding log level. More...
 

Static Public Member Functions

static Outstation create_serial_session (Runtime &runtime, const std::string &serial_path, const SerialSettings &settings, const OutstationConfig &config, std::unique_ptr< OutstationApplication > application, std::unique_ptr< OutstationInformation > information, std::unique_ptr< ControlHandler > control_handler)
 Create an outstation instance running on a serial port. More...
 
static Outstation create_serial_session_fault_tolerant (Runtime &runtime, const std::string &serial_path, const SerialSettings &settings, std::chrono::steady_clock::duration open_retry_delay, const OutstationConfig &config, std::unique_ptr< OutstationApplication > application, std::unique_ptr< OutstationInformation > information, std::unique_ptr< ControlHandler > control_handler)
 This method is implemented in terms of Outstation::create_serial_session_2() but without a port listener. More...
 
static Outstation create_serial_session_2 (Runtime &runtime, const std::string &serial_path, const SerialSettings &settings, std::chrono::steady_clock::duration open_retry_delay, const OutstationConfig &config, std::unique_ptr< OutstationApplication > application, std::unique_ptr< OutstationInformation > information, std::unique_ptr< ControlHandler > control_handler, std::unique_ptr< PortStateListener > port_listener)
 Create an outstation instance running on a serial port which is tolerant to the serial port being added and removed. More...
 
static Outstation create_tcp_client (Runtime &runtime, LinkErrorMode link_error_mode, EndpointList &endpoints, const ConnectStrategy &connect_strategy, ConnectOptions &connect_options, const OutstationConfig &config, std::unique_ptr< OutstationApplication > application, std::unique_ptr< OutstationInformation > information, std::unique_ptr< ControlHandler > control_handler, std::unique_ptr< ClientStateListener > listener)
 Create an outstation instance running as a TCP client. More...
 
static Outstation create_tcp_client_with_handler (Runtime &runtime, LinkErrorMode link_error_mode, const std::string &span_name, const OutstationConfig &config, std::unique_ptr< OutstationApplication > application, std::unique_ptr< OutstationInformation > information, std::unique_ptr< ControlHandler > control_handler, std::unique_ptr< ClientStateListener > listener, std::unique_ptr< ClientConnectionHandler > connection_handler)
 Create an outstation instance running as a TCP client with fine-grained connection management. More...
 
static Outstation create_tls_client (Runtime &runtime, LinkErrorMode link_error_mode, EndpointList &endpoints, const ConnectStrategy &connect_strategy, ConnectOptions &connect_options, const OutstationConfig &config, std::unique_ptr< OutstationApplication > application, std::unique_ptr< OutstationInformation > information, std::unique_ptr< ControlHandler > control_handler, std::unique_ptr< ClientStateListener > listener, const TlsClientConfig &tls_config)
 Create an outstation instance running as a TLS client. More...
 
static Outstation create_tls_client_with_handler (Runtime &runtime, LinkErrorMode link_error_mode, const std::string &span_name, const OutstationConfig &config, std::unique_ptr< OutstationApplication > application, std::unique_ptr< OutstationInformation > information, std::unique_ptr< ControlHandler > control_handler, std::unique_ptr< ClientStateListener > listener, std::unique_ptr< ClientConnectionHandler > connection_handler, const TlsClientConfig &tls_config)
 Create an outstation instance running as a TLS client with fine-grained connection management. More...
 
static Outstation create_udp (Runtime &runtime, const OutstationUdpConfig &udp_config, const OutstationConfig &config, std::unique_ptr< OutstationApplication > application, std::unique_ptr< OutstationInformation > information, std::unique_ptr< ControlHandler > control_handler)
 Create an outstation instance that communicates over UDP. More...
 

Friends

class CppOutstationFriend
 

Detailed Description

Outstation handle.

Use this handle to modify the internal database.

Constructor & Destructor Documentation

◆ Outstation()

dnp3::Outstation::Outstation ( Outstation &&  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

◆ ~Outstation()

dnp3::Outstation::~Outstation ( )

Free resources of the outstation.

Warning
An outstation created with a TCP client, TLS client, serial, or UDP method stops when it is destroyed. An outstation added to an OutstationServer keeps running until the server is shut down with OutstationServer::~OutstationServer().

Member Function Documentation

◆ create_serial_session()

static Outstation dnp3::Outstation::create_serial_session ( Runtime &  runtime,
const std::string &  serial_path,
const SerialSettings &  settings,
const OutstationConfig &  config,
std::unique_ptr< OutstationApplication >  application,
std::unique_ptr< OutstationInformation >  information,
std::unique_ptr< ControlHandler >  control_handler 
)
static

Create an outstation instance running on a serial port.

The port is opened immediately on the calling thread and fails if not successful

Warning
Most users should prefer the fault tolerant version of the this method Outstation::create_serial_session_fault_tolerant()
Parameters
runtimeruntime on which to spawn the outstation
serial_pathPath of the serial device
settingssettings for the serial port
configoutstation configuration
applicationapplication interface
informationinformational events interface
control_handlercontrol handler interface
Returns
Outstation instance or NULL if the port cannot be opened
Exceptions
ParamException

◆ create_serial_session_2()

static Outstation dnp3::Outstation::create_serial_session_2 ( Runtime &  runtime,
const std::string &  serial_path,
const SerialSettings &  settings,
std::chrono::steady_clock::duration  open_retry_delay,
const OutstationConfig &  config,
std::unique_ptr< OutstationApplication >  application,
std::unique_ptr< OutstationInformation >  information,
std::unique_ptr< ControlHandler >  control_handler,
std::unique_ptr< PortStateListener >  port_listener 
)
static

Create an outstation instance running on a serial port which is tolerant to the serial port being added and removed.

Parameters
runtimeruntime on which to spawn the outstation
serial_pathPath of the serial device
settingssettings for the serial port
open_retry_delaydelay between attempts to open the serial port
configoutstation configuration
applicationapplication interface
informationinformational events interface
control_handlercontrol handler interface
port_listenerport state listener
Returns
Outstation instance or NULL if an error occurred
Exceptions
ParamException

◆ create_serial_session_fault_tolerant()

static Outstation dnp3::Outstation::create_serial_session_fault_tolerant ( Runtime &  runtime,
const std::string &  serial_path,
const SerialSettings &  settings,
std::chrono::steady_clock::duration  open_retry_delay,
const OutstationConfig &  config,
std::unique_ptr< OutstationApplication >  application,
std::unique_ptr< OutstationInformation >  information,
std::unique_ptr< ControlHandler >  control_handler 
)
static

This method is implemented in terms of Outstation::create_serial_session_2() but without a port listener.

Parameters
runtimeruntime on which to spawn the outstation
serial_pathPath of the serial device
settingssettings for the serial port
open_retry_delaydelay between attempts to open the serial port
configoutstation configuration
applicationapplication interface
informationinformational events interface
control_handlercontrol handler interface
Returns
Outstation instance or NULL if an error occurred
Exceptions
ParamException

◆ create_tcp_client()

static Outstation dnp3::Outstation::create_tcp_client ( Runtime &  runtime,
LinkErrorMode  link_error_mode,
EndpointList &  endpoints,
const ConnectStrategy &  connect_strategy,
ConnectOptions &  connect_options,
const OutstationConfig &  config,
std::unique_ptr< OutstationApplication >  application,
std::unique_ptr< OutstationInformation >  information,
std::unique_ptr< ControlHandler >  control_handler,
std::unique_ptr< ClientStateListener >  listener 
)
static

Create an outstation instance running as a TCP client.

Parameters
runtimeruntime on which to spawn the outstation
link_error_modeControls how link errors are handled with respect to the TCP session
endpointsList of IP endpoints.
connect_strategyControls the timing of (re)connection attempts
connect_optionsOptions that control the TCP connection process
configoutstation configuration
applicationapplication interface
informationinformational events interface
control_handlercontrol handler interface
listenerConnection listener used to receive updates on the status of the connection
Returns
Outstation instance
Exceptions
ParamException

◆ create_tcp_client_with_handler()

static Outstation dnp3::Outstation::create_tcp_client_with_handler ( Runtime &  runtime,
LinkErrorMode  link_error_mode,
const std::string &  span_name,
const OutstationConfig &  config,
std::unique_ptr< OutstationApplication >  application,
std::unique_ptr< OutstationInformation >  information,
std::unique_ptr< ControlHandler >  control_handler,
std::unique_ptr< ClientStateListener >  listener,
std::unique_ptr< ClientConnectionHandler >  connection_handler 
)
static

Create an outstation instance running as a TCP client with fine-grained connection management.

This function provides fine-grained control over connection management via a user implementation of the ClientConnectionHandler interface.

Parameters
runtimeruntime on which to spawn the outstation
link_error_modeControls how link errors are handled with respect to the TCP session
span_nameName used for tracing spans (typically the main endpoint address)
configoutstation configuration
applicationapplication interface
informationinformational events interface
control_handlercontrol handler interface
listenerConnection listener used to receive updates on the status of the connection
connection_handlerConnection handler providing fine-grained control over connection management
Returns
Outstation instance
Exceptions
ParamException

◆ create_tls_client()

static Outstation dnp3::Outstation::create_tls_client ( Runtime &  runtime,
LinkErrorMode  link_error_mode,
EndpointList &  endpoints,
const ConnectStrategy &  connect_strategy,
ConnectOptions &  connect_options,
const OutstationConfig &  config,
std::unique_ptr< OutstationApplication >  application,
std::unique_ptr< OutstationInformation >  information,
std::unique_ptr< ControlHandler >  control_handler,
std::unique_ptr< ClientStateListener >  listener,
const TlsClientConfig &  tls_config 
)
static

Create an outstation instance running as a TLS client.

Parameters
runtimeruntime on which to spawn the outstation
link_error_modeControls how link errors are handled with respect to the TCP session
endpointsList of IP endpoints.
connect_strategyControls the timing of (re)connection attempts
connect_optionsOptions that control the TCP connection process
configoutstation configuration
applicationapplication interface
informationinformational events interface
control_handlercontrol handler interface
listenerConnection listener used to receive updates on the status of the connection
tls_configTLS client configuration
Returns
Outstation instance
Exceptions
ParamException

◆ create_tls_client_with_handler()

static Outstation dnp3::Outstation::create_tls_client_with_handler ( Runtime &  runtime,
LinkErrorMode  link_error_mode,
const std::string &  span_name,
const OutstationConfig &  config,
std::unique_ptr< OutstationApplication >  application,
std::unique_ptr< OutstationInformation >  information,
std::unique_ptr< ControlHandler >  control_handler,
std::unique_ptr< ClientStateListener >  listener,
std::unique_ptr< ClientConnectionHandler >  connection_handler,
const TlsClientConfig &  tls_config 
)
static

Create an outstation instance running as a TLS client with fine-grained connection management.

This function provides fine-grained control over connection management via a user implementation of the ClientConnectionHandler interface.

Parameters
runtimeruntime on which to spawn the outstation
link_error_modeControls how link errors are handled with respect to the TCP session
span_nameSpan name used for tracing the connection
configoutstation configuration
applicationapplication interface
informationinformational events interface
control_handlercontrol handler interface
listenerConnection listener used to receive updates on the status of the connection
connection_handlerConnection handler providing fine-grained control over connection management
tls_configTLS client configuration
Returns
Outstation instance
Exceptions
ParamException

◆ create_udp()

static Outstation dnp3::Outstation::create_udp ( Runtime &  runtime,
const OutstationUdpConfig &  udp_config,
const OutstationConfig &  config,
std::unique_ptr< OutstationApplication >  application,
std::unique_ptr< OutstationInformation >  information,
std::unique_ptr< ControlHandler >  control_handler 
)
static

Create an outstation instance that communicates over UDP.

The socket is bound in the background, and binding is retried after a failure, so this method does not fail if the socket cannot be bound.

Parameters
runtimeruntime on which to spawn the outstation
udp_configUDP configuration
configoutstation configuration
applicationapplication interface
informationinformational events interface
control_handlercontrol handler interface
Returns
Outstation instance or NULL if an error occurred
Exceptions
ParamException

◆ disable()

void dnp3::Outstation::disable ( )

disable communications

Exceptions
ParamException

◆ enable()

void dnp3::Outstation::enable ( )

enable communications

Exceptions
ParamException

◆ set_decode_level()

void dnp3::Outstation::set_decode_level ( const DecodeLevel &  level)

Set decoding log level.

Parameters
levelDecode log
Exceptions
ParamException

◆ transaction()

void dnp3::Outstation::transaction ( DatabaseTransaction &  callback)

Acquire a mutex on the underlying database and apply a set of changes as a transaction.

Parameters
callbackInterface on which to execute the transaction

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