Lev Walkin | cc15947 | 2017-07-06 08:26:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017 Lev Walkin <vlm@lionet.info>. All rights reserved. |
| 3 | * Redistribution and modifications are permitted subject to BSD license. |
| 4 | */ |
Lev Walkin | d88bea9 | 2017-07-20 11:21:30 +0300 | [diff] [blame] | 5 | #ifndef OER_ENCODER_H |
| 6 | #define OER_ENCODER_H |
Lev Walkin | cc15947 | 2017-07-06 08:26:36 -0700 | [diff] [blame] | 7 | |
| 8 | #include <asn_application.h> |
| 9 | |
| 10 | #ifdef __cplusplus |
| 11 | extern "C" { |
| 12 | #endif |
| 13 | |
| 14 | struct 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 | */ |
| 20 | asn_enc_rval_t oer_encode(struct asn_TYPE_descriptor_s *type_descriptor, |
Lev Walkin | 4558ad0 | 2017-07-10 05:21:30 -0700 | [diff] [blame] | 21 | 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 Walkin | cc15947 | 2017-07-06 08:26:36 -0700 | [diff] [blame] | 25 | |
| 26 | /* A variant of oer_encode() which encodes data into the pre-allocated buffer */ |
| 27 | asn_enc_rval_t oer_encode_to_buffer( |
Lev Walkin | 4558ad0 | 2017-07-10 05:21:30 -0700 | [diff] [blame] | 28 | struct asn_TYPE_descriptor_s *type_descriptor, |
Lev Walkin | 494fb70 | 2017-08-07 20:07:00 -0700 | [diff] [blame] | 29 | const asn_oer_constraints_t *constraints, |
Lev Walkin | 4558ad0 | 2017-07-10 05:21:30 -0700 | [diff] [blame] | 30 | void *struct_ptr, /* Structure to be encoded */ |
| 31 | void *buffer, /* Pre-allocated buffer */ |
| 32 | size_t buffer_size /* Initial buffer size (maximum) */ |
| 33 | ); |
Lev Walkin | cc15947 | 2017-07-06 08:26:36 -0700 | [diff] [blame] | 34 | |
| 35 | /* |
| 36 | * Type of the generic OER encoder. |
| 37 | */ |
Lev Walkin | 4558ad0 | 2017-07-10 05:21:30 -0700 | [diff] [blame] | 38 | typedef asn_enc_rval_t(oer_type_encoder_f)( |
| 39 | struct asn_TYPE_descriptor_s *type_descriptor, |
Lev Walkin | 494fb70 | 2017-08-07 20:07:00 -0700 | [diff] [blame] | 40 | const asn_oer_constraints_t *constraints, |
Lev Walkin | 4558ad0 | 2017-07-10 05:21:30 -0700 | [diff] [blame] | 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 Walkin | cc15947 | 2017-07-06 08:26:36 -0700 | [diff] [blame] | 45 | |
| 46 | |
| 47 | #ifdef __cplusplus |
| 48 | } |
| 49 | #endif |
| 50 | |
Lev Walkin | d88bea9 | 2017-07-20 11:21:30 +0300 | [diff] [blame] | 51 | #endif /* OER_ENCODER_H */ |