/src/open5gs/lib/asn1c/common/NULL.c
Line | Count | Source |
1 | | /*- |
2 | | * Copyright (c) 2003, 2005 Lev Walkin <vlm@lionet.info>. All rights reserved. |
3 | | * Redistribution and modifications are permitted subject to BSD license. |
4 | | */ |
5 | | #include <asn_internal.h> |
6 | | #include <NULL.h> |
7 | | |
8 | | /* |
9 | | * NULL basic type description. |
10 | | */ |
11 | | static const ber_tlv_tag_t asn_DEF_NULL_tags[] = { |
12 | | (ASN_TAG_CLASS_UNIVERSAL | (5 << 2)) |
13 | | }; |
14 | | asn_TYPE_operation_t asn_OP_NULL = { |
15 | | .kind = ASN_KIND_PRIMITIVE, |
16 | | NULL_free, |
17 | | #if !defined(ASN_DISABLE_PRINT_SUPPORT) |
18 | | NULL_print, |
19 | | #else |
20 | | 0, |
21 | | #endif /* !defined(ASN_DISABLE_PRINT_SUPPORT) */ |
22 | | NULL_compare, |
23 | | NULL_copy, |
24 | | #if !defined(ASN_DISABLE_BER_SUPPORT) |
25 | | NULL_decode_ber, |
26 | | NULL_encode_der, /* Special handling of DER encoding */ |
27 | | #else |
28 | | 0, |
29 | | 0, |
30 | | #endif /* !defined(ASN_DISABLE_BER_SUPPORT) */ |
31 | | #if !defined(ASN_DISABLE_XER_SUPPORT) |
32 | | NULL_decode_xer, |
33 | | NULL_encode_xer, |
34 | | #else |
35 | | 0, |
36 | | 0, |
37 | | #endif /* !defined(ASN_DISABLE_XER_SUPPORT) */ |
38 | | #if !defined(ASN_DISABLE_JER_SUPPORT) |
39 | | NULL_decode_jer, |
40 | | NULL_encode_jer, |
41 | | #else |
42 | | 0, |
43 | | 0, |
44 | | #endif /* !defined(ASN_DISABLE_JER_SUPPORT) */ |
45 | | #if !defined(ASN_DISABLE_OER_SUPPORT) |
46 | | NULL_decode_oer, |
47 | | NULL_encode_oer, |
48 | | #else |
49 | | 0, |
50 | | 0, |
51 | | #endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ |
52 | | #if !defined(ASN_DISABLE_UPER_SUPPORT) |
53 | | NULL_decode_uper, /* Unaligned PER decoder */ |
54 | | NULL_encode_uper, /* Unaligned PER encoder */ |
55 | | #else |
56 | | 0, |
57 | | 0, |
58 | | #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) */ |
59 | | #if !defined(ASN_DISABLE_APER_SUPPORT) |
60 | | NULL_decode_aper, /* Aligned PER decoder */ |
61 | | NULL_encode_aper, /* Aligned PER encoder */ |
62 | | #else |
63 | | 0, |
64 | | 0, |
65 | | #endif /* !defined(ASN_DISABLE_APER_SUPPORT) */ |
66 | | #if !defined(ASN_DISABLE_RFILL_SUPPORT) |
67 | | NULL_random_fill, |
68 | | #else |
69 | | 0, |
70 | | #endif /* !defined(ASN_DISABLE_RFILL_SUPPORT) */ |
71 | | 0 /* Use generic outmost tag fetcher */, |
72 | | #if !defined(ASN_DISABLE_CBOR_SUPPORT) |
73 | | NULL_decode_cbor, |
74 | | NULL_encode_cbor, |
75 | | #else |
76 | | 0, |
77 | | 0, |
78 | | #endif /* !defined(ASN_DISABLE_CBOR_SUPPORT) */ |
79 | | }; |
80 | | asn_TYPE_descriptor_t asn_DEF_NULL = { |
81 | | "NULL", |
82 | | "NULL", |
83 | | &asn_OP_NULL, |
84 | | asn_DEF_NULL_tags, |
85 | | sizeof(asn_DEF_NULL_tags) / sizeof(asn_DEF_NULL_tags[0]), |
86 | | asn_DEF_NULL_tags, /* Same as above */ |
87 | | sizeof(asn_DEF_NULL_tags) / sizeof(asn_DEF_NULL_tags[0]), |
88 | | { |
89 | | #if !defined(ASN_DISABLE_OER_SUPPORT) |
90 | | 0, |
91 | | #endif /* !defined(ASN_DISABLE_OER_SUPPORT) */ |
92 | | #if !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) |
93 | | 0, |
94 | | #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) || !defined(ASN_DISABLE_APER_SUPPORT) */ |
95 | | #if !defined(ASN_DISABLE_JER_SUPPORT) |
96 | | 0, |
97 | | #endif /* !defined(ASN_DISABLE_JER_SUPPORT) */ |
98 | | asn_generic_no_constraint |
99 | | }, |
100 | | 0, 0, /* No members */ |
101 | | 0 /* No specifics */ |
102 | | }; |
103 | | |
104 | | void |
105 | | NULL_free(const asn_TYPE_descriptor_t *td, void *ptr, |
106 | 191 | enum asn_struct_free_method method) { |
107 | 191 | if(td && ptr) { |
108 | 191 | switch(method) { |
109 | 0 | case ASFM_FREE_EVERYTHING: |
110 | 0 | FREEMEM(ptr); |
111 | 0 | break; |
112 | 191 | case ASFM_FREE_UNDERLYING: |
113 | 191 | break; |
114 | 0 | case ASFM_FREE_UNDERLYING_AND_RESET: |
115 | 0 | memset(ptr, 0, sizeof(NULL_t)); |
116 | 0 | break; |
117 | 191 | } |
118 | 191 | } |
119 | 191 | } |
120 | | |
121 | | int |
122 | 0 | NULL_compare(const asn_TYPE_descriptor_t *td, const void *a, const void *b) { |
123 | 0 | (void)td; |
124 | 0 | (void)a; |
125 | 0 | (void)b; |
126 | 0 | return 0; |
127 | 0 | } |
128 | | |
129 | | int |
130 | 0 | NULL_copy(const asn_TYPE_descriptor_t *td, void **a, const void *b) { |
131 | 0 | (void)td; |
132 | |
|
133 | 0 | if(b && !*a) { |
134 | 0 | *a = CALLOC(1, sizeof(NULL_t)); |
135 | 0 | if (!*a) return -1; |
136 | 0 | } |
137 | | |
138 | 0 | return 0; |
139 | 0 | } |