2 * Copyright (c) 2005-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 : sipclienttransaction.h
16 * Part of : SIP Client
25 #ifndef CSIPCLIENTTRANSACTION_H
26 #define CSIPCLIENTTRANSACTION_H
29 #include "siptransactionbase.h"
31 // FORWARD DECLARATIONS
40 * Class for managing SIP client transactions.
41 * It provides services for ending and getting the SIP client transaction
42 * parameters. Some client transactions can also be canceled.
44 * The user of the class cannot instante this class.
47 class CSIPClientTransaction: public CSIPTransactionBase
54 IMPORT_C ~CSIPClientTransaction();
56 public: // New functions
59 * Gets response elements of the most recent response.
60 * @return Response elements. Ownership isn't transferred.
62 IMPORT_C const CSIPResponseElements* ResponseElements() const;
65 * Cancels client transaction i.e. creates a CANCEL request and sends it
67 * @pre State()==EProceeding
68 * @pre CancelAllowed()==ETrue
69 * @pre Connection().State()==EActive
70 * @return SIP CANCEL transaction, ownership is transferred.
71 * @leave KErrSIPInvalidTransactionState if canceling is not possible
72 * at all, or because the transaction is not in a proper state or the
73 * transaction is not related to a dialog.
74 * @leave KErrSIPResourceNotAvailable if a required SIP Client API
75 * object has been deleted
76 * @capability NetworkServices
78 IMPORT_C CSIPClientTransaction* CancelL();
81 * Gets the associated refresh with the transaction.
82 * If the refresh is associated with the transaction,
83 * transaction will be refreshed at defined interval.
84 * @return associated refresh or 0-pointer if there's no
85 * associated refresh. Ownership isn't transferred.
87 IMPORT_C const CSIPRefresh* Refresh() const;
90 * Checks if the client transaction is such that it can be cancelled.
91 * This does no check whether the transaction is currently in such a
92 * state that the canceling can be done now.
94 * @return ETrue if client transaction can be cancelled;
97 IMPORT_C virtual TBool CancelAllowed() const;
99 public: // Constructors, for internal use
102 * Instantiates a CSIPClientTransaction object, leaves on failure.
104 * @param aType Identifies the transaction type
105 * @param aAssociation Object to which the transaction is associated
107 * @param aRefresh If transaction is refreshed, this points to a
108 * CSIPRefresh, otherwise this is NULL. Ownership is not transferred.
109 * @return SIP client transaction, ownership is transferred.
111 static CSIPClientTransaction*
113 MTransactionAssociation& aAssociation,
114 CSIPRefresh* aRefresh=0);
117 * Instantiates a CSIPClientTransaction object and pushes it into
118 * CleanupStack, leaves on failure.
120 * @param aType Identifies the transaction type
121 * @param aAssociation Object to which the transaction is associated
123 * @param aRefresh If transaction is refreshed, this points to a
124 * CSIPRefresh, otherwise this is NULL. Ownership is not transferred.
125 * @return SIP client transaction, ownership is transferred.
127 static CSIPClientTransaction*
128 NewLC(RStringF aType,
129 MTransactionAssociation& aAssociation,
130 CSIPRefresh* aRefresh=0);
132 public: // New functions, for internal use
135 * Sets the RequestId.
137 * @pre iRequestId == 0
138 * @pre aRequestId != 0
139 * @param aRequestId RequestId obtained from SIP client
141 void SetRequestId(TUint32 aRequestId);
144 * Gets the associated refresh with the transaction and allows
145 * modification fo the refresh. This method is for internal use only.
147 * @return associated refresh or 0-pointer if there's no
148 * associated refresh. Ownership isn't transferred.
150 CSIPRefresh* Refresh();
153 * Clears the association from ClientTransaction to CSIPRefresh
155 void RemoveRefresh();
157 protected: // Constructor
159 CSIPClientTransaction(MTransactionAssociation& aAssociation,
160 CSIPRefresh* aRefresh);
164 //Points to the refresh object if this transaction is refreshed.
165 //NULL if not refreshed. Not owned.
166 CSIPRefresh* iRefresh;
168 private: // For testing purposes
170 friend class CSIP_Test;