|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // This file specifies the states which can be used to form a |
|
15 // Net Ups State Machine. |
|
16 // @internalComponent |
|
17 // @prototype |
|
18 // |
|
19 // |
|
20 |
|
21 #ifndef NETUPSSTATE_H |
|
22 #define NETUPSSTATE_H |
|
23 |
|
24 #include <e32def.h> // defines TInt |
|
25 #include <e32std.h> // defines ThreadId, TProcessId |
|
26 |
|
27 #include <comms-infras/ss_activities.h> |
|
28 |
|
29 #include <comms-infras/ss_nodemessages.h> // defines ESock::TCFMessage |
|
30 #include "netupstypes.h" // defines TDestinationName, TNetUpsDecision |
|
31 |
|
32 #include "netupstypes.h" // defines TRequestId |
|
33 #include "netupskeys.h" |
|
34 #include "netupsdatabaseentry.h" |
|
35 #include "netupsprocessentry.h" // defines the database entry |
|
36 #include "netupsthreadentry.h" // defines the database sub entry |
|
37 #include "netupsstatedef.h" // defines the states for each state machine |
|
38 |
|
39 #include <comms-infras/commsdebugutility.h> // defines the comms debug logging utility |
|
40 |
|
41 namespace NetUps |
|
42 { |
|
43 class CNetUpsImpl; |
|
44 class CUpsStateMachine; |
|
45 NONSHARABLE_CLASS(CState) |
|
46 { |
|
47 public: |
|
48 static CState* NewL(TNetUpsState aNetUpsState, CUpsStateMachine& aStateMachine); |
|
49 virtual ~CState(); |
|
50 |
|
51 const TNetUpsState& State() const; |
|
52 CUpsStateMachine& UpsStateMachine(); |
|
53 static void PerformStateTransition(TEvent aEvent, CProcessEntry& aProcessEntry); |
|
54 |
|
55 virtual void ProcessPolicyCheckRequestL(TThreadKey& aThreadKey, const TPolicyCheckRequestData& aPolicyCheckRequestData, TRequestId aRequestId); |
|
56 |
|
57 virtual void IncrementConnectionCountL(TCommsIdKey& aCommsIdKey); |
|
58 virtual void DecrementConnectionCountL(TCommsIdKey& aCommsIdKey); |
|
59 |
|
60 virtual void HandleUPSRequestCompletionL(TCommsIdKey& aCommsIdKey, MPolicyCheckRequestOriginator& aPolicyCheckRequestOriginator, TNetUpsDecision aNetUpsDecision); |
|
61 virtual void HandleUPSErrorOnCompletionL(TCommsIdKey& aCommsIdKey, MPolicyCheckRequestOriginator& aPolicyCheckRequestOriginator, TInt aError); |
|
62 |
|
63 virtual void HandleProcessTermination(TProcessKey& aProcessKey); |
|
64 virtual void HandleThreadTermination(TThreadKey& aThreadKey); |
|
65 |
|
66 protected: |
|
67 CState(TNetUpsState aNetUpsState, CUpsStateMachine& aStateMachine); |
|
68 private: |
|
69 void ConstructL(); |
|
70 private: |
|
71 TNetUpsState iNetUpsState; |
|
72 CUpsStateMachine& iUpsStateMachine; |
|
73 |
|
74 __FLOG_DECLARATION_MEMBER; |
|
75 }; |
|
76 |
|
77 NONSHARABLE_CLASS(CNullState) : public CState |
|
78 { |
|
79 public: |
|
80 void ProcessPolicyCheckRequestL(TThreadKey& aThreadKey, const TPolicyCheckRequestData& aPolicyCheckRequestData, TRequestId aRequestId); |
|
81 |
|
82 CNullState(CUpsStateMachine& aStateMachine); |
|
83 }; |
|
84 |
|
85 NONSHARABLE_CLASS(CProcLifeTime_NonSessionState) : public CState |
|
86 { |
|
87 public: |
|
88 void ProcessPolicyCheckRequestL(TThreadKey& aThreadKey, const TPolicyCheckRequestData& aPolicyCheckRequestData, TRequestId aRequestId); |
|
89 void HandleUPSRequestCompletionL(TCommsIdKey& aCommsIdKey, MPolicyCheckRequestOriginator& aPolicyCheckRequestOriginator, TNetUpsDecision aNetUpsDecision); |
|
90 void HandleUPSErrorOnCompletionL(TCommsIdKey& aCommsIdKey, MPolicyCheckRequestOriginator& aPolicyCheckRequestOriginator, TInt aError); |
|
91 void HandleThreadTermination(TThreadKey& aThreadKey); |
|
92 |
|
93 CProcLifeTime_NonSessionState(CUpsStateMachine& aStateMachine); |
|
94 }; |
|
95 |
|
96 NONSHARABLE_CLASS(CProcLifeTime_SessionState) : public CState |
|
97 { |
|
98 public: |
|
99 void HandleProcessTermination(TProcessKey& aProcessKey); |
|
100 |
|
101 CProcLifeTime_SessionState(TNetUpsState aNetUpsState, CUpsStateMachine& aStateMachine); |
|
102 }; |
|
103 |
|
104 NONSHARABLE_CLASS(CProcLifeTime_TransitTo_SessionState) : public CProcLifeTime_SessionState |
|
105 { |
|
106 public: |
|
107 void HandleUPSRequestCompletionL(TCommsIdKey& aCommsIdKey, MPolicyCheckRequestOriginator& aPolicyCheckRequestOriginator, TNetUpsDecision aNetUpsDecision); |
|
108 void HandleUPSErrorOnCompletionL(TCommsIdKey& aCommsIdKey, MPolicyCheckRequestOriginator& aPolicyCheckRequestOriginator, TInt aError); |
|
109 |
|
110 CProcLifeTime_TransitTo_SessionState(TNetUpsState aNetUpsState, CUpsStateMachine& aStateMachine); |
|
111 }; |
|
112 |
|
113 NONSHARABLE_CLASS(CNetLifeTime_NonSessionState) : public CState |
|
114 { |
|
115 public: |
|
116 void ProcessPolicyCheckRequestL(TThreadKey& aThreadKey, const TPolicyCheckRequestData& aPolicyCheckRequestData, TRequestId aRequestId); |
|
117 void DecrementConnectionCountL(TCommsIdKey& aCommsIdKey); |
|
118 void HandleUPSRequestCompletionL(TCommsIdKey& aCommsIdKey, MPolicyCheckRequestOriginator& aPolicyCheckRequestOriginator, TNetUpsDecision aNetUpsDecision); |
|
119 void HandleUPSErrorOnCompletionL(TCommsIdKey& aCommsIdKey, MPolicyCheckRequestOriginator& aPolicyCheckRequestOriginator, TInt aError); |
|
120 void HandleThreadTermination(TThreadKey& aThreadKey); |
|
121 |
|
122 CNetLifeTime_NonSessionState(CUpsStateMachine& aStateMachine); |
|
123 }; |
|
124 |
|
125 NONSHARABLE_CLASS(CNetLifeTime_SessionYesState) : public CState |
|
126 { |
|
127 public: |
|
128 void DecrementConnectionCountL(TCommsIdKey& aCommsIdKey); |
|
129 |
|
130 CNetLifeTime_SessionYesState(CUpsStateMachine& aStateMachine); |
|
131 protected: |
|
132 CNetLifeTime_SessionYesState(TNetUpsState aNetUpsState, CUpsStateMachine& aStateMachine); |
|
133 }; |
|
134 |
|
135 NONSHARABLE_CLASS(CNetLifeTime_TransitTo_SessionYesState) : public CNetLifeTime_SessionYesState |
|
136 { |
|
137 public: |
|
138 void HandleUPSRequestCompletionL(TCommsIdKey& aCommsIdKey, MPolicyCheckRequestOriginator& aPolicyCheckRequestOriginator, TNetUpsDecision aNetUpsDecision); |
|
139 void HandleUPSErrorOnCompletionL(TCommsIdKey& aCommsIdKey, MPolicyCheckRequestOriginator& aPolicyCheckRequestOriginator, TInt aError); |
|
140 |
|
141 CNetLifeTime_TransitTo_SessionYesState(CUpsStateMachine& aStateMachine); |
|
142 }; |
|
143 |
|
144 NONSHARABLE_CLASS(CNetLifeTime_SessionNo_WithOutConnectionsState) : public CState |
|
145 { |
|
146 public: |
|
147 void HandleProcessTermination(TProcessKey& aProcessKey); |
|
148 void DecrementConnectionCountL(TCommsIdKey& aCommsIdKey); |
|
149 |
|
150 CNetLifeTime_SessionNo_WithOutConnectionsState(CUpsStateMachine& aStateMachine); |
|
151 protected: |
|
152 CNetLifeTime_SessionNo_WithOutConnectionsState(TNetUpsState aNetUpsState, CUpsStateMachine& aStateMachine); |
|
153 }; |
|
154 |
|
155 NONSHARABLE_CLASS(CNetLifeTimeSession_TransitTo_SessionNoWithOutConnectionsState) : public CNetLifeTime_SessionNo_WithOutConnectionsState |
|
156 { |
|
157 public: |
|
158 void HandleUPSRequestCompletionL(TCommsIdKey& aCommsIdKey, MPolicyCheckRequestOriginator& aPolicyCheckRequestOriginator, TNetUpsDecision aNetUpsDecision); |
|
159 void HandleThreadTermination(TThreadKey& aThreadKey); |
|
160 void HandleUPSErrorOnCompletionL(TCommsIdKey& aCommsIdKey, MPolicyCheckRequestOriginator& aPolicyCheckRequestOriginator, TInt aError); |
|
161 |
|
162 CNetLifeTimeSession_TransitTo_SessionNoWithOutConnectionsState(CUpsStateMachine& aStateMachine); |
|
163 }; |
|
164 |
|
165 NONSHARABLE_CLASS(CNetLifeTime_SessionNo_WithConnectionsState) : public CState |
|
166 { |
|
167 public: |
|
168 void DecrementConnectionCountL(TCommsIdKey& aCommsIdKey); |
|
169 |
|
170 CNetLifeTime_SessionNo_WithConnectionsState(CUpsStateMachine& aStateMachine); |
|
171 protected: |
|
172 CNetLifeTime_SessionNo_WithConnectionsState(TNetUpsState aNetUpsState, CUpsStateMachine& aStateMachine); |
|
173 }; |
|
174 |
|
175 NONSHARABLE_CLASS(CNetLifeTime_TransitTo_SessionNo_WithConnectionsState) : public CNetLifeTime_SessionNo_WithConnectionsState |
|
176 { |
|
177 public: |
|
178 void HandleUPSRequestCompletionL(TCommsIdKey& aCommsIdKey, MPolicyCheckRequestOriginator& aPolicyCheckRequestOriginator, TNetUpsDecision aNetUpsDecision); |
|
179 void HandleUPSErrorOnCompletionL(TCommsIdKey& aCommsIdKey, MPolicyCheckRequestOriginator& aPolicyCheckRequestOriginator, TInt aError); |
|
180 |
|
181 CNetLifeTime_TransitTo_SessionNo_WithConnectionsState(CUpsStateMachine& aStateMachine); |
|
182 }; |
|
183 |
|
184 } // end namespace NetUps |
|
185 |
|
186 #endif // NETUPSSTATE_H |