RSPRO: don't use "default 1" for protocol version

I suspect there may be some bugs in the handling of DEFAULT values
in asn1c (or maybe I don't understand them fully?), so let's simply
make the version field a normal ASN.1 field.

Change-Id: I08077e715a901dfa5193855be7040d550f6fc2e8
This commit is contained in:
Harald Welte 2018-09-24 14:49:41 +02:00
parent 52cc7db6ed
commit 293478cf76
3 changed files with 4 additions and 22 deletions

View File

@ -270,7 +270,7 @@ RsproPDUchoice ::= CHOICE {
} }
RsproPDU ::= SEQUENCE { RsproPDU ::= SEQUENCE {
version [0] INTEGER(0..32) DEFAULT 1, version [0] INTEGER(0..32),
tag [1] OperationTag, tag [1] OperationTag,
msg [2] RsproPDUchoice msg [2] RsproPDUchoice
} }

View File

@ -22,7 +22,7 @@ extern "C" {
/* RsproPDU */ /* RsproPDU */
typedef struct RsproPDU { typedef struct RsproPDU {
long *version /* DEFAULT 1 */; long version;
OperationTag_t tag; OperationTag_t tag;
RsproPDUchoice_t msg; RsproPDUchoice_t msg;

View File

@ -31,32 +31,14 @@ memb_version_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
} }
} }
static int asn_DFL_2_set_1(int set_value, void **sptr) {
long *st = *sptr;
if(!st) {
if(!set_value) return -1; /* Not a default value */
st = (*sptr = CALLOC(1, sizeof(*st)));
if(!st) return -1;
}
if(set_value) {
/* Install default value 1 */
*st = 1l;
return 0;
} else {
/* Test default value 1 */
return (*st == 1);
}
}
static asn_TYPE_member_t asn_MBR_RsproPDU_1[] = { static asn_TYPE_member_t asn_MBR_RsproPDU_1[] = {
{ ATF_POINTER, 1, offsetof(struct RsproPDU, version), { ATF_NOFLAGS, 0, offsetof(struct RsproPDU, version),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)), (ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */ -1, /* IMPLICIT tag at current level */
&asn_DEF_NativeInteger, &asn_DEF_NativeInteger,
memb_version_constraint_1, memb_version_constraint_1,
0, /* PER is not compiled, use -gen-PER */ 0, /* PER is not compiled, use -gen-PER */
asn_DFL_2_set_1, /* DEFAULT 1 */ 0,
"version" "version"
}, },
{ ATF_NOFLAGS, 0, offsetof(struct RsproPDU, tag), { ATF_NOFLAGS, 0, offsetof(struct RsproPDU, tag),