|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.clackrouter.component.base.ClackComponent net.clackrouter.component.extension.Classifier
public class Classifier
Classifies packets and sends them out distict ports if they match user-specified byte-string/offset pairs called patterns.
This is a very powerful but very general component that can be used to demultiplex packets based on different header information. The number of output ports is dynamic, depending on the total number of possible pattern matches.
Nested Class Summary | |
---|---|
class |
Classifier.PatternMatcher
|
protected class |
Classifier.QuickMatch
|
Nested classes/interfaces inherited from class net.clackrouter.component.base.ClackComponent |
---|
ClackComponent.Waiter |
Field Summary | |
---|---|
protected java.util.ArrayList |
mPatternMatchers
|
static int |
sFROM_IFACE
|
Fields inherited from class net.clackrouter.component.base.ClackComponent |
---|
componentCell, m_has_error, m_log, m_name, m_num_ports, m_packetcount_in, m_packetcount_out, m_ports, mListeners, mRouter, pendingError, SIGNAL_ERROR_LEN_MSEC, UNIQUE_COUNT, view |
Constructor Summary | |
---|---|
Classifier(Router router,
java.lang.String name)
|
Method Summary | |
---|---|
void |
acceptPacket(VNSPacket packet,
int port_number)
The starting point for packet-processing when packets are "pushed" to this component. |
protected void |
addNewPortToArray(java.lang.String descr)
|
boolean |
addPattern(java.lang.String pattern)
|
boolean |
delPattern(int index)
|
Classifier.PatternMatcher |
getPattern(int index)
|
java.lang.Object[] |
getPatterns()
|
javax.swing.JPanel |
getPropertiesView()
Method for getting the properties view associated with this component Property views are used to display more detailed information about internal component state. |
java.util.Properties |
getSerializableProperties(boolean isTransient)
Used to get all values the component would like to serialize to file. |
void |
initializeProperties(java.util.Properties props)
Method used to initialize a component based on serialized properties values saved to a file. |
boolean |
isModifying()
Reports whether this component modifies packets passed through it This value is used by the static checking algorithm used to make sure port connections are valid. |
protected void |
removePortFromArray(int portNum)
|
protected void |
setupPorts(int numports)
Allocates an array of ClackPort objects to be used by this component |
Methods inherited from class net.clackrouter.component.base.ClackComponent |
---|
createCopy, createInputPullPort, createInputPushPort, createOutputPullPort, createOutputPushPort, error, fireListeners, getColor, getComponentCell, getHierarchicalView, getLog, getName, getNumPorts, getPacketCountIn, getPacketCountOut, getPendingError, getPort, getRouter, getTime, getTypeName, getUniqueCount, getView, handlePullRequest, hasError, isHierarchical, log, notifyAlarm, poll, registerListener, sendOutPort, setAlarm, setComponentCell, setName, setPendingError, setView, showErrorDialog, signalError, try_repaint, unregisterListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int sFROM_IFACE
protected java.util.ArrayList mPatternMatchers
Constructor Detail |
---|
public Classifier(Router router, java.lang.String name)
Method Detail |
---|
protected void setupPorts(int numports)
ClackComponent
setupPorts
in class ClackComponent
numports
- the number of ports to createpublic boolean isModifying()
ClackComponent
isModifying
in class ClackComponent
protected void addNewPortToArray(java.lang.String descr)
protected void removePortFromArray(int portNum)
public boolean delPattern(int index)
public boolean addPattern(java.lang.String pattern)
public void acceptPacket(VNSPacket packet, int port_number)
ClackComponent
The starting point for packet-processing when packets are "pushed" to this component.
The default implementation warns that the packet is being ignored.
acceptPacket
in class ClackComponent
packet
- The pushed packetport_number
- The number of the port that this packet is arriving onpublic Classifier.PatternMatcher getPattern(int index)
public java.lang.Object[] getPatterns()
public javax.swing.JPanel getPropertiesView()
ClackComponent
getPropertiesView
in class ClackComponent
public java.util.Properties getSerializableProperties(boolean isTransient)
ClackComponent
Used to get all values the component would like to serialize to file.
These values are stored as String -> String pairs in a Properties
object. These
properties will be passed to ClackComponent.initializeProperties(Properties)
when the Component is recreated.
Serialization can be transient or not, which determines whether all or just some of the internal component state is saved. Transient serialization means that some properties will be saved which may make this serialized file invalid for use on different network or router set-ups. For example, saving info specific to the IP addresses of a certain topology would only happen if transient serialization was used. However, it can be desireable to save these properties when setting up exact demonstrations.
By default we have no properties to serialize, so we return an empty object
getSerializableProperties
in class ClackComponent
isTransient
- flag indicating if serialization is transient
public void initializeProperties(java.util.Properties props)
ClackComponent
Method used to initialize a component based on serialized properties values saved to a file.
By default, no action is performed
initializeProperties
in class ClackComponent
props
- all property values serialized for this component
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |