blob: 5541bae86ab7ee3e875c126a9413f38d00f83194 [file] [log] [blame]
Harald Welte92c45f32010-06-12 18:59:38 +02001/*-
Harald Welteec0e2172010-07-20 00:03:44 +02002 * Copyright (c) 2005, 2007 Lev Walkin <vlm@lionet.info>. All rights reserved.
Harald Welte92c45f32010-06-12 18:59:38 +02003 * 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
12extern "C" {
13#endif
14
15struct asn_TYPE_descriptor_s; /* Forward declaration */
16
17/*
Harald Welteec0e2172010-07-20 00:03:44 +020018 * Unaligned PER decoder of a "complete encoding" as per X.691#10.1.
19 * On success, this call always returns (.consumed >= 1), as per X.691#10.1.3.
20 */
21asn_dec_rval_t uper_decode_complete(struct asn_codec_ctx_s *opt_codec_ctx,
22 struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */
23 void **struct_ptr, /* Pointer to a target structure's pointer */
24 const void *buffer, /* Data to be decoded */
25 size_t size /* Size of data buffer */
26 );
27
28/*
Harald Welte92c45f32010-06-12 18:59:38 +020029 * Unaligned PER decoder of any ASN.1 type. May be invoked by the application.
Harald Welteec0e2172010-07-20 00:03:44 +020030 * WARNING: This call returns the number of BITS read from the stream. Beware.
Harald Welte92c45f32010-06-12 18:59:38 +020031 */
32asn_dec_rval_t uper_decode(struct asn_codec_ctx_s *opt_codec_ctx,
33 struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */
34 void **struct_ptr, /* Pointer to a target structure's pointer */
35 const void *buffer, /* Data to be decoded */
36 size_t size, /* Size of data buffer */
37 int skip_bits, /* Number of unused leading bits, 0..7 */
38 int unused_bits /* Number of unused tailing bits, 0..7 */
39 );
40
Harald Welte41b85d52015-08-31 08:56:53 +020041/*
42 * Aligned PER decoder of a "complete encoding" as per X.691#10.1.
43 * On success, this call always returns (.consumed >= 1), as per X.691#10.1.3.
44 */
45asn_dec_rval_t aper_decode_complete(struct asn_codec_ctx_s *opt_codec_ctx,
46 struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */
47 void **struct_ptr, /* Pointer to a target structure's pointer */
48 const void *buffer, /* Data to be decoded */
49 size_t size /* Size of data buffer */
50 );
Harald Welte92c45f32010-06-12 18:59:38 +020051
52/*
Harald Welte41b85d52015-08-31 08:56:53 +020053 * Aligned PER decoder of any ASN.1 type. May be invoked by the application.
54 * WARNING: This call returns the number of BITS read from the stream. Beware.
55 */
56asn_dec_rval_t aper_decode(struct asn_codec_ctx_s *opt_codec_ctx,
57 struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */
58 void **struct_ptr, /* Pointer to a target structure's pointer */
59 const void *buffer, /* Data to be decoded */
60 size_t size, /* Size of data buffer */
61 int skip_bits, /* Number of unused leading bits, 0..7 */
62 int unused_bits /* Number of unused tailing bits, 0..7 */
63 );
64/*
Harald Welte92c45f32010-06-12 18:59:38 +020065 * Type of the type-specific PER decoder function.
66 */
67typedef asn_dec_rval_t (per_type_decoder_f)(asn_codec_ctx_t *opt_codec_ctx,
68 struct asn_TYPE_descriptor_s *type_descriptor,
69 asn_per_constraints_t *constraints,
70 void **struct_ptr,
71 asn_per_data_t *per_data
72 );
73
74#ifdef __cplusplus
75}
76#endif
77
78#endif /* _PER_DECODER_H_ */