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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
18 @warning : This file contains Rose Model ID comments - please do not delete
21 #ifndef __THTTPEVENT_H__
22 #define __THTTPEVENT_H__
28 The HTTP UID. This UID is used for all events defined here.
32 const TUint KHTTPUid = 0x1000A441;
35 Wildcard Matching UID. When specified as part of an event then the UID event
36 part of the match will be ignored.
40 const TUint KHTTPMatchAnyEventUid = 0x1000A44C;
43 The base status code for transaction events. Any number above this but below
44 KSessionEventBaseStatus is a transaction event.
48 const TInt KTransactionEventBaseStatus = 0;
51 The base status code for transaction warning events.
55 const TInt KTransactionWarningBaseStatus = 10000;
58 The base status code for session events. Any number above this is a session
63 const TInt KSessionEventBaseStatus = 100000;
66 The base status code for session warning events.
70 const TInt KSessionWarningBaseStatus = 110000;
73 //##ModelId=3C4C18740294
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
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
94 /** Used when registering filter to indicate the filter is instrested
95 in ALL events, both transaction and session events.
97 EAll = KRequestPending + 1,
98 /** Used when registering filters to indicate the filter is interested
99 in any transaction event, from any direction.
101 EAnyTransactionEvent = KRequestPending,
102 /** Used when registering filters to indicate the filter is interested
103 in any session event.
105 EAnySessionEvent = KSessionEventBaseStatus
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.
116 enum TTransactionEvent
118 /** The transaction is being submitted. An outgoing event.
120 ESubmit = KTransactionEventBaseStatus,
121 /** The transaction is being cancelled. An outgoing event.
123 ECancel = KTransactionEventBaseStatus + 1,
124 /** A new part of request body data is available for transmission. An
127 ENotifyNewRequestBodyPart = KTransactionEventBaseStatus + 2,
128 /** The transaction is being closed. An outgoing event.
130 EClosed = KTransactionEventBaseStatus + 3,
131 /** All the response headers have been received. An incoming event.
133 EGotResponseHeaders = KTransactionEventBaseStatus + 4,
134 /** Some (more) body data has been received (in the HTTP response). An
137 EGotResponseBodyData = KTransactionEventBaseStatus + 5,
138 /** The transaction's response is complete. An incoming event.
140 EResponseComplete = KTransactionEventBaseStatus + 6,
141 /** Some trailer headers have been received. An incoming event.
143 EGotResponseTrailerHeaders = KTransactionEventBaseStatus + 7,
144 /** The transaction has succeeded. An incoming event.
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.
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.
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
167 ETooMuchRequestData = KTransactionEventBaseStatus + 11,
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.
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.
178 If the requested method is GET or HEAD the transaction is automatically
179 redirected and this event is not used.
181 ERedirectRequiresConfirmation = KTransactionEventBaseStatus + 12,
183 /** A transaction has been specified to use a proxy and the request
184 requires a tunnel to be establised to the origin server.
186 ENeedTunnel = KTransactionEventBaseStatus + 13,
188 /** The client wishes to view the current cipher suite.
190 EGetCipherSuite = KTransactionEventBaseStatus + 14,
192 /** The transaction's request is complete. An incoming event.
194 ERequestComplete = KTransactionEventBaseStatus + 15,
196 /**An event to signal that 100 Continue response has been received.
198 EReceived100Continue = KTransactionEventBaseStatus + 16,
200 /**An event to cancel the wait for a 100-Continue event.
202 ECancelWaitFor100Continue = KTransactionEventBaseStatus + 17,
204 /**An event of Send Timeout for a Request.
206 ESendTimeOut = KTransactionEventBaseStatus + 18,
208 /**An event of Receive Timeout for a Response.
210 EReceiveTimeOut = KTransactionEventBaseStatus + 19,
212 /**An event that indicate that transaction Suspended.
214 ESuspend = KTransactionEventBaseStatus +20,
216 /**An event that indicate that transaction Resume.
218 EResume = KTransactionEventBaseStatus +21
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.
230 /** An event originating with the client (e.g. start transaction).
233 /** An event originating with the server (e.g. something received).
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.
243 enum TTransactionWarning
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.
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.
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.
260 EMoreDataReceivedThanExpected = KTransactionWarningBaseStatus + 2
266 @param aStatus The status value.
269 //##ModelId=3C4C187402FB
270 inline THTTPEvent(TInt aStatus, TUint aUID = KHTTPUid);
272 /** Constructor (using a standard event and the HTTP UID)
273 @param aStatus The standard event to use.
275 //##ModelId=3C4C18740304
276 inline THTTPEvent(TStandardEvent aStatus = EAnyTransactionEvent);
278 /** Constructor (using a transaction event and the HTTP UID)
279 @param aStatus The transaction event to use.
281 //##ModelId=3C4C1874030C
282 inline THTTPEvent(TTransactionEvent aStatus);
284 /** Assigns a standard event code to an event object
285 @param aStatus The standard event.
286 @return The HTTP event object.
288 //##ModelId=3C4C187402EF
289 inline THTTPEvent& operator=(TStandardEvent aStatus);
291 /** Assigns a transaction event code to an event object
292 @param aStatus The transaction event.
293 @return The HTTP event object.
295 //##ModelId=3C4C187402F1
296 inline THTTPEvent& operator=(TTransactionEvent aStatus);
298 /** Equality operator
299 @param The HTTP event object to compare.
300 @return ETrue if the HTTP event objects are equal.
302 //##ModelId=3C4C187402DA
303 inline TBool operator==(THTTPEvent aThat) const;
305 /** Inequality operator
306 @param The HTTP event object to compare.
307 @return ETrue if the HTTP event objects are not equal.
309 //##ModelId=3C4C187402BD
310 inline TBool operator!=(THTTPEvent aThat) const;
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.
316 //##ModelId=3C4C187402DC
317 inline TBool operator==(TStandardEvent aStatus) const;
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.
323 //##ModelId=3C4C187402C7
324 inline TBool operator!=(TStandardEvent aStatus) const;
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.
330 //##ModelId=3C4C187402E4
331 inline TBool operator==(TTransactionEvent aStatus) const;
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.
337 //##ModelId=3C4C187402D0
338 inline TBool operator!=(TTransactionEvent aStatus) const;
340 /** @return ETrue if the event is a session event
342 //##ModelId=3C4C187402BC
343 inline TBool IsSessionEvent() const;
345 public: // Attributes
347 /** The status value.
349 //##ModelId=3C4C187402B4
354 //##ModelId=3C4C187402AA
357 protected: // Attributes
358 /** Flag to indicate whether the event is a session event
360 TBool iIsSessionEventFlag;
365 class THTTPSessionEvent : public THTTPEvent
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
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.
383 /** A session connection should be initiated. An outgoing event.
385 EConnect = KSessionEventBaseStatus,
386 /** The session should be disconnected. An outgoing event.
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
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
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.
403 EDisconnected = KSessionEventBaseStatus + 4,
404 /** The authentication handshake succeeded with the automatic validation
405 of the (proxy) server certificate.
407 EAuthenticatedOK = KSessionEventBaseStatus + 5,
408 /** The authentication handshake failed.
410 EAuthenticationFailure = KSessionEventBaseStatus + 6,
411 /** The connection attempt to the proxy timed out.
413 EConnectionTimedOut = KSessionEventBaseStatus + 7
417 HTTP session warning events.
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.
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.
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.
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.
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.
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.
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.
454 EAlreadyDisconnected = KSessionWarningBaseStatus + 6
459 @param aStatus The status value.
462 inline THTTPSessionEvent(TInt aStatus, TUint aUID = KHTTPUid);
464 /** Constructor (using a standard event and the HTTP UID)
465 @param aStatus The standard event to use.
467 inline THTTPSessionEvent(TStandardEvent aStatus = EAnySessionEvent);
469 /** Constructor (using a session event and the HTTP UID)
470 @param aStatus The session event to use.
472 inline THTTPSessionEvent(TSessionEvent aStatus);
474 /** Assigns a session event code to an event object
475 @param aStatus The session event.
477 //##ModelId=3C4C187402F9
478 inline THTTPSessionEvent& operator=(TSessionEvent aStatus);
480 // Equality operator (compares with a session event)
481 //##ModelId=3C4C187402E6
482 inline TBool operator==(TSessionEvent aStatus) const;
484 // Inequality operator (compares with a session event)
485 //##ModelId=3C4C187402D2
486 inline TBool operator!=(TSessionEvent aStatus) const;
489 #include <http/thttpevent.inl>
491 #endif // __THTTPEVENT_H__