1 /* |
|
2 * Copyright (c) 2005-2006 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: SIP event handling class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CMUSAVACAPABILITYSIPAGENT_H |
|
20 #define CMUSAVACAPABILITYSIPAGENT_H |
|
21 |
|
22 |
|
23 #include <e32base.h> // CBase |
|
24 #include "musunittesting.h" |
|
25 #include "musavasipadapter.h" |
|
26 #include "musavasipconnectionadapter.h" |
|
27 #include "musavaavailabilityobserver.h" |
|
28 |
|
29 |
|
30 class CMusAvaSharedObject; |
|
31 class CSIPConnection; |
|
32 class CSIPDialog; |
|
33 class CSIPProfile; |
|
34 class CSIPProfileRegistry; |
|
35 class CSIPServerTransaction; |
|
36 class CMusAvaCapabilityExchange; |
|
37 class CMusAvaCapability; |
|
38 |
|
39 /** |
|
40 * SIP event handling class |
|
41 * |
|
42 * @lib AlwaysOnlineSwisPlugin.dll |
|
43 */ |
|
44 class CMusAvaCapabilitySipAgent : |
|
45 public CBase, |
|
46 public MMusAvaSipAdapter, |
|
47 public MMusAvaSipConnectionAdapter |
|
48 { |
|
49 |
|
50 private: |
|
51 |
|
52 /** SIP connection state */ |
|
53 |
|
54 enum TSipConnectionState |
|
55 { |
|
56 /** Connection state unknown */ |
|
57 ESipConnUnknown = 0, |
|
58 /** Connection initializing */ |
|
59 ESipConnInit, |
|
60 /** Connection active */ |
|
61 ESipConnActive, |
|
62 /** Connection suspended */ |
|
63 ESipConnSuspended, |
|
64 /** Connection is inactive */ |
|
65 ESipConnInactive, |
|
66 /** Connection is permanently unavailable */ |
|
67 ESipConnUnavailable |
|
68 }; |
|
69 |
|
70 |
|
71 public: // constructors and destructor |
|
72 |
|
73 static CMusAvaCapabilitySipAgent* NewL( |
|
74 CMusAvaCapabilityExchange& aCapabilityExchange, |
|
75 CMusAvaSharedObject& aSharedObject, |
|
76 MMusAvaAvailabilityObserver& aAvaObserver ); |
|
77 |
|
78 virtual ~CMusAvaCapabilitySipAgent(); |
|
79 |
|
80 |
|
81 private: // constructors |
|
82 |
|
83 CMusAvaCapabilitySipAgent( CMusAvaCapabilityExchange& aCapabilityExchange, |
|
84 CMusAvaSharedObject& aSharedObject, |
|
85 MMusAvaAvailabilityObserver& aAvaObserver ); |
|
86 |
|
87 |
|
88 public: // new functions |
|
89 |
|
90 /** |
|
91 * Executes capability query |
|
92 * |
|
93 *@param aCapability capability to query |
|
94 *@param aSipAddress remote part address |
|
95 */ |
|
96 void ExecuteCapabilityQueryL( CMusAvaCapability& aCapability, |
|
97 const TDesC& aSipAddress ); |
|
98 |
|
99 |
|
100 public: // functions from base class MSIPObserver |
|
101 |
|
102 /** |
|
103 * A SIP request has been received from the network. |
|
104 * This function is called when the SIP request was received using such |
|
105 * an IAP, for which the application has not created a CSIPConnection |
|
106 * object. |
|
107 * @pre aTransaction != 0 |
|
108 * @param aIapId The IapId from which the SIP request was received. |
|
109 * @param aTransaction contains local address, remote address of a SIP |
|
110 * message, as well as optional SIP message method, headers and |
|
111 * body. The ownership is transferred. |
|
112 */ |
|
113 TInt IncomingRequest( TUint32 aIapId, |
|
114 CSIPServerTransaction* aTransaction ); |
|
115 |
|
116 /** |
|
117 * The received SIP request time-outed and it has been destroyed. |
|
118 * This will be called if the user fails to create a SIP |
|
119 * connection and does not send an appropriate SIP response. |
|
120 * @param aTransaction The time-outed transaction. |
|
121 */ |
|
122 TInt TimedOut( CSIPServerTransaction& /* aTransaction */ ); |
|
123 |
|
124 |
|
125 public: // functions from base class MMusAvaSipConnectionAdapter |
|
126 |
|
127 /** |
|
128 * A SIP request outside a dialog has been received from the |
|
129 * network. |
|
130 */ |
|
131 TInt IncomingRequest( CSIPServerTransaction* aTransaction ); |
|
132 |
|
133 /** |
|
134 * A SIP response received from the network. |
|
135 * |
|
136 * @param aTransaction contains response elements. |
|
137 */ |
|
138 TInt IncomingResponse (CSIPClientTransaction& aTransaction); |
|
139 |
|
140 /** |
|
141 * An asynchronous error has occurred in the stack related to the |
|
142 * request indicated by the given transaction. |
|
143 * |
|
144 * @param aError system wide or SIP error code |
|
145 * @param aTransaction failed transaction |
|
146 * @param aSIPConnection a SIP connection |
|
147 */ |
|
148 TInt ErrorOccured (TInt aError, CSIPTransactionBase& aTransaction ); |
|
149 |
|
150 private: |
|
151 /** |
|
152 * Handle incoming SIP request |
|
153 * @param aTransaction incoming transaction |
|
154 */ |
|
155 void HandleIncomingRequestL( CSIPServerTransaction& aTransaction ); |
|
156 |
|
157 private: // data |
|
158 |
|
159 CSIPConnection* iSipConnection; |
|
160 CMusAvaCapabilityExchange& iCapabilityExchange; |
|
161 CMusAvaSharedObject& iSharedObj; |
|
162 MMusAvaAvailabilityObserver& iAvailabilityObserver; |
|
163 |
|
164 MUS_UNITTEST ( UT_CMusAvaCapabilitySipAgent ) |
|
165 |
|
166 }; |
|
167 |
|
168 |
|
169 #endif // CMUSAVACAPABILITYSIPAGENT_H |
|