Adding initial code jy.oak@samsung.com
[ric-app/kpimon.git] / asn1c_defs / all-defs / asn_random_fill.h
diff --git a/asn1c_defs/all-defs/asn_random_fill.h b/asn1c_defs/all-defs/asn_random_fill.h
new file mode 100755 (executable)
index 0000000..d8b3e52
--- /dev/null
@@ -0,0 +1,51 @@
+/*\r
+ * Copyright (c) 2017 Lev Walkin <vlm@lionet.info>. All rights reserved.\r
+ * Redistribution and modifications are permitted subject to BSD license.\r
+ */\r
+#ifndef        ASN_RANDOM_FILL\r
+#define        ASN_RANDOM_FILL\r
+\r
+/* Forward declarations */\r
+struct asn_TYPE_descriptor_s;\r
+struct asn_encoding_constraints_s;\r
+\r
+/*\r
+ * Initialize a structure with random data according to the type specification\r
+ * and optional member constraints.\r
+ * ARGUMENTS:\r
+ *  (max_length)        - See (approx_max_length_limit).\r
+ *  (memb_constraints)  - Member constraints, if exist.\r
+ *                        The type can be constrained differently according\r
+ *                        to PER and OER specifications, so we find a value\r
+ *                        at the intersection of these constraints.\r
+ * In case the return differs from ARFILL_OK, the (struct_ptr) contents\r
+ * and (current_length) value remain in their original state.\r
+ */\r
+typedef struct asn_random_fill_result_s {\r
+    enum {\r
+        ARFILL_FAILED = -1, /* System error (memory?) */\r
+        ARFILL_OK = 0,      /* Initialization succeeded */\r
+        ARFILL_SKIPPED = 1  /* Not done due to (length?) constraint */\r
+    } code;\r
+    size_t length; /* Approximate number of bytes created. */\r
+} asn_random_fill_result_t;\r
+typedef asn_random_fill_result_t(asn_random_fill_f)(\r
+    const struct asn_TYPE_descriptor_s *td, void **struct_ptr,\r
+    const struct asn_encoding_constraints_s *memb_constraints,\r
+    size_t max_length);\r
+\r
+/*\r
+ * Returns 0 if the structure was properly initialized, -1 otherwise.\r
+ * The (approx_max_length_limit) specifies the approximate limit of the\r
+ * resulting structure in units closely resembling bytes. The actual result\r
+ * might be several times larger or smaller than the length limit.\r
+ */\r
+int asn_random_fill(const struct asn_TYPE_descriptor_s *td, void **struct_ptr,\r
+                    size_t approx_max_length_limit);\r
+\r
+/*\r
+ * Returns a random number between min and max.\r
+ */\r
+intmax_t asn_random_between(intmax_t min, intmax_t max);\r
+\r
+#endif /* ASN_RANDOM_FILL */\r