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