5f985588f7
Ports the proven subset of `[MC-NBFX]` to `mxaccess-asb-nettcp::nbfx`.
Token model: Element { prefix, name } / EndElement / Attribute /
DefaultNamespace / NamespaceDeclaration / Text. Element + attribute
names can be inline UTF-8, an `[MC-NBFS]` static-dictionary id (via
F22's `lookup_static`), or a per-session `DynamicDictionary` id.
Text records covered: Empty (0xA8), Zero (0x80), One (0x82), Bool
(0x84/0x86 + 0xB4), Int8 (0x88), Int16 (0x8A), Int32 (0x8C), Int64
(0x8E), Chars (0x98/0x9A/0x9C — width variant chosen automatically by
payload length), DictionaryText (0xAA — both static and dynamic refs).
`*WithEndElement` collapse is automatic: a `Text → EndElement` pair
encodes as the `+1` record byte (e.g. `EmptyTextWithEndElement = 0xA9`,
`TrueTextWithEndElement = 0x87`). The decoder splits the implicit
EndElement back out so consumers see the same token stream regardless
of which wire form was used.
Element variants covered: ShortElement (0x40), Element (0x41 with
prefix string), ShortDictionaryElement (0x42), DictionaryElement
(0x43). Prefix-letter family (0x44-0x77) deferred — emit the long
form for now.
Attribute variants covered: ShortAttribute (0x04), Attribute (0x05),
ShortDictionaryAttribute (0x06), DictionaryAttribute (0x07), plus
xmlns variants (0x08/0x09).
15 new unit tests cover the dynamic dictionary, every supported
element/attribute/xmlns/text record form (including round-trip),
explicit byte pinning for the collapse behavior, Chars width-variant
selection, unknown-record rejection, and truncated-payload rejection.
Records left for follow-up: Decimal, UniqueId, TimeSpan, Float/Double
text, DateTime text, Bytes8/16/32, QNameDictionary, the 0x0C-0x25
prefix-dict-attribute / 0x26-0x3F prefix-attribute / 0x44-0x77
prefix-element families. None of these are on the proven ASB path.
With F21 landed, the M5 framing + encoder layer (streams A+B+C+D and
the F24 codec) is complete. F25 (mxaccess-asb IASBIDataV2 client) and
F26 (Session over AsbTransport) remain.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
33 lines
1.3 KiB
Rust
33 lines
1.3 KiB
Rust
//! `mxaccess-asb-nettcp` — `[MS-NMF]` framing + `[MC-NBFX]/[MC-NBFS]` binary
|
|
//! message encoding (the default `NetTcpBinding` encoder, **not** SOAP/XML).
|
|
//!
|
|
//! M5 work-in-progress — see `design/60-roadmap.md` and follow-up F18 in
|
|
//! `design/followups.md` for the current sub-stream breakdown.
|
|
//!
|
|
//! The .NET reference at `src/MxAsbClient/MxAsbDataClient.cs:660-685` uses
|
|
//! `new NetTcpBinding(SecurityMode.None)` with no encoder override, which
|
|
//! selects `BinaryMessageEncodingBindingElement` by default.
|
|
//!
|
|
//! Implements two layers:
|
|
//! 1. `[MS-NMF]` framing (preamble, preamble-ack, sized-envelope, end, fault)
|
|
//! plus the reliable-session ack handling on the underlying `net.tcp` channel.
|
|
//! 2. `[MC-NBFX]` binary XML + `[MC-NBFS]` static dictionary that holds the
|
|
//! SOAP/WS-Addressing/`IASBIDataV2`-action strings.
|
|
//!
|
|
//! …plus an [`auth`] sub-module that ports the .NET `AsbSystemAuthenticator`
|
|
//! (DH key exchange + HMAC signing + AES-128/PBKDF2-SHA1 derivation).
|
|
|
|
#![forbid(unsafe_code)]
|
|
|
|
pub mod auth;
|
|
pub mod nbfs;
|
|
pub mod nbfx;
|
|
pub mod nmf;
|
|
|
|
pub use auth::AuthError;
|
|
pub use nbfs::{StaticEntry, lookup_static, position_of_static};
|
|
pub use nbfx::{
|
|
DynamicDictionary, NbfxError, NbfxName, NbfxText, NbfxToken, decode_tokens, encode_tokens,
|
|
};
|
|
pub use nmf::{NmfEncoding, NmfError, NmfMode, NmfRecord, NmfRecordType};
|