#include <response/CodeResponse.h>
#include <response/pointers.h>
#include <sockets/SocketClient.h>
+#include <sockets/SocketPath.h>
#include <types/ProtocolFields.h>
#include "Logic.h"
namespace Cynara {
-const std::string adminSocketPath("/run/cynara/cynara-admin.socket");
-
Logic::Logic() {
- m_socketClient = std::make_shared<SocketClient>(adminSocketPath,
+ m_socketClient = std::make_shared<SocketClient>(SocketPath::admin,
std::make_shared<ProtocolAdmin>());
}
#include <response/CheckResponse.h>
#include <response/pointers.h>
#include <sockets/SocketClient.h>
+#include <sockets/SocketPath.h>
#include <logic/Logic.h>
namespace Cynara {
-const std::string clientSocketPath("/run/cynara/cynara.socket");
-
static ProtocolFrameSequenceNumber generateSequenceNumber(void) {
static ProtocolFrameSequenceNumber sequenceNumber = 0;
return ++sequenceNumber;
}
Logic::Logic() {
- m_socket = std::make_shared<SocketClient>(clientSocketPath, std::make_shared<ProtocolClient>());
+ m_socket = std::make_shared<SocketClient>(SocketPath::client, std::make_shared<ProtocolClient>());
m_cache = std::make_shared<CapacityCache>();
auto naiveInterpreter = std::make_shared<NaiveInterpreter>();
m_cache->registerPlugin(PredefinedPolicyType::ALLOW, naiveInterpreter);
${COMMON_PATH}/response/ResponseTaker.cpp
${COMMON_PATH}/sockets/Socket.cpp
${COMMON_PATH}/sockets/SocketClient.cpp
+ ${COMMON_PATH}/sockets/SocketPath.cpp
${COMMON_PATH}/types/PolicyBucket.cpp
${COMMON_PATH}/types/PolicyKey.cpp
${COMMON_PATH}/types/PolicyKeyHelpers.cpp
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+/**
+ * @file src/common/sockets/SocketPath.cpp
+ * @author Marcin Niesluchowski <m.niesluchow@samsung.com>
+ * @version 1.0
+ * @brief Source file for common socket paths
+ */
+
+#include "SocketPath.h"
+
+namespace Cynara {
+namespace SocketPath {
+
+const std::string client("/run/cynara/cynara.socket");
+const std::string admin("/run/cynara/cynara-admin.socket");
+
+} // namespace SocketPath
+} // namespace Cynara
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+/**
+ * @file src/common/sockets/SocketPath.h
+ * @author Marcin Niesluchowski <m.niesluchow@samsung.com>
+ * @version 1.0
+ * @brief Header for common socket paths
+ */
+
+#ifndef SRC_COMMON_SOCKETS_SOCKETPATH_H_
+#define SRC_COMMON_SOCKETS_SOCKETPATH_H_
+
+#include <string>
+
+namespace Cynara {
+namespace SocketPath {
+
+extern const std::string client;
+extern const std::string admin;
+
+} // namespace SocketPath
+} // namespace Cynara
+
+#endif // SRC_COMMON_SOCKETS_SOCKETPATH_H_
#include <exceptions/DescriptorNotExistsException.h>
#include <exceptions/InitException.h>
#include <exceptions/UnexpectedErrorException.h>
+#include <sockets/SocketPath.h>
#include <logic/Logic.h>
#include <main/Cynara.h>
void SocketManager::init(void) {
LOGI("SocketManger init start");
- const std::string clientSocketPath("/run/cynara/cynara.socket");
- const std::string adminSocketPath("/run/cynara/cynara-admin.socket");
const mode_t clientSocketUMask(0);
const mode_t adminSocketUMask(0077);
- createDomainSocket(std::make_shared<ProtocolClient>(), clientSocketPath, clientSocketUMask,
+ createDomainSocket(std::make_shared<ProtocolClient>(), SocketPath::client, clientSocketUMask,
true);
- createDomainSocket(std::make_shared<ProtocolAdmin>(), adminSocketPath, adminSocketUMask, false);
+ createDomainSocket(std::make_shared<ProtocolAdmin>(), SocketPath::admin, adminSocketUMask,
+ false);
createSignalSocket(std::make_shared<ProtocolSignal>());
LOGI("SocketManger init done");
}