Skip to main content

Crate oxirush_utils

Crate oxirush_utils 

Source
Expand description

What the OxiRush crates share: the identities of 3GPP networks as values, and one tree with paths for the messages of every family. no_std, without a dependency unless a feature asks for one.

use oxirush_utils::identity::{Guti5g, Plmn};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let plmn: Plmn = "310-410".parse()?;
    let guti = Guti5g::new(plmn, 0xca, 0x3fe, 0x01, 0xdead_beef)?;

    // The three octets of a PLMN in a NAS message, and in an NGAP or S1AP message
    println!("{plmn}: {:02x?} in NAS, {:02x?} in NGAP", plmn.to_nas_octets(), plmn.to_ap_octets());

    // A 5G-GUTI as text, and as a 5GS mobile identity
    println!("{guti}: {:02x?}", guti.to_nas_octets());
    Ok(())
}
310-410: [13, 00, 14] in NAS, [13, 40, 01] in NGAP
5g-guti-310410caff81deadbeef: [f2, 13, 00, 14, ca, ff, 81, de, ad, be, ef]

§Tasks

The README has an example of each, with what it prints, except the rules of a family of messages: the documentation of tree::Family has theirs.

TaskItems
An identity through its formsImsi, Plmn, ImsiSuci, Supi, Guti5g, STmsi5g
IMEI, IMEISV, and the identities of EPSImei, Imeisv, GutiEps, Tai5gs, TaiEps
The SUCI in the form of a NAINaiSuci, nai::check_realm
What other implementations sendImeisv::from_nas_octets_tolerant, Fault
A type as a treetree::Tree, tree!, tree::to_value, tree::from_value
Pathstree::select, tree::paths, tree::set, tree::insert, tree::remove
The rules of a family of messagestree::Family, tree::select_in, tree::written_as
Any format of serdeimpl_serde!

§Modules

ModuleHasFeature
identityThe PLMN with its two codings, TBCD digits, IMSI, IMEI, IMEISV, the SUPI with its type, the SUCI of an IMSI and the SUCI in the form of a NAI with the grammar of a NAI, the GUTI and the S-TMSI of 5GS and of EPS, the tracking area identities, the types of identitynone
treeThe tree of a message as a JSON value that keeps the order of its members, and tree! that writes one: the forms of the plain values, the writer and the reader of members, and paths with select, paths, set, remove, inserttree
tree::serdeSerialize and Deserialize for a type through its treeserde

The crate is no_std with alloc, has no dependency without a feature, and no unsafe. With the feature idna, the realm and the username of a NAI are also checked as internationalized names (see identity::nai::check_realm).

A tree keeps the order of the specification by itself: the crate turns on no feature of serde_json that orders a map, and the JSON of a program that depends on it keeps the order that the program chose.

§The OxiRush family

Modules§

identity
The identities of 3GPP networks as values: what every family of messages holds and prints the same way.
treetree
One tree for the messages of every family: the tree of a value as JSON, the forms of its plain values, and paths into it.

Macros§

impl_serdeserde and tree
Serialize and Deserialize for each of the types named, which are Tree: through their tree, with serialize and deserialize.
treetree
A tree::Value written as JSON, as serde_json::json! writes one, whose objects keep their members in the order in which they are written. A value in it is a literal or any expression that converts into a tree, which it takes as a call takes its argument: a variable that holds a tree moves into it, and is given by reference to stay where it is (&name); a name is a string literal or an expression, as a variable, that converts into a String.