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