aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlm <vlm@59561ff5-6e30-0410-9f3c-9617f08c8826>2007-06-26 09:52:44 +0000
committervlm <vlm@59561ff5-6e30-0410-9f3c-9617f08c8826>2007-06-26 09:52:44 +0000
commit32193f184bcdafd559fd5a8c3d5f71de30e71378 (patch)
tree10df57f5caaa7eca6e95d553e6f7dafbfa0681a0
parent232c4b987df53afafc448d093cb4d56a9cd62297 (diff)
decoding unknown extensions
git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@1337 59561ff5-6e30-0410-9f3c-9617f08c8826
-rw-r--r--skeletons/constr_SEQUENCE.c44
1 files changed, 37 insertions, 7 deletions
diff --git a/skeletons/constr_SEQUENCE.c b/skeletons/constr_SEQUENCE.c
index 8af6cb9d..ad737ffb 100644
--- a/skeletons/constr_SEQUENCE.c
+++ b/skeletons/constr_SEQUENCE.c
@@ -1210,10 +1210,33 @@ uper_get_open_type(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
return rv;
}
+asn_dec_rval_t
+uper_sot_suck(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
+ asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
+ asn_dec_rval_t rv;
+
+ (void)opt_codec_ctx;
+ (void)td;
+ (void)constraints;
+ (void)sptr;
+
+ while(per_get_few_bits(pd, 24) >= 0);
+
+ rv.code = RC_OK;
+ rv.consumed = pd->moved;
+
+ return rv;
+}
+
static int
uper_skip_open_type(asn_codec_ctx_t *opt_codec_ctx, asn_per_data_t *pd) {
+ asn_TYPE_descriptor_t s_td;
asn_dec_rval_t rv;
- rv = uper_get_open_type(opt_codec_ctx, 0, 0, 0, pd);
+
+ s_td.name = "<unknown extension>";
+ s_td.uper_decoder = uper_sot_suck;
+
+ rv = uper_get_open_type(opt_codec_ctx, &s_td, 0, 0, pd);
if(rv.code != RC_OK)
return -1;
else
@@ -1387,11 +1410,17 @@ SEQUENCE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
/* Skip over overflow extensions which aren't present
* in this system's version of the protocol */
- while(per_get_few_bits(&epmd, 1) >= 0) {
- if(uper_skip_open_type(opt_codec_ctx, pd)) {
- FREEMEM(epres);
- _ASN_DECODE_STARVED;
+ for(;;) {
+ switch(per_get_few_bits(&epmd, 1)) {
+ case -1: break;
+ case 0: continue;
+ default:
+ if(uper_skip_open_type(opt_codec_ctx, pd)) {
+ FREEMEM(epres);
+ _ASN_DECODE_STARVED;
+ }
}
+ break;
}
FREEMEM(epres);
@@ -1445,7 +1474,7 @@ SEQUENCE_handle_extensions(asn_TYPE_descriptor_t *td, void *sptr,
int present;
if(!IN_EXTENSION_GROUP(specs, edx)) {
- ASN_DEBUG("%d is not extension", edx);
+ ASN_DEBUG("%s (@%d) is not extension", elm->type->name, edx);
continue;
}
@@ -1459,7 +1488,8 @@ SEQUENCE_handle_extensions(asn_TYPE_descriptor_t *td, void *sptr,
present = 1;
}
- ASN_DEBUG("checking ext %d is present => %d", edx, present);
+ ASN_DEBUG("checking %s (@%d) present => %d",
+ elm->type->name, edx, present);
exts_count++;
exts_present += present;