Go to the documentation of this file.
23 #ifndef LIBVLC_VARIABLES_H
24 # define LIBVLC_VARIABLES_H 1
26 # include <stdalign.h>
60 # define vlc_internals( obj ) (((vlc_object_internals_t*)(VLC_OBJECT(obj)))-1)
61 # define vlc_externals( priv ) ((vlc_object_t *)((priv) + 1))
void(* pf_free)(vlc_value_t *)
Definition: variables.c:59
static int CmpBool(vlc_value_t v, vlc_value_t w)
Definition: variables.c:104
vlc_callback_t pf_value_callback
Definition: variables.c:90
static void TriggerListCallback(vlc_object_t *obj, variable_t *var, const char *name, int action, vlc_value_t *val)
Definition: variables.c:258
static void DelCallback(vlc_object_t *p_this, const char *psz_name, callback_entry_t entry, vlc_callback_type_t i_type)
Definition: variables.c:885
static size_t read_mpi(uint8_t *dst, const uint8_t *buf, size_t buflen, size_t bits)
Definition: update_crypto.c:75
size_t count
Definition: core.c:461
static int varcmp(const void *a, const void *b)
Definition: variables.c:142
int i_type
The type of the variable.
Definition: variables.c:84
struct signature_packet_t::@61::@63 v4
int(* pf_cmp)(vlc_value_t, vlc_value_t)
Definition: variables.c:57
#define CRC24_POLY
Definition: update_crypto.c:351
callback_entry_t * p_entries
Definition: variables.c:65
char ** var_GetAllNames(vlc_object_t *obj)
Return a list of all variable names.
Definition: variables.c:1394
FILE * vlc_fopen(const char *filename, const char *mode)
Opens a FILE pointer.
Definition: filesystem.c:46
#define VLC_VAR_SETVALUE
Set the value of this variable without triggering any callbacks.
Definition: vlc_variables.h:87
struct public_key_packet_t::@58::@59 dsa
#define VLC_VAR_CLASS
Definition: vlc_variables.h:40
static int vlc_stream_GetSize(stream_t *s, uint64_t *size)
Get the size of the stream.
Definition: vlc_stream.h:313
vlc_object_internals_t * first
Definition: variables.h:52
int var_Inherit(vlc_object_t *p_this, const char *psz_name, int i_type, vlc_value_t *p_val)
Finds the value of a variable.
Definition: variables.c:1171
#define VLC_VAR_CLEARCHOICES
Definition: vlc_variables.h:98
#define packet_header_len(c)
Definition: update_crypto.c:51
public_key_t * download_key(vlc_object_t *p_this, const uint8_t *p_longid, const uint8_t *p_signature_issuer)
Definition: update_crypto.c:929
void var_TriggerCallback(vlc_object_t *p_this, const char *psz_name)
Trigger callback on a variable.
Definition: variables.c:969
VLC list structure.
Definition: vlc_common.h:344
Definition: vlc_fixups.h:497
struct public_key_packet_t::@58::@60 rsa
#define ARRAY_APPEND(array, elem)
Definition: vlc_arrays.h:187
#define VLC_VAR_GETCHOICES
Definition: vlc_variables.h:99
void * p_callback
Definition: variables.c:92
#define VLC_VAR_SETTEXT
Definition: vlc_variables.h:89
#define vlc_internals(obj)
Definition: variables.h:59
int32_t x
Definition: vlc_common.h:337
size_t vlc_b64_decode_binary_to_buffer(uint8_t *p_dst, size_t i_dst, const char *p_src)
Definition: strings.c:404
char * psz_text
The variable display name, mainly for use by the interfaces.
Definition: variables.c:80
static variable_t * Lookup(vlc_object_t *obj, const char *psz_name)
Definition: variables.c:151
vlc_mutex_t tree_lock
Definition: variables.h:53
struct callback_entry_t callback_entry_t
struct vlc_res * resources
Definition: variables.h:56
vlc_mutex_t var_lock
Definition: variables.h:42
#define VLC_VAR_DOINHERIT
Creation flag.
Definition: vlc_variables.h:69
void * tdelete(const void *key, void **rootp, int(*cmp)(const void *, const void *))
vlc_destructor_t pf_destructor
Definition: variables.h:47
int var_GetChecked(vlc_object_t *p_this, const char *psz_name, int expected_type, vlc_value_t *p_val)
Definition: variables.c:779
unsigned i_usage
Reference count.
Definition: variables.c:85
static const struct variable_ops_t addr_ops
Definition: variables.c:135
void * var_root
Definition: variables.h:41
static int CmpString(vlc_value_t v, vlc_value_t w)
Definition: variables.c:114
#define VLC_VAR_ADDCHOICE
Definition: vlc_variables.h:96
int config_GetType(const char *psz_name)
Definition: core.c:52
bool b_incallback
Set to TRUE if the variable is in a callback.
Definition: variables.c:96
int var_GetAndSet(vlc_object_t *p_this, const char *psz_name, int i_action, vlc_value_t *p_val)
Perform a Get and Set on a variable.
Definition: variables.c:629
union signature_packet_t::@62 algo_specific
void() var_Destroy(vlc_object_t *p_this, const char *psz_name)
Destroy a vlc variable.
Definition: variables.c:396
struct callback_table_t callback_table_t
vlc_list_t choices_text
List of friendly names for the choices.
Definition: variables.c:93
static int verify_signature_dsa(signature_packet_t *sign, public_key_packet_t *p_key, uint8_t *p_hash)
Definition: update_crypto.c:518
void * p_address
Definition: vlc_common.h:335
int parse_public_key(const uint8_t *p_key_data, size_t i_key_len, public_key_t *p_key, const uint8_t *p_sig_issuer)
Definition: update_crypto.c:604
int var_Get(vlc_object_t *p_this, const char *psz_name, vlc_value_t *p_val)
Get a variable's value.
Definition: variables.c:817
#define VLC_VAR_BOOL
Definition: vlc_variables.h:49
uint8_t issuer_longid[8]
Definition: update.h:81
#define VLC_VAR_DELCHOICE
Definition: vlc_variables.h:97
uint8_t timestamp[4]
Definition: update.h:53
Definition: variables.c:44
#define msg_Dbg(p_this,...)
Definition: vlc_messages.h:86
int var_Type(vlc_object_t *p_this, const char *psz_name)
Request a variable's type.
Definition: variables.c:698
#define vlc_stream_NewURL(a, b)
Definition: vlc_stream.h:404
Add parameter to an integer value.
Definition: vlc_variables.h:112
static int CmpAddress(vlc_value_t v, vlc_value_t w)
Definition: variables.c:122
static void CleanupVar(void *var)
Definition: variables.c:424
static const struct variable_ops_t int_ops
Definition: variables.c:138
Binary NAND over an integer bits field.
Definition: vlc_variables.h:114
vlc_list_callback_t pf_list_callback
Definition: variables.c:91
Definition: vlc_fixups.h:495
void vlc_cond_broadcast(vlc_cond_t *p_condvar)
Wakes up all threads waiting on a condition variable.
Definition: thread.c:262
public_key_packet_t key
Definition: update.h:121
#define VLC_EGENERIC
Unspecified error.
Definition: vlc_common.h:354
atomic_uint refs
Definition: variables.h:46
#define VLC_VAR_ADDRESS
Definition: vlc_variables.h:53
uint8_t * psz_username
Definition: update.h:119
uint8_t * hash_from_text(const char *psz_string, signature_packet_t *p_sig)
Definition: update_crypto.c:789
Invert a boolean value (param ignored)
Definition: vlc_variables.h:111
#define VLC_VAR_INTEGER
Definition: vlc_variables.h:50
#define VLC_VAR_STRING
Definition: vlc_variables.h:51
static void TriggerCallback(vlc_object_t *obj, variable_t *var, const char *name, vlc_value_t prev)
Definition: variables.c:233
#define VLC_VAR_TYPE
Definition: vlc_variables.h:39
#define VLC_VAR_FLOAT
Definition: vlc_variables.h:52
#define config_GetInt(a, b)
Definition: vlc_configuration.h:142
#define config_GetPsz(a, b)
Definition: vlc_configuration.h:146
int var_Set(vlc_object_t *p_this, const char *psz_name, vlc_value_t val)
Set a variable's value.
Definition: variables.c:773
static int verify_signature_rsa(signature_packet_t *sign, public_key_packet_t *p_key, uint8_t *p_hash)
Definition: update_crypto.c:465
#define var_InheritString(o, n)
Definition: vlc_variables.h:639
static int hash_from_binary_file(const char *psz_file, gcry_md_hd_t hd)
Definition: update_crypto.c:723
pthread_cond_t vlc_cond_t
Condition variable.
Definition: vlc_threads.h:279
bool config_IsSafe(const char *)
Definition: core.c:77
int asprintf(char **, const char *,...)
#define VLC_VAR_GETSTEP
Definition: vlc_variables.h:94
int64_t i_int
Definition: vlc_common.h:331
vlc_value_t max
Definition: variables.c:88
uint8_t digest_algo
Definition: update.h:78
#define VLC_VAR_SETMINMAX
Definition: vlc_variables.h:102
uint8_t * hash_from_public_key(public_key_t *p_pkey)
Definition: update_crypto.c:844
int i_entries
Definition: variables.c:64
static void TwalkGetNames(const void *data, const VISIT which, const int depth)
Definition: variables.c:1381
static void FreeDummy(vlc_value_t *p_val)
Definition: variables.c:130
static long crc_octets(uint8_t *octets, size_t len)
Definition: update_crypto.c:353
#define TAB_ERASE(count, tab, index)
Definition: vlc_arrays.h:77
int(* vlc_list_callback_t)(vlc_object_t *, char const *, int, vlc_value_t *, void *)
Definition: vlc_common.h:373
vlc_object_t * parent
Parent object.
Definition: vlc_common.h:452
int32_t y
Definition: vlc_common.h:337
#define VLC_VAR_VOID
Definition: vlc_variables.h:48
bool b_bool
Definition: vlc_common.h:332
static int CmpFloat(vlc_value_t v, vlc_value_t w)
Definition: variables.c:121
void var_OptionParse(vlc_object_t *p_obj, const char *psz_option, bool trusted)
Parse a stringified option This function parse a string option and create the associated object varia...
Definition: variables.c:1029
char ** var_GetAllNames(vlc_object_t *)
Return a list of all variable names.
Definition: variables.c:1394
static void FreeString(vlc_value_t *p_val)
Definition: variables.c:131
vlc_object_internals_t * prev
Definition: variables.h:51
static size_t parse_signature_v4_packet(signature_packet_t *p_sig, const uint8_t *p_buf, size_t i_sig_len)
Definition: update_crypto.c:179
static const struct variable_ops_t bool_ops
Definition: variables.c:136
vlc_callback_type_t
Definition: variables.c:822
void var_DestroyAll(vlc_object_t *obj)
Definition: variables.c:429
char * psz_name
Definition: variables.h:38
int i_type
Definition: vlc_common.h:346
int i_type
Definition: httpd.c:1252
void(* pf_dup)(vlc_value_t *)
Definition: variables.c:58
#define READ_MPI(d, bits)
Definition: update_crypto.c:94
#define ARRAY_INIT(array)
Definition: vlc_arrays.h:173
struct variable_ops_t variable_ops_t
float f_float
Definition: vlc_common.h:333
vlc_object_internals_t * next
Definition: variables.h:50
Definition: variables.c:824
static const struct variable_ops_t void_ops
Definition: variables.c:134
vlc_value_t step
Definition: variables.c:88
callback_table_t list_callbacks
Registered list callbacks.
Definition: variables.c:101
Binary OR over an integer bits field.
Definition: vlc_variables.h:113
Definition: variables.c:825
static uint32_t scalar_number(const uint8_t *p, int header_len)
Definition: update_crypto.c:54
#define VLC_VAR_GETTEXT
Definition: vlc_variables.h:90
#define VLC_VAR_HASCHOICE
Definition: vlc_variables.h:62
vlc_value_t min
If the variable has min/max/step values.
Definition: variables.c:88
uint8_t algo
Definition: update.h:54
struct signature_packet_t::@62::@66 rsa
#define VLC_VAR_CHOICESCOUNT
Definition: vlc_variables.h:101
uint8_t version
Definition: update.h:52
#define TAB_APPEND(count, tab, p)
Definition: vlc_arrays.h:64
#define VLC_VAR_ISCOMMAND
Definition: vlc_variables.h:64
const char * psz_name
Definition: vlc_codecs.h:315
static int parse_signature_packet(signature_packet_t *p_sig, const uint8_t *p_buf, size_t i_packet_len)
Definition: update_crypto.c:275
void var_AddCallback(vlc_object_t *p_this, const char *psz_name, vlc_callback_t pf_callback, void *p_data)
Register a callback in a variable.
Definition: variables.c:875
char * psz_string
Definition: vlc_common.h:334
stream_t definition
Definition: vlc_stream.h:46
#define VLC_VAR_SETSTEP
Definition: vlc_variables.h:80
#define vlc_cleanup_pop()
Unregisters the last cancellation handler.
Definition: vlc_threads.h:983
Definition: vlc_fixups.h:133
#define DECL_ARRAY(type)
Definition: vlc_arrays.h:165
#define VLC_ENOOBJ
Object not found.
Definition: vlc_common.h:358
VISIT
Definition: vlc_fixups.h:493
static void WaitUnused(vlc_object_t *obj, variable_t *var)
Waits until the variable is inactive (i.e.
Definition: variables.c:223
void DumpVariables(vlc_object_t *obj)
Definition: variables.c:1369
char * psz_url
Download URL.
Definition: vlc_update.h:46
static int rsa_pkcs1_encode_sig(gcry_mpi_t *r_result, size_t size, const uint8_t *hash, int algo)
Definition: update_crypto.c:434
ssize_t vlc_stream_Read(stream_t *s, void *buf, size_t len)
Reads data from a byte stream.
Definition: stream.c:453
static void AddCallback(vlc_object_t *p_this, const char *psz_name, callback_entry_t entry, vlc_callback_type_t i_type)
Definition: variables.c:828
signature_packet_t sig
Definition: update.h:123
int var_Create(vlc_object_t *p_this, const char *psz_name, int i_type)
Initialize a vlc variable.
Definition: variables.c:296
const variable_ops_t * ops
Definition: variables.c:82
void(* vlc_destructor_t)(struct vlc_object_t *)
Definition: libvlc.h:118
vlc_cond_t var_wait
Definition: variables.h:43
static void * xmalloc(size_t len)
Definition: vlc_common.h:979
uint8_t public_key_algo
Definition: update.h:77
void DumpVariables(vlc_object_t *obj)
Definition: variables.c:1369
#define likely(p)
Definition: vlc_common.h:113
The main vlc_object_t structure.
Definition: vlc_objects.h:39
char * psz_name
The variable unique name (must be first)
Definition: variables.c:74
#define VLC_ENOMEM
Not enough memory.
Definition: vlc_common.h:355
Definition: variables.c:55
static void CheckValue(variable_t *var, vlc_value_t *val)
Adjusts a value to fit the constraints for a certain variable:
Definition: variables.c:187
int verify_signature(signature_packet_t *sign, public_key_packet_t *p_key, uint8_t *p_hash)
Definition: update_crypto.c:586
static size_t parse_signature_v3_packet(signature_packet_t *p_sig, const uint8_t *p_buf, size_t i_sig_len)
Definition: update_crypto.c:142
void tdestroy(void *root, void(*free_node)(void *nodep))
pthread_mutex_t vlc_mutex_t
Mutex.
Definition: vlc_threads.h:267
#define VLC_SUCCESS
No error.
Definition: vlc_common.h:353
void * tfind(const void *key, const void **rootp, int(*cmp)(const void *, const void *))
struct signature_packet_t::@61::@64 v3
char * strdup(const char *)
char psz_value[8]
Definition: vout_intf.c:91
int i_count
Definition: vlc_common.h:347
static uint8_t * hash_finish(gcry_md_hd_t hd, signature_packet_t *p_sig)
Definition: update_crypto.c:742
#define VLC_VAR_GETMAX
Definition: vlc_variables.h:93
#define VLC_VAR_COORDS
Definition: vlc_variables.h:54
const char name[16]
Definition: httpd.c:1251
static uint32_t mpi_len(const uint8_t *mpi)
Definition: update_crypto.c:70
static int pgp_unarmor(const char *p_ibuf, size_t i_ibuf_len, uint8_t *p_obuf, size_t i_obuf_len)
Definition: update_crypto.c:375
Definition: fourcc_gen.c:50
void vlc_cond_wait(vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex)
Waits on a condition variable.
Definition: thread.c:267
void * p_data
Definition: variables.c:73
void var_AddListCallback(vlc_object_t *p_this, const char *psz_name, vlc_list_callback_t pf_callback, void *p_data)
Register a callback for a list variable.
Definition: variables.c:993
callback_table_t value_callbacks
Registered value callbacks.
Definition: variables.c:99
static void Destroy(variable_t *p_var)
Definition: variables.c:161
static void DupString(vlc_value_t *p_val)
Definition: variables.c:125
int() var_InheritURational(vlc_object_t *object, unsigned *num, unsigned *den, const char *var)
It inherits a string as an unsigned rational number (it also accepts basic float number).
Definition: variables.c:1213
union signature_packet_t::@61 specific
long long int strtoll(const char *, char **, int)
void vlc_mutex_unlock(vlc_mutex_t *p_mutex)
Releases a mutex.
Definition: thread.c:138
uint8_t longid[8]
Definition: update.h:118
#define VLC_ENOVAR
Variable not found.
Definition: vlc_common.h:359
#define unlikely(p)
Definition: vlc_common.h:114
void var_DelListCallback(vlc_object_t *p_this, const char *psz_name, vlc_list_callback_t pf_callback, void *p_data)
Remove a callback from a list variable.
Definition: variables.c:1009
void var_DestroyAll(vlc_object_t *)
Definition: variables.c:429
bool vlc_ureduce(unsigned *, unsigned *, uint64_t, uint64_t, uint64_t)
vlc_list_t * p_list
Definition: vlc_common.h:336
int var_Change(vlc_object_t *p_this, const char *psz_name, int i_action, vlc_value_t *p_val, vlc_value_t *p_val2)
Perform an action on a variable.
Definition: variables.c:447
static int CmpInt(vlc_value_t v, vlc_value_t w)
Definition: variables.c:109
#define vlc_assert_unreachable()
Definition: vlc_common.h:118
vlc_value_t val
The variable's exported value.
Definition: variables.c:77
static uint32_t U32_AT(const void *p)
Reads 32 bits in network byte order.
Definition: vlc_common.h:806
#define CRC24_INIT
Definition: update_crypto.c:350
void * tsearch(const void *key, void **rootp, int(*cmp)(const void *, const void *))
#define config_GetFloat(a, b)
Definition: vlc_configuration.h:144
uint8_t type
Definition: update.h:76
uint8_t version
Definition: update.h:74
static void DumpVariable(const void *data, const VISIT which, const int depth)
Definition: variables.c:1310
static const struct variable_ops_t float_ops
Definition: variables.c:137
union public_key_packet_t::@58 sig
double us_atof(const char *str)
us_atof() has the same prototype as ANSI C atof() but it expects a dot as decimal separator,...
Definition: charset.c:87
void twalk(const void *root, void(*action)(const void *nodep, VISIT which, int depth))
struct signature_packet_t::@62::@65 dsa
uint8_t hash_verification[2]
Definition: update.h:80
static thread_local void * twalk_ctx
Definition: variables.c:1379
#define packet_type(c)
Definition: update_crypto.c:50
static void DupDummy(vlc_value_t *p_val)
Definition: variables.c:124
int download_signature(vlc_object_t *p_this, signature_packet_t *p_sig, const char *psz_url)
Definition: update_crypto.c:994
VLC value structure.
Definition: vlc_common.h:329
The structure describing a variable.
Definition: variables.c:72
#define VLC_VAR_GETMIN
Definition: vlc_variables.h:92
void var_DelCallback(vlc_object_t *p_this, const char *psz_name, vlc_callback_t pf_callback, void *p_data)
Remove a callback from a variable.
Definition: variables.c:952
void vlc_mutex_lock(vlc_mutex_t *p_mutex)
Acquires a mutex.
Definition: thread.c:123
int var_SetChecked(vlc_object_t *p_this, const char *psz_name, int expected_type, vlc_value_t val)
Definition: variables.c:720
static int parse_public_key_packet(public_key_packet_t *p_key, const uint8_t *p_buf, size_t i_packet_len)
Definition: update_crypto.c:105
struct vlc_value_t::@146 coords
#define msg_Err(p_this,...)
Definition: vlc_messages.h:82
void var_FreeList(vlc_value_t *p_val, vlc_value_t *p_val2)
Free a list and the associated strings.
Definition: variables.c:1285
struct vlc_common_members obj
Definition: vlc_objects.h:42
static const struct variable_ops_t coords_ops
Definition: variables.c:140
vlc_value_t * p_values
Definition: vlc_common.h:348
static const struct variable_ops_t string_ops
Definition: variables.c:139
vlc_list_t choices
List of choices.
Definition: variables.c:91
int var_LocationParse(vlc_object_t *obj, const char *mrl, const char *pref)
Parses a set of colon-separated or semicolon-separated name=value pairs.
Definition: variables.c:1136
Definition: variables.c:62
uint8_t * hash_from_file(const char *psz_file, signature_packet_t *p_sig)
Definition: update_crypto.c:824
#define mutex_cleanup_push(lock)
Definition: vlc_threads.h:1013
void vlc_stream_Delete(stream_t *s)
Destroy a stream.
Definition: stream.c:120
Definition: variables.h:35
int(* vlc_callback_t)(vlc_object_t *, char const *, vlc_value_t, vlc_value_t, void *)
Definition: vlc_common.h:365