|
1 /** @file |
|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CUPNPSOCKETSHUTDOWN_H |
|
20 #define C_CUPNPSOCKETSHUTDOWN_H |
|
21 |
|
22 // INCLUDES |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <in_sock.h> |
|
26 |
|
27 class CUpnpTcpSession; |
|
28 class CUpnpNotifyTimer; |
|
29 |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 |
|
34 NONSHARABLE_CLASS (CUpnpSocketShutdown) : CActive, MUpnpNotifyTimerObserver |
|
35 { |
|
36 public: |
|
37 |
|
38 /** |
|
39 * Constructor function. |
|
40 * @since Series60 3.1 |
|
41 * @return A new CUpnpSocketShutdown instance. |
|
42 **/ |
|
43 static CUpnpSocketShutdown* NewL( CUpnpTcpSession&, RSocket&, TThreadPriority ); |
|
44 |
|
45 /** |
|
46 * Destructor. |
|
47 */ |
|
48 ~CUpnpSocketShutdown(); |
|
49 |
|
50 /** |
|
51 * HandleError |
|
52 * Error servicing |
|
53 * @since Series60 3.1 |
|
54 * @param aError Error code |
|
55 */ |
|
56 void HandleError( TInt aError ); |
|
57 |
|
58 /** |
|
59 * ShutdownImmediate |
|
60 * Shutdown with EImmediate |
|
61 * @since Series60 3.1 |
|
62 */ |
|
63 void ShutdownImmediate(); |
|
64 |
|
65 /** |
|
66 * ShutdownStop |
|
67 * Shutdown with ENormal or EStopOutput |
|
68 * @since Series60 3.1 |
|
69 */ |
|
70 void ShutdownStop(); |
|
71 |
|
72 /** |
|
73 * MarksTimeout |
|
74 * Marks if timeout occured on session |
|
75 * @since Series60 3.2 |
|
76 */ |
|
77 void MarksTimeout(); |
|
78 |
|
79 private: |
|
80 |
|
81 /** |
|
82 * Constructor |
|
83 */ |
|
84 CUpnpSocketShutdown( CUpnpTcpSession&, RSocket&, TThreadPriority ); |
|
85 |
|
86 /** |
|
87 * ConstructL |
|
88 */ |
|
89 void ConstructL(); |
|
90 |
|
91 /** |
|
92 * RunL |
|
93 * Active object state machine. |
|
94 * @since Series60 2.0 |
|
95 */ |
|
96 void RunL(); |
|
97 |
|
98 /** |
|
99 * DoCancel |
|
100 * Cancel outstanding request(s) and reset the iActive flag. |
|
101 * @since Series60 2.0 |
|
102 */ |
|
103 void DoCancel(); |
|
104 |
|
105 /** |
|
106 * RunError |
|
107 * RunError in case RunL leaves. |
|
108 * @since Series60 2.0 |
|
109 */ |
|
110 TInt RunError( TInt aError ); |
|
111 |
|
112 /** |
|
113 * Callback function for timer expirations. |
|
114 * @since Series60 2.6 |
|
115 * @param aTimer Timer that has expired. |
|
116 **/ |
|
117 void TimerEventL( CUpnpNotifyTimer* aTimer ); |
|
118 |
|
119 /** |
|
120 * TInternalState |
|
121 * Internal states. |
|
122 * @since Series60 3.1 |
|
123 */ |
|
124 enum TInternalState |
|
125 { |
|
126 EUnknown, |
|
127 EShuttingDownStopOutput, |
|
128 EShuttingDownNormal, |
|
129 EWaitingForInputError, |
|
130 EInputErrorReceived, |
|
131 ENotConnected |
|
132 }; |
|
133 |
|
134 private: |
|
135 |
|
136 /** |
|
137 * Reference to session that owns the writer. |
|
138 * Session is request writing and is notified when it's finished or |
|
139 * errors occure, not owned. |
|
140 */ |
|
141 CUpnpTcpSession& iSession; |
|
142 |
|
143 /** |
|
144 * Socket used for writing data, not owned. |
|
145 */ |
|
146 RSocket& iSocket; |
|
147 |
|
148 /** |
|
149 * Internal state variable. |
|
150 */ |
|
151 TInternalState iInternalState; |
|
152 |
|
153 // Timeout timer for input errors after shutdown normal and stop input |
|
154 CUpnpNotifyTimer* iInputTimeoutTimer; |
|
155 |
|
156 /** |
|
157 * Determines if timeout occured on session |
|
158 */ |
|
159 TBool iSessionTimeouted; |
|
160 |
|
161 }; |
|
162 |
|
163 |
|
164 #endif |
|
165 |