rasn 0.3.0 #13
XAMPPRocky
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone, I'm proud to announce the
0.3.0
ofrasn
!rasn
is a#[no_std]
codec framework for the ASN.1 data model and encoding rules. Allowing you to safely and easily parse data formats such as BER, CER, and DER in safe Rust.Sponsorship
Work on rasn is funded through the support of contributors on GitHub Sponsors. If you would like support work on rasn, tokei, or my other open source projects, contributions are always welcome, appreciated, and make a direct impact on my ability to build new projects as well support existing ones.
New Crates
This release was focused on building implementations of standards that use these formats as their underlying protocol, which is why I'm also happy to announce the release of three new sibling crates,
rasn-smi
,rasn-mib
, andrasn-snmp
. These crates provide the types needed to be able to decode and encode Simple Network Management Protocol (SNMP) messages, SMI object syntax, and MIB objects. It's important to note that this does not contain a implementation of an SNMP proxy or manager, but provides the data types needed to build one. Likerasn
, these crates are entirely#[no_std]
and are transport-layer and encoding rule agnostic written in 100% safe Rust.As an example, let's say we wanted to store our SNMPv2c messages containing SNMPv2 Protocol Data Units (PDUs), but we wanted to ensure when is saved it is encoded in DER so that it is "canonical" (meaning the same value always produces the same encoding), but we need to be able to accept messages in BER. Here's how you'd write that with
rasn
.That's it! All the complexity in encoding and decoding is completely abstracted by the types, letting us focus on the actual implementation of our agent.
With this release, the initial set of Management Information Base (MIB) objects covers the most of what was defined in RFC 3418. Contributions adding more MIB objects from IETF RFCs are both welcome and appreciated.
New Additions
[T; N]
array types forAsnType
,Decode
, andEncode
.Oid
type which is reference type equivalent forObjectIdentifier
, andConstOid
, which allows you to define object identifiers inconst
contexts.#[rasn(delegate)]
container attribute which is accepted on single value newtype structs (e.g.struct Foo(u8);
). This will cause the implementation of of any of the derive macros to directly encode and decode the inner type, and to ignore the wrapper.#[rasn(choice)]
field attribute which specifies to decode a given field as aCHOICE
type.#[rasn(default)]
field attribute which will use theDefault
value if it cannot parse the given field.Incomplete
error variant tode::Error
that provides how many more bytes are needed to potentially decode the message.ExceedsMaxLength
error variant tode::Error
that provides an error when a list-like type (SEQUENCE OF
) is encoded correctly but it's length exceeds the maximum allowed by the type.Breaking Changes
Decoder::decode_sequence
, no longer returns aDeocder
and instead accepts aFnOnce(Decoder) -> Result<Self>
function to decode the sequence. This is needed in order to correctly handle nested indefinite length sequences in CER.This discussion was created from the release rasn 0.3.0.
Beta Was this translation helpful? Give feedback.
All reactions