SIM-115: update simulator to use latest E2SM KPM version 3
[sim/e2-interface.git] / e2sim / asn1c / aper_support.h
1 /*
2  * Copyright (c) 2005-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
3  * Redistribution and modifications are permitted subject to BSD license.
4  */
5 #ifndef _APER_SUPPORT_H_
6 #define _APER_SUPPORT_H_
7
8 #include <asn_system.h>         /* Platform-specific types */
9 #include <per_support.h>
10
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14
15 /*
16  * X.691 (08/2015) #11.9 "General rules for encoding a length determinant"
17  * Get the length "n" from the Aligned PER stream.
18  */
19 ssize_t aper_get_length(asn_per_data_t *pd, ssize_t lb, ssize_t ub,
20                         int effective_bound_bits, int *repeat);
21
22 /*
23  * Get the normally small length "n".
24  */
25 ssize_t aper_get_nslength(asn_per_data_t *pd);
26
27 /*
28  * Get the normally small non-negative whole number.
29  */
30 ssize_t aper_get_nsnnwn(asn_per_data_t *pd, int range);
31
32 /*
33  * X.691 (08/2015) #11.9 "General rules for encoding a length determinant"
34  * Put the length "n" to the Aligned PER stream.
35  * If (opt_need_eom) is given, it will be set to 1 if final 0-n is needed.
36  * In that case, invoke aper_put_length(po, -1, -1, 0, NULL) after encoding the
37  * last block.
38  * This function returns the number of units which may be flushed
39  * in the next units saving iteration.
40  */
41 ssize_t aper_put_length(asn_per_outp_t *po, ssize_t lb, ssize_t ub, size_t n,
42                         int *opt_need_eom);
43
44 /* Align the current bit position to octet bundary */
45 int aper_put_align(asn_per_outp_t *po);
46 int32_t aper_get_align(asn_per_data_t *pd);
47
48 /*
49  * Put the normally small length "n" to the Unaligned PER stream.
50  * Returns 0 or -1.
51  */
52 int aper_put_nslength(asn_per_outp_t *po, size_t length);
53
54 /*
55  * Put the normally small non-negative whole number.
56  */
57 int aper_put_nsnnwn(asn_per_outp_t *po, int range, int number);
58
59 #ifdef __cplusplus
60 }
61 #endif
62
63 #endif  /* _APER_SUPPORT_H_ */