31658a20cb34a2455014c05fe57ed53f50e6c00f
[ric-app/kpimon.git] / asn1c_defs / all-defs / ANY.h
1 /*-\r
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
4  */\r
5 #ifndef ASN_TYPE_ANY_H\r
6 #define ASN_TYPE_ANY_H\r
7 \r
8 #include <OCTET_STRING.h>       /* Implemented via OCTET STRING type */\r
9 \r
10 #ifdef __cplusplus\r
11 extern "C" {\r
12 #endif\r
13 \r
14 typedef struct ANY {\r
15         uint8_t *buf;   /* BER-encoded ANY contents */\r
16         int size;       /* Size of the above buffer */\r
17 \r
18         asn_struct_ctx_t _asn_ctx;      /* Parsing across buffer boundaries */\r
19 } ANY_t;\r
20 \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
24 \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
34 \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
42 \r
43 /******************************\r
44  * Handy conversion routines. *\r
45  ******************************/\r
46 \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
52 \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
56 \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
60 \r
61 #ifdef __cplusplus\r
62 }\r
63 #endif\r
64 \r
65 #endif  /* ASN_TYPE_ANY_H */\r