mil.navy.nps.dis
Class RtpHeader

java.lang.Object
  extended bymil.navy.nps.dis.PduElement
      extended bymil.navy.nps.dis.RtpHeader
All Implemented Interfaces:
java.lang.Cloneable, SerializationInterface

public class RtpHeader
extends PduElement

This class encapsulates the header of the Real-time Transport Protocol (RTP) when used to transfer DIS packets as a payload.

Version:
1.0
Author:
Francisco Afonso (afonso@cs.nps.navy.mil) Location: Web: http://www.web3d.org/WorkingGroups/vrtp/mil/navy/nps/dis/RtpHeader.java or locally: ~/mil/navy/nps/dis/RtpHeader.java

References: RTP: (RFC1889) http://www.ietf.org/internet-drafts/draft-ietf-avt-rtp-new-04.txt


Field Summary
static int RTP_CSRC_COUNT
          Contains the number of contributing source identifiers in this header.
static int RTP_EXTENSION
          The extension bit defines if the normal header will be followed by an extension header.
static int RTP_MARKER
          This bit is used as a marker by a specific profile or application.
static int RTP_PADDING
          Padding is being performed at the DIS protocol level.
static int RTP_PAYLOAD_TYPE_FOR_DIS
          We arbitrarily set the payload type number for experimental DIS work to 111.
static int RTP_VERSION
          Identifies the version of RTP (2 bits).
static int sizeOf
          Contains the size of the header in bytes (= 12).
 
Constructor Summary
RtpHeader()
          Constructor.
 
Method Summary
 java.lang.Object clone()
          Makes deep copies of all the instance variables.
 void deSerialize(java.io.DataInputStream inputStream)
          Fills the header contents with data from a DataInputStream
 UnsignedShort getSequenceNumber()
          Returns the packet sequence number.
 UnsignedInt getSSRC()
          Returns the packet Syncronization Source Identifier.
 UnsignedInt getTimestamp()
          Returns the packet timestamp.
 int length()
          Returns the size of the header.
 void prepareToSend(ProtocolDataUnit pdu)
          Prepares the header for sending.
 void printValues(int indentLevel, java.io.PrintStream printStream)
          Prints internal values for debugging.
 void serialize(java.io.DataOutputStream outputStream)
          Serializes the header into a DataOutputStream.
 void setSequenceNumber(UnsignedShort pSequenceNumber)
          Sets the packet sequence number.
 void setSSRC(UnsignedInt pSSRC)
          Sets the Syncronization Source Identifier.
 void setTimestamp(UnsignedInt pTimestamp)
          Sets the packet timestamp.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RTP_VERSION

public static final int RTP_VERSION
Identifies the version of RTP (2 bits). RFC1889 defines the actual version as two (2).

See Also:
Constant Field Values

RTP_PADDING

public static final int RTP_PADDING
Padding is being performed at the DIS protocol level. Therefore the padding bit is set to zero.

See Also:
Constant Field Values

RTP_EXTENSION

public static final int RTP_EXTENSION
The extension bit defines if the normal header will be followed by an extension header. Not needed in this application, and so set to zero.

See Also:
Constant Field Values

RTP_CSRC_COUNT

public static final int RTP_CSRC_COUNT
Contains the number of contributing source identifiers in this header. This is used only by mixers. Set to zero.

See Also:
Constant Field Values

RTP_MARKER

public static final int RTP_MARKER
This bit is used as a marker by a specific profile or application. Not used so far. Set to zero.

See Also:
Constant Field Values

RTP_PAYLOAD_TYPE_FOR_DIS

public static final int RTP_PAYLOAD_TYPE_FOR_DIS
We arbitrarily set the payload type number for experimental DIS work to 111. It must be n the dynamic assignment range [96..127]. Numbers in this range do not need to be registered.

See Section 3 of RTP Profile for Audio and Video Conferences with Minimal Control (http://www.ietf.org/internet-drafts/draft-ietf-avt-profile-new-06.txt) and RTP Payload types (PT) for standard audio and video encodings (www.isi.edu/in-notes/iana/assignments/rtp-parameters).

E-mail discussion on this topic is archived at http://www.web3D.org/WorkingGroups/vrtp/dis-java-vrml/hypermail/1999/9902/0083.html

See Also:
Constant Field Values

sizeOf

public static final int sizeOf
Contains the size of the header in bytes (= 12).

See Also:
Constant Field Values
Constructor Detail

RtpHeader

public RtpHeader()
Constructor. An empty header is created.

Method Detail

getSequenceNumber

public UnsignedShort getSequenceNumber()
Returns the packet sequence number.

Returns:
the sequence number as an unsigned short (16 bits)

getTimestamp

public UnsignedInt getTimestamp()
Returns the packet timestamp.

Returns:
the timestamp as an unsigned int (32 bits)

getSSRC

public UnsignedInt getSSRC()
Returns the packet Syncronization Source Identifier.

Returns:
the SSRC as an unsigned int (32 bits)

setSequenceNumber

public void setSequenceNumber(UnsignedShort pSequenceNumber)
Sets the packet sequence number.

Parameters:
pSequenceNumber - the sequence number as an unsigned short (16 bits)

setTimestamp

public void setTimestamp(UnsignedInt pTimestamp)
Sets the packet timestamp.

Parameters:
pTimestamp - the timestamp as an unsigned int (32 bits)

setSSRC

public void setSSRC(UnsignedInt pSSRC)
Sets the Syncronization Source Identifier.

Parameters:
pSSRC - the SSRC as a unsigned int (32 bits)

prepareToSend

public void prepareToSend(ProtocolDataUnit pdu)
Prepares the header for sending. Assigns the sequential number from a static variable, takes the timestamp from the DIS pdu and sets the SSRC.

Parameters:
pdu - the DIS pdu that will be transmitted

length

public int length()
Returns the size of the header.

Specified by:
length in class PduElement
Returns:
the header size

serialize

public void serialize(java.io.DataOutputStream outputStream)
Serializes the header into a DataOutputStream.

Specified by:
serialize in interface SerializationInterface
Specified by:
serialize in class PduElement
Parameters:
outputStream - the stream that will receive the serialized header.

deSerialize

public void deSerialize(java.io.DataInputStream inputStream)
Fills the header contents with data from a DataInputStream

Specified by:
deSerialize in interface SerializationInterface
Specified by:
deSerialize in class PduElement
Parameters:
inputStream - the stream which contains the header.

clone

public java.lang.Object clone()
Makes deep copies of all the instance variables.

Overrides:
clone in class PduElement
Returns:
a clone of this instance
See Also:
Object

printValues

public void printValues(int indentLevel,
                        java.io.PrintStream printStream)
Prints internal values for debugging.

Specified by:
printValues in class PduElement
Parameters:
indentLevel - number of spaces to indent for visibility