SIPMessage Class Reference
A container and parser for SIP messages.
More...
#include <yatesip.h>
List of all members.
Public Member Functions |
| SIPMessage (const SIPMessage &original) |
| SIPMessage (const char *_method, const char *_uri, const char *_version="SIP/2.0") |
| SIPMessage (SIPParty *ep, const char *buf, int len=-1) |
| SIPMessage (const SIPMessage *message, int _code, const char *_reason=0) |
| SIPMessage (const SIPMessage *original, const SIPMessage *answer) |
virtual | ~SIPMessage () |
void | complete (SIPEngine *engine, const char *user=0, const char *domain=0, const char *dlgTag=0) |
bool | copyHeader (const SIPMessage *message, const char *name, const char *newName=0) |
int | copyAllHeaders (const SIPMessage *message, const char *name, const char *newName=0) |
SIPParty * | getParty () const |
void | setParty (SIPParty *ep=0) |
bool | isValid () const |
bool | isAnswer () const |
bool | isOutgoing () const |
bool | isACK () const |
bool | isReliable () const |
int | getCSeq () const |
const MimeHeaderLine * | getHeader (const char *name) const |
const MimeHeaderLine * | getLastHeader (const char *name) const |
int | countHeaders (const char *name) const |
const NamedString * | getParam (const char *name, const char *param) const |
const String & | getHeaderValue (const char *name) const |
const String & | getParamValue (const char *name, const char *param) const |
void | addHeader (const char *name, const char *value=0) |
void | addHeader (MimeHeaderLine *line) |
void | clearHeaders (const char *name) |
void | setHeader (const char *name, const char *value=0) |
MimeAuthLine * | buildAuth (const String &username, const String &password, const String &meth, const String &uri, bool proxy=false) const |
MimeAuthLine * | buildAuth (const SIPMessage &original) const |
void | setAutoAuth (const char *username=0, const char *password=0) |
const String & | getAuthUsername () const |
const String & | getAuthPassword () const |
ObjList * | getRoutes () const |
void | addRoutes (const ObjList *routes) |
const DataBlock & | getBuffer () const |
const String & | getHeaders () const |
void | setBody (MimeBody *newbody=0) |
Static Public Member Functions |
static SIPMessage * | fromParsing (SIPParty *ep, const char *buf, int len=-1) |
Public Attributes |
String | version |
String | method |
String | uri |
int | code |
String | reason |
ObjList | header |
MimeBody * | body |
Protected Member Functions |
bool | parse (const char *buf, int len) |
bool | parseFirst (String &line) |
Protected Attributes |
SIPParty * | m_ep |
bool | m_valid |
bool | m_answer |
bool | m_outgoing |
bool | m_ack |
int | m_cseq |
String | m_string |
DataBlock | m_data |
String | m_authUser |
String | m_authPass |
Detailed Description
A container and parser for SIP messages.
An object that holds the sip message parsed into this library model. This class can be used to parse a sip message from a text buffer, or it can be used to create a text buffer from a sip message.
Constructor & Destructor Documentation
SIPMessage |
( |
const char * |
_method, |
|
|
const char * |
_uri, |
|
|
const char * |
_version = "SIP/2.0" | |
|
) |
| | |
Creates a new SIPMessage from parsing a text buffer.
Creates a new SIPMessage as answer to another message.
Creates an ACK message from an original message and a response.
Destroy the message and all
Member Function Documentation
Append an already constructed header line
- Parameters:
-
void addHeader |
( |
const char * |
name, |
|
|
const char * |
value = 0 | |
|
) |
| | [inline] |
Append a new header line constructed from name and content
- Parameters:
-
| name | Name of the header to add |
| value | Content of the new header line |
void addRoutes |
( |
const ObjList * |
routes |
) |
|
Add Route: headers to an outgoing message
- Parameters:
-
Construct a new authorization line based on this answer and original message
- Parameters:
-
| original | Origianl outgoing message |
- Returns:
- A new authorization line to be used in a new transaction
Construct a new authorization line based on credentials and challenge
- Parameters:
-
| username | User account name |
| password | Clear text password for the account |
| meth | Method to include in the authorization digest |
| uri | URI to include in the authorization digest |
| proxy | Set to true to authenticate to a proxy, false to a server |
- Returns:
- A new authorization line to be used in a new transaction
void clearHeaders |
( |
const char * |
name |
) |
|
Clear all header lines that match a name
- Parameters:
-
| name | Name of the header to clear |
void complete |
( |
SIPEngine * |
engine, |
|
|
const char * |
user = 0 , |
|
|
const char * |
domain = 0 , |
|
|
const char * |
dlgTag = 0 | |
|
) |
| | |
Complete missing fields with defaults taken from a SIP engine
int copyAllHeaders |
( |
const SIPMessage * |
message, |
|
|
const char * |
name, |
|
|
const char * |
newName = 0 | |
|
) |
| | |
Copy multiple header lines (including all parameters) from another message
- Parameters:
-
| message | Pointer to the message to copy the header from |
| name | Name of the headers to copy |
| newName | New name to force in headers, NULL to just copy |
- Returns:
- Number of headers found and copied
bool copyHeader |
( |
const SIPMessage * |
message, |
|
|
const char * |
name, |
|
|
const char * |
newName = 0 | |
|
) |
| | |
Copy an entire header line (including all parameters) from another message
- Parameters:
-
| message | Pointer to the message to copy the header from |
| name | Name of the header to copy |
| newName | New name to force in headers, NULL to just copy |
- Returns:
- True if the header was found and copied
int countHeaders |
( |
const char * |
name |
) |
const |
Count the header lines matching a specific name
- Parameters:
-
| name | Name of the header to locate |
- Returns:
- Number of matching header lines
Construct a new SIP message by parsing a text buffer
- Returns:
- A pointer to a valid new message or NULL
const String& getAuthPassword |
( |
|
) |
const [inline] |
Retrive the password to be used for auto authentication
- Returns:
- Password for auto authentication
const String& getAuthUsername |
( |
|
) |
const [inline] |
Retrive the username to be used for auto authentication
- Returns:
- Username for auto authentication
int getCSeq |
( |
|
) |
const [inline] |
Get the Command Sequence number from this message
Find a header line by name
- Parameters:
-
| name | Name of the header to locate |
- Returns:
- A pointer to the first matching header line or 0 if not found
const String& getHeaders |
( |
|
) |
const |
Creates a text buffer from the headers.
const String& getHeaderValue |
( |
const char * |
name |
) |
const |
Get a string value (without parameters) from a header line
- Parameters:
-
| name | Name of the header to locate |
- Returns:
- The value hold in the header or an empty String
Find the last header line that matches a given name name
- Parameters:
-
| name | Name of the header to locate |
- Returns:
- A pointer to the last matching header line or 0 if not found
const NamedString* getParam |
( |
const char * |
name, |
|
|
const char * |
param | |
|
) |
| | const |
Find a header parameter by name
- Parameters:
-
| name | Name of the header to locate |
| param | Name of the parameter to locate in the tag |
- Returns:
- A pointer to the first matching header line or 0 if not found
const String& getParamValue |
( |
const char * |
name, |
|
|
const char * |
param | |
|
) |
| | const |
Get a string value from a parameter in a header line
- Parameters:
-
| name | Name of the header to locate |
| param | Name of the parameter to locate in the tag |
- Returns:
- The value hold in the parameter or an empty String
Get the endpoint this message uses
- Returns:
- Pointer to the endpoint of this message
Extract routes from Record-Route: headers
- Returns:
- A list of MimeHeaderLine representing SIP routes
bool isACK |
( |
|
) |
const [inline] |
Check if this message is an ACK message
- Returns:
- True if this message has an ACK method
bool isAnswer |
( |
|
) |
const [inline] |
Check if this message is an answer or a request
bool isOutgoing |
( |
|
) |
const [inline] |
Check if this message is an outgoing message
- Returns:
- True if this message should be sent to remote
bool isReliable |
( |
|
) |
const [inline] |
Check if this message is handled by a reliable protocol
- Returns:
- True if a reliable protocol (TCP, SCTP) is used
bool isValid |
( |
|
) |
const [inline] |
Check if this message is valid as result of the parsing
void setAutoAuth |
( |
const char * |
username = 0 , |
|
|
const char * |
password = 0 | |
|
) |
| | [inline] |
Prepare the message for automatic client transaction authentication.
- Parameters:
-
| username | Username for auto authentication |
| password | Password for auto authentication |
Set a new body for this message
void setHeader |
( |
const char * |
name, |
|
|
const char * |
value = 0 | |
|
) |
| | [inline] |
Set a header line constructed from name and content
Set the endpoint this message uses
- Parameters:
-
| ep | Pointer to the endpoint of this message |
Member Data Documentation
All the body related things should be here, including the entire body and the parsed body.
All the headers should be in this list.
This holds the method name of the message.
The documentation for this class was generated from the following file: