Browse Source

* drop duplicate defines from module headers

master
Alex 'AdUser' Z 4 years ago
parent
commit
e94447cf26
  1. 43
      src/backends/backend.h
  2. 58
      src/filters/filter.h
  3. 43
      src/sources/source.h

43
src/backends/backend.h

@ -75,33 +75,11 @@
*/
#define ID_MAX 32
/**
* Opaque module handler, contains module internal structs
*/
typedef struct _config cfg_t;
/** @note config() parameters are module-specific, but each module
* at least should handle 'shared' option */
/** type-specific module exportable routines */
/**
* @brief Create instance of module
* @param id Module id, used when 'shared = yes'
* @returns Opaque module handler or NULL on failure
*/
extern cfg_t *create(const char *id);
/**
* @brief Configure module instance
* @param cfg Module handler
* @param key Parameter name
* @param value Parameter value
* @returns true on success, false on error
*/
extern bool config(cfg_t *cfg, const char *key, const char *value);
/**
* @brief Checks is module ready for usage
* @param cfg Module handler
* @returns true if ready, false if not
* @note parameters are module-specific, but each module
* at least should handle 'shared' option
*/
extern bool ready(cfg_t *cfg);
/**
* @brief Allocate resources and start processing
* @param cfg Module handler
@ -120,13 +98,6 @@ extern bool stop(cfg_t *cfg);
* @returns true on success
*/
extern bool ping(cfg_t *cfg);
/**
* @brief Sets the log callback
* @param cfg Module handler
* @param cb Logging callback
* @note Optional, if this function is not called, warnings/errors of module will be suppressed
*/
extern void logcb(cfg_t *cfg, void (*cb)(enum loglevel l, const char *msg));
/**
* @brief Make a rabbit disappear
* @param cfg Module handler
@ -150,9 +121,3 @@ extern bool check(cfg_t *cfg, const char *ip);
* @note If this action is meaningless for backend it should return true
*/
extern bool unban(cfg_t *cfg, const char *ip);
/**
* @brief Free module handle
* @param cfg Module handler
* @note Module handler becomes invalid after calling this function on it
*/
extern void destroy(cfg_t *cfg);

58
src/filters/filter.h

@ -66,42 +66,15 @@
* @endmsc
*/
/**
* @def ID_MAX
* Maximum length of name for usage in @a start()
*/
#define ID_MAX 32
/**
* @def PATTERN_MAX
* Maximum length of regex
*/
#define PATTERN_MAX 256
/**
* @def HOST_TOKEN
* Use this string in place where to search for ip address
*/
#define HOST_TOKEN "<HOST>"
#define ID_MAX 32 /**< Maximum length of name for usage in @a start() */
#define PATTERN_MAX 256 /**< Maximum length of regex */
#define HOST_TOKEN "<HOST>" /**< Use this string in place where to search for ip address */
/**
* Opaque module handler, contains module internal structs
*/
typedef struct _config cfg_t;
/** opaque pointer to regexp type */
typedef struct _regexp rx_t;
/**
* @brief Create instance of module
* @param id Module name string
* @returns Opaque module handler or NULL on failure
*/
extern cfg_t *create(const char *id);
/**
* @brief Contigure module instance
* @param cfg Module handler
* @param key Parameter name
* @param value Parameter value
* @returns true on success, false on error
*/
extern bool config(cfg_t *cfg, const char *key, const char *value);
/** type-specific module api routines */
/**
* @brief Add match pattern
* @param cfg Module handler
@ -109,19 +82,6 @@ extern bool config(cfg_t *cfg, const char *key, const char *value);
* @returns true on success, false on error
*/
extern bool append(cfg_t *cfg, const char *pattern);
/**
* @brief Checks is module ready for usage
* @param cfg Module handler
* @returns true if ready, false if not
*/
extern bool ready(cfg_t *cfg);
/**
* @brief Sets the log callback
* @param cfg Module handler
* @param cb Logging callback
* @note Optional, if this function is not called, warnings/errors of module will be suppressed
*/
extern void logcb(cfg_t *cfg, void (*cb)(enum loglevel l, const char *msg));
/**
* @brief Fetch filter match stats
* @param cfg Module handler
@ -144,9 +104,3 @@ extern bool match(cfg_t *cfg, const char *line, char *buf, size_t bufsize);
* @param cfg Module handler
*/
extern void flush(cfg_t *cfg);
/**
* @brief Free module handle
* @param cfg Module handler
* @note Module handler becomes invalid after calling this function on it
*/
extern void destroy(cfg_t *cfg);

43
src/sources/source.h

@ -61,43 +61,6 @@
* @endmsc
*/
/**
* @def INIT_MAX
* Defines max length of @a init param in @a create()
*/
#define INIT_MAX 256
/**
* Opaque module handler, contains module internal structs
*/
typedef struct _config cfg_t;
/**
* @brief Create instance of module
* @param init Module-specific init string
* @returns Opaque module handler or NULL on failure
*/
extern cfg_t *create(const char *init);
/**
* @brief Configure module instance
* @param cfg Module handler
* @param key Parameter name
* @param value Parameter value
* @returns true on success, false on error
*/
extern bool config(cfg_t *cfg, const char *key, const char *value);
/**
* @brief Checks is module ready for usage
* @param cfg Module handler
* @returns true if ready, false if not
*/
extern bool ready(cfg_t *cfg);
/**
* @brief Sets the log callback
* @param cfg Module handler
* @param cb Logging callback
* @note Optional, if this function is not called, warnings/errors of module will be suppressed
*/
extern void logcb(cfg_t *cfg, void (*cb)(enum loglevel l, const char *msg));
/**
* @brief Allocate resources and start processing
* @param cfg Module handler
@ -127,9 +90,3 @@ extern bool stats(cfg_t *cfg, char *buf, size_t bufsize);
* @returns true on success
*/
extern bool stop(cfg_t *cfg);
/**
* @brief Free module handle
* @param cfg Module handler
* @note Module handler becomes invalid after calling this function on it
*/
extern void destroy(cfg_t *cfg);

Loading…
Cancel
Save