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
8c3b8540
Commit
8c3b8540
authored
Mar 10, 2005
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added const qualifier
parent
fb617704
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
107 additions
and
104 deletions
+107
-104
skeletons/BMPString.c
skeletons/BMPString.c
+1
-1
skeletons/BOOLEAN.c
skeletons/BOOLEAN.c
+4
-4
skeletons/INTEGER.c
skeletons/INTEGER.c
+1
-1
skeletons/NULL.c
skeletons/NULL.c
+1
-1
skeletons/NativeInteger.c
skeletons/NativeInteger.c
+4
-4
skeletons/NativeReal.c
skeletons/NativeReal.c
+4
-4
skeletons/OBJECT_IDENTIFIER.c
skeletons/OBJECT_IDENTIFIER.c
+1
-1
skeletons/OCTET_STRING.c
skeletons/OCTET_STRING.c
+13
-13
skeletons/REAL.c
skeletons/REAL.c
+1
-1
skeletons/RELATIVE-OID.c
skeletons/RELATIVE-OID.c
+1
-1
skeletons/UniversalString.c
skeletons/UniversalString.c
+1
-1
skeletons/asn_codecs_prim.c
skeletons/asn_codecs_prim.c
+3
-3
skeletons/asn_codecs_prim.h
skeletons/asn_codecs_prim.h
+1
-1
skeletons/ber_decoder.c
skeletons/ber_decoder.c
+5
-5
skeletons/ber_decoder.h
skeletons/ber_decoder.h
+3
-3
skeletons/ber_tlv_length.c
skeletons/ber_tlv_length.c
+9
-9
skeletons/ber_tlv_length.h
skeletons/ber_tlv_length.h
+2
-2
skeletons/ber_tlv_tag.c
skeletons/ber_tlv_tag.c
+6
-5
skeletons/ber_tlv_tag.h
skeletons/ber_tlv_tag.h
+2
-2
skeletons/constr_CHOICE.c
skeletons/constr_CHOICE.c
+8
-7
skeletons/constr_SEQUENCE.c
skeletons/constr_SEQUENCE.c
+11
-10
skeletons/constr_SET.c
skeletons/constr_SET.c
+11
-11
skeletons/constr_SET_OF.c
skeletons/constr_SET_OF.c
+9
-9
skeletons/xer_decoder.c
skeletons/xer_decoder.c
+1
-1
skeletons/xer_decoder.h
skeletons/xer_decoder.h
+4
-4
No files found.
skeletons/BMPString.c
View file @
8c3b8540
...
@@ -79,7 +79,7 @@ BMPString__dump(const BMPString_t *st,
...
@@ -79,7 +79,7 @@ BMPString__dump(const BMPString_t *st,
asn_dec_rval_t
asn_dec_rval_t
BMPString_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
BMPString_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
void
*
buf_ptr
,
size_t
size
)
{
const
char
*
opt_mname
,
const
void
*
buf_ptr
,
size_t
size
)
{
asn_dec_rval_t
rc
;
asn_dec_rval_t
rc
;
rc
=
OCTET_STRING_decode_xer_utf8
(
opt_codec_ctx
,
td
,
sptr
,
opt_mname
,
rc
=
OCTET_STRING_decode_xer_utf8
(
opt_codec_ctx
,
td
,
sptr
,
opt_mname
,
...
...
skeletons/BOOLEAN.c
View file @
8c3b8540
...
@@ -37,7 +37,7 @@ asn_TYPE_descriptor_t asn_DEF_BOOLEAN = {
...
@@ -37,7 +37,7 @@ asn_TYPE_descriptor_t asn_DEF_BOOLEAN = {
asn_dec_rval_t
asn_dec_rval_t
BOOLEAN_decode_ber
(
asn_codec_ctx_t
*
opt_codec_ctx
,
BOOLEAN_decode_ber
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
asn_TYPE_descriptor_t
*
td
,
void
**
bool_value
,
void
*
buf_ptr
,
size_t
size
,
void
**
bool_value
,
const
void
*
buf_ptr
,
size_t
size
,
int
tag_mode
)
{
int
tag_mode
)
{
BOOLEAN_t
*
st
=
(
BOOLEAN_t
*
)
*
bool_value
;
BOOLEAN_t
*
st
=
(
BOOLEAN_t
*
)
*
bool_value
;
asn_dec_rval_t
rval
;
asn_dec_rval_t
rval
;
...
@@ -66,7 +66,7 @@ BOOLEAN_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -66,7 +66,7 @@ BOOLEAN_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
ASN_DEBUG
(
"Boolean length is %d bytes"
,
(
int
)
length
);
ASN_DEBUG
(
"Boolean length is %d bytes"
,
(
int
)
length
);
buf_ptr
=
((
char
*
)
buf_ptr
)
+
rval
.
consumed
;
buf_ptr
=
((
c
onst
c
har
*
)
buf_ptr
)
+
rval
.
consumed
;
size
-=
rval
.
consumed
;
size
-=
rval
.
consumed
;
if
(
length
>
(
ber_tlv_len_t
)
size
)
{
if
(
length
>
(
ber_tlv_len_t
)
size
)
{
rval
.
code
=
RC_WMORE
;
rval
.
code
=
RC_WMORE
;
...
@@ -84,7 +84,7 @@ BOOLEAN_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -84,7 +84,7 @@ BOOLEAN_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
* value is already TRUE.
* value is already TRUE.
* BOOLEAN is not supposed to contain meaningful data anyway.
* BOOLEAN is not supposed to contain meaningful data anyway.
*/
*/
*
st
|=
((
uint8_t
*
)
buf_ptr
)[
lidx
];
*
st
|=
((
const
uint8_t
*
)
buf_ptr
)[
lidx
];
}
}
rval
.
code
=
RC_OK
;
rval
.
code
=
RC_OK
;
...
@@ -169,7 +169,7 @@ BOOLEAN__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chun
...
@@ -169,7 +169,7 @@ BOOLEAN__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chun
asn_dec_rval_t
asn_dec_rval_t
BOOLEAN_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
BOOLEAN_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
void
*
buf_ptr
,
size_t
size
)
{
const
void
*
buf_ptr
,
size_t
size
)
{
return
xer_decode_primitive
(
opt_codec_ctx
,
td
,
return
xer_decode_primitive
(
opt_codec_ctx
,
td
,
sptr
,
sizeof
(
BOOLEAN_t
),
opt_mname
,
buf_ptr
,
size
,
sptr
,
sizeof
(
BOOLEAN_t
),
opt_mname
,
buf_ptr
,
size
,
...
...
skeletons/INTEGER.c
View file @
8c3b8540
...
@@ -409,7 +409,7 @@ INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chun
...
@@ -409,7 +409,7 @@ INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chun
asn_dec_rval_t
asn_dec_rval_t
INTEGER_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
INTEGER_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
void
*
buf_ptr
,
size_t
size
)
{
const
void
*
buf_ptr
,
size_t
size
)
{
return
xer_decode_primitive
(
opt_codec_ctx
,
td
,
return
xer_decode_primitive
(
opt_codec_ctx
,
td
,
sptr
,
sizeof
(
INTEGER_t
),
opt_mname
,
sptr
,
sizeof
(
INTEGER_t
),
opt_mname
,
...
...
skeletons/NULL.c
View file @
8c3b8540
...
@@ -81,7 +81,7 @@ NULL__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_b
...
@@ -81,7 +81,7 @@ NULL__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_b
asn_dec_rval_t
asn_dec_rval_t
NULL_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
NULL_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
void
*
buf_ptr
,
size_t
size
)
{
const
void
*
buf_ptr
,
size_t
size
)
{
return
xer_decode_primitive
(
opt_codec_ctx
,
td
,
return
xer_decode_primitive
(
opt_codec_ctx
,
td
,
sptr
,
sizeof
(
NULL_t
),
opt_mname
,
buf_ptr
,
size
,
sptr
,
sizeof
(
NULL_t
),
opt_mname
,
buf_ptr
,
size
,
...
...
skeletons/NativeInteger.c
View file @
8c3b8540
...
@@ -44,7 +44,7 @@ asn_TYPE_descriptor_t asn_DEF_NativeInteger = {
...
@@ -44,7 +44,7 @@ asn_TYPE_descriptor_t asn_DEF_NativeInteger = {
asn_dec_rval_t
asn_dec_rval_t
NativeInteger_decode_ber
(
asn_codec_ctx_t
*
opt_codec_ctx
,
NativeInteger_decode_ber
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
asn_TYPE_descriptor_t
*
td
,
void
**
nint_ptr
,
void
*
buf_ptr
,
size_t
size
,
int
tag_mode
)
{
void
**
nint_ptr
,
const
void
*
buf_ptr
,
size_t
size
,
int
tag_mode
)
{
long
*
native
=
(
long
*
)
*
nint_ptr
;
long
*
native
=
(
long
*
)
*
nint_ptr
;
asn_dec_rval_t
rval
;
asn_dec_rval_t
rval
;
ber_tlv_len_t
length
;
ber_tlv_len_t
length
;
...
@@ -77,7 +77,7 @@ NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -77,7 +77,7 @@ NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
/*
/*
* Make sure we have this length.
* Make sure we have this length.
*/
*/
buf_ptr
=
((
char
*
)
buf_ptr
)
+
rval
.
consumed
;
buf_ptr
=
((
c
onst
c
har
*
)
buf_ptr
)
+
rval
.
consumed
;
size
-=
rval
.
consumed
;
size
-=
rval
.
consumed
;
if
(
length
>
(
ber_tlv_len_t
)
size
)
{
if
(
length
>
(
ber_tlv_len_t
)
size
)
{
rval
.
code
=
RC_WMORE
;
rval
.
code
=
RC_WMORE
;
...
@@ -93,7 +93,7 @@ NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -93,7 +93,7 @@ NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
{
{
INTEGER_t
tmp
;
INTEGER_t
tmp
;
long
l
;
long
l
;
tmp
.
buf
=
(
uint8_t
*
)
buf_ptr
;
(
const
uint8_t
*
)
tmp
.
buf
=
(
const
uint8_t
*
)
buf_ptr
;
tmp
.
size
=
length
;
tmp
.
size
=
length
;
if
(
asn_INTEGER2long
(
&
tmp
,
&
l
))
{
if
(
asn_INTEGER2long
(
&
tmp
,
&
l
))
{
...
@@ -169,7 +169,7 @@ NativeInteger_encode_der(asn_TYPE_descriptor_t *sd, void *ptr,
...
@@ -169,7 +169,7 @@ NativeInteger_encode_der(asn_TYPE_descriptor_t *sd, void *ptr,
asn_dec_rval_t
asn_dec_rval_t
NativeInteger_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
NativeInteger_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
void
*
buf_ptr
,
size_t
size
)
{
const
void
*
buf_ptr
,
size_t
size
)
{
asn_dec_rval_t
rval
;
asn_dec_rval_t
rval
;
INTEGER_t
*
st
=
0
;
INTEGER_t
*
st
=
0
;
void
*
st_ptr
=
(
void
*
)
&
st
;
void
*
st_ptr
=
(
void
*
)
&
st
;
...
...
skeletons/NativeReal.c
View file @
8c3b8540
...
@@ -45,7 +45,7 @@ asn_TYPE_descriptor_t asn_DEF_NativeReal = {
...
@@ -45,7 +45,7 @@ asn_TYPE_descriptor_t asn_DEF_NativeReal = {
asn_dec_rval_t
asn_dec_rval_t
NativeReal_decode_ber
(
asn_codec_ctx_t
*
opt_codec_ctx
,
NativeReal_decode_ber
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
asn_TYPE_descriptor_t
*
td
,
void
**
dbl_ptr
,
void
*
buf_ptr
,
size_t
size
,
int
tag_mode
)
{
void
**
dbl_ptr
,
const
void
*
buf_ptr
,
size_t
size
,
int
tag_mode
)
{
double
*
Dbl
=
(
double
*
)
*
dbl_ptr
;
double
*
Dbl
=
(
double
*
)
*
dbl_ptr
;
asn_dec_rval_t
rval
;
asn_dec_rval_t
rval
;
ber_tlv_len_t
length
;
ber_tlv_len_t
length
;
...
@@ -79,7 +79,7 @@ NativeReal_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -79,7 +79,7 @@ NativeReal_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
/*
/*
* Make sure we have this length.
* Make sure we have this length.
*/
*/
buf_ptr
=
((
char
*
)
buf_ptr
)
+
rval
.
consumed
;
buf_ptr
=
((
c
onst
c
har
*
)
buf_ptr
)
+
rval
.
consumed
;
size
-=
rval
.
consumed
;
size
-=
rval
.
consumed
;
if
(
length
>
(
ber_tlv_len_t
)
size
)
{
if
(
length
>
(
ber_tlv_len_t
)
size
)
{
rval
.
code
=
RC_WMORE
;
rval
.
code
=
RC_WMORE
;
...
@@ -95,7 +95,7 @@ NativeReal_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -95,7 +95,7 @@ NativeReal_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
{
{
REAL_t
tmp
;
REAL_t
tmp
;
double
d
;
double
d
;
tmp
.
buf
=
(
uint8_t
*
)
buf_ptr
;
(
const
uint8_t
*
)
tmp
.
buf
=
(
const
uint8_t
*
)
buf_ptr
;
tmp
.
size
=
length
;
tmp
.
size
=
length
;
if
(
asn_REAL2double
(
&
tmp
,
&
d
))
{
if
(
asn_REAL2double
(
&
tmp
,
&
d
))
{
...
@@ -158,7 +158,7 @@ NativeReal_encode_der(asn_TYPE_descriptor_t *td, void *ptr,
...
@@ -158,7 +158,7 @@ NativeReal_encode_der(asn_TYPE_descriptor_t *td, void *ptr,
asn_dec_rval_t
asn_dec_rval_t
NativeReal_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
NativeReal_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
void
*
buf_ptr
,
size_t
size
)
{
const
void
*
buf_ptr
,
size_t
size
)
{
asn_dec_rval_t
rval
;
asn_dec_rval_t
rval
;
REAL_t
*
st
=
0
;
REAL_t
*
st
=
0
;
double
*
Dbl
=
(
double
*
)
*
sptr
;
double
*
Dbl
=
(
double
*
)
*
sptr
;
...
...
skeletons/OBJECT_IDENTIFIER.c
View file @
8c3b8540
...
@@ -310,7 +310,7 @@ OBJECT_IDENTIFIER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const
...
@@ -310,7 +310,7 @@ OBJECT_IDENTIFIER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const
asn_dec_rval_t
asn_dec_rval_t
OBJECT_IDENTIFIER_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
OBJECT_IDENTIFIER_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
void
*
buf_ptr
,
size_t
size
)
{
const
void
*
buf_ptr
,
size_t
size
)
{
return
xer_decode_primitive
(
opt_codec_ctx
,
td
,
return
xer_decode_primitive
(
opt_codec_ctx
,
td
,
sptr
,
sizeof
(
OBJECT_IDENTIFIER_t
),
opt_mname
,
sptr
,
sizeof
(
OBJECT_IDENTIFIER_t
),
opt_mname
,
...
...
skeletons/OCTET_STRING.c
View file @
8c3b8540
...
@@ -54,7 +54,7 @@ asn_TYPE_descriptor_t asn_DEF_OCTET_STRING = {
...
@@ -54,7 +54,7 @@ asn_TYPE_descriptor_t asn_DEF_OCTET_STRING = {
#undef ADVANCE
#undef ADVANCE
#define ADVANCE(num_bytes) do { \
#define ADVANCE(num_bytes) do { \
size_t num = (num_bytes); \
size_t num = (num_bytes); \
buf_ptr = ((c
har *)buf_ptr) + num;
\
buf_ptr = ((c
onst char *)buf_ptr) + num;
\
size -= num; \
size -= num; \
consumed_myself += num; \
consumed_myself += num; \
} while(0)
} while(0)
...
@@ -164,7 +164,7 @@ _new_stack() {
...
@@ -164,7 +164,7 @@ _new_stack() {
asn_dec_rval_t
asn_dec_rval_t
OCTET_STRING_decode_ber
(
asn_codec_ctx_t
*
opt_codec_ctx
,
OCTET_STRING_decode_ber
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
asn_TYPE_descriptor_t
*
td
,
void
**
os_structure
,
void
*
buf_ptr
,
size_t
size
,
int
tag_mode
)
{
void
**
os_structure
,
const
void
*
buf_ptr
,
size_t
size
,
int
tag_mode
)
{
asn_OCTET_STRING_specifics_t
*
specs
=
td
->
specifics
asn_OCTET_STRING_specifics_t
*
specs
=
td
->
specifics
?
(
asn_OCTET_STRING_specifics_t
*
)
td
->
specifics
?
(
asn_OCTET_STRING_specifics_t
*
)
td
->
specifics
:
&
asn_DEF_OCTET_STRING_specs
;
:
&
asn_DEF_OCTET_STRING_specs
;
...
@@ -285,7 +285,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -285,7 +285,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
tlv_constr
=
BER_TLV_CONSTRUCTED
(
buf_ptr
);
tlv_constr
=
BER_TLV_CONSTRUCTED
(
buf_ptr
);
ll
=
ber_fetch_length
(
tlv_constr
,
ll
=
ber_fetch_length
(
tlv_constr
,
(
c
har
*
)
buf_ptr
+
tl
,
Left
-
tl
,
&
tlv_len
);
(
c
onst
char
*
)
buf_ptr
+
tl
,
Left
-
tl
,
&
tlv_len
);
ASN_DEBUG
(
"Got tag=%s, tc=%d, left=%ld, tl=%ld, len=%ld, ll=%ld"
,
ASN_DEBUG
(
"Got tag=%s, tc=%d, left=%ld, tl=%ld, len=%ld, ll=%ld"
,
ber_tlv_tag_string
(
tlv_tag
),
tlv_constr
,
ber_tlv_tag_string
(
tlv_tag
),
tlv_constr
,
(
long
)
Left
,
(
long
)
tl
,
(
long
)
tlv_len
,
(
long
)
ll
);
(
long
)
Left
,
(
long
)
tl
,
(
long
)
tlv_len
,
(
long
)
ll
);
...
@@ -295,8 +295,8 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -295,8 +295,8 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
}
}
if
(
sel
&&
sel
->
want_nulls
if
(
sel
&&
sel
->
want_nulls
&&
((
uint8_t
*
)
buf_ptr
)[
0
]
==
0
&&
((
const
uint8_t
*
)
buf_ptr
)[
0
]
==
0
&&
((
uint8_t
*
)
buf_ptr
)[
1
]
==
0
)
&&
((
const
uint8_t
*
)
buf_ptr
)[
1
]
==
0
)
{
{
ASN_DEBUG
(
"Eat EOC; wn=%d--"
,
sel
->
want_nulls
);
ASN_DEBUG
(
"Eat EOC; wn=%d--"
,
sel
->
want_nulls
);
...
@@ -426,8 +426,8 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -426,8 +426,8 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
if
(
type_variant
==
_TT_BIT_STRING
if
(
type_variant
==
_TT_BIT_STRING
&&
sel
->
bits_chopped
==
0
)
{
&&
sel
->
bits_chopped
==
0
)
{
/* Put the unused-bits-octet away */
/* Put the unused-bits-octet away */
st
->
bits_unused
=
*
(
uint8_t
*
)
buf_ptr
;
st
->
bits_unused
=
*
(
const
uint8_t
*
)
buf_ptr
;
APPEND
(((
char
*
)
buf_ptr
+
1
),
(
len
-
1
));
APPEND
(((
c
onst
c
har
*
)
buf_ptr
+
1
),
(
len
-
1
));
sel
->
bits_chopped
=
1
;
sel
->
bits_chopped
=
1
;
}
else
{
}
else
{
APPEND
(
buf_ptr
,
len
);
APPEND
(
buf_ptr
,
len
);
...
@@ -457,7 +457,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -457,7 +457,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
if
(
size
<
(
size_t
)
ctx
->
left
)
{
if
(
size
<
(
size_t
)
ctx
->
left
)
{
if
(
!
size
)
RETURN
(
RC_WMORE
);
if
(
!
size
)
RETURN
(
RC_WMORE
);
if
(
type_variant
==
_TT_BIT_STRING
&&
ctx
->
step
==
0
)
{
if
(
type_variant
==
_TT_BIT_STRING
&&
ctx
->
step
==
0
)
{
st
->
bits_unused
=
*
(
uint8_t
*
)
buf_ptr
;
st
->
bits_unused
=
*
(
const
uint8_t
*
)
buf_ptr
;
ctx
->
left
--
;
ctx
->
left
--
;
ADVANCE
(
1
);
ADVANCE
(
1
);
}
}
...
@@ -469,7 +469,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -469,7 +469,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
}
else
{
}
else
{
if
(
type_variant
==
_TT_BIT_STRING
if
(
type_variant
==
_TT_BIT_STRING
&&
ctx
->
step
==
0
&&
ctx
->
left
)
{
&&
ctx
->
step
==
0
&&
ctx
->
left
)
{
st
->
bits_unused
=
*
(
uint8_t
*
)
buf_ptr
;
st
->
bits_unused
=
*
(
const
uint8_t
*
)
buf_ptr
;
ctx
->
left
--
;
ctx
->
left
--
;
ADVANCE
(
1
);
ADVANCE
(
1
);
}
}
...
@@ -1096,7 +1096,7 @@ static ssize_t OCTET_STRING__convert_entrefs(void *sptr, const void *chunk_buf,
...
@@ -1096,7 +1096,7 @@ static ssize_t OCTET_STRING__convert_entrefs(void *sptr, const void *chunk_buf,
static
asn_dec_rval_t
static
asn_dec_rval_t
OCTET_STRING__decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
OCTET_STRING__decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
void
*
buf_ptr
,
size_t
size
,
const
char
*
opt_mname
,
const
void
*
buf_ptr
,
size_t
size
,
int
(
*
opt_unexpected_tag_decoder
)
int
(
*
opt_unexpected_tag_decoder
)
(
void
*
struct_ptr
,
const
void
*
chunk_buf
,
size_t
chunk_size
),
(
void
*
struct_ptr
,
const
void
*
chunk_buf
,
size_t
chunk_size
),
ssize_t
(
*
body_receiver
)
ssize_t
(
*
body_receiver
)
...
@@ -1156,7 +1156,7 @@ sta_failed:
...
@@ -1156,7 +1156,7 @@ sta_failed:
asn_dec_rval_t
asn_dec_rval_t
OCTET_STRING_decode_xer_hex
(
asn_codec_ctx_t
*
opt_codec_ctx
,
OCTET_STRING_decode_xer_hex
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
void
*
buf_ptr
,
size_t
size
)
{
const
char
*
opt_mname
,
const
void
*
buf_ptr
,
size_t
size
)
{
return
OCTET_STRING__decode_xer
(
opt_codec_ctx
,
td
,
sptr
,
opt_mname
,
return
OCTET_STRING__decode_xer
(
opt_codec_ctx
,
td
,
sptr
,
opt_mname
,
buf_ptr
,
size
,
0
,
OCTET_STRING__convert_hexadecimal
);
buf_ptr
,
size
,
0
,
OCTET_STRING__convert_hexadecimal
);
}
}
...
@@ -1167,7 +1167,7 @@ OCTET_STRING_decode_xer_hex(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -1167,7 +1167,7 @@ OCTET_STRING_decode_xer_hex(asn_codec_ctx_t *opt_codec_ctx,
asn_dec_rval_t
asn_dec_rval_t
OCTET_STRING_decode_xer_binary
(
asn_codec_ctx_t
*
opt_codec_ctx
,
OCTET_STRING_decode_xer_binary
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
void
*
buf_ptr
,
size_t
size
)
{
const
char
*
opt_mname
,
const
void
*
buf_ptr
,
size_t
size
)
{
return
OCTET_STRING__decode_xer
(
opt_codec_ctx
,
td
,
sptr
,
opt_mname
,
return
OCTET_STRING__decode_xer
(
opt_codec_ctx
,
td
,
sptr
,
opt_mname
,
buf_ptr
,
size
,
0
,
OCTET_STRING__convert_binary
);
buf_ptr
,
size
,
0
,
OCTET_STRING__convert_binary
);
}
}
...
@@ -1178,7 +1178,7 @@ OCTET_STRING_decode_xer_binary(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -1178,7 +1178,7 @@ OCTET_STRING_decode_xer_binary(asn_codec_ctx_t *opt_codec_ctx,
asn_dec_rval_t
asn_dec_rval_t
OCTET_STRING_decode_xer_utf8
(
asn_codec_ctx_t
*
opt_codec_ctx
,
OCTET_STRING_decode_xer_utf8
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
void
*
buf_ptr
,
size_t
size
)
{
const
char
*
opt_mname
,
const
void
*
buf_ptr
,
size_t
size
)
{
return
OCTET_STRING__decode_xer
(
opt_codec_ctx
,
td
,
sptr
,
opt_mname
,
return
OCTET_STRING__decode_xer
(
opt_codec_ctx
,
td
,
sptr
,
opt_mname
,
buf_ptr
,
size
,
buf_ptr
,
size
,
OCTET_STRING__handle_control_chars
,
OCTET_STRING__handle_control_chars
,
...
...
skeletons/REAL.c
View file @
8c3b8540
...
@@ -325,7 +325,7 @@ REAL__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_b
...
@@ -325,7 +325,7 @@ REAL__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_b
asn_dec_rval_t
asn_dec_rval_t
REAL_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
REAL_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
void
*
buf_ptr
,
size_t
size
)
{
const
void
*
buf_ptr
,
size_t
size
)
{
return
xer_decode_primitive
(
opt_codec_ctx
,
td
,
return
xer_decode_primitive
(
opt_codec_ctx
,
td
,
sptr
,
sizeof
(
REAL_t
),
opt_mname
,
sptr
,
sizeof
(
REAL_t
),
opt_mname
,
...
...
skeletons/RELATIVE-OID.c
View file @
8c3b8540
...
@@ -134,7 +134,7 @@ RELATIVE_OID__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void
...
@@ -134,7 +134,7 @@ RELATIVE_OID__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void
asn_dec_rval_t
asn_dec_rval_t
RELATIVE_OID_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
RELATIVE_OID_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
void
*
buf_ptr
,
size_t
size
)
{
const
void
*
buf_ptr
,
size_t
size
)
{
return
xer_decode_primitive
(
opt_codec_ctx
,
td
,
return
xer_decode_primitive
(
opt_codec_ctx
,
td
,
sptr
,
sizeof
(
RELATIVE_OID_t
),
opt_mname
,
sptr
,
sizeof
(
RELATIVE_OID_t
),
opt_mname
,
...
...
skeletons/UniversalString.c
View file @
8c3b8540
...
@@ -98,7 +98,7 @@ UniversalString__dump(const UniversalString_t *st,
...
@@ -98,7 +98,7 @@ UniversalString__dump(const UniversalString_t *st,
asn_dec_rval_t
asn_dec_rval_t
UniversalString_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
UniversalString_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
void
*
buf_ptr
,
size_t
size
)
{
const
char
*
opt_mname
,
const
void
*
buf_ptr
,
size_t
size
)
{
asn_dec_rval_t
rc
;
asn_dec_rval_t
rc
;
rc
=
OCTET_STRING_decode_xer_utf8
(
opt_codec_ctx
,
td
,
sptr
,
opt_mname
,
rc
=
OCTET_STRING_decode_xer_utf8
(
opt_codec_ctx
,
td
,
sptr
,
opt_mname
,
...
...
skeletons/asn_codecs_prim.c
View file @
8c3b8540
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
asn_dec_rval_t
asn_dec_rval_t
ber_decode_primitive
(
asn_codec_ctx_t
*
opt_codec_ctx
,
ber_decode_primitive
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
void
*
buf_ptr
,
size_t
size
,
int
tag_mode
)
{
void
**
sptr
,
const
void
*
buf_ptr
,
size_t
size
,
int
tag_mode
)
{
ASN__PRIMITIVE_TYPE_t
*
st
=
(
ASN__PRIMITIVE_TYPE_t
*
)
*
sptr
;
ASN__PRIMITIVE_TYPE_t
*
st
=
(
ASN__PRIMITIVE_TYPE_t
*
)
*
sptr
;
asn_dec_rval_t
rval
;
asn_dec_rval_t
rval
;
ber_tlv_len_t
length
;
ber_tlv_len_t
length
;
...
@@ -47,7 +47,7 @@ ber_decode_primitive(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -47,7 +47,7 @@ ber_decode_primitive(asn_codec_ctx_t *opt_codec_ctx,
/*
/*
* Make sure we have this length.
* Make sure we have this length.
*/
*/
buf_ptr
=
((
char
*
)
buf_ptr
)
+
rval
.
consumed
;
buf_ptr
=
((
c
onst
c
har
*
)
buf_ptr
)
+
rval
.
consumed
;
size
-=
rval
.
consumed
;
size
-=
rval
.
consumed
;
if
(
length
>
(
ber_tlv_len_t
)
size
)
{
if
(
length
>
(
ber_tlv_len_t
)
size
)
{
rval
.
code
=
RC_WMORE
;
rval
.
code
=
RC_WMORE
;
...
@@ -238,7 +238,7 @@ xer_decode_primitive(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -238,7 +238,7 @@ xer_decode_primitive(asn_codec_ctx_t *opt_codec_ctx,
void
**
sptr
,
void
**
sptr
,
size_t
struct_size
,
size_t
struct_size
,
const
char
*
opt_mname
,
const
char
*
opt_mname
,
void
*
buf_ptr
,
size_t
size
,
const
void
*
buf_ptr
,
size_t
size
,
xer_primitive_body_decoder_f
*
prim_body_decoder
xer_primitive_body_decoder_f
*
prim_body_decoder
)
{
)
{
const
char
*
xml_tag
=
opt_mname
?
opt_mname
:
td
->
xml_tag
;
const
char
*
xml_tag
=
opt_mname
?
opt_mname
:
td
->
xml_tag
;
...
...
skeletons/asn_codecs_prim.h
View file @
8c3b8540
...
@@ -38,7 +38,7 @@ asn_dec_rval_t xer_decode_primitive(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -38,7 +38,7 @@ asn_dec_rval_t xer_decode_primitive(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t
*
type_descriptor
,
asn_TYPE_descriptor_t
*
type_descriptor
,
void
**
struct_ptr
,
size_t
struct_size
,
void
**
struct_ptr
,
size_t
struct_size
,
const
char
*
opt_mname
,
const
char
*
opt_mname
,
void
*
buf_ptr
,
size_t
size
,
const
void
*
buf_ptr
,
size_t
size
,
xer_primitive_body_decoder_f
*
prim_body_decoder
xer_primitive_body_decoder_f
*
prim_body_decoder
);
);
...
...
skeletons/ber_decoder.c
View file @
8c3b8540
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
#undef ADVANCE
#undef ADVANCE
#define ADVANCE(num_bytes) do { \
#define ADVANCE(num_bytes) do { \
size_t num = num_bytes; \
size_t num = num_bytes; \
ptr = ((c
har *)ptr) + num;
\
ptr = ((c
onst char *)ptr) + num;
\
size -= num; \
size -= num; \
consumed_myself += num; \
consumed_myself += num; \
} while(0)
} while(0)
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
asn_dec_rval_t
asn_dec_rval_t
ber_decode
(
asn_codec_ctx_t
*
opt_codec_ctx
,
ber_decode
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
type_descriptor
,
asn_TYPE_descriptor_t
*
type_descriptor
,
void
**
struct_ptr
,
void
*
ptr
,
size_t
size
)
{
void
**
struct_ptr
,
const
void
*
ptr
,
size_t
size
)
{
asn_codec_ctx_t
s_codec_ctx
;
asn_codec_ctx_t
s_codec_ctx
;
/*
/*
...
@@ -58,7 +58,7 @@ ber_decode(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -58,7 +58,7 @@ ber_decode(asn_codec_ctx_t *opt_codec_ctx,
asn_dec_rval_t
asn_dec_rval_t
ber_check_tags
(
asn_codec_ctx_t
*
opt_codec_ctx
,
ber_check_tags
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
asn_struct_ctx_t
*
opt_ctx
,
asn_TYPE_descriptor_t
*
td
,
asn_struct_ctx_t
*
opt_ctx
,
void
*
ptr
,
size_t
size
,
int
tag_mode
,
int
last_tag_form
,
const
void
*
ptr
,
size_t
size
,
int
tag_mode
,
int
last_tag_form
,
ber_tlv_len_t
*
last_length
,
int
*
opt_tlv_form
)
{
ber_tlv_len_t
*
last_length
,
int
*
opt_tlv_form
)
{
ssize_t
consumed_myself
=
0
;
ssize_t
consumed_myself
=
0
;
ssize_t
tag_len
;
ssize_t
tag_len
;
...
@@ -128,7 +128,7 @@ ber_check_tags(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -128,7 +128,7 @@ ber_check_tags(asn_codec_ctx_t *opt_codec_ctx,
}
}
tlv_constr
=
BER_TLV_CONSTRUCTED
(
ptr
);
tlv_constr
=
BER_TLV_CONSTRUCTED
(
ptr
);
len_len
=
ber_fetch_length
(
tlv_constr
,
len_len
=
ber_fetch_length
(
tlv_constr
,
(
char
*
)
ptr
+
tag_len
,
size
-
tag_len
,
&
tlv_len
);
(
c
onst
c
har
*
)
ptr
+
tag_len
,
size
-
tag_len
,
&
tlv_len
);
switch
(
len_len
)
{
switch
(
len_len
)
{
case
-
1
:
RETURN
(
RC_FAIL
);
case
-
1
:
RETURN
(
RC_FAIL
);
case
0
:
RETURN
(
RC_WMORE
);
case
0
:
RETURN
(
RC_WMORE
);
...
@@ -208,7 +208,7 @@ ber_check_tags(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -208,7 +208,7 @@ ber_check_tags(asn_codec_ctx_t *opt_codec_ctx,
* Fetch and process L from TLV.
* Fetch and process L from TLV.
*/
*/
len_len
=
ber_fetch_length
(
tlv_constr
,
len_len
=
ber_fetch_length
(
tlv_constr
,
(
char
*
)
ptr
+
tag_len
,
size
-
tag_len
,
&
tlv_len
);
(
c
onst
c
har
*
)
ptr
+
tag_len
,
size
-
tag_len
,
&
tlv_len
);
ASN_DEBUG
(
"Fetchinig len = %ld"
,
(
long
)
len_len
);
ASN_DEBUG
(
"Fetchinig len = %ld"
,
(
long
)
len_len
);
switch
(
len_len
)
{
switch
(
len_len
)
{
case
-
1
:
RETURN
(
RC_FAIL
);
case
-
1
:
RETURN
(
RC_FAIL
);
...
...
skeletons/ber_decoder.h
View file @
8c3b8540
...
@@ -17,7 +17,7 @@ struct asn_codec_ctx_s; /* Forward declaration */
...
@@ -17,7 +17,7 @@ struct asn_codec_ctx_s; /* Forward declaration */
asn_dec_rval_t
ber_decode
(
struct
asn_codec_ctx_s
*
opt_codec_ctx
,
asn_dec_rval_t
ber_decode
(
struct
asn_codec_ctx_s
*
opt_codec_ctx
,
struct
asn_TYPE_descriptor_s
*
type_descriptor
,
struct
asn_TYPE_descriptor_s
*
type_descriptor
,
void
**
struct_ptr
,
/* Pointer to a target structure's pointer */
void
**
struct_ptr
,
/* Pointer to a target structure's pointer */
void
*
buffer
,
/* Data to be decoded */
const
void
*
buffer
,
/* Data to be decoded */
size_t
size
/* Size of that buffer */
size_t
size
/* Size of that buffer */
);
);
...
@@ -27,7 +27,7 @@ asn_dec_rval_t ber_decode(struct asn_codec_ctx_s *opt_codec_ctx,
...
@@ -27,7 +27,7 @@ asn_dec_rval_t ber_decode(struct asn_codec_ctx_s *opt_codec_ctx,
typedef
asn_dec_rval_t
(
ber_type_decoder_f
)(
typedef
asn_dec_rval_t
(
ber_type_decoder_f
)(
struct
asn_codec_ctx_s
*
opt_codec_ctx
,
struct
asn_codec_ctx_s
*
opt_codec_ctx
,
struct
asn_TYPE_descriptor_s
*
type_descriptor
,
struct
asn_TYPE_descriptor_s
*
type_descriptor
,
void
**
struct_ptr
,
void
*
buf_ptr
,
size_t
size
,
void
**
struct_ptr
,
const
void
*
buf_ptr
,
size_t
size
,
int
tag_mode
);
int
tag_mode
);
/*******************************
/*******************************
...
@@ -45,7 +45,7 @@ asn_dec_rval_t ber_check_tags(
...
@@ -45,7 +45,7 @@ asn_dec_rval_t ber_check_tags(
struct
asn_codec_ctx_s
*
opt_codec_ctx
,
/* optional context */
struct
asn_codec_ctx_s
*
opt_codec_ctx
,
/* optional context */
struct
asn_TYPE_descriptor_s
*
type_dsc
,
struct
asn_TYPE_descriptor_s
*
type_dsc
,
asn_struct_ctx_t
*
opt_ctx
,
/* saved decoding context */
asn_struct_ctx_t
*
opt_ctx
,
/* saved decoding context */
void
*
ptr
,
size_t
size
,
const
void
*
ptr
,
size_t
size
,
int
tag_mode
,
/* {-1,0,1}: IMPLICIT, no, EXPLICIT */
int
tag_mode
,
/* {-1,0,1}: IMPLICIT, no, EXPLICIT */
int
last_tag_form
,
/* {-1,0:1}: any, primitive, constr */
int
last_tag_form
,
/* {-1,0:1}: any, primitive, constr */
ber_tlv_len_t
*
last_length
,
ber_tlv_len_t
*
last_length
,
...
...
skeletons/ber_tlv_length.c
View file @
8c3b8540
...
@@ -7,15 +7,15 @@
...
@@ -7,15 +7,15 @@
#include <ber_tlv_tag.h>
#include <ber_tlv_tag.h>
ssize_t
ssize_t
ber_fetch_length
(
int
_is_constructed
,
void
*
bufptr
,
size_t
size
,
ber_fetch_length
(
int
_is_constructed
,
const
void
*
bufptr
,
size_t
size
,
ber_tlv_len_t
*
len_r
)
{
ber_tlv_len_t
*
len_r
)
{
uint8_t
*
buf
=
(
uint8_t
*
)
bufptr
;
const
uint8_t
*
buf
=
(
const
uint8_t
*
)
bufptr
;
unsigned
oct
;
unsigned
oct
;
if
(
size
==
0
)
if
(
size
==
0
)
return
0
;
/* Want more */
return
0
;
/* Want more */
oct
=
*
(
uint8_t
*
)
buf
;
oct
=
*
(
const
uint8_t
*
)
buf
;
if
((
oct
&
0x80
)
==
0
)
{
if
((
oct
&
0x80
)
==
0
)
{
/*
/*
* Short definite length.
* Short definite length.
...
@@ -75,7 +75,7 @@ ber_fetch_length(int _is_constructed, void *bufptr, size_t size,
...
@@ -75,7 +75,7 @@ ber_fetch_length(int _is_constructed, void *bufptr, size_t size,
ssize_t
ssize_t
ber_skip_length
(
asn_codec_ctx_t
*
opt_codec_ctx
,
ber_skip_length
(
asn_codec_ctx_t
*
opt_codec_ctx
,
int
_is_constructed
,
void
*
ptr
,
size_t
size
)
{
int
_is_constructed
,
const
void
*
ptr
,
size_t
size
)
{
ber_tlv_len_t
vlen
;
/* Length of V in TLV */
ber_tlv_len_t
vlen
;
/* Length of V in TLV */
ssize_t
tl
;
/* Length of L in TLV */
ssize_t
tl
;
/* Length of L in TLV */
ssize_t
ll
;
/* Length of L in TLV */
ssize_t
ll
;
/* Length of L in TLV */
...
@@ -116,7 +116,7 @@ ber_skip_length(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -116,7 +116,7 @@ ber_skip_length(asn_codec_ctx_t *opt_codec_ctx,
* Indefinite length!
* Indefinite length!
*/
*/
ASN_DEBUG
(
"Skipping indefinite length"
);
ASN_DEBUG
(
"Skipping indefinite length"
);
for
(
skip
=
ll
,
ptr
=
((
char
*
)
ptr
)
+
ll
,
size
-=
ll
;;)
{
for
(
skip
=
ll
,
ptr
=
((
c
onst
c
har
*
)
ptr
)
+
ll
,
size
-=
ll
;;)
{
ber_tlv_tag_t
tag
;
ber_tlv_tag_t
tag
;
/* Fetch the tag */
/* Fetch the tag */
...
@@ -125,7 +125,7 @@ ber_skip_length(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -125,7 +125,7 @@ ber_skip_length(asn_codec_ctx_t *opt_codec_ctx,
ll
=
ber_skip_length
(
opt_codec_ctx
,
ll
=
ber_skip_length
(
opt_codec_ctx
,
BER_TLV_CONSTRUCTED
(
ptr
),
BER_TLV_CONSTRUCTED
(
ptr
),
((
char
*
)
ptr
)
+
tl
,
size
-
tl
);
((
c
onst
c
har
*
)
ptr
)
+
tl
,
size
-
tl
);
if
(
ll
<=
0
)
return
ll
;
if
(
ll
<=
0
)
return
ll
;
skip
+=
tl
+
ll
;
skip
+=
tl
+
ll
;
...
@@ -135,11 +135,11 @@ ber_skip_length(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -135,11 +135,11 @@ ber_skip_length(asn_codec_ctx_t *opt_codec_ctx,
* two consecutive 0 octets.
* two consecutive 0 octets.
* Check if it is true.
* Check if it is true.
*/
*/
if
(((
uint8_t
*
)
ptr
)[
0
]
==
0
if
(((
const
uint8_t
*
)
ptr
)[
0
]
==
0
&&
((
uint8_t
*
)
ptr
)[
1
]
==
0
)
&&
((
const
uint8_t
*
)
ptr
)[
1
]
==
0
)
return
skip
;
return
skip
;
ptr
=
((
char
*
)
ptr
)
+
tl
+
ll
;
ptr
=
((
c
onst
c
har
*
)
ptr
)
+
tl
+
ll
;
size
-=
tl
+
ll
;
size
-=
tl
+
ll
;
}
}
...
...
skeletons/ber_tlv_length.h
View file @
8c3b8540
...
@@ -17,7 +17,7 @@ typedef ssize_t ber_tlv_len_t;
...
@@ -17,7 +17,7 @@ typedef ssize_t ber_tlv_len_t;
* On return with >0, len_r is constrained as -1..MAX, where -1 mean
* On return with >0, len_r is constrained as -1..MAX, where -1 mean
* that the value is of indefinite length.
* that the value is of indefinite length.
*/
*/
ssize_t
ber_fetch_length
(
int
_is_constructed
,
void
*
bufptr
,
size_t
size
,
ssize_t
ber_fetch_length
(
int
_is_constructed
,
const
void
*
bufptr
,
size_t
size
,
ber_tlv_len_t
*
len_r
);
ber_tlv_len_t
*
len_r
);
/*
/*
...
@@ -30,7 +30,7 @@ ssize_t ber_fetch_length(int _is_constructed, void *bufptr, size_t size,
...
@@ -30,7 +30,7 @@ ssize_t ber_fetch_length(int _is_constructed, void *bufptr, size_t size,
struct
asn_codec_ctx_s
;
/* Forward declaration */
struct
asn_codec_ctx_s
;
/* Forward declaration */
ssize_t
ber_skip_length
(
ssize_t
ber_skip_length
(
struct
asn_codec_ctx_s
*
opt_codec_ctx
,
/* optional context */
struct
asn_codec_ctx_s
*
opt_codec_ctx
,
/* optional context */
int
_is_constructed
,
void
*
bufptr
,
size_t
size
);
int
_is_constructed
,
const
void
*
bufptr
,
size_t
size
);
/*
/*
* This function serializes the length (L from TLV) in DER format.
* This function serializes the length (L from TLV) in DER format.
...
...
skeletons/ber_tlv_tag.c
View file @
8c3b8540
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
#include <errno.h>
#include <errno.h>
ssize_t
ssize_t
ber_fetch_tag
(
void
*
ptr
,
size_t
size
,
ber_tlv_tag_t
*
tag_r
)
{
ber_fetch_tag
(
const
void
*
ptr
,
size_t
size
,
ber_tlv_tag_t
*
tag_r
)
{
ber_tlv_tag_t
val
;
ber_tlv_tag_t
val
;
ber_tlv_tag_t
tclass
;
ber_tlv_tag_t
tclass
;
size_t
skipped
;
size_t
skipped
;
...
@@ -15,7 +15,7 @@ ber_fetch_tag(void *ptr, size_t size, ber_tlv_tag_t *tag_r) {
...
@@ -15,7 +15,7 @@ ber_fetch_tag(void *ptr, size_t size, ber_tlv_tag_t *tag_r) {
if
(
size
==
0
)
if
(
size
==
0
)
return
0
;
return
0
;
val
=
*
(
uint8_t
*
)
ptr
;
val
=
*
(
const
uint8_t
*
)
ptr
;
tclass
=
(
val
>>
6
);
tclass
=
(
val
>>
6
);
if
((
val
&=
0x1F
)
!=
0x1F
)
{
if
((
val
&=
0x1F
)
!=
0x1F
)
{
/*
/*
...
@@ -30,9 +30,10 @@ ber_fetch_tag(void *ptr, size_t size, ber_tlv_tag_t *tag_r) {
...
@@ -30,9 +30,10 @@ ber_fetch_tag(void *ptr, size_t size, ber_tlv_tag_t *tag_r) {
* Each octet contains 7 bits of useful information.
* Each octet contains 7 bits of useful information.
* The MSB is 0 if it is the last octet of the tag.
* The MSB is 0 if it is the last octet of the tag.
*/
*/
for
(
val
=
0
,
ptr
=
((
char
*
)
ptr
)
+
1
,
skipped
=
2
;
for
(
val
=
0
,
ptr
=
((
const
char
*
)
ptr
)
+
1
,
skipped
=
2
;
skipped
<=
size
;
ptr
=
((
char
*
)
ptr
)
+
1
,
skipped
++
)
{
skipped
<=
size
;
unsigned
int
oct
=
*
(
uint8_t
*
)
ptr
;
ptr
=
((
const
char
*
)
ptr
)
+
1
,
skipped
++
)
{
unsigned
int
oct
=
*
(
const
uint8_t
*
)
ptr
;
if
(
oct
&
0x80
)
{
if
(
oct
&
0x80
)
{
val
=
(
val
<<
7
)
|
(
oct
&
0x7F
);
val
=
(
val
<<
7
)
|
(
oct
&
0x7F
);
/*
/*
...
...
skeletons/ber_tlv_tag.h
View file @
8c3b8540
...
@@ -18,7 +18,7 @@ typedef unsigned ber_tlv_tag_t; /* BER TAG from Tag-Length-Value */
...
@@ -18,7 +18,7 @@ typedef unsigned ber_tlv_tag_t; /* BER TAG from Tag-Length-Value */
*/
*/
#define BER_TAG_CLASS(tag) ((tag) & 0x3)
#define BER_TAG_CLASS(tag) ((tag) & 0x3)
#define BER_TAG_VALUE(tag) ((tag) >> 2)
#define BER_TAG_VALUE(tag) ((tag) >> 2)
#define BER_TLV_CONSTRUCTED(tagptr) (((*(
uint8_t *)tagptr) &
0x20)?1:0)
#define BER_TLV_CONSTRUCTED(tagptr) (((*(
const uint8_t *)tagptr)&
0x20)?1:0)
#define BER_TAGS_EQUAL(tag1, tag2) ((tag1) == (tag2))
#define BER_TAGS_EQUAL(tag1, tag2) ((tag1) == (tag2))
...
@@ -39,7 +39,7 @@ char *ber_tlv_tag_string(ber_tlv_tag_t tag);
...
@@ -39,7 +39,7 @@ char *ber_tlv_tag_string(ber_tlv_tag_t tag);
* -1: Fatal error deciphering tag.
* -1: Fatal error deciphering tag.
* >0: Number of bytes used from bufptr. tag_r will contain the tag.
* >0: Number of bytes used from bufptr. tag_r will contain the tag.
*/
*/
ssize_t
ber_fetch_tag
(
void
*
bufptr
,
size_t
size
,
ber_tlv_tag_t
*
tag_r
);
ssize_t
ber_fetch_tag
(
const
void
*
bufptr
,
size_t
size
,
ber_tlv_tag_t
*
tag_r
);
/*
/*
* This function serializes the tag (T from TLV) in BER format.
* This function serializes the tag (T from TLV) in BER format.
...
...
skeletons/constr_CHOICE.c
View file @
8c3b8540
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
#undef ADVANCE
#undef ADVANCE
#define ADVANCE(num_bytes) do { \
#define ADVANCE(num_bytes) do { \
size_t num = num_bytes; \
size_t num = num_bytes; \
ptr = ((c
har *)ptr) + num;
\
ptr = ((c
onst char *)ptr) + num;
\
size -= num; \
size -= num; \
if(ctx->left >= 0) \
if(ctx->left >= 0) \
ctx->left -= num; \
ctx->left -= num; \
...
@@ -99,7 +99,7 @@ _search4tag(const void *ap, const void *bp) {
...
@@ -99,7 +99,7 @@ _search4tag(const void *ap, const void *bp) {
*/
*/
asn_dec_rval_t
asn_dec_rval_t
CHOICE_decode_ber
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
CHOICE_decode_ber
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
struct_ptr
,
void
*
ptr
,
size_t
size
,
int
tag_mode
)
{
void
**
struct_ptr
,
const
void
*
ptr
,
size_t
size
,
int
tag_mode
)
{
/*
/*
* Bring closer parts of structure description.
* Bring closer parts of structure description.
*/
*/
...
@@ -211,7 +211,8 @@ CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -211,7 +211,8 @@ CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
skip
=
ber_skip_length
(
opt_codec_ctx
,
skip
=
ber_skip_length
(
opt_codec_ctx
,
BER_TLV_CONSTRUCTED
(
ptr
),
BER_TLV_CONSTRUCTED
(
ptr
),
(
char
*
)
ptr
+
tag_len
,
LEFT
-
tag_len
);
(
const
char
*
)
ptr
+
tag_len
,
LEFT
-
tag_len
);
switch
(
skip
)
{
switch
(
skip
)
{
case
0
:
if
(
!
SIZE_VIOLATION
)
RETURN
(
RC_WMORE
);
case
0
:
if
(
!
SIZE_VIOLATION
)
RETURN
(
RC_WMORE
);
...
@@ -320,13 +321,13 @@ CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -320,13 +321,13 @@ CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
/*
/*
* Expected <0><0>...
* Expected <0><0>...
*/
*/
if
(((
uint8_t
*
)
ptr
)[
0
]
==
0
)
{
if
(((
const
uint8_t
*
)
ptr
)[
0
]
==
0
)
{
if
(
LEFT
<
2
)
{
if
(
LEFT
<
2
)
{
if
(
SIZE_VIOLATION
)
if
(
SIZE_VIOLATION
)
RETURN
(
RC_FAIL
);
RETURN
(
RC_FAIL
);
else
else
RETURN
(
RC_WMORE
);
RETURN
(
RC_WMORE
);
}
else
if
(((
uint8_t
*
)
ptr
)[
1
]
==
0
)
{
}
else
if
(((
const
uint8_t
*
)
ptr
)[
1
]
==
0
)
{
/*
/*
* Correctly finished with <0><0>.
* Correctly finished with <0><0>.
*/
*/
...
@@ -543,7 +544,7 @@ CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
...
@@ -543,7 +544,7 @@ CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
#undef XER_ADVANCE
#undef XER_ADVANCE
#define XER_ADVANCE(num_bytes) do { \
#define XER_ADVANCE(num_bytes) do { \
size_t num = num_bytes; \
size_t num = num_bytes; \
buf_ptr = ((c
har *)buf_ptr) + num;
\
buf_ptr = ((c
onst char *)buf_ptr) + num;
\
size -= num; \
size -= num; \
consumed_myself += num; \
consumed_myself += num; \
} while(0)
} while(0)
...
@@ -554,7 +555,7 @@ CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
...
@@ -554,7 +555,7 @@ CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_dec_rval_t
asn_dec_rval_t
CHOICE_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
CHOICE_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
struct_ptr
,
const
char
*
opt_mname
,
void
**
struct_ptr
,
const
char
*
opt_mname
,
void
*
buf_ptr
,
size_t
size
)
{
const
void
*
buf_ptr
,
size_t
size
)
{
/*
/*
* Bring closer parts of structure description.
* Bring closer parts of structure description.
*/
*/
...
...
skeletons/constr_SEQUENCE.c
View file @
8c3b8540
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
#undef ADVANCE
#undef ADVANCE
#define ADVANCE(num_bytes) do { \
#define ADVANCE(num_bytes) do { \
size_t num = num_bytes; \
size_t num = num_bytes; \
ptr = ((c
har *)ptr) + num;
\
ptr = ((c
onst char *)ptr) + num;
\
size -= num; \
size -= num; \
if(ctx->left >= 0) \
if(ctx->left >= 0) \
ctx->left -= num; \
ctx->left -= num; \
...
@@ -110,7 +110,7 @@ _t2e_cmp(const void *ap, const void *bp) {
...
@@ -110,7 +110,7 @@ _t2e_cmp(const void *ap, const void *bp) {
*/
*/
asn_dec_rval_t
asn_dec_rval_t
SEQUENCE_decode_ber
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
SEQUENCE_decode_ber
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
struct_ptr
,
void
*
ptr
,
size_t
size
,
int
tag_mode
)
{
void
**
struct_ptr
,
const
void
*
ptr
,
size_t
size
,
int
tag_mode
)
{
/*
/*
* Bring closer parts of structure description.
* Bring closer parts of structure description.
*/
*/
...
@@ -240,13 +240,13 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -240,13 +240,13 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
case
-
1
:
RETURN
(
RC_FAIL
);
case
-
1
:
RETURN
(
RC_FAIL
);
}
}
if
(
ctx
->
left
<
0
&&
((
uint8_t
*
)
ptr
)[
0
]
==
0
)
{
if
(
ctx
->
left
<
0
&&
((
const
uint8_t
*
)
ptr
)[
0
]
==
0
)
{
if
(
LEFT
<
2
)
{
if
(
LEFT
<
2
)
{
if
(
SIZE_VIOLATION
)
if
(
SIZE_VIOLATION
)
RETURN
(
RC_FAIL
);
RETURN
(
RC_FAIL
);
else
else
RETURN
(
RC_WMORE
);
RETURN
(
RC_WMORE
);
}
else
if
(((
uint8_t
*
)
ptr
)[
1
]
==
0
)
{
}
else
if
(((
const
uint8_t
*
)
ptr
)[
1
]
==
0
)
{
ASN_DEBUG
(
"edx = %d, opt = %d, ec=%d"
,
ASN_DEBUG
(
"edx = %d, opt = %d, ec=%d"
,
edx
,
elements
[
edx
].
optional
,
edx
,
elements
[
edx
].
optional
,
td
->
elements_count
);
td
->
elements_count
);
...
@@ -362,7 +362,8 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -362,7 +362,8 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
skip
=
ber_skip_length
(
opt_codec_ctx
,
skip
=
ber_skip_length
(
opt_codec_ctx
,
BER_TLV_CONSTRUCTED
(
ptr
),
BER_TLV_CONSTRUCTED
(
ptr
),
(
char
*
)
ptr
+
tag_len
,
LEFT
-
tag_len
);
(
const
char
*
)
ptr
+
tag_len
,
LEFT
-
tag_len
);
ASN_DEBUG
(
"Skip length %d in %s"
,
ASN_DEBUG
(
"Skip length %d in %s"
,
(
int
)
skip
,
td
->
name
);
(
int
)
skip
,
td
->
name
);
switch
(
skip
)
{
switch
(
skip
)
{
...
@@ -455,13 +456,13 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -455,13 +456,13 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
* If expected <0><0>...
* If expected <0><0>...
*/
*/
if
(
ctx
->
left
<
0
if
(
ctx
->
left
<
0
&&
((
uint8_t
*
)
ptr
)[
0
]
==
0
)
{
&&
((
const
uint8_t
*
)
ptr
)[
0
]
==
0
)
{
if
(
LEFT
<
2
)
{
if
(
LEFT
<
2
)
{
if
(
SIZE_VIOLATION
)
if
(
SIZE_VIOLATION
)
RETURN
(
RC_FAIL
);
RETURN
(
RC_FAIL
);
else
else
RETURN
(
RC_WMORE
);
RETURN
(
RC_WMORE
);
}
else
if
(((
uint8_t
*
)
ptr
)[
1
]
==
0
)
{
}
else
if
(((
const
uint8_t
*
)
ptr
)[
1
]
==
0
)
{
/*
/*
* Correctly finished with <0><0>.
* Correctly finished with <0><0>.
*/
*/
...
@@ -484,7 +485,7 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -484,7 +485,7 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
ll
=
ber_skip_length
(
opt_codec_ctx
,
ll
=
ber_skip_length
(
opt_codec_ctx
,
BER_TLV_CONSTRUCTED
(
ptr
),
BER_TLV_CONSTRUCTED
(
ptr
),
(
char
*
)
ptr
+
tl
,
LEFT
-
tl
);
(
c
onst
c
har
*
)
ptr
+
tl
,
LEFT
-
tl
);
switch
(
ll
)
{
switch
(
ll
)
{
case
0
:
if
(
!
SIZE_VIOLATION
)
RETURN
(
RC_WMORE
);
case
0
:
if
(
!
SIZE_VIOLATION
)
RETURN
(
RC_WMORE
);
/* Fall through */
/* Fall through */
...
@@ -593,7 +594,7 @@ SEQUENCE_encode_der(asn_TYPE_descriptor_t *td,
...
@@ -593,7 +594,7 @@ SEQUENCE_encode_der(asn_TYPE_descriptor_t *td,
#undef XER_ADVANCE
#undef XER_ADVANCE
#define XER_ADVANCE(num_bytes) do { \
#define XER_ADVANCE(num_bytes) do { \
size_t num = num_bytes; \
size_t num = num_bytes; \
buf_ptr = ((c
har *)buf_ptr) + num;
\
buf_ptr = ((c
onst char *)buf_ptr) + num;
\
size -= num; \
size -= num; \
consumed_myself += num; \
consumed_myself += num; \
} while(0)
} while(0)
...
@@ -604,7 +605,7 @@ SEQUENCE_encode_der(asn_TYPE_descriptor_t *td,
...
@@ -604,7 +605,7 @@ SEQUENCE_encode_der(asn_TYPE_descriptor_t *td,
asn_dec_rval_t
asn_dec_rval_t
SEQUENCE_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
SEQUENCE_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
struct_ptr
,
const
char
*
opt_mname
,
void
**
struct_ptr
,
const
char
*
opt_mname
,
void
*
buf_ptr
,
size_t
size
)
{
const
void
*
buf_ptr
,
size_t
size
)
{
/*
/*
* Bring closer parts of structure description.
* Bring closer parts of structure description.
*/
*/
...
...
skeletons/constr_SET.c
View file @
8c3b8540
...
@@ -42,7 +42,7 @@ static int _SET_is_populated(asn_TYPE_descriptor_t *td, void *st);
...
@@ -42,7 +42,7 @@ static int _SET_is_populated(asn_TYPE_descriptor_t *td, void *st);
#undef ADVANCE
#undef ADVANCE
#define ADVANCE(num_bytes) do { \
#define ADVANCE(num_bytes) do { \
size_t num = num_bytes; \
size_t num = num_bytes; \
ptr = ((c
har *)ptr) + num;
\
ptr = ((c
onst char *)ptr) + num;
\
size -= num; \
size -= num; \
if(ctx->left >= 0) \
if(ctx->left >= 0) \
ctx->left -= num; \
ctx->left -= num; \
...
@@ -101,7 +101,7 @@ _t2e_cmp(const void *ap, const void *bp) {
...
@@ -101,7 +101,7 @@ _t2e_cmp(const void *ap, const void *bp) {
*/
*/
asn_dec_rval_t
asn_dec_rval_t
SET_decode_ber
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
SET_decode_ber
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
struct_ptr
,
void
*
ptr
,
size_t
size
,
int
tag_mode
)
{
void
**
struct_ptr
,
const
void
*
ptr
,
size_t
size
,
int
tag_mode
)
{
/*
/*
* Bring closer parts of structure description.
* Bring closer parts of structure description.
*/
*/
...
@@ -211,13 +211,13 @@ SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -211,13 +211,13 @@ SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
case
-
1
:
RETURN
(
RC_FAIL
);
case
-
1
:
RETURN
(
RC_FAIL
);
}
}
if
(
ctx
->
left
<
0
&&
((
uint8_t
*
)
ptr
)[
0
]
==
0
)
{
if
(
ctx
->
left
<
0
&&
((
const
uint8_t
*
)
ptr
)[
0
]
==
0
)
{
if
(
LEFT
<
2
)
{
if
(
LEFT
<
2
)
{
if
(
SIZE_VIOLATION
)
if
(
SIZE_VIOLATION
)
RETURN
(
RC_FAIL
);
RETURN
(
RC_FAIL
);
else
else
RETURN
(
RC_WMORE
);
RETURN
(
RC_WMORE
);
}
else
if
(((
uint8_t
*
)
ptr
)[
1
]
==
0
)
{
}
else
if
(((
const
uint8_t
*
)
ptr
)[
1
]
==
0
)
{
/*
/*
* Found the terminator of the
* Found the terminator of the
* indefinite length structure.
* indefinite length structure.
...
@@ -253,7 +253,7 @@ SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -253,7 +253,7 @@ SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
skip
=
ber_skip_length
(
opt_codec_ctx
,
skip
=
ber_skip_length
(
opt_codec_ctx
,
BER_TLV_CONSTRUCTED
(
ptr
),
BER_TLV_CONSTRUCTED
(
ptr
),
(
char
*
)
ptr
+
tag_len
,
LEFT
-
tag_len
);
(
c
onst
c
har
*
)
ptr
+
tag_len
,
LEFT
-
tag_len
);
switch
(
skip
)
{
switch
(
skip
)
{
case
0
:
if
(
!
SIZE_VIOLATION
)
RETURN
(
RC_WMORE
);
case
0
:
if
(
!
SIZE_VIOLATION
)
RETURN
(
RC_WMORE
);
...
@@ -345,13 +345,13 @@ SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -345,13 +345,13 @@ SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
* If expected <0><0>...
* If expected <0><0>...
*/
*/
if
(
ctx
->
left
<
0
if
(
ctx
->
left
<
0
&&
((
uint8_t
*
)
ptr
)[
0
]
==
0
)
{
&&
((
const
uint8_t
*
)
ptr
)[
0
]
==
0
)
{
if
(
LEFT
<
2
)
{
if
(
LEFT
<
2
)
{
if
(
SIZE_VIOLATION
)
if
(
SIZE_VIOLATION
)
RETURN
(
RC_FAIL
);
RETURN
(
RC_FAIL
);
else
else
RETURN
(
RC_WMORE
);
RETURN
(
RC_WMORE
);
}
else
if
(((
uint8_t
*
)
ptr
)[
1
]
==
0
)
{
}
else
if
(((
const
uint8_t
*
)
ptr
)[
1
]
==
0
)
{
/*
/*
* Correctly finished with <0><0>.
* Correctly finished with <0><0>.
*/
*/
...
@@ -366,13 +366,13 @@ SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -366,13 +366,13 @@ SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
ASN_DEBUG
(
"Unexpected continuation "
ASN_DEBUG
(
"Unexpected continuation "
"of a non-extensible type %s "
"of a non-extensible type %s "
"(ptr=%02x)"
,
"(ptr=%02x)"
,
td
->
name
,
*
(
uint8_t
*
)
ptr
);
td
->
name
,
*
(
const
uint8_t
*
)
ptr
);
RETURN
(
RC_FAIL
);
RETURN
(
RC_FAIL
);
}
}
ll
=
ber_skip_length
(
opt_codec_ctx
,
ll
=
ber_skip_length
(
opt_codec_ctx
,
BER_TLV_CONSTRUCTED
(
ptr
),
BER_TLV_CONSTRUCTED
(
ptr
),
(
char
*
)
ptr
+
tl
,
LEFT
-
tl
);
(
c
onst
c
har
*
)
ptr
+
tl
,
LEFT
-
tl
);
switch
(
ll
)
{
switch
(
ll
)
{
case
0
:
if
(
!
SIZE_VIOLATION
)
RETURN
(
RC_WMORE
);
case
0
:
if
(
!
SIZE_VIOLATION
)
RETURN
(
RC_WMORE
);
/* Fall through */
/* Fall through */
...
@@ -573,7 +573,7 @@ SET_encode_der(asn_TYPE_descriptor_t *td,
...
@@ -573,7 +573,7 @@ SET_encode_der(asn_TYPE_descriptor_t *td,
#undef XER_ADVANCE
#undef XER_ADVANCE
#define XER_ADVANCE(num_bytes) do { \
#define XER_ADVANCE(num_bytes) do { \
size_t num = num_bytes; \
size_t num = num_bytes; \
buf_ptr = ((c
har *)buf_ptr) + num;
\
buf_ptr = ((c
onst char *)buf_ptr) + num;
\
size -= num; \
size -= num; \
consumed_myself += num; \
consumed_myself += num; \
} while(0)
} while(0)
...
@@ -584,7 +584,7 @@ SET_encode_der(asn_TYPE_descriptor_t *td,
...
@@ -584,7 +584,7 @@ SET_encode_der(asn_TYPE_descriptor_t *td,
asn_dec_rval_t
asn_dec_rval_t
SET_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
SET_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
struct_ptr
,
const
char
*
opt_mname
,
void
**
struct_ptr
,
const
char
*
opt_mname
,
void
*
buf_ptr
,
size_t
size
)
{
const
void
*
buf_ptr
,
size_t
size
)
{
/*
/*
* Bring closer parts of structure description.
* Bring closer parts of structure description.
*/
*/
...
...
skeletons/constr_SET_OF.c
View file @
8c3b8540
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
#undef ADVANCE
#undef ADVANCE
#define ADVANCE(num_bytes) do { \
#define ADVANCE(num_bytes) do { \
size_t num = num_bytes; \
size_t num = num_bytes; \
ptr = ((c
har *)ptr) + num;
\
ptr = ((c
onst char *)ptr) + num;
\
size -= num; \
size -= num; \
if(ctx->left >= 0) \
if(ctx->left >= 0) \
ctx->left -= num; \
ctx->left -= num; \
...
@@ -67,7 +67,7 @@
...
@@ -67,7 +67,7 @@
*/
*/
asn_dec_rval_t
asn_dec_rval_t
SET_OF_decode_ber
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
SET_OF_decode_ber
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
struct_ptr
,
void
*
ptr
,
size_t
size
,
int
tag_mode
)
{
void
**
struct_ptr
,
const
void
*
ptr
,
size_t
size
,
int
tag_mode
)
{
/*
/*
* Bring closer parts of structure description.
* Bring closer parts of structure description.
*/
*/
...
@@ -166,13 +166,13 @@ SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -166,13 +166,13 @@ SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
case
-
1
:
RETURN
(
RC_FAIL
);
case
-
1
:
RETURN
(
RC_FAIL
);
}
}
if
(
ctx
->
left
<
0
&&
((
uint8_t
*
)
ptr
)[
0
]
==
0
)
{
if
(
ctx
->
left
<
0
&&
((
const
uint8_t
*
)
ptr
)[
0
]
==
0
)
{
if
(
LEFT
<
2
)
{
if
(
LEFT
<
2
)
{
if
(
SIZE_VIOLATION
)
if
(
SIZE_VIOLATION
)
RETURN
(
RC_FAIL
);
RETURN
(
RC_FAIL
);
else
else
RETURN
(
RC_WMORE
);
RETURN
(
RC_WMORE
);
}
else
if
(((
uint8_t
*
)
ptr
)[
1
]
==
0
)
{
}
else
if
(((
const
uint8_t
*
)
ptr
)[
1
]
==
0
)
{
/*
/*
* Found the terminator of the
* Found the terminator of the
* indefinite length structure.
* indefinite length structure.
...
@@ -241,15 +241,15 @@ SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -241,15 +241,15 @@ SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
*/
*/
while
(
ctx
->
left
<
0
)
{
while
(
ctx
->
left
<
0
)
{
if
(
LEFT
<
2
)
{
if
(
LEFT
<
2
)
{
if
(
LEFT
>
0
&&
((
char
*
)
ptr
)[
0
]
!=
0
)
{
if
(
LEFT
>
0
&&
((
c
onst
c
har
*
)
ptr
)[
0
]
!=
0
)
{
/* Unexpected tag */
/* Unexpected tag */
RETURN
(
RC_FAIL
);
RETURN
(
RC_FAIL
);
}
else
{
}
else
{
RETURN
(
RC_WMORE
);
RETURN
(
RC_WMORE
);
}
}
}
}
if
(((
char
*
)
ptr
)[
0
]
==
0
if
(((
c
onst
c
har
*
)
ptr
)[
0
]
==
0
&&
((
char
*
)
ptr
)[
1
]
==
0
)
{
&&
((
c
onst
c
har
*
)
ptr
)[
1
]
==
0
)
{
ADVANCE
(
2
);
ADVANCE
(
2
);
ctx
->
left
++
;
ctx
->
left
++
;
}
else
{
}
else
{
...
@@ -452,7 +452,7 @@ SET_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr,
...
@@ -452,7 +452,7 @@ SET_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr,
#undef XER_ADVANCE
#undef XER_ADVANCE
#define XER_ADVANCE(num_bytes) do { \
#define XER_ADVANCE(num_bytes) do { \
size_t num = num_bytes; \
size_t num = num_bytes; \
buf_ptr = ((c
har *)buf_ptr) + num;
\
buf_ptr = ((c
onst char *)buf_ptr) + num;
\
size -= num; \
size -= num; \
consumed_myself += num; \
consumed_myself += num; \
} while(0)
} while(0)
...
@@ -463,7 +463,7 @@ SET_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr,
...
@@ -463,7 +463,7 @@ SET_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr,
asn_dec_rval_t
asn_dec_rval_t
SET_OF_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
SET_OF_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
struct_ptr
,
const
char
*
opt_mname
,
void
**
struct_ptr
,
const
char
*
opt_mname
,
void
*
buf_ptr
,
size_t
size
)
{
const
void
*
buf_ptr
,
size_t
size
)
{
/*
/*
* Bring closer parts of structure description.
* Bring closer parts of structure description.
*/
*/
...
...
skeletons/xer_decoder.c
View file @
8c3b8540
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
*/
*/
asn_dec_rval_t
asn_dec_rval_t
xer_decode
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
xer_decode
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
struct_ptr
,
void
*
buffer
,
size_t
size
)
{
void
**
struct_ptr
,
const
void
*
buffer
,
size_t
size
)
{
asn_codec_ctx_t
s_codec_ctx
;
asn_codec_ctx_t
s_codec_ctx
;
/*
/*
...
...
skeletons/xer_decoder.h
View file @
8c3b8540
...
@@ -15,7 +15,7 @@ struct asn_TYPE_descriptor_s; /* Forward declaration */
...
@@ -15,7 +15,7 @@ struct asn_TYPE_descriptor_s; /* Forward declaration */
asn_dec_rval_t
xer_decode
(
struct
asn_codec_ctx_s
*
opt_codec_ctx
,
asn_dec_rval_t
xer_decode
(
struct
asn_codec_ctx_s
*
opt_codec_ctx
,
struct
asn_TYPE_descriptor_s
*
type_descriptor
,
struct
asn_TYPE_descriptor_s
*
type_descriptor
,
void
**
struct_ptr
,
/* Pointer to a target structure's pointer */
void
**
struct_ptr
,
/* Pointer to a target structure's pointer */
void
*
buffer
,
/* Data to be decoded */
const
void
*
buffer
,
/* Data to be decoded */
size_t
size
/* Size of that buffer */
size_t
size
/* Size of that buffer */
);
);
...
@@ -26,7 +26,7 @@ typedef asn_dec_rval_t (xer_type_decoder_f)(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -26,7 +26,7 @@ typedef asn_dec_rval_t (xer_type_decoder_f)(asn_codec_ctx_t *opt_codec_ctx,
struct
asn_TYPE_descriptor_s
*
type_descriptor
,
struct
asn_TYPE_descriptor_s
*
type_descriptor
,
void
**
struct_ptr
,
void
**
struct_ptr
,
const
char
*
opt_mname
,
/* Member name */
const
char
*
opt_mname
,
/* Member name */
void
*
buf_ptr
,
size_t
size
const
void
*
buf_ptr
,
size_t
size
);
);
/*******************************
/*******************************
...
@@ -61,7 +61,7 @@ asn_dec_rval_t xer_decode_general(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -61,7 +61,7 @@ asn_dec_rval_t xer_decode_general(asn_codec_ctx_t *opt_codec_ctx,
typedef
enum
pxer_chunk_type
{
typedef
enum
pxer_chunk_type
{
PXER_TAG
,
/* Complete XER tag */
PXER_TAG
,
/* Complete XER tag */
PXER_TEXT
,
/* Plain text between XER tags */
PXER_TEXT
,
/* Plain text between XER tags */
PXER_COMMENT
,
/* A comment, may be part of */
PXER_COMMENT
/* A comment, may be part of */
}
pxer_chunk_type_e
;
}
pxer_chunk_type_e
;
ssize_t
xer_next_token
(
int
*
stateContext
,
ssize_t
xer_next_token
(
int
*
stateContext
,
const
void
*
buffer
,
size_t
size
,
pxer_chunk_type_e
*
_ch_type
);
const
void
*
buffer
,
size_t
size
,
pxer_chunk_type_e
*
_ch_type
);
...
@@ -77,7 +77,7 @@ ssize_t xer_next_token(int *stateContext,
...
@@ -77,7 +77,7 @@ ssize_t xer_next_token(int *stateContext,
XCT__UNK__MASK
=
4
,
/* Mask of everything unexpected */
XCT__UNK__MASK
=
4
,
/* Mask of everything unexpected */
XCT_UNKNOWN_OP
=
5
,
/* Unexpected <opening> tag */
XCT_UNKNOWN_OP
=
5
,
/* Unexpected <opening> tag */
XCT_UNKNOWN_CL
=
6
,
/* Unexpected </closing> tag */
XCT_UNKNOWN_CL
=
6
,
/* Unexpected </closing> tag */
XCT_UNKNOWN_BO
=
7
,
/* Unexpected <modified/> tag */
XCT_UNKNOWN_BO
=
7
/* Unexpected <modified/> tag */
}
xer_check_tag_e
;
}
xer_check_tag_e
;
xer_check_tag_e
xer_check_tag
(
const
void
*
buf_ptr
,
int
size
,
xer_check_tag_e
xer_check_tag
(
const
void
*
buf_ptr
,
int
size
,
const
char
*
need_tag
);
const
char
*
need_tag
);
...
...
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