libini_config 0.6.2
Loading...
Searching...
No Matches
Value management

Data Structures

struct  ini_validator
 Structure used to define application specific (external to libini) validator. More...
 

Functions

int ini_get_config_valueobj (const char *section, const char *name, struct ini_cfgobj *ini_config, int mode, struct value_obj **vo)
 Retrieve a value object form the configuration.
 
int ini_get_int_config_value (struct value_obj *vo, int strict, int def, int *error)
 Convert value to integer number.
 
unsigned ini_get_unsigned_config_value (struct value_obj *vo, int strict, unsigned def, int *error)
 Convert value object to a unsigned number.
 
long ini_get_long_config_value (struct value_obj *vo, int strict, long def, int *error)
 Convert value to long number.
 
unsigned long ini_get_ulong_config_value (struct value_obj *vo, int strict, unsigned long def, int *error)
 Convert value to unsigned long number.
 
int32_t ini_get_int32_config_value (struct value_obj *vo, int strict, int32_t def, int *error)
 Convert value to int32_t number.
 
uint32_t ini_get_uint32_config_value (struct value_obj *vo, int strict, uint32_t def, int *error)
 Convert value to uint32_t number.
 
int64_t ini_get_int64_config_value (struct value_obj *vo, int strict, int64_t def, int *error)
 Convert value to integer number.
 
uint64_t ini_get_uint64_config_value (struct value_obj *vo, int strict, uint64_t def, int *error)
 Convert value to integer number.
 
double ini_get_double_config_value (struct value_obj *vo, int strict, double def, int *error)
 Convert value to floating point number.
 
unsigned char ini_get_bool_config_value (struct value_obj *vo, unsigned char def, int *error)
 Convert value into a logical value.
 
char * ini_get_string_config_value (struct value_obj *vo, int *error)
 Get the copy of string stored in the configuration value.
 
const char * ini_get_const_string_config_value (struct value_obj *vo, int *error)
 Get the string stored in the configuration value.
 
char * ini_get_bin_config_value (struct value_obj *vo, int *length, int *error)
 Convert value into a binary sequence.
 
void ini_free_bin_config_value (char *bin)
 Free binary buffer.
 
char ** ini_get_string_config_array (struct value_obj *vo, const char *sep, int *size, int *error)
 Convert value to an array of strings.
 
char ** ini_get_raw_string_config_array (struct value_obj *vo, const char *sep, int *size, int *error)
 Convert value to an array of strings.
 
long * ini_get_long_config_array (struct value_obj *vo, int *size, int *error)
 Convert value to an array of long values.
 
double * ini_get_double_config_array (struct value_obj *vo, int *size, int *error)
 Convert value to an array of floating point values.
 
void ini_free_string_config_array (char **str_config)
 Free array of string values.
 
void ini_free_long_config_array (long *array)
 Free array of long values.
 
void ini_free_double_config_array (double *array)
 Free array of floating pointer values.
 
int ini_errobj_create (struct ini_errobj **_errobj)
 Create structure to hold error messages.
 
void ini_errobj_destroy (struct ini_errobj **errobj)
 Free structure that holds error messages.
 
int ini_errobj_add_msg (struct ini_errobj *errobj, const char *format,...) DING_ATTR_FORMAT(2
 Add new printf formated message to errobj.
 
int void ini_errobj_reset (struct ini_errobj *errobj)
 Reset iterator in errobj.
 
const char * ini_errobj_get_msg (struct ini_errobj *errobj)
 Get pointer to current message in errobj.
 
void ini_errobj_next (struct ini_errobj *errobj)
 Move to the next message in errobj.
 
int ini_errobj_no_more_msgs (struct ini_errobj *errobj)
 Check if errobj has more messages.
 
size_t ini_errobj_count (struct ini_errobj *errobj)
 Return number of messages in errobj.
 
int ini_rules_read_from_file (const char *filename, struct ini_cfgobj **_rules_obj)
 Read rules from INI file.
 
int ini_rules_check (struct ini_cfgobj *rules_obj, struct ini_cfgobj *config_obj, struct ini_validator **extra_validators, struct ini_errobj *errobj)
 Check configuration file using rules.
 
void ini_rules_destroy (struct ini_cfgobj *ini_config)
 Free the rules.
 

Detailed Description

This section contains value management functions. These functions can be used to interpret values that are stored in the configuration object in memory.

Function Documentation

◆ ini_get_config_valueobj()

int ini_get_config_valueobj ( const char * section,
const char * name,
struct ini_cfgobj * ini_config,
int mode,
struct value_obj ** vo )

Retrieve a value object form the configuration.

Check return error code first. If the function returns an error there is a serious problem. Then check if object is found. Function will set vo parameter to NULL if no attribute with provided name is found in the collection.

Parameters
[in]sectionSection name. If NULL assumed default.
[in]nameAttribute name to find.
[in]ini_configConfiguration object to search.
[in]modeSee search mode section for more info.
[out]voValue object. Will be set to NULL if element with the given name is not found.
Returns
0 - Success.
EINVAL - Invalid parameter.
ENOMEM - No memory.

◆ ini_get_int_config_value()

int ini_get_int_config_value ( struct value_obj * vo,
int strict,
int def,
int * error )

Convert value to integer number.

This is a conversion function. It converts the value read from the INI file and stored in the configuration element into an int number. Any of the conversion functions can be used to try to convert the value stored as a string inside the value object. The result 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.

Parameters
[in]voValue object to interpret. It must be retrieved using ini_get_config_valueobj().
[in]strictFail the function if the symbol after last digit is not valid.
[in]defDefault value to use if conversion failed.
[out]errorVariable 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.
Returns
Converted value. In case of failure the function returns default value and sets error code into the provided variable.

◆ ini_get_unsigned_config_value()

unsigned ini_get_unsigned_config_value ( struct value_obj * vo,
int strict,
unsigned def,
int * error )

Convert value object to a unsigned number.

This is a conversion function. It converts the value read from the INI file and stored in the configuration element into an unsigned number. Any of the conversion functions can be used to try to convert the value stored as a string inside the value object. The result 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 UINT_MAX.

Parameters
[in]voValue object to interpret. It must be retrieved using ini_get_config_valueobj().
[in]strictFail the function if the symbol after last digit is not valid.
[in]defDefault value to use if conversion failed.
[out]errorVariable 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.
Returns
Converted value. In case of failure the function returns default value and sets error code into the provided variable.

◆ ini_get_long_config_value()

long ini_get_long_config_value ( struct value_obj * vo,
int strict,
long def,
int * error )

Convert value to long number.

This is a conversion function. It converts the value read from the INI file and stored in the configuration element into a long number. Any of the conversion functions can be used to try to convert the value stored as a string inside the value object. The result 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 LONG_MIN to LONG_MAX.

Parameters
[in]voValue object to interpret. It must be retrieved using ini_get_config_valueobj().
[in]strictFail the function if the symbol after last digit is not valid.
[in]defDefault value to use if conversion failed.
[out]errorVariable 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.
Returns
Converted value. In case of failure the function returns default value and sets error code into the provided variable.

◆ ini_get_ulong_config_value()

unsigned long ini_get_ulong_config_value ( struct value_obj * vo,
int strict,
unsigned long def,
int * error )

Convert value to unsigned long number.

This is a conversion function. It converts the value read from the INI file and stored in the configuration element into an unsigned long number. Any of the conversion functions can be used to try to convert the value stored as a string inside the value object. The result 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.

Parameters
[in]voValue object to interpret. It must be retrieved using ini_get_config_valueobj().
[in]strictFail the function if the symbol after last digit is not valid.
[in]defDefault value to use if conversion failed.
[out]errorVariable 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.
Returns
Converted value. In case of failure the function returns default value and sets error code into the provided variable.

◆ ini_get_int32_config_value()

int32_t ini_get_int32_config_value ( struct value_obj * vo,
int strict,
int32_t def,
int * error )

Convert value to int32_t number.

This is a conversion function. It converts the value read from the INI file and stored in the configuration element 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 value object. The result 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.

Parameters
[in]voValue object to interpret. It must be retrieved using ini_get_config_valueobj().
[in]strictFail the function if the symbol after last digit is not valid.
[in]defDefault value to use if conversion failed.
[out]errorVariable 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.
Returns
Converted value. In case of failure the function returns default value and sets error code into the provided variable.

◆ ini_get_uint32_config_value()

uint32_t ini_get_uint32_config_value ( struct value_obj * vo,
int strict,
uint32_t def,
int * error )

Convert value to uint32_t number.

This is a conversion function. It converts the value read from the INI file and stored in the configuration value 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 value object. The result 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.

Parameters
[in]voValue object to interpret. It must be retrieved using ini_get_config_valueobj().
[in]strictFail the function if the symbol after last digit is not valid.
[in]defDefault value to use if conversion failed.
[out]errorVariable 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.
Returns
Converted value. In case of failure the function returns default value and sets error code into the provided variable.

◆ ini_get_int64_config_value()

int64_t ini_get_int64_config_value ( struct value_obj * vo,
int strict,
int64_t def,
int * error )

Convert value to integer number.

This is a conversion function. It converts the value read from the INI file and stored in the configuration element 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 value object. The result 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.

Parameters
[in]voValue object to interpret. It must be retrieved using ini_get_config_valueobj().
[in]strictFail the function if the symbol after last digit is not valid.
[in]defDefault value to use if conversion failed.
[out]errorVariable 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.
Returns
Converted value. In case of failure the function returns default value and sets error code into the provided variable.

◆ ini_get_uint64_config_value()

uint64_t ini_get_uint64_config_value ( struct value_obj * vo,
int strict,
uint64_t def,
int * error )

Convert value to integer number.

This is a conversion function. It converts the value read from the INI file and stored in the configuration element 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 value object. The result 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.

Parameters
[in]voValue object to interpret. It must be retrieved using ini_get_config_valueobj().
[in]strictFail the function if the symbol after last digit is not valid.
[in]defDefault value to use if conversion failed.
[out]errorVariable 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.
Returns
Converted value. In case of failure the function returns default value and sets error code into the provided variable.

◆ ini_get_double_config_value()

double ini_get_double_config_value ( struct value_obj * vo,
int strict,
double def,
int * error )

Convert value to floating point number.

This is a conversion function. It converts the value read from the INI file and stored in the configuration element into a floating point number. Any of the conversion functions can be used to try to convert the value stored as a string inside the value object. The result 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.

Parameters
[in]voValue object to interpret. It must be retrieved using ini_get_config_valueobj().
[in]strictFail the function if the symbol after last digit is not valid.
[in]defDefault value to use if conversion failed.
[out]errorVariable 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.
Returns
Converted value. In case of failure the function returns default value and sets error code into the provided variable.

◆ ini_get_bool_config_value()

unsigned char ini_get_bool_config_value ( struct value_obj * vo,
unsigned char def,
int * error )

Convert value into a logical value.

This is a conversion function. It converts the value read from the INI file and stored in the configuration element into a Boolean. Any of the conversion functions can be used to try to convert the value stored as a string inside the value object. The result can be different depending upon how the caller tries to interpret the value.

Parameters
[in]voValue object to interpret. It must be retrieved using ini_get_config_valueobj().
[in]defDefault value to use if conversion failed.
[out]errorVariable 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.
Returns
Converted value. In case of failure the function returns default value and sets error code into the provided variable.

◆ ini_get_string_config_value()

char * ini_get_string_config_value ( struct value_obj * vo,
int * error )

Get the copy of string stored in the configuration value.

Function creates a copy of the string value stored in the configuration element. Returned value needs to be freed after use. If error occurred the returned value will be NULL.

Parameters
[in]voValue object to use. It must be retrieved using ini_get_config_valueobj().
[out]errorVariable 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.
  • ENOMEM - No memory.
Returns
Copy of the string or NULL.

◆ ini_get_const_string_config_value()

const char * ini_get_const_string_config_value ( struct value_obj * vo,
int * error )

Get the string stored in the configuration value.

Function returns a reference to the string value stored inside the configuration element. This string can't be altered. The string will go out of scope if the value object is deleted.

Parameters
[in]voValue object to use. It must be retrieved using ini_get_config_valueobj().
[out]errorVariable 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.
Returns
String from the value object.

◆ ini_get_bin_config_value()

char * ini_get_bin_config_value ( struct value_obj * vo,
int * length,
int * error )

Convert value into a binary sequence.

This is a conversion function. It converts the value read from the INI file and stored in the configuration element into a sequence of bytes. Any of the conversion functions can be used to try to convert the value stored as a string inside the value object. The result can be different depending upon how the caller tries to interpret the value.

The function allocates memory. It is the responsibility of the caller to free it after use. Use ini_free_bin_config_value() for this purpose. Functions will return NULL if conversion failed.

Function assumes that the value being interpreted has a special format. The string should be taken in single quotes and consist of hex encoded value represented by two hex digits per byte. Case does not matter.

Example: '0a2BFeCc'

Parameters
[in]voValue object to interpret. It must be retrieved using ini_get_config_valueobj().
[out]lengthVariable that optionally receives the length of the binary sequence.
[out]errorVariable 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.
  • ENOMEM - No memory.
Returns
Converted value. In case of failure the function returns NULL.

◆ ini_free_bin_config_value()

void ini_free_bin_config_value ( char * bin)

Free binary buffer.

Free binary value returned by ini_get_bin_config_value().

Parameters
[in]binBinary buffer to free.

◆ ini_get_string_config_array()

char ** ini_get_string_config_array ( struct value_obj * vo,
const char * sep,
int * size,
int * error )

Convert value to an array of strings.

This is a conversion function. It converts the value read from the INI file and stored in the configuration value object into an array of strings. Any of the conversion functions can be used to try to convert the value stored as a string inside the value object. The result can be different depending upon how the caller tries to interpret the value.

Separator string includes up to three different separators. If separator NULL, comma is assumed. The spaces are trimmed automatically around separators in the string. The function drops empty tokens from the list. This means that the string like this: "apple, ,banana, ,orange ," will be translated into the list of three items: "apple","banana" and "orange".

The length of the allocated array is returned in "size". Size and error parameters can be NULL. Use ini_free_string_config_array() to free the array after use.

The array is always NULL terminated so it is safe not to get size and just loop until array element is NULL.

Parameters
[in]voValue object to interpret. It must be retrieved using ini_get_config_valueobj().
[in]sepString cosisting of separator symbols. For example: ",.;" would mean that comma, dot and semicolon should be treated as separators in the value.
[out]sizeVariable that optionally receives the size of the array.
[out]errorVariable 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.
  • ENOMEM - No memory.
Returns
Array of strings. In case of failure the function returns NULL.

◆ ini_get_raw_string_config_array()

char ** ini_get_raw_string_config_array ( struct value_obj * vo,
const char * sep,
int * size,
int * error )

Convert value to an array of strings.

This is a conversion function. It converts the value read from the INI file and stored in the configuration element into an array of strings. Any of the conversion functions can be used to try to convert the value stored as a string inside the value object. The result can be different depending upon how the caller tries to interpret the value.

Separator string includes up to three different separators. If separator NULL, comma is assumed. The spaces are trimmed automatically around separators in the string. The function does not drop empty tokens from the list. This means that the string like this: "apple, ,banana, ,orange ," will be translated into the list of five items: "apple", "", "banana", "" and "orange".

The length of the allocated array is returned in "size". Size and error parameters can be NULL. Use ini_free_string_config_array() to free the array after use.

The array is always NULL terminated so it is safe not to get size and just loop until array element is NULL.

Parameters
[in]voValue object to interpret. It must be retrieved using ini_get_config_valueobj().
[in]sepString cosisting of separator symbols. For example: ",.;" would mean that comma, dot and semicolon should be treated as separators in the value.
[out]sizeVariable that optionally receives the size of the array.
[out]errorVariable 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.
  • ENOMEM - No memory.
Returns
Array of strings. In case of failure the function returns NULL.

◆ ini_get_long_config_array()

long * ini_get_long_config_array ( struct value_obj * vo,
int * size,
int * error )

Convert value to an array of long values.

This is a conversion function. It converts the value read from the INI file and stored in the configuration element into an array of long values. Any of the conversion functions can be used to try to convert the value stored as a string inside the value object. The result can be different depending upon how the caller tries to interpret the value.

Separators inside the string are detected automatically. The spaces are trimmed automatically around separators in the string.

The length of the allocated array is returned in "size". Size parameter can't be NULL.

Use ini_free_long_config_array() to free the array after use.

Parameters
[in]voValue object to interpret. It must be retrieved using ini_get_config_valueobj().
[out]sizeVariable that receives the size of the array.
[out]errorVariable 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.
  • ERANGE - Value is out of range.
  • ENOMEM - No memory.
Returns
Array of long values. In case of failure the function returns NULL.

◆ ini_get_double_config_array()

double * ini_get_double_config_array ( struct value_obj * vo,
int * size,
int * error )

Convert value to an array of floating point values.

This is a conversion function. It converts the value read from the INI file and stored in the configuration element into an array of floating point values. Any of the conversion functions can be used to try to convert the value stored as a string inside the value object. The result can be different depending upon how the caller tries to interpret the value.

Separators inside the string are detected automatically. The spaces are trimmed automatically around separators in the string.

The length of the allocated array is returned in "size". Size parameter can't be NULL.

Use ini_free_double_config_array() to free the array after use.

Parameters
[in]voValue object to interpret. It must be retrieved using ini_get_config_valueobj().
[out]sizeVariable that receives the size of the array.
[out]errorVariable 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.
  • ENOMEM - No memory.
Returns
Array of floating point values. In case of failure the function returns NULL.

◆ ini_free_string_config_array()

void ini_free_string_config_array ( char ** str_config)

Free array of string values.

Use this function to free the array returned by ini_get_string_config_array() or by ini_get_raw_string_config_array().

Parameters
[in]str_configArray of string values.

◆ ini_free_long_config_array()

void ini_free_long_config_array ( long * array)

Free array of long values.

Use this function to free the array returned by ini_get_long_config_array().

Parameters
[in]arrayArray of long values.

◆ ini_free_double_config_array()

void ini_free_double_config_array ( double * array)

Free array of floating pointer values.

Use this function to free the array returned by ini_get_double_config_array().

Parameters
[in]arrayArray of floating pointer values.

◆ ini_errobj_create()

int ini_errobj_create ( struct ini_errobj ** _errobj)

Create structure to hold error messages.

This function initiates structure that can be used to hold error messages from generators. To add messages to the structure use ini_errobj_add_msg.

Parameters
[out]_errobjcontainer for errors.
Returns
Zero on success, nonzero value in case of error.

◆ ini_errobj_destroy()

void ini_errobj_destroy ( struct ini_errobj ** errobj)

Free structure that holds error messages.

This function is used to free structure previously created by ini_errobj_create.

Parameters
[in]errobjcontainer for errors.

◆ ini_errobj_add_msg()

int ini_errobj_add_msg ( struct ini_errobj * errobj,
const char * format,
... )

Add new printf formated message to errobj.

This function initiates structure that can be used to hold error messages from generators. To add messages to the structure use ini_errobj_add_msg.

Parameters
[in]errobjcontainer for errors previously created by ini_errobj_create.
[in]formatprintf format string
Returns
Zero on success, nonzero value in case of error.

◆ ini_errobj_reset()

int void ini_errobj_reset ( struct ini_errobj * errobj)

Reset iterator in errobj.

After calling this function, the iterator in errobj will point to the first error message. Use this if you need to accesss the list multiple times in a loop.

Parameters
[in]errobjcontainer for errors previously created by ini_errobj_create.

◆ ini_errobj_get_msg()

const char * ini_errobj_get_msg ( struct ini_errobj * errobj)

Get pointer to current message in errobj.

This function returns pointer to current message pointed by the internal iterator. The returned string can not be changed and will point to valid data only until ini_errobj_destroy is called.

Parameters
[in]errobjcontainer for errors previously created by ini_errobj_create.
Returns
String inside the errobj structure. String is valid until errobj is destroyed.

◆ ini_errobj_next()

void ini_errobj_next ( struct ini_errobj * errobj)

Move to the next message in errobj.

This function moves the internal iterator of errobj to the next message in list.

Parameters
[in]errobjcontainer for errors previously created by ini_errobj_create.

◆ ini_errobj_no_more_msgs()

int ini_errobj_no_more_msgs ( struct ini_errobj * errobj)

Check if errobj has more messages.

This function returns true if errobj's internal iterator reached end of list and no longer points to a message

Parameters
[in]errobjcontainer for errors previously created by ini_errobj_create.
Returns
True if internal iterator reached end of list.

◆ ini_errobj_count()

size_t ini_errobj_count ( struct ini_errobj * errobj)

Return number of messages in errobj.

This function returns number of messages inside errobj

Parameters
[in]errobjcontainer for errors previously created by ini_errobj_create.
Returns
Number of messages stored in errobj.

◆ ini_rules_read_from_file()

int ini_rules_read_from_file ( const char * filename,
struct ini_cfgobj ** _rules_obj )

Read rules from INI file.

This function is used to read rules from INI file and store them in config object. This special config object is passed to ini_rules_check together with config object representing the configuration that will be checked.

Parameters
[in]filenameName of file with rules
[out]_rules_objconfig object representing the rules
Returns
Zero on success. Non zero value on error.

◆ ini_rules_check()

int ini_rules_check ( struct ini_cfgobj * rules_obj,
struct ini_cfgobj * config_obj,
struct ini_validator ** extra_validators,
struct ini_errobj * errobj )

Check configuration file using rules.

This function is used to check if configuration file applies to rules previously loaded by ini_rules_read_from_file. Any errors detected in the configuration are stored in the errobj structure. Error code returned by this function indicates some internal error with validators or memory allocation error (not rule violation).

Parameters
[in]rules_objconfig object representing the rules
[in]config_objconfig object representing the configuration
[in]extra_validatorsNULL terminated array of external validators. Can be NULL if no external validators are used.
[in]errobjerrobj to store generated errors from validators.
Returns
Zero on success. Non zero value on error.

◆ ini_rules_destroy()

void ini_rules_destroy ( struct ini_cfgobj * ini_config)

Free the rules.

This function is just wrapper around ini_config_destroy