uper_encoder.h
Go to the documentation of this file.
1 /*-
2  * Copyright (c) 2006-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
3  * Redistribution and modifications are permitted subject to BSD license.
4  */
5 #ifndef _UPER_ENCODER_H_
6 #define _UPER_ENCODER_H_
7 
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 struct asn_TYPE_descriptor_s; /* Forward declaration */
16 
17 /*
18  * Unaligned PER encoder of any ASN.1 type. May be invoked by the application.
19  * WARNING: This function returns the number of encoded bits in the .encoded
20  * field of the return value. Use the following formula to convert to bytes:
21  * bytes = ((.encoded + 7) / 8)
22  */
24  const struct asn_TYPE_descriptor_s *type_descriptor,
25  const asn_per_constraints_t *constraints,
26  const void *struct_ptr, /* Structure to be encoded */
27  asn_app_consume_bytes_f *consume_bytes_cb, /* Data collector */
28  void *app_key /* Arbitrary callback argument */
29 );
30 
31 /*
32  * A variant of uper_encode() which encodes data into the existing buffer
33  * WARNING: This function returns the number of encoded bits in the .encoded
34  * field of the return value.
35  */
37  const struct asn_TYPE_descriptor_s *type_descriptor,
38  const asn_per_constraints_t *constraints,
39  const void *struct_ptr, /* Structure to be encoded */
40  void *buffer, /* Pre-allocated buffer */
41  size_t buffer_size /* Initial buffer size (max) */
42 );
43 
44 /*
45  * A variant of uper_encode_to_buffer() which allocates buffer itself.
46  * Returns the number of bytes in the buffer or -1 in case of failure.
47  * WARNING: This function produces a "Production of the complete encoding",
48  * with length of at least one octet. Contrast this to precise bit-packing
49  * encoding of uper_encode() and uper_encode_to_buffer().
50  */
52  const struct asn_TYPE_descriptor_s *type_descriptor,
53  const asn_per_constraints_t *constraints,
54  const void *struct_ptr, /* Structure to be encoded */
55  void **buffer_r /* Buffer allocated and returned */
56 );
57 
58 #ifdef __cplusplus
59 }
60 #endif
61 
62 #endif /* _UPER_ENCODER_H_ */
asn_enc_rval_s
Definition: asn_codecs.h:41
uper_support.h
asn_TYPE_descriptor_s
Definition: constr_TYPE.h:224
uper_encode_to_new_buffer
ssize_t uper_encode_to_new_buffer(const struct asn_TYPE_descriptor_s *type_descriptor, const asn_per_constraints_t *constraints, const void *struct_ptr, void **buffer_r)
uper_encode
asn_enc_rval_t uper_encode(const struct asn_TYPE_descriptor_s *type_descriptor, const asn_per_constraints_t *constraints, const void *struct_ptr, asn_app_consume_bytes_f *consume_bytes_cb, void *app_key)
asn_app_consume_bytes_f
int() asn_app_consume_bytes_f(const void *buffer, size_t size, void *application_specific_key)
Definition: asn_application.h:124
asn_application.h
asn_per_constraints_s
Definition: per_support.h:30
uper_encode_to_buffer
asn_enc_rval_t uper_encode_to_buffer(const struct asn_TYPE_descriptor_s *type_descriptor, const asn_per_constraints_t *constraints, const void *struct_ptr, void *buffer, size_t buffer_size)


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