3 * Copyright (c) 2005-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
4 * Redistribution and modifications are permitted subject to BSD license.
6 #ifndef _PER_DECODER_H_
7 #define _PER_DECODER_H_
9 #include <asn_application.h>
10 #include <per_support.h>
16 struct asn_TYPE_descriptor_s; /* Forward declaration */
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.
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 */
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.
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 */
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.
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 */
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.
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 */
71 * Type of the type-specific PER decoder function.
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);
83 #endif /* _PER_DECODER_H_ */