ze-filter  (ze-filter-0.8.0-develop-180218)
ze-livehistory.c File Reference
#include <ze-sys.h>
#include "ze-filter.h"

Go to the source code of this file.

Classes

struct  Bucket_T
 
struct  ShortHist_T
 
struct  browse_T
 

Macros

#define DTCLEANUP   600
 
#define K_MIN   16
 
#define K_SHF   10
 
#define NB_MAJOR(i)   ((i) >> K_SHF)
 
#define NB_MINOR(i)   (((i) >> K_SHF) & (K_MIN - 1))
 
#define DATA_LOCK()
 
#define DATA_UNLOCK()
 

Typedefs

typedef struct Bucket_T Bucket_T
 
typedef struct ShortHist_T ShortHist_T
 
typedef struct browse_T browse_T
 

Functions

void livehistory_reset ()
 
bool livehistory_clean_table ()
 
int livehistory_add_entry (char *ip, time_t now, int n, int what)
 
int livehistory_check_host (char *ip, time_t win, int what)
 
void livehistory_log_table (int fd, bool resolve)
 

Macro Definition Documentation

◆ DATA_LOCK

#define DATA_LOCK ( )
Value:
if (pthread_mutex_lock(&hdata.mutex) != 0) { \
ZE_LogSysError("pthread_mutex_lock"); \
}

Definition at line 100 of file ze-livehistory.c.

◆ DATA_UNLOCK

#define DATA_UNLOCK ( )
Value:
if (pthread_mutex_unlock(&hdata.mutex) != 0) { \
ZE_LogSysError("pthread_mutex_unlock"); \
}

Definition at line 105 of file ze-livehistory.c.

◆ DTCLEANUP

#define DTCLEANUP   600

Definition at line 36 of file ze-livehistory.c.

◆ K_MIN

#define K_MIN   16

Definition at line 40 of file ze-livehistory.c.

◆ K_SHF

#define K_SHF   10

Definition at line 41 of file ze-livehistory.c.

◆ NB_MAJOR

#define NB_MAJOR (   i)    ((i) >> K_SHF)

Definition at line 53 of file ze-livehistory.c.

◆ NB_MINOR

#define NB_MINOR (   i)    (((i) >> K_SHF) & (K_MIN - 1))

Definition at line 54 of file ze-livehistory.c.

Typedef Documentation

◆ browse_T

typedef struct browse_T browse_T

Definition at line 393 of file ze-livehistory.c.

◆ Bucket_T

typedef struct Bucket_T Bucket_T

◆ ShortHist_T

typedef struct ShortHist_T ShortHist_T

Function Documentation

◆ livehistory_add_entry()

int livehistory_add_entry ( char *  ip,
time_t  now,
int  n,
int  what 
)

Definition at line 253 of file ze-livehistory.c.

◆ livehistory_check_host()

int livehistory_check_host ( char *  ip,
time_t  win,
int  what 
)

Definition at line 338 of file ze-livehistory.c.

◆ livehistory_clean_table()

bool livehistory_clean_table ( )

Definition at line 214 of file ze-livehistory.c.

◆ livehistory_log_table()

void livehistory_log_table ( int  fd,
bool  resolve 
)

Definition at line 469 of file ze-livehistory.c.

◆ livehistory_reset()

void livehistory_reset ( )

Definition at line 161 of file ze-livehistory.c.

Variable Documentation

◆ bucket

struct Bucket_T bucket[K_MIN]

Definition at line 95 of file ze-livehistory.c.

◆ db_empty

ZEBT_T db_empty

Definition at line 93 of file ze-livehistory.c.

◆ last

time_t last

Definition at line 88 of file ze-livehistory.c.

◆ mutex

pthread_mutex_t mutex

Definition at line 91 of file ze-livehistory.c.

◆ nb

int nb

Definition at line 89 of file ze-livehistory.c.

◆ ok

bool ok

Definition at line 87 of file ze-livehistory.c.