--- /dev/null
+/*-\r
+ * Copyright (c) 2006-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.\r
+ * Redistribution and modifications are permitted subject to BSD license.\r
+ */\r
+#ifndef _PER_ENCODER_H_\r
+#define _PER_ENCODER_H_\r
+\r
+#include <asn_application.h>\r
+#include <per_support.h>\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+struct asn_TYPE_descriptor_s; /* Forward declaration */\r
+\r
+/*\r
+ * Unaligned PER encoder of any ASN.1 type. May be invoked by the application.\r
+ * WARNING: This function returns the number of encoded bits in the .encoded\r
+ * field of the return value. Use the following formula to convert to bytes:\r
+ * bytes = ((.encoded + 7) / 8)\r
+ */\r
+asn_enc_rval_t uper_encode(\r
+ const struct asn_TYPE_descriptor_s *type_descriptor,\r
+ const asn_per_constraints_t *constraints,\r
+ const void *struct_ptr, /* Structure to be encoded */\r
+ asn_app_consume_bytes_f *consume_bytes_cb, /* Data collector */\r
+ void *app_key /* Arbitrary callback argument */\r
+);\r
+\r
+asn_enc_rval_t aper_encode(\r
+ const struct asn_TYPE_descriptor_s *type_descriptor,\r
+ const asn_per_constraints_t *constraints,\r
+ const void *struct_ptr, /* Structure to be encoded */\r
+ asn_app_consume_bytes_f *consume_bytes_cb, /* Data collector */\r
+ void *app_key /* Arbitrary callback argument */\r
+);\r
+\r
+/*\r
+ * A variant of uper_encode() which encodes data into the existing buffer\r
+ * WARNING: This function returns the number of encoded bits in the .encoded\r
+ * field of the return value.\r
+ */\r
+asn_enc_rval_t uper_encode_to_buffer(\r
+ const struct asn_TYPE_descriptor_s *type_descriptor,\r
+ const asn_per_constraints_t *constraints,\r
+ const void *struct_ptr, /* Structure to be encoded */\r
+ void *buffer, /* Pre-allocated buffer */\r
+ size_t buffer_size /* Initial buffer size (max) */\r
+);\r
+\r
+asn_enc_rval_t aper_encode_to_buffer(\r
+ const struct asn_TYPE_descriptor_s *type_descriptor,\r
+ const asn_per_constraints_t *constraints,\r
+ const void *struct_ptr, /* Structure to be encoded */\r
+ void *buffer, /* Pre-allocated buffer */\r
+ size_t buffer_size /* Initial buffer size (max) */\r
+);\r
+/*\r
+ * A variant of uper_encode_to_buffer() which allocates buffer itself.\r
+ * Returns the number of bytes in the buffer or -1 in case of failure.\r
+ * WARNING: This function produces a "Production of the complete encoding",\r
+ * with length of at least one octet. Contrast this to precise bit-packing\r
+ * encoding of uper_encode() and uper_encode_to_buffer().\r
+ */\r
+ssize_t uper_encode_to_new_buffer(\r
+ const struct asn_TYPE_descriptor_s *type_descriptor,\r
+ const asn_per_constraints_t *constraints,\r
+ const void *struct_ptr, /* Structure to be encoded */\r
+ void **buffer_r /* Buffer allocated and returned */\r
+);\r
+\r
+ssize_t\r
+aper_encode_to_new_buffer(\r
+ const struct asn_TYPE_descriptor_s *td,\r
+ const asn_per_constraints_t *constraints,\r
+ const void *sptr,\r
+ void **buffer_r\r
+);\r
+\r
+/*\r
+ * Type of the generic PER encoder function.\r
+ */\r
+typedef asn_enc_rval_t(per_type_encoder_f)(\r
+ const struct asn_TYPE_descriptor_s *type_descriptor,\r
+ const asn_per_constraints_t *constraints, const void *struct_ptr,\r
+ asn_per_outp_t *per_output);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif /* _PER_ENCODER_H_ */\r