class
ASN1::BER::Length
- ASN1::BER::Length
- BinData
- Reference
- Object
Overview
The length octets of a BER element: short form, long form, or the indefinite
marker. The decoded byte count is exposed as #length.
Defined in:
bindata/asn1/length.crConstant Summary
-
AFTER_DESERIALIZE =
[] of Nil -
The length octets of a BER element: short form, long form, or the indefinite marker. The decoded byte count is exposed as
#length. -
BEFORE_SERIALIZE =
[] of Nil -
The length octets of a BER element: short form, long form, or the indefinite marker. The decoded byte count is exposed as
#length. -
ENDIAN =
["big"] -
The length octets of a BER element: short form, long form, or the indefinite marker. The decoded byte count is exposed as
#length. -
KLASS_NAME =
[ASN1::BER::Length] -
The length octets of a BER element: short form, long form, or the indefinite marker. The decoded byte count is exposed as
#length. -
PARTS =
[{type: "bitfield", name: 2, cls: ASN1::BER::Length, onlyif: nil, verify: nil, endian: IO::ByteFormat::BigEndian}, {type: "array", name: long_bytes, cls: UInt8, onlyif: nil, verify: nil, length: -> do if long && !indefinite? if length_indicator > 4 raise("invalid ASN.1 BER length. Number of length bytes: #{length_indicator}") end 0 | length_indicator else 0 end end, value: nil}] of Nil -
The length octets of a BER element: short form, long form, or the indefinite marker. The decoded byte count is exposed as
#length. -
REMAINING =
[] of Nil -
The length octets of a BER element: short form, long form, or the indefinite marker. The decoded byte count is exposed as
#length.
Class Method Summary
-
.bit_fields
The length octets of a BER element: short form, long form, or the indefinite marker.
Macro Summary
-
asn1_ber(name, onlyif = nil, verify = nil, value = nil)
The length octets of a BER element: short form, long form, or the indefinite marker.
-
asn1_ber_extended_identifier(name, onlyif = nil, verify = nil, value = nil)
The length octets of a BER element: short form, long form, or the indefinite marker.
-
asn1_ber_identifier(name, onlyif = nil, verify = nil, value = nil)
The length octets of a BER element: short form, long form, or the indefinite marker.
-
asn1_ber_length(name, onlyif = nil, verify = nil, value = nil)
The length octets of a BER element: short form, long form, or the indefinite marker.
-
ber(name, onlyif = nil, verify = nil, value = nil)
The length octets of a BER element: short form, long form, or the indefinite marker.
Instance Method Summary
-
#__format__ : IO::ByteFormat
A
groupcaptures the endianness at its declaration point, so declaringendianafter one would silently leave it system-endian. - #indefinite?
-
#length : Int32
We can pretty much safely assume no protocol is implementing more than positive Int32 length datagrams
-
#length=(length : Int32)
We can pretty much safely assume no protocol is implementing more than positive Int32 length datagrams
- #length_indicator : UInt8
- #length_indicator=(length_indicator : UInt8)
- #long : Bool
- #long=(long : UInt8)
- #long=(value : Bool)
- #long_bytes : Array(UInt8)
- #long_bytes=(long_bytes : Array(UInt8))
-
#read(io : IO) : IO
Reads the fields of this instance from io, in declaration order, and returns io.
-
#write(io : IO)
Writes the fields of this instance to io in declaration order.
Instance methods inherited from class BinData
__format__ : IO::ByteFormat
__format__,
read(io : IO) : IO
read,
to_io(io : IO, format : IO::ByteFormat = IO::ByteFormat::SystemEndian)
to_io,
to_s(io)
to_s,
to_slice
to_slice,
write(io : IO)
write
Class methods inherited from class BinData
bit_fields
bit_fields,
from_io(io : IO, format : IO::ByteFormat = IO::ByteFormat::SystemEndian)
from_io,
from_slice(bytes : Slice, format : IO::ByteFormat = IO::ByteFormat::SystemEndian)
from_slice
Macros inherited from class BinData
__add_enum_field(name, cls, onlyif, verify, value, encoding, enum_type)
__add_enum_field,
__build_methods__
__build_methods__,
after_deserialize(&block)
after_deserialize,
array(name, length, onlyif = nil, verify = nil, value = nil)
array,
before_serialize(&block)
before_serialize,
bit_field(onlyif = nil, verify = nil, endian = nil, &block)
bit_field,
bits(size, name, value = nil, default = nil)
bits,
bool(name, default = false)
bool,
bytes(name, length, onlyif = nil, verify = nil, value = nil, default = nil)
bytes,
custom(name, onlyif = nil, verify = nil, value = nil)
custom,
endian(format)
endian,
enum_bits(size, name)
enum_bits,
enum_field(size, name, onlyif = nil, verify = nil, value = nil)
enum_field,
field(type_declaration, onlyif = nil, verify = nil, value = nil, length = nil, read_next = nil, encoding = nil, endian = nil)
field,
float32(name, onlyif = nil, verify = nil, value = nil, default = nil)
float32,
float32be(name, onlyif = nil, verify = nil, value = nil, default = nil)
float32be,
float32le(name, onlyif = nil, verify = nil, value = nil, default = nil)
float32le,
float64(name, onlyif = nil, verify = nil, value = nil, default = nil)
float64,
float64be(name, onlyif = nil, verify = nil, value = nil, default = nil)
float64be,
float64le(name, onlyif = nil, verify = nil, value = nil, default = nil)
float64le,
group(name, onlyif = nil, verify = nil, value = nil, &block)
group,
int128(name, onlyif = nil, verify = nil, value = nil, default = nil)
int128,
int128be(name, onlyif = nil, verify = nil, value = nil, default = nil)
int128be,
int128le(name, onlyif = nil, verify = nil, value = nil, default = nil)
int128le,
int16(name, onlyif = nil, verify = nil, value = nil, default = nil)
int16,
int16be(name, onlyif = nil, verify = nil, value = nil, default = nil)
int16be,
int16le(name, onlyif = nil, verify = nil, value = nil, default = nil)
int16le,
int32(name, onlyif = nil, verify = nil, value = nil, default = nil)
int32,
int32be(name, onlyif = nil, verify = nil, value = nil, default = nil)
int32be,
int32le(name, onlyif = nil, verify = nil, value = nil, default = nil)
int32le,
int64(name, onlyif = nil, verify = nil, value = nil, default = nil)
int64,
int64be(name, onlyif = nil, verify = nil, value = nil, default = nil)
int64be,
int64le(name, onlyif = nil, verify = nil, value = nil, default = nil)
int64le,
int8(name, onlyif = nil, verify = nil, value = nil, default = nil)
int8,
int8be(name, onlyif = nil, verify = nil, value = nil, default = nil)
int8be,
int8le(name, onlyif = nil, verify = nil, value = nil, default = nil)
int8le,
remaining_bytes(name, onlyif = nil, verify = nil, default = nil)
remaining_bytes,
skip(length, onlyif = nil, verify = nil)
skip,
string(name, onlyif = nil, verify = nil, length = nil, value = nil, encoding = nil, default = nil)
string,
uint128(name, onlyif = nil, verify = nil, value = nil, default = nil)
uint128,
uint128be(name, onlyif = nil, verify = nil, value = nil, default = nil)
uint128be,
uint128le(name, onlyif = nil, verify = nil, value = nil, default = nil)
uint128le,
uint16(name, onlyif = nil, verify = nil, value = nil, default = nil)
uint16,
uint16be(name, onlyif = nil, verify = nil, value = nil, default = nil)
uint16be,
uint16le(name, onlyif = nil, verify = nil, value = nil, default = nil)
uint16le,
uint32(name, onlyif = nil, verify = nil, value = nil, default = nil)
uint32,
uint32be(name, onlyif = nil, verify = nil, value = nil, default = nil)
uint32be,
uint32le(name, onlyif = nil, verify = nil, value = nil, default = nil)
uint32le,
uint64(name, onlyif = nil, verify = nil, value = nil, default = nil)
uint64,
uint64be(name, onlyif = nil, verify = nil, value = nil, default = nil)
uint64be,
uint64le(name, onlyif = nil, verify = nil, value = nil, default = nil)
uint64le,
uint8(name, onlyif = nil, verify = nil, value = nil, default = nil)
uint8,
uint8be(name, onlyif = nil, verify = nil, value = nil, default = nil)
uint8be,
uint8le(name, onlyif = nil, verify = nil, value = nil, default = nil)
uint8le,
variable_array(name, read_next, onlyif = nil, verify = nil, value = nil)
variable_array
Class Method Detail
The length octets of a BER element: short form, long form, or the indefinite
marker. The decoded byte count is exposed as #length.
Macro Detail
The length octets of a BER element: short form, long form, or the indefinite
marker. The decoded byte count is exposed as #length.
The length octets of a BER element: short form, long form, or the indefinite
marker. The decoded byte count is exposed as #length.
The length octets of a BER element: short form, long form, or the indefinite
marker. The decoded byte count is exposed as #length.
The length octets of a BER element: short form, long form, or the indefinite
marker. The decoded byte count is exposed as #length.
The length octets of a BER element: short form, long form, or the indefinite
marker. The decoded byte count is exposed as #length.
Instance Method Detail
A group captures the endianness at its declaration point, so declaring
endian after one would silently leave it system-endian. Fail loudly.
We can pretty much safely assume no protocol is implementing more than positive Int32 length datagrams
We can pretty much safely assume no protocol is implementing more than positive Int32 length datagrams
Reads the fields of this instance from io, in declaration order, and
returns io. Raises BinData::ParseError (or BinData::VerificationException)
on malformed input.
Writes the fields of this instance to io in declaration order. Raises
BinData::WriteError (or BinData::VerificationException) on failure.