2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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.
17 * @file tpkp_client_cache.cpp
18 * @author Kyungwook Tak (k.tak@samsung.com)
20 * @brief Https Public Key Pinning client cache implementation.
22 #include "tpkp_client_cache.h"
26 #include <sys/syscall.h>
29 #include "tpkp_logger.h"
35 return syscall(SYS_gettid);
42 ClientCache::ClientCache() {}
44 ClientCache::~ClientCache() {}
46 void ClientCache::setUrl(const std::string &url)
48 auto tid = _getThreadId();
50 std::lock_guard<std::mutex> lock(m_url_mutex);
54 SLOGD("set url[%s] of thread id[%u]", url.c_str(), tid);
57 std::string ClientCache::getUrl(void)
61 auto tid = _getThreadId();
63 std::lock_guard<std::mutex> lock(m_url_mutex);
67 SLOGD("get url[%s] from thread id[%u]", url.c_str(), tid);
72 void ClientCache::eraseUrl(void)
74 auto tid = _getThreadId();
76 std::lock_guard<std::mutex> lock(m_url_mutex);
80 SLOGD("erase url of mapped by thread id[%u]", tid);
83 void ClientCache::eraseUrlAll(void)
87 SLOGD("erase all urls saved of client");