|
1 /* |
|
2 * Copyright (c) 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 the License "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: A class that holds the shared connection to a access point. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef SESSION_HTTP_CONNECTION_H |
|
20 #define SESSION_HTTP_CONNECTION_H |
|
21 |
|
22 |
|
23 // INCLUDES |
|
24 #include <es_sock.h> |
|
25 //#include <AknInputBlock.h> |
|
26 |
|
27 #include "httpconnection.h" |
|
28 |
|
29 // CONSTANTS |
|
30 |
|
31 // MACROS |
|
32 |
|
33 // DATA TYPES |
|
34 |
|
35 // FUNCTION PROTOTYPES |
|
36 |
|
37 // FORWARD DECLARATIONS |
|
38 class CFeedsServerSession; |
|
39 |
|
40 // CLASS DECLARATION |
|
41 |
|
42 |
|
43 /** |
|
44 * A class that holds the shared connection with client app. |
|
45 * |
|
46 * \b Library: FeedsEngine.lib |
|
47 * |
|
48 * @since 3.0 |
|
49 */ |
|
50 class CSessionHttpConnection: public CHttpConnection//, public MAknInputBlockCancelHandler |
|
51 { |
|
52 public: // Constructors and destructor |
|
53 /** |
|
54 * Two-phased constructor. |
|
55 */ |
|
56 static CSessionHttpConnection* NewL( CFeedsServerSession& aFeedsSession ); |
|
57 |
|
58 /** |
|
59 * Destructor. |
|
60 */ |
|
61 virtual ~CSessionHttpConnection(); |
|
62 |
|
63 |
|
64 public: // From MConnectionCallback |
|
65 /** |
|
66 * It propagates the connection callback to the browser client. |
|
67 * |
|
68 * @since 3.0 |
|
69 * @param aConnectionPtr Connection ptr |
|
70 * @param aSockSvrHandle Socket server handle |
|
71 * @param aNewConn ETrue, if this is a new connection |
|
72 * @param aBearerType Bearer type |
|
73 * @return OS wide error code |
|
74 */ |
|
75 virtual TInt CreateConnection(TInt* aConnectionPtr, TInt* aSockSvrHandle, |
|
76 TBool* aNewConn, TApBearerType* aBearerType); |
|
77 |
|
78 |
|
79 public: // From CHttpConnection. |
|
80 /** |
|
81 * Returns whether or not the connection is active. |
|
82 * |
|
83 * @since 3.0 |
|
84 * @return void. |
|
85 */ |
|
86 TBool IsConnected(); |
|
87 |
|
88 /** |
|
89 * Closes the connection. |
|
90 * |
|
91 * @since 3.0 |
|
92 * @return void. |
|
93 */ |
|
94 void Disconnect(); |
|
95 |
|
96 /** |
|
97 * |
|
98 */ |
|
99 void CancelAnyConnectionAttempt(); |
|
100 |
|
101 public: // New Methods. |
|
102 /** |
|
103 * Set the connection. |
|
104 * |
|
105 * @since 3.1 |
|
106 * @return ETrue if connection being set, EFalse otherwise. |
|
107 */ |
|
108 TBool SetConnection( TDesC& aName, TInt aBearerType ); |
|
109 |
|
110 |
|
111 private: |
|
112 /** |
|
113 * C++ default constructor. |
|
114 */ |
|
115 CSessionHttpConnection( CFeedsServerSession& aFeedsSession ); |
|
116 |
|
117 /** |
|
118 * By default Symbian 2nd phase constructor is private. |
|
119 */ |
|
120 void ConstructL(); |
|
121 |
|
122 /** |
|
123 * Reset connection name |
|
124 */ |
|
125 void Reset(); |
|
126 |
|
127 /** |
|
128 * Have we received valid connection information from the client? |
|
129 */ |
|
130 TBool ConnectionInformationProvidedByClient() const; |
|
131 |
|
132 private: |
|
133 TLeakTracker iLeakTracker; |
|
134 |
|
135 CFeedsServerSession& iFeedsSession; |
|
136 |
|
137 RSocketServ iSocketServ; |
|
138 RConnection iConnection; ///< got from client apps, no need to disconnect upon session closing |
|
139 HBufC* iConnName; |
|
140 TApBearerType iBearerType; |
|
141 TInt iConnStage; |
|
142 TInt iConnectionError; |
|
143 |
|
144 CActiveSchedulerWait iWait; |
|
145 }; |
|
146 |
|
147 #endif // SESSION_HTTP_CONNECTION_H |
|
148 |
|
149 // End of File |