upipe/udict.h header reference
Upipe dictionary of attributes More
Header inclusion [link]
Members [link]
Types [link]
- struct udict
- enum udict_command
- enum udict_mgr_command
- struct udict_opaque
Functions [link]
- 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_opaque_from_hex(struct udict *udict, const char *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 [link]
Upipe dictionary of attributes
Members detail [link]
#define _UPIPE_UDICT_H_ [link]
This macro is declared in upipe/udict.h source file, line 31.
struct udict [link]
This struct is declared in upipe/udict.h source file, line 193.
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 233.
This function allocates and initializes a new udict.
Parameter 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 908.
This function compares two udicts.
Parameter list:
- udict1: first udict
- udict2: second udict
The return value is 0 if the two udicts are identical
enum udict_command [link]
This enum is declared in upipe/udict.h source file, line 157.
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 | 0x8000 | 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 889.
This function allocates a new udict with a given manager, and copies all attributes.
Parameter 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) [link]
This function is declared in upipe/udict.h source file, line 826.
This function deletes an attribute.
Parameter 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 277.
This function duplicates a given udict.
Parameter list:
- udict: pointer to udict
The return value is duplicated udict
This function is declared in upipe/udict.h source file, line 849.
This function frees a udict.
Parameter list:
- udict: structure to free
int udict_get_bool(struct udict *udict, bool *p, enum udict_type type, const char *name) [link]
This function is declared in upipe/udict.h source file, line 380.
This function returns the value of a bool attribute.
Parameter 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) [link]
This function is declared in upipe/udict.h source file, line 511.
This function returns the value of a float attribute.
Parameter 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) [link]
This function is declared in upipe/udict.h source file, line 491.
This function returns the value of an int attribute.
Parameter 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) [link]
This function is declared in upipe/udict.h source file, line 537.
This function returns the value of a rational attribute.
Parameter 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) [link]
This function is declared in upipe/udict.h source file, line 421.
This function returns the value of a small int attribute.
Parameter 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) [link]
This function is declared in upipe/udict.h source file, line 401.
This function returns the value of a small unsigned attribute.
Parameter 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) [link]
This function is declared in upipe/udict.h source file, line 345.
This function returns the value of a string attribute.
Parameter 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) [link]
This function is declared in upipe/udict.h source file, line 471.
This function returns the value of an unsigned attribute.
Parameter 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) [link]
This function is declared in upipe/udict.h source file, line 365.
This function checks for the presence of a void attribute.
Parameter 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 862.
This function imports all attributes from a udict into another udict.
Parameter 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) [link]
This function is declared in upipe/udict.h source file, line 296.
This function finds an attribute of the given name and type and returns the name and type of the next attribute.
Parameter 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
struct udict_mgr [link]
This struct is declared in upipe/udict.h source file, line 210.
| 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 |
enum udict_mgr_command [link]
This enum is declared in upipe/udict.h source file, line 199.
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 | 0x8000 | non-standard manager commands implemented by a module type can start from there (first arg = signature) |
This function is declared in upipe/udict.h source file, line 971.
This function decrements the reference count of a udict manager or frees it.
Parameter list:
- mgr: pointer to udict manager
This function is declared in upipe/udict.h source file, line 959.
This function increments the reference count of a udict manager.
Parameter list:
- mgr: pointer to udict manager
The return value is same pointer to udict manager
This function is declared in upipe/udict.h source file, line 1019.
This function instructs an existing udict manager to release all structures currently kept in pools. It is intended as a debug tool only.
Parameter 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) [link]
This function is declared in upipe/udict.h source file, line 840.
This function names a shorthand attribute.
Parameter 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
struct udict_opaque [link]
This struct is declared in upipe/udict.h source file, line 180.
This struct is a structure describing an opaque.
int udict_set_bool(struct udict *udict, bool value, enum udict_type type, const char *name) [link]
This function is declared in upipe/udict.h source file, line 665.
This function sets the value of a bool attribute, optionally creating it.
Parameter 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) [link]
This function is declared in upipe/udict.h source file, line 785.
This function sets the value of a float attribute, optionally creating it.
Parameter 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) [link]
This function is declared in upipe/udict.h source file, line 768.
This function sets the value of an int attribute, optionally creating it.
Parameter 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) [link]
This function is declared in upipe/udict.h source file, line 575.
This function sets the value of an opaque attribute, optionally creating it.
Parameter 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_from_hex(struct udict *udict, const char *value, enum udict_type type, const char *name) [link]
This function is declared in upipe/udict.h source file, line 601.
This function sets the value of an opaque attribute, optionally creating it, from an hexadecimal string.
Parameter list:
- udict: the pointer to the udict
- value: hexadecimal 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) [link]
This function is declared in upipe/udict.h source file, line 809.
This function sets the value of a rational attribute, optionally creating it.
Parameter 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) [link]
This function is declared in upipe/udict.h source file, line 700.
This function sets the value of a small int attribute, optionally creating it.
Parameter 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) [link]
This function is declared in upipe/udict.h source file, line 683.
This function sets the value of a small unsigned attribute, optionally creating it.
Parameter 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) [link]
This function is declared in upipe/udict.h source file, line 629.
This function sets the value of a string attribute, optionally creating it.
Parameter 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) [link]
This function is declared in upipe/udict.h source file, line 751.
This function sets the value of an unsigned attribute, optionally creating it.
Parameter 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) [link]
This function is declared in upipe/udict.h source file, line 650.
This function sets the value of a void attribute, optionally creating it.
Parameter 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
This function is for internal use only.
This function is declared in upipe/udict.h source file, line 262.
This function sends a control command to the udict.
Parameter 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
This function is for internal use only.
This function is declared in upipe/udict.h source file, line 246.
This function sends a control command to the udict.
Parameter 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) [link]
This function is for internal use only.
This function is declared in upipe/udict.h source file, line 313.
This function finds an attribute of the given name and type and returns a pointer to the beginning of its value.
Parameter 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
int64_t udict_get_int64(const uint8_t *attr) [link]
This function is for internal use only.
This function is declared in upipe/udict.h source file, line 451.
This function unserializes a 64 bit signed integer. FIXME: this is probably suboptimal
Parameter 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) [link]
This function is for internal use only.
This function is declared in upipe/udict.h source file, line 328.
This function returns the value of an opaque attribute, potentially shorthand.
Parameter 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
uint64_t udict_get_uint64(const uint8_t *attr) [link]
This function is for internal use only.
This function is declared in upipe/udict.h source file, line 437.
This function unserializes a 64 bit unsigned integer.
Parameter list:
- attr: pointer to the start of serialized data
The return value is value of the unsigned integer
This function is for internal use only.
This function is declared in upipe/udict.h source file, line 1003.
This function sends a control command to the pipe manager. Note that all arguments are owned by the caller.
Parameter 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
This function is for internal use only.
This function is declared in upipe/udict.h source file, line 986.
This function sends a control command to the pipe manager. Note that all arguments are owned by the caller.
Parameter 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) [link]
This function is for internal use only.
This function is declared in upipe/udict.h source file, line 560.
This function adds or changes an attribute (excluding the value itself).
Parameter 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
void udict_set_int64(uint8_t *attr, int64_t value) [link]
This function is for internal use only.
This function is declared in upipe/udict.h source file, line 731.
This function serializes a 64 bit signed integer.
Parameter list:
- attr: pointer to the start of serialized data
- value: value of the signed integer
void udict_set_uint64(uint8_t *attr, uint64_t value) [link]
This function is for internal use only.
This function is declared in upipe/udict.h source file, line 714.
This function serializes a 64 bit unsigned integer.
Parameter list:
- attr: pointer to the start of serialized data
- value: value of the unsigned integer
enum udict_type [link]
This enum is for internal use only.
This enum is declared in upipe/udict.h source file, line 48.
This enum defines basic attribute types.