Class Ip4PacketFilter
java.lang.Object
ca.uqac.lif.cep.Processor
ca.uqac.lif.cep.SynchronousProcessor
netp.Ip4PacketFilter
- All Implemented Interfaces:
ca.uqac.lif.cep.Contextualizable, ca.uqac.lif.cep.Duplicable, ca.uqac.lif.cep.DuplicableProcessor
public class Ip4PacketFilter
extends ca.uqac.lif.cep.SynchronousProcessor
Discards packets from an input trace based on a selection criterion. These
criterion are net protocol, source and destination IP, and source and
destination port. A packet must satisfy ALL criterion to pass through the
filter. At least, it lets only IPv4 packets through, and discards the rest.
-
Nested Class Summary
Nested classes/interfaces inherited from class ca.uqac.lif.cep.SynchronousProcessor
ca.uqac.lif.cep.SynchronousProcessor.InputPushable, ca.uqac.lif.cep.SynchronousProcessor.OutputPullableNested classes/interfaces inherited from class ca.uqac.lif.cep.Processor
ca.uqac.lif.cep.Processor.InternalProcessorState -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intFields inherited from class ca.uqac.lif.cep.SynchronousProcessor
m_inputPushables, m_outputPullables, m_tempQueueFields inherited from class ca.uqac.lif.cep.Processor
m_context, m_hasBeenNotifiedOfEndOfTrace, m_inputArity, m_inputPullables, m_inputQueues, m_notifiedEndOfTraceDownstream, m_outputArity, m_outputPushables, m_outputQueues, MAX_PULL_RETRIES, s_versionString -
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a default filter that allows all packets through -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDestinationIp(String dst) Adds a destination IP to allow through the filter.voidaddSourceIp(String src) Adds a source IP to allow through the filter.clone()protected booleanca.uqac.lif.cep.Processorduplicate(boolean with_state) voidRemove a destination IP from the filter.voidremoveSourceIp(String src) Remove a source IP from the filter.voidsetDestinationPort(int dst) Set the destination port to allow through the filtervoidsetDestinationPortRange(int low, int high) Set a range of destination ports to allow through the filtervoidsetProtocol(int protocol) Set the protocol to allow through the filter.voidsetSourcePort(int src) Set the source port to allow through the filtervoidsetSourcePortRange(int low, int high) Set a range of source ports to allow through the filterMethods inherited from class ca.uqac.lif.cep.SynchronousProcessor
getPullableOutput, getPushableInputMethods inherited from class ca.uqac.lif.cep.Processor
allNotifiedEndOfTrace, allNull, copyInputQueue, copyOutputQueue, duplicate, duplicateInto, equals, getAt, getContext, getContext, getEmptyQueue, getId, getInputArity, getInputQueue, getInputType, getInputTypesFor, getOutputArity, getOutputQueue, getOutputType, getPullableInput, getPullableOutput, getPushableInput, getPushableOutput, hashCode, leftShift, newContext, onEndOfTrace, or, or, or, printState, readState, reset, rightShift, setContext, setContext, setPullableInput, setPushableOutput, start, startAll, stop, stopAll
-
Field Details
-
ICMP
public static final int ICMP- See Also:
-
TCP
public static final int TCP- See Also:
-
UDP
public static final int UDP- See Also:
-
ANY_PROTOCOL
public static final int ANY_PROTOCOL- See Also:
-
-
Constructor Details
-
Ip4PacketFilter
public Ip4PacketFilter()Instantiates a default filter that allows all packets through
-
-
Method Details
-
addSourceIp
Adds a source IP to allow through the filter. If the IP list is empty, all IPs pass through.- Parameters:
src- IP address in string form (e.g. "192.168.0.1")
-
removeSourceIp
Remove a source IP from the filter. If the IP list is empty, all IPs pass through.- Parameters:
src- IP address in string form (e.g. "192.168.0.1")
-
addDestinationIp
Adds a destination IP to allow through the filter. If the IP list is empty, all IPs pass through.- Parameters:
dst- IP address in string form (e.g. "192.168.0.1")
-
removeDestinationIp
Remove a destination IP from the filter. If the IP list is empty, all IPs pass through.- Parameters:
dst- IP address in string form (e.g. "192.168.0.1")
-
setProtocol
public void setProtocol(int protocol) Set the protocol to allow through the filter. The filtered protocol is the one within the IPv4 header.- Parameters:
protocol- the protocol ID, orPacketFilter.ANY_PROTOCOLto allow all protocols
-
setSourcePort
public void setSourcePort(int src) Set the source port to allow through the filter- Parameters:
src- the port number
-
setSourcePortRange
public void setSourcePortRange(int low, int high) Set a range of source ports to allow through the filter- Parameters:
low- the lower bound of the port range to allowhigh- the upper bound of the port range to allow
-
setDestinationPort
public void setDestinationPort(int dst) Set the destination port to allow through the filter- Parameters:
dst- the port number
-
setDestinationPortRange
public void setDestinationPortRange(int low, int high) Set a range of destination ports to allow through the filter- Parameters:
low- the lower bound of the port range to allowhigh- the upper bound of the port range to allow
-
compute
-
clone
-
duplicate
public ca.uqac.lif.cep.Processor duplicate(boolean with_state) - Specified by:
duplicatein interfaceca.uqac.lif.cep.Duplicable- Specified by:
duplicatein classca.uqac.lif.cep.Processor
-