de.innovationgate.utils.net
public class IPv4Restriction extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
TYPE_HOST
Restriction including a single host
|
static java.lang.String |
TYPE_NETWORK
Restriction including a network
|
static java.lang.String |
TYPE_RANGE
Restriction including an IP range
|
Constructor and Description |
---|
IPv4Restriction(ClientRestriction restriction) |
IPv4Restriction(java.lang.String type)
Creates a restriction of the given type
|
Modifier and Type | Method and Description |
---|---|
boolean |
exists(IPv4Address ip)
checks if the given ip is included in this restriction
|
IPv4Address |
getEndIP()
Returns the end ip of a restriction of
TYPE_RANGE |
IPv4Address |
getHostIP()
Returns the host ip of a restriction of
TYPE_HOST |
IPv4Address |
getNetmask()
Returns the netmask of a restriction of
TYPE_NETWORK |
IPv4Address |
getNetwork()
Returns the network address of a restriction of
TYPE_NETWORK |
static java.util.List |
getRestrictions(org.dom4j.Element clientRestrictions)
Parses client restrictions from wga.xml
|
static java.util.List<IPv4Restriction> |
getRestrictions(java.util.List<ClientRestriction> restrictions,
java.lang.String dbkey,
org.apache.log4j.Logger log) |
IPv4Address |
getStartIP()
Returns the start ip of a restriction of type
TYPE_RANGE |
java.lang.String |
getType()
Returns the restriction type as constant TYPE_...
|
static IPv4Restriction |
parseRestrictionString(java.lang.String str) |
static void |
saveRestrictions(org.dom4j.Element clientRestrictions,
java.util.List restrictions)
Writes restrictions to wga.xml.
|
void |
setEndIP(IPv4Address endIP)
Sets the end ip of a restriction of
TYPE_RANGE |
void |
setHostIP(IPv4Address hostIP)
Sets the host ip of a restriction of
TYPE_HOST |
void |
setNetmask(IPv4Address netmask)
Sets the netmask of a restriction of
TYPE_NETWORK |
void |
setNetwork(IPv4Address network)
Sets the network address of a restriction of
TYPE_NETWORK |
void |
setStartIP(IPv4Address startIP)
Sets the start ip of a restriction of type
TYPE_RANGE |
void |
setType(java.lang.String type)
Sets the restriction type.
|
java.lang.String |
toString() |
public static final java.lang.String TYPE_HOST
public static final java.lang.String TYPE_NETWORK
public static final java.lang.String TYPE_RANGE
public IPv4Restriction(java.lang.String type)
type
- The restriction type. Use constants TYPE_...public IPv4Restriction(ClientRestriction restriction) throws java.lang.Exception
java.lang.Exception
public static IPv4Restriction parseRestrictionString(java.lang.String str) throws FormattingException
FormattingException
public java.lang.String toString()
toString
in class java.lang.Object
public IPv4Address getEndIP()
TYPE_RANGE
public void setEndIP(IPv4Address endIP)
TYPE_RANGE
endIP
- public IPv4Address getHostIP()
TYPE_HOST
public void setHostIP(IPv4Address hostIP)
TYPE_HOST
hostIP
- public IPv4Address getNetmask()
TYPE_NETWORK
public void setNetmask(IPv4Address netmask)
TYPE_NETWORK
netmask
- public IPv4Address getNetwork()
TYPE_NETWORK
public void setNetwork(IPv4Address network)
TYPE_NETWORK
network
- public IPv4Address getStartIP()
TYPE_RANGE
public void setStartIP(IPv4Address startIP)
TYPE_RANGE
startIP
- public java.lang.String getType()
public void setType(java.lang.String type)
type
- public static java.util.List getRestrictions(org.dom4j.Element clientRestrictions)
clientRestrictions
- The client restrictions parent element in wga.xm�lIPv4Restriction
objectspublic static java.util.List<IPv4Restriction> getRestrictions(java.util.List<ClientRestriction> restrictions, java.lang.String dbkey, org.apache.log4j.Logger log)
public static void saveRestrictions(org.dom4j.Element clientRestrictions, java.util.List restrictions)
clientRestrictions
- The client restrictions parent element in wga.xmlrestrictions
- The restrictions to write. List of IPv4Restriction
objects.public boolean exists(IPv4Address ip)
ip
- IPAddress to check for