All Packages  This Package  Class Hierarchy  Class Search  Index

Class edu.utah.janos.nodeos.DemultiplexKey
java.lang.Object
   |
   +----edu.utah.janos.nodeos.pj_DemultiplexKey
           |
           +----edu.utah.janos.nodeos.DemultiplexKey

  Summary

public class  DemultiplexKey
     extends edu.utah.janos.nodeos.pj_DemultiplexKey
{
          // Constructors 1
     public DemultiplexKey(Flow);

          // Methods 8
     pj_DemultiplexKey getNativeKey();
     public void match(int, int, byte[], boolean[]);
     public void matchANEP(int, byte, boolean, short);
     public void matchIPv4(int, int, int, int);
     public void matchTCP(int, int, int);
     public void matchUDP(int, int, int);
     public final int matches(byte[], int, int);
     public String toString();
}

A key for matching incoming packets.

Author:
Janos Ministry of Development

See Also: InChannel, CutThroughChannel


  Cross Reference

Extended By:
ANEPDemultiplexKey, StdinTest.StdinDemultiplexKey, SimpleDemultiplexKey





  Constructors

· DemultiplexKey

Summary  |  Top
   public DemultiplexKey(Flow flow) 

Create a new demultiplex key. By default, the key is empty (matches anything, or everything, I don't remember.)



  Methods

· match

Summary  |  Top
   public void match(int offset, 
                     int length, 
                     byte[] sequence, 
                     boolean[] mask) 

Add a segment that matches the given sequence of bytes at the given offset in the packet. The mask says which bytes of sequence are relevant. If mask is null, all bytes are relevant.

XXX currently mask must be null.

XXX should throw a real exception for bogon parameters (vs. Error).

Parameter Description
offset The offset from the previous segment to start matching
length The length of the bytes to match
sequence The sequence of bytes to match
mask If non-null, its a bit mask that indicates which bytes in `sequence' should be matched.

Overrides:
match in class pj_DemultiplexKey


· matchIPv4

Summary  |  Top
   public void matchIPv4(int offset, 
                         int source, 
                         int dest, 
                         int protocol) 

Add a segment to match an IPv4 header. Offset is the expected offset of the IPv4 header in the packet.

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).

XXX need well-defined wildcards for addresses and protocols.

Parameter Description
offset the offset of the IPv4 header in the packet.
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.

Overrides:
matchIPv4 in class pj_DemultiplexKey


· matchUDP

Summary  |  Top
   public void matchUDP(int offset, 
                        int srcPort, 
                        int destPort) 

Add a segment to match a UDP header, needs to be preceded by a call to matchIPv4.

XXX the exact semantics of 'offset' are not worked out yet.

Overrides:
matchUDP in class pj_DemultiplexKey


· matchTCP

Summary  |  Top
   public void matchTCP(int offset, 
                        int srcPort, 
                        int destPort) 

Add a segment to match a TCP header, needs to be preceded by a call to matchIPv4

XXX the exact semantics of 'offset' are not worked out yet.

Overrides:
matchTCP in class pj_DemultiplexKey


· matchANEP

Summary  |  Top
   public void matchANEP(int offset, 
                         byte version, 
                         boolean allVersions, 
                         short protocolID) 

Add a segment that matches an ANEP header

Parameter Description
offset The offset from the previous segment
version The ANEP version number to match
allVersions Match any version of ANEP
protocolID The protocolID to match

Overrides:
matchANEP in class pj_DemultiplexKey


· matches

Summary  |  Top
   public final int matches(byte[] payload, 
                            int payloadStart, 
                            int payloadLength) 

Test a packet to see if this key matches.

XXX payloadLength has odd semantics. Either explain why, or fix the callers of this method.

Parameter Description
payload The packet data
payloadStart The place to start matching in `payload'
payloadLength The length of data in payload, including bytes up to payloadStart.

Returns:
0 if there was an error otherwise the index of the first byte after the end of the key.
Overrides:
matches in class pj_DemultiplexKey


· getNativeKey

Summary  |  Top
   pj_DemultiplexKey getNativeKey() 


· toString

Summary  |  Top
   public String toString() 
Overrides:
toString in class pj_DemultiplexKey


All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7