idm-frame 1.0.0

ITU-T Recommendation X.519 IDM Frame Decoding and Encoding
Documentation
  • Coverage
  • 100%
    27 out of 27 items documented1 out of 8 items with examples
  • Size
  • Source code size: 17.59 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 505.24 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • JonathanWilbur

IDM Frame Utilities

ITU-T Recommendation X.519 (2019) defines a protocol, Internet Directly-Mapped (IDM) Protocol, which is used to provide the OSI ROSE service and all lower layers of the OSI networking stack over TCP/IP, specifically for the purpose of making the X.500 directory easily available over the Internet.

There are two versions of the IDM protocol defined. This crate supports both. The second version supports negotiation of the transfer syntax, whereas the first uses the Basic Encoding Rules (BER).

This crate does not handle decoding of the contained IDM-PDU ASN.1 data structure: it only handles the frames.

This crate

This crate is no_std and does not require alloc, except for running the tests. This crate was not written in any part by AI or LLMs. This crate was fuzz-tested. It has no dependencies. Extremely simple and light-weight.

Usage

To read an IDM frame, simply create an IdmFrameIter, and iterate over it one or more times.

let buffer: Vec<u8> = Vec::from([
    1, 1, 0, 0, 0, 5, 1, 2, 3, 4, 5,
].as_slice());
let mut frames = IdmFrameIter::new(buffer.as_slice());
let frame = frames.next()
  .expect("uh oh, no frame")
  .expect("uh oh, unrecognized / unsupported version");
assert_eq!(frame.version, 1);
assert_eq!(frame.final_, 1);
assert_eq!(frame.encoding, 0);
assert_eq!(frame.data, [1,2,3,4,5].as_slice());

This crate also provides two fairly trivial functions for helping you write valid IDM frames: write_idm_v1_frame_header and write_idm_v2_frame_header. These can be used like so:

let mut buf: [u8; IDMV2_FRAME_SIZE] = [0, 0, 0, 0, 0, 0, 0, 0];
write_idm_v2_frame_header(&mut buf, true, IDM_ENCODING_XER, 1024);
assert_eq!(buf, [2, 1, 0x10, 0, 0, 0, 4, 0]);

Cheers!