Class RPIPFilter
- java.lang.Object
-
- com.biglybt.pifimpl.remote.RPObject
-
- com.biglybt.pifimpl.remote.ipfilter.RPIPFilter
-
- All Implemented Interfaces:
IPFilter
,java.io.Serializable
public class RPIPFilter extends RPObject implements IPFilter
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected IPFilter
delegate
long
last_update_time
int
number_of_blocked_ips
int
number_of_ranges
-
Fields inherited from class com.biglybt.pifimpl.remote.RPObject
__delegate, _dispatcher, _object_id, next_key, object_registry, object_registry_reverse
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RPIPFilter(IPFilter _delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 addressvoid
block(java.lang.String IPAddress)
Explicitly blocks an addressstatic 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 rangeIPRange
createRange(int address_type, boolean this_session_only)
creates a new range but *doesn't* add it to the list.IPBanned[]
getBannedIPs()
Gets the current list of b addressesIPBlocked[]
getBlockedIPs()
Gets the current list of blocked addressesjava.io.File
getFile()
Gets the file name used for persistent rangesboolean
getInRangeAddressesAreAllowed()
The filter either allows defined ranges to be allowed or denied accesslong
getLastUpdateTime()
Gets the last time the filter set was updated or marked as up to dateint
getNumberOfBannedIPs()
returns length of banned ip listint
getNumberOfBlockedIPs()
returns length of blocked ip listint
getNumberOfRanges()
returns length of ranges listIPRange[]
getRanges()
Gets the current set of defined IP rangesboolean
isEnabled()
Test if ipfilter is enabled or notboolean
isInRange(java.lang.String IPAddress)
Checks an address to see if its in an allowed rangevoid
reload()
Reloads the ip filter from the config file (obtainable using "getFile")void
removeRange(IPRange range)
Remove a rangevoid
save()
saves current setting to file given by getFilevoid
setEnabled(boolean value)
change the enabled statusvoid
setInRangeAddressesAreAllowed(boolean value)
Set the behaviour of the filter to either allow or deny access for defined rangesvoid
unban(java.lang.String IPAddress)
Removes a ban on an address-
Methods inherited from class com.biglybt.pifimpl.remote.RPObject
_fixupLocal, _getDelegate, _getName, _getOID, _lookupLocal, _lookupLocal, _refresh, _setRemote, getDispatcher, notSupported, notSupported
-
-
-
-
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
-
_setDelegate
protected void _setDelegate(java.lang.Object _delegate)
- Overrides:
_setDelegate
in classRPObject
-
_setLocal
public java.lang.Object _setLocal() throws RPException
- Overrides:
_setLocal
in classRPObject
- Throws:
RPException
-
getFile
public java.io.File getFile()
Description copied from interface:IPFilter
Gets the file name used for persistent ranges
-
createRange
public IPRange createRange(int address_type, 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 interfaceIPFilter
- Parameters:
address_type
- - 1= ipv4, 2=ipv6this_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
-
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 interfaceIPFilter
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 interfaceIPFilter
-
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 interfaceIPFilter
- Throws:
IPFilterException
-
getRanges
public IPRange[] getRanges()
Description copied from interface:IPFilter
Gets the current set of defined IP ranges
-
isInRange
public boolean isInRange(java.lang.String IPAddress)
Description copied from interface:IPFilter
Checks an address to see if its in an allowed range
-
getBlockedIPs
public IPBlocked[] getBlockedIPs()
Description copied from interface:IPFilter
Gets the current list of blocked addresses- Specified by:
getBlockedIPs
in interfaceIPFilter
- Returns:
-
block
public void block(java.lang.String IPAddress)
Description copied from interface:IPFilter
Explicitly blocks an address
-
getBannedIPs
public IPBanned[] getBannedIPs()
Description copied from interface:IPFilter
Gets the current list of b addresses- Specified by:
getBannedIPs
in interfaceIPFilter
- Returns:
-
ban
public void ban(java.lang.String IPAddress, java.lang.String text)
Description copied from interface:IPFilter
Explicitly bans an address
-
unban
public void unban(java.lang.String IPAddress)
Description copied from interface:IPFilter
Removes a ban on an address
-
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 interfaceIPFilter
- 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 interfaceIPFilter
-
isEnabled
public boolean isEnabled()
Description copied from interface:IPFilter
Test if ipfilter is enabled or not
-
setEnabled
public void setEnabled(boolean value)
Description copied from interface:IPFilter
change the enabled status- Specified by:
setEnabled
in interfaceIPFilter
-
save
public void save() throws IPFilterException
Description copied from interface:IPFilter
saves current setting to file given by getFile- Specified by:
save
in interfaceIPFilter
- Throws:
IPFilterException
-
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 interfaceIPFilter
- Returns:
-
getNumberOfRanges
public int getNumberOfRanges()
Description copied from interface:IPFilter
returns length of ranges list- Specified by:
getNumberOfRanges
in interfaceIPFilter
- Returns:
-
getNumberOfBlockedIPs
public int getNumberOfBlockedIPs()
Description copied from interface:IPFilter
returns length of blocked ip list- Specified by:
getNumberOfBlockedIPs
in interfaceIPFilter
- Returns:
-
getNumberOfBannedIPs
public int getNumberOfBannedIPs()
Description copied from interface:IPFilter
returns length of banned ip list- Specified by:
getNumberOfBannedIPs
in interfaceIPFilter
- Returns:
-
-