SSF.OS
Class ProtocolMessage

java.lang.Object
  |
  +--SSF.OS.ProtocolMessage
Direct Known Subclasses:
AppMessage, dataMessage, DD_Packet, DDoSMessage, HelloPacket, ICMPHeader, IpHeader, LS_AckPacket, LS_RequestPacket, LS_UpdatePacket, LSA, LSA, Message, Packet, Packet, Router_LSA, Summary_LSA, TCP_Header, UDP_Header

public class ProtocolMessage
extends java.lang.Object

A ProtocolMessage is the base class for representing a packet header and payload specific to a single protocol. It may be an element of a linked list of other ProtocolMessages that represent the previous and subsequent headers. If a subsequent ProtocolMessage exists, it represents the payload of this header.


Constructor Summary
ProtocolMessage()
          Construct an empty ProtocolMessage.
 
Method Summary
 int bytecount()
          Return the total size (in bytes) of this header plus the payload, if any.
 void carryPayload(ProtocolMessage payload)
          Append a ProtocolMessage to this ProtocolMessage.
 ProtocolMessage copy()
          Return an exact copy of this ProtocolMessage.
 void dropHeader()
          Discard the header of this ProtocolMessage.
 void dropPayload()
          Discard the payload of this ProtocolMessage.
 void frombytes(byte[] buf, int offset)
          Deserialize this header from the given byte buffer at the given offset.
static ProtocolMessage fromVersion(java.lang.String V)
          Return a new instance of the specified ProtocolMessage class.
 int header_bytecount()
          Return the size (in bytes) of this header only, don't include the payload, if any.
 ProtocolMessage payload()
          Return the next header.
 ProtocolMessage previous()
          Return the previous header.
 float size()
          Return the total number of bytes in the ProtocolMessage.
 void tobytes(byte[] buf, int offset)
          Serialize this header into the given byte buffer at the given offset.
 java.lang.String version()
          Return the name of the class of which this ProtocolMessage is an instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProtocolMessage

public ProtocolMessage()
Construct an empty ProtocolMessage.

Method Detail

size

public float size()
Return the total number of bytes in the ProtocolMessage. This method should be obsoleted.


version

public java.lang.String version()
Return the name of the class of which this ProtocolMessage is an instance.


fromVersion

public static ProtocolMessage fromVersion(java.lang.String V)
Return a new instance of the specified ProtocolMessage class.


dropPayload

public void dropPayload()
Discard the payload of this ProtocolMessage.


dropHeader

public void dropHeader()
Discard the header of this ProtocolMessage.


copy

public ProtocolMessage copy()
Return an exact copy of this ProtocolMessage. Defaults to null; override in derived classes


carryPayload

public void carryPayload(ProtocolMessage payload)
Append a ProtocolMessage to this ProtocolMessage.


payload

public ProtocolMessage payload()
Return the next header.


previous

public ProtocolMessage previous()
Return the previous header.


bytecount

public int bytecount()
Return the total size (in bytes) of this header plus the payload, if any. Defaults to zero; override in derived classes.


header_bytecount

public int header_bytecount()
Return the size (in bytes) of this header only, don't include the payload, if any. Defaults to zero; override in derived classes.


tobytes

public void tobytes(byte[] buf,
                    int offset)
Serialize this header into the given byte buffer at the given offset.


frombytes

public void frombytes(byte[] buf,
                      int offset)
Deserialize this header from the given byte buffer at the given offset.