2 * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
3 * Redistribution and modifications are permitted subject to BSD license.
8 #include <asn_application.h>
15 typedef struct asn_SET_specifics_s {
17 * Target structure description.
19 unsigned struct_size; /* Size of the target structure. */
20 unsigned ctx_offset; /* Offset of the asn_struct_ctx_t member */
21 unsigned pres_offset; /* Offset of _presence_map member */
24 * Tags to members mapping table (sorted).
25 * Sometimes suitable for DER encoding (untagged CHOICE is present);
26 * if so, tag2el_count will be greater than td->elements_count.
28 const asn_TYPE_tag2member_t *tag2el;
29 unsigned tag2el_count;
32 * Tags to members mapping table, second edition.
33 * Suitable for CANONICAL-XER encoding.
35 const asn_TYPE_tag2member_t *tag2el_cxer;
36 unsigned tag2el_cxer_count;
39 * Extensions-related stuff.
41 int extensible; /* Whether SET is extensible */
42 const unsigned int *_mandatory_elements; /* Bitmask of mandatory ones */
43 } asn_SET_specifics_t;
46 * A set specialized functions dealing with the SET type.
48 asn_struct_free_f SET_free;
49 asn_struct_print_f SET_print;
50 asn_struct_compare_f SET_compare;
51 asn_constr_check_f SET_constraint;
52 ber_type_decoder_f SET_decode_ber;
53 der_type_encoder_f SET_encode_der;
54 xer_type_decoder_f SET_decode_xer;
55 xer_type_encoder_f SET_encode_xer;
56 per_type_decoder_f SET_decode_uper;
57 per_type_encoder_f SET_encode_uper;
58 asn_random_fill_f SET_random_fill;
59 extern asn_TYPE_operation_t asn_OP_SET;
61 /***********************
62 * Some handy helpers. *
63 ***********************/
66 * Figure out whether the SET member indicated by PR_x has already been decoded.
67 * It is very simple bitfield test, despite its visual complexity.
69 #define ASN_SET_ISPRESENT(set_ptr, PR_x) \
70 ASN_SET_ISPRESENT2(&((set_ptr)->_presence_map), PR_x)
71 #define ASN_SET_ISPRESENT2(map_ptr, PR_x) \
72 (((unsigned int *)(map_ptr)) \
73 [(PR_x) / (8 * sizeof(unsigned int))] \
74 & (1u << ((8 * sizeof(unsigned int)) - 1 \
75 - ((PR_x) % (8 * sizeof(unsigned int))))))
77 #define ASN_SET_MKPRESENT(map_ptr, PR_x) \
78 (((unsigned int *)(map_ptr)) \
79 [(PR_x) / (8 * sizeof(unsigned int))] \
80 |= (1u << ((8 * sizeof(unsigned int)) - 1 \
81 - ((PR_x) % (8 * sizeof(unsigned int))))))
87 #endif /* _CONSTR_SET_H_ */