加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
FactoryVersion.c 10.19 KB
一键复制 编辑 原始数据 按行查看 历史
eomer 提交于 2019-11-12 10:34 . init repo
/*
* Generated by asn1c-0.9.28 (http://lionet.info/asn1c)
* From ASN.1 module "DLT69845"
* found in "dlt698.45.asn1"
* `asn1c -gen-PER -pdu=all`
*/
#include "FactoryVersion.h"
static int check_permitted_alphabet_2(const void *sptr) {
/* The underlying type is VisibleString */
const VisibleString_t *st = (const VisibleString_t *)sptr;
const uint8_t *ch = st->buf;
const uint8_t *end = ch + st->size;
for(; ch < end; ch++) {
uint8_t cv = *ch;
if(!(cv >= 32 && cv <= 126)) return -1;
}
return 0;
}
static int check_permitted_alphabet_3(const void *sptr) {
/* The underlying type is VisibleString */
const VisibleString_t *st = (const VisibleString_t *)sptr;
const uint8_t *ch = st->buf;
const uint8_t *end = ch + st->size;
for(; ch < end; ch++) {
uint8_t cv = *ch;
if(!(cv >= 32 && cv <= 126)) return -1;
}
return 0;
}
static int check_permitted_alphabet_4(const void *sptr) {
/* The underlying type is VisibleString */
const VisibleString_t *st = (const VisibleString_t *)sptr;
const uint8_t *ch = st->buf;
const uint8_t *end = ch + st->size;
for(; ch < end; ch++) {
uint8_t cv = *ch;
if(!(cv >= 32 && cv <= 126)) return -1;
}
return 0;
}
static int check_permitted_alphabet_5(const void *sptr) {
/* The underlying type is VisibleString */
const VisibleString_t *st = (const VisibleString_t *)sptr;
const uint8_t *ch = st->buf;
const uint8_t *end = ch + st->size;
for(; ch < end; ch++) {
uint8_t cv = *ch;
if(!(cv >= 32 && cv <= 126)) return -1;
}
return 0;
}
static int check_permitted_alphabet_6(const void *sptr) {
/* The underlying type is VisibleString */
const VisibleString_t *st = (const VisibleString_t *)sptr;
const uint8_t *ch = st->buf;
const uint8_t *end = ch + st->size;
for(; ch < end; ch++) {
uint8_t cv = *ch;
if(!(cv >= 32 && cv <= 126)) return -1;
}
return 0;
}
static int check_permitted_alphabet_7(const void *sptr) {
/* The underlying type is VisibleString */
const VisibleString_t *st = (const VisibleString_t *)sptr;
const uint8_t *ch = st->buf;
const uint8_t *end = ch + st->size;
for(; ch < end; ch++) {
uint8_t cv = *ch;
if(!(cv >= 32 && cv <= 126)) return -1;
}
return 0;
}
static int
memb_vendorCode_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
const VisibleString_t *st = (const VisibleString_t *)sptr;
size_t size;
if(!sptr) {
ASN__CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
size = st->size;
if((size == 4)
&& !check_permitted_alphabet_2(st)) {
/* Constraint check succeeded */
return 0;
} else {
ASN__CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}
static int
memb_softVerCode_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
const VisibleString_t *st = (const VisibleString_t *)sptr;
size_t size;
if(!sptr) {
ASN__CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
size = st->size;
if((size == 4)
&& !check_permitted_alphabet_3(st)) {
/* Constraint check succeeded */
return 0;
} else {
ASN__CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}
static int
memb_softverDate_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
const VisibleString_t *st = (const VisibleString_t *)sptr;
size_t size;
if(!sptr) {
ASN__CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
size = st->size;
if((size == 6)
&& !check_permitted_alphabet_4(st)) {
/* Constraint check succeeded */
return 0;
} else {
ASN__CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}
static int
memb_hardVerCode_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
const VisibleString_t *st = (const VisibleString_t *)sptr;
size_t size;
if(!sptr) {
ASN__CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
size = st->size;
if((size == 4)
&& !check_permitted_alphabet_5(st)) {
/* Constraint check succeeded */
return 0;
} else {
ASN__CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}
static int
memb_hardVerDate_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
const VisibleString_t *st = (const VisibleString_t *)sptr;
size_t size;
if(!sptr) {
ASN__CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
size = st->size;
if((size == 6)
&& !check_permitted_alphabet_6(st)) {
/* Constraint check succeeded */
return 0;
} else {
ASN__CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}
static int
memb_vendorExtInfo_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
const VisibleString_t *st = (const VisibleString_t *)sptr;
size_t size;
if(!sptr) {
ASN__CTFAIL(app_key, td, sptr,
"%s: value not given (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
size = st->size;
if((size == 8)
&& !check_permitted_alphabet_7(st)) {
/* Constraint check succeeded */
return 0;
} else {
ASN__CTFAIL(app_key, td, sptr,
"%s: constraint failed (%s:%d)",
td->name, __FILE__, __LINE__);
return -1;
}
}
static asn_per_constraints_t asn_PER_memb_vendorCode_constr_2 GCC_NOTUSED = {
{ APC_CONSTRAINED, 7, 7, 32, 126 } /* (32..126) */,
{ APC_CONSTRAINED, 0, 0, 4, 4 } /* (SIZE(4..4)) */,
0, 0 /* No PER character map necessary */
};
static asn_per_constraints_t asn_PER_memb_softVerCode_constr_3 GCC_NOTUSED = {
{ APC_CONSTRAINED, 7, 7, 32, 126 } /* (32..126) */,
{ APC_CONSTRAINED, 0, 0, 4, 4 } /* (SIZE(4..4)) */,
0, 0 /* No PER character map necessary */
};
static asn_per_constraints_t asn_PER_memb_softverDate_constr_4 GCC_NOTUSED = {
{ APC_CONSTRAINED, 7, 7, 32, 126 } /* (32..126) */,
{ APC_CONSTRAINED, 0, 0, 6, 6 } /* (SIZE(6..6)) */,
0, 0 /* No PER character map necessary */
};
static asn_per_constraints_t asn_PER_memb_hardVerCode_constr_5 GCC_NOTUSED = {
{ APC_CONSTRAINED, 7, 7, 32, 126 } /* (32..126) */,
{ APC_CONSTRAINED, 0, 0, 4, 4 } /* (SIZE(4..4)) */,
0, 0 /* No PER character map necessary */
};
static asn_per_constraints_t asn_PER_memb_hardVerDate_constr_6 GCC_NOTUSED = {
{ APC_CONSTRAINED, 7, 7, 32, 126 } /* (32..126) */,
{ APC_CONSTRAINED, 0, 0, 6, 6 } /* (SIZE(6..6)) */,
0, 0 /* No PER character map necessary */
};
static asn_per_constraints_t asn_PER_memb_vendorExtInfo_constr_7 GCC_NOTUSED = {
{ APC_CONSTRAINED, 7, 7, 32, 126 } /* (32..126) */,
{ APC_CONSTRAINED, 0, 0, 8, 8 } /* (SIZE(8..8)) */,
0, 0 /* No PER character map necessary */
};
static asn_TYPE_member_t asn_MBR_FactoryVersion_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct FactoryVersion, vendorCode),
(ASN_TAG_CLASS_UNIVERSAL | (26 << 2)),
0,
&asn_DEF_VisibleString,
memb_vendorCode_constraint_1,
&asn_PER_memb_vendorCode_constr_2,
0,
"vendorCode"
},
{ ATF_NOFLAGS, 0, offsetof(struct FactoryVersion, softVerCode),
(ASN_TAG_CLASS_UNIVERSAL | (26 << 2)),
0,
&asn_DEF_VisibleString,
memb_softVerCode_constraint_1,
&asn_PER_memb_softVerCode_constr_3,
0,
"softVerCode"
},
{ ATF_NOFLAGS, 0, offsetof(struct FactoryVersion, softverDate),
(ASN_TAG_CLASS_UNIVERSAL | (26 << 2)),
0,
&asn_DEF_VisibleString,
memb_softverDate_constraint_1,
&asn_PER_memb_softverDate_constr_4,
0,
"softverDate"
},
{ ATF_NOFLAGS, 0, offsetof(struct FactoryVersion, hardVerCode),
(ASN_TAG_CLASS_UNIVERSAL | (26 << 2)),
0,
&asn_DEF_VisibleString,
memb_hardVerCode_constraint_1,
&asn_PER_memb_hardVerCode_constr_5,
0,
"hardVerCode"
},
{ ATF_NOFLAGS, 0, offsetof(struct FactoryVersion, hardVerDate),
(ASN_TAG_CLASS_UNIVERSAL | (26 << 2)),
0,
&asn_DEF_VisibleString,
memb_hardVerDate_constraint_1,
&asn_PER_memb_hardVerDate_constr_6,
0,
"hardVerDate"
},
{ ATF_NOFLAGS, 0, offsetof(struct FactoryVersion, vendorExtInfo),
(ASN_TAG_CLASS_UNIVERSAL | (26 << 2)),
0,
&asn_DEF_VisibleString,
memb_vendorExtInfo_constraint_1,
&asn_PER_memb_vendorExtInfo_constr_7,
0,
"vendorExtInfo"
},
};
static const ber_tlv_tag_t asn_DEF_FactoryVersion_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_FactoryVersion_tag2el_1[] = {
{ (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), 0, 0, 5 }, /* vendorCode */
{ (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), 1, -1, 4 }, /* softVerCode */
{ (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), 2, -2, 3 }, /* softverDate */
{ (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), 3, -3, 2 }, /* hardVerCode */
{ (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), 4, -4, 1 }, /* hardVerDate */
{ (ASN_TAG_CLASS_UNIVERSAL | (26 << 2)), 5, -5, 0 } /* vendorExtInfo */
};
static asn_SEQUENCE_specifics_t asn_SPC_FactoryVersion_specs_1 = {
sizeof(struct FactoryVersion),
offsetof(struct FactoryVersion, _asn_ctx),
asn_MAP_FactoryVersion_tag2el_1,
6, /* Count of tags in the map */
0, 0, 0, /* Optional elements (not needed) */
-1, /* Start extensions */
-1 /* Stop extensions */
};
asn_TYPE_descriptor_t asn_DEF_FactoryVersion = {
"FactoryVersion",
"FactoryVersion",
SEQUENCE_free,
SEQUENCE_print,
SEQUENCE_constraint,
SEQUENCE_decode_ber,
SEQUENCE_encode_der,
SEQUENCE_decode_xer,
SEQUENCE_encode_xer,
SEQUENCE_decode_uper,
SEQUENCE_encode_uper,
0, /* Use generic outmost tag fetcher */
asn_DEF_FactoryVersion_tags_1,
sizeof(asn_DEF_FactoryVersion_tags_1)
/sizeof(asn_DEF_FactoryVersion_tags_1[0]), /* 1 */
asn_DEF_FactoryVersion_tags_1, /* Same as above */
sizeof(asn_DEF_FactoryVersion_tags_1)
/sizeof(asn_DEF_FactoryVersion_tags_1[0]), /* 1 */
0, /* No PER visible constraints */
asn_MBR_FactoryVersion_1,
6, /* Elements count */
&asn_SPC_FactoryVersion_specs_1 /* Additional specs */
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化