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