Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ASCII = Prefixers{
Fixed: &asciiFixedPrefixer{},
L: &asciiVarPrefixer{1},
LL: &asciiVarPrefixer{2},
LLL: &asciiVarPrefixer{3},
LLLL: &asciiVarPrefixer{4},
LLLLL: &asciiVarPrefixer{5},
LLLLLL: &asciiVarPrefixer{6},
}
var BCD = Prefixers{
Fixed: &bcdFixedPrefixer{},
L: &bcdVarPrefixer{1},
LL: &bcdVarPrefixer{2},
LLL: &bcdVarPrefixer{3},
LLLL: &bcdVarPrefixer{4},
LLLLL: &bcdVarPrefixer{5},
LLLLLL: &bcdVarPrefixer{6},
}
var BerTLV = &berTLVPrefixer{}
BerTLV encodes and decodes the length of BER-TLV fields based on the following rules:
Short Form: When the most-significant bit is off, the length field consists of only one byte in which the right-most 7 bits contain the number of bytes in the Value field, as an unsigned binary integer. This form of the Length field supports data lengths of 127 bytes. For example, a Length value of 126 can be encoded as binary 01111110 (hexadecimal equivalent of 7E).
Long Form: When the most-significant bit is on, the Length field consists of an initial byte and one or more subsequent bytes. The right-most 7 bits of the initial byte contain the number of subsequent bytes in the Length field, as an unsigned binary integer. All bits of the subsequent bytes contain an unsigned big-endian binary integer equal to the number of bytes in the Value field. For example, a Length value of 254 can be encoded as binary 10000001 11111110 (hexadecimal equivalent of 81FE).
var Binary = Prefixers{
Fixed: &binaryFixedPrefixer{},
L: &binaryVarPrefixer{1},
LL: &binaryVarPrefixer{2},
LLL: &binaryVarPrefixer{3},
LLLL: &binaryVarPrefixer{4},
LLLLL: &binaryVarPrefixer{5},
LLLLLL: &binaryVarPrefixer{6},
}
var EBCDIC = Prefixers{
Fixed: &ebcdicFixedPrefixer{},
L: &ebcdicVarPrefixer{1},
LL: &ebcdicVarPrefixer{2},
LLL: &ebcdicVarPrefixer{3},
LLLL: &ebcdicVarPrefixer{4},
LLLLL: &ebcdicVarPrefixer{5},
LLLLLL: &ebcdicVarPrefixer{6},
}
var EBCDIC1047 = Prefixers{
Fixed: &ebcdic1047FixedPrefixer{},
L: &ebcdic1047Prefixer{1},
LL: &ebcdic1047Prefixer{2},
LLL: &ebcdic1047Prefixer{3},
LLLL: &ebcdic1047Prefixer{4},
LLLLL: &ebcdic1047Prefixer{5},
LLLLLL: &ebcdic1047Prefixer{6},
}
var Hex = Prefixers{
Fixed: &hexFixedPrefixer{},
L: &hexVarPrefixer{1},
LL: &hexVarPrefixer{2},
LLL: &hexVarPrefixer{3},
LLLL: &hexVarPrefixer{4},
LLLLL: &hexVarPrefixer{5},
LLLLLL: &hexVarPrefixer{6},
}
var None = Prefixers{
Fixed: &nonePrefixer{},
}
Functions ¶
This section is empty.
Types ¶
type Prefixer ¶
type Prefixer interface { // Returns field length encoded into []byte EncodeLength(maxLen, length int) ([]byte, error) // Returns the size of the field (number of characters, HEX-digits, bytes) // as well as the number of bytes read to decode the length DecodeLength(maxLen int, data []byte) (length int, read int, err error) // Returns human readable information about length prefixer. Returned value // is used to create prefixer when we build spec from a JSON spec. // Returned value should be in the following format: // PrefixerName.Length // Examples: // ASCII.LL // Hex.Fixed Inspect() string }