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
815e5bc0
Commit
815e5bc0
authored
Jan 08, 2024
by
v0-e
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oer: OPEN TYPE encoding fix
parent
f2c5d7c6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
1 deletion
+51
-1
skeletons/OPEN_TYPE.h
skeletons/OPEN_TYPE.h
+4
-1
skeletons/OPEN_TYPE_oer.c
skeletons/OPEN_TYPE_oer.c
+47
-0
No files found.
skeletons/OPEN_TYPE.h
View file @
815e5bc0
...
...
@@ -77,7 +77,10 @@ asn_dec_rval_t OPEN_TYPE_oer_get(
asn_TYPE_member_t
*
element
,
const
void
*
ptr
,
size_t
size
);
#define OPEN_TYPE_decode_oer NULL
#define OPEN_TYPE_encode_oer CHOICE_encode_oer
asn_enc_rval_t
OPEN_TYPE_encode_oer
(
const
asn_TYPE_descriptor_t
*
type_descriptor
,
const
asn_oer_constraints_t
*
constraints
,
const
void
*
struct_ptr
,
asn_app_consume_bytes_f
*
consume_bytes_cb
,
void
*
app_key
);
#endif
/* !defined(ASN_DISABLE_OER_SUPPORT) */
#if !defined(ASN_DISABLE_UPER_SUPPORT)
...
...
skeletons/OPEN_TYPE_oer.c
View file @
815e5bc0
...
...
@@ -89,3 +89,50 @@ OPEN_TYPE_oer_get(const asn_codec_ctx_t *opt_codec_ctx,
}
return
rv
;
}
asn_enc_rval_t
OPEN_TYPE_encode_oer
(
const
asn_TYPE_descriptor_t
*
td
,
const
asn_oer_constraints_t
*
constraints
,
const
void
*
sptr
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn_TYPE_member_t
*
elm
;
unsigned
present
;
const
void
*
memb_ptr
;
ssize_t
encoded
;
asn_enc_rval_t
er
=
{
0
,
0
,
0
};
(
void
)
constraints
;
if
(
!
sptr
)
ASN__ENCODE_FAILED
;
present
=
CHOICE_variant_get_presence
(
td
,
sptr
);
if
(
present
==
0
||
present
>
td
->
elements_count
)
{
ASN__ENCODE_FAILED
;
}
else
{
present
--
;
}
ASN_DEBUG
(
"Encoding %s OPEN TYPE element %d"
,
td
->
name
,
present
);
elm
=
&
td
->
elements
[
present
];
if
(
elm
->
flags
&
ATF_POINTER
)
{
memb_ptr
=
*
(
const
void
*
const
*
)((
const
char
*
)
sptr
+
elm
->
memb_offset
);
if
(
memb_ptr
==
0
)
{
/* Mandatory element absent */
ASN__ENCODE_FAILED
;
}
}
else
{
memb_ptr
=
(
const
void
*
)((
const
char
*
)
sptr
+
elm
->
memb_offset
);
}
if
((
encoded
=
oer_open_type_put
(
elm
->
type
,
elm
->
encoding_constraints
.
oer_constraints
,
memb_ptr
,
cb
,
app_key
))
<
0
)
{
ASN__ENCODE_FAILED
;
}
er
.
encoded
=
encoded
;
ASN__ENCODED_OK
(
er
);
return
er
;
}
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