2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Name : sipextensionheader.h
17 * Interface : SDK API, SIP Codec API
25 #ifndef CSIPEXTENSIONHEADER_H
26 #define CSIPEXTENSIONHEADER_H
29 #include "sipheaderbase.h"
37 * The class stores unknown and extension headers that are either not
38 * supported by the current SIP codec implementation or not specified in
39 * current SIP RFC or both.
43 class CSIPExtensionHeader : public CSIPHeaderBase
45 public: // Constructors and destructor
48 * Creates a new instance of CSIPExtensionHeader
49 * @param aName the full or compact name of the header
50 * @param aValue the value of the header
51 * @return a new instance of CSIPExtensionHeader
53 IMPORT_C static CSIPExtensionHeader*
54 NewL(const TDesC8& aName, const TDesC8& aValue);
57 * Creates a new instance of CSIPExtensionHeader
58 * and puts it to CleanupStack
59 * @param aName the full or compact name of the header
60 * @param aValue the value of the header
61 * @return a new instance of CSIPExtensionHeader
63 IMPORT_C static CSIPExtensionHeader*
64 NewLC(const TDesC8& aName, const TDesC8& aValue);
67 * Destructor, deletes the resources of CSIPExtensionHeader.
69 IMPORT_C ~CSIPExtensionHeader();
72 public: // New functions
75 * Sets the header value
76 * @param aValue the header value to be set
78 IMPORT_C void SetValueL(const TDesC8& aValue);
81 * Gets the header value
82 * @return the header value
84 IMPORT_C const TDesC8& Value() const;
87 * Constructs an instance of a CSIPExtensionHeader from a RReadStream
88 * @param aReadStream a stream containing the value of the
89 * externalized header object (header name not included).
90 * @return an instance of a CSIPExtensionHeader
93 IMPORT_C static CSIPExtensionHeader*
94 InternalizeValueL(RReadStream& aReadStream);
97 public: // From CSIPHeaderBase
100 * From CSIPHeaderBase CloneL
102 IMPORT_C CSIPHeaderBase* CloneL() const;
105 * From CSIPHeaderBase Name
107 IMPORT_C RStringF Name() const;
110 * From CSIPHeaderBase ToTextValueL
112 IMPORT_C HBufC8* ToTextValueL() const;
115 * From CSIPHeaderBase ExternalizeSupported
117 IMPORT_C TBool ExternalizeSupported() const;
120 public: // New functions, for internal use
122 void SetNameL(const TDesC8& aName);
124 public: // From CSIPHeaderBase, for internal use
129 TBool IsExtensionHeader() const;
134 TBool EncodeMultipleToOneLine() const;
139 TBool MoreThanOneAllowed() const;
144 TBool HasCompactName() const;
149 RStringF CompactName() const;
154 TPreferredPlace PreferredPlaceInMessage() const;
156 private: // From CSIPHeaderBase
158 void ExternalizeValueL(RWriteStream& aWriteStream) const;
160 private: // Constructors
162 CSIPExtensionHeader();
163 void ConstructL(const TDesC8& aName, const TDesC8& aValue);
164 void ConstructL(const CSIPExtensionHeader& aExtensionHeader);
165 void DoInternalizeValueL(RReadStream& aReadStream);
167 private: // New functions
169 TBool CheckValue (const TDesC8& aValue);
177 private: // For testing purposes
179 friend class CSIPExtensionHeaderTest;
180 friend class CSIPHeaderLookupTest;
184 #endif // CSIPEXTENSIONHEADER_H