Configuration loading driver callbacks.
Definition at line 27 of file config.h.
Data Fields | |
int(* | open )(const char *uri, void **parg) |
int(* | close )(void *arg) |
char *(* | gets )(void *arg, char *buf, size_t size) |
int(* | resolv )(const char *name, char *uri, size_t uri_bufsz) |
int(* u_config_driver_s::close)(void *arg) |
Close the (previously u_config_driver_s::open'ed) resource pointed by arg
.
0 | on success | |
~0 | on failure |
Definition at line 41 of file config.h.
Referenced by u_config_load_from_drv().
char*(* u_config_driver_s::gets)(void *arg, char *buf, size_t size) |
fgets(3)-like function using a generic resource pointer arg
. The function reads at most one less than the number of characters specified by size
from the resource handler pointed by arg
, and stores them in the string buf
. Reading stops when a newline character is found, at end-of-file or error. The newline, if any, is retained. If any characters are read and there is no error, a \0
character is appended to end the string.
NULL
and the buffer contents remain unchanged. If an error occurs, return NULL
and the buffer contents are indeterminate. Definition at line 50 of file config.h.
Referenced by u_config_load_from_drv().
int(* u_config_driver_s::open)(const char *uri, void **parg) |
Open the the resource pointed by uri
and return its opaque handler through the parg
result argument. The *parg
(e.g. a file stream pointer in case of a file system u_config_driver_t) will be possibly used by subsequent u_config_driver_s::close and u_config_driver_s::gets callbacks.
0 | on success | |
~0 | on failure |
Definition at line 29 of file config.h.
Referenced by u_config_load_from_drv().
int(* u_config_driver_s::resolv)(const char *name, char *uri, size_t uri_bufsz) |
Resolver function for mapping relative to absolute resource names, e.g. when handling an include
directive from within another resource object). In case of success, the resolved uri
can be used as first argument to a subsequent u_config_driver_s::open call. The name
argument is the relative resource name, uri
is a pre-alloc'd string of uri_bufsz
bytes which will store the absolute resource name in case the resolution is successful.
0 | on success | |
~0 | on failure |