Yate
|
An MGCP command or response. More...
#include <yatemgcp.h>
Public Member Functions | |
MGCPMessage (MGCPEngine *engine, const char *name, const char *ep, const char *ver="MGCP 1.0") | |
MGCPMessage (MGCPTransaction *trans, unsigned int code, const char *comment=0) | |
virtual | ~MGCPMessage () |
bool | valid () const |
const String & | name () const |
int | code () const |
const String & | version () const |
const String & | comment () const |
bool | isCommand () const |
bool | isResponse () const |
bool | isAck () const |
unsigned int | transactionId () const |
const String & | endpointId () const |
void | toString (String &dest) const |
Static Public Member Functions | |
static bool | parse (MGCPEngine *engine, ObjList &dest, const unsigned char *buffer, unsigned int len, const char *sdpType="application/sdp") |
Public Attributes | |
NamedList | params |
ObjList | sdp |
Protected Member Functions | |
MGCPMessage (MGCPEngine *engine, const char *name, int code, unsigned int transId, const char *epId, const char *ver) | |
Friends | |
class | MGCPTransaction |
An MGCP command or response.
This class holds an MGCP message, either command or response, along with its parameters. The
MGCPMessage | ( | MGCPEngine * | engine, |
const char * | name, | ||
const char * | ep, | ||
const char * | ver = "MGCP 1.0" |
||
) |
Constructor. Construct an outgoing command message. A transaction id will be requested from the endpoint's engine. The message will be invalidated if failed to get a transaction id or the command name is unknown
engine | The engine sending this message |
name | Command name |
ep | The id of the endpoint issuing this command |
ver | The protocol version to use |
MGCPMessage | ( | MGCPTransaction * | trans, |
unsigned int | code, | ||
const char * | comment = 0 |
||
) |
Constructor. Construct an outgoing response message The message will be invalidated if failed to get a transaction id or the code is greater then 999
trans | The transaction to respond |
code | The response code ranging from 0 to 999 |
comment | Optional response comment |
virtual ~MGCPMessage | ( | ) | [virtual] |
Destructor
MGCPMessage | ( | MGCPEngine * | engine, |
const char * | name, | ||
int | code, | ||
unsigned int | transId, | ||
const char * | epId, | ||
const char * | ver | ||
) | [protected] |
Constructor. Used by the parser to construct an incoming message
engine | The engine receiving this message |
name | Command name or response comment |
code | The response code in the range 0 to 999 or -1 if the received message is a command |
transId | The id of the transaction owning this message |
epId | The id of the endpoint issuing this command |
ver | The protocol version |
int code | ( | ) | const [inline] |
Get the response code if this is a response message
Get the comment from a response message
const String& endpointId | ( | ) | const [inline] |
Get the message's endpoint id if this is a command
bool isAck | ( | ) | const [inline] |
Check if this message is a response ACK (code is between 0 and 99, including the margins)
bool isCommand | ( | ) | const [inline] |
Check if this is a command (code is a negative value)
bool isResponse | ( | ) | const [inline] |
Check if this is a response message (code is greater then or equal to 100)
Get the command name or response code text representation of this message
static bool parse | ( | MGCPEngine * | engine, |
ObjList & | dest, | ||
const unsigned char * | buffer, | ||
unsigned int | len, | ||
const char * | sdpType = "application/sdp" |
||
) | [static] |
Parse a received buffer according to RFC 3435. Command and protocol names are converted to upper case. The enpoint id is converted to lower case. Message parameter names are converted to lower case if the engine's flag is set. Message parameter values and SDP(s) are stored unchanged
engine | The receiving engine |
dest | The list of received messages |
buffer | The buffer to parse |
len | The buffer length |
sdpType | The MIME SDP content type if the message contains any SDP body |
Convert this message to a string representation to be sent to the remote endpoint or printed to output
dest | Destination string |
unsigned int transactionId | ( | ) | const [inline] |
Get the message's transaction id
bool valid | ( | ) | const [inline] |
Check if this is a valid message
Get the protocol version of a command message
Keep the SDP(s) carried by this message as MimeSdpBody object(s)