ystero-dev / hampi

Rust ASN.1 Toolkit
Other
43 stars 18 forks source link

`UTCTime` support #101

Closed ljbade closed 8 months ago

ljbade commented 9 months ago

The 3GPP LPP specification uses a number of UTCTime fields.

Currently after running hampi-rs-asn1c you get a Rust file that can't compile due to errors like:

error: This ASN.1 Type is not supported.
    --> src/lpp_bindings.rs:6507:14
     |
6507 | #[asn(type = "UTCTime")]
     |              ^^^^^^^^^

A quick fix is to replace all instances of UTCTime with UTF8String since time is just a formatted string.

It would be useful if the asn macro recognised UTCTime as a character string in https://github.com/gabhijit/hampi/blob/master/codecs_derive/src/per/mod.rs#L34

I think you should also add IA5String in there too since it is just a superset of Printable/VisibleString types, as well as NumericString

gabhijit commented 9 months ago

@ljbade : Thanks for reporting this. I think it's possible to fix this easily in the code base. Also will take into considerations IA5String suggestion.

gabhijit commented 9 months ago

@ljbade : This looks more like an error in codec, can you please post the full generated structure, so that I can add it as a test case.

gabhijit commented 9 months ago

Implemented in #104 and also added a quick test in this file. You may want to try this with master and if it works for you, you can close this issue.

gabhijit commented 8 months ago

This is available now in crate version 0.6.0.