summaryrefslogtreecommitdiffstats
path: root/common/ini/ini_config.h
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2010-05-17 13:21:56 -0400
committerStephen Gallagher <sgallagh@redhat.com>2010-05-17 13:52:16 -0400
commit5c65c5a50c496b161c7532055778c9e223185c21 (patch)
tree6834a98bbb35362ba16d9edb0494f3dfdb5f1a02 /common/ini/ini_config.h
parentebb6e30d687a4d6626c735234c85cbb5b06a26aa (diff)
downloadsssd-5c65c5a50c496b161c7532055778c9e223185c21.tar.gz
sssd-5c65c5a50c496b161c7532055778c9e223185c21.tar.xz
sssd-5c65c5a50c496b161c7532055778c9e223185c21.zip
Adding support for explicit 32/64 types (attempt 2).
This is a reworked patch to add support for explicit 32 and 64 bit values in the config files.
Diffstat (limited to 'common/ini/ini_config.h')
-rw-r--r--common/ini/ini_config.h180
1 files changed, 180 insertions, 0 deletions
diff --git a/common/ini/ini_config.h b/common/ini/ini_config.h
index 3b58a11..28e1af8 100644
--- a/common/ini/ini_config.h
+++ b/common/ini/ini_config.h
@@ -1172,6 +1172,186 @@ unsigned long get_ulong_config_value(struct collection_item *item,
int *error);
/**
+ * @brief Convert item value to integer number.
+ *
+ * This is a conversion function.
+ * It converts the value read from the INI file
+ * and stored in the configuration item
+ * into an int32_t number. Any of the conversion
+ * functions can be used to try to convert the value
+ * stored as a string inside the item.
+ * The results can be different depending upon
+ * how the caller tries to interpret the value.
+ * If "strict" parameter is non zero the function will fail
+ * if there are more characters after the last digit.
+ * The value range is from INT_MIN to INT_MAX.
+ *
+ * @param[in] item Item to interpret.
+ * It must be retrieved using
+ * \ref get_config_item().
+ * @param[in] strict Fail the function if
+ * the symbol after last digit
+ * is not valid.
+ * @param[in] def Default value to use if
+ * conversion failed.
+ * @param[out] error Variable will get the value
+ * of the error code if
+ * error happened.
+ * Can be NULL. In this case
+ * function does not set
+ * the code.
+ * Codes:
+ * - 0 - Success.
+ * - EINVAL - Argument is invalid.
+ * - EIO - Conversion failed due
+ * invalid characters.
+ * - ERANGE - Value is out of range.
+ *
+ * @return Converted value.
+ * In case of failure the function returns default value and
+ * sets error code into the provided variable.
+ */
+int32_t get_int32_config_value(struct collection_item *item,
+ int strict,
+ int32_t def,
+ int *error);
+
+/**
+ * @brief Convert item value to integer number.
+ *
+ * This is a conversion function.
+ * It converts the value read from the INI file
+ * and stored in the configuration item
+ * into an uint32_t number. Any of the conversion
+ * functions can be used to try to convert the value
+ * stored as a string inside the item.
+ * The results can be different depending upon
+ * how the caller tries to interpret the value.
+ * If "strict" parameter is non zero the function will fail
+ * if there are more characters after the last digit.
+ * The value range is from 0 to ULONG_MAX.
+ *
+ * @param[in] item Item to interpret.
+ * It must be retrieved using
+ * \ref get_config_item().
+ * @param[in] strict Fail the function if
+ * the symbol after last digit
+ * is not valid.
+ * @param[in] def Default value to use if
+ * conversion failed.
+ * @param[out] error Variable will get the value
+ * of the error code if
+ * error happened.
+ * Can be NULL. In this case
+ * function does not set
+ * the code.
+ * Codes:
+ * - 0 - Success.
+ * - EINVAL - Argument is invalid.
+ * - EIO - Conversion failed due
+ * invalid characters.
+ * - ERANGE - Value is out of range.
+ *
+ * @return Converted value.
+ * In case of failure the function returns default value and
+ * sets error code into the provided variable.
+ */
+uint32_t get_uint32_config_value(struct collection_item *item,
+ int strict,
+ uint32_t def,
+ int *error);
+
+/**
+ * @brief Convert item value to integer number.
+ *
+ * This is a conversion function.
+ * It converts the value read from the INI file
+ * and stored in the configuration item
+ * into an int64_t number. Any of the conversion
+ * functions can be used to try to convert the value
+ * stored as a string inside the item.
+ * The results can be different depending upon
+ * how the caller tries to interpret the value.
+ * If "strict" parameter is non zero the function will fail
+ * if there are more characters after the last digit.
+ * The value range is from LLONG_MIN to LLONG_MAX.
+ *
+ * @param[in] item Item to interpret.
+ * It must be retrieved using
+ * \ref get_config_item().
+ * @param[in] strict Fail the function if
+ * the symbol after last digit
+ * is not valid.
+ * @param[in] def Default value to use if
+ * conversion failed.
+ * @param[out] error Variable will get the value
+ * of the error code if
+ * error happened.
+ * Can be NULL. In this case
+ * function does not set
+ * the code.
+ * Codes:
+ * - 0 - Success.
+ * - EINVAL - Argument is invalid.
+ * - EIO - Conversion failed due
+ * invalid characters.
+ * - ERANGE - Value is out of range.
+ *
+ * @return Converted value.
+ * In case of failure the function returns default value and
+ * sets error code into the provided variable.
+ */
+int64_t get_int64_config_value(struct collection_item *item,
+ int strict,
+ int64_t def,
+ int *error);
+
+/**
+ * @brief Convert item value to integer number.
+ *
+ * This is a conversion function.
+ * It converts the value read from the INI file
+ * and stored in the configuration item
+ * into an uint64_t number. Any of the conversion
+ * functions can be used to try to convert the value
+ * stored as a string inside the item.
+ * The results can be different depending upon
+ * how the caller tries to interpret the value.
+ * If "strict" parameter is non zero the function will fail
+ * if there are more characters after the last digit.
+ * The value range is from 0 to ULLONG_MAX.
+ *
+ * @param[in] item Item to interpret.
+ * It must be retrieved using
+ * \ref get_config_item().
+ * @param[in] strict Fail the function if
+ * the symbol after last digit
+ * is not valid.
+ * @param[in] def Default value to use if
+ * conversion failed.
+ * @param[out] error Variable will get the value
+ * of the error code if
+ * error happened.
+ * Can be NULL. In this case
+ * function does not set
+ * the code.
+ * Codes:
+ * - 0 - Success.
+ * - EINVAL - Argument is invalid.
+ * - EIO - Conversion failed due
+ * invalid characters.
+ * - ERANGE - Value is out of range.
+ *
+ * @return Converted value.
+ * In case of failure the function returns default value and
+ * sets error code into the provided variable.
+ */
+uint64_t get_uint64_config_value(struct collection_item *item,
+ int strict,
+ uint64_t def,
+ int *error);
+
+/**
* @brief Convert item value to floating point number.
*
* This is a conversion function.