X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=blobdiff_plain;f=src%2Finclude%2Fcore%2Fstore.h;h=82507a9d424c2c33865e5f133a6fd753ca32d94c;hp=fe7eb750b8860e45b3810ef76b938d1494459e88;hb=ad0100d18b3e1b754a92f36ef91f52382b0b6ead;hpb=bf3b8e60b2fdc493c4e04b05ce67abf69ca9a4ff diff --git a/src/include/core/store.h b/src/include/core/store.h index fe7eb75..82507a9 100644 --- a/src/include/core/store.h +++ b/src/include/core/store.h @@ -69,28 +69,58 @@ typedef struct { #define SC_HOST(obj) ((sc_host_t *)(obj)) sc_host_t * -sc_host_create(char *name); +sc_host_create(const char *name); sc_host_t * sc_host_clone(const sc_host_t *host); +/* + * sc_store_host: + * Add/update a host in the store. If the host, identified by its name, + * already exists, it will be updated according to the specified 'host' + * object. Else, a new entry will be created in the store. Any memory required + * for storing the entry will be allocated an managed by the store itself. The + * specified host-object will not be referenced or further accessed. + * + * Returns: + * - 0 on success + * - a positive value if the new entry is older than the currently stored + * entry (in this case, no update will happen) + * - a negative value on error + */ int sc_store_host(const sc_host_t *host); const sc_host_t * -sc_store_get_host(char *name); +sc_store_get_host(const char *name); sc_service_t * -sc_service_create(char *hostname, char *name); +sc_service_create(const char *hostname, const char *name); sc_service_t * sc_service_clone(const sc_service_t *svc); +/* + * sc_store_service: + * Add/update a store in the store. If the service, identified by its name, + * already exists for the specified host, it will be updated according to the + * specified 'service' object. If the referenced host does not exist, an error + * will be reported. Else, a new entry will be created in the store. Any + * memory required for storing the entry will be allocated an managed by the + * store itself. The specified service-object will not be referenced or + * further accessed. + * + * Returns: + * - 0 on success + * - a positive value if the new entry is older than the currently stored + * entry (in this case, no update will happen) + * - a negative value on error + */ int sc_store_service(const sc_service_t *svc); const sc_service_t * -sc_store_get_service(const sc_host_t *host, char *name); +sc_store_get_service(const sc_host_t *host, const char *name); int sc_store_dump(FILE *fh);