上结果,使用ASN_SEQUENCE_ADD和ASN_STRUCT_FREE_CONTENTS_ONLY搭配使用。

示例:
asn.1文件

Example 
DEFINITIONS AUTOMATIC TAGS ::= 
BEGIN 

StructWList ::= SEQUENCE OF ListItem 
ListItem ::= INTEGER 
END

操作程序代码

int main()
 {
    ListItem_t *li = nullptr;
   StructWList_t swl = {0};

    swl.list.count = 0;
    swl.list.size = 0;
    li = reinterpret_cast<ListItem_t*>(calloc(1, sizeof *li));
    *li = i;
    ASN_SEQUENCE_ADD(&swl, li);
    ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_StructWList, &swl);
 }

来源:
https://stackoverflow.com/questions/56019134/how-to-correctly-use-and-free-asn1c-sequence-of

本文链接地址:https://const.net.cn/429.html

标签: none

添加新评论