CSIPMessage Class Reference

class CSIPMessage : public CBase

A base class for SIP messages that provides functions for setting and getting headers and SIP version of a SIP message.

sipcodec.lib

Inherits from

Public Member Functions
~CSIPMessage()
IMPORT_C voidAddHeaderL(CSIPHeaderBase *)
IMPORT_C voidAddHeaderL(const CSIPHeaderBase &)
IMPORT_C const RPointerArray< CSIPHeaderBase > &AllHeadersL()
IMPORT_C TUintAnnouncedContentLength()
IMPORT_C CSIPCSeqHeader *CSeq()
IMPORT_C CSIPCallIDHeader *CallID()
IMPORT_C const TDesC8 &Content()
IMPORT_C TIntDeleteHeaders(RStringF)
IMPORT_C TIntEncodedHeaderPartLengthL()
IMPORT_C voidExternalizeHeadersL(RWriteStream &)
IMPORT_C CSIPFromHeader *From()
IMPORT_C TBoolHasAnnouncedContentLength()
IMPORT_C TBoolHasHeader(RStringF)
IMPORT_C CSIPHeaderBase *Header(RStringF, TInt)
IMPORT_C TIntHeaderCount(RStringF)
IMPORT_C TSglQueIter< CSIPHeaderBase >Headers(RStringF)
IMPORT_C voidInternalizeHeadersL(RReadStream &)
IMPORT_C TBoolIsRequest()
IMPORT_C TIntRemoveHeader(const CSIPHeaderBase *)
IMPORT_C voidReplaceHeaderL(CSIPHeaderBase *, CSIPHeaderBase *)
IMPORT_C voidReplaceHeadersL(RPointerArray< CSIPHeaderBase > &)
IMPORT_C RStringFSIPVersion()
IMPORT_C voidSetContent(HBufC8 *)
voidSetSIPVersionL(const TDesC8 &)
IMPORT_C HBufC8 *TakeContentOwnershipL()
IMPORT_C CSIPToHeader *To()
IMPORT_C CBufBase *ToTextHeaderPartL()
IMPORT_C CBufBase *ToTextHeaderPartLC()
IMPORT_C CBufBase *ToTextL()
IMPORT_C CBufBase *ToTextLC()
Protected Member Functions
CSIPMessage()
voidConstructL()
HBufC8 *ToTextFirstLineLC()
Private Member Functions
TInt FindHeaderListIndex(RStringF)
TInt FindHeaderListIndex(const CSIPHeaderBase &)
voidGetEncodedContentLengthHeaderSizeL(TInt &)
voidGetEncodedFirstLineSizeL(TInt &)
TInt HeaderOrder(const TSglQue< CSIPHeaderBase > &, const TSglQue< CSIPHeaderBase > &)
voidInsertL(TSglQue< CSIPHeaderBase > &)
TBool IsContentLengthHeader(const CSIPHeaderBase &)
RStringF ReadFromStreamL(RReadStream &)
HBufC8 *ToTextContentLengthLC()
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Private Attributes
TInt iAnnouncedContentLength
TBool iAnnouncedContentLengthSet
HBufC8 *iContent
RArray< TSglQue< CSIPHeaderBase > >iSIPHeaderListArray
RStringF iSIPVersion
RPointerArray< CSIPHeaderBase >iTmpAllHeaders

Constructor & Destructor Documentation

CSIPMessage()

CSIPMessage()[protected]

~CSIPMessage()

IMPORT_C~CSIPMessage()[virtual]

Destructor.

Member Functions Documentation

AddHeaderL(CSIPHeaderBase *)

IMPORT_C voidAddHeaderL(CSIPHeaderBase *aSIPHeader)

Adds a header to the SIP message. Note that the first header inserted within a group of headers with the same name (for example "Route") is also guaranteed to appear first in the encoded message.

Pre-condition
aSIPHeader != 0
!(aSIPHeader->MoreThanOneAllowed()&&HasHeader (aSIPHeader->Name())

Parameters

CSIPHeaderBase * aSIPHeadera SIP header to be added, ownership is transferred.

AddHeaderL(const CSIPHeaderBase &)

IMPORT_C voidAddHeaderL(const CSIPHeaderBase &aSIPHeader)

Adds a deep copy of a given header to the SIP message. Note that the first header inserted within a group of headers with the same name (for example "Route") is also guaranteed to appear first in the encoded message.

Pre-condition
!(aSIPHeader.MoreThanOneAllowed()&&HasHeader(aSIPHeader->Name())

Parameters

const CSIPHeaderBase & aSIPHeadera SIP header to be added

AllHeadersL()

IMPORT_C const RPointerArray< CSIPHeaderBase > &AllHeadersL()

Creates copies of the pointers to all the headers in the SIP message. Note that the caller must not delete any of the headers returned.

AnnouncedContentLength()

IMPORT_C TUintAnnouncedContentLength()const
Gets the value of "Content-Length"-header that was present when the message was decoded. This might be different than the actual length of the message content.
Pre-condition
HasAnnouncedContentLength() == ETrue

CSeq()

IMPORT_C CSIPCSeqHeader *CSeq()

Gets the CSeq-header in the message.

CallID()

IMPORT_C CSIPCallIDHeader *CallID()

Gets the Call-ID-header in the message.

ConstructL()

voidConstructL()[protected]

Content()

IMPORT_C const TDesC8 &Content()const

Gets the content.

DeleteHeaders(RStringF)

IMPORT_C TIntDeleteHeaders(RStringFaName)
Removes and deletes all the headers with name aName
Pre-condition
HasHeader(aName)==ETrue

Parameters

RStringF aNamethe full or compact name of the headers to delete.

EncodedHeaderPartLengthL()

IMPORT_C TIntEncodedHeaderPartLengthL()

Using this function the user can get the length of the encoded header part without actually encoding the whole header part. Note that this function only saves memory, but not necessarily processing time compared to the actual encoding.

ExternalizeHeadersL(RWriteStream &)

IMPORT_C voidExternalizeHeadersL(RWriteStream &aWriteStream)

Externalizes all the headers that support serialization to a write stream.

Parameters

RWriteStream & aWriteStreama stream where the objects will be externalized

FindHeaderListIndex(RStringF)

TInt FindHeaderListIndex(RStringFaName)const [private]

Parameters

RStringF aName

FindHeaderListIndex(const CSIPHeaderBase &)

TInt FindHeaderListIndex(const CSIPHeaderBase &aHeader)const [private]

Parameters

const CSIPHeaderBase & aHeader

From()

IMPORT_C CSIPFromHeader *From()

Gets the From-header in the message.

GetEncodedContentLengthHeaderSizeL(TInt &)

voidGetEncodedContentLengthHeaderSizeL(TInt &aSize)const [private]

Parameters

TInt & aSize

GetEncodedFirstLineSizeL(TInt &)

voidGetEncodedFirstLineSizeL(TInt &aSize)const [private]

Parameters

TInt & aSize

HasAnnouncedContentLength()

IMPORT_C TBoolHasAnnouncedContentLength()const

Checks if "Content-Length"-header was present when the message was decoded.

HasHeader(RStringF)

IMPORT_C TBoolHasHeader(RStringFaName)const

Checks if a one or more headers with aName are present

Parameters

RStringF aNamethe full or compact name of the header

Header(RStringF, TInt)

IMPORT_C CSIPHeaderBase *Header(RStringFaName,
TIntaIndex
)

Gets a header with aName and an index in list of header with aName Note that using HeaderCount(...) and this function to loop through the headers with a given name is MUCH less efficient than using iterators through Headers(...).

Pre-condition
aIndex < HeaderCount(aName)

Parameters

RStringF aNamethe full or compact name of the header to get
TInt aIndexthe index in the header list

HeaderCount(RStringF)

IMPORT_C TIntHeaderCount(RStringFaName)

Get a count of headers with a given name in this SIP message.

Parameters

RStringF aNamethe full or compact name of the header

HeaderOrder(const TSglQue< CSIPHeaderBase > &, const TSglQue< CSIPHeaderBase > &)

TInt HeaderOrder(const TSglQue< CSIPHeaderBase > &aFirstList,
const TSglQue< CSIPHeaderBase > &aSecondList
)[private, static]

Parameters

const TSglQue< CSIPHeaderBase > & aFirstList
const TSglQue< CSIPHeaderBase > & aSecondList

Headers(RStringF)

IMPORT_C TSglQueIter< CSIPHeaderBase >Headers(RStringFaName)
Gets an iterator to a list of headers with aName
Pre-condition
HasHeader(aName) == ETrue

Parameters

RStringF aNamethe full or compact name of the headers to get

InsertL(TSglQue< CSIPHeaderBase > &)

voidInsertL(TSglQue< CSIPHeaderBase > &aHeaderList)[private]

Parameters

TSglQue< CSIPHeaderBase > & aHeaderList

InternalizeHeadersL(RReadStream &)

IMPORT_C voidInternalizeHeadersL(RReadStream &aReadStream)

Adds headers to the CSIPMessage from a read stream.

Parameters

RReadStream & aReadStreama stream containing the values of the externalized SIP header objects

IsContentLengthHeader(const CSIPHeaderBase &)

TBool IsContentLengthHeader(const CSIPHeaderBase &aHeader)const [private]

Parameters

const CSIPHeaderBase & aHeader

IsRequest()

IMPORT_C TBoolIsRequest()const [pure virtual]

Checks if the actual class of this object is CSIPRequest and can be safely casted to CSIPRequest

ReadFromStreamL(RReadStream &)

RStringF ReadFromStreamL(RReadStream &aReadStream)const [private]

Parameters

RReadStream & aReadStream

RemoveHeader(const CSIPHeaderBase *)

IMPORT_C TIntRemoveHeader(const CSIPHeaderBase *aSIPHeader)

Removes a header from the SIP message based on pointer comparison

Parameters

const CSIPHeaderBase * aSIPHeaderthe header to be removed, ownership is NOT transferred, the caller is supposed to do the deletion

ReplaceHeaderL(CSIPHeaderBase *, CSIPHeaderBase *)

IMPORT_C voidReplaceHeaderL(CSIPHeaderBase *aOldSIPHeader,
CSIPHeaderBase *aNewSIPHeader
)

Replaces a header to the SIP message based on pointer comparison. The updated header has to have the same type. This means that a Contact-header cannot replace a To-header. Note that the new header will be placed last in the list of headers.

Pre-condition
aOldSIPHeader != 0
aNewSIPHeader != 0
aOldSIPHeader->Name() == aNewSIPHeader->Name()

Parameters

CSIPHeaderBase * aOldSIPHeaderthe header to be replaced. Deleted if the function returns without leaving.
CSIPHeaderBase * aNewSIPHeaderthe header that replaces the old header. The ownership is transferred.

ReplaceHeadersL(RPointerArray< CSIPHeaderBase > &)

IMPORT_C voidReplaceHeadersL(RPointerArray< CSIPHeaderBase > &aNewHeaders)

Replaces all the headers with a common name. All the headers must be of same type.

Pre-condition
aNewHeaders.Count() > 0

Parameters

RPointerArray< CSIPHeaderBase > & aNewHeadersthe headers that will replace the old headers. The ownership of the headers is transferred and the array is resetted on return.

SIPVersion()

IMPORT_C RStringFSIPVersion()const

Gets the SIP version

SetContent(HBufC8 *)

IMPORT_C voidSetContent(HBufC8 *aContent)

Set the content

Parameters

HBufC8 * aContent

SetSIPVersionL(const TDesC8 &)

voidSetSIPVersionL(const TDesC8 &aSIPVersion)

Parameters

const TDesC8 & aSIPVersion

TakeContentOwnershipL()

IMPORT_C HBufC8 *TakeContentOwnershipL()

Gets the ownership to the content

To()

IMPORT_C CSIPToHeader *To()

Gets the To-header in the message.

ToTextContentLengthLC()

HBufC8 *ToTextContentLengthLC()const [private]

ToTextFirstLineLC()

HBufC8 *ToTextFirstLineLC()const [protected, pure virtual]

ToTextHeaderPartL()

IMPORT_C CBufBase *ToTextHeaderPartL()

Encodes the header part of the SIP message object into its textual representation..

ToTextHeaderPartLC()

IMPORT_C CBufBase *ToTextHeaderPartLC()

Encodes the header part of the SIP message object into its textual representation and pushes it to the CleanupStack.

ToTextL()

IMPORT_C CBufBase *ToTextL()

Encodes the SIP message object into its textual representation.

ToTextLC()

IMPORT_C CBufBase *ToTextLC()

Encodes the SIP message object into its textual representation and pushes it to the CleanupStack.

Member Data Documentation

TInt iAnnouncedContentLength

TInt iAnnouncedContentLength[private]

TBool iAnnouncedContentLengthSet

TBool iAnnouncedContentLengthSet[private]

HBufC8 * iContent

HBufC8 *iContent[private]

RArray< TSglQue< CSIPHeaderBase > > iSIPHeaderListArray

RArray< TSglQue< CSIPHeaderBase > >iSIPHeaderListArray[private]

RStringF iSIPVersion

RStringF iSIPVersion[private]

RPointerArray< CSIPHeaderBase > iTmpAllHeaders

RPointerArray< CSIPHeaderBase >iTmpAllHeaders[private]