From: Zofia Abramowska Date: Mon, 22 Dec 2014 12:19:15 +0000 (+0100) Subject: Add classes for plugin description listing request and response X-Git-Tag: accepted/tizen/common/20150119.084431~44 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c7f9108b6fd36daaccbe0218b0ea708c955b0713;p=platform%2Fcore%2Fsecurity%2Fcynara.git Add classes for plugin description listing request and response DescritpionListRequest used for asking cynara for list of internal and external plugin description. DescriptionListResponse used for sending this list back to client. Change-Id: I047747efcf69ecf7f15747e890ffe1b2b98132f1 --- diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index fe2f727..feb7e80 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -44,6 +44,7 @@ SET(COMMON_SOURCES ${COMMON_PATH}/request/AgentRegisterRequest.cpp ${COMMON_PATH}/request/CancelRequest.cpp ${COMMON_PATH}/request/CheckRequest.cpp + ${COMMON_PATH}/request/DescriptionListRequest.cpp ${COMMON_PATH}/request/EraseRequest.cpp ${COMMON_PATH}/request/InsertOrUpdateBucketRequest.cpp ${COMMON_PATH}/request/ListRequest.cpp @@ -57,6 +58,7 @@ SET(COMMON_SOURCES ${COMMON_PATH}/response/CancelResponse.cpp ${COMMON_PATH}/response/CheckResponse.cpp ${COMMON_PATH}/response/CodeResponse.cpp + ${COMMON_PATH}/response/DescriptionListResponse.cpp ${COMMON_PATH}/response/ListResponse.cpp ${COMMON_PATH}/response/ResponseTaker.cpp ${COMMON_PATH}/sockets/Socket.cpp diff --git a/src/common/request/DescriptionListRequest.cpp b/src/common/request/DescriptionListRequest.cpp new file mode 100644 index 0000000..1cea6f5 --- /dev/null +++ b/src/common/request/DescriptionListRequest.cpp @@ -0,0 +1,36 @@ +/* + * 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/request/DescriptionListRequest.cpp + * @author Zofia Abramowska + * @version 1.0 + * @brief This file implements plugin description list request class + */ + +#include + +#include + +#include "DescriptionListRequest.h" + +namespace Cynara { + +void DescriptionListRequest::execute(RequestPtr self, RequestTakerPtr taker, + RequestContextPtr context) const { + taker->execute(context, std::dynamic_pointer_cast(self)); +} + +} // namespace Cynara diff --git a/src/common/request/DescriptionListRequest.h b/src/common/request/DescriptionListRequest.h new file mode 100644 index 0000000..53e14ef --- /dev/null +++ b/src/common/request/DescriptionListRequest.h @@ -0,0 +1,44 @@ +/* + * 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/request/DescriptionListRequest.h + * @author Zofia Abramowska + * @version 1.0 + * @brief This file defines plugin description list request class + */ + +#ifndef SRC_COMMON_REQUEST_DESCRIPTIONLISTREQUEST_H_ +#define SRC_COMMON_REQUEST_DESCRIPTIONLISTREQUEST_H_ + +#include +#include + +namespace Cynara { + +class DescriptionListRequest : public Request { +public: + DescriptionListRequest(ProtocolFrameSequenceNumber sequenceNumber) : + Request(sequenceNumber) { + } + + virtual ~DescriptionListRequest() {}; + + virtual void execute(RequestPtr self, RequestTakerPtr taker, RequestContextPtr context) const; +}; + +} // namespace Cynara + +#endif /* SRC_COMMON_REQUEST_DESCRIPTIONLISTREQUEST_H_ */ diff --git a/src/common/request/RequestTaker.cpp b/src/common/request/RequestTaker.cpp index 1233f17..ea25f16 100644 --- a/src/common/request/RequestTaker.cpp +++ b/src/common/request/RequestTaker.cpp @@ -55,6 +55,11 @@ void RequestTaker::execute(RequestContextPtr context UNUSED, EraseRequestPtr req } void RequestTaker::execute(RequestContextPtr context UNUSED, + DescriptionListRequestPtr request UNUSED) { + throw NotImplementedException(); +} + +void RequestTaker::execute(RequestContextPtr context UNUSED, InsertOrUpdateBucketRequestPtr request UNUSED) { throw NotImplementedException(); } diff --git a/src/common/request/RequestTaker.h b/src/common/request/RequestTaker.h index 9d929d9..e6e3f08 100644 --- a/src/common/request/RequestTaker.h +++ b/src/common/request/RequestTaker.h @@ -37,6 +37,7 @@ public: virtual void execute(RequestContextPtr context, AgentRegisterRequestPtr request); virtual void execute(RequestContextPtr context, CancelRequestPtr request); virtual void execute(RequestContextPtr context, CheckRequestPtr request); + virtual void execute(RequestContextPtr context, DescriptionListRequestPtr request); virtual void execute(RequestContextPtr context, EraseRequestPtr request); virtual void execute(RequestContextPtr context, InsertOrUpdateBucketRequestPtr request); virtual void execute(RequestContextPtr context, ListRequestPtr request); diff --git a/src/common/request/pointers.h b/src/common/request/pointers.h index 865a4c4..be1fdeb 100644 --- a/src/common/request/pointers.h +++ b/src/common/request/pointers.h @@ -42,6 +42,9 @@ typedef std::shared_ptr CancelRequestPtr; class CheckRequest; typedef std::shared_ptr CheckRequestPtr; +class DescriptionListRequest; +typedef std::shared_ptr DescriptionListRequestPtr; + class EraseRequest; typedef std::shared_ptr EraseRequestPtr; diff --git a/src/common/response/DescriptionListResponse.cpp b/src/common/response/DescriptionListResponse.cpp new file mode 100644 index 0000000..481913a --- /dev/null +++ b/src/common/response/DescriptionListResponse.cpp @@ -0,0 +1,36 @@ +/* + * 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/response/DescriptionListResponse.cpp + * @author Zofia Abramowska + * @version 1.0 + * @brief This file implements plugins description list response class + */ + +#include + +#include + +#include "DescriptionListResponse.h" + +namespace Cynara { + +void DescriptionListResponse::execute(ResponsePtr self, ResponseTakerPtr taker, + RequestContextPtr context) const { + taker->execute(context, std::dynamic_pointer_cast(self)); +} + +} // namespace Cynara diff --git a/src/common/response/DescriptionListResponse.h b/src/common/response/DescriptionListResponse.h new file mode 100644 index 0000000..a963775 --- /dev/null +++ b/src/common/response/DescriptionListResponse.h @@ -0,0 +1,56 @@ +/* + * 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/response/DescriptionListResponse.h + * @author Zofia Abramowska + * @version 1.0 + * @brief This file defines response class for plugins description list response + */ + +#ifndef SRC_COMMON_RESPONSE_DESCRIPTIONLISTRESPONSE_H_ +#define SRC_COMMON_RESPONSE_DESCRIPTIONLISTRESPONSE_H_ + +#include + +#include +#include +#include +#include + +namespace Cynara { + +class DescriptionListResponse : public Response { +public: + DescriptionListResponse(const std::vector &descriptions, + ProtocolFrameSequenceNumber sequenceNumber) : + Response(sequenceNumber), m_descriptions(descriptions) { + } + + virtual ~DescriptionListResponse() {}; + + virtual void execute(ResponsePtr self, ResponseTakerPtr taker, RequestContextPtr context) const; + + const std::vector &descriptions(void) const { + return m_descriptions; + } + +private: + std::vector m_descriptions; +}; + +} // namespace Cynara + +#endif /* SRC_COMMON_RESPONSE_DESCRIPTIONLISTRESPONSE_H_ */ diff --git a/src/common/response/ResponseTaker.cpp b/src/common/response/ResponseTaker.cpp index af47659..492af6e 100644 --- a/src/common/response/ResponseTaker.cpp +++ b/src/common/response/ResponseTaker.cpp @@ -55,6 +55,11 @@ void ResponseTaker::execute(RequestContextPtr context UNUSED, CodeResponsePtr re throw NotImplementedException(); } +void ResponseTaker::execute(RequestContextPtr context UNUSED, + DescriptionListResponsePtr response UNUSED) { + throw NotImplementedException(); +} + void ResponseTaker::execute(RequestContextPtr context UNUSED, ListResponsePtr response UNUSED) { throw NotImplementedException(); } diff --git a/src/common/response/ResponseTaker.h b/src/common/response/ResponseTaker.h index 20296af..c642b4f 100644 --- a/src/common/response/ResponseTaker.h +++ b/src/common/response/ResponseTaker.h @@ -39,6 +39,7 @@ public: virtual void execute(RequestContextPtr context, CancelResponsePtr response); virtual void execute(RequestContextPtr context, CheckResponsePtr response); virtual void execute(RequestContextPtr context, CodeResponsePtr response); + virtual void execute(RequestContextPtr context, DescriptionListResponsePtr response); virtual void execute(RequestContextPtr context, ListResponsePtr response); }; diff --git a/src/common/response/pointers.h b/src/common/response/pointers.h index 5e26929..5e90289 100644 --- a/src/common/response/pointers.h +++ b/src/common/response/pointers.h @@ -45,6 +45,9 @@ typedef std::shared_ptr CheckResponsePtr; class CodeResponse; typedef std::shared_ptr CodeResponsePtr; +class DescriptionListResponse; +typedef std::shared_ptr DescriptionListResponsePtr; + class ListResponse; typedef std::shared_ptr ListResponsePtr;