| 1 | #ifndef _HASHTAB_H |
| 2 | #define _HASHTAB_H |
| 3 | |
| 4 | typedef struct hnode *HNODEPTR; /* site node (host) pointer */ |
| 5 | typedef struct unode *UNODEPTR; /* url node pointer */ |
| 6 | typedef struct rnode *RNODEPTR; /* referrer node */ |
| 7 | typedef struct anode *ANODEPTR; /* user agent node pointer */ |
| 8 | typedef struct snode *SNODEPTR; /* Search string node pointer */ |
| 9 | typedef struct inode *INODEPTR; /* user (ident) node pointer */ |
| 10 | #ifdef USE_DNS |
| 11 | typedef struct dnode *DNODEPTR; /* DNS hash table node struct */ |
| 12 | #endif |
| 13 | |
| 14 | /* Object flags */ |
| 15 | #define OBJ_REG 0 /* Regular object */ |
| 16 | #define OBJ_HIDE 1 /* Hidden object */ |
| 17 | #define OBJ_GRP 2 /* Grouped object */ |
| 18 | |
| 19 | #ifdef USE_DNS |
| 20 | struct dnode { char *string; /* DNS node hash table struct */ |
| 21 | struct sockaddr_storage addr; |
| 22 | int addrlen; |
| 23 | struct dnode *llist; |
| 24 | struct dnode *next; }; |
| 25 | #endif |
| 26 | |
| 27 | struct hnode { char *string; /* host hash table structure */ |
| 28 | int flag; |
| 29 | u_int64_t count; |
| 30 | u_int64_t files; |
| 31 | u_int64_t visit; /* visit information */ |
| 32 | u_int64_t tstamp; |
| 33 | char *lasturl; |
| 34 | double xfer; |
| 35 | struct hnode *next; }; |
| 36 | |
| 37 | struct unode { char *string; /* url hash table structure */ |
| 38 | int flag; /* Object type (REG, HIDE, GRP) */ |
| 39 | u_int64_t count; /* requests counter */ |
| 40 | u_int64_t files; /* files counter */ |
| 41 | u_int64_t entry; /* entry page counter */ |
| 42 | u_int64_t exit; /* exit page counter */ |
| 43 | double xfer; /* xfer size in bytes */ |
| 44 | struct unode *next; }; /* pointer to next node */ |
| 45 | |
| 46 | struct rnode { char *string; /* referrer hash table struct */ |
| 47 | int flag; |
| 48 | u_int64_t count; |
| 49 | struct rnode *next; }; |
| 50 | |
| 51 | struct anode { char *string; |
| 52 | int flag; |
| 53 | u_int64_t count; |
| 54 | struct anode *next; }; |
| 55 | |
| 56 | struct snode { char *string; /* search string struct */ |
| 57 | u_int64_t count; |
| 58 | struct snode *next; }; |
| 59 | |
| 60 | struct inode { char *string; /* host hash table struct */ |
| 61 | int flag; |
| 62 | u_int64_t count; |
| 63 | u_int64_t files; |
| 64 | u_int64_t visit; |
| 65 | u_int64_t tstamp; |
| 66 | double xfer; |
| 67 | struct inode *next; }; |
| 68 | |
| 69 | extern HNODEPTR sm_htab[MAXHASH]; /* hash tables */ |
| 70 | extern HNODEPTR sd_htab[MAXHASH]; |
| 71 | extern UNODEPTR um_htab[MAXHASH]; /* for hits, sites, */ |
| 72 | extern RNODEPTR rm_htab[MAXHASH]; /* referrers and agents... */ |
| 73 | extern ANODEPTR am_htab[MAXHASH]; |
| 74 | extern SNODEPTR sr_htab[MAXHASH]; /* search string table */ |
| 75 | extern INODEPTR im_htab[MAXHASH]; /* ident table (username) */ |
| 76 | #ifdef USE_DNS |
| 77 | extern DNODEPTR host_table[MAXHASH]; /* DNS resolver table */ |
| 78 | #endif |
| 79 | |
| 80 | extern int put_hnode(char *, int, u_int64_t, u_int64_t, double, |
| 81 | u_int64_t *, u_int64_t, u_int64_t, char *, HNODEPTR *); |
| 82 | extern int put_unode(char *, int, u_int64_t, double, u_int64_t *, |
| 83 | u_int64_t, u_int64_t, UNODEPTR *); |
| 84 | extern int put_inode(char *, int, u_int64_t, u_int64_t, double, |
| 85 | u_int64_t *, u_int64_t, u_int64_t, INODEPTR *); |
| 86 | extern int put_rnode(char *, int, u_int64_t, u_int64_t *, RNODEPTR *); |
| 87 | extern int put_anode(char *, int, u_int64_t, u_int64_t *, ANODEPTR *); |
| 88 | extern int put_snode(char *, u_int64_t, SNODEPTR *); |
| 89 | |
| 90 | #ifdef USE_DNS |
| 91 | extern int put_dnode(char *, void *, int, DNODEPTR *); |
| 92 | extern void del_dlist(DNODEPTR *); |
| 93 | #endif |
| 94 | |
| 95 | extern void del_htabs(); /* delete hash tables */ |
| 96 | extern void del_hlist(HNODEPTR *); /* delete host htab */ |
| 97 | extern void del_ulist(UNODEPTR *); /* delete url htab */ |
| 98 | extern void del_rlist(RNODEPTR *); /* delete referrer htab */ |
| 99 | extern void del_alist(ANODEPTR *); /* delete host htab */ |
| 100 | extern void del_slist(SNODEPTR *); /* delete host htab */ |
| 101 | extern void del_ilist(INODEPTR *); /* delete host htab */ |
| 102 | |
| 103 | extern void month_update_exit(u_int64_t); |
| 104 | extern u_int64_t tot_visit(HNODEPTR *); |
| 105 | extern char *find_url(char *); |
| 106 | |
| 107 | #endif /* _HASHTAB_H */ |