]> git.stg.codes - stg.git/blobdiff - libs/smux/include/stg/INTEGER.h
Update SMUX library.
[stg.git] / libs / smux / include / stg / INTEGER.h
index 62832b12e1271e1f27a5edd5b4a0f82986ff2fc3..9a88097075770e27d522e5ee35c4cb9a61e654c3 100644 (file)
@@ -24,12 +24,14 @@ typedef struct asn_INTEGER_enum_map_s {
 } asn_INTEGER_enum_map_t;
 
 /* This type describes an enumeration for INTEGER and ENUMERATED types */
 } asn_INTEGER_enum_map_t;
 
 /* This type describes an enumeration for INTEGER and ENUMERATED types */
-typedef struct asn_INTEGER_specifics_s {
-       asn_INTEGER_enum_map_t *value2enum;     /* N -> "tag"; sorted by N */
-       unsigned int *enum2value;               /* "tag" => N; sorted by tag */
+typedef const struct asn_INTEGER_specifics_s {
+       const asn_INTEGER_enum_map_t *value2enum;       /* N -> "tag"; sorted by N */
+       const unsigned int *enum2value;         /* "tag" => N; sorted by tag */
        int map_count;                          /* Elements in either map */
        int extension;                          /* This map is extensible */
        int strict_enumeration;                 /* Enumeration set is fixed */
        int map_count;                          /* Elements in either map */
        int extension;                          /* This map is extensible */
        int strict_enumeration;                 /* Enumeration set is fixed */
+       int field_width;                        /* Size of native integer */
+       int field_unsigned;                     /* Signed=0, unsigned=1 */
 } asn_INTEGER_specifics_t;
 
 asn_struct_print_f INTEGER_print;
 } asn_INTEGER_specifics_t;
 
 asn_struct_print_f INTEGER_print;
@@ -51,7 +53,22 @@ per_type_encoder_f INTEGER_encode_uper;
  * -1/ENOMEM: Memory allocation failed (in asn_long2INTEGER()).
  */
 int asn_INTEGER2long(const INTEGER_t *i, long *l);
  * -1/ENOMEM: Memory allocation failed (in asn_long2INTEGER()).
  */
 int asn_INTEGER2long(const INTEGER_t *i, long *l);
+int asn_INTEGER2ulong(const INTEGER_t *i, unsigned long *l);
 int asn_long2INTEGER(INTEGER_t *i, long l);
 int asn_long2INTEGER(INTEGER_t *i, long l);
+int asn_ulong2INTEGER(INTEGER_t *i, unsigned long l);
+
+/* A a reified version of strtol(3) with nicer error reporting. */
+enum asn_strtol_result_e {
+    ASN_STRTOL_ERROR_RANGE = -3,  /* Input outside of numeric range for long type */
+    ASN_STRTOL_ERROR_INVAL = -2,  /* Invalid data encountered (e.g., "+-") */
+    ASN_STRTOL_EXPECT_MORE = -1,  /* More data expected (e.g. "+") */
+    ASN_STRTOL_OK          =  0,  /* Conversion succeded, number ends at (*end) */
+    ASN_STRTOL_EXTRA_DATA  =  1   /* Conversion succeded, but the string has extra stuff */
+};
+enum asn_strtol_result_e asn_strtol_lim(const char *str, const char **end, long *l);
+
+/* The asn_strtol is going to be DEPRECATED soon */
+enum asn_strtol_result_e asn_strtol(const char *str, const char *end, long *l);
 
 /*
  * Convert the integer value into the corresponding enumeration map entry.
 
 /*
  * Convert the integer value into the corresponding enumeration map entry.