Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
96f9921b
Commit
96f9921b
authored
Aug 29, 2017
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decode SET OF in OER
parent
84382cc1
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
60 additions
and
26 deletions
+60
-26
examples/sample.source.1609.2/Makefile
examples/sample.source.1609.2/Makefile
+1
-0
skeletons/Makefile.am
skeletons/Makefile.am
+1
-0
skeletons/NativeInteger_oer.c
skeletons/NativeInteger_oer.c
+10
-10
skeletons/constr_CHOICE_oer.c
skeletons/constr_CHOICE_oer.c
+26
-4
skeletons/constr_SEQUENCE_OF.c
skeletons/constr_SEQUENCE_OF.c
+2
-2
skeletons/constr_SEQUENCE_OF.h
skeletons/constr_SEQUENCE_OF.h
+2
-0
skeletons/constr_SET_OF.c
skeletons/constr_SET_OF.c
+5
-0
skeletons/constr_SET_OF.h
skeletons/constr_SET_OF.h
+12
-10
skeletons/file-dependencies
skeletons/file-dependencies
+1
-0
No files found.
examples/sample.source.1609.2/Makefile
View file @
96f9921b
...
...
@@ -287,6 +287,7 @@ ASN_MODULE_SOURCES+=NativeInteger_oer.c
ASN_MODULE_SOURCES
+=
NativeEnumerated_oer.c
ASN_MODULE_SOURCES
+=
constr_SEQUENCE_oer.c
ASN_MODULE_SOURCES
+=
constr_CHOICE_oer.c
ASN_MODULE_SOURCES
+=
constr_SET_OF_oer.c
ASN_CONVERTER_SOURCES
+=
pdu_collection.c
...
...
skeletons/Makefile.am
View file @
96f9921b
...
...
@@ -72,6 +72,7 @@ libasn1cskeletons_la_SOURCES = \
constr_SEQUENCE_OF.c constr_SEQUENCE_OF.h
\
constr_SET.c constr_SET.h
\
constr_SET_OF.c constr_SET_OF.h
\
constr_SET_OF_oer.c
\
constr_TYPE.c constr_TYPE.h
\
constraints.c constraints.h
\
der_encoder.c der_encoder.h
\
...
...
skeletons/NativeInteger_oer.c
View file @
96f9921b
...
...
@@ -41,23 +41,23 @@ NativeInteger_decode_oer(asn_codec_ctx_t *opt_codec_ctx,
if
(
specs
&&
specs
->
field_unsigned
)
{
unsigned
long
ul
;
if
(
asn_INTEGER2ulong
(
&
tmpint
,
&
ul
)
!=
0
)
{
ASN_STRUCT_FREE_CONTENTS_ONLY
(
asn_DEF_INTEGER
,
&
tmpint
);
int
ok
=
asn_INTEGER2ulong
(
&
tmpint
,
&
ul
)
==
0
;
ASN_STRUCT_FREE_CONTENTS_ONLY
(
asn_DEF_INTEGER
,
&
tmpint
);
if
(
ok
)
{
*
native
=
ul
;
}
else
{
rval
.
code
=
RC_FAIL
;
rval
.
consumed
=
0
;
return
rval
;
}
else
{
*
native
=
ul
;
}
}
else
{
long
l
;
if
(
asn_INTEGER2long
(
&
tmpint
,
&
l
)
!=
0
)
{
ASN_STRUCT_FREE_CONTENTS_ONLY
(
asn_DEF_INTEGER
,
&
tmpint
);
int
ok
=
asn_INTEGER2long
(
&
tmpint
,
&
l
)
==
0
;
ASN_STRUCT_FREE_CONTENTS_ONLY
(
asn_DEF_INTEGER
,
&
tmpint
);
if
(
ok
)
{
*
native
=
l
;
}
else
{
rval
.
code
=
RC_FAIL
;
rval
.
consumed
=
0
;
return
rval
;
}
else
{
*
native
=
l
;
}
}
...
...
skeletons/constr_CHOICE_oer.c
View file @
96f9921b
...
...
@@ -15,6 +15,7 @@
#undef RETURN
#define RETURN(_code) \
do { \
asn_dec_rval_t rval; \
rval.code = _code; \
rval.consumed = consumed_myself; \
return rval; \
...
...
@@ -38,7 +39,12 @@
ctx->phase++; \
ctx->step = 0; \
} while(0)
#undef SET_PHASE
#define SET_PHASE(ctx, value) \
do { \
ctx->phase = value; \
ctx->step = 0; \
} while(0)
/*
* Tags are canonically sorted in the tag to member table.
...
...
@@ -136,8 +142,6 @@ CHOICE_decode_oer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void
*
st
=
*
struct_ptr
;
/* Target structure. */
asn_struct_ctx_t
*
ctx
;
/* Decoder context */
asn_dec_rval_t
rval
;
/* Return code from subparsers */
ssize_t
consumed_myself
=
0
;
/* Consumed bytes from ptr */
(
void
)
constraints
;
...
...
@@ -196,7 +200,9 @@ CHOICE_decode_oer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
RETURN
(
RC_FAIL
);
}
else
{
/* Skip open type extension */
ASN_DEBUG
(
"Not implemented skipping open type extension"
);
ASN_DEBUG
(
"Not implemented skipping open type extension for tag %s"
,
ber_tlv_tag_string
(
tlv_tag
));
RETURN
(
RC_FAIL
);
}
}
while
(
0
);
...
...
@@ -204,10 +210,12 @@ CHOICE_decode_oer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
ADVANCE
(
tag_len
);
}
/* Fall through */
case
1
:
{
asn_TYPE_member_t
*
elm
=
&
elements
[
ctx
->
step
];
/* CHOICE's element */
void
*
memb_ptr
;
/* Pointer to the member */
void
**
memb_ptr2
;
/* Pointer to that pointer */
asn_dec_rval_t
rval
;
/*
* Compute the position of the member inside a structure,
...
...
@@ -240,8 +248,22 @@ CHOICE_decode_oer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
elm
->
oer_constraints
,
memb_ptr2
,
ptr
,
size
);
rval
.
consumed
+=
consumed_myself
;
switch
(
rval
.
code
)
{
case
RC_OK
:
NEXT_PHASE
(
ctx
);
case
RC_WMORE
:
break
;
case
RC_FAIL
:
SET_PHASE
(
ctx
,
3
);
/* => 3 */
}
return
rval
;
}
case
2
:
/* Already decoded everything */
RETURN
(
RC_OK
);
case
3
:
/* Failed to decode, after all */
RETURN
(
RC_FAIL
);
}
RETURN
(
RC_FAIL
);
...
...
skeletons/constr_SEQUENCE_OF.c
View file @
96f9921b
...
...
@@ -220,8 +220,8 @@ asn_TYPE_operation_t asn_OP_SEQUENCE_OF = {
0
,
0
,
#else
0
,
0
,
SEQUENCE_OF_decode_oer
,
SEQUENCE_OF_encode_oer
,
#endif
/* ASN_DISABLE_OER_SUPPORT */
#ifdef ASN_DISABLE_PER_SUPPORT
0
,
...
...
skeletons/constr_SEQUENCE_OF.h
View file @
96f9921b
...
...
@@ -23,6 +23,8 @@ extern "C" {
#define SEQUENCE_OF_decode_ber SET_OF_decode_ber
#define SEQUENCE_OF_decode_xer SET_OF_decode_xer
#define SEQUENCE_OF_decode_uper SET_OF_decode_uper
#define SEQUENCE_OF_decode_oer SET_OF_decode_oer
#define SEQUENCE_OF_encode_oer SET_OF_encode_oer
der_type_encoder_f
SEQUENCE_OF_encode_der
;
xer_type_encoder_f
SEQUENCE_OF_encode_xer
;
per_type_encoder_f
SEQUENCE_OF_encode_uper
;
...
...
skeletons/constr_SET_OF.c
View file @
96f9921b
...
...
@@ -981,8 +981,13 @@ asn_TYPE_operation_t asn_OP_SET_OF = {
SET_OF_encode_der
,
SET_OF_decode_xer
,
SET_OF_encode_xer
,
#ifdef ASN_DISABLE_OER_SUPPORT
0
,
0
,
#else
SET_OF_decode_oer
,
SET_OF_decode_oer
,
#endif
#ifdef ASN_DISABLE_PER_SUPPORT
0
,
0
,
...
...
skeletons/constr_SET_OF.h
View file @
96f9921b
...
...
@@ -2,8 +2,8 @@
* Copyright (c) 2003 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
#ifndef
_CONSTR_SET_OF_H_
#define
_CONSTR_SET_OF_H_
#ifndef
CONSTR_SET_OF_H
#define
CONSTR_SET_OF_H
#include <asn_application.h>
...
...
@@ -12,14 +12,14 @@ extern "C" {
#endif
typedef
const
struct
asn_SET_OF_specifics_s
{
/*
* Target structure description.
*/
int
struct_size
;
/* Size of the target structure. */
int
ctx_offset
;
/* Offset of the asn_struct_ctx_t member */
/*
* Target structure description.
*/
unsigned
struct_size
;
/* Size of the target structure. */
unsigned
ctx_offset
;
/* Offset of the asn_struct_ctx_t member */
/* XER-specific stuff */
int
as_XMLValueList
;
/* The member type must be encoded like this */
/* XER-specific stuff */
int
as_XMLValueList
;
/* The member type must be encoded like this */
}
asn_SET_OF_specifics_t
;
/*
...
...
@@ -33,6 +33,8 @@ ber_type_decoder_f SET_OF_decode_ber;
der_type_encoder_f
SET_OF_encode_der
;
xer_type_decoder_f
SET_OF_decode_xer
;
xer_type_encoder_f
SET_OF_encode_xer
;
oer_type_decoder_f
SET_OF_decode_oer
;
oer_type_encoder_f
SET_OF_encode_oer
;
per_type_decoder_f
SET_OF_decode_uper
;
per_type_encoder_f
SET_OF_encode_uper
;
extern
asn_TYPE_operation_t
asn_OP_SET_OF
;
...
...
@@ -41,4 +43,4 @@ extern asn_TYPE_operation_t asn_OP_SET_OF;
}
#endif
#endif
/*
_CONSTR_SET_OF_H_
*/
#endif
/*
CONSTR_SET_OF_H
*/
skeletons/file-dependencies
View file @
96f9921b
...
...
@@ -78,5 +78,6 @@ NativeInteger_oer.c
NativeEnumerated_oer.c
constr_SEQUENCE_oer.c
constr_CHOICE_oer.c
constr_SET_OF_oer.c
CODEC-PER: # THIS IS A SPECIAL SECTION
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment