|
1 /* |
|
2 * Copyright (c) 2002-2005 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: Header file for SUPL Communication Manager |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CSUPLCOMMUNICATIONMANAGER_H |
|
20 #define C_CSUPLCOMMUNICATIONMANAGER_H |
|
21 |
|
22 #include <e32std.h> |
|
23 #include <es_sock.h> |
|
24 |
|
25 #include "epos_msuplpacketnotifier.h" |
|
26 |
|
27 // CONSTANTS |
|
28 //const ?type ?constant_var = ?constant; |
|
29 const TInt KMaxSessionPerConn = 1; |
|
30 |
|
31 |
|
32 // Forward Declaration |
|
33 class CSuplConnection; |
|
34 class MSuplPacketReceiver; |
|
35 class CSuplConnTrace; |
|
36 |
|
37 // CLASS DECLARATION |
|
38 |
|
39 /** |
|
40 * CSuplCommunicationManager is the Singleton that provides SUPL Connection |
|
41 * to be used by Protocol Handler |
|
42 * |
|
43 * This provides the methods to create and destroy for SUPL Connection |
|
44 * Provides method to handle incoming packets from the network |
|
45 * |
|
46 * |
|
47 * @lib EPosSuplProtocolHandlerPlugin.dll |
|
48 * @since Series 60 3.1M //e.g. Series 60 3.0 |
|
49 */ |
|
50 class CSuplCommunicationManager : public CBase, public MSuplPacketNotifier |
|
51 { |
|
52 public: // Constructors and destructor |
|
53 |
|
54 /** |
|
55 * Two-phased constructor. |
|
56 */ |
|
57 IMPORT_C static CSuplCommunicationManager* NewL(); |
|
58 |
|
59 /** |
|
60 * Destructor. |
|
61 */ |
|
62 IMPORT_C virtual ~CSuplCommunicationManager(); |
|
63 |
|
64 public: // New functions |
|
65 |
|
66 /** |
|
67 * Initialize. |
|
68 * @since Series 60 3.1M |
|
69 * @param None |
|
70 * @return TInt. If sucessful, returns KErrNone. |
|
71 * For unsuccessful cases, it returns a System wide |
|
72 * error code |
|
73 */ |
|
74 IMPORT_C TInt Initialize(); |
|
75 |
|
76 /** |
|
77 * CreateConnection. |
|
78 * @since Series 60 3.1M |
|
79 * @param aHostAddress HostAddress with which connection has to |
|
80 * be established |
|
81 * @return CSuplConnection * |
|
82 */ |
|
83 IMPORT_C CSuplConnection *CreateConnectionL(const TDesC &aHostAddress, |
|
84 const TUint aPort, |
|
85 const TInt aIAPId); |
|
86 |
|
87 //---------------------------------------ADDITIONAL CREATECONNECTIONL METHOD(TAKES TLS ALSO)----------------------------- |
|
88 |
|
89 IMPORT_C CSuplConnection *CreateConnectionL(const TDesC &aHostAddress, |
|
90 TBool aTls, |
|
91 TBool aPskTls, |
|
92 const TUint aPort, |
|
93 const TInt aIAPId); |
|
94 //------------------------------------------------------------------------------------------------------ |
|
95 |
|
96 /** |
|
97 * DestroyConnection. |
|
98 * @since Series 60 3.1M |
|
99 * @param CSuplConnection * |
|
100 * @return none |
|
101 */ |
|
102 IMPORT_C TInt DestroyConnection(CSuplConnection *aConnection); |
|
103 |
|
104 /** |
|
105 * SetPacketReceiver. |
|
106 * @since Series 60 3.1M |
|
107 * @param MSuplPacketReceiver |
|
108 * @return none |
|
109 */ |
|
110 IMPORT_C void SetPacketReceiver(MSuplPacketReceiver *aReceiver); |
|
111 |
|
112 public: // Functions from base classes |
|
113 |
|
114 /** |
|
115 * From MSuplPacketNotifier - To handle received packets fromk the |
|
116 * Network. |
|
117 * @since Series 60 3.1U |
|
118 * @param aPacket - The packet received from the network |
|
119 * @return None |
|
120 */ |
|
121 void HandlePacket(const TDesC8 &aPacket, TUint aPortNo); |
|
122 |
|
123 /** |
|
124 * From MSuplPacketNotifier - To handle any errors while trying to |
|
125 * read packets from the network |
|
126 * @since Series 60 3.1U |
|
127 * @param aError - The Error value |
|
128 * @return None |
|
129 */ |
|
130 void HandlePacketError (const TInt aError); |
|
131 |
|
132 protected: // New functions |
|
133 |
|
134 /** |
|
135 * FindConnection. |
|
136 * @since Series 60 3.1M |
|
137 * @param aHostAddress |
|
138 * @param aPort |
|
139 * @return CSuplConnection * |
|
140 */ |
|
141 CSuplConnection *FindConnection( const TDesC &aHostAddress, const TUint aPort ); |
|
142 |
|
143 /** |
|
144 * FindConnection. |
|
145 * @since Series 60 3.1M |
|
146 * @param aConnection |
|
147 * @return TInt |
|
148 */ |
|
149 TInt FindConnection( const CSuplConnection *aConnection ); |
|
150 |
|
151 |
|
152 /** |
|
153 * RemoveConnection. |
|
154 * @since Series 60 3.1M |
|
155 * @param CSuplConnection * |
|
156 * @return none |
|
157 */ |
|
158 void RemoveConnection(TInt aIndex); |
|
159 |
|
160 /** |
|
161 * DestroyAllConnections. |
|
162 * @since Series 60 3.1M |
|
163 * @param none |
|
164 * @return none |
|
165 */ |
|
166 void DestroyAllConnections(); |
|
167 |
|
168 |
|
169 protected: // Functions from base classes |
|
170 |
|
171 /** |
|
172 * From ?base_class ?member_description |
|
173 */ |
|
174 //?type ?member_function(); |
|
175 |
|
176 private: |
|
177 |
|
178 /** |
|
179 * C++ default constructor. |
|
180 */ |
|
181 CSuplCommunicationManager(); |
|
182 |
|
183 /** |
|
184 * By default Symbian 2nd phase constructor is private. |
|
185 */ |
|
186 void ConstructL(); |
|
187 |
|
188 |
|
189 public: // Data |
|
190 |
|
191 |
|
192 protected: // Data |
|
193 |
|
194 private: // Data |
|
195 // A Pointer Array holding the CSuplConnection pointers |
|
196 RPointerArray<CSuplConnection> iConnArray; |
|
197 |
|
198 // RSocketServ |
|
199 RSocketServ iSocketServ; |
|
200 |
|
201 // If Connected ?? |
|
202 TBool iServerConnected; |
|
203 |
|
204 // Packet Receiver |
|
205 MSuplPacketReceiver *iPktReceiver; |
|
206 |
|
207 // Trace Log |
|
208 CSuplConnTrace* iTrace; |
|
209 }; |
|
210 |
|
211 #endif // C_CSUPLCOMMUNICATIONMANAGER_H |
|
212 |
|
213 // End of File |