# Miscenalleous: logs, version strings, config storage

## Typedefs
typedef struct _LpConfig | LpConfig
## Functions
void | linphone_core_enable_logs (FILE *file)
void | linphone_core_enable_logs_with_cb (OrtpLogFunc logfunc)
void | linphone_core_disable_logs ()
const char * | linphone_core_get_version (void)
void | linphone_core_set_user_agent (const char *name, const char *ver)
LpConfig * | linphone_core_get_config (LinphoneCore *lc)
const char * | lp_config_get_string (LpConfig *lpconfig, const char *section, const char *key, const char *default_string)
int | lp_config_get_int (LpConfig *lpconfig, const char *section, const char *key, int default_value)
float | lp_config_get_float (LpConfig *lpconfig, const char *section, const char *key, float default_value)
void | lp_config_set_string (LpConfig *lpconfig, const char *section, const char *key, const char *value)
void | lp_config_set_int (LpConfig *lpconfig, const char *section, const char *key, int value)
int | lp_config_sync (LpConfig *lpconfig)
int | lp_config_has_section (LpConfig *lpconfig, const char *section)
void | lp_config_clean_section (LpConfig *lpconfig, const char *section)

## Typedef Documentation

typedef struct _LpConfig LpConfig

The LpConfig object is used to manipulate a configuration file.

The format of the configuration file is a .ini like format:

- sections are defined in []
- each section contains a sequence of key=value pairs.

Example:

     [sound]
     echocanceler=1
     playback_dev=ALSA: Default device

     [video]
     enabled=1

## Function Documentation

void linphone_core_enable_logs | ( | FILE * | file | ) |

Enable logs in supplied FILE*.

Parameters:

  | file | a C FILE* where to fprintf logs. If null stdout is used.

void linphone_core_enable_logs_with_cb | ( | OrtpLogFunc | logfunc | ) |

Enable logs through the user's supplied log callback.

Parameters:

  | logfunc | The address of a OrtpLogFunc callback whose protoype is typedef void (*OrtpLogFunc)(OrtpLogLevel lev, const char *fmt, va_list args);

void linphone_core_disable_logs | ( | void |  | ) |

Entirely disable logging.

const char* linphone_core_get_version | ( | void |  | ) |

Returns liblinphone's version as a string.

void linphone_core_set_user_agent | ( | const char * | name,
|  | const char * | ver |
| ) |  |  |

Sets the user agent string used in SIP messages.

LpConfig* linphone_core_get_config | ( | LinphoneCore * | lc | ) | `[read]`

Returns the LpConfig object used to manage the storage (config) file.

The application can use the LpConfig object to insert its own private sections and pairs of key=value in the configuration file.

const char* lp_config_get_string | ( | LpConfig * | lpconfig,
|  | const char * | section,
|  | const char * | key,
|  | const char * | default_string |
| ) |  |  |

Retrieves a configuration item as a string, given its section, key, and default value.

The default value string is returned if the config item isn't found.

int lp_config_get_int | ( | LpConfig * | lpconfig,
|  | const char * | section,
|  | const char * | key,
|  | int | default_value |
| ) |  |  |

Retrieves a configuration item as an integer, given its section, key, and default value.

The default integer value is returned if the config item isn't found.

float lp_config_get_float | ( | LpConfig * | lpconfig,
|  | const char * | section,
|  | const char * | key,
|  | float | default_value |
| ) |  |  |

Retrieves a configuration item as a float, given its section, key, and default value.

The default float value is returned if the config item isn't found.

void lp_config_set_string | ( | LpConfig * | lpconfig,
|  | const char * | section,
|  | const char * | key,
|  | const char * | value |
| ) |  |  |

Sets a string config item

void lp_config_set_int | ( | LpConfig * | lpconfig,
|  | const char * | section,
|  | const char * | key,
|  | int | value |
| ) |  |  |

Sets an integer config item

int lp_config_sync | ( | LpConfig * | lpconfig | ) |

Writes the config file to disk.

int lp_config_has_section | ( | LpConfig * | lpconfig,
|  | const char * | section |
| ) |  |  |

Returns 1 if a given section is present in the configuration.

void lp_config_clean_section | ( | LpConfig * | lpconfig,
|  | const char * | section |
| ) |  |  |

Removes every pair of key,value in a section and remove the section.