public class PortForwardRule
extends java.lang.Object
Constructor and Description |
---|
PortForwardRule()
Constructor of
PortForwardRule object. |
PortForwardRule(java.lang.String iface,
java.lang.String address,
java.lang.String protocol,
int inPort,
int outPort,
java.lang.String permittedNetwork,
int permittedNetworkMask,
java.lang.String permittedMAC,
java.lang.String sourcePortRange)
Constructor of
PortForwardRule object. |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAddress()
Getter for address
|
java.lang.String |
getIface()
Getter for iface
|
int |
getInPort()
Getter for inPort
|
int |
getOutPort()
Getter for outPort
|
java.lang.String |
getPermittedMAC()
Getter for permittedMAC
|
java.lang.String |
getPermittedNetwork()
Getter for permittedNetwork
|
int |
getPermittedNetworkMask()
Getter for permittedNetworkMask
|
java.lang.String |
getProtocol()
Getter for protocol
|
java.lang.String |
getSourcePortRange()
Getter for sourcePortRange
|
boolean |
isComplete()
Returns true if the required
LocalRule parameters have all been set. |
void |
setAddress(java.lang.String address)
Setter for address
|
void |
setIface(java.lang.String iface)
Setter for iface
|
void |
setInPort(int inPort)
Setter for inPort
|
void |
setOutPort(int outPort)
Setter for outPort
|
void |
setPermittedMAC(java.lang.String permittedMAC)
Setter for permittedMAC
|
void |
setPermittedNetwork(java.lang.String permittedNetwork)
Setter for permittedNetwork
|
void |
setPermittedNetworkMask(int permittedNetworkMask)
Setter for permittedNetworkMask
|
void |
setProtocol(java.lang.String protocol)
Setter for protocol
|
void |
setSourcePortRange(java.lang.String sourcePortRange)
Setter for sourcePortRange
|
java.lang.String |
toString()
Converts the
PortForwardRule to a String . |
public PortForwardRule(java.lang.String iface, java.lang.String address, java.lang.String protocol, int inPort, int outPort, java.lang.String permittedNetwork, int permittedNetworkMask, java.lang.String permittedMAC, java.lang.String sourcePortRange)
PortForwardRule
object.iface
- interface name on which inbound connection is allowed (such as ppp0)inPort
- inbound port on which to listen for port forwardprotocol
- protocol of port connection (tcp, udp)address
- destination IP address to forward IP trafficoutPort
- destination port to forward IP trafficpermittedNetwork
- source network or ip address from which connection is allowed (such as 192.168.1.0)permittedNetworkMask
- source network mask from which connection is allowed (such as 255.255.255.0)permittedMAC
- MAC address from which connection is allowed (such as AA:BB:CC:DD:EE:FF)sourcePortRange
- range of source ports allowed on IP connection (sourcePort1:sourcePort2)public PortForwardRule()
PortForwardRule
object.public boolean isComplete()
LocalRule
parameters have all been set. Returns false otherwise.public java.lang.String toString()
PortForwardRule
to a String
.
Returns one of the following iptables strings depending on the PortForwardRule
format:
iptables -t nat -A PREROUTING -i {iface} -p {protocol} --dport {inPort} -j DNAT --to {address}:{outPort}
iptables -t nat -A PREROUTING -i {iface} -p {protocol} --sport {sourcePortRange} --dport {inPort} -j DNAT --to {address}:{outPort}
iptables -t nat -A PREROUTING -i {iface} -p {protocol} -m mac --mac-source {permittedMAC} --dport {inPort} -j DNAT --to {address}:{outPort}
iptables -t nat -A PREROUTING -i {iface} -p {protocol} -m mac --mac-source {permittedMAC} --sport {sourcePortRange} --dport {inPort} -j DNAT --to {address}:{outPort}
iptables -t nat -A PREROUTING -i {iface} -p {protocol} -s {permittedNetwork} --dport {inPort} -j DNAT --to {address}:{outPort}
iptables -t nat -A PREROUTING -i {iface} -p {protocol} -s {permittedNetwork} --sport {sourcePortRange} --dport {inPort} -j DNAT --to {address}:{outPort}
iptables -t nat -A PREROUTING -i {iface} -p {protocol} -s {permittedNetwork} -m mac --mac-source {permittedMAC} --dport {inPort} -j DNAT --to {address}:{outPort}
iptables -t nat -A PREROUTING -i {iface} -p {protocol} -s {permittedNetwork} -m mac --mac-source {permittedMAC} --sport {sourcePortRange} --dport {inPort} -j DNAT --to {address}:{outPort}
toString
in class java.lang.Object
PortForwardRule
public java.lang.String getIface()
public void setIface(java.lang.String iface)
iface
- the iface to setpublic java.lang.String getAddress()
public void setAddress(java.lang.String address)
address
- the address to setpublic java.lang.String getProtocol()
public void setProtocol(java.lang.String protocol)
protocol
- the protocol to setpublic int getInPort()
public void setInPort(int inPort)
inPort
- the inPort to setpublic int getOutPort()
public void setOutPort(int outPort)
outPort
- the outPort to setpublic java.lang.String getPermittedNetwork()
public void setPermittedNetwork(java.lang.String permittedNetwork)
permittedNetwork
- the permittedNetwork to setpublic int getPermittedNetworkMask()
public void setPermittedNetworkMask(int permittedNetworkMask)
permittedNetworkMask
- of the permittedNetwork to setpublic java.lang.String getPermittedMAC()
public void setPermittedMAC(java.lang.String permittedMAC)
permittedMAC
- the permittedMAC to setpublic java.lang.String getSourcePortRange()
public void setSourcePortRange(java.lang.String sourcePortRange)
sourcePortRange
- the sourcePortRange to setCopyright © 2009 Eurotech Inc. All rights reserved.