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