org.gudy.azureus2.pluginsimpl.remote.ipfilter
Class RPIPFilter

java.lang.Object
  extended by org.gudy.azureus2.pluginsimpl.remote.RPObject
      extended by org.gudy.azureus2.pluginsimpl.remote.ipfilter.RPIPFilter
All Implemented Interfaces:
java.io.Serializable, IPFilter

public class RPIPFilter
extends RPObject
implements IPFilter

See Also:
Serialized Form

Field Summary
protected  IPFilter delegate
           
 long last_update_time
           
 int number_of_blocked_ips
           
 int number_of_ranges
           
 
Fields inherited from class org.gudy.azureus2.pluginsimpl.remote.RPObject
__delegate, _dispatcher, _object_id, next_key, object_registry, object_registry_reverse
 
Constructor Summary
protected RPIPFilter(IPFilter _delegate)
           
 
Method Summary
 RPReply _process(RPRequest request)
           
protected  void _setDelegate(java.lang.Object _delegate)
           
 java.lang.Object _setLocal()
           
 void addRange(IPRange range)
          Adds a range.
 void ban(java.lang.String IPAddress, java.lang.String text)
          Explicitly bans an address
 void block(java.lang.String IPAddress)
          Explicitly blocks an address
static IPFilter create(IPFilter _delegate)
           
 IPRange createAndAddRange(java.lang.String description, java.lang.String start_ip, java.lang.String end_ip, boolean this_session_only)
          Creates, validates and adds a range
 IPRange createRange(boolean this_session_only)
          creates a new range but *doesn't* add it to the list.
 IPBanned[] getBannedIPs()
          Gets the current list of b addresses
 IPBlocked[] getBlockedIPs()
          Gets the current list of blocked addresses
 java.io.File getFile()
          Gets the file name used for persistent ranges
 boolean getInRangeAddressesAreAllowed()
          The filter either allows defined ranges to be allowed or denied access
 long getLastUpdateTime()
          Gets the last time the filter set was updated or marked as up to date
 int getNumberOfBannedIPs()
          returns length of banned ip list
 int getNumberOfBlockedIPs()
          returns length of blocked ip list
 int getNumberOfRanges()
          returns length of ranges list
 IPRange[] getRanges()
          Gets the current set of defined IP ranges
 boolean isEnabled()
          Test if ipfilter is enabled or not
 boolean isInRange(java.lang.String IPAddress)
          Checks an address to see if its in an allowed range
 void markAsUpToDate()
          Marks the IPFilter set as being uptodate
 void reload()
          Reloads the ip filter from the config file (obtainable using "getFile")
 void removeRange(IPRange range)
          Remove a range
 void save()
          saves current setting to file given by getFile
 void setEnabled(boolean value)
          change the enabled status
 void setInRangeAddressesAreAllowed(boolean value)
          Set the behaviour of the filter to either allow or deny access for defined ranges
 void unban(java.lang.String IPAddress)
          Removes a ban on an address
 
Methods inherited from class org.gudy.azureus2.pluginsimpl.remote.RPObject
_fixupLocal, _getDelegate, _getName, _getOID, _lookupLocal, _lookupLocal, _refresh, _setRemote, getDispatcher, notSupported, notSupported
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

delegate

protected transient IPFilter delegate

last_update_time

public long last_update_time

number_of_ranges

public int number_of_ranges

number_of_blocked_ips

public int number_of_blocked_ips
Constructor Detail

RPIPFilter

protected RPIPFilter(IPFilter _delegate)
Method Detail

create

public static IPFilter create(IPFilter _delegate)

_setDelegate

protected void _setDelegate(java.lang.Object _delegate)
Overrides:
_setDelegate in class RPObject

_setLocal

public java.lang.Object _setLocal()
                           throws RPException
Overrides:
_setLocal in class RPObject
Throws:
RPException

_process

public RPReply _process(RPRequest request)
Overrides:
_process in class RPObject

getFile

public java.io.File getFile()
Description copied from interface: IPFilter
Gets the file name used for persistent ranges

Specified by:
getFile in interface IPFilter
Returns:

createRange

public IPRange createRange(boolean this_session_only)
Description copied from interface: IPFilter
creates a new range but *doesn't* add it to the list. Use the add method to add it

Specified by:
createRange in interface IPFilter
Parameters:
this_session_only - // not persisted if "this_session_only" is true
Returns:

addRange

public void addRange(IPRange range)
Description copied from interface: IPFilter
Adds a range. Only ranges created with "create" above can be added

Specified by:
addRange in interface IPFilter

createAndAddRange

public IPRange createAndAddRange(java.lang.String description,
                                 java.lang.String start_ip,
                                 java.lang.String end_ip,
                                 boolean this_session_only)
Description copied from interface: IPFilter
Creates, validates and adds a range

Specified by:
createAndAddRange in interface IPFilter
this_session_only - not persisted if true
Returns:
new range or null if invalid

removeRange

public void removeRange(IPRange range)
Description copied from interface: IPFilter
Remove a range

Specified by:
removeRange in interface IPFilter

reload

public void reload()
            throws IPFilterException
Description copied from interface: IPFilter
Reloads the ip filter from the config file (obtainable using "getFile")

Specified by:
reload in interface IPFilter
Throws:
IPFilterException

getRanges

public IPRange[] getRanges()
Description copied from interface: IPFilter
Gets the current set of defined IP ranges

Specified by:
getRanges in interface IPFilter
Returns:

isInRange

public boolean isInRange(java.lang.String IPAddress)
Description copied from interface: IPFilter
Checks an address to see if its in an allowed range

Specified by:
isInRange in interface IPFilter
Returns:

getBlockedIPs

public IPBlocked[] getBlockedIPs()
Description copied from interface: IPFilter
Gets the current list of blocked addresses

Specified by:
getBlockedIPs in interface IPFilter
Returns:

block

public void block(java.lang.String IPAddress)
Description copied from interface: IPFilter
Explicitly blocks an address

Specified by:
block in interface IPFilter

getBannedIPs

public IPBanned[] getBannedIPs()
Description copied from interface: IPFilter
Gets the current list of b addresses

Specified by:
getBannedIPs in interface IPFilter
Returns:

ban

public void ban(java.lang.String IPAddress,
                java.lang.String text)
Description copied from interface: IPFilter
Explicitly bans an address

Specified by:
ban in interface IPFilter

unban

public void unban(java.lang.String IPAddress)
Description copied from interface: IPFilter
Removes a ban on an address

Specified by:
unban in interface IPFilter

getInRangeAddressesAreAllowed

public boolean getInRangeAddressesAreAllowed()
Description copied from interface: IPFilter
The filter either allows defined ranges to be allowed or denied access

Specified by:
getInRangeAddressesAreAllowed in interface IPFilter
Returns:

setInRangeAddressesAreAllowed

public void setInRangeAddressesAreAllowed(boolean value)
Description copied from interface: IPFilter
Set the behaviour of the filter to either allow or deny access for defined ranges

Specified by:
setInRangeAddressesAreAllowed in interface IPFilter

isEnabled

public boolean isEnabled()
Description copied from interface: IPFilter
Test if ipfilter is enabled or not

Specified by:
isEnabled in interface IPFilter
Returns:

setEnabled

public void setEnabled(boolean value)
Description copied from interface: IPFilter
change the enabled status

Specified by:
setEnabled in interface IPFilter

save

public void save()
          throws IPFilterException
Description copied from interface: IPFilter
saves current setting to file given by getFile

Specified by:
save in interface IPFilter
Throws:
IPFilterException

markAsUpToDate

public void markAsUpToDate()
Description copied from interface: IPFilter
Marks the IPFilter set as being uptodate

Specified by:
markAsUpToDate in interface IPFilter

getLastUpdateTime

public long getLastUpdateTime()
Description copied from interface: IPFilter
Gets the last time the filter set was updated or marked as up to date

Specified by:
getLastUpdateTime in interface IPFilter
Returns:

getNumberOfRanges

public int getNumberOfRanges()
Description copied from interface: IPFilter
returns length of ranges list

Specified by:
getNumberOfRanges in interface IPFilter
Returns:

getNumberOfBlockedIPs

public int getNumberOfBlockedIPs()
Description copied from interface: IPFilter
returns length of blocked ip list

Specified by:
getNumberOfBlockedIPs in interface IPFilter
Returns:

getNumberOfBannedIPs

public int getNumberOfBannedIPs()
Description copied from interface: IPFilter
returns length of banned ip list

Specified by:
getNumberOfBannedIPs in interface IPFilter
Returns: