1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/mw/http/thttpevent.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,485 @@
1.4 +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +
1.20 +
1.21 +/**
1.22 + @file THTTPEvent.h
1.23 + @warning : This file contains Rose Model ID comments - please do not delete
1.24 +*/
1.25 +
1.26 +#ifndef __THTTPEVENT_H__
1.27 +#define __THTTPEVENT_H__
1.28 +
1.29 +// System includes
1.30 +#include <e32std.h>
1.31 +
1.32 +/**
1.33 +The HTTP UID. This UID is used for all events defined here.
1.34 +@publishedAll
1.35 +@released
1.36 +*/
1.37 +const TUint KHTTPUid = 0x1000A441;
1.38 +
1.39 +/**
1.40 +Wildcard Matching UID. When specified as part of an event then the UID event
1.41 +part of the match will be ignored.
1.42 +@publishedAll
1.43 +@released
1.44 +*/
1.45 +const TUint KHTTPMatchAnyEventUid = 0x1000A44C;
1.46 +
1.47 +/**
1.48 +The base status code for transaction events. Any number above this but below
1.49 +KSessionEventBaseStatus is a transaction event.
1.50 +@publishedAll
1.51 +@released
1.52 +*/
1.53 +const TInt KTransactionEventBaseStatus = 0;
1.54 +
1.55 +/**
1.56 +The base status code for transaction warning events.
1.57 +@publishedAll
1.58 +@released
1.59 +*/
1.60 +const TInt KTransactionWarningBaseStatus = 10000;
1.61 +
1.62 +/**
1.63 +The base status code for session events. Any number above this is a session
1.64 +event.
1.65 +@publishedAll
1.66 +@released
1.67 +*/
1.68 +const TInt KSessionEventBaseStatus = 100000;
1.69 +
1.70 +/**
1.71 +The base status code for session warning events.
1.72 +@publishedAll
1.73 +@released
1.74 +*/
1.75 +const TInt KSessionWarningBaseStatus = 110000;
1.76 +
1.77 +
1.78 +//##ModelId=3C4C18740294
1.79 +class THTTPEvent
1.80 +/**
1.81 +A HTTP status message. Status messages consist of a UID and a
1.82 +status code within that UID. Extension dlls that needs to create
1.83 +new status messages should use their own UID and create status codes
1.84 +within that UID.
1.85 +@publishedAll
1.86 +@released
1.87 +*/
1.88 + {
1.89 +public:
1.90 +
1.91 + /** The TStandardEvent type is used to specify a family of event types. Any
1.92 + negative event number is used to convey error codes. All events are
1.93 + incoming (originate with the origin server) unless otherwise indicated.
1.94 + Outgoing messages will not be seen by the MHTTPTransactionCallback's
1.95 + MHFRunL.
1.96 + */
1.97 + enum TStandardEvent
1.98 + {
1.99 + /** Used when registering filter to indicate the filter is instrested
1.100 + in ALL events, both transaction and session events.
1.101 + */
1.102 + EAll = KRequestPending + 1,
1.103 + /** Used when registering filters to indicate the filter is interested
1.104 + in any transaction event, from any direction.
1.105 + */
1.106 + EAnyTransactionEvent = KRequestPending,
1.107 + /** Used when registering filters to indicate the filter is interested
1.108 + in any session event.
1.109 + */
1.110 + EAnySessionEvent = KSessionEventBaseStatus
1.111 + };
1.112 +
1.113 + /** The TTransactionEvents type defines the events that correspond to
1.114 + transactions. Outgoing events originate from the client or from filters.
1.115 + The clients do not send these explicitly since the API methods of
1.116 + RHTTPTransaction do it on their behalf. Incoming events originate from
1.117 + the protocol handler or from filters, and clients should handle these.
1.118 + The ESucceeded and EFailed events are mutually exclusive, but one will
1.119 + always be sent to the client as the final event for a transaction.
1.120 + */
1.121 + enum TTransactionEvent
1.122 + {
1.123 + /** The transaction is being submitted. An outgoing event.
1.124 + */
1.125 + ESubmit = KTransactionEventBaseStatus,
1.126 + /** The transaction is being cancelled. An outgoing event.
1.127 + */
1.128 + ECancel = KTransactionEventBaseStatus + 1,
1.129 + /** A new part of request body data is available for transmission. An
1.130 + outgoing event
1.131 + */
1.132 + ENotifyNewRequestBodyPart = KTransactionEventBaseStatus + 2,
1.133 + /** The transaction is being closed. An outgoing event.
1.134 + */
1.135 + EClosed = KTransactionEventBaseStatus + 3,
1.136 + /** All the response headers have been received. An incoming event.
1.137 + */
1.138 + EGotResponseHeaders = KTransactionEventBaseStatus + 4,
1.139 + /** Some (more) body data has been received (in the HTTP response). An
1.140 + incoming event.
1.141 + */
1.142 + EGotResponseBodyData = KTransactionEventBaseStatus + 5,
1.143 + /** The transaction's response is complete. An incoming event.
1.144 + */
1.145 + EResponseComplete = KTransactionEventBaseStatus + 6,
1.146 + /** Some trailer headers have been received. An incoming event.
1.147 + */
1.148 + EGotResponseTrailerHeaders = KTransactionEventBaseStatus + 7,
1.149 + /** The transaction has succeeded. An incoming event.
1.150 + */
1.151 + ESucceeded = KTransactionEventBaseStatus + 8,
1.152 + /** The transaction has failed. This is a 'catch-all' for communicating
1.153 + failures, and more details of the failure should have been notified
1.154 + in previous messages or status codes. If the client could process
1.155 + these then it is possible that it should not consider the transaction
1.156 + a failure. For instance a browser that displays the body of 404
1.157 + responses to the user would not consider a 404 response to be a
1.158 + failure, as it would display it just like a 200 response even though
1.159 + a 404 will be flagged as a 'failure'. An incoming event.
1.160 + */
1.161 + EFailed = KTransactionEventBaseStatus + 9,
1.162 + /** Generated from RHTTPTransaction::Fail(). A filter has failed in a
1.163 + way that prevents it from using the normal event mechanism to inform
1.164 + the client of the error. This probably means it's run out of memory.
1.165 + An incoming event.
1.166 + */
1.167 + EUnrecoverableError = KTransactionEventBaseStatus + 10,
1.168 + /** An event that indicates that there is too much request data to be
1.169 + sent. The transaction will subsequently be cancelled. An incoming
1.170 + event.
1.171 + */
1.172 + ETooMuchRequestData = KTransactionEventBaseStatus + 11,
1.173 +
1.174 +
1.175 + /** If the returned status code for a transaciton is either 301, 302 or 307
1.176 + and the requested method is NOT a GET or HEAD, then the filter sends the
1.177 + client an event ERedirectRequiresConfirmation as stated in RFC2616.
1.178 +
1.179 + On receiving this event, the transaction is already setup with the redirected URI
1.180 + and the client is required to make the decision to whether to submit the
1.181 + transaction or close the transaction.
1.182 +
1.183 + If the requested method is GET or HEAD the transaction is automatically
1.184 + redirected and this event is not used.
1.185 + */
1.186 + ERedirectRequiresConfirmation = KTransactionEventBaseStatus + 12,
1.187 +
1.188 + /** A transaction has been specified to use a proxy and the request
1.189 + requires a tunnel to be establised to the origin server.
1.190 + */
1.191 + ENeedTunnel = KTransactionEventBaseStatus + 13,
1.192 +
1.193 + /** The client wishes to view the current cipher suite.
1.194 + */
1.195 + EGetCipherSuite = KTransactionEventBaseStatus + 14,
1.196 +
1.197 + /** The transaction's request is complete. An incoming event.
1.198 + */
1.199 + ERequestComplete = KTransactionEventBaseStatus + 15,
1.200 +
1.201 + /**An event to signal that 100 Continue response has been received.
1.202 + */
1.203 + EReceived100Continue = KTransactionEventBaseStatus + 16,
1.204 +
1.205 + /**An event to cancel the wait for a 100-Continue event.
1.206 + */
1.207 + ECancelWaitFor100Continue = KTransactionEventBaseStatus + 17,
1.208 +
1.209 + /**An event of Send Timeout for a Request.
1.210 + */
1.211 + ESendTimeOut = KTransactionEventBaseStatus + 18,
1.212 +
1.213 + /**An event of Receive Timeout for a Response.
1.214 + */
1.215 + EReceiveTimeOut = KTransactionEventBaseStatus + 19
1.216 +
1.217 + };
1.218 +
1.219 + /** The TDirection type defines the direction of an event. An outgoing event
1.220 + originates from the client or from filters. The clients do not send these
1.221 + explicitly since the API methods of RHTTPTransaction or RHTTPSession do
1.222 + it on their behalf. Incoming events originate from the protocol handler
1.223 + or from filters, and clients should handle these.
1.224 + */
1.225 + enum TDirection
1.226 + {
1.227 + /** An event originating with the client (e.g. start transaction).
1.228 + */
1.229 + EOutgoing,
1.230 + /** An event originating with the server (e.g. something received).
1.231 + */
1.232 + EIncoming
1.233 + };
1.234 +
1.235 + /** The TTransactionWarning type indicates that something in a transaction
1.236 + may be incorrect but the transaction may continue. It may also indicate
1.237 + that something (e.g. a filter) may have performed an action that has
1.238 + changed the transaction and that the client should be informed of this.
1.239 + */
1.240 + enum TTransactionWarning
1.241 + {
1.242 + /** An event indicating that the transaction has been redirected and the
1.243 + original origin server indicated that it was a permanent redirection.
1.244 + The URI for the transaction is now the redirected location. A
1.245 + permanent redirection may require further client behavior if the
1.246 + request came from a stored URI. This is to avoid further redirections
1.247 + on subsequent requests for this resource.
1.248 + */
1.249 + ERedirectedPermanently = KTransactionWarningBaseStatus,
1.250 + /** An event indicating that the transaction has been redirected and the
1.251 + original server indicated that it was a temporary redirection.
1.252 + */
1.253 + ERedirectedTemporarily = KTransactionWarningBaseStatus + 1,
1.254 + /** An event generated by the Protocol Handler when it receives a Content-
1.255 + Length value that does not match the actual length of the body data.
1.256 + */
1.257 + EMoreDataReceivedThanExpected = KTransactionWarningBaseStatus + 2
1.258 + };
1.259 +
1.260 +public: // Methods
1.261 +
1.262 + /** Constructor
1.263 + @param aStatus The status value.
1.264 + @param aUID The UID.
1.265 + */
1.266 + //##ModelId=3C4C187402FB
1.267 + inline THTTPEvent(TInt aStatus, TUint aUID = KHTTPUid);
1.268 +
1.269 + /** Constructor (using a standard event and the HTTP UID)
1.270 + @param aStatus The standard event to use.
1.271 + */
1.272 + //##ModelId=3C4C18740304
1.273 + inline THTTPEvent(TStandardEvent aStatus = EAnyTransactionEvent);
1.274 +
1.275 + /** Constructor (using a transaction event and the HTTP UID)
1.276 + @param aStatus The transaction event to use.
1.277 + */
1.278 + //##ModelId=3C4C1874030C
1.279 + inline THTTPEvent(TTransactionEvent aStatus);
1.280 +
1.281 + /** Assigns a standard event code to an event object
1.282 + @param aStatus The standard event.
1.283 + @return The HTTP event object.
1.284 + */
1.285 + //##ModelId=3C4C187402EF
1.286 + inline THTTPEvent& operator=(TStandardEvent aStatus);
1.287 +
1.288 + /** Assigns a transaction event code to an event object
1.289 + @param aStatus The transaction event.
1.290 + @return The HTTP event object.
1.291 + */
1.292 + //##ModelId=3C4C187402F1
1.293 + inline THTTPEvent& operator=(TTransactionEvent aStatus);
1.294 +
1.295 + /** Equality operator
1.296 + @param The HTTP event object to compare.
1.297 + @return ETrue if the HTTP event objects are equal.
1.298 + */
1.299 + //##ModelId=3C4C187402DA
1.300 + inline TBool operator==(THTTPEvent aThat) const;
1.301 +
1.302 + /** Inequality operator
1.303 + @param The HTTP event object to compare.
1.304 + @return ETrue if the HTTP event objects are not equal.
1.305 + */
1.306 + //##ModelId=3C4C187402BD
1.307 + inline TBool operator!=(THTTPEvent aThat) const;
1.308 +
1.309 + /** Equality operator (compares with a standard event)
1.310 + @param The standard event object to compare.
1.311 + @return ETrue if the standard event objects are equal.
1.312 + */
1.313 + //##ModelId=3C4C187402DC
1.314 + inline TBool operator==(TStandardEvent aStatus) const;
1.315 +
1.316 + /** Inequality operator (compares with a standard event)
1.317 + @param The standard event object to compare.
1.318 + @return ETrue if the standard event objects are not equal.
1.319 + */
1.320 + //##ModelId=3C4C187402C7
1.321 + inline TBool operator!=(TStandardEvent aStatus) const;
1.322 +
1.323 + /** Equality operator (compares with a transaction event)
1.324 + @param The transaction event object to compare.
1.325 + @return ETrue if the transaction event objects are equal.
1.326 + */
1.327 + //##ModelId=3C4C187402E4
1.328 + inline TBool operator==(TTransactionEvent aStatus) const;
1.329 +
1.330 + /** Inequality operator (compares with a transaction event)
1.331 + @param The transaction event object to compare.
1.332 + @return ETrue if the transaction event objects are not equal.
1.333 + */
1.334 + //##ModelId=3C4C187402D0
1.335 + inline TBool operator!=(TTransactionEvent aStatus) const;
1.336 +
1.337 + /** @return ETrue if the event is a session event
1.338 + */
1.339 + //##ModelId=3C4C187402BC
1.340 + inline TBool IsSessionEvent() const;
1.341 +
1.342 +public: // Attributes
1.343 +
1.344 + /** The status value.
1.345 + */
1.346 + //##ModelId=3C4C187402B4
1.347 + TInt iStatus;
1.348 +
1.349 + /** The UID.
1.350 + */
1.351 + //##ModelId=3C4C187402AA
1.352 + TUint iUID;
1.353 +
1.354 +protected: // Attributes
1.355 + /** Flag to indicate whether the event is a session event
1.356 + */
1.357 + TBool iIsSessionEventFlag;
1.358 +
1.359 + };
1.360 +
1.361 +
1.362 +class THTTPSessionEvent : public THTTPEvent
1.363 +/**
1.364 +A HTTP session status message. Status messages consist of a UID and a
1.365 +status code within that UID. Extension dlls that needs to create
1.366 +new status messages should use their own UID and create status codes
1.367 +within that UID.
1.368 +@publishedAll
1.369 +@released
1.370 +*/
1.371 + {
1.372 +public: // Enumerations
1.373 + /** The TSessionEvents type defines the evenst that correspond to the
1.374 + of a session entity. Outgoing events originate from the client or from
1.375 + filters. Incoming events originate from the protocol handler or from
1.376 + filters, and clients should handle these.
1.377 + */
1.378 + enum TSessionEvent
1.379 + {
1.380 + /** A session connection should be initiated. An outgoing event.
1.381 + */
1.382 + EConnect = KSessionEventBaseStatus,
1.383 + /** The session should be disconnected. An outgoing event.
1.384 + */
1.385 + EDisconnect = KSessionEventBaseStatus + 1,
1.386 + /** The session has been successfully connected. None of the client
1.387 + requested capabilities were denied or reduced by the proxy. An
1.388 + incoming event.
1.389 + */
1.390 + EConnectedOK = KSessionEventBaseStatus + 2,
1.391 + /** The session has been connected, but with one or more of the client
1.392 + requested capabilities denied or reduced by the proxy. An incoming
1.393 + event.
1.394 + */
1.395 + EConnectedWithReducedCapabilities = KSessionEventBaseStatus + 3,
1.396 + /** The session has been disconnected. This either confirms an earlier
1.397 + EDisconnect event or indicates a forced disconnection by the proxy.
1.398 + An incoming event.
1.399 + */
1.400 + EDisconnected = KSessionEventBaseStatus + 4,
1.401 + /** The authentication handshake succeeded with the automatic validation
1.402 + of the (proxy) server certificate.
1.403 + */
1.404 + EAuthenticatedOK = KSessionEventBaseStatus + 5,
1.405 + /** The authentication handshake failed.
1.406 + */
1.407 + EAuthenticationFailure = KSessionEventBaseStatus + 6,
1.408 + /** The connection attempt to the proxy timed out.
1.409 + */
1.410 + EConnectionTimedOut = KSessionEventBaseStatus + 7
1.411 + };
1.412 +
1.413 + /**
1.414 + HTTP session warning events.
1.415 + */
1.416 + enum TSessionWarning
1.417 + {
1.418 + /** The client has requested a transaction event that requires a session
1.419 + to be connected or the connection to be initiated, but neither is
1.420 + currently true. The transaction event will be left pending until the
1.421 + session is connected. An incoming event.
1.422 + */
1.423 + ENotConnected = KSessionWarningBaseStatus,
1.424 + /** The proxy has sent some information that is not related to a
1.425 + transaction and has no effect on the state of the session. The
1.426 + information from the proxy is in the EProxyExceptionInfo property.
1.427 + */
1.428 + EExceptionInfo = KSessionWarningBaseStatus + 1,
1.429 + /** The client connection request was (permanently) redirected to a new
1.430 + WAP proxy address. The client should check the EWspProxyAddress
1.431 + property for the new address. The client's access-point database can
1.432 + then be updated with this address. No notification is given of a
1.433 + temporary redirection.
1.434 + */
1.435 + ERedirected = KSessionWarningBaseStatus + 2,
1.436 + /** The client has requested a session event that is not valid whilst
1.437 + the WSP session is trying to establish a connection.
1.438 + */
1.439 + EAlreadyConnecting = KSessionWarningBaseStatus + 3,
1.440 + /** The client has requested a session event that is not valid whilst
1.441 + the WSP session is in the Connected state.
1.442 + */
1.443 + EAlreadyConnected = KSessionWarningBaseStatus + 4,
1.444 + /** The client has requested a session event that is not valid whilst
1.445 + the WSP session is trying to close the connection.
1.446 + */
1.447 + EAlreadyDisconnecting = KSessionWarningBaseStatus + 5,
1.448 + /** The client has requested a session event that is not valid whilst
1.449 + the WSP session is in the Null (or disconnected) state.
1.450 + */
1.451 + EAlreadyDisconnected = KSessionWarningBaseStatus + 6
1.452 + };
1.453 +
1.454 +public:
1.455 + /** Constructor
1.456 + @param aStatus The status value.
1.457 + @param aUID The UID.
1.458 + */
1.459 + inline THTTPSessionEvent(TInt aStatus, TUint aUID = KHTTPUid);
1.460 +
1.461 + /** Constructor (using a standard event and the HTTP UID)
1.462 + @param aStatus The standard event to use.
1.463 + */
1.464 + inline THTTPSessionEvent(TStandardEvent aStatus = EAnySessionEvent);
1.465 +
1.466 + /** Constructor (using a session event and the HTTP UID)
1.467 + @param aStatus The session event to use.
1.468 + */
1.469 + inline THTTPSessionEvent(TSessionEvent aStatus);
1.470 +
1.471 + /** Assigns a session event code to an event object
1.472 + @param aStatus The session event.
1.473 + */
1.474 + //##ModelId=3C4C187402F9
1.475 + inline THTTPSessionEvent& operator=(TSessionEvent aStatus);
1.476 +
1.477 + /// Equality operator (compares with a session event)
1.478 + //##ModelId=3C4C187402E6
1.479 + inline TBool operator==(TSessionEvent aStatus) const;
1.480 +
1.481 + /// Inequality operator (compares with a session event)
1.482 + //##ModelId=3C4C187402D2
1.483 + inline TBool operator!=(TSessionEvent aStatus) const;
1.484 + };
1.485 +
1.486 +#include <http/thttpevent.inl>
1.487 +
1.488 +#endif // __THTTPEVENT_H__