org.jnetpcap.protocol.voip
Class Rtp.Extension
java.lang.Object
org.jnetpcap.nio.JMemory
org.jnetpcap.nio.JBuffer
org.jnetpcap.packet.JHeader
org.jnetpcap.packet.JSubHeader<Rtp>
org.jnetpcap.protocol.voip.Rtp.Extension
- All Implemented Interfaces:
- JPayloadAccessor
- Enclosing class:
- Rtp
public abstract static class Rtp.Extension
- extends JSubHeader<Rtp>
An extension mechanism is provided to allow individual implementations to
experiment with new payload-format-independent functions that require
additional information to be carried in the RTP data packet header. This
mechanism is designed so that the header extension may be ignored by other
interoperating implementations that have not been extended. Schulzrinne, et
al. Standards Track [Page 18] RFC 3550 RTP July 2003 Note that this header
extension is intended only for limited use. Most potential uses of this
mechanism would be better done another way, using the methods described in
the previous section. For example, a profile-specific extension to the
fixed header is less expensive to process because it is not conditional nor
in a variable location. Additional information required for a particular
payload format SHOULD NOT use this header extension, but SHOULD be carried
in the payload section of the packet.
0 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| defined by profile | length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| header extension |
| .... |
If the X bit in the RTP header is one, a variable-length header extension
MUST be appended to the RTP header, following the CSRC list if present. The
header extension contains a 16-bit length field that counts the number of
32-bit words in the extension, excluding the four-octet extension header
(therefore zero is a valid length). Only a single extension can be appended
to the RTP data header. To allow multiple interoperating implementations to
each experiment independently with different header extensions, or to allow
a particular implementation to experiment with more than one type of header
extension, the first 16 bits of the header extension are left open for
distinguishing identifiers or parameters. The format of these 16 bits is to
be defined by the profile specification under which the implementations are
operating. This RTP specification does not define any header extensions
itself.
This is a baseclass, suitable for use by extending it with the appropriate
extension based on the profile definition. The class defines methods for
reading the static fields that are present in every extension, especially
the length() field. No sub-header ID needs to be manually assigned
since Rtp specification only allows a single extension to exist within a
header. Note that the profile specific 16-bit field has a getter method
provided but is not marked with Field annotation. This
provides a method for reading the raw 16-bit field value and allows the
subclass to provide its own method that is profile specific and which
possibly further breaks down the structure of this raw field into a
sub-structure.
- Author:
- Mark Bednarczyk, Sly Technologies, Inc.
|
Field Summary |
static int |
STATIC_HEADER_LENGTH
Constant which defines the length of the static part of the header in
bytes. |
|
Method Summary |
static int |
headerLength(JBuffer buffer,
int offset)
Determines the length of the header in octets. |
int |
length()
a 16-bit length field that counts the number of 32-bit words in the
extension, excluding the four-octet extension header (therefore zero is a
valid length). |
int |
profileSpecific()
The format of these 16 bit field is to be defined by the profile
specification under which the implementations are operating. |
| Methods inherited from class org.jnetpcap.packet.JHeader |
decode, decodeHeader, getAnnotatedHeader, getDescription, getFields, getGap, getGapLength, getGapOffset, getHeader, getHeaderLength, getHeaderOffset, getId, getIndex, getName, getNextHeaderId, getNextHeaderOffset, getNicname, getPacket, getPayload, getPayloadLength, getPayloadOffset, getPostfix, getPostfixLength, getPostfixOffset, getPrefix, getPrefixLength, getPrefixOffset, getPreviousHeaderId, getPreviousHeaderOffset, getState, getSubHeaders, hasDescription, hasGap, hasNextHeader, hasPayload, hasPostfix, hasPrefix, hasPreviousHeader, hasSubHeaders, isFragmented, isGapTruncated, isHeaderTruncated, isPayloadTruncated, isPostfixTruncated, isPrefixTruncated, peer, peer, peerPayloadTo, setPacket, setSubHeaders, sizeof, toString, transferPayloadTo, transferPayloadTo, transferPayloadTo, validateHeader |
| Methods inherited from class org.jnetpcap.nio.JBuffer |
findUTF8String, getByte, getByteArray, getByteArray, getByteArray, getDouble, getFloat, getInt, getLong, getShort, getUByte, getUInt, getUShort, getUTF8Char, getUTF8String, getUTF8String, getUTF8String, getUTF8String, isReadonly, order, order, peer, peer, peer, peer, setByte, setByteArray, setByteBuffer, setDouble, setFloat, setInt, setLong, setShort, setShort0, setUByte, setUInt, setUShort, transferFrom, transferFrom, transferFrom, transferTo, transferTo, transferTo |
| Methods inherited from class org.jnetpcap.nio.JMemory |
availableDirectMemory, check, cleanup, createReference, isInitialized, isJMemoryBasedOwner, isOwner, maxDirectMemory, peer, reservedDirectMemory, setSize, size, softDirectMemory, toDebugString, toHexdump, toHexdump, totalActiveAllocated, totalAllocateCalls, totalAllocated, totalAllocatedSegments0To255Bytes, totalAllocatedSegments256OrAbove, totalDeAllocateCalls, totalDeAllocated, transferFrom, transferFrom, transferFromDirect, transferOwnership, transferTo, transferTo, transferTo, transferTo, transferTo, transferTo0 |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
STATIC_HEADER_LENGTH
public static final int STATIC_HEADER_LENGTH
- Constant which defines the length of the static part of the header in
bytes.
- See Also:
- Constant Field Values
Rtp.Extension
public Rtp.Extension()
headerLength
@HeaderLength
public static int headerLength(JBuffer buffer,
int offset)
- Determines the length of the header in octets. The value is calculated by
use of a 16-bit length field that counts the number of 32-bit words in
the extension.
- Parameters:
buffer - buffer containing the header dataoffset - offset within the buffer of the start of the header
- Returns:
- length of the header in bytes
length
@Field(offset=16,
length=16)
public int length()
- a 16-bit length field that counts the number of 32-bit words in the
extension, excluding the four-octet extension header (therefore zero is a
valid length).
- Returns:
- length of the extension header in 32-bit words, minus the 4 byte
static part
profileSpecific
public int profileSpecific()
- The format of these 16 bit field is to be defined by the profile
specification under which the implementations are operating. This RTP
specification does not define any header extensions itself.
- Returns:
- raw usigned 16 bit value of the profile specific field