williamr@2
|
1 |
/*
|
williamr@2
|
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
3 |
* All rights reserved.
|
williamr@2
|
4 |
* This component and the accompanying materials are made available
|
williamr@4
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
williamr@2
|
6 |
* which accompanies this distribution, and is available
|
williamr@4
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
williamr@2
|
8 |
*
|
williamr@2
|
9 |
* Initial Contributors:
|
williamr@2
|
10 |
* Nokia Corporation - initial contribution.
|
williamr@2
|
11 |
*
|
williamr@2
|
12 |
* Contributors:
|
williamr@2
|
13 |
*
|
williamr@2
|
14 |
* Description:
|
williamr@2
|
15 |
* Name : sipservertransaction.h
|
williamr@2
|
16 |
* Part of : SIP Client
|
williamr@2
|
17 |
* Interface : SDK API, SIP API
|
williamr@2
|
18 |
* Version : 1.0
|
williamr@2
|
19 |
*
|
williamr@2
|
20 |
*/
|
williamr@2
|
21 |
|
williamr@2
|
22 |
|
williamr@2
|
23 |
|
williamr@2
|
24 |
#ifndef CSIPSERVERTRANSACTION_H
|
williamr@2
|
25 |
#define CSIPSERVERTRANSACTION_H
|
williamr@2
|
26 |
|
williamr@2
|
27 |
// INCLUDES
|
williamr@2
|
28 |
#include "siptransactionbase.h"
|
williamr@2
|
29 |
|
williamr@2
|
30 |
// FORWARD DECLARATIONS
|
williamr@2
|
31 |
class CSIPRequestElements;
|
williamr@2
|
32 |
class MSIPResponseSender;
|
williamr@2
|
33 |
class CSIPConnection;
|
williamr@2
|
34 |
class CSIPDialogImplementation;
|
williamr@2
|
35 |
|
williamr@2
|
36 |
// CLASS DECLARATION
|
williamr@2
|
37 |
|
williamr@2
|
38 |
/**
|
williamr@2
|
39 |
* @publishedAll
|
williamr@2
|
40 |
* @released
|
williamr@2
|
41 |
*
|
williamr@2
|
42 |
* Class for managing SIP server transactions.
|
williamr@2
|
43 |
* It provides services for creating, ending
|
williamr@2
|
44 |
* and getting SIP transaction parameters.
|
williamr@2
|
45 |
* Client cannot instantiate this class.
|
williamr@2
|
46 |
*
|
williamr@2
|
47 |
* @lib sipclient
|
williamr@2
|
48 |
*/
|
williamr@2
|
49 |
class CSIPServerTransaction: public CSIPTransactionBase
|
williamr@2
|
50 |
{
|
williamr@2
|
51 |
public: // Destructor
|
williamr@2
|
52 |
|
williamr@2
|
53 |
/**
|
williamr@2
|
54 |
* Destructor
|
williamr@2
|
55 |
*/
|
williamr@2
|
56 |
IMPORT_C ~CSIPServerTransaction();
|
williamr@2
|
57 |
|
williamr@2
|
58 |
public: // New functions
|
williamr@2
|
59 |
|
williamr@2
|
60 |
/**
|
williamr@2
|
61 |
* Sends response and ends the transaction;
|
williamr@2
|
62 |
* The user must not send 100 Trying response. Leaves on failure.
|
williamr@2
|
63 |
* @pre aElements!=0
|
williamr@2
|
64 |
* @pre State()==ETrying || State()==EProceeding
|
williamr@2
|
65 |
* @pre CSIPConnection::State()==EActive
|
williamr@2
|
66 |
* @pre ResponseAllowed()==ETrue
|
williamr@2
|
67 |
* @param aElements contains Status Code, optional Reason Phrase and
|
williamr@2
|
68 |
* optional SIP message headers and body. Ownership is transferred.
|
williamr@2
|
69 |
* @leave KErrArgument if aElements == NULL
|
williamr@2
|
70 |
* @leave KErrGeneral if ResponseAllowed() == EFalse
|
williamr@2
|
71 |
* @leave KErrSIPInvalidTransactionState if State()!=ETrying and
|
williamr@2
|
72 |
* State()!=EProceeding
|
williamr@2
|
73 |
* @leave KErrSIPInvalidDialogState if sending response to a request
|
williamr@2
|
74 |
* within dialog, and the dialog is in terminated state.
|
williamr@2
|
75 |
* @leave KErrSIPResourceNotAvailable if a required SIP Client API
|
williamr@2
|
76 |
* object has been deleted
|
williamr@2
|
77 |
* @capability NetworkServices
|
williamr@2
|
78 |
*/
|
williamr@2
|
79 |
IMPORT_C void SendResponseL(CSIPResponseElements *aElements);
|
williamr@2
|
80 |
|
williamr@2
|
81 |
/**
|
williamr@2
|
82 |
* Gets the request elements
|
williamr@2
|
83 |
* @return Request elements. Ownership is not transferred.
|
williamr@2
|
84 |
*/
|
williamr@2
|
85 |
IMPORT_C const CSIPRequestElements* RequestElements() const;
|
williamr@2
|
86 |
|
williamr@2
|
87 |
/**
|
williamr@2
|
88 |
* Checks if the response sending is allowed for this server
|
williamr@2
|
89 |
* transaction. For instance response is not allowed in ACK transaction.
|
williamr@2
|
90 |
* @return ETrue if response sending is allowed, EFalse otherwise
|
williamr@2
|
91 |
*/
|
williamr@2
|
92 |
IMPORT_C TBool ResponseAllowed() const;
|
williamr@2
|
93 |
|
williamr@2
|
94 |
public: // New functions, for internal use
|
williamr@2
|
95 |
|
williamr@2
|
96 |
/**
|
williamr@2
|
97 |
* Sets a new respose sender, replacing the current sender.
|
williamr@2
|
98 |
*
|
williamr@2
|
99 |
* @param aSender Response sender to be used from now on. Ownership is
|
williamr@2
|
100 |
* transferred.
|
williamr@2
|
101 |
*/
|
williamr@2
|
102 |
void SetResponseSender(MSIPResponseSender* aSender);
|
williamr@2
|
103 |
|
williamr@2
|
104 |
/**
|
williamr@2
|
105 |
* If the request was received inside a dialog, returns the dialog.
|
williamr@2
|
106 |
*
|
williamr@2
|
107 |
* @return CSIPDialogImplementation* The dialog inside which the request
|
williamr@2
|
108 |
* was received, or NULL. Ownership is not transferred.
|
williamr@2
|
109 |
*/
|
williamr@2
|
110 |
CSIPDialogImplementation* Dialog() const;
|
williamr@2
|
111 |
|
williamr@2
|
112 |
/**
|
williamr@2
|
113 |
* Obtains the associated CSIPConnection instance. If connection can't
|
williamr@2
|
114 |
* be accessed anymore, this function leaves.
|
williamr@2
|
115 |
*
|
williamr@2
|
116 |
* @return CSIPConnection
|
williamr@2
|
117 |
*/
|
williamr@2
|
118 |
CSIPConnection& SIPConnectionL();
|
williamr@2
|
119 |
|
williamr@2
|
120 |
/**
|
williamr@2
|
121 |
* Update the MTransactionAssociation to point to aAssociation.
|
williamr@2
|
122 |
*
|
williamr@2
|
123 |
* @param aAssociation Associated object
|
williamr@2
|
124 |
*/
|
williamr@2
|
125 |
void ReAssociateL(MTransactionAssociation& aAssociation);
|
williamr@2
|
126 |
|
williamr@2
|
127 |
/**
|
williamr@2
|
128 |
* Removes, but does not delete, request elements from
|
williamr@2
|
129 |
* aServerTransaction.
|
williamr@2
|
130 |
*
|
williamr@2
|
131 |
* @param aServerTransaction Server transaction from which response
|
williamr@2
|
132 |
* elements are removed. Ownership is not transferred.
|
williamr@2
|
133 |
*/
|
williamr@2
|
134 |
static void DetachRequestElements(TAny* aServerTransaction);
|
williamr@2
|
135 |
|
williamr@2
|
136 |
public: // Constructors, for internal use
|
williamr@2
|
137 |
/**
|
williamr@2
|
138 |
* Creates a server transaction.
|
williamr@2
|
139 |
*
|
williamr@2
|
140 |
* @param aRequestId RequestId for the transaction to use
|
williamr@2
|
141 |
* @param aAssociation Object with which the transaction is associated
|
williamr@2
|
142 |
* @param aElements Request elements. Ownership is transferred.
|
williamr@2
|
143 |
* @return New object. Ownership is transferred.
|
williamr@2
|
144 |
*/
|
williamr@2
|
145 |
static CSIPServerTransaction*
|
williamr@2
|
146 |
NewL(TUint32 aRequestId,
|
williamr@2
|
147 |
MTransactionAssociation& aAssociation,
|
williamr@2
|
148 |
CSIPRequestElements* aElements);
|
williamr@2
|
149 |
|
williamr@2
|
150 |
/**
|
williamr@2
|
151 |
* Creates a server transaction and pushes it to cleanup stack.
|
williamr@2
|
152 |
*
|
williamr@2
|
153 |
* @param aRequestId RequestId for the transaction to use
|
williamr@2
|
154 |
* @param aAssociation Object with which the transaction is associated
|
williamr@2
|
155 |
* @param aElements Request elements. Ownership is transferred.
|
williamr@2
|
156 |
* @return New object. Ownership is transferred.
|
williamr@2
|
157 |
*/
|
williamr@2
|
158 |
static CSIPServerTransaction*
|
williamr@2
|
159 |
NewLC(TUint32 aRequestId,
|
williamr@2
|
160 |
MTransactionAssociation& aAssociation,
|
williamr@2
|
161 |
CSIPRequestElements* aElements);
|
williamr@2
|
162 |
|
williamr@2
|
163 |
private: // Constructors
|
williamr@2
|
164 |
CSIPServerTransaction(TUint32 aRequestId,
|
williamr@2
|
165 |
MTransactionAssociation& aAssociation);
|
williamr@2
|
166 |
|
williamr@2
|
167 |
/**
|
williamr@2
|
168 |
* Second phase constructor.
|
williamr@2
|
169 |
*
|
williamr@2
|
170 |
* @pre aElements!=0
|
williamr@2
|
171 |
* @param aElements Request elements. Ownership is transferred.
|
williamr@2
|
172 |
*/
|
williamr@2
|
173 |
void ConstructL(CSIPRequestElements* aElements);
|
williamr@2
|
174 |
|
williamr@2
|
175 |
private: // Data
|
williamr@2
|
176 |
CSIPRequestElements* iRequestElements;
|
williamr@2
|
177 |
|
williamr@2
|
178 |
//This interface is used for sending the response.
|
williamr@2
|
179 |
//CSIPServerTransaction owns iResponseSender.
|
williamr@2
|
180 |
MSIPResponseSender* iResponseSender;
|
williamr@2
|
181 |
|
williamr@2
|
182 |
private: // For testing purposes
|
williamr@4
|
183 |
#ifdef CPPUNIT_TEST
|
williamr@4
|
184 |
friend class CSIPServerTransaction_Test;
|
williamr@4
|
185 |
friend class CSIP_Test;
|
williamr@4
|
186 |
#endif
|
williamr@4
|
187 |
void __DbgTestInvariant() const;
|
williamr@2
|
188 |
|
williamr@2
|
189 |
};
|
williamr@2
|
190 |
|
williamr@2
|
191 |
#endif
|