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
c098de20
Commit
c098de20
authored
Feb 25, 2022
by
Nikolaos Koutsianas
Committed by
Mouse
Feb 25, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
aper decoder can ignore unknown open types in a sequence and continue with next ones
parent
314778a2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
0 deletions
+68
-0
skeletons/OPEN_TYPE.h
skeletons/OPEN_TYPE.h
+8
-0
skeletons/OPEN_TYPE_aper.c
skeletons/OPEN_TYPE_aper.c
+55
-0
skeletons/constr_SEQUENCE_aper.c
skeletons/constr_SEQUENCE_aper.c
+5
-0
No files found.
skeletons/OPEN_TYPE.h
View file @
c098de20
...
...
@@ -94,6 +94,14 @@ asn_enc_rval_t OPEN_TYPE_encode_aper(
const
asn_TYPE_descriptor_t
*
type_descriptor
,
const
asn_per_constraints_t
*
constraints
,
const
void
*
struct_ptr
,
asn_per_outp_t
*
per_output
);
int
OPEN_TYPE_aper_is_unknown_type
(
const
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
const
asn_TYPE_member_t
*
elm
);
asn_dec_rval_t
OPEN_TYPE_aper_unknown_type_discard_bytes
(
asn_per_data_t
*
pd
);
#endif
/* !defined(ASN_DISABLE_APER_SUPPORT) */
extern
asn_TYPE_operation_t
asn_OP_OPEN_TYPE
;
...
...
skeletons/OPEN_TYPE_aper.c
View file @
c098de20
...
...
@@ -117,3 +117,58 @@ OPEN_TYPE_encode_aper(const asn_TYPE_descriptor_t *td,
er
.
encoded
=
0
;
ASN__ENCODED_OK
(
er
);
}
int
OPEN_TYPE_aper_is_unknown_type
(
const
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
const
asn_TYPE_member_t
*
elm
)
{
asn_type_selector_result_t
selected
;
if
(
!
elm
->
type_selector
)
{
return
1
;
}
else
{
selected
=
elm
->
type_selector
(
td
,
sptr
);
if
(
!
selected
.
presence_index
)
{
return
1
;
}
}
return
0
;
}
asn_dec_rval_t
OPEN_TYPE_aper_unknown_type_discard_bytes
(
asn_per_data_t
*
pd
)
{
#define ASN_DUMMY_BYTES 256
unsigned
char
dummy
[
ASN_DUMMY_BYTES
],
*
dummy_ptr
=
NULL
;
ssize_t
bytes
;
int
repeat
;
asn_dec_rval_t
rv
;
rv
.
consumed
=
0
;
rv
.
code
=
RC_FAIL
;
do
{
bytes
=
aper_get_length
(
pd
,
-
1
,
-
1
,
&
repeat
);
if
(
bytes
>
10
*
ASN_DUMMY_BYTES
)
{
return
rv
;
}
else
if
(
bytes
>
ASN_DUMMY_BYTES
)
{
dummy_ptr
=
CALLOC
(
1
,
bytes
);
if
(
!
dummy_ptr
)
return
rv
;
}
per_get_many_bits
(
pd
,
(
dummy_ptr
?
dummy_ptr
:
dummy
),
0
,
bytes
<<
3
);
if
(
dummy_ptr
)
{
FREEMEM
(
dummy_ptr
);
dummy_ptr
=
NULL
;
}
}
while
(
repeat
);
rv
.
code
=
RC_OK
;
return
rv
;
#undef ASN_DUMMY_BYTES
}
skeletons/constr_SEQUENCE_aper.c
View file @
c098de20
...
...
@@ -130,6 +130,11 @@ SEQUENCE_decode_aper(const asn_codec_ctx_t *opt_codec_ctx,
ASN_DEBUG
(
"Decoding member
\"
%s
\"
in %s"
,
elm
->
name
,
td
->
name
);
if
(
elm
->
flags
&
ATF_OPEN_TYPE
)
{
if
(
OPEN_TYPE_aper_is_unknown_type
(
td
,
st
,
elm
))
{
rv
=
OPEN_TYPE_aper_unknown_type_discard_bytes
(
pd
);
FREEMEM
(
opres
);
return
rv
;
}
rv
=
OPEN_TYPE_aper_get
(
opt_codec_ctx
,
td
,
st
,
elm
,
pd
);
}
else
{
rv
=
elm
->
type
->
op
->
aper_decoder
(
opt_codec_ctx
,
elm
->
type
,
...
...
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