00001 /* 00002 * ============================================================================= 00003 * Name : SdpMediaField.h 00004 * Part of : SDP Codec 00005 * Interface : SDK API, SDP Codec API 00006 * Description : 00007 * Version : 1.0 00008 * 00009 * Copyright (c) 2003 Nokia Corporation. 00010 * This material, including documentation and any related 00011 * computer programs, is protected by copyright controlled by 00012 * Nokia Corporation. All rights are reserved. Copying, 00013 * including reproducing, storing, adapting or translating, any 00014 * or all of this material requires the prior written consent of 00015 * Nokia Corporation. This material also contains confidential 00016 * information which may not be disclosed to others without the 00017 * prior written consent of Nokia Corporation. 00018 * ============================================================================= 00019 */ 00020 00021 #ifndef CSDPMEDIAFIELD_H 00022 #define CSDPMEDIAFIELD_H 00023 00024 // INCLUDES 00025 #include <e32base.h> 00026 #include "_sdpdefs.h" 00027 #include <stringpool.h> 00028 00029 // FORWARD DECLARATIONS 00030 class RReadStream; 00031 class RWriteStream; 00032 class CSdpConnectionField; 00033 class CSdpBandwidthField; 00034 class CSdpAttributeField; 00035 class CSdpKeyField; 00036 class CSdpFmtAttributeField; 00037 class CSdpCodecParseUtil; 00038 00039 // CLASS DECLARATION 00054 class CSdpMediaField : public CBase 00055 { 00056 00057 public: 00058 00059 00060 public: // Constructors and destructor 00071 IMPORT_C static CSdpMediaField* DecodeL(const TDesC8& aText, 00072 TBool aRecurse = ETrue); 00073 00085 IMPORT_C static CSdpMediaField* DecodeLC(const TDesC8& aText, 00086 TBool aRecurse = ETrue); 00087 00098 IMPORT_C static CSdpMediaField* NewL(RStringF aMedia, 00099 TUint aPort, 00100 RStringF aProtocol, 00101 const TDesC8& aFormatList); 00102 00114 IMPORT_C static CSdpMediaField* NewLC(RStringF aMedia, 00115 TUint aPort, 00116 RStringF aProtocol, 00117 const TDesC8& aFormatList); 00118 00122 IMPORT_C ~CSdpMediaField(); 00123 00124 public: // New functions 00136 IMPORT_C void 00137 EncodeL(RWriteStream& aStream, TBool aRecurse = ETrue) const; 00138 00147 IMPORT_C CSdpMediaField * CloneL(TBool aRecurse = ETrue) const; 00148 00156 IMPORT_C TBool operator == (const CSdpMediaField& aObj) const; 00157 00166 IMPORT_C TBool IsValid() const; 00167 00173 IMPORT_C RStringF Media() const; 00174 00181 IMPORT_C void SetMediaL(RStringF aMedia); 00182 00188 IMPORT_C RStringF Protocol() const; 00189 00198 IMPORT_C void SetProtocolL(RStringF aProtocol); 00199 00205 IMPORT_C TUint Port() const; 00206 00214 IMPORT_C void SetPortL(TUint aPort); 00215 00221 IMPORT_C TUint PortCount() const; 00222 00229 IMPORT_C void SetPortCountL(TUint aCount); 00230 00236 IMPORT_C const TDesC8& FormatList() const; 00237 00246 IMPORT_C void SetFormatListL(const TDesC8& aValue); 00247 00253 IMPORT_C const TDesC8& Info() const; 00254 00262 IMPORT_C void SetInfoL(const TDesC8& aValue); 00263 00271 IMPORT_C CSdpKeyField* Key(); 00272 00278 IMPORT_C const CSdpKeyField* Key() const; 00279 00287 IMPORT_C void SetKey(CSdpKeyField* aObj); 00288 00301 IMPORT_C RPointerArray<CSdpFmtAttributeField>& FormatAttributeFields(); 00302 00315 IMPORT_C RPointerArray<CSdpAttributeField>& AttributeFields(); 00316 00329 IMPORT_C RPointerArray<CSdpBandwidthField>& BandwidthFields(); 00330 00343 IMPORT_C RPointerArray<CSdpConnectionField>& ConnectionFields(); 00344 00353 IMPORT_C void RemoveFormatL(const TDesC8& aFormat); 00354 00367 IMPORT_C void KeepFormatL(const TDesC8& aFormat); 00368 00376 IMPORT_C void RejectMedia(); 00377 00378 public: 00384 TBool IsContactPresent() const; 00385 00391 void ExternalizeL(RWriteStream& aStream) const; 00392 00399 static CSdpMediaField* InternalizeL(RReadStream& aStream); 00400 00401 private: 00402 CSdpMediaField(); 00403 void ConstructL(); 00404 void ConstructL(TBool aRecurse); 00405 void ConstructL(RStringF aMedia, TUint aPort, RStringF aProtocol, 00406 const TDesC8& aFormatList); 00407 00408 void ConstructL(const CSdpMediaField& aSdpMediaField); 00409 void DoInternalizeL(RReadStream& aStream); 00410 void ParseL (const TDesC8& aText); 00411 void ParseMediaL(); 00412 void ParseInformationL(); 00413 void ParseConnectionL(); 00414 void ParseBandwithL(); 00415 void ParseEncryptionKeyL(); 00416 void ParseAttributeFieldL(); 00417 TDesC8& GetTokenFromStreamL(RReadStream& aStream); 00418 00419 00420 CSdpMediaField(const CSdpMediaField&); // Hidden. 00421 CSdpMediaField& operator = (const CSdpMediaField&); // Hidden 00422 00423 private: // Data 00424 HBufC8* iInfo; 00425 CSdpKeyField* iSdpKeyField; 00426 RArray<TPtrC8> iElementArray; 00427 RStringPool iPool; 00428 TBool iRecurse; 00429 RStringF iMedia; 00430 RStringF iProtocol; 00431 TUint iPort; 00432 TUint iPortCount; 00433 HBufC8* iFormatList; 00434 RPointerArray<CSdpBandwidthField>* iBandwidthFields; 00435 RPointerArray<CSdpAttributeField>* iAttributeFields; 00436 RPointerArray<CSdpConnectionField>* iConnectionFields; 00437 RPointerArray<CSdpFmtAttributeField>* iFmtAttrFields; 00438 HBufC8* iToken; 00439 CSdpCodecParseUtil* iSdpCodecParseUtil; 00440 }; 00441 00442 // CSDPMEDIAFIELD_H 00443 #endif