LimeWire Consolidated API

com.limegroup.gnutella.filters
Interface IPFilter

All Superinterfaces:
SpamFilter
All Known Implementing Classes:
HostileFilter, LocalIPFilter

public interface IPFilter
extends SpamFilter

Defines an interface to find out if an IP address is banned.


Nested Class Summary
static interface IPFilter.IPFilterCallback
          Defines an interface for loading IP Filters through a callback.
 
Method Summary
 boolean allow(Address address)
          Checks if the address is of type Connectable and checks if the ip address is banned.
 boolean allow(byte[] addr)
          Checks if a given host is banned.
 boolean allow(IP ip)
          Checks if a given host is banned.
 boolean allow(SocketAddress addr)
          Checks if a given host is banned.
 boolean allow(String addr)
          Checks if a given host is banned.
 boolean hasBlacklistedHosts()
           
 int logMinDistanceTo(IP ip)
          Calculates the first set bit in the distance between an IPv4 address and the ranges represented by this list.
 void refreshHosts()
          Updates the hosts in the IP filter.
 void refreshHosts(IPFilter.IPFilterCallback callback)
           
 
Methods inherited from interface com.limegroup.gnutella.filters.SpamFilter
allow
 

Method Detail

refreshHosts

void refreshHosts(IPFilter.IPFilterCallback callback)

hasBlacklistedHosts

boolean hasBlacklistedHosts()
Returns:
true if there are black listed hosts in the filter.

logMinDistanceTo

int logMinDistanceTo(IP ip)
Calculates the first set bit in the distance between an IPv4 address and the ranges represented by this list. This is equivalent to floor(log2(distance)) + 1.

Parameters:
ip - an IPv4 address, represented as an IP object with a /32 netmask.
Returns:
an int on the interval [0,31], or 32 if the address is whitelisted.

allow

boolean allow(IP ip)
Checks if a given host is banned. This method will be called when accepting an incoming or outgoing connection.

Parameters:
ip - address in the form of A.B.C.D, but if it is a DNS name then a lookup will be performed.
Returns:
true if this host is allowed, false if it is banned or we are unable to create correct IP address out of it.

allow

boolean allow(SocketAddress addr)
Checks if a given host is banned. This method will be called when accepting an incoming or outgoing connection.

Parameters:
addr - an IP in the form of A.B.C.D, but if it is a DNS name then a lookup will be performed.
Returns:
true if this host is allowed, false if it is banned or we are unable to create correct IP address out of it.

allow

boolean allow(String addr)
Checks if a given host is banned. This method will be called when accepting an incoming or outgoing connection.

Parameters:
addr - an IP in the form of A.B.C.D, but if it is a DNS name then a lookup will be performed.
Returns:
true if this host is allowed, false if it is banned or we are unable to create correct IP address out of it.

allow

boolean allow(Address address)
Checks if the address is of type Connectable and checks if the ip address is banned. Can be extended to handle other address types if they have the notion of a public/unique ip address.

Returns:
if this host is allowed or the type of address can't be filtered, false if it is banned or we are unable to create correct IP address out of it.

allow

boolean allow(byte[] addr)
Checks if a given host is banned. This method will be called when accepting an incoming or outgoing connection.

Parameters:
addr - an IP in the form of A.B.C.D, but if it is a DNS name then a lookup will be performed.
Returns:
true if this host is allowed, false if it is banned or we are unable to create correct IP address out of it.

refreshHosts

void refreshHosts()
Updates the hosts in the IP filter.


LimeWire Consolidated API

Copyright © 2009. All Rights Reserved.