Adding initial code jy.oak@samsung.com
[ric-app/kpimon.git] / asn1c_defs / all-defs / INTEGER.h
diff --git a/asn1c_defs/all-defs/INTEGER.h b/asn1c_defs/all-defs/INTEGER.h
new file mode 100755 (executable)
index 0000000..d04e015
--- /dev/null
@@ -0,0 +1,108 @@
+/*-\r
+ * Copyright (c) 2003-2017 Lev Walkin <vlm@lionet.info>. All rights reserved.\r
+ * Redistribution and modifications are permitted subject to BSD license.\r
+ */\r
+#ifndef        _INTEGER_H_\r
+#define        _INTEGER_H_\r
+\r
+#include <asn_application.h>\r
+#include <asn_codecs_prim.h>\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+typedef ASN__PRIMITIVE_TYPE_t INTEGER_t;\r
+\r
+extern asn_TYPE_descriptor_t asn_DEF_INTEGER;\r
+extern asn_TYPE_operation_t asn_OP_INTEGER;\r
+\r
+/* Map with <tag> to integer value association */\r
+typedef struct asn_INTEGER_enum_map_s {\r
+       long             nat_value;     /* associated native integer value */\r
+       size_t           enum_len;      /* strlen("tag") */\r
+       const char      *enum_name;     /* "tag" */\r
+} asn_INTEGER_enum_map_t;\r
+\r
+/* This type describes an enumeration for INTEGER and ENUMERATED types */\r
+typedef struct asn_INTEGER_specifics_s {\r
+       const asn_INTEGER_enum_map_t *value2enum;       /* N -> "tag"; sorted by N */\r
+       const unsigned int *enum2value;         /* "tag" => N; sorted by tag */\r
+       int map_count;                          /* Elements in either map */\r
+       int extension;                          /* This map is extensible */\r
+       int strict_enumeration;                 /* Enumeration set is fixed */\r
+       int field_width;                        /* Size of native integer */\r
+       int field_unsigned;                     /* Signed=0, unsigned=1 */\r
+} asn_INTEGER_specifics_t;\r
+\r
+#define INTEGER_free    ASN__PRIMITIVE_TYPE_free\r
+#define INTEGER_decode_ber     ber_decode_primitive\r
+#define INTEGER_constraint     asn_generic_no_constraint\r
+asn_struct_print_f INTEGER_print;\r
+asn_struct_compare_f INTEGER_compare;\r
+der_type_encoder_f INTEGER_encode_der;\r
+xer_type_decoder_f INTEGER_decode_xer;\r
+xer_type_encoder_f INTEGER_encode_xer;\r
+oer_type_decoder_f INTEGER_decode_oer;\r
+oer_type_encoder_f INTEGER_encode_oer;\r
+per_type_decoder_f INTEGER_decode_uper;\r
+per_type_encoder_f INTEGER_encode_uper;\r
+per_type_decoder_f INTEGER_decode_aper;\r
+per_type_encoder_f INTEGER_encode_aper;\r
+asn_random_fill_f  INTEGER_random_fill;\r
+\r
+/***********************************\r
+ * Some handy conversion routines. *\r
+ ***********************************/\r
+\r
+/*\r
+ * Natiwe size-independent conversion of native integers to/from INTEGER.\r
+ * (l_size) is in bytes.\r
+ * Returns 0 if it was possible to convert, -1 otherwise.\r
+ * -1/EINVAL: Mandatory argument missing\r
+ * -1/ERANGE: Value encoded is out of range for long representation\r
+ * -1/ENOMEM: Memory allocation failed (in asn_*2INTEGER()).\r
+ */\r
+int asn_INTEGER2imax(const INTEGER_t *i, intmax_t *l);\r
+int asn_INTEGER2umax(const INTEGER_t *i, uintmax_t *l);\r
+int asn_imax2INTEGER(INTEGER_t *i, intmax_t l);\r
+int asn_umax2INTEGER(INTEGER_t *i, uintmax_t l);\r
+\r
+/*\r
+ * Size-specific conversion helpers.\r
+ */\r
+int asn_INTEGER2long(const INTEGER_t *i, long *l);\r
+int asn_INTEGER2ulong(const INTEGER_t *i, unsigned long *l);\r
+int asn_long2INTEGER(INTEGER_t *i, long l);\r
+int asn_ulong2INTEGER(INTEGER_t *i, unsigned long l);\r
+int asn_int642INTEGER(INTEGER_t *i, int64_t l);\r
+int asn_uint642INTEGER(INTEGER_t *i, uint64_t l);\r
+\r
+/* A version of strtol/strtoimax(3) with nicer error reporting. */\r
+enum asn_strtox_result_e {\r
+    ASN_STRTOX_ERROR_RANGE = -3,  /* Input outside of supported numeric range */\r
+    ASN_STRTOX_ERROR_INVAL = -2,  /* Invalid data encountered (e.g., "+-") */\r
+    ASN_STRTOX_EXPECT_MORE = -1,  /* More data expected (e.g. "+") */\r
+    ASN_STRTOX_OK          =  0,  /* Conversion succeded, number ends at (*end) */\r
+    ASN_STRTOX_EXTRA_DATA  =  1   /* Conversion succeded, but the string has extra stuff */\r
+};\r
+enum asn_strtox_result_e asn_strtol_lim(const char *str, const char **end,\r
+                                        long *l);\r
+enum asn_strtox_result_e asn_strtoul_lim(const char *str, const char **end,\r
+                                         unsigned long *l);\r
+enum asn_strtox_result_e asn_strtoimax_lim(const char *str, const char **end,\r
+                                           intmax_t *l);\r
+enum asn_strtox_result_e asn_strtoumax_lim(const char *str, const char **end,\r
+                                           uintmax_t *l);\r
+\r
+/*\r
+ * Convert the integer value into the corresponding enumeration map entry.\r
+ */\r
+const asn_INTEGER_enum_map_t *INTEGER_map_value2enum(\r
+    const asn_INTEGER_specifics_t *specs, long value);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif /* _INTEGER_H_ */\r