# SIP_PDU Class Reference

`#include <sippdu.h>`

Inheritance diagram for SIP_PDU:

[legend]
Collaboration diagram for SIP_PDU:
[legend]

## Public Types

| Method_INVITE
| Method_ACK
| Method_OPTIONS
| Method_BYE
| Method_CANCEL
| Method_REGISTER
| Method_SUBSCRIBE
| Method_NOTIFY
| Method_REFER
| Method_MESSAGE
| Method_INFO
| Method_PING
| Method_PUBLISH
| Method_PRACK
| NumMethods
| IllegalStatusCode
| Local_TransportError
| Local_BadTransportAddress
| Local_Timeout
| Local_NoCompatibleListener
| Local_CannotMapScheme
| Local_TransportLost
| Local_KeepAlive
| Local_NotAuthenticated
| Information_Trying = 100
| Information_Ringing = 180
| Information_CallForwarded = 181
| Information_Queued = 182
| Information_Session_Progress = 183
| Successful_OK = 200
| Successful_Accepted = 202
| Redirection_MultipleChoices = 300
| Redirection_MovedPermanently = 301
| Redirection_MovedTemporarily = 302
| Redirection_UseProxy = 305
| Redirection_AlternativeService = 380
| Failure_BadRequest = 400
| Failure_UnAuthorised = 401
| Failure_PaymentRequired = 402
| Failure_Forbidden = 403
| Failure_NotFound = 404
| Failure_MethodNotAllowed = 405
| Failure_NotAcceptable = 406
| Failure_ProxyAuthenticationRequired = 407
| Failure_RequestTimeout = 408
| Failure_Conflict = 409
| Failure_Gone = 410
| Failure_LengthRequired = 411
| Failure_RequestEntityTooLarge = 413
| Failure_RequestURITooLong = 414
| Failure_UnsupportedMediaType = 415
| Failure_UnsupportedURIScheme = 416
| Failure_BadExtension = 420
| Failure_ExtensionRequired = 421
| Failure_IntervalTooBrief = 423
| Failure_UnresolvableDestination = 476
| Failure_TemporarilyUnavailable = 480
| Failure_TransactionDoesNotExist = 481
| Failure_LoopDetected = 482
| Failure_TooManyHops = 483
| Failure_AddressIncomplete = 484
| Failure_Ambiguous = 485
| Failure_BusyHere = 486
| Failure_RequestTerminated = 487
| Failure_NotAcceptableHere = 488
| Failure_BadEvent = 489
| Failure_RequestPending = 491
| Failure_Undecipherable = 493
| Failure_InternalServerError = 500
| Failure_NotImplemented = 501
| Failure_BadGateway = 502
| Failure_ServiceUnavailable = 503
| Failure_ServerTimeout = 504
| Failure_SIPVersionNotSupported = 505
| Failure_MessageTooLarge = 513
| GlobalFailure_BusyEverywhere = 600
| GlobalFailure_Decline = 603
| GlobalFailure_DoesNotExistAnywhere = 604
| GlobalFailure_NotAcceptable = 606
| MaxStatusCode = 699
enum | Methods { Method_INVITE, Method_ACK, Method_OPTIONS, Method_BYE, Method_CANCEL, Method_REGISTER, Method_SUBSCRIBE, Method_NOTIFY, Method_REFER, Method_MESSAGE, Method_INFO, Method_PING, Method_PUBLISH, Method_PRACK, NumMethods }

enum

StatusCodes {
IllegalStatusCode, Local_TransportError, Local_BadTransportAddress, Local_Timeout,
Local_NoCompatibleListener, Local_CannotMapScheme, Local_TransportLost, Local_KeepAlive,
Local_NotAuthenticated, Information_Trying = 100, Information_Ringing = 180, Information_CallForwarded = 181,
Information_Queued = 182, Information_Session_Progress = 183, Successful_OK = 200, Successful_Accepted = 202,
Redirection_MultipleChoices = 300, Redirection_MovedPermanently = 301, Redirection_MovedTemporarily = 302, Redirection_UseProxy = 305,
Redirection_AlternativeService = 380, Failure_BadRequest = 400, Failure_UnAuthorised = 401, Failure_PaymentRequired = 402,
Failure_Forbidden = 403, Failure_NotFound = 404, Failure_MethodNotAllowed = 405, Failure_NotAcceptable = 406,
Failure_ProxyAuthenticationRequired = 407, Failure_RequestTimeout = 408, Failure_Conflict = 409, Failure_Gone = 410,
Failure_LengthRequired = 411, Failure_RequestEntityTooLarge = 413, Failure_RequestURITooLong = 414, Failure_UnsupportedMediaType = 415,
Failure_UnsupportedURIScheme = 416, Failure_BadExtension = 420, Failure_ExtensionRequired = 421, Failure_IntervalTooBrief = 423,
Failure_UnresolvableDestination = 476, Failure_TemporarilyUnavailable = 480, Failure_TransactionDoesNotExist = 481, Failure_LoopDetected = 482,
Failure_TooManyHops = 483, Failure_AddressIncomplete = 484, Failure_Ambiguous = 485, Failure_BusyHere = 486,
Failure_RequestTerminated = 487, Failure_NotAcceptableHere = 488, Failure_BadEvent = 489, Failure_RequestPending = 491,
Failure_Undecipherable = 493, Failure_InternalServerError = 500, Failure_NotImplemented = 501, Failure_BadGateway = 502,
Failure_ServiceUnavailable = 503, Failure_ServerTimeout = 504, Failure_SIPVersionNotSupported = 505, Failure_MessageTooLarge = 513,
GlobalFailure_BusyEverywhere = 600, GlobalFailure_Decline = 603, GlobalFailure_DoesNotExistAnywhere = 604, GlobalFailure_NotAcceptable = 606,
MaxStatusCode = 699
}

## Public Member Functions

| SIP_PDU (Methods method=SIP_PDU::NumMethods, const OpalTransportPtr &transport=NULL)
| SIP_PDU (const SIP_PDU &request, StatusCodes code, const SDPSessionDescription *sdp=NULL)
| SIP_PDU (const SIP_PDU &)
SIP_PDU & | operator= (const SIP_PDU &)
| ~SIP_PDU ()
void | PrintOn (ostream &strm) const
void | InitialiseHeaders (const SIPURL &dest, const SIPURL &to, const SIPURL &from, const PString &callID, unsigned cseq)
void | InitialiseHeaders (SIPDialogContext &dialog, unsigned cseq=0)
void | InitialiseHeaders (SIPConnection &connection, unsigned cseq=0)
void | InitialiseHeaders (const SIP_PDU &request)
bool | SetRoute (const SIPURLList &routeSet)
bool | SetRoute (const SIPURL &proxy)
void | SetAllow (unsigned bitmask)
StatusCodes | Read ()
StatusCodes | Parse (istream &strm, bool truncated)
bool | Send ()
bool | SendResponse (StatusCodes code)
void | Build (PString &pduStr, PINDEX &pduLen)
const PString & | GetTransactionID () const
Methods | GetMethod () const
StatusCodes | GetStatusCode () const
void | SetStatusCode (StatusCodes c)
const SIPURL & | GetURI () const
void | SetURI (const SIPURL &newuri)
unsigned | GetVersionMajor () const
unsigned | GetVersionMinor () const
void | SetCSeq (unsigned cseq)
const PString & | GetEntityBody () const
void | SetEntityBody (const PString &body)
void | SetEntityBody ()
const PString & | GetInfo () const
void | SetInfo (const PString &info)
const SIPMIMEInfo & | GetMIME () const
SIPMIMEInfo & | GetMIME ()
SDPSessionDescription * | GetSDP ()
void | SetSDP (SDPSessionDescription *sdp)
bool | DecodeSDP (const OpalMediaFormatList &masterList)
const PString & | GetExternalTransportAddress () const
OpalTransportPtr | GetTransport () const

## Static Public Member Functions

static PString | GetStatusCodeDescription (int code)

## Protected Member Functions

void | CalculateVia ()
StatusCodes | InternalSend (bool canDoTCP)

## Protected Attributes

Methods | m_method
StatusCodes | m_statusCode
SIPURL | m_uri
unsigned | m_versionMajor
unsigned | m_versionMinor
PString | m_info
SIPMIMEInfo | m_mime
PString | m_entityBody
PString | m_transactionID
SDPSessionDescription * | m_SDP
OpalTransportPtr | m_transport
OpalTransportAddress | m_viaAddress
OpalTransportAddress | m_externalTransportAddress

## Friends

ostream & | operator<< (ostream &strm, StatusCodes status)

## Detailed Description

Session Initiation Protocol message. Each message contains a header, MIME lines and possibly SDP. Class provides methods for reading from and writing to transport.

## Member Enumeration Documentation

enum SIP_PDU::Methods

Enumerator:

  Method_INVITE |
  Method_ACK |
  Method_OPTIONS |
  Method_BYE |
  Method_CANCEL |
  Method_REGISTER |
  Method_SUBSCRIBE |
  Method_NOTIFY |
  Method_REFER |
  Method_MESSAGE |
  Method_INFO |
  Method_PING |
  Method_PUBLISH |
  Method_PRACK |
  NumMethods |

enum SIP_PDU::StatusCodes

Enumerator:

  IllegalStatusCode |
  Local_TransportError |
  Local_BadTransportAddress |
  Local_Timeout |
  Local_NoCompatibleListener |
  Local_CannotMapScheme |
  Local_TransportLost |
  Local_KeepAlive |
  Local_NotAuthenticated |
  Information_Trying |
  Information_Ringing |
  Information_CallForwarded |
  Information_Queued |
  Information_Session_Progress |
  Successful_OK |
  Successful_Accepted |
  Redirection_MultipleChoices |
  Redirection_MovedPermanently |
  Redirection_MovedTemporarily |
  Redirection_UseProxy |
  Redirection_AlternativeService |
  Failure_BadRequest |
  Failure_UnAuthorised |
  Failure_PaymentRequired |
  Failure_Forbidden |
  Failure_NotFound |
  Failure_MethodNotAllowed |
  Failure_NotAcceptable |
  Failure_ProxyAuthenticationRequired |
  Failure_RequestTimeout |
  Failure_Conflict |
  Failure_Gone |
  Failure_LengthRequired |
  Failure_RequestEntityTooLarge |
  Failure_RequestURITooLong |
  Failure_UnsupportedMediaType |
  Failure_UnsupportedURIScheme |
  Failure_BadExtension |
  Failure_ExtensionRequired |
  Failure_IntervalTooBrief |
  Failure_UnresolvableDestination |
  Failure_TemporarilyUnavailable |
  Failure_TransactionDoesNotExist |
  Failure_LoopDetected |
  Failure_TooManyHops |
  Failure_AddressIncomplete |
  Failure_Ambiguous |
  Failure_BusyHere |
  Failure_RequestTerminated |
  Failure_NotAcceptableHere |
  Failure_BadEvent |
  Failure_RequestPending |
  Failure_Undecipherable |
  Failure_InternalServerError |
  Failure_NotImplemented |
  Failure_BadGateway |
  Failure_ServiceUnavailable |
  Failure_ServerTimeout |
  Failure_SIPVersionNotSupported |
  Failure_MessageTooLarge |
  GlobalFailure_BusyEverywhere |
  GlobalFailure_Decline |
  GlobalFailure_DoesNotExistAnywhere |
  GlobalFailure_NotAcceptable |
  MaxStatusCode |

## Constructor & Destructor Documentation

SIP_PDU::SIP_PDU | ( | Methods | method = `SIP_PDU::NumMethods`,
|  | const OpalTransportPtr & | transport = `NULL` |
| ) |  |  |

SIP_PDU::SIP_PDU | ( | const SIP_PDU & | request,
|  | StatusCodes | code,
|  | const SDPSessionDescription * | sdp = `NULL` |
| ) |  |  |

Construct a Response message extra is passed as message body

SIP_PDU::SIP_PDU | ( | const SIP_PDU & |  | ) |

SIP_PDU::~SIP_PDU | ( |  | ) |

## Member Function Documentation

void SIP_PDU::Build | ( | PString & | pduStr,
|  | PINDEX & | pduLen |
| ) |  |  |

Construct the PDU string to output. Returns the total length of the PDU.

void SIP_PDU::CalculateVia | ( |  | ) | `[protected]`

bool SIP_PDU::DecodeSDP | ( | const OpalMediaFormatList & | masterList | ) |

const PString& SIP_PDU::GetEntityBody | ( |  | ) | const`[inline]`

const PString& SIP_PDU::GetExternalTransportAddress | ( |  | ) | const`[inline]`

const PString& SIP_PDU::GetInfo | ( |  | ) | const`[inline]`

Methods SIP_PDU::GetMethod | ( |  | ) | const`[inline]`

SIPMIMEInfo& SIP_PDU::GetMIME | ( |  | ) | `[inline]`

const SIPMIMEInfo& SIP_PDU::GetMIME | ( |  | ) | const`[inline]`

SDPSessionDescription* SIP_PDU::GetSDP | ( |  | ) | `[inline]`

StatusCodes SIP_PDU::GetStatusCode | ( |  | ) | const`[inline]`

static PString SIP_PDU::GetStatusCodeDescription | ( | int | code | ) | `[static]`

const PString& SIP_PDU::GetTransactionID | ( |  | ) | const`[inline]`

OpalTransportPtr SIP_PDU::GetTransport | ( |  | ) | const`[inline]`

const SIPURL& SIP_PDU::GetURI | ( |  | ) | const`[inline]`

unsigned SIP_PDU::GetVersionMajor | ( |  | ) | const`[inline]`

unsigned SIP_PDU::GetVersionMinor | ( |  | ) | const`[inline]`

void SIP_PDU::InitialiseHeaders | ( | const SIP_PDU & | request | ) |

void SIP_PDU::InitialiseHeaders | ( | SIPConnection & | connection,
|  | unsigned | cseq = `0` |
| ) |  |  |

void SIP_PDU::InitialiseHeaders | ( | SIPDialogContext & | dialog,
|  | unsigned | cseq = `0` |
| ) |  |  |

void SIP_PDU::InitialiseHeaders | ( | const SIPURL & | dest,
|  | const SIPURL & | to,
|  | const SIPURL & | from,
|  | const PString & | callID,
|  | unsigned | cseq |
| ) |  |  |

StatusCodes SIP_PDU::InternalSend | ( | bool | canDoTCP | ) | `[protected]`

SIP_PDU& SIP_PDU::operator= | ( | const SIP_PDU & |  | ) |

StatusCodes SIP_PDU::Parse | ( | istream & | strm,
|  | bool | truncated |
| ) |  |  |

void SIP_PDU::PrintOn | ( | ostream & | strm | ) | const

StatusCodes SIP_PDU::Read | ( |  | ) |

Read PDU from the specified transport.

bool SIP_PDU::Send | ( |  | ) |

Write the PDU to the transport.

bool SIP_PDU::SendResponse | ( | StatusCodes | code | ) |

Write PDU as a response to a request.

void SIP_PDU::SetAllow | ( | unsigned | bitmask | ) |

Set mime allow field to all supported methods.

void SIP_PDU::SetCSeq | ( | unsigned | cseq | ) |

void SIP_PDU::SetEntityBody | ( |  | ) |

void SIP_PDU::SetEntityBody | ( | const PString & | body | ) | `[inline]`

void SIP_PDU::SetInfo | ( | const PString & | info | ) | `[inline]`

bool SIP_PDU::SetRoute | ( | const SIPURL & | proxy | ) |

bool SIP_PDU::SetRoute | ( | const SIPURLList & | routeSet | ) |

Add and populate Route header following the given routeSet. If first route is strict, exchange with URI. Returns true if routeSet.

void SIP_PDU::SetSDP | ( | SDPSessionDescription * | sdp | ) |

void SIP_PDU::SetStatusCode | ( | StatusCodes | c | ) | `[inline]`

void SIP_PDU::SetURI | ( | const SIPURL & | newuri | ) | `[inline]`

## Friends And Related Function Documentation

ostream& operator<< | ( | ostream & | strm,
|  | StatusCodes | status |
| ) |  |  | `[friend]`

## Field Documentation

PString SIP_PDU::m_entityBody `[protected]`

OpalTransportAddress SIP_PDU::m_externalTransportAddress `[protected]`

PString SIP_PDU::m_info `[protected]`

Methods SIP_PDU::m_method `[protected]`

SIPMIMEInfo SIP_PDU::m_mime `[protected]`

SDPSessionDescription* SIP_PDU::m_SDP `[protected]`

StatusCodes SIP_PDU::m_statusCode `[protected]`

PString SIP_PDU::m_transactionID `[protected]`

OpalTransportPtr SIP_PDU::m_transport `[protected]`

SIPURL SIP_PDU::m_uri `[protected]`

unsigned SIP_PDU::m_versionMajor `[protected]`

unsigned SIP_PDU::m_versionMinor `[protected]`

OpalTransportAddress SIP_PDU::m_viaAddress `[protected]`

The documentation for this class was generated from the following file:

- sippdu.h