Browse Source

* matches.h : doxygen comments

master
Alex 'AdUser' Z 8 years ago
parent
commit
3f24649a3d
  1. 30
      src/matches.h

30
src/matches.h

@ -8,16 +8,36 @@
#define F2B_MATCHES_H_ #define F2B_MATCHES_H_
typedef struct { typedef struct {
size_t hits; size_t hits; /**< how many times this ip matched by filter */
size_t max; size_t max; /**< max matches that this in struct can contain */
size_t used; size_t used; /**< currently used matches count */
time_t *times; time_t *times; /**< dynamic unix timestamps array */
} f2b_matches_t; } f2b_matches_t;
/**
* @brief Init matches struct, allocate memory for @a hits
* @param m Pointer to struct
* @param max Max expected matches count
* @returns true on success, false otherwise
*/
bool f2b_matches_create (f2b_matches_t *m, size_t max); bool f2b_matches_create (f2b_matches_t *m, size_t max);
/**
* @brief Destroy matches struct and free memory
* @param m Pointer to struct
*/
void f2b_matches_destroy(f2b_matches_t *m); void f2b_matches_destroy(f2b_matches_t *m);
/**
* @brief Push new match time to struct
* @param m Pointer to struct
* @param t Match time
* @returns true on success, false if capacity exceeded
*/
bool f2b_matches_append (f2b_matches_t *m, time_t t); bool f2b_matches_append (f2b_matches_t *m, time_t t);
/**
* @brief Remove matches before given time
* @param m Pointer to struct
* @param t Start time
*/
void f2b_matches_expire (f2b_matches_t *m, time_t t); void f2b_matches_expire (f2b_matches_t *m, time_t t);
#endif /* F2B_MATCHES_H_ */ #endif /* F2B_MATCHES_H_ */

Loading…
Cancel
Save