${COMMON_PATH}/protocol/ProtocolSerialization.cpp
${COMMON_PATH}/protocol/ProtocolSignal.cpp
${COMMON_PATH}/request/CheckRequest.cpp
+ ${COMMON_PATH}/request/InsertOrUpdateBucketRequest.cpp
+ ${COMMON_PATH}/request/RemoveBucketRequest.cpp
${COMMON_PATH}/request/RequestTaker.cpp
+ ${COMMON_PATH}/request/SetPoliciesRequest.cpp
${COMMON_PATH}/request/SignalRequest.cpp
${COMMON_PATH}/response/CheckResponse.cpp
${COMMON_PATH}/response/ResponseTaker.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 InsertOrUpdateBucketRequest.cpp
+ * @author Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
+ * @version 1.0
+ * @brief This file implements request class for inserting or updating policy bucket
+ */
+
+#include <memory>
+
+#include "InsertOrUpdateBucketRequest.h"
+
+namespace Cynara {
+
+void InsertOrUpdateBucketRequest::execute(RequestPtr self, RequestTakerPtr taker,
+ RequestContextPtr context) const {
+ taker->execute(context, std::dynamic_pointer_cast<InsertOrUpdateBucketRequest>(self));
+}
+
+} // 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 InsertOrUpdateBucketRequest.h
+ * @author Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
+ * @version 1.0
+ * @brief This file defines request class for inserting or updating policy bucket
+ */
+
+#ifndef SRC_COMMON_REQUEST_INSERTORUPDATEBUCKETREQUEST_H_
+#define SRC_COMMON_REQUEST_INSERTORUPDATEBUCKETREQUEST_H_
+
+#include <types/PolicyBucketId.h>
+#include <types/PolicyResult.h>
+
+#include <request/pointers.h>
+#include <request/Request.h>
+#include <request/RequestTaker.h>
+
+namespace Cynara {
+
+class InsertOrUpdateBucketRequest : public Request {
+private:
+ PolicyBucketId m_bucketId;
+ PolicyResult m_result;
+
+public:
+ InsertOrUpdateBucketRequest(const PolicyBucketId &bucketId, const PolicyResult &result,
+ ProtocolFrameSequenceNumber sequenceNumber) :
+ Request(sequenceNumber), m_bucketId(bucketId), m_result(result) {
+ }
+
+ virtual ~InsertOrUpdateBucketRequest() = default;
+
+ const PolicyBucketId &bucketId(void) const {
+ return m_bucketId;
+ }
+
+ const PolicyResult &result(void) const {
+ return m_result;
+ }
+
+ virtual void execute(RequestPtr self, RequestTakerPtr taker, RequestContextPtr context) const;
+};
+
+} // namespace Cynara
+
+#endif /* SRC_COMMON_REQUEST_INSERTORUPDATEBUCKETREQUEST_H_ */
--- /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 RemoveBucketRequest.cpp
+ * @author Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
+ * @version 1.0
+ * @brief This file implements request class for bucket removal
+ */
+
+#include <memory>
+
+#include "RemoveBucketRequest.h"
+
+namespace Cynara {
+
+void RemoveBucketRequest::execute(RequestPtr self, RequestTakerPtr taker,
+ RequestContextPtr context) const {
+ taker->execute(context, std::dynamic_pointer_cast<RemoveBucketRequest>(self));
+}
+
+} // 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 RemoveBucketRequest.h
+ * @author Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
+ * @version 1.0
+ * @brief This file defines request class for bucket removal
+ */
+
+#ifndef SRC_COMMON_REQUEST_REMOVEBUCKETREQUEST_H_
+#define SRC_COMMON_REQUEST_REMOVEBUCKETREQUEST_H_
+
+#include <types/PolicyBucketId.h>
+
+#include <request/pointers.h>
+#include <request/Request.h>
+#include <request/RequestTaker.h>
+
+namespace Cynara {
+
+class RemoveBucketRequest : public Request {
+private:
+ PolicyBucketId m_bucketId;
+
+public:
+ RemoveBucketRequest(const PolicyBucketId &bucketId, ProtocolFrameSequenceNumber sequenceNumber)
+ : Request(sequenceNumber), m_bucketId(bucketId) {
+ }
+
+ virtual ~RemoveBucketRequest() = default;
+
+ const PolicyBucketId &bucketId(void) const {
+ return m_bucketId;
+ }
+
+ virtual void execute(RequestPtr self, RequestTakerPtr taker, RequestContextPtr context) const;
+};
+
+} // namespace Cynara
+
+#endif /* SRC_COMMON_REQUEST_REMOVEBUCKETREQUEST_H_ */
throw NotImplementedException();
}
+void RequestTaker::execute(RequestContextPtr context UNUSED,
+ InsertOrUpdateBucketRequestPtr request UNUSED) {
+ throw NotImplementedException();
+}
+
+void RequestTaker::execute(RequestContextPtr context UNUSED,
+ RemoveBucketRequestPtr request UNUSED) {
+ throw NotImplementedException();
+}
+
+void RequestTaker::execute(RequestContextPtr context UNUSED, SetPoliciesRequestPtr request UNUSED) {
+ throw NotImplementedException();
+}
+
void RequestTaker::execute(RequestContextPtr context UNUSED, SignalRequestPtr request UNUSED) {
throw NotImplementedException();
}
virtual ~RequestTaker() = default;
virtual void execute(RequestContextPtr context, CheckRequestPtr request);
+ virtual void execute(RequestContextPtr context, InsertOrUpdateBucketRequestPtr request);
+ virtual void execute(RequestContextPtr context, RemoveBucketRequestPtr request);
+ virtual void execute(RequestContextPtr context, SetPoliciesRequestPtr request);
virtual void execute(RequestContextPtr context, SignalRequestPtr request);
};
--- /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 SetPoliciesRequest.cpp
+ * @author Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
+ * @version 1.0
+ * @brief This file implements request class for modifying policies
+ */
+
+#include <memory>
+
+#include "SetPoliciesRequest.h"
+
+namespace Cynara {
+
+void SetPoliciesRequest::execute(RequestPtr self, RequestTakerPtr taker,
+ RequestContextPtr context) const {
+ taker->execute(context, std::dynamic_pointer_cast<SetPoliciesRequest>(self));
+}
+
+} // 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 SetPoliciesRequest.h
+ * @author Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
+ * @version 1.0
+ * @brief This file defines request class for modifying policies
+ */
+
+#ifndef SRC_COMMON_REQUEST_SETPOLICIESREQUEST_H_
+#define SRC_COMMON_REQUEST_SETPOLICIESREQUEST_H_
+
+#include <map>
+#include <vector>
+
+#include <types/Policy.h>
+#include <types/PolicyBucketId.h>
+#include <types/PolicyKey.h>
+
+#include <request/pointers.h>
+#include <request/Request.h>
+#include <request/RequestTaker.h>
+
+namespace Cynara {
+
+class SetPoliciesRequest : public Request {
+private:
+ std::map<PolicyBucketId, std::vector<Policy>> m_insertOrUpdatePolicies;
+ std::map<PolicyBucketId, std::vector<PolicyKey>> m_removePolicies;
+
+public:
+ SetPoliciesRequest(const std::map<PolicyBucketId, std::vector<Policy>> &insertOrUpdatePolicies,
+ const std::map<PolicyBucketId, std::vector<PolicyKey>> &removePolicies,
+ ProtocolFrameSequenceNumber sequenceNumber) :
+ Request(sequenceNumber), m_insertOrUpdatePolicies(insertOrUpdatePolicies),
+ m_removePolicies(removePolicies) {
+ }
+
+ virtual ~SetPoliciesRequest() = default;
+
+ const std::map<PolicyBucketId, std::vector<Policy>> &policiesToBeInsertedOrUpdated(void) const {
+ return m_insertOrUpdatePolicies;
+ }
+
+ const std::map<PolicyBucketId, std::vector<PolicyKey>> &policiesToBeRemoved(void) const {
+ return m_removePolicies;
+ }
+
+ virtual void execute(RequestPtr self, RequestTakerPtr taker, RequestContextPtr context) const;
+};
+
+} // namespace Cynara
+
+#endif /* SRC_COMMON_REQUEST_SETPOLICIESREQUEST_H_ */
class CheckRequest;
typedef std::shared_ptr<CheckRequest> CheckRequestPtr;
+class InsertOrUpdateBucketRequest;
+typedef std::shared_ptr<InsertOrUpdateBucketRequest> InsertOrUpdateBucketRequestPtr;
+
+class RemoveBucketRequest;
+typedef std::shared_ptr<RemoveBucketRequest> RemoveBucketRequestPtr;
+
class Request;
typedef std::shared_ptr<Request> RequestPtr;
class RequestTaker;
typedef std::shared_ptr<RequestTaker> RequestTakerPtr;
+class SetPoliciesRequest;
+typedef std::shared_ptr<SetPoliciesRequest> SetPoliciesRequestPtr;
+
class SignalRequest;
typedef std::shared_ptr<SignalRequest> SignalRequestPtr;