1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @publishedAll |
|
19 @released |
|
20 */ |
|
21 |
|
22 #ifndef __OBEXSERVER_H |
|
23 #define __OBEXSERVER_H |
|
24 |
|
25 #include <obextypes.h> |
|
26 #include <obexbase.h> |
|
27 |
|
28 class TObexTransportInfo; |
|
29 class CObexServerRequestPacketEngine; |
|
30 class CObexPacketSignaller; |
|
31 class MObexReadActivityObserver; |
|
32 |
|
33 /** OBEX server. |
|
34 |
|
35 CObexServer provides a framework for servicing OBEX requests from remote clients. |
|
36 It is designed to be able to act as either a "default" application (in IrDA |
|
37 terms, registering on the IrDA:OBEX IAS class), or as a application specific |
|
38 server (registering itself on a private IAS class). |
|
39 |
|
40 You implement service-specific behaviour by providing a MObexServerNotify |
|
41 interface implementation to the server object. The server calls the interface's |
|
42 functions to provide notification of server events, which specific implementations |
|
43 can process (or ignore) as appropriate. |
|
44 |
|
45 This class is not designed for user derivation. |
|
46 |
|
47 @publishedAll |
|
48 @released |
|
49 */ |
|
50 NONSHARABLE_CLASS(CObexServer) : public CObex |
|
51 { |
|
52 // CObexServer is friends with the core Server State Machine class so |
|
53 // that it can access the CObex::ControlledTransportDown() method |
|
54 friend class CObexServerStateMachine; |
|
55 |
|
56 // CObexServer is friends with the TObexServerStateObexConnecting class so |
|
57 // that it can access the CObex::SetConnectState(TConnectState aNewState) method |
|
58 friend class TObexServerStateObexConnecting; |
|
59 |
|
60 // CObexServer is friends with the Server Request Packet Engine so that |
|
61 // it can NULL the iServerRequestPacketEngine pointer ready for another |
|
62 // extension interface |
|
63 friend class CObexServerRequestPacketEngine; |
|
64 |
|
65 public: |
|
66 /** |
|
67 @publishedAll |
|
68 @released |
|
69 |
|
70 The target header checking to apply to incoming connection requests. Defaults to |
|
71 EIfPresent. |
|
72 @see CObexServer::SetTargetChecking |
|
73 */ |
|
74 enum TTargetChecking |
|
75 { |
|
76 ENoChecking, /** Allow all target headers to connect. */ |
|
77 EIfPresent, /** Only check target header in response to receiving one. Allows all clients |
|
78 specifying an Inbox service to connect. */ |
|
79 EAlways, /** Strict checking. Only allow connections if target header matches or no header |
|
80 received and none expected. */ |
|
81 }; |
|
82 |
|
83 IMPORT_C static CObexServer* NewL(TObexProtocolInfo& aObexProtocolInfoPtr); |
|
84 IMPORT_C static CObexServer* NewL(TObexProtocolInfo& aObexProtocolInfoPtr, TObexProtocolPolicy& aObexProtocolPolicy); |
|
85 IMPORT_C static CObexServer* NewL(TObexTransportInfo& aObexTransportInfo); |
|
86 ~CObexServer(); |
|
87 IMPORT_C TInt Start(MObexServerNotify* aOwner); |
|
88 IMPORT_C TInt Start(MObexServerNotifyAsync* aOwner); |
|
89 IMPORT_C void Stop(); |
|
90 IMPORT_C TBool IsStarted(); |
|
91 IMPORT_C TOperation CurrentOperation() const; |
|
92 void SetCurrentOperation(const TOperation aOperation); // used internally by state machine |
|
93 IMPORT_C void SetChallengeL(const TDesC& aPassword); |
|
94 IMPORT_C void ResetChallenge(); |
|
95 IMPORT_C void UserPasswordL( const TDesC& aPassword); |
|
96 IMPORT_C void SetTargetChecking(TTargetChecking aChecking); |
|
97 IMPORT_C TInt SetPutFinalResponseHeaders(CObexHeaderSet* aHeaderSet); |
|
98 IMPORT_C TInt RequestIndicationCallback(CObexBaseObject* aObject); |
|
99 IMPORT_C TInt RequestIndicationCallbackWithError(TObexResponse aResponseCode); |
|
100 IMPORT_C TInt RequestIndicationCallbackWithError(TInt aErrorCode); |
|
101 IMPORT_C TInt RequestCompleteIndicationCallback(TObexResponse aResponseCode); |
|
102 IMPORT_C TInt RequestCompleteIndicationCallback(TInt aErrorCode); |
|
103 |
|
104 IMPORT_C TInt PacketHeaders(CObexHeaderSet*& aHeaderSet); |
|
105 IMPORT_C TInt PacketHeaders(CObexHeaderSet*& aHeaderSet, MObexHeaderCheck& aHeaderCheck); |
|
106 IMPORT_C void SetReadActivityObserver(MObexReadActivityObserver* aObserver); |
|
107 |
|
108 IMPORT_C TAny* ExtensionInterfaceL(TUid aUid); |
|
109 IMPORT_C const TObexTransportInfo* TransportInfo() const; |
|
110 |
|
111 public: |
|
112 // Called from CObexNotifyExtendServer |
|
113 void SignalPacketProcessEvent(TInt aEvent); |
|
114 |
|
115 // Unexported functions used by the Server state machine |
|
116 TBool CheckObjectForConnectionId(CObexBaseObject& aObject); |
|
117 TBool CheckPacketForConnectionId(CObexPacket& aObject); |
|
118 |
|
119 private: |
|
120 CObexServer(); |
|
121 void ConstructL(TObexTransportInfo& aObexTransportInfo); |
|
122 TInt AcceptConnection(); |
|
123 // Implementation of CObex Events |
|
124 virtual void OnPacketReceive(CObexPacket& aPacket); |
|
125 virtual void OnError(TInt aError); |
|
126 virtual void OnTransportUp(); |
|
127 virtual void OnTransportDown(); |
|
128 |
|
129 public: |
|
130 // These three functions need to be public so the Server state machine can use them |
|
131 // However ParseConnectPacket cannot be moved as it is a virtual function (from CObex) |
|
132 TInt PrepareConnectPacket(CObexPacket& aPacket); |
|
133 TInt PrepareErroredConnectPacket(CObexPacket& aPacket); |
|
134 void SignalReadActivity(); |
|
135 TInt ParseConnectPacket(CObexPacket& aPacket); |
|
136 |
|
137 private: |
|
138 TInt AddConnectionIDHeader(CObexPacket& aPacket); |
|
139 TInt PrepareFinalChallResponse(CObexPacket& aPacket, TConnectState& aNextState); |
|
140 void CheckTarget(TConnectState& aNextState, TInt& aRetVal); |
|
141 void ResetConnectionID(); |
|
142 void SetConnectionID(TUint32 aConnectionID); |
|
143 TUint32 ConnectionID(); |
|
144 void CheckServerAppResponseCode(TObexOpcode aOpcode, TObexResponse aResponse); |
|
145 TInt DoPacketHeaders(CObexHeaderSet*& aHeaderSet, MObexHeaderCheck* aHeaderCheck); |
|
146 |
|
147 private: |
|
148 MObexServerNotifyAsync* iOwner; |
|
149 TBool iEnabled; |
|
150 TBool iSpecDone; |
|
151 TBool iTargetReceived; |
|
152 TTargetChecking iTargetChecking; |
|
153 TUint32 iConnectionID; |
|
154 TBool iConnectionIdSet; |
|
155 CObexHeader* iHeader; |
|
156 CObexServerStateMachine* iStateMachine; |
|
157 CObexServerNotifySyncWrapper* iSyncWrapper; |
|
158 CObexServerRequestPacketEngine* iServerRequestPacketEngine; |
|
159 CObexPacketSignaller* iPacketProcessSignaller; |
|
160 }; |
|
161 |
|
162 |
|
163 /** OBEX synchronous server notification interface. |
|
164 |
|
165 Any service that provides OBEX server functionality must implement one of the two |
|
166 server observer classes -- this one or MObexServerNotifyAsync. |
|
167 |
|
168 The CObexServer object handles the protocol side of an OBEX server session, |
|
169 while this class provides the server policy for a particular session. |
|
170 |
|
171 PUT and GET requests are handled synchronously, with the implementer returning a |
|
172 CObexBufObject which will be processed immediately. |
|
173 |
|
174 @publishedAll |
|
175 @released |
|
176 @see MObexServerNotifyAsync |
|
177 @see CObexServer |
|
178 */ |
|
179 class MObexServerNotify |
|
180 { |
|
181 public: |
|
182 /** |
|
183 Returns a null aObject if the extension is not implemented, or a pointer to another interface if it is. |
|
184 @param aInterface UID of the interface to return |
|
185 @param aObject the container for another interface as specified by aInterface |
|
186 */ |
|
187 IMPORT_C virtual void MOSN_ExtensionInterfaceL(TUid aInterface, void*& aObject); |
|
188 |
|
189 /** Called if an OBEX protocol error occurs. |
|
190 |
|
191 It is only called for fatal errors that cause the OBEX connection to terminate. |
|
192 An error that does not terminate the connection, for example the server issuing |
|
193 a semantically valid, but unrecognised command, will not be indicated. |
|
194 |
|
195 @param aError Error code that describes the OBEX error. OBEX specific error |
|
196 codes are listed from KErrIrObexClientNoDevicesFound. |
|
197 |
|
198 @publishedAll |
|
199 @released |
|
200 */ |
|
201 virtual void ErrorIndication(TInt aError) =0; |
|
202 |
|
203 |
|
204 |
|
205 /** Called when the underlying transport connection is made from a remote |
|
206 client to the server. |
|
207 |
|
208 Note that this does not, however, indicate an OBEX connection has been successfully |
|
209 established. |
|
210 |
|
211 You can define any low-level connection policy here. It is also a good place |
|
212 to set up the local connection information (CObex::LocalInfo()), if any non-defaults |
|
213 are required. |
|
214 |
|
215 @publishedAll |
|
216 @released |
|
217 */ |
|
218 virtual void TransportUpIndication() =0; |
|
219 |
|
220 |
|
221 |
|
222 /** Called when the transport connection is dropped (by either party). |
|
223 |
|
224 It is called whether the OBEX connection was gracefully disconnected or not. |
|
225 The function is the definitive place for disconnection processing. |
|
226 |
|
227 @publishedAll |
|
228 @released |
|
229 */ |
|
230 virtual void TransportDownIndication() =0; |
|
231 |
|
232 |
|
233 |
|
234 /** Called when an OBEX connection is made from a remote client. |
|
235 |
|
236 Override this function to provide any extra OBEX connection processing. |
|
237 Despite this method returning a value, implementers cannot use this to |
|
238 refuse the connection attempt. |
|
239 |
|
240 @param aRemoteInfo Connection information supplied by that remote machine |
|
241 @param aInfo Further information about the requested connection (reserved) |
|
242 @return Ignored |
|
243 |
|
244 @publishedAll |
|
245 @released |
|
246 */ |
|
247 virtual TInt ObexConnectIndication(const TObexConnectInfo& aRemoteInfo, const TDesC8& aInfo) =0; |
|
248 |
|
249 |
|
250 |
|
251 /** Called on a (graceful) OBEX disconnection by the client. |
|
252 |
|
253 Override this to provide any extra processing OBEX disconnection processing. |
|
254 |
|
255 Note that this indication will not be raised if the remote machine simply |
|
256 drops the transport connection. However, ErrorIndication() will be called |
|
257 if the disconnection is unexpected/ invalid (i.e. another operation was in |
|
258 progress at the time). In all cases, TransportDownIndication() will be called. |
|
259 |
|
260 @param aInfo Contains information about the disconnection (reserved) |
|
261 |
|
262 @publishedAll |
|
263 @released |
|
264 */ |
|
265 virtual void ObexDisconnectIndication(const TDesC8& aInfo) =0; |
|
266 |
|
267 |
|
268 |
|
269 /** Called on receipt of the first packet of a (valid) put request. |
|
270 |
|
271 It is called before any parsing of the packet is performed, simply to establish |
|
272 whether this server is interested in receiving objects at all. |
|
273 |
|
274 Note if the returned object cannot be initialised for receiving, ERespInternalError |
|
275 is returned to the client. |
|
276 |
|
277 @return CObexBaseObject-derived object, which the object being put will be |
|
278 parsed into. If this is NULL, ERespForbidden is returned to the client. |
|
279 |
|
280 @publishedAll |
|
281 @released |
|
282 */ |
|
283 virtual CObexBufObject* PutRequestIndication() =0; |
|
284 |
|
285 |
|
286 |
|
287 /** Called on receipt of every packet of an OBEX PUT operation. |
|
288 |
|
289 It will always be preceded by a PutRequestIndication(). The object returned |
|
290 by the request indication will be updated to reflect all the information received |
|
291 concerning the object which the client is sending, from packets up to and |
|
292 including the current one. |
|
293 |
|
294 You can use this function to provide periodic user notification on the progress |
|
295 of the transfer (noting that the Length attribute may take an arbitrary number |
|
296 of packets to become non-zero, and the constraints on its accuracy). Due to |
|
297 the nature of OBEX operations, where any header attribute can be sent at any |
|
298 point in the transfer, this is also a good place to marshal the details of |
|
299 a received object, and possibly prompt for action on the received object (e.g. |
|
300 renaming on filename clashes). |
|
301 |
|
302 Note that this function could be hit quite heavily, in proportion to the size |
|
303 of the object transferred. Therefore more consideration should be given to |
|
304 the speed of execution of this function than that of the other indications. |
|
305 |
|
306 @return KErrNone instructs the server to allow the client to continue the put |
|
307 operation. Any other value cancels the operation with an appropriate OBEX |
|
308 server response code. |
|
309 |
|
310 @publishedAll |
|
311 @released |
|
312 */ |
|
313 virtual TInt PutPacketIndication() =0; |
|
314 |
|
315 |
|
316 |
|
317 /** Called after the final put packet has been successfully received and parsed. |
|
318 |
|
319 Note that there will not necessarily be a call to this function corresponding |
|
320 to each PutRequestIndication() as, if an error occurs while the put is being |
|
321 carried out, ErrorIndication() will be called instead. |
|
322 |
|
323 Before version 6.1, the return type was void. |
|
324 |
|
325 @return KErrNoneinstructs the remote client that the put completed successfully. |
|
326 Any other value cancels the operation with an appropriate OBEX server response |
|
327 code. |
|
328 |
|
329 @publishedAll |
|
330 @released |
|
331 */ |
|
332 virtual TInt PutCompleteIndication() =0; |
|
333 |
|
334 |
|
335 |
|
336 /** Called when a full get request has been received from the client. |
|
337 |
|
338 aRequestedObject holds all the details about the object the remote client |
|
339 has requested. Use this function to analyse the client's request, and return |
|
340 a pointer to the object to be returned to the client, or NULL to return no |
|
341 object. |
|
342 |
|
343 If NULL is returned, the server will send ERespForbidden to the client; if |
|
344 an error occurs in returning the object, ERespInternalError is returned, otherwise |
|
345 the returned object is sent back to the client. |
|
346 |
|
347 @param aRequiredObject Details about the object the remote client has requested |
|
348 @return Object to return to the client |
|
349 |
|
350 @publishedAll |
|
351 @released |
|
352 */ |
|
353 virtual CObexBufObject* GetRequestIndication(CObexBaseObject *aRequiredObject) =0; |
|
354 |
|
355 |
|
356 |
|
357 /** Called for every packet of get reply sent by the server back to the client. |
|
358 |
|
359 The function is only called while an object is being sent to the client, not |
|
360 while the client is providing its initial specification for the object it |
|
361 requires. |
|
362 |
|
363 You can use this function to provide user notification on the object being |
|
364 sent, and its progress. As with PutPacketIndication(), you should consider |
|
365 that this function might get called often, especially for large objects and |
|
366 small OBEX packet sizes, so the speed of execution here is important. |
|
367 |
|
368 @return KErrNone to continue sending the object, or any other error code to |
|
369 cancel the operation |
|
370 |
|
371 @publishedAll |
|
372 @released |
|
373 */ |
|
374 virtual TInt GetPacketIndication() =0; |
|
375 |
|
376 |
|
377 |
|
378 /** Called when the final packet of the object has been returned to the client. |
|
379 |
|
380 Note like PutCompleteIndication(), this function might not be called for each |
|
381 GetRequestIndication(), if the operation is interrupted by an error. |
|
382 |
|
383 Before version 6.1, the return type was void. |
|
384 |
|
385 @return KErrNoneinstructs the remote client that the get completed successfully. |
|
386 Any other value cancels the operation with an appropriate OBEX server response |
|
387 code. |
|
388 |
|
389 @publishedAll |
|
390 @released |
|
391 */ |
|
392 virtual TInt GetCompleteIndication() =0; |
|
393 |
|
394 |
|
395 |
|
396 /** Called when an OBEX SETPATH command is received by the server. |
|
397 |
|
398 @param aPathInfo SETPATH command parameters |
|
399 @param aInfo Not currently used |
|
400 @return System wide error code indicating the success of the setpath command |
|
401 |
|
402 @publishedAll |
|
403 @released |
|
404 */ |
|
405 virtual TInt SetPathIndication(const CObex::TSetPathInfo& aPathInfo, const TDesC8& aInfo) =0; |
|
406 |
|
407 |
|
408 |
|
409 /** Called when an abort packet is received from the client. |
|
410 |
|
411 An OBEX abort command simply cancels the current operation, and does not necessarily |
|
412 have to cause the connection to be dropped. On return, a ERespSuccess packet |
|
413 is sent to the client. |
|
414 |
|
415 @publishedAll |
|
416 @released |
|
417 */ |
|
418 virtual void AbortIndication() =0; |
|
419 }; |
|
420 |
|
421 |
|
422 |
|
423 /** OBEX asynchronous server notification interface. |
|
424 |
|
425 Any service that provides OBEX server functionality must implement one of the two |
|
426 server observer classes -- this one or MObexServerNotify. |
|
427 |
|
428 The CObexServer object handles the protocol side of an OBEX server session, |
|
429 while this class provides the server policy for a particular session. |
|
430 |
|
431 PUT and GET requests are handled asynchronously, with the upcall from the server |
|
432 being followed at some stage in the future by a call to CObexServer::RequestIndicationComplete |
|
433 to trigger processing. |
|
434 |
|
435 @publishedAll |
|
436 @released |
|
437 @see MObexServerNotify |
|
438 @see CObexServer |
|
439 */ |
|
440 class MObexServerNotifyAsync |
|
441 { |
|
442 public: |
|
443 |
|
444 /** |
|
445 Returns a null aObject if the extension is not implemented, or a pointer to another |
|
446 interface if it is. |
|
447 @param aInterface UID of the interface to return |
|
448 @param aObject the container for another interface as specified by aInterface |
|
449 */ |
|
450 IMPORT_C virtual void MOSNA_ExtensionInterfaceL(TUid aInterface, void*& aObject); |
|
451 |
|
452 |
|
453 |
|
454 /** Called if an OBEX protocol error occurs. |
|
455 |
|
456 It is only called for fatal errors that cause the OBEX connection to terminate. |
|
457 An error that does not terminate the connection, for example the server issuing |
|
458 a semantically valid, but unrecognised command, will not be indicated. |
|
459 |
|
460 @param aError Error code that describes the OBEX error. OBEX specific error |
|
461 codes are listed from KErrIrObexClientNoDevicesFound. |
|
462 |
|
463 @publishedAll |
|
464 @released |
|
465 */ |
|
466 virtual void ErrorIndication(TInt aError) =0; |
|
467 |
|
468 |
|
469 |
|
470 /** Called when the underlying transport connection is made from a remote |
|
471 client to the server. |
|
472 |
|
473 Note that this does not, however, indicate an OBEX connection has been successfully |
|
474 established. |
|
475 |
|
476 You can define any low-level connection policy here. It is also a good place |
|
477 to set up the local connection information (CObex::LocalInfo()), if any non-defaults |
|
478 are required. |
|
479 |
|
480 @publishedAll |
|
481 @released |
|
482 */ |
|
483 virtual void TransportUpIndication() =0; |
|
484 |
|
485 |
|
486 |
|
487 /** Called when the transport connection is dropped (by either party). |
|
488 |
|
489 It is called whether the OBEX connection was gracefully disconnected or not. |
|
490 The function is the definitive place for disconnection processing. |
|
491 |
|
492 @publishedAll |
|
493 @released |
|
494 */ |
|
495 virtual void TransportDownIndication() =0; |
|
496 |
|
497 |
|
498 |
|
499 /** Called when an OBEX connection is made from a remote client. |
|
500 |
|
501 Override this function to provide any extra OBEX connection processing. |
|
502 |
|
503 @param aRemoteInfo Connection information supplied by that remote machine |
|
504 @param aInfo Further information about the requested connection (reserved) |
|
505 |
|
506 @publishedAll |
|
507 @released |
|
508 */ |
|
509 virtual void ObexConnectIndication(const TObexConnectInfo& aRemoteInfo, const TDesC8& aInfo) =0; |
|
510 |
|
511 |
|
512 |
|
513 /** Called on a (graceful) OBEX disconnection by the client. |
|
514 |
|
515 Override this to provide any extra processing OBEX disconnection processing. |
|
516 |
|
517 Note that this indication will not be raised if the remote machine simply |
|
518 drops the transport connection. However, ErrorIndication() will be called |
|
519 if the disconnection is unexpected/ invalid (i.e. another operation was in |
|
520 progress at the time). In all cases, TransportDownIndication() will be called. |
|
521 |
|
522 @param aInfo Contains information about the disconnection (reserved) |
|
523 |
|
524 @publishedAll |
|
525 @released |
|
526 */ |
|
527 virtual void ObexDisconnectIndication(const TDesC8& aInfo) =0; |
|
528 |
|
529 |
|
530 |
|
531 /** Called on receipt of the first packet of a (valid) put request. |
|
532 |
|
533 It is called before any parsing of the packet is performed, simply to establish |
|
534 whether this server is interested in receiving objects at all. |
|
535 |
|
536 Following this notification, the server will wait for a call to |
|
537 CObexServer::RequestIndicationCallback supplying a CObexBaseObject derived |
|
538 object to receive into or a response code specifying the error. |
|
539 |
|
540 @publishedAll |
|
541 @released |
|
542 */ |
|
543 virtual void PutRequestIndication() =0; |
|
544 |
|
545 |
|
546 |
|
547 /** Called on receipt of every packet of an OBEX PUT operation. |
|
548 |
|
549 It will always be preceded by a PutRequestIndication(). The object returned |
|
550 by the request indication will be updated to reflect all the information received |
|
551 concerning the object which the client is sending, from packets up to and |
|
552 including the current one. |
|
553 |
|
554 You can use this function to provide periodic user notification on the progress |
|
555 of the transfer (noting that the Length attribute may take an arbitrary number |
|
556 of packets to become non-zero, and the constraints on its accuracy). Due to |
|
557 the nature of OBEX operations, where any header attribute can be sent at any |
|
558 point in the transfer, this is also a good place to marshal the details of |
|
559 a received object, and possibly prompt for action on the received object (e.g. |
|
560 renaming on filename clashes). |
|
561 |
|
562 Note that this function could be hit quite heavily, in proportion to the size |
|
563 of the object transferred. Therefore more consideration should be given to |
|
564 the speed of execution of this function than that of the other indications. |
|
565 |
|
566 @return KErrNone instructs the server to allow the client to continue the put |
|
567 operation. Any other value cancels the operation with an appropriate OBEX |
|
568 server response code. |
|
569 |
|
570 @publishedAll |
|
571 @released |
|
572 */ |
|
573 virtual TInt PutPacketIndication() =0; |
|
574 |
|
575 |
|
576 |
|
577 /** Called after the final put packet has been successfully received and parsed. |
|
578 |
|
579 Note that there will not necessarily be a call to this function corresponding |
|
580 to each PutRequestIndication() as, if an error occurs while the put is being |
|
581 carried out, ErrorIndication() will be called instead. |
|
582 |
|
583 Following this notification, the server will wait for a call to |
|
584 CObexServer::RequestCompleteIndicationCallback supplying a Obex response code. |
|
585 |
|
586 @publishedAll |
|
587 @released |
|
588 */ |
|
589 virtual void PutCompleteIndication() =0; |
|
590 |
|
591 |
|
592 |
|
593 /** Called when a full get request has been received from the client. |
|
594 |
|
595 aRequestedObject holds all the details about the object the remote client |
|
596 has requested. Use this function to analyse the client's request, and return |
|
597 a pointer to the object to be returned to the client, or NULL to return no |
|
598 object. |
|
599 |
|
600 Following this notification, the server will wait for a call to |
|
601 CObexServer::RequestIndicationCallback supplying a CObexBaseObject derived |
|
602 object to send to the client or a response code specifying the error. |
|
603 |
|
604 @param aRequiredObject Details about the object the remote client has requested |
|
605 |
|
606 @publishedAll |
|
607 @released |
|
608 */ |
|
609 virtual void GetRequestIndication(CObexBaseObject* aRequiredObject) =0; |
|
610 |
|
611 |
|
612 |
|
613 /** Called for every packet of get reply sent by the server back to the client. |
|
614 |
|
615 The function is only called while an object is being sent to the client, not |
|
616 while the client is providing its initial specification for the object it |
|
617 requires. |
|
618 |
|
619 You can use this function to provide user notification on the object being |
|
620 sent, and its progress. As with PutPacketIndication(), you should consider |
|
621 that this function might get called often, especially for large objects and |
|
622 small OBEX packet sizes, so the speed of execution here is important. |
|
623 |
|
624 @return KErrNone to continue sending the object, or any other error code to |
|
625 cancel the operation |
|
626 |
|
627 @publishedAll |
|
628 @released |
|
629 */ |
|
630 virtual TInt GetPacketIndication() =0; |
|
631 |
|
632 |
|
633 |
|
634 /** Called when the final packet of the object has been returned to the client. |
|
635 |
|
636 Note like PutCompleteIndication(), this function might not be called for each |
|
637 GetRequestIndication(), if the operation is interrupted by an error. |
|
638 |
|
639 Following this notification, the server will wait for a call to |
|
640 CObexServer::RequestCompleteIndicationCallback supplying a Obex response code. |
|
641 |
|
642 @publishedAll |
|
643 @released |
|
644 */ |
|
645 virtual void GetCompleteIndication() =0; |
|
646 |
|
647 |
|
648 |
|
649 /** Called when an OBEX SETPATH command is received by the server. |
|
650 |
|
651 Following this notification, the server will wait for a call to |
|
652 CObexServer::RequestCompleteIndicationCallback supplying a Obex response code. |
|
653 |
|
654 @param aPathInfo SETPATH command parameters |
|
655 @param aInfo Not currently used |
|
656 |
|
657 @publishedAll |
|
658 @released |
|
659 */ |
|
660 virtual void SetPathIndication(const CObex::TSetPathInfo& aPathInfo, const TDesC8& aInfo) =0; |
|
661 |
|
662 |
|
663 |
|
664 /** Called when an abort packet is received from the client. |
|
665 |
|
666 An OBEX abort command simply cancels the current operation, and does not necessarily |
|
667 have to cause the connection to be dropped. On return, a ERespSuccess packet |
|
668 is sent to the client. |
|
669 |
|
670 @publishedAll |
|
671 @released |
|
672 */ |
|
673 virtual void AbortIndication() =0; |
|
674 |
|
675 |
|
676 |
|
677 /** Cancel an asynchronous callback request (ie. PutRequest/GetRequest/PutComplete/GetComplete/SetPath |
|
678 notification). |
|
679 |
|
680 Note that ignoring this call will lead to a panic when the indication callback function |
|
681 is called. |
|
682 |
|
683 @publishedAll |
|
684 @released |
|
685 */ |
|
686 virtual void CancelIndicationCallback() =0; |
|
687 }; |
|
688 |
|
689 |
|
690 #endif // __OBEXSERVER_H |
|
691 |
|
692 |
|