Add protocol and socket path to SocketClient constructor.
Pass path to client socket and ProtocolClient object to
SocketClient in libcynara-client Logic class.
Change-Id: I45e991b8309616876248289558265e5df915012d
#include <exceptions/ServerConnectionErrorException.h>
#include <exceptions/UnexpectedErrorException.h>
#include <log/log.h>
+#include <protocol/Protocol.h>
+#include <protocol/ProtocolClient.h>
#include <request/CheckRequest.h>
#include <request/pointers.h>
#include <response/CheckResponse.h>
namespace Cynara {
+const std::string clientSocketPath("/run/cynara/cynara.socket");
+
Logic::Logic() {
- m_socketClient = std::make_shared<SocketClient>();
+ m_socketClient = std::make_shared<SocketClient>(clientSocketPath,
+ std::make_shared<ProtocolClient>());
}
cynara_api_result Logic::check(const std::string &client, const std::string &session UNUSED,
#include <log/log.h>
#include <protocol/Protocol.h>
-#include <protocol/ProtocolClient.h>
#include <request/pointers.h>
#include <request/Request.h>
#include <request/RequestContext.h>
namespace Cynara {
-const std::string clientSocketPath("/run/cynara/cynara.socket");
-
-SocketClient::SocketClient() : m_socket(clientSocketPath),
- m_protocol(std::make_shared<ProtocolClient>()) {
+SocketClient::SocketClient(const std::string &socketPath, ProtocolPtr protocol)
+ : m_socket(socketPath), m_protocol(protocol) {
}
ResponsePtr SocketClient::askCynaraServer(RequestPtr request) {
BinaryQueue m_writeQueue;
public:
- SocketClient();
+ SocketClient(const std::string &socketPath, ProtocolPtr protocol);
virtual ~SocketClient() = default;
//returns pointer to response