williamr@2: // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@2: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: /** williamr@4: @file williamr@2: @warning : This file contains Rose Model ID comments - please do not delete williamr@2: */ williamr@2: williamr@2: #ifndef __THTTPEVENT_H__ williamr@2: #define __THTTPEVENT_H__ williamr@2: williamr@2: // System includes williamr@2: #include williamr@2: williamr@2: /** williamr@2: The HTTP UID. This UID is used for all events defined here. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: const TUint KHTTPUid = 0x1000A441; williamr@2: williamr@2: /** williamr@2: Wildcard Matching UID. When specified as part of an event then the UID event williamr@2: part of the match will be ignored. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: const TUint KHTTPMatchAnyEventUid = 0x1000A44C; williamr@2: williamr@2: /** williamr@2: The base status code for transaction events. Any number above this but below williamr@2: KSessionEventBaseStatus is a transaction event. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: const TInt KTransactionEventBaseStatus = 0; williamr@2: williamr@2: /** williamr@2: The base status code for transaction warning events. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: const TInt KTransactionWarningBaseStatus = 10000; williamr@2: williamr@2: /** williamr@2: The base status code for session events. Any number above this is a session williamr@2: event. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: const TInt KSessionEventBaseStatus = 100000; williamr@2: williamr@2: /** williamr@2: The base status code for session warning events. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: const TInt KSessionWarningBaseStatus = 110000; williamr@2: williamr@2: williamr@2: //##ModelId=3C4C18740294 williamr@2: class THTTPEvent williamr@2: /** williamr@2: A HTTP status message. Status messages consist of a UID and a williamr@2: status code within that UID. Extension dlls that needs to create williamr@2: new status messages should use their own UID and create status codes williamr@2: within that UID. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: williamr@2: /** The TStandardEvent type is used to specify a family of event types. Any williamr@2: negative event number is used to convey error codes. All events are williamr@2: incoming (originate with the origin server) unless otherwise indicated. williamr@2: Outgoing messages will not be seen by the MHTTPTransactionCallback's williamr@2: MHFRunL. williamr@2: */ williamr@2: enum TStandardEvent williamr@2: { williamr@2: /** Used when registering filter to indicate the filter is instrested williamr@2: in ALL events, both transaction and session events. williamr@2: */ williamr@2: EAll = KRequestPending + 1, williamr@2: /** Used when registering filters to indicate the filter is interested williamr@2: in any transaction event, from any direction. williamr@2: */ williamr@2: EAnyTransactionEvent = KRequestPending, williamr@2: /** Used when registering filters to indicate the filter is interested williamr@2: in any session event. williamr@2: */ williamr@2: EAnySessionEvent = KSessionEventBaseStatus williamr@2: }; williamr@2: williamr@2: /** The TTransactionEvents type defines the events that correspond to williamr@2: transactions. Outgoing events originate from the client or from filters. williamr@2: The clients do not send these explicitly since the API methods of williamr@2: RHTTPTransaction do it on their behalf. Incoming events originate from williamr@2: the protocol handler or from filters, and clients should handle these. williamr@2: The ESucceeded and EFailed events are mutually exclusive, but one will williamr@2: always be sent to the client as the final event for a transaction. williamr@2: */ williamr@2: enum TTransactionEvent williamr@2: { williamr@2: /** The transaction is being submitted. An outgoing event. williamr@2: */ williamr@2: ESubmit = KTransactionEventBaseStatus, williamr@2: /** The transaction is being cancelled. An outgoing event. williamr@2: */ williamr@2: ECancel = KTransactionEventBaseStatus + 1, williamr@2: /** A new part of request body data is available for transmission. An williamr@2: outgoing event williamr@2: */ williamr@2: ENotifyNewRequestBodyPart = KTransactionEventBaseStatus + 2, williamr@2: /** The transaction is being closed. An outgoing event. williamr@2: */ williamr@2: EClosed = KTransactionEventBaseStatus + 3, williamr@2: /** All the response headers have been received. An incoming event. williamr@2: */ williamr@2: EGotResponseHeaders = KTransactionEventBaseStatus + 4, williamr@2: /** Some (more) body data has been received (in the HTTP response). An williamr@2: incoming event. williamr@2: */ williamr@2: EGotResponseBodyData = KTransactionEventBaseStatus + 5, williamr@2: /** The transaction's response is complete. An incoming event. williamr@2: */ williamr@2: EResponseComplete = KTransactionEventBaseStatus + 6, williamr@2: /** Some trailer headers have been received. An incoming event. williamr@2: */ williamr@2: EGotResponseTrailerHeaders = KTransactionEventBaseStatus + 7, williamr@2: /** The transaction has succeeded. An incoming event. williamr@2: */ williamr@2: ESucceeded = KTransactionEventBaseStatus + 8, williamr@2: /** The transaction has failed. This is a 'catch-all' for communicating williamr@2: failures, and more details of the failure should have been notified williamr@2: in previous messages or status codes. If the client could process williamr@2: these then it is possible that it should not consider the transaction williamr@2: a failure. For instance a browser that displays the body of 404 williamr@2: responses to the user would not consider a 404 response to be a williamr@2: failure, as it would display it just like a 200 response even though williamr@2: a 404 will be flagged as a 'failure'. An incoming event. williamr@2: */ williamr@2: EFailed = KTransactionEventBaseStatus + 9, williamr@2: /** Generated from RHTTPTransaction::Fail(). A filter has failed in a williamr@2: way that prevents it from using the normal event mechanism to inform williamr@2: the client of the error. This probably means it's run out of memory. williamr@2: An incoming event. williamr@2: */ williamr@2: EUnrecoverableError = KTransactionEventBaseStatus + 10, williamr@2: /** An event that indicates that there is too much request data to be williamr@2: sent. The transaction will subsequently be cancelled. An incoming williamr@2: event. williamr@2: */ williamr@2: ETooMuchRequestData = KTransactionEventBaseStatus + 11, williamr@2: williamr@2: williamr@2: /** If the returned status code for a transaciton is either 301, 302 or 307 williamr@2: and the requested method is NOT a GET or HEAD, then the filter sends the williamr@2: client an event ERedirectRequiresConfirmation as stated in RFC2616. williamr@2: williamr@2: On receiving this event, the transaction is already setup with the redirected URI williamr@2: and the client is required to make the decision to whether to submit the williamr@2: transaction or close the transaction. williamr@2: williamr@2: If the requested method is GET or HEAD the transaction is automatically williamr@2: redirected and this event is not used. williamr@2: */ williamr@2: ERedirectRequiresConfirmation = KTransactionEventBaseStatus + 12, williamr@2: williamr@2: /** A transaction has been specified to use a proxy and the request williamr@2: requires a tunnel to be establised to the origin server. williamr@2: */ williamr@2: ENeedTunnel = KTransactionEventBaseStatus + 13, williamr@2: williamr@2: /** The client wishes to view the current cipher suite. williamr@2: */ williamr@2: EGetCipherSuite = KTransactionEventBaseStatus + 14, williamr@2: williamr@2: /** The transaction's request is complete. An incoming event. williamr@2: */ williamr@2: ERequestComplete = KTransactionEventBaseStatus + 15, williamr@2: williamr@2: /**An event to signal that 100 Continue response has been received. williamr@2: */ williamr@2: EReceived100Continue = KTransactionEventBaseStatus + 16, williamr@2: williamr@2: /**An event to cancel the wait for a 100-Continue event. williamr@2: */ williamr@2: ECancelWaitFor100Continue = KTransactionEventBaseStatus + 17, williamr@4: williamr@2: /**An event of Send Timeout for a Request. williamr@2: */ williamr@2: ESendTimeOut = KTransactionEventBaseStatus + 18, williamr@2: williamr@2: /**An event of Receive Timeout for a Response. williamr@2: */ williamr@4: EReceiveTimeOut = KTransactionEventBaseStatus + 19, williamr@4: williamr@4: /**An event that indicate that transaction Suspended. williamr@4: */ williamr@4: ESuspend = KTransactionEventBaseStatus +20, williamr@4: williamr@4: /**An event that indicate that transaction Resume. williamr@4: */ williamr@4: EResume = KTransactionEventBaseStatus +21 williamr@2: williamr@2: }; williamr@2: williamr@2: /** The TDirection type defines the direction of an event. An outgoing event williamr@2: originates from the client or from filters. The clients do not send these williamr@2: explicitly since the API methods of RHTTPTransaction or RHTTPSession do williamr@2: it on their behalf. Incoming events originate from the protocol handler williamr@2: or from filters, and clients should handle these. williamr@2: */ williamr@2: enum TDirection williamr@2: { williamr@2: /** An event originating with the client (e.g. start transaction). williamr@2: */ williamr@2: EOutgoing, williamr@2: /** An event originating with the server (e.g. something received). williamr@2: */ williamr@2: EIncoming williamr@2: }; williamr@2: williamr@2: /** The TTransactionWarning type indicates that something in a transaction williamr@2: may be incorrect but the transaction may continue. It may also indicate williamr@2: that something (e.g. a filter) may have performed an action that has williamr@2: changed the transaction and that the client should be informed of this. williamr@2: */ williamr@2: enum TTransactionWarning williamr@2: { williamr@2: /** An event indicating that the transaction has been redirected and the williamr@2: original origin server indicated that it was a permanent redirection. williamr@2: The URI for the transaction is now the redirected location. A williamr@2: permanent redirection may require further client behavior if the williamr@2: request came from a stored URI. This is to avoid further redirections williamr@2: on subsequent requests for this resource. williamr@2: */ williamr@2: ERedirectedPermanently = KTransactionWarningBaseStatus, williamr@2: /** An event indicating that the transaction has been redirected and the williamr@2: original server indicated that it was a temporary redirection. williamr@2: */ williamr@2: ERedirectedTemporarily = KTransactionWarningBaseStatus + 1, williamr@2: /** An event generated by the Protocol Handler when it receives a Content- williamr@2: Length value that does not match the actual length of the body data. williamr@2: */ williamr@2: EMoreDataReceivedThanExpected = KTransactionWarningBaseStatus + 2 williamr@2: }; williamr@2: williamr@2: public: // Methods williamr@2: williamr@2: /** Constructor williamr@2: @param aStatus The status value. williamr@2: @param aUID The UID. williamr@2: */ williamr@2: //##ModelId=3C4C187402FB williamr@2: inline THTTPEvent(TInt aStatus, TUint aUID = KHTTPUid); williamr@2: williamr@2: /** Constructor (using a standard event and the HTTP UID) williamr@2: @param aStatus The standard event to use. williamr@2: */ williamr@2: //##ModelId=3C4C18740304 williamr@2: inline THTTPEvent(TStandardEvent aStatus = EAnyTransactionEvent); williamr@2: williamr@2: /** Constructor (using a transaction event and the HTTP UID) williamr@2: @param aStatus The transaction event to use. williamr@2: */ williamr@2: //##ModelId=3C4C1874030C williamr@2: inline THTTPEvent(TTransactionEvent aStatus); williamr@2: williamr@2: /** Assigns a standard event code to an event object williamr@2: @param aStatus The standard event. williamr@2: @return The HTTP event object. williamr@2: */ williamr@2: //##ModelId=3C4C187402EF williamr@2: inline THTTPEvent& operator=(TStandardEvent aStatus); williamr@2: williamr@2: /** Assigns a transaction event code to an event object williamr@2: @param aStatus The transaction event. williamr@2: @return The HTTP event object. williamr@2: */ williamr@2: //##ModelId=3C4C187402F1 williamr@2: inline THTTPEvent& operator=(TTransactionEvent aStatus); williamr@2: williamr@2: /** Equality operator williamr@2: @param The HTTP event object to compare. williamr@2: @return ETrue if the HTTP event objects are equal. williamr@2: */ williamr@2: //##ModelId=3C4C187402DA williamr@2: inline TBool operator==(THTTPEvent aThat) const; williamr@2: williamr@2: /** Inequality operator williamr@2: @param The HTTP event object to compare. williamr@2: @return ETrue if the HTTP event objects are not equal. williamr@2: */ williamr@2: //##ModelId=3C4C187402BD williamr@2: inline TBool operator!=(THTTPEvent aThat) const; williamr@2: williamr@2: /** Equality operator (compares with a standard event) williamr@2: @param The standard event object to compare. williamr@2: @return ETrue if the standard event objects are equal. williamr@2: */ williamr@2: //##ModelId=3C4C187402DC williamr@2: inline TBool operator==(TStandardEvent aStatus) const; williamr@2: williamr@2: /** Inequality operator (compares with a standard event) williamr@2: @param The standard event object to compare. williamr@2: @return ETrue if the standard event objects are not equal. williamr@2: */ williamr@2: //##ModelId=3C4C187402C7 williamr@2: inline TBool operator!=(TStandardEvent aStatus) const; williamr@2: williamr@2: /** Equality operator (compares with a transaction event) williamr@2: @param The transaction event object to compare. williamr@2: @return ETrue if the transaction event objects are equal. williamr@2: */ williamr@2: //##ModelId=3C4C187402E4 williamr@2: inline TBool operator==(TTransactionEvent aStatus) const; williamr@2: williamr@2: /** Inequality operator (compares with a transaction event) williamr@2: @param The transaction event object to compare. williamr@2: @return ETrue if the transaction event objects are not equal. williamr@2: */ williamr@2: //##ModelId=3C4C187402D0 williamr@2: inline TBool operator!=(TTransactionEvent aStatus) const; williamr@2: williamr@2: /** @return ETrue if the event is a session event williamr@2: */ williamr@2: //##ModelId=3C4C187402BC williamr@2: inline TBool IsSessionEvent() const; williamr@2: williamr@2: public: // Attributes williamr@2: williamr@2: /** The status value. williamr@2: */ williamr@2: //##ModelId=3C4C187402B4 williamr@2: TInt iStatus; williamr@2: williamr@2: /** The UID. williamr@2: */ williamr@2: //##ModelId=3C4C187402AA williamr@2: TUint iUID; williamr@2: williamr@2: protected: // Attributes williamr@2: /** Flag to indicate whether the event is a session event williamr@2: */ williamr@2: TBool iIsSessionEventFlag; williamr@2: williamr@2: }; williamr@2: williamr@2: williamr@2: class THTTPSessionEvent : public THTTPEvent williamr@2: /** williamr@2: A HTTP session status message. Status messages consist of a UID and a williamr@2: status code within that UID. Extension dlls that needs to create williamr@2: new status messages should use their own UID and create status codes williamr@2: within that UID. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: // Enumerations williamr@2: /** The TSessionEvents type defines the evenst that correspond to the williamr@2: of a session entity. Outgoing events originate from the client or from williamr@2: filters. Incoming events originate from the protocol handler or from williamr@2: filters, and clients should handle these. williamr@2: */ williamr@2: enum TSessionEvent williamr@2: { williamr@2: /** A session connection should be initiated. An outgoing event. williamr@2: */ williamr@2: EConnect = KSessionEventBaseStatus, williamr@2: /** The session should be disconnected. An outgoing event. williamr@2: */ williamr@2: EDisconnect = KSessionEventBaseStatus + 1, williamr@2: /** The session has been successfully connected. None of the client williamr@2: requested capabilities were denied or reduced by the proxy. An williamr@2: incoming event. williamr@2: */ williamr@2: EConnectedOK = KSessionEventBaseStatus + 2, williamr@2: /** The session has been connected, but with one or more of the client williamr@2: requested capabilities denied or reduced by the proxy. An incoming williamr@2: event. williamr@2: */ williamr@2: EConnectedWithReducedCapabilities = KSessionEventBaseStatus + 3, williamr@2: /** The session has been disconnected. This either confirms an earlier williamr@2: EDisconnect event or indicates a forced disconnection by the proxy. williamr@2: An incoming event. williamr@2: */ williamr@2: EDisconnected = KSessionEventBaseStatus + 4, williamr@2: /** The authentication handshake succeeded with the automatic validation williamr@2: of the (proxy) server certificate. williamr@2: */ williamr@2: EAuthenticatedOK = KSessionEventBaseStatus + 5, williamr@2: /** The authentication handshake failed. williamr@2: */ williamr@2: EAuthenticationFailure = KSessionEventBaseStatus + 6, williamr@2: /** The connection attempt to the proxy timed out. williamr@2: */ williamr@2: EConnectionTimedOut = KSessionEventBaseStatus + 7 williamr@2: }; williamr@2: williamr@2: /** williamr@2: HTTP session warning events. williamr@2: */ williamr@2: enum TSessionWarning williamr@2: { williamr@2: /** The client has requested a transaction event that requires a session williamr@2: to be connected or the connection to be initiated, but neither is williamr@2: currently true. The transaction event will be left pending until the williamr@2: session is connected. An incoming event. williamr@2: */ williamr@2: ENotConnected = KSessionWarningBaseStatus, williamr@2: /** The proxy has sent some information that is not related to a williamr@2: transaction and has no effect on the state of the session. The williamr@2: information from the proxy is in the EProxyExceptionInfo property. williamr@2: */ williamr@2: EExceptionInfo = KSessionWarningBaseStatus + 1, williamr@2: /** The client connection request was (permanently) redirected to a new williamr@2: WAP proxy address. The client should check the EWspProxyAddress williamr@2: property for the new address. The client's access-point database can williamr@2: then be updated with this address. No notification is given of a williamr@2: temporary redirection. williamr@2: */ williamr@2: ERedirected = KSessionWarningBaseStatus + 2, williamr@2: /** The client has requested a session event that is not valid whilst williamr@2: the WSP session is trying to establish a connection. williamr@2: */ williamr@2: EAlreadyConnecting = KSessionWarningBaseStatus + 3, williamr@2: /** The client has requested a session event that is not valid whilst williamr@2: the WSP session is in the Connected state. williamr@2: */ williamr@2: EAlreadyConnected = KSessionWarningBaseStatus + 4, williamr@2: /** The client has requested a session event that is not valid whilst williamr@2: the WSP session is trying to close the connection. williamr@2: */ williamr@2: EAlreadyDisconnecting = KSessionWarningBaseStatus + 5, williamr@2: /** The client has requested a session event that is not valid whilst williamr@2: the WSP session is in the Null (or disconnected) state. williamr@2: */ williamr@2: EAlreadyDisconnected = KSessionWarningBaseStatus + 6 williamr@2: }; williamr@2: williamr@2: public: williamr@2: /** Constructor williamr@2: @param aStatus The status value. williamr@2: @param aUID The UID. williamr@2: */ williamr@2: inline THTTPSessionEvent(TInt aStatus, TUint aUID = KHTTPUid); williamr@2: williamr@2: /** Constructor (using a standard event and the HTTP UID) williamr@2: @param aStatus The standard event to use. williamr@2: */ williamr@2: inline THTTPSessionEvent(TStandardEvent aStatus = EAnySessionEvent); williamr@2: williamr@2: /** Constructor (using a session event and the HTTP UID) williamr@2: @param aStatus The session event to use. williamr@2: */ williamr@2: inline THTTPSessionEvent(TSessionEvent aStatus); williamr@2: williamr@2: /** Assigns a session event code to an event object williamr@2: @param aStatus The session event. williamr@2: */ williamr@2: //##ModelId=3C4C187402F9 williamr@2: inline THTTPSessionEvent& operator=(TSessionEvent aStatus); williamr@2: williamr@4: // Equality operator (compares with a session event) williamr@2: //##ModelId=3C4C187402E6 williamr@2: inline TBool operator==(TSessionEvent aStatus) const; williamr@2: williamr@4: // Inequality operator (compares with a session event) williamr@2: //##ModelId=3C4C187402D2 williamr@2: inline TBool operator!=(TSessionEvent aStatus) const; williamr@2: }; williamr@2: williamr@2: #include williamr@2: williamr@2: #endif // __THTTPEVENT_H__