2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
24 #include <curl/curl.h>
25 #include <curl/easy.h>
27 #include "common/HereMaps_global.h"
29 #include "common/RestItemHandle.h"
30 #include "base/BaseByteBuffer.h"
31 #include "base/EventDrivenThread.h"
33 TIZEN_MAPS_BEGIN_NAMESPACE
35 using namespace Tizen::Maps;
37 typedef struct MemoryStruct {
38 MemoryStruct() : memory(NULL), size(0), http_code(0), error(0) {};
52 static RestCurl& GetInstance();
53 bool Commit(void *pArgs);
54 void Abort(const Here::Maps::RestItemHandle::RequestId aRequestId);
59 int EasyCurl(String sUrl, MemoryStruct_s* pChunk
60 #ifdef TIZEN_SUPPORT_POST_METHOD
61 , bool bPost = false, String sPostData = ""
64 void MaskCredentialKey(String &key);
65 static void *ThreadFunc(void *pArgs);
66 static size_t WriteMemoryCb(void *pContents, size_t nSize, size_t nNmemb, void *pUser);
67 static int XferInfoCb(void *pUser, curl_off_t dlTotal, curl_off_t dlNow,
68 curl_off_t ulTotal, curl_off_t ulNow);
69 String UrlEncode(String sStr);
70 bool CreateDetachedThread(void* (*pFunc)(void*), void *pArgs);
72 #ifdef TIZEN_SUPPORT_CRYPTO_LOCK
73 static void CryptoMutexLock(int mode, int type, char *file, int line);
74 static void CryptoInitMutexLocks(void);
75 static void CryptoKillMutexLocks(void);
76 static unsigned long CryptoThreadId(void);
80 RestCurlImpl* m_pImpl;
83 TIZEN_MAPS_END_NAMESPACE
85 #endif /* REST_CURL_H */