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
867ac199
Commit
867ac199
authored
Oct 22, 2004
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BOOLEAN XER support
parent
435cb289
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
1 deletion
+56
-1
skeletons/BOOLEAN.c
skeletons/BOOLEAN.c
+55
-1
skeletons/BOOLEAN.h
skeletons/BOOLEAN.h
+1
-0
No files found.
skeletons/BOOLEAN.c
View file @
867ac199
...
...
@@ -3,6 +3,7 @@
* Redistribution and modifications are permitted subject to BSD license.
*/
#include <asn_internal.h>
#include <asn_codecs_prim.h>
#include <BOOLEAN.h>
/*
...
...
@@ -19,7 +20,7 @@ asn_TYPE_descriptor_t asn_DEF_BOOLEAN = {
asn_generic_no_constraint
,
BOOLEAN_decode_ber
,
BOOLEAN_encode_der
,
0
,
/* Not implemented yet */
BOOLEAN_decode_xer
,
BOOLEAN_encode_xer
,
0
,
/* Use generic outmost tag fetcher */
asn_DEF_BOOLEAN_tags
,
...
...
@@ -128,6 +129,59 @@ BOOLEAN_encode_der(asn_TYPE_descriptor_t *td, void *sptr,
return
erval
;
}
/*
* Decode the chunk of XML text encoding INTEGER.
*/
static
ssize_t
BOOLEAN__xer_body_decode
(
void
*
sptr
,
void
*
chunk_buf
,
size_t
chunk_size
)
{
BOOLEAN_t
*
st
=
(
BOOLEAN_t
*
)
sptr
;
char
*
p
=
(
char
*
)
chunk_buf
;
char
*
pend
=
p
+
chunk_size
;
if
(
chunk_size
==
0
)
return
-
1
;
if
(
p
[
0
]
==
0x3c
/* '<' */
)
{
switch
(
xer_check_tag
(
chunk_buf
,
chunk_size
,
"false"
))
{
case
XCT_BOTH
:
/* "<false/>" */
*
st
=
0
;
break
;
case
XCT_UNEXPECTED
:
if
(
xer_check_tag
(
chunk_buf
,
chunk_size
,
"true"
)
!=
XCT_BOTH
)
return
-
1
;
/* "<true/>" */
*
st
=
1
;
/* Or 0xff as in DER?.. */
break
;
default:
return
-
1
;
}
}
else
{
for
(;
p
<
pend
;
p
++
)
{
switch
(
*
p
)
{
case
0x09
:
case
0x0a
:
case
0x0d
:
case
0x20
:
break
;
default:
return
-
1
;
/* Not whitespace */
}
}
}
return
chunk_size
;
}
asn_dec_rval_t
BOOLEAN_decode_xer
(
asn_codec_ctx_t
*
opt_codec_ctx
,
asn_TYPE_descriptor_t
*
td
,
void
**
sptr
,
const
char
*
opt_mname
,
void
*
buf_ptr
,
size_t
size
)
{
return
xer_decode_primitive
(
opt_codec_ctx
,
td
,
sptr
,
sizeof
(
BOOLEAN_t
),
opt_mname
,
buf_ptr
,
size
,
BOOLEAN__xer_body_decode
);
}
asn_enc_rval_t
BOOLEAN_encode_xer
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
...
...
skeletons/BOOLEAN.h
View file @
867ac199
...
...
@@ -20,6 +20,7 @@ asn_struct_free_f BOOLEAN_free;
asn_struct_print_f
BOOLEAN_print
;
ber_type_decoder_f
BOOLEAN_decode_ber
;
der_type_encoder_f
BOOLEAN_encode_der
;
xer_type_decoder_f
BOOLEAN_decode_xer
;
xer_type_encoder_f
BOOLEAN_encode_xer
;
#endif
/* _BOOLEAN_H_ */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment