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