Skip to main content

zerodds_opcua_uacp/
lib.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 ZeroDDS Contributors
3
4//! OPC-UA Connection Protocol (**UACP**, OPC Foundation Part 6 §7.1) — the
5//! `opc.tcp://` binary message framing that carries OPC-UA Client/Server
6//! traffic.
7//!
8//! Crate `zerodds-opcua-uacp`. Safety classification: **STANDARD**.
9//! Spec: OPC-UA **Part 6 — Mappings** §7.1 (Connection Protocol).
10//!
11//! # Scope and relationship to the rest of the OPC-UA stack
12//!
13//! This is the **wire foundation** for a native OPC-UA Client/Server stack
14//! (the request/response counterpart to the native UADP PubSub stack in
15//! [`zerodds-opcua-pubsub`](https://docs.rs/zerodds-opcua-pubsub)). The layers
16//! build up:
17//!
18//! 1. **UACP** (this crate) — the TCP message framing: every message starts
19//!    with an 8-byte header (`MessageType` + `ChunkType` + `MessageSize`),
20//!    then a body. The connection-setup messages — Hello / Acknowledge /
21//!    Error / ReverseHello — are handled here in full.
22//! 2. SecureChannel (`OPN`/`CLO`/`MSG` messages + symmetric/asymmetric
23//!    crypto) — next.
24//! 3. Session + Service dispatch (Part 4) over the SecureChannel.
25//! 4. Server (serving the `zerodds-opcua-gateway` AddressSpace + the
26//!    `zerodds-opcua-pubsub` Information Model) and Client.
27//!
28//! The OPC-UA Part 6 §5 binary encoding is reused from
29//! [`zerodds_opcua_pubsub::binary`] (`UaReader`/`UaWriter`).
30
31#![cfg_attr(not(feature = "std"), no_std)]
32#![forbid(unsafe_code)]
33#![warn(missing_docs)]
34#![cfg_attr(test, allow(clippy::expect_used, clippy::unwrap_used, clippy::panic))]
35
36extern crate alloc;
37
38pub mod connection;
39#[cfg(feature = "crypto")]
40pub mod crypto;
41pub mod securechannel;
42
43pub use connection::{
44    AcknowledgeMessage, ChunkType, ErrorMessage, HelloMessage, MessageHeader, MessageType,
45    ReverseHelloMessage,
46};
47#[cfg(feature = "crypto")]
48pub use securechannel::SecuritySession;
49pub use securechannel::{
50    AsymmetricAlgorithmSecurityHeader, ChannelSecurityToken, OpenSecureChannelRequest,
51    OpenSecureChannelResponse, ParsedChunk, RequestHeader, ResponseHeader, SecureChannel,
52    SequenceHeader, parse_chunk,
53};
54pub use zerodds_opcua_pubsub::{DecodeError, EncodeError, UaReader, UaWriter};