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 : sipcseqheader.h
17 * Interface : SDK API, SIP Codec API
25 #ifndef CSIPCSEQHEADER_H
26 #define CSIPCSEQHEADER_H
29 #include "sipheaderbase.h"
36 * Class provides functions for setting and getting sequence number and
37 * method in SIP "CSeq" header.
41 class CSIPCSeqHeader : public CSIPHeaderBase
43 public: // Constructors and destructor
46 * Constructs a CSIPCSeqHeader from textual representation
47 * of the header's value part.
48 * @param aValue a value part of a "CSeq"-header (e.g. "1 REGISTER")
49 * @return a new instance of CSIPCSeqHeader.
51 IMPORT_C static CSIPCSeqHeader* DecodeL(const TDesC8& aValue);
54 * Creates a new instance of CSIPCSeqHeader
55 * @param aSeq a sequence number to set.
56 * @param aMethod a method to set. For example "REGISTER"
57 * @return a new instance of CSIPCSeqHeader
59 IMPORT_C static CSIPCSeqHeader* NewL(TUint aSeq, RStringF aMethod);
62 * Creates a new instance of CSIPCSeqHeader and puts it to CleanupStack
63 * @param aSeq a sequence number to set.
64 * @param aMethod a method to set. For example "REGISTER"
65 * @return a new instance of CSIPCSeqHeader
67 IMPORT_C static CSIPCSeqHeader* NewLC(TUint aSeq, RStringF aMethod);
70 * Destructor, deletes the resources of CSIPCSeqHeader.
72 IMPORT_C ~CSIPCSeqHeader();
75 public: // New functions
78 * Gets the sequence number from the "CSeq" header
79 * @return the current sequence number
81 IMPORT_C TUint Seq() const;
84 * Sets the sequence number in the "CSeq" header
85 * @param aSeq a sequence number to set
87 IMPORT_C void SetSeq(TUint aSeq);
90 * Gets the method from the "CSeq" header
93 IMPORT_C RStringF Method() const;
96 * Sets the method in the "CSeq" header
97 * @param aMethod a method to set
99 IMPORT_C void SetMethodL(RStringF aMethod);
102 * Constructs an instance of a CSIPCSeqHeader from a RReadStream
103 * @param aReadStream a stream containing the value of the
104 * externalized object (header name not included).
105 * @return an instance of a CSIPCSeqHeader
107 IMPORT_C static CSIPHeaderBase*
108 InternalizeValueL(RReadStream& aReadStream);
111 public: // From CSIPHeaderBase
114 * From CSIPHeaderBase CloneL
116 IMPORT_C CSIPHeaderBase* CloneL() const;
119 * From CSIPHeaderBase Name
121 IMPORT_C RStringF Name() const;
124 * From CSIPHeaderBase ToTextValueL
126 IMPORT_C HBufC8* ToTextValueL() const;
129 public: // From CSIPHeaderBase, for internal use
134 TPreferredPlace PreferredPlaceInMessage () const;
136 public: // New functions, for internal use
138 static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
140 private: // From CSIPHeaderBase
142 void ExternalizeValueL (RWriteStream& aWriteStream) const;
144 private: // Constructors
147 void ConstructL(TUint aCSeq, RStringF aMethod);
149 private: // New functions
151 void DoInternalizeValueL(RReadStream& aReadStream);
152 void ParseL(const TDesC8& aValue);
153 void SetMethodL(const TDesC8& aMethod);
160 private: // For testing purposes
162 friend class CSIPCSeqHeaderTest;
166 #endif // CSIPCSEQHEADER_H