数据结构
AsnDesc
ASN.1数据描述符。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | typedef struct AsnDesc { uint16_t id; /* 描述符的唯一索引 */ uint16_t attrs; /* 类型属性(bitmap形式),见#AsnDescAttr */ uint32_t limit; /* 成员数组或字符数组的大小限制 */ uint32_t nmem; /* 成员总个数 */ AsnDescInfo i; /* 类型描述信息 */ uint8_t extNum; /* 扩展成员个数 */ uint8_t reserved; /* 保留字段 */ size_t size; /* 该类型成员大小 */ AsnDescMember m; /* 成员列表 */ AsnConstraint cstr; /* 约束 */ AsnLocalTag localTag; /* 局部标签信息 */ AsnBuiltinType asn1Type; /* ASN1内置支持类型 */ /* ASN1协议文本中的类型名(匿名类型使用成员名称)。注意:该名字非唯一 */ AsnNameValue name; AsnDescNameValue nameValues; ASN_ENC_FUNC enc; /* 编码函数 */ ASN_DEC_FUNC dec; /* 解码函数 */ uintptr_t reservedArr[4]; } AsnDescriptor; |
AsnBuf
编解码缓冲区结构体。
1 2 3 4 5 6 7 8 | typedef struct { uint8_t *buf; /* 缓冲区的起始地址 */ uint32_t bufLen; /* 缓冲区的长度(单位:byte) */ union { uint32_t bitIdx; /* 缓冲区当前的比特下标,在BER/DER/PER中使用 */ uint32_t byteIdx; /* 缓冲区当前的字节下标,仅在XER中使用 */ }; } AsnBuf; |
AsnCtx
ASN1上下文结构体。
1 2 3 4 5 6 7 8 9 | typedef struct { AsnBuf *buf; /* 编码缓冲区结构体 */ uint32_t ret; /* 错误码 #AsnErrors */ uint8_t method; /* ASN1编解码方法 #AsnCodecMethod */ uint8_t level; /* 成员层级,可以辅助格式化 */ uint16_t reserved; /* 保留字段 */ AsnLocalTag *localTag; /* 局部标签信息 */ uintptr_t reservedArr[4]; } AsnCtx; |
父主题: KSL_ASN1库函数说明