org.mitre.jsip
Class SipMessage

java.lang.Object
  |
  +--org.mitre.jsip.SipMessage
Direct Known Subclasses:
SipRequestMessage, SipResponseMessage

public abstract class SipMessage
extends java.lang.Object


Field Summary
static int BadType
           
static int Request
           
static int Response
           
 
Method Summary
 void addContact(SipUri contact)
          Add a url to the contact list
static SipMessage createMessage(java.lang.String inputMessage)
          Create a SipMessage from a buffer
 SipUriList getContactList()
          Returns a reference to the contact list for this message.
 int getContentLength()
          Return the Content Length of the message body
static int getCSeqMethod(java.lang.String s)
          Gets the CSeq method type of the incoming message the CSeq header field has the CSeq and the Method of the current transaction
This method extracts the Method from the CSeq header.
 java.lang.String getHeaderData(int id)
          Returns the data contained in the specified header.
 SipUriList getRecordRoute()
          Returns a reference to the Record-Route for this message.
 SipUri getSendToAddress()
           
 int getType()
          Return the type of this message, either SipMessage.Request or SipMessage.Response
 SipViaList getViaList()
          Returns a reference to the via list for this message.
 boolean hasHeader(int id)
          Returns true if the message contains the specified header.
 boolean hasSendToAddress()
           
 boolean haveBody()
          Returns true if the message has a body.
 void insertHeader(int id, java.lang.String data)
          Inserts a new header into the message.
 java.lang.String message()
          Generate the full message
 java.lang.String messageBody()
          Returns the message body.
 void setBody(java.lang.String newbody)
          Sets the body of the SIP message.
 void setContactList(SipUriList newclist)
          Sets the contact list for this message.
 void setRecordRoute(SipUriList newrr)
          Sets the record route for this message.
 void setSendToAddress(SipUri address)
           
 void setViaList(SipViaList copylist)
          Sets the via list to be a copy of an existing via list.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Request

public static final int Request

Response

public static final int Response

BadType

public static final int BadType
Method Detail

createMessage

public static SipMessage createMessage(java.lang.String inputMessage)
Create a SipMessage from a buffer

haveBody

public boolean haveBody()
Returns true if the message has a body.
Returns:
bool

setBody

public void setBody(java.lang.String newbody)
Sets the body of the SIP message.
Parameters:
newbody -  

messageBody

public java.lang.String messageBody()
Returns the message body.
Returns:
The body of the message

getType

public int getType()
Return the type of this message, either SipMessage.Request or SipMessage.Response

getContentLength

public int getContentLength()
Return the Content Length of the message body
Returns:
The size of the message body

getCSeqMethod

public static int getCSeqMethod(java.lang.String s)
Gets the CSeq method type of the incoming message the CSeq header field has the CSeq and the Method of the current transaction
This method extracts the Method from the CSeq header.
NOTE: This should have been in org.mitre.jsip.SipMessage SRJ: does this need to be static??? are we referencing an instanciated message???

message

public java.lang.String message()
Generate the full message
Returns:
The full message text

insertHeader

public void insertHeader(int id,
                         java.lang.String data)
Inserts a new header into the message.
Parameters:
id -  
data -  

hasHeader

public boolean hasHeader(int id)
Returns true if the message contains the specified header.
Parameters:
id -  
Returns:
bool

getHeaderData

public java.lang.String getHeaderData(int id)
Returns the data contained in the specified header.
Parameters:
id -  
Returns:
String

getViaList

public SipViaList getViaList()
Returns a reference to the via list for this message. Usually useful for getting and setting the topmost via entry.
Returns:
SipViaList

getRecordRoute

public SipUriList getRecordRoute()
Returns a reference to the Record-Route for this message.
Returns:
SipUriList &

getContactList

public SipUriList getContactList()
Returns a reference to the contact list for this message.
Returns:
SipUriList &

setViaList

public void setViaList(SipViaList copylist)
Sets the via list to be a copy of an existing via list. Useful for building responses.
Parameters:
copylist -  

setContactList

public void setContactList(SipUriList newclist)
Sets the contact list for this message.
Parameters:
newclist -  

setRecordRoute

public void setRecordRoute(SipUriList newrr)
Sets the record route for this message.
Parameters:
newrr -  

addContact

public void addContact(SipUri contact)
Add a url to the contact list

hasSendToAddress

public boolean hasSendToAddress()

getSendToAddress

public SipUri getSendToAddress()

setSendToAddress

public void setSendToAddress(SipUri address)