diff options
| author | geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2005-06-05 10:46:25 +0000 |
|---|---|---|
| committer | geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2005-06-05 10:46:25 +0000 |
| commit | a6e9356357a9dfe0c01871531eba58f6fdce92ea (patch) | |
| tree | cd90b41ac8b20a86d00df4818853c21754067ebd /include | |
| parent | 843f9f38a8e2a567432223bc173710e52d7431c1 (diff) | |
BUILD : 1.7.10 (828) BUGS : NOTES : Added a new ban system which should be faster than what we have now and also supports CIDR bans -- not yet in use, but will be used for akills andeventually channel bans -- hashing and cidr bans are not tested yet
git-svn-id: svn://svn.anope.org/anope/trunk@828 31f1291d-b8d6-0310-a050-a5561fc1590b
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@581 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'include')
| -rw-r--r-- | include/extern.h | 14 | ||||
| -rw-r--r-- | include/services.h | 38 |
2 files changed, 52 insertions, 0 deletions
diff --git a/include/extern.h b/include/extern.h index 433d6bb96..56e2ff4ca 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1055,6 +1055,20 @@ E int sockprintf(ano_socket_t s, char *fmt, ...); E int conn(const char *host, int port, const char *lhost, int lport); E void disconn(ano_socket_t s); +/**** userban.c ****/ + +E uint32 cidr_to_netmask(uint16 cidr); +E uint16 netmask_to_cidr(uint32 mask); +E BanInfo *ban_create(char *mask, uint32 id); +E int ban_match(BanInfo *ban, char *user, char *host, uint32 ip); +E int ban_match_mask(BanInfo *ban, char *mask, uint32 ip); +E int ban_add(BanList *bl, char *mask); +E void ban_del(BanList *bl, BanInfo *ban); +E BanList *banlist_create(int hashed); +E int banlist_match(BanList *bl, char *user, char *host, uint32 ip); +E int banlist_match_mask(BanList *bl, char *mask, uint32 ip); +E BanInfo *banlist_lookup_id(BanList *bl, uint32 id); + /**** users.c ****/ E User *userlist[1024]; diff --git a/include/services.h b/include/services.h index e0017256e..31684577c 100644 --- a/include/services.h +++ b/include/services.h @@ -1317,6 +1317,44 @@ typedef struct ircd_modes_ { /*************************************************************************/ +/* UserBan support structures */ + +typedef struct baninfo_ BanInfo; +typedef struct banlist_ BanList; + +struct baninfo_ { + uint32 id; /* Ban ID, can be used to look it up */ + uint16 type; /* See BANTYPE_ below */ + + uint32 cidr_mask; /* Netmask for CIDR matching */ + uint32 cidr_ip; /* IP mask for CIDR matching */ + char *user; /* User value, NULL when not matched */ + char *host; /* Host value, NULL when not matched */ + + char *mask; /* String version of the ban mask, for displaying */ + + BanInfo *next; + BanInfo *prev; +}; + +struct banlist_ { + uint16 flags; /* See BANLIST_ below */ + BanInfo **bans; /* Ban data lists */ + uint32 next_id; /* Next ID to use for a ban */ +}; + +#define BANTYPE_NONE 0x0000 +#define BANTYPE_CIDR4 0x0001 +#define BANTYPE_USER 0x0002 +#define BANTYPE_USER_WILD 0x0004 +#define BANTYPE_HOST 0x0008 +#define BANTYPE_HOST_WILD 0x0010 + +#define BANLIST_NONE 0x0000 +#define BANLIST_HASHED 0x0001 + +/*************************************************************************/ + #include "extern.h" /*************************************************************************/ |
