public class Ip4PacketFilter
extends SynchronousProcessor
| Modifier and Type | Field and Description |
|---|---|
static int |
ANY_PROTOCOL |
static int |
ICMP |
static int |
TCP |
static int |
UDP |
| Constructor and Description |
|---|
Ip4PacketFilter()
Instantiates a default filter that allows all packets through
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDestinationIp(java.lang.String dst)
Adds a destination IP to allow through the filter.
|
void |
addSourceIp(java.lang.String src)
Adds a source IP to allow through the filter.
|
Ip4PacketFilter |
clone() |
protected boolean |
compute(java.lang.Object[] inputs,
java.util.Queue<java.lang.Object[]> outputs) |
Processor |
duplicate(boolean with_state) |
void |
removeDestinationIp(java.lang.String dst)
Remove a destination IP from the filter.
|
void |
removeSourceIp(java.lang.String src)
Remove a source IP from the filter.
|
void |
setDestinationPort(int dst)
Set the destination port to allow through the filter
|
void |
setDestinationPortRange(int low,
int high)
Set a range of destination ports to allow through the filter
|
void |
setProtocol(int protocol)
Set the protocol to allow through the filter.
|
void |
setSourcePort(int src)
Set the source port to allow through the filter
|
void |
setSourcePortRange(int low,
int high)
Set a range of source ports to allow through the filter
|
public static final int ICMP
public static final int TCP
public static final int UDP
public static final int ANY_PROTOCOL
public Ip4PacketFilter()
public void addSourceIp(java.lang.String src)
src - IP address in string form (e.g. "192.168.0.1")public void removeSourceIp(java.lang.String src)
src - IP address in string form (e.g. "192.168.0.1")public void addDestinationIp(java.lang.String dst)
dst - IP address in string form (e.g. "192.168.0.1")public void removeDestinationIp(java.lang.String dst)
dst - IP address in string form (e.g. "192.168.0.1")public void setProtocol(int protocol)
protocol - the protocol ID, or PacketFilter.ANY_PROTOCOL to allow
all protocolspublic void setSourcePort(int src)
src - the port numberpublic void setSourcePortRange(int low,
int high)
low - the lower bound of the port range to allowhigh - the upper bound of the port range to allowpublic void setDestinationPort(int dst)
dst - the port numberpublic void setDestinationPortRange(int low,
int high)
low - the lower bound of the port range to allowhigh - the upper bound of the port range to allowprotected boolean compute(java.lang.Object[] inputs,
java.util.Queue<java.lang.Object[]> outputs)
public Ip4PacketFilter clone()
public Processor duplicate(boolean with_state)
Copyright © Sylvain HallĂ©. All Rights Reserved.