merge with master
[framework/osp/net.git] / src / http / FNetHttp_HttpTransactionEventArg.cpp
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_HttpTransactionEventArg.cpp
20  * @brief               This is the implementation file for _HttpTransactionEventArg class.
21  */
22
23 #include <FBaseSysLog.h>
24 #include <FBaseCol.h>
25 #include "FNetHttp_HttpTransactionImpl.h"
26 #include "FNetHttp_HttpTransactionEvent.h"
27 #include "FNetHttp_HttpTransactionEventArg.h"
28
29 using namespace Tizen::Base;
30 using namespace Tizen::Base::Collection;
31
32 namespace Tizen { namespace Net { namespace Http
33 {
34
35 _HttpTransactionEventArg::_HttpTransactionEventArg(int transactionId, _HttpTransactionEventType eventType)
36         : __transactionId(transactionId)
37         , __eventType(eventType)
38         , __result(E_SUCCESS)
39         , __readHeaderLength(0)
40         , __httpAuth(0)
41         , __isProxyAuth(false)
42         , __readBodyLength(0)
43         , __recommendedSize(0)
44         , __uploadCurrentProgress(0)
45         , __uploadTotalProgress(0)
46         , __downloadCurrentProgress(0)
47         , __downloadTotalProgress(0)
48         , __pServerCert(null)
49         , __pServerCertList(null)
50 {
51 }
52
53 _HttpTransactionEventArg::~_HttpTransactionEventArg(void)
54 {
55         __transactionId = -1;
56         __eventType = _HTTP_TRANSACTION_EVENT_TYPE_UNDEFINED;
57         __result = E_SUCCESS;
58         __readHeaderLength = 0;
59         __readBodyLength = 0;
60 }
61
62 int
63 _HttpTransactionEventArg::GetTransactionId() const
64 {
65         return __transactionId;
66 }
67
68 _HttpTransactionEventType
69 _HttpTransactionEventArg::GetEventType()
70 {
71
72         return __eventType;
73 }
74
75 void
76 _HttpTransactionEventArg::SetError(result error)
77 {
78         __result = error;
79 }
80
81 result
82 _HttpTransactionEventArg::GetError() const
83 {
84         return __result;
85 }
86
87 void
88 _HttpTransactionEventArg::SetReadHeaderLength(int readHeaderLength)
89 {
90         __readHeaderLength = readHeaderLength;
91 }
92
93 int
94 _HttpTransactionEventArg::GetReadHeaderLength(void) const
95 {
96         return __readHeaderLength;
97 }
98
99 void
100 _HttpTransactionEventArg::SetAuthType(long httpAuth)
101 {
102         __httpAuth = httpAuth;
103 }
104 long
105 _HttpTransactionEventArg::GetAuthType(void) const
106 {
107         return __httpAuth;
108 }
109
110 void
111 _HttpTransactionEventArg::SetProxyAuth(bool isProxyAuth)
112 {
113         __isProxyAuth = isProxyAuth;
114 }
115
116 bool
117 _HttpTransactionEventArg::IsProxyAuth(void) const
118 {
119         return __isProxyAuth;
120 }
121
122 void
123 _HttpTransactionEventArg::SetReadBodyLength(int readBodyLength)
124 {
125         __readBodyLength = readBodyLength;
126 }
127 int
128 _HttpTransactionEventArg::GetReadBodyLength(void) const
129 {
130         return __readBodyLength;
131 }
132
133 void
134 _HttpTransactionEventArg::SetRecommendedSize(int recommendedSize)
135 {
136         __recommendedSize = recommendedSize;
137 }
138
139 int
140 _HttpTransactionEventArg::GetRecommendedSize(void) const
141 {
142         return __recommendedSize;
143 }
144
145 void
146 _HttpTransactionEventArg::SetUploadProgress(long long currentSize, long long totalSize)
147 {
148         __uploadCurrentProgress = currentSize;
149         __uploadTotalProgress = totalSize;
150 }
151
152 long long
153 _HttpTransactionEventArg::GetCurrentUploadProgress(void) const
154 {
155         return __uploadCurrentProgress;
156 }
157
158 long long
159 _HttpTransactionEventArg::GetTotalUploadProgress(void) const
160 {
161         return __uploadTotalProgress;
162 }
163
164 void
165 _HttpTransactionEventArg::SetDownloadProgress(long long currentSize, long long totalSize)
166 {
167         __downloadCurrentProgress = currentSize;
168         __downloadTotalProgress = totalSize;
169 }
170
171 long long
172 _HttpTransactionEventArg::GetCurrentDownloadProgress(void) const
173 {
174         return __downloadCurrentProgress;
175 }
176
177 long long
178 _HttpTransactionEventArg::GetTotalDownloadProgress(void) const
179 {
180         return __downloadTotalProgress;
181 }
182
183 void
184 _HttpTransactionEventArg::SetServerCert(String* pServerCert)
185 {
186         __pServerCert = pServerCert;
187 }
188
189 String*
190 _HttpTransactionEventArg::GetServerCert(void) const
191 {
192         return __pServerCert;
193 }
194
195 void
196 _HttpTransactionEventArg::SetServerCertList(IList* pServerCertList)
197 {
198         __pServerCertList = pServerCertList;
199 }
200
201 IList*
202 _HttpTransactionEventArg::GetServerCertList(void) const
203 {
204         return __pServerCertList;
205 }
206
207 } } } // Tizen::Net::Http