src
constr_CHOICE_print.c
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2017 Lev Walkin <vlm@lionet.info>.
3
* All rights reserved.
4
* Redistribution and modifications are permitted subject to BSD license.
5
*/
6
#include <
etsi_its_spatem_ts_coding/asn_internal.h
>
7
#include <
etsi_its_spatem_ts_coding/constr_CHOICE.h
>
8
9
int
10
CHOICE_print
(
const
asn_TYPE_descriptor_t
*td,
const
void
*sptr,
int
ilevel,
11
asn_app_consume_bytes_f
*cb,
void
*app_key) {
12
const
asn_CHOICE_specifics_t
*specs = (
const
asn_CHOICE_specifics_t
*)td->
specifics
;
13
unsigned
present;
14
15
if
(!sptr)
return
(cb(
"<absent>"
, 8, app_key) < 0) ? -1 : 0;
16
17
/*
18
* Figure out which CHOICE element is encoded.
19
*/
20
present =
_fetch_present_idx
(sptr, specs->
pres_offset
,specs->
pres_size
);
21
22
/*
23
* Print that element.
24
*/
25
if
(present > 0 && present <= td->elements_count) {
26
asn_TYPE_member_t
*elm = &td->
elements
[present-1];
27
const
void
*memb_ptr;
28
29
if
(elm->
flags
&
ATF_POINTER
) {
30
memb_ptr = *(
const
void
*
const
*)((
const
char
*)sptr + elm->
memb_offset
);
31
if
(!memb_ptr)
return
(cb(
"<absent>"
, 8, app_key) < 0) ? -1 : 0;
32
}
else
{
33
memb_ptr = (
const
void
*)((
const
char
*)sptr + elm->
memb_offset
);
34
}
35
36
/* Print member's name and stuff */
37
if
(0) {
38
if
(cb(elm->
name
, strlen(elm->
name
), app_key) < 0
39
|| cb(
": "
, 2, app_key) < 0)
40
return
-1;
41
}
42
43
return
elm->
type
->
op
->
print_struct
(elm->
type
, memb_ptr, ilevel,
44
cb, app_key);
45
}
else
{
46
return
(cb(
"<absent>"
, 8, app_key) < 0) ? -1 : 0;
47
}
48
}
asn_TYPE_member_s::memb_offset
unsigned memb_offset
Definition:
constr_TYPE.h:275
CHOICE_print
int CHOICE_print(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, asn_app_consume_bytes_f *cb, void *app_key)
Definition:
constr_CHOICE_print.c:10
asn_CHOICE_specifics_s
Definition:
constr_CHOICE.h:14
ATF_POINTER
@ ATF_POINTER
Definition:
constr_TYPE.h:268
asn_TYPE_descriptor_s
Definition:
constr_TYPE.h:224
asn_TYPE_member_s::type
asn_TYPE_descriptor_t * type
Definition:
constr_TYPE.h:278
asn_TYPE_descriptor_s::specifics
const void * specifics
Definition:
constr_TYPE.h:259
asn_CHOICE_specifics_s::pres_offset
unsigned pres_offset
Definition:
constr_CHOICE.h:20
asn_TYPE_member_s::name
const char * name
Definition:
constr_TYPE.h:283
asn_TYPE_descriptor_s::op
asn_TYPE_operation_t * op
Definition:
constr_TYPE.h:232
asn_TYPE_operation_s::print_struct
asn_struct_print_f * print_struct
Definition:
constr_TYPE.h:186
asn_app_consume_bytes_f
int() asn_app_consume_bytes_f(const void *buffer, size_t size, void *application_specific_key)
Definition:
asn_application.h:124
asn_internal.h
asn_TYPE_descriptor_s::elements
struct asn_TYPE_member_s * elements
Definition:
constr_TYPE.h:252
constr_CHOICE.h
_fetch_present_idx
unsigned _fetch_present_idx(const void *struct_ptr, unsigned off, unsigned size)
Definition:
constr_CHOICE.c:215
asn_TYPE_member_s
Definition:
constr_TYPE.h:272
asn_TYPE_member_s::flags
enum asn_TYPE_flags_e flags
Definition:
constr_TYPE.h:273
asn_CHOICE_specifics_s::pres_size
unsigned pres_size
Definition:
constr_CHOICE.h:21
etsi_its_spatem_ts_coding
Author(s): Jean-Pierre Busch
, Guido Küppers
, Lennart Reiher
autogenerated on Sun May 18 2025 02:29:28