epoc32/include/mw/http/thttpevent.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	__THTTPEVENT_H__
    22 #define	__THTTPEVENT_H__
    23 
    24 // System includes
    25 #include <e32std.h>
    26 
    27 /**
    28 The HTTP UID. This UID is used for all events defined here.
    29 @publishedAll
    30 @released
    31 */
    32 const TUint KHTTPUid				= 0x1000A441;
    33 
    34 /**
    35 Wildcard Matching UID. When specified as part of an event then the UID event
    36 part of the match will be ignored.
    37 @publishedAll
    38 @released
    39 */
    40 const TUint KHTTPMatchAnyEventUid	=  0x1000A44C;
    41 
    42 /**
    43 The base status code for transaction events. Any number above this but below
    44 KSessionEventBaseStatus is a transaction event.
    45 @publishedAll
    46 @released
    47 */
    48 const TInt KTransactionEventBaseStatus		= 0;
    49 
    50 /**
    51 The base status code for transaction warning events.
    52 @publishedAll
    53 @released
    54 */
    55 const TInt KTransactionWarningBaseStatus	= 10000;
    56 
    57 /**
    58 The base status code for session events. Any number above this is a session 
    59 event.
    60 @publishedAll
    61 @released
    62 */
    63 const TInt KSessionEventBaseStatus			= 100000;
    64 
    65 /**
    66 The base status code for session warning events.
    67 @publishedAll
    68 @released
    69 */
    70 const TInt KSessionWarningBaseStatus		= 110000;
    71 
    72 
    73 //##ModelId=3C4C18740294
    74 class THTTPEvent
    75 /**
    76 A HTTP status message. Status messages consist of a UID and a
    77 status code within that UID. Extension dlls that needs to create
    78 new status messages should use their own UID and create status codes
    79 within that UID.
    80 @publishedAll
    81 @released
    82 */
    83 	{
    84 public:	
    85 
    86 	/** The TStandardEvent type is used to specify a family of event types. Any
    87 		negative event number is used to convey error codes. All events are 
    88 		incoming (originate with the origin server) unless otherwise indicated. 
    89 		Outgoing messages will not be seen by the MHTTPTransactionCallback's 
    90 		MHFRunL.
    91 	 */
    92 	enum TStandardEvent
    93 		{
    94 		/** Used when registering filter to indicate the filter is instrested 
    95 			in ALL events, both transaction and session events.
    96 		 */
    97 		EAll					= KRequestPending + 1,
    98 		/** Used when registering filters to indicate the filter is interested
    99 			in any transaction event, from any direction.
   100 		 */
   101 		EAnyTransactionEvent	= KRequestPending,
   102 		/** Used when registering filters to indicate the filter is interested 
   103 			in any session event.
   104 		 */
   105 		EAnySessionEvent		= KSessionEventBaseStatus
   106 		};
   107 
   108 	/** The TTransactionEvents type defines the events that correspond to 
   109 		transactions. Outgoing events originate from the client or from filters.
   110 		The clients do not send these explicitly since the API methods of 
   111 		RHTTPTransaction do it on their behalf. Incoming events originate from 
   112 		the protocol handler or from filters, and clients should handle these.
   113 		The ESucceeded and EFailed events are mutually exclusive, but one will
   114 		always be sent to the client as the final event for a transaction.
   115 	 */
   116 	enum TTransactionEvent
   117 		{
   118 		/** The transaction is being submitted. An outgoing event.
   119 		*/
   120 		ESubmit						= KTransactionEventBaseStatus,
   121 		/** The transaction is being cancelled. An outgoing event. 
   122 		*/
   123 		ECancel						= KTransactionEventBaseStatus + 1,
   124 		/** A new part of request body data is available for transmission. An
   125 			outgoing event
   126 		*/
   127 		ENotifyNewRequestBodyPart	= KTransactionEventBaseStatus + 2,
   128 		/** The transaction is being closed. An outgoing event. 
   129 		*/
   130 		EClosed						= KTransactionEventBaseStatus + 3,
   131 		/** All the response headers have been received. An incoming event. 
   132 		*/
   133 		EGotResponseHeaders			= KTransactionEventBaseStatus + 4, 
   134 		/** Some (more) body data has been received (in the HTTP response). An 
   135 			incoming event.
   136 		*/
   137 		EGotResponseBodyData		= KTransactionEventBaseStatus + 5,
   138 		/** The transaction's response is complete. An incoming event. 
   139 		*/
   140 		EResponseComplete			= KTransactionEventBaseStatus + 6,
   141 		/** Some trailer headers have been received. An incoming event.
   142 		*/
   143 		EGotResponseTrailerHeaders	= KTransactionEventBaseStatus + 7,
   144 		/** The transaction has succeeded. An incoming event.
   145 		*/
   146 		ESucceeded					= KTransactionEventBaseStatus + 8,
   147 		/** The transaction has failed. This is a 'catch-all' for communicating
   148 			failures, and more details of the failure should have been notified
   149 			in previous messages or status codes. If the client could process 
   150 			these then it is possible that it should not consider the transaction
   151 			a failure. For instance a browser that displays the body of 404 
   152 			responses to the user would not consider a 404 response to be a 
   153 			failure, as it would display it just like a 200 response even though
   154 			a 404 will be flagged as a 'failure'. An incoming event.
   155 		*/
   156 		EFailed						= KTransactionEventBaseStatus + 9, 
   157 		/** Generated from RHTTPTransaction::Fail(). A filter has failed in a 
   158 			way that prevents it from using the normal event mechanism to inform
   159 			the client of the error. This probably means it's run out of memory.
   160 			An incoming event.
   161 		*/
   162 		EUnrecoverableError			= KTransactionEventBaseStatus + 10,
   163 		/** An event that indicates that there is too much request data to be 
   164 			sent. The transaction will subsequently be cancelled. An incoming 
   165 			event.
   166 		*/
   167 		ETooMuchRequestData			= KTransactionEventBaseStatus + 11,
   168 
   169 		
   170 		/** If the returned status code for a transaciton is either 301, 302 or 307
   171             and the requested method is NOT a GET or HEAD, then the filter sends the 
   172             client an event ERedirectRequiresConfirmation as stated in RFC2616.
   173 
   174             On receiving this event, the transaction is already setup with the redirected URI
   175             and the client is required to make the decision to whether to submit the 
   176             transaction or close the transaction.
   177 
   178             If the requested method is GET or HEAD the transaction is automatically 
   179             redirected and this event is not used.
   180         */
   181 		ERedirectRequiresConfirmation = KTransactionEventBaseStatus + 12,
   182 
   183 		/** A transaction has been specified to use a proxy and the request
   184 			requires a tunnel to be establised to the origin server.
   185 		*/
   186 		ENeedTunnel					= KTransactionEventBaseStatus + 13,
   187 		
   188 		/** The client wishes to view the current cipher suite.
   189 		*/
   190 		EGetCipherSuite				= KTransactionEventBaseStatus + 14,
   191 		
   192 		/** The transaction's request is complete. An incoming event. 
   193 		*/
   194 		ERequestComplete			= KTransactionEventBaseStatus + 15,
   195 		
   196 		/**An event to signal that 100 Continue response has been received.
   197 		*/
   198 		EReceived100Continue		= KTransactionEventBaseStatus + 16,
   199 		
   200 		/**An event to cancel the wait for a 100-Continue event.
   201 		*/
   202 		ECancelWaitFor100Continue	= KTransactionEventBaseStatus + 17,
   203 		
   204 		/**An event of Send Timeout for a Request.
   205 		*/
   206 		ESendTimeOut	= KTransactionEventBaseStatus + 18,
   207 
   208 		/**An event of Receive Timeout for a Response.
   209 		*/
   210 		EReceiveTimeOut	= KTransactionEventBaseStatus + 19,
   211 		
   212 		/**An event that indicate that transaction Suspended.
   213 		*/
   214 		ESuspend = KTransactionEventBaseStatus +20,
   215 		
   216 		/**An event that indicate that transaction Resume.
   217 		*/
   218 		EResume = KTransactionEventBaseStatus +21
   219 
   220 		};
   221 
   222 	/** The TDirection type defines the direction of an event. An outgoing event
   223 		originates from the client or from filters. The clients do not send these
   224 		explicitly since the API methods of RHTTPTransaction or RHTTPSession do 
   225 		it on their behalf. Incoming events originate from the protocol handler 
   226 		or from filters, and clients should handle these.
   227 	*/
   228 	enum TDirection
   229 		{
   230 		/** An event originating with the client (e.g. start transaction).
   231 		*/
   232 		EOutgoing,
   233 		/** An event originating with the server (e.g. something received). 
   234 		*/
   235 		EIncoming
   236 		};
   237 
   238 	/** The TTransactionWarning type indicates that something in a transaction 
   239 		may be incorrect but the transaction may continue. It may also indicate 
   240 		that something (e.g. a filter) may have performed an action that has 
   241 		changed the transaction and that the client should be informed of this.
   242 	*/
   243 	enum TTransactionWarning
   244 		{
   245 		/** An event indicating that the transaction has been redirected and the
   246 			original origin server indicated that it was a permanent redirection.
   247 			The URI for the transaction is now the redirected location. A 
   248 			permanent redirection may require further client behavior if the 
   249 			request came from a stored URI. This is to avoid further redirections 
   250 			on subsequent requests for this resource.
   251 		*/
   252 		ERedirectedPermanently			= KTransactionWarningBaseStatus,
   253 		/** An event indicating that the transaction has been redirected and the
   254 			original server indicated that it was a temporary redirection. 
   255 		*/
   256 		ERedirectedTemporarily			= KTransactionWarningBaseStatus + 1,
   257 		/** An event generated by the Protocol Handler when it receives a Content-
   258 			Length value that does not match the actual length of the body data.
   259 		*/
   260 		EMoreDataReceivedThanExpected	= KTransactionWarningBaseStatus + 2
   261 		};
   262 
   263 public:	// Methods
   264 
   265 	/** Constructor
   266 		@param aStatus	The status value.
   267 		@param aUID		The UID.
   268 	*/
   269 	//##ModelId=3C4C187402FB
   270 	inline THTTPEvent(TInt aStatus, TUint aUID = KHTTPUid);
   271 
   272 	/** Constructor (using a standard event and the HTTP UID)
   273 		@param aStatus	The standard event to use.
   274 	*/
   275 	//##ModelId=3C4C18740304
   276 	inline THTTPEvent(TStandardEvent aStatus = EAnyTransactionEvent);
   277 
   278 	/** Constructor (using a transaction event and the HTTP UID)
   279 		@param aStatus	The transaction event to use.
   280 	*/
   281 	//##ModelId=3C4C1874030C
   282 	inline THTTPEvent(TTransactionEvent aStatus);
   283 
   284 	/** Assigns a standard event code to an event object
   285 		@param aStatus	The standard event.
   286 		@return The HTTP event object.
   287 	*/
   288 	//##ModelId=3C4C187402EF
   289 	inline THTTPEvent& operator=(TStandardEvent aStatus);
   290 
   291 	/** Assigns a transaction event code to an event object
   292 		@param aStatus	The transaction event.
   293 		@return The HTTP event object.
   294 	*/
   295 	//##ModelId=3C4C187402F1
   296 	inline THTTPEvent& operator=(TTransactionEvent aStatus);
   297 
   298 	/** Equality operator
   299 		@param The HTTP event object to compare.
   300 		@return ETrue if the HTTP event objects are equal. 
   301 	*/
   302 	//##ModelId=3C4C187402DA
   303 	inline TBool operator==(THTTPEvent aThat) const;
   304 
   305 	/** Inequality operator
   306 		@param The HTTP event object to compare.
   307 		@return ETrue if the HTTP event objects are not equal. 
   308 	*/
   309 	//##ModelId=3C4C187402BD
   310 	inline TBool operator!=(THTTPEvent aThat) const;
   311 
   312 	/** Equality operator (compares with a standard event)
   313 		@param The standard event object to compare.
   314 		@return ETrue if the standard event objects are equal.
   315 	*/
   316 	//##ModelId=3C4C187402DC
   317 	inline TBool operator==(TStandardEvent aStatus) const;
   318 
   319 	/** Inequality operator (compares with a standard event)
   320 		@param The standard event object to compare.
   321 		@return ETrue if the standard event objects are not equal. 
   322 	*/
   323 	//##ModelId=3C4C187402C7
   324 	inline TBool operator!=(TStandardEvent aStatus) const;
   325 
   326 	/** Equality operator (compares with a transaction event)
   327 		@param The transaction event object to compare.
   328 		@return ETrue if the transaction event objects are equal. 
   329 	*/
   330 	//##ModelId=3C4C187402E4
   331 	inline TBool operator==(TTransactionEvent aStatus) const;
   332 
   333 	/** Inequality operator (compares with a transaction event)
   334 		@param The transaction event object to compare.
   335 		@return ETrue if the transaction event objects are not equal. 
   336 	*/
   337 	//##ModelId=3C4C187402D0
   338 	inline TBool operator!=(TTransactionEvent aStatus) const;
   339 	
   340 	/** @return ETrue if the event is a session event
   341 	*/
   342 	//##ModelId=3C4C187402BC
   343 	inline TBool IsSessionEvent() const;
   344 
   345 public:	// Attributes
   346 
   347 	/** The status value.
   348 	 */
   349 	//##ModelId=3C4C187402B4
   350 	TInt iStatus;
   351 
   352 	/** The UID.
   353 	 */
   354 	//##ModelId=3C4C187402AA
   355 	TUint iUID;
   356 
   357 protected: // Attributes
   358 	/** Flag to indicate whether the event is a session event
   359 	*/
   360 	TBool iIsSessionEventFlag;
   361 
   362 	};
   363 
   364 
   365 class THTTPSessionEvent : public THTTPEvent
   366 /**
   367 A HTTP session status message. Status messages consist of a UID and a
   368 status code within that UID. Extension dlls that needs to create
   369 new status messages should use their own UID and create status codes
   370 within that UID.
   371 @publishedAll
   372 @released
   373 */
   374 	{
   375 public: // Enumerations
   376 	/** The TSessionEvents type defines the evenst that correspond to the 
   377 		of a session entity. Outgoing events originate from the client or from
   378 		filters. Incoming events originate from the protocol handler or from 
   379 		filters, and clients should handle these. 
   380 	*/
   381 	enum TSessionEvent
   382 		{
   383 		/** A session connection should be initiated. An outgoing event.
   384 		*/
   385 		EConnect							= KSessionEventBaseStatus,
   386 		/** The session should be disconnected. An outgoing event.
   387 		 */
   388 		EDisconnect							= KSessionEventBaseStatus + 1,
   389 		/** The session has been successfully connected. None of the client 
   390 			requested capabilities were denied or reduced by the proxy. An 
   391 			incoming event.
   392 		*/
   393 		EConnectedOK						= KSessionEventBaseStatus + 2,
   394 		/** The session has been connected, but with one or more of the client 
   395 			requested capabilities denied or reduced by the proxy. An incoming 
   396 			event.
   397 		*/
   398 		EConnectedWithReducedCapabilities	= KSessionEventBaseStatus + 3,
   399 		/** The session has been disconnected. This either confirms an earlier 
   400 			EDisconnect event or indicates a forced disconnection by the proxy. 
   401 			An incoming event.
   402 		*/
   403 		EDisconnected						= KSessionEventBaseStatus + 4,
   404 		/** The authentication handshake succeeded with the automatic validation
   405 			of the (proxy) server certificate.
   406 		 */
   407 		EAuthenticatedOK					= KSessionEventBaseStatus + 5,
   408 		/** The authentication handshake failed.
   409 		*/
   410 		EAuthenticationFailure				= KSessionEventBaseStatus + 6,
   411 		/** The connection attempt to the proxy timed out.
   412 		*/
   413 		EConnectionTimedOut					= KSessionEventBaseStatus + 7
   414 		};
   415 	
   416 	/**
   417 		HTTP session warning events.
   418 	 */
   419 	enum TSessionWarning
   420 		{
   421 		/** The client has requested a transaction event that requires a session
   422 			to be connected or the connection to be initiated, but neither is
   423 			currently true. The transaction event will be left pending until the
   424 			session is connected. An incoming event.
   425 		*/
   426 		ENotConnected						= KSessionWarningBaseStatus,
   427 		/** The proxy has sent some information that is not related to a 
   428 			transaction and has no effect on the state of the session. The 
   429 			information from the proxy is in the EProxyExceptionInfo property.
   430 		*/
   431 		EExceptionInfo						= KSessionWarningBaseStatus + 1,
   432 		/** The client connection request was (permanently) redirected to a new
   433 			WAP proxy address. The client should check the EWspProxyAddress 
   434 			property for the new address. The client's access-point database can
   435 			then be updated with this address. No notification is given of a 
   436 			temporary redirection.
   437 		*/
   438 		ERedirected							= KSessionWarningBaseStatus + 2,
   439 		/** The client has requested a session event that is not valid whilst
   440 			the WSP session is trying to establish a connection.
   441 		*/
   442 		EAlreadyConnecting					= KSessionWarningBaseStatus + 3,
   443 		/** The client has requested a session event that is not valid whilst
   444 			the WSP session is in the Connected state.
   445 		*/
   446 		EAlreadyConnected					= KSessionWarningBaseStatus + 4,
   447 		/** The client has requested a session event that is not valid whilst
   448 			the WSP session is trying to close the connection.
   449 		*/
   450 		EAlreadyDisconnecting				= KSessionWarningBaseStatus + 5,
   451 		/** The client has requested a session event that is not valid whilst
   452 			the WSP session is in the Null (or disconnected) state.
   453 		*/
   454 		EAlreadyDisconnected				= KSessionWarningBaseStatus + 6
   455 		};
   456 
   457 public:
   458 	/** Constructor
   459 		@param aStatus	The status value.
   460 		@param aUID		The UID.
   461 	*/
   462 	inline THTTPSessionEvent(TInt aStatus, TUint aUID = KHTTPUid);
   463 
   464 	/** Constructor (using a standard event and the HTTP UID)
   465 		@param aStatus	The standard event to use.
   466 	*/
   467 	inline THTTPSessionEvent(TStandardEvent aStatus = EAnySessionEvent);
   468 
   469 	/** Constructor (using a session event and the HTTP UID)
   470 		@param aStatus	The session event to use.
   471 	*/
   472 	inline THTTPSessionEvent(TSessionEvent aStatus);
   473 
   474 	/** Assigns a session event code to an event object
   475 		@param aStatus	The session event.
   476 	*/
   477 	//##ModelId=3C4C187402F9
   478 	inline THTTPSessionEvent& operator=(TSessionEvent aStatus);
   479 
   480 	// Equality operator (compares with a session event)
   481 	//##ModelId=3C4C187402E6
   482 	inline TBool operator==(TSessionEvent aStatus) const;
   483 
   484 	// Inequality operator (compares with a session event)
   485 	//##ModelId=3C4C187402D2
   486 	inline TBool operator!=(TSessionEvent aStatus) const;
   487 	};
   488 
   489 #include <http/thttpevent.inl>
   490 
   491 #endif // __THTTPEVENT_H__