liblinphone  3.6.1
Typedefs | Functions
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 (LinphoneCore *lc, const char *name, const char *ver)
 
LpConfiglinphone_core_get_config (LinphoneCore *lc)
 
void linphone_core_set_log_handler (OrtpLogFunc logfunc)
 
void linphone_core_set_log_file (FILE *file)
 
void linphone_core_set_log_level (OrtpLogLevel loglevel)
 
int linphone_dial_plan_lookup_ccc_from_iso (const char *iso)
 
int linphone_dial_plan_lookup_ccc_from_e164 (const char *e164)
 
LpConfiglp_config_new (const char *filename)
 
LpConfiglp_config_new_with_factory (const char *config_filename, const char *factory_config_filename)
 
const char * lp_config_get_string (const LpConfig *lpconfig, const char *section, const char *key, const char *default_string)
 
bool_t lp_config_get_range (const LpConfig *lpconfig, const char *section, const char *key, int *min, int *max, int default_min, int default_max)
 
int lp_config_get_int (const LpConfig *lpconfig, const char *section, const char *key, int default_value)
 
int64_t lp_config_get_int64 (const LpConfig *lpconfig, const char *section, const char *key, int64_t default_value)
 
float lp_config_get_float (const 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_range (LpConfig *lpconfig, const char *section, const char *key, int min_value, int max_value)
 
void lp_config_set_int (LpConfig *lpconfig, const char *section, const char *key, int value)
 
void lp_config_set_int_hex (LpConfig *lpconfig, const char *section, const char *key, int value)
 
void lp_config_set_int64 (LpConfig *lpconfig, const char *section, const char *key, int64_t value)
 
void lp_config_set_float (LpConfig *lpconfig, const char *section, const char *key, float value)
 
int lp_config_sync (LpConfig *lpconfig)
 
int lp_config_has_section (const LpConfig *lpconfig, const char *section)
 
void lp_config_clean_section (LpConfig *lpconfig, const char *section)
 
void lp_config_for_each_section (const LpConfig *lpconfig, void(*callback)(const char *section, void *ctx), void *ctx)
 
void lp_config_for_each_entry (const LpConfig *lpconfig, const char *section, void(*callback)(const char *entry, void *ctx), void *ctx)
 

Detailed Description

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:

1 [sound]
2 echocanceler=1
3 playback_dev=ALSA: Default device
4 
5 [video]
6 enabled=1

Function Documentation

void linphone_core_enable_logs ( FILE *  file)

Enable logs in supplied FILE*.

Deprecated:
Use linphone_core_set_log_file and linphone_core_set_log_level instead.
Parameters
filea 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.

Deprecated:
Use linphone_core_set_log_handler and linphone_core_set_log_level instead.
Parameters
logfuncThe 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.

Deprecated:
Use linphone_core_set_log_level instead.
const char* linphone_core_get_version ( void  )

Returns liblinphone's version as a string.

void linphone_core_set_user_agent ( LinphoneCore lc,
const char *  name,
const char *  ver 
)

Sets the user agent string used in SIP messages.

LpConfig* linphone_core_get_config ( LinphoneCore lc)

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.

void linphone_core_set_log_handler ( OrtpLogFunc  logfunc)

Define a log handler.

Parameters
logfuncThe function pointer of the log handler.
void linphone_core_set_log_file ( FILE *  file)

Define a log file.

If the file pointer passed as an argument is NULL, stdout is used instead.

Parameters
fileA pointer to the FILE structure of the file to write to.
void linphone_core_set_log_level ( OrtpLogLevel  loglevel)

Define the log level.

The loglevel parameter is a bitmask parameter. Therefore to enable only warning and error messages, use ORTP_WARNING | ORTP_ERROR. To disable logs, simply set loglevel to 0.

Parameters
loglevelA bitmask of the log levels to set.
int linphone_dial_plan_lookup_ccc_from_iso ( const char *  iso)

Function to get call country code from ISO 3166-1 alpha-2 code, ex: FR returns 33

Parameters
isocountry code alpha2
Returns
call country code or -1 if not found
int linphone_dial_plan_lookup_ccc_from_e164 ( const char *  e164)

Function to get call country code from an e164 number, ex: +33952650121 will return 33

Parameters
e164phone number
Returns
call country code or -1 if not found
LpConfig* lp_config_new ( const char *  filename)

Instantiates a LpConfig object from a user config file.

Parameters
filenamethe filename of the config file to read to fill the instantiated LpConfig
See also
lp_config_new_with_factory
LpConfig* lp_config_new_with_factory ( const char *  config_filename,
const char *  factory_config_filename 
)

Instantiates a LpConfig object from a user config file and a factory config file.

Parameters
config_filenamethe filename of the user config file to read to fill the instantiated LpConfig
factory_config_filenamethe filename of the factory config file to read to fill the instantiated LpConfig
See also
lp_config_new

The user config file is read first to fill the LpConfig and then the factory config file is read. Therefore the configuration parameters defined in the user config file will be overwritten by the parameters defined in the factory config file.

const char* lp_config_get_string ( const 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.

bool_t lp_config_get_range ( const LpConfig lpconfig,
const char *  section,
const char *  key,
int *  min,
int *  max,
int  default_min,
int  default_max 
)

Retrieves a configuration item as a range, given its section, key, and default min and max values.

Returns
TRUE if the value is successfully parsed as a range, FALSE otherwise. If FALSE is returned, min and max are filled respectively with default_min and default_max values.
int lp_config_get_int ( const 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.

int64_t lp_config_get_int64 ( const LpConfig lpconfig,
const char *  section,
const char *  key,
int64_t  default_value 
)

Retrieves a configuration item as a 64 bit 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 ( const 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_range ( LpConfig lpconfig,
const char *  section,
const char *  key,
int  min_value,
int  max_value 
)

Sets a range config item

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

Sets an integer config item

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

Sets an integer config item, but store it as hexadecimal

void lp_config_set_int64 ( LpConfig lpconfig,
const char *  section,
const char *  key,
int64_t  value 
)

Sets a 64 bits integer config item

void lp_config_set_float ( LpConfig lpconfig,
const char *  section,
const char *  key,
float  value 
)

Sets a float config item

int lp_config_sync ( LpConfig lpconfig)

Writes the config file to disk.

int lp_config_has_section ( const 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.

void lp_config_for_each_section ( const LpConfig lpconfig,
void(*)(const char *section, void *ctx)  callback,
void *  ctx 
)

Call a function for each section present in the configuration.

void lp_config_for_each_entry ( const LpConfig lpconfig,
const char *  section,
void(*)(const char *entry, void *ctx)  callback,
void *  ctx 
)

Call a function for each entry present in a section configuration.