|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.opennms.protocols.icmpd.MessageHeader | +--org.opennms.protocols.icmpd.CtrlFilterMessage
Defines the control filter message for filtering received icmp messages from a remote host. The format of the message is as follows:
+--------+--------+----------------+ | TYPE | CODE | SEQUENCE | +--------+--------+--------+-------+ | LENGTH |FILTERON| ACTION| +-----------------+--------+-------+ | PACKET OFFSET | +----------------------------------+ | FILTER LENGTH | +----------------------------------+ | FILTER DATA | | | +----------------------------------+
Field Summary | |
static byte |
ACTION_DISCARD
If the filter matches discard the datagram. |
static byte |
ACTION_PASS
If the filter matches return the datagram. |
static byte |
CODE
The code for the class. |
static byte |
FILTER_ON_ICMP
Filter on the ICMP message. |
static byte |
FILTER_ON_IPHEADER
Filter on the IP Header. |
private byte[] |
m_filterData
The actual filter data. |
private int |
m_filterLen
The valid length of the filter data |
private int |
m_packetOffset
The offset into the icmp or ip header packet. |
static byte |
TYPE
The type for the class. |
Fields inherited from class org.opennms.protocols.icmpd.MessageHeader |
m_code, m_length, m_reserved, m_sequence, m_type, sm_seq, TYPE_CONTROL, TYPE_DATA |
Constructor Summary | |
|
CtrlFilterMessage()
Creates a new control filter message for sending to the icmp daemon. |
|
CtrlFilterMessage(byte filterOn,
byte action,
int offset,
byte[] data)
Creates a new control filter message based on the passed parameters. |
(package private) |
CtrlFilterMessage(MessageHeader hdr,
InputStream istream)
Creates a new control filter message based on the message header and the input stream. |
Method Summary | |
private void |
calculateLength()
|
byte[] |
getFilter()
Returns the encapsulated filter data. |
int |
getFilterLength()
Returns the number of valid bytes of filter data |
int |
getOffset()
Returns the starting offset for the filter when comparing it against retreived icmp messages or received ip headers. |
boolean |
isDiscardAction()
Returns true if the filter is marked for discarding matched packets. |
boolean |
isICMPFilter()
Returns true fi the filter is set to check ICMP messages. |
boolean |
isIPFilter()
Returns true if the filter is set to check IP headers |
boolean |
isPassAction()
Returns true if the filter is marked for sending matched packets. |
void |
setAction(byte action)
Sets the action for the filter object. |
void |
setFilter(int offset,
byte[] data)
Sets the encapsulated filter data. |
void |
setFilterOn(byte filterOn)
Sets teh filter field of the object. |
(package private) void |
write(OutputStream ostream)
Seralizes the object to the icmp daemon using the passed connection stream. |
Methods inherited from class org.opennms.protocols.icmpd.MessageHeader |
align4, getCode, getLength, getSequence, getType, makeInt, makeShort, nextSequenceId, read, setSequence |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final byte TYPE
public static final byte CODE
public static final byte FILTER_ON_IPHEADER
public static final byte FILTER_ON_ICMP
public static final byte ACTION_DISCARD
public static final byte ACTION_PASS
private int m_packetOffset
private byte[] m_filterData
private int m_filterLen
Constructor Detail |
public CtrlFilterMessage()
CtrlFilterMessage(MessageHeader hdr, InputStream istream) throws IOException
hdr
- The message header.istream
- The input stream containing the reamining data.IOException
- Thrown if an error occurs with the input streamIllegalArgumentException
- Thrown if the header is not valid.public CtrlFilterMessage(byte filterOn, byte action, int offset, byte[] data)
filterOn
- Filter on IP header or ICMP data.action
- Pass or Discard matched packets.offset
- The offset into the packet.data
- The filter data.Method Detail |
private void calculateLength()
public boolean isIPFilter()
public boolean isICMPFilter()
public void setFilterOn(byte filterOn)
filterOn
- The part of the received message to
perform filtering on.public void setFilter(int offset, byte[] data)
offset
- The offset into the packet.data
- The comparison data.public byte[] getFilter()
getFilterLength()
public int getFilterLength()
public int getOffset()
public boolean isDiscardAction()
public boolean isPassAction()
public void setAction(byte action)
byte
- The action to be performed by the filter.void write(OutputStream ostream) throws IOException
write
in class MessageHeader
ostream
- The connection sink.IOException
- Thrown if an I/O error occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |