aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-09-24 14:49:41 +0200
committerHarald Welte <laforge@gnumonks.org>2018-09-24 14:49:41 +0200
commit293478cf768272a55155ba162def4e4fbd3b45ad (patch)
tree6598854f05214ed1534c1fd17b91e54b2115b77b
parent52cc7db6eda86cec209698eef00d6473debe650b (diff)
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
-rw-r--r--asn1/RSPRO.asn2
-rw-r--r--include/osmocom/rspro/RsproPDU.h2
-rw-r--r--src/rspro/RsproPDU.c22
3 files changed, 4 insertions, 22 deletions
diff --git a/asn1/RSPRO.asn b/asn1/RSPRO.asn
index 8772ee7..45ef70c 100644
--- a/asn1/RSPRO.asn
+++ b/asn1/RSPRO.asn
@@ -270,7 +270,7 @@ RsproPDUchoice ::= CHOICE {
}
RsproPDU ::= SEQUENCE {
- version [0] INTEGER(0..32) DEFAULT 1,
+ version [0] INTEGER(0..32),
tag [1] OperationTag,
msg [2] RsproPDUchoice
}
diff --git a/include/osmocom/rspro/RsproPDU.h b/include/osmocom/rspro/RsproPDU.h
index 171750a..11d251b 100644
--- a/include/osmocom/rspro/RsproPDU.h
+++ b/include/osmocom/rspro/RsproPDU.h
@@ -22,7 +22,7 @@ extern "C" {
/* RsproPDU */
typedef struct RsproPDU {
- long *version /* DEFAULT 1 */;
+ long version;
OperationTag_t tag;
RsproPDUchoice_t msg;
diff --git a/src/rspro/RsproPDU.c b/src/rspro/RsproPDU.c
index 2aa0862..d0bdb28 100644
--- a/src/rspro/RsproPDU.c
+++ b/src/rspro/RsproPDU.c
@@ -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[] = {
- { ATF_POINTER, 1, offsetof(struct RsproPDU, version),
+ { ATF_NOFLAGS, 0, offsetof(struct RsproPDU, version),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_NativeInteger,
memb_version_constraint_1,
0, /* PER is not compiled, use -gen-PER */
- asn_DFL_2_set_1, /* DEFAULT 1 */
+ 0,
"version"
},
{ ATF_NOFLAGS, 0, offsetof(struct RsproPDU, tag),