blob: 67bc47edd053a47154f7411e46432d36e5afc512 [file] [log] [blame]
Lev Walkincc159472017-07-06 08:26:36 -07001/*
2 * Copyright (c) 2017 Lev Walkin <vlm@lionet.info>. All rights reserved.
3 * Redistribution and modifications are permitted subject to BSD license.
4 */
5#ifndef _OER_ENCODER_H_
6#define _OER_ENCODER_H_
7
8#include <asn_application.h>
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14struct asn_TYPE_descriptor_s; /* Forward declaration */
15
16/*
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 */
20asn_enc_rval_t oer_encode(struct asn_TYPE_descriptor_s *type_descriptor,
Lev Walkin4558ad02017-07-10 05:21:30 -070021 void *struct_ptr, /* Structure to be encoded */
22 asn_app_consume_bytes_f *consume_bytes_cb,
23 void *app_key /* Arbitrary callback argument */
24 );
Lev Walkincc159472017-07-06 08:26:36 -070025
26/* A variant of oer_encode() which encodes data into the pre-allocated buffer */
27asn_enc_rval_t oer_encode_to_buffer(
Lev Walkin4558ad02017-07-10 05:21:30 -070028 struct asn_TYPE_descriptor_s *type_descriptor,
29 void *struct_ptr, /* Structure to be encoded */
30 void *buffer, /* Pre-allocated buffer */
31 size_t buffer_size /* Initial buffer size (maximum) */
32 );
Lev Walkincc159472017-07-06 08:26:36 -070033
34/*
35 * Type of the generic OER encoder.
36 */
Lev Walkin4558ad02017-07-10 05:21:30 -070037typedef asn_enc_rval_t(oer_type_encoder_f)(
38 struct asn_TYPE_descriptor_s *type_descriptor,
39 asn_oer_constraints_t *constraints,
40 void *struct_ptr, /* Structure to be encoded */
41 asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */
42 void *app_key /* Arbitrary callback argument */
43 );
Lev Walkincc159472017-07-06 08:26:36 -070044
45
46#ifdef __cplusplus
47}
48#endif
49
50#endif /* _OER_ENCODER_H_ */