e4040160b2f534f5fffdbdc0081b40d6aebe550e
[ric-plt/resource-status-manager.git] / RSM / asn1codec / e2ap_engine / per_decoder.h
1
2 /*-
3  * Copyright (c) 2005-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
4  * Redistribution and modifications are permitted subject to BSD license.
5  */
6 #ifndef _PER_DECODER_H_
7 #define _PER_DECODER_H_
8
9 #include <asn_application.h>
10 #include <per_support.h>
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16 struct asn_TYPE_descriptor_s;   /* Forward declaration */
17
18 /*
19  * Unaligned PER decoder of a "complete encoding" as per X.691 (08/2015) #11.1.
20  * On success, this call always returns (.consumed >= 1), as per #11.1.3.
21  */
22 asn_dec_rval_t uper_decode_complete(
23     const struct asn_codec_ctx_s *opt_codec_ctx,
24     const struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */
25     void **struct_ptr,  /* Pointer to a target structure's pointer */
26     const void *buffer, /* Data to be decoded */
27     size_t size         /* Size of data buffer */
28 );
29
30 /*
31  * Unaligned PER decoder of any ASN.1 type. May be invoked by the application.
32  * WARNING: This call returns the number of BITS read from the stream. Beware.
33  */
34 asn_dec_rval_t uper_decode(
35     const struct asn_codec_ctx_s *opt_codec_ctx,
36     const struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */
37     void **struct_ptr,  /* Pointer to a target structure's pointer */
38     const void *buffer, /* Data to be decoded */
39     size_t size,        /* Size of the input data buffer, in bytes */
40     int skip_bits,      /* Number of unused leading bits, 0..7 */
41     int unused_bits     /* Number of unused tailing bits, 0..7 */
42 );
43
44 /*
45  * Aligned PER decoder of a "complete encoding" as per X.691#10.1.
46  * On success, this call always returns (.consumed >= 1), in BITS, as per X.691#10.1.3.
47  */
48 asn_dec_rval_t aper_decode_complete(
49        const struct asn_codec_ctx_s *opt_codec_ctx,
50        const struct asn_TYPE_descriptor_s *type_descriptor,     /* Type to decode */
51        void **struct_ptr,       /* Pointer to a target structure's pointer */
52        const void *buffer,      /* Data to be decoded */
53        size_t size              /* Size of data buffer */
54                                                                         );
55
56 /*
57  * Aligned PER decoder of any ASN.1 type. May be invoked by the application.
58  * WARNING: This call returns the number of BITS read from the stream. Beware.
59  */
60 asn_dec_rval_t aper_decode(
61       const struct asn_codec_ctx_s *opt_codec_ctx,
62       const struct asn_TYPE_descriptor_s *type_descriptor,      /* Type to decode */
63       void **struct_ptr,        /* Pointer to a target structure's pointer */
64       const void *buffer,       /* Data to be decoded */
65       size_t size,              /* Size of data buffer */
66       int skip_bits,            /* Number of unused leading bits, 0..7 */
67       int unused_bits           /* Number of unused tailing bits, 0..7 */
68       );
69
70 /*
71  * Type of the type-specific PER decoder function.
72  */
73 typedef asn_dec_rval_t(per_type_decoder_f)(
74     const asn_codec_ctx_t *opt_codec_ctx,
75     const struct asn_TYPE_descriptor_s *type_descriptor,
76     const asn_per_constraints_t *constraints, void **struct_ptr,
77     asn_per_data_t *per_data);
78
79 #ifdef __cplusplus
80 }
81 #endif
82
83 #endif  /* _PER_DECODER_H_ */