Change version after creation of r2 branch
[ric-plt/resource-status-manager.git] / RSM / asn1codec / e2ap_engine / ANY.h
1
2 /*-
3  * Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
4  * Redistribution and modifications are permitted subject to BSD license.
5  */
6 #ifndef ASN_TYPE_ANY_H
7 #define ASN_TYPE_ANY_H
8
9 #include <OCTET_STRING.h>       /* Implemented via OCTET STRING type */
10
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14
15 typedef struct ANY {
16         uint8_t *buf;   /* BER-encoded ANY contents */
17         int size;       /* Size of the above buffer */
18
19         asn_struct_ctx_t _asn_ctx;      /* Parsing across buffer boundaries */
20 } ANY_t;
21
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;
25
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;
35
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
43
44 /******************************
45  * Handy conversion routines. *
46  ******************************/
47
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);
53
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);
57
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))
61
62 #ifdef __cplusplus
63 }
64 #endif
65
66 #endif  /* ASN_TYPE_ANY_H */