Add CheckContext class 00/29800/10
authorAdam Malinowski <a.malinowsk2@partner.samsung.com>
Mon, 3 Nov 2014 10:16:22 +0000 (11:16 +0100)
committerAdam Malinowski <a.malinowsk2@partner.samsung.com>
Sat, 15 Nov 2014 04:30:05 +0000 (05:30 +0100)
This class will be used for storing all data related to check request.
This data will be used to send response to client when answer is ready.

Change-Id: I20b665409e15d249a9c55615a39f4ab5b361bc18

src/service/request/CheckContext.h [new file with mode: 0644]

diff --git a/src/service/request/CheckContext.h b/src/service/request/CheckContext.h
new file mode 100644 (file)
index 0000000..5184296
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * 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/service/request/CheckContext.h
+ * @author      Adam Malinowski <a.malinowsk2@partner.samsung.com>
+ * @version     1.0
+ * @brief       Declaration of CheckContext class
+ */
+
+#ifndef SRC_SERVICE_REQUEST_CHECKCONTEXT_H_
+#define SRC_SERVICE_REQUEST_CHECKCONTEXT_H_
+
+#include <memory>
+
+#include <containers/BinaryQueue.h>
+#include <request/pointers.h>
+#include <types/PolicyKey.h>
+#include <types/ProtocolFields.h>
+
+#include <cynara-plugin.h>
+
+#include <agent/AgentTalker.h>
+
+namespace Cynara {
+
+class CheckContext {
+public:
+    CheckContext(const PolicyKey &key, RequestContextPtr requestContext,
+                 ProtocolFrameSequenceNumber checkId, ServicePluginInterfacePtr plugin,
+                 const AgentTalkerPtr &agentTalkerPtr) : m_agentTalker(agentTalkerPtr),
+                     m_checkId(checkId), m_key(key), m_plugin(plugin),
+                     m_requestContext(requestContext), m_cancelled(false) {}
+    ~CheckContext() {}
+
+    AgentTalkerPtr m_agentTalker;
+    const ProtocolFrameSequenceNumber m_checkId;
+    const PolicyKey m_key;
+    ServicePluginInterfacePtr m_plugin;
+    RequestContextPtr m_requestContext;
+    bool m_cancelled;
+
+    void cancel(void) {
+        m_cancelled = true;
+    }
+
+    bool cancelled(void) const {
+        return m_cancelled;
+    }
+};
+
+typedef std::shared_ptr<CheckContext> CheckContextPtr;
+
+} // namespace Cynara
+
+#endif /* SRC_SERVICE_REQUEST_CHECKCONTEXT_H_ */