williamr@2
|
1 |
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@2
|
4 |
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@2
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
|
williamr@2
|
17 |
|
williamr@2
|
18 |
/**
|
williamr@2
|
19 |
@file
|
williamr@2
|
20 |
@publishedPartner
|
williamr@2
|
21 |
@released
|
williamr@2
|
22 |
*/
|
williamr@2
|
23 |
|
williamr@2
|
24 |
#if !defined(__ES_PROT_H__)
|
williamr@2
|
25 |
#define __ES_PROT_H__
|
williamr@2
|
26 |
|
williamr@2
|
27 |
|
williamr@2
|
28 |
#include <es_enum.h>
|
williamr@2
|
29 |
|
williamr@2
|
30 |
/**
|
williamr@2
|
31 |
ESock subsession unique id
|
williamr@2
|
32 |
@internalTechnology
|
williamr@2
|
33 |
*/
|
williamr@2
|
34 |
typedef TUint TSubSessionUniqueId;
|
williamr@2
|
35 |
|
williamr@2
|
36 |
/**
|
williamr@2
|
37 |
@internalComponent
|
williamr@2
|
38 |
*/
|
williamr@2
|
39 |
enum TConnStartType
|
williamr@2
|
40 |
{
|
williamr@2
|
41 |
EConnStartExplicit,
|
williamr@2
|
42 |
EConnStartImplicit
|
williamr@2
|
43 |
};
|
williamr@2
|
44 |
|
williamr@2
|
45 |
/**
|
williamr@2
|
46 |
@internalComponent
|
williamr@2
|
47 |
*/
|
williamr@2
|
48 |
enum TESOCKActivePriority
|
williamr@2
|
49 |
{
|
williamr@2
|
50 |
ESSExclusivePriority=100000,
|
williamr@2
|
51 |
ECommReceivePriority=200, ///< Must always run.
|
williamr@2
|
52 |
ECommTransmitPriority=100,
|
williamr@2
|
53 |
ECAsyncImmediatePriority=75, ///< I.e. before a timer event goes off.
|
williamr@2
|
54 |
ESocketTimerPriority=50,
|
williamr@2
|
55 |
EActiveIpcPriority=20,
|
williamr@2
|
56 |
EActiveHighPriority=10,
|
williamr@2
|
57 |
EActiveMedPriority=0,
|
williamr@2
|
58 |
EActiveLowPriority=-10,
|
williamr@2
|
59 |
ECAsyncDeferredPriority=-20,
|
williamr@2
|
60 |
};
|
williamr@2
|
61 |
|
williamr@2
|
62 |
/**
|
williamr@2
|
63 |
End of data,Socket can't receive more data.
|
williamr@2
|
64 |
@publishedPartner
|
williamr@2
|
65 |
@released
|
williamr@2
|
66 |
*/
|
williamr@2
|
67 |
const TUint KNewDataEndofData = 0xFFFFFFFF;
|
williamr@2
|
68 |
|
williamr@2
|
69 |
class CServProviderBase;
|
williamr@2
|
70 |
class CSocket;
|
williamr@2
|
71 |
|
williamr@2
|
72 |
class MSocketNotify
|
williamr@2
|
73 |
/** Abstract base class used by a CServProviderBase-derived object, through its
|
williamr@2
|
74 |
iSocket member, to notify the socket server that various events have occurred.
|
williamr@2
|
75 |
|
williamr@2
|
76 |
The class provides several up-call member functions.
|
williamr@2
|
77 |
|
williamr@2
|
78 |
All up-calls on an MSocketNotify should be made in the context of the socket
|
williamr@2
|
79 |
server's thread - i.e. the thread which called NewSAPL() on the protocol.
|
williamr@2
|
80 |
|
williamr@2
|
81 |
@publishedPartner
|
williamr@2
|
82 |
@released Since v5.0 */
|
williamr@2
|
83 |
{
|
williamr@2
|
84 |
public:
|
williamr@2
|
85 |
/** Delete and detach flags. */
|
williamr@2
|
86 |
enum TDelete
|
williamr@2
|
87 |
{
|
williamr@2
|
88 |
/** Delete SAP */
|
williamr@2
|
89 |
EDelete,
|
williamr@2
|
90 |
/** Don't delete SAP */
|
williamr@2
|
91 |
EDetach
|
williamr@2
|
92 |
};
|
williamr@2
|
93 |
/** Error codes. */
|
williamr@2
|
94 |
enum TOperationBitmasks
|
williamr@2
|
95 |
{
|
williamr@2
|
96 |
/** An error has occurred which affects Send() operations */
|
williamr@2
|
97 |
EErrorSend=0x0000001,
|
williamr@2
|
98 |
|
williamr@2
|
99 |
/** An error has occurred which affects Receive() operations. */
|
williamr@2
|
100 |
EErrorRecv=0x0000002,
|
williamr@2
|
101 |
|
williamr@2
|
102 |
/** An error has occurred which affects Connect() operations */
|
williamr@2
|
103 |
EErrorConnect=0x0000004,
|
williamr@2
|
104 |
|
williamr@2
|
105 |
/** An error has occurred which affects Close() operations */
|
williamr@2
|
106 |
EErrorClose=0x00000008,
|
williamr@2
|
107 |
|
williamr@2
|
108 |
/** An error has occurred which affects Ioctl() operations */
|
williamr@2
|
109 |
EErrorIoctl=0x00000010,
|
williamr@2
|
110 |
|
williamr@2
|
111 |
/** A fatal error has occurred */
|
williamr@2
|
112 |
EErrorFatal=0x10000000,
|
williamr@2
|
113 |
|
williamr@2
|
114 |
/** An error has occurred which affects all operations */
|
williamr@2
|
115 |
EErrorAllOperations=0x7fffffff,
|
williamr@2
|
116 |
};
|
williamr@2
|
117 |
|
williamr@2
|
118 |
/**
|
williamr@2
|
119 |
Indicates that new data is available on a service access point
|
williamr@2
|
120 |
|
williamr@2
|
121 |
For a stream-oriented protocol aCount should be a byte count; for datagram-oriented
|
williamr@2
|
122 |
sockets aCount should be a datagram count.
|
williamr@2
|
123 |
|
williamr@2
|
124 |
@note aCount is the amount of new data, not the total amount of data waiting
|
williamr@2
|
125 |
to be read.
|
williamr@2
|
126 |
|
williamr@2
|
127 |
@param aCount The amount of new data. A value of KNewDataEndofData indicates
|
williamr@2
|
128 |
that the socket is in a half-closed state and will receive no more data. Any subsequent
|
williamr@2
|
129 |
reads will complete with KErrEof and a length of 0. */
|
williamr@2
|
130 |
virtual void NewData(TUint aCount) = 0;
|
williamr@2
|
131 |
/** Indicates that new buffer space is available on a service. */
|
williamr@2
|
132 |
virtual void CanSend() = 0;
|
williamr@2
|
133 |
/** Indicates that a connection attempt has completed successfully (for active opens).
|
williamr@2
|
134 |
|
williamr@2
|
135 |
There are four versions of this up-call: two are for active opens and two are for passive
|
williamr@2
|
136 |
opens. Both active and passive versions support a variant carrying user connection
|
williamr@2
|
137 |
data for protocols which support it.
|
williamr@2
|
138 |
|
williamr@2
|
139 |
@note A connection-less protocol should never call the ConnectComplete() up-calls.
|
williamr@2
|
140 |
@note A protocol should keep a count of sockets which have called ConnectComplete()
|
williamr@2
|
141 |
but have not had Start() called. Sockets in this state have their Error()
|
williamr@2
|
142 |
and NewData() calls deferred until Start() is called.*/
|
williamr@2
|
143 |
virtual void ConnectComplete() = 0;
|
williamr@2
|
144 |
/** Indicates that a connection attempt has completed successfully (for active opens).
|
williamr@2
|
145 |
|
williamr@2
|
146 |
There are four versions of this up-call: two are for active opens and two are for passive
|
williamr@2
|
147 |
opens. Both active and passive versions support a variant carrying user connection
|
williamr@2
|
148 |
data for protocols which support it.
|
williamr@2
|
149 |
|
williamr@2
|
150 |
@note A connection-less protocol should never call the ConnectComplete() up-calls.
|
williamr@2
|
151 |
@note A protocol should keep a count of sockets which have called ConnectComplete()
|
williamr@2
|
152 |
but have not had Start() called. Sockets in this state have their Error()
|
williamr@2
|
153 |
and NewData() calls deferred until Start() is called.
|
williamr@2
|
154 |
|
williamr@2
|
155 |
@param aConnectData Connect data (if supported).
|
williamr@2
|
156 |
*/
|
williamr@2
|
157 |
virtual void ConnectComplete(const TDesC8& aConnectData) = 0;
|
williamr@2
|
158 |
/** Indicates that a connection attempt has completed successfully (for passive opens).
|
williamr@2
|
159 |
|
williamr@2
|
160 |
There are four versions of this up-call: two are for active opens and two are for passive
|
williamr@2
|
161 |
opens. Both active and passive versions support a variant carrying user connection
|
williamr@2
|
162 |
data for protocols which support it.
|
williamr@2
|
163 |
|
williamr@2
|
164 |
The versions of ConnectComplete() for passive opens carry a new SSP (socket service
|
williamr@2
|
165 |
provider, or SAP) for the newly created socket. A new socket will then be linked up to
|
williamr@2
|
166 |
the SSP and data transfer can take place. The original socket stays listening.
|
williamr@2
|
167 |
|
williamr@2
|
168 |
@note A connection-less protocol should never call the ConnectComplete() up-calls.
|
williamr@2
|
169 |
@note A protocol should keep a count of sockets which have called ConnectComplete()
|
williamr@2
|
170 |
but have not had Start() called. Sockets in this state have their Error()
|
williamr@2
|
171 |
and NewData() calls deferred until Start() is called.
|
williamr@2
|
172 |
|
williamr@2
|
173 |
@param aSSP The new SSP for passive opens.
|
williamr@2
|
174 |
*/
|
williamr@2
|
175 |
virtual void ConnectComplete(CServProviderBase& aSSP) = 0;
|
williamr@2
|
176 |
/** Indicates that a connection attempt has completed successfully (for passive opens).
|
williamr@2
|
177 |
|
williamr@2
|
178 |
There are four versions of this up-call: two are for active opens and two are for passive
|
williamr@2
|
179 |
opens. Both active and passive versions support a variant carrying user connection
|
williamr@2
|
180 |
data for protocols which support it.
|
williamr@2
|
181 |
|
williamr@2
|
182 |
The versions of ConnectComplete() for passive opens carry a new SSP (socket service
|
williamr@2
|
183 |
provider, or SAP) for the newly created socket. A new socket will then be linked up to
|
williamr@2
|
184 |
the SSP and data transfer can take place. The original socket stays listening.
|
williamr@2
|
185 |
|
williamr@2
|
186 |
@note A connection-less protocol should never call the ConnectComplete() up-calls.
|
williamr@2
|
187 |
@note A protocol should keep a count of sockets which have called ConnectComplete()
|
williamr@2
|
188 |
but have not had Start() called. Sockets in this state have their Error()
|
williamr@2
|
189 |
and NewData() calls deferred until Start() is called.
|
williamr@2
|
190 |
|
williamr@2
|
191 |
@param aSSP The new SSP for passive opens.
|
williamr@2
|
192 |
@param aConnectData Connect data (if supported). */
|
williamr@2
|
193 |
virtual void ConnectComplete(CServProviderBase& aSSP,const TDesC8& aConnectData) = 0;
|
williamr@2
|
194 |
/** Indicates that the SAP has finished closing down.
|
williamr@2
|
195 |
|
williamr@2
|
196 |
This up-call is the response to a Shutdown(). A connection-oriented protocol should call
|
williamr@2
|
197 |
CanClose() when it has terminated communications with the remote host. Protocols can call
|
williamr@2
|
198 |
CanClose() from within their Shutdown() code. After CanClose() has been called, an SAP may
|
williamr@2
|
199 |
be deleted by the socket server.
|
williamr@2
|
200 |
|
williamr@2
|
201 |
@note The protocol must not access the CServProviderBase object after calling CanClose().
|
williamr@2
|
202 |
@param aDelete Delete SAP.
|
williamr@2
|
203 |
*/
|
williamr@2
|
204 |
virtual void CanClose(TDelete aDelete=EDelete) = 0;
|
williamr@2
|
205 |
/** Indicates that the SAP has finished closing down.
|
williamr@2
|
206 |
|
williamr@2
|
207 |
This up-call is the response to a Shutdown(). A connection-oriented protocol should call
|
williamr@2
|
208 |
CanClose() when it has terminated communications with the remote host. Protocols can call
|
williamr@2
|
209 |
CanClose() from within their Shutdown() code. After CanClose() has been called, an SAP may
|
williamr@2
|
210 |
be deleted by the socket server.
|
williamr@2
|
211 |
|
williamr@2
|
212 |
@note The protocol must not access the CServProviderBase object after calling CanClose().
|
williamr@2
|
213 |
@param aDisconnectData Any user data carried on the disconnect frame.
|
williamr@2
|
214 |
@param aDelete Delete SAP.
|
williamr@2
|
215 |
*/
|
williamr@2
|
216 |
virtual void CanClose(const TDesC8& aDisconnectData,TDelete aDelete=EDelete) = 0;
|
williamr@2
|
217 |
/** Tells the socket server that an error state has arisen within the protocol.
|
williamr@2
|
218 |
|
williamr@2
|
219 |
It should not be used to report programmatic errors, either in the protocol
|
williamr@2
|
220 |
itself or the socket server (a panic should be used in these cases). When
|
williamr@2
|
221 |
Error() is called on a connection-oriented socket, the socket is moved into
|
williamr@2
|
222 |
a dead state which denies user access to it.
|
williamr@2
|
223 |
|
williamr@2
|
224 |
@param anError KErrNone or another of the system-wide error codes.
|
williamr@2
|
225 |
@param anOperationMask A bitmask of TOperationBitmasks values specifying which
|
williamr@2
|
226 |
pending operations are affected by the Error up-call. */
|
williamr@2
|
227 |
virtual void Error(TInt anError,TUint anOperationMask=EErrorAllOperations) = 0;
|
williamr@2
|
228 |
/** Indicates that the other end of a connection has disconnected.
|
williamr@2
|
229 |
|
williamr@2
|
230 |
This is analogous to CanClose(), but in this case the other end initiated it.
|
williamr@2
|
231 |
|
williamr@2
|
232 |
Once the client has called Shutdown() it is illegal to call Disconnect(). Instead,
|
williamr@2
|
233 |
CanClose() or Error(KErrDisconnected) should be called.
|
williamr@2
|
234 |
*/
|
williamr@2
|
235 |
virtual void Disconnect(void) = 0;
|
williamr@2
|
236 |
/** Indicates that the other end of a connection has disconnected.
|
williamr@2
|
237 |
|
williamr@2
|
238 |
This is analogous to CanClose(), but in this case the other end initiated it.
|
williamr@2
|
239 |
|
williamr@2
|
240 |
Once the client has called Shutdown() it is illegal to call Disconnect(). Instead,
|
williamr@2
|
241 |
CanClose() or Error(KErrDisconnected) should be called.
|
williamr@2
|
242 |
|
williamr@2
|
243 |
@param aConnectData User data in the disconnect frame.
|
williamr@2
|
244 |
*/
|
williamr@2
|
245 |
virtual void Disconnect(TDesC8& aDisconnectData) = 0;
|
williamr@2
|
246 |
/** Indicates that the currently pending Ioctl has completed.
|
williamr@2
|
247 |
|
williamr@2
|
248 |
The parameter aBuf is protocol defined - in fact it is defined by the specific
|
williamr@2
|
249 |
Ioctl.
|
williamr@2
|
250 |
|
williamr@2
|
251 |
@param aBuf Any data requested by the Ioctl operation. */
|
williamr@2
|
252 |
virtual void IoctlComplete(TDesC8* aBuf) = 0;
|
williamr@2
|
253 |
|
williamr@2
|
254 |
/**
|
williamr@2
|
255 |
Indicates that there are no bearer available
|
williamr@2
|
256 |
|
williamr@2
|
257 |
@param aConnectionParams, the connection parameters.
|
williamr@2
|
258 |
*/
|
williamr@2
|
259 |
virtual void NoBearer(const TDesC8& aConnectionParams) = 0;
|
williamr@2
|
260 |
|
williamr@2
|
261 |
/**
|
williamr@2
|
262 |
Indicates the bearer available.
|
williamr@2
|
263 |
|
williamr@2
|
264 |
@param aConnectionInfo, Information about socket connection.
|
williamr@2
|
265 |
*/
|
williamr@2
|
266 |
virtual void Bearer(const TDesC8& aConnectionInfo) = 0;
|
williamr@2
|
267 |
|
williamr@2
|
268 |
/**
|
williamr@2
|
269 |
Indicates that this socket is now completed an asynchronous join
|
williamr@2
|
270 |
with a sub-connection. It now can use the properties of the sub-connection
|
williamr@2
|
271 |
*/
|
williamr@2
|
272 |
virtual void JoinedSubConnection() {;};
|
williamr@2
|
273 |
|
williamr@2
|
274 |
/**
|
williamr@2
|
275 |
Indicates that this socket was not able to complete an asynchronous join
|
williamr@2
|
276 |
with a sub-connection. The socket is still joined, but cannot use the
|
williamr@2
|
277 |
properties of the sub-connection
|
williamr@2
|
278 |
|
williamr@2
|
279 |
@param aError Reason the socket could not be joined
|
williamr@2
|
280 |
*/
|
williamr@2
|
281 |
virtual void SubConnectionJoinFailed(TInt /*aError*/) {;};
|
williamr@2
|
282 |
|
williamr@2
|
283 |
/**
|
williamr@2
|
284 |
Indicates that this socket has now completed an asynchronous leave
|
williamr@2
|
285 |
from a sub-connection. The socket is now connected to the sub-connection
|
williamr@2
|
286 |
anymore.
|
williamr@2
|
287 |
*/
|
williamr@2
|
288 |
virtual void LeftSubConnection() {;};
|
williamr@2
|
289 |
|
williamr@2
|
290 |
private:
|
williamr@2
|
291 |
};
|
williamr@2
|
292 |
|
williamr@2
|
293 |
|
williamr@2
|
294 |
class TNifProgress;
|
williamr@2
|
295 |
|
williamr@2
|
296 |
class MConnectionNotify
|
williamr@2
|
297 |
/**
|
williamr@2
|
298 |
* Callback interface from CConnectionProvdBase-derived classes
|
williamr@2
|
299 |
* @internalTechnology
|
williamr@2
|
300 |
*/
|
williamr@2
|
301 |
{
|
williamr@2
|
302 |
public:
|
williamr@2
|
303 |
virtual void SelectionComplete(TInt aError, const TDesC8& aSelectionInfo) = 0;
|
williamr@2
|
304 |
virtual void ConnectionError(TInt aError) = 0;
|
williamr@2
|
305 |
virtual void LinkLayerOpen(TInt aError) = 0;
|
williamr@2
|
306 |
virtual void LinkLayerClosed(TInt aError) = 0;
|
williamr@2
|
307 |
virtual void ProgressNotification(TInt aStage, TInt aError) = 0;
|
williamr@2
|
308 |
virtual void ProgressNotification(TSubConnectionUniqueId aSubConnectionUniqueId, TInt aStage, TInt aError) = 0;
|
williamr@2
|
309 |
virtual void ServiceChangeNotification(TUint32 aId, const TDesC& aType) = 0;
|
williamr@2
|
310 |
virtual void InterfaceStateChangeNotification(TDesC8& aInfo) = 0;
|
williamr@2
|
311 |
virtual void NotifyDataSent(TSubConnectionUniqueId aSubConnectionUniqueId, TUint aUplinkVolume) = 0;
|
williamr@2
|
312 |
virtual void NotifyDataReceived(TSubConnectionUniqueId aSubConnectionUniqueId, TUint aDownlinkVolume) = 0;
|
williamr@2
|
313 |
|
williamr@2
|
314 |
virtual void SubConnectionEvent(const TSubConnectionEvent& aSubConnectionEvent) = 0;
|
williamr@2
|
315 |
};
|
williamr@2
|
316 |
|
williamr@2
|
317 |
/**
|
williamr@2
|
318 |
@internalComponent
|
williamr@2
|
319 |
*/
|
williamr@2
|
320 |
enum TProtocolServiceInfo
|
williamr@2
|
321 |
{
|
williamr@2
|
322 |
ESocketSupport=0x00000001, ///< Can make sockets
|
williamr@2
|
323 |
ETransport=0x00000002, ///< Can act as a transport - ie can be bound to
|
williamr@2
|
324 |
EPreferMBufChains=0x00000004, ///< Will process MBufChains (I.e. won't convert them to descriptors)
|
williamr@2
|
325 |
EPreferDescriptors=0x00000008, ///< Will process Descriptors (I.e. won't convert them to MBufChains)
|
williamr@2
|
326 |
ECantProcessMBufChains=0x00000010, ///< Will Panic if asked to process an MBufChain
|
williamr@2
|
327 |
ENeedMBufs=0x00000020, ///< Uses MBufChains internally.
|
williamr@2
|
328 |
EUseCanSend=0x00000040, ///< Uses the inter-protocol CanSend upcall.
|
williamr@2
|
329 |
EInterface=0x00000080, ///< Is a CInterfaceBase rather than CProtocolBase
|
williamr@2
|
330 |
};
|
williamr@2
|
331 |
|
williamr@2
|
332 |
/**
|
williamr@2
|
333 |
@internalTechnology
|
williamr@2
|
334 |
*/
|
williamr@2
|
335 |
enum TProtocolType
|
williamr@2
|
336 |
{
|
williamr@2
|
337 |
ENormalProtocol, ///< Normal protocol
|
williamr@2
|
338 |
EInterfaceProtocol ///< Has EInterface flags set and supports GetBinderL()
|
williamr@2
|
339 |
};
|
williamr@2
|
340 |
|
williamr@2
|
341 |
/**
|
williamr@2
|
342 |
@internalComponent
|
williamr@2
|
343 |
*/
|
williamr@2
|
344 |
const TInt KUnlimitedSockets=-1;
|
williamr@2
|
345 |
|
williamr@2
|
346 |
struct TServerProtocolDesc : public TProtocolDesc
|
williamr@2
|
347 |
/**
|
williamr@2
|
348 |
Contains data that describes a particular protocol.
|
williamr@2
|
349 |
@publishedPartner
|
williamr@2
|
350 |
@released
|
williamr@2
|
351 |
|
williamr@2
|
352 |
@see CProtocolFamilyBase::ProtocolList().
|
williamr@2
|
353 |
*/
|
williamr@2
|
354 |
{
|
williamr@2
|
355 |
TInt iServiceTypeInfo; ///< Set this to 1 if the protocol supports socket creation
|
williamr@2
|
356 |
TInt iNumSockets; ///< The maximum number of SSPs the protocol supports
|
williamr@2
|
357 |
};
|
williamr@2
|
358 |
|
williamr@2
|
359 |
|
williamr@2
|
360 |
class MResolverNotify
|
williamr@2
|
361 |
/**
|
williamr@2
|
362 |
@publishedPartner
|
williamr@2
|
363 |
@released
|
williamr@2
|
364 |
*/
|
williamr@2
|
365 |
{
|
williamr@2
|
366 |
public:
|
williamr@2
|
367 |
virtual void QueryComplete(TInt anError)=0;
|
williamr@2
|
368 |
};
|
williamr@2
|
369 |
|
williamr@2
|
370 |
/** Ensure that the requested length for datagrams is bigger than any real one. This ensures that
|
williamr@2
|
371 |
naive providers deliver them without truncation, so allowing the client to perform continuation reads.
|
williamr@2
|
372 |
@internalTechnology
|
williamr@2
|
373 |
*/
|
williamr@2
|
374 |
const TUint KGetDataWholeDatagram = 0x40000000;
|
williamr@2
|
375 |
|
williamr@2
|
376 |
/**
|
williamr@2
|
377 |
Security checker class passed down to providers which is used to perform security checks on the client
|
williamr@2
|
378 |
of the provider. The provider calls the CheckPolicy(...) method with a suitable TSecurityPolicy
|
williamr@2
|
379 |
class and a diagnostic string as arguments.
|
williamr@2
|
380 |
|
williamr@2
|
381 |
@see CServProviderBase
|
williamr@2
|
382 |
@see CResolverProvdBase
|
williamr@2
|
383 |
|
williamr@2
|
384 |
@code
|
williamr@2
|
385 |
_LIT_SECURITY_POLICY_C1(myPolicy1, ECapabilityNetworkServices);
|
williamr@2
|
386 |
...
|
williamr@2
|
387 |
TInt CMyProvider::SecurityCheck(MProvdSecurityChecker *aChecker)
|
williamr@2
|
388 |
{
|
williamr@2
|
389 |
...
|
williamr@2
|
390 |
if (aChecker->CheckPolicy(myPolicy1, "CMyProvider main") == KErrNone)
|
williamr@2
|
391 |
{
|
williamr@2
|
392 |
// client has NetworkServices capability
|
williamr@2
|
393 |
}
|
williamr@2
|
394 |
...
|
williamr@2
|
395 |
}
|
williamr@2
|
396 |
@endcode
|
williamr@2
|
397 |
|
williamr@2
|
398 |
@publishedPartner
|
williamr@2
|
399 |
@released
|
williamr@2
|
400 |
*/
|
williamr@2
|
401 |
class MProvdSecurityChecker
|
williamr@2
|
402 |
{
|
williamr@2
|
403 |
public:
|
williamr@2
|
404 |
/**
|
williamr@2
|
405 |
Check the security policy of a client process.
|
williamr@2
|
406 |
|
williamr@2
|
407 |
Called from a socket or resolver provider to check whether the client process conforms to a security policy.
|
williamr@2
|
408 |
|
williamr@2
|
409 |
@param aPolicy A TSecurityPolicy class instance containing the security information to be checked against the client.
|
williamr@2
|
410 |
@param aDiagnostic A diagnostic string used when logging system-wide security failures, else 0.
|
williamr@2
|
411 |
@return KErrNone if client process has the required security information, else KErrPermissionDenied.
|
williamr@2
|
412 |
(In the future, some other system error may be returned).
|
williamr@2
|
413 |
*/
|
williamr@2
|
414 |
virtual TInt CheckPolicy(const TSecurityPolicy& aPolicy, const char *aDiagnostic) = 0;
|
williamr@2
|
415 |
};
|
williamr@2
|
416 |
|
williamr@2
|
417 |
class RMBufChain;
|
williamr@2
|
418 |
class CSubConnectionProviderBase;
|
williamr@2
|
419 |
class CServProviderBase : public CBase
|
williamr@2
|
420 |
/** Service Access Point.
|
williamr@2
|
421 |
|
williamr@2
|
422 |
Provides transport services to a single protocol. Several of the calls to
|
williamr@2
|
423 |
CServProviderBase have pre-conditions attached to them - for example
|
williamr@2
|
424 |
a connection oriented protocol must have its local address set (either by
|
williamr@2
|
425 |
a SetLocalName() or AutoBind()) before it is opened. If the socket server
|
williamr@2
|
426 |
calls the CServProviderBase in such an erroneous way, the protocol should panic.
|
williamr@2
|
427 |
|
williamr@2
|
428 |
@publishedPartner
|
williamr@2
|
429 |
@released Since 5.0 */
|
williamr@2
|
430 |
{
|
williamr@2
|
431 |
friend class ProtocolManager;
|
williamr@2
|
432 |
public:
|
williamr@2
|
433 |
|
williamr@2
|
434 |
/** Describes the behaviour the SAP should take on shutdown.*/
|
williamr@2
|
435 |
enum TCloseType
|
williamr@2
|
436 |
{
|
williamr@2
|
437 |
ENormal, ///< The protocol should shutdown gracefully — no further input or output will be requested.
|
williamr@2
|
438 |
EStopInput, ///< The protocol should shut down gracefully — all further and pending input should be discarded.
|
williamr@2
|
439 |
EStopOutput, ///< The protocol should shutdown gracefully — all pending output should be discarded.
|
williamr@2
|
440 |
EImmediate ///< The protocol should close the connection immediately and free all resources without performing a graceful disconnect.
|
williamr@2
|
441 |
};
|
williamr@2
|
442 |
IMPORT_C CServProviderBase();
|
williamr@2
|
443 |
IMPORT_C virtual ~CServProviderBase();
|
williamr@2
|
444 |
|
williamr@2
|
445 |
IMPORT_C virtual void SetNotify(MSocketNotify* aSocket);
|
williamr@2
|
446 |
//V1.0 itf support
|
williamr@2
|
447 |
IMPORT_C virtual void SetSockType(TUint aSockType);
|
williamr@2
|
448 |
IMPORT_C TUint SockType() const;
|
williamr@2
|
449 |
|
williamr@2
|
450 |
IMPORT_C virtual void JoinSubConnectionL(CSubConnectionProviderBase& aSubConnProvider);
|
williamr@2
|
451 |
IMPORT_C virtual void LeaveSubConnection(CSubConnectionProviderBase& aSubConnProvider);
|
williamr@2
|
452 |
|
williamr@2
|
453 |
public:
|
williamr@2
|
454 |
|
williamr@2
|
455 |
/**
|
williamr@2
|
456 |
pure virtual
|
williamr@2
|
457 |
*/
|
williamr@2
|
458 |
/**
|
williamr@2
|
459 |
Start a service provider.
|
williamr@2
|
460 |
*/
|
williamr@2
|
461 |
virtual void Start()=0;
|
williamr@2
|
462 |
/** Gets the local name (address) of the socket service provider entity. The format
|
williamr@2
|
463 |
of the data in the TSockAddr object is defined by individual protocols.
|
williamr@2
|
464 |
|
williamr@2
|
465 |
The local address is the address of the local machine plus a local port number.
|
williamr@2
|
466 |
Generally only the port number is important, unless you have two IP interfaces,
|
williamr@2
|
467 |
for example.
|
williamr@2
|
468 |
|
williamr@2
|
469 |
@param anAddr The address to be filled in */
|
williamr@2
|
470 |
virtual void LocalName(TSockAddr& anAddr) const =0;
|
williamr@2
|
471 |
/** Sets the local name (address) of the socket service provider entity. The format
|
williamr@2
|
472 |
of the data in the TSockAddr object is defined by individual protocols.
|
williamr@2
|
473 |
|
williamr@2
|
474 |
@param anAddr The address
|
williamr@2
|
475 |
@return Returns KErrNone if the local name is correctly set or, if this is
|
williamr@2
|
476 |
not the case, an informative error number. */
|
williamr@2
|
477 |
virtual TInt SetLocalName(TSockAddr& anAddr)=0;
|
williamr@2
|
478 |
/** Gets the remote name (address) of the socket service provider entity. The format
|
williamr@2
|
479 |
of the data in the TSockAddr object is defined by individual protocols.
|
williamr@2
|
480 |
|
williamr@2
|
481 |
A remote address is either the address you're sending data to (non connection-oriented
|
williamr@2
|
482 |
sockets)* or the remote end of the connection. It is the address of the remote
|
williamr@2
|
483 |
machine (your peer in the network) plus a port number.
|
williamr@2
|
484 |
|
williamr@2
|
485 |
@note RemName is only meaningful if the socket server client has called Connect()
|
williamr@2
|
486 |
to set up a default address for SendTo(). This function will only be called
|
williamr@2
|
487 |
on the protocol if this is the case.
|
williamr@2
|
488 |
|
williamr@2
|
489 |
@param anAddr The address to be filled in */
|
williamr@2
|
490 |
virtual void RemName(TSockAddr& anAddr) const =0;
|
williamr@2
|
491 |
/** Sets the remote name (address) of the socket service provider entity. The format
|
williamr@2
|
492 |
of the data in the TSockAddr object is defined by individual protocols.
|
williamr@2
|
493 |
|
williamr@2
|
494 |
@param anAddr The address
|
williamr@2
|
495 |
@return Returns KErrNone if the remote name is correctly set or, if this is
|
williamr@2
|
496 |
not the case, an informative error number. */
|
williamr@2
|
497 |
virtual TInt SetRemName(TSockAddr& anAddr)=0;
|
williamr@2
|
498 |
/** Gets some protocol specific option when called by the socket server on behalf of a
|
williamr@2
|
499 |
client. A protocol may pass the request down a protocol stack (to protocols it is bound
|
williamr@2
|
500 |
to) using the GetOption() function of CProtocolBase.
|
williamr@2
|
501 |
|
williamr@2
|
502 |
@param aLevel Option level.
|
williamr@2
|
503 |
@param aName Option name.
|
williamr@2
|
504 |
@param anOption Option data.
|
williamr@2
|
505 |
@return System wide error code.
|
williamr@2
|
506 |
*/
|
williamr@2
|
507 |
virtual TInt GetOption(TUint level,TUint name,TDes8& anOption)const =0;
|
williamr@2
|
508 |
/** Performs some protocol specific IO control.
|
williamr@2
|
509 |
|
williamr@2
|
510 |
@note If this function is called erroneously, the protocol should call Error() on the
|
williamr@2
|
511 |
socket. If an Ioctl call is already outstanding, the client will be panicked with the
|
williamr@2
|
512 |
value ETwoIoctls.
|
williamr@2
|
513 |
|
williamr@2
|
514 |
@param aLevel Option level.
|
williamr@2
|
515 |
@param aName Option name.
|
williamr@2
|
516 |
@param anOption Option data.
|
williamr@2
|
517 |
@return System wide error code.
|
williamr@2
|
518 |
*/
|
williamr@2
|
519 |
virtual void Ioctl(TUint level,TUint name,TDes8* anOption)=0;
|
williamr@2
|
520 |
/** Cancels an outstanding Ioctl call. You are guaranteed only to have one outstanding
|
williamr@2
|
521 |
at once.
|
williamr@2
|
522 |
|
williamr@2
|
523 |
@param aLevel IOCTL level.
|
williamr@2
|
524 |
@param aName IOCTL name.
|
williamr@2
|
525 |
*/
|
williamr@2
|
526 |
virtual void CancelIoctl(TUint aLevel,TUint aName)=0;
|
williamr@2
|
527 |
/** Sets some protocol specific option when called by the socket server on behalf of a
|
williamr@2
|
528 |
client. A protocol may pass the request down a protocol stack (to protocols it is bound
|
williamr@2
|
529 |
to) using the SetOption() function of CProtocolBase.
|
williamr@2
|
530 |
|
williamr@2
|
531 |
@param aLevel Option level.
|
williamr@2
|
532 |
@param aName Option name.
|
williamr@2
|
533 |
@param anOption Option data.
|
williamr@2
|
534 |
@return System wide error code.
|
williamr@2
|
535 |
*/
|
williamr@2
|
536 |
virtual TInt SetOption(TUint level,TUint name,const TDesC8& anOption)=0;
|
williamr@2
|
537 |
virtual void ActiveOpen()=0;
|
williamr@2
|
538 |
/** Initiates a connection operation - this means that it tells the protocol to
|
williamr@2
|
539 |
attempt to connect to a peer. It is called by the socket server in response
|
williamr@2
|
540 |
to a connect request from a client.
|
williamr@2
|
541 |
|
williamr@2
|
542 |
This version of the function has user data in the connection frame.
|
williamr@2
|
543 |
|
williamr@2
|
544 |
Only ever called on connection-oriented sockets. Such a socket
|
williamr@2
|
545 |
should always have both the local address and the remote address specified
|
williamr@2
|
546 |
before this function is called. If this is not the case then the protocol
|
williamr@2
|
547 |
should panic.
|
williamr@2
|
548 |
|
williamr@2
|
549 |
When a connection has completed, the protocol should call ConnectComplete()
|
williamr@2
|
550 |
on its TNotify. If an error occurs during connection the protocol should not
|
williamr@2
|
551 |
call ConnectComplete() at all; instead it should call Error().
|
williamr@2
|
552 |
|
williamr@2
|
553 |
@param aConnectionData If the protocol supports user specified connection
|
williamr@2
|
554 |
data, then it will be held in this buffer. */
|
williamr@2
|
555 |
virtual void ActiveOpen(const TDesC8& aConnectionData)=0;
|
williamr@2
|
556 |
/** Tells the protocol to start waiting for an incoming connection request on this
|
williamr@2
|
557 |
socket (i.e. port). It is called by the socket server in response to a listen
|
williamr@2
|
558 |
request from a client.
|
williamr@2
|
559 |
|
williamr@2
|
560 |
Only ever called on connection-oriented sockets. Such a socket
|
williamr@2
|
561 |
should always have both the local address and the remote address specified
|
williamr@2
|
562 |
before this function is called. If this is not the case, then the protocol
|
williamr@2
|
563 |
should panic.
|
williamr@2
|
564 |
|
williamr@2
|
565 |
The aQue parameter is the number of sockets which can be waiting for an outstanding
|
williamr@2
|
566 |
Start after calling ConnectComplete(). The protocol should keep a count of
|
williamr@2
|
567 |
sockets in this state - incrementing a variable in ConnectComplete(), and
|
williamr@2
|
568 |
decrementing it in Start().
|
williamr@2
|
569 |
|
williamr@2
|
570 |
When a connection has completed, the protocol should call ConnectComplete()
|
williamr@2
|
571 |
on its TNotify. If an error occurs during connection the protocol should not
|
williamr@2
|
572 |
call ConnectComplete() at all; instead it should call Error().
|
williamr@2
|
573 |
|
williamr@2
|
574 |
@param aQueSize Size of connect queue.
|
williamr@2
|
575 |
*/
|
williamr@2
|
576 |
virtual TInt PassiveOpen(TUint aQueSize)=0;
|
williamr@2
|
577 |
/** Tells the protocol to start waiting for an incoming connection request on this
|
williamr@2
|
578 |
socket (i.e. port). It is called by the socket server in response to a listen
|
williamr@2
|
579 |
request from a client.
|
williamr@2
|
580 |
|
williamr@2
|
581 |
This version of the function has user data in the connection frame.
|
williamr@2
|
582 |
|
williamr@2
|
583 |
Only ever called on connection-oriented sockets. Such a socket
|
williamr@2
|
584 |
should always have both the local address and the remote address specified
|
williamr@2
|
585 |
before this function is called. If this is not the case then the protocol
|
williamr@2
|
586 |
should panic.
|
williamr@2
|
587 |
|
williamr@2
|
588 |
The aQue parameter is the number of sockets which can be waiting for an outstanding
|
williamr@2
|
589 |
Start after calling ConnectComplete(). The protocol should keep a count of
|
williamr@2
|
590 |
sockets in this state - incrementing a variable in ConnectComplete(), and
|
williamr@2
|
591 |
decrementing it in Start().
|
williamr@2
|
592 |
|
williamr@2
|
593 |
When a connection has completed the protocol should call ConnectComplete()
|
williamr@2
|
594 |
on its TNotify. If an error occurs during connection the protocol should not
|
williamr@2
|
595 |
call ConnectComplete() at all; instead it should call Error().
|
williamr@2
|
596 |
|
williamr@2
|
597 |
@param aQueSize size of connect queue
|
williamr@2
|
598 |
@param aConnectionData if the protocol supports user specified connection data
|
williamr@2
|
599 |
then it will be held in this buffer. */
|
williamr@2
|
600 |
virtual TInt PassiveOpen(TUint aQueSize,const TDesC8& aConnectionData)=0;
|
williamr@2
|
601 |
/** Terminates a connection (or closes a non connection-oriented socket down).
|
williamr@2
|
602 |
|
williamr@2
|
603 |
The value of the option argument specifies the type of processing which will
|
williamr@2
|
604 |
be required of the protocol after this function is called.
|
williamr@2
|
605 |
|
williamr@2
|
606 |
Normally, when the socket server has called Shutdown() for a socket, it will
|
williamr@2
|
607 |
wait for the socket to call CanClose() before destroying the CServProviderBase
|
williamr@2
|
608 |
object. However, if the option argument is EImmediate, the CServProviderBase
|
williamr@2
|
609 |
will be destroyed as soon as Shutdown() returns.
|
williamr@2
|
610 |
|
williamr@2
|
611 |
@param option The shutdown type. */
|
williamr@2
|
612 |
virtual void Shutdown(TCloseType option)=0;
|
williamr@2
|
613 |
/** Terminates a connection (or closes a non connection-oriented socket down).
|
williamr@2
|
614 |
|
williamr@2
|
615 |
The value of the option argument specifies the type of processing which will
|
williamr@2
|
616 |
be required of the protocol after this function is called.
|
williamr@2
|
617 |
|
williamr@2
|
618 |
Normally, when the socket server has called Shutdown() for a socket, it will
|
williamr@2
|
619 |
wait for the socket to call CanClose() before destroying the CServProviderBase
|
williamr@2
|
620 |
object. However, if the option argument is EImmediate, the CServProviderBase
|
williamr@2
|
621 |
will be destroyed as soon as Shutdown() returns.
|
williamr@2
|
622 |
|
williamr@2
|
623 |
@param option The shutdown type.
|
williamr@2
|
624 |
@param aDisconnectionData If the protocol supports disconnect data, any such
|
williamr@2
|
625 |
data required will be held in this buffer. */
|
williamr@2
|
626 |
virtual void Shutdown(TCloseType option,const TDesC8& aDisconnectionData)=0;
|
williamr@2
|
627 |
/** Specifies that the protocol should choose a local address for the service access
|
williamr@2
|
628 |
point itself. */
|
williamr@2
|
629 |
virtual void AutoBind()=0;
|
williamr@2
|
630 |
|
williamr@2
|
631 |
// protocol read/write data; ESock v1.5 calls down to the v1.5 itf (RMBufChain).
|
williamr@2
|
632 |
// v1.5-ready protocols implement this, laggard protocols inherit these base class
|
williamr@2
|
633 |
// implementations which call the v1.0 descriptor itf instead.
|
williamr@2
|
634 |
|
williamr@2
|
635 |
/** Sends data onto the network via the protocol.
|
williamr@2
|
636 |
|
williamr@2
|
637 |
Connection-oriented sockets must be in a connected state (that is ConnectComplete() has
|
williamr@2
|
638 |
been called on their MSocketNotify before Write() is called).
|
williamr@2
|
639 |
|
williamr@2
|
640 |
The socket server keeps track of how much data is waiting and then tries to send it all
|
williamr@2
|
641 |
until the protocol tells it to hold off by returning 0 (datagram sockets) or 'less than
|
williamr@2
|
642 |
all data consumed' (stream sockets) to Write(). The protocol should call CanSend() when it
|
williamr@2
|
643 |
is ready to send more data.
|
williamr@2
|
644 |
|
williamr@2
|
645 |
anAddr is the address to write the data to. Connection oriented sockets always use the
|
williamr@2
|
646 |
default value.
|
williamr@2
|
647 |
|
williamr@2
|
648 |
@param aDesc The data to be sent.
|
williamr@2
|
649 |
@param aOptions Protocol specific options.
|
williamr@2
|
650 |
@param anAddr Address to write the data to.
|
williamr@2
|
651 |
|
williamr@2
|
652 |
@returns For stream-oriented protocols the return value is the number of bytes actually written.
|
williamr@2
|
653 |
If this is less than the length of the descriptor then the protocol should call CanSend()
|
williamr@2
|
654 |
when it is ready to send more data. For datagram-oriented protocols, the write should return
|
williamr@2
|
655 |
either 0 if the write cannot be completed, or the length of the descriptor if the write succeeds -
|
williamr@2
|
656 |
no other values are valid. If the Write() must return 0, then it should call CanSend() when it is
|
williamr@2
|
657 |
ready to send more data. If the Write() fails due to some error, then it should call Error() with
|
williamr@2
|
658 |
an informative error number.
|
williamr@2
|
659 |
*/
|
williamr@2
|
660 |
IMPORT_C virtual TUint Write(const TDesC8& aDesc,TUint options, TSockAddr* anAddr=NULL);
|
williamr@2
|
661 |
/** Sends data onto the network via the protocol.
|
williamr@2
|
662 |
|
williamr@2
|
663 |
Connection-oriented sockets must be in a connected state (that is ConnectComplete() has
|
williamr@2
|
664 |
been called on their MSocketNotify before Write() is called).
|
williamr@2
|
665 |
|
williamr@2
|
666 |
The socket server keeps track of how much data is waiting and then tries to send it all
|
williamr@2
|
667 |
until the protocol tells it to hold off by returning 0 (datagram sockets) or 'less than
|
williamr@2
|
668 |
all data consumed' (stream sockets) to Write(). The protocol should call CanSend() when it
|
williamr@2
|
669 |
is ready to send more data.
|
williamr@2
|
670 |
|
williamr@2
|
671 |
anAddr is the address to write the data to. Connection oriented sockets always use the
|
williamr@2
|
672 |
default value.
|
williamr@2
|
673 |
|
williamr@2
|
674 |
@param aData The data to be sent.
|
williamr@2
|
675 |
@param aOptions Protocol specific options.
|
williamr@2
|
676 |
@param anAddr Address to write the data to.
|
williamr@2
|
677 |
|
williamr@2
|
678 |
@returns For stream-oriented protocols the return value is the number of bytes actually written.
|
williamr@2
|
679 |
If this is less than the length of the descriptor then the protocol should call CanSend()
|
williamr@2
|
680 |
when it is ready to send more data. For datagram-oriented protocols, the write should return
|
williamr@2
|
681 |
either 0 if the write cannot be completed, or the length of the descriptor if the write succeeds -
|
williamr@2
|
682 |
no other values are valid. If the Write() must return 0, then it should call CanSend() when it is
|
williamr@2
|
683 |
ready to send more data. If the Write() fails due to some error, then it should call Error() with
|
williamr@2
|
684 |
an informative error number.
|
williamr@2
|
685 |
*/
|
williamr@2
|
686 |
IMPORT_C virtual TInt Write(RMBufChain& aData, TUint aOptions, TSockAddr* anAddr=NULL);
|
williamr@2
|
687 |
|
williamr@2
|
688 |
/** Gets data which the protocol has indicated is waiting in its buffers using the NewData
|
williamr@2
|
689 |
up-call on the MSocketNotify.
|
williamr@2
|
690 |
|
williamr@2
|
691 |
GetData() will only ever be called for as much data as the protocol has specified it can process
|
williamr@2
|
692 |
using the NewData up-call.
|
williamr@2
|
693 |
|
williamr@2
|
694 |
For stream oriented protocols GetData() should fill the descriptor with data from the stream. On
|
williamr@2
|
695 |
a datagram protocol GetData() should copy one datagram into the descriptor and set the length of
|
williamr@2
|
696 |
the descriptor. If a full datagram will not fit into the supplied descriptor, the overflow should
|
williamr@2
|
697 |
be discarded.
|
williamr@2
|
698 |
|
williamr@2
|
699 |
anAddr should be filled in by the protocol with the address of where the data came from.
|
williamr@2
|
700 |
|
williamr@2
|
701 |
@param aDesc The buffer for data.
|
williamr@2
|
702 |
@param aOptions Protocol specific options.
|
williamr@2
|
703 |
@param anAddr Address where the data came from.
|
williamr@2
|
704 |
*/
|
williamr@2
|
705 |
IMPORT_C virtual void GetData(TDes8& aDesc,TUint options,TSockAddr* anAddr=NULL);
|
williamr@2
|
706 |
/** Gets data which the protocol has indicated is waiting in its buffers using the NewData
|
williamr@2
|
707 |
up-call on the MSocketNotify.
|
williamr@2
|
708 |
|
williamr@2
|
709 |
GetData() will only ever be called for as much data as the protocol has specified it can process
|
williamr@2
|
710 |
using the NewData up-call.
|
williamr@2
|
711 |
|
williamr@2
|
712 |
For stream oriented protocols GetData() should fill the descriptor with data from the stream. On
|
williamr@2
|
713 |
a datagram protocol GetData() should copy one datagram into the descriptor and set the length of
|
williamr@2
|
714 |
the descriptor. If a full datagram will not fit into the supplied descriptor, the overflow should
|
williamr@2
|
715 |
be discarded.
|
williamr@2
|
716 |
|
williamr@2
|
717 |
anAddr should be filled in by the protocol with the address of where the data came from.
|
williamr@2
|
718 |
|
williamr@2
|
719 |
@param aDesc The buffer for data.
|
williamr@2
|
720 |
@param aOptions Protocol specific options.
|
williamr@2
|
721 |
@param anAddr Address where the data came from.
|
williamr@2
|
722 |
*/
|
williamr@2
|
723 |
IMPORT_C virtual TInt GetData(RMBufChain& aData, TUint aLength, TUint aOptions, TSockAddr* anAddr=NULL);
|
williamr@2
|
724 |
|
williamr@2
|
725 |
/** Use the class instance argument to perform security policy checks on the originating client process.
|
williamr@2
|
726 |
|
williamr@2
|
727 |
This method is called when a SAP is created and when a socket is transferred between sessions. The SAP is
|
williamr@2
|
728 |
required to check whether the originating client process has enough privileges to request services from the SAP.
|
williamr@2
|
729 |
The MProvdSecurityChecker class instance is used to perform security policy checks. The SAP may choose
|
williamr@2
|
730 |
to perform a security policy check in its SecurityCheck(...) method, or it may choose to store the
|
williamr@2
|
731 |
MProvdSecurityChecker class instance argument and perform checking later (i.e. when subsequent
|
williamr@2
|
732 |
SAP methods are called).
|
williamr@2
|
733 |
|
williamr@2
|
734 |
@param aSecurityChecker Pointer to class used by SAP to perform security checks on the client process. This
|
williamr@2
|
735 |
pointer becomes invalid when the SAP is destroyed or detached.
|
williamr@2
|
736 |
@returns KErrPermissionDenied if SAP wishes to disallow access to the client, else KErrNone. This would
|
williamr@2
|
737 |
normally be as a result of calling MProvdSecurityChecker::CheckPolicy(...) with a suitable security policy argument.
|
williamr@2
|
738 |
*/
|
williamr@2
|
739 |
IMPORT_C virtual TInt SecurityCheck(MProvdSecurityChecker *aSecurityChecker);
|
williamr@2
|
740 |
|
williamr@2
|
741 |
protected:
|
williamr@2
|
742 |
/** On socket creation, the socket server sets this member to point to a server
|
williamr@2
|
743 |
notification interface. */
|
williamr@2
|
744 |
MSocketNotify* iSocket;
|
williamr@2
|
745 |
private:
|
williamr@2
|
746 |
//V1.0 interface support specifics
|
williamr@2
|
747 |
HBufC8* iV1ShimDataIn;
|
williamr@2
|
748 |
HBufC8* iV1ShimDataOut;
|
williamr@2
|
749 |
TUint iSockType;
|
williamr@2
|
750 |
};
|
williamr@2
|
751 |
|
williamr@2
|
752 |
class CProtocolBase;
|
williamr@2
|
753 |
class CResolverProvdBase : public CBase
|
williamr@2
|
754 |
/**
|
williamr@2
|
755 |
@publishedPartner
|
williamr@2
|
756 |
@released
|
williamr@2
|
757 |
*/
|
williamr@2
|
758 |
{
|
williamr@2
|
759 |
friend class ProtocolManager;
|
williamr@2
|
760 |
public:
|
williamr@2
|
761 |
inline void SetNotify(MResolverNotify* aNotifier);
|
williamr@2
|
762 |
|
williamr@2
|
763 |
/**
|
williamr@2
|
764 |
@internalComponent
|
williamr@2
|
765 |
*/
|
williamr@2
|
766 |
virtual void CancelCurrentOperation()=0;
|
williamr@2
|
767 |
|
williamr@2
|
768 |
/** Use the class instance argument to perform security policy checks on the originating client process.
|
williamr@2
|
769 |
|
williamr@2
|
770 |
This method is called when a resolver is created. The resolver is required to check whether the originating
|
williamr@2
|
771 |
client process has enough privileges to request services from the resolver. The MProvdSecurityChecker
|
williamr@2
|
772 |
class instance is used to perform security policy checks. The resolver may choose to perform a security
|
williamr@2
|
773 |
policy check in its SecurityCheck(...) method, or it may choose to store the MProvdSecurityChecker class
|
williamr@2
|
774 |
instance argument and use it to perform checking later (i.e. when subsequent resolver methods are called).
|
williamr@2
|
775 |
|
williamr@2
|
776 |
@param aSecurityChecker Pointer to class used by resolver to perform security checks on the client process. This
|
williamr@2
|
777 |
pointer becomes invalid when the resolver is destroyed or detached.
|
williamr@2
|
778 |
@returns KErrPermissionDenied if resolver wishes to disallow access to the client, else KErrNone. This would
|
williamr@2
|
779 |
normally be as a result of calling MProvdSecurityChecker::CheckPolicy(...) with a suitable security policy argument.
|
williamr@2
|
780 |
*/
|
williamr@2
|
781 |
IMPORT_C virtual TInt SecurityCheck(MProvdSecurityChecker *aSecurityChecker);
|
williamr@2
|
782 |
|
williamr@2
|
783 |
protected:
|
williamr@2
|
784 |
MResolverNotify* iNotify;
|
williamr@2
|
785 |
private:
|
williamr@2
|
786 |
CProtocolBase* iProtocol;
|
williamr@2
|
787 |
};
|
williamr@2
|
788 |
|
williamr@2
|
789 |
class CHostResolvProvdBase : public CResolverProvdBase
|
williamr@2
|
790 |
/**
|
williamr@2
|
791 |
Provides Host name resolver service
|
williamr@2
|
792 |
@publishedPartner
|
williamr@2
|
793 |
@released
|
williamr@2
|
794 |
*/
|
williamr@2
|
795 |
{
|
williamr@2
|
796 |
friend class ProtocolManager;
|
williamr@2
|
797 |
public:
|
williamr@2
|
798 |
|
williamr@2
|
799 |
/**
|
williamr@2
|
800 |
Get the Host name by name
|
williamr@2
|
801 |
@param aName, results of name queries
|
williamr@2
|
802 |
*/
|
williamr@2
|
803 |
virtual void GetByName(TNameRecord& aName)=0;
|
williamr@2
|
804 |
|
williamr@2
|
805 |
/**
|
williamr@2
|
806 |
Gets the Host name by address
|
williamr@2
|
807 |
@param aName, results of name queries
|
williamr@2
|
808 |
*/
|
williamr@2
|
809 |
virtual void GetByAddress(TNameRecord& aName)=0;
|
williamr@2
|
810 |
|
williamr@2
|
811 |
/**
|
williamr@2
|
812 |
Sets the Host name
|
williamr@2
|
813 |
@param aNameBuf, name to set
|
williamr@2
|
814 |
*/
|
williamr@2
|
815 |
virtual void SetHostName(TDes& aNameBuf)=0;
|
williamr@2
|
816 |
|
williamr@2
|
817 |
/**
|
williamr@2
|
818 |
Gets the Host name
|
williamr@2
|
819 |
@param aNameBuf, name to retrieve
|
williamr@2
|
820 |
*/
|
williamr@2
|
821 |
virtual void GetHostName(TDes& aNameBuf)=0;
|
williamr@2
|
822 |
IMPORT_C virtual TInt SetOption(TUint level,TUint name,const TDesC8& anOption);
|
williamr@2
|
823 |
IMPORT_C virtual void Query(const TDesC8& aQryBuf, TDes8& aResBuf, TInt aCounter);
|
williamr@2
|
824 |
};
|
williamr@2
|
825 |
|
williamr@2
|
826 |
class CServiceResolvProvdBase : public CResolverProvdBase
|
williamr@2
|
827 |
/**
|
williamr@2
|
828 |
@publishedPartner
|
williamr@2
|
829 |
@released
|
williamr@2
|
830 |
*/
|
williamr@2
|
831 |
{
|
williamr@2
|
832 |
friend class ProtocolManager;
|
williamr@2
|
833 |
public:
|
williamr@2
|
834 |
|
williamr@2
|
835 |
/**
|
williamr@2
|
836 |
Get the Host name by name
|
williamr@2
|
837 |
@param aName, results of name queries
|
williamr@2
|
838 |
*/
|
williamr@2
|
839 |
virtual void GetByName(const TDesC& aNameBuf,TInt32& aPortNum)=0;
|
williamr@2
|
840 |
|
williamr@2
|
841 |
/**
|
williamr@2
|
842 |
Gets the Host name by address
|
williamr@2
|
843 |
@param aName, results of name queries
|
williamr@2
|
844 |
*/
|
williamr@2
|
845 |
virtual void GetByNumber(TDes& aNameBuf,TInt32 aPortNum)=0;
|
williamr@2
|
846 |
|
williamr@2
|
847 |
/**
|
williamr@2
|
848 |
Sets the Host name
|
williamr@2
|
849 |
@param aNameBuf, name to set
|
williamr@2
|
850 |
*/
|
williamr@2
|
851 |
virtual void RegisterService(const TDesC& aNameBuf,TInt32 aPortNum)=0;
|
williamr@2
|
852 |
|
williamr@2
|
853 |
/**
|
williamr@2
|
854 |
Gets the Host name
|
williamr@2
|
855 |
@param aNameBuf, name to retrieve
|
williamr@2
|
856 |
*/
|
williamr@2
|
857 |
virtual void RemoveService(const TDesC& aNameBuf,TInt32 aPortNum)=0;
|
williamr@2
|
858 |
};
|
williamr@2
|
859 |
|
williamr@2
|
860 |
class CNetDBProvdBase : public CResolverProvdBase
|
williamr@2
|
861 |
/**
|
williamr@2
|
862 |
Provides network Database access
|
williamr@2
|
863 |
@publishedPartner
|
williamr@2
|
864 |
@released
|
williamr@2
|
865 |
*/
|
williamr@2
|
866 |
{
|
williamr@2
|
867 |
friend class ProtocolManager;
|
williamr@2
|
868 |
public:
|
williamr@2
|
869 |
virtual void Query(TDes8& aBuffer)=0;
|
williamr@2
|
870 |
virtual void Add(TDes8& aBuffer)=0;
|
williamr@2
|
871 |
virtual void Remove(TDes8& aBuffer)=0;
|
williamr@2
|
872 |
};
|
williamr@2
|
873 |
|
williamr@2
|
874 |
/**
|
williamr@2
|
875 |
Definition of argument to CConnectionProvdBase::SetUsageProfile()
|
williamr@2
|
876 |
Bitmap masks
|
williamr@2
|
877 |
|
williamr@2
|
878 |
@internalTechnology
|
williamr@2
|
879 |
*/
|
williamr@2
|
880 |
const TUint KConnProfileNone = 0;
|
williamr@2
|
881 |
|
williamr@2
|
882 |
/**
|
williamr@2
|
883 |
Definition of argument to CConnectionProvdBase::SetUsageProfile()
|
williamr@2
|
884 |
Bitmap masks
|
williamr@2
|
885 |
|
williamr@2
|
886 |
@internalTechnology
|
williamr@2
|
887 |
*/
|
williamr@2
|
888 |
const TUint KConnProfileLong = 1;
|
williamr@2
|
889 |
|
williamr@2
|
890 |
/**
|
williamr@2
|
891 |
Definition of argument to CConnectionProvdBase::SetUsageProfile()
|
williamr@2
|
892 |
Bitmap masks
|
williamr@2
|
893 |
|
williamr@2
|
894 |
@internalTechnology
|
williamr@2
|
895 |
*/
|
williamr@2
|
896 |
const TUint KConnProfileMedium = 2;
|
williamr@2
|
897 |
|
williamr@2
|
898 |
class TConnPref;
|
williamr@2
|
899 |
class CSubConnectionProviderBase;
|
williamr@2
|
900 |
class CNifIfBase;
|
williamr@2
|
901 |
|
williamr@2
|
902 |
class CConnectionProvdBase : public CBase
|
williamr@2
|
903 |
/**
|
williamr@2
|
904 |
* Base class for connection providers (currently nifman)
|
williamr@2
|
905 |
* @internalTechnology
|
williamr@2
|
906 |
*/
|
williamr@2
|
907 |
{
|
williamr@2
|
908 |
friend class ProtocolManager;
|
williamr@2
|
909 |
friend class CConnection;
|
williamr@2
|
910 |
friend class CConnectionSettingsShim; //to access the virtual "Do" db functions directly
|
williamr@2
|
911 |
public:
|
williamr@2
|
912 |
IMPORT_C virtual ~CConnectionProvdBase();
|
williamr@2
|
913 |
|
williamr@2
|
914 |
IMPORT_C TUint Id() const;
|
williamr@2
|
915 |
IMPORT_C void SetConnectionProviderClient(MConnectionNotify* aClient);
|
williamr@2
|
916 |
MConnectionNotify* ConnectionProviderClient();
|
williamr@2
|
917 |
|
williamr@2
|
918 |
|
williamr@2
|
919 |
// SubConnectionProvider Management
|
williamr@2
|
920 |
void JoinL(CSubConnectionProviderBase& aSubConnProvider);
|
williamr@2
|
921 |
void Leave(CSubConnectionProviderBase& aSubConnProvider);
|
williamr@2
|
922 |
|
williamr@2
|
923 |
virtual void StartL(TConnStartType aConnectType, const RMessagePtr2* aMessage) = 0;
|
williamr@2
|
924 |
virtual void StartL(TConnStartType aConnectType, const TConnPref& aPref, const RMessagePtr2* aMessage) = 0;
|
williamr@2
|
925 |
virtual void AttachToConnectionL(const TDesC8& aConnectionInfo, TBool aMonitorAttach, const RMessagePtr2* aMessage) = 0;
|
williamr@2
|
926 |
virtual TInt Stop(TInt aError, const RMessagePtr2* aMessage) = 0;
|
williamr@2
|
927 |
virtual void ProgressL(TNifProgressBuf& aBuffer) const = 0;
|
williamr@2
|
928 |
virtual void ProgressL(TSubConnectionUniqueId aSubConnectionUniqueId, TNifProgressBuf& aBuffer) const = 0;
|
williamr@2
|
929 |
virtual void LastProgressError(TNifProgressBuf& aBuffer) = 0;
|
williamr@2
|
930 |
virtual void RequestServiceChangeNotificationL() = 0;
|
williamr@2
|
931 |
virtual void CancelServiceChangeNotification() = 0;
|
williamr@2
|
932 |
virtual void EnumerateConnectionsL(RPointerArray<TConnectionInfo>& aConnectionInfoPtrArray) = 0;
|
williamr@2
|
933 |
virtual TBool AllInterfaceNotificationL() = 0;
|
williamr@2
|
934 |
virtual void ControlL(TUint aOptionLevel, TUint aOptionName, TDes8& aOption, const RMessagePtr2* aMessage) = 0;
|
williamr@2
|
935 |
virtual void SetUsageProfile(TUint aProfile) = 0;
|
williamr@2
|
936 |
|
williamr@2
|
937 |
/**
|
williamr@2
|
938 |
Stop the specified subconnection
|
williamr@2
|
939 |
|
williamr@2
|
940 |
@param aSubConnectionUniqueId The id of the subconnection to be stopped
|
williamr@2
|
941 |
@param aError The error code to be propogated to the clients of the subconnection
|
williamr@2
|
942 |
*/
|
williamr@2
|
943 |
virtual TInt Stop(TSubConnectionUniqueId aSubConnectionUniqueId, TInt aError, const RMessagePtr2* aMessage)=0;
|
williamr@2
|
944 |
|
williamr@2
|
945 |
/**
|
williamr@2
|
946 |
Find out the number of subconnetions on a connection
|
williamr@2
|
947 |
|
williamr@2
|
948 |
@param aCount On return, contains the number of subconnections
|
williamr@2
|
949 |
*/
|
williamr@2
|
950 |
virtual TInt EnumerateSubConnections(TUint& aCount)=0;
|
williamr@2
|
951 |
|
williamr@2
|
952 |
/**
|
williamr@2
|
953 |
Get information about a subconnection specified only by generic index
|
williamr@2
|
954 |
|
williamr@2
|
955 |
@param aIndex
|
williamr@2
|
956 |
@param aSubConnectionInfo An appropriate SubConnectionInfo-derived class; on return, this is filled in
|
williamr@2
|
957 |
*/
|
williamr@2
|
958 |
virtual TInt GetSubConnectionInfo(TUint aIndex, TDes8& aSubConnectionInfo)=0;
|
williamr@2
|
959 |
|
williamr@2
|
960 |
/**
|
williamr@2
|
961 |
Get information about a subconnection specifed by its unique id
|
williamr@2
|
962 |
|
williamr@2
|
963 |
@param aSubConnectionInfo An appropriate SubConnectionInfo-derived class containing a valid TSubConnectionUniqueId; on return, this is filled in
|
williamr@2
|
964 |
*/
|
williamr@2
|
965 |
virtual TInt GetSubConnectionInfo(TDes8& aSubConnectionInfo)=0;
|
williamr@2
|
966 |
|
williamr@2
|
967 |
/**
|
williamr@2
|
968 |
Register for all subconnection notifications
|
williamr@2
|
969 |
*/
|
williamr@2
|
970 |
virtual TInt AllSubConnectionNotificationEnable()=0;
|
williamr@2
|
971 |
|
williamr@2
|
972 |
/**
|
williamr@2
|
973 |
Cancel registration for AllSubConnectionNotification
|
williamr@2
|
974 |
*/
|
williamr@2
|
975 |
virtual TInt CancelAllSubConnectionNotification()=0;
|
williamr@2
|
976 |
|
williamr@2
|
977 |
/**
|
williamr@2
|
978 |
Find out how much data has been sent and received
|
williamr@2
|
979 |
|
williamr@2
|
980 |
@param aSubConnectionUniqueId The id of the subconnection to which this request refers
|
williamr@2
|
981 |
@param aUplinkVolume The total number of bytes sent on this subconnection
|
williamr@2
|
982 |
@param aDownlinkVolume The total number of bytes received on this subconnection
|
williamr@2
|
983 |
*/
|
williamr@2
|
984 |
virtual TInt DataTransferred(TSubConnectionUniqueId aSubConnectionUniqueId, TUint& aUplinkVolume, TUint& aDownlinkVolume)=0;
|
williamr@2
|
985 |
|
williamr@2
|
986 |
/**
|
williamr@2
|
987 |
Cancel a request for the amount of data sent and received
|
williamr@2
|
988 |
|
williamr@2
|
989 |
@param aSubConnectionUniqueId The id of the subconnection that this request refers to
|
williamr@2
|
990 |
@note At present this method is never called, as this is a synchronous operation on the server side
|
williamr@2
|
991 |
*/
|
williamr@2
|
992 |
virtual TInt DataTransferredCancel(TSubConnectionUniqueId aSubConnectionUniqueId)=0;
|
williamr@2
|
993 |
|
williamr@2
|
994 |
/**
|
williamr@2
|
995 |
Make a request for notifications about data sent at the specifed granularity on a specified subconnection
|
williamr@2
|
996 |
|
williamr@2
|
997 |
@param aSubConnectionUniqueId The id of the subconnection to which this request refers
|
williamr@2
|
998 |
@param aUplinkGranularity The granularity in bytes at which notifications should be sent
|
williamr@2
|
999 |
*/
|
williamr@2
|
1000 |
virtual TInt SetDataSentNotificationGranularity(TSubConnectionUniqueId aSubConnectionUniqueId, TUint aUplinkGranularity)=0;
|
williamr@2
|
1001 |
|
williamr@2
|
1002 |
/**
|
williamr@2
|
1003 |
Cancel a request for notifications about data sent on a specified subconnection
|
williamr@2
|
1004 |
|
williamr@2
|
1005 |
@param aSubConnectionUniqueId The id of the subconnection to which this request refers
|
williamr@2
|
1006 |
*/
|
williamr@2
|
1007 |
virtual TInt DataSentNotificationCancel(TSubConnectionUniqueId aSubConnectionUniqueId)=0;
|
williamr@2
|
1008 |
|
williamr@2
|
1009 |
/**
|
williamr@2
|
1010 |
Make a request for notifications about data received at the specifed granularity on a specified subconnection
|
williamr@2
|
1011 |
|
williamr@2
|
1012 |
@param aSubConnectionUniqueId The id of the subconnection to which this request refers
|
williamr@2
|
1013 |
@param aDownlinkGranularity The granularity in bytes at which notifications should be sent
|
williamr@2
|
1014 |
*/
|
williamr@2
|
1015 |
virtual TInt SetDataReceivedNotificationGranularity(TSubConnectionUniqueId aSubConnectionUniqueId, TUint aDownlinkGranularity)=0;
|
williamr@2
|
1016 |
|
williamr@2
|
1017 |
/**
|
williamr@2
|
1018 |
Cancel a request for notifications about data received on a specified subconnection
|
williamr@2
|
1019 |
|
williamr@2
|
1020 |
@param aSubConnectionUniqueId The id of the subconnection to which this request refers
|
williamr@2
|
1021 |
*/
|
williamr@2
|
1022 |
virtual TInt DataReceivedNotificationCancel(TSubConnectionUniqueId aSubConnectionUniqueId)=0;
|
williamr@2
|
1023 |
|
williamr@2
|
1024 |
/**
|
williamr@2
|
1025 |
* SendIoctlMessageL forwards Ioctl request to the target
|
williamr@2
|
1026 |
* Important - message has to be completed by the target. There is no notification back
|
williamr@2
|
1027 |
* to the caller => meant for forwarding Ioctl messages the forwarding path is not really
|
williamr@2
|
1028 |
* interested in apart from "routing informations"
|
williamr@2
|
1029 |
* @param aMessage forwarded message (it's the caller's resposibility to forward just Ioctl
|
williamr@2
|
1030 |
* messages)
|
williamr@2
|
1031 |
*/
|
williamr@2
|
1032 |
virtual void SendIoctlMessageL(const RMessage2& aMessage) = 0;
|
williamr@2
|
1033 |
virtual void SendCancelIoctl() = 0;
|
williamr@2
|
1034 |
|
williamr@2
|
1035 |
//PREQ399_REMOVE
|
williamr@2
|
1036 |
#ifdef SYMBIAN_NETWORKING_3GPPDEFAULTQOS
|
williamr@2
|
1037 |
virtual CNifIfBase* GetNif(TInt aIndex) = 0;
|
williamr@2
|
1038 |
#endif
|
williamr@2
|
1039 |
//SYMBIAN_NETWORKING_3GPPDEFAULTQOS //PREQ399_REMOVE
|
williamr@2
|
1040 |
|
williamr@2
|
1041 |
IMPORT_C void GetBoolSettingL(const TDesC& aSettingName, TBool& aValue );
|
williamr@2
|
1042 |
IMPORT_C void GetBoolSettingL(const TDesC& aSettingName, TBool& aValue, const RMessagePtr2* aMessage );
|
williamr@2
|
1043 |
IMPORT_C void GetDes16SettingL(const TDesC& aSettingName, TDes16& aValue );
|
williamr@2
|
1044 |
IMPORT_C void GetDes16SettingL(const TDesC& aSettingName, TDes16& aValue, const RMessagePtr2* aMessage );
|
williamr@2
|
1045 |
IMPORT_C void GetDes8SettingL(const TDesC& aSettingName, TDes8& aValue );
|
williamr@2
|
1046 |
IMPORT_C void GetDes8SettingL(const TDesC& aSettingName, TDes8& aValue, const RMessagePtr2* aMessage );
|
williamr@2
|
1047 |
IMPORT_C void GetIntSettingL(const TDesC& aSettingName, TUint32& aValue );
|
williamr@2
|
1048 |
IMPORT_C void GetIntSettingL(const TDesC& aSettingName, TUint32& aValue, const RMessagePtr2* aMessage );
|
williamr@2
|
1049 |
IMPORT_C HBufC* GetLongDesSettingLC(const TDesC& aSettingName, const RMessagePtr2* aMessage );
|
williamr@2
|
1050 |
IMPORT_C HBufC* GetLongDesSettingLC(const TDesC& aSettingName );
|
williamr@2
|
1051 |
|
williamr@2
|
1052 |
protected:
|
williamr@2
|
1053 |
IMPORT_C CConnectionProvdBase(TUint aId);
|
williamr@2
|
1054 |
IMPORT_C void CreateL(MConnectionNotify* aConnection);
|
williamr@2
|
1055 |
|
williamr@2
|
1056 |
virtual void DoGetIntSettingL(const TDesC& aSettingName, TUint32& aValue, const RMessagePtr2* aMessage ) = 0;
|
williamr@2
|
1057 |
virtual void DoGetBoolSettingL(const TDesC& aSettingName, TBool& aValue, const RMessagePtr2* aMessage ) = 0;
|
williamr@2
|
1058 |
virtual void DoGetDes8SettingL(const TDesC& aSettingName, TDes8& aValue, const RMessagePtr2* aMessage ) = 0;
|
williamr@2
|
1059 |
virtual void DoGetDes16SettingL(const TDesC& aSettingName, TDes16& aValue, const RMessagePtr2* aMessage ) = 0;
|
williamr@2
|
1060 |
virtual HBufC* DoGetLongDesSettingLC(const TDesC& aSettingName, const RMessagePtr2* aMessage ) = 0;
|
williamr@2
|
1061 |
|
williamr@2
|
1062 |
protected:
|
williamr@2
|
1063 |
MConnectionNotify* iConnection;
|
williamr@2
|
1064 |
RPointerArray<CSubConnectionProviderBase> iSubConnProviders;
|
williamr@2
|
1065 |
TUint iId;
|
williamr@2
|
1066 |
};
|
williamr@2
|
1067 |
|
williamr@2
|
1068 |
class CProtocolFamilyBase;
|
williamr@2
|
1069 |
class RMBufChain;
|
williamr@2
|
1070 |
class CProtocolRef;
|
williamr@2
|
1071 |
class CProtocolBase : public CBase
|
williamr@2
|
1072 |
/** Protocols created by protocol families must be instances of sub-classes of
|
williamr@2
|
1073 |
the abstract CProtocolBase.
|
williamr@2
|
1074 |
@publishedPartner
|
williamr@2
|
1075 |
@released Since v5.0 */
|
williamr@2
|
1076 |
{
|
williamr@2
|
1077 |
friend class ProtocolManager;
|
williamr@2
|
1078 |
friend class CProtocolRef;
|
williamr@2
|
1079 |
|
williamr@2
|
1080 |
public:
|
williamr@2
|
1081 |
IMPORT_C virtual CServProviderBase* NewSAPL(TUint aProtocol);
|
williamr@2
|
1082 |
IMPORT_C virtual CHostResolvProvdBase* NewHostResolverL();
|
williamr@2
|
1083 |
IMPORT_C virtual CServiceResolvProvdBase* NewServiceResolverL();
|
williamr@2
|
1084 |
IMPORT_C virtual CNetDBProvdBase* NewNetDatabaseL();
|
williamr@2
|
1085 |
IMPORT_C CProtocolBase();
|
williamr@2
|
1086 |
IMPORT_C virtual ~CProtocolBase();
|
williamr@2
|
1087 |
CProtocolFamilyBase* ProtocolFamily();
|
williamr@2
|
1088 |
IMPORT_C virtual void Close();
|
williamr@2
|
1089 |
IMPORT_C virtual void Open();
|
williamr@2
|
1090 |
IMPORT_C virtual void CloseNow();
|
williamr@2
|
1091 |
IMPORT_C virtual void StartSending(CProtocolBase* aProtocol); // Up
|
williamr@2
|
1092 |
IMPORT_C TPtrC Tag();
|
williamr@2
|
1093 |
IMPORT_C virtual void InitL(TDesC& aTag); // From ProtocolManager before all binding.
|
williamr@2
|
1094 |
IMPORT_C virtual void StartL(); // From Protocol Manager - after all binding
|
williamr@2
|
1095 |
IMPORT_C virtual void BindL(CProtocolBase* protocol, TUint id); // From higher protocol
|
williamr@2
|
1096 |
IMPORT_C virtual void BindToL(CProtocolBase* protocol); // From Protocol Manager
|
williamr@2
|
1097 |
IMPORT_C virtual TInt Send(RMBufChain& aPDU,CProtocolBase* aSourceProtocol=NULL); // Down
|
williamr@2
|
1098 |
IMPORT_C virtual TInt Send(TDes8& aPDU,TSockAddr* to,TSockAddr* from=NULL,CProtocolBase* aSourceProtocol=NULL); // Done
|
williamr@2
|
1099 |
IMPORT_C virtual void Process(RMBufChain&,CProtocolBase* aSourceProtocol=NULL); // Up
|
williamr@2
|
1100 |
IMPORT_C virtual void Process(TDes8& aPDU,TSockAddr* from,TSockAddr* to=NULL,CProtocolBase* aSourceProtocol=NULL); // Up
|
williamr@2
|
1101 |
IMPORT_C virtual TInt GetOption(TUint level,TUint name,TDes8& option,CProtocolBase* aSourceProtocol=NULL); // Down
|
williamr@2
|
1102 |
IMPORT_C virtual TInt SetOption(TUint level,TUint name,const TDesC8& option,CProtocolBase* aSourceProtocol=NULL); // Down
|
williamr@2
|
1103 |
IMPORT_C virtual void Error(TInt anError,CProtocolBase* aSourceProtocol=NULL); // Up
|
williamr@2
|
1104 |
|
williamr@2
|
1105 |
// Pure virtual
|
williamr@2
|
1106 |
/** Fills in the passed TServerProtocolDesc with data describing the protocol.
|
williamr@2
|
1107 |
|
williamr@2
|
1108 |
@param aProtocolDesc Protocol description object to fill in */
|
williamr@2
|
1109 |
virtual void Identify(TServerProtocolDesc* aProtocolDesc)const =0; // from anyone.
|
williamr@2
|
1110 |
|
williamr@2
|
1111 |
inline TInt RefCount() const;
|
williamr@2
|
1112 |
protected:
|
williamr@2
|
1113 |
IMPORT_C void CanClose(); // Up
|
williamr@2
|
1114 |
private:
|
williamr@2
|
1115 |
void TryDelete();
|
williamr@2
|
1116 |
protected:
|
williamr@2
|
1117 |
// TProtocolDesc iDesc;
|
williamr@2
|
1118 |
private:
|
williamr@2
|
1119 |
CProtocolRef* iManagerRef;
|
williamr@2
|
1120 |
TInt iRefCount;
|
williamr@2
|
1121 |
};
|
williamr@2
|
1122 |
|
williamr@2
|
1123 |
class CProtocolFamilyRef;
|
williamr@2
|
1124 |
class CLibUnloader;
|
williamr@2
|
1125 |
class CConnection;
|
williamr@2
|
1126 |
class CConnectionProvdBase;
|
williamr@2
|
1127 |
class CProtocolFamilyBase : public CBase
|
williamr@2
|
1128 |
/** Defines the interface for protocol families.
|
williamr@2
|
1129 |
|
williamr@2
|
1130 |
Protocol families must:
|
williamr@2
|
1131 |
|
williamr@2
|
1132 |
be able to identify the protocols which they can create
|
williamr@2
|
1133 |
|
williamr@2
|
1134 |
be able to create instances of protocol objects for all the protocols they
|
williamr@2
|
1135 |
advertise
|
williamr@2
|
1136 |
|
williamr@2
|
1137 |
@publishedPartner
|
williamr@2
|
1138 |
@released */
|
williamr@2
|
1139 |
{
|
williamr@2
|
1140 |
friend class ProtocolManager;
|
williamr@2
|
1141 |
friend class CProtocolFamilyRef;
|
williamr@2
|
1142 |
public:
|
williamr@2
|
1143 |
IMPORT_C virtual ~CProtocolFamilyBase();
|
williamr@2
|
1144 |
IMPORT_C CProtocolFamilyBase();
|
williamr@2
|
1145 |
IMPORT_C virtual void Close();
|
williamr@2
|
1146 |
IMPORT_C virtual void Open();
|
williamr@2
|
1147 |
IMPORT_C virtual TInt Remove();
|
williamr@2
|
1148 |
IMPORT_C virtual TBool QueryVersionSupported(const TVersion& aVer) const;
|
williamr@2
|
1149 |
|
williamr@2
|
1150 |
void SetLibraryL(RLibrary& aLib);
|
williamr@2
|
1151 |
|
williamr@2
|
1152 |
// Pure virtual
|
williamr@2
|
1153 |
/** Initialises a protocol family.
|
williamr@2
|
1154 |
|
williamr@2
|
1155 |
After the CProtocolFamilyBase-derived object has been created, the first function
|
williamr@2
|
1156 |
called by the socket server on that object is Install(). It is at this point that the
|
williamr@2
|
1157 |
CProtocolFamilyBase-derived object should perform any initialisation which it needs.
|
williamr@2
|
1158 |
|
williamr@2
|
1159 |
@return System-wide error code */
|
williamr@2
|
1160 |
virtual TInt Install()=0;
|
williamr@2
|
1161 |
/** Creates a new protocol object.
|
williamr@2
|
1162 |
|
williamr@2
|
1163 |
During socket creation, after the socket server has called Open() on a protocol family,
|
williamr@2
|
1164 |
it next calls this function to create an instance of a CProtocolBase-derived object -
|
williamr@2
|
1165 |
the protocol itself.
|
williamr@2
|
1166 |
|
williamr@2
|
1167 |
@param aSockType A supported socket type for the protocol family as advertised
|
williamr@2
|
1168 |
in the protocol list.
|
williamr@2
|
1169 |
@param aProtocol A protocol number specifying a protocol returned by ProtocolList().
|
williamr@2
|
1170 |
|
williamr@2
|
1171 |
@return A protocol, or NULL if some error has prevented the protocol from being
|
williamr@2
|
1172 |
created. */
|
williamr@2
|
1173 |
virtual CProtocolBase * NewProtocolL(TUint aSockType,TUint aProtocol)=0;
|
williamr@2
|
1174 |
/** Gets a list of supported protocols.
|
williamr@2
|
1175 |
|
williamr@2
|
1176 |
Called during initialisation, directly after Install(). ProtocolList() returns a list
|
williamr@2
|
1177 |
of all the protocols in the protocol family. The protocol family object should allocate
|
williamr@2
|
1178 |
memory to hold an array of TServerProtocolDesc structures. This function should then
|
williamr@2
|
1179 |
fill them in and return the pointer and a count of the number of protocols
|
williamr@2
|
1180 |
supported. The socket server caches this information, so that it does not
|
williamr@2
|
1181 |
need to keep the protocol module loaded.
|
williamr@2
|
1182 |
|
williamr@2
|
1183 |
The protocol family should not attempt to use static data (which it can't)
|
williamr@2
|
1184 |
or to free this memory later, as the socket server will automatically free
|
williamr@2
|
1185 |
this storage.
|
williamr@2
|
1186 |
|
williamr@2
|
1187 |
@param aProtocolList This pointer is set to point to memory allocated by the
|
williamr@2
|
1188 |
protocol family and filled in as described above
|
williamr@2
|
1189 |
@return The number of protocols in this protocol family (and entries in the
|
williamr@2
|
1190 |
list of protocols) */
|
williamr@2
|
1191 |
virtual TUint ProtocolList(TServerProtocolDesc*& aProtocolList)=0;
|
williamr@2
|
1192 |
|
williamr@2
|
1193 |
inline TInt RefCount() const;
|
williamr@2
|
1194 |
|
williamr@2
|
1195 |
protected:
|
williamr@2
|
1196 |
|
williamr@2
|
1197 |
/** Contains version information */
|
williamr@2
|
1198 |
TVersion iVersion;
|
williamr@2
|
1199 |
private:
|
williamr@2
|
1200 |
TInt iRefCount;
|
williamr@2
|
1201 |
CLibUnloader* iLibUnloader;
|
williamr@2
|
1202 |
CProtocolFamilyRef* iManagerRef;
|
williamr@2
|
1203 |
};
|
williamr@2
|
1204 |
|
williamr@2
|
1205 |
/**
|
williamr@2
|
1206 |
@publishedPartner
|
williamr@2
|
1207 |
@released
|
williamr@2
|
1208 |
*/
|
williamr@2
|
1209 |
typedef CProtocolFamilyBase* (*TProtocolNew)();
|
williamr@2
|
1210 |
|
williamr@2
|
1211 |
|
williamr@2
|
1212 |
class SocketTimer
|
williamr@2
|
1213 |
/**
|
williamr@2
|
1214 |
@internalComponent
|
williamr@2
|
1215 |
*/
|
williamr@2
|
1216 |
{
|
williamr@2
|
1217 |
public:
|
williamr@2
|
1218 |
IMPORT_C static void Queue(TTimeIntervalMicroSeconds32 aTimeInMicroSeconds,TDeltaTimerEntry& aTimer);
|
williamr@2
|
1219 |
IMPORT_C static void Remove(TDeltaTimerEntry& aTimer);
|
williamr@2
|
1220 |
};
|
williamr@2
|
1221 |
|
williamr@2
|
1222 |
class SocketServExt
|
williamr@2
|
1223 |
/**
|
williamr@2
|
1224 |
@internalTechnology
|
williamr@2
|
1225 |
*/
|
williamr@2
|
1226 |
{
|
williamr@2
|
1227 |
public:
|
williamr@2
|
1228 |
IMPORT_C static CProtocolBase* FindAndLoadProtocolL(const TDesC& aName, TProtocolType aType=ENormalProtocol);
|
williamr@2
|
1229 |
IMPORT_C static CProtocolBase* FindAndLoadProtocolL(TUint aAddrFamily, TUint aSockType, TUint aProtocol);
|
williamr@2
|
1230 |
IMPORT_C static void InstallExtensionL(const TDesC& aDllName, const TDesC& aArgs);
|
williamr@2
|
1231 |
IMPORT_C static void OpenSession();
|
williamr@2
|
1232 |
IMPORT_C static void CloseSession();
|
williamr@2
|
1233 |
IMPORT_C static void InstallSchedulerWaitHook(TCallBack* aCall);
|
williamr@2
|
1234 |
};
|
williamr@2
|
1235 |
|
williamr@2
|
1236 |
class CSocketServExtRef;
|
williamr@2
|
1237 |
class CSocketServExtBase : public CBase
|
williamr@2
|
1238 |
/**
|
williamr@2
|
1239 |
Base class for extensions
|
williamr@2
|
1240 |
|
williamr@2
|
1241 |
@internalTechnology
|
williamr@2
|
1242 |
*/
|
williamr@2
|
1243 |
{
|
williamr@2
|
1244 |
public:
|
williamr@2
|
1245 |
IMPORT_C virtual ~CSocketServExtBase();
|
williamr@2
|
1246 |
protected:
|
williamr@2
|
1247 |
IMPORT_C CSocketServExtBase();
|
williamr@2
|
1248 |
public:
|
williamr@2
|
1249 |
virtual void InstallL(const TDesC& aArgs)=0;
|
williamr@2
|
1250 |
virtual void Remove()=0;
|
williamr@2
|
1251 |
//
|
williamr@2
|
1252 |
private:
|
williamr@2
|
1253 |
friend class CSocketServExtRef;
|
williamr@2
|
1254 |
CSocketServExtRef* iExtRef;
|
williamr@2
|
1255 |
};
|
williamr@2
|
1256 |
|
williamr@2
|
1257 |
|
williamr@2
|
1258 |
/**
|
williamr@2
|
1259 |
KSoOwnerInfo
|
williamr@2
|
1260 |
|
williamr@2
|
1261 |
Definition for internal SetOption() from ESock to Provider to communicate
|
williamr@2
|
1262 |
socket owner information.
|
williamr@2
|
1263 |
|
williamr@2
|
1264 |
@internalTechnology
|
williamr@2
|
1265 |
@released
|
williamr@2
|
1266 |
*/
|
williamr@2
|
1267 |
const TInt KSOLProvider = 2;
|
williamr@2
|
1268 |
|
williamr@2
|
1269 |
const TUint KSoOwnerInfo = 1 | KSocketInternalOptionBit;
|
williamr@2
|
1270 |
|
williamr@2
|
1271 |
class TSoOwnerInfo
|
williamr@2
|
1272 |
/**
|
williamr@2
|
1273 |
Class used to communicate the owner of a socket from ESOCK to Provider.
|
williamr@2
|
1274 |
@internalTechnology
|
williamr@2
|
1275 |
*/
|
williamr@2
|
1276 |
{
|
williamr@2
|
1277 |
public:
|
williamr@2
|
1278 |
TUidType iUid;
|
williamr@2
|
1279 |
};
|
williamr@2
|
1280 |
|
williamr@2
|
1281 |
/**
|
williamr@2
|
1282 |
KSoConnectionInfo
|
williamr@2
|
1283 |
|
williamr@2
|
1284 |
Definition for internal SetOption() from ESock to Provider to communicate
|
williamr@2
|
1285 |
connection selection information. Note that the information is opaque
|
williamr@2
|
1286 |
to ESock and comes from Nifman in the form of a TSoIfConnectionInfo class.
|
williamr@2
|
1287 |
@internalTechnology
|
williamr@2
|
1288 |
*/
|
williamr@2
|
1289 |
const TInt KSoConnectionInfo = 2 | KSocketInternalOptionBit;
|
williamr@2
|
1290 |
|
williamr@2
|
1291 |
/**
|
williamr@2
|
1292 |
UID of Protocol Modules
|
williamr@2
|
1293 |
@publishedPartner
|
williamr@2
|
1294 |
@released */
|
williamr@2
|
1295 |
const TInt KUidProtocolModule = 0x1000004A;
|
williamr@2
|
1296 |
|
williamr@2
|
1297 |
/**
|
williamr@2
|
1298 |
UID of Unicode Protocol Modules
|
williamr@2
|
1299 |
|
williamr@2
|
1300 |
@internalTechnology
|
williamr@2
|
1301 |
*/
|
williamr@2
|
1302 |
const TInt KUidUnicodeProtocolModule = 0x10003d38;
|
williamr@2
|
1303 |
|
williamr@2
|
1304 |
/** @internalTechnology */
|
williamr@2
|
1305 |
const TInt KUidEsockExtension = 0x10000387;
|
williamr@2
|
1306 |
|
williamr@2
|
1307 |
#include <es_prot.inl>
|
williamr@2
|
1308 |
|
williamr@2
|
1309 |
#endif
|