prupp
Class Access

java.lang.Object
  |
  +--prupp.Access

public class Access
extends java.lang.Object

A class to handle access to ip ranges.


Field Summary
static int ADMIN
          allowed to access metapages
static int FTP
          allowed to ftp
static int GOPHER
          allowed to run gopher over the proxy
static int HTTP
          allowed to access standard http (ordinary webpages)
static int HTTPS
          allowed to run secure transactions
static int NONE
          No access at all
static int WAIS
          allowed to run wais over the proxy
 
Constructor Summary
Access(int type, java.net.InetAddress lowipa, java.net.InetAddress highipa)
          Create a new Access with given ip-range and given type
Access(java.lang.String type, java.net.InetAddress lowip, java.net.InetAddress highip)
          Create a new Access with given ip-range and given type
 
Method Summary
 int getType()
          return the accesstype we have for this range
 boolean inrange(java.net.InetAddress ia)
          check if a given ip is in this accessrange
 void setType(int newType)
          sets the accesstype we have for this range
 java.lang.String toString()
          get the string representation of this access.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static int NONE
No access at all

ADMIN

public static int ADMIN
allowed to access metapages

HTTP

public static int HTTP
allowed to access standard http (ordinary webpages)

HTTPS

public static int HTTPS
allowed to run secure transactions

FTP

public static int FTP
allowed to ftp

GOPHER

public static int GOPHER
allowed to run gopher over the proxy

WAIS

public static int WAIS
allowed to run wais over the proxy
Constructor Detail

Access

public Access(java.lang.String type,
              java.net.InetAddress lowip,
              java.net.InetAddress highip)
Create a new Access with given ip-range and given type
Parameters:
type - one of http, admin, ftp, gopher, https, wais (caseinsensitive)
lowip - the lowest ip in the range
highip - the highest ip in the range

Access

public Access(int type,
              java.net.InetAddress lowipa,
              java.net.InetAddress highipa)
Create a new Access with given ip-range and given type
Parameters:
type - one of the constants (HTTP, FTP, ADMIN etc) or a OR (|) of them.
lowip - the lowest ip in the range
highip - the highest ip in the range
Method Detail

inrange

public boolean inrange(java.net.InetAddress ia)
check if a given ip is in this accessrange
Parameters:
ia - the ip we are testing.
Returns:
true if ia is in the range (inclusive), false otherwise

getType

public int getType()
return the accesstype we have for this range

setType

public void setType(int newType)
sets the accesstype we have for this range
Parameters:
newType - the new access for this range.

toString

public java.lang.String toString()
get the string representation of this access.
Overrides:
toString in class java.lang.Object