public class LocalRule
extends java.lang.Object
Constructor and Description |
---|
LocalRule()
Constructor of
LocalRule object. |
LocalRule(int port,
java.lang.String protocol,
java.lang.String permittedNetwork,
int permittedNetworkMask,
java.lang.String permittedMAC,
java.lang.String sourcePortRange)
Constructor of
LocalRule object. |
LocalRule(java.lang.String portRange,
java.lang.String protocol,
java.lang.String permittedNetwork,
int permittedNetworkMask,
java.lang.String permittedMAC,
java.lang.String sourcePortRange)
Constructor of
LocalRule object. |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getPermittedMAC()
Getter for permittedMAC
|
java.lang.String |
getPermittedNetwork()
Getter for permittedNetwork
|
int |
getPermittedNetworkMask()
Getter for permittedNetworkMask
|
int |
getPort()
Getter for port
|
java.lang.String |
getPortRange()
Getter for portRange
|
java.lang.String |
getProtocol()
Getter for protocol
|
java.lang.String |
getSourcePortRange()
Getter for the sourcePortRange.
|
boolean |
isComplete()
Returns true if the required
LocalRule parameters have all been set. |
void |
setPermittedMAC(java.lang.String permittedMAC)
Setter for the permittedMAC.
|
void |
setPermittedNetwork(int permittedNetworkMask)
Setter for the permittedNetworkMask.
|
void |
setPermittedNetwork(java.lang.String permittedNetwork)
Setter for the permittedNetwork.
|
void |
setPort(int port)
Setter for the port.
|
void |
setPortRange(java.lang.String portRange)
Setter for the portRange
|
void |
setProtocol(java.lang.String protocol)
Setter for the protocol.
|
void |
setSourcePortRange(java.lang.String sourcePortRange)
Setter for the sourcePortRange.
|
java.lang.String |
toString()
Converts the
LocalRule to a String . |
public LocalRule(int port, java.lang.String protocol, java.lang.String permittedNetwork, int permittedNetworkMask, java.lang.String permittedMAC, java.lang.String sourcePortRange)
LocalRule
object.port
- destination local IP port number to allowprotocol
- protocol of port (tcp, udp)sourcePortRange
- range of source ports allowed on IP connection (sourcePort1:sourcePort2)permittedNetwork
- source network or ip address from which connection is allowed (such as 192.168.1.0)permittedMAC
- MAC address from which connection is allowed (such as AA:BB:CC:DD:EE:FF)public LocalRule(java.lang.String portRange, java.lang.String protocol, java.lang.String permittedNetwork, int permittedNetworkMask, java.lang.String permittedMAC, java.lang.String sourcePortRange)
LocalRule
object.portRange
- destination local IP port range to allow of the form X:Y where Xprotocol
- protocol of port (tcp, udp)sourcePortRange
- range of source ports allowed on IP connection (sourcePort1:sourcePort2)permittedNetwork
- source network or ip address from which connection is allowed (such as 192.168.1.0)permittedMAC
- MAC address from which connection is allowed (such as AA:BB:CC:DD:EE:FF)public LocalRule()
LocalRule
object.public boolean isComplete()
LocalRule
parameters have all been set. Returns false otherwise.public void setProtocol(java.lang.String protocol)
protocol
- A String representing the protocol.public void setPermittedNetwork(java.lang.String permittedNetwork)
permittedNetwork
- A String representing the permittedNetwork.public void setPermittedNetwork(int permittedNetworkMask)
permittedNetworkMask
- An int representing the permittedNetworkMask.public void setPermittedMAC(java.lang.String permittedMAC)
permittedMAC
- A String representing the permittedMAC.public void setSourcePortRange(java.lang.String sourcePortRange)
sourcePortRange
- A String representing the sourcePortRange.public void setPort(int port)
port
- An int representing the port.public void setPortRange(java.lang.String portRange)
portRange
- A string representing the port range of the form X:Y where X < Y and both are valid portspublic java.lang.String getSourcePortRange()
public int getPort()
public java.lang.String getPortRange()
public java.lang.String getProtocol()
public java.lang.String getPermittedNetwork()
public int getPermittedNetworkMask()
public java.lang.String getPermittedMAC()
public java.lang.String toString()
LocalRule
to a String
.
Returns one of the following iptables strings depending on the LocalRule
format:
iptables -I INPUT -p {protocol} --dport {port} -j ACCEPT
iptables -I INPUT -p {protocol} --sport {sourcePort1:sourcePort2} --dport {port} -j ACCEPT
iptables -I INPUT -p {protocol} -m mac --mac-source {permittedMAC} --dport {port} -j ACCEPT
iptables -I INPUT -p {protocol} -m mac --mac-source {permittedMAC} --sport {sourcePort1:sourcePort2} --dport {port} -j ACCEPT
iptables -I INPUT -p {protocol} -s {permittedNetwork} --dport {port} -j ACCEPT
iptables -I INPUT -p {protocol} -s {permittedNetwork} --sport {sourcePort1:sourcePort2} --dport {port} -j ACCEPT
iptables -I INPUT -p {protocol} -s {permittedNetwork} -m mac --mac-source {permittedMAC} --dport {port} -j ACCEPT
iptables -I INPUT -p {protocol} -s {permittedNetwork} -m mac --mac-source {permittedMAC} --sport {sourcePort1:sourcePort2} --dport {port} -j ACCEPT
toString
in class java.lang.Object
Copyright © 2009 Eurotech Inc. All rights reserved.