3 * Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
4 * Redistribution and modifications are permitted subject to BSD license.
9 #include <OCTET_STRING.h> /* Implemented via OCTET STRING type */
16 uint8_t *buf; /* BER-encoded ANY contents */
17 int size; /* Size of the above buffer */
19 asn_struct_ctx_t _asn_ctx; /* Parsing across buffer boundaries */
22 extern asn_TYPE_descriptor_t asn_DEF_ANY;
23 extern asn_TYPE_operation_t asn_OP_ANY;
24 extern asn_OCTET_STRING_specifics_t asn_SPC_ANY_specs;
26 asn_struct_free_f ANY_free;
27 asn_struct_print_f ANY_print;
28 ber_type_decoder_f ANY_decode_ber;
29 der_type_encoder_f ANY_encode_der;
30 xer_type_encoder_f ANY_encode_xer;
31 per_type_decoder_f ANY_decode_uper;
32 per_type_encoder_f ANY_encode_uper;
33 per_type_decoder_f ANY_decode_aper;
34 per_type_encoder_f ANY_encode_aper;
36 #define ANY_free OCTET_STRING_free
37 #define ANY_print OCTET_STRING_print
38 #define ANY_compare OCTET_STRING_compare
39 #define ANY_constraint asn_generic_no_constraint
40 #define ANY_decode_ber OCTET_STRING_decode_ber
41 #define ANY_encode_der OCTET_STRING_encode_der
42 #define ANY_decode_xer OCTET_STRING_decode_xer_hex
44 /******************************
45 * Handy conversion routines. *
46 ******************************/
48 /* Convert another ASN.1 type into the ANY. This implies DER encoding. */
49 int ANY_fromType(ANY_t *, asn_TYPE_descriptor_t *td, void *struct_ptr);
50 int ANY_fromType_aper(ANY_t *st, asn_TYPE_descriptor_t *td, void *sptr);
51 ANY_t *ANY_new_fromType(asn_TYPE_descriptor_t *td, void *struct_ptr);
52 ANY_t *ANY_new_fromType_aper(asn_TYPE_descriptor_t *td, void *sptr);
54 /* Convert the contents of the ANY type into the specified type. */
55 int ANY_to_type(ANY_t *, asn_TYPE_descriptor_t *td, void **struct_ptr);
56 int ANY_to_type_aper(ANY_t *, asn_TYPE_descriptor_t *td, void **struct_ptr);
58 #define ANY_fromBuf(s, buf, size) OCTET_STRING_fromBuf((s), (buf), (size))
59 #define ANY_new_fromBuf(buf, size) OCTET_STRING_new_fromBuf( \
60 &asn_DEF_ANY, (buf), (size))
66 #endif /* ASN_TYPE_ANY_H */