org.jnetpcap.protocol.voip
Class Sip

java.lang.Object
  extended by org.jnetpcap.nio.JMemory
      extended by org.jnetpcap.nio.JBuffer
          extended by org.jnetpcap.packet.JHeader
              extended by org.jnetpcap.packet.JMappedHeader
                  extended by org.jnetpcap.packet.AbstractMessageHeader
                      extended by org.jnetpcap.protocol.voip.Sip
All Implemented Interfaces:
JPayloadAccessor

@Header
public class Sip
extends AbstractMessageHeader

The Session Initiation Protocol (SIP) is an IETF-defined signaling protocol, widely used for controlling multimedia communication sessions such as voice and video calls over Internet Protocol (IP). The protocol can be used for creating, modifying and terminating two-party (unicast) or multiparty (multicast) sessions consisting of one or several media streams. The modification can involve changing addresses or ports, inviting more participants, and adding or deleting media streams. Other feasible application examples include video conferencing, streaming multimedia distribution, instant messaging, presence information, file transfer and online games.

SIP was originally designed by Henning Schulzrinne and Mark Handley starting in 1996. The latest version of the specification is RFC 3261 from the IETF Network Working Group. In November 2000, SIP was accepted as a 3GPP signaling protocol and permanent element of the IP Multimedia Subsystem (IMS) architecture for IP-based streaming multimedia services in cellular systems.

The SIP protocol is an Application Layer protocol designed to be independent of the underlying transport layer; it can run on Transmission Control Protocol (TCP), User Datagram Protocol (UDP), or Stream Control Transmission Protocol (SCTP). It is a text-based protocol, incorporating many elements of the Hypertext Transfer Protocol (HTTP) and the Simple Mail Transfer Protocol (SMTP).

Description Source: http://en.wikipedia.org/wiki/Session_Initiation_Protocol

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Nested Class Summary
static class Sip.Code
          A table of SIP protocol codes and their meanings.
static class Sip.ContentType
          A table of SIP supported content types.
static class Sip.Fields
          A table of SIP specific fields found in a SIP message.
static class Sip.Request
          A table of supported Request message types.
static class Sip.Response
          A table of supported Response message types.
 
Nested classes/interfaces inherited from class org.jnetpcap.packet.AbstractMessageHeader
AbstractMessageHeader.MessageType
 
Nested classes/interfaces inherited from class org.jnetpcap.packet.JHeader
JHeader.State
 
Nested classes/interfaces inherited from class org.jnetpcap.nio.JMemory
JMemory.Type
 
Field Summary
static int ID
          Constant numerial ID for this protocol's header.
 
Fields inherited from class org.jnetpcap.packet.AbstractMessageHeader
rawHeader
 
Fields inherited from class org.jnetpcap.packet.JHeader
annotatedHeader, BYTE, EMPTY_HEADER_ARRAY, isSubHeader, packet, state
 
Fields inherited from class org.jnetpcap.nio.JMemory
JNETPCAP_LIBRARY_NAME, MAX_DIRECT_MEMORY_DEFAULT, POINTER
 
Constructor Summary
Sip()
           
 
Method Summary
 int contentLength()
          Returns the value of the Content_Length field if present.
 java.lang.String contentType()
          Returns the content type of this SIP message.
 Sip.ContentType contentTypeEnum()
          Returns the content type of this SIP message as a enum constant.
protected  void decodeFirstLine(java.lang.String line)
          Decode first line.
 java.lang.String fieldValue(Sip.Fields field)
          Looks up a field value using Fields table.
 java.lang.String fieldValue(Sip.Request field)
          Looks up a field value using Request field constant.
 java.lang.String fieldValue(Sip.Response field)
          Looks up a field value using Response field constant.
 boolean hasContent()
          Checks if the message has any content defined.
 boolean hasContentType()
          Checks if Content_Type field is present within the message.
 boolean hasField(Sip.Fields field)
          Checks if a specific field is present within the message.
 java.lang.String header()
          Gets the raw header instead of reconstructing it.
 boolean isResponse()
          Checks if this message is a response message.
 
Methods inherited from class org.jnetpcap.packet.AbstractMessageHeader
decodeHeader, getMessageType, headerLength, setMessageType
 
Methods inherited from class org.jnetpcap.packet.JMappedHeader
addField, addField, addField, clearFields, fieldArray, fieldDescription, fieldDescription, fieldDisplay, fieldDisplay, fieldLength, fieldLength, fieldOffset, fieldOffset, fieldValue, fieldValue, fieldValue, fieldValue, hasField, hasField, map, map
 
Methods inherited from class org.jnetpcap.packet.JHeader
decode, getAnnotatedHeader, getDescription, getFields, getGap, getGapLength, getGapOffset, getHeader, getHeaderLength, getHeaderOffset, getId, getIndex, getLength, getName, getNextHeaderId, getNextHeaderOffset, getNicname, getOffset, getPacket, getParent, 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
 

Field Detail

ID

public static int ID
Constant numerial ID for this protocol's header.

Constructor Detail

Sip

public Sip()
Method Detail

contentLength

public int contentLength()
Returns the value of the Content_Length field if present.

Returns:
returns the value of the field or 0 if field is not preset within the message

contentType

public java.lang.String contentType()
Returns the content type of this SIP message.

Returns:
A string with value of the Content_Type field

contentTypeEnum

public Sip.ContentType contentTypeEnum()
Returns the content type of this SIP message as a enum constant.

Returns:
contants from ContentType table

decodeFirstLine

protected void decodeFirstLine(java.lang.String line)
Decode first line.

Specified by:
decodeFirstLine in class AbstractMessageHeader
Parameters:
line - the line
See Also:
AbstractMessageHeader.decodeFirstLine(java.lang.String)

fieldValue

public java.lang.String fieldValue(Sip.Fields field)
Looks up a field value using Fields table.

Parameters:
field - field to lookup
Returns:
the value of the field or null if not present

fieldValue

public java.lang.String fieldValue(Sip.Request field)
Looks up a field value using Request field constant.

Parameters:
field - field to lookup
Returns:
the value of the field or null if not present

fieldValue

public java.lang.String fieldValue(Sip.Response field)
Looks up a field value using Response field constant.

Parameters:
field - field to lookup
Returns:
the value of the field or null if not present

hasContent

public boolean hasContent()
Checks if the message has any content defined.

Returns:
true if Content_Type field is used within the message indicating that content is preset

hasContentType

public boolean hasContentType()
Checks if Content_Type field is present within the message.

Returns:
true if content type field is found otherwise false

hasField

public boolean hasField(Sip.Fields field)
Checks if a specific field is present within the message.

Parameters:
field - field to lookup
Returns:
true if field is found within the message otherwise falst

header

public java.lang.String header()
Gets the raw header instead of reconstructing it.

Returns:
original raw header

isResponse

public boolean isResponse()
Checks if this message is a response message.

Returns:
true if response message, otherwise false indicating its a request message type