|
1 // Copyright (c) 2002-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 // $Header$ |
|
15 // The header file introducing the collection of HTTP command classes |
|
16 // of the Integration Harness framework. |
|
17 // |
|
18 // |
|
19 |
|
20 #ifndef __HTTPSESSIONCMDS_H__ |
|
21 #define __HTTPSESSIONCMDS_H__ |
|
22 |
|
23 //----------------------------------------------------------------------------- |
|
24 |
|
25 #include "MWspEventCallback.h" |
|
26 |
|
27 #include "GT0149.h" |
|
28 #include "TEngine.h" |
|
29 #include "CCmdFamily.h" |
|
30 #include "CCmdBase.h" |
|
31 #include "CObjCatalogue.h" |
|
32 #include "CTimeoutTimer.h" |
|
33 #include "CWspEventDispatcher.h" |
|
34 |
|
35 //---------------------------------------------------------------------------- |
|
36 // specifics to this module |
|
37 |
|
38 |
|
39 #include <http.h> |
|
40 #include <etel.h> |
|
41 #include <e32base.h> |
|
42 #include <es_sock.h> |
|
43 #include <http/mhttpauthenticationcallback.h> |
|
44 #include <http/mhttpsessioneventcallback.h> |
|
45 |
|
46 class CCmdConnect : public CCmdBase, public MWspEventCallback |
|
47 { |
|
48 friend class CCmdDisconnect; |
|
49 friend class CCmdTransaction; |
|
50 |
|
51 public: |
|
52 |
|
53 static CCmdConnect *NewL (TInt, const TDesC& aKeyphrase, const TDesC& aHelpPhrase); |
|
54 static CCmdConnect *NewLC(TInt, const TDesC& aKeyphrase, const TDesC& aHelpPhrase); |
|
55 virtual ~CCmdConnect(); |
|
56 |
|
57 void DisconnectL(const TInt &aIndex); |
|
58 void DisconnectL(const TDesC& aLabel); |
|
59 void Delete(const TInt &aIndex); |
|
60 void Delete(const TDesC& aLabel); |
|
61 |
|
62 |
|
63 protected: // data types |
|
64 |
|
65 enum THTTPReceivedType |
|
66 { |
|
67 EHTTPReceived, |
|
68 EHTTPUnexpected, |
|
69 EHTTPNotReceived, |
|
70 EMaxReceivedEventType |
|
71 }; |
|
72 |
|
73 protected: // from CCmdBase |
|
74 |
|
75 void ConstructL( TInt aCommandId, const TDesC& aKeyphrase, const TDesC& aHelpPhrase); |
|
76 CCmdConnect() {}; // ensure a concrete class! |
|
77 |
|
78 // void DoneWaitEvents(); |
|
79 void SetWspProxyPropertiesL(RHTTPSession & aSession, RStringPool &aStrPool) ; |
|
80 void SetWspCapabilityPropertiesL( RHTTPSession & aSession, RStringPool &aStrPool) ; |
|
81 |
|
82 public: // from CCmdBase |
|
83 TInt ProcessL (const TDesC& aCommand); |
|
84 |
|
85 private: |
|
86 CWspEventDispatcher *iEventDispatcher; |
|
87 void HandleWspEvent(TRequestStatus aStatus); |
|
88 // Get command parameters = the remainder after the Keyword Phrase |
|
89 // in the command string. Leaves (KErrArgument) if cannot recogize |
|
90 // the command. |
|
91 TInt ParseCmdArgs( const TDesC& aCommand, TPtrC& aFramework, TPtrC& aConName ); |
|
92 void ShowSessions(); |
|
93 void WaitForNextEvent(TInt); |
|
94 |
|
95 RHTTPSession *iSession; |
|
96 |
|
97 THTTPReceivedType iReceived; |
|
98 |
|
99 TInt iMaxEvents; |
|
100 TInt iEventCount; |
|
101 TInt iEventRequired; |
|
102 |
|
103 TBool iNowaitGiven; // ETrue if command contains NOWAIT option |
|
104 TBool iNbrGiven; // ETrue if command contains number option |
|
105 TInt iNbrValue; // value of the number option |
|
106 }; |
|
107 |
|
108 //----------------------------------------------------------------------------- |
|
109 // Command: The 'Disconnect' command which closes a named session |
|
110 |
|
111 class CCmdDisconnect : public CCmdBase |
|
112 { |
|
113 public: |
|
114 |
|
115 static CCmdDisconnect *NewL ( TInt, const TDesC& aKeyphrase, const TDesC& aHelpPhrase); |
|
116 static CCmdDisconnect *NewLC( TInt, const TDesC& aKeyphrase, const TDesC& aHelpPhrase); |
|
117 virtual ~CCmdDisconnect(); |
|
118 |
|
119 private: |
|
120 CWspEventDispatcher *iEventDispatcher; |
|
121 enum TReceivedType |
|
122 { |
|
123 EReceived, |
|
124 EUnexpected, |
|
125 ENotReceived |
|
126 }; |
|
127 TReceivedType iReceived; |
|
128 |
|
129 TInt iMaxEvents; |
|
130 TInt iEventCount; |
|
131 |
|
132 TBool iNowaitGiven; // ETrue if command contains NOWAIT option |
|
133 TBool iNbrGiven; // ETrue if command contains number option |
|
134 TInt iNbrValue; // value of the number option |
|
135 |
|
136 |
|
137 protected: // from CCmdBase |
|
138 |
|
139 void ConstructL( TInt aCommandId, const TDesC& aKeyphrase, const TDesC& aHelpPhrase); |
|
140 // void DoneWaitEvents(); |
|
141 TInt iEventRequired; |
|
142 |
|
143 public: // from CCmdBase |
|
144 TInt ProcessL ( const TDesC& aCommand ); |
|
145 |
|
146 private: |
|
147 TInt ParseCmdArgs( const TDesC& aCommand, TPtrC& aConName ); |
|
148 void WaitForNextEvent(TInt); |
|
149 }; |
|
150 |
|
151 //----------------------------------------------------------------------------- |
|
152 |
|
153 #endif // __HTTPSESSIONCMDS_H__ |
|
154 |
|
155 //----------------------------------------------------------------------------- |
|
156 // End of File |
|
157 //----------------------------------------------------------------------------- |
|
158 |