From 52a672c6468d78f2466526dae388607c79b34766 Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Fri, 14 Oct 2016 16:11:58 +1000 Subject: [PATCH] backend.h : doxygen comments --- src/backend.h | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/backend.h b/src/backend.h index 24e27b1..127bf42 100644 --- a/src/backend.h +++ b/src/backend.h @@ -10,25 +10,49 @@ #include "config.h" #include "log.h" +/** backend module definition */ typedef struct f2b_backend_t { - void *h; - void *cfg; + void *h; /**< dlopen handler */ + void *cfg; /**< opaque pointer of module config */ + /* handlers */ + /** dlsym pointer to handler of @a create command */ void *(*create) (const char *id); + /** dlsym pointer to handler of @a config command */ bool (*config) (void *cfg, const char *key, const char *value); + /** dlsym pointer to handler of @a ready command */ bool (*ready) (void *cfg); + /** dlsym pointer to handler of @a error command */ char *(*error) (void *cfg); + /** dlsym pointer to handler of @a start command */ bool (*start) (void *cfg); + /** dlsym pointer to handler of @a stop command */ bool (*stop) (void *cfg); + /** dlsym pointer to handler of @a ping command */ bool (*ping) (void *cfg); + /** dlsym pointer to handler of @a ban command */ bool (*ban) (void *cfg, const char *ip); + /** dlsym pointer to handler of @a check command */ bool (*check) (void *cfg, const char *ip); + /** dlsym pointer to handler of @a unban command */ bool (*unban) (void *cfg, const char *ip); + /** dlsym pointer to handler of @a destroy command */ void (*destroy) (void *cfg); } f2b_backend_t; +/** + * @brief Create module from config + * @param config Pointer to section of config + * @param init Module init string + * @returns Pointer to module metadata of NULL on error + */ f2b_backend_t * f2b_backend_create (f2b_config_section_t *config, const char *id); -void f2b_backend_destroy(f2b_backend_t *b); +/** + * @brief Free module metadata + * @param b Pointer to module struct + */ +void f2b_backend_destroy(f2b_backend_t *b); +/* helpers */ const char * f2b_backend_error (f2b_backend_t *b); bool f2b_backend_start (f2b_backend_t *b);