2 * Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
3 * Redistribution and modifications are permitted subject to BSD license.
8 #include <OCTET_STRING.h> /* Implemented via OCTET STRING type */
15 uint8_t *buf; /* BER-encoded ANY contents */
16 int size; /* Size of the above buffer */
18 asn_struct_ctx_t _asn_ctx; /* Parsing across buffer boundaries */
21 extern asn_TYPE_descriptor_t asn_DEF_ANY;
22 extern asn_TYPE_operation_t asn_OP_ANY;
23 extern asn_OCTET_STRING_specifics_t asn_SPC_ANY_specs;
25 #define ANY_free OCTET_STRING_free
27 #if !defined(ASN_DISABLE_PRINT_SUPPORT)
28 #define ANY_print OCTET_STRING_print
29 #endif /* !defined(ASN_DISABLE_PRINT_SUPPORT) */
31 #define ANY_compare OCTET_STRING_compare
33 #define ANY_constraint asn_generic_no_constraint
35 #if !defined(ASN_DISABLE_BER_SUPPORT)
36 #define ANY_decode_ber OCTET_STRING_decode_ber
37 #define ANY_encode_der OCTET_STRING_encode_der
38 #endif /* !defined(ASN_DISABLE_BER_SUPPORT) */
40 #if !defined(ASN_DISABLE_XER_SUPPORT)
41 #define ANY_decode_xer OCTET_STRING_decode_xer_hex
42 xer_type_encoder_f ANY_encode_xer;
43 #endif /* !defined(ASN_DISABLE_XER_SUPPORT) */
45 #if !defined(ASN_DISABLE_JER_SUPPORT)
46 jer_type_encoder_f ANY_encode_jer;
47 #endif /* !defined(ASN_DISABLE_JER_SUPPORT) */
49 #if !defined(ASN_DISABLE_UPER_SUPPORT)
50 per_type_decoder_f ANY_decode_uper;
51 per_type_encoder_f ANY_encode_uper;
52 #endif /* !defined(ASN_DISABLE_UPER_SUPPORT) */
53 #if !defined(ASN_DISABLE_APER_SUPPORT)
54 per_type_decoder_f ANY_decode_aper;
55 per_type_encoder_f ANY_encode_aper;
56 #endif /* !defined(ASN_DISABLE_APER_SUPPORT) */
58 /******************************
59 * Handy conversion routines. *
60 ******************************/
62 /* Convert another ASN.1 type into the ANY. This implies DER encoding. */
63 int ANY_fromType(ANY_t *, asn_TYPE_descriptor_t *td, void *struct_ptr);
64 ANY_t *ANY_new_fromType(asn_TYPE_descriptor_t *td, void *struct_ptr);
65 #if !defined(ASN_DISABLE_APER_SUPPORT)
66 int ANY_fromType_aper(ANY_t *st, asn_TYPE_descriptor_t *td, void *sptr);
67 ANY_t *ANY_new_fromType_aper(asn_TYPE_descriptor_t *td, void *sptr);
68 #endif /* !defined(ASN_DISABLE_APER_SUPPORT) */
70 /* Convert the contents of the ANY type into the specified type. */
71 int ANY_to_type(ANY_t *, asn_TYPE_descriptor_t *td, void **struct_ptr);
72 #if !defined(ASN_DISABLE_APER_SUPPORT)
73 int ANY_to_type_aper(ANY_t *, asn_TYPE_descriptor_t *td, void **struct_ptr);
74 #endif /* !defined(ASN_DISABLE_APER_SUPPORT) */
76 #define ANY_fromBuf(s, buf, size) OCTET_STRING_fromBuf((s), (buf), (size))
77 #define ANY_new_fromBuf(buf, size) OCTET_STRING_new_fromBuf( \
78 &asn_DEF_ANY, (buf), (size))
84 #endif /* ASN_TYPE_ANY_H */