00001 /* 00002 * ============================================================================== 00003 * Name : sipmessageelements.h 00004 * Part of : SIP Client 00005 * Interface : SDK API, SIP API 00006 * Description : 00007 * Version : 1.0 00008 * 00009 * Copyright (c) 2005 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 CSIPMESSAGEELEMENTS_H 00022 #define CSIPMESSAGEELEMENTS_H 00023 00024 // INCLUDES 00025 #include <e32base.h> 00026 #include <s32strm.h> 00027 #include <stringpool.h> 00028 #include "_sipcodecdefs.h" 00029 00030 // FORWARD DECLARATIONS 00031 class CSIPHeaderBase; 00032 class CSIPContentTypeHeader; 00033 class CSIPFromHeader; 00034 class CSIPToHeader; 00035 class CSIPCSeqHeader; 00036 class CSIPExtensionHeader; 00037 00038 // CLASS DECLARATION 00039 00058 class CSIPMessageElements : public CBase 00059 { 00060 public: // Constructors and destructor 00064 IMPORT_C static CSIPMessageElements* NewL(); 00065 00069 IMPORT_C static CSIPMessageElements* NewLC(); 00070 00074 IMPORT_C ~CSIPMessageElements(); 00075 00076 public: //new functions 00085 IMPORT_C void SetUserHeadersL(RPointerArray<CSIPHeaderBase>& aHeaders); 00086 00091 IMPORT_C const RPointerArray<CSIPHeaderBase>& UserHeaders() const; 00092 00105 IMPORT_C void SetContentL(HBufC8* aContent, 00106 CSIPContentTypeHeader* aContentType); 00107 00113 IMPORT_C const TDesC8& Content() const; 00114 00120 IMPORT_C const CSIPContentTypeHeader* ContentType() const; 00121 00122 /* 00123 * Removes the SIP message content and destroys 00124 * Content-Type header as well. 00125 * @return SIP message content; the ownership is transferred. 00126 */ 00127 IMPORT_C HBufC8* ExtractContent(); 00128 00129 public: // New functions, for internal use 00130 00131 static CSIPMessageElements* InternalizeL(RReadStream& aReadStream); 00132 void ExternalizeL(RWriteStream& aWriteStream) const; 00133 TInt UserHeaderCount(RStringF aName) const; 00134 const RPointerArray<CSIPHeaderBase> UserHeadersL(RStringF aName) const; 00135 TInt RemoveHeaders(RStringF aName); 00136 void DetachUserHeader(CSIPHeaderBase* aHeader); 00137 void AddHeaderL(CSIPHeaderBase* aHeader); 00138 void SetToL(CSIPToHeader* aTo); 00139 const CSIPToHeader* To() const; 00140 void SetFromL (CSIPFromHeader* aFrom); 00141 const CSIPFromHeader* From() const; 00142 const CSIPCSeqHeader* CSeq() const; 00143 void SetContent(HBufC8* aContent); 00144 void DetachContent(); 00145 00146 private: 00147 00148 CSIPMessageElements(); 00149 void ConstructL(); 00150 void DoInternalizeL(RReadStream& aReadStream); 00151 void CheckUserHeaderL(const CSIPHeaderBase* aHeader) const; 00152 void ExternalizeUserHeadersL(RWriteStream& aWriteStream) const; 00153 void ExternalizeL(const CSIPExtensionHeader* aHeader, 00154 RWriteStream& aWriteStream) const; 00155 00156 private: // Data 00157 00158 RPointerArray<CSIPHeaderBase> iUserHeaders; 00159 HBufC8* iContent; 00160 CSIPFromHeader* iFromHeader; 00161 CSIPToHeader* iToHeader; 00162 CSIPCSeqHeader* iCSeqHeader; 00163 CSIPContentTypeHeader* iContentTypeHeader; 00164 TBool iHeaderLookupOpen; 00165 00166 private: // For testing purposes 00167 00168 UNIT_TEST(CSIPMessageElementsTest) 00169 }; 00170 00171 #endif