protocol
Class ProtocolDataUnit

java.lang.Object
  extended by protocol.ProtocolDataUnit
Direct Known Subclasses:
VoicePDU

public abstract class ProtocolDataUnit
extends java.lang.Object

Represents a Protocol Data Unit (PDU).

                       1                   2                   3
   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1        Octets:
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+  +---------------+
  |1|     Source Call Number      |0|   Destination Call Number   |    0   1   2   3
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+  +---------------+
  |                           Time-Stamp                          |    4   5   6   7
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+  +---------------+
  |  Out Seq No   |   In Seq No   |0|  PDU Type   |   Sub Class   |    8   9  10  11
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+  +---------------+
  |                                                               |   12  ...
  :                            Payload                            :
  |                                                               |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  


Field Summary
protected  CallContext call
          The call object
protected  int destinationCallNumber
          The destination call number
protected  int inSeqNo
          The inbound stream sequence number
protected  int outSeqNo
          The outbound stream sequence number
protected  OctetBuffer payload
          The payload data
protected  int pduSubclass
          The subclass
protected  int pduType
          The frame type
protected  int sourceCallNumber
          The source call number
protected  java.lang.Long timeStamp
          The time-stamp
protected static int VOICE
          PDU Type: Data Audio Compression Format Raw Voice Data
 
Constructor Summary
ProtocolDataUnit(CallContext call)
          The constructor for outbound PDUs.
ProtocolDataUnit(CallContext call, byte[] pduOctets)
          The constructor for inbound PDUs.
 
Method Summary
static ProtocolDataUnit create(CallContext call, byte[] pduOctets)
          Creates a new PDU of the correct type.
(package private)  void dump(java.lang.String prefix)
          Logs this frame.
(package private)  long getTimestamp()
          Returns the timestamp as long.
protected  void log(java.lang.String prefix)
          Logs the time-stamp and the inbound/outbound stream sequence number.
(package private)  void onArrivedPDU()
          Arrived is called when a packet arrives.
 void sendPayload(byte[] payload)
          Sends a specified payload.
(package private)  void setTimestamp(long v)
          Sets the time stamp as long.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VOICE

protected static final int VOICE
PDU Type: Data Audio Compression Format Raw Voice Data

See Also:
Constant Field Values

call

protected CallContext call
The call object


payload

protected OctetBuffer payload
The payload data


timeStamp

protected java.lang.Long timeStamp
The time-stamp


sourceCallNumber

protected int sourceCallNumber
The source call number


destinationCallNumber

protected int destinationCallNumber
The destination call number


outSeqNo

protected int outSeqNo
The outbound stream sequence number


inSeqNo

protected int inSeqNo
The inbound stream sequence number


pduType

protected int pduType
The frame type


pduSubclass

protected int pduSubclass
The subclass

Constructor Detail

ProtocolDataUnit

public ProtocolDataUnit(CallContext call)
The constructor for outbound PDUs.

Parameters:
call - The Call object

ProtocolDataUnit

public ProtocolDataUnit(CallContext call,
                        byte[] pduOctets)
The constructor for inbound PDUs.

Parameters:
call - The Call object
pduOctets - The incoming message bytes
Method Detail

setTimestamp

void setTimestamp(long v)
Sets the time stamp as long.


getTimestamp

long getTimestamp()
Returns the timestamp as long.


create

public static ProtocolDataUnit create(CallContext call,
                                      byte[] pduOctets)
Creates a new PDU of the correct type.

Parameters:
call - Call
pduOctets - byte[]
Returns:
a PDU

sendPayload

public void sendPayload(byte[] payload)
Sends a specified payload. Payload represents the data field in the frame.

Parameters:
payload - The payload data

onArrivedPDU

void onArrivedPDU()
Arrived is called when a packet arrives. This method doesn't do anything more than dumping the frame. It should be overridden in derived class.


log

protected void log(java.lang.String prefix)
Logs the time-stamp and the inbound/outbound stream sequence number.

Parameters:
prefix - Text to include

dump

void dump(java.lang.String prefix)
Logs this frame.