|
JNodeOS v1.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.utah.janos.nodeos.pj_DemultiplexKey | +--edu.utah.janos.nodeos.DemultiplexKey
A key for matching incoming packets.
InChannel
,
CutThroughChannel
Inner classes inherited from class edu.utah.janos.nodeos.pj_DemultiplexKey |
pj_DemultiplexKey.ByteMask |
Field Summary | |
static int |
ETH_ALLFLAGS
|
static int |
ETH_ANYDADDR
|
static int |
ETH_ANYETYPE
|
static int |
ETH_ANYSADDR
|
static int |
IPV4_ALLFLAGS
|
static int |
IPV4_ANYDADDR
|
static int |
IPV4_ANYPROTO
|
static int |
IPV4_ANYSADDR
|
Constructor Summary | |
DemultiplexKey(Flow flow)
Create a new demultiplex key. |
Method Summary | |
void |
add(int offset,
byte b)
Add a segment matching the given byte offset bytes from the last segment. |
void |
add(int offset,
int length,
byte[] sequence,
byte[] mask)
Add a segment that matches the given sequence of bytes, skipping offset bytes from the previous segment. |
void |
add(int offset,
short s)
Add a segment matching the given short offset bytes from the last segment. |
void |
addANEP(int offset,
byte version,
boolean allVersions,
short protocolID)
Add a segment that matches an ANEP header. |
void |
addETH(int offset,
int flags,
byte[] src,
byte[] dst,
short type)
Add a segment to match an Ethernet header. |
void |
addIPv4(int offset,
int flags,
int source,
int srcMask,
int dest,
int dstMask,
byte protocol)
Add a segment to match an IPv4 header. |
void |
addTCP(int offset,
int srcPort,
int destPort)
Add a segment to match a TCP header, needs to be preceded by a call to matchIPv4 . |
void |
addUDP(int offset,
int srcPort,
int destPort)
Add a segment to match a UDP header, needs to be preceded by a call to matchIPv4 . |
int |
length()
Get the "length" of this key. |
void |
match(int offset,
int i)
Add a segment matching the given int offset bytes from the last segment. |
void |
match(int offset,
long l)
Add a segment matching the given long offset bytes from the last segment. |
int |
matches(byte[] payload,
int payloadStart,
int payloadLength)
Test a packet to see if this key would match that packet. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final int ETH_ANYSADDR
public static final int ETH_ANYDADDR
public static final int ETH_ANYETYPE
public static final int ETH_ALLFLAGS
public static final int IPV4_ANYSADDR
public static final int IPV4_ANYDADDR
public static final int IPV4_ANYPROTO
public static final int IPV4_ALLFLAGS
Constructor Detail |
public DemultiplexKey(Flow flow)
Method Detail |
public void add(int offset, int length, byte[] sequence, byte[] mask)
XXX currently mask must be null.
XXX should throw a custom exception for bogon parameters (vs. Error).
offset
- The offset from the end of the previous segment.length
- The length of the bytes to matchsequence
- The sequence of bytes to matchmask
- If non-null, its a bit mask that indicates which bytes
in `sequence' should be matched.public void add(int offset, byte b)
Equivalent to:
byte[] barray = new byte[1]; barray[0] = b; match(offset, 1, barray, null);
public void add(int offset, short s)
XXX currently does not convert s to network order. Should it?
public void match(int offset, int i)
XXX currently does not convert i to network order. Should it?
public void match(int offset, long l)
XXX currently does not convert l to network order. Should it?
public void addETH(int offset, int flags, byte[] src, byte[] dst, short type)
offset
- The offset from the previous segment.flags
- The flags that indicate which parameters should be
ignored (i.e. wildcards).src
- The source address to match.dst
- The destination address to match.type
- The type of ethernet packet to match.public void addIPv4(int offset, int flags, int source, int srcMask, int dest, int dstMask, byte protocol)
Use this instead of the vanilla match() to get a "payloadOffset" in the deliver func that will skip IP options. (A vanilla match() call will leave payloadOffset in the first byte after the "protocol" byte, which is not necessairly the first byte of the payload in an IP packet (e.g., one with options).
offset
- the offset of the IPv4 header in the packet.flags
- The flags that indicate which parameters should be
ignored (i.e. wildcards).source
- the 32-bit IPv4 source address to match in the header.dest
- the 32-bit IPv4 destination address to match in the header.protocol
- the 16-bit IPv4 protocol identifier.public void addUDP(int offset, int srcPort, int destPort)
matchIPv4
.public void addTCP(int offset, int srcPort, int destPort)
matchIPv4
.public void addANEP(int offset, byte version, boolean allVersions, short protocolID)
version
- The ANEP version number to matchallVersions
- Match any version of ANEPprotocolID
- The protocolID to matchpublic final int matches(byte[] payload, int payloadStart, int payloadLength)
XXX payloadLength has odd semantics. Either explain why, or fix the callers of this method.
payload
- The packet datapayloadStart
- The place to start matching in `payload'payloadLength
- The length of data in payload, including bytes
up to payloadStart.public final int length()
public java.lang.String toString()
|
JNodeOS v1.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |