Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 1 | /*- |
Lev Walkin | 08b30bb | 2007-06-26 08:24:50 +0000 | [diff] [blame] | 2 | * Copyright (c) 2005, 2007 Lev Walkin <vlm@lionet.info>. All rights reserved. |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 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 |
| 12 | extern "C" { |
| 13 | #endif |
| 14 | |
Lev Walkin | 1d9e8dd | 2005-12-07 05:46:03 +0000 | [diff] [blame] | 15 | struct asn_TYPE_descriptor_s; /* Forward declaration */ |
| 16 | |
| 17 | /* |
Lev Walkin | 6d46bc3 | 2017-09-12 21:34:00 -0700 | [diff] [blame] | 18 | * Unaligned PER decoder of a "complete encoding" as per X.691 (08/2015) #11.1. |
| 19 | * On success, this call always returns (.consumed >= 1), as per #11.1.3. |
Lev Walkin | 08b30bb | 2007-06-26 08:24:50 +0000 | [diff] [blame] | 20 | */ |
Lev Walkin | afbf2a9 | 2017-09-12 23:30:27 -0700 | [diff] [blame] | 21 | asn_dec_rval_t uper_decode_complete( |
| 22 | const struct asn_codec_ctx_s *opt_codec_ctx, |
| 23 | struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */ |
| 24 | void **struct_ptr, /* Pointer to a target structure's pointer */ |
| 25 | const void *buffer, /* Data to be decoded */ |
| 26 | size_t size /* Size of data buffer */ |
| 27 | ); |
Lev Walkin | 08b30bb | 2007-06-26 08:24:50 +0000 | [diff] [blame] | 28 | |
| 29 | /* |
Lev Walkin | 1d9e8dd | 2005-12-07 05:46:03 +0000 | [diff] [blame] | 30 | * Unaligned PER decoder of any ASN.1 type. May be invoked by the application. |
Lev Walkin | 08b30bb | 2007-06-26 08:24:50 +0000 | [diff] [blame] | 31 | * WARNING: This call returns the number of BITS read from the stream. Beware. |
Lev Walkin | 1d9e8dd | 2005-12-07 05:46:03 +0000 | [diff] [blame] | 32 | */ |
Lev Walkin | afbf2a9 | 2017-09-12 23:30:27 -0700 | [diff] [blame] | 33 | asn_dec_rval_t uper_decode( |
| 34 | const struct asn_codec_ctx_s *opt_codec_ctx, |
| 35 | struct asn_TYPE_descriptor_s *type_descriptor, /* Type to decode */ |
| 36 | void **struct_ptr, /* Pointer to a target structure's pointer */ |
| 37 | const void *buffer, /* Data to be decoded */ |
| 38 | size_t size, /* Size of data buffer */ |
| 39 | int skip_bits, /* Number of unused leading bits, 0..7 */ |
| 40 | int unused_bits /* Number of unused tailing bits, 0..7 */ |
| 41 | ); |
Lev Walkin | 1d9e8dd | 2005-12-07 05:46:03 +0000 | [diff] [blame] | 42 | |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 43 | |
| 44 | /* |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 45 | * Type of the type-specific PER decoder function. |
| 46 | */ |
Lev Walkin | afbf2a9 | 2017-09-12 23:30:27 -0700 | [diff] [blame] | 47 | typedef asn_dec_rval_t(per_type_decoder_f)( |
| 48 | const asn_codec_ctx_t *opt_codec_ctx, |
| 49 | struct asn_TYPE_descriptor_s *type_descriptor, |
| 50 | const asn_per_constraints_t *constraints, void **struct_ptr, |
| 51 | asn_per_data_t *per_data); |
Lev Walkin | 59b176e | 2005-11-26 11:25:14 +0000 | [diff] [blame] | 52 | |
| 53 | #ifdef __cplusplus |
| 54 | } |
| 55 | #endif |
| 56 | |
| 57 | #endif /* _PER_DECODER_H_ */ |