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
904e65b8
Commit
904e65b8
authored
Feb 18, 2005
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more distinction
parent
239143ee
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
64 additions
and
25 deletions
+64
-25
skeletons/constr_CHOICE.c
skeletons/constr_CHOICE.c
+14
-3
skeletons/constr_SEQUENCE.c
skeletons/constr_SEQUENCE.c
+22
-8
skeletons/constr_SET.c
skeletons/constr_SET.c
+14
-3
skeletons/constr_SET_OF.c
skeletons/constr_SET_OF.c
+2
-3
skeletons/xer_decoder.c
skeletons/xer_decoder.c
+4
-3
skeletons/xer_decoder.h
skeletons/xer_decoder.h
+8
-5
No files found.
skeletons/constr_CHOICE.c
View file @
904e65b8
...
@@ -673,7 +673,8 @@ CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -673,7 +673,8 @@ CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
continue
;
continue
;
}
}
/* Fall through */
/* Fall through */
case
XCT_UNEXPECTED
:
case
XCT_UNKNOWN_OP
:
case
XCT_UNKNOWN_BO
:
if
(
ctx
->
phase
!=
1
)
if
(
ctx
->
phase
!=
1
)
break
;
/* Really unexpected */
break
;
/* Really unexpected */
...
@@ -693,9 +694,9 @@ CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -693,9 +694,9 @@ CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
ctx
->
step
=
edx
;
ctx
->
step
=
edx
;
ctx
->
phase
=
2
;
ctx
->
phase
=
2
;
break
;
break
;
case
XCT_UNEXPECTED
:
case
XCT_UNKNOWN_OP
:
case
XCT_UNKNOWN_BO
:
continue
;
continue
;
case
XCT_CLOSING
:
default:
default:
edx
=
td
->
elements_count
;
edx
=
td
->
elements_count
;
break
;
/* Phase out */
break
;
/* Phase out */
...
@@ -704,6 +705,16 @@ CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -704,6 +705,16 @@ CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
}
}
if
(
edx
!=
td
->
elements_count
)
if
(
edx
!=
td
->
elements_count
)
continue
;
continue
;
/* It is expected extension */
if
(
specs
->
extensible
)
{
ASN_DEBUG
(
"Got anticipated extension, "
"but NOT IMPLEMENTED YET"
);
/*
* TODO: implement skipping of extensions
*/
}
/* Fall through */
/* Fall through */
default:
default:
break
;
break
;
...
...
skeletons/constr_SEQUENCE.c
View file @
904e65b8
...
@@ -623,6 +623,7 @@ SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -623,6 +623,7 @@ SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
ssize_t
consumed_myself
=
0
;
/* Consumed bytes from ptr */
ssize_t
consumed_myself
=
0
;
/* Consumed bytes from ptr */
int
xer_state
;
/* XER low level parsing context */
int
xer_state
;
/* XER low level parsing context */
int
edx
;
/* Element index */
int
edx
;
/* Element index */
int
edx_end
;
/*
/*
* Create the target structure if it is not present already.
* Create the target structure if it is not present already.
...
@@ -649,6 +650,7 @@ SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -649,6 +650,7 @@ SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
ssize_t
ch_size
;
/* Chunk size */
ssize_t
ch_size
;
/* Chunk size */
xer_check_tag_e
tcv
;
/* Tag check value */
xer_check_tag_e
tcv
;
/* Tag check value */
asn_TYPE_member_t
*
elm
;
asn_TYPE_member_t
*
elm
;
int
n
;
/*
/*
* Go inside the inner member of a sequence.
* Go inside the inner member of a sequence.
...
@@ -740,9 +742,8 @@ SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -740,9 +742,8 @@ SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
continue
;
continue
;
}
}
/* Fall through */
/* Fall through */
case
XCT_UNEXPECTED
:
{
case
XCT_UNKNOWN_OP
:
int
edx_end
;
case
XCT_UNKNOWN_BO
:
int
n
;
ASN_DEBUG
(
"XER/SEQUENCE: tcv=%d, ph=%d"
,
ASN_DEBUG
(
"XER/SEQUENCE: tcv=%d, ph=%d"
,
tcv
,
ctx
->
phase
);
tcv
,
ctx
->
phase
);
...
@@ -754,6 +755,8 @@ SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -754,6 +755,8 @@ SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
* Search which member corresponds to this tag.
* Search which member corresponds to this tag.
*/
*/
edx_end
=
edx
+
elements
[
edx
].
optional
+
1
;
edx_end
=
edx
+
elements
[
edx
].
optional
+
1
;
if
(
edx_end
>
td
->
elements_count
)
edx_end
=
td
->
elements_count
;
for
(
n
=
edx
;
n
<
edx_end
;
n
++
)
{
for
(
n
=
edx
;
n
<
edx_end
;
n
++
)
{
elm
=
&
td
->
elements
[
n
];
elm
=
&
td
->
elements
[
n
];
tcv
=
xer_check_tag
(
buf_ptr
,
ch_size
,
elm
->
name
);
tcv
=
xer_check_tag
(
buf_ptr
,
ch_size
,
elm
->
name
);
...
@@ -766,18 +769,29 @@ SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -766,18 +769,29 @@ SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
ctx
->
step
=
edx
=
n
;
ctx
->
step
=
edx
=
n
;
ctx
->
phase
=
2
;
ctx
->
phase
=
2
;
break
;
break
;
case
XCT_UNEXPECTED
:
case
XCT_UNKNOWN_OP
:
case
XCT_UNKNOWN_BO
:
continue
;
continue
;
case
XCT_CLOSING
:
default:
default:
n
=
edx_end
;
n
=
edx_end
;
break
;
/* Phase out */
break
;
/* Phase out */
}
}
break
;
break
;
}
}
if
(
n
==
edx_end
)
break
;
if
(
n
!=
edx_end
)
continue
;
continue
;
}
/* It is expected extension */
if
(
IN_EXTENSION_GROUP
(
specs
,
edx
+
elements
[
edx
].
optional
))
{
ASN_DEBUG
(
"Got anticipated extension at %d, "
"but NOT IMPLEMENTED YET"
,
edx
);
/*
* TODO: implement skipping of extensions
*/
}
/* Fall through */
default:
default:
break
;
break
;
}
}
...
...
skeletons/constr_SET.c
View file @
904e65b8
...
@@ -714,7 +714,8 @@ SET_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -714,7 +714,8 @@ SET_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
continue
;
continue
;
}
}
/* Fall through */
/* Fall through */
case
XCT_UNEXPECTED
:
case
XCT_UNKNOWN_OP
:
case
XCT_UNKNOWN_BO
:
ASN_DEBUG
(
"XER/SET: tcv=%d, ph=%d"
,
tcv
,
ctx
->
phase
);
ASN_DEBUG
(
"XER/SET: tcv=%d, ph=%d"
,
tcv
,
ctx
->
phase
);
if
(
ctx
->
phase
!=
1
)
if
(
ctx
->
phase
!=
1
)
...
@@ -735,9 +736,9 @@ SET_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -735,9 +736,9 @@ SET_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
ctx
->
step
=
edx
;
ctx
->
step
=
edx
;
ctx
->
phase
=
2
;
ctx
->
phase
=
2
;
break
;
break
;
case
XCT_UNEXPECTED
:
case
XCT_UNKNOWN_OP
:
case
XCT_UNKNOWN_BO
:
continue
;
continue
;
case
XCT_CLOSING
:
default:
default:
edx
=
td
->
elements_count
;
edx
=
td
->
elements_count
;
break
;
/* Phase out */
break
;
/* Phase out */
...
@@ -746,6 +747,16 @@ SET_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -746,6 +747,16 @@ SET_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
}
}
if
(
edx
!=
td
->
elements_count
)
if
(
edx
!=
td
->
elements_count
)
continue
;
continue
;
/* It is expected extension */
if
(
specs
->
extensible
)
{
ASN_DEBUG
(
"Got anticipated extension, "
"but NOT IMPLEMENTED YET"
);
/*
* TODO: implement skipping of extensions
*/
}
/* Fall through */
/* Fall through */
default:
default:
break
;
break
;
...
...
skeletons/constr_SET_OF.c
View file @
904e65b8
...
@@ -577,7 +577,8 @@ SET_OF_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -577,7 +577,8 @@ SET_OF_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
continue
;
continue
;
}
}
/* Fall through */
/* Fall through */
case
XCT_UNEXPECTED
:
case
XCT_UNKNOWN_OP
:
case
XCT_UNKNOWN_BO
:
ASN_DEBUG
(
"XER/SET OF: tcv=%d, ph=%d"
,
tcv
,
ctx
->
phase
);
ASN_DEBUG
(
"XER/SET OF: tcv=%d, ph=%d"
,
tcv
,
ctx
->
phase
);
if
(
ctx
->
phase
!=
1
)
if
(
ctx
->
phase
!=
1
)
...
@@ -595,8 +596,6 @@ SET_OF_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
...
@@ -595,8 +596,6 @@ SET_OF_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
*/
*/
ctx
->
phase
=
2
;
ctx
->
phase
=
2
;
continue
;
continue
;
case
XCT_UNEXPECTED
:
case
XCT_CLOSING
:
default:
default:
break
;
/* Phase out */
break
;
/* Phase out */
}
}
...
...
skeletons/xer_decoder.c
View file @
904e65b8
...
@@ -137,12 +137,13 @@ xer_check_tag(const void *buf_ptr, int size, const char *need_tag) {
...
@@ -137,12 +137,13 @@ xer_check_tag(const void *buf_ptr, int size, const char *need_tag) {
return
ct
;
return
ct
;
}
}
}
}
return
XCT_UNEXPECTED
;
return
(
XCT__UNK__MASK
|
ct
)
;
}
}
if
(
b
==
0
)
if
(
b
==
0
)
return
XCT_BROKEN
;
/* Embedded 0 in buf?! */
return
XCT_BROKEN
;
/* Embedded 0 in buf?! */
}
}
if
(
*
need_tag
)
return
XCT_UNEXPECTED
;
if
(
*
need_tag
)
return
(
XCT__UNK__MASK
|
ct
);
return
ct
;
return
ct
;
}
}
...
@@ -272,7 +273,7 @@ xer_decode_general(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -272,7 +273,7 @@ xer_decode_general(asn_codec_ctx_t *opt_codec_ctx,
ADVANCE
(
ch_size
);
ADVANCE
(
ch_size
);
ctx
->
phase
=
2
;
/* Phase out */
ctx
->
phase
=
2
;
/* Phase out */
RETURN
(
RC_OK
);
RETURN
(
RC_OK
);
case
XCT_UN
EXPECTED
:
case
XCT_UN
KNOWN_BO
:
if
(
!
ctx
->
phase
)
break
;
if
(
!
ctx
->
phase
)
break
;
/*
/*
* Certain tags in the body may be expected.
* Certain tags in the body may be expected.
...
...
skeletons/xer_decoder.h
View file @
904e65b8
...
@@ -70,11 +70,14 @@ ssize_t xer_next_token(int *stateContext, void *buffer, size_t size,
...
@@ -70,11 +70,14 @@ ssize_t xer_next_token(int *stateContext, void *buffer, size_t size,
* This function checks the buffer against the tag name is expected to occur.
* This function checks the buffer against the tag name is expected to occur.
*/
*/
typedef
enum
xer_check_tag
{
typedef
enum
xer_check_tag
{
XCT_BROKEN
,
/* The tag is broken */
XCT_BROKEN
=
0
,
/* The tag is broken */
XCT_UNEXPECTED
,
/* The tag is fine, but unexpected */
XCT_OPENING
=
1
,
/* This is the <opening> tag */
XCT_OPENING
,
/* This is the opening <tag> */
XCT_CLOSING
=
2
,
/* This is the </closing> tag */
XCT_CLOSING
,
/* This is the closing </tag> */
XCT_BOTH
=
3
,
/* This is the <modified/> tag */
XCT_BOTH
,
/* This is the opening and closing tag <tag/> */
XCT__UNK__MASK
=
4
,
/* Mask of everything unexpected */
XCT_UNKNOWN_OP
=
5
,
/* Unexpected <opening> tag */
XCT_UNKNOWN_CL
=
6
,
/* Unexpected </closing> 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