epoc32/include/mw/http/rhttptransaction.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
//
williamr@2
    15
williamr@2
    16
/**
williamr@4
    17
 @file
williamr@2
    18
 @warning : This file contains Rose Model ID comments - please do not delete
williamr@2
    19
*/
williamr@2
    20
williamr@2
    21
#ifndef __RHTTPTRANSACTION_H__
williamr@2
    22
#define __RHTTPTRANSACTION_H__ 
williamr@2
    23
williamr@2
    24
// System includes
williamr@2
    25
#include <http/thttpevent.h>
williamr@2
    26
#include <http/rhttpresponse.h>
williamr@2
    27
#include <http/rhttprequest.h>
williamr@2
    28
#include <http/rhttptransactionpropertyset.h>
williamr@2
    29
#include <http/thttpfilterhandle.h>
williamr@2
    30
#include <http/mhttpdataoptimiser.h>
williamr@2
    31
williamr@2
    32
// Forward declarations
williamr@2
    33
class CHTTPTransaction;
williamr@2
    34
class CTransaction;
williamr@2
    35
class MHTTPTransactionCallback;
williamr@2
    36
class RHTTPSession;
williamr@2
    37
class TCertInfo;
williamr@2
    38
class CCertificate;
williamr@2
    39
williamr@2
    40
williamr@2
    41
//##ModelId=3C4C18860091
williamr@2
    42
class RHTTPTransaction 
williamr@2
    43
/**
williamr@2
    44
A HTTP Transaction. This encapsulates 1 HTTP request and
williamr@2
    45
response. A Transaction is associated with a session, and must be
williamr@2
    46
created using the session's CreateTransactionL method.
williamr@2
    47
@publishedAll
williamr@2
    48
@released
williamr@2
    49
@see RHTTPSession
williamr@2
    50
@see RHTTPSession::CreateTransactionL
williamr@2
    51
*/
williamr@2
    52
	{
williamr@2
    53
 public:
williamr@2
    54
	/** 
williamr@2
    55
		Default (uninitialised) constructor
williamr@2
    56
	*/
williamr@2
    57
	//##ModelId=3C4C188600F5
williamr@2
    58
	inline RHTTPTransaction();
williamr@2
    59
williamr@2
    60
	/** Submits a transaction. Once all the headers and other details
williamr@2
    61
		have been set up, this call actualy causes the request to be
williamr@2
    62
		made.
williamr@2
    63
		@leave KErrNoMemory There was not enough memory.
williamr@2
    64
	*/
williamr@2
    65
	//##ModelId=3C4C188600ED
williamr@2
    66
	IMPORT_C void SubmitL(THTTPFilterHandle aStart = 
williamr@2
    67
						  THTTPFilterHandle::EClient);
williamr@4
    68
	
williamr@4
    69
	IMPORT_C TInt Submit(THTTPFilterHandle aStart = THTTPFilterHandle::EClient);
williamr@2
    70
	/** Notify HTTP of the availability of more request body data,
williamr@2
    71
		when submitting body data in several parts.
williamr@2
    72
		
williamr@2
    73
		@param aStart The filter supplying the new data. This will almost always be the client (default value)
williamr@2
    74
		@leave KErrNoMemory There was not enough memory.
williamr@2
    75
	*/
williamr@2
    76
	//##ModelId=3C4C188600EB
williamr@2
    77
	IMPORT_C void NotifyNewRequestBodyPartL(THTTPFilterHandle aStart = 
williamr@2
    78
											 THTTPFilterHandle::EClient);
williamr@2
    79
williamr@2
    80
	/** Sends a status message to all relevant filters. This function
williamr@2
    81
		is predominantly used by filters, rather than by the client.
williamr@2
    82
		@param aStatus The status message to send.  
williamr@2
    83
		@param aDirection The direction down the filter queue that this event 
williamr@2
    84
		will be propogated.
williamr@2
    85
		@leave KErrNoMemory There was not enough memory.
williamr@2
    86
	*/
williamr@2
    87
	//##ModelId=3C4C188600E2
williamr@2
    88
	IMPORT_C void SendEventL(THTTPEvent aStatus, 
williamr@2
    89
							 THTTPEvent::TDirection aDirection, 
williamr@2
    90
							 THTTPFilterHandle aStart);
williamr@4
    91
	
williamr@4
    92
	IMPORT_C TInt SendEvent(THTTPEvent aStatus, THTTPEvent::TDirection aDirection, THTTPFilterHandle aStart);
williamr@2
    93
	/** Gets the response. Note that the returned response may not be
williamr@2
    94
		valid if it hasn't been created yet.
williamr@2
    95
		@see RHTTPMessage::IsValid()
williamr@2
    96
	*/
williamr@2
    97
//##ModelId=3C4C188600E1
williamr@2
    98
	IMPORT_C RHTTPResponse Response() const;
williamr@2
    99
williamr@4
   100
	// Gets the request.
williamr@2
   101
	//##ModelId=3C4C188600DA
williamr@2
   102
	IMPORT_C RHTTPRequest Request() const;
williamr@2
   103
williamr@4
   104
	// Returns the session associated with the transaction.
williamr@2
   105
	//##ModelId=3C4C188600D9
williamr@2
   106
	IMPORT_C RHTTPSession Session() const;
williamr@2
   107
williamr@2
   108
	/** Returns the transaction's property set. This is used by filters
williamr@2
   109
		to store transaction-specific information, and by clients to
williamr@2
   110
		specify things like reload or no cache behaviour.
williamr@2
   111
	*/
williamr@2
   112
	//##ModelId=3C4C188600D8
williamr@2
   113
	IMPORT_C RHTTPTransactionPropertySet PropertySet() const;
williamr@2
   114
williamr@2
   115
	/** Cancels the transaction.
williamr@2
   116
	
williamr@2
   117
		@param aStart The entity that is initiating the cancel (defaults
williamr@2
   118
		to the client). See THTTPFilterHandle for the values this can take.
williamr@2
   119
	*/
williamr@2
   120
	//##ModelId=3C4C188600CF
williamr@2
   121
	IMPORT_C void Cancel(THTTPFilterHandle aStart = 
williamr@2
   122
						 THTTPFilterHandle::EClient);
williamr@2
   123
williamr@2
   124
	/** Closes the transaction and frees all owned resources.
williamr@2
   125
		Transactions must be opened using RHTTPSession::OpenTransactionL.
williamr@2
   126
		It is also closed when you close the session.
williamr@2
   127
	 */
williamr@2
   128
	//##ModelId=3C4C188600CE
williamr@2
   129
	IMPORT_C void Close();
williamr@2
   130
williamr@2
   131
	/** This function should be called by filters when they have
williamr@2
   132
	 failed due to running out of memory. It cancels the transaction
williamr@2
   133
	 and sends the synchronous events EUnrecoverableError and EFailed
williamr@2
   134
	 to the client to inform it of the failure. For instance in a
williamr@2
   135
	 filter that attempts to send an event to the client from a
williamr@2
   136
	 MHFRunError to inform the client of a failure, if the call to
williamr@2
   137
	 SendEventL leaves, Fail() may be used to 'give up'. */
williamr@2
   138
	//##ModelId=3C4C188600C7
williamr@2
   139
	IMPORT_C void Fail(THTTPFilterHandle aStart = 
williamr@2
   140
					   THTTPFilterHandle::ECurrentFilter);
williamr@2
   141
williamr@2
   142
	/** Equality operator to check if this transaction is the same as that one.
williamr@2
   143
		@param aTrans The transaction to compare this one to.
williamr@2
   144
	*/
williamr@2
   145
	//##ModelId=3C4C188600C5
williamr@2
   146
	TBool operator==(RHTTPTransaction aTrans) const;
williamr@2
   147
	/** Inequality operator
williamr@2
   148
		@param aTrans The transaction to compare this one to.
williamr@2
   149
	*/
williamr@2
   150
	//##ModelId=3C4C188600C3
williamr@2
   151
	TBool operator!=(RHTTPTransaction aTrans) const;
williamr@2
   152
	/** Obtain this transaction's ID, which is unique within its
williamr@2
   153
		session.  This is mostly used for producing a
williamr@2
   154
		slightly-meaningful way of identifying transactions in logging
williamr@2
   155
		code.
williamr@2
   156
		@return The transaction ID.  
williamr@2
   157
	*/
williamr@2
   158
	//##ModelId=3C4C188600BB
williamr@2
   159
	IMPORT_C TInt Id() const;
williamr@2
   160
williamr@2
   161
	/** Obtain the server certificate information for this transaction.  This function
williamr@2
   162
		should only be used for text-mode, for WSP use RHttpSession::ServerCert.
williamr@2
   163
		@see RHttpSession::ServerCert
williamr@2
   164
		@param	aServerCert A client supplied object into which the certificate
williamr@2
   165
		information will be placed.
williamr@2
   166
		@return KErrNone if certificate has been completed, KErrNotSupported if
williamr@2
   167
		this function is called for WSP.
williamr@2
   168
		@deprecated v9.2 onwards - maintained for compatibility with v9.1 and before
williamr@2
   169
					TCertInfo has been deprecated since v9.2. CCertificate may be used as an alternative.
williamr@2
   170
	*/
williamr@2
   171
	//##ModelId=3C4C188600B9
williamr@2
   172
	IMPORT_C TInt ServerCert(TCertInfo& aServerCert);
williamr@2
   173
williamr@4
   174
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
williamr@4
   175
	/** Obtain the server certificate information for this transaction.  This function
williamr@4
   176
		should only be used for HTTP. WSP should use RHttpSession::ServerCert.
williamr@4
   177
		@see RHttpSession::ServerCert
williamr@4
   178
		@prototype
williamr@4
   179
		@return	a CCertificate pointer to an CX509Certificate object.
williamr@4
   180
		Calling code can safely cast to CX509Certificate if using  "HTTP/TCP".
williamr@4
   181
		NULL returned if certificate information not found.
williamr@4
   182
	*/
williamr@4
   183
#else
williamr@2
   184
	/** Obtain the server certificate information for this transaction.  This function
williamr@2
   185
		should only be used for HTTP. WSP should use RHttpSession::ServerCert.
williamr@2
   186
		@see RHttpSession::ServerCert
williamr@2
   187
		@internalAll
williamr@2
   188
		@prototype
williamr@2
   189
		@return	a CCertificate pointer to an CX509Certificate object.
williamr@2
   190
		Calling code can safely cast to CX509Certificate if using  "HTTP/TCP".
williamr@2
   191
		NULL returned if certificate information not found.
williamr@2
   192
	*/
williamr@4
   193
#endif	//SYMBIAN_ENABLE_SPLIT_HEADERS
williamr@2
   194
	IMPORT_C const CCertificate* ServerCert();
williamr@4
   195
williamr@4
   196
williamr@2
   197
	/** Obtain the cipher suite information for this transaction.
williamr@2
   198
		@return RString containing the cipher suite as per RFC2246.
williamr@2
   199
	*/
williamr@2
   200
	IMPORT_C RString CipherSuite();
williamr@4
   201
williamr@4
   202
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS		
williamr@4
   203
	/**Sets the HTTP data optimiser for the transaction.
williamr@4
   204
	@param aHttpOptimiser An object of the implementation of interface, MHttpDataOptimiser, supplied by the client.
williamr@4
   205
	*/
williamr@4
   206
#else
williamr@2
   207
	/**Sets the HTTP data optimiser for the transaction.
williamr@2
   208
	@param aHttpOptimiser An object of the implementation of interface, MHttpDataOptimiser, supplied by the client.
williamr@2
   209
	@publishedPartner
williamr@4
   210
	@released
williamr@2
   211
	*/
williamr@4
   212
#endif	//SYMBIAN_ENABLE_SPLIT_HEADERS
williamr@2
   213
 	IMPORT_C void SetupHttpDataOptimiser (MHttpDataOptimiser& aHttpOptimiser);
williamr@2
   214
 
williamr@4
   215
 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS		
williamr@4
   216
 	/**Returns the object of the MHttpDataOptimiser implementation class.
williamr@4
   217
	*/
williamr@4
   218
#else
williamr@2
   219
 	/**Returns the object of the MHttpDataOptimiser implementation class.
williamr@2
   220
	@internalTechnology
williamr@2
   221
	*/
williamr@4
   222
#endif	//SYMBIAN_ENABLE_SPLIT_HEADERS
williamr@2
   223
 	IMPORT_C MHttpDataOptimiser* HttpDataOptimiser ();
williamr@2
   224
williamr@2
   225
private:
williamr@2
   226
	friend class RHTTPSession;
williamr@2
   227
	friend class CTransaction;
williamr@4
   228
	friend class CProtocolHandler;
williamr@4
   229
	
williamr@4
   230
	inline CTransaction* Implementation();
williamr@2
   231
 private:
williamr@2
   232
	//##ModelId=3C4C188600A7
williamr@2
   233
	CTransaction* iImplementation;
williamr@2
   234
	}; 
williamr@2
   235
williamr@2
   236
inline TBool RHTTPTransaction::operator==(RHTTPTransaction aTrans) const
williamr@2
   237
	{
williamr@2
   238
	return (iImplementation == aTrans.iImplementation);
williamr@2
   239
	};
williamr@2
   240
inline TBool RHTTPTransaction::operator!=(RHTTPTransaction aTrans) const
williamr@2
   241
	{
williamr@2
   242
	return !(*this == aTrans);
williamr@2
   243
	};
williamr@2
   244
williamr@2
   245
inline RHTTPTransaction::RHTTPTransaction()
williamr@2
   246
		: iImplementation(NULL)
williamr@2
   247
	{
williamr@2
   248
	}
williamr@2
   249
williamr@4
   250
inline CTransaction* RHTTPTransaction::Implementation()
williamr@4
   251
    {
williamr@4
   252
    return iImplementation;
williamr@4
   253
    }
williamr@2
   254
williamr@2
   255
#endif // __RHTTPTRANSACTION_H__