2 * Copyright (c) 2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
3 * Redistribution and modifications are permitted subject to BSD license.
8 #include <asn_application.h>
14 struct asn_TYPE_descriptor_s; /* Forward declaration */
17 * The Octet Encoding Rules (OER, X.696 08/2015) encoder for any type.
18 * This function may be invoked directly by the application.
19 * Produces CANONICAL-OER output compatible with CANONICAL-OER
20 * and BASIC-OER decoders.
22 asn_enc_rval_t oer_encode(const struct asn_TYPE_descriptor_s *type_descriptor,
23 const void *struct_ptr, /* Structure to be encoded */
24 asn_app_consume_bytes_f *consume_bytes_cb,
25 void *app_key /* Arbitrary callback argument */
28 /* A variant of oer_encode() which encodes data into the pre-allocated buffer */
29 asn_enc_rval_t oer_encode_to_buffer(
30 const struct asn_TYPE_descriptor_s *type_descriptor,
31 const asn_oer_constraints_t *constraints,
32 const void *struct_ptr, /* Structure to be encoded */
33 void *buffer, /* Pre-allocated buffer */
34 size_t buffer_size /* Initial buffer size (maximum) */
38 * Type of the generic OER encoder.
40 typedef asn_enc_rval_t(oer_type_encoder_f)(
41 const struct asn_TYPE_descriptor_s *type_descriptor,
42 const asn_oer_constraints_t *constraints,
43 const void *struct_ptr, /* Structure to be encoded */
44 asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */
45 void *app_key /* Arbitrary callback argument */
49 * Write out the Open Type (X.696 (08/2015), #30).
51 * -1: Fatal error encoding the type.
52 * >0: Number of bytes serialized.
54 ssize_t oer_open_type_put(const struct asn_TYPE_descriptor_s *td,
55 const asn_oer_constraints_t *constraints,
56 const void *struct_ptr,
57 asn_app_consume_bytes_f *consume_bytes_cb,
62 * Length-prefixed buffer encoding for primitive types.
64 oer_type_encoder_f oer_encode_primitive;
70 #endif /* OER_ENCODER_H */