stepfunc / dnp3 Goto Github PK
View Code? Open in Web Editor NEWRust implementation of DNP3 (IEEE 1815) with idiomatic bindings for C, .NET, C++, and Java
Home Page: https://stepfunc.io/products/libraries/dnp3/
License: Other
Rust implementation of DNP3 (IEEE 1815) with idiomatic bindings for C, .NET, C++, and Java
Home Page: https://stepfunc.io/products/libraries/dnp3/
License: Other
Parameterize the link layer parser so that it bubbles up or swallows framing errors. TCP/TLS should bubble up errors and close the stream by default, but it shouldn't be hard coded by channel type (except for perhaps serial) b/c of the use of terminal servers which can convert serial to IP.
This was noted in #35 but wasn't implemented in it.
Also, parameterize the link layer parser so that it bubbles up or swallows framing errors. TCP/TLS should bubble up errors and close the stream by default, but it shouldn't be hard coded by channel type (except for perhaps serial) b/c of the use of terminal servers which can convert serial to IP.
We don't need the separate light/dark toggle. Let's just focus on a single light theme to match the website.
I have reserved the io.stepfunc groupId on Maven central.
Add performance benchmark where a set of masters communicate with an outstation as fast as possible using criterion to collect statistics.
The outstation follows this pattern but the master creation methods are on the Runtime.
We should limit the number of class type resources in our APIs whenever possible as they have to be destroyed in C and handled specially in C#/Java.
An association is really just an address token and as far as the ffi is concerned can just be:
struct Association {
address: u16
}
All of the methods on Association can be moved to Master
and take an additional Association
argument. A rust association is just a MasterHandle
paired with an EndpointAddress
anyway:
#[derive(Clone, Debug)]
pub struct AssociationHandle {
address: EndpointAddress,
master: MasterHandle,
}
This change will eliminate resource leaks related to not freeing associations. It's much easier for the user to just have to deal with freeing a master or outstation.
Setting the log handler more than once panics with unable to install tracing subscriber
here:
dnp3/ffi/dnp3-ffi/src/logging.rs
Lines 17 to 18 in 83af2ee
The tracing
docs of tracing::subscriber::set_global_default
says:
Libraries should NOT call
set_global_default()
! That will cause conflicts when executables try to set them later.
The callbacks should return the time-to-complete value.
The octet string read handler method is currently doing nothing. See https://github.com/grid-io/dnp3/blob/1739253b8afdbbef262fc68f1fdf5bb7756bf12b/ffi/dnp3-ffi/src/handler.rs#L76-L82
e.g. at the moment we have runtime_config_t
but logging_configuration_t
We need both APIs to give full control over how objects/headers are constructed.
It should be possible to have multiple objects per object header.
AssociationHandler::get_system_time
in the bindingsAssociationHandler::get_system_time
to return an Option<SystemTime>
. If it is None
, then no time synchronization should happen. See dnp3/opendnp3#397Preludes:
use dnp3::prelude::*;
use dnp3::prelude::master::*;
use dnp3::prelude::outstation::*;
Also, move entry functions to master
and outstation
modules.
Also add all missing public Rustdoc
Add the ability to have a custom reconnection strategy, instead of the hard-coded exponential backoff.
Tracing can provide additional context, e.g. each connection can be identified in some way, whereas the log crate has no such info and will make it impossible to correlate logs with sessions without injecting identifiers down into the log calls themselves.
I found myself wanting to pull in the License.txt
into the documentation without having anchors.
In the FFI, the command callback yields the following enum:
/// @brief Result of a command
typedef enum command_result_t
{
/// @brief Command was a success
CommandResult_Success = 0,
/// @brief Failed b/c of a generic task execution error
CommandResult_TaskError = 1,
/// @brief Outstation indicated that a command was not SUCCESS
CommandResult_BadStatus = 2,
/// @brief Number of headers in the response doesn't match the number in the request
CommandResult_HeaderCountMismatch = 3,
/// @brief Header in the response doesn't match the request
CommandResult_HeaderTypeMismatch = 4,
/// @brief Number of objects in one of the headers doesn't match the request
CommandResult_ObjectCountMismatch = 5,
/// @brief Value in one of the objects in the response doesn't match the request
CommandResult_ObjectValueMismatch = 6,
} command_result_t;
Its a little strange that we have 4 different kinds of details about why the device might not respond to a select/operate correctly, i.e. all the header count mismatches, yet there's just a single TaskError
. We might consider rolling up all the "mismatch" errors into something like "BadReply".
The TaskError should at least be able to differentiate between "response timeout" and "disconnected".
Uncomment // missing_docs
in lib.rs and add missing rustdoc
Instead of abandonning an AutoTask if it failed, we should provide a retry strategy with a delay. OpenDNP3 has a exponential backoff strategy that can be configured with https://github.com/dnp3/opendnp3/blob/097b6ddcb012a54c9e8e10db03fec98ddc898341/cpp/lib/include/opendnp3/master/MasterParams.h#L65-L69
Similar to dnp3/opendnp3#277.
Update to tokio 2.23 when it's released. We currently use a git dependency in order to have this change: tokio-rs/tokio#2649
When connecting the dnp3rs master to the OpenDNP3 outstation example, the startup integrity poll fails because it does not expect g50v4 (see #10) in the response, and then retries it immediatly. It creates a loop of request/response. Perhaps it should wait a couple of seconds before retrying that integrity poll.
This is required for conformance testing, although rarely used.
See also: dnp3/opendnp3#405 (comment)
With tracing integrated, it's worth going through each log statement in the library to determine if context in the log statement should be moved into a parent span instead.
I'd like to use this in a few places in the docs, namely master startup, diagrams of the runtime, etc.
Do we need to the raw hexadecimal?
Allowing single port to map to multiple outstation sessions, based on IP address filter or wildcard.
This group is supported by OpenDNP3, but it's very rarely used.
It should accept just a function code and request headers. It could be used for class assignement or to freeze counters for example.
Once stepfunc/oo_bindgen#42 is implemented, the Poll
and Association
should used an opaque struct instead of a class. This would prevent memory leaks and remove the misunderstanding of users for non-working polls if they let them be garbage-collected.
Optionally, specify the class assignements at startup (whenever a restart is detected).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.