1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
/* */
#ifndef INCLUDED_mtrie_conf_h
#define INCLUDED_mtrie_conf_h
#include <sys/types.h>
struct ConfItem;
struct Client;
extern void add_mtrie_conf_entry(struct ConfItem *,int);
extern void add_ip_Iline( struct ConfItem * );
extern struct ConfItem* find_matching_mtrie_conf(const char* host,
const char* user,
const char *nick,
unsigned long ip);
extern void report_mtrie_conf_links(struct Client *,int);
extern void clear_mtrie_conf_links(void);
extern size_t count_mtrie_conf_links(void);
extern void report_matching_host_klines(struct Client *,char *);
/* As ircd only allow 63 characters in a hostname, 100 is more than enough */
#define MAX_TLD_STACK 100
#define MAX_PIECE_LIST 32 /* number of chars to use in domain piece
* "lookat" table. It has to be a multiple
* of 2, 32 works well for 26 chars in
* alphabet.
*/
/*
* What this is, is a modified trie
* It will help if you read Knuth, Sorting and Searching, third volume
* of "The Art Of Computer Programming" pg.
*
* Each node has more than two branches
* the tree consists of "domain_levels" which have a piece of the domain name
* being looked for. If a match is found on that piece, it will point
* to the next "domain_level" node to scan from. The stack is popped
* and search continues.
* If a domain_level is ever filled up, an overflow domain_level is created.
* simple.
*
* -Dianora
*
*
* [domain_level "com" "ca" "org"]
* \ |
* \ _>[domain_level "passport" "group"
* \
* \-->[domain_level "varner" "voo"]->...
*
*/
typedef struct domain_piece
{
char *host_piece;
struct ConfItem *conf_ptr;
struct ConfItem *wild_conf_ptr;
int flags; /* E_type I_type K_type */
struct domain_piece *next_piece;
struct domain_level *next_level;
} DOMAIN_PIECE;
typedef struct domain_level
{
struct domain_piece *piece_list[MAX_PIECE_LIST];
} DOMAIN_LEVEL;
#endif /* INCLUDED_mtrie_conf_h */
|