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