1.1 --- a/epoc32/include/sdpattributefield.h Tue Mar 16 16:12:26 2010 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,391 +0,0 @@
1.4 -/*
1.5 -* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 -* All rights reserved.
1.7 -* This component and the accompanying materials are made available
1.8 -* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.9 -* which accompanies this distribution, and is available
1.10 -* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 -*
1.12 -* Initial Contributors:
1.13 -* Nokia Corporation - initial contribution.
1.14 -*
1.15 -* Contributors:
1.16 -*
1.17 -* Description:
1.18 -* Name : SdpAttributeField.h
1.19 -* Part of : SDP Codec
1.20 -* Interface : SDK API, SDP Codec API
1.21 -* Version : 1.0
1.22 -*
1.23 -*/
1.24 -
1.25 -
1.26 -
1.27 -#ifndef CSDPATTRIBUTEFIELD_H
1.28 -#define CSDPATTRIBUTEFIELD_H
1.29 -
1.30 -// INCLUDES
1.31 -#include <e32base.h>
1.32 -#include <stringpool.h>
1.33 -#include "sdpcodecstringconstants.h"
1.34 -#include "_sdpdefs.h"
1.35 -
1.36 -// FORWARD DECLARATIONS
1.37 -class RReadStream;
1.38 -class RWriteStream;
1.39 -class CSdpFmtAttributeField;
1.40 -class CSdpAttributeFieldPtrs;
1.41 -
1.42 -// CLASS DECLARATION
1.43 -/**
1.44 - * @publishedAll
1.45 - * @released
1.46 - *
1.47 - * This class encapsulates the attribute field of Session Description Protocol
1.48 - * for media and session level attributes. Media format/payload type level
1.49 - * attributes are supported by the CSdpFmtAttributeField class.
1.50 - *
1.51 - * The normative reference for correct formatting and values is
1.52 - * draft-ietf-mmusic-sdp-new-14 unless specified otherwise in
1.53 - * member documentation. The implementation supports this normative
1.54 - * reference, but does not enforce it fully.
1.55 - *
1.56 - * @lib sdpcodec.lib
1.57 - */
1.58 -class CSdpAttributeField : public CBase
1.59 - {
1.60 - public: // Constructors and destructor
1.61 -
1.62 - /**
1.63 - * Constructs a new attribute field.
1.64 - *
1.65 - * @param aText A string containing a correctly
1.66 - * formatted field value terminated by a CRLF.
1.67 - * @return a new instance.
1.68 - */
1.69 - IMPORT_C static CSdpAttributeField* DecodeL( const TDesC8& aText );
1.70 -
1.71 - /**
1.72 - * Constructs a new attribute field and adds the pointer to the
1.73 - * cleanup stack.
1.74 - *
1.75 - * @param aTest A string containing a correctly
1.76 - * formatted field value terminated by a CRLF.
1.77 - * @return a new instance.
1.78 - */
1.79 - IMPORT_C static CSdpAttributeField* DecodeLC( const TDesC8& aText );
1.80 -
1.81 - /**
1.82 - * Constructs a new attribute field.
1.83 - *
1.84 - * @param aAttribute The attribute name. It can be a pre-
1.85 - * defined name in the SDP string pool or defined by the
1.86 - * client.
1.87 - * @param aValue A valid attribute value or an empty
1.88 - * descriptor to omit the value part.
1.89 - * @return a new instance.
1.90 - */
1.91 - IMPORT_C static CSdpAttributeField* NewL(
1.92 - RStringF aAttribute, const TDesC8& aValue );
1.93 -
1.94 - /**
1.95 - * Constructs a new attribute field and adds the pointer to the
1.96 - * cleanup stack.
1.97 - *
1.98 - * @param aAttribute The attribute name. It can be a pre-defined
1.99 - * name in the SDP string pool or defined by the client.
1.100 - * @param aValue A valid attribute value or an empty
1.101 - * descriptor to omit the value part.
1.102 - * @return a new instance.
1.103 - */
1.104 - IMPORT_C static CSdpAttributeField* NewLC(
1.105 - RStringF aAttribute, const TDesC8& aValue );
1.106 -
1.107 - /**
1.108 - * Deletes the resources held by the instance.
1.109 - */
1.110 - IMPORT_C ~CSdpAttributeField();
1.111 -
1.112 - public: // New functions
1.113 -
1.114 - /**
1.115 - * Outputs the field formatted according to SDP syntax and including
1.116 - * the terminating CRLF.
1.117 - *
1.118 - * @param aStream Stream used for output. On return the
1.119 - * stream includes correctly formatted attribute field.
1.120 - */
1.121 - IMPORT_C void EncodeL( RWriteStream& aStream ) const;
1.122 -
1.123 - /**
1.124 - * Creates a new instance that is equal to the target.
1.125 - *
1.126 - * @return a new instance.
1.127 - */
1.128 - IMPORT_C CSdpAttributeField* CloneL() const;
1.129 -
1.130 - /**
1.131 - * Compares this instance to another for equality.
1.132 - *
1.133 - * @param aObj: The instance to compare to.
1.134 - * @return ETrue if equal, EFalse if not.
1.135 - */
1.136 - IMPORT_C TBool operator == ( const CSdpAttributeField& aObj ) const;
1.137 -
1.138 - /**
1.139 - * Gets the attribute name.
1.140 - *
1.141 - * @return The attribute name. The name can be pre-defined
1.142 - * name in the SDP string table or defined by the client.
1.143 - */
1.144 - IMPORT_C RStringF Attribute() const;
1.145 -
1.146 - /**
1.147 - * Gets the attribute.
1.148 - *
1.149 - * @return The value or an empty descriptor if there is no value part.
1.150 - */
1.151 - IMPORT_C const TDesC8& Value() const;
1.152 -
1.153 - /**
1.154 - * Sets the attribute and attribute value.
1.155 - *
1.156 - * @param aAttribute A valid attribute name. It can be a
1.157 - * pre-defined name in the SDP string pool or
1.158 - * defined by the client.
1.159 - * @param aValue A valid attribute value or an empty
1.160 - * descriptor to omit the value part.
1.161 - * @leave KErrSdpCodecAttributeField if the attribute part is not
1.162 - * pre-defined EAttributeFmtp or EAttributeRtpmap.
1.163 - */
1.164 - IMPORT_C void SetL( RStringF aAttribute, const TDesC8& aValue );
1.165 -
1.166 - /**
1.167 - * Assigns attribute to the format level attribute.
1.168 - * In the final output the attribute will placed after format level
1.169 - * attribute.
1.170 - *
1.171 - * @param aFmtAttribute A format level
1.172 - * attribute this attribute is assigned to.
1.173 - */
1.174 - IMPORT_C void AssignTo(const CSdpFmtAttributeField& aFmtAttribute);
1.175 -
1.176 - /**
1.177 - * Test if the attribute belongs to the given format level attribute.
1.178 - * Note, that the check can be true for the media level paremeter if
1.179 - * it appears after the last format level attribute.
1.180 - *
1.181 - * @param aFmtAttribute: A format level
1.182 - * attribute this attribute belongs to.
1.183 - * @return ETrue if attribute belongs to the format level attribute,
1.184 - * EFalse otherwise.
1.185 - */
1.186 - IMPORT_C TBool BelongsTo(const CSdpFmtAttributeField& aFmtAttribute) const;
1.187 -
1.188 - public: // Internal to codec
1.189 -
1.190 - /**
1.191 - * Externalizes the object to stream
1.192 - *
1.193 - * @param aStream Stream where the object's state will be stored
1.194 - */
1.195 - void ExternalizeL( RWriteStream& aStream ) const;
1.196 -
1.197 - /**
1.198 - * Creates object from the stream data
1.199 - *
1.200 - * @param aStream Stream where the object's state will be read
1.201 - * @return Initialized object
1.202 - */
1.203 - static CSdpAttributeField* InternalizeL( RReadStream& aStream );
1.204 -
1.205 - /**
1.206 - * Informs if the attribute belongs to any format level attribute.
1.207 - *
1.208 - * @return ETrue if attribute belongs to any format level
1.209 - * attribute, EFalse otherwise.
1.210 - */
1.211 - TBool IsFmtAttribute();
1.212 -
1.213 - private: // Constructors
1.214 -
1.215 - /**
1.216 - * Constructor
1.217 - */
1.218 - CSdpAttributeField();
1.219 -
1.220 - /**
1.221 - * Second phase constructor
1.222 - *
1.223 - * @param aText Text string ending to LF character
1.224 - */
1.225 - void ConstructL( const TDesC8& aText );
1.226 -
1.227 - /**
1.228 - * Second phase constructor
1.229 - *
1.230 - * @param aAttribute Attribute identifier
1.231 - * @param aValue Value of the attribute of KNullDesC8
1.232 - */
1.233 - void ConstructL( RStringF aAttribute, const TDesC8& aValue );
1.234 -
1.235 - private: // Internal
1.236 -
1.237 - /**
1.238 - * Verifies that attribute is valid property attribute and initializes
1.239 - * the member variables of class accordingly
1.240 - *
1.241 - * @param aAttribute Attribute in descriptor
1.242 - */
1.243 - void FormatProperyAttributeL( const TDesC8& aAttribute );
1.244 -
1.245 - /**
1.246 - * Verifies that attribute is valid value attribute and initializes
1.247 - * the member variables of class accordingly
1.248 - *
1.249 - * @param aArray Array of the attributes
1.250 - */
1.251 - void FormatValueAttributeL( const TDesC8& aAttribute,
1.252 - const TDesC8& aValue );
1.253 -
1.254 - /**
1.255 - * Verifies that the value is valid for the attribute
1.256 - *
1.257 - * @param aAttribute The attribute
1.258 - * @param aArray Array containing the values (and attribute)
1.259 - */
1.260 - void VerifyValueAttributeL( SdpCodecStringConstants::TStrings aString,
1.261 - const TDesC8& aValue );
1.262 -
1.263 - /**
1.264 - * Forms attribute and value strings out of the token array
1.265 - * and pushes both (aAttribute & aValue) into cleanup stack
1.266 - *
1.267 - * @param aArray Token array
1.268 - * @param aAttribute Attribute string (in cleanup stack)
1.269 - * @param aValue Value string (in cleanup stack)
1.270 - */
1.271 - void CreateAttributeAndValueStringsLC( RArray<TPtrC8>& aArray,
1.272 - HBufC8*& aAttribute,
1.273 - HBufC8*& aValue );
1.274 -
1.275 - /**
1.276 - * Checks if the value is among the valid orient attributes
1.277 - *
1.278 - * @param aValue Value string
1.279 - */
1.280 - void CheckValidOrientL( const TDesC8& aValue );
1.281 -
1.282 - /**
1.283 - * Checks if the value is valid language attribute as
1.284 - * specified in RFC 3066
1.285 - *
1.286 - * @param aValue Value string
1.287 - */
1.288 - void CheckValidLangStrL( const TDesC8& aValue );
1.289 -
1.290 - /**
1.291 - * Checks if the value is valid framerate attribute
1.292 - *
1.293 - * @param aValue Value string
1.294 - */
1.295 - void CheckValidFrameRateL( const TDesC8& aValue );
1.296 -
1.297 - /**
1.298 - * Checks if the value is among valid uri value for control attribute
1.299 - *
1.300 - * @param aValue Value string
1.301 - */
1.302 - void CheckValidControlL( const TDesC8& aValue );
1.303 -
1.304 - /**
1.305 - * Checks if the value is valid value for group attribute as
1.306 - * specified in RFC 3388
1.307 - *
1.308 - * @param aValue Value string
1.309 - */
1.310 - void CheckValidGroupL( const TDesC8& aValue );
1.311 -
1.312 - /**
1.313 - * Checks if the value is valid value for des attribute as
1.314 - * specified in RFC 3312
1.315 - *
1.316 - * @param aValue Value string
1.317 - */
1.318 - void CheckValidDesL( const TDesC8& aValue );
1.319 -
1.320 - /**
1.321 - * Checks if the value is valid value for curr and conf attribute as
1.322 - * specified in RFC 3312
1.323 - *
1.324 - * @param aValue Value string
1.325 - */
1.326 - void CheckValidCurrAndConfL( const TDesC8& aValue );
1.327 -
1.328 - /**
1.329 - * Checks if value is included in the list of predefined values
1.330 - *
1.331 - * @param aItemsCount Predefined values count
1.332 - * @param aValuesList List of predefined values
1.333 - * @param aValue Value string
1.334 - */
1.335 - void ValidValueInListL( TInt aItemsCount,
1.336 - const TText8* const aValuesList[],
1.337 - const TDesC8& aValue );
1.338 -
1.339 - /**
1.340 - * Checks if the value is valid value for range attribute as
1.341 - * specified in RFC 2326
1.342 - *
1.343 - * @param aValue Value string
1.344 - */
1.345 - void CheckValidRangeL( const TDesC8& aValue );
1.346 -
1.347 -
1.348 - /**
1.349 - * Checks if the value is valid rtpmap string
1.350 - *
1.351 - * @param aValue Value string
1.352 - */
1.353 - void CheckValidRtpmapL( const TDesC8& aValue );
1.354 -
1.355 - /**
1.356 - * Checks if the value is valid fmtp string
1.357 - *
1.358 - * @param aValue Value string
1.359 - */
1.360 - void CheckValidFmtpL( const TDesC8& aValue );
1.361 -
1.362 - /**
1.363 - * Set attribute and values. Attribute is not one of predefined ones.
1.364 - *
1.365 - * @param aAttribute Attribute string (in cleanup stack)
1.366 - * @param aValue Value string
1.367 - */
1.368 - void SetNotPredefinedAttributeL( const TDesC8& aAttribute,
1.369 - const TDesC8& aValue );
1.370 -
1.371 - void CreateAttributeFieldPtrsL();
1.372 -
1.373 - inline CSdpAttributeFieldPtrs& AttributeFieldPtrs();
1.374 -
1.375 - inline const CSdpAttributeFieldPtrs& AttributeFieldPtrs() const;
1.376 -
1.377 - __DECLARE_TEST;
1.378 -
1.379 - private: // Data
1.380 -
1.381 - // String pool
1.382 - RStringPool iPool;
1.383 -
1.384 - // Attribute name
1.385 - RStringF iAttribute;
1.386 -
1.387 - // Flag indicating if the attribute is a property attribute
1.388 - TBool iPropertyAttribute;
1.389 -
1.390 - // Value field
1.391 - HBufC8* iValue;
1.392 - };
1.393 -
1.394 -#endif // CSDPATTRIBUTEFIELD_H