-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add separate README files to get nicer pages on crates.io
- Loading branch information
Showing
26 changed files
with
422 additions
and
35 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Async OPC-UA Client | ||
|
||
Part of [async-opcua](https://crates.io/crates/async-opcua), a general purpose OPC-UA library in rust. | ||
|
||
This library defines a fully capable async OPC-UA client based on tokio. You will need a tokio runtime to use this client at all, as it depends on tokio for network and I/O. | ||
|
||
The OPC UA Client module contains the functionality necessary for a client to connect to an OPC UA server, authenticate itself, send messages, receive responses, get values, browse the address space and provide callbacks for things to be propagated to the client. | ||
|
||
Once the `Client` is created it can connect to a server by creating a `Session`. Multiple sessions can be created from the same client. | ||
|
||
To connect to a session, you can either use one of the `connect_*` methods on the `Client`, or the `SessionBuilder` which is more flexible. | ||
|
||
Once connected, you will get a `Session` object, and an `EventLoop`. The event loop must be continuously polled while you use the session, you can do this manually, to monitor the state of the connection, or you can just spawn it on a tokio task using `event_loop.spawn()`. | ||
|
||
The `Session` object contains methods for each OPC-UA service as of version 1.05 of the standard. Each service may be called directly with its corresponding method, i.e. | ||
|
||
```rust | ||
session.read(...).await? | ||
``` | ||
|
||
or by using the request builder: | ||
|
||
```rust | ||
Read::new(&session).nodes_to_read(...).send(session.channel()).await? | ||
``` | ||
|
||
By using the request builder, it is also possible to retry requests by using `Session::send_with_retry`. | ||
|
||
## Example | ||
|
||
```rust | ||
#[tokio::main] | ||
async fn main() { | ||
let mut client = ClientBuilder::new() | ||
.application_name("My First Client") | ||
.application_uri("urn:MyFirstClient") | ||
.create_sample_keypair(true) | ||
.trust_server_certs(false) | ||
.session_retry_limit(3) | ||
.client().unwrap(); | ||
// Create an endpoint. The EndpointDescription can be made from a tuple consisting of | ||
// the endpoint url, security policy, message security mode and user token policy. | ||
let endpoint: EndpointDescription = ( | ||
"opc.tcp://localhost:4855/", | ||
"None", | ||
MessageSecurityMode::None, | ||
UserTokenPolicy::anonymous() | ||
).into(); | ||
// Create the session and event loop | ||
let (session, event_loop) = client.connect_to_matching_endpoint(endpoint, IdentityToken::Anonymous).await.unwrap(); | ||
let handle = event_loop.spawn(); | ||
session.wait_for_connection().await; | ||
// From here you can call services on the session... | ||
// It is good practice to exit the session when you are done, since | ||
// OPC-UA servers may keep clients that exit uncleanly alive for some time. | ||
let _ = session_c.disconnect().await; | ||
handle.await.unwrap(); | ||
} | ||
``` | ||
|
||
See [simple client](../samples/simple-client/) for a slightly more elaborate example. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
[package] | ||
name = "async-opcua-codegen" | ||
version = "0.13.0" | ||
version = "0.14.0" | ||
edition = "2021" | ||
description = "OPC UA code generation library" | ||
authors = ["Einar Omang <[email protected]>"] | ||
homepage = "https://github.com/freeopcua/async-opcua" | ||
repository = "https://github.com/freeopcua/async-opcua" | ||
license = "MPL-2.0" | ||
keywords = ["opcua", "opc", "ua"] | ||
readme = "../README.md" | ||
documentation = "https://docs.rs/opcua/" | ||
readme = "README.md" | ||
documentation = "https://docs.rs/async-opcua/" | ||
|
||
[lib] | ||
name = "opcua_codegen" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Async OPC-UA Core | ||
|
||
Part of [async-opcua](https://crates.io/crates/async-opcua), a general purpose OPC-UA library in rust. | ||
|
||
This is a command line tool to generate code for use with the async-opcua client and server libraries. | ||
|
||
To use, define a [YAML](https://yaml.org/) configuration file with a list of code gen targets, including OPC-UA BSD (Binary Schema Definition) files, XSD (XML Schema Definition) files, and NodeSet2.xml files. | ||
|
||
See the [custom-codegen](../samples/custom-codegen/) sample for an example of how this can be done. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Async OPC-UA Core Namespace | ||
|
||
Part of [async-opcua](https://crates.io/crates/async-opcua), a general purpose OPC-UA library in rust. | ||
|
||
This library contains generated code for nodes and events defined in the core OPC-UA standard. It is intended to be used with [async-opcua-server](https://crates.io/crates/async-opcua-server), to define the core node manager. | ||
|
||
All OPC-UA servers must define the core namespace, which is primarily the core type hierarchy. Version 1.05 of the OPC-UA standard was used to generate this code, using `async-opcua-codegen`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Async OPC-UA Core | ||
|
||
Part of [async-opcua](https://crates.io/crates/async-opcua), a general purpose OPC-UA library in rust. | ||
|
||
This library contains common types used by the server and client parts of the `async-opcua` library. | ||
|
||
You will typically use either the client or server, and rarely use this library directly. | ||
|
||
`async-opcua-core` covers a few different areas of shared functionality. | ||
|
||
- The `RequestMessage` and `ResponseMessage` enums, which discriminate over the possible messages in an OPC-UA request and response. | ||
- Core message types such as `HelloMessage`, `AcknowledgeMessage`, `MessageChunk`, etc. and components of these. | ||
- The low-level implementation of the opc/tcp protocol. | ||
- The `SecureChannel` type, which uses [async-opcua-crypto](https://crates.io/crates/async-opcua-crypto) to encrypt OPC-UA messages. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Async OPC-UA Crypto | ||
|
||
Part of [async-opcua](https://crates.io/crates/async-opcua), a general purpose OPC-UA library in rust. | ||
|
||
This defines common cryptographic tooling for the OPC-UA protocol using libraries from [Rust Crypto](https://github.com/rustcrypto). | ||
|
||
Currently supported security policies: | ||
|
||
- `Basic256` (Deprecated) | ||
- `Basic128Rsa15` (Deprecated) | ||
- `Basic256Sha256` (Deprecated) | ||
- `Aes256Sha256RsaPss` | ||
- `Aes128Sha256Oaep` | ||
|
||
There's also some general tooling for working with and generating X509 Certificates, as well as support for the _legacy_ password encryption/decryption scheme in OPC-UA. | ||
|
||
You are unlikely to want to use this library directly, but it is used in both the server and client parts `async-opcua`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Async OPC-UA Macros | ||
|
||
Part of [async-opcua](https://crates.io/crates/async-opcua), a general purpose OPC-UA library in rust. | ||
|
||
This defines a number of utility macros for encoding, decoding, and defining types to help write server and client software. | ||
|
||
Currently defines: | ||
|
||
- `Event`, a macro for deriving the `Event` trait on custom event types. | ||
- `EventField`, a macro for deriving the `EventField` trait, used for types that can be part of OPC-UA events. | ||
- `FromXml`, with the `"xml"` feature. Derives conversion from XML objects in `NodeSet2` files. | ||
- `JsonEncodable`, with the `"json"` feature. Derives streaming serialization using OPC-UA JSON. | ||
- `JsonDecodable`, with the `"json"` feature. Derives streaming deserialization using OPC-UA JSON. | ||
- `BinaryEncodable`, derives streaming serialization using OPC-UA Binary. | ||
- `BinaryDecodable`, derives streaming deserialization using OPC-UA Binary. | ||
- `UaEnum`, derives the `UaEnum` and a few other traits to make it easier to define custom OPC-UA enums. | ||
|
||
## Features | ||
|
||
- `json`, adds the `JsonEncodable` and `JsonDecodable` macros. | ||
- `xml`, adds the `FromXml` macro. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Async OPC-UA Nodes | ||
|
||
Part of [async-opcua](https://crates.io/crates/async-opcua), a general purpose OPC-UA library in rust. | ||
|
||
This library defines types used mainly in the [async-opcua-server](https://crates.io/crates/async-opcua-server) library as part of in-memory node managers, but also utilities for importing `NodeSet2` XML files to Rust. | ||
|
||
Primarily, this library defines a type for each OPC-UA NodeClass `Object`, `Variable`, `Method`, `View`, `ObjectType`, `VariableType`, `DataType`, and `ReferenceType`, as well as builders for all of these. There's also a common enum over all of these `NodeType`. | ||
|
||
A few other common types are also defined here, such as the `TypeTree` trait, used in the server to provide the server with a view of all the types defined on the server, and the `NodeSet2Import` type, used to import `NodeSet2` files into memory. | ||
|
||
## Features | ||
|
||
- `xml` adds support for reading NodeSet2 XML files into `NodeType`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.