|
1 // Copyright (c) 2005-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 // CSipStateBase definition file |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 #ifndef SIP_STATE_BASE_H |
|
24 #define SIP_STATE_BASE_H |
|
25 |
|
26 #include "siphlcommontypes.h" |
|
27 |
|
28 class CSipStateMachine; |
|
29 |
|
30 class CSipStateBase : public CBase |
|
31 /** |
|
32 This class will hold the base functionality required for a SIP state |
|
33 to have in it. Every state implementation should be derived from this |
|
34 class and implement the virtuals |
|
35 |
|
36 @internalComponent |
|
37 @released since v9.2 |
|
38 */ |
|
39 { |
|
40 public: |
|
41 /** |
|
42 The constructor of the class. |
|
43 |
|
44 @param aStateMachine Handle to the state machine on which the state belongs |
|
45 */ |
|
46 CSipStateBase( CSipStateMachine* aStateMachine, TSipHLConsts::SIP_STATES aCurrState ) : |
|
47 iSipSM(aStateMachine), iCurrState(aCurrState) |
|
48 { |
|
49 } |
|
50 /** |
|
51 The implemented version of the function will get called in case of a request |
|
52 comes from the client. i.e the entity which instantiated the state machine. |
|
53 |
|
54 @param aRequestStatus To be set when the processing is complete |
|
55 */ |
|
56 virtual CSipStateBase * ProcessClientL(TRequestStatus& aStatus) = 0; |
|
57 |
|
58 /** |
|
59 The implemented version of the function will get called in case of a request |
|
60 comes from the server. i.e TE. |
|
61 |
|
62 @param aRequestStatus To be set when the processing is complete |
|
63 */ |
|
64 virtual CSipStateBase * ProcessServerL(TRequestStatus& aStatus) = 0; |
|
65 |
|
66 /** |
|
67 The implemented version of the function can either be called from the client |
|
68 ore the TE |
|
69 |
|
70 @param aRequestStatus To be set when the processing is complete |
|
71 */ |
|
72 virtual CSipStateBase * ProcessServerErrorL(TRequestStatus & aStatus) = 0; |
|
73 |
|
74 /** |
|
75 The function will set what the client wants the state to do |
|
76 |
|
77 @param aRequest Request that are supported |
|
78 */ |
|
79 void SetClientRequest(TSipHLConsts::SIP_REQUESTS aRequest); |
|
80 |
|
81 /** |
|
82 The function will set what the server wants the state to do |
|
83 |
|
84 @param aRequest Request that are supported |
|
85 */ |
|
86 void SetServerRequest(TSipHLConsts::SIP_REQUESTS aRequest); |
|
87 |
|
88 /** |
|
89 The function will set what the client wants the state to do in |
|
90 response of a request |
|
91 |
|
92 @param aResponse Response that are supported |
|
93 */ |
|
94 void SetClientResponse(TSipHLConsts::SIP_RESPONSES aResponse); |
|
95 |
|
96 /** |
|
97 The function will set what the Server wants the state to do in |
|
98 response of a request |
|
99 |
|
100 @param aResponse Response that are supported |
|
101 */ |
|
102 void SetServerResponse(TSipHLConsts::SIP_RESPONSES aResponse); |
|
103 |
|
104 /** |
|
105 This function will Get the current state name |
|
106 */ |
|
107 TSipHLConsts::SIP_STATES GetStateId(); |
|
108 |
|
109 /** |
|
110 This function will reset all the request and response to None |
|
111 */ |
|
112 void ResetRequestResponse(); |
|
113 |
|
114 protected: |
|
115 // handle to the Next state |
|
116 CSipStateBase* iNext; |
|
117 CSipStateMachine* iSipSM; |
|
118 TChar iReqIdentifier; |
|
119 TSipHLConsts::SIP_REQUESTS iClientRequest; |
|
120 TSipHLConsts::SIP_REQUESTS iServerRequest; |
|
121 TSipHLConsts::SIP_RESPONSES iClientResponse; |
|
122 TSipHLConsts::SIP_RESPONSES iServerResponse; |
|
123 TSipHLConsts::SIP_STATES iCurrState; |
|
124 }; |
|
125 |
|
126 |
|
127 inline void CSipStateBase::SetClientRequest(TSipHLConsts::SIP_REQUESTS aRequest) |
|
128 /** |
|
129 */ |
|
130 { |
|
131 iReqIdentifier = 1; |
|
132 iClientRequest = aRequest; |
|
133 } |
|
134 inline void CSipStateBase::SetServerRequest(TSipHLConsts::SIP_REQUESTS aRequest) |
|
135 /** |
|
136 */ |
|
137 { |
|
138 iReqIdentifier = 2; |
|
139 iServerRequest = aRequest; |
|
140 } |
|
141 |
|
142 inline void CSipStateBase::SetClientResponse(TSipHLConsts::SIP_RESPONSES aResponse) |
|
143 /** |
|
144 */ |
|
145 { |
|
146 iReqIdentifier = 3; |
|
147 iClientResponse = aResponse; |
|
148 } |
|
149 inline void CSipStateBase::SetServerResponse(TSipHLConsts::SIP_RESPONSES aResponse) |
|
150 /** |
|
151 */ |
|
152 { |
|
153 iReqIdentifier = 4; |
|
154 iServerResponse = aResponse; |
|
155 } |
|
156 |
|
157 inline void CSipStateBase::ResetRequestResponse() |
|
158 /** |
|
159 */ |
|
160 { |
|
161 iReqIdentifier = 0; |
|
162 iClientRequest = iServerRequest = TSipHLConsts::ERequestNone; |
|
163 iClientResponse = iServerResponse = TSipHLConsts::EResponseNone; |
|
164 } |
|
165 |
|
166 inline TSipHLConsts::SIP_STATES CSipStateBase::GetStateId() |
|
167 /** |
|
168 */ |
|
169 { |
|
170 return iCurrState; |
|
171 } |
|
172 |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 #endif |