blob: 97eef147777e596fbda284e029de7a5049685bf0 [file] [log] [blame]
vlm337167e2005-11-26 11:25:14 +00001/*-
2 * Copyright (c) 2005 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
12extern "C" {
13#endif
14
vlm4d2ca122005-12-07 05:46:03 +000015struct asn_TYPE_descriptor_s; /* Forward declaration */
16
17/*
18 * Unaligned PER decoder of any ASN.1 type. May be invoked by the application.
19 */
20asn_dec_rval_t uper_decode(struct asn_codec_ctx_s *opt_codec_ctx,
21 struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */
22 void **struct_ptr, /* Pointer to a target structure's pointer */
23 const void *buffer, /* Data to be decoded */
24 size_t size /* Size of data buffer */
25 );
26
vlm337167e2005-11-26 11:25:14 +000027
28/*
29 * Pre-computed PER constraints.
30 */
31 enum asn_per_constraint_flags {
32 APC_UNCONSTRAINED = 0x0, /* No PER visible constraints */
33 APC_SEMI_CONSTRAINED = 0x1, /* Constrained at "lb" */
34 APC_CONSTRAINED = 0x2, /* Fully constrained */
35 APC_EXTENSIBLE = 0x4 /* May have extension */
36 };
37typedef struct asn_per_constraint_s {
vlm337167e2005-11-26 11:25:14 +000038 enum asn_per_constraint_flags flags;
39 int range_bits; /* Full number of bits in the range */
40 int effective_bits; /* Effective bits */
41 long lower_bound; /* "lb" value */
42 long upper_bound; /* "ub" value */
43} asn_per_constraint_t;
44typedef struct asn_per_constraints_s {
45 asn_per_constraint_t value;
46 asn_per_constraint_t size;
47} asn_per_constraints_t;
48
vlm337167e2005-11-26 11:25:14 +000049/*
50 * Type of the type-specific PER decoder function.
51 */
52typedef asn_dec_rval_t (per_type_decoder_f)(asn_codec_ctx_t *opt_codec_ctx,
53 struct asn_TYPE_descriptor_s *type_descriptor,
54 asn_per_constraints_t *constraints,
55 void **struct_ptr,
56 asn_per_data_t *per_data
57 );
58
59#ifdef __cplusplus
60}
61#endif
62
63#endif /* _PER_DECODER_H_ */