epoc32/include/mw/http/framework/cprotocolhandler.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) 2001-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
// please do not delete
williamr@2
    15
// 
williamr@2
    16
//
williamr@2
    17
williamr@2
    18
/**
williamr@2
    19
 @file CProtocolHandler.h
williamr@2
    20
 @warning : This file contains Rose Model ID comments 
williamr@2
    21
*/
williamr@2
    22
williamr@2
    23
#ifndef __CPROTOCOLHANDLER_H__
williamr@2
    24
#define __CPROTOCOLHANDLER_H__
williamr@2
    25
williamr@2
    26
// System includes
williamr@2
    27
#include <e32base.h>
williamr@2
    28
#include <http/framework/httplogger.h>
williamr@2
    29
#include <http/mhttpfilter.h>
williamr@2
    30
#include <http/rhttpsession.h>
williamr@2
    31
williamr@2
    32
// Forward declarations
williamr@2
    33
class CHeaderCodec;
williamr@2
    34
class CProtTransaction;
williamr@2
    35
class CSecurityPolicy;
williamr@2
    36
class MProtHandlerInterface;
williamr@2
    37
williamr@2
    38
/**
williamr@2
    39
The ECom protocol handler plugin interface UID.
williamr@2
    40
@publishedAll
williamr@2
    41
@released
williamr@2
    42
*/
williamr@2
    43
const TUid KUidProtocolHandlerPluginInterface = {0x1000A449};
williamr@2
    44
williamr@2
    45
// 
williamr@2
    46
/**
williamr@2
    47
Defined active object priorities for the Protocol Handler
williamr@2
    48
@publishedAll
williamr@2
    49
@released
williamr@2
    50
*/
williamr@2
    51
const TInt KProtocolHandlerActivePriority = CActive::EPriorityStandard;
williamr@2
    52
/**
williamr@2
    53
Defined active object priorities for the Transaction
williamr@2
    54
@publishedAll
williamr@2
    55
@released
williamr@2
    56
*/
williamr@2
    57
const TInt KTransactionActivePriority = KProtocolHandlerActivePriority+1;
williamr@2
    58
williamr@2
    59
williamr@2
    60
//##ModelId=3C4C186A02A3
williamr@2
    61
class CProtocolHandler : public CActive, public MHTTPFilter
williamr@2
    62
/**
williamr@2
    63
An abstract protocol handler.  Protocol handlers are required to
williamr@2
    64
act as the bridge between abstract representations of sessions, transactions and
williamr@2
    65
headers (the client side of the HTTP architecture) and specific comms transports
williamr@2
    66
(the network side of the architecture).
williamr@2
    67
williamr@2
    68
Each instance of a concrete subclass of CProtocolHandler is associated
williamr@2
    69
with a specific	client session, and hence with a particular choice of proxy type,
williamr@2
    70
and by implication, transport type.  It is designed to appear like a filter in
williamr@2
    71
order to be placed at the end of a session's filter queue.  This allows it to 
williamr@2
    72
receive transaction-related events in the same way that any other filter
williamr@2
    73
(or indeed, the client) does.  An active object, it may implement a queuing
williamr@2
    74
system for submitted transactions, according to the chosen internal service
williamr@2
    75
model.
williamr@2
    76
williamr@2
    77
In order to divide the abstract functionality associated with handling the HTTP
williamr@2
    78
protocol handler from the specifics needed for a particular choice of transport,
williamr@2
    79
this class defines a number of pure virtual methods which allow it to defer
williamr@2
    80
transport-specific choices or mechamisms.  These are mainly concerned with the
williamr@2
    81
service model (ie. allocation of transactions to objects that can handle them), the
williamr@2
    82
codec model (ie. on-demand encoding/decoding of	HTTP header data) and general
williamr@2
    83
housekeeping (eg. instantiation and cleanup of objects at particular points in
williamr@2
    84
a transaction lifecycle).
williamr@2
    85
@publishedAll
williamr@2
    86
@released
williamr@2
    87
*/
williamr@2
    88
	{
williamr@2
    89
public:	// Methods
williamr@2
    90
williamr@2
    91
/**	
williamr@2
    92
	Standard factory constructor. This is the ECOM interface class from
williamr@2
    93
	which concrete protocol handlers are derived. The method queries
williamr@2
    94
	ECOM for the protocol handler plugin that matches the protocol
williamr@2
    95
	description passed in.
williamr@2
    96
	@param			aProtocol	(in) The name of the protocol required.
williamr@2
    97
	@param			aSession	(in) The HTTP session on which this protocol handler
williamr@2
    98
									 will be installed.
williamr@2
    99
	@leave			KErrNoMemory if there was not enough memory to create the object.
williamr@2
   100
*/
williamr@2
   101
	//##ModelId=3C4C186B007E
williamr@2
   102
	static CProtocolHandler* NewL(const TDesC8& aProtocol, RHTTPSession aSession);
williamr@2
   103
williamr@2
   104
/**	
williamr@2
   105
	Intended Usage:	Class destructor.
williamr@2
   106
*/
williamr@2
   107
	//##ModelId=3C4C186B0075
williamr@2
   108
	IMPORT_C virtual ~CProtocolHandler();
williamr@2
   109
williamr@2
   110
/**	
williamr@2
   111
	Obtain the protocol handler's header codec.
williamr@2
   112
	@return			The header codec owned by this protocol handler, or NULL if one
williamr@2
   113
					has not yet been created.
williamr@2
   114
	@see CHeaderCodec
williamr@2
   115
*/
williamr@2
   116
	//##ModelId=3C4C186B0074
williamr@2
   117
	IMPORT_C CHeaderCodec* Codec() const;
williamr@2
   118
williamr@2
   119
williamr@2
   120
/** 
williamr@2
   121
	Get the Server Certificate for the current session.
williamr@2
   122
	@return	The certificate information or NULL if it is not available
williamr@2
   123
*/
williamr@2
   124
	IMPORT_C const CCertificate* SessionServerCert();
williamr@2
   125
williamr@2
   126
/** 
williamr@2
   127
	Get the Server Certificate for the specified transaction.
williamr@2
   128
	@param	aTransaction The transaction for which the certificate is requested
williamr@2
   129
	@return	The certificate information or NULL if it is not available
williamr@2
   130
*/
williamr@2
   131
	IMPORT_C const CCertificate* TransactionServerCert( RHTTPTransaction aTransaction);
williamr@2
   132
williamr@2
   133
public:	// Methods to be implemented in specific protocol handlers
williamr@2
   134
williamr@2
   135
/** 
williamr@2
   136
	Intended Usage:	Get the Server Certificate for the current session.
williamr@2
   137
	@param	aServerCert A TCertInfo which will be filled with the certificate information
williamr@2
   138
	@return	An error code.  KErrNone if aServerCert has been completed, otherwise one of 
williamr@2
   139
	the system wide error codes
williamr@2
   140
*/
williamr@2
   141
	virtual TInt SessionServerCert(TCertInfo& aServerCert) = 0;
williamr@2
   142
williamr@2
   143
/** 
williamr@2
   144
	Intended Usage:	Get the Server Certificate for the specified transaction.
williamr@2
   145
	@param	aServerCert A TCertInfo which will be filled with the certificate information
williamr@2
   146
	@param	aTransaction The transaction for which the certificate is requested
williamr@2
   147
	@return	An error code.  KErrNone if aServerCert has been completed, otherwise one of 
williamr@2
   148
			the system wide error codes
williamr@2
   149
*/
williamr@2
   150
	virtual TInt TransactionServerCert(TCertInfo& aServerCert, RHTTPTransaction aTransaction) = 0;
williamr@2
   151
williamr@2
   152
public:	// Methods from MHTTPFilterBase
williamr@2
   153
	
williamr@2
   154
/**
williamr@2
   155
	Intended Usage:	Called when the filter's registration conditions are satisfied for events that
williamr@2
   156
	occur on a transaction. Any Leaves must be handled by the appropriate MHFRunError.
williamr@2
   157
	Note that this function is not allowed to leave if called with certain events. 
williamr@2
   158
	@see THTTPEvent
williamr@2
   159
	@param aTransaction The transaction that the event has occurred on.
williamr@2
   160
	@param aEvent aEvent The event that has occurred.
williamr@2
   161
	@leave Standard Symbian OS error codes. e.g. KErrNoMemory.
williamr@2
   162
	@see MHTTPFilterBase	
williamr@2
   163
*/
williamr@2
   164
	//##ModelId=3C4C186B0061
williamr@2
   165
	IMPORT_C virtual void MHFRunL(RHTTPTransaction aTransaction, const THTTPEvent& aEvent);
williamr@2
   166
williamr@2
   167
/**
williamr@2
   168
	Intended Usage:	Called when the filters registration conditions are satisfied for events that occur
williamr@2
   169
	on the session. Any leaves must be handled by the appropriate MHFRunError.
williamr@2
   170
	@param aEvent The session event that has occured.
williamr@2
   171
	@leave KErrNoMemory if an attempt to allocate memory has failed
williamr@2
   172
	@leave KErrHttpCantResetRequestBody if the request body needed to be rewound by the client
williamr@2
   173
		   but it doesn't support this
williamr@2
   174
	@see MHTTPFilterBase
williamr@2
   175
*/
williamr@2
   176
	//##ModelId=3C4C186B0057
williamr@2
   177
	IMPORT_C virtual void MHFSessionRunL(const THTTPSessionEvent& aEvent);
williamr@2
   178
williamr@2
   179
/**
williamr@2
   180
	Intended Usage:	Called when RunL leaves from a transaction event. This works in the same
williamr@2
   181
	way as CActve::RunError; return KErrNone if you have handled the error.
williamr@2
   182
	If you don't completely handle the error, a panic will occur.
williamr@2
   183
	@param aError The leave code that RunL left with.
williamr@2
   184
	@param aTransaction The transaction that was being processed.
williamr@2
   185
	@param aEvent The Event that was being processed.
williamr@2
   186
	@return KErrNone if the error has been cancelled or the code
williamr@2
   187
			of the continuing error otherwise.
williamr@2
   188
	@see MHTTPFilterBase
williamr@2
   189
*/
williamr@2
   190
	//##ModelId=3C4C186B0043
williamr@2
   191
	IMPORT_C virtual TInt MHFRunError(TInt aError, RHTTPTransaction aTransaction, const THTTPEvent& aEvent);
williamr@2
   192
williamr@2
   193
/**
williamr@2
   194
	Intended Usage:	Called when MHFRunL leaves from a session event. This works in the same
williamr@2
   195
	way as CActve::RunError. If you don't completely handle the error, a panic will occur.
williamr@2
   196
	@param aError The leave code that RunL left with.
williamr@2
   197
	@param aEvent The Event that was being processed.
williamr@2
   198
	@return KErrNone if the error has been cancelled or the code
williamr@2
   199
			of the continuing error otherwise.	
williamr@2
   200
	@see MHTTPFilterBase
williamr@2
   201
*/
williamr@2
   202
	//##ModelId=3C4C186B0038	
williamr@2
   203
	IMPORT_C virtual TInt MHFSessionRunError(TInt aError, const THTTPSessionEvent& aEvent);
williamr@2
   204
williamr@2
   205
public:	// Methods from MHTTPFilter
williamr@2
   206
williamr@2
   207
/** 
williamr@2
   208
	Intended Usage:	Called when the filter is being removed from a session's filter queue.
williamr@2
   209
	@param aSession The session it's being removed from
williamr@2
   210
	@param aHandle The filter handle. Complex filters may need to 
williamr@2
   211
				   refer to this to keep track of which particular registration is
williamr@2
   212
				   being unloaded.
williamr@2
   213
	@see MHTTFilter
williamr@2
   214
*/
williamr@2
   215
	//##ModelId=3C4C186B0025
williamr@2
   216
	IMPORT_C virtual void MHFUnload(RHTTPSession aSession, THTTPFilterHandle aHandle);
williamr@2
   217
williamr@2
   218
/** 
williamr@2
   219
	Intended Usage:	Called when the filter is being added to the session's filter queue.
williamr@2
   220
	@param aSession The session it's being added to.
williamr@2
   221
	@param aHandle The filter handle. Complex filters may need to keep
williamr@2
   222
				   track of this, for instance if generating events in response to
williamr@2
   223
				   external stimuli
williamr@2
   224
	@see MHTTFilter
williamr@2
   225
 */
williamr@2
   226
	//##ModelId=3C4C186B001A
williamr@2
   227
	IMPORT_C virtual void MHFLoad(RHTTPSession aSession, THTTPFilterHandle aHandle);
williamr@2
   228
williamr@2
   229
protected: // callbacks/methods for sub-classes
williamr@2
   230
williamr@2
   231
/**	
williamr@2
   232
	Callback method for concrete protocol handler sub-classes to
williamr@2
   233
	inform the base protocol handler that a transaction has completed.
williamr@2
   234
	The concrete protocol handler must call this method in order to
williamr@2
   235
	supply a completion event that will be sent to the client.
williamr@2
   236
	In addition, the method allows the base protocol handler to do some
williamr@2
   237
	queue management.
williamr@2
   238
	@param			aTrans			(in) the completed transaction
williamr@2
   239
	@param			aEventStatus	(in) an event to be sent back to the client along
williamr@2
   240
										 the filter queue
williamr@2
   241
	@leave			THTTPPanic::EInvalidFilterHandle if unable to send event.
williamr@2
   242
 */
williamr@2
   243
	//##ModelId=3C4C186B0010
williamr@2
   244
	IMPORT_C void TransactionCompletedL(RHTTPTransaction aTrans, THTTPEvent aEventStatus);
williamr@4
   245
    IMPORT_C TInt TransactionCompleted(RHTTPTransaction aTrans, THTTPEvent aEventStatus);
williamr@2
   246
/**	
williamr@2
   247
	Obtain the number of currently active transactions
williamr@2
   248
	@return			The number of currently active transactions
williamr@2
   249
 */
williamr@2
   250
	//##ModelId=3C4C186B0006
williamr@2
   251
	IMPORT_C TInt NumActiveTransactions() const;
williamr@2
   252
williamr@2
   253
/**	
williamr@2
   254
	Callback method for concrete protocol handler sub-classes to
williamr@2
   255
	inform the base protocol handler that a transaction has failed
williamr@2
   256
	utterly. (i.e. the sub-class used aTrans.Fail().) The base protocol
williamr@2
   257
	handler sets the transaction state to be cancelled.
williamr@2
   258
	@param			aTrans			(in) the completed transaction
williamr@2
   259
 */
williamr@2
   260
	//##ModelId=3C4C186A03E5
williamr@2
   261
	IMPORT_C void TransactionFailed(RHTTPTransaction aTrans);
williamr@2
   262
williamr@2
   263
/**	
williamr@2
   264
	Completes this active object - allows the protocol handler to
williamr@2
   265
	reevaluate the queue of pending transactions and service new ones
williamr@2
   266
	if possible.
williamr@2
   267
 */
williamr@2
   268
	//##ModelId=3C4C186A03E4
williamr@2
   269
	IMPORT_C void CompleteSelf();
williamr@2
   270
williamr@2
   271
/**	
williamr@2
   272
	Searches the array of CProtTransaction objects to if the
williamr@2
   273
	aTransaction object is wrapped by one of them. If one is found aProtTransaction is set to it
williamr@2
   274
	@param aTransaction	The transaction to search for.
williamr@2
   275
	@param aProtTransaction	Reference to a CProtTransaction which will be set to the
williamr@2
   276
		   CProtTransaction which wraps the RHTTPTransaction.
williamr@2
   277
	@return If a CProtTransaction object is found, a positive value is
williamr@2
   278
			returned that is the index to that object in the array. If 
williamr@2
   279
			no object is found, KErrNotFound is returned.
williamr@2
   280
 */
williamr@2
   281
	IMPORT_C TInt FindTransaction(RHTTPTransaction aTransaction, const CProtTransaction*& aProtTransaction) const;
williamr@2
   282
williamr@4
   283
	IMPORT_C CProtTransaction* FindProtocolTransaction(RHTTPTransaction aTransaction) const;
williamr@2
   284
private: // methods to be implemented in specific protocol handlers
williamr@2
   285
williamr@2
   286
/**	Intended usage:	Creates the specific type of codec required for a specific type
williamr@2
   287
					of protocol handler.
williamr@2
   288
					
williamr@2
   289
					This must be implemented by a concrete protocol handler sub-class.
williamr@2
   290
 */
williamr@2
   291
	//##ModelId=3C4C186A03DC
williamr@2
   292
	virtual void CreateCodecL() = 0;
williamr@2
   293
williamr@2
   294
/**	Intended Usage:	Creates a representation of a client transaction to be used in the
williamr@2
   295
					protocol handler.  Since the protocol handler deals with the low-
williamr@2
   296
					level data for a transaction as sent over a particular transport,
williamr@2
   297
					an appropriate CProtTransaction-derived class is used that owns a
williamr@2
   298
					CRxData and a CTxData to handle the low-level data.
williamr@2
   299
					
williamr@2
   300
					This must be implemented by a concrete protocol handler sub-class.
williamr@2
   301
	@leave			KErrNoMemory if there was not enough memory to create the object.
williamr@2
   302
					create the object.
williamr@2
   303
	@param			aTransaction	The RHTTPTransaction object associated with
williamr@2
   304
									this CProtTransaction object.
williamr@2
   305
	@return			A pointer to a created CProtTransaction-derived class.
williamr@2
   306
	@see			CRxData
williamr@2
   307
	@see			CTxData
williamr@2
   308
 */
williamr@2
   309
	//##ModelId=3C4C186A03DA
williamr@2
   310
	virtual CProtTransaction* CreateProtTransactionL(RHTTPTransaction aTransaction) = 0;
williamr@2
   311
williamr@2
   312
/**	Intended Usage:	Attempt to service the transaction.  This implies that the concrete
williamr@2
   313
					protocol handler will allocate some transport resources to the
williamr@2
   314
					transaction - which could fail if the protocol handler has hit an
williamr@2
   315
					internal limit of resources or bandwidth.
williamr@2
   316
					Implementations of this interface may leave with any of KErrHttpInvalidUri,
williamr@2
   317
					KErrGeneral, KErrNoMemory
williamr@2
   318
					
williamr@2
   319
					This must be implemented by a concrete protocol handler sub-class.
williamr@2
   320
	@param			aTrans	The pending protocol transaction object which is to be
williamr@2
   321
							serviced.
williamr@2
   322
	@return			A flag that indicates if the transaction can be serviced immediately.
williamr@2
   323
 */
williamr@2
   324
	//##ModelId=3C4C186A03D0
williamr@2
   325
	virtual TBool ServiceL(CProtTransaction& aTrans) = 0;
williamr@2
   326
williamr@2
   327
/**	Intended Usage:	Called when the RHTTPTransaction object corresponding to aTrans has
williamr@2
   328
					been closed by the client. This allows the concrete protocol handler
williamr@2
   329
					to do any cleanup required for this particular transaction.
williamr@2
   330
williamr@2
   331
					Ownership of the CProtTransaction object is transferred back to the
williamr@2
   332
					concrete protocol handler, which then has deletion responsibility
williamr@2
   333
					for it.  By the time this function has been called, the base
williamr@2
   334
					protocol handler will have dequeued the transaction.
williamr@2
   335
					
williamr@2
   336
					The client's RHTTPTransaction will be closed when this function
williamr@2
   337
					returns,  so it is not possible to send events to the client during
williamr@2
   338
					the function's execution.
williamr@2
   339
					
williamr@2
   340
					This must be implemented by a concrete protocol handler sub-class.
williamr@2
   341
	@param			aTrans		(in) A pointer to the transaction about to be closed.
williamr@2
   342
 */
williamr@2
   343
	//##ModelId=3C4C186A03C6
williamr@2
   344
	virtual void ClosedTransactionHook(CProtTransaction* aTrans) = 0;
williamr@2
   345
williamr@2
   346
/**	Intended Usage:	Called when the RHTTPTransaction object corresponding to aTrans has
williamr@2
   347
					been cancelled by the client or an intermediate filter. This allows
williamr@2
   348
					the concrete protocol handler to do any cleanup and to perform the
williamr@2
   349
					necessary actions for cancellation on its transport layer.
williamr@2
   350
					
williamr@2
   351
					This must be implemented by a concrete protocol handler sub-class.
williamr@2
   352
	@param			aTrans		(in) A reference to the transaction being cancelled.
williamr@2
   353
 */
williamr@2
   354
	//##ModelId=3C4C186A03B3
williamr@2
   355
	virtual void CancelTransactionHook(CProtTransaction& aTransaction) = 0;
williamr@2
   356
williamr@2
   357
/**	Intended Usage:	Called to notify the concrete protocol handler that new request
williamr@2
   358
					body data is available for transmission.
williamr@2
   359
					
williamr@2
   360
					This must be implemented by a concrete protocol handler sub-class.
williamr@2
   361
	@param			aTrans		(in) A reference to the transaction whose request body
williamr@2
   362
									 has new data available.
williamr@2
   363
 */
williamr@2
   364
	//##ModelId=3C4C186A03A8
williamr@2
   365
	virtual void NotifyNewRequestBodyPart(CProtTransaction& aTransaction) = 0;
williamr@2
   366
williamr@2
   367
protected: // Methods inherited from CActive
williamr@2
   368
williamr@2
   369
/**	Intended Usage:	Do some processing when a previous asynchronous request made by
williamr@2
   370
					this object has completed.
williamr@2
   371
 */
williamr@2
   372
	//##ModelId=3C4C186A0377
williamr@2
   373
	IMPORT_C virtual void RunL();
williamr@2
   374
williamr@2
   375
/**	Intended Usage:	Do any cleanup required should RunL leave
williamr@2
   376
	@param			aError		(in) The error code that RunL left with
williamr@2
   377
	@return			A final error code - KErrNone if the error was handled by this
williamr@2
   378
					method.
williamr@2
   379
 */
williamr@2
   380
	//##ModelId=3C4C186A036E
williamr@2
   381
	IMPORT_C virtual TInt RunError(TInt aError);
williamr@2
   382
williamr@2
   383
/**	Intended Usage:	Cancel outstanding asynchronous requests that this object has made
williamr@2
   384
 */
williamr@2
   385
	//##ModelId=3C4C186A036D
williamr@2
   386
	IMPORT_C virtual void DoCancel();
williamr@2
   387
williamr@2
   388
protected:	// Methods
williamr@2
   389
williamr@2
   390
/**	
williamr@2
   391
	Constructs a protocol handler associated with the supplied HTTP
williamr@2
   392
	client session.
williamr@2
   393
	@param			aSession	(in) The session on which the new protocol handler will
williamr@2
   394
									 be installed.
williamr@2
   395
 */
williamr@2
   396
	IMPORT_C CProtocolHandler(RHTTPSession aSession);
williamr@2
   397
williamr@2
   398
/**	
williamr@2
   399
	Second phase construction in which any necessary allocation is done
williamr@2
   400
	Implementations of this interface may leave with KErrNoMemory
williamr@2
   401
	@param aSession The HTTP session on which this protocol handler
williamr@2
   402
		   will be installed.
williamr@2
   403
 */
williamr@2
   404
	//##ModelId=3C4C186A036C
williamr@2
   405
	IMPORT_C void ConstructL(RHTTPSession aSession);
williamr@2
   406
williamr@2
   407
protected: // Attributes
williamr@2
   408
williamr@2
   409
	/** The session to which this protocol handler is dedicated
williamr@2
   410
	*/
williamr@2
   411
	//##ModelId=3C4C186A033C
williamr@2
   412
	RHTTPSession iSession;
williamr@2
   413
williamr@2
   414
	/** The codec used for this protocol handler (to be specialised in subclasses)
williamr@2
   415
	*/
williamr@2
   416
	//##ModelId=3C4C186A032F
williamr@2
   417
	CHeaderCodec* iCodec;
williamr@2
   418
williamr@2
   419
	/** HTTP logger handle (debug only)
williamr@2
   420
	*/
williamr@2
   421
	__DECLARE_LOG
williamr@2
   422
williamr@2
   423
	/** An interface providing the security policy. This may be NULL if there is no security policy plugin */
williamr@2
   424
	//##ModelId=3C4C186A031D
williamr@2
   425
	CSecurityPolicy* iSecurityPolicy;	
williamr@2
   426
williamr@2
   427
private: // Methods
williamr@2
   428
williamr@2
   429
/**	
williamr@2
   430
	Called after a client RHTTPTransaction::SubmitL(), this method
williamr@2
   431
	enqueues the supplied client transaction.  It checks to see if there
williamr@2
   432
	already exists a CProtTransaction for this transaction. If there is
williamr@2
   433
	and its state is ECancelled, then the associated request data is
williamr@2
   434
	reset and the state changed to EPending. A CompleteSelf() is issued.
williamr@2
   435
	In the case of an existing CProtTransaction that has not been
williamr@2
   436
	cancelled, the submit event is ignored. If no CProtTransaction
williamr@2
   437
	object existed, then one is created for the transaction and a
williamr@2
   438
	CompleteSelf() is issued.
williamr@2
   439
	@leave			KErrHttpCantResetRequestBody if the request body data cannot
williamr@2
   440
					be reset. KErrNoMemory if a new CProtTransaction cannot be
williamr@2
   441
					created or added to the transaction queue.
williamr@2
   442
	@param			aTransaction	The submitted transaction.
williamr@2
   443
	@pre 			None
williamr@2
   444
	@post			If there is a new pending CProtTransaction object the protocol
williamr@2
   445
					handler will have been self-completed (i.e. the RunL will be 
williamr@2
   446
					called).
williamr@2
   447
 */
williamr@2
   448
	//##ModelId=3C4C186A0362
williamr@2
   449
	void SubmitTransactionL(RHTTPTransaction aTransaction);
williamr@2
   450
williamr@2
   451
/**	
williamr@2
   452
	Sets the state of the CProtTransaction object for this 
williamr@2
   453
	transaction to ECancelled, and resets the object. This
williamr@2
   454
	object can be reused if the transaction is resubmitted.
williamr@2
   455
	@param			RHTTPTransaction aTrans
williamr@2
   456
	@pre 			A CProtTransaction object exists for this transaction.
williamr@2
   457
	@post			The state of the CProtTransaction object is set to ECancelled 
williamr@2
   458
					and it has been reset.
williamr@2
   459
 */
williamr@2
   460
	//##ModelId=3C4C186A0359
williamr@2
   461
	void HandleCancelTransaction(RHTTPTransaction aTrans);
williamr@2
   462
williamr@2
   463
/**	
williamr@2
   464
	Removes the CProtTransaction object for the transaction
williamr@2
   465
	from the queue of CProtTransaction objects.
williamr@2
   466
	@param			RHTTPTransaction aTrans
williamr@2
   467
	@pre 			A CProtTransaction object exists for this transaction.
williamr@2
   468
	@post			The CProtTransaction object has been removed from the queue.
williamr@2
   469
 */
williamr@2
   470
	//##ModelId=3C4C186A034F
williamr@2
   471
	void HandleClosedTransaction(RHTTPTransaction aTrans);
williamr@2
   472
williamr@2
   473
/**	
williamr@2
   474
	Searches the array of CProtTransaction objects to if the
williamr@2
   475
	aTransaction object is wrapped by one of them.
williamr@2
   476
	@param			aTransaction	The transaction to search for.
williamr@2
   477
	@return			If a CProtTransaction object is found, a positive value is
williamr@2
   478
					returned that is the index to that object in the array. If 
williamr@2
   479
					no object is found, KErrNotFound is returned.
williamr@2
   480
 */
williamr@2
   481
	//##ModelId=3C4C186A0346
williamr@2
   482
	TInt FindTransaction(RHTTPTransaction aTransaction) const;
williamr@2
   483
williamr@2
   484
protected:
williamr@2
   485
/**	
williamr@2
   486
	Intended Usage: This is a mechanism for allowing future change to CProtocolHandler API 
williamr@2
   487
	without breaking BC.
williamr@2
   488
	@param aInterfaceId		the UID of the API function being called.
williamr@2
   489
	@param aInterfacePtr	reference to pointer to actual function implementation (in the derived class)
williamr@2
   490
 */
williamr@2
   491
	inline virtual void GetInterfaceL(TUid aInterfaceId, MProtHandlerInterface*& aInterfacePtr);
williamr@2
   492
williamr@2
   493
public:
williamr@2
   494
/**	Intended Usage:	Reserve a slot in the v-table to preserve future BC
williamr@2
   495
 */
williamr@2
   496
	//##ModelId=3C4C186A0344
williamr@2
   497
	inline virtual void Reserved2();
williamr@2
   498
williamr@2
   499
williamr@2
   500
private: // Attributes
williamr@2
   501
williamr@2
   502
	/** A list of transactions. Each transaction has a list state, e.g. pending,
williamr@2
   503
		active, etc.
williamr@2
   504
	*/
williamr@2
   505
	//##ModelId=3C4C186A0313
williamr@2
   506
	RPointerArray<CProtTransaction>		iTransactions;
williamr@2
   507
williamr@2
   508
	/**	The transaction which is currently being serviced - used in RunError so 
williamr@2
   509
		we know which transaction caused RunL to leave.
williamr@2
   510
	*/
williamr@2
   511
	//##ModelId=3C4C186A02FF
williamr@2
   512
	RHTTPTransaction					iCurrentTransaction;
williamr@2
   513
williamr@2
   514
	/** The destructor key UID indentification required by ECom
williamr@2
   515
	*/
williamr@2
   516
	//##ModelId=3C4C186A02F5
williamr@2
   517
	TUid iDtor_ID_Key;
williamr@2
   518
	};
williamr@2
   519
williamr@2
   520
williamr@2
   521
	
williamr@2
   522
/**
williamr@2
   523
Interface for adding to ProtocolHandler API
williamr@2
   524
@publishedAll
williamr@2
   525
@released
williamr@2
   526
*/
williamr@2
   527
williamr@2
   528
const TInt KProtHandlerSessionServerCertUid		= 0x1028180D;
williamr@2
   529
const TInt KProtHandlerTransactionServerCertUid	= 0x1028180E;
williamr@2
   530
williamr@2
   531
class MProtHandlerInterface
williamr@2
   532
	{
williamr@2
   533
public:
williamr@2
   534
	/** 
williamr@2
   535
	Intended Usage: Get the Server Certificate for the current session.
williamr@2
   536
	@return	The certificate information or NULL if it is not available
williamr@2
   537
	*/
williamr@2
   538
	virtual const CCertificate*  SessionServerCert() = 0;
williamr@2
   539
williamr@2
   540
	/** 
williamr@2
   541
	Intended Usage: Get the Server Certificate for the specified transaction.
williamr@2
   542
	@param	aTransaction The transaction for which the certificate is requested
williamr@2
   543
	@return	The certificate information or NULL if it is not available
williamr@2
   544
	*/
williamr@2
   545
	virtual const CCertificate* TransactionServerCert( RHTTPTransaction aTransaction) = 0;
williamr@2
   546
	};
williamr@2
   547
williamr@2
   548
inline void CProtocolHandler::GetInterfaceL(TUid, MProtHandlerInterface*&)
williamr@2
   549
	{}
williamr@2
   550
williamr@2
   551
inline void CProtocolHandler::Reserved2()
williamr@2
   552
	{}
williamr@2
   553
williamr@2
   554
#endif // __CPROTOCOLHANDLER_H__