|
1 /* |
|
2 * Copyright (c) 2006 - 2007 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: Sends keepalive messages to TURN Client in order to keep |
|
15 * allocation in TURN Server alive |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #ifndef C_NATFWTURNREFRESHTIMER_H |
|
23 #define C_NATFWTURNREFRESHTIMER_H |
|
24 |
|
25 #include <e32base.h> |
|
26 |
|
27 class MNATFWRefreshObserver; |
|
28 |
|
29 /** |
|
30 * Sends keepalive messages to TURN Client. |
|
31 * |
|
32 * Sends keepalive messages to TURN Client in order to keep |
|
33 * allocation in TURN Server alive. Gets interval in microseconds from |
|
34 * CNATFWTurnPlugin. |
|
35 * |
|
36 * @lib turnplugin.lib |
|
37 * @since S60 v3.2 |
|
38 */ |
|
39 class CNATFWTurnRefreshTimer : public CActive |
|
40 { |
|
41 public: |
|
42 |
|
43 /** |
|
44 * Creates a new instance of NAT FW TURN Refresh Timer. |
|
45 * |
|
46 * @since S60 v3.2 |
|
47 * @param aObserver Observer for callbacks to timer's user |
|
48 * @return A new instance, ownership is transferred. |
|
49 */ |
|
50 static CNATFWTurnRefreshTimer* NewL( MNATFWRefreshObserver&aObserver ); |
|
51 |
|
52 /** |
|
53 * Creates a new instance of NAT FW TURN Refresh Timer and |
|
54 * pushes it to CleanupStack. |
|
55 * |
|
56 * @since S60 v3.2 |
|
57 * @param aObserver Observer for callbacks to timer's user |
|
58 * @return A new instance, ownership is transferred. |
|
59 */ |
|
60 static CNATFWTurnRefreshTimer* NewLC( MNATFWRefreshObserver&aObserver ); |
|
61 |
|
62 ~CNATFWTurnRefreshTimer(); |
|
63 |
|
64 /** |
|
65 * Waits for given time (aInterval) and calls SetActive(). |
|
66 * If interval is 0, timer is cancelled. |
|
67 * |
|
68 * @since S60 v3.2 |
|
69 * @param aInterval Interval in microseconds |
|
70 */ |
|
71 void StartTurnRefresh( TUint aInterval ); |
|
72 |
|
73 /** |
|
74 * Client can query if refresh is going on. |
|
75 * |
|
76 * @since S60 v3.2 |
|
77 * @return ETrue if refreshing |
|
78 */ |
|
79 TBool IsRunning() const; |
|
80 |
|
81 protected: |
|
82 |
|
83 /** |
|
84 * from CActive |
|
85 */ |
|
86 void RunL(); |
|
87 |
|
88 /** |
|
89 * from CActive |
|
90 */ |
|
91 void DoCancel(); |
|
92 |
|
93 private: |
|
94 |
|
95 CNATFWTurnRefreshTimer( MNATFWRefreshObserver&aObserver ); |
|
96 |
|
97 void ConstructL(); |
|
98 |
|
99 private: // data |
|
100 |
|
101 /** |
|
102 * Interval in microseconds |
|
103 */ |
|
104 TUint iInterval; |
|
105 |
|
106 /** |
|
107 * Asynchronous timer service. |
|
108 */ |
|
109 RTimer iTimer; |
|
110 |
|
111 /** |
|
112 * MNATFWRefreshObserver reference. |
|
113 */ |
|
114 MNATFWRefreshObserver& iObserver; |
|
115 |
|
116 }; |
|
117 |
|
118 #endif // C_NATFWTURNREFRESHTIMER_H |