org.gudy.azureus2.core3.ipfilter.impl
Class IpFilterImpl

java.lang.Object
  extended by org.gudy.azureus2.core3.ipfilter.impl.IpFilterImpl
All Implemented Interfaces:
IpFilter

public class IpFilterImpl
extends Object
implements IpFilter


Method Summary
 void addExcludedHash(byte[] hash)
           
 void addExternalHandler(IpFilterExternalHandler h)
           
 void addListener(IPFilterListener l)
           
 void addRange(IpRange range)
           
 boolean ban(String ipAddress, String torrent_name, boolean manual)
           
 boolean ban(String ipAddress, String torrent_name, boolean manual, int for_mins)
           
protected  IpRange checkExternalHandlers(byte[] torrent_hash, InetAddress address)
           
protected  IpRange checkExternalHandlers(byte[] torrent_hash, String address)
           
 void clearBannedIps()
           
 void clearBlockedIPs()
           
 IpRange createRange(boolean sessionOnly)
           
 BannedIp[] getBannedIps()
           
 BlockedIp[] getBlockedIps()
           
 File getFile()
           
 boolean getInRangeAddressesAreAllowed()
           
static IpFilter getInstance()
           
 List getIpRanges()
          Deprecated.  
 long getLastUpdateTime()
           
 int getNbBannedIps()
           
 int getNbIpsBlocked()
           
 int getNbIpsBlockedAndLoggable()
           
 int getNbRanges()
           
 IpRange[] getRanges()
           
 long getTotalAddressesInRange()
           
 boolean isEnabled()
           
 boolean isInRange(InetAddress ipAddress, String torrent_name, byte[] torrent_hash, boolean loggable)
           
 boolean isInRange(String ipAddress)
           
 boolean isInRange(String ipAddress, String torrent_name, byte[] torrent_hash)
           
 boolean isInRange(String ipAddress, String torrent_name, byte[] torrent_hash, boolean loggable)
           
protected  void loadBannedIPs()
           
 void markAsUpToDate()
           
 void reload()
           
 void reload(boolean allowAsyncDownloading)
           
 void reloadSync()
           
 void removeExcludedHash(byte[] hash)
           
 void removeExternalHandler(IpFilterExternalHandler h)
           
 void removeListener(IPFilterListener l)
           
 void removeRange(IpRange range)
           
 void save()
           
protected  void saveBannedIPs()
           
 void setEnabled(boolean enabled)
           
 void setInRangeAddressesAreAllowed(boolean b)
           
protected  void setValidOrNot(IpRange range, boolean valid)
           
 void unban(String ipAddress)
           
 void unban(String ipAddress, boolean block)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static IpFilter getInstance()

getFile

public File getFile()
Specified by:
getFile in interface IpFilter

reload

public void reload()
            throws Exception
Specified by:
reload in interface IpFilter
Throws:
Exception

reloadSync

public void reloadSync()
                throws Exception
Specified by:
reloadSync in interface IpFilter
Throws:
Exception

reload

public void reload(boolean allowAsyncDownloading)
            throws Exception
Throws:
Exception

save

public void save()
          throws Exception
Specified by:
save in interface IpFilter
Throws:
Exception

loadBannedIPs

protected void loadBannedIPs()

saveBannedIPs

protected void saveBannedIPs()

isInRange

public boolean isInRange(String ipAddress)
Specified by:
isInRange in interface IpFilter

isInRange

public boolean isInRange(String ipAddress,
                         String torrent_name,
                         byte[] torrent_hash)
Specified by:
isInRange in interface IpFilter

isInRange

public boolean isInRange(String ipAddress,
                         String torrent_name,
                         byte[] torrent_hash,
                         boolean loggable)
Specified by:
isInRange in interface IpFilter

isInRange

public boolean isInRange(InetAddress ipAddress,
                         String torrent_name,
                         byte[] torrent_hash,
                         boolean loggable)
Specified by:
isInRange in interface IpFilter

checkExternalHandlers

protected IpRange checkExternalHandlers(byte[] torrent_hash,
                                        String address)

checkExternalHandlers

protected IpRange checkExternalHandlers(byte[] torrent_hash,
                                        InetAddress address)

getInRangeAddressesAreAllowed

public boolean getInRangeAddressesAreAllowed()
Specified by:
getInRangeAddressesAreAllowed in interface IpFilter

setInRangeAddressesAreAllowed

public void setInRangeAddressesAreAllowed(boolean b)
Specified by:
setInRangeAddressesAreAllowed in interface IpFilter

getIpRanges

public List getIpRanges()
Deprecated. 

Description copied from interface: IpFilter
deprecated and to be removed after 2.0.8.0. Left in to support old SafePeer plugin version that uses this stuff directly...

Specified by:
getIpRanges in interface IpFilter
Returns:

getRanges

public IpRange[] getRanges()
Specified by:
getRanges in interface IpFilter

createRange

public IpRange createRange(boolean sessionOnly)
Specified by:
createRange in interface IpFilter

addRange

public void addRange(IpRange range)
Specified by:
addRange in interface IpFilter

removeRange

public void removeRange(IpRange range)
Specified by:
removeRange in interface IpFilter

getNbRanges

public int getNbRanges()
Specified by:
getNbRanges in interface IpFilter

setValidOrNot

protected void setValidOrNot(IpRange range,
                             boolean valid)

getNbIpsBlocked

public int getNbIpsBlocked()
Specified by:
getNbIpsBlocked in interface IpFilter

getNbIpsBlockedAndLoggable

public int getNbIpsBlockedAndLoggable()
Specified by:
getNbIpsBlockedAndLoggable in interface IpFilter

ban

public boolean ban(String ipAddress,
                   String torrent_name,
                   boolean manual)
Specified by:
ban in interface IpFilter

ban

public boolean ban(String ipAddress,
                   String torrent_name,
                   boolean manual,
                   int for_mins)
Specified by:
ban in interface IpFilter

getBannedIps

public BannedIp[] getBannedIps()
Specified by:
getBannedIps in interface IpFilter

getNbBannedIps

public int getNbBannedIps()
Specified by:
getNbBannedIps in interface IpFilter

clearBannedIps

public void clearBannedIps()
Specified by:
clearBannedIps in interface IpFilter

unban

public void unban(String ipAddress)
Specified by:
unban in interface IpFilter

unban

public void unban(String ipAddress,
                  boolean block)
Specified by:
unban in interface IpFilter

getBlockedIps

public BlockedIp[] getBlockedIps()
Specified by:
getBlockedIps in interface IpFilter

clearBlockedIPs

public void clearBlockedIPs()
Specified by:
clearBlockedIPs in interface IpFilter

addExcludedHash

public void addExcludedHash(byte[] hash)
Specified by:
addExcludedHash in interface IpFilter

removeExcludedHash

public void removeExcludedHash(byte[] hash)
Specified by:
removeExcludedHash in interface IpFilter

isEnabled

public boolean isEnabled()
Specified by:
isEnabled in interface IpFilter

setEnabled

public void setEnabled(boolean enabled)
Specified by:
setEnabled in interface IpFilter

markAsUpToDate

public void markAsUpToDate()
Specified by:
markAsUpToDate in interface IpFilter

getLastUpdateTime

public long getLastUpdateTime()
Specified by:
getLastUpdateTime in interface IpFilter

getTotalAddressesInRange

public long getTotalAddressesInRange()
Specified by:
getTotalAddressesInRange in interface IpFilter

addListener

public void addListener(IPFilterListener l)
Specified by:
addListener in interface IpFilter

removeListener

public void removeListener(IPFilterListener l)
Specified by:
removeListener in interface IpFilter

addExternalHandler

public void addExternalHandler(IpFilterExternalHandler h)
Specified by:
addExternalHandler in interface IpFilter

removeExternalHandler

public void removeExternalHandler(IpFilterExternalHandler h)
Specified by:
removeExternalHandler in interface IpFilter