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
f5af86c1
Commit
f5af86c1
authored
Oct 05, 2021
by
Senthil Prabakaran
Committed by
Mouse
May 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix JER support
parent
184d07e4
Changes
48
Hide whitespace changes
Inline
Side-by-side
Showing
48 changed files
with
168 additions
and
491 deletions
+168
-491
skeletons/ANY.c
skeletons/ANY.c
+5
-0
skeletons/ANY.h
skeletons/ANY.h
+4
-0
skeletons/BIT_STRING.c
skeletons/BIT_STRING.c
+5
-0
skeletons/BMPString.c
skeletons/BMPString.c
+5
-0
skeletons/BOOLEAN.c
skeletons/BOOLEAN.c
+0
-2
skeletons/ENUMERATED.c
skeletons/ENUMERATED.c
+5
-0
skeletons/GeneralString.c
skeletons/GeneralString.c
+5
-0
skeletons/GeneralizedTime.c
skeletons/GeneralizedTime.c
+0
-2
skeletons/GeneralizedTime.h
skeletons/GeneralizedTime.h
+4
-0
skeletons/GraphicString.c
skeletons/GraphicString.c
+5
-0
skeletons/GraphicString.h
skeletons/GraphicString.h
+4
-0
skeletons/INTEGER.c
skeletons/INTEGER.c
+5
-0
skeletons/INTEGER_jer.c
skeletons/INTEGER_jer.c
+0
-78
skeletons/ISO646String.c
skeletons/ISO646String.c
+5
-0
skeletons/ISO646String.h
skeletons/ISO646String.h
+4
-0
skeletons/NULL.c
skeletons/NULL.c
+5
-0
skeletons/NULL_jer.c
skeletons/NULL_jer.c
+0
-26
skeletons/NativeEnumerated.c
skeletons/NativeEnumerated.c
+5
-0
skeletons/NativeEnumerated.h
skeletons/NativeEnumerated.h
+4
-0
skeletons/NativeReal.c
skeletons/NativeReal.c
+5
-0
skeletons/NativeReal.h
skeletons/NativeReal.h
+4
-0
skeletons/NumericString.c
skeletons/NumericString.c
+5
-0
skeletons/OBJECT_IDENTIFIER.c
skeletons/OBJECT_IDENTIFIER.c
+5
-0
skeletons/OCTET_STRING.c
skeletons/OCTET_STRING.c
+0
-2
skeletons/ObjectDescriptor.c
skeletons/ObjectDescriptor.c
+5
-0
skeletons/PrintableString.c
skeletons/PrintableString.c
+5
-0
skeletons/PrintableString.h
skeletons/PrintableString.h
+4
-0
skeletons/REAL.c
skeletons/REAL.c
+5
-0
skeletons/RELATIVE-OID.c
skeletons/RELATIVE-OID.c
+5
-0
skeletons/RELATIVE-OID_jer.c
skeletons/RELATIVE-OID_jer.c
+0
-53
skeletons/T61String.c
skeletons/T61String.c
+0
-2
skeletons/T61String.h
skeletons/T61String.h
+4
-0
skeletons/TeletexString.c
skeletons/TeletexString.c
+5
-0
skeletons/UTCTime.c
skeletons/UTCTime.c
+5
-0
skeletons/UTCTime.h
skeletons/UTCTime.h
+4
-0
skeletons/UniversalString.c
skeletons/UniversalString.c
+5
-0
skeletons/UniversalString_jer.c
skeletons/UniversalString_jer.c
+0
-58
skeletons/VideotexString.c
skeletons/VideotexString.c
+0
-2
skeletons/VideotexString.h
skeletons/VideotexString.h
+4
-0
skeletons/VisibleString.c
skeletons/VisibleString.c
+5
-0
skeletons/constr_CHOICE.c
skeletons/constr_CHOICE.c
+0
-2
skeletons/constr_SEQUENCE_OF.c
skeletons/constr_SEQUENCE_OF.c
+5
-0
skeletons/constr_SEQUENCE_OF.h
skeletons/constr_SEQUENCE_OF.h
+4
-0
skeletons/constr_SET.c
skeletons/constr_SET.c
+5
-0
skeletons/constr_SET.h
skeletons/constr_SET.h
+4
-0
skeletons/constr_SET_OF.c
skeletons/constr_SET_OF.c
+5
-0
skeletons/constr_SET_OF_jer.c
skeletons/constr_SET_OF_jer.c
+0
-25
skeletons/constr_SET_jer.c
skeletons/constr_SET_jer.c
+0
-239
No files found.
skeletons/ANY.c
View file @
f5af86c1
...
...
@@ -32,6 +32,11 @@ asn_TYPE_operation_t asn_OP_ANY = {
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
ANY_encode_jer
,
#else
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
0
,
0
,
...
...
skeletons/ANY.h
View file @
f5af86c1
...
...
@@ -42,6 +42,10 @@ extern asn_OCTET_STRING_specifics_t asn_SPC_ANY_specs;
xer_type_encoder_f
ANY_encode_xer
;
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
jer_type_encoder_f
ANY_encode_jer
;
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_UPER_SUPPORT)
per_type_decoder_f
ANY_decode_uper
;
per_type_encoder_f
ANY_encode_uper
;
...
...
skeletons/BIT_STRING.c
View file @
f5af86c1
...
...
@@ -38,6 +38,11 @@ asn_TYPE_operation_t asn_OP_BIT_STRING = {
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
BIT_STRING_encode_jer
,
#else
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
BIT_STRING_decode_oer
,
BIT_STRING_encode_oer
,
...
...
skeletons/BMPString.c
View file @
f5af86c1
...
...
@@ -46,6 +46,11 @@ asn_TYPE_operation_t asn_OP_BMPString = {
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
BMPString_encode_jer
,
/* Convert to UTF-8 */
#else
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
OCTET_STRING_decode_oer
,
OCTET_STRING_encode_oer
,
...
...
skeletons/BOOLEAN.c
View file @
f5af86c1
...
...
@@ -34,11 +34,9 @@ asn_TYPE_operation_t asn_OP_BOOLEAN = {
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
0
,
BOOLEAN_encode_jer
,
#else
0
,
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
BOOLEAN_decode_oer
,
...
...
skeletons/ENUMERATED.c
View file @
f5af86c1
...
...
@@ -34,6 +34,11 @@ asn_TYPE_operation_t asn_OP_ENUMERATED = {
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
INTEGER_encode_jer
,
#else
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
ENUMERATED_decode_oer
,
ENUMERATED_encode_oer
,
...
...
skeletons/GeneralString.c
View file @
f5af86c1
...
...
@@ -34,6 +34,11 @@ asn_TYPE_operation_t asn_OP_GeneralString = {
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
OCTET_STRING_encode_jer
,
#else
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
OCTET_STRING_decode_oer
,
OCTET_STRING_encode_oer
,
...
...
skeletons/GeneralizedTime.c
View file @
f5af86c1
...
...
@@ -197,11 +197,9 @@ asn_TYPE_operation_t asn_OP_GeneralizedTime = {
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
0
,
GeneralizedTime_encode_jer
,
#else
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
OCTET_STRING_decode_oer
,
...
...
skeletons/GeneralizedTime.h
View file @
f5af86c1
...
...
@@ -36,6 +36,10 @@ der_type_encoder_f GeneralizedTime_encode_der;
xer_type_encoder_f
GeneralizedTime_encode_xer
;
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
jer_type_encoder_f
GeneralizedTime_encode_jer
;
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_UPER_SUPPORT)
#define GeneralizedTime_decode_uper OCTET_STRING_decode_uper
#define GeneralizedTime_encode_uper OCTET_STRING_encode_uper
...
...
skeletons/GraphicString.c
View file @
f5af86c1
...
...
@@ -34,6 +34,11 @@ asn_TYPE_operation_t asn_OP_GraphicString = {
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
OCTET_STRING_encode_jer
,
/* Can't expect it to be ASCII/UTF8 */
#else
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
OCTET_STRING_decode_oer
,
OCTET_STRING_encode_oer
,
...
...
skeletons/GraphicString.h
View file @
f5af86c1
...
...
@@ -36,6 +36,10 @@ extern asn_TYPE_operation_t asn_OP_GraphicString;
#define GraphicString_encode_xer OCTET_STRING_encode_xer
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
#define GraphicString_encode_jer OCTET_STRING_encode_jer
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_UPER_SUPPORT)
#define GraphicString_decode_uper OCTET_STRING_decode_uper
#define GraphicString_encode_uper OCTET_STRING_encode_uper
...
...
skeletons/INTEGER.c
View file @
f5af86c1
...
...
@@ -36,6 +36,11 @@ asn_TYPE_operation_t asn_OP_INTEGER = {
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
INTEGER_encode_jer
,
#else
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
INTEGER_decode_oer
,
/* OER decoder */
INTEGER_encode_oer
,
/* Canonical OER encoder */
...
...
skeletons/INTEGER_jer.c
View file @
f5af86c1
...
...
@@ -6,84 +6,6 @@
#include <asn_internal.h>
#include <INTEGER.h>
struct
e2v_key
{
const
char
*
start
;
const
char
*
stop
;
const
asn_INTEGER_enum_map_t
*
vemap
;
const
unsigned
int
*
evmap
;
};
static
int
INTEGER__compar_enum2value
(
const
void
*
kp
,
const
void
*
am
)
{
const
struct
e2v_key
*
key
=
(
const
struct
e2v_key
*
)
kp
;
const
asn_INTEGER_enum_map_t
*
el
=
(
const
asn_INTEGER_enum_map_t
*
)
am
;
const
char
*
ptr
,
*
end
,
*
name
;
/* Remap the element (sort by different criterion) */
el
=
key
->
vemap
+
key
->
evmap
[
el
-
key
->
vemap
];
/* Compare strings */
for
(
ptr
=
key
->
start
,
end
=
key
->
stop
,
name
=
el
->
enum_name
;
ptr
<
end
;
ptr
++
,
name
++
)
{
if
(
*
ptr
!=
*
name
||
!*
name
)
return
*
(
const
unsigned
char
*
)
ptr
-
*
(
const
unsigned
char
*
)
name
;
}
return
name
[
0
]
?
-
1
:
0
;
}
static
const
asn_INTEGER_enum_map_t
*
INTEGER_map_enum2value
(
const
asn_INTEGER_specifics_t
*
specs
,
const
char
*
lstart
,
const
char
*
lstop
)
{
const
asn_INTEGER_enum_map_t
*
el_found
;
int
count
=
specs
?
specs
->
map_count
:
0
;
struct
e2v_key
key
;
const
char
*
lp
;
if
(
!
count
)
return
NULL
;
/* Guaranteed: assert(lstart < lstop); */
/* Figure out the tag name */
for
(
lstart
++
,
lp
=
lstart
;
lp
<
lstop
;
lp
++
)
{
switch
(
*
lp
)
{
case
9
:
case
10
:
case
11
:
case
12
:
case
13
:
case
32
:
/* WSP */
case
0x2f
:
/* '/' */
case
0x3e
:
/* '>' */
break
;
default:
continue
;
}
break
;
}
if
(
lp
==
lstop
)
return
NULL
;
/* No tag found */
lstop
=
lp
;
key
.
start
=
lstart
;
key
.
stop
=
lstop
;
key
.
vemap
=
specs
->
value2enum
;
key
.
evmap
=
specs
->
enum2value
;
el_found
=
(
asn_INTEGER_enum_map_t
*
)
bsearch
(
&
key
,
specs
->
value2enum
,
count
,
sizeof
(
specs
->
value2enum
[
0
]),
INTEGER__compar_enum2value
);
if
(
el_found
)
{
/* Remap enum2value into value2enum */
el_found
=
key
.
vemap
+
key
.
evmap
[
el_found
-
key
.
vemap
];
}
return
el_found
;
}
static
int
INTEGER_st_prealloc
(
INTEGER_t
*
st
,
int
min_size
)
{
void
*
p
=
MALLOC
(
min_size
+
1
);
if
(
p
)
{
void
*
b
=
st
->
buf
;
st
->
size
=
0
;
st
->
buf
=
p
;
FREEMEM
(
b
);
return
0
;
}
else
{
return
-
1
;
}
}
asn_enc_rval_t
INTEGER_encode_jer
(
const
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
enum
jer_encoder_flags_e
flags
,
...
...
skeletons/ISO646String.c
View file @
f5af86c1
...
...
@@ -41,6 +41,11 @@ asn_TYPE_operation_t asn_OP_ISO646String = {
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
OCTET_STRING_encode_jer_utf8
,
#else
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
OCTET_STRING_decode_oer
,
OCTET_STRING_encode_oer
,
...
...
skeletons/ISO646String.h
View file @
f5af86c1
...
...
@@ -37,6 +37,10 @@ extern asn_TYPE_operation_t asn_OP_ISO646String;
#define ISO646String_encode_xer OCTET_STRING_encode_xer_utf8
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
#define ISO646String_encode_jer OCTET_STRING_encode_jer_utf8
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
#define ISO646String_decode_oer OCTET_STRING_decode_oer
#define ISO646String_encode_oer OCTET_STRING_encode_oer
...
...
skeletons/NULL.c
View file @
f5af86c1
...
...
@@ -33,6 +33,11 @@ asn_TYPE_operation_t asn_OP_NULL = {
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
NULL_encode_jer
,
#else
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
NULL_decode_oer
,
NULL_encode_oer
,
...
...
skeletons/NULL_jer.c
View file @
f5af86c1
...
...
@@ -24,29 +24,3 @@ NULL_encode_jer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
er
.
encoded
=
0
;
ASN__ENCODED_OK
(
er
);
}
static
enum
jer_pbd_rval
NULL__jer_body_decode
(
const
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
const
void
*
chunk_buf
,
size_t
chunk_size
)
{
(
void
)
td
;
(
void
)
sptr
;
(
void
)
chunk_buf
;
/* Going to be empty according to the rules below. */
/*
* There must be no content in self-terminating <NULL/> tag.
*/
if
(
chunk_size
)
return
XPBD_BROKEN_ENCODING
;
else
return
XPBD_BODY_CONSUMED
;
}
asn_dec_rval_t
NULL_decode_jer
(
const
asn_codec_ctx_t
*
opt_codec_ctx
,
const
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
const
void
*
buf_ptr
,
size_t
size
)
{
return
jer_decode_primitive
(
opt_codec_ctx
,
td
,
sptr
,
sizeof
(
NULL_t
),
opt_mname
,
buf_ptr
,
size
,
NULL__jer_body_decode
);
}
skeletons/NativeEnumerated.c
View file @
f5af86c1
...
...
@@ -40,6 +40,11 @@ asn_TYPE_operation_t asn_OP_NativeEnumerated = {
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
NativeEnumerated_encode_jer
,
#else
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
NativeEnumerated_decode_oer
,
NativeEnumerated_encode_oer
,
...
...
skeletons/NativeEnumerated.h
View file @
f5af86c1
...
...
@@ -41,6 +41,10 @@ extern asn_TYPE_operation_t asn_OP_NativeEnumerated;
xer_type_encoder_f
NativeEnumerated_encode_xer
;
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
jer_type_encoder_f
NativeEnumerated_encode_jer
;
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
oer_type_decoder_f
NativeEnumerated_decode_oer
;
oer_type_encoder_f
NativeEnumerated_encode_oer
;
...
...
skeletons/NativeReal.c
View file @
f5af86c1
...
...
@@ -60,6 +60,11 @@ asn_TYPE_operation_t asn_OP_NativeReal = {
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
NativeReal_encode_jer
,
#else
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
NativeReal_decode_oer
,
NativeReal_encode_oer
,
...
...
skeletons/NativeReal.h
View file @
f5af86c1
...
...
@@ -50,6 +50,10 @@ xer_type_decoder_f NativeReal_decode_xer;
xer_type_encoder_f
NativeReal_encode_xer
;
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
jer_type_encoder_f
NativeReal_encode_jer
;
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
oer_type_decoder_f
NativeReal_decode_oer
;
oer_type_encoder_f
NativeReal_encode_oer
;
...
...
skeletons/NumericString.c
View file @
f5af86c1
...
...
@@ -61,6 +61,11 @@ asn_TYPE_operation_t asn_OP_NumericString = {
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
OCTET_STRING_encode_jer_utf8
,
#else
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
OCTET_STRING_decode_oer
,
OCTET_STRING_encode_oer
,
...
...
skeletons/OBJECT_IDENTIFIER.c
View file @
f5af86c1
...
...
@@ -38,6 +38,11 @@ asn_TYPE_operation_t asn_OP_OBJECT_IDENTIFIER = {
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
OBJECT_IDENTIFIER_encode_jer
,
#else
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
OBJECT_IDENTIFIER_decode_oer
,
OBJECT_IDENTIFIER_encode_oer
,
...
...
skeletons/OCTET_STRING.c
View file @
f5af86c1
...
...
@@ -41,11 +41,9 @@ asn_TYPE_operation_t asn_OP_OCTET_STRING = {
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
0
,
OCTET_STRING_encode_jer
,
#else
0
,
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
OCTET_STRING_decode_oer
,
...
...
skeletons/ObjectDescriptor.c
View file @
f5af86c1
...
...
@@ -34,6 +34,11 @@ asn_TYPE_operation_t asn_OP_ObjectDescriptor = {
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
OCTET_STRING_encode_jer_utf8
,
#else
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
0
,
0
,
...
...
skeletons/PrintableString.c
View file @
f5af86c1
...
...
@@ -71,6 +71,11 @@ asn_TYPE_operation_t asn_OP_PrintableString = {
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
OCTET_STRING_encode_jer_utf8
,
#else
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
OCTET_STRING_decode_oer
,
OCTET_STRING_encode_oer
,
...
...
skeletons/PrintableString.h
View file @
f5af86c1
...
...
@@ -36,6 +36,10 @@ asn_constr_check_f PrintableString_constraint;
#define PrintableString_encode_xer OCTET_STRING_encode_xer_utf8
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
#define PrintableString_encode_jer OCTET_STRING_encode_jer_utf8
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_UPER_SUPPORT)
#define PrintableString_decode_uper OCTET_STRING_decode_uper
#define PrintableString_encode_uper OCTET_STRING_encode_uper
...
...
skeletons/REAL.c
View file @
f5af86c1
...
...
@@ -76,6 +76,11 @@ asn_TYPE_operation_t asn_OP_REAL = {
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
REAL_encode_jer
,
#else
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
REAL_decode_oer
,
REAL_encode_oer
,
...
...
skeletons/RELATIVE-OID.c
View file @
f5af86c1
...
...
@@ -36,6 +36,11 @@ asn_TYPE_operation_t asn_OP_RELATIVE_OID = {
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
RELATIVE_OID_encode_jer
,
#else
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
RELATIVE_OID_decode_oer
,
RELATIVE_OID_encode_oer
,
...
...
skeletons/RELATIVE-OID_jer.c
View file @
f5af86c1
...
...
@@ -6,59 +6,6 @@
#include <asn_internal.h>
#include <RELATIVE-OID.h>
static
enum
jer_pbd_rval
RELATIVE_OID__jer_body_decode
(
const
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
const
void
*
chunk_buf
,
size_t
chunk_size
)
{
RELATIVE_OID_t
*
st
=
(
RELATIVE_OID_t
*
)
sptr
;
const
char
*
chunk_end
=
(
const
char
*
)
chunk_buf
+
chunk_size
;
const
char
*
endptr
;
asn_oid_arc_t
s_arcs
[
6
];
asn_oid_arc_t
*
arcs
=
s_arcs
;
ssize_t
num_arcs
;
int
ret
;
(
void
)
td
;
num_arcs
=
OBJECT_IDENTIFIER_parse_arcs
(
(
const
char
*
)
chunk_buf
,
chunk_size
,
arcs
,
sizeof
(
s_arcs
)
/
sizeof
(
s_arcs
[
0
]),
&
endptr
);
if
(
num_arcs
<
0
)
{
/* Expecting at least one arc arcs */
return
XPBD_BROKEN_ENCODING
;
}
else
if
(
num_arcs
==
0
)
{
return
XPBD_NOT_BODY_IGNORE
;
}
assert
(
endptr
==
chunk_end
);
if
((
size_t
)
num_arcs
>
sizeof
(
s_arcs
)
/
sizeof
(
s_arcs
[
0
]))
{
arcs
=
(
asn_oid_arc_t
*
)
MALLOC
(
num_arcs
*
sizeof
(
arcs
[
0
]));
if
(
!
arcs
)
return
XPBD_SYSTEM_FAILURE
;
ret
=
OBJECT_IDENTIFIER_parse_arcs
((
const
char
*
)
chunk_buf
,
chunk_size
,
arcs
,
num_arcs
,
&
endptr
);
if
(
ret
!=
num_arcs
)
{
return
XPBD_SYSTEM_FAILURE
;
/* assert?.. */
}
}
/*
* Convert arcs into BER representation.
*/
ret
=
RELATIVE_OID_set_arcs
(
st
,
arcs
,
num_arcs
);
if
(
arcs
!=
s_arcs
)
FREEMEM
(
arcs
);
return
ret
?
XPBD_SYSTEM_FAILURE
:
XPBD_BODY_CONSUMED
;
}
asn_dec_rval_t
RELATIVE_OID_decode_jer
(
const
asn_codec_ctx_t
*
opt_codec_ctx
,
const
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
const
void
*
buf_ptr
,
size_t
size
)
{
return
jer_decode_primitive
(
opt_codec_ctx
,
td
,
sptr
,
sizeof
(
RELATIVE_OID_t
),
opt_mname
,
buf_ptr
,
size
,
RELATIVE_OID__jer_body_decode
);
}
asn_enc_rval_t
RELATIVE_OID_encode_jer
(
const
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
enum
jer_encoder_flags_e
flags
,
...
...
skeletons/T61String.c
View file @
f5af86c1
...
...
@@ -35,11 +35,9 @@ asn_TYPE_operation_t asn_OP_T61String = {
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
0
,
OCTET_STRING_encode_jer
,
#else
0
,
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
OCTET_STRING_decode_oer
,
...
...
skeletons/T61String.h
View file @
f5af86c1
...
...
@@ -36,6 +36,10 @@ extern asn_TYPE_operation_t asn_OP_T61String;
#define T61String_encode_xer OCTET_STRING_encode_xer
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
#define T61String_encode_jer OCTET_STRING_encode_jer
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_UPER_SUPPORT)
#define T61String_decode_uper OCTET_STRING_decode_uper
#define T61String_encode_uper OCTET_STRING_encode_uper
...
...
skeletons/TeletexString.c
View file @
f5af86c1
...
...
@@ -34,6 +34,11 @@ asn_TYPE_operation_t asn_OP_TeletexString = {
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
OCTET_STRING_encode_jer
,
#else
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
OCTET_STRING_decode_oer
,
OCTET_STRING_encode_oer
,
...
...
skeletons/UTCTime.c
View file @
f5af86c1
...
...
@@ -52,6 +52,11 @@ asn_TYPE_operation_t asn_OP_UTCTime = {
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
UTCTime_encode_jer
,
#else
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
OCTET_STRING_decode_oer
,
OCTET_STRING_encode_oer
,
...
...
skeletons/UTCTime.h
View file @
f5af86c1
...
...
@@ -36,6 +36,10 @@ asn_constr_check_f UTCTime_constraint;
xer_type_encoder_f
UTCTime_encode_xer
;
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
jer_type_encoder_f
UTCTime_encode_jer
;
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_UPER_SUPPORT)
#define UTCTime_decode_uper OCTET_STRING_decode_uper
#define UTCTime_encode_uper OCTET_STRING_encode_uper
...
...
skeletons/UniversalString.c
View file @
f5af86c1
...
...
@@ -46,6 +46,11 @@ asn_TYPE_operation_t asn_OP_UniversalString = {
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
UniversalString_encode_jer
,
/* Convert into UTF-8 */
#else
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
OCTET_STRING_decode_oer
,
OCTET_STRING_encode_oer
,
...
...
skeletons/UniversalString_jer.c
View file @
f5af86c1
...
...
@@ -7,64 +7,6 @@
#include <UniversalString.h>
#include <UTF8String.h>
asn_dec_rval_t
UniversalString_decode_jer
(
const
asn_codec_ctx_t
*
opt_codec_ctx
,
const
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
const
void
*
buf_ptr
,
size_t
size
)
{
asn_dec_rval_t
rc
;
rc
=
OCTET_STRING_decode_jer_utf8
(
opt_codec_ctx
,
td
,
sptr
,
opt_mname
,
buf_ptr
,
size
);
if
(
rc
.
code
==
RC_OK
)
{
/*
* Now we have a whole string in UTF-8 format.
* Convert it into UCS-4.
*/
uint32_t
*
wcs
;
size_t
wcs_len
;
UTF8String_t
*
st
;
#ifndef WORDS_BIGENDIAN
int
little_endian
=
1
;
#endif
assert
(
*
sptr
);
st
=
(
UTF8String_t
*
)
*
sptr
;
assert
(
st
->
buf
);
wcs_len
=
UTF8String_to_wcs
(
st
,
0
,
0
);
wcs
=
(
uint32_t
*
)
MALLOC
(
4
*
(
wcs_len
+
1
));
if
(
wcs
==
0
||
UTF8String_to_wcs
(
st
,
wcs
,
wcs_len
)
!=
wcs_len
)
{
rc
.
code
=
RC_FAIL
;
rc
.
consumed
=
0
;
return
rc
;
}
else
{
wcs
[
wcs_len
]
=
0
;
/* nul-terminate */
}
#ifndef WORDS_BIGENDIAN
if
(
*
(
char
*
)
&
little_endian
)
{
/* Swap byte order in encoding */
uint32_t
*
wc
=
wcs
;
uint32_t
*
wc_end
=
wcs
+
wcs_len
;
for
(;
wc
<
wc_end
;
wc
++
)
{
/* *wc = htonl(*wc); */
uint32_t
wch
=
*
wc
;
*
((
uint8_t
*
)
wc
+
0
)
=
wch
>>
24
;
*
((
uint8_t
*
)
wc
+
1
)
=
wch
>>
16
;
*
((
uint8_t
*
)
wc
+
2
)
=
wch
>>
8
;
*
((
uint8_t
*
)
wc
+
3
)
=
wch
;
}
}
#endif
/* WORDS_BIGENDIAN */
FREEMEM
(
st
->
buf
);
st
->
buf
=
(
uint8_t
*
)
wcs
;
st
->
size
=
4
*
wcs_len
;
}
return
rc
;
}
asn_enc_rval_t
UniversalString_encode_jer
(
const
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
enum
jer_encoder_flags_e
flags
,
...
...
skeletons/VideotexString.c
View file @
f5af86c1
...
...
@@ -35,11 +35,9 @@ asn_TYPE_operation_t asn_OP_VideotexString = {
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
0
,
OCTET_STRING_encode_jer
,
#else
0
,
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
OCTET_STRING_decode_oer
,
...
...
skeletons/VideotexString.h
View file @
f5af86c1
...
...
@@ -36,6 +36,10 @@ extern asn_TYPE_operation_t asn_OP_VideotexString;
#define VideotexString_encode_xer OCTET_STRING_encode_xer
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
#define VideotexString_encode_jer OCTET_STRING_encode_jer
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_UPER_SUPPORT)
#define VideotexString_decode_uper OCTET_STRING_decode_uper
#define VideotexString_encode_uper OCTET_STRING_encode_uper
...
...
skeletons/VisibleString.c
View file @
f5af86c1
...
...
@@ -41,6 +41,11 @@ asn_TYPE_operation_t asn_OP_VisibleString = {
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
OCTET_STRING_encode_jer_utf8
,
#else
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
OCTET_STRING_decode_oer
,
OCTET_STRING_encode_oer
,
...
...
skeletons/constr_CHOICE.c
View file @
f5af86c1
...
...
@@ -28,11 +28,9 @@ asn_TYPE_operation_t asn_OP_CHOICE = {
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
0
,
CHOICE_encode_jer
,
#else
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
CHOICE_decode_oer
,
...
...
skeletons/constr_SEQUENCE_OF.c
View file @
f5af86c1
...
...
@@ -29,6 +29,11 @@ asn_TYPE_operation_t asn_OP_SEQUENCE_OF = {
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
SEQUENCE_OF_encode_jer
,
#else
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
SEQUENCE_OF_decode_oer
,
/* Same as SET OF decoder. */
SEQUENCE_OF_encode_oer
,
/* Same as SET OF encoder */
...
...
skeletons/constr_SEQUENCE_OF.h
View file @
f5af86c1
...
...
@@ -36,6 +36,10 @@ der_type_encoder_f SEQUENCE_OF_encode_der;
xer_type_encoder_f
SEQUENCE_OF_encode_xer
;
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
jer_type_encoder_f
SEQUENCE_OF_encode_jer
;
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
#define SEQUENCE_OF_decode_oer SET_OF_decode_oer
#define SEQUENCE_OF_encode_oer SET_OF_encode_oer
...
...
skeletons/constr_SET.c
View file @
f5af86c1
...
...
@@ -28,6 +28,11 @@ asn_TYPE_operation_t asn_OP_SET = {
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
SET_encode_jer
,
#else
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
0
,
/* SET_decode_oer */
0
,
/* SET_encode_oer */
...
...
skeletons/constr_SET.h
View file @
f5af86c1
...
...
@@ -65,6 +65,10 @@ xer_type_decoder_f SET_decode_xer;
xer_type_encoder_f
SET_encode_xer
;
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
jer_type_encoder_f
SET_encode_jer
;
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_UPER_SUPPORT)
per_type_decoder_f
SET_decode_uper
;
per_type_encoder_f
SET_encode_uper
;
...
...
skeletons/constr_SET_OF.c
View file @
f5af86c1
...
...
@@ -28,6 +28,11 @@ asn_TYPE_operation_t asn_OP_SET_OF = {
0
,
0
,
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
SET_OF_encode_jer
,
#else
0
,
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
SET_OF_decode_oer
,
SET_OF_encode_oer
,
...
...
skeletons/constr_SET_OF_jer.c
View file @
f5af86c1
...
...
@@ -6,31 +6,6 @@
#include <asn_internal.h>
#include <constr_SET_OF.h>
/*
* Return a standardized complex structure.
*/
#undef RETURN
#define RETURN(_code) \
do { \
rval.code = _code; \
rval.consumed = consumed_myself; \
return rval; \
} while(0)
#undef JER_ADVANCE
#define JER_ADVANCE(num_bytes) \
do { \
size_t num = num_bytes; \
buf_ptr = ((const char *)buf_ptr) + num; \
size -= num; \
consumed_myself += num; \
} while(0)
typedef
struct
jer_tmp_enc_s
{
void
*
buffer
;
size_t
offset
;
size_t
size
;
}
jer_tmp_enc_t
;
static
int
SET_OF_encode_jer_callback
(
const
void
*
buffer
,
size_t
size
,
void
*
key
)
{
...
...
skeletons/constr_SET_jer.c
View file @
f5af86c1
...
...
@@ -6,245 +6,6 @@
#include <asn_internal.h>
#include <constr_SET.h>
/*
* Return a standardized complex structure.
*/
#undef RETURN
#define RETURN(_code) \
do { \
rval.code = _code; \
rval.consumed = consumed_myself; \
return rval; \
} while(0)
#undef JER_ADVANCE
#define JER_ADVANCE(num_bytes) \
do { \
size_t num = num_bytes; \
buf_ptr = ((const char *)buf_ptr) + num; \
size -= num; \
consumed_myself += num; \
} while(0)
/*
* Decode the JER (XML) data.
*/
asn_dec_rval_t
SET_decode_jer
(
const
asn_codec_ctx_t
*
opt_codec_ctx
,
const
asn_TYPE_descriptor_t
*
td
,
void
**
struct_ptr
,
const
char
*
opt_mname
,
const
void
*
buf_ptr
,
size_t
size
)
{
/*
* Bring closer parts of structure description.
*/
const
asn_SET_specifics_t
*
specs
=
(
const
asn_SET_specifics_t
*
)
td
->
specifics
;
const
asn_TYPE_member_t
*
elements
=
td
->
elements
;
const
char
*
xml_tag
=
opt_mname
?
opt_mname
:
td
->
xml_tag
;
/*
* ... and parts of the structure being constructed.
*/
void
*
st
=
*
struct_ptr
;
/* Target structure. */
asn_struct_ctx_t
*
ctx
;
/* Decoder context */
asn_dec_rval_t
rval
;
/* Return value from a decoder */
ssize_t
consumed_myself
=
0
;
/* Consumed bytes from ptr */
size_t
edx
;
/* Element index */
/*
* Create the target structure if it is not present already.
*/
if
(
st
==
0
)
{
st
=
*
struct_ptr
=
CALLOC
(
1
,
specs
->
struct_size
);
if
(
st
==
0
)
RETURN
(
RC_FAIL
);
}
/*
* Restore parsing context.
*/
ctx
=
(
asn_struct_ctx_t
*
)((
char
*
)
st
+
specs
->
ctx_offset
);
/*
* Phases of JER/XML processing:
* Phase 0: Check that the opening tag matches our expectations.
* Phase 1: Processing body and reacting on closing tag.
* Phase 2: Processing inner type.
* Phase 3: Skipping unknown extensions.
* Phase 4: PHASED OUT
*/
for
(
edx
=
ctx
->
step
;
ctx
->
phase
<=
3
;)
{
pjer_chunk_type_e
ch_type
;
/* JER chunk type */
ssize_t
ch_size
;
/* Chunk size */
jer_check_tag_e
tcv
;
/* Tag check value */
const
asn_TYPE_member_t
*
elm
;
/*
* Go inside the inner member of a set.
*/
if
(
ctx
->
phase
==
2
)
{
asn_dec_rval_t
tmprval
;
void
*
memb_ptr_dontuse
;
/* Pointer to the member */
void
**
memb_ptr2
;
/* Pointer to that pointer */
if
(
ASN_SET_ISPRESENT2
((
char
*
)
st
+
specs
->
pres_offset
,
edx
))
{
ASN_DEBUG
(
"SET %s: Duplicate element %s (%"
ASN_PRI_SSIZE
")"
,
td
->
name
,
elements
[
edx
].
name
,
edx
);
RETURN
(
RC_FAIL
);
}
elm
=
&
elements
[
edx
];
if
(
elm
->
flags
&
ATF_POINTER
)
{
/* Member is a pointer to another structure */
memb_ptr2
=
(
void
**
)((
char
*
)
st
+
elm
->
memb_offset
);
}
else
{
memb_ptr_dontuse
=
(
char
*
)
st
+
elm
->
memb_offset
;
memb_ptr2
=
&
memb_ptr_dontuse
;
/* Only use of memb_ptr_dontuse */
}
/* Invoke the inner type decoder, m.b. multiple times */
tmprval
=
elm
->
type
->
op
->
jer_decoder
(
opt_codec_ctx
,
elm
->
type
,
memb_ptr2
,
elm
->
name
,
buf_ptr
,
size
);
JER_ADVANCE
(
tmprval
.
consumed
);
if
(
tmprval
.
code
!=
RC_OK
)
RETURN
(
tmprval
.
code
);
ctx
->
phase
=
1
;
/* Back to body processing */
ASN_SET_MKPRESENT
((
char
*
)
st
+
specs
->
pres_offset
,
edx
);
ASN_DEBUG
(
"JER/SET phase => %d"
,
ctx
->
phase
);
/* Fall through */
}
/*
* Get the next part of the XML stream.
*/
ch_size
=
jer_next_token
(
&
ctx
->
context
,
buf_ptr
,
size
,
&
ch_type
);
if
(
ch_size
==
-
1
)
{
RETURN
(
RC_FAIL
);
}
else
{
switch
(
ch_type
)
{
case
PJER_WMORE
:
RETURN
(
RC_WMORE
);
case
PJER_COMMENT
:
/* Got XML comment */
case
PJER_TEXT
:
/* Ignore free-standing text */
JER_ADVANCE
(
ch_size
);
/* Skip silently */
continue
;
case
PJER_TAG
:
break
;
/* Check the rest down there */
}
}
tcv
=
jer_check_tag
(
buf_ptr
,
ch_size
,
xml_tag
);
ASN_DEBUG
(
"JER/SET: tcv = %d, ph=%d"
,
tcv
,
ctx
->
phase
);
/* Skip the extensions section */
if
(
ctx
->
phase
==
3
)
{
switch
(
jer_skip_unknown
(
tcv
,
&
ctx
->
left
))
{
case
-
1
:
ctx
->
phase
=
4
;
RETURN
(
RC_FAIL
);
case
1
:
ctx
->
phase
=
1
;
/* Fall through */
case
0
:
JER_ADVANCE
(
ch_size
);
continue
;
case
2
:
ctx
->
phase
=
1
;
break
;
}
}
switch
(
tcv
)
{
case
XCT_CLOSING
:
if
(
ctx
->
phase
==
0
)
break
;
ctx
->
phase
=
0
;
/* Fall through */
case
XCT_BOTH
:
if
(
ctx
->
phase
==
0
)
{
if
(
_SET_is_populated
(
td
,
st
))
{
JER_ADVANCE
(
ch_size
);
ctx
->
phase
=
4
;
/* Phase out */
RETURN
(
RC_OK
);
}
else
{
ASN_DEBUG
(
"Premature end of JER SET"
);
RETURN
(
RC_FAIL
);
}
}
/* Fall through */
case
XCT_OPENING
:
if
(
ctx
->
phase
==
0
)
{
JER_ADVANCE
(
ch_size
);
ctx
->
phase
=
1
;
/* Processing body phase */
continue
;
}
/* Fall through */
case
XCT_UNKNOWN_OP
:
case
XCT_UNKNOWN_BO
:
ASN_DEBUG
(
"JER/SET: tcv=%d, ph=%d"
,
tcv
,
ctx
->
phase
);
if
(
ctx
->
phase
!=
1
)
break
;
/* Really unexpected */
/*
* Search which member corresponds to this tag.
*/
for
(
edx
=
0
;
edx
<
td
->
elements_count
;
edx
++
)
{
switch
(
jer_check_tag
(
buf_ptr
,
ch_size
,
elements
[
edx
].
name
))
{
case
XCT_BOTH
:
case
XCT_OPENING
:
/*
* Process this member.
*/
ctx
->
step
=
edx
;
ctx
->
phase
=
2
;
break
;
case
XCT_UNKNOWN_OP
:
case
XCT_UNKNOWN_BO
:
continue
;
default:
edx
=
td
->
elements_count
;
break
;
/* Phase out */
}
break
;
}
if
(
edx
!=
td
->
elements_count
)
continue
;
/* It is expected extension */
if
(
specs
->
extensible
)
{
ASN_DEBUG
(
"Got anticipated extension"
);
/*
* Check for (XCT_BOTH or XCT_UNKNOWN_BO)
* By using a mask. Only record a pure
* <opening> tags.
*/
if
(
tcv
&
XCT_CLOSING
)
{
/* Found </extension> without body */
}
else
{
ctx
->
left
=
1
;
ctx
->
phase
=
3
;
/* Skip ...'s */
}
JER_ADVANCE
(
ch_size
);
continue
;
}
/* Fall through */
default:
break
;
}
ASN_DEBUG
(
"Unexpected XML tag in SET, expected
\"
%s
\"
"
,
xml_tag
);
break
;
}
ctx
->
phase
=
4
;
/* "Phase out" on hard failure */
RETURN
(
RC_FAIL
);
}
asn_enc_rval_t
SET_encode_jer
(
const
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
enum
jer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
...
...
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