blob: 6d33f1ccd906729a8f774f9256c8829b193ee431 [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 */
Lev Walkind88bea92017-07-20 11:21:30 +03005#ifndef OER_ENCODER_H
6#define OER_ENCODER_H
Lev Walkincc159472017-07-06 08:26:36 -07007
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,
Lev Walkin486fd5c2017-07-10 22:08:14 -070029 asn_oer_constraints_t *constraints,
Lev Walkin4558ad02017-07-10 05:21:30 -070030 void *struct_ptr, /* Structure to be encoded */
31 void *buffer, /* Pre-allocated buffer */
32 size_t buffer_size /* Initial buffer size (maximum) */
33 );
Lev Walkincc159472017-07-06 08:26:36 -070034
35/*
36 * Type of the generic OER encoder.
37 */
Lev Walkin4558ad02017-07-10 05:21:30 -070038typedef asn_enc_rval_t(oer_type_encoder_f)(
39 struct asn_TYPE_descriptor_s *type_descriptor,
40 asn_oer_constraints_t *constraints,
41 void *struct_ptr, /* Structure to be encoded */
42 asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */
43 void *app_key /* Arbitrary callback argument */
44 );
Lev Walkincc159472017-07-06 08:26:36 -070045
46
47#ifdef __cplusplus
48}
49#endif
50
Lev Walkind88bea92017-07-20 11:21:30 +030051#endif /* OER_ENCODER_H */