#notation #syntax #asn #abstract #itu-t #basic #technology

x680

ITU-T X.680 - Information technology – Abstract Syntax Notation One (ASN.1): Specification of basic notation

1 unstable release

0.0.1 Jan 12, 2019

#19 in #asn

GPL-2.0-or-later

2KB

Work In Progress

Goal

Final Syntax TBD

x680!(r#"
FooProtocol DEFINITIONS ::= BEGIN
FooQuestion ::= SEQUENCE {
    trackingNumber INTEGER,
    question       IA5String
}
FooAnswer ::= SEQUENCE {
    questionNumber INTEGER,
    answer         BOOLEAN
}
END
"#)

der_decode!(fq, FooProtocol::FooQuestion)
der_encode!(fa, FooProtocol::FooAnswer)

fn answer_question(buffer: &[u8]) -> Vec<u8> {
    let buffer: &[u8] = ...
    let question: FooQuestion = fq(buffer).unwrap();
        let answer = FooProtocol::FooAnswer {
        questionNumber: 1,
        answer: true
    }
    return fa(answer).unwrap()
}

No runtime deps