xine-lib 1.2.13-20230125hg15249
Data Structures | Macros | Functions | Variables
configfile.c File Reference
#include <errno.h>
#include <time.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <xine/configfile.h>
#include "bswap.h"
#include <xine/xineutils.h>
#include <xine/sorted_array.h>
#include <xine/xine_internal.h>
#include "xine_private.h"

Data Structures

struct  fat_cfg_entry_t
 
struct  very_fat_cfg_entry_t
 
struct  fat_config_values_t
 
struct  _cfg_cb_info_t
 
struct  _cfg_cb_relay_t
 

Macros

#define LOG_MODULE   "configfile"
 
#define LOG_VERBOSE
 
#define SINGLE_CHUNK_ENUMS
 
#define MAX_SORT_KEY   320
 
#define PSEP   '/'
 
#define STRING_BACKLOG_LD   2
 
#define _CFG_DUMMY_DATA   (void *)1
 
#define _CFG_BIT_HAS_CALLBACKS   30
 
#define FIND_ONLY   0x7fffffff
 
#define _MAX_CFG_KEY   320
 
#define XCF_HAVE_BACKUP   1
 
#define XCF_HAVE_FILE   2
 
#define XCF_HAVE_TFILE   4
 
#define XCF_HAVE_ITEMS   8
 
#define XCS_BUF_SIZE   4096
 
#define get_string(s, len)
 

Functions

static void _config_set_fat_entry (fat_cfg_entry_t *entry)
 
static int _config_is_fat_entry (fat_cfg_entry_t *entry)
 
static void _cfg_relay (void *data, xine_cfg_entry_t *e)
 
static int _cfg_cb_clear (cfg_entry_t *entry)
 
static int _cfg_cb_clear_report (xine_t *xine, cfg_entry_t *entry)
 
static int _cfg_cb_d_rem (cfg_entry_t *entry, xine_config_cb_t callback, void *data, size_t data_size)
 
static int _cfg_cb_rem (cfg_entry_t *entry, xine_config_cb_t callback)
 
static int _cfg_d_rem (cfg_entry_t *entry, void *data, size_t data_size)
 
static int _cfg_any_rem (cfg_entry_t *entry, xine_config_cb_t callback, void *data, size_t data_size)
 
static void _cfg_cb_add (cfg_entry_t *entry, xine_config_cb_t callback, void *data)
 
static const char * config_xlate_old (const char *s)
 
static int config_section_enum (const uint8_t *s, uint32_t l)
 
static size_t config_make_sort_key (char *dest, const char *key, int *klen, int exp_level)
 
static int config_validate (config_values_t *this_gen)
 
static fat_cfg_entry_tconfig_insert (config_values_t *this_gen, const char *key, int exp_level)
 
static const char * config_xlate_internal (const char *key, const xine_config_entry_translation_t *trans)
 
static const char * config_translate_key (const char *key, char *tmp, size_t klen)
 
static cfg_entry_tconfig_lookup_entry_int (config_values_t *this, const char *key)
 
static char ** str_array_dup (const char *const *from, uint32_t *n)
 
static char ** str_array_ldup (const char *const *from, const uint32_t *len, uint32_t n)
 
static void str_array_free (char **a)
 
static cfg_entry_tconfig_lookup_entry (config_values_t *this, const char *key)
 
static cfg_entry_tconfig_lookup_entry_safe (config_values_t *this, const char *key)
 
static char * config_lookup_string (config_values_t *this, const char *key)
 
static void config_free_string (config_values_t *this, char **str)
 
static int config_lookup_num (config_values_t *this, const char *key, int def_value)
 
static void config_reset_value (fat_cfg_entry_t *entry)
 
static void config_shallow_copy (xine_cfg_entry_t *dest, const cfg_entry_t *src)
 
static void config_new_entry (config_values_t *this, cfg_entry_t *entry)
 
static cfg_entry_tconfig_register_key (config_values_t *this, const char *key, int exp_level, xine_config_cb_t changed_cb, void *cb_data, const char *description, const char *help)
 
static char * config_register_filename (config_values_t *this, const char *key, const char *def_value, int req_type, const char *description, const char *help, int exp_level, xine_config_cb_t changed_cb, void *cb_data)
 
static char * config_register_string (config_values_t *this, const char *key, const char *def_value, const char *description, const char *help, int exp_level, xine_config_cb_t changed_cb, void *cb_data)
 
static int config_register_num (config_values_t *this, const char *key, int def_value, const char *description, const char *help, int exp_level, xine_config_cb_t changed_cb, void *cb_data)
 
static int config_register_bool (config_values_t *this, const char *key, int def_value, const char *description, const char *help, int exp_level, xine_config_cb_t changed_cb, void *cb_data)
 
static int config_register_range (config_values_t *this, const char *key, int def_value, int min, int max, const char *description, const char *help, int exp_level, xine_config_cb_t changed_cb, void *cb_data)
 
static int config_parse_enum (const char *str, const char **values)
 
static int config_register_enum (config_values_t *this, const char *key, int def_value, char **values, const char *description, const char *help, int exp_level, xine_config_cb_t changed_cb, void *cb_data)
 
static void config_update_num_e (cfg_entry_t *entry, int value)
 
static void config_update_num (config_values_t *this, const char *key, int value)
 
static void config_update_string_e (cfg_entry_t *entry, const char *value)
 
static void config_update_string (config_values_t *this, const char *key, const char *value)
 
void xine_config_set_translation_user (const xine_config_entry_translation_t *xlate)
 
void xine_config_load (xine_t *xine, const char *filename)
 
static size_t xine_realpath (char *buf, const char *filename, size_t bsize, int *num_links)
 
void xine_config_save (xine_t *xine, const char *filename)
 
static void config_dispose (config_values_t *this_gen)
 
static void config_unregister_cb (config_values_t *this, const char *key)
 
static int config_unregister_callbacks (config_values_t *this, const char *key, xine_config_cb_t changed_cb, void *cb_data, size_t cb_data_size)
 
void _x_config_unregister_cb_class_d (config_values_t *this, void *callback_data)
 
void _x_config_unregister_cb_class_p (config_values_t *this, xine_config_cb_t callback)
 
static void config_set_new_entry_callback (config_values_t *this, xine_config_cb_t new_entry_cb, void *cbdata)
 
static void config_unset_new_entry_callback (config_values_t *this)
 
static void put_int (uint8_t **dest, int value)
 
static void put_string (uint8_t **dest, const char *value, uint32_t value_len)
 
static char * config_get_serialized_entry (config_values_t *this, const char *key)
 
static char * config_register_serialized_entry (config_values_t *this, const char *value)
 
static unsigned int _config_fat_entry_hash (void *a)
 
static int _config_fat_entry_cmp (void *a, void *b)
 
config_values_t_x_config_init (void)
 allocate and init a new xine config object
 
int _x_config_change_opt (config_values_t *config, const char *opt)
 interpret stream_setup part of mrls for config value changes
 

Variables

static const xine_config_entry_translation_tconfig_entry_translation_user = NULL
 

Macro Definition Documentation

◆ _CFG_BIT_HAS_CALLBACKS

#define _CFG_BIT_HAS_CALLBACKS   30

◆ _CFG_DUMMY_DATA

#define _CFG_DUMMY_DATA   (void *)1

◆ _MAX_CFG_KEY

#define _MAX_CFG_KEY   320

◆ FIND_ONLY

#define FIND_ONLY   0x7fffffff

◆ get_string

#define get_string ( s,
len )
Value:
{ \
len = _X_LE_32 (p); p[0] = 0; p += 4; \
if (len > left) \
break; \
left -= len; \
s = (char *)p; p += len; \
}
#define _X_LE_32(x)
Definition bswap.h:63

◆ LOG_MODULE

#define LOG_MODULE   "configfile"

◆ LOG_VERBOSE

#define LOG_VERBOSE

◆ MAX_SORT_KEY

#define MAX_SORT_KEY   320

◆ PSEP

#define PSEP   '/'

Referenced by xine_realpath().

◆ SINGLE_CHUNK_ENUMS

#define SINGLE_CHUNK_ENUMS

◆ STRING_BACKLOG_LD

#define STRING_BACKLOG_LD   2

<< xine_fast_string_t *

Referenced by config_insert(), config_reset_value(), and config_update_string_e().

◆ XCF_HAVE_BACKUP

#define XCF_HAVE_BACKUP   1

◆ XCF_HAVE_FILE

#define XCF_HAVE_FILE   2

◆ XCF_HAVE_ITEMS

#define XCF_HAVE_ITEMS   8

◆ XCF_HAVE_TFILE

#define XCF_HAVE_TFILE   4

◆ XCS_BUF_SIZE

#define XCS_BUF_SIZE   4096

Function Documentation

◆ _cfg_any_rem()

static int _cfg_any_rem ( cfg_entry_t * entry,
xine_config_cb_t callback,
void * data,
size_t data_size )
static

◆ _cfg_cb_add()

static void _cfg_cb_add ( cfg_entry_t * entry,
xine_config_cb_t callback,
void * data )
static

◆ _cfg_cb_clear()

static int _cfg_cb_clear ( cfg_entry_t * entry)
static

◆ _cfg_cb_clear_report()

static int _cfg_cb_clear_report ( xine_t * xine,
cfg_entry_t * entry )
static

◆ _cfg_cb_d_rem()

static int _cfg_cb_d_rem ( cfg_entry_t * entry,
xine_config_cb_t callback,
void * data,
size_t data_size )
static

◆ _cfg_cb_rem()

static int _cfg_cb_rem ( cfg_entry_t * entry,
xine_config_cb_t callback )
static

◆ _cfg_d_rem()

static int _cfg_d_rem ( cfg_entry_t * entry,
void * data,
size_t data_size )
static

◆ _cfg_relay()

static void _cfg_relay ( void * data,
xine_cfg_entry_t * e )
static

◆ _config_fat_entry_cmp()

static int _config_fat_entry_cmp ( void * a,
void * b )
static

◆ _config_fat_entry_hash()

static unsigned int _config_fat_entry_hash ( void * a)
static

◆ _config_is_fat_entry()

static int _config_is_fat_entry ( fat_cfg_entry_t * entry)
static

◆ _config_set_fat_entry()

static void _config_set_fat_entry ( fat_cfg_entry_t * entry)
static

◆ _x_config_change_opt()

int _x_config_change_opt ( config_values_t * config,
const char * opt )

◆ _x_config_init()

config_values_t * _x_config_init ( void )

◆ _x_config_unregister_cb_class_d()

void _x_config_unregister_cb_class_d ( config_values_t * config,
void * callback_data )

deprecated in favour of config_values_t->unregister_callbacks ().

References _cfg_d_rem(), and _x_assert.

◆ _x_config_unregister_cb_class_p()

void _x_config_unregister_cb_class_p ( config_values_t * this,
xine_config_cb_t callback )

References _cfg_cb_rem(), and _x_assert.

◆ config_dispose()

static void config_dispose ( config_values_t * this_gen)
static

◆ config_free_string()

static void config_free_string ( config_values_t * this,
char ** str )
static

References _x_freep().

Referenced by _x_config_init().

◆ config_get_serialized_entry()

static char * config_get_serialized_entry ( config_values_t * this,
const char * key )
static

◆ config_insert()

static fat_cfg_entry_t * config_insert ( config_values_t * this_gen,
const char * key,
int exp_level )
static

◆ config_lookup_entry()

static cfg_entry_t * config_lookup_entry ( config_values_t * this,
const char * key )
static

◆ config_lookup_entry_int()

static cfg_entry_t * config_lookup_entry_int ( config_values_t * this,
const char * key )
static

◆ config_lookup_entry_safe()

static cfg_entry_t * config_lookup_entry_safe ( config_values_t * this,
const char * key )
static

◆ config_lookup_num()

static int config_lookup_num ( config_values_t * this,
const char * key,
int def_value )
static

◆ config_lookup_string()

static char * config_lookup_string ( config_values_t * this,
const char * key )
static

◆ config_make_sort_key()

static size_t config_make_sort_key ( char * dest,
const char * key,
int * klen,
int exp_level )
static

◆ config_new_entry()

static void config_new_entry ( config_values_t * this,
cfg_entry_t * entry )
static

◆ config_parse_enum()

static int config_parse_enum ( const char * str,
const char ** values )
static

◆ config_register_bool()

static int config_register_bool ( config_values_t * this,
const char * key,
int def_value,
const char * description,
const char * help,
int exp_level,
xine_config_cb_t changed_cb,
void * cb_data )
static

◆ config_register_enum()

static int config_register_enum ( config_values_t * this,
const char * key,
int def_value,
char ** values,
const char * description,
const char * help,
int exp_level,
xine_config_cb_t changed_cb,
void * cb_data )
static

◆ config_register_filename()

static char * config_register_filename ( config_values_t * this,
const char * key,
const char * def_value,
int req_type,
const char * description,
const char * help,
int exp_level,
xine_config_cb_t changed_cb,
void * cb_data )
static

◆ config_register_key()

static cfg_entry_t * config_register_key ( config_values_t * this,
const char * key,
int exp_level,
xine_config_cb_t changed_cb,
void * cb_data,
const char * description,
const char * help )
static

◆ config_register_num()

static int config_register_num ( config_values_t * this,
const char * key,
int def_value,
const char * description,
const char * help,
int exp_level,
xine_config_cb_t changed_cb,
void * cb_data )
static

◆ config_register_range()

static int config_register_range ( config_values_t * this,
const char * key,
int def_value,
int min,
int max,
const char * description,
const char * help,
int exp_level,
xine_config_cb_t changed_cb,
void * cb_data )
static

◆ config_register_serialized_entry()

static char * config_register_serialized_entry ( config_values_t * this,
const char * value )
static

◆ config_register_string()

static char * config_register_string ( config_values_t * this,
const char * key,
const char * def_value,
const char * description,
const char * help,
int exp_level,
xine_config_cb_t changed_cb,
void * cb_data )
static

◆ config_reset_value()

static void config_reset_value ( fat_cfg_entry_t * entry)
static

◆ config_section_enum()

static int config_section_enum ( const uint8_t * s,
uint32_t l )
static

◆ config_set_new_entry_callback()

static void config_set_new_entry_callback ( config_values_t * this,
xine_config_cb_t new_entry_cb,
void * cbdata )
static

Referenced by _x_config_init().

◆ config_shallow_copy()

static void config_shallow_copy ( xine_cfg_entry_t * dest,
const cfg_entry_t * src )
static

◆ config_translate_key()

static const char * config_translate_key ( const char * key,
char * tmp,
size_t klen )
static

◆ config_unregister_callbacks()

static int config_unregister_callbacks ( config_values_t * this,
const char * key,
xine_config_cb_t changed_cb,
void * cb_data,
size_t cb_data_size )
static

◆ config_unregister_cb()

static void config_unregister_cb ( config_values_t * this,
const char * key )
static

◆ config_unset_new_entry_callback()

static void config_unset_new_entry_callback ( config_values_t * this)
static

References NULL.

Referenced by _x_config_init().

◆ config_update_num()

static void config_update_num ( config_values_t * this,
const char * key,
int value )
static

◆ config_update_num_e()

static void config_update_num_e ( cfg_entry_t * entry,
int value )
static

◆ config_update_string()

static void config_update_string ( config_values_t * this,
const char * key,
const char * value )
static

◆ config_update_string_e()

static void config_update_string_e ( cfg_entry_t * entry,
const char * value )
static

◆ config_validate()

static int config_validate ( config_values_t * this_gen)
static

◆ config_xlate_internal()

static const char * config_xlate_internal ( const char * key,
const xine_config_entry_translation_t * trans )
static

◆ config_xlate_old()

static const char * config_xlate_old ( const char * s)
static

References NULL.

Referenced by config_translate_key().

◆ put_int()

static void put_int ( uint8_t ** dest,
int value )
static

◆ put_string()

static void put_string ( uint8_t ** dest,
const char * value,
uint32_t value_len )
static

References put_int().

Referenced by config_get_serialized_entry().

◆ str_array_dup()

static char ** str_array_dup ( const char *const * from,
uint32_t * n )
static

◆ str_array_free()

static void str_array_free ( char ** a)
static

◆ str_array_ldup()

static char ** str_array_ldup ( const char *const * from,
const uint32_t * len,
uint32_t n )
static

◆ xine_config_load()

void xine_config_load ( xine_t * xine,
const char * filename )

◆ xine_config_save()

void xine_config_save ( xine_t * xine,
const char * filename )

◆ xine_config_set_translation_user()

void xine_config_set_translation_user ( const xine_config_entry_translation_t * xlate)

◆ xine_realpath()

static size_t xine_realpath ( char * buf,
const char * filename,
size_t bsize,
int * num_links )
static

References PSEP, S_ISLNK, and xine_small_memcpy.

Referenced by xine_config_save().

Variable Documentation

◆ config_entry_translation_user

const xine_config_entry_translation_t* config_entry_translation_user = NULL
static