uper_support.h
Go to the documentation of this file.
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 _UPER_SUPPORT_H_
6 #define _UPER_SUPPORT_H_
7 
8 #include <etsi_its_vam_ts_coding/asn_system.h> /* Platform-specific types */
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 Unaligned PER stream.
18  */
19 ssize_t uper_get_length(asn_per_data_t *pd, int effective_bound_bits,
20  size_t lower_bound, int *repeat);
21 
22 /*
23  * Get the normally small length "n".
24  */
26 
27 /*
28  * Get the normally small non-negative whole number.
29  */
30 ssize_t uper_get_nsnnwn(asn_per_data_t *pd);
31 
32 /* X.691-2008/11, #11.5.6 */
33 int uper_get_constrained_whole_number(asn_per_data_t *pd, uintmax_t *v, int nbits);
34 
35 /*
36  * Rebase the given value as an offset into the range specified by the
37  * lower bound (lb) and upper bound (ub).
38  * RETURN VALUES:
39  * -1: Conversion failed due to range problems.
40  * 0: Conversion was successful.
41  */
42 int per_long_range_rebase(long, intmax_t lb, intmax_t ub, unsigned long *output);
43 int per_imax_range_rebase(intmax_t v, intmax_t lb, intmax_t ub, uintmax_t *output);
44 /* The inverse operation: restores the value by the offset and its bounds. */
45 int per_long_range_unrebase(unsigned long inp, intmax_t lb, intmax_t ub, long *outp);
46 int per_imax_range_unrebase(uintmax_t inp, intmax_t lb, intmax_t ub, intmax_t *outp);
47 
48 /* X.691-2008/11, #11.5 */
49 int uper_put_constrained_whole_number_u(asn_per_outp_t *po, uintmax_t v, int nbits);
50 
51 /*
52  * X.691 (08/2015) #11.9 "General rules for encoding a length determinant"
53  * Put the length "whole_length" to the Unaligned PER stream.
54  * If (opt_need_eom) is given, it will be set to 1 if final 0-length is needed.
55  * In that case, invoke uper_put_length(po, 0, 0) after encoding the last block.
56  * This function returns the number of units which may be flushed
57  * in the next units saving iteration.
58  */
59 ssize_t uper_put_length(asn_per_outp_t *po, size_t whole_length,
60  int *opt_need_eom);
61 
62 /*
63  * Put the normally small length "n" to the Unaligned PER stream.
64  * Returns 0 or -1.
65  */
66 int uper_put_nslength(asn_per_outp_t *po, size_t length);
67 
68 /*
69  * Put the normally small non-negative whole number.
70  */
71 int uper_put_nsnnwn(asn_per_outp_t *po, int n);
72 
73 #ifdef __cplusplus
74 }
75 #endif
76 
77 #endif /* _UPER_SUPPORT_H_ */
asn_bit_outp_s
Definition: asn_bit_data.h:56
per_support.h
per_long_range_unrebase
int per_long_range_unrebase(unsigned long inp, intmax_t lb, intmax_t ub, long *outp)
Definition: uper_support.c:306
uper_put_nsnnwn
int uper_put_nsnnwn(asn_per_outp_t *po, int n)
Definition: uper_support.c:101
per_imax_range_rebase
int per_imax_range_rebase(intmax_t v, intmax_t lb, intmax_t ub, uintmax_t *output)
Definition: uper_support.c:235
uper_put_length
ssize_t uper_put_length(asn_per_outp_t *po, size_t whole_length, int *opt_need_eom)
Definition: uper_support.c:168
uper_get_constrained_whole_number
int uper_get_constrained_whole_number(asn_per_data_t *pd, uintmax_t *v, int nbits)
Definition: uper_support.c:124
asn_bit_data_s
Definition: asn_bit_data.h:17
per_imax_range_unrebase
int per_imax_range_unrebase(uintmax_t inp, intmax_t lb, intmax_t ub, intmax_t *outp)
Definition: uper_support.c:280
per_long_range_rebase
int per_long_range_rebase(long, intmax_t lb, intmax_t ub, unsigned long *output)
Definition: uper_support.c:272
asn_system.h
uper_get_nslength
ssize_t uper_get_nslength(asn_per_data_t *pd)
Definition: uper_support.c:52
uper_put_constrained_whole_number_u
int uper_put_constrained_whole_number_u(asn_per_outp_t *po, uintmax_t v, int nbits)
Definition: uper_support.c:151
uper_get_length
ssize_t uper_get_length(asn_per_data_t *pd, int effective_bound_bits, size_t lower_bound, int *repeat)
Definition: uper_support.c:14
uper_get_nsnnwn
ssize_t uper_get_nsnnwn(asn_per_data_t *pd)
Definition: uper_support.c:75
uper_put_nslength
int uper_put_nslength(asn_per_outp_t *po, size_t length)
Definition: uper_support.c:201


etsi_its_vam_ts_coding
Author(s): Jean-Pierre Busch , Guido Küppers , Lennart Reiher
autogenerated on Sun May 18 2025 02:30:55