Updated INFO.yaml file
[ric-app/kpimon.git] / asn1c_defs / all-defs / der_encoder.h
1 /*-\r
2  * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.\r
3  * Redistribution and modifications are permitted subject to BSD license.\r
4  */\r
5 #ifndef _DER_ENCODER_H_\r
6 #define _DER_ENCODER_H_\r
7 \r
8 #include <asn_application.h>\r
9 \r
10 #ifdef __cplusplus\r
11 extern "C" {\r
12 #endif\r
13 \r
14 struct asn_TYPE_descriptor_s;   /* Forward declaration */\r
15 \r
16 /*\r
17  * The DER encoder of any type. May be invoked by the application.\r
18  * Produces DER- and BER-compliant encoding. (DER is a subset of BER).\r
19  *\r
20  * NOTE: Use the ber_decode() function (ber_decoder.h) to decode data\r
21  * produced by der_encode().\r
22  */\r
23 asn_enc_rval_t der_encode(const struct asn_TYPE_descriptor_s *type_descriptor,\r
24                           const void *struct_ptr, /* Structure to be encoded */\r
25                           asn_app_consume_bytes_f *consume_bytes_cb,\r
26                           void *app_key /* Arbitrary callback argument */\r
27 );\r
28 \r
29 /* A variant of der_encode() which encodes data into the pre-allocated buffer */\r
30 asn_enc_rval_t der_encode_to_buffer(\r
31     const struct asn_TYPE_descriptor_s *type_descriptor,\r
32     const void *struct_ptr, /* Structure to be encoded */\r
33     void *buffer,           /* Pre-allocated buffer */\r
34     size_t buffer_size      /* Initial buffer size (maximum) */\r
35 );\r
36 \r
37 /*\r
38  * Type of the generic DER encoder.\r
39  */\r
40 typedef asn_enc_rval_t(der_type_encoder_f)(\r
41     const struct asn_TYPE_descriptor_s *type_descriptor,\r
42     const void *struct_ptr, /* Structure to be encoded */\r
43     int tag_mode,           /* {-1,0,1}: IMPLICIT, no, EXPLICIT */\r
44     ber_tlv_tag_t tag, asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */\r
45     void *app_key /* Arbitrary callback argument */\r
46 );\r
47 \r
48 \r
49 /*******************************\r
50  * INTERNALLY USEFUL FUNCTIONS *\r
51  *******************************/\r
52 \r
53 /*\r
54  * Write out leading TL[v] sequence according to the type definition.\r
55  */\r
56 ssize_t der_write_tags(const struct asn_TYPE_descriptor_s *type_descriptor,\r
57                        size_t struct_length,\r
58                        int tag_mode,      /* {-1,0,1}: IMPLICIT, no, EXPLICIT */\r
59                        int last_tag_form, /* {0,!0}: prim, constructed */\r
60                        ber_tlv_tag_t tag,\r
61                        asn_app_consume_bytes_f *consume_bytes_cb,\r
62                        void *app_key);\r
63 \r
64 #ifdef __cplusplus\r
65 }\r
66 #endif\r
67 \r
68 #endif  /* _DER_ENCODER_H_ */\r