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 void AddHeaderL ( CSIPHeaderBase *)
IMPORT_C void AddHeaderL (const CSIPHeaderBase &)
IMPORT_C const RPointerArray < CSIPHeaderBase > & AllHeadersL ()
IMPORT_C TUint AnnouncedContentLength ()
IMPORT_C CSIPCSeqHeader * CSeq ()
IMPORT_C CSIPCallIDHeader * CallID ()
IMPORT_C const TDesC8 & Content ()
IMPORT_C TInt DeleteHeaders ( RStringF )
IMPORT_C TInt EncodedHeaderPartLengthL ()
IMPORT_C void ExternalizeHeadersL ( RWriteStream &)
IMPORT_C CSIPFromHeader * From ()
IMPORT_C TBool HasAnnouncedContentLength ()
IMPORT_C TBool HasHeader ( RStringF )
IMPORT_C CSIPHeaderBase * Header ( RStringF , TInt )
IMPORT_C TInt HeaderCount ( RStringF )
IMPORT_C TSglQueIter < CSIPHeaderBase > Headers ( RStringF )
IMPORT_C void InternalizeHeadersL ( RReadStream &)
IMPORT_C TBool IsRequest ()
IMPORT_C TInt RemoveHeader (const CSIPHeaderBase *)
IMPORT_C void ReplaceHeaderL ( CSIPHeaderBase *, CSIPHeaderBase *)
IMPORT_C void ReplaceHeadersL ( RPointerArray < CSIPHeaderBase > &)
IMPORT_C RStringF SIPVersion ()
IMPORT_C void SetContent ( HBufC8 *)
void SetSIPVersionL (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 ()
void ConstructL ()
HBufC8 * ToTextFirstLineLC ()
Private Member Functions
TInt FindHeaderListIndex ( RStringF )
TInt FindHeaderListIndex (const CSIPHeaderBase &)
void GetEncodedContentLengthHeaderSizeL ( TInt &)
void GetEncodedFirstLineSizeL ( TInt &)
TInt HeaderOrder (const TSglQue < CSIPHeaderBase > &, const TSglQue < CSIPHeaderBase > &)
void InsertL ( 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 void AddHeaderL ( 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 * aSIPHeader a SIP header to be added, ownership is transferred.

AddHeaderL(const CSIPHeaderBase &)

IMPORT_C void AddHeaderL ( 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 & aSIPHeader a 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 TUint AnnouncedContentLength ( ) 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()

void ConstructL ( ) [protected]

Content()

IMPORT_C const TDesC8 & Content ( ) const

Gets the content.

DeleteHeaders(RStringF)

IMPORT_C TInt DeleteHeaders ( RStringF aName )
Removes and deletes all the headers with name aName
Pre-condition
HasHeader(aName)==ETrue

Parameters

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

EncodedHeaderPartLengthL()

IMPORT_C TInt EncodedHeaderPartLengthL ( )

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 void ExternalizeHeadersL ( RWriteStream & aWriteStream )

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

Parameters

RWriteStream & aWriteStream a stream where the objects will be externalized

FindHeaderListIndex(RStringF)

TInt FindHeaderListIndex ( RStringF aName ) 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 &)

void GetEncodedContentLengthHeaderSizeL ( TInt & aSize ) const [private]

Parameters

TInt & aSize

GetEncodedFirstLineSizeL(TInt &)

void GetEncodedFirstLineSizeL ( TInt & aSize ) const [private]

Parameters

TInt & aSize

HasAnnouncedContentLength()

IMPORT_C TBool HasAnnouncedContentLength ( ) const

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

HasHeader(RStringF)

IMPORT_C TBool HasHeader ( RStringF aName ) const

Checks if a one or more headers with aName are present

Parameters

RStringF aName the full or compact name of the header

Header(RStringF, TInt)

IMPORT_C CSIPHeaderBase * Header ( RStringF aName,
TInt aIndex
)

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 aName the full or compact name of the header to get
TInt aIndex the index in the header list

HeaderCount(RStringF)

IMPORT_C TInt HeaderCount ( RStringF aName )

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

Parameters

RStringF aName the 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 ( RStringF aName )
Gets an iterator to a list of headers with aName
Pre-condition
HasHeader(aName) == ETrue

Parameters

RStringF aName the full or compact name of the headers to get

InsertL(TSglQue< CSIPHeaderBase > &)

void InsertL ( TSglQue < CSIPHeaderBase > & aHeaderList ) [private]

Parameters

TSglQue < CSIPHeaderBase > & aHeaderList

InternalizeHeadersL(RReadStream &)

IMPORT_C void InternalizeHeadersL ( RReadStream & aReadStream )

Adds headers to the CSIPMessage from a read stream.

Parameters

RReadStream & aReadStream a 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 TBool IsRequest ( ) 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 TInt RemoveHeader ( const CSIPHeaderBase * aSIPHeader )

Removes a header from the SIP message based on pointer comparison

Parameters

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

ReplaceHeaderL(CSIPHeaderBase *, CSIPHeaderBase *)

IMPORT_C void ReplaceHeaderL ( 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 * aOldSIPHeader the header to be replaced. Deleted if the function returns without leaving.
CSIPHeaderBase * aNewSIPHeader the header that replaces the old header. The ownership is transferred.

ReplaceHeadersL(RPointerArray< CSIPHeaderBase > &)

IMPORT_C void ReplaceHeadersL ( 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 > & aNewHeaders the headers that will replace the old headers. The ownership of the headers is transferred and the array is resetted on return.

SIPVersion()

IMPORT_C RStringF SIPVersion ( ) const

Gets the SIP version

SetContent(HBufC8 *)

IMPORT_C void SetContent ( HBufC8 * aContent )

Set the content

Parameters

HBufC8 * aContent

SetSIPVersionL(const TDesC8 &)

void SetSIPVersionL ( 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]