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