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