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
20ea8521
Commit
20ea8521
authored
Jul 20, 2017
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add OER open type decoder
parent
39837e6c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
1 deletion
+56
-1
skeletons/oer_decoder.c
skeletons/oer_decoder.c
+55
-0
skeletons/oer_decoder.h
skeletons/oer_decoder.h
+1
-1
No files found.
skeletons/oer_decoder.c
View file @
20ea8521
...
...
@@ -37,3 +37,58 @@ oer_decode(asn_codec_ctx_t *opt_codec_ctx,
ptr
,
size
/* Buffer and its size */
);
}
/*
* Open Type is encoded as a length (#8.6) followed by that number of bytes.
* Since we're just skipping, reading the length would be enough.
*/
ssize_t
oer_open_type_skip
(
const
void
*
bufptr
,
size_t
size
)
{
size_t
len
=
0
;
return
oer_fetch_length
(
bufptr
,
size
,
&
len
);
}
/*
* Read the Open Type (X.696 (08/2015), #30).
* RETURN VALUES:
* 0: More data expected than bufptr contains.
* -1: Fatal error deciphering length.
* >0: Number of bytes used from bufptr.
*/
ssize_t
oer_open_type_get
(
asn_codec_ctx_t
*
opt_codec_ctx
,
struct
asn_TYPE_descriptor_s
*
td
,
asn_oer_constraints_t
*
constraints
,
void
**
struct_ptr
,
const
void
*
bufptr
,
size_t
size
)
{
asn_dec_rval_t
dr
;
size_t
container_len
=
0
;
ssize_t
len_len
;
/* Get the size of a length determinant */
len_len
=
oer_fetch_length
(
bufptr
,
size
,
&
container_len
);
if
(
len_len
<=
0
)
{
return
len_len
;
/* Error or more data expected */
}
/*
* len_len can't be bigger than size, but size without len_len
* should be bigger or equal to container length
*/
if
(
size
-
len_len
<
container_len
)
{
/* More data is expected */
return
0
;
}
dr
=
td
->
oer_decoder
(
opt_codec_ctx
,
td
,
constraints
,
struct_ptr
,
(
const
uint8_t
*
)
bufptr
+
len_len
,
container_len
);
if
(
dr
.
code
==
RC_OK
)
{
return
len_len
+
container_len
;
}
else
{
/* Even if RC_WMORE, we can't get more data into a closed container. */
ASN_STRUCT_FREE
(
*
td
,
*
struct_ptr
);
*
struct_ptr
=
0
;
return
-
1
;
}
}
skeletons/oer_decoder.h
View file @
20ea8521
...
...
@@ -44,7 +44,7 @@ typedef asn_dec_rval_t(oer_type_decoder_f)(
* -1: Fatal error deciphering length.
* >0: Number of bytes used from bufptr.
*/
ssize_t
oer_open_type_s
lur
p
(
const
void
*
bufptr
,
size_t
size
);
ssize_t
oer_open_type_s
ki
p
(
const
void
*
bufptr
,
size_t
size
);
/*
* Read the Open Type (X.696 (08/2015), #30).
...
...
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