Remove cynara-bootstrap implementation.
Add ApiInterface class.
Add Logic class - main class of cynara client.
Logic class implements ApiInterface.
Fix CMakeFile by removing dependencies and updating source files.
Change-Id: Ic6a9ebe9ad9c1de85620b943523e751382083bc6
#
SET(LIB_CYNARA_VERSION_MAJOR 0)
-SET(LIB_CYNARA_VERSION ${LIB_CYNARA_VERSION_MAJOR}.0.1)
+SET(LIB_CYNARA_VERSION ${LIB_CYNARA_VERSION_MAJOR}.0.2)
SET(CYNARA_LIB_CYNARA_PATH ${CYNARA_PATH}/client)
SET(LIB_CYNARA_SOURCES
- ${CYNARA_LIB_CYNARA_PATH}/client-api.cpp
- ${CYNARA_LIB_CYNARA_PATH}/bootstrap/cynara-client-bootstrap.cpp
- )
-
-PKG_CHECK_MODULES(CYNARA_CLIENT_DEP
- REQUIRED
- security-server
+ ${CYNARA_LIB_CYNARA_PATH}/api/client-api.cpp
+ ${CYNARA_LIB_CYNARA_PATH}/logic/Logic.cpp
)
INCLUDE_DIRECTORIES(
${CYNARA_LIB_CYNARA_PATH}
- ${CYNARA_CLIENT_DEP_INCLUDE_DIRS}
)
ADD_LIBRARY(${TARGET_LIB_CYNARA} SHARED ${LIB_CYNARA_SOURCES})
TARGET_LINK_LIBRARIES(${TARGET_LIB_CYNARA}
${CYNARA_DEP_LIBRARIES}
- ${CYNARA_CLIENT_DEP_LIBRARIES}
${TARGET_CYNARA_COMMON}
)
* limitations under the License
*/
/*
- * @file cynara-client-interface.h
+ * @file ApiInterface.h
* @author Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
* @version 1.0
- * @brief This file contains interface for libcynara-client API implementation.
+ * @brief This file contains libcynara-client API interface definition.
*/
-
-#ifndef CYNARA_CLIENT_INTERFACE_H
-#define CYNARA_CLIENT_INTERFACE_H
+#ifndef SRC_CLIENT_API_APIINTERFACE_H_
+#define SRC_CLIENT_API_APIINTERFACE_H_
#include <string>
#include <cynara-client.h>
-class CynaraClientInterface {
+namespace Cynara {
+
+class ApiInterface {
public:
- virtual ~CynaraClientInterface() {
- }
+ ApiInterface() = default;
+ virtual ~ApiInterface() = default;
+
virtual cynara_api_result check(const std::string &client, const std::string &session,
const std::string &user, const std::string &privilege) = 0;
};
-#endif /* CYNARA_CLIENT_INTERFACE_H */
+} // namespace Cynara
+
+#endif /* SRC_CLIENT_API_APIINTERFACE_H_ */
#include <new>
#include <common.h>
#include <cynara-client.h>
-#include <cynara-client-interface.h>
-#include <bootstrap/cynara-client-bootstrap.h>
+#include <api/ApiInterface.h>
+#include <logic/Logic.h>
struct cynara {
- CynaraClientInterface *impl;
+ Cynara::ApiInterface *impl;
- cynara(CynaraClientInterface *_impl) : impl(_impl) {
+ cynara(Cynara::ApiInterface *_impl) : impl(_impl) {
}
~cynara() {
delete impl;
return cynara_api_result::CYNARA_API_INVALID_PARAM;
try {
- *pp_cynara = new cynara(new CynaraClientBootstrap);
- } catch (std::bad_alloc &ex) {
+ *pp_cynara = new cynara(new Cynara::Logic);
+ } catch (const std::bad_alloc &ex) {
return cynara_api_result::CYNARA_API_OUT_OF_MEMORY;
}
* limitations under the License
*/
/*
- * @file cynara-client-bootstrap.cpp
+ * @file Logic.cpp
* @author Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
* @version 1.0
- * @brief This file contains bootstrap version of libcynara-client API implementation.
+ * @brief This file contains implementation of Logic class - main libcynara-client class
*/
-#include <security-server.h>
-#include "cynara-client-bootstrap.h"
+#include <common.h>
-CynaraClientBootstrap :: CynaraClientBootstrap() {
-}
+#include "Logic.h"
-CynaraClientBootstrap :: ~CynaraClientBootstrap() {
-}
+namespace Cynara {
-cynara_api_result CynaraClientBootstrap :: check(const std::string &client,
- const std::string &session UNUSED, const std::string &user UNUSED, const std::string &privilege)
+cynara_api_result Logic::check(const std::string &client UNUSED, const std::string &session UNUSED,
+ const std::string &user UNUSED, const std::string &privilege UNUSED)
{
- int is_enabled = 0;
-
- int ret = security_server_app_has_privilege(client.c_str(), APP_TYPE_WGT, privilege.c_str(),
- &is_enabled);
-
- if(ret == PC_OPERATION_SUCCESS && is_enabled)
- return cynara_api_result::CYNARA_API_SUCCESS;
+ //todo - this is a stub
return cynara_api_result::CYNARA_API_ACCESS_DENIED;
}
+
+} // namespace Cynara
* limitations under the License
*/
/*
- * @file cynara-client-bootstrap.h
+ * @file Logic.h
* @author Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
* @version 1.0
- * @brief This file contains bootstrap version of libcynara-client API implementation.
+ * @brief This file contains definition of Logic class - main libcynara-client class
*/
-#ifndef CYNARA_CLIENT_BOOTSTRAP_H
-#define CYNARA_CLIENT_BOOTSTRAP_H
+#ifndef SRC_CLIENT_LOGIC_LOGIC_H_
+#define SRC_CLIENT_LOGIC_LOGIC_H_
#include <string>
-#include <common.h>
-#include <cynara-client.h>
-#include <cynara-client-interface.h>
+#include <api/ApiInterface.h>
-class CynaraClientBootstrap : public CynaraClientInterface {
+namespace Cynara {
+
+class Logic : public ApiInterface {
public:
- CynaraClientBootstrap();
- virtual ~CynaraClientBootstrap();
+ Logic() = default;
+ virtual ~Logic() = default;
+
virtual cynara_api_result check(const std::string &client, const std::string &session,
const std::string &user, const std::string &privilege);
};
-#endif /* CYNARA_CLIENT_BOOTSTRAP_H */
+} // namespace Cynara
+
+#endif /* SRC_CLIENT_LOGIC_LOGIC_H_ */