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
ca4ee3bf
Commit
ca4ee3bf
authored
Sep 30, 2021
by
Senthil Prabakaran
Committed by
Mouse
May 02, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update to compile
parent
acb43807
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
13 additions
and
200 deletions
+13
-200
skeletons/ANY_jer.c
skeletons/ANY_jer.c
+3
-8
skeletons/BIT_STRING_jer.c
skeletons/BIT_STRING_jer.c
+1
-1
skeletons/BOOLEAN.h
skeletons/BOOLEAN.h
+4
-0
skeletons/asn_application.c
skeletons/asn_application.c
+1
-1
skeletons/asn_codecs_prim_jer.c
skeletons/asn_codecs_prim_jer.c
+0
-184
skeletons/constr_CHOICE_jer.c
skeletons/constr_CHOICE_jer.c
+0
-3
skeletons/constr_SEQUENCE_OF_jer.c
skeletons/constr_SEQUENCE_OF_jer.c
+1
-1
skeletons/constr_SEQUENCE_jer.c
skeletons/constr_SEQUENCE_jer.c
+1
-1
skeletons/constr_TYPE.h
skeletons/constr_TYPE.h
+1
-0
skeletons/file-dependencies
skeletons/file-dependencies
+1
-1
No files found.
skeletons/ANY_jer.c
View file @
ca4ee3bf
...
...
@@ -10,13 +10,8 @@ asn_enc_rval_t
ANY_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
,
void
*
app_key
)
{
if
(
flags
&
JER_F_CANONICAL
)
{
/*
* Canonical JER-encoding of ANY type is not supported.
*/
ASN__ENCODE_FAILED
;
}
ASN__ENCODE_FAILED
;
/* Dump as binary */
return
OCTET_STRING_encode_jer
(
td
,
sptr
,
ilevel
,
flags
,
cb
,
app_key
);
/* Dump as binary */
return
OCTET_STRING_encode_jer
(
td
,
sptr
,
ilevel
,
flags
,
cb
,
app_key
);
}
skeletons/BIT_STRING_jer.c
View file @
ca4ee3bf
...
...
@@ -20,7 +20,7 @@ BIT_STRING_encode_jer(const asn_TYPE_descriptor_t *td, const void *sptr,
char
*
p
=
scratch
;
char
*
scend
=
scratch
+
(
sizeof
(
scratch
)
-
10
);
const
BIT_STRING_t
*
st
=
(
const
BIT_STRING_t
*
)
sptr
;
int
xcan
=
(
flags
&
JER_F_CANONICAL
)
;
int
xcan
=
0
;
uint8_t
*
buf
;
uint8_t
*
end
;
...
...
skeletons/BOOLEAN.h
View file @
ca4ee3bf
...
...
@@ -41,6 +41,10 @@ xer_type_decoder_f BOOLEAN_decode_xer;
xer_type_encoder_f
BOOLEAN_encode_xer
;
#endif
/* !defined(ASN_DISABLE_XER_SUPPORT) */
#if !defined(ASN_DISABLE_JER_SUPPORT)
jer_type_encoder_f
BOOLEAN_encode_jer
;
#endif
/* !defined(ASN_DISABLE_JER_SUPPORT) */
#if !defined(ASN_DISABLE_OER_SUPPORT)
oer_type_decoder_f
BOOLEAN_decode_oer
;
oer_type_encoder_f
BOOLEAN_encode_oer
;
...
...
skeletons/asn_application.c
View file @
ca4ee3bf
...
...
@@ -434,7 +434,7 @@ asn_encode_internal(const asn_codec_ctx_t *opt_codec_ctx,
#if !defined(ASN_DISABLE_JER_SUPPORT)
case
ATS_BASIC_JER
:
if
(
td
->
op
->
jer_encoder
)
{
er
=
jer_encode
(
td
,
sptr
,
0
,
callback
,
callback_key
);
er
=
jer_encode
(
td
,
sptr
,
callback
,
callback_key
);
if
(
er
.
encoded
==
-
1
)
{
if
(
er
.
failed_type
&&
er
.
failed_type
->
op
->
jer_encoder
)
{
errno
=
EBADF
;
/* Structure has incorrect form. */
...
...
skeletons/asn_codecs_prim_jer.c
deleted
100644 → 0
View file @
acb43807
/*
* Copyright (c) 2017 Lev Walkin <vlm@lionet.info>.
* All rights reserved.
* Redistribution and modifications are permitted subject to BSD license.
*/
#include <asn_internal.h>
#include <asn_codecs_prim.h>
/*
* Local internal type passed around as an argument.
*/
struct
xdp_arg_s
{
const
asn_TYPE_descriptor_t
*
type_descriptor
;
void
*
struct_key
;
xer_primitive_body_decoder_f
*
prim_body_decoder
;
int
decoded_something
;
int
want_more
;
};
/*
* Since some kinds of primitive values can be encoded using value-specific
* tags (<MINUS-INFINITY>, <enum-element>, etc), the primitive decoder must
* be supplied with such tags to parse them as needed.
*/
static
int
jer_decode__unexpected_tag
(
void
*
key
,
const
void
*
chunk_buf
,
size_t
chunk_size
)
{
struct
xdp_arg_s
*
arg
=
(
struct
xdp_arg_s
*
)
key
;
enum
jer_pbd_rval
bret
;
/*
* The chunk_buf is guaranteed to start at '<'.
*/
assert
(
chunk_size
&&
((
const
char
*
)
chunk_buf
)[
0
]
==
0x3c
);
/*
* Decoding was performed once already. Prohibit doing it again.
*/
if
(
arg
->
decoded_something
)
return
-
1
;
bret
=
arg
->
prim_body_decoder
(
arg
->
type_descriptor
,
arg
->
struct_key
,
chunk_buf
,
chunk_size
);
switch
(
bret
)
{
case
XPBD_SYSTEM_FAILURE
:
case
XPBD_DECODER_LIMIT
:
case
XPBD_BROKEN_ENCODING
:
break
;
case
XPBD_BODY_CONSUMED
:
/* Tag decoded successfully */
arg
->
decoded_something
=
1
;
/* Fall through */
case
XPBD_NOT_BODY_IGNORE
:
/* Safe to proceed further */
return
0
;
}
return
-
1
;
}
static
ssize_t
jer_decode__primitive_body
(
void
*
key
,
const
void
*
chunk_buf
,
size_t
chunk_size
,
int
have_more
)
{
struct
xdp_arg_s
*
arg
=
(
struct
xdp_arg_s
*
)
key
;
enum
jer_pbd_rval
bret
;
size_t
lead_wsp_size
;
if
(
arg
->
decoded_something
)
{
if
(
jer_whitespace_span
(
chunk_buf
,
chunk_size
)
==
chunk_size
)
{
/*
* Example:
* "<INTEGER>123<!--/--> </INTEGER>"
* ^- chunk_buf position.
*/
return
chunk_size
;
}
/*
* Decoding was done once already. Prohibit doing it again.
*/
return
-
1
;
}
if
(
!
have_more
)
{
/*
* If we've received something like "1", we can't really
* tell whether it is really `1` or `123`, until we know
* that there is no more data coming.
* The have_more argument will be set to 1 once something
* like this is available to the caller of this callback:
* "1<tag_start..."
*/
arg
->
want_more
=
1
;
return
-
1
;
}
lead_wsp_size
=
jer_whitespace_span
(
chunk_buf
,
chunk_size
);
chunk_buf
=
(
chunk_buf
==
NULL
)
?
NULL
:
((
const
char
*
)
chunk_buf
+
lead_wsp_size
);
chunk_size
-=
lead_wsp_size
;
bret
=
arg
->
prim_body_decoder
(
arg
->
type_descriptor
,
arg
->
struct_key
,
chunk_buf
,
chunk_size
);
switch
(
bret
)
{
case
XPBD_SYSTEM_FAILURE
:
case
XPBD_DECODER_LIMIT
:
case
XPBD_BROKEN_ENCODING
:
break
;
case
XPBD_BODY_CONSUMED
:
/* Tag decoded successfully */
arg
->
decoded_something
=
1
;
/* Fall through */
case
XPBD_NOT_BODY_IGNORE
:
/* Safe to proceed further */
return
lead_wsp_size
+
chunk_size
;
}
return
-
1
;
}
asn_dec_rval_t
jer_decode_primitive
(
const
asn_codec_ctx_t
*
opt_codec_ctx
,
const
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
size_t
struct_size
,
const
char
*
opt_mname
,
const
void
*
buf_ptr
,
size_t
size
,
jer_primitive_body_decoder_f
*
prim_body_decoder
)
{
const
char
*
xml_tag
=
opt_mname
?
opt_mname
:
td
->
xml_tag
;
asn_struct_ctx_t
s_ctx
;
struct
xdp_arg_s
s_arg
;
asn_dec_rval_t
rc
;
/*
* Create the structure if does not exist.
*/
if
(
!*
sptr
)
{
*
sptr
=
CALLOC
(
1
,
struct_size
);
if
(
!*
sptr
)
ASN__DECODE_FAILED
;
}
memset
(
&
s_ctx
,
0
,
sizeof
(
s_ctx
));
s_arg
.
type_descriptor
=
td
;
s_arg
.
struct_key
=
*
sptr
;
s_arg
.
prim_body_decoder
=
prim_body_decoder
;
s_arg
.
decoded_something
=
0
;
s_arg
.
want_more
=
0
;
rc
=
jer_decode_general
(
opt_codec_ctx
,
&
s_ctx
,
&
s_arg
,
xml_tag
,
buf_ptr
,
size
,
jer_decode__unexpected_tag
,
jer_decode__primitive_body
);
switch
(
rc
.
code
)
{
case
RC_OK
:
if
(
!
s_arg
.
decoded_something
)
{
char
ch
;
ASN_DEBUG
(
"Primitive body is not recognized, "
"supplying empty one"
);
/*
* Decoding opportunity has come and gone.
* Where's the result?
* Try to feed with empty body, see if it eats it.
*/
if
(
prim_body_decoder
(
s_arg
.
type_descriptor
,
s_arg
.
struct_key
,
&
ch
,
0
)
!=
XPBD_BODY_CONSUMED
)
{
/*
* This decoder does not like empty stuff.
*/
ASN__DECODE_FAILED
;
}
}
break
;
case
RC_WMORE
:
/*
* Redo the whole thing later.
* We don't have a context to save intermediate parsing state.
*/
rc
.
consumed
=
0
;
break
;
case
RC_FAIL
:
rc
.
consumed
=
0
;
if
(
s_arg
.
want_more
)
rc
.
code
=
RC_WMORE
;
else
ASN__DECODE_FAILED
;
break
;
}
return
rc
;
}
skeletons/constr_CHOICE_jer.c
View file @
ca4ee3bf
...
...
@@ -62,7 +62,6 @@ CHOICE_encode_jer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
er
.
encoded
=
0
;
if
(
!
(
flags
&
JER_F_CANONICAL
))
ASN__TEXT_INDENT
(
1
,
ilevel
);
ASN__CALLBACK3
(
"<"
,
1
,
mname
,
mlen
,
">"
,
1
);
tmper
=
elm
->
type
->
op
->
jer_encoder
(
elm
->
type
,
memb_ptr
,
...
...
@@ -73,8 +72,6 @@ CHOICE_encode_jer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
ASN__CALLBACK3
(
"</"
,
2
,
mname
,
mlen
,
">"
,
1
);
}
if
(
!
(
flags
&
JER_F_CANONICAL
))
ASN__TEXT_INDENT
(
1
,
ilevel
-
1
);
ASN__ENCODED_OK
(
er
);
cb_failed:
ASN__ENCODE_FAILED
;
...
...
skeletons/constr_SEQUENCE_OF_jer.c
View file @
ca4ee3bf
...
...
@@ -19,7 +19,7 @@ SEQUENCE_OF_encode_jer(const asn_TYPE_descriptor_t *td, const void *sptr,
?
0
:
((
*
elm
->
name
)
?
elm
->
name
:
elm
->
type
->
xml_tag
);
size_t
mlen
=
mname
?
strlen
(
mname
)
:
0
;
int
xcan
=
(
flags
&
JER_F_CANONICAL
)
;
int
xcan
=
0
;
int
i
;
if
(
!
sptr
)
ASN__ENCODE_FAILED
;
...
...
skeletons/constr_SEQUENCE_jer.c
View file @
ca4ee3bf
...
...
@@ -34,7 +34,7 @@
consumed_myself += num; \
} while(0)
SEQUENCE_encode_jer
(
const
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
asn_enc_rval_t
SEQUENCE_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
,
void
*
app_key
)
{
asn_enc_rval_t
er
=
{
0
,
0
,
0
};
...
...
skeletons/constr_TYPE.h
View file @
ca4ee3bf
...
...
@@ -185,6 +185,7 @@ typedef struct asn_TYPE_operation_s {
per_type_encoder_f
*
aper_encoder
;
/* Aligned PER encoder */
asn_random_fill_f
*
random_fill
;
/* Initialize with a random value */
asn_outmost_tag_f
*
outmost_tag
;
/* <optional, internal> */
jer_type_encoder_f
*
jer_encoder
;
/* Generic JER encoder */
}
asn_TYPE_operation_t
;
/*
...
...
skeletons/file-dependencies
View file @
ca4ee3bf
...
...
@@ -264,7 +264,7 @@ REAL.h REAL_jer.c
RELATIVE-OID.h RELATIVE-OID_jer.c
UTCTime.h UTCTime_jer.c
UniversalString.h UniversalString_jer.c
asn_codecs_prim.h
asn_codecs_prim_jer.c
asn_codecs_prim.h
constr_CHOICE.h constr_CHOICE_jer.c
constr_SEQUENCE_OF.h constr_SEQUENCE_OF_jer.c
constr_SEQUENCE.h constr_SEQUENCE_jer.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