2 * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Contact: Rafal Krypa <r.krypa@samsung.com>
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License
19 * @file client-common.cpp
20 * @author Bartlomiej Grzelewski (b.grzelewski@samsung.com)
22 * @brief This file is implementation of client-common functions.
27 #include <sys/types.h>
28 #include <sys/socket.h>
30 #include <sys/smack.h>
31 #include <sys/xattr.h>
32 #include <linux/xattr.h>
35 #include <dpl/log/log.h>
36 #include <dpl/serialization.h>
37 #include <dpl/singleton.h>
38 #include <dpl/singleton_safe_impl.h>
40 #include <message-buffer.h>
42 #include <protocols.h>
44 IMPLEMENT_SAFE_SINGLETON(SecurityManager::Log::LogSystem);
48 void securityClientEnableLogSystem(void) {
49 SecurityManager::Singleton<SecurityManager::Log::LogSystem>::Instance().SetTag("SECURITY_MANAGER_CLIENT");
52 } // namespace anonymous
54 namespace SecurityManager {
56 int try_catch(const std::function<int()>& func)
60 } catch (MessageBuffer::Exception::Base &e) {
61 LogError("SecurityManager::MessageBuffer::Exception " << e.DumpToString());
62 } catch (std::exception &e) {
63 LogError("STD exception " << e.what());
65 LogError("Unknown exception occured");
67 return SECURITY_MANAGER_API_ERROR_UNKNOWN;
70 } // namespace SecurityMANAGER
72 static void init_lib(void) __attribute__ ((constructor));
73 static void init_lib(void)
75 securityClientEnableLogSystem();
78 static void fini_lib(void) __attribute__ ((destructor));
79 static void fini_lib(void)