2 * Copyright (c) 2005-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
\r
3 * Redistribution and modifications are permitted subject to BSD license.
\r
5 #ifndef _PER_DECODER_H_
\r
6 #define _PER_DECODER_H_
\r
8 #include <asn_application.h>
\r
9 #include <per_support.h>
\r
15 struct asn_TYPE_descriptor_s; /* Forward declaration */
\r
18 * Unaligned PER decoder of a "complete encoding" as per X.691 (08/2015) #11.1.
\r
19 * On success, this call always returns (.consumed >= 1), as per #11.1.3.
\r
21 asn_dec_rval_t uper_decode_complete(
\r
22 const struct asn_codec_ctx_s *opt_codec_ctx,
\r
23 const struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */
\r
24 void **struct_ptr, /* Pointer to a target structure's pointer */
\r
25 const void *buffer, /* Data to be decoded */
\r
26 size_t size /* Size of data buffer */
\r
30 * Unaligned PER decoder of any ASN.1 type. May be invoked by the application.
\r
31 * WARNING: This call returns the number of BITS read from the stream. Beware.
\r
33 asn_dec_rval_t uper_decode(
\r
34 const struct asn_codec_ctx_s *opt_codec_ctx,
\r
35 const struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */
\r
36 void **struct_ptr, /* Pointer to a target structure's pointer */
\r
37 const void *buffer, /* Data to be decoded */
\r
38 size_t size, /* Size of the input data buffer, in bytes */
\r
39 int skip_bits, /* Number of unused leading bits, 0..7 */
\r
40 int unused_bits /* Number of unused tailing bits, 0..7 */
\r
44 * Aligned PER decoder of a "complete encoding" as per X.691#10.1.
\r
45 * On success, this call always returns (.consumed >= 1), in BITS, as per X.691#10.1.3.
\r
47 asn_dec_rval_t aper_decode_complete(
\r
48 const struct asn_codec_ctx_s *opt_codec_ctx,
\r
49 const struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */
\r
50 void **struct_ptr, /* Pointer to a target structure's pointer */
\r
51 const void *buffer, /* Data to be decoded */
\r
52 size_t size /* Size of data buffer */
\r
56 * Aligned PER decoder of any ASN.1 type. May be invoked by the application.
\r
57 * WARNING: This call returns the number of BITS read from the stream. Beware.
\r
59 asn_dec_rval_t aper_decode(
\r
60 const struct asn_codec_ctx_s *opt_codec_ctx,
\r
61 const struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */
\r
62 void **struct_ptr, /* Pointer to a target structure's pointer */
\r
63 const void *buffer, /* Data to be decoded */
\r
64 size_t size, /* Size of data buffer */
\r
65 int skip_bits, /* Number of unused leading bits, 0..7 */
\r
66 int unused_bits /* Number of unused tailing bits, 0..7 */
\r
70 * Type of the type-specific PER decoder function.
\r
72 typedef asn_dec_rval_t(per_type_decoder_f)(
\r
73 const asn_codec_ctx_t *opt_codec_ctx,
\r
74 const struct asn_TYPE_descriptor_s *type_descriptor,
\r
75 const asn_per_constraints_t *constraints, void **struct_ptr,
\r
76 asn_per_data_t *per_data);
\r
82 #endif /* _PER_DECODER_H_ */
\r