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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Name : sipcseqheader.h
17 * Interface : SDK API, SIP Codec API
25 #ifndef CSIPCSEQHEADER_H
26 #define CSIPCSEQHEADER_H
29 #include "sipheaderbase.h"
30 #include "_sipcodecdefs.h"
37 * Class provides functions for setting and getting sequence number and
38 * method in SIP "CSeq" header.
42 class CSIPCSeqHeader : public CSIPHeaderBase
44 public: // Constructors and destructor
47 * Constructs a CSIPCSeqHeader from textual representation
48 * of the header's value part.
49 * @param aValue a value part of a "CSeq"-header (e.g. "1 REGISTER")
50 * @return a new instance of CSIPCSeqHeader.
52 IMPORT_C static CSIPCSeqHeader* DecodeL(const TDesC8& aValue);
55 * Creates a new instance of CSIPCSeqHeader
56 * @param aSeq a sequence number to set.
57 * @param aMethod a method to set. For example "REGISTER"
58 * @return a new instance of CSIPCSeqHeader
60 IMPORT_C static CSIPCSeqHeader* NewL(TUint aSeq, RStringF aMethod);
63 * Creates a new instance of CSIPCSeqHeader and puts it to CleanupStack
64 * @param aSeq a sequence number to set.
65 * @param aMethod a method to set. For example "REGISTER"
66 * @return a new instance of CSIPCSeqHeader
68 IMPORT_C static CSIPCSeqHeader* NewLC(TUint aSeq, RStringF aMethod);
71 * Destructor, deletes the resources of CSIPCSeqHeader.
73 IMPORT_C ~CSIPCSeqHeader();
76 public: // New functions
79 * Gets the sequence number from the "CSeq" header
80 * @return the current sequence number
82 IMPORT_C TUint Seq() const;
85 * Sets the sequence number in the "CSeq" header
86 * @param aSeq a sequence number to set
88 IMPORT_C void SetSeq(TUint aSeq);
91 * Gets the method from the "CSeq" header
94 IMPORT_C RStringF Method() const;
97 * Sets the method in the "CSeq" header
98 * @param aMethod a method to set
100 IMPORT_C void SetMethodL(RStringF aMethod);
103 * Constructs an instance of a CSIPCSeqHeader from a RReadStream
104 * @param aReadStream a stream containing the value of the
105 * externalized object (header name not included).
106 * @return an instance of a CSIPCSeqHeader
108 IMPORT_C static CSIPHeaderBase*
109 InternalizeValueL(RReadStream& aReadStream);
112 public: // From CSIPHeaderBase
115 * From CSIPHeaderBase CloneL
117 IMPORT_C CSIPHeaderBase* CloneL() const;
120 * From CSIPHeaderBase Name
122 IMPORT_C RStringF Name() const;
125 * From CSIPHeaderBase ToTextValueL
127 IMPORT_C HBufC8* ToTextValueL() const;
130 public: // From CSIPHeaderBase, for internal use
135 TPreferredPlace PreferredPlaceInMessage () const;
137 public: // New functions, for internal use
139 static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
141 private: // From CSIPHeaderBase
143 void ExternalizeValueL (RWriteStream& aWriteStream) const;
145 private: // Constructors
148 void ConstructL(TUint aCSeq, RStringF aMethod);
150 private: // New functions
152 void DoInternalizeValueL(RReadStream& aReadStream);
153 void ParseL(const TDesC8& aValue);
154 void SetMethodL(const TDesC8& aMethod);
161 private: // For testing purposes
163 UNIT_TEST(CSIPCSeqHeaderTest)
166 #endif // CSIPCSEQHEADER_H