edu.uiuc.cs.net.DPRPManager
Class DPRPRestriction

java.lang.Object
  |
  +--edu.uiuc.cs.net.DPRPManager.DPRPRestriction

public class DPRPRestriction
extends java.lang.Object

This class comprises a set of restrictions against a potential DPRP client. In the interests of security, there are several operations that the site administrator may wish to constrain for certain clients. These capabilities include:

These restrictions are fed into the server via an ASCII text configuration file, the format of which is described in the ServerPortMgr class.

Version:
1.0 - September 18th, 2001
Author:
Andy Reitz (areitz@cs.uiuc.edu)

Field Summary
(package private)  int allowedNumRenewals
          Number of times client is allowed to renew lease (to prevent running unauthorized servers).
(package private)  java.net.InetAddress clientIP
          The IP address of the client to be restricted.
static int defaultMaxDuration
          Default maximum duration (MAX_INT).
static int defaultMaxPort
          Default maximum allowed port (65536).
static int defaultMinDuration
          Default minimum duration (500).
(package private)  boolean denied
          If the client is even allowed to speak DPRP.
(package private)  int maxDuration
          The longest lease time the client is allowed (to prevent running unauthorized servers).
(package private)  int maxPort
          The highest port the client is allowed to request.
(package private)  int minDuration
          The shortest lease time the client is allowed (to prevent DoS).
(package private)  int minPort
          The smallest port the client is allowed to request.
(package private)  boolean renewOK
          If the client is allowed to renew at all.
 
Constructor Summary
DPRPRestriction(java.net.InetAddress cip)
          The main constructor for a new restriction.
 
Method Summary
 boolean checkDuration(int inDur)
          Checks the given duration, to see if it is allowed.
 boolean checkNumRenews(int nr)
          Checks if the number of times a lease has been renewed is allowed.
 boolean checkPort(int inPort)
          Checks the given port, to see if it is allowed.
 java.net.InetAddress getClientIP()
          Returns the client IP address.
 int getMaxDuration()
          Returns maxDuration.
 int getMaxPort()
          Returns maxPort.
 int getMinDuration()
          Returns minDuration.
 int getMinPort()
          Returns minPort.
 int getNumRenewals()
          Returns allowedNumRenewals.
 boolean isDenied()
          Returns true if client is denied from accessing server.
 void prettyPrint()
          A utility method, for displaying the restriction contents in a human-readable way.
 boolean renewAllowed()
          Returns true if client allowed to renew leases.
 void setClientIP(java.net.InetAddress cr)
          Sets the client IP address for this restriction.
 void setIsDenied()
          Denies the client.
 void setMaxDuration(int mad)
          Sets the maximum allowed duration.
 void setMaxPort(int map)
          Sets the maximum allowed port.
 void setMinDuration(int mid)
          Sets the minimum allowed duration.
 void setMinPort(int mip)
          Sets the minimum allowed port.
 void setNumRenewals(int mr)
          Sets the maximum number of lease renewals.
 void setRenewNotOK()
          Stops the client from being able to renewing any leases.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

clientIP

java.net.InetAddress clientIP
The IP address of the client to be restricted.

denied

boolean denied
If the client is even allowed to speak DPRP.

renewOK

boolean renewOK
If the client is allowed to renew at all.

allowedNumRenewals

int allowedNumRenewals
Number of times client is allowed to renew lease (to prevent running unauthorized servers).

minDuration

int minDuration
The shortest lease time the client is allowed (to prevent DoS).

maxDuration

int maxDuration
The longest lease time the client is allowed (to prevent running unauthorized servers).

minPort

int minPort
The smallest port the client is allowed to request.

maxPort

int maxPort
The highest port the client is allowed to request.

defaultMinDuration

public static final int defaultMinDuration
Default minimum duration (500).

defaultMaxDuration

public static final int defaultMaxDuration
Default maximum duration (MAX_INT).

defaultMaxPort

public static final int defaultMaxPort
Default maximum allowed port (65536).
Constructor Detail

DPRPRestriction

public DPRPRestriction(java.net.InetAddress cip)
The main constructor for a new restriction. It gives everything default values.
Parameters:
cip - The client IP address.
Method Detail

checkDuration

public boolean checkDuration(int inDur)
Checks the given duration, to see if it is allowed.
Parameters:
inDur - A duration, checked to see that it is greater than (or equal to) minDuration, but less than (or equal to) maxDuration.
Returns:
True if the parameter satisfies the conditional, false otherwise.

checkPort

public boolean checkPort(int inPort)
Checks the given port, to see if it is allowed.
Parameters:
inPort - A port number, checked to see that it is greater than (or equal to) minPort, but less than (or equal to) maxPort.
Returns:
True if the parameter satisfies the conditional, false otherwise.

checkNumRenews

public boolean checkNumRenews(int nr)
Checks if the number of times a lease has been renewed is allowed.
Parameters:
nr - A number of renews, that should be less than the number of NumRenewals allowed for this client.
Returns:
True if the paramater satisfies the conditional, false otherwise.

setMaxDuration

public void setMaxDuration(int mad)
Sets the maximum allowed duration.

setMinDuration

public void setMinDuration(int mid)
Sets the minimum allowed duration.

setMaxPort

public void setMaxPort(int map)
Sets the maximum allowed port.

setMinPort

public void setMinPort(int mip)
Sets the minimum allowed port.

setIsDenied

public void setIsDenied()
Denies the client.

setRenewNotOK

public void setRenewNotOK()
Stops the client from being able to renewing any leases.

setNumRenewals

public void setNumRenewals(int mr)
Sets the maximum number of lease renewals.

setClientIP

public void setClientIP(java.net.InetAddress cr)
Sets the client IP address for this restriction.

getMaxDuration

public int getMaxDuration()
Returns maxDuration.

getMinDuration

public int getMinDuration()
Returns minDuration.

getMaxPort

public int getMaxPort()
Returns maxPort.

getMinPort

public int getMinPort()
Returns minPort.

isDenied

public boolean isDenied()
Returns true if client is denied from accessing server.

renewAllowed

public boolean renewAllowed()
Returns true if client allowed to renew leases.

getNumRenewals

public int getNumRenewals()
Returns allowedNumRenewals.

getClientIP

public java.net.InetAddress getClientIP()
Returns the client IP address.

prettyPrint

public void prettyPrint()
A utility method, for displaying the restriction contents in a human-readable way.