| 1 | /* |
| 2 | * Copyright (c) 2004-2017 Lev Walkin <[email protected]>. All rights reserved. |
| 3 | * Redistribution and modifications are permitted subject to BSD license. |
| 4 | */ |
| 5 | #include <asn_internal.h>cxx . . $ `<file>/lib/s1ap/asn1c/asn_internal.h`/ |
| 6 | #include <ANY.h>cxx . . $ `<file>/lib/s1ap/asn1c/ANY.h`/ |
| 7 | #include <errno.h> |
| 8 | |
| 9 | asn_OCTET_STRING_specifics_tcxx . . $ asn_OCTET_STRING_specifics_t# asn_SPC_ANY_specscxx . . $ asn_SPC_ANY_specs. = { |
| 10 | sizeof(ANY_tcxx . . $ ANY_t#), |
| 11 | offsetofcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:431:9`!(ANY_t, _asn_ctx), |
| 12 | ASN_OSUBV_ANYcxx . . $ ASN_OSUBV_ANY. |
| 13 | }; |
| 14 | asn_TYPE_operation_tcxx . . $ asn_TYPE_operation_t# asn_OP_ANYcxx . . $ asn_OP_ANY. = { |
| 15 | OCTET_STRING_freecxx . . $ OCTET_STRING_free(d934c6f1aa2db56)., |
| 16 | OCTET_STRING_printcxx . . $ OCTET_STRING_print(f90cfeb3746557fe)., |
| 17 | OCTET_STRING_comparecxx . . $ OCTET_STRING_compare(bd6c17b928321db4)., |
| 18 | OCTET_STRING_decode_bercxx . . $ OCTET_STRING_decode_ber(96f9c71a4eda4f59)., |
| 19 | OCTET_STRING_encode_dercxx . . $ OCTET_STRING_encode_der(fa2fb5a8fffd167c)., |
| 20 | OCTET_STRING_decode_xer_hexcxx . . $ OCTET_STRING_decode_xer_hex(95123bf157631071)., |
| 21 | ANY_encode_xercxx . . $ ANY_encode_xer(c4fdd6fdb096b316)., |
| 22 | #ifdef ASN_DISABLE_OER_SUPPORT |
| 23 | 0, |
| 24 | 0, |
| 25 | #else |
| 26 | 0, |
| 27 | 0, |
| 28 | #endif /* ASN_DISABLE_OER_SUPPORT */ |
| 29 | #ifdef ASN_DISABLE_PER_SUPPORT |
| 30 | 0, 0, 0, 0, |
| 31 | #else |
| 32 | ANY_decode_upercxx . . $ ANY_decode_uper(e6a06374f784e2a6)., |
| 33 | ANY_encode_upercxx . . $ ANY_encode_uper(1e553b888c3dcd43)., |
| 34 | ANY_decode_apercxx . . $ ANY_decode_aper(e6a06374f784e2a6)., |
| 35 | ANY_encode_apercxx . . $ ANY_encode_aper(1e553b888c3dcd43)., |
| 36 | #endif /* ASN_DISABLE_PER_SUPPORT */ |
| 37 | 0, /* Random fill is not defined for ANY type */ |
| 38 | 0 /* Use generic outmost tag fetcher */ |
| 39 | }; |
| 40 | asn_TYPE_descriptor_tcxx . . $ asn_TYPE_descriptor_t# asn_DEF_ANYcxx . . $ asn_DEF_ANY. = { |
| 41 | "ANY", |
| 42 | "ANY", |
| 43 | &asn_OP_ANYcxx . . $ asn_OP_ANY., |
| 44 | 0, 0, 0, 0, |
| 45 | { 0, 0, asn_generic_no_constraintcxx . . $ asn_generic_no_constraint(f655700a27bffd74). }, /* No constraints */ |
| 46 | 0, 0, /* No members */ |
| 47 | &asn_SPC_ANY_specscxx . . $ asn_SPC_ANY_specs., |
| 48 | }; |
| 49 | |
| 50 | #undef RETURN |
| 51 | #define RETURNcxx . . $ `lib/s1ap/asn1c/ANY.c:51:9`!(_code) \ |
| 52 | do { \ |
| 53 | asn_dec_rval_t tmprval; \ |
| 54 | tmprval.code = _code; \ |
| 55 | tmprval.consumed = consumed_myself; \ |
| 56 | return tmprval; \ |
| 57 | } while(0) |
| 58 | |
| 59 | asn_enc_rval_tcxx . . $ asn_enc_rval_t# |
| 60 | ANY_encode_xercxx . . $ ANY_encode_xer(c4fdd6fdb096b316).(const asn_TYPE_descriptor_tcxx . . $ asn_TYPE_descriptor_t# *td, const void *sptr, int ilevel, |
| 61 | enum xer_encoder_flags_ecxx . . $ xer_encoder_flags_e# flags, asn_app_consume_bytes_fcxx . . $ asn_app_consume_bytes_f# *cb, |
| 62 | void *app_key) { |
| 63 | if(flags & XER_F_CANONICALcxx . . $ XER_F_CANONICAL.) { |
| 64 | /* |
| 65 | * Canonical XER-encoding of ANY type is not supported. |
| 66 | */ |
| 67 | ASN__ENCODE_FAILEDcxx . . $ `lib/s1ap/asn1c/asn_codecs.h:59:9`!; |
| 68 | } |
| 69 | |
| 70 | /* Dump as binary */ |
| 71 | return OCTET_STRING_encode_xercxx . . $ OCTET_STRING_encode_xer(c4fdd6fdb096b316).(td, sptr, ilevel, flags, cb, app_key); |
| 72 | } |
| 73 | |
| 74 | struct _callback_argcxx . . $ _callback_arg# { |
| 75 | uint8_tcxx . . $ uint8_t# *buffercxx . . $ _callback_arg#buffer.; |
| 76 | size_t offsetcxx . . $ _callback_arg#offset.; |
| 77 | size_t sizecxx . . $ _callback_arg#size.; |
| 78 | }; |
| 79 | |
| 80 | static int ANY__consume_bytescxx . . $ ANY__consume_bytes(d5add74c253e2b79).(const void *buffer, size_t size, void *key); |
| 81 | |
| 82 | int |
| 83 | ANY_fromTypecxx . . $ ANY_fromType(9991d6edc3c365c1).(ANY_tcxx . . $ ANY_t# *st, asn_TYPE_descriptor_tcxx . . $ asn_TYPE_descriptor_t# *td, void *sptr) { |
| 84 | struct _callback_argcxx . . $ _callback_arg# arg; |
| 85 | asn_enc_rval_tcxx . . $ asn_enc_rval_t# erval; |
| 86 | |
| 87 | if(!st || !td) { |
| 88 | errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!; |
| 89 | return -1; |
| 90 | } |
| 91 | |
| 92 | if(!sptr) { |
| 93 | if(st->bufcxx . . $ ANY#buf.) FREEMEMcxx . . $ `lib/s1ap/asn1c/asn_internal.h:36:9`!(st->buf); |
| 94 | st->sizecxx . . $ ANY#size. = 0; |
| 95 | return 0; |
| 96 | } |
| 97 | |
| 98 | arg.offsetcxx . . $ _callback_arg#offset. = arg.sizecxx . . $ _callback_arg#size. = 0; |
| 99 | arg.buffercxx . . $ _callback_arg#buffer. = 0; |
| 100 | |
| 101 | erval = der_encodecxx . . $ der_encode(58833f7210a97c38).(td, sptr, ANY__consume_bytescxx . . $ ANY__consume_bytes(d5add74c253e2b79)., &arg); |
| 102 | if(erval.encodedcxx . . $ asn_enc_rval_s#encoded. == -1) { |
| 103 | if(arg.buffercxx . . $ _callback_arg#buffer.) FREEMEMcxx . . $ `lib/s1ap/asn1c/asn_internal.h:36:9`!(arg.buffer); |
| 104 | return -1; |
| 105 | } |
| 106 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!((size_t)erval.encoded == arg.offset); |
| 107 | |
| 108 | if(st->bufcxx . . $ ANY#buf.) FREEMEMcxx . . $ `lib/s1ap/asn1c/asn_internal.h:36:9`!(st->buf); |
| 109 | st->bufcxx . . $ ANY#buf. = arg.buffercxx . . $ _callback_arg#buffer.; |
| 110 | st->sizecxx . . $ ANY#size. = arg.offsetcxx . . $ _callback_arg#offset.; |
| 111 | |
| 112 | return 0; |
| 113 | } |
| 114 | |
| 115 | int |
| 116 | ANY_fromType_apercxx . . $ ANY_fromType_aper(9991d6edc3c365c1).(ANY_tcxx . . $ ANY_t# *st, asn_TYPE_descriptor_tcxx . . $ asn_TYPE_descriptor_t# *td, void *sptr) { |
| 117 | uint8_tcxx . . $ uint8_t# *buffer = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 118 | ssize_tcxx . . $ ssize_t# erval; |
| 119 | |
| 120 | if(!st || !td) { |
| 121 | errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!; |
| 122 | return -1; |
| 123 | } |
| 124 | |
| 125 | if(!sptr) { |
| 126 | if(st->bufcxx . . $ ANY#buf.) FREEMEMcxx . . $ `lib/s1ap/asn1c/asn_internal.h:36:9`!(st->buf); |
| 127 | st->sizecxx . . $ ANY#size. = 0; |
| 128 | return 0; |
| 129 | } |
| 130 | |
| 131 | erval = aper_encode_to_new_buffercxx . . $ aper_encode_to_new_buffer(a2aab3e72246e506).(td, td->encoding_constraintscxx . . $ asn_TYPE_descriptor_s#encoding_constraints..per_constraintscxx . . $ asn_encoding_constraints_s#per_constraints., sptr, (void**)&buffer); |
| 132 | |
| 133 | if(erval == -1) { |
| 134 | if(buffer) FREEMEMcxx . . $ `lib/s1ap/asn1c/asn_internal.h:36:9`!(buffer); |
| 135 | return -1; |
| 136 | } |
| 137 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!((size_t)erval > 0); |
| 138 | |
| 139 | if(st->bufcxx . . $ ANY#buf.) FREEMEMcxx . . $ `lib/s1ap/asn1c/asn_internal.h:36:9`!(st->buf); |
| 140 | st->bufcxx . . $ ANY#buf. = buffer; |
| 141 | st->sizecxx . . $ ANY#size. = erval; |
| 142 | |
| 143 | return 0; |
| 144 | } |
| 145 | |
| 146 | ANY_tcxx . . $ ANY_t# * |
| 147 | ANY_new_fromTypecxx . . $ ANY_new_fromType(378f09c3b2fecb47).(asn_TYPE_descriptor_tcxx . . $ asn_TYPE_descriptor_t# *td, void *sptr) { |
| 148 | ANY_tcxx . . $ ANY_t# tmp; |
| 149 | ANY_tcxx . . $ ANY_t# *st; |
| 150 | |
| 151 | if(!td || !sptr) { |
| 152 | errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!; |
| 153 | return 0; |
| 154 | } |
| 155 | |
| 156 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(&tmp, 0, sizeof(tmp)); |
| 157 | |
| 158 | if(ANY_fromTypecxx . . $ ANY_fromType(9991d6edc3c365c1).(&tmp, td, sptr)) return 0; |
| 159 | |
| 160 | st = (ANY_tcxx . . $ ANY_t# *)CALLOCcxx . . $ `lib/s1ap/asn1c/asn_internal.h:33:9`!(1, sizeof(ANY_t)); |
| 161 | if(st) { |
| 162 | *st = tmp; |
| 163 | return st; |
| 164 | } else { |
| 165 | FREEMEMcxx . . $ `lib/s1ap/asn1c/asn_internal.h:36:9`!(tmp.buf); |
| 166 | return 0; |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | ANY_tcxx . . $ ANY_t# * |
| 171 | ANY_new_fromType_apercxx . . $ ANY_new_fromType_aper(378f09c3b2fecb47).(asn_TYPE_descriptor_tcxx . . $ asn_TYPE_descriptor_t# *td, void *sptr) { |
| 172 | ANY_tcxx . . $ ANY_t# tmp; |
| 173 | ANY_tcxx . . $ ANY_t# *st; |
| 174 | |
| 175 | if(!td || !sptr) { |
| 176 | errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!; |
| 177 | return 0; |
| 178 | } |
| 179 | |
| 180 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(&tmp, 0, sizeof(tmp)); |
| 181 | |
| 182 | if(ANY_fromType_apercxx . . $ ANY_fromType_aper(9991d6edc3c365c1).(&tmp, td, sptr)) return 0; |
| 183 | |
| 184 | st = (ANY_tcxx . . $ ANY_t# *)CALLOCcxx . . $ `lib/s1ap/asn1c/asn_internal.h:33:9`!(1, sizeof(ANY_t)); |
| 185 | if(st) { |
| 186 | *st = tmp; |
| 187 | return st; |
| 188 | } else { |
| 189 | FREEMEMcxx . . $ `lib/s1ap/asn1c/asn_internal.h:36:9`!(tmp.buf); |
| 190 | return 0; |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | int |
| 195 | ANY_to_typecxx . . $ ANY_to_type(5c7d2bb46b24bb5).(ANY_tcxx . . $ ANY_t# *st, asn_TYPE_descriptor_tcxx . . $ asn_TYPE_descriptor_t# *td, void **struct_ptr) { |
| 196 | asn_dec_rval_tcxx . . $ asn_dec_rval_t# rval; |
| 197 | void *newst = 0; |
| 198 | |
| 199 | if(!st || !td || !struct_ptr) { |
| 200 | errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!; |
| 201 | return -1; |
| 202 | } |
| 203 | |
| 204 | if(st->bufcxx . . $ ANY#buf. == 0) { |
| 205 | /* Nothing to convert, make it empty. */ |
| 206 | *struct_ptr = (void *)0; |
| 207 | return 0; |
| 208 | } |
| 209 | |
| 210 | rval = ber_decodecxx . . $ ber_decode(cfb84f0b72eb2f8e).(0, td, (void **)&newst, st->bufcxx . . $ ANY#buf., st->sizecxx . . $ ANY#size.); |
| 211 | if(rval.codecxx . . $ asn_dec_rval_s#code. == RC_OKcxx . . $ RC_OK.) { |
| 212 | *struct_ptr = newst; |
| 213 | return 0; |
| 214 | } else { |
| 215 | /* Remove possibly partially decoded data. */ |
| 216 | ASN_STRUCT_FREEcxx . . $ `lib/s1ap/asn1c/constr_TYPE.h:72:9`!(*td, newst); |
| 217 | return -1; |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | int |
| 222 | ANY_to_type_apercxx . . $ ANY_to_type_aper(5c7d2bb46b24bb5).(ANY_tcxx . . $ ANY_t# *st, asn_TYPE_descriptor_tcxx . . $ asn_TYPE_descriptor_t# *td, void **struct_ptr) { |
| 223 | asn_dec_rval_tcxx . . $ asn_dec_rval_t# rval; |
| 224 | void *newst = 0; |
| 225 | |
| 226 | if(!st || !td || !struct_ptr) { |
| 227 | errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`! = EINVALcxx . . $ `<external>/8987895939074593727/errno-base.h:26:9`!; |
| 228 | return -1; |
| 229 | } |
| 230 | |
| 231 | if(st->bufcxx . . $ ANY#buf. == 0) { |
| 232 | /* Nothing to convert, make it empty. */ |
| 233 | *struct_ptr = (void *)0; |
| 234 | return 0; |
| 235 | } |
| 236 | |
| 237 | rval = aper_decodecxx . . $ aper_decode(a81ca0836c467163).(0, td, (void **)&newst, st->bufcxx . . $ ANY#buf., st->sizecxx . . $ ANY#size., 0, 0); |
| 238 | if(rval.codecxx . . $ asn_dec_rval_s#code. == RC_OKcxx . . $ RC_OK.) { |
| 239 | *struct_ptr = newst; |
| 240 | return 0; |
| 241 | } else { |
| 242 | /* Remove possibly partially decoded data. */ |
| 243 | ASN_STRUCT_FREEcxx . . $ `lib/s1ap/asn1c/constr_TYPE.h:72:9`!(*td, newst); |
| 244 | return -1; |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | static int ANY__consume_bytescxx . . $ ANY__consume_bytes(d5add74c253e2b79).(const void *buffer, size_t size, void *key) { |
| 249 | struct _callback_argcxx . . $ _callback_arg# *arg = (struct _callback_argcxx . . $ _callback_arg# *)key; |
| 250 | |
| 251 | if((arg->offsetcxx . . $ _callback_arg#offset. + size) >= arg->sizecxx . . $ _callback_arg#size.) { |
| 252 | size_t nsize = (arg->sizecxx . . $ _callback_arg#size. ? arg->sizecxx . . $ _callback_arg#size. << 2 : 16) + size; |
| 253 | void *p = REALLOCcxx . . $ `lib/s1ap/asn1c/asn_internal.h:35:9`!(arg->buffer, nsize); |
| 254 | if(!p) return -1; |
| 255 | arg->buffercxx . . $ _callback_arg#buffer. = (uint8_tcxx . . $ uint8_t# *)p; |
| 256 | arg->sizecxx . . $ _callback_arg#size. = nsize; |
| 257 | } |
| 258 | |
| 259 | memcpycxx . . $ memcpy(cc817cb175f282d).(arg->buffercxx . . $ _callback_arg#buffer. + arg->offsetcxx . . $ _callback_arg#offset., buffer, size); |
| 260 | arg->offsetcxx . . $ _callback_arg#offset. += size; |
| 261 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(arg->offset < arg->size); |
| 262 | |
| 263 | return 0; |
| 264 | } |
| 265 | |
| 266 | #ifndef ASN_DISABLE_PER_SUPPORT |
| 267 | |
| 268 | asn_dec_rval_tcxx . . $ asn_dec_rval_t# |
| 269 | ANY_decode_upercxx . . $ ANY_decode_uper(e6a06374f784e2a6).(const asn_codec_ctx_tcxx . . $ asn_codec_ctx_t# *opt_codec_ctx, |
| 270 | const asn_TYPE_descriptor_tcxx . . $ asn_TYPE_descriptor_t# *td, |
| 271 | const asn_per_constraints_tcxx . . $ asn_per_constraints_t# *constraints, void **sptr, |
| 272 | asn_per_data_tcxx . . $ asn_per_data_t# *pd) { |
| 273 | const asn_OCTET_STRING_specifics_tcxx . . $ asn_OCTET_STRING_specifics_t# *specs = |
| 274 | td->specificscxx . . $ asn_TYPE_descriptor_s#specifics. ? (const asn_OCTET_STRING_specifics_tcxx . . $ asn_OCTET_STRING_specifics_t# *)td->specificscxx . . $ asn_TYPE_descriptor_s#specifics. |
| 275 | : &asn_SPC_ANY_specscxx . . $ asn_SPC_ANY_specs.; |
| 276 | size_t consumed_myself = 0; |
| 277 | int repeat; |
| 278 | ANY_tcxx . . $ ANY_t# *st = (ANY_tcxx . . $ ANY_t# *)*sptr; |
| 279 | |
| 280 | (void)opt_codec_ctx; |
| 281 | (void)constraints; |
| 282 | |
| 283 | /* |
| 284 | * Allocate the structure. |
| 285 | */ |
| 286 | if(!st) { |
| 287 | st = (ANY_tcxx . . $ ANY_t# *)(*sptr = CALLOCcxx . . $ `lib/s1ap/asn1c/asn_internal.h:33:9`!(1, specs->struct_size)); |
| 288 | if(!st) RETURNcxx . . $ `lib/s1ap/asn1c/ANY.c:51:9`!(RC_FAIL); |
| 289 | } |
| 290 | |
| 291 | ASN_DEBUGcxx . . $ `lib/s1ap/asn1c/asn_internal.h:76:9`!("UPER Decoding ANY type"); |
| 292 | |
| 293 | st->sizecxx . . $ ANY#size. = 0; |
| 294 | do { |
| 295 | ssize_tcxx . . $ ssize_t# raw_len; |
| 296 | ssize_tcxx . . $ ssize_t# len_bytes; |
| 297 | ssize_tcxx . . $ ssize_t# len_bits; |
| 298 | void *p; |
| 299 | int ret; |
| 300 | |
| 301 | /* Get the PER length */ |
| 302 | raw_len = uper_get_lengthcxx . . $ uper_get_length(14d590abbb3d316b).(pd, -1, 0, &repeat); |
| 303 | if(raw_len < 0) RETURNcxx . . $ `lib/s1ap/asn1c/ANY.c:51:9`!(RC_WMORE); |
| 304 | if(raw_len == 0 && st->bufcxx . . $ ANY#buf.) break; |
| 305 | |
| 306 | ASN_DEBUGcxx . . $ `lib/s1ap/asn1c/asn_internal.h:76:9`!("Got PER length len %" ASN_PRI_SIZE ", %s (%s)", raw_len, |
| 307 | repeat ? "repeat" : "once", td->name); |
| 308 | len_bytes = raw_len; |
| 309 | len_bits = len_bytes * 8; |
| 310 | |
| 311 | p = REALLOCcxx . . $ `lib/s1ap/asn1c/asn_internal.h:35:9`!(st->buf, st->size + len_bytes + 1); |
| 312 | if(!p) RETURNcxx . . $ `lib/s1ap/asn1c/ANY.c:51:9`!(RC_FAIL); |
| 313 | st->bufcxx . . $ ANY#buf. = (uint8_tcxx . . $ uint8_t# *)p; |
| 314 | |
| 315 | ret = per_get_many_bitscxx . . $ `lib/s1ap/asn1c/per_support.h:41:9`!(pd, &st->buf[st->size], 0, len_bits); |
| 316 | if(ret < 0) RETURNcxx . . $ `lib/s1ap/asn1c/ANY.c:51:9`!(RC_WMORE); |
| 317 | consumed_myself += len_bits; |
| 318 | st->sizecxx . . $ ANY#size. += len_bytes; |
| 319 | } while(repeat); |
| 320 | st->bufcxx . . $ ANY#buf.[st->sizecxx . . $ ANY#size.] = 0; /* nul-terminate */ |
| 321 | |
| 322 | RETURNcxx . . $ `lib/s1ap/asn1c/ANY.c:51:9`!(RC_OK); |
| 323 | } |
| 324 | |
| 325 | asn_enc_rval_tcxx . . $ asn_enc_rval_t# |
| 326 | ANY_encode_upercxx . . $ ANY_encode_uper(1e553b888c3dcd43).(const asn_TYPE_descriptor_tcxx . . $ asn_TYPE_descriptor_t# *td, |
| 327 | const asn_per_constraints_tcxx . . $ asn_per_constraints_t# *constraints, const void *sptr, |
| 328 | asn_per_outp_tcxx . . $ asn_per_outp_t# *po) { |
| 329 | const ANY_tcxx . . $ ANY_t# *st = (const ANY_tcxx . . $ ANY_t# *)sptr; |
| 330 | asn_enc_rval_tcxx . . $ asn_enc_rval_t# er = {0, 0, 0}; |
| 331 | const uint8_tcxx . . $ uint8_t# *buf; |
| 332 | size_t size; |
| 333 | int ret; |
| 334 | |
| 335 | (void)constraints; |
| 336 | |
| 337 | if(!st || (!st->bufcxx . . $ ANY#buf. && st->sizecxx . . $ ANY#size.)) ASN__ENCODE_FAILEDcxx . . $ `lib/s1ap/asn1c/asn_codecs.h:59:9`!; |
| 338 | |
| 339 | buf = st->bufcxx . . $ ANY#buf.; |
| 340 | size = st->sizecxx . . $ ANY#size.; |
| 341 | do { |
| 342 | int need_eom = 0; |
| 343 | ssize_tcxx . . $ ssize_t# may_save = uper_put_lengthcxx . . $ uper_put_length(8430978b5e735d38).(po, size, &need_eom); |
| 344 | if(may_save < 0) ASN__ENCODE_FAILEDcxx . . $ `lib/s1ap/asn1c/asn_codecs.h:59:9`!; |
| 345 | |
| 346 | ret = per_put_many_bitscxx . . $ `lib/s1ap/asn1c/per_support.h:73:9`!(po, buf, may_save * 8); |
| 347 | if(ret) ASN__ENCODE_FAILEDcxx . . $ `lib/s1ap/asn1c/asn_codecs.h:59:9`!; |
| 348 | |
| 349 | buf += may_save; |
| 350 | size -= may_save; |
| 351 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(!(may_save & 0x07) || !size); |
| 352 | if(need_eom && uper_put_lengthcxx . . $ uper_put_length(8430978b5e735d38).(po, 0, 0)) |
| 353 | ASN__ENCODE_FAILEDcxx . . $ `lib/s1ap/asn1c/asn_codecs.h:59:9`!; /* End of Message length */ |
| 354 | } while(size); |
| 355 | |
| 356 | ASN__ENCODED_OKcxx . . $ `lib/s1ap/asn1c/asn_codecs.h:67:9`!(er); |
| 357 | } |
| 358 | |
| 359 | asn_dec_rval_tcxx . . $ asn_dec_rval_t# |
| 360 | ANY_decode_apercxx . . $ ANY_decode_aper(e6a06374f784e2a6).(const asn_codec_ctx_tcxx . . $ asn_codec_ctx_t# *opt_codec_ctx, |
| 361 | const asn_TYPE_descriptor_tcxx . . $ asn_TYPE_descriptor_t# *td, |
| 362 | const asn_per_constraints_tcxx . . $ asn_per_constraints_t# *constraints, void **sptr, |
| 363 | asn_per_data_tcxx . . $ asn_per_data_t# *pd) { |
| 364 | const asn_OCTET_STRING_specifics_tcxx . . $ asn_OCTET_STRING_specifics_t# *specs = |
| 365 | td->specificscxx . . $ asn_TYPE_descriptor_s#specifics. ? (const asn_OCTET_STRING_specifics_tcxx . . $ asn_OCTET_STRING_specifics_t# *)td->specificscxx . . $ asn_TYPE_descriptor_s#specifics. |
| 366 | : &asn_SPC_ANY_specscxx . . $ asn_SPC_ANY_specs.; |
| 367 | size_t consumed_myself = 0; |
| 368 | int repeat; |
| 369 | ANY_tcxx . . $ ANY_t# *st = (ANY_tcxx . . $ ANY_t# *)*sptr; |
| 370 | |
| 371 | (void)opt_codec_ctx; |
| 372 | (void)constraints; |
| 373 | |
| 374 | /* |
| 375 | * Allocate the structure. |
| 376 | */ |
| 377 | if(!st) { |
| 378 | st = (ANY_tcxx . . $ ANY_t# *)(*sptr = CALLOCcxx . . $ `lib/s1ap/asn1c/asn_internal.h:33:9`!(1, specs->struct_size)); |
| 379 | if(!st) RETURNcxx . . $ `lib/s1ap/asn1c/ANY.c:51:9`!(RC_FAIL); |
| 380 | } |
| 381 | |
| 382 | ASN_DEBUGcxx . . $ `lib/s1ap/asn1c/asn_internal.h:76:9`!("APER Decoding ANY type"); |
| 383 | |
| 384 | st->sizecxx . . $ ANY#size. = 0; |
| 385 | do { |
| 386 | ssize_tcxx . . $ ssize_t# raw_len; |
| 387 | ssize_tcxx . . $ ssize_t# len_bytes; |
| 388 | ssize_tcxx . . $ ssize_t# len_bits; |
| 389 | void *p; |
| 390 | int ret; |
| 391 | |
| 392 | /* Get the PER length */ |
| 393 | raw_len = aper_get_lengthcxx . . $ aper_get_length(f83e194f1de67789).(pd, -1, 0, &repeat); |
| 394 | if(raw_len < 0) RETURNcxx . . $ `lib/s1ap/asn1c/ANY.c:51:9`!(RC_WMORE); |
| 395 | if(raw_len == 0 && st->bufcxx . . $ ANY#buf.) break; |
| 396 | |
| 397 | ASN_DEBUGcxx . . $ `lib/s1ap/asn1c/asn_internal.h:76:9`!("Got PER length len %" ASN_PRI_SIZE ", %s (%s)", raw_len, |
| 398 | repeat ? "repeat" : "once", td->name); |
| 399 | len_bytes = raw_len; |
| 400 | len_bits = len_bytes * 8; |
| 401 | |
| 402 | p = REALLOCcxx . . $ `lib/s1ap/asn1c/asn_internal.h:35:9`!(st->buf, st->size + len_bytes + 1); |
| 403 | if(!p) RETURNcxx . . $ `lib/s1ap/asn1c/ANY.c:51:9`!(RC_FAIL); |
| 404 | st->bufcxx . . $ ANY#buf. = (uint8_tcxx . . $ uint8_t# *)p; |
| 405 | |
| 406 | ret = per_get_many_bitscxx . . $ `lib/s1ap/asn1c/per_support.h:41:9`!(pd, &st->buf[st->size], 0, len_bits); |
| 407 | if(ret < 0) RETURNcxx . . $ `lib/s1ap/asn1c/ANY.c:51:9`!(RC_WMORE); |
| 408 | consumed_myself += len_bits; |
| 409 | st->sizecxx . . $ ANY#size. += len_bytes; |
| 410 | } while(repeat); |
| 411 | st->bufcxx . . $ ANY#buf.[st->sizecxx . . $ ANY#size.] = 0; /* nul-terminate */ |
| 412 | |
| 413 | RETURNcxx . . $ `lib/s1ap/asn1c/ANY.c:51:9`!(RC_OK); |
| 414 | } |
| 415 | |
| 416 | asn_enc_rval_tcxx . . $ asn_enc_rval_t# |
| 417 | ANY_encode_apercxx . . $ ANY_encode_aper(1e553b888c3dcd43).(const asn_TYPE_descriptor_tcxx . . $ asn_TYPE_descriptor_t# *td, |
| 418 | const asn_per_constraints_tcxx . . $ asn_per_constraints_t# *constraints, const void *sptr, |
| 419 | asn_per_outp_tcxx . . $ asn_per_outp_t# *po) { |
| 420 | const ANY_tcxx . . $ ANY_t# *st = (const ANY_tcxx . . $ ANY_t# *)sptr; |
| 421 | asn_enc_rval_tcxx . . $ asn_enc_rval_t# er = {0, 0, 0}; |
| 422 | const uint8_tcxx . . $ uint8_t# *buf; |
| 423 | size_t size; |
| 424 | int ret; |
| 425 | |
| 426 | (void)constraints; |
| 427 | |
| 428 | if(!st || (!st->bufcxx . . $ ANY#buf. && st->sizecxx . . $ ANY#size.)) ASN__ENCODE_FAILEDcxx . . $ `lib/s1ap/asn1c/asn_codecs.h:59:9`!; |
| 429 | |
| 430 | buf = st->bufcxx . . $ ANY#buf.; |
| 431 | size = st->sizecxx . . $ ANY#size.; |
| 432 | do { |
| 433 | int need_eom = 0; |
| 434 | ssize_tcxx . . $ ssize_t# may_save = uper_put_lengthcxx . . $ uper_put_length(8430978b5e735d38).(po, size, &need_eom); |
| 435 | if(may_save < 0) ASN__ENCODE_FAILEDcxx . . $ `lib/s1ap/asn1c/asn_codecs.h:59:9`!; |
| 436 | |
| 437 | ret = per_put_many_bitscxx . . $ `lib/s1ap/asn1c/per_support.h:73:9`!(po, buf, may_save * 8); |
| 438 | if(ret) ASN__ENCODE_FAILEDcxx . . $ `lib/s1ap/asn1c/asn_codecs.h:59:9`!; |
| 439 | |
| 440 | buf += may_save; |
| 441 | size -= may_save; |
| 442 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(!(may_save & 0x07) || !size); |
| 443 | if(need_eom && uper_put_lengthcxx . . $ uper_put_length(8430978b5e735d38).(po, 0, 0)) |
| 444 | ASN__ENCODE_FAILEDcxx . . $ `lib/s1ap/asn1c/asn_codecs.h:59:9`!; /* End of Message length */ |
| 445 | } while(size); |
| 446 | |
| 447 | ASN__ENCODED_OKcxx . . $ `lib/s1ap/asn1c/asn_codecs.h:67:9`!(er); |
| 448 | } |
| 449 | #endif /* ASN_DISABLE_PER_SUPPORT */ |
| 450 |