ms-ndr 0.1.0

Pure-Rust NDR (Network Data Representation) marshaling — the DCE/RPC transfer syntax (MS-RPCE, little-endian): aligned primitives, conformant & varying arrays, unique (referent) pointers, and conformant-varying UTF-16 strings. No FFI.
Documentation
  • Coverage
  • 30.3%
    10 out of 33 items documented0 out of 28 items with examples
  • Size
  • Source code size: 12.6 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 473.6 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 5s Average build duration of successful builds.
  • all releases: 6s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • icedracon

ms-ndr

Pure-Rust NDR (Network Data Representation) marshaling — the DCE/RPC transfer syntax (MS-RPCE), little-endian. No FFI, no unsafe.

This is the foundation layer every MS-RPCE interface rides on. It turns Rust values into NDR bytes and back; it knows nothing about transports, PDUs, or specific interfaces.

What it covers

  • Aligned primitives (u8/u16/u32/u64, uuid) — alignment relative to the start of the stub buffer, matching the NDR rule that an aggregate aligns to its largest member.
  • Unique (referent) pointers — fresh referent ids from 0x00020000, stepping by 4.
  • Conformant + varying UTF-16 strings — the [size_is][length_is] wchar payload used by RPC_UNICODE_STRING.
  • Raw byte reads for fixed context handles / tower blobs.

Usage

use ms_ndr::{NdrEncoder, NdrDecoder};

let mut e = NdrEncoder::new();
e.u32(0x1234);
e.conformant_varying_wstr("HOSTNAME");
let stub = e.into_bytes();

let mut d = NdrDecoder::new(&stub);
let n = d.u32()?;
let name = d.conformant_varying_wstr()?;
# Ok::<(), ms_ndr::NdrError>(())

Extracted from and used by dcerpc.

License

MIT