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