blob: 8397a545fb9b2e950942aae892a32385730989e7 [file] [log] [blame]
vlm337167e2005-11-26 11:25:14 +00001/*-
vlma472cf22007-06-26 08:24:50 +00002 * Copyright (c) 2005, 2007 Lev Walkin <vlm@lionet.info>. All rights reserved.
vlm337167e2005-11-26 11:25:14 +00003 * 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
vlm4d2ca122005-12-07 05:46:03 +000015struct asn_TYPE_descriptor_s; /* Forward declaration */
16
17/*
vlma472cf22007-06-26 08:24:50 +000018 * 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/*
vlm4d2ca122005-12-07 05:46:03 +000029 * Unaligned PER decoder of any ASN.1 type. May be invoked by the application.
vlma472cf22007-06-26 08:24:50 +000030 * WARNING: This call returns the number of BITS read from the stream. Beware.
vlm4d2ca122005-12-07 05:46:03 +000031 */
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 */
vlme7e9bd92006-09-17 11:02:53 +000036 size_t size, /* Size of data buffer */
vlm619448e2006-09-18 20:05:55 +000037 int skip_bits, /* Number of unused leading bits, 0..7 */
38 int unused_bits /* Number of unused tailing bits, 0..7 */
vlm4d2ca122005-12-07 05:46:03 +000039 );
40
vlm337167e2005-11-26 11:25:14 +000041
42/*
vlm337167e2005-11-26 11:25:14 +000043 * Type of the type-specific PER decoder function.
44 */
45typedef asn_dec_rval_t (per_type_decoder_f)(asn_codec_ctx_t *opt_codec_ctx,
46 struct asn_TYPE_descriptor_s *type_descriptor,
47 asn_per_constraints_t *constraints,
48 void **struct_ptr,
49 asn_per_data_t *per_data
50 );
51
52#ifdef __cplusplus
53}
54#endif
55
56#endif /* _PER_DECODER_H_ */