Adding initial code jy.oak@samsung.com
[ric-app/kpimon.git] / asn1c_defs / all-defs / xer_encoder.h
diff --git a/asn1c_defs/all-defs/xer_encoder.h b/asn1c_defs/all-defs/xer_encoder.h
new file mode 100755 (executable)
index 0000000..8a5fc58
--- /dev/null
@@ -0,0 +1,83 @@
+/*-\r
+ * Copyright (c) 2004-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.\r
+ * Redistribution and modifications are permitted subject to BSD license.\r
+ */\r
+#ifndef        _XER_ENCODER_H_\r
+#define        _XER_ENCODER_H_\r
+\r
+#include <asn_application.h>\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+struct asn_TYPE_descriptor_s;  /* Forward declaration */\r
+\r
+/* Flags used by the xer_encode() and (*xer_type_encoder_f), defined below */\r
+enum xer_encoder_flags_e {\r
+       /* Mode of encoding */\r
+       XER_F_BASIC     = 0x01, /* BASIC-XER (pretty-printing) */\r
+       XER_F_CANONICAL = 0x02  /* Canonical XER (strict rules) */\r
+};\r
+\r
+/*\r
+ * The XER encoder of any type. May be invoked by the application.\r
+ * Produces CANONICAL-XER and BASIC-XER depending on the (xer_flags).\r
+ */\r
+asn_enc_rval_t xer_encode(const struct asn_TYPE_descriptor_s *type_descriptor,\r
+                          const void *struct_ptr, /* Structure to be encoded */\r
+                          enum xer_encoder_flags_e xer_flags,\r
+                          asn_app_consume_bytes_f *consume_bytes_cb,\r
+                          void *app_key /* Arbitrary callback argument */\r
+);\r
+\r
+/*\r
+ * The variant of the above function which dumps the BASIC-XER (XER_F_BASIC)\r
+ * output into the chosen file pointer.\r
+ * RETURN VALUES:\r
+ *      0: The structure is printed.\r
+ *     -1: Problem printing the structure.\r
+ * WARNING: No sensible errno value is returned.\r
+ */\r
+int xer_fprint(FILE *stream, const struct asn_TYPE_descriptor_s *td,\r
+               const void *struct_ptr);\r
+\r
+/*\r
+ * A helper function that uses XER encoding/decoding to verify that:\r
+ * - Both structures encode into the same BASIC XER.\r
+ * - Both resulting XER byte streams can be decoded back.\r
+ * - Both decoded structures encode into the same BASIC XER (round-trip).\r
+ * All of this verifies equivalence between structures and a round-trip.\r
+ * ARGUMENTS:\r
+ *  (opt_debug_stream)  - If specified, prints ongoing details.\r
+ */\r
+enum xer_equivalence_e {\r
+    XEQ_SUCCESS,          /* The only completely positive return value */\r
+    XEQ_FAILURE,          /* General failure */\r
+    XEQ_ENCODE1_FAILED,   /* First sructure XER encoding failed */\r
+    XEQ_ENCODE2_FAILED,   /* Second structure XER encoding failed */\r
+    XEQ_DIFFERENT,        /* Structures encoded into different XER */\r
+    XEQ_DECODE_FAILED,    /* Decode of the XER data failed */\r
+    XEQ_ROUND_TRIP_FAILED /* Bad round-trip */\r
+};\r
+enum xer_equivalence_e xer_equivalent(\r
+    const struct asn_TYPE_descriptor_s *type_descriptor, const void *struct1,\r
+    const void *struct2, FILE *opt_debug_stream);\r
+\r
+/*\r
+ * Type of the generic XER encoder.\r
+ */\r
+typedef asn_enc_rval_t(xer_type_encoder_f)(\r
+    const struct asn_TYPE_descriptor_s *type_descriptor,\r
+    const void *struct_ptr, /* Structure to be encoded */\r
+    int ilevel,             /* Level of indentation */\r
+    enum xer_encoder_flags_e xer_flags,\r
+    asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */\r
+    void *app_key                              /* Arbitrary callback argument */\r
+);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif /* _XER_ENCODER_H_ */\r