merge with master
[framework/osp/net.git] / src / http / FNetHttp_HttpTransactionEvent.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17
18 /**
19  * @file                FNetHttp_HttpTransactionEvent.h
20  * @brief               This is the header file for %_HttpTransactionEvent class.
21  *
22  * This header file contains the declarations of _HttpTransactionEvent class.
23  * The _HttpTransactionEvent class can call listener's method. So, when an event is occurred,
24  * application can handle it appropriately.
25  */
26
27 #ifndef _FNET_HTTP_INTERNAL_HTTP_TRANSACTION_EVENT_H_
28 #define _FNET_HTTP_INTERNAL_HTTP_TRANSACTION_EVENT_H_
29
30 #include <FNetHttpHttpTypes.h>
31 #include <FNetHttpIHttpProgressEventListener.h>
32 #include <FBaseRt_Event.h>
33 #include "FNetHttp_HttpCommon.h"
34
35 namespace Tizen { namespace Net { namespace Http
36 {
37 class _HttpSessionImpl;
38 class _HttpTransactionImpl;
39 /**
40  * @class       _HttpTransactionEvent
41  * @brief       This class handles an Http Transaction event. It is inherited from Event class.
42  *
43  * @since 2.1
44  *
45  * When an Http Transaction event is occurred, the __HttpTransactionEvent class finds listener and calls
46  * the appropriate listener's method. @n
47  */
48
49 class _HttpTransactionEvent
50         : public Tizen::Base::Runtime::_Event
51 {
52
53 public:
54         _HttpTransactionEvent(void);
55
56         ~_HttpTransactionEvent(void);
57
58         result Construct(_HttpSessionImpl* pHttpSessionImpl, _HttpTransactionImpl* pHttpTransactionImpl);
59
60         result SetHttpProgressListener(const IHttpProgressEventListener* pListener);
61
62         bool GetCertRequestedResult(void) const;
63
64         _HttpSessionImpl* GetHttpSessionImpl(void) const;
65
66         result FireTransactionReadyToReadEvent(int readBodyLength, bool async = false);
67
68         result FireTransactionReadyToWriteEvent(int recommenedLength, bool async = false);
69
70         result FireTransactionHeaderCompletedEvent(int headerLength, long proxyAuth, long httpAuth, bool async = false);
71
72         result FireTransactionCertVerificationRequiredNEvent(Tizen::Base::String* pServerCert, bool async = false);
73
74         result FireTransactionCertVerificationRequestedNEvent(Tizen::Base::Collection::IList* pServerCertList, bool async = false);
75
76         result FireTransactionCompletedEvent(bool async = false);
77
78         result FireTransactionAbortedEvent(result error, bool async = false);
79
80         result FireHttpUploadInProgressEvent(int currentLength, int totalLength, bool async = false);
81
82         result FireHttpDownloadInProgressEvent(int currentLength, int totalLength, bool async = false);
83
84 protected:
85         virtual void FireImpl(Tizen::Base::Runtime::IEventListener& listener, const Tizen::Base::Runtime::IEventArg& arg);
86
87 private:
88         _HttpTransactionEvent(const _HttpTransactionEvent& rhs);
89
90         _HttpTransactionEvent& operator =(const _HttpTransactionEvent& rhs);
91
92 private:
93         _HttpSessionImpl* __pHttpSessionImpl;
94         _HttpTransactionImpl* __pHttpTransactionImpl;
95         IHttpProgressEventListener* __pHttpProgressListener;
96         int __transactionId;
97         bool __isCertRequestedResult;
98
99 }; // _HttpTransactionEvent
100
101 } } } // Tizen::Net::Http
102 #endif // _FNET_HTTP_INTERNAL_HTTP_TRANSACTION_EVENT_H_