|
1 /* |
|
2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Name : sipcseqheader.h |
|
16 * Part of : SIP Codec |
|
17 * Interface : SDK API, SIP Codec API |
|
18 * Version : SIP/4.0 |
|
19 * |
|
20 */ |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 #ifndef CSIPCSEQHEADER_H |
|
26 #define CSIPCSEQHEADER_H |
|
27 |
|
28 // INCLUDES |
|
29 #include "sipheaderbase.h" |
|
30 |
|
31 // CLASS DECLARATION |
|
32 /** |
|
33 * @publishedAll |
|
34 * @released |
|
35 * |
|
36 * Class provides functions for setting and getting sequence number and |
|
37 * method in SIP "CSeq" header. |
|
38 * |
|
39 * @lib sipcodec.lib |
|
40 */ |
|
41 class CSIPCSeqHeader : public CSIPHeaderBase |
|
42 { |
|
43 public: // Constructors and destructor |
|
44 |
|
45 /** |
|
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. |
|
50 */ |
|
51 IMPORT_C static CSIPCSeqHeader* DecodeL(const TDesC8& aValue); |
|
52 |
|
53 /** |
|
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 |
|
58 */ |
|
59 IMPORT_C static CSIPCSeqHeader* NewL(TUint aSeq, RStringF aMethod); |
|
60 |
|
61 /** |
|
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 |
|
66 */ |
|
67 IMPORT_C static CSIPCSeqHeader* NewLC(TUint aSeq, RStringF aMethod); |
|
68 |
|
69 /** |
|
70 * Destructor, deletes the resources of CSIPCSeqHeader. |
|
71 */ |
|
72 IMPORT_C ~CSIPCSeqHeader(); |
|
73 |
|
74 |
|
75 public: // New functions |
|
76 |
|
77 /** |
|
78 * Gets the sequence number from the "CSeq" header |
|
79 * @return the current sequence number |
|
80 */ |
|
81 IMPORT_C TUint Seq() const; |
|
82 |
|
83 /** |
|
84 * Sets the sequence number in the "CSeq" header |
|
85 * @param aSeq a sequence number to set |
|
86 */ |
|
87 IMPORT_C void SetSeq(TUint aSeq); |
|
88 |
|
89 /** |
|
90 * Gets the method from the "CSeq" header |
|
91 * @return the method |
|
92 */ |
|
93 IMPORT_C RStringF Method() const; |
|
94 |
|
95 /** |
|
96 * Sets the method in the "CSeq" header |
|
97 * @param aMethod a method to set |
|
98 */ |
|
99 IMPORT_C void SetMethodL(RStringF aMethod); |
|
100 |
|
101 /** |
|
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 |
|
106 */ |
|
107 IMPORT_C static CSIPHeaderBase* |
|
108 InternalizeValueL(RReadStream& aReadStream); |
|
109 |
|
110 |
|
111 public: // From CSIPHeaderBase |
|
112 |
|
113 /** |
|
114 * From CSIPHeaderBase CloneL |
|
115 */ |
|
116 IMPORT_C CSIPHeaderBase* CloneL() const; |
|
117 |
|
118 /** |
|
119 * From CSIPHeaderBase Name |
|
120 */ |
|
121 IMPORT_C RStringF Name() const; |
|
122 |
|
123 /** |
|
124 * From CSIPHeaderBase ToTextValueL |
|
125 */ |
|
126 IMPORT_C HBufC8* ToTextValueL() const; |
|
127 |
|
128 |
|
129 public: // From CSIPHeaderBase, for internal use |
|
130 |
|
131 /** |
|
132 * @internalComponent |
|
133 */ |
|
134 TPreferredPlace PreferredPlaceInMessage () const; |
|
135 |
|
136 public: // New functions, for internal use |
|
137 |
|
138 static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue); |
|
139 |
|
140 private: // From CSIPHeaderBase |
|
141 |
|
142 void ExternalizeValueL (RWriteStream& aWriteStream) const; |
|
143 |
|
144 private: // Constructors |
|
145 |
|
146 CSIPCSeqHeader(); |
|
147 void ConstructL(TUint aCSeq, RStringF aMethod); |
|
148 |
|
149 private: // New functions |
|
150 |
|
151 void DoInternalizeValueL(RReadStream& aReadStream); |
|
152 void ParseL(const TDesC8& aValue); |
|
153 void SetMethodL(const TDesC8& aMethod); |
|
154 |
|
155 private: // Data |
|
156 |
|
157 TUint iSeq; |
|
158 RStringF iMethod; |
|
159 |
|
160 private: // For testing purposes |
|
161 #ifdef CPPUNIT_TEST |
|
162 friend class CSIPCSeqHeaderTest; |
|
163 #endif |
|
164 }; |
|
165 |
|
166 #endif // CSIPCSEQHEADER_H |
|
167 |
|
168 // End of File |