CSdpMediaField Class Reference

class CSdpMediaField : public CBase

This class encapsulates the media description field and related media specific subfields of the Session Description Protocol.

The normative reference for correct formatting and values is draft-ietf-mmusic-sdp-new-14 unless specified otherwise in member documentation. The implementation supports this normative reference, but does not enforce it fully.

sdpcodec.lib

Inherits from

Public Member Functions
~CSdpMediaField ()
IMPORT_C RPointerArray < CSdpAttributeField > & AttributeFields ()
IMPORT_C RPointerArray < CSdpBandwidthField > & BandwidthFields ()
IMPORT_C CSdpMediaField * CloneL ( TBool )
IMPORT_C RPointerArray < CSdpConnectionField > & ConnectionFields ()
IMPORT_C CSdpMediaField * DecodeL (const TDesC8 &, TBool )
IMPORT_C CSdpMediaField * DecodeLC (const TDesC8 &, TBool )
IMPORT_C void EncodeL ( RWriteStream &, TBool )
void ExternalizeL ( RWriteStream &)
IMPORT_C RPointerArray < CSdpFmtAttributeField > & FormatAttributeFields ()
IMPORT_C const TDesC8 & FormatList ()
IMPORT_C const TDesC8 & Info ()
CSdpMediaField * InternalizeL ( RReadStream &)
TBool IsContactPresent ()
IMPORT_C TBool IsValid ()
IMPORT_C void KeepFormatL (const TDesC8 &)
IMPORT_C CSdpKeyField * Key ()
IMPORT_C const CSdpKeyField * Key ()
IMPORT_C RStringF Media ()
IMPORT_C CSdpMediaField * NewL ( RStringF , TUint , RStringF , const TDesC8 &)
IMPORT_C CSdpMediaField * NewLC ( RStringF , TUint , RStringF , const TDesC8 &)
IMPORT_C TUint Port ()
IMPORT_C TUint PortCount ()
IMPORT_C RStringF Protocol ()
IMPORT_C void RejectMedia ()
IMPORT_C void RemoveFormatL (const TDesC8 &)
IMPORT_C void SetFormatListL (const TDesC8 &)
IMPORT_C void SetInfoL (const TDesC8 &)
IMPORT_C void SetKey ( CSdpKeyField *)
IMPORT_C void SetMediaL ( RStringF )
IMPORT_C void SetPortCountL ( TUint )
IMPORT_C void SetPortL ( TUint )
IMPORT_C void SetProtocolL ( RStringF )
IMPORT_C TBool operator== (const CSdpMediaField &)
Private Member Functions
CSdpMediaField ()
CSdpMediaField (const CSdpMediaField &)
void ConstructL ()
void ConstructL ( TBool )
void ConstructL ( RStringF , TUint , RStringF , const TDesC8 &)
void ConstructL (const CSdpMediaField &)
void DoInternalizeL ( RReadStream &)
TDesC8 & GetTokenFromStreamL ( RReadStream &)
void ParseAttributeFieldsL ()
void ParseBandwithL ()
void ParseConnectionL ()
void ParseEncryptionKeyL ()
void ParseInformationL ()
void ParseL (const TDesC8 &)
void ParseMediaL ()
CSdpMediaField & operator= (const CSdpMediaField &)
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
RPointerArray < CSdpAttributeField > * iAttributeFields
RPointerArray < CSdpBandwidthField > * iBandwidthFields
RPointerArray < CSdpConnectionField > * iConnectionFields
RArray < TPtrC8 > iElementArray
RPointerArray < CSdpFmtAttributeField > * iFmtAttrFields
HBufC8 * iFormatList
HBufC8 * iInfo
RStringF iMedia
RStringPool iPool
TUint iPort
TUint iPortCount
RStringF iProtocol
TBool iRecurse
CSdpCodecParseUtil * iSdpCodecParseUtil
CSdpKeyField * iSdpKeyField
HBufC8 * iToken

Constructor & Destructor Documentation

CSdpMediaField()

CSdpMediaField ( ) [private]

CSdpMediaField(const CSdpMediaField &)

CSdpMediaField ( const CSdpMediaField & ) [private]

Parameters

const CSdpMediaField &

~CSdpMediaField()

IMPORT_C ~CSdpMediaField ( )

Deletes the resources held by the instance.

Member Functions Documentation

AttributeFields()

IMPORT_C RPointerArray < CSdpAttributeField > & AttributeFields ( )

Gets the set of media level, format independent attributes. This array is used directly for element insertion and removal.

The objects referenced from the array are owned by the media field instance and must not be deleted. An object can be removed from the media description by setting the corresponding element to zero. By doing so, the calling party receives ownership of the removed object.

BandwidthFields()

IMPORT_C RPointerArray < CSdpBandwidthField > & BandwidthFields ( )

Gets the set of media level bandwidth fields. This array is used directly for element insertion and removal.

The objects referenced from the array are owned by the media field instance and must not be deleted. An object can be removed from the media description by setting the corresponding element to zero. By doing so, the calling party receives ownership of the removed object.

CloneL(TBool)

IMPORT_C CSdpMediaField * CloneL ( TBool aRecurse = ETrue ) const

Creates a new instance that is equal to the target. Optionally also related subfields are cloned.

Parameters

TBool aRecurse = ETrue Flag to specify whether to clone subfields also (ETrue) or only the media field (EFalse).

ConnectionFields()

IMPORT_C RPointerArray < CSdpConnectionField > & ConnectionFields ( )

Gets the set of media level connection fields. This array is used directly for element insertion and removal.

The objects referenced from the array are owned by the media field instance and must not be deleted. An object can be removed from the media description by setting the corresponding element to zero. By doing so, the calling party receives ownership of the removed object.

ConstructL()

void ConstructL ( ) [private]

ConstructL(TBool)

void ConstructL ( TBool aRecurse ) [private]

Parameters

TBool aRecurse

ConstructL(RStringF, TUint, RStringF, const TDesC8 &)

void ConstructL ( RStringF aMedia,
TUint aPort,
RStringF aProtocol,
const TDesC8 & aFormatList
) [private]

Parameters

RStringF aMedia
TUint aPort
RStringF aProtocol
const TDesC8 & aFormatList

ConstructL(const CSdpMediaField &)

void ConstructL ( const CSdpMediaField & aSdpMediaField ) [private]

Parameters

const CSdpMediaField & aSdpMediaField

DecodeL(const TDesC8 &, TBool)

IMPORT_C CSdpMediaField * DecodeL ( const TDesC8 & aText,
TBool aRecurse = ETrue
) [static]

Constructs a new media description field.

Parameters

const TDesC8 & aText A correctly formatted media field terminated by a CRLF followed by zero or more media attribute fields separated by a CRLF.
TBool aRecurse = ETrue If ETrue, attempts to construct also media attributes following the CRLF terminating the media field.

DecodeLC(const TDesC8 &, TBool)

IMPORT_C CSdpMediaField * DecodeLC ( const TDesC8 & aText,
TBool aRecurse = ETrue
) [static]

Constructs a new media description field and adds the pointer to the cleanup stack.

Parameters

const TDesC8 & aText A correctly formatted media field terminated by a CRLF followed by zero or more media attribute fields separated by a CRLF.
TBool aRecurse = ETrue If ETrue, attempts to construct also media attributes following the CRLF terminating the media field.

DoInternalizeL(RReadStream &)

void DoInternalizeL ( RReadStream & aStream ) [private]

Parameters

RReadStream & aStream

EncodeL(RWriteStream &, TBool)

IMPORT_C void EncodeL ( RWriteStream & aStream,
TBool aRecurse = ETrue
) const

Outputs the field formatted according to SDP syntax and including the terminating CRLF. Optionally output also the related media level fields.

Parameters

RWriteStream & aStream Stream used for output. On return the stream includes correctly formatted media field with media part fields if aRecurse is defined to ETrue.
TBool aRecurse = ETrue Flag to specify whether to output media attributes also (ETrue) or only the media field (EFalse).

ExternalizeL(RWriteStream &)

void ExternalizeL ( RWriteStream & aStream ) const

Externalizes the object to stream

Parameters

RWriteStream & aStream Stream where the object's state will be stored

FormatAttributeFields()

IMPORT_C RPointerArray < CSdpFmtAttributeField > & FormatAttributeFields ( )

Gets the set of media format level attributes. This array is used directly for element insertion and removal.

The objects referenced from the array are owned by the media field instance and must not be deleted. An object can be removed from the media description by setting the corresponding element to zero. By doing so, the calling party receives ownership of the removed object.

FormatList()

IMPORT_C const TDesC8 & FormatList ( ) const

Gets the format list.

GetTokenFromStreamL(RReadStream &)

TDesC8 & GetTokenFromStreamL ( RReadStream & aStream ) [private]

Parameters

RReadStream & aStream

Info()

IMPORT_C const TDesC8 & Info ( ) const

Return the media level info field value.

InternalizeL(RReadStream &)

CSdpMediaField * InternalizeL ( RReadStream & aStream ) [static]

Creates object from the stream data

Parameters

RReadStream & aStream Stream where the object's state will be read

IsContactPresent()

TBool IsContactPresent ( ) const

Shows if contact is present

IsValid()

IMPORT_C TBool IsValid ( ) const

Checks the consistency between the media field and it's subfields. In particular, this function checks that each format specific attribute is related to a format in the format list of the media field.

KeepFormatL(const TDesC8 &)

IMPORT_C void KeepFormatL ( const TDesC8 & aFormat )

Removes all formats except one from the media description. The function will set the format list to only contain the one format to keep and then delete all format level attributes that are related to the removed formats. If the format is not found from the format list, it is added there. If there are no format level attributes for the specified format, the format level attribute set will be empty.

Parameters

const TDesC8 & aFormat The name of the format to keep after removing all others.

Key()

IMPORT_C CSdpKeyField * Key ( )

Gets the media level encryption key field. Note, that the ownership is not transferred and the instance must not be deleted by the caller.

Key()

IMPORT_C const CSdpKeyField * Key ( ) const

Gets the media level encryption key field.

Media()

IMPORT_C RStringF Media ( ) const

Gets the media type.

NewL(RStringF, TUint, RStringF, const TDesC8 &)

IMPORT_C CSdpMediaField * NewL ( RStringF aMedia,
TUint aPort,
RStringF aProtocol,
const TDesC8 & aFormatList
) [static]

Constructs a new media description field. The optional portcount component of the field is initialized to 1.

Parameters

RStringF aMedia A valid media type name.
TUint aPort Port number.
RStringF aProtocol A valid media protocol name.
const TDesC8 & aFormatList A valid format list.

NewLC(RStringF, TUint, RStringF, const TDesC8 &)

IMPORT_C CSdpMediaField * NewLC ( RStringF aMedia,
TUint aPort,
RStringF aProtocol,
const TDesC8 & aFormatList
) [static]

Constructs a new media description field and adds the pointer to the cleanup stack. The optional portcount component of the field is initialized to 1.

Parameters

RStringF aMedia A valid media type name.
TUint aPort Port number.
RStringF aProtocol A valid media protocol name.
const TDesC8 & aFormatList A valid format list.

ParseAttributeFieldsL()

void ParseAttributeFieldsL ( ) [private]

ParseBandwithL()

void ParseBandwithL ( ) [private]

ParseConnectionL()

void ParseConnectionL ( ) [private]

ParseEncryptionKeyL()

void ParseEncryptionKeyL ( ) [private]

ParseInformationL()

void ParseInformationL ( ) [private]

ParseL(const TDesC8 &)

void ParseL ( const TDesC8 & aText ) [private]

Parameters

const TDesC8 & aText

ParseMediaL()

void ParseMediaL ( ) [private]

Port()

IMPORT_C TUint Port ( ) const

Gets the port number.

PortCount()

IMPORT_C TUint PortCount ( ) const

Gets the port count.

Protocol()

IMPORT_C RStringF Protocol ( ) const

Gets the media protocol.

RejectMedia()

IMPORT_C void RejectMedia ( )

Sets this media description into rejected state. The rejected state is defined by the offer/answer model in RFC3264. The function sets the port number to 0 and removes all formats except one. The remaining format is determined by the implementation.

RemoveFormatL(const TDesC8 &)

IMPORT_C void RemoveFormatL ( const TDesC8 & aFormat )

Removes a specific format from the media description. The function will remove the named format from the format list if found and then delete all format level attributes of type CSdpFmtAttributeField related to the removed format.

Parameters

const TDesC8 & aFormat The name of the format to remove.

SetFormatListL(const TDesC8 &)

IMPORT_C void SetFormatListL ( const TDesC8 & aValue )

Sets the format list. The format list should contain one or more format tokens separated by a single whitespace character.

leave
KErrSdpCodecMediaField if aValue contains invalid tokens

Parameters

const TDesC8 & aValue A valid format list.

SetInfoL(const TDesC8 &)

IMPORT_C void SetInfoL ( const TDesC8 & aValue )

Sets the media level info field value.

leave
KErrSdpCodecMediaInfoField if aValue is not KNullDesC8 or aValue includes invalid byte strings ( , , ).

Parameters

const TDesC8 & aValue A valid info field value.

SetKey(CSdpKeyField *)

IMPORT_C void SetKey ( CSdpKeyField * aObj )

Sets or removes the media level encryption key field.

Parameters

CSdpKeyField * aObj The new key field or null if field is to be removed. Ownership of the referenced object is transferred to the media field instance.

SetMediaL(RStringF)

IMPORT_C void SetMediaL ( RStringF aMedia )

Sets the media type.

leave
KErrSdpCodecMediaField if aMedia is not valid character

Parameters

RStringF aMedia The media type.

SetPortCountL(TUint)

IMPORT_C void SetPortCountL ( TUint aCount )

Sets the port count.

leave
KErrSdpCodecMediaField if aCount equals to zero.

Parameters

TUint aCount The port count that must be greater than zero.

SetPortL(TUint)

IMPORT_C void SetPortL ( TUint aPort )

Sets the port number.

leave
KErrSdpCodecMediaField if port is not valid number as defined in draft-ietf-mmusic-sdp-new-14

Parameters

TUint aPort The port number.

SetProtocolL(RStringF)

IMPORT_C void SetProtocolL ( RStringF aProtocol )

Sets the media protocol.

leave
KErrSdpCodecMediaField if aProtocol containing two elements divided by slash are not valid tokens.

Parameters

RStringF aProtocol The media protocol.

operator=(const CSdpMediaField &)

CSdpMediaField & operator= ( const CSdpMediaField & ) [private]

Parameters

const CSdpMediaField &

operator==(const CSdpMediaField &)

IMPORT_C TBool operator== ( const CSdpMediaField & aObj ) const

Compares this instance to another for equality. Subfields are included in the comparison if present.

Parameters

const CSdpMediaField & aObj The instance to compare to.

Member Data Documentation

RPointerArray< CSdpAttributeField > * iAttributeFields

RPointerArray < CSdpAttributeField > * iAttributeFields [private]

RPointerArray< CSdpBandwidthField > * iBandwidthFields

RPointerArray < CSdpBandwidthField > * iBandwidthFields [private]

RPointerArray< CSdpConnectionField > * iConnectionFields

RPointerArray < CSdpConnectionField > * iConnectionFields [private]

RArray< TPtrC8 > iElementArray

RArray < TPtrC8 > iElementArray [private]

RPointerArray< CSdpFmtAttributeField > * iFmtAttrFields

RPointerArray < CSdpFmtAttributeField > * iFmtAttrFields [private]

HBufC8 * iFormatList

HBufC8 * iFormatList [private]

HBufC8 * iInfo

HBufC8 * iInfo [private]

RStringF iMedia

RStringF iMedia [private]

RStringPool iPool

RStringPool iPool [private]

TUint iPort

TUint iPort [private]

TUint iPortCount

TUint iPortCount [private]

RStringF iProtocol

RStringF iProtocol [private]

TBool iRecurse

TBool iRecurse [private]

CSdpCodecParseUtil * iSdpCodecParseUtil

CSdpCodecParseUtil * iSdpCodecParseUtil [private]

CSdpKeyField * iSdpKeyField

CSdpKeyField * iSdpKeyField [private]

HBufC8 * iToken

HBufC8 * iToken [private]