diff options
author | Björn Gustavsson <[email protected]> | 2013-01-08 10:56:27 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2013-01-23 15:22:56 +0100 |
commit | 74cee7dc1cc5b0332cd851da4953ebbb98224b5f (patch) | |
tree | ff539fdce7055f51fb437bc906358f073d77a620 /lib/asn1/src/asn1rtt_ber.erl | |
parent | 625d2b01dcaa0b15cc9ff7f98438bcd81a5bddc8 (diff) | |
download | otp-74cee7dc1cc5b0332cd851da4953ebbb98224b5f.tar.gz otp-74cee7dc1cc5b0332cd851da4953ebbb98224b5f.tar.bz2 otp-74cee7dc1cc5b0332cd851da4953ebbb98224b5f.zip |
By default, encode BIT STRING to bitstrings
Add the option 'legacy_bit_string' to decode to the old list format.
Diffstat (limited to 'lib/asn1/src/asn1rtt_ber.erl')
-rw-r--r-- | lib/asn1/src/asn1rtt_ber.erl | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/asn1/src/asn1rtt_ber.erl b/lib/asn1/src/asn1rtt_ber.erl index 7998c24465..889a421e4f 100644 --- a/lib/asn1/src/asn1rtt_ber.erl +++ b/lib/asn1/src/asn1rtt_ber.erl @@ -33,6 +33,7 @@ decode_named_bit_string/3, decode_compact_bit_string/3, decode_legacy_bit_string/3, + decode_native_bit_string/3, encode_null/2,decode_null/2, encode_relative_oid/2,decode_relative_oid/2, encode_object_identifier/2,decode_object_identifier/2, @@ -1068,6 +1069,16 @@ decode_legacy_bit_string(Buffer, Range, Tags) -> end, check_restricted_string(Val, length(Val), Range). +decode_native_bit_string(Buffer, Range, Tags) -> + case match_and_collect(Buffer, Tags) of + <<0>> -> + check_restricted_string(<<>>, 0, Range); + <<Unused,Bits/binary>> -> + Size = bit_size(Bits) - Unused, + <<Val:Size/bitstring,_:Unused/bitstring>> = Bits, + check_restricted_string(Val, Size, Range) + end. + decode_named_bit_string(Buffer, NamedNumberList, Tags) -> case match_and_collect(Buffer, Tags) of <<0>> -> |