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
6903380f
Commit
6903380f
authored
Aug 25, 2017
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
generate oer only when requested
parent
6cd0d567
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
81 deletions
+33
-81
skeletons/OPEN_TYPE.c
skeletons/OPEN_TYPE.c
+3
-76
skeletons/OPEN_TYPE_oer.c
skeletons/OPEN_TYPE_oer.c
+0
-1
skeletons/constr_TYPE.h
skeletons/constr_TYPE.h
+8
-1
skeletons/converter-sample.c
skeletons/converter-sample.c
+18
-0
skeletons/file-dependencies
skeletons/file-dependencies
+4
-3
No files found.
skeletons/OPEN_TYPE.c
View file @
6903380f
...
...
@@ -23,6 +23,8 @@ asn_TYPE_operation_t asn_OP_OPEN_TYPE = {
0
,
/* Use generic outmost tag fetcher */
};
#ifndef ASN_DISABLE_PER_SUPPORT
asn_dec_rval_t
OPEN_TYPE_uper_get
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
...
...
@@ -90,79 +92,4 @@ OPEN_TYPE_uper_get(asn_codec_ctx_t *opt_codec_ctx,
return
rv
;
}
asn_dec_rval_t
OPEN_TYPE_oer_get
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
asn_TYPE_member_t
*
elm
,
const
void
*
ptr
,
size_t
size
)
{
asn_type_selector_result_t
selected
;
void
*
memb_ptr
;
/* Pointer to the member */
void
**
memb_ptr2
;
/* Pointer to that pointer */
void
*
inner_value
;
asn_dec_rval_t
rv
;
size_t
ot_ret
;
if
(
!
(
elm
->
flags
&
ATF_OPEN_TYPE
)
||
!
elm
->
type_selector
)
{
ASN__DECODE_FAILED
;
}
selected
=
elm
->
type_selector
(
td
,
sptr
);
if
(
!
selected
.
presence_index
)
{
ASN__DECODE_FAILED
;
}
/* Fetch the pointer to this member */
if
(
elm
->
flags
&
ATF_POINTER
)
{
memb_ptr2
=
(
void
**
)((
char
*
)
sptr
+
elm
->
memb_offset
);
}
else
{
memb_ptr
=
(
char
*
)
sptr
+
elm
->
memb_offset
;
memb_ptr2
=
&
memb_ptr
;
}
if
(
*
memb_ptr2
!=
NULL
)
{
/* Make sure we reset the structure first before encoding */
if
(
CHOICE_variant_set_presence
(
selected
.
type_descriptor
,
*
memb_ptr2
,
0
)
!=
0
)
{
ASN__DECODE_FAILED
;
}
}
inner_value
=
(
char
*
)
*
memb_ptr2
+
elm
->
type
->
elements
[
selected
.
presence_index
-
1
].
memb_offset
;
ot_ret
=
oer_open_type_get
(
opt_codec_ctx
,
selected
.
type_descriptor
,
NULL
,
&
inner_value
,
ptr
,
size
);
switch
(
ot_ret
)
{
default:
if
(
CHOICE_variant_set_presence
(
selected
.
type_descriptor
,
*
memb_ptr2
,
selected
.
presence_index
)
==
0
)
{
rv
.
code
=
RC_OK
;
rv
.
consumed
=
ot_ret
;
return
rv
;
}
else
{
/* Oh, now a full-blown failure failure */
}
/* Fall through */
case
-
1
:
rv
.
code
=
RC_FAIL
;
rv
.
consumed
=
0
;
break
;
case
0
:
rv
.
code
=
RC_WMORE
;
rv
.
consumed
=
0
;
break
;
}
if
(
*
memb_ptr2
)
{
asn_CHOICE_specifics_t
*
specs
=
selected
.
type_descriptor
->
specifics
;
if
(
elm
->
flags
&
ATF_POINTER
)
{
ASN_STRUCT_FREE
(
*
selected
.
type_descriptor
,
inner_value
);
*
memb_ptr2
=
NULL
;
}
else
{
ASN_STRUCT_FREE_CONTENTS_ONLY
(
*
selected
.
type_descriptor
,
inner_value
);
memset
(
*
memb_ptr2
,
0
,
specs
->
struct_size
);
}
}
return
rv
;
}
#endif
/* ASN_DISABLE_PER_SUPPORT */
skeletons/OPEN_TYPE_oer.c
View file @
6903380f
...
...
@@ -5,7 +5,6 @@
#include <asn_internal.h>
#include <OPEN_TYPE.h>
#include <constr_CHOICE.h>
#include <oer_opentype.h>
#include <errno.h>
asn_dec_rval_t
...
...
skeletons/constr_TYPE.h
View file @
6903380f
...
...
@@ -41,9 +41,16 @@ typedef struct asn_struct_ctx_s {
#include <xer_encoder.h>
/* Encoder into XER (XML, text) */
#include <per_decoder.h>
/* Packet Encoding Rules decoder */
#include <per_encoder.h>
/* Packet Encoding Rules encoder */
#include <constraints.h>
/* Subtype constraints support */
#ifdef ASN_DISABLE_OER_SUPPORT
typedef
void
(
*
oer_type_decoder_f
)();
typedef
void
(
*
oer_type_encoder_f
)();
typedef
struct
{}
asn_oer_constraints_t
;
#else
#include <oer_decoder.h>
/* Octet Encoding Rules encoder */
#include <oer_encoder.h>
/* Octet Encoding Rules encoder */
#
include <constraints.h>
/* Subtype constraints support */
#
endif
/*
* Free the structure according to its specification.
...
...
skeletons/converter-sample.c
View file @
6903380f
...
...
@@ -341,7 +341,11 @@ main(int ac, char *av[]) {
DEBUG
(
"Encoded in %ld bytes of DER"
,
(
long
)
erv
.
encoded
);
break
;
case
OUT_OER
:
#ifdef ASN_DISABLE_OER_SUPPORT
erv
.
encoded
=
-
1
;
#else
erv
=
oer_encode
(
pduType
,
structure
,
write_out
,
stdout
);
#endif
if
(
erv
.
encoded
<
0
)
{
fprintf
(
stderr
,
"%s: Cannot convert %s into oER
\n
"
,
name
,
pduType
->
name
);
...
...
@@ -350,7 +354,11 @@ main(int ac, char *av[]) {
DEBUG
(
"Encoded in %ld bytes of OER"
,
(
long
)
erv
.
encoded
);
break
;
case
OUT_PER
:
#ifdef ASN_DISABLE_PER_SUPPORT
erv
.
encoded
=
-
1
;
#else
erv
=
uper_encode
(
pduType
,
structure
,
write_out
,
stdout
);
#endif
if
(
erv
.
encoded
<
0
)
{
fprintf
(
stderr
,
"%s: Cannot convert %s into Unaligned PER
\n
"
,
name
,
...
...
@@ -670,14 +678,23 @@ data_decode_from_file(asn_TYPE_descriptor_t *pduType, FILE *file, const char *na
(
void
**
)
&
structure
,
i_bptr
,
i_size
);
break
;
case
INP_OER
:
#ifdef ASN_DISABLE_OER_SUPPORT
rval
.
code
=
RC_FAIL
;
rval
.
consumed
=
0
;
#else
rval
=
oer_decode
(
opt_codec_ctx
,
pduType
,
(
void
**
)
&
structure
,
i_bptr
,
i_size
);
#endif
break
;
case
INP_XER
:
rval
=
xer_decode
(
opt_codec_ctx
,
pduType
,
(
void
**
)
&
structure
,
i_bptr
,
i_size
);
break
;
case
INP_PER
:
#ifdef ASN_DISABLE_PER_SUPPORT
rval
.
code
=
RC_FAIL
;
rval
.
consumed
=
0
;
#else
if
(
opt_nopad
)
rval
=
uper_decode
(
opt_codec_ctx
,
pduType
,
(
void
**
)
&
structure
,
i_bptr
,
i_size
,
0
,
...
...
@@ -685,6 +702,7 @@ data_decode_from_file(asn_TYPE_descriptor_t *pduType, FILE *file, const char *na
else
rval
=
uper_decode_complete
(
opt_codec_ctx
,
pduType
,
(
void
**
)
&
structure
,
i_bptr
,
i_size
);
#endif
switch
(
rval
.
code
)
{
case
RC_OK
:
/* Fall through */
...
...
skeletons/file-dependencies
View file @
6903380f
...
...
@@ -59,9 +59,6 @@ constraints.h constraints.c # Subtype constraints support
xer_support.h xer_support.c # XML parsing
xer_decoder.h xer_decoder.c # XER decoding support
xer_encoder.h xer_encoder.c # XER encoding support
oer_decoder.h oer_decoder.c # OER decoding support
oer_encoder.h oer_encoder.c # OER encoding support
oer_support.h oer_support.c # OER support
per_support.h per_support.c # PER parsing
per_decoder.h per_decoder.c # PER decoding support
per_encoder.h per_encoder.c # PER encoding support
...
...
@@ -71,6 +68,10 @@ CONVERTER: # THIS IS A SPECIAL SECTION
converter-sample.c # A default name for sample transcoder
CODEC-OER: # THIS IS A SPECIAL SECTION
oer_decoder.h oer_decoder.c # OER decoding support
oer_encoder.h oer_encoder.c # OER encoding support
oer_support.h oer_support.c # OER support
OPEN_TYPE.h OPEN_TYPE_oer.c
INTEGER_oer.c
OCTET_STRING_oer.c
NativeInteger_oer.c
...
...
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