All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.devtools.SIPNoTE.SIPMessage

java.lang.Object
   |
   +----com.ibm.devtools.SIPNoTE.SIPMessage

public class SIPMessage
extends Object
This class represents a SIP 2.0 message, as described in version 4 of the SIP Internet Draft from the IETF. Not all request methods have been fully implemented. In fact, only REGISTER, UNREGISTER, MESSAGE, and LOCATE have machinery behind them. The rest have only stubs where the implementation should be made.


Variable Index

 o ACK
Method type
 o BYE
Method type
 o INVITE
Method type
 o LOCATE
Method type
 o MESSAGE
Method type
 o OPTIONS
Method type
 o REGISTER
Method type
 o REQUEST
Message type
 o RESPONSE
Message type
 o UNKNOWN
Unknown message type or method
 o UNREGISTER
Method type

Constructor Index

 o SIPMessage()

Method Index

 o addFrom(FromEntity)
Add a new From: header to this message.
 o addLocation(SIPurl)
Add a new Location: header to this message.
 o addSubscription(String)
Adds a new Subscribe: header to the message.
 o addTo(ToEntity[])
Add a new To: header to this message.
 o addVia(ViaEntity)
Adds a new Via: header above the other Via: headers.
 o getContentType()
Get the Content-Type associated with the contents of this message.
 o getLocation()
Get the contents of any Location: headers which were included in this message.
 o getMessageBody()
Get the body of this message.
 o getMessageType()
Get the type of message this is (request vs.
 o getMethod()
Get the method to which this message belongs.
 o getOriginatorVia()
Get the first Via: which was added to this message.
 o getReasonPhrase()
Get the reason phrase associated with this response.
 o getRequestURI()
Get the URL's from the request-line.
 o getStatusCode()
Get the status code returned in this message.
 o getSubscriptions()
Get the subscription information from all of the Subscribe: headers within this message.
 o readMessage(InputStream)
Read a SIP message in from the specified InputStream.
 o setContentType(String)
Sets the Content-Type header for this message.
 o setMessageBody(byte[])
Sets the data for the message body.
 o setMessageType(int)
Sets the type of this message.
 o setMethod(int)
Sets the method associated with this message.
 o setReasonPhrase(String)
Sets the reason-phrase associated with this response.
 o setRequestURI(SIPurl[])
Sets the URI's to which this message should be sent.
 o setStatusCode(int)
Sets the status code associated with this response.
 o writeMessage(OutputStream)
Write the message out to the specified OutputStream.

Variables

 o UNKNOWN
 public static final int UNKNOWN
Unknown message type or method

 o REQUEST
 public static final int REQUEST
Message type

 o RESPONSE
 public static final int RESPONSE
Message type

 o REGISTER
 public static final int REGISTER
Method type

 o UNREGISTER
 public static final int UNREGISTER
Method type

 o INVITE
 public static final int INVITE
Method type

 o ACK
 public static final int ACK
Method type

 o OPTIONS
 public static final int OPTIONS
Method type

 o BYE
 public static final int BYE
Method type

 o MESSAGE
 public static final int MESSAGE
Method type

 o LOCATE
 public static final int LOCATE
Method type

Constructors

 o SIPMessage
 public SIPMessage()

Methods

 o writeMessage
 public void writeMessage(OutputStream out) throws MalformedMessageException
Write the message out to the specified OutputStream.

Parameters:
out - The OutputStream to which the data should be written.
Throws: MalformedMessageException
Thrown when the SIP message does not fit within the specifications. This may mean, that required fields have not been set, are set incorrectly, or that something else went wrong.
 o readMessage
 public void readMessage(InputStream in) throws MalformedMessageException
Read a SIP message in from the specified InputStream.

Parameters:
in - The InputStream from which the message should be read.
Throws: MalformedMessageException
Thrown when the SIP message which is read in is not well formed based upon the specification, and we are unable to fill in or fix the required information.
 o getMessageType
 public int getMessageType()
Get the type of message this is (request vs. response).

Returns:
An integer representing the type of message.
 o setMessageType
 public void setMessageType(int type)
Sets the type of this message.

Parameters:
type - The type of message this is.
 o getMethod
 public int getMethod()
Get the method to which this message belongs.

Returns:
An integer representing the method.
 o setMethod
 public void setMethod(int type)
Sets the method associated with this message.

Parameters:
type - The method which this message represents.
 o getRequestURI
 public SIPurl[] getRequestURI()
Get the URL's from the request-line.

Returns:
An array of SIP URL's.
 o setRequestURI
 public void setRequestURI(SIPurl urls[])
Sets the URI's to which this message should be sent.

Parameters:
urls - The array of URL's to be set on the request-line.
 o getStatusCode
 public int getStatusCode()
Get the status code returned in this message. (For responses only.)

Returns:
An integer representing the status code.
 o setStatusCode
 public void setStatusCode(int code)
Sets the status code associated with this response.

Parameters:
code - The status code to be sent.
 o getReasonPhrase
 public String getReasonPhrase()
Get the reason phrase associated with this response.

Returns:
A string containing the returned reason-phrase.
 o setReasonPhrase
 public void setReasonPhrase(String reason)
Sets the reason-phrase associated with this response.

Parameters:
reason - The reason to be sent.
 o getOriginatorVia
 public ViaEntity getOriginatorVia() throws MalformedHeaderException
Get the first Via: which was added to this message. This indicates the originator of the message (we hope.)

Returns:
A ViaEntity with the originator information.
Throws: MalformedHeaderException
Thrown if the header line is syntactically invalid.
 o addVia
 public void addVia(ViaEntity via) throws MalformedMessageException
Adds a new Via: header above the other Via: headers.

Parameters:
via - The ViaEntity to be added.
Throws: MalformedMessageException
Thrown if the addition of this header causes the message to be syntactically malformed.
 o getSubscriptions
 public String[] getSubscriptions()
Get the subscription information from all of the Subscribe: headers within this message.

Returns:
An array of strings containing the subscriptions.
 o addSubscription
 public void addSubscription(String sub) throws MalformedMessageException
Adds a new Subscribe: header to the message.

Parameters:
sub - The instance to be subscribed to.
Throws: MalformedMessageException
Thrown if the addition of this header line makes the message malformed.
 o getLocation
 public SIPurl[] getLocation() throws MalformedMessageException
Get the contents of any Location: headers which were included in this message.

Returns:
An array of SIP URL's containing the location information.
Throws: MalformedMessageException
Thrown if the header from which we are trying to fetch the information is malformed.
 o addLocation
 public void addLocation(SIPurl loc) throws MalformedMessageException
Add a new Location: header to this message.

Parameters:
loc - The SIP URL representing the location to be added.
Throws: MalformedMessageException
Thrown if the header which is being added causes the message to be malformed.
 o addTo
 public void addTo(ToEntity tolist[]) throws MalformedMessageException
Add a new To: header to this message.

Parameters:
to - The ToEntity array containing the addresses to be added.
Throws: MalformedMessageException
Thrown if the header which is being added causes the message to be malformed.
 o addFrom
 public void addFrom(FromEntity from) throws MalformedMessageException
Add a new From: header to this message.

Parameters:
from - The FromEntity representing the address to be added.
Throws: MalformedMessageException
Thrown if the header which is being added causes the message to be malformed.
 o setContentType
 public void setContentType(String type)
Sets the Content-Type header for this message.

Parameters:
type - The string representing the type of content included.
 o getContentType
 public String getContentType()
Get the Content-Type associated with the contents of this message.

Returns:
The string containing the content-type.
 o setMessageBody
 public void setMessageBody(byte data[])
Sets the data for the message body.

Parameters:
data - The byte array which contains the data to be sent.
 o getMessageBody
 public byte[] getMessageBody()
Get the body of this message.

Returns:
A byte array containing the contents of the message body.

All Packages  Class Hierarchy  This Package  Previous  Next  Index