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 : siprackheader.h
17 * Interface : SDK API, SIP Codec API
25 #ifndef CSIPRACKHEADER_H
26 #define CSIPRACKHEADER_H
29 #include "sipheaderbase.h"
36 * Class provides functions for setting and getting sequence number and
37 * method in SIP "RAck"-header.
41 class CSIPRAckHeader : public CSIPHeaderBase
43 public: // Constructors and destructor
46 * Constructs a CSIPRAckHeader from textual representation
47 * of the header's value part.
48 * @param aValue a value part of a "RAck"-header (e.g. "1 2 INVITE")
49 * @return a new instance of CSIPRAckHeader.
51 IMPORT_C static CSIPRAckHeader* DecodeL(const TDesC8& aValue);
54 * Creates a new instance of CSIPRAckHeader
55 * @param aSeq a sequence number to set
56 * @param aCSeqNum a sequence number from CSeq-header
57 * @param aMethod a method to set. For example "REGISTER"
58 * @return a new instance of CSIPRAckHeader
60 IMPORT_C static CSIPRAckHeader* NewL(TUint aSeq,
66 * Creates a new instance of CSIPRAckHeader and puts it to CleanupStack
67 * @param aSeq a sequence number to set
68 * @param aCSeqNum a sequence number from CSeq-header
69 * @param aMethod a method to set. For example "REGISTER"
70 * @return a new instance of CSIPRAckHeader
72 IMPORT_C static CSIPRAckHeader* NewLC(TUint aSeq,
77 * Destructor, deletes the resources of CSIPRAckHeader.
79 IMPORT_C ~CSIPRAckHeader();
82 public: // New functions
85 * Gets the sequence number from the "RAck" header
86 * @return the current sequence number
88 IMPORT_C TUint Seq() const;
91 * Sets the sequence number in the "RAck" header
92 * @param aSeq a sequence number to set
94 IMPORT_C void SetSeq(TUint aSeq);
97 * Gets the sequence number from the "RAck" header
98 * @return the current sequence number
100 IMPORT_C TUint CSeqNum() const;
103 * Sets the sequence number in the "RAck" header
104 * @param aCSeqNum a sequence number to set
106 IMPORT_C void SetCSeqNum(TUint aCSeqNum);
109 * Gets the method from the "RAck" header
112 IMPORT_C RStringF Method() const;
115 * Sets the method in the "RAck" header
116 * @param aMethod a method to set
118 IMPORT_C void SetMethodL(RStringF aMethod);
121 * Constructs an instance of a CSIPRAckHeader from a RReadStream
122 * @param aReadStream a stream containing the value of the
123 * externalized object (header name not included).
124 * @return an instance of a CSIPRAckHeader
126 IMPORT_C static CSIPHeaderBase*
127 InternalizeValueL(RReadStream& aReadStream);
130 public: // From CSIPHeaderBase
133 * From CSIPHeaderBase CloneL
135 IMPORT_C CSIPHeaderBase* CloneL() const;
138 * From CSIPHeaderBase Name
140 IMPORT_C RStringF Name() const;
143 * From CSIPHeaderBase ToTextValueL
145 IMPORT_C HBufC8* ToTextValueL() const;
148 public: // From CSIPHeaderBase, for internal use
153 TPreferredPlace PreferredPlaceInMessage() const;
155 public: // New functions, for internal use
157 static RPointerArray<CSIPHeaderBase> BaseDecodeL(const TDesC8& aValue);
159 private: // From CSIPHeaderBase
161 void ExternalizeValueL (RWriteStream& aWriteStream) const;
163 private: // Constructors
166 CSIPRAckHeader(TUint aSeq, TUint aCSeqNum);
167 void ConstructL(RStringF aMethod);
168 void ConstructL(const CSIPRAckHeader& aRAckHeader);
170 private: // New functions
172 void DoInternalizeValueL(RReadStream& aReadStream);
173 void ParseL(const TDesC8& aValue);
174 void SetMethodL(const TDesC8& aMethod);
182 private: // For testing purposes
184 friend class CSIPRAckHeaderTest;
188 #endif // CSIPRACKHEADER_H