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 server-main.cpp
20 * @author Bartlomiej Grzelewski (b.grzelewski@samsung.com)
22 * @brief Implementation of security-manager on basis of security-server
27 #include <dpl/log/log.h>
28 #include <dpl/singleton.h>
29 #include <dpl/singleton_safe_impl.h>
31 #include <socket-manager.h>
33 #include <installer.h>
35 IMPLEMENT_SAFE_SINGLETON(SecurityManager::Log::LogSystem);
37 #define REGISTER_SOCKET_SERVICE(manager, service) \
38 registerSocketService<service>(manager, #service)
41 void registerSocketService(SecurityManager::SocketManager &manager, const std::string& serviceName)
47 manager.RegisterSocketService(service);
49 } catch (const SecurityManager::Exception &exception) {
50 LogError("Error in creating service " << serviceName <<
51 ", details:\n" << exception.DumpToString());
52 } catch (const std::exception& e) {
53 LogError("Error in creating service " << serviceName <<
54 ", details:\n" << e.what());
56 LogError("Error in creating service " << serviceName <<
57 ", unknown exception occured");
65 UNHANDLED_EXCEPTION_HANDLER_BEGIN
67 SecurityManager::Singleton<SecurityManager::Log::LogSystem>::Instance().SetTag("SECURITY_MANAGER");
71 sigaddset(&mask, SIGTERM);
72 sigaddset(&mask, SIGPIPE);
73 if (-1 == pthread_sigmask(SIG_BLOCK, &mask, NULL)) {
74 LogError("Error in pthread_sigmask");
79 SecurityManager::SocketManager manager;
81 REGISTER_SOCKET_SERVICE(manager, SecurityManager::InstallerService);
85 UNHANDLED_EXCEPTION_HANDLER_END