All Packages  This Package  Class Hierarchy  Class Search  Index

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

  Summary

public abstract class  DemultiplexKey
     extends java.lang.Object
{
          // Fields 1
     private final int length;

          // Constructors 1
     public DemultiplexKey(int);

          // Methods 5
     protected static final int compareByte(byte[], int, int, int, byte);
     protected static final int compareSlice(byte[], int, int, int, byte[]);

     final int length();
     public abstract int matches(byte[], int, int);
     public String toString();
}

A key for matching incoming packets.


  Cross Reference

Extended By:
ANEPDemultiplexKey, SimpleDemultiplexKey





  Fields

· length

Summary  |  Top
   private final int length

"length" of this filter for sorting the filters (longest first..)


  Constructors

· DemultiplexKey

Summary  |  Top

   public DemultiplexKey(int length) 


  Methods

· length

Summary  |  Top
   final int length() 


· compareByte

Summary  |  Top
   protected static final int compareByte(byte[] packetBuf, 
                                          int packetOffset, 
                                          int packetLength, 
                                          int offset, 
                                          byte val) 

See if the offset'th byte of the packet is val. The packet is defined as the sub-array of packetBuf from packetOffset to packetOffset + packetLength.

Returns:
0 if it failed to match; offset+1 if it did match.


· compareSlice

Summary  |  Top
   protected static final int compareSlice(byte[] packetBuf, 
                                           int packetOffset, 
                                           int packetLength, 
                                           int offset, 
                                           byte[] slice) 

Comparse the slice of bytes at offset'th byte of the packet against the given slice. The packet is defined as the sub-array of packetBuf from packetOffset to packetOffset + packetLength.

Returns:
offset + slice.length if they match, otherwise returns zero.


· matches

Summary  |  Top
   public abstract int matches(byte[] data, 
                               int packetOffset, 
                               int packetLength) 

XXX this is not supposed to be public. It is currently public so that it may be overridden to supply more interesting packet demultiplexing matchers (e.g., in ANTS). Check if the given packet matches this filter. Return 0 if it does not, or a non-zero integer value to pass to the receive function.



· toString

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


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