Documentation
¶
Index ¶
- Constants
- type Bit
- type BitBuffer
- func (b *BitBuffer) Bits() []Bit
- func (b *BitBuffer) ByteLength() int
- func (b *BitBuffer) Bytes() []byte
- func (b *BitBuffer) Error() error
- func (b *BitBuffer) Length() int
- func (b *BitBuffer) PushBit(bit Bit) *BitBuffer
- func (b *BitBuffer) PushBit2(value byte) *BitBuffer
- func (b *BitBuffer) PushBitBuffer(bitBuffer *BitBuffer) *BitBuffer
- func (b *BitBuffer) PushBits(bit []Bit) *BitBuffer
- func (b *BitBuffer) PushBool(bit bool) *BitBuffer
- func (b *BitBuffer) PushByte(byte2 byte, bit_len int) *BitBuffer
- func (b *BitBuffer) PushBytes(buf []byte, bit_len int) *BitBuffer
- func (b *BitBuffer) PushInteger(value uint64, bit_len int) *BitBuffer
- func (b *BitBuffer) Result() ([]byte, error)
- func (b *BitBuffer) ReverseBits() []Bit
- func (b *BitBuffer) SetError(err error) *BitBuffer
- func (b *BitBuffer) SetErrorText(txt string) *BitBuffer
- func (b *BitBuffer) SetErrorTextf(format string, args ...interface{}) *BitBuffer
- func (b *BitBuffer) ShiftBit() Bit
- func (b *BitBuffer) ShiftBits(bit_len int) []Bit
- func (b *BitBuffer) ShiftBool() bool
- func (b *BitBuffer) ShiftByte(bit_len int) byte
- func (b *BitBuffer) ShiftBytes(bit_len int) []byte
- func (b *BitBuffer) ShiftInteger(bit_len int) uint64
- func (b *BitBuffer) String() string
- type Constraint
- type ExprType
- type Flag
- type Marker
- type Member
- type Module
- type Type
- type UperDecoder
- type UperEncoder
Constants ¶
View Source
const ( AMT_TYPE = "AMT_TYPE" //原始 ASN 类型 : {"expr_type":"INTEGER","meta_type":"AMT_TYPE","constraints":{"type":"SIZE_RANG","min":1,"max":255},"Identifier":"Speed"} ASN_TYPE = "ASN_TYPE" //自定义类型 AMT_VALUE = "AMT_VALUE" //数字类型如 ENUMERATED {solid(1), liquid(2), gas(3)} 其中成员 solid 定义: {"expr_type":"A1TC_UNIVERVAL","meta_type":"AMT_VALUE","Identifier":"solid","value":1} )
View Source
const IDENTIFY_EXTENSIBLE = "..."
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BitBuffer ¶
type BitBuffer struct {
// contains filtered or unexported fields
}
func NewBitBuffer ¶
func NewBitBuffer() *BitBuffer
func NewBitBufferFromBytes ¶
func (*BitBuffer) PushBitBuffer ¶
func (*BitBuffer) PushInteger ¶
添加一个指定比特长度的整数
func (*BitBuffer) SetErrorText ¶
外部可设置编码是否出错
func (*BitBuffer) SetErrorTextf ¶
外部可设置编码是否出错
type Constraint ¶
type Constraint struct { Type Type `json:"type"` //SIZE_FIXED SIZE_RANG SIZE_FIXED_AND_EXT SIZE_RANG_AND_EXT REAL_WITH_COMPONENTS //SIZE_FIXED SIZE_FIXED_AND_EXT 定长时包含 Value Value int64 `json:"value"` //SIZE_RANG SIZE_RANG_AND_EXT 变长时包含值范围 Min int64 `json:"min"` Max int64 `json:"max"` //Type 为 REAL_WITH_COMPONENTS 时的约束 Base int `json:"base"` //10 Exponent int `json:"exponent"` //-2 }
type ExprType ¶
type ExprType string
const ( AMT_TYPE_INTEGER ExprType = "INTEGER" AMT_TYPE_BOOLEAN ExprType = "BOOLEAN" AMT_TYPE_CHOICE ExprType = "CHOICE" AMT_TYPE_ENUMERATED ExprType = "ENUMERATED" AMT_TYPE_SEQUENCE ExprType = "SEQUENCE" AMT_TYPE_IA5String ExprType = "IA5String" AMT_TYPE_OCTET_STRING ExprType = "OCTET_STRING" AMT_TYPE_BIT_STRING ExprType = "BIT_STRING" AMT_TYPE_REAL ExprType = "REAL" AMT_TYPE_SEQUENCE_OF ExprType = "SEQUENCE_OF" )
type Member ¶
type Member struct { Members []Member `json:"members,omitempty"` //包含的字段 ExprType ExprType `json:"expr_type"` // AMT_TYPE 类型 INTEGER,BOOLEAN,CHOICE,ENUMERATED,SEQUENCE,IA5String,OCTET_STRING,BIT_STRING,REAL,SEQUENCE_OF MetaType string `json:"meta_type"` // AMT_TYPE(原始 ASN 类型) ASN_TYPE(自定义类型) AMT_VALUE(数字类型如 ENUMERATED {solid(1), liquid(2), gas(3)}) Constraints *Constraint `json:"constraints,omitempty"` //约束 Identifier string `json:"Identifier"` //字段名称,注意标识符为 ...(IDENTIFY_EXTENSIBLE) 时需特殊处理扩展的情况 Marker *Marker `json:"marker,omitempty"` //"marker": { "flags": "EM_OPTIONAL" } Value int `json:"value"` //meta_type 为 AMT_VALUE 需要处理该字段,若没设置时,value 为 -1 }
func (Member) MemberCountBitLength ¶
非扩展的成员数量需要的编码 bit_len
type Type ¶
type Type string
const ( SIZE_FIXED Type = "SIZE_FIXED" //定长 SIZE(5) SIZE_RANG Type = "SIZE_RANG" //变长 SIZE(1..8) SIZE_FIXED_AND_EXT Type = "SIZE_FIXED_AND_EXT" //定长可扩展 SIZE(5,...) Max==Min SIZE_RANG_AND_EXT Type = "SIZE_RANG_AND_EXT" //变长可扩展 SIZE(1..7,...) //暂时没有这个 REAL_WITH_COMPONENTS Type = "REAL_WITH_COMPONENTS" //Type 为 REAL_WITH_COMPONENTS 时包含 Base 和 Exponent 约束 )
type UperDecoder ¶
type UperDecoder interface {
UperDecode(buffer *BitBuffer)
}
type UperEncoder ¶
type UperEncoder interface {
UperEncode() *BitBuffer
}
Click to show internal directories.
Click to hide internal directories.