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
e7b73c40
Commit
e7b73c40
authored
Jul 07, 2017
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oer support code
parent
cc159474
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
5 deletions
+86
-5
skeletons/Makefile.am
skeletons/Makefile.am
+4
-0
skeletons/oer_decoder.c
skeletons/oer_decoder.c
+39
-0
skeletons/oer_decoder.h
skeletons/oer_decoder.h
+8
-5
skeletons/oer_support.h
skeletons/oer_support.h
+35
-0
No files found.
skeletons/Makefile.am
View file @
e7b73c40
...
...
@@ -33,6 +33,7 @@ libasn1cskeletons_la_SOURCES = \
GraphicString.c GraphicString.h
\
IA5String.c IA5String.h
\
INTEGER.c INTEGER.h
\
INTEGER_oer.c INTEGER_oer.h
\
ISO646String.c ISO646String.h
\
NULL.c NULL.h
\
NativeEnumerated.c NativeEnumerated.h
\
...
...
@@ -68,6 +69,9 @@ libasn1cskeletons_la_SOURCES = \
constr_TYPE.c constr_TYPE.h
\
constraints.c constraints.h
\
der_encoder.c der_encoder.h
\
oer_decoder.c oer_decoder.h
\
oer_encoder.c oer_encoder.h
\
oer_support.c oer_support.h
\
per_decoder.c per_decoder.h
\
per_encoder.c per_encoder.h
\
per_opentype.c per_opentype.h
\
...
...
skeletons/oer_decoder.c
0 → 100644
View file @
e7b73c40
/*
* Copyright (c) 2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
#include <asn_internal.h>
/*
* The OER decoder of any type.
*/
asn_dec_rval_t
oer_decode
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
type_descriptor
,
void
**
struct_ptr
,
const
void
*
ptr
,
size_t
size
)
{
asn_codec_ctx_t
s_codec_ctx
;
/*
* Stack checker requires that the codec context
* must be allocated on the stack.
*/
if
(
opt_codec_ctx
)
{
if
(
opt_codec_ctx
->
max_stack_size
)
{
s_codec_ctx
=
*
opt_codec_ctx
;
opt_codec_ctx
=
&
s_codec_ctx
;
}
}
else
{
/* If context is not given, be security-conscious anyway */
memset
(
&
s_codec_ctx
,
0
,
sizeof
(
s_codec_ctx
));
s_codec_ctx
.
max_stack_size
=
ASN__DEFAULT_STACK_MAX
;
opt_codec_ctx
=
&
s_codec_ctx
;
}
/*
* Invoke type-specific decoder.
*/
return
type_descriptor
->
oer_decoder
(
opt_codec_ctx
,
type_descriptor
,
0
,
struct_ptr
,
/* Pointer to the destination structure */
ptr
,
size
/* Buffer and its size */
);
}
skeletons/oer_decoder.h
View file @
e7b73c40
...
...
@@ -6,6 +6,7 @@
#define _OER_DECODER_H_
#include <asn_application.h>
#include <oer_support.h>
#ifdef __cplusplus
extern
"C"
{
...
...
@@ -28,11 +29,13 @@ asn_dec_rval_t oer_decode(struct asn_codec_ctx_s *opt_codec_ctx,
/*
* Type of generic function which decodes the byte stream into the structure.
*/
typedef
asn_dec_rval_t
(
oer_type_decoder_f
)(
struct
asn_codec_ctx_s
*
opt_codec_ctx
,
struct
asn_TYPE_descriptor_s
*
type_descriptor
,
void
**
struct_ptr
,
const
void
*
buf_ptr
,
size_t
size
,
int
tag_mode
);
typedef
asn_dec_rval_t
(
oer_type_decoder_f
)(
struct
asn_codec_ctx_s
*
opt_codec_ctx
,
struct
asn_TYPE_descriptor_s
*
type_descriptor
,
asn_oer_constraint_t
*
constraints
,
void
**
struct_ptr
,
const
void
*
buf_ptr
,
size_t
size
);
#ifdef __cplusplus
}
...
...
skeletons/oer_support.h
0 → 100644
View file @
e7b73c40
/*
* Copyright (c) 2017 Lev Walkin <vlm@lionet.info>.
* All rights reserved.
* Redistribution and modifications are oermitted subject to BSD license.
*/
#ifndef _OER_SUPPORT_H_
#define _OER_SUPPORT_H_
#include <asn_system.h>
/* Platform-specific types */
#ifdef __cplusplus
extern
"C"
{
#endif
/*
* Pre-computed OER constraints.
*/
typedef
const
struct
asn_oer_constraint_s
{
enum
asn_oer_constraint_flags
{
AOC_HAS_LOWER_BOUND
=
0x01
,
AOC_HAS_UPPER_BOUND
=
0x02
}
flags
;
intmax_t
lower_bound
;
intmax_t
upoer_bound
;
}
asn_oer_constraint_t
;
typedef
const
struct
asn_oer_constraints_s
{
struct
asn_oer_constraint_s
value
;
struct
asn_oer_constraint_s
size
;
}
asn_oer_constraints_t
;
#ifdef __cplusplus
}
#endif
#endif
/* _OER_SUPPORT_H_ */
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