2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FNetHttpIHttpTransactionEventListener.h
20 * @brief This is the header file for the %IHttpTransactionEventListener interface.
22 * This header file contains the declarations of the %IHttpTransactionEventListener interface.
25 #ifndef _FNET_HTTP_IHTTP_TRANSACTION_EVENT_LISTENER_H_
26 #define _FNET_HTTP_IHTTP_TRANSACTION_EVENT_LISTENER_H_
28 #include <FBaseTypes.h>
29 #include <FBaseString.h>
30 #include <FBaseRtIEventListener.h>
32 namespace Tizen { namespace Net { namespace Http
35 class HttpTransaction;
37 * @interface IHttpTransactionEventListener
38 * @brief This interface provides listeners for the HTTP transaction events.
42 * @remarks If a user-defined class is derived from multiple classes including this interface, a compile error for using an ambiguous base class can occur. @n
43 * In this case, type casting is required to declare an explicit base class for the user-defined class.
45 * The %IHttpTransactionEventListener interface provides listeners for the HTTP transaction events. To use this listener, you must add it to the HttpTransaction instance
46 * through the AddListener() method. If an HTTP transaction event is generated, a method of this class is called.
48 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/net/http_transaction.htm">HTTP Transaction</a>.
51 class _OSP_EXPORT_ IHttpTransactionEventListener
52 : virtual public Tizen::Base::Runtime::IEventListener
57 * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when the destructor of this interface is called.
61 virtual ~IHttpTransactionEventListener(void) {}
65 * Called to notify when the content body of the response has been received.
69 * @param[in] httpSession The session information of the %Http transaction event
70 * @param[in] httpTransaction The transaction information of the %Http transaction event
71 * @param[in] availableBodyLen The length of the available body of the %Http transaction
72 * @see HttpResponse::ReadBodyN()
74 virtual void OnTransactionReadyToRead(HttpSession& httpSession, HttpTransaction& httpTransaction, int availableBodyLen) = 0;
77 * Called to notify when the process of transaction has been aborted.
81 * @param[in] httpSession The session information of the %Http transaction event
82 * @param[in] httpTransaction The transaction information of the %Http transaction event
83 * @param[in] r The cause of the error
84 * @exception E_INVALID_ARG A specified input parameter is invalid.
85 * @exception E_OUT_OF_MEMORY The memory is insufficient.
86 * @exception E_IO The method has failed to read the data.
87 * @exception E_TIMEOUT An attempt to connect to the server has timed out.
88 * @exception E_NETWORK_UNAVAILABLE The network is unavailable.
89 * @exception E_HOST_UNREACHABLE The network cannot be reached from this host at this time.
90 * @exception E_SYSTEM An internal error has occurred.
91 * @exception E_UNKNOWN An unknown error has occurred.
92 * @exception E_NOT_RESPONDING There is no response.
93 * @exception E_INVALID_CONTENT The content is invalid.
94 * @exception E_CONNECTION_RESET The network connection has been reset.
95 * @exception E_HTTP_USER The HTTP user is canceled.
96 * @exception E_NO_CERTIFICATE The client certificate is required to connect to the server.
97 * @exception E_UNSUPPORTED_SERVICE The service is not allowed.
98 * @exception E_USER_AGENT_NOT_ALLOWED The user agent is not allowed.
99 * @exception E_RESOURCE_UNAVAILABLE The network resource is unavailable.
100 * @remarks If the E_NO_CERTIFICATE exception is thrown, start the AppControl(L"tizen.certificatemanager") for getting the selected client certificate. @n
101 * For more information, see <a href="../org.tizen.native.appprogramming/html/guide/app/appcontrol_certmgr.htm">here</a>.
103 virtual void OnTransactionAborted(HttpSession& httpSession, HttpTransaction& httpTransaction, result r) = 0;
106 * Called to add chunks to the request.
110 * @param[in] httpSession The session information of the %Http transaction event
111 * @param[in] httpTransaction The transaction information of the %Http transaction event
112 * @param[in] recommendedChunkSize The length of the chunked %Http transaction
113 * @remarks To enable this listener, HttpTransaction::EnableTransactionReadyToWrite() must be called.
114 * @see HttpRequest::WriteBody()
116 virtual void OnTransactionReadyToWrite(HttpSession& httpSession, HttpTransaction& httpTransaction, int recommendedChunkSize) = 0;
119 * Called to notify when the header of response has been received.
123 * @param[in] httpSession The session information of the %Http transaction event
124 * @param[in] httpTransaction The transaction information of the %Http transaction event
125 * @param[in] headerLen The length of the %Http transaction's header
126 * @param[in] bAuthRequired Set to @c true if the transaction requires authentication, @n
128 * @see HttpResponse::GetHeader()
130 virtual void OnTransactionHeaderCompleted(HttpSession& httpSession, HttpTransaction& httpTransaction, int headerLen, bool bAuthRequired) = 0;
133 * Called to notify when the process of transaction has been completed.
137 * @param[in] httpSession The session information of the %Http transaction event
138 * @param[in] httpTransaction The transaction information of the %Http transaction event
139 * @see HttpResponse::GetHeader()
140 * @see HttpResponse::ReadBodyN()
142 virtual void OnTransactionCompleted(HttpSession& httpSession, HttpTransaction& httpTransaction) = 0;
145 * Called to accept input from the user on whether to resume or pause the transaction in case the certificate is not verified.
149 * @param[in] httpSession The session information of the %Http transaction event
150 * @param[in] httpTransaction The transaction information of the %Http transaction event
151 * @param[in] pCert The certificate information
152 * @see HttpTransaction::Resume()
153 * @see HttpTransaction::Pause()
155 virtual void OnTransactionCertVerificationRequiredN(HttpSession& httpSession, HttpTransaction& httpTransaction, Tizen::Base::String* pCert) = 0;
159 // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
161 // This method is reserved and may change its name at any time without prior notice.
165 virtual void IHttpTransactionEventListener_Reserved1(void) {}
168 // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
170 // This method is reserved and may change its name at any time without prior notice.
174 virtual void IHttpTransactionEventListener_Reserved2(void) {}
178 } } } // Tizen::Net::Http
179 #endif // _FNET_HTTP_IHTTP_TRANSACTION_EVENT_LISTENER_H_