MjSip Stack
v1.6

org.zoolu.sdp
Class SessionDescriptor

java.lang.Object
  |
  +--org.zoolu.sdp.SessionDescriptor

public class SessionDescriptor
extends java.lang.Object

Class SessionDescriptor handles SIP message bodys formatted according to the Session Description Protocol (SDP).

A session description consists of a session-level description (details that apply to the whole session and all media streams) and zero or more media-level descriptions (details that apply onto to a single media stream).

The session-level part starts with a `v=' line and continues to the first media-level section. The media description starts with an `m=' line and continues to the next media description or end of the whole session description. In general, session-level values are the default for all media unless overridden by an equivalent media-level value.

In the current implementation, the session-level description consists of the v, o, s, c, and t SDP fields (lines).


Constructor Summary
SessionDescriptor()
          Creates a default SessionDescriptor.
SessionDescriptor(OriginField origin, SessionNameField session, ConnectionField connection, TimeField time)
          Creates a new SessionDescriptor specifing o, s, c, and t fields.
SessionDescriptor(SessionDescriptor sd)
          Creates a new SessionDescriptor.
SessionDescriptor(java.lang.String sdp)
          Creates a new SessionDescriptor from String sdp
SessionDescriptor(java.lang.String owner, java.lang.String address)
          Creates a new SessionDescriptor.
SessionDescriptor(java.lang.String origin, java.lang.String session, java.lang.String connection, java.lang.String time)
          Creates a new SessionDescriptor specifing o, s, c, and t fields.
 
Method Summary
 SessionDescriptor addAttribute(AttributeField attribute)
          Adds a new attribute
 SessionDescriptor addAttributes(java.util.Vector attribute_fields)
          Adds a Vector of session attributes.
 SessionDescriptor addMedia(MediaField media, AttributeField attribute)
          Adds a new attribute for a particular media
 SessionDescriptor addMedia(MediaField media, java.util.Vector attributes)
          Adds a new media.
 SessionDescriptor addMediaDescriptor(MediaDescriptor media_desc)
          Adds a new MediaDescriptor
 SessionDescriptor addMediaDescriptors(java.util.Vector media_descs)
          Adds a Vector of MediaDescriptors
 AttributeField getAttribute(java.lang.String attribute_name)
          Gets the first AttributeField of a particular attribute name.
 java.util.Vector getAttributes()
          Gets a Vector of attribute values.
 java.util.Vector getAttributes(java.lang.String attribute_name)
          Gets a Vector of attribute values of a particular attribute name.
 ConnectionField getConnection()
          Gets the connection-information 'c' field
 MediaDescriptor getMediaDescriptor(java.lang.String media_type)
          Gets the first MediaDescriptor of a particular media.
 java.util.Vector getMediaDescriptors()
          Gets all MediaDescriptors
 OriginField getOrigin()
          Gets the origin 'o' field
 SessionNameField getSessionName()
          Gets the session-name 's' field
 TimeField getTime()
          Gets the time 't' field
 boolean hasAttribute(java.lang.String attribute_name)
          Whether it has a particular attribute
 SessionDescriptor removeAttributes()
          Removes all session attributes.
 SessionDescriptor removeMediaDescriptor(java.lang.String media_type)
          Removes all MediaDescriptors
 SessionDescriptor removeMediaDescriptors()
          Removes all MediaDescriptors
 SessionDescriptor setConnection(ConnectionField connection)
          Sets the connection-information 'c' field.
 SessionDescriptor setOrigin(OriginField origin)
          Sets the origin 'o' field.
 SessionDescriptor setSessionName(SessionNameField session)
          Sets the session-name 's' field.
 SessionDescriptor setTime(TimeField time)
          Sets the time 't' field.
 java.lang.String toString()
          Gets a String rapresentation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SessionDescriptor

public SessionDescriptor(SessionDescriptor sd)
Creates a new SessionDescriptor.
Parameters:
sd - the SessionDescriptor clone

SessionDescriptor

public SessionDescriptor(OriginField origin,
                         SessionNameField session,
                         ConnectionField connection,
                         TimeField time)
Creates a new SessionDescriptor specifing o, s, c, and t fields.
Parameters:
origin - the OriginField
session - the SessionNameField
connection - the ConnectionField
time - the TimeField

SessionDescriptor

public SessionDescriptor(java.lang.String origin,
                         java.lang.String session,
                         java.lang.String connection,
                         java.lang.String time)
Creates a new SessionDescriptor specifing o, s, c, and t fields.
Parameters:
origin - the origin value
session - the session value
connection - the connection value
time - the time value

SessionDescriptor

public SessionDescriptor(java.lang.String owner,
                         java.lang.String address)
Creates a new SessionDescriptor.

with:
o=owner
s=Session SIP/SDP
c=IP4 address
t=0 0

if address==null, '127.0.0.1' is used
if owner==null, 'user@'address is used

Parameters:
owner - the owner
address - the IPv4 address

SessionDescriptor

public SessionDescriptor()
Creates a default SessionDescriptor.

o=user@127.0.0.1 s=Session SIP/SDP c=127.0.0.1 t=0 0


SessionDescriptor

public SessionDescriptor(java.lang.String sdp)
Creates a new SessionDescriptor from String sdp
Parameters:
sdp - the entire SDP
Method Detail

setOrigin

public SessionDescriptor setOrigin(OriginField origin)
Sets the origin 'o' field.
Parameters:
origin - the OriginField
Returns:
this SessionDescriptor

getOrigin

public OriginField getOrigin()
Gets the origin 'o' field

setSessionName

public SessionDescriptor setSessionName(SessionNameField session)
Sets the session-name 's' field.
Parameters:
session - the SessionNameField
Returns:
this SessionDescriptor

getSessionName

public SessionNameField getSessionName()
Gets the session-name 's' field

setConnection

public SessionDescriptor setConnection(ConnectionField connection)
Sets the connection-information 'c' field.
Parameters:
connection - the ConnectionField
Returns:
this SessionDescriptor

getConnection

public ConnectionField getConnection()
Gets the connection-information 'c' field

setTime

public SessionDescriptor setTime(TimeField time)
Sets the time 't' field.
Parameters:
time - the TimeField
Returns:
this SessionDescriptor

getTime

public TimeField getTime()
Gets the time 't' field

addMedia

public SessionDescriptor addMedia(MediaField media,
                                  AttributeField attribute)
Adds a new attribute for a particular media
Parameters:
media - the MediaField
attribute - an AttributeField
Returns:
this SessionDescriptor

addMedia

public SessionDescriptor addMedia(MediaField media,
                                  java.util.Vector attributes)
Adds a new media.
Parameters:
media - the MediaField
attributes - Vector of AttributeField
Returns:
this SessionDescriptor

addMediaDescriptor

public SessionDescriptor addMediaDescriptor(MediaDescriptor media_desc)
Adds a new MediaDescriptor
Parameters:
media_desc - a MediaDescriptor
Returns:
this SessionDescriptor

addMediaDescriptors

public SessionDescriptor addMediaDescriptors(java.util.Vector media_descs)
Adds a Vector of MediaDescriptors
Parameters:
media_descs - Vector if MediaDescriptor
Returns:
this SessionDescriptor

getMediaDescriptors

public java.util.Vector getMediaDescriptors()
Gets all MediaDescriptors

removeMediaDescriptor

public SessionDescriptor removeMediaDescriptor(java.lang.String media_type)
Removes all MediaDescriptors

removeMediaDescriptors

public SessionDescriptor removeMediaDescriptors()
Removes all MediaDescriptors

getMediaDescriptor

public MediaDescriptor getMediaDescriptor(java.lang.String media_type)
Gets the first MediaDescriptor of a particular media.
Parameters:
media_type - the media type
Returns:
the MediaDescriptor

addAttributes

public SessionDescriptor addAttributes(java.util.Vector attribute_fields)
Adds a Vector of session attributes.
Parameters:
attribute_fields - Vector of AttributeFields
Returns:
this SessionDescriptor

addAttribute

public SessionDescriptor addAttribute(AttributeField attribute)
Adds a new attribute
Parameters:
attribute - the new AttributeField
Returns:
this MediaDescriptor

removeAttributes

public SessionDescriptor removeAttributes()
Removes all session attributes.

getAttributes

public java.util.Vector getAttributes()
Gets a Vector of attribute values.
Returns:
a Vector of AttributeField

hasAttribute

public boolean hasAttribute(java.lang.String attribute_name)
Whether it has a particular attribute
Parameters:
a_name - the attribute name
Returns:
true if found, otherwise returns null

getAttribute

public AttributeField getAttribute(java.lang.String attribute_name)
Gets the first AttributeField of a particular attribute name.
Parameters:
attribute_name - the attribute name
Returns:
the AttributeField, or null if not found

getAttributes

public java.util.Vector getAttributes(java.lang.String attribute_name)
Gets a Vector of attribute values of a particular attribute name.
Parameters:
a_name - the attribute name
Returns:
a Vector of AttributeField

toString

public java.lang.String toString()
Gets a String rapresentation
Overrides:
toString in class java.lang.Object

MjSip Stack
v1.6