Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

ban.h File Reference


Detailed Description

Banning control.

Author:
Raphael Manfredi
Date:
2002-2003

#include <glib.h>
#include "lib/host_addr.h"

Go to the source code of this file.

Enumerations

enum  ban_type_t { BAN_OK = 0, BAN_FIRST = 1, BAN_FORCE = 2, BAN_MSG = 3 }

Functions

void ban_init (void)
 Initialize the banning system.

void ban_close (void)
 Called at shutdown time to reclaim all memory.

ban_type_t ban_allow (const host_addr_t addr)
 Check whether we can allow connection from `ip' to proceed.

void ban_record (const host_addr_t addr, const gchar *msg)
 Record banning with specific message for a given IP, for MAX_BAN seconds.

void ban_force (struct gnutella_socket *s)
 Force banning of the connection.

gint ban_delay (const host_addr_t addr)
gchar * ban_message (const host_addr_t addr)
gboolean ban_is_banned (const host_addr_t addr)
 Check whether IP is already recorded as being banned.

void ban_max_recompute (void)
 Recompute the maximum amount of file descriptors we dedicate to banning.

const gchar * ban_vendor (const gchar *vendor)
 Check whether servent identified by its vendor string should be banned.


Enumeration Type Documentation

enum ban_type_t
 

Returns:
codes for ban_allow().
Enumeration values:
BAN_OK  OK, don't ban and accept the connection.
BAN_FIRST  Initial banning, send polite denial.
BAN_FORCE  Force banning, don't send back anything.
BAN_MSG  Ban with explicit message.


Function Documentation

ban_type_t ban_allow const host_addr_t  addr  ) 
 

Check whether we can allow connection from `ip' to proceed.

Returns:

BAN_OK ok, can proceed with connection. BAN_FIRST will ban, but send back message, then close connection. BAN_FORCE don't send back anything, and call ban_force(). BAN_MSG will ban with explicit message and tailored error code.

Every BAN_REMIND attempts, return BAN_FIRST to let them know that they have been banned, in case they "missed" our previous indications or did not get the Retry-After right. --RAM, 2004-06-21

void ban_close void   ) 
 

Called at shutdown time to reclaim all memory.

gint ban_delay const host_addr_t  addr  ) 
 

Returns:
banning delay for banned IP.

void ban_force struct gnutella_socket s  ) 
 

Force banning of the connection.

We're putting it in a list and forgetting about it.

void ban_init void   ) 
 

Initialize the banning system.

gboolean ban_is_banned const host_addr_t  addr  ) 
 

Check whether IP is already recorded as being banned.

void ban_max_recompute void   ) 
 

Recompute the maximum amount of file descriptors we dedicate to banning.

gchar* ban_message const host_addr_t  addr  ) 
 

Returns:
banning message for banned IP.

void ban_record const host_addr_t  addr,
const gchar *  msg
 

Record banning with specific message for a given IP, for MAX_BAN seconds.

const gchar* ban_vendor const gchar *  vendor  ) 
 

Check whether servent identified by its vendor string should be banned.

When we ban, we ban for both gnet and download connections. Such banning is exceptional, usually restricted to some versions and the servent's author is informed about the banning.

Returns:
NULL if we shall not ban, a banning reason string otherwise.


Generated on Sun Feb 12 10:49:59 2006 for Gtk-Gnutella by doxygen 1.3.6