]> git.stg.codes - stg.git/blob - stglibs/smux.lib/include/stg/per_encoder.h
Moved base and utility classes from global scope.
[stg.git] / stglibs / smux.lib / include / stg / per_encoder.h
1 /*-
2  * Copyright (c) 2006 Lev Walkin <vlm@lionet.info>. All rights reserved.
3  * Redistribution and modifications are permitted subject to BSD license.
4  */
5 #ifndef _PER_ENCODER_H_
6 #define _PER_ENCODER_H_
7
8 #include <asn_application.h>
9 #include <per_support.h>
10
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14
15 struct asn_TYPE_descriptor_s;   /* Forward declaration */
16
17 /*
18  * Unaligned PER encoder of any ASN.1 type. May be invoked by the application.
19  */
20 asn_enc_rval_t uper_encode(struct asn_TYPE_descriptor_s *type_descriptor,
21         void *struct_ptr,       /* Structure to be encoded */
22         asn_app_consume_bytes_f *consume_bytes_cb,      /* Data collector */
23         void *app_key           /* Arbitrary callback argument */
24 );
25
26 /* A variant of uper_encode() which encodes data into the existing buffer */
27 asn_enc_rval_t uper_encode_to_buffer(
28         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 (max) */
32 );
33
34
35 /*
36  * Type of the generic PER encoder function.
37  */
38 typedef asn_enc_rval_t (per_type_encoder_f)(
39         struct asn_TYPE_descriptor_s *type_descriptor,
40         asn_per_constraints_t *constraints,
41         void *struct_ptr,
42         asn_per_outp_t *per_output
43 );
44
45 #ifdef __cplusplus
46 }
47 #endif
48
49 #endif  /* _PER_ENCODER_H_ */