rtpi.packets
Class RtcpiPacket

java.lang.Object
  |
  +--rtpi.packets.RtcpiPacket
Direct Known Subclasses:
RtcpiApplicationPacket, RtcpiByePacket, RtcpiSourceDescriptionPacket, RtcpiSubcomponentReportPacket

public abstract class RtcpiPacket
extends java.lang.Object

This is the base class for RTCP/I packets.

Author:
Martin Mauve

Field Summary
protected  int count
          The count field.
static int HEADER_SIZE
          The size of an RTCP/I header.
protected  int length
          The length of this RTCP/I packet in bytes.
protected  byte[] packetData
          The whole compound packet (transport packet) which contains this RTCP packet.
protected  int packetStart
          RTCP packets are stacked in one compound packet.
protected  int participantID
          The participant ID
protected  int payloadType
          The RTCP/I payload type (SUBREP / APP / BYE / SDES).
protected  int reserved
          The reserved bit.
protected  int version
          The version.
static int VERSION
          The RTCP/I version number.
 
Constructor Summary
protected RtcpiPacket(byte[] packet, int start)
          Constructor for packets coming from the network
protected RtcpiPacket(int pid)
          Constructer for packets that are to be sent to the network
 
Method Summary
abstract  void flush()
          This flushes the packet.
protected  void flushHeader(java.io.DataOutputStream dos)
          This flushes the header part of an RTCP/I packet.
 int getLength()
          This returns the length of this packet.
 byte[] getPacket()
          This returns the encoded packet.
 int getParticipantID()
          This returns the Partcicipant ID of this packet's source.
 int getPayloadType()
          Get the payload type of the RTCP packet.
static int inspectLength(byte[] packet, int start)
          This static method extracts the length of the packet.
static int inspectPayloadType(byte[] packet, int start)
          This static method extracts the RTCP/I payload type of an RTCP/I packet.
abstract  void parse()
          This parses the packet.
 java.lang.String toString()
          Convert this object to a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HEADER_SIZE

public static final int HEADER_SIZE
The size of an RTCP/I header.

VERSION

public static final int VERSION
The RTCP/I version number.

version

protected int version
The version.

reserved

protected int reserved
The reserved bit.

count

protected int count
The count field.

payloadType

protected int payloadType
The RTCP/I payload type (SUBREP / APP / BYE / SDES).

length

protected int length
The length of this RTCP/I packet in bytes.

participantID

protected int participantID
The participant ID

packetStart

protected int packetStart
RTCP packets are stacked in one compound packet. We therefore need to remember where it does start within the transport packet!

packetData

protected byte[] packetData
The whole compound packet (transport packet) which contains this RTCP packet.
Constructor Detail

RtcpiPacket

protected RtcpiPacket(byte[] packet,
                      int start)
Constructor for packets coming from the network

RtcpiPacket

protected RtcpiPacket(int pid)
Constructer for packets that are to be sent to the network
Method Detail

inspectPayloadType

public static int inspectPayloadType(byte[] packet,
                                     int start)
                              throws RtpiParseException
This static method extracts the RTCP/I payload type of an RTCP/I packet.
Parameters:
packet - The packet which contains the RTCP/ packet.
start - The start (position of the first byte of the header) of the RTCP/I packet in the transport packet.
Returns:
The payload type.

inspectLength

public static int inspectLength(byte[] packet,
                                int start)
                         throws RtpiParseException
This static method extracts the length of the packet.
Parameters:
packet - The packet which contains the RTCP/ packet.
start - The start (position of the first byte of the header) of the RTCP/I packet in the transport packet.
Returns:
The length of the packet including the RTCP/I header in bytes.

getPacket

public byte[] getPacket()
This returns the encoded packet.
Returns:
The encoded packet.

getParticipantID

public int getParticipantID()
This returns the Partcicipant ID of this packet's source.
Returns:
The Participant ID.

getLength

public int getLength()
This returns the length of this packet.
Returns:
The length.

getPayloadType

public int getPayloadType()
Get the payload type of the RTCP packet.
Returns:
The payload type.

flush

public abstract void flush()
                    throws RtpiFlushException
This flushes the packet. To be overidden in derived classes.
Returns:
The flushed packet data.

flushHeader

protected void flushHeader(java.io.DataOutputStream dos)
                    throws RtpiFlushException
This flushes the header part of an RTCP/I packet.
Parameters:
dos - The output stream to which the header information should be flushed.
Returns:
The flushed header.

parse

public abstract void parse()
                    throws RtpiParseException
This parses the packet. To be overidden in derived classes.

toString

public java.lang.String toString()
Convert this object to a string.
Returns:
This object as a string.
Overrides:
toString in class java.lang.Object