upipe/udict.h header reference
Upipe dictionary of attributes More
Header inclusion
Members
Types
- struct udict
- enum udict_command
- struct udict_mgr
- enum udict_mgr_command
- struct udict_opaque
Functions
- struct udict * udict_alloc(struct udict_mgr *mgr, size_t size)
- int udict_cmp(struct udict *udict1, struct udict *udict2)
- struct udict * udict_copy(struct udict_mgr *mgr, struct udict *udict)
- int udict_delete(struct udict *udict, enum udict_type type, const char *name)
- struct udict * udict_dup(struct udict *udict)
- void udict_free(struct udict *udict)
- int udict_get_bool(struct udict *udict, bool *p, enum udict_type type, const char *name)
- int udict_get_float(struct udict *udict, double *p, enum udict_type type, const char *name)
- int udict_get_int(struct udict *udict, int64_t *p, enum udict_type type, const char *name)
- int udict_get_rational(struct udict *udict, struct urational *p, enum udict_type type, const char *name)
- int udict_get_small_int(struct udict *udict, int8_t *p, enum udict_type type, const char *name)
- int udict_get_small_unsigned(struct udict *udict, uint8_t *p, enum udict_type type, const char *name)
- int udict_get_string(struct udict *udict, const char **p, enum udict_type type, const char *name)
- int udict_get_unsigned(struct udict *udict, uint64_t *p, enum udict_type type, const char *name)
- int udict_get_void(struct udict *udict, void *p, enum udict_type type, const char *name)
- int udict_import(struct udict *udict, struct udict *udict_attr)
- int udict_iterate(struct udict *udict, const char **name_p, enum udict_type *type_p)
- void udict_mgr_release(struct udict_mgr *mgr)
- struct udict_mgr * udict_mgr_use(struct udict_mgr *mgr)
- int udict_mgr_vacuum(struct udict_mgr *mgr)
- int udict_name(struct udict *udict, enum udict_type type, const char **name_p, enum udict_type *base_type_p)
- int udict_set_bool(struct udict *udict, bool value, enum udict_type type, const char *name)
- int udict_set_float(struct udict *udict, double value, enum udict_type type, const char *name)
- int udict_set_int(struct udict *udict, uint64_t value, enum udict_type type, const char *name)
- int udict_set_opaque(struct udict *udict, struct udict_opaque value, enum udict_type type, const char *name)
- int udict_set_rational(struct udict *udict, struct urational value, enum udict_type type, const char *name)
- int udict_set_small_int(struct udict *udict, int8_t value, enum udict_type type, const char *name)
- int udict_set_small_unsigned(struct udict *udict, uint8_t value, enum udict_type type, const char *name)
- int udict_set_string(struct udict *udict, const char *value, enum udict_type type, const char *name)
- int udict_set_unsigned(struct udict *udict, uint64_t value, enum udict_type type, const char *name)
- int udict_set_void(struct udict *udict, void *value, enum udict_type type, const char *name)
Description
Members detail
This macro is declared in upipe/udict.h source file, line 31.
This struct is declared in upipe/udict.h source file, line 161.
This struct stores a dictionary of attributes.
The structure is not refcounted and shouldn't be used by more than one module at once.
This function is declared in upipe/udict.h source file, line 201.
This function allocates and initializes a new udict.
Parameters list:
- mgr: management structure for this buffer pool
- size: initial size of the attribute space
The return value is allocated udict or NULL in case of allocation failure
This function is declared in upipe/udict.h source file, line 887.
This function compares two udicts.
Parameters list:
- udict1: first udict
- udict2: second udict
The return value is 0 if the two udicts are identical
This enum is declared in upipe/udict.h source file, line 125.
This enum defines standard commands which udict modules may implement.
Identifier | Value | Description |
---|---|---|
UDICT_DUP | 0 | duplicate a given udict (struct udict **) |
UDICT_ITERATE | 1 | get the name and type of the next attribute (const char **, enum udict_type *) |
UDICT_GET | 2 | get an attribute (const char *, enum udict_type, size_t *, const uint8_t **) |
UDICT_SET | 3 | set an attribute (const char *, enum udict_type, size_t, uint8_t **) |
UDICT_DELETE | 4 | delete an attribute (const char *, enum udict_type) |
UDICT_NAME | 5 | name a shorthand attribute (enum udict_type, const char **, enum udict_type *) |
UDICT_CONTROL_LOCAL | 0 | non-standard commands implemented by a module type can start from there (first arg = signature) |
This function is declared in upipe/udict.h source file, line 868.
This function allocates a new udict with a given manager, and copies all attributes.
Parameters list:
- mgr: common management structure
- udict: source structure to clone
The return value is new udict or NULL in case of allocation failure
int udict_delete(struct udict *udict, enum udict_type type, const char *name)
This function is declared in upipe/udict.h source file, line 807.
This function deletes an attribute.
Parameters list:
- udict: pointer to the udict
- type: type of the attribute (potentially a shorthand)
- name: name of the attribute
The return value is an error code
This function is declared in upipe/udict.h source file, line 245.
This function duplicates a given udict.
Parameters list:
- udict: pointer to udict
The return value is duplicated udict
void udict_free(struct udict *udict)
This function is declared in upipe/udict.h source file, line 830.
This function frees a udict.
Parameters list:
- udict: structure to free
int udict_get_bool(struct udict *udict, bool *p, enum udict_type type, const char *name)
This function is declared in upipe/udict.h source file, line 347.
This function returns the value of a bool attribute.
Parameters list:
- udict: pointer to the udict
- p: pointer to the retrieved value (modified during execution)
- type: type of the attribute (potentially a shorthand)
- name: name of the attribute
The return value is an error code
int udict_get_float(struct udict *udict, double *p, enum udict_type type, const char *name)
This function is declared in upipe/udict.h source file, line 507.
This function returns the value of a float attribute.
Parameters list:
- udict: pointer to the udict
- p: pointer to the retrieved value (modified during execution)
- type: type of the attribute (potentially a shorthand)
- name: name of the attribute
The return value is an error code
int udict_get_int(struct udict *udict, int64_t *p, enum udict_type type, const char *name)
This function is declared in upipe/udict.h source file, line 488.
This function returns the value of an int attribute.
Parameters list:
- udict: pointer to the udict
- p: pointer to the retrieved value (modified during execution)
- type: type of the attribute (potentially a shorthand)
- name: name of the attribute
The return value is an error code
int udict_get_rational(struct udict *udict, struct urational *p, enum udict_type type, const char *name)
This function is declared in upipe/udict.h source file, line 532.
This function returns the value of a rational attribute.
Parameters list:
- udict: pointer to the udict
- p: pointer to the retrieved value (modified during execution)
- type: type of the attribute (potentially a shorthand)
- name: name of the attribute
The return value is an error code
int udict_get_small_int(struct udict *udict, int8_t *p, enum udict_type type, const char *name)
This function is declared in upipe/udict.h source file, line 386.
This function returns the value of a small int attribute.
Parameters list:
- udict: pointer to the udict
- p: pointer to the retrieved value (modified during execution)
- type: type of the attribute (potentially a shorthand)
- name: name of the attribute
The return value is an error code
int udict_get_small_unsigned(struct udict *udict, uint8_t *p, enum udict_type type, const char *name)
This function is declared in upipe/udict.h source file, line 367.
This function returns the value of a small unsigned attribute.
Parameters list:
- udict: pointer to the udict
- p: pointer to the retrieved value (modified during execution)
- type: type of the attribute (potentially a shorthand)
- name: name of the attribute
The return value is an error code
int udict_get_string(struct udict *udict, const char **p, enum udict_type type, const char *name)
This function is declared in upipe/udict.h source file, line 313.
This function returns the value of a string attribute.
Parameters list:
- udict: pointer to the udict
- p: pointer to the retrieved value (modified during execution)
- type: type of the attribute (potentially a shorthand)
- name: name of the attribute
The return value is an error code
int udict_get_unsigned(struct udict *udict, uint64_t *p, enum udict_type type, const char *name)
This function is declared in upipe/udict.h source file, line 469.
This function returns the value of an unsigned attribute.
Parameters list:
- udict: pointer to the udict
- p: pointer to the retrieved value (modified during execution)
- type: type of the attribute (potentially a shorthand)
- name: name of the attribute
The return value is an error code
int udict_get_void(struct udict *udict, void *p, enum udict_type type, const char *name)
This function is declared in upipe/udict.h source file, line 332.
This function checks for the presence of a void attribute.
Parameters list:
- udict: pointer to the udict
- p: actually unused, but kept for API consistency (should be NULL)
- type: type of the attribute (potentially a shorthand)
- name: name of the attribute
The return value is an error code
This function is declared in upipe/udict.h source file, line 841.
This function imports all attributes from a udict into another udict.
Parameters list:
- udict: overwritten udict
- udict_attr: udict containing attributes to fetch
The return value is an error code
int udict_iterate(struct udict *udict, const char **name_p, enum udict_type *type_p)
This function is declared in upipe/udict.h source file, line 264.
This function finds an attribute of the given name and type and returns the name and type of the next attribute.
Parameters list:
- udict: pointer to the udict
- name_p: reference to the name of the attribute to find, changed during execution to the name of the next attribute, or NULL if it is a shorthand
- type_p: reference to the type of the attribute, changed to UDICT_TYPE_END at the end of the iteration; start with UDICT_TYPE_END as well
The return value is an error code
This struct is declared in upipe/udict.h source file, line 178.
This struct stores common management parameters for a udict pool.
Field | Description |
---|---|
struct urefcount *refcount; | pointer to refcount management structure |
struct udict *(*udict_alloc)(struct udict_mgr *, size_t ) ; | function to allocate a udict with a given initial size |
int (*udict_control)(struct udict *, int , va_list ) ; | control function for standard or local commands |
void (*udict_free)(struct udict *) ; | function to free a udict |
int (*udict_mgr_control)(struct udict_mgr *, int , va_list ) ; | control function for standard or local manager commands - all parameters belong to the caller |
This enum is declared in upipe/udict.h source file, line 167.
This enum defines standard commands which udict managers may implement.
Identifier | Value | Description |
---|---|---|
UDICT_MGR_VACUUM | 0 | release all buffers kept in pools (void) |
UDICT_MGR_CONTROL_LOCAL | 0 | non-standard manager commands implemented by a module type can start from there (first arg = signature) |
void udict_mgr_release(struct udict_mgr *mgr)
This function is declared in upipe/udict.h source file, line 950.
This function decrements the reference count of a udict manager or frees it.
Parameters list:
- mgr: pointer to udict manager
This function is declared in upipe/udict.h source file, line 938.
This function increments the reference count of a udict manager.
Parameters list:
- mgr: pointer to udict manager
The return value is same pointer to udict manager
int udict_mgr_vacuum(struct udict_mgr *mgr)
This function is declared in upipe/udict.h source file, line 998.
This function instructs an existing udict manager to release all structures currently kept in pools. It is inteded as a debug tool only.
Parameters list:
- mgr: pointer to udict manager
The return value is an error code
int udict_name(struct udict *udict, enum udict_type type, const char **name_p, enum udict_type *base_type_p)
This function is declared in upipe/udict.h source file, line 821.
This function names a shorthand attribute.
Parameters list:
- udict: pointer to the udict
- type: shorthand type
- name_p: filled in with the name of the shorthand attribute
- base_type_p: filled in with the base type of the shorthand attribute
The return value is an error code
This struct is declared in upipe/udict.h source file, line 148.
This struct is a structure describing an opaque.
int udict_set_bool(struct udict *udict, bool value, enum udict_type type, const char *name)
This function is declared in upipe/udict.h source file, line 628.
This function sets the value of a bool attribute, optionally creating it.
Parameters list:
- udict: the pointer to the udict
- value: value to set
- type: type of the attribute (potentially a shorthand)
- name: name of the attribute
The return value is an error code
int udict_set_float(struct udict *udict, double value, enum udict_type type, const char *name)
This function is declared in upipe/udict.h source file, line 766.
This function sets the value of a float attribute, optionally creating it.
Parameters list:
- udict: the pointer to the udict
- value: value to set
- type: type of the attribute (potentially a shorthand)
- name: name of the attribute
The return value is an error code
int udict_set_int(struct udict *udict, uint64_t value, enum udict_type type, const char *name)
This function is declared in upipe/udict.h source file, line 749.
This function sets the value of an int attribute, optionally creating it.
Parameters list:
- udict: the pointer to the udict
- value: value to set
- type: type of the attribute (potentially a shorthand)
- name: name of the attribute
The return value is an error code
int udict_set_opaque(struct udict *udict, struct udict_opaque value, enum udict_type type, const char *name)
This function is declared in upipe/udict.h source file, line 568.
This function sets the value of an opaque attribute, optionally creating it.
Parameters list:
- udict: the pointer to the udict
- value: value to set
- type: type of the attribute (potentially a shorthand)
- name: name of the attribute
The return value is an error code
int udict_set_rational(struct udict *udict, struct urational value, enum udict_type type, const char *name)
This function is declared in upipe/udict.h source file, line 790.
This function sets the value of a rational attribute, optionally creating it.
Parameters list:
- udict: the pointer to the udict
- value: value to set
- type: type of the attribute (potentially a shorthand)
- name: name of the attribute
The return value is an error code
int udict_set_small_int(struct udict *udict, int8_t value, enum udict_type type, const char *name)
This function is declared in upipe/udict.h source file, line 663.
This function sets the value of a small int attribute, optionally creating it.
Parameters list:
- udict: the pointer to the udict
- value: value to set
- type: type of the attribute (potentially a shorthand)
- name: name of the attribute
The return value is an error code
int udict_set_small_unsigned(struct udict *udict, uint8_t value, enum udict_type type, const char *name)
This function is declared in upipe/udict.h source file, line 646.
This function sets the value of a small unsigned attribute, optionally creating it.
Parameters list:
- udict: the pointer to the udict
- value: value to set
- type: type of the attribute (potentially a shorthand)
- name: name of the attribute
The return value is an error code
int udict_set_string(struct udict *udict, const char *value, enum udict_type type, const char *name)
This function is declared in upipe/udict.h source file, line 590.
This function sets the value of a string attribute, optionally creating it.
Parameters list:
- udict: the pointer to the udict
- value: value to set
- type: type of the attribute (potentially a shorthand)
- name: name of the attribute
The return value is an error code
int udict_set_unsigned(struct udict *udict, uint64_t value, enum udict_type type, const char *name)
This function is declared in upipe/udict.h source file, line 732.
This function sets the value of an unsigned attribute, optionally creating it.
Parameters list:
- udict: the pointer to the udict
- value: value to set
- type: type of the attribute (potentially a shorthand)
- name: name of the attribute
The return value is an error code
int udict_set_void(struct udict *udict, void *value, enum udict_type type, const char *name)
This function is declared in upipe/udict.h source file, line 613.
This function sets the value of a void attribute, optionally creating it.
Parameters list:
- udict: the pointer to the udict
- value: actually unused, but kept for API consistency (should be NULL)
- type: type of the attribute (potentially a shorthand)
- name: name of the attribute
The return value is an error code
int udict_control(struct udict *udict, int command, ...)
This function is for internal use only.
This function is declared in upipe/udict.h source file, line 230.
This function sends a control command to the udict.
Parameters list:
- upipe: description structure of the pipe
- command: control command to send, followed by optional read or write parameters
The return value is an error code
int udict_control_va(struct udict *udict, int command, va_list args)
This function is for internal use only.
This function is declared in upipe/udict.h source file, line 214.
This function sends a control command to the udict.
Parameters list:
- upipe: description structure of the pipe
- command: control command to send
- args: optional read or write parameters
The return value is an error code
int udict_get(struct udict *udict, const char *name, enum udict_type type, size_t *size_p, const uint8_t **p)
This function is for internal use only.
This function is declared in upipe/udict.h source file, line 281.
This function finds an attribute of the given name and type and returns a pointer to the beginning of its value.
Parameters list:
- udict: pointer to the udict
- name: name of the attribute (NULL if type is a shorthand)
- type: type of the attribute (potentially a shorthand)
- size_p: size of the value, written on execution
- p: pointer to the value of the found attribute
The return value is an error code
This function is for internal use only.
This function is declared in upipe/udict.h source file, line 431.
This function unserializes a 64 bit signed integer. FIXME: this is probably suboptimal
Parameters list:
- attr: pointer to the start of serialized data
The return value is value of the signed integer
int udict_get_opaque(struct udict *udict, struct udict_opaque *p, enum udict_type type, const char *name)
This function is for internal use only.
This function is declared in upipe/udict.h source file, line 296.
This function returns the value of an opaque attribute, potentially shorthand.
Parameters list:
- udict: pointer to the udict
- p: pointer to the retrieved value (modified during execution)
- type: type of the attribute (potentially a shorthand)
- name: name of the attribute
The return value is an error code
This function is for internal use only.
This function is declared in upipe/udict.h source file, line 401.
This function unserializes a 64 bit unsigned integer.
Parameters list:
- attr: pointer to the start of serialized data
The return value is value of the unsigned integer
int udict_mgr_control(struct udict_mgr *mgr, int command, ...)
This function is for internal use only.
This function is declared in upipe/udict.h source file, line 982.
This function sends a control command to the pipe manager. Note that all arguments are owned by the caller.
Parameters list:
- mgr: pointer to udict manager
- command: control manager command to send, followed by optional read or write parameters
The return value is an error code
int udict_mgr_control_va(struct udict_mgr *mgr, int command, va_list args)
This function is for internal use only.
This function is declared in upipe/udict.h source file, line 965.
This function sends a control command to the pipe manager. Note that all arguments are owned by the caller.
Parameters list:
- mgr: pointer to udict manager
- command: manager control command to send
- args: optional read or write parameters
The return value is an error code
int udict_set(struct udict *udict, const char *name, enum udict_type type, size_t attr_size, uint8_t **p)
This function is for internal use only.
This function is declared in upipe/udict.h source file, line 553.
This function adds or changes an attribute (excluding the value itself).
Parameters list:
- udict: the pointer to the udict
- name: name of the attribute
- type: type of the attribute
- attr_size: size needed to store the value of the attribute
- p: pointer to the value of the attribute
This function is for internal use only.
This function is declared in upipe/udict.h source file, line 710.
This function serializes a 64 bit signed integer.
Parameters list:
- attr: pointer to the start of serialized data
- value: value of the signed integer
This function is for internal use only.
This function is declared in upipe/udict.h source file, line 677.
This function serializes a 64 bit unsigned integer.
Parameters list:
- attr: pointer to the start of serialized data
- value: value of the unsigned integer
This enum is for internal use only.
This enum is declared in upipe/udict.h source file, line 47.
This enum defines basic attribute types.
Identifier | Value | Description |
---|---|---|
UDICT_TYPE_SHORTHAND | 0 |