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
63a35237
Commit
63a35237
authored
Aug 10, 2017
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
presence unsigned
parent
6aae7c62
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
41 deletions
+40
-41
skeletons/constr_CHOICE.c
skeletons/constr_CHOICE.c
+23
-24
skeletons/constr_CHOICE.h
skeletons/constr_CHOICE.h
+17
-17
No files found.
skeletons/constr_CHOICE.c
View file @
63a35237
...
...
@@ -67,7 +67,7 @@ static signed _fetch_present_idx(const void *struct_ptr, int off, int size);
static
void
_set_present_idx
(
void
*
sptr
,
int
offset
,
int
size
,
int
pres
);
static
const
void
*
_get_member_ptr
(
const
asn_TYPE_descriptor_t
*
,
const
void
*
sptr
,
asn_TYPE_member_t
**
elm
,
signed
*
present
);
un
signed
*
present
);
/*
* Tags are canonically sorted in the tag to member table.
...
...
@@ -365,7 +365,7 @@ CHOICE_encode_der(asn_TYPE_descriptor_t *td, void *sptr,
asn_enc_rval_t
erval
;
void
*
memb_ptr
;
size_t
computed_size
=
0
;
signed
present
;
un
signed
present
;
if
(
!
sptr
)
ASN__ENCODE_FAILED
;
...
...
@@ -379,7 +379,7 @@ CHOICE_encode_der(asn_TYPE_descriptor_t *td, void *sptr,
* If the structure was not initialized, it cannot be encoded:
* can't deduce what to encode in the choice type.
*/
if
(
present
<=
0
||
(
unsigned
)
present
>
td
->
elements_count
)
{
if
(
present
==
0
||
present
>
td
->
elements_count
)
{
if
(
present
==
0
&&
td
->
elements_count
==
0
)
{
/* The CHOICE is empty?! */
erval
.
encoded
=
0
;
...
...
@@ -450,7 +450,7 @@ CHOICE_encode_der(asn_TYPE_descriptor_t *td, void *sptr,
ber_tlv_tag_t
CHOICE_outmost_tag
(
const
asn_TYPE_descriptor_t
*
td
,
const
void
*
ptr
,
int
tag_mode
,
ber_tlv_tag_t
tag
)
{
asn_CHOICE_specifics_t
*
specs
=
(
asn_CHOICE_specifics_t
*
)
td
->
specifics
;
signed
present
;
un
signed
present
;
assert
(
tag_mode
==
0
);
(
void
)
tag_mode
;
assert
(
tag
==
0
);
(
void
)
tag
;
...
...
@@ -460,7 +460,7 @@ CHOICE_outmost_tag(const asn_TYPE_descriptor_t *td, const void *ptr, int tag_mod
*/
present
=
_fetch_present_idx
(
ptr
,
specs
->
pres_offset
,
specs
->
pres_size
);
if
(
present
>
0
&&
(
unsigned
)
present
<=
td
->
elements_count
)
{
if
(
present
>
0
&&
present
<=
td
->
elements_count
)
{
const
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
present
-
1
];
const
void
*
memb_ptr
;
...
...
@@ -483,7 +483,7 @@ int
CHOICE_constraint
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
asn_app_constraint_failed_f
*
ctfailcb
,
void
*
app_key
)
{
asn_CHOICE_specifics_t
*
specs
=
(
asn_CHOICE_specifics_t
*
)
td
->
specifics
;
signed
present
;
un
signed
present
;
if
(
!
sptr
)
{
ASN__CTFAIL
(
app_key
,
td
,
sptr
,
...
...
@@ -496,7 +496,7 @@ CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
* Figure out which CHOICE element is encoded.
*/
present
=
_fetch_present_idx
(
sptr
,
specs
->
pres_offset
,
specs
->
pres_size
);
if
(
present
>
0
&&
(
unsigned
)
present
<=
td
->
elements_count
)
{
if
(
present
>
0
&&
present
<=
td
->
elements_count
)
{
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
present
-
1
];
const
void
*
memb_ptr
;
...
...
@@ -780,7 +780,7 @@ CHOICE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn_CHOICE_specifics_t
*
specs
=
(
asn_CHOICE_specifics_t
*
)
td
->
specifics
;
asn_enc_rval_t
er
;
signed
present
;
un
signed
present
;
if
(
!
sptr
)
ASN__ENCODE_FAILED
;
...
...
@@ -790,7 +790,7 @@ CHOICE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
*/
present
=
_fetch_present_idx
(
sptr
,
specs
->
pres_offset
,
specs
->
pres_size
);
if
(
present
<=
0
||
(
unsigned
)
present
>
td
->
elements_count
)
{
if
(
present
==
0
||
present
>
td
->
elements_count
)
{
ASN__ENCODE_FAILED
;
}
else
{
asn_enc_rval_t
tmper
;
...
...
@@ -917,7 +917,7 @@ CHOICE_encode_uper(asn_TYPE_descriptor_t *td,
asn_TYPE_member_t
*
elm
;
/* CHOICE's element */
const
asn_per_constraint_t
*
ct
;
void
*
memb_ptr
;
signed
present
;
un
signed
present
;
int
present_enc
;
if
(
!
sptr
)
ASN__ENCODE_FAILED
;
...
...
@@ -928,14 +928,13 @@ CHOICE_encode_uper(asn_TYPE_descriptor_t *td,
else
if
(
td
->
per_constraints
)
ct
=
&
td
->
per_constraints
->
value
;
else
ct
=
0
;
present
=
_fetch_present_idx
(
sptr
,
specs
->
pres_offset
,
specs
->
pres_size
);
present
=
_fetch_present_idx
(
sptr
,
specs
->
pres_offset
,
specs
->
pres_size
);
/*
/*
* If the structure was not initialized properly, it cannot be encoded:
* can't deduce what to encode in the choice type.
*/
if
(
present
<=
0
||
(
unsigned
)
present
>
td
->
elements_count
)
if
(
present
==
0
||
present
>
td
->
elements_count
)
ASN__ENCODE_FAILED
;
else
present
--
;
...
...
@@ -998,7 +997,7 @@ int
CHOICE_print
(
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn_CHOICE_specifics_t
*
specs
=
(
asn_CHOICE_specifics_t
*
)
td
->
specifics
;
signed
present
;
un
signed
present
;
if
(
!
sptr
)
return
(
cb
(
"<absent>"
,
8
,
app_key
)
<
0
)
?
-
1
:
0
;
...
...
@@ -1010,7 +1009,7 @@ CHOICE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
/*
* Print that element.
*/
if
(
present
>
0
&&
(
unsigned
)
present
<=
td
->
elements_count
)
{
if
(
present
>
0
&&
present
<=
td
->
elements_count
)
{
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
present
-
1
];
const
void
*
memb_ptr
;
...
...
@@ -1038,7 +1037,7 @@ CHOICE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
void
CHOICE_free
(
asn_TYPE_descriptor_t
*
td
,
void
*
ptr
,
int
contents_only
)
{
asn_CHOICE_specifics_t
*
specs
=
(
asn_CHOICE_specifics_t
*
)
td
->
specifics
;
signed
present
;
un
signed
present
;
if
(
!
td
||
!
ptr
)
return
;
...
...
@@ -1053,7 +1052,7 @@ CHOICE_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) {
/*
* Free that element.
*/
if
(
present
>
0
&&
(
unsigned
)
present
<=
td
->
elements_count
)
{
if
(
present
>
0
&&
present
<=
td
->
elements_count
)
{
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
present
-
1
];
void
*
memb_ptr
;
...
...
@@ -1085,7 +1084,7 @@ CHOICE_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) {
static
signed
_fetch_present_idx
(
const
void
*
struct_ptr
,
int
pres_offset
,
int
pres_size
)
{
const
void
*
present_ptr
;
signed
present
;
un
signed
present
;
present_ptr
=
((
const
char
*
)
struct_ptr
)
+
pres_offset
;
...
...
@@ -1119,9 +1118,9 @@ _set_present_idx(void *struct_ptr, int pres_offset, int pres_size, int present)
static
const
void
*
_get_member_ptr
(
const
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
asn_TYPE_member_t
**
elm_ptr
,
signed
*
present_out
)
{
asn_TYPE_member_t
**
elm_ptr
,
un
signed
*
present_out
)
{
asn_CHOICE_specifics_t
*
specs
=
(
asn_CHOICE_specifics_t
*
)
td
->
specifics
;
signed
present
;
un
signed
present
;
if
(
!
sptr
)
{
*
elm_ptr
=
NULL
;
...
...
@@ -1139,7 +1138,7 @@ _get_member_ptr(const asn_TYPE_descriptor_t *td, const void *sptr,
* The presence index is intentionally 1-based to avoid
* treating zeroed structure as a valid one.
*/
if
(
present
>
0
&&
(
unsigned
)
present
<=
td
->
elements_count
)
{
if
(
present
>
0
&&
present
<=
td
->
elements_count
)
{
asn_TYPE_member_t
*
const
elm
=
&
td
->
elements
[
present
-
1
];
const
void
*
memb_ptr
;
...
...
@@ -1162,8 +1161,8 @@ int
CHOICE_compare
(
const
asn_TYPE_descriptor_t
*
td
,
const
void
*
aptr
,
const
void
*
bptr
)
{
asn_TYPE_member_t
*
aelm
;
asn_TYPE_member_t
*
belm
;
signed
apresent
=
0
;
signed
bpresent
=
0
;
un
signed
apresent
=
0
;
un
signed
bpresent
=
0
;
const
void
*
amember
=
_get_member_ptr
(
td
,
aptr
,
&
aelm
,
&
apresent
);
const
void
*
bmember
=
_get_member_ptr
(
td
,
bptr
,
&
belm
,
&
apresent
);
...
...
skeletons/constr_CHOICE.h
View file @
63a35237
...
...
@@ -13,27 +13,27 @@ extern "C" {
#endif
typedef
const
struct
asn_CHOICE_specifics_s
{
/*
* Target structure description.
*/
int
struct_size
;
/* Size of the target structure. */
int
ctx_offset
;
/* Offset of the asn_codec_ctx_t member */
int
pres_offset
;
/* Identifier of the present member */
int
pres_size
;
/* Size of the identifier (enum) */
/*
* Tags to members mapping table.
*/
const
asn_TYPE_tag2member_t
*
tag2el
;
/*
* Target structure description.
*/
unsigned
struct_size
;
/* Size of the target structure. */
unsigned
ctx_offset
;
/* Offset of the asn_codec_ctx_t member */
unsigned
pres_offset
;
/* Identifier of the present member */
unsigned
pres_size
;
/* Size of the identifier (enum) */
/*
* Tags to members mapping table.
*/
const
asn_TYPE_tag2member_t
*
tag2el
;
unsigned
tag2el_count
;
/* Canonical ordering of CHOICE elements, for PER */
int
*
canonical_order
;
const
int
*
canonical_order
;
/*
* Extensions-related stuff.
*/
signed
ext_start
;
/* First member of extensions, or -1 */
/*
* Extensions-related stuff.
*/
signed
ext_start
;
/* First member of extensions, or -1 */
}
asn_CHOICE_specifics_t
;
/*
...
...
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