Change device policy manager interface submit/tizen/20170817.045900
authorJaemin Ryu <jm77.ryu@samsung.com>
Wed, 16 Aug 2017 04:19:20 +0000 (13:19 +0900)
committerJaemin Ryu <jm77.ryu@samsung.com>
Wed, 16 Aug 2017 07:44:33 +0000 (16:44 +0900)
Signed-off-by: Jaemin Ryu <jm77.ryu@samsung.com>
78 files changed:
CMakeLists.txt
administration.cpp [deleted file]
application.cpp [deleted file]
bluetooth.cpp [deleted file]
dpm.pc.in [deleted file]
dpm/administration.cpp [deleted file]
dpm/administration.h [deleted file]
dpm/application.cpp [deleted file]
dpm/application.h [deleted file]
dpm/array.h [deleted file]
dpm/bluetooth.cpp [deleted file]
dpm/bluetooth.h [deleted file]
dpm/client-handle.cpp [deleted file]
dpm/debug.h [deleted file]
dpm/device-policy-manager.h [deleted file]
dpm/password.cpp [deleted file]
dpm/password.h [deleted file]
dpm/password_internal.h [deleted file]
dpm/restriction.cpp [deleted file]
dpm/restriction.h [deleted file]
dpm/security.cpp [deleted file]
dpm/security.h [deleted file]
dpm/storage.cpp [deleted file]
dpm/storage.h [deleted file]
dpm/wifi.cpp [deleted file]
dpm/wifi.h [deleted file]
dpm/zone.cpp [deleted file]
dpm/zone.h [deleted file]
krate.cpp [deleted file]
libs/CMakeLists.txt [new file with mode: 0755]
libs/administration.cpp [new file with mode: 0644]
libs/application.cpp [new file with mode: 0644]
libs/array.h [new file with mode: 0644]
libs/bluetooth.cpp [new file with mode: 0644]
libs/client-handle.cpp [new file with mode: 0644]
libs/debug.h [new file with mode: 0644]
libs/dpm.pc.in [new file with mode: 0644]
libs/dpm/administration.h [new file with mode: 0644]
libs/dpm/application.h [new file with mode: 0644]
libs/dpm/bluetooth.h [new file with mode: 0644]
libs/dpm/device-policy-manager.h [new file with mode: 0644]
libs/dpm/password.h [new file with mode: 0644]
libs/dpm/password_internal.h [new file with mode: 0644]
libs/dpm/restriction.h [new file with mode: 0644]
libs/dpm/security.h [new file with mode: 0644]
libs/dpm/storage.h [new file with mode: 0644]
libs/dpm/wifi.h [new file with mode: 0644]
libs/dpm/zone.h [new file with mode: 0644]
libs/password.cpp [new file with mode: 0644]
libs/policy-client.cpp [new file with mode: 0644]
libs/policy-client.h [new file with mode: 0644]
libs/restriction.cpp [new file with mode: 0644]
libs/security.cpp [new file with mode: 0644]
libs/status.h [new file with mode: 0644]
libs/storage.cpp [new file with mode: 0644]
libs/wifi.cpp [new file with mode: 0644]
libs/zone.cpp [new file with mode: 0755]
location.cpp [deleted file]
password.cpp [deleted file]
policy-client.cpp [deleted file]
policy-client.h [deleted file]
policy-context.hxx [deleted file]
policy/administration.hxx [deleted file]
policy/application.hxx [deleted file]
policy/bluetooth.hxx [deleted file]
policy/krate.hxx [deleted file]
policy/location.hxx [deleted file]
policy/password.hxx [deleted file]
policy/restriction.hxx [deleted file]
policy/security.hxx [deleted file]
policy/smack.hxx [deleted file]
policy/storage.hxx [deleted file]
policy/wifi.hxx [deleted file]
restriction.cpp [deleted file]
security.cpp [deleted file]
status.h [deleted file]
storage.cpp [deleted file]
wifi.cpp [deleted file]

index 630b15e0063a977df88cd349008fa781befbd0ef..eeb4c2562744904f7a9189a2a493af0a6e14be41 100755 (executable)
@@ -15,9 +15,7 @@
 #
 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
 
-PROJECT(dpm)
-SET(LIB_VERSION "${VERSION}")
-SET(LIB_SOVERSION "0")
+PROJECT(device-policy-client)
 
 INCLUDE(FindPkgConfig)
 
@@ -25,8 +23,7 @@ IF(NOT CMAKE_BUILD_TYPE)
        SET(CMAKE_BUILD_TYPE "DEBUG")
 ENDIF(NOT CMAKE_BUILD_TYPE)
 
-SET(DPM_POLICY     ${PROJECT_SOURCE_DIR}/policy)
-SET(DPM_LIBS       ${PROJECT_SOURCE_DIR}/)
+SET(DPM_LIBS       ${PROJECT_SOURCE_DIR}/libs)
 
 IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
        SET(CXX_STD "c++0x")
@@ -58,64 +55,5 @@ ENDIF(NOT DEFINED TEST_DATA_INSTALL_DIR)
 
 ADD_DEFINITIONS(-DUG_WAYLAND)
 
-SET(PC_FILE "${PROJECT_NAME}.pc")
+ADD_SUBDIRECTORY(${DPM_LIBS})
 
-SET(FOUNDATION          policy-client.cpp
-                                               dpm/client-handle.cpp
-)
-
-SET(POLICY              administration.cpp
-                                               application.cpp
-                                               bluetooth.cpp
-                                               location.cpp
-                                               restriction.cpp
-                                               security.cpp
-                                               storage.cpp
-                                               wifi.cpp
-                                               password.cpp
-                                               krate.cpp
-                                               dpm/administration.cpp
-                                               dpm/application.cpp
-                                               dpm/bluetooth.cpp
-                                               dpm/restriction.cpp
-                                               dpm/security.cpp
-                                               dpm/wifi.cpp
-                                               dpm/password.cpp
-                                               dpm/zone.cpp
-)
-
-SET(CAPI                dpm/device-policy-manager.h
-                                               dpm/administration.h
-                                               dpm/application.h
-                                               dpm/bluetooth.h
-                                               dpm/restriction.h
-                                               dpm/security.h
-                                               dpm/wifi.h
-                                               dpm/password.h
-                                               dpm/password_internal.h
-                                               dpm/zone.h
-)
-
-SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,noexecstack")
-
-ADD_LIBRARY(${PROJECT_NAME} SHARED ${FOUNDATION} ${POLICY})
-
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-fvisibility=hidden")
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${LIB_SOVERSION})
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION   ${LIB_VERSION})
-
-PKG_CHECK_MODULES(LIBS_DEPS    REQUIRED
-                                                       klay
-                                                       glib-2.0
-                                                       capi-base-common
-                                                       capi-system-info
-)
-
-INCLUDE_DIRECTORIES(SYSTEM ${LIBS_DEPS_INCLUDE_DIRS} ${DPM_POLICY} ${DPM_LIBS})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIBS_DEPS_LIBRARIES} pthread)
-
-CONFIGURE_FILE(${PC_FILE}.in ${CMAKE_BINARY_DIR}/${PC_FILE} @ONLY)
-
-INSTALL(FILES ${CMAKE_BINARY_DIR}/${PC_FILE} DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
-INSTALL(FILES ${CAPI} DESTINATION ${INCLUDE_INSTALL_DIR}/dpm)
diff --git a/administration.cpp b/administration.cpp
deleted file mode 100644 (file)
index 507076f..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#include "status.h"
-#include "administration.hxx"
-
-namespace DevicePolicyManager {
-
-struct AdministrationPolicy::Private {
-       Private(PolicyControlContext& ctx) : context(ctx) {}
-       PolicyControlContext& context;
-};
-
-AdministrationPolicy::AdministrationPolicy(AdministrationPolicy&& rhs) = default;
-AdministrationPolicy& AdministrationPolicy::operator=(AdministrationPolicy&& rhs) = default;
-
-AdministrationPolicy::AdministrationPolicy(const AdministrationPolicy& rhs) :
-       pimpl(nullptr)
-{
-       if (rhs.pimpl) {
-               pimpl.reset(new Private(*rhs.pimpl));
-       }
-}
-
-AdministrationPolicy& AdministrationPolicy::operator=(const AdministrationPolicy& rhs)
-{
-       if (!rhs.pimpl) {
-               pimpl.reset();
-       } else {
-               pimpl.reset(new Private(*rhs.pimpl));
-       }
-
-       return *this;
-}
-
-AdministrationPolicy::AdministrationPolicy(PolicyControlContext& ctx) :
-       pimpl(new Private(ctx))
-{
-}
-
-AdministrationPolicy::~AdministrationPolicy()
-{
-}
-
-int AdministrationPolicy::registerPolicyClient(const std::string& name, uid_t uid)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("AdministrationPolicy::registerPolicyClient", name, uid);
-
-       return status.get();
-}
-
-int AdministrationPolicy::deregisterPolicyClient(const std::string& name, uid_t uid)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("AdministrationPolicy::deregisterPolicyClient", name, uid);
-
-       return status.get();
-}
-
-} // namespace DevicePolicyManager
diff --git a/application.cpp b/application.cpp
deleted file mode 100644 (file)
index 429e6bd..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#include "status.h"
-#include "application.hxx"
-
-namespace DevicePolicyManager {
-
-struct ApplicationPolicy::Private {
-       Private(PolicyControlContext& ctxt) : context(ctxt) {}
-       PolicyControlContext& context;
-};
-
-ApplicationPolicy::ApplicationPolicy(ApplicationPolicy&& rhs) = default;
-ApplicationPolicy& ApplicationPolicy::operator=(ApplicationPolicy&& rhs) = default;
-
-ApplicationPolicy::ApplicationPolicy(const ApplicationPolicy& rhs)
-{
-       if (rhs.pimpl) {
-               pimpl.reset(new Private(*rhs.pimpl));
-       }
-}
-
-ApplicationPolicy& ApplicationPolicy::operator=(const ApplicationPolicy& rhs)
-{
-       if (!rhs.pimpl) {
-               pimpl.reset();
-       } else {
-               pimpl.reset(new Private(*rhs.pimpl));
-       }
-
-       return *this;
-}
-
-ApplicationPolicy::ApplicationPolicy(PolicyControlContext& ctxt) :
-       pimpl(new Private(ctxt))
-{
-}
-
-ApplicationPolicy::~ApplicationPolicy()
-{
-}
-
-int ApplicationPolicy::installPackage(const std::string& pkgpath)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("ApplicationPolicy::installPackage", pkgpath);
-
-       return status.get();
-}
-
-int ApplicationPolicy::uninstallPackage(const std::string& pkgid)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("ApplicationPolicy::uninstallPackage", pkgid);
-
-       return status.get();
-}
-
-int ApplicationPolicy::setModeRestriction(int mode)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("ApplicationPolicy::setModeRestriction", mode);
-
-       return status.get();
-}
-
-int ApplicationPolicy::unsetModeRestriction(int mode)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("ApplicationPolicy::unsetModeRestriction", mode);
-
-       return status.get();
-}
-
-int ApplicationPolicy::getModeRestriction()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { 0 };
-
-       status = context.methodCall<int>("ApplicationPolicy::getModeRestriction");
-
-       return status.get();
-}
-
-int ApplicationPolicy::addPrivilegeToBlacklist(int type, const std::string& privilege)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("ApplicationPolicy::addPrivilegeToBlacklist", type, privilege);
-
-       return status.get();
-}
-
-int ApplicationPolicy::removePrivilegeFromBlacklist(int type, const std::string& privilege)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("ApplicationPolicy::removePrivilegeFromBlacklist", type, privilege);
-
-       return status.get();
-}
-
-int ApplicationPolicy::checkPrivilegeIsBlacklisted(int type, const std::string& privilege)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { 0 };
-
-       status = context.methodCall<int>("ApplicationPolicy::checkPrivilegeIsBlacklisted", type, privilege);
-
-       return status.get();
-}
-} // namespace DevicePolicyManager
diff --git a/bluetooth.cpp b/bluetooth.cpp
deleted file mode 100644 (file)
index ade8f32..0000000
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- *  Copyright (c) 2016 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
- */
-
-#include "status.h"
-#include "bluetooth.hxx"
-
-namespace DevicePolicyManager {
-
-struct BluetoothPolicy::Private {
-       Private(PolicyControlContext& ctx) : context(ctx) {}
-       PolicyControlContext& context;
-};
-
-BluetoothPolicy::BluetoothPolicy(BluetoothPolicy&& rhs) = default;
-BluetoothPolicy& BluetoothPolicy::operator=(BluetoothPolicy&& rhs) = default;
-
-BluetoothPolicy::BluetoothPolicy(const BluetoothPolicy& rhs)
-{
-       if (rhs.pimpl) {
-               pimpl.reset(new Private(*rhs.pimpl));
-       }
-}
-
-BluetoothPolicy& BluetoothPolicy::operator=(const BluetoothPolicy& rhs)
-{
-       if (!rhs.pimpl) {
-               pimpl.reset();
-       } else {
-               pimpl.reset(new Private(*rhs.pimpl));
-       }
-
-       return *this;
-}
-
-BluetoothPolicy::BluetoothPolicy(PolicyControlContext& ctxt) :
-       pimpl(new Private(ctxt))
-{
-}
-
-BluetoothPolicy::~BluetoothPolicy()
-{
-}
-
-// for restriction CPIs
-int BluetoothPolicy::setModeChangeState(bool enable)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("BluetoothPolicy::setModeChangeState", enable);
-
-       return status.get();
-}
-
-bool BluetoothPolicy::getModeChangeState()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<bool> status { true };
-
-       status = context.methodCall<bool>("BluetoothPolicy::getModeChangeState");
-
-       return status.get();
-}
-
-int BluetoothPolicy::setDesktopConnectivityState(bool enable)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<bool>("BluetoothPolicy::setDesktopConnectivityState", enable);
-
-       return status.get();
-}
-
-bool BluetoothPolicy::getDesktopConnectivityState()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<bool> status { true };
-
-       status = context.methodCall<bool>("BluetoothPolicy::getDesktopConnectivityState");
-
-       return status.get();
-}
-
-int BluetoothPolicy::setTetheringState(bool enable)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("BluetoothPolicy::setTetheringState", enable);
-
-       return status.get();
-}
-
-bool BluetoothPolicy::getTetheringState()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<bool> status { true };
-
-       status = context.methodCall<bool>("BluetoothPolicy::getTetheringState");
-
-       return status.get();
-}
-
-int BluetoothPolicy::setPairingState(bool enable)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("BluetoothPolicy::setPairingState", enable);
-
-       return status.get();
-}
-
-bool BluetoothPolicy::getPairingState()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<bool> status { true };
-
-       status = context.methodCall<bool>("BluetoothPolicy::getPairingState");
-
-       return status.get();
-}
-
-int BluetoothPolicy::addDeviceToBlacklist(const std::string& mac)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("BluetoothPolicy::addDeviceToBlacklist", mac);
-
-       return status.get();
-}
-
-int BluetoothPolicy::removeDeviceFromBlacklist(const std::string& mac)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("BluetoothPolicy::removeDeviceFromBlacklist", mac);
-
-       return status.get();
-}
-
-int BluetoothPolicy::setDeviceRestriction(bool enable)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("BluetoothPolicy::setDeviceRestriction", enable);
-
-       return status.get();
-}
-
-bool BluetoothPolicy::isDeviceRestricted()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<bool> status { false };
-
-       status = context.methodCall<bool>("BluetoothPolicy::isDeviceRestricted");
-
-       return status.get();
-}
-
-int BluetoothPolicy::addUuidToBlacklist(const std::string& uuid)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("BluetoothPolicy::addUuidToBlacklist", uuid);
-
-       return status.get();
-}
-
-int BluetoothPolicy::removeUuidFromBlacklist(const std::string& uuid)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("BluetoothPolicy::removeUuidFromBlacklist", uuid);
-
-       return status.get();
-}
-
-int BluetoothPolicy::setUuidRestriction(bool enable)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("BluetoothPolicy::setUuidRestriction", enable);
-
-       return status.get();
-}
-
-bool BluetoothPolicy::isUuidRestricted()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<bool> status { false };
-
-       status = context.methodCall<bool>("BluetoothPolicy::isUuidRestricted");
-
-       return status.get();
-}
-
-} // namespace DevicePolicyManager
diff --git a/dpm.pc.in b/dpm.pc.in
deleted file mode 100644 (file)
index 6ba2138..0000000
--- a/dpm.pc.in
+++ /dev/null
@@ -1,12 +0,0 @@
-# Package Information for pkg-config
-
-prefix=@CMAKE_INSTALL_PREFIX@
-exec_prefix=@CMAKE_INSTALL_PREFIX@
-libdir=@LIB_INSTALL_DIR@
-includedir=@INCLUDE_INSTALL_DIR@
-
-Name: dpm
-Description: Tizen Device Policy Client library
-Version: @VERSION@
-Libs: -L${libdir} -ldpm
-Cflags: -I${includedir}/dpm
diff --git a/dpm/administration.cpp b/dpm/administration.cpp
deleted file mode 100644 (file)
index 6a19eaf..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#include <cstring>
-#include <cassert>
-
-#include "administration.h"
-#include "administration.hxx"
-
-#include "debug.h"
-#include "policy-client.h"
-
-using namespace DevicePolicyManager;
-
-EXPORT_API int dpm_admin_register_client(device_policy_manager_h handle, const char* name, uid_t uid)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(name, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(uid, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       AdministrationPolicy admin = client.createPolicyInterface<AdministrationPolicy>();
-
-       try {
-               return admin.registerPolicyClient(name, uid);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_admin_deregister_client(device_policy_manager_h handle, const char* name, uid_t uid)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(name, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(uid, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       AdministrationPolicy admin = client.createPolicyInterface<AdministrationPolicy>();
-
-       try {
-               return admin.deregisterPolicyClient(name, uid);
-       } catch (...) {
-               return -1;
-       }
-}
diff --git a/dpm/administration.h b/dpm/administration.h
deleted file mode 100644 (file)
index 2bcaddd..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#ifndef __CAPI_ADMINISTRATION_POLICY_H__
-#define __CAPI_ADMINISTRATION_POLICY_H__
-
-#include <sys/types.h>
-
-#include <dpm/device-policy-manager.h>
-
-/**
- * @file administration.h
- * @brief This file provides APIs to register/deregister the device admin client
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup  CAPI_DPM_ADMINISTRATION_POLICY_MODULE
- * @{
- */
-
-/**
- * @brief       Registers device policy admin client.
- * @details     This API is used to register the device policy admin client to
- *              the device policy manager. The device policy admin client must be
- *              registered to use the device administration APIs.
- * @since_tizen 3.0
- * @param[in]   handle The device policy manager handle
- * @param[in]   name The name of the device policy admin package
- * @param[in]   uid The uid of the device policy admin package
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMEOUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid package name
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         handle must be created by dpm_context_create()
- * @see         dpm_context_acquire_admin_policy()
- * @see         dpm_context_release_admin_policy()
- * @see         dpm_admin_deregister_client()
- */
-int dpm_admin_register_client(device_policy_manager_h handle, const char* name, uid_t uid);
-
-/**
- * @brief       Deregisters the device policy admin client.
- * @details     This API is used to deregister the Device Policy Client from
- *              the device policy manager.
- * @since_tizen 3.0
- * @param[in]   handle The device policy manager handle
- * @param[in]   name The name of the device policy admin package
- * @param[in]   uid The uid of the device policy admin package
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMEOUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid package name
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         handle must be created by dpm_context_create()
- * @see         dpm_context_acquire_admin_policy()
- * @see         dpm_context_release_admin_policy()
- * @see         dpm_admin_register_client()
- */
-int dpm_admin_deregister_client(device_policy_manager_h handle, const char* name, uid_t uid);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__CAPI_ADMINISTRATION_POLICY_H__
diff --git a/dpm/application.cpp b/dpm/application.cpp
deleted file mode 100644 (file)
index 0983819..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#include "application.h"
-#include "application.hxx"
-
-#include "debug.h"
-#include "policy-client.h"
-
-using namespace DevicePolicyManager;
-
-EXPORT_API int dpm_application_set_mode_restriction(device_policy_manager_h handle, int mode)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(mode, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext& client = GetDevicePolicyContext(handle);
-       ApplicationPolicy application = client.createPolicyInterface<ApplicationPolicy>();
-
-       try {
-               return application.setModeRestriction(mode);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_application_unset_mode_restriction(device_policy_manager_h handle, int mode)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(mode, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext& client = GetDevicePolicyContext(handle);
-       ApplicationPolicy application = client.createPolicyInterface<ApplicationPolicy>();
-
-       try {
-               return application.unsetModeRestriction(mode);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_application_get_mode_restriction(device_policy_manager_h handle, int *mode)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(mode, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext& client = GetDevicePolicyContext(handle);
-       ApplicationPolicy application = client.createPolicyInterface<ApplicationPolicy>();
-
-       try {
-               int ret = application.getModeRestriction();
-               if (ret < 0) {
-                       return -1;
-               }
-               *mode = ret;
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_application_add_privilege_to_blacklist(device_policy_manager_h handle, int type, const char* privilege)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(privilege, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext& client = GetDevicePolicyContext(handle);
-       ApplicationPolicy application = client.createPolicyInterface<ApplicationPolicy>();
-
-       try {
-               return application.addPrivilegeToBlacklist(type, privilege);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_application_remove_privilege_from_blacklist(device_policy_manager_h handle, int type, const char* privilege)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(privilege, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext& client = GetDevicePolicyContext(handle);
-       ApplicationPolicy application = client.createPolicyInterface<ApplicationPolicy>();
-
-       try {
-               return application.removePrivilegeFromBlacklist(type, privilege);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_application_check_privilege_is_blacklisted(device_policy_manager_h handle, int type, const char* privilege, int *is_blacklisted)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(privilege, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(is_blacklisted, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext& client = GetDevicePolicyContext(handle);
-       ApplicationPolicy application = client.createPolicyInterface<ApplicationPolicy>();
-
-       try {
-               int ret = application.checkPrivilegeIsBlacklisted(type, privilege);
-               if (ret < 0) {
-                       return -1;
-               }
-
-               *is_blacklisted = ret;
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_application_install_package(device_policy_manager_h handle, const char* pkgpath)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(pkgpath, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext& client = GetDevicePolicyContext(handle);
-       ApplicationPolicy application = client.createPolicyInterface<ApplicationPolicy>();
-
-       try {
-               return application.installPackage(pkgpath);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_application_uninstall_package(device_policy_manager_h handle, const char* pkgid)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(pkgid, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext& client = GetDevicePolicyContext(handle);
-       ApplicationPolicy application = client.createPolicyInterface<ApplicationPolicy>();
-
-       try {
-               return application.uninstallPackage(pkgid);
-       } catch (...) {
-               return -1;
-       }
-}
diff --git a/dpm/application.h b/dpm/application.h
deleted file mode 100644 (file)
index b160ed5..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#ifndef __CAPI_APPLICATION_POLICY_H__
-#define __CAPI_APPLICATION_POLICY_H__
-
-#include <dpm/device-policy-manager.h>
-
-/**
- * @file application.h
- * @brief This file provides APIs to control application functionality
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup  CAPI_DPM_APPLICATION_POLICY_MODULE
- * @{
- */
-
-/**
- * @brief       Enumeration for installation mode
- * @since_tizen 3.0
- */
-typedef enum {
-       DPM_PACKAGE_RESTRICTION_MODE_ALL        = 0x0F, /**< All package restriction mode */
-       DPM_PACKAGE_RESTRICTION_MODE_INSTALL    = 0x01, /**< Package install restriction */
-       DPM_PACKAGE_RESTRICTION_MODE_UNINSTALL  = 0x02, /**< Package uninstall restriction */
-       DPM_PACKAGE_RESTRICTION_MODE_REINSTALL  = 0x04, /**< Package reinstall restriction */
-       DPM_PACKAGE_RESTRICTION_MODE_MOVE       = 0x08  /**< Package move restriction */
-} dpm_package_restriction_mode_e;
-
-/**
- * @brief       Restricts installation / uninstallation for all packages.
- * @details     Administrator can use this API to restrict package installation, uninstallation,
- *              reinstallation or move.
- * @since_tizen 3.0
- * @param[in]   handle The device policy manager handle
- * @param[in]   mode The installation mode to be set, one of DPM_PACKAGE_INSTALLATION_MODE_ALLOW or
- *              DPM_PACKAGE_INSTALLATION_MODE_DISALLOW
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE No error
- * @retval      #DPM_ERROR_TIMEOUT Time out
- * @retval      #DPM_ERROR_ACCESS_DENIED The application does not have
- *              the privilege to call this API
- * @pre         handle must be created by dpm_context_acquire_application_policy()
- * @see         dpm_application_unset_mode_restriction()
- * @see         dpm_application_get_mode_restriction()
- */
-int dpm_application_set_mode_restriction(device_policy_manager_h handle, int mode);
-
-/**
- * @brief       Allows installation / uninstallation for all packages.
- * @details     If the mode is set to DPM_PACKAGE_INSTALLATION_MODE_DISALLOW,
- *              no application can be installed on the device.
- * @since_tizen 3.0
- * @param[in]   handle The device policy manager handle
- * @param[in]   mode The installation mode to be set, one of DPM_PACKAGE_INSTALLATION_MODE_ALLOW or
- *              DPM_PACKAGE_INSTALLATION_MODE_DISALLOW
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE No error
- * @retval      #DPM_ERROR_TIMEOUT Time out
- * @retval      #DPM_ERROR_ACCESS_DENIED The application does not have
- *              the privilege to call this API
- * @pre         handle must be created by dpm_context_acquire_application_policy()
- * @see         dpm_application_set_mode_restriction()
- * @see         dpm_application_get_mode_restriction()
- */
-int dpm_application_unset_mode_restriction(device_policy_manager_h handle, int mode);
-
-/**
- * @brief       Gets the current restriction mode for all packages.
- * @details     The default mode is to allow any package to be installed.
- * @since_tizen 3.0
- * @param[in]   handle The device policy manager handle
- * @param[out]  mode Current mode of operation, which is one of the following:
- *              #DPM_PACKAGE_INSTALLATION_MODE_ALLOW Package installation is allowed
- *              #DPM_PACKAGE_INSTALLATION_MODE_DISALLOW Package installation is not allowed
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMEOUT Time out
- * @pre         handle must be created by dpm_context_acquire_application_policy()
- * @see         dpm_application_set_mode_restriction()
- * @see         dpm_application_unset_mode_restriction()
- * @see         dpm_application_get_mode_restriction()
- */
-int dpm_application_get_mode_restriction(device_policy_manager_h handle, int *mode);
-
-/**
- * @brief       Adds privilege to blacklist
- * @details     Administrator can use this API to disallow package installation
- *              which requires the privilege.
- * @since_tizen 3.0
- * @param[in]   handle The application policy handle
- * @param[in]   type The package type
- * @param[in]   privilehe The privilege name to be blacklisted
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMEOUT Time out
- * @retval      #DPM_ERROR_ACCESS_DENIED The application does not have
- *              the privilege to call this API
- * @pre         handle must be created by dpm_context_acquire_application_policy()
- * @see         dpm_context_acquire_application_policy()
- * @see         dpm_context_release_application_policy()
- * @see         dpm_application_remove_privilege_from_blacklist()
- * @see         dpm_application_check_privilege_is_blacklisted()
- */
-int dpm_application_add_privilege_to_blacklist(device_policy_manager_h handle, int type, const char* privilege);
-
-/**
- * @brief       Removes privilege from blacklist
- * @details     Administrator can use this API to remove privilege from blacklist.
- * @since_tizen 3.0
- * @param[in]   handle The application policy handle
- * @param[in]   type The package type
- * @param[in]   privilege The privilege name which is removed from blacklist
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMEOUT Time out
- * @retval      #DPM_ERROR_ACCESS_DENIED The application does not have
- *              the privilege to call this API
- * @pre         handle must be created by dpm_context_acquire_application_policy()
- * @see         dpm_context_acquire_application_policy()
- * @see         dpm_context_release_application_policy()
- * @see         dpm_application_add_privilege_to_blacklist()
- * @see         dpm_application_check_privilege_is_blacklisted()
- */
-int dpm_application_remove_privilege_from_blacklist(device_policy_manager_h handle, int type, const char* privilege);
-
-/**
- * @brief       Checks whether a privilege is added to blacklist
- * @details     Administrator can use this API to check whether the privilege is blacklisted.
- *              Once privilege is added to blacklist, the package which requires the privilege
- *              is prohibited to install on the device.
- * @since_tizen 3.0
- * @param[in]   handle The application policy handle
- * @param[in]   type The package type
- * @param[in]   privilege The privilege name
- * @param[out]  is_blacklisted TRUE if the package installation is disabled, else FALSE
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMEOUT Time out
- * @pre         handle must be created by dpm_context_acquire_application_policy()
- * @see         dpm_context_acquire_application_policy()
- * @see         dpm_context_release_application_policy()
- * @see         dpm_application_add_privilege_to_blacklist()
- * @see         dpm_application_remove_privilege_from_blacklist()
- */
-int dpm_application_check_privilege_is_blacklisted(device_policy_manager_h handle, int type, const char* privilege, int *is_blacklisted);
-
-int dpm_application_install_package(device_policy_manager_h handle, const char* pkgpath);
-int dpm_application_uninstall_package(device_policy_manager_h handle, const char* pkgid);
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //! __CAPI_APPLICATION_POLICY_H__
diff --git a/dpm/array.h b/dpm/array.h
deleted file mode 100644 (file)
index 77ac2a3..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#ifndef __RUNTIME_ARRAY_H__
-#define __RUNTIME_ARRAY_H__
-
-#include <vector>
-#include <utility>
-
-namespace runtime {
-
-template <typename T>
-class Array final {
-public:
-       Array() = delete;
-       Array(std::vector<T> &&list) :
-               list(std::move(list)), it(this->list.begin())
-       {
-       }
-
-       Array(const std::vector<T> &list) :
-               list(list), it(this->list.begin())
-       {
-       }
-
-       T *next()
-       {
-               if (it != list.end()) {
-                       return &(*it++);
-               }
-               return NULL;
-       }
-
-       bool isEnd()
-       {
-               return it == list.end();
-       }
-
-private:
-       std::vector<T> list;
-       typename std::vector<T>::iterator it;
-};
-
-} // namespace runtime
-
-#endif // __RUNTIME_ARRAY_H__
diff --git a/dpm/bluetooth.cpp b/dpm/bluetooth.cpp
deleted file mode 100644 (file)
index cb8c409..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- *  Copyright (c) 2016 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
- */
-
-#include "bluetooth.h"
-#include "bluetooth.hxx"
-
-#include "debug.h"
-#include "policy-client.h"
-
-using namespace DevicePolicyManager;
-
-EXPORT_API int dpm_bluetooth_add_device_to_blacklist(device_policy_manager_h handle, const char* mac)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(mac, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       BluetoothPolicy bluetooth = client.createPolicyInterface<BluetoothPolicy>();
-
-       try {
-               return bluetooth.addDeviceToBlacklist(mac);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_bluetooth_remove_device_from_blacklist(device_policy_manager_h handle, const char* mac)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(mac, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       BluetoothPolicy bluetooth = client.createPolicyInterface<BluetoothPolicy>();
-
-       try {
-               return bluetooth.removeDeviceFromBlacklist(mac);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_bluetooth_set_device_restriction(device_policy_manager_h handle, int enable)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       BluetoothPolicy bluetooth = client.createPolicyInterface<BluetoothPolicy>();
-
-       try {
-               return bluetooth.setDeviceRestriction(enable);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_bluetooth_is_device_restricted(device_policy_manager_h handle, int *state)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       BluetoothPolicy bluetooth = client.createPolicyInterface<BluetoothPolicy>();
-
-       try {
-               *state = bluetooth.isDeviceRestricted();
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_bluetooth_add_uuid_to_blacklist(device_policy_manager_h handle, const char* uuid)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(uuid, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       BluetoothPolicy bluetooth = client.createPolicyInterface<BluetoothPolicy>();
-
-       try {
-               return bluetooth.addUuidToBlacklist(uuid);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_bluetooth_remove_uuid_from_blacklist(device_policy_manager_h handle, const char* uuid)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(uuid, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       BluetoothPolicy bluetooth = client.createPolicyInterface<BluetoothPolicy>();
-
-       try {
-               return bluetooth.removeUuidFromBlacklist(uuid);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_bluetooth_set_uuid_restriction(device_policy_manager_h handle, int enable)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       BluetoothPolicy bluetooth = client.createPolicyInterface<BluetoothPolicy>();
-
-       try {
-               return bluetooth.setUuidRestriction(enable);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_bluetooth_is_uuid_restricted(device_policy_manager_h handle, int *state)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       BluetoothPolicy bluetooth = client.createPolicyInterface<BluetoothPolicy>();
-
-       try {
-               *state = bluetooth.isUuidRestricted();
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
diff --git a/dpm/bluetooth.h b/dpm/bluetooth.h
deleted file mode 100644 (file)
index 04160e5..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- *  Copyright (c) 2016 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
- */
-
-#ifndef __CAPI_BLUETOOTH_POLICY_H__
-#define __CAPI_BLUETOOTH_POLICY_H__
-
-#include <dpm/device-policy-manager.h>
-
-/**
- * @file bluetooth.h
- * @brief This file provides APIs to control bluetooth functionality such as
- *        bluetooth device or uuid restriction
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup  CAPI_DPM_BLUETOOTH_POLICY_MODULE
- * @{
- */
-
-/**
- * @brief       Adds MAC address to blacklist
- * @details     An administrator can use this API to add new MAC address to
- *              blacklist
- * @since_tizen 3.0
- * @param[in]   handle The device policy manager handle
- * @param[in]   address The MAC address that should be added
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMEOUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         handle must be created by dpm_context_acquire_bluetooth_policy()
- * @see         dpm_context_acquire_bluetooth_policy()
- * @see         dpm_context_release_bluetooth_policy()
- * @see         dpm_bluetooth_remove_device_from_blacklist()
- */
-int dpm_bluetooth_add_device_to_blacklist(device_policy_manager_h handle, const char* address);
-
-/**
- * @brief       Removes MAC address from blacklist
- * @details     An administrator can use this API to remove MAC address from
- *              blacklist
- * @since_tizen 3.0
- * @param[in]   handle The device policy manager handle
- * @param[in]   address The MAC address that should be removed
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMEOUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         handle must be created by dpm_context_acquire_bluetooth_policy()
- * @see         dpm_context_acquire_bluetooth_policy()
- * @see         dpm_context_release_bluetooth_policy()
- * @see         dpm_bluetooth_add_device_to_blacklist()
- */
-int dpm_bluetooth_remove_device_from_blacklist(device_policy_manager_h handle, const char* address);
-
-/**
- * @brief       Enables or disables device restriction of bluetooth
- * @details     An administrator can use this API to set whether the bluetooth
- *              is allowed or not by device restriction
- * @since_tizen 3.0
- * @param[in]   handle The device policy manager handle
- * @param[in]   enable If true, enable the bluetooth pairing restriction, if false, allow the bluetooth pairing
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMEOUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         handle must be created by dpm_context_acquire_bluetooth_policy()
- * @see         dpm_context_acquire_bluetooth_policy()
- * @see         dpm_context_release_bluetooth_policy()
- * @see         dpm_bluetooth_is_device_restricted()
- */
-int dpm_bluetooth_set_device_restriction(device_policy_manager_h handle, int enable);
-
-/**
- * @brief       Gets the status of the bluetooth's device restriction
- * @details     An administrator can use this API to get the status of the
- *              bluetooth's device restriction. The device restricted bluetooth will be worked by MAC
- *              address blacklist
- * @since_tizen 3.0
- * @param[in]   handle The device policy manager handle
- * @param[out]  is_enabled true if the bluetooth pairing restriction is enabled, else false
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMEOUT Time out
- * @pre         handle must be created by dpm_context_acquire_bluetooth_policy()
- * @see         dpm_context_acquire_bluetooth_policy()
- * @see         dpm_context_release_bluetooth_policy()
- * @see         dpm_bluetooth_set_device_restriction()
- */
-int dpm_bluetooth_is_device_restricted(device_policy_manager_h handle, int *is_enabled);
-
-/**
- * @brief       Adds UUID to blacklist
- * @details     An administrator can use this API to add new UUID to blacklist
- * @since_tizen 3.0
- * @param[in]   handle The device policy manager handle
- * @param[in]   uuid The UUID that should be added
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMEOUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         handle must be created by dpm_context_acquire_bluetooth_policy()
- * @see         dpm_context_acquire_bluetooth_policy()
- * @see         dpm_context_release_bluetooth_policy()
- * @see         dpm_bluetooth_remove_uuid_from_blacklist()
- */
-int dpm_bluetooth_add_uuid_to_blacklist(device_policy_manager_h handle, const char* uuid);
-
-/**
- * @brief       Removes UUID from blacklist
- * @details     An administrator can use this API to remove UUID from blacklist
- * @since_tizen 3.0
- * @param[in]   handle The device policy manager handle
- * @param[in]   uuid The UUID that should be removed
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMEOUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         handle must be created by dpm_context_acquire_bluetooth_policy()
- * @see         dpm_context_acquire_bluetooth_policy()
- * @see         dpm_context_release_bluetooth_policy()
- * @see         dpm_bluetooth_add_uuid_to_blacklist()
- */
-int dpm_bluetooth_remove_uuid_from_blacklist(device_policy_manager_h handle, const char* uuid);
-
-/**
- * @brief       Enables or disables UUID restriction of bluetooth
- * @details     An administrator can use this API to set whether the bluetooth
- *              is allowed or not by UUID restriction
- * @since_tizen 3.0
- * @param[in]   handle The device policy manager handle
- * @param[in]   enable If true, enable the bluetooth pairing restriction,
- *              if false, disable the bluetooth pairing restriction
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMEOUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         handle must be created by dpm_context_acquire_bluetooth_policy()
- * @see         dpm_context_acquire_bluetooth_policy()
- * @see         dpm_context_release_bluetooth_policy()
- * @see         dpm_bluetooth_is_uuid_restricted()
- */
-int dpm_bluetooth_set_uuid_restriction(device_policy_manager_h handle, int enable);
-
-/**
- * @brief       Gets the bluetooth's UUID restriction status
- * @details     An administrator can use this API to get the bluetooth's UUID restriction status
- *              The UUID restricted bluetooth will be worked by UUID blacklist
- * @since_tizen 3.0
- * @param[in]   handle The device policy manager handle
- * @param[out]  is_enabled true if the bluetooth pairing restriction is enabled, else false
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMEOUT Time out
- * @pre         handle must be created by dpm_context_acquire_bluetooth_policy()
- * @see         dpm_context_acquire_bluetooth_policy()
- * @see         dpm_context_release_bluetooth_policy()
- * @see         dpm_bluetooth_set_uuid_restriction()
- */
-int dpm_bluetooth_is_uuid_restricted(device_policy_manager_h handle, int *is_enabled);
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //! __CAPI_BLUETOOTH_POLICY_H__
diff --git a/dpm/client-handle.cpp b/dpm/client-handle.cpp
deleted file mode 100644 (file)
index 1c5eb7d..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#include <cassert>
-#include <iostream>
-
-#include "device-policy-manager.h"
-
-#include "policy-client.h"
-#include "debug.h"
-
-DevicePolicyContext& GetDevicePolicyContext(void* handle)
-{
-       assert(handle);
-       return *reinterpret_cast<DevicePolicyContext*>(handle);
-}
-
-EXPORT_API device_policy_manager_h dpm_manager_create(void)
-{
-       DevicePolicyContext* client = new(std::nothrow) DevicePolicyContext();
-       if (client == nullptr) {
-               return NULL;
-       }
-
-       if (client->connect() < 0) {
-               delete client;
-               return NULL;
-       }
-
-       return reinterpret_cast<device_policy_manager_h>(client);
-}
-
-EXPORT_API int dpm_manager_destroy(device_policy_manager_h handle)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       delete &GetDevicePolicyContext(handle);
-
-       return 0;
-}
-
-EXPORT_API int dpm_add_policy_changed_cb(device_policy_manager_h handle,
-                                                                                const char* name,
-                                                                                dpm_policy_changed_cb callback,
-                                                                                void* user_data,
-                                                                                int* id)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(name, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(callback, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(id, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext& client = GetDevicePolicyContext(handle);
-       int ret = client.subscribePolicyChange(name, callback, user_data);
-       if (ret < 0) {
-               return -1;
-       }
-
-       *id = ret;
-       return 0;
-}
-
-EXPORT_API int dpm_remove_policy_changed_cb(device_policy_manager_h handle, int id)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(id >= 0, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext& client = GetDevicePolicyContext(handle);
-       return client.unsubscribePolicyChange(id);
-}
-
-EXPORT_API int dpm_add_signal_cb(device_policy_manager_h handle, const char* signal,
-                                                                dpm_signal_cb callback, void* user_data, int* id)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(signal, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(callback, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(id, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext& context = GetDevicePolicyContext(handle);
-       int ret = context.subscribeSignal(signal, callback, user_data);
-       if (ret < 0) {
-               return -1;
-       }
-
-       *id = ret;
-       return 0;
-}
-
-EXPORT_API int dpm_remove_signal_cb(device_policy_manager_h handle, int id)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(id >= 0, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext& context = GetDevicePolicyContext(handle);
-       return context.unsubscribeSignal(id);
-}
diff --git a/dpm/debug.h b/dpm/debug.h
deleted file mode 100644 (file)
index 8e5ebb4..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#ifndef __CAPI_DPM_ASSERT_H__
-#define __CAPI_DPM_ASSERT_H__
-
-#define RET_ON_FAILURE(cond, ret) \
-{                                 \
-       if (!(cond))                  \
-               return (ret);             \
-}
-
-#endif //! __CAPI_DPM_ASSERT_H__
diff --git a/dpm/device-policy-manager.h b/dpm/device-policy-manager.h
deleted file mode 100644 (file)
index 774eb84..0000000
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#ifndef __DEVICE_POLICY_MANAGER_H__
-#define __DEVICE_POLICY_MANAGER_H__
-
-#include <tizen.h>
-#include <tizen_type.h>
-
-/**
- * @file device-policy-manager.h
- * @brief This file defines common data types required to device policy APIs.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup  CAPI_DPM_MANAGER_MODULE
- * @{
- */
-
-/**
- * @brief       Called when a policy is changed.
- * @since_tizen 3.0
- * @param[in]   name The name of the policy
- * @param[in]   state The current state of the policy
- * @param[in]   user_data The user data passed from dpm_manager_add_policy_changed_cb
- * @see         dpm_manager_add_policy_changed_cb()
- * @see         dpm_manager_remove_policy_changed_cb()
- */
-typedef void (*dpm_policy_changed_cb)(const char* name, const char* state, void *user_data);
-
-/**
- * @brief       The device policy manager handle
- * @details     The device policy manager handle is an abstraction of the
- *              logical connection between the device policy manager and
- *              it's client. The device policy manager handle must be
- *              created by using dpm_manager_create() before attempting to
- *              use almost any of the device policy APIs, and it should
- *              be freed when interaction with the device policy manager
- *              is no longer required.
- *              To release the handle, use dpm_manager_destroy().
- * @since_tizen 3.0
- * @see         dpm_manager_create()
- * @see         dpm_manager_destroy()
- */
-typedef void* device_policy_manager_h;
-
-/**
- * @brief       Enumeration of device policy API errors
- * @since_tizen 3.0
- */
-typedef enum {
-       DPM_ERROR_NONE                 = TIZEN_ERROR_NONE,                 /**< The operation was successful */
-       DPM_ERROR_INVALID_PARAMETER    = TIZEN_ERROR_INVALID_PARAMETER,    /**< Invalid parameter */
-       DPM_ERROR_CONNECTION_REFUSED   = TIZEN_ERROR_CONNECTION_REFUSED,   /**< Connection refused */
-       DPM_ERROR_TIMED_OUT            = TIZEN_ERROR_TIMED_OUT,            /**< Time out */
-       DPM_ERROR_PERMISSION_DENIED    = TIZEN_ERROR_PERMISSION_DENIED,    /**< Access privilege is not sufficient */
-       DPM_ERROR_NOT_PERMITTED        = TIZEN_ERROR_NOT_PERMITTED,        /**< Operation not permitted */
-       DPM_ERROR_FILE_EXISTS          = TIZEN_ERROR_FILE_EXISTS,          /**< File exists */
-       DPM_ERROR_OUT_OF_MEMORY        = TIZEN_ERROR_OUT_OF_MEMORY,        /**< Out of memory */
-       DPM_ERROR_NO_DATA              = TIZEN_ERROR_NO_DATA               /**< No Data */
-} dpm_error_type_e;
-
-/**
- * @brief       Creates the device policy manager handle.
- * @details     This API creates device policy manager handle required to
- *              the device policy APIs.
- *              This API is also used to verify whether caller is authorized
- *              or not.
- * @since_tizen 3.0
- * @return      Device policy manager handle on success, otherwise NULL
- * @remarks      The specific error code can be obtained by using the
- *              get_last_result() method. Error codes are described in
- *              exception section.
- *              The returned handle should be released using dpm_manager_destroy().
- * @exception   #DPM_ERROR_NONE No error
- * @exception   #DPM_ERROR_CONNECTION_REFUSED Connection refused
- * @exception   #DPM_ERROR_OUT_OF_MEMORY Out of memory
- * @see         dpm_manager_destroy()
- * @see         get_last_result()
- */
-device_policy_manager_h dpm_manager_create(void);
-
-/**
- * @brief       Releases the device policy manager handle.
- * @details     This API must be called if interaction with the device
- *              policy manager is no longer required.
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_manager_destroy(device_policy_manager_h handle);
-
-/**
- * @brief       Adds policy change callback to the device policy
- *              manager.
- * @details     This API can be used to subscribe policy change callback.
- *              The callback specified to this API is asynchronously called when
- *              policy is changed on runtime.
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @param[in]   name Policy name to subscribe(see @ref CAPI_SECURITY_DPM_MODULE_POLICY)
- * @param[in]   callback The callback when policy is changed
- * @param[in]   user_data User specified data passed to the callback
- * @param[out]  id Policy change callback identifier
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @remark      See @ref CAPI_SECURITY_DPM_MODULE_POLICY section for available policy name
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_remove_policy_changed_cb()
- */
-int dpm_add_policy_changed_cb(device_policy_manager_h handle,
-                                                         const char* name,
-                                                         dpm_policy_changed_cb callback,
-                                                         void* user_data,
-                                                         int* id);
-/**
- * @brief       Removes policy change callback from the device policy
- *              manager.
- * @details     This API should be called if policy change subscription is no longer
- *              required.
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @param[in]   id Policy change callback identifier
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @pre         The handle must be created by dpm_manager_create().
- * @pre         The callback identifier must be created by dpm_manager_add_policy_changed_cb().
- * @see         dpm_manager_create()
- * @see         dpm_add_policy_changed_cb()
- */
-int dpm_remove_policy_changed_cb(device_policy_manager_h handle, int id);
-/**
- * @brief       Called when a zone raises a signal.
- * @since_tizen 3.0
- * @param[in]   name The zone name
- * @param[in]   object The object name triggered the signal
- * @param[in]   user_data The user data passed from dpm_zone_add_signal_cb
- * @see         dpm_zone_add_signal_cb()
- * @see         dpm_zone_remove_signal_cb()
- */
-typedef void(*dpm_signal_cb)(const char* name, const char* object, void *user_data);
-
-/**
- * @brief       Adds signal callback.
- * @details     This API can be used to receive signals raised by the device policy manager.
- *              The callback specified to this function is automatically called when
- *              the device policy manager raises signal.
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @param[in]   signal The signal name to receive(see @ref CAPI_DPM_SECURITY_MODULE_SIGNAL)
- * @param[in]   callback The signal callback
- * @param[in]   user_data The user data passed to the callback function
- * @param[out]  id Signal identifier
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @remark      See @ref CAPI_DPM_SECURITY_MODULE_SIGNAL section for signals
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_manager_destroy()
- * @see         dpm_remove_signal_cb()
- */
-int dpm_add_signal_cb(device_policy_manager_h handle, const char* signal,
-                                         dpm_signal_cb callback, void* user_data, int* id);
-
-/**
- * @brief       Removes signal callback.
- * @details     This API removes signal callback.
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @param[in]   id Signal identifier
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @pre         The context must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_manager_destroy()
- * @see         dpm_add_signal_cb()
- */
-int dpm_remove_signal_cb(device_policy_manager_h handle, int id);
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __DEVICE_POLICY_MANAGER_H__ */
diff --git a/dpm/password.cpp b/dpm/password.cpp
deleted file mode 100644 (file)
index 377788a..0000000
+++ /dev/null
@@ -1,572 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#include <cstring>
-#include <cassert>
-
-#include "password.h"
-#include "password_internal.h"
-#include "password.hxx"
-
-#include "array.h"
-#include "debug.h"
-#include "policy-client.h"
-
-using namespace DevicePolicyManager;
-
-EXPORT_API int dpm_password_set_quality(device_policy_manager_h handle, int quality)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(quality >= 0, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               return password.setQuality(quality);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_password_get_quality(device_policy_manager_h handle, int *quality)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(quality, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               int ret = password.getQuality();
-               if (ret < 0) {
-                       return -1;
-               }
-
-               *quality = (dpm_password_quality_e)ret;
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_password_set_minimum_length(device_policy_manager_h handle, int value)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(value >= 0, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               return password.setMinimumLength(value);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_password_get_minimum_length(device_policy_manager_h handle, int *value)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(value, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               int ret = password.getMinimumLength();
-               if (ret < 0) {
-                       return -1;
-               }
-
-               *value = ret;
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_password_set_min_complex_chars(device_policy_manager_h handle, int value)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(value >= 0, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               return password.setMinComplexChars(value);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_password_get_min_complex_chars(device_policy_manager_h handle, int *value)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(value, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               int ret = password.getMinComplexChars();
-               if (ret < 0) {
-                       return -1;
-               }
-
-               *value = ret;
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_password_set_maximum_failed_attempts_for_wipe(device_policy_manager_h handle, int value)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(value >= 0, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               return password.setMaximumFailedForWipe(value);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_password_get_maximum_failed_attempts_for_wipe(device_policy_manager_h handle, int *value)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(value, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               int ret = password.getMaximumFailedForWipe();
-               if (ret < 0) {
-                       return -1;
-               }
-
-               *value = ret;
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_password_set_expires(device_policy_manager_h handle, int value)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(value >= 0, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               return password.setExpires(value);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_password_get_expires(device_policy_manager_h handle, int *value)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(value, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               int ret = password.getExpires();
-               if (ret < 0) {
-                       return -1;
-               }
-
-               *value = ret;
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_password_set_history(device_policy_manager_h handle, int value)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(value >= 0, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               return password.setHistory(value);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_password_get_history(device_policy_manager_h handle, int *value)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(value, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               int ret = password.getHistory();
-               if (ret < 0) {
-                       return -1;
-               }
-
-               *value = ret;
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_password_set_pattern(device_policy_manager_h handle, const char *pattern)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(pattern, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               return password.setPattern(pattern);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_password_reset(device_policy_manager_h handle, const char *passwd)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(passwd, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               return password.reset(passwd);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_password_enforce_change(device_policy_manager_h handle)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               return password.enforceChange();
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_password_set_max_inactivity_time_device_lock(device_policy_manager_h handle, int value)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(value >= 0, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               return password.setMaxInactivityTimeDeviceLock(value);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_password_get_max_inactivity_time_device_lock(device_policy_manager_h handle, int *value)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(value, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               int ret = password.getMaxInactivityTimeDeviceLock();
-               if (ret < 0) {
-                       return -1;
-               }
-
-               *value = ret;
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_password_set_status(device_policy_manager_h handle, dpm_password_status_e status)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(status >= DPM_PASSWORD_STATUS_NORMAL &&
-                                  status <= DPM_PASSWORD_STATUS_PATTERN_CHANGED,
-                                  DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               return password.setStatus(status);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_password_get_status(device_policy_manager_h handle, dpm_password_status_e *status)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(status, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               int ret = password.getStatus();
-               if (ret < 0) {
-                       return -1;
-               }
-
-               *status = (dpm_password_status_e)ret;
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_password_delete_pattern(device_policy_manager_h handle)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               return password.deletePattern();
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_password_get_pattern(device_policy_manager_h handle, char **pattern)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(pattern, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               *pattern = ::strdup(password.getPattern().c_str());
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_password_set_maximum_character_occurrences(device_policy_manager_h handle, int value)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(value >= 0, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               return password.setMaximumCharacterOccurrences(value);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_password_get_maximum_character_occurrences(device_policy_manager_h handle, int *value)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(value, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               int ret = password.getMaximumCharacterOccurrences();
-               if (ret < 0) {
-                       return -1;
-               }
-
-               *value = ret;
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_password_set_maximum_numeric_sequence_length(device_policy_manager_h handle, int value)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(value >= 0, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               return password.setMaximumNumericSequenceLength(value);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_password_get_maximum_numeric_sequence_length(device_policy_manager_h handle, int *value)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(value, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               int ret = password.getMaximumNumericSequenceLength();
-               if (ret < 0) {
-                       return -1;
-               }
-
-               *value = ret;
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-typedef runtime::Array<std::string> dpm_password_iterator;
-
-EXPORT_API dpm_password_iterator_h dpm_password_create_iterator(device_policy_manager_h handle)
-{
-       RET_ON_FAILURE(handle, NULL);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       return reinterpret_cast<dpm_password_iterator_h>(new dpm_password_iterator(password.getForbiddenStrings()));
-}
-
-EXPORT_API int dpm_password_iterator_next(dpm_password_iterator_h iter, const char **result)
-{
-       RET_ON_FAILURE(iter, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(result, DPM_ERROR_INVALID_PARAMETER);
-
-       dpm_password_iterator *it = reinterpret_cast<dpm_password_iterator *>(iter);
-
-       if (it->isEnd())
-               *result = NULL;
-       else
-               *result = it->next()->c_str();
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_password_destroy_iterator(dpm_password_iterator_h iter)
-{
-       RET_ON_FAILURE(iter, DPM_ERROR_INVALID_PARAMETER);
-
-       delete reinterpret_cast<dpm_password_iterator *>(iter);
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_password_set_forbidden_strings(device_policy_manager_h handle, const char *strings[], int length)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(strings, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(length >= 0, DPM_ERROR_INVALID_PARAMETER);
-
-       int iter;
-       std::vector<std::string> forbiddenStrings;
-
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(strings, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       for (iter = 0; iter < length; iter++)
-               forbiddenStrings.push_back(strings[iter]);
-
-       try {
-               return password.setForbiddenStrings(forbiddenStrings);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_password_set_recovery(device_policy_manager_h handle, int enable)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               return password.setRecovery(enable);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_password_get_recovery(device_policy_manager_h handle, int *enable)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(enable, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
-
-       try {
-               int ret = password.getRecovery();
-               if (ret < 0) {
-                       return -1;
-               }
-
-               *enable = ret;
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
diff --git a/dpm/password.h b/dpm/password.h
deleted file mode 100644 (file)
index acd77e9..0000000
+++ /dev/null
@@ -1,732 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#ifndef __CAPI_PASSWORD_POLICY_H__
-#define __CAPI_PASSWORD_POLICY_H__
-
-#include <dpm/device-policy-manager.h>
-
-/**
- * @file password.h
- * @brief This file provides APIs to control password functionality
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup  CAPI_DPM_PASSWORD_POLICY_MODULE
- * @{
- */
-
-/**
- * @brief       Enumeration for dpm password quality type
- * @since_tizen 3.0
- */
-typedef enum {
-       DPM_PASSWORD_QUALITY_UNSPECIFIED     = 0x00,    /**< No requirements for password. */
-       DPM_PASSWORD_QUALITY_SIMPLE_PASSWORD = 0x01,    /**< EAS(Exchange ActiveSync) requirement for simple password */
-       DPM_PASSWORD_QUALITY_SOMETHING       = 0x10,    /**< Some kind password is required, but doesn't care what it is */
-       DPM_PASSWORD_QUALITY_NUMERIC         = 0x20,    /**< Containing at least numeric characters */
-       DPM_PASSWORD_QUALITY_ALPHABETIC      = 0x40,    /**< Containing at least alphabetic (or other symbol) characters */
-       DPM_PASSWORD_QUALITY_ALPHANUMERIC    = 0x80,    /**< Containing at least numeric and alphabetic characters */
-} dpm_password_quality_e;
-
-/**
- * @brief       Enumeration for dpm password status type
- * @since_tizen 3.0
- */
-typedef enum {
-       DPM_PASSWORD_STATUS_NORMAL,                     /**< Password normal status */
-       DPM_PASSWORD_STATUS_CHANGED,                    /**< Password successfully changed */
-       DPM_PASSWORD_STATUS_NOT_CHANGED,                /**< Password not changed */
-       DPM_PASSWORD_STATUS_CHANGE_REQUIRED ,           /**< Password change required */
-       DPM_PASSWORD_STATUS_MAX_ATTEMPTS_EXCEEDED,      /**< Password Max Attempts Exceeded*/
-
-       DPM_PASSWORD_STATUS_EXPIRED,                    /**< Password expired */
-       DPM_PASSWORD_STATUS_RECOVERY_PASSWORD_FAILED,   /**< Device unlock failed by Password Recovery */
-       DPM_PASSWORD_STATUS_RECOVERY_PASSWORD_SUCCEEDED,/**< Device unlock succeeded by Password Recovery */
-
-       DPM_PASSWORD_STATUS_QUALITY_CHANGED,            /**< Password quality successfully changed */
-       DPM_PASSWORD_STATUS_MIN_LENGTH_CHANGED,         /**< Password min_length successfully changed */
-       DPM_PASSWORD_STATUS_COMPLEX_CHAR_CHANGED,       /**< Password complex_char successfully changed */
-       DPM_PASSWORD_STATUS_PATTERN_CHANGED             /**< Password pattern successfully changed */
-} dpm_password_status_e;
-
-/**
- * @partner
- * @brief       Sets password quality.
- * @details     An administrator can set the password restrictions it is imposing.
- *              After setting this, the user will not be able to
- *              enter a new password that is not at least as restrictive as what has been set.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   handle Device policy manager handle
- * @param[in]   quality Password quality type, values of #dpm_password_quality_e combined with bitwise 'or'
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_set_quality(device_policy_manager_h handle, int quality);
-
-/**
- * @partner
- * @brief       Gets password quality.
- * @details     An administrator can get the password restrictions it is imposing.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   handle Device policy manager handle
- * @param[out]   quality Password quality type, values of #dpm_password_quality_e combined with bitwise 'or'
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_get_quality(device_policy_manager_h handle, int *quality);
-
-/**
- * @partner
- * @brief       Sets password minimum length.
- * @details     Sets the minimum allowed password length. After setting this,
- *              the user will not be able to enter a new password that is
- *              shorter than the setting length.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   handle Device policy manager handle
- * @param[in]   value Allowed minimum password length
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_set_minimum_length(device_policy_manager_h handle, int value);
-
-/**
- * @partner
- * @brief       Gets password minimum length.
- * @details     Gets the minimum allowed password length.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   handle Device policy manager handle
- * @param[out]   value Allowed minimum password length
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_get_minimum_length(device_policy_manager_h handle, int *value);
-
-/**
- * @partner
- * @brief       Sets minimum complex char in password.
- * @details     Complex characters are all non-alphabetic characters;
- *              that is, numbers and symbols. Admin can configure this
- *              setting and make the password more secure.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   handle Device policy manager handle
- * @param[in]   value Number of minimum complex char in password.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_set_min_complex_chars(device_policy_manager_h handle, int value);
-
-/**
- * @partner
- * @brief       Gets minimum complex char in password.
- * @details     Complex characters are all non-alphabetic characters;
- *              that is, numbers and symbols.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   handle Device policy manager handle
- * @param[out]   value Number of minimum complex char in password.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_get_min_complex_chars(device_policy_manager_h handle, int *value);
-
-/**
- * @partner
- * @brief       Sets maximum number of failed attempts before device is wiped.
- * @details     If user fails the last attempt, device will be wiped.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   handle Device policy manager handle
- * @param[in]   value Maximum count for failed passwords.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_set_maximum_failed_attempts_for_wipe(device_policy_manager_h handle, int value);
-
-/**
- * @partner
- * @brief       Gets maximum number of failed attempts before device is wiped.
- * @details     If user fails the last attempt, device will be wiped.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   handle Device policy manager handle
- * @param[out]   value Maximum count for failed passwords.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_get_maximum_failed_attempts_for_wipe(device_policy_manager_h handle, int *value);
-
-/**
- * @partner
- * @brief       Sets the number of days password expires.
- * @details     An administrator can configure the password age to force
- *              the user to enter a new password after every expiration period.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   handle Device policy manager handle
- * @param[in]   value Number of days after which the password expires.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_set_expires(device_policy_manager_h handle, int value);
-
-/**
- * @partner
- * @brief       Gets the number of days password expires.
- * @details     An administrator can get the password age to force
- *              the user to enter a new password after every expiration period.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   handle Device policy manager handle
- * @param[out]   value Number of days after which the password expires.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_get_expires(device_policy_manager_h handle, int *value);
-
-/**
- * @partner
- * @brief       Sets the number of min password history to avoid previous password.
- * @details     An administrator can configure the number of previous
- *              passwords which cannot be used when entering a new password.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   handle Device policy manager handle
- * @param[in]   value Number of previous passwords which cannot be used when
- *              settings a new password.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_set_history(device_policy_manager_h handle, int value);
-
-/**
- * @partner
- * @brief       Gets the number of min password history to avoid previous password.
- * @details     An administrator can get the number of previous
- *              passwords which cannot be used when entering a new password.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   handle Device policy manager handle
- * @param[out]   value Number of previous passwords which cannot be used when
- *              settings a new password.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_get_history(device_policy_manager_h handle, int *value);
-
-/**
- * @partner
- * @brief       Sets the required password pattern.
- * @details     An administrator can force User to enter password based on
- *              a regular expression.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   handle Device policy manager handle
- * @param[in]   pattern Password pattern. If regular expression is
- *              [a-zA-Z]{4}[0-9]{4}, we can force user to enter a 8 character
- *              password with first 4 alphabetic characters and next 4
- *              numeric characters. An administrator must take care when
- *              setting this pattern.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_set_pattern(device_policy_manager_h handle, const char *pattern);
-
-/**
- * @partner
- * @brief       Resets password.
- * @details     This takes effect immediately to the device password.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   handle Device policy manager handle
- * @param[in]   password New password
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_reset(device_policy_manager_h handle, const char *password);
-
-/**
- * @partner
- * @brief       Enforces password change.
- * @details     An administrator can enforce password change. PasswordPolicy
- *              change setting is launched.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   handle Device policy manager handle
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_enforce_change(device_policy_manager_h handle);
-
-/**
- * @partner
- * @brief       Sets the maximum number of seconds of inactivity time
- *              before the screen timeout occurs.
- * @details     An administrator sets the maximum number of seconds of inactivity
- *              time before the screen timeout occurs and a device user must
- *              type the password to unlock the device.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   handle Device policy manager handle
- * @param[in]   value Maximum inactivity time for device lock. Specifies how soon
- *              the device can be unlocked again after use, without reprompting for
- *              the passcode.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_set_max_inactivity_time_device_lock(device_policy_manager_h handle, int value);
-
-/**
- * @partner
- * @brief       Gets the maximum number of seconds of inactivity time
- *              before the screen timeout occurs.
- * @details     Called by an application that is managing the device to get
- *              the value of timeout period.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   handle Device policy manager handle
- * @param[out]  value Pointer of Maximum inactivity time for device lock.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_get_max_inactivity_time_device_lock(device_policy_manager_h handle, int *value);
-
-/**
- * @partner
- * @brief       Sets password status
- * @details     An administrator can know password status for this API.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   handle Device policy manager handle
- * @param[in]   status Password status
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_set_status(device_policy_manager_h handle, dpm_password_status_e status);
-
-/**
- * @partner
- * @brief       Gets password status
- * @details     An administrator can know password status for this API.
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @param[out]   status Password status
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_get_status(device_policy_manager_h handle, dpm_password_status_e *status);
-
-
-/**
- * @partner
- * @brief       Removes all password patterns.
- * @details     An administrator can remove all password patterns.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   handle Device policy manager handle
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_delete_pattern(device_policy_manager_h handle);
-
-/**
- * @partner
- * @brief       Gets password pattern.
- * @details     This API can be used for applying complexity on new password value.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @remarks     The @a pattern should be freed using free().
- * @param[in]   handle Device policy manager handle
- * @param[out]  pattern Password pattern
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_OUT_OF_MEMORY Out of memory
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_get_pattern(device_policy_manager_h handle, char **pattern);
-
-/**
- * @partner
- * @brief       Sets the maximum number of times a character can occur in
- *              the device password.
- * @details     Called by an admin that is managing the device to specify that
- *              any character in the device password cannot occur more than
- *              the specified maximum number of times. Characters can be numeric
- *              or alphabetic or symbolic. "aaabcde" has 'a' which occurs 3 times,
- *              "1b1c1de" has '1' which occurs 3 times and "a@b@c@" has '@' which
- *              occurs 3 times. A value of '0' specifies that no restrictions are
- *              applied.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   handle Device policy manager handle
- * @param[in]   value Maximum character occurrences
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_set_maximum_character_occurrences(device_policy_manager_h handle, int value);
-
-/**
- * @partner
- * @brief       Gets the maximum number of times a character can occur in
- *              the device password.
- * @details     An administrator can retrieve the maximum number of times
- *              a character can occur in the device password. If more than
- *              one admin has set this value then the least value will take
- *              preference.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   handle Device policy manager handle
- * @param[out]   value Pointer of Maximum Character Occurrences
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_get_maximum_character_occurrences(device_policy_manager_h handle, int *value);
-
-/**
- * @partner
- * @brief       Sets the maximum length of the numeric sequence
- *              which is allowed in the device password.
- * @details     Called by an administrator that is managing the device to set
- *              the maximum numeric sequence length. This specifies that
- *              the device password must not contain numeric sequences greater
- *              than the given length.
- *              Numeric sequences can be increasing successively by one like
- *              "12345", or decreasing successively by one like "98765", or
- *              repeating like "55555".
- *              These are all numeric sequences of length '5'.
- *              If maximum value is set to '5' then "123456" or "987654" or
- *              "555555" are not allowed.
- *              A value of '0' specifies that no such numeric sequence
- *              restrictions are applied.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   handle Device policy manager handle
- * @param[in]   value Maximum numeric sequence length
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_set_maximum_numeric_sequence_length(device_policy_manager_h handle, int value);
-
-/**
- * @partner
- * @brief       Gets the maximum numeric sequence length allowed in
- *              the device password.
- * @details     An administrator can retrieve the length of numeric sequences
- *              which are allowed in the device password.
- *              For instance, if the return value is '3' then "123", "987",
- *              "555" would all be numeric sequences of length '3' and will be
- *              allowed in the device password.
- *              If more than one admin has set this value then the least value
- *              will take preference.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   handle Device policy manager handle
- * @param[out]  value Pointer of maximum numeric sequence length
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_get_maximum_numeric_sequence_length(device_policy_manager_h handle, int *value);
-
-/**
- * @brief       The password forbidden string list iterator handle
- * @since_tizen 3.0
- * @see         dpm_password_create_iterator()
- * @see         dpm_password_iterator_next()
- * @see         dpm_password_destroy_iterator()
- */
-typedef void *dpm_password_iterator_h;
-
-/**
- * @partner
- * @brief       Creates a password forbidden string list iterator.
- * @details     The password forbidden string list iterator can be used to get all forbidden strings.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   handle Device policy manager handle
- * @return      A password forbidden string list iterator on success, otherwise
- *              null value
- * @remarks     The specific error code can be obtained by using the
- *              get_last_result() method. Error codes are described in
- *              exception section.
- *              The returned iterator should be released using dpm_password_destroy_iterator().
- * @exception   #DPM_ERROR_NONE No error
- * @exception   #DPM_ERROR_OUT_OF_MEMORY Out of memory
- * @exception   #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @exception   #DPM_ERROR_TIMED_OUT Time out
- * @exception   #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_password_iterator_next()
- * @see         dpm_password_destroy_iterator()
- * @see         get_last_result()
- */
-dpm_password_iterator_h dpm_password_create_iterator(device_policy_manager_h handle);
-
-/**
- * @partner
- * @brief       Fetches a password forbidden string and forwards the iterator.
- * @details     This API returns a password forbidden string indicated by the iterator, and then
- *              the iterator is moved to the next position. If the iterator reaches
- *              the end of the list, null value will be returned.
- * @since_tizen 3.0
- * @param[in]   iter The iterator to be controlled
- * @param[out]  forbidden_string The forbidden string got from the iterator
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @remarks     The @a forbidden_string should not be freed using free().
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @pre         The iter must be created by dpm_password_create_iterator().
- * @see         dpm_passsword_create_iterator()
- * @see         dpm_password_destroy_iterator()
- */
-int dpm_password_iterator_next(dpm_password_iterator_h iter, const char **forbidden_string);
-
-/**
- * @partner
- * @brief       Frees the password forbidden string iterator.
- * @details     This API frees the password forbidden string iterator. This API must be called
- *              if the iterator no longer used.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   iter The iterator to be removed
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The iter must be created by dpm_password_create_iterator()
- * @see         dpm_password_create_iterator()
- * @see         dpm_password_iterator_next()
- */
-int dpm_password_destroy_iterator(dpm_password_iterator_h iter);
-
-/**
- * @partner
- * @brief       Sets strings which are forbidden in the device password.
- * @details     Called by an admin that is managing the device to set strings that are forbidden to be used in the device password.
- *              This specifies any strings which must not be present in the device password such as personal data (variations on the user's name, email address or X400 address), or any other strings.
- *              If the parameter list has only one blank string(""), then the stored strings are cleared.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.password
- * @param[in]   handle Device policy manager handle
- * @param[in]   strings The forbidden strings
- * @param[in]   length The length of the strings
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_password_set_forbidden_strings(device_policy_manager_h handle, const char *strings[], int length);
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  __CAPI_PASSWORD_POLICY_H__ */
diff --git a/dpm/password_internal.h b/dpm/password_internal.h
deleted file mode 100644 (file)
index a02274d..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#ifndef __CAPI_PASSWORD_INTERNAL_POLICY_H__
-#define __CAPI_PASSWORD_INTERNAL_POLICY_H__
-
-#include <dpm/device-policy-manager.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int dpm_password_set_recovery(device_policy_manager_h handle, int enable);
-int dpm_password_get_recovery(device_policy_manager_h handle, int *enable);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*  __CAPI_PASSWORD_INTERNAL_POLICY_H__ */
-
diff --git a/dpm/restriction.cpp b/dpm/restriction.cpp
deleted file mode 100644 (file)
index 97021a4..0000000
+++ /dev/null
@@ -1,522 +0,0 @@
-/*
- *  Copyright (c) 2016 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
- */
-
-#include "restriction.h"
-#include "restriction.hxx"
-#include "location.hxx"
-#include "bluetooth.hxx"
-#include "wifi.hxx"
-
-#include "debug.h"
-#include "policy-client.h"
-
-using namespace DevicePolicyManager;
-
-EXPORT_API int dpm_restriction_set_camera_state(device_policy_manager_h handle, int allow)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
-
-       try {
-               return restriction.setCameraState(allow);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_restriction_get_camera_state(device_policy_manager_h handle, int *is_allowed)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
-
-       try {
-               *is_allowed = restriction.getCameraState();
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_restriction_set_microphone_state(device_policy_manager_h handle, int allow)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
-
-       try {
-               return restriction.setMicrophoneState(allow);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_restriction_get_microphone_state(device_policy_manager_h handle, int *is_allowed)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
-
-       try {
-               *is_allowed = restriction.getMicrophoneState();
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_restriction_set_location_state(device_policy_manager_h handle, int allow)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       LocationPolicy location = client.createPolicyInterface<LocationPolicy>();
-
-       try {
-               return location.setLocationState(allow);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_restriction_get_location_state(device_policy_manager_h handle, int *is_allowed)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       LocationPolicy location = client.createPolicyInterface<LocationPolicy>();
-
-       try {
-               *is_allowed = location.getLocationState();
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_restriction_set_usb_debugging_state(device_policy_manager_h handle, int allow)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
-
-       try {
-               return restriction.setUsbDebuggingState(allow);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_restriction_get_usb_debugging_state(device_policy_manager_h handle, int *is_allowed)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
-
-       try {
-               *is_allowed = restriction.getUsbDebuggingState();
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_restriction_set_usb_tethering_state(device_policy_manager_h handle, int allow)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
-
-       try {
-               return restriction.setUsbTetheringState(allow);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_restriction_get_usb_tethering_state(device_policy_manager_h handle, int *is_allowed)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
-
-       try {
-               *is_allowed = restriction.getUsbTetheringState();
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_restriction_set_external_storage_state(device_policy_manager_h handle, int allow)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
-
-       try {
-               return restriction.setExternalStorageState(allow);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_restriction_get_external_storage_state(device_policy_manager_h handle, int *is_allowed)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
-
-       try {
-               *is_allowed = restriction.getExternalStorageState();
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_restriction_set_clipboard_state(device_policy_manager_h handle, int allow)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
-
-       try {
-               return restriction.setClipboardState(allow);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_restriction_get_clipboard_state(device_policy_manager_h handle, int *is_allowed)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
-
-       try {
-               *is_allowed = restriction.getClipboardState();
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_restriction_set_wifi_state(device_policy_manager_h handle, int allow)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       WifiPolicy wifi = client.createPolicyInterface<WifiPolicy>();
-
-       try {
-               return wifi.setState(allow);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_restriction_get_wifi_state(device_policy_manager_h handle, int *is_allowed)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       WifiPolicy wifi = client.createPolicyInterface<WifiPolicy>();
-
-       try {
-               *is_allowed = wifi.getState();
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_restriction_set_wifi_hotspot_state(device_policy_manager_h handle, int allow)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       WifiPolicy wifi = client.createPolicyInterface<WifiPolicy>();
-
-       try {
-               return wifi.setHotspotState(allow);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_restriction_get_wifi_hotspot_state(device_policy_manager_h handle, int *is_allowed)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       WifiPolicy wifi = client.createPolicyInterface<WifiPolicy>();
-
-       try {
-               *is_allowed = wifi.getHotspotState();
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_restriction_set_bluetooth_tethering_state(device_policy_manager_h handle, int allow)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       BluetoothPolicy bluetooth = client.createPolicyInterface<BluetoothPolicy>();
-
-       try {
-               return bluetooth.setTetheringState(allow);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_restriction_get_bluetooth_tethering_state(device_policy_manager_h handle, int *is_allowed)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       BluetoothPolicy bluetooth = client.createPolicyInterface<BluetoothPolicy>();
-
-       try {
-               *is_allowed = bluetooth.getTetheringState();
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_restriction_set_bluetooth_mode_change_state(device_policy_manager_h handle, int allow)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       BluetoothPolicy bluetooth = client.createPolicyInterface<BluetoothPolicy>();
-
-       try {
-               return bluetooth.setModeChangeState(allow);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_restriction_get_bluetooth_mode_change_state(device_policy_manager_h handle, int *is_allowed)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       BluetoothPolicy bluetooth = client.createPolicyInterface<BluetoothPolicy>();
-
-       try {
-               *is_allowed = bluetooth.getModeChangeState();
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_restriction_set_bluetooth_desktop_connectivity_state(device_policy_manager_h handle, int allow)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       BluetoothPolicy bluetooth = client.createPolicyInterface<BluetoothPolicy>();
-
-       try {
-               return bluetooth.setDesktopConnectivityState(allow);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_restriction_get_bluetooth_desktop_connectivity_state(device_policy_manager_h handle, int *is_allowed)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       BluetoothPolicy bluetooth = client.createPolicyInterface<BluetoothPolicy>();
-
-       try {
-               *is_allowed = bluetooth.getDesktopConnectivityState();
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_restriction_set_bluetooth_pairing_state(device_policy_manager_h handle, int allow)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       BluetoothPolicy bluetooth = client.createPolicyInterface<BluetoothPolicy>();
-
-       try {
-               return bluetooth.setPairingState(allow);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_restriction_get_bluetooth_pairing_state(device_policy_manager_h handle, int *is_allowed)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       BluetoothPolicy bluetooth = client.createPolicyInterface<BluetoothPolicy>();
-
-       try {
-               *is_allowed = bluetooth.getPairingState();
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_restriction_set_popimap_email_state(device_policy_manager_h handle, int allow)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
-
-       try {
-               return restriction.setPopImapEmailState(allow);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_restriction_get_popimap_email_state(device_policy_manager_h handle, int *is_allowed)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
-
-       try {
-               *is_allowed = restriction.getPopImapEmailState();
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_restriction_set_messaging_state(device_policy_manager_h handle, const char *sim_id, int allow)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
-
-       try {
-               return restriction.setMessagingState(sim_id, allow);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_restriction_get_messaging_state(device_policy_manager_h handle, const char *sim_id, int *is_allowed)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
-
-       try {
-               *is_allowed = restriction.getMessagingState(sim_id);
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_restriction_set_browser_state(device_policy_manager_h handle, int allow)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
-
-       try {
-               return restriction.setBrowserState(allow);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_restriction_get_browser_state(device_policy_manager_h handle, int *is_allowed)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
-
-       try {
-               *is_allowed = restriction.getBrowserState();
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
diff --git a/dpm/restriction.h b/dpm/restriction.h
deleted file mode 100644 (file)
index 9262341..0000000
+++ /dev/null
@@ -1,696 +0,0 @@
-/*
- *  Copyright (c) 2016 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
- */
-
-#ifndef __CAPI_RESTRICTION_POLICY_H__
-#define __CAPI_RESTRICTION_POLICY_H__
-
-#include <dpm/device-policy-manager.h>
-
-/**
- * @file restriction.h
- * @brief This file provides APIs to control restriction functionality.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup  CAPI_DPM_RESTRICTION_POLICY_MODULE
- * @{
- */
-
-/**
- * @partner
- * @brief       Allows or disallows the use of camera.
- * @details     An administrator can use this API to set whether the use of camera
- *              is allowed or not.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.camera
- * @param[in]   handle Device policy manager handle
- * @param[in]   allow If true, allow the use of camera, if false, disallow the use of camera
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_restriction_get_camera_state()
- */
-int dpm_restriction_set_camera_state(device_policy_manager_h handle, int allow);
-
-/**
- * @brief       Check whether the use of camera is allowed or not.
- * @details     An administrator can use this API to check whether the use of camera
- *              is allowed or not.
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @param[out]  is_allowed true if the use of camera is allowed, false otherwise.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_restriction_set_camera_state()
- */
-int dpm_restriction_get_camera_state(device_policy_manager_h handle, int *is_allowed);
-
-/**
- * @partner
- * @brief       Allows or disallows the use of microphone.
- * @details     An administrator can use this API to set whether the use of microphone
- *              is allowed or not.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.microphone
- * @param[in]   handle Device policy manager handle
- * @param[in]   allow If true, allow the use of microphone,
- *              if false, disallow the use of microphone
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_restriction_get_microphone_state()
- */
-int dpm_restriction_set_microphone_state(device_policy_manager_h handle, int allow);
-
-/**
- * @brief       Checks whether the use of microphone is allowed or not.
- * @details     An administrator can use this API to check whether the use of microphone
- *              is allowed of not.
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @param[out]  is_allowed true if the use of microphone is allowed, false otherwise.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_restriction_set_microphone_state()
- */
-int dpm_restriction_get_microphone_state(device_policy_manager_h handle, int *is_allowed);
-
-/**
- * @partner
- * @brief       Allows or disallows user to change the location state.
- * @details     An administrator can use this API to allow or disallow user to change
- *              the location state.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.location
- * @param[in]   handle Device policy manager handle
- * @param[in]   allow If true, allow user to change the location state, if false, disallow
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_restriction_get_location_state()
- */
-int dpm_restriction_set_location_state(device_policy_manager_h handle, int allow);
-
-/**
- * @brief       Check whether user is allowed to change location state or not.
- * @details     An administrator can use this API to check whether user is allowed to change
- *              the location state or not.
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @param[out]  is_allowed true if the location state change is allowed, false otherwise.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_restriction_set_location_state()
- */
-int dpm_restriction_get_location_state(device_policy_manager_h handle, int *is_allowed);
-
-/**
- * @partner
- * @brief       Allows or disallows user to use usb mass storage.
- * @details     An administrator can use this API to set whether the usb mass
- *              storage is allowed or not.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.storage
- * @param[in]   handle Device policy manager handle
- * @param[in]   allow If true, allow user to use the external storages, if false, disallow
- *              the external storage
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_storage_get_external_storage_state()
- */
-int dpm_restriction_set_external_storage_state(device_policy_manager_h handle, int allow);
-
-/**
- * @brief       Checks whether the use of external storage is allowed or not.
- * @details     An administrator can use this API to check whether the use of external storage is
- *              allowed or not.
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @param[out]  is_allowed true if the use of external storage is allowed, false otherwise.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_storage_set_external_storage_state()
- */
-int dpm_restriction_get_external_storage_state(device_policy_manager_h handle, int *is_allowed);
-
-/**
- * @partner
- * @brief       Allows or disallows user to access the clipboard.
- * @details     An administrator can use this API to set whether the clipboard access.
- *              is allowed or not
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.clipboard
- * @param[in]   handle Device policy manager handle
- * @param[in]   allow If true, allow the clipboard access, if false, disallow the clipboard access.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_restriction_get_clipboard_state()
- */
-int dpm_restriction_set_clipboard_state(device_policy_manager_h handle, int allow);
-
-/**
- * @brief       Checks whether the clipboard access is allowed or not.
- * @details     An administrator can use this API to check whether the clipboard access
- *              is allowed or not.
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @param[out]  is_allowed true if the access is allowed, false otherwise.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_restriction_set_clipboard_state()
- */
-int dpm_restriction_get_clipboard_state(device_policy_manager_h handle, int *is_allowed);
-
-/**
- * @partner
- * @brief       Allows or disallows the usb debugging.
- * @details     An administrator can use this API to set whether the usb debugging
- *              is allowed or not.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.debugging
- * @param[in]   handle Device policy manager handle
- * @param[in]   allow If true, allow the usb debugging, if false, disallow the usb
- *              debugging
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_restriction_get_usb_debugging_state()
- */
-int dpm_restriction_set_usb_debugging_state(device_policy_manager_h handle, int allow);
-
-/**
- * @brief       Checks whether the usb debugging is allowed or not.
- * @details     An administrator can use this API to check whether the usb debugging
- *              is allowed or not.
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @param[out]   is_allowed true if the usb debugging is allowed, false otherwise.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_restriction_set_usb_debugging_state()
- */
-int dpm_restriction_get_usb_debugging_state(device_policy_manager_h handle, int *is_allowed);
-
-/**
- * @partner
- * @brief       Allows or disallows user to change the Wi-Fi state.
- * @details     An administrator can use this API to allow or disallow user to
- *              change the Wi-Fi state. If it is disallowed, user does not have UI
- *              access to change the state.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.wifi
- * @param[in]   handle Device policy manager handle
- * @param[in]   allow If true, allow user to change Wi-Fi state,
- *              if false, disallow user to change Wi-Fi state.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_restriction_get_wifi_state()
- */
-int dpm_restriction_set_wifi_state(device_policy_manager_h handle, int allow);
-
-/**
- * @brief       Checks whether the Wi-Fi state change is allowed or not.
- * @details     An administrator can use this API to check whether user is
- *              allowed to change Wi-Fi state or not.
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @param[out]  is_allowed true if the change is allowed, false otherwise.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_restriction_set_wifi_state()
- */
-int dpm_restriction_get_wifi_state(device_policy_manager_h handle, int *is_allowed);
-
-/**
- * @partner
- * @brief       Allows or disallows user to change Wi-Fi hotspot state change.
- * @details     An administrator can use this API to allow or disallow user to change Wi-Fi
- *              hotspot state. When it is disallowed, the UI is grayed out so user cannot
- *              change Wi-Fi hotspot state.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.wifi
- * @param[in]   handle Device policy manager handle
- * @param[in]   allow If true, allow user to change Wi-Fi hostspot state,
- *              if false, disallow user to change Wi-Fi hotspot state.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_restriction_get_wifi_hotspot_state()
- */
-int dpm_restriction_set_wifi_hotspot_state(device_policy_manager_h handle, int allow);
-
-/**
- * @brief       Checks whether the the Wi-Fi hotspot state change is allowed or not.
- * @details     An administrator can use this API to check whether user is allowed to change
- *              Wi-Fi hotspot state or not.
- *              If the Wi-Fi hotspot state change is disallowed, the UI is grayed out so user can not
- *              change its state.
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @param[out]  is_allowed true if the state change is allowed, false otherwise.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_restriction_set_wifi_hotspot_state()
- */
-int dpm_restriction_get_wifi_hotspot_state(device_policy_manager_h handle, int *is_allowed);
-
-/**
- * @partner
- * @brief       Allows or disallows user to change the bluetooth tethering state.
- * @details     An administrator can use this API to allow of disallow user
- *              to chanage the bluetooth tethering state.
- *              When disallowed, the UI is grayed out so user cannot change the state.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.bluetooth
- * @param[in]   handle Device policy manager handle
- * @param[in]   allow If true, allow user to change the bluetooth tethering state,
- *              if false, disallow user to change the bluetooth tethering state.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_restriction_get_bluetooth_tethering_state()
- */
-int dpm_restriction_set_bluetooth_tethering_state(device_policy_manager_h handle, int allow);
-
-/**
- * @brief       Checks whether the bluetooth tethering state change is allowed.
- * @details     An administrator can use this API to check whether user is allowed
- *              to change bluetooth tethering state.
- *              is allowed or not.
- *              If the bluetooth tethering state change is disallowed, the UI is grayed out
- *              so user can not change its state.
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @param[out]  is_allowed true if the change is allowed, false otherwise.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_restriction_set_bluetooth_tethering_state()
- */
-int dpm_restriction_get_bluetooth_tethering_state(device_policy_manager_h handle, int *is_allowed);
-
-/**
- * @partner
- * @brief       Allows or disallows user to change USB tethering settings.
- * @details     An administrator can use this API to allow or disallow user
- *              to change USB tethering settings.
- *              When disallowed, the UI is grayed out so user cannot change the state.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.usb
- * @param[in]   handle Device policy manager handle
- * @param[in]   allow If true, allow USB tethering state change,
- *              if false, disallow USB tethering state change.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_restriction_get_usb_tethering_state()
- */
-int dpm_restriction_set_usb_tethering_state(device_policy_manager_h handle, int allow);
-
-/**
- * @brief       Checks whether the USB tethering state change is allowed.
- * @details     An administrator can use this API to check whether the USB tethering state change
- *              is allowed or not.
- *              If the USB tethering state change is disallowed, the UI is grayed out
- *              so user can not change its state.
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @param[out]  is_allowed true if the change is allowed, false otherwise.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_restriction_set_usb_tethering_state()
- */
-int dpm_restriction_get_usb_tethering_state(device_policy_manager_h handle, int *is_allowed);
-
-/**
- * @partner
- * @brief       Allows or disallows user to change the bluetooth state.
- * @details     An administrator can use this API to allow or disallow user
- *              to change the bluetooth state.
- *              When disallowed, the UI is grayed out so user cannot change the state.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.bluetooth
- * @param[in]   handle Device policy manager handle
- * @param[in]   allow If true, allow user to change bluetooth state,
- *              if false, disallow user to change bluetooth state.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_restriction_get_bluetooth_mode_change_state()
- */
-int dpm_restriction_set_bluetooth_mode_change_state(device_policy_manager_h handle, int allow);
-
-/**
- * @brief       Checks whether the the bluetooth state change is allowed of not.
- * @details     An administrator can use this API to check whether the bluetooth state change
- *              is allowed or not.
- *              If the bluetooth state change is disallowed, the UI is grayed out
- *              so user can not change its state.
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @param[out]  is_allowed true if the change is allowed, false otherwise.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_restriction_set_bluetooth_mode_change_state()
- */
-int dpm_restriction_get_bluetooth_mode_change_state(device_policy_manager_h handle, int *is_allowed);
-
-/**
- * @partner
- * @brief       Allows or disallows the bluetooth desktop connectivity.
- * @details     An administrator can use this API to allow or disallow the bluetooth
- *              desktop connectivity.
- *              If the bluetooth desktop connectivity is disallowed, the UI is grayed out
- *              so user can not
- *              change its state.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.bluetooth
- * @param[in]   handle Device policy manager handle
- * @param[out]  allow If true, allow the bluetooth desktop connectivity,
- *              if false, disallow the bluetooth desktop connectivitiy
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_restriction_get_bluetooth_desktop_connectivity_state()
- */
-int dpm_restriction_set_bluetooth_desktop_connectivity_state(device_policy_manager_h handle, int allow);
-
-/**
- * @brief       Checks whether the the Bluetooth desktop connectivity is allowed or not.
- * @details     An administrator can use this API to check whether the Bluetooth desktop
- *              connectivity is allowed or not.
- *              If the Bluetooth desktop connectivity is disallowed, the UI is grayed out
- *              so user can not change its state.
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @param[out]  is_allowed true if the connectivity is allowed, false otherwise.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_restriction_set_bluetooth_desktop_connectivity_state()
- */
-int dpm_restriction_get_bluetooth_desktop_connectivity_state(device_policy_manager_h handle, int *is_allowed);
-
-/**
- * @partner
- * @brief       Allows or disallows user to change the bluetooth pairing.
- * @details     An administrator can use this API to allow or disallow the bluetooth pairing.
- *              If the bluetooth pairing is disallowed, the UI is grayed out
- *              so user can not change its state.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.bluetooth
- * @param[in]   handle Device policy manager handle
- * @param[out]  allow If true, allow the bluetooth pairing, if false, disallow the bluetooth pairing.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_restriction_get_bluetooth_pairing_state()
- */
-int dpm_restriction_set_bluetooth_pairing_state(device_policy_manager_h handle, int allow);
-
-/**
- * @brief       Checks whether the the bluetooth pairing is allowed or not.
- * @details     An administrator can use this API to check whether the bluetooth
- *              pairing is allowed or not.
- *              If the bluetooth pairing is disallowed, the UI is grayed out
- *              so user can not change its state.
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @param[out]  is_allowed true if the pairing is allowed, false otherwise.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_restriction_set_bluetooth_pairing_state()
- */
-int dpm_restriction_get_bluetooth_pairing_state(device_policy_manager_h handle, int *is_allowed);
-
-/**
- * @partner
- * @brief       Allows or disallows user to use of SMS or text messaging.
- * @details     An administrator can disable the text messaging capability
- *              without any user interaction
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.message
- * @param[in]   handle Device policy manager handle
- * @param[in]   sim_id SIM identifier
- * @param[in]   allow If true, allow the use of SMS or text messaging,
- *              if false, disallow the use of SMS or text messaging.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_restriction_get_messaging_state()
- */
-int dpm_restriction_set_messaging_state(device_policy_manager_h handle, const char *sim_id, int allow);
-
-/**
- * @brief       Checks whether the text messaging is allowed or not.
- * @details     An administrator can use this API to check whether text messaging capability
- *              is enabled or not.
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @param[in]   sim_id SIM identifier
- * @param[out]  is_allowed true if the messaging is allowed, false otherwise.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_restriction_set_messaging_state()
- */
-int dpm_restriction_get_messaging_state(device_policy_manager_h handle, const char *sim_id, int *is_allowed);
-
-/**
- * @partner
- * @brief       Allows or disallows the access to POP or IMAP email.
- * @details     An administrator can disable the email capability without any user interaction
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.email
- * @param[in]   handle Device policy manager handle
- * @param[in]   allow If ture, allow POP or IMAP email, if false, disallow POP or IMAP email.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_restriction_get_popimap_email_state()
- */
-int dpm_restriction_set_popimap_email_state(device_policy_manager_h handle, int allow);
-
-/**
- * @brief       Checks whether the access to POP or IMAP email is allowed or not.
- * @details     An administrator can use this API to check the access to POP or IMAP email
- *              is allowed or not.
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @param[out]  is_allowed true if the POP or IMAP email is allowed, false otherwise.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_restriction_set_popimap_email_state()
- */
-int dpm_restriction_get_popimap_email_state(device_policy_manager_h handle, int *is_allowed);
-
-/**
- * @partner
- * @brief       Allows or disallows the use of web browser.
- * @details     An administrator can allows or disallow the use of web browser without
- *              any user interaction
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.browser
- * @param[in]   handle Device policy manager handle
- * @param[in]   allow If true, allow the use of web browser,
- *              if false, disallow the use of web browser.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_restriction_get_browser_state()
- */
-int dpm_restriction_set_browser_state(device_policy_manager_h handle, int allow);
-
-/**
- * @brief       Checks whether the use of web browser is allowed or not.
- * @details     An administrator can use this API to check whether the use of web browser
- *              is allowed or not.
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @param[out]  is_allowed true if the use of web browser is allowed, false otherwise.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_restriction_set_browser_state()
- */
-int dpm_restriction_get_browser_state(device_policy_manager_h handle, int *is_allowed);
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __CAPI_RESTRICTION_POLICY_H__ */
diff --git a/dpm/security.cpp b/dpm/security.cpp
deleted file mode 100644 (file)
index 328c4c7..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#include "security.h"
-#include "security.hxx"
-#include "storage.hxx"
-
-#include "debug.h"
-#include "policy-client.h"
-
-using namespace DevicePolicyManager;
-
-EXPORT_API int dpm_security_lockout_screen(device_policy_manager_h handle)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &context = GetDevicePolicyContext(handle);
-       SecurityPolicy security = context.createPolicyInterface<SecurityPolicy>();
-       try {
-               return security.lockoutScreen();
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_security_set_internal_storage_encryption(device_policy_manager_h handle, int encrypt)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &context = GetDevicePolicyContext(handle);
-       SecurityPolicy security = context.createPolicyInterface<SecurityPolicy>();
-       try {
-               return security.setInternalStorageEncryption(encrypt);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_security_is_internal_storage_encrypted(device_policy_manager_h handle, int *is_encrypted)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(is_encrypted, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &context = GetDevicePolicyContext(handle);
-       SecurityPolicy security = context.createPolicyInterface<SecurityPolicy>();
-       try {
-               *is_encrypted = security.isInternalStorageEncrypted();
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_security_set_external_storage_encryption(device_policy_manager_h handle, int encrypt)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &context = GetDevicePolicyContext(handle);
-       SecurityPolicy security = context.createPolicyInterface<SecurityPolicy>();
-       try {
-               return security.setExternalStorageEncryption(encrypt);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_security_is_external_storage_encrypted(device_policy_manager_h handle, int *is_encrypted)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(is_encrypted, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &context = GetDevicePolicyContext(handle);
-       SecurityPolicy security = context.createPolicyInterface<SecurityPolicy>();
-       try {
-               *is_encrypted = security.isExternalStorageEncrypted();
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_security_wipe_data(device_policy_manager_h handle, dpm_security_wipe_type_e type)
-{
-       int mask = type & (DPM_SECURITY_WIPE_INTERNAL_STORAGE | DPM_SECURITY_WIPE_EXTERNAL_STORAGE);
-
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(mask, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       StoragePolicy storage = client.createPolicyInterface<StoragePolicy>();
-       try {
-               return storage.wipeData(type);
-       } catch (...) {
-               return -1;
-       }
-}
diff --git a/dpm/security.h b/dpm/security.h
deleted file mode 100644 (file)
index a688991..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#ifndef __CAPI_SECURITY_POLICY_H__
-#define __CAPI_SECURITY_POLICY_H__
-
-#include <dpm/device-policy-manager.h>
-
-/**
- * @file security.h
- * @brief This file provides APIs to control security functionality such as
- *        device encryption and screen lock.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup  CAPI_DPM_SECURITY_POLICY_MODULE
- * @{
- */
-
-/**
- * @partner
- * @brief       Locks device screen immediately.
- * @details     An administrator can use this API to lock the device screen
- *              immediately
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.lock
- * @param[in]   handle Device policy manager handle
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_security_lockout_screen(device_policy_manager_h handle);
-
-/**
- * @partner
- * @brief       Encrypts or decrypts internal storage.
- * @details     An administrator can use this API to enable full device
- *              encryption, which includes device memory and internal SD card.
- *              Before calling this API, administrator must ensure that
- *              the device password is set to alphanumeric quality.
- *              The administrator can set an alphanumeric password by using
- *              dpm_set_password_quality() API
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.security
- * @param[in]   handle Device policy manager handle
- * @param[in]   encrypt true if encryption is required, false if decryption is
- *              required
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_security_is_internal_storage_encrypted()
- */
-int dpm_security_set_internal_storage_encryption(device_policy_manager_h handle, int encrypt);
-
-/**
- * @brief       Checks the internal storage encryption state.
- * @details     An administrator can use this API to check whether internal
- *              storage encryption is enabled.
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @param[out]  is_encrypted true if internal storage is encrypted or being encrypted,
- *              else false.
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_security_set_internal_storage_encryption()
- */
-int dpm_security_is_internal_storage_encrypted(device_policy_manager_h handle, int *is_encrypted);
-
-/**
- * @partner
- * @brief       Encrypts or decrypts external storage.
- * @details     An administrator can use this API to enable external SD card
- *              encryption. Before calling this API, administrator must
- *              ensure that the device password is set to alphanumeric quality.
- *              The administrator can set an alphanumeric password by using
- *              dpm_set_password_quality() API
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.security
- * @param[in]   handle Device policy manager handle
- * @param[in]   encrypt true if encryption is required, false if decryption is
- *              required
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_security_is_external_storage_encryped()
- */
-int dpm_security_set_external_storage_encryption(device_policy_manager_h handle, int encrypt);
-
-/**
- * @brief       Checks the external storage encryption state.
- * @details     An administrator can use this API to check whether external
- *              storage encryption is enabled.
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @param[out]   is_encrypted true if external storage is encrypted or being encrypted,
- *              else false
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_security_set_external_storage_encryption()
- */
-int dpm_security_is_external_storage_encrypted(device_policy_manager_h handle, int *is_encrypted);
-
-/**
- * @brief       Enumeration for device wipe type.
- * @since_tizen 3.0
- */
-typedef enum {
-       DPM_SECURITY_WIPE_INTERNAL_STORAGE = (1 << 0), /**< Wipe internal memory */
-       DPM_SECURITY_WIPE_EXTERNAL_STORAGE = (1 << 1),  /**< Wipe external memory */
-} dpm_security_wipe_type_e;
-
-/**
- * @partner
- * @brief       Wipes external memory, internal memory, or both selectively.
- * @details     Device Admin can use this API to wipe both SD card data
- *              and application data.
- *              Calling this API may require rebooting the device.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.wipe
- * @param[in]   handle Device policy manager handle
- * @param[in]   type The target storage for wipe
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- */
-int dpm_security_wipe_data(device_policy_manager_h handle, dpm_security_wipe_type_e type);
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //! __CAPI_SECURITY_POLICY_H__
diff --git a/dpm/storage.cpp b/dpm/storage.cpp
deleted file mode 100644 (file)
index ca828af..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#include "storage.h"
-#include "storage.hxx"
-
-#include "debug.h"
-#include "policy-client.h"
-
-using namespace DevicePolicyManager;
-
-dpm_storage_policy_h dpm_context_acquire_storage_policy(dpm_context_h handle)
-{
-       return handle;
-}
-
-int dpm_context_release_storage_policy(dpm_storage_policy_h handle)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       return DPM_ERROR_NONE;
-}
-
-int dpm_storage_wipe_data(dpm_storage_policy_h handle, const dpm_wipe_type_e type)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       StoragePolicy storage = client.createPolicyInterface<StoragePolicy>();
-       try {
-               return storage.wipeData(type);
-       } catch (...) {
-               return -1;
-       }
-}
diff --git a/dpm/storage.h b/dpm/storage.h
deleted file mode 100644 (file)
index c6fb900..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#ifndef __CAPI_STORAGE_POLICY_H__
-#define __CAPI_STORAGE_POLICY_H__
-
-#include <dpm/device-policy-manager.h>
-
-/**
- * @file storage.h
- * @brief This file provides APIs to control storage
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup  CAPI_DPM_STORAGE_POLICY_MODULE
- * @{
- */
-
-/**
- * @brief       Enumeration for device wipe type
- * @since_tizen 3.0
- */
-typedef enum {
-       WIPE_INTERNAL_STORAGE = (1 << 0), /**< Wipe internal memory. */
-       WIPE_EXTERNAL_STORAGE = (1 << 1)  /**< Wipe external memory. */
-} dpm_wipe_type_e;
-
-/**
- * @brief       The storage policy handle
- * @since_tizen 3.0
- * @see         dpm_context_acquire_storage_policy()
- * @see         dpm_context_release_storage_policy()
- */
-typedef void* dpm_storage_policy_h;
-
-/**
- * @brief       Acquires the storage policy handle.
- * @details     This API acquires storage policy handle required to enforce
- *              the storage policies.
- * @since_tizen 3.0
- * @param[in]   handle The device policy context handle
- * @return      Storage policy handle on success, otherwise NULL
- * @remark      The specific error code can be obtained by using the
- *              get_last_result() method. Error codes are described in
- *              exception section.
- * @exception   #DPM_ERROR_NONE No error
- * @exception   #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @exception   #DPM_ERROR_TIMED_OUT Time out
- * @see         dpm_context_release_storage_policy()
- * @see         get_last_result()
- */
-dpm_storage_policy_h dpm_context_acquire_storage_policy(dpm_context_h handle);
-
-/**
- * @brief       Releases the storage policy handle.
- * @details     This API must be called if interaction with the device
- *              policy manager is no longer required.
- * @since_tizen 3.0
- * @param[in]   handle The device policy context
- * @param[in]   handle The storage policy handle
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @pre         The handle must be created by dpm_context_acquire_storage_policy().
- * @see         dpm_context_acquire_storage_policy()
- */
-int dpm_context_release_storage_policy(dpm_context_h context, dpm_storage_policy_h handle);
-
-/**
- * @brief       API to selectively wipe external memory, internal memory,
- *              or both.
- * @details     Device Admin can use this API to wipe both SD card data
- *              and application data.
- *              Calling this API may require rebooting the device.
- * @since_tizen 3.0
- * @param[in]   handle Storage policy handle
- * @param[in]   type DPM_WIPE_INTERNAL_STORAGE or DPM_WIPE_EXTERNAL_STORAGE
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         handle must be created by dpm_context_acquire_storage_policy()
- * @see         dpm_context_acquire_storage_policy()
- * @see         dpm_context_release_storage_policy()
- */
-int dpm_storage_wipe_data(dpm_storage_policy_h handle, const dpm_wipe_type_e type);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__CAPI_STORAGE_POLICY_H__
diff --git a/dpm/wifi.cpp b/dpm/wifi.cpp
deleted file mode 100644 (file)
index bdcf094..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#include "wifi.h"
-#include "wifi.hxx"
-
-#include "debug.h"
-#include "policy-client.h"
-
-using namespace DevicePolicyManager;
-
-EXPORT_API int dpm_wifi_set_profile_change_restriction(device_policy_manager_h handle, int enable)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       WifiPolicy wifi = client.createPolicyInterface<WifiPolicy>();
-
-       try {
-               return wifi.setProfileChangeRestriction(enable);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_wifi_is_profile_change_restricted(device_policy_manager_h handle, int *enable)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(enable, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       WifiPolicy wifi = client.createPolicyInterface<WifiPolicy>();
-
-       try {
-               *enable = wifi.isProfileChangeRestricted();
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_wifi_set_network_access_restriction(device_policy_manager_h handle, int enable)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       WifiPolicy wifi = client.createPolicyInterface<WifiPolicy>();
-
-       try {
-               return wifi.setNetworkAccessRestriction(enable);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_wifi_is_network_access_restricted(device_policy_manager_h handle, int *enable)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(enable, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       WifiPolicy wifi = client.createPolicyInterface<WifiPolicy>();
-
-       try {
-               *enable = wifi.isNetworkAccessRestricted();
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_wifi_add_ssid_to_blocklist(device_policy_manager_h handle, const char* ssid)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(ssid, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       WifiPolicy wifi = client.createPolicyInterface<WifiPolicy>();
-
-       try {
-               return wifi.addSsidToBlocklist(ssid);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_wifi_remove_ssid_from_blocklist(device_policy_manager_h handle, const char* ssid)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(ssid, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       WifiPolicy wifi = client.createPolicyInterface<WifiPolicy>();
-
-       try {
-               return wifi.removeSsidFromBlocklist(ssid);
-       } catch (...) {
-               return -1;
-       }
-}
diff --git a/dpm/wifi.h b/dpm/wifi.h
deleted file mode 100644 (file)
index 95d0b1a..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#ifndef __CAPI_WIFI_POLICY_H__
-#define __CAPI_WIFI_POLICY_H__
-
-#include <dpm/device-policy-manager.h>
-
-/**
- * @file wifi.h
- * @brief This file provides APIs to control wifi policy
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup  CAPI_DPM_WIFI_POLICY_MODULE
- * @{
- */
-
-/**
- * @brief       Allows or disallows user to modify some Wi-Fi profiles of network settings.
- * @details     An administrator can use this API to allow or disallow users to modify selected
- *              Wi-Fi profiles like static ip configuration, proxy settings, security type
- *              and others. When this policy is in effect the user is only allowed to
- *              modify only the username, password, anonymous identity, and wep key.
- *              In addition, the user cannot remove the network. When false, the user can
- *              modify all Wi-fi network profiles normally and also remove it.
- * @since_tizen 3.0
- * @param[in]   handle The device policy manager handle
- * @param[in]   enable true to enable restriction mode for wifi profile changes, else false
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMEOUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         handle must be created by dpm_context_acquire_wifi_policy()
- * @see         dpm_context_acquire_wifi_policy()
- * @see         dpm_context_release_wifi_policy()
- * @see         dpm_wifi_is_profile_change_restricted()
- */
-int dpm_wifi_set_profile_change_restriction(device_policy_manager_h handle, int enable);
-
-/**
- * @brief       Checks if the user is allowed to modify certain Wi-Fi profiles.
- * @details     An administrator can use this API to check whether the user is
- *              allowed to modify Wi-Fi profiles. The user is restricted in modifying
- *              Wi-Fi profiles if at least one administrator has set the value to TRUE.
- * @since_tizen 3.0
- * @param[in]   handle The device policy manager handle
- * @param[out]  is_enabled true if one or more administrators enabled restriction
- *              false if user can change all Wi-Fi profiles
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMEOUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre         handle must be created by dpm_context_acquire_wifi_policy()
- * @see         dpm_context_acquire_wifi_policy()
- * @see         dpm_context_release_wifi_policy()
- * @see         dpm_wifi_set_profile_change_restriction()
- */
-int dpm_wifi_is_profile_change_restricted(device_policy_manager_h handle, int *is_enabled);
-
-/**
- * @brief       Restricts network access based on the Wi-Fi network service set
- *              identifier(SSID).
- * @details     An administrator can use this API to restrict connecting to the Wi-Fi
- *              network based on the blocked network list.
- * @since_tizen 3.0
- * @param[in]   handle The device policy manager handle
- * @param[in]   enable true to enable the Wi-Fi network access restriction,
- *              false to disable the Wi-Fi network access restriction
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMEOUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         handle must be created by dpm_manager_create()
- * @pre         Blocked network list must be added by dpm_wifi_add_ssid_to_blocklist()
- * @see         dpm_wifi_is_network_access_restricted()
- * @see         dpm_wifi_add_ssid_to_blocklist()
- * @see         dpm_wifi_remove_ssid_from_blocklist()
- */
-int dpm_wifi_set_network_access_restriction(device_policy_manager_h handle, int enable);
-
-/**
- * @brief       Checks whether the SSID-based Wi-Fi network access restriction is
- *              enabled.
- * @details     An administrator can use this API to check whether the SSID-based
- *              Wi-Fi network restriction is enabled.
- * @since_tizen 3.0
- * @param[in]   handle The device policy manager handle
- * @param[out]  is_enabled true if restriction mode is enabled or
- *              false if restriction mode is disabled
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMEOUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre         handle must be created by dpm_manager_create()
- * @see         dpm_wifi_set_network_access_restriction()
- */
-int dpm_wifi_is_network_access_restricted(device_policy_manager_h handle, int *is_enabled);
-
-/**
- * @brief       Adds a service set identifier(SSID) to the list of blocked network.
- * @details     An administrator can use this API to add an SSID to the list of blocked
- *              networks, which prevents the user from connecting to it.
- *              The blocked network still appears in the Access Point list but is disabled.
- * @since_tizen 3.0
- * @param[in]   handle The device policy manager handle
- * @param[in]   ssid The SSID to block
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMEOUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @retval      #DPM_ERROR_OUT_OF_MEMORY Too many SSIDs in blocked network list
- * @pre         handle must be created by dpm_manager_create()
- * @post        dpm_wifi_set_network_access_restriction() must be called
- *              when SSIDs in the blacklist are needed to get restricted
- * @see         dpm_wifi_remove_ssid_from_blocklist()
- * @see         dpm_wifi_set_network_access_restriction()
- */
-int dpm_wifi_add_ssid_to_blocklist(device_policy_manager_h handle, const char* ssid);
-
-/**
- * @brief       Removes a service set identifier(SSID) from the list of blocked
- *              networks.
- * @details     An administrator can use this API to remove an SSID from the list of
- *              blocked networks, which allows the user to connect to it.
- * @since_tizen 3.0
- * @param[in]   handle The device policy manager handle
- * @param[in]   ssid The SSID to be removed from the list of blocked networks
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMEOUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         handle must be created by dpm_manager_create()
- * @see         dpm_wifi_add_ssid_to_blocklist()
- * @see         dpm_wifi_set_network_access_restriction()
- */
-int dpm_wifi_remove_ssid_from_blocklist(device_policy_manager_h handle, const char* ssid);
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //! __CAPI_WIFI_POLICY_H__
diff --git a/dpm/zone.cpp b/dpm/zone.cpp
deleted file mode 100755 (executable)
index 9e51c67..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#include "zone.h"
-#include "krate.hxx"
-
-#include "array.h"
-#include "debug.h"
-#include "policy-client.h"
-
-using namespace DevicePolicyManager;
-
-EXPORT_API int dpm_zone_create(device_policy_manager_h handle, const char* name, const char* pkgname)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(name, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(pkgname, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       KratePolicy krate = client.createPolicyInterface<KratePolicy>();
-
-       try {
-               return krate.createKrate(name, pkgname);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_zone_destroy(device_policy_manager_h handle, const char* name)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(name, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       KratePolicy krate = client.createPolicyInterface<KratePolicy>();
-
-       try {
-               return krate.removeKrate(name);
-       } catch (...) {
-               return -1;
-       }
-}
-
-EXPORT_API int dpm_zone_get_state(device_policy_manager_h handle, const char* name, dpm_zone_state_e *state)
-{
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(name, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(state, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       KratePolicy krate = client.createPolicyInterface<KratePolicy>();
-
-       try {
-               int result = krate.getKrateState(name);
-               if (result == 0) {
-                       return DPM_ERROR_NO_DATA;
-               }
-
-               *state = (dpm_zone_state_e)result;
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
-
-EXPORT_API int dpm_zone_foreach_name(device_policy_manager_h handle, dpm_zone_state_e state,
-                                                                        dpm_zone_foreach_name_cb callback, void* user_data)
-{
-       int mask = state & (DPM_ZONE_STATE_LOCKED | DPM_ZONE_STATE_RUNNING);
-
-       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(callback, DPM_ERROR_INVALID_PARAMETER);
-       RET_ON_FAILURE(mask, DPM_ERROR_INVALID_PARAMETER);
-
-       DevicePolicyContext &client = GetDevicePolicyContext(handle);
-       KratePolicy krate = client.createPolicyInterface<KratePolicy>();
-
-       try {
-               std::vector<std::string> list = krate.getKrateList(state);
-               for (const std::string& name : list) {
-                       if (!callback(name.c_str(), user_data))
-                               break;
-               }
-       } catch (...) {
-               return -1;
-       }
-
-       return DPM_ERROR_NONE;
-}
diff --git a/dpm/zone.h b/dpm/zone.h
deleted file mode 100644 (file)
index e7b56d8..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#ifndef __CAPI_ZONE_POLICY_H__
-#define __CAPI_ZONE_POLICY_H__
-
-#include <dpm/device-policy-manager.h>
-
-/**
- * @file zone.h
- * @brief This file provides APIs to control zones
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @addtogroup  CAPI_DPM_ZONE_POLICY_MODULE
- * @{
- */
-
-/**
- * @partner
- * @brief       Creates a new zone.
- * @details     An administrator can use this API to create a container. Once the container
- *              is created, the admin package given to the parameter will be installed inside
- *              the container. Then ownership of the container gets transferred to the admin
- *              package from the client which triggered the container creation process.
- * @since_tizen 3.0
- * @privlevel   partner
- * @privilege   %http://tizen.org/privilege/dpm.zone
- * @param[in]   handle Device policy manager handle
- * @param[in]   name The zone name to be created
- * @param[in]   pkgname Admin package container ownership will be transferred
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_NOT_PERMITTED Operation not permitted
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_zone_destroy()
- * @see         dpm_zone_create_iterator()
- */
-int dpm_zone_create(device_policy_manager_h handle, const char* name, const char* pkgname);
-
-/**
- * @partner
- * @brief       Removes existing zone.
- * @details     Administrator can use this API to remove zone. All file system objects
- *              created for the zone will be also erased.
- * @since_tizen 3.0
- * @privlevel  partner
- * @privilege  %http://tizen.org/privilege/dpm.zone
- * @param[in]   handle Device policy manager handle
- * @param[in]   name The zone name to be removed
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
- *              the privilege to call this API or the caller is not the owner
- *              of the zone
- * @pre         The handle must be created by dpm_manager_create().
- * @pre         The zone corresponding to the given name must be
- *              created before use of this API.
- * @see         dpm_manager_create()
- * @see         dpm_zone_create()
- * @see         dpm_zone_create_iterator()
- */
-int dpm_zone_destroy(device_policy_manager_h handle, const char* name);
-
-/**
- * @brief       Enumeration for zone state
- * @since_tizen 3.0
- */
-typedef enum {
-       DPM_ZONE_STATE_LOCKED       = 0x01,  /**< Zone has been defined, but it can not start. */
-       DPM_ZONE_STATE_RUNNING      = 0x02, /**< Zone has been started. */
-       DPM_ZONE_STATE_ALL          = 0xff  /**< This presents all of the state  */
-} dpm_zone_state_e;
-
-/**
- * @brief       Gets the zone state.
- * @details     This API can be used to get the state of the zone. The zone can
- *              have one of the three states(running, locked).
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @param[in]   name The zone name
- * @param[out]  state The zone state
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_NO_DATA No such zone to get state
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_zone_create()
- * @see         dpm_zone_destroy()
- */
-int dpm_zone_get_state(device_policy_manager_h handle, const char* name, dpm_zone_state_e *state);
-
-/**
- * @brief       Called to get all the name of created zones.
- * @since_tizen 3.0
- * @param[in]   name The zone name
- * @param[in]   user_data The user data passed from dpm_zone_foreach_name
- * @return      true to continue with the next iteration of the loop, otherwise false to break out out the loop
- * @see         dpm_zone_foreach_name()
- */
-typedef bool(*dpm_zone_foreach_name_cb)(const char* name, void *user_data);
-
-/**
- * @brief       Retrieves all the name of created zones
- * @details     This API calls dpm_zone_foreach_cb() once for each zone name
- *              with traversing the created zones list.
- * @since_tizen 3.0
- * @param[in]   handle Device policy manager handle
- * @param[in]   state a combination of the zone state to look
- * @param[in]   callback The iteration callback function
- * @param[in]   user_data The user data passed to the callback function
- * @return      #DPM_ERROR_NONE on success, otherwise a negative value
- * @retval      #DPM_ERROR_NONE Successful
- * @retval      #DPM_ERROR_TIMED_OUT Time out
- * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre         The handle must be created by dpm_manager_create().
- * @see         dpm_manager_create()
- * @see         dpm_zone_create()
- * @see         dpm_zone_destroy()
- */
-int dpm_zone_foreach_name(device_policy_manager_h handle,
-                                                 dpm_zone_state_e state,
-                                                 dpm_zone_foreach_name_cb callback, void* user_data);
-
-
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __CAPI_ZONE_POLICY__ */
diff --git a/krate.cpp b/krate.cpp
deleted file mode 100644 (file)
index b49ac3f..0000000
--- a/krate.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#include "status.h"
-#include "krate.hxx"
-
-namespace DevicePolicyManager {
-
-struct KratePolicy::Private {
-       Private(PolicyControlContext& ctxt) : context(ctxt) {}
-       PolicyControlContext& context;
-};
-
-KratePolicy::KratePolicy(KratePolicy&& rhs) = default;
-KratePolicy& KratePolicy::operator=(KratePolicy&& rhs) = default;
-
-KratePolicy::KratePolicy(const KratePolicy& rhs)
-{
-       if (rhs.pimpl) {
-               pimpl.reset(new Private(*rhs.pimpl));
-       }
-}
-
-KratePolicy& KratePolicy::operator=(const KratePolicy& rhs)
-{
-       if (!rhs.pimpl) {
-               pimpl.reset();
-       } else {
-               pimpl.reset(new Private(*rhs.pimpl));
-       }
-
-       return *this;
-}
-
-KratePolicy::KratePolicy(PolicyControlContext& ctx) :
-       pimpl(new Private(ctx))
-{
-}
-
-KratePolicy::~KratePolicy()
-{
-}
-
-int KratePolicy::createKrate(const std::string& name, const std::string& setupWizAppid)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("KratePolicy::createKrate", name, setupWizAppid);
-
-       return status.get();
-}
-
-int KratePolicy::removeKrate(const std::string& name)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("KratePolicy::removeKrate", name);
-
-       return status.get();
-}
-
-int KratePolicy::getKrateState(const std::string& name)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { 0 };
-
-       status = context.methodCall<int>("KratePolicy::getKrateState", name);
-
-       return status.get();
-}
-
-std::vector<std::string> KratePolicy::getKrateList(int state)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<std::vector<std::string>> status { std::vector<std::string>() };
-
-       status = context.methodCall<std::vector<std::string>>("KratePolicy::getKrateList", state);
-
-       return status.get();
-}
-
-} // namespace DevicePolicyManager
diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..3d5f6bd
--- /dev/null
@@ -0,0 +1,70 @@
+#
+# Copyright (c) 2015 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.
+#
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+SET(TARGET "dpm")
+SET(LIB_VERSION "${VERSION}")
+SET(LIB_SOVERSION "0")
+
+SET(PC_FILE "${TARGET}.pc")
+
+SET(POLICY             policy-client.cpp
+                               client-handle.cpp
+                               administration.cpp
+                               application.cpp
+                               bluetooth.cpp
+                               restriction.cpp
+                               security.cpp
+                               wifi.cpp
+                               password.cpp
+                               zone.cpp
+)
+
+SET(CAPI               dpm/device-policy-manager.h
+                               dpm/administration.h
+                               dpm/application.h
+                               dpm/bluetooth.h
+                               dpm/restriction.h
+                               dpm/security.h
+                               dpm/wifi.h
+                               dpm/password.h
+                               dpm/password_internal.h
+                               dpm/zone.h
+)
+
+SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,noexecstack")
+
+ADD_LIBRARY(${TARGET} SHARED ${FOUNDATION} ${POLICY})
+
+SET_TARGET_PROPERTIES(${TARGET} PROPERTIES COMPILE_FLAGS "-fvisibility=hidden")
+SET_TARGET_PROPERTIES(${TARGET} PROPERTIES SOVERSION ${LIB_SOVERSION})
+SET_TARGET_PROPERTIES(${TARGET} PROPERTIES VERSION   ${LIB_VERSION})
+
+PKG_CHECK_MODULES(LIBS_DEPS    REQUIRED
+                                                       klay
+                                                       glib-2.0
+                                                       capi-base-common
+                                                       capi-system-info
+)
+
+INCLUDE_DIRECTORIES(SYSTEM ${LIBS_DEPS_INCLUDE_DIRS} ${DPM_LIBS})
+TARGET_LINK_LIBRARIES(${TARGET} ${LIBS_DEPS_LIBRARIES} pthread)
+
+CONFIGURE_FILE(${PC_FILE}.in ${CMAKE_BINARY_DIR}/${PC_FILE} @ONLY)
+
+INSTALL(FILES ${CMAKE_BINARY_DIR}/${PC_FILE} DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+INSTALL(TARGETS ${TARGET} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
+INSTALL(FILES ${CAPI} DESTINATION ${INCLUDE_INSTALL_DIR}/dpm)
diff --git a/libs/administration.cpp b/libs/administration.cpp
new file mode 100644 (file)
index 0000000..5e8b500
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ *  Copyright (c) 2015 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
+ */
+
+#include <cstring>
+#include <cassert>
+
+#include "dpm/administration.h"
+
+#include "debug.h"
+#include "status.h"
+#include "policy-client.h"
+
+EXPORT_API int dpm_admin_register_client(device_policy_manager_h handle, const char* name, uid_t uid)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(name, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(uid, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("DevicePolicyManager::enroll", name, uid);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_admin_deregister_client(device_policy_manager_h handle, const char* name, uid_t uid)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(name, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(uid, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("DevicePolicyManager::disenroll", name, uid);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
diff --git a/libs/application.cpp b/libs/application.cpp
new file mode 100644 (file)
index 0000000..4b3ae3b
--- /dev/null
@@ -0,0 +1,161 @@
+/*
+ *  Copyright (c) 2015 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
+ */
+
+#include "dpm/application.h"
+
+#include "debug.h"
+#include "status.h"
+#include "policy-client.h"
+
+EXPORT_API int dpm_application_set_mode_restriction(device_policy_manager_h handle, int mode)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(mode, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient& client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Application::setModeRestriction", mode);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_application_unset_mode_restriction(device_policy_manager_h handle, int mode)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(mode, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient& client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Application::unsetModeRestriction", mode);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_application_get_mode_restriction(device_policy_manager_h handle, int *mode)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(mode, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient& client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { 0 };
+               status = client.methodCall<int>("Application::getModeRestriction");
+               if (status.get() < 0) {
+                       return -1;
+               }
+               *mode = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_application_add_privilege_to_blacklist(device_policy_manager_h handle, int type, const char* privilege)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(privilege, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient& client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Application::addPrivilegeToBlacklist", type, privilege);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_application_remove_privilege_from_blacklist(device_policy_manager_h handle, int type, const char* privilege)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(privilege, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient& client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Application::removePrivilegeFromBlacklist", type, privilege);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_application_check_privilege_is_blacklisted(device_policy_manager_h handle, int type, const char* privilege, int *is_blacklisted)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(privilege, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(is_blacklisted, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient& client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { 0 };
+               status = client.methodCall<int>("Application::checkPrivilegeIsBlacklisted", type, privilege);
+               if (status.get() < 0) {
+                       return -1;
+               }
+
+               *is_blacklisted = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_application_install_package(device_policy_manager_h handle, const char* pkgpath)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(pkgpath, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient& client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Application::installPackage", pkgpath);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_application_uninstall_package(device_policy_manager_h handle, const char* pkgid)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(pkgid, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient& client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Application::uninstallPackage", pkgid);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
diff --git a/libs/array.h b/libs/array.h
new file mode 100644 (file)
index 0000000..77ac2a3
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ *  Copyright (c) 2015 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
+ */
+
+#ifndef __RUNTIME_ARRAY_H__
+#define __RUNTIME_ARRAY_H__
+
+#include <vector>
+#include <utility>
+
+namespace runtime {
+
+template <typename T>
+class Array final {
+public:
+       Array() = delete;
+       Array(std::vector<T> &&list) :
+               list(std::move(list)), it(this->list.begin())
+       {
+       }
+
+       Array(const std::vector<T> &list) :
+               list(list), it(this->list.begin())
+       {
+       }
+
+       T *next()
+       {
+               if (it != list.end()) {
+                       return &(*it++);
+               }
+               return NULL;
+       }
+
+       bool isEnd()
+       {
+               return it == list.end();
+       }
+
+private:
+       std::vector<T> list;
+       typename std::vector<T>::iterator it;
+};
+
+} // namespace runtime
+
+#endif // __RUNTIME_ARRAY_H__
diff --git a/libs/bluetooth.cpp b/libs/bluetooth.cpp
new file mode 100644 (file)
index 0000000..a5d8470
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ *  Copyright (c) 2016 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
+ */
+
+#include "dpm/bluetooth.h"
+
+#include "debug.h"
+#include "status.h"
+#include "policy-client.h"
+
+EXPORT_API int dpm_bluetooth_add_device_to_blacklist(device_policy_manager_h handle, const char* mac)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(mac, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Bluetooth::addDeviceToBlacklist", mac);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_bluetooth_remove_device_from_blacklist(device_policy_manager_h handle, const char* mac)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(mac, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Bluetooth::removeDeviceFromBlacklist", mac);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_bluetooth_set_device_restriction(device_policy_manager_h handle, int enable)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Bluetooth::setDeviceRestriction", enable);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_bluetooth_is_device_restricted(device_policy_manager_h handle, int *state)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<bool> status { false };
+               status = client.methodCall<bool>("Bluetooth::isDeviceRestricted");
+               *state = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_bluetooth_add_uuid_to_blacklist(device_policy_manager_h handle, const char* uuid)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(uuid, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Bluetooth::addUuidToBlacklist", uuid);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_bluetooth_remove_uuid_from_blacklist(device_policy_manager_h handle, const char* uuid)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(uuid, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Bluetooth::removeUuidFromBlacklist", uuid);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_bluetooth_set_uuid_restriction(device_policy_manager_h handle, int enable)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Bluetooth::setUuidRestriction", enable);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_bluetooth_is_uuid_restricted(device_policy_manager_h handle, int *state)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<bool> status { false };
+               status = client.methodCall<bool>("Bluetooth::isUuidRestricted");
+               *state = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
diff --git a/libs/client-handle.cpp b/libs/client-handle.cpp
new file mode 100644 (file)
index 0000000..d2ea116
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ *  Copyright (c) 2015 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
+ */
+
+#include <cassert>
+#include <iostream>
+
+#include "dpm/device-policy-manager.h"
+
+#include "policy-client.h"
+#include "debug.h"
+
+DevicePolicyClient& GetDevicePolicyClient(void* handle)
+{
+       assert(handle);
+       return *reinterpret_cast<DevicePolicyClient*>(handle);
+}
+
+EXPORT_API device_policy_manager_h dpm_manager_create(void)
+{
+       DevicePolicyClient* client = new(std::nothrow) DevicePolicyClient();
+       if (client == nullptr) {
+               return NULL;
+       }
+
+       if (client->connect() < 0) {
+               delete client;
+               return NULL;
+       }
+
+       return reinterpret_cast<device_policy_manager_h>(client);
+}
+
+EXPORT_API int dpm_manager_destroy(device_policy_manager_h handle)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       delete &GetDevicePolicyClient(handle);
+
+       return 0;
+}
+
+EXPORT_API int dpm_add_policy_changed_cb(device_policy_manager_h handle,
+                                                                                const char* name,
+                                                                                dpm_policy_changed_cb callback,
+                                                                                void* user_data,
+                                                                                int* id)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(name, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(callback, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(id, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient& client = GetDevicePolicyClient(handle);
+       int ret = client.subscribeSignal(name, callback, user_data);
+       if (ret < 0) {
+               return -1;
+       }
+
+       *id = ret;
+       return 0;
+}
+
+EXPORT_API int dpm_remove_policy_changed_cb(device_policy_manager_h handle, int id)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(id >= 0, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient& client = GetDevicePolicyClient(handle);
+       return client.unsubscribeSignal(id);
+}
+
+EXPORT_API int dpm_add_signal_cb(device_policy_manager_h handle, const char* signal,
+                                                                dpm_signal_cb callback, void* user_data, int* id)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(signal, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(callback, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(id, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient& context = GetDevicePolicyClient(handle);
+       int ret = context.subscribeSignal(signal, callback, user_data);
+       if (ret < 0) {
+               return -1;
+       }
+
+       *id = ret;
+       return 0;
+}
+
+EXPORT_API int dpm_remove_signal_cb(device_policy_manager_h handle, int id)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(id >= 0, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient& context = GetDevicePolicyClient(handle);
+       return context.unsubscribeSignal(id);
+}
diff --git a/libs/debug.h b/libs/debug.h
new file mode 100644 (file)
index 0000000..8e5ebb4
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ *  Copyright (c) 2015 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
+ */
+
+#ifndef __CAPI_DPM_ASSERT_H__
+#define __CAPI_DPM_ASSERT_H__
+
+#define RET_ON_FAILURE(cond, ret) \
+{                                 \
+       if (!(cond))                  \
+               return (ret);             \
+}
+
+#endif //! __CAPI_DPM_ASSERT_H__
diff --git a/libs/dpm.pc.in b/libs/dpm.pc.in
new file mode 100644 (file)
index 0000000..6ba2138
--- /dev/null
@@ -0,0 +1,12 @@
+# Package Information for pkg-config
+
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=@CMAKE_INSTALL_PREFIX@
+libdir=@LIB_INSTALL_DIR@
+includedir=@INCLUDE_INSTALL_DIR@
+
+Name: dpm
+Description: Tizen Device Policy Client library
+Version: @VERSION@
+Libs: -L${libdir} -ldpm
+Cflags: -I${includedir}/dpm
diff --git a/libs/dpm/administration.h b/libs/dpm/administration.h
new file mode 100644 (file)
index 0000000..2bcaddd
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ *  Copyright (c) 2015 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
+ */
+
+#ifndef __CAPI_ADMINISTRATION_POLICY_H__
+#define __CAPI_ADMINISTRATION_POLICY_H__
+
+#include <sys/types.h>
+
+#include <dpm/device-policy-manager.h>
+
+/**
+ * @file administration.h
+ * @brief This file provides APIs to register/deregister the device admin client
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup  CAPI_DPM_ADMINISTRATION_POLICY_MODULE
+ * @{
+ */
+
+/**
+ * @brief       Registers device policy admin client.
+ * @details     This API is used to register the device policy admin client to
+ *              the device policy manager. The device policy admin client must be
+ *              registered to use the device administration APIs.
+ * @since_tizen 3.0
+ * @param[in]   handle The device policy manager handle
+ * @param[in]   name The name of the device policy admin package
+ * @param[in]   uid The uid of the device policy admin package
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMEOUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid package name
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         handle must be created by dpm_context_create()
+ * @see         dpm_context_acquire_admin_policy()
+ * @see         dpm_context_release_admin_policy()
+ * @see         dpm_admin_deregister_client()
+ */
+int dpm_admin_register_client(device_policy_manager_h handle, const char* name, uid_t uid);
+
+/**
+ * @brief       Deregisters the device policy admin client.
+ * @details     This API is used to deregister the Device Policy Client from
+ *              the device policy manager.
+ * @since_tizen 3.0
+ * @param[in]   handle The device policy manager handle
+ * @param[in]   name The name of the device policy admin package
+ * @param[in]   uid The uid of the device policy admin package
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMEOUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid package name
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         handle must be created by dpm_context_create()
+ * @see         dpm_context_acquire_admin_policy()
+ * @see         dpm_context_release_admin_policy()
+ * @see         dpm_admin_register_client()
+ */
+int dpm_admin_deregister_client(device_policy_manager_h handle, const char* name, uid_t uid);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__CAPI_ADMINISTRATION_POLICY_H__
diff --git a/libs/dpm/application.h b/libs/dpm/application.h
new file mode 100644 (file)
index 0000000..b160ed5
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ *  Copyright (c) 2015 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
+ */
+
+#ifndef __CAPI_APPLICATION_POLICY_H__
+#define __CAPI_APPLICATION_POLICY_H__
+
+#include <dpm/device-policy-manager.h>
+
+/**
+ * @file application.h
+ * @brief This file provides APIs to control application functionality
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup  CAPI_DPM_APPLICATION_POLICY_MODULE
+ * @{
+ */
+
+/**
+ * @brief       Enumeration for installation mode
+ * @since_tizen 3.0
+ */
+typedef enum {
+       DPM_PACKAGE_RESTRICTION_MODE_ALL        = 0x0F, /**< All package restriction mode */
+       DPM_PACKAGE_RESTRICTION_MODE_INSTALL    = 0x01, /**< Package install restriction */
+       DPM_PACKAGE_RESTRICTION_MODE_UNINSTALL  = 0x02, /**< Package uninstall restriction */
+       DPM_PACKAGE_RESTRICTION_MODE_REINSTALL  = 0x04, /**< Package reinstall restriction */
+       DPM_PACKAGE_RESTRICTION_MODE_MOVE       = 0x08  /**< Package move restriction */
+} dpm_package_restriction_mode_e;
+
+/**
+ * @brief       Restricts installation / uninstallation for all packages.
+ * @details     Administrator can use this API to restrict package installation, uninstallation,
+ *              reinstallation or move.
+ * @since_tizen 3.0
+ * @param[in]   handle The device policy manager handle
+ * @param[in]   mode The installation mode to be set, one of DPM_PACKAGE_INSTALLATION_MODE_ALLOW or
+ *              DPM_PACKAGE_INSTALLATION_MODE_DISALLOW
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE No error
+ * @retval      #DPM_ERROR_TIMEOUT Time out
+ * @retval      #DPM_ERROR_ACCESS_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         handle must be created by dpm_context_acquire_application_policy()
+ * @see         dpm_application_unset_mode_restriction()
+ * @see         dpm_application_get_mode_restriction()
+ */
+int dpm_application_set_mode_restriction(device_policy_manager_h handle, int mode);
+
+/**
+ * @brief       Allows installation / uninstallation for all packages.
+ * @details     If the mode is set to DPM_PACKAGE_INSTALLATION_MODE_DISALLOW,
+ *              no application can be installed on the device.
+ * @since_tizen 3.0
+ * @param[in]   handle The device policy manager handle
+ * @param[in]   mode The installation mode to be set, one of DPM_PACKAGE_INSTALLATION_MODE_ALLOW or
+ *              DPM_PACKAGE_INSTALLATION_MODE_DISALLOW
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE No error
+ * @retval      #DPM_ERROR_TIMEOUT Time out
+ * @retval      #DPM_ERROR_ACCESS_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         handle must be created by dpm_context_acquire_application_policy()
+ * @see         dpm_application_set_mode_restriction()
+ * @see         dpm_application_get_mode_restriction()
+ */
+int dpm_application_unset_mode_restriction(device_policy_manager_h handle, int mode);
+
+/**
+ * @brief       Gets the current restriction mode for all packages.
+ * @details     The default mode is to allow any package to be installed.
+ * @since_tizen 3.0
+ * @param[in]   handle The device policy manager handle
+ * @param[out]  mode Current mode of operation, which is one of the following:
+ *              #DPM_PACKAGE_INSTALLATION_MODE_ALLOW Package installation is allowed
+ *              #DPM_PACKAGE_INSTALLATION_MODE_DISALLOW Package installation is not allowed
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMEOUT Time out
+ * @pre         handle must be created by dpm_context_acquire_application_policy()
+ * @see         dpm_application_set_mode_restriction()
+ * @see         dpm_application_unset_mode_restriction()
+ * @see         dpm_application_get_mode_restriction()
+ */
+int dpm_application_get_mode_restriction(device_policy_manager_h handle, int *mode);
+
+/**
+ * @brief       Adds privilege to blacklist
+ * @details     Administrator can use this API to disallow package installation
+ *              which requires the privilege.
+ * @since_tizen 3.0
+ * @param[in]   handle The application policy handle
+ * @param[in]   type The package type
+ * @param[in]   privilehe The privilege name to be blacklisted
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMEOUT Time out
+ * @retval      #DPM_ERROR_ACCESS_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         handle must be created by dpm_context_acquire_application_policy()
+ * @see         dpm_context_acquire_application_policy()
+ * @see         dpm_context_release_application_policy()
+ * @see         dpm_application_remove_privilege_from_blacklist()
+ * @see         dpm_application_check_privilege_is_blacklisted()
+ */
+int dpm_application_add_privilege_to_blacklist(device_policy_manager_h handle, int type, const char* privilege);
+
+/**
+ * @brief       Removes privilege from blacklist
+ * @details     Administrator can use this API to remove privilege from blacklist.
+ * @since_tizen 3.0
+ * @param[in]   handle The application policy handle
+ * @param[in]   type The package type
+ * @param[in]   privilege The privilege name which is removed from blacklist
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMEOUT Time out
+ * @retval      #DPM_ERROR_ACCESS_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         handle must be created by dpm_context_acquire_application_policy()
+ * @see         dpm_context_acquire_application_policy()
+ * @see         dpm_context_release_application_policy()
+ * @see         dpm_application_add_privilege_to_blacklist()
+ * @see         dpm_application_check_privilege_is_blacklisted()
+ */
+int dpm_application_remove_privilege_from_blacklist(device_policy_manager_h handle, int type, const char* privilege);
+
+/**
+ * @brief       Checks whether a privilege is added to blacklist
+ * @details     Administrator can use this API to check whether the privilege is blacklisted.
+ *              Once privilege is added to blacklist, the package which requires the privilege
+ *              is prohibited to install on the device.
+ * @since_tizen 3.0
+ * @param[in]   handle The application policy handle
+ * @param[in]   type The package type
+ * @param[in]   privilege The privilege name
+ * @param[out]  is_blacklisted TRUE if the package installation is disabled, else FALSE
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMEOUT Time out
+ * @pre         handle must be created by dpm_context_acquire_application_policy()
+ * @see         dpm_context_acquire_application_policy()
+ * @see         dpm_context_release_application_policy()
+ * @see         dpm_application_add_privilege_to_blacklist()
+ * @see         dpm_application_remove_privilege_from_blacklist()
+ */
+int dpm_application_check_privilege_is_blacklisted(device_policy_manager_h handle, int type, const char* privilege, int *is_blacklisted);
+
+int dpm_application_install_package(device_policy_manager_h handle, const char* pkgpath);
+int dpm_application_uninstall_package(device_policy_manager_h handle, const char* pkgid);
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //! __CAPI_APPLICATION_POLICY_H__
diff --git a/libs/dpm/bluetooth.h b/libs/dpm/bluetooth.h
new file mode 100644 (file)
index 0000000..04160e5
--- /dev/null
@@ -0,0 +1,193 @@
+/*
+ *  Copyright (c) 2016 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
+ */
+
+#ifndef __CAPI_BLUETOOTH_POLICY_H__
+#define __CAPI_BLUETOOTH_POLICY_H__
+
+#include <dpm/device-policy-manager.h>
+
+/**
+ * @file bluetooth.h
+ * @brief This file provides APIs to control bluetooth functionality such as
+ *        bluetooth device or uuid restriction
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup  CAPI_DPM_BLUETOOTH_POLICY_MODULE
+ * @{
+ */
+
+/**
+ * @brief       Adds MAC address to blacklist
+ * @details     An administrator can use this API to add new MAC address to
+ *              blacklist
+ * @since_tizen 3.0
+ * @param[in]   handle The device policy manager handle
+ * @param[in]   address The MAC address that should be added
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMEOUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         handle must be created by dpm_context_acquire_bluetooth_policy()
+ * @see         dpm_context_acquire_bluetooth_policy()
+ * @see         dpm_context_release_bluetooth_policy()
+ * @see         dpm_bluetooth_remove_device_from_blacklist()
+ */
+int dpm_bluetooth_add_device_to_blacklist(device_policy_manager_h handle, const char* address);
+
+/**
+ * @brief       Removes MAC address from blacklist
+ * @details     An administrator can use this API to remove MAC address from
+ *              blacklist
+ * @since_tizen 3.0
+ * @param[in]   handle The device policy manager handle
+ * @param[in]   address The MAC address that should be removed
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMEOUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         handle must be created by dpm_context_acquire_bluetooth_policy()
+ * @see         dpm_context_acquire_bluetooth_policy()
+ * @see         dpm_context_release_bluetooth_policy()
+ * @see         dpm_bluetooth_add_device_to_blacklist()
+ */
+int dpm_bluetooth_remove_device_from_blacklist(device_policy_manager_h handle, const char* address);
+
+/**
+ * @brief       Enables or disables device restriction of bluetooth
+ * @details     An administrator can use this API to set whether the bluetooth
+ *              is allowed or not by device restriction
+ * @since_tizen 3.0
+ * @param[in]   handle The device policy manager handle
+ * @param[in]   enable If true, enable the bluetooth pairing restriction, if false, allow the bluetooth pairing
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMEOUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         handle must be created by dpm_context_acquire_bluetooth_policy()
+ * @see         dpm_context_acquire_bluetooth_policy()
+ * @see         dpm_context_release_bluetooth_policy()
+ * @see         dpm_bluetooth_is_device_restricted()
+ */
+int dpm_bluetooth_set_device_restriction(device_policy_manager_h handle, int enable);
+
+/**
+ * @brief       Gets the status of the bluetooth's device restriction
+ * @details     An administrator can use this API to get the status of the
+ *              bluetooth's device restriction. The device restricted bluetooth will be worked by MAC
+ *              address blacklist
+ * @since_tizen 3.0
+ * @param[in]   handle The device policy manager handle
+ * @param[out]  is_enabled true if the bluetooth pairing restriction is enabled, else false
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMEOUT Time out
+ * @pre         handle must be created by dpm_context_acquire_bluetooth_policy()
+ * @see         dpm_context_acquire_bluetooth_policy()
+ * @see         dpm_context_release_bluetooth_policy()
+ * @see         dpm_bluetooth_set_device_restriction()
+ */
+int dpm_bluetooth_is_device_restricted(device_policy_manager_h handle, int *is_enabled);
+
+/**
+ * @brief       Adds UUID to blacklist
+ * @details     An administrator can use this API to add new UUID to blacklist
+ * @since_tizen 3.0
+ * @param[in]   handle The device policy manager handle
+ * @param[in]   uuid The UUID that should be added
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMEOUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         handle must be created by dpm_context_acquire_bluetooth_policy()
+ * @see         dpm_context_acquire_bluetooth_policy()
+ * @see         dpm_context_release_bluetooth_policy()
+ * @see         dpm_bluetooth_remove_uuid_from_blacklist()
+ */
+int dpm_bluetooth_add_uuid_to_blacklist(device_policy_manager_h handle, const char* uuid);
+
+/**
+ * @brief       Removes UUID from blacklist
+ * @details     An administrator can use this API to remove UUID from blacklist
+ * @since_tizen 3.0
+ * @param[in]   handle The device policy manager handle
+ * @param[in]   uuid The UUID that should be removed
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMEOUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         handle must be created by dpm_context_acquire_bluetooth_policy()
+ * @see         dpm_context_acquire_bluetooth_policy()
+ * @see         dpm_context_release_bluetooth_policy()
+ * @see         dpm_bluetooth_add_uuid_to_blacklist()
+ */
+int dpm_bluetooth_remove_uuid_from_blacklist(device_policy_manager_h handle, const char* uuid);
+
+/**
+ * @brief       Enables or disables UUID restriction of bluetooth
+ * @details     An administrator can use this API to set whether the bluetooth
+ *              is allowed or not by UUID restriction
+ * @since_tizen 3.0
+ * @param[in]   handle The device policy manager handle
+ * @param[in]   enable If true, enable the bluetooth pairing restriction,
+ *              if false, disable the bluetooth pairing restriction
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMEOUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         handle must be created by dpm_context_acquire_bluetooth_policy()
+ * @see         dpm_context_acquire_bluetooth_policy()
+ * @see         dpm_context_release_bluetooth_policy()
+ * @see         dpm_bluetooth_is_uuid_restricted()
+ */
+int dpm_bluetooth_set_uuid_restriction(device_policy_manager_h handle, int enable);
+
+/**
+ * @brief       Gets the bluetooth's UUID restriction status
+ * @details     An administrator can use this API to get the bluetooth's UUID restriction status
+ *              The UUID restricted bluetooth will be worked by UUID blacklist
+ * @since_tizen 3.0
+ * @param[in]   handle The device policy manager handle
+ * @param[out]  is_enabled true if the bluetooth pairing restriction is enabled, else false
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMEOUT Time out
+ * @pre         handle must be created by dpm_context_acquire_bluetooth_policy()
+ * @see         dpm_context_acquire_bluetooth_policy()
+ * @see         dpm_context_release_bluetooth_policy()
+ * @see         dpm_bluetooth_set_uuid_restriction()
+ */
+int dpm_bluetooth_is_uuid_restricted(device_policy_manager_h handle, int *is_enabled);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //! __CAPI_BLUETOOTH_POLICY_H__
diff --git a/libs/dpm/device-policy-manager.h b/libs/dpm/device-policy-manager.h
new file mode 100644 (file)
index 0000000..774eb84
--- /dev/null
@@ -0,0 +1,217 @@
+/*
+ *  Copyright (c) 2015 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
+ */
+
+#ifndef __DEVICE_POLICY_MANAGER_H__
+#define __DEVICE_POLICY_MANAGER_H__
+
+#include <tizen.h>
+#include <tizen_type.h>
+
+/**
+ * @file device-policy-manager.h
+ * @brief This file defines common data types required to device policy APIs.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup  CAPI_DPM_MANAGER_MODULE
+ * @{
+ */
+
+/**
+ * @brief       Called when a policy is changed.
+ * @since_tizen 3.0
+ * @param[in]   name The name of the policy
+ * @param[in]   state The current state of the policy
+ * @param[in]   user_data The user data passed from dpm_manager_add_policy_changed_cb
+ * @see         dpm_manager_add_policy_changed_cb()
+ * @see         dpm_manager_remove_policy_changed_cb()
+ */
+typedef void (*dpm_policy_changed_cb)(const char* name, const char* state, void *user_data);
+
+/**
+ * @brief       The device policy manager handle
+ * @details     The device policy manager handle is an abstraction of the
+ *              logical connection between the device policy manager and
+ *              it's client. The device policy manager handle must be
+ *              created by using dpm_manager_create() before attempting to
+ *              use almost any of the device policy APIs, and it should
+ *              be freed when interaction with the device policy manager
+ *              is no longer required.
+ *              To release the handle, use dpm_manager_destroy().
+ * @since_tizen 3.0
+ * @see         dpm_manager_create()
+ * @see         dpm_manager_destroy()
+ */
+typedef void* device_policy_manager_h;
+
+/**
+ * @brief       Enumeration of device policy API errors
+ * @since_tizen 3.0
+ */
+typedef enum {
+       DPM_ERROR_NONE                 = TIZEN_ERROR_NONE,                 /**< The operation was successful */
+       DPM_ERROR_INVALID_PARAMETER    = TIZEN_ERROR_INVALID_PARAMETER,    /**< Invalid parameter */
+       DPM_ERROR_CONNECTION_REFUSED   = TIZEN_ERROR_CONNECTION_REFUSED,   /**< Connection refused */
+       DPM_ERROR_TIMED_OUT            = TIZEN_ERROR_TIMED_OUT,            /**< Time out */
+       DPM_ERROR_PERMISSION_DENIED    = TIZEN_ERROR_PERMISSION_DENIED,    /**< Access privilege is not sufficient */
+       DPM_ERROR_NOT_PERMITTED        = TIZEN_ERROR_NOT_PERMITTED,        /**< Operation not permitted */
+       DPM_ERROR_FILE_EXISTS          = TIZEN_ERROR_FILE_EXISTS,          /**< File exists */
+       DPM_ERROR_OUT_OF_MEMORY        = TIZEN_ERROR_OUT_OF_MEMORY,        /**< Out of memory */
+       DPM_ERROR_NO_DATA              = TIZEN_ERROR_NO_DATA               /**< No Data */
+} dpm_error_type_e;
+
+/**
+ * @brief       Creates the device policy manager handle.
+ * @details     This API creates device policy manager handle required to
+ *              the device policy APIs.
+ *              This API is also used to verify whether caller is authorized
+ *              or not.
+ * @since_tizen 3.0
+ * @return      Device policy manager handle on success, otherwise NULL
+ * @remarks      The specific error code can be obtained by using the
+ *              get_last_result() method. Error codes are described in
+ *              exception section.
+ *              The returned handle should be released using dpm_manager_destroy().
+ * @exception   #DPM_ERROR_NONE No error
+ * @exception   #DPM_ERROR_CONNECTION_REFUSED Connection refused
+ * @exception   #DPM_ERROR_OUT_OF_MEMORY Out of memory
+ * @see         dpm_manager_destroy()
+ * @see         get_last_result()
+ */
+device_policy_manager_h dpm_manager_create(void);
+
+/**
+ * @brief       Releases the device policy manager handle.
+ * @details     This API must be called if interaction with the device
+ *              policy manager is no longer required.
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_manager_destroy(device_policy_manager_h handle);
+
+/**
+ * @brief       Adds policy change callback to the device policy
+ *              manager.
+ * @details     This API can be used to subscribe policy change callback.
+ *              The callback specified to this API is asynchronously called when
+ *              policy is changed on runtime.
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   name Policy name to subscribe(see @ref CAPI_SECURITY_DPM_MODULE_POLICY)
+ * @param[in]   callback The callback when policy is changed
+ * @param[in]   user_data User specified data passed to the callback
+ * @param[out]  id Policy change callback identifier
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @remark      See @ref CAPI_SECURITY_DPM_MODULE_POLICY section for available policy name
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_remove_policy_changed_cb()
+ */
+int dpm_add_policy_changed_cb(device_policy_manager_h handle,
+                                                         const char* name,
+                                                         dpm_policy_changed_cb callback,
+                                                         void* user_data,
+                                                         int* id);
+/**
+ * @brief       Removes policy change callback from the device policy
+ *              manager.
+ * @details     This API should be called if policy change subscription is no longer
+ *              required.
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   id Policy change callback identifier
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @pre         The handle must be created by dpm_manager_create().
+ * @pre         The callback identifier must be created by dpm_manager_add_policy_changed_cb().
+ * @see         dpm_manager_create()
+ * @see         dpm_add_policy_changed_cb()
+ */
+int dpm_remove_policy_changed_cb(device_policy_manager_h handle, int id);
+/**
+ * @brief       Called when a zone raises a signal.
+ * @since_tizen 3.0
+ * @param[in]   name The zone name
+ * @param[in]   object The object name triggered the signal
+ * @param[in]   user_data The user data passed from dpm_zone_add_signal_cb
+ * @see         dpm_zone_add_signal_cb()
+ * @see         dpm_zone_remove_signal_cb()
+ */
+typedef void(*dpm_signal_cb)(const char* name, const char* object, void *user_data);
+
+/**
+ * @brief       Adds signal callback.
+ * @details     This API can be used to receive signals raised by the device policy manager.
+ *              The callback specified to this function is automatically called when
+ *              the device policy manager raises signal.
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   signal The signal name to receive(see @ref CAPI_DPM_SECURITY_MODULE_SIGNAL)
+ * @param[in]   callback The signal callback
+ * @param[in]   user_data The user data passed to the callback function
+ * @param[out]  id Signal identifier
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @remark      See @ref CAPI_DPM_SECURITY_MODULE_SIGNAL section for signals
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_manager_destroy()
+ * @see         dpm_remove_signal_cb()
+ */
+int dpm_add_signal_cb(device_policy_manager_h handle, const char* signal,
+                                         dpm_signal_cb callback, void* user_data, int* id);
+
+/**
+ * @brief       Removes signal callback.
+ * @details     This API removes signal callback.
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   id Signal identifier
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @pre         The context must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_manager_destroy()
+ * @see         dpm_add_signal_cb()
+ */
+int dpm_remove_signal_cb(device_policy_manager_h handle, int id);
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __DEVICE_POLICY_MANAGER_H__ */
diff --git a/libs/dpm/password.h b/libs/dpm/password.h
new file mode 100644 (file)
index 0000000..acd77e9
--- /dev/null
@@ -0,0 +1,732 @@
+/*
+ *  Copyright (c) 2015 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
+ */
+
+#ifndef __CAPI_PASSWORD_POLICY_H__
+#define __CAPI_PASSWORD_POLICY_H__
+
+#include <dpm/device-policy-manager.h>
+
+/**
+ * @file password.h
+ * @brief This file provides APIs to control password functionality
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup  CAPI_DPM_PASSWORD_POLICY_MODULE
+ * @{
+ */
+
+/**
+ * @brief       Enumeration for dpm password quality type
+ * @since_tizen 3.0
+ */
+typedef enum {
+       DPM_PASSWORD_QUALITY_UNSPECIFIED     = 0x00,    /**< No requirements for password. */
+       DPM_PASSWORD_QUALITY_SIMPLE_PASSWORD = 0x01,    /**< EAS(Exchange ActiveSync) requirement for simple password */
+       DPM_PASSWORD_QUALITY_SOMETHING       = 0x10,    /**< Some kind password is required, but doesn't care what it is */
+       DPM_PASSWORD_QUALITY_NUMERIC         = 0x20,    /**< Containing at least numeric characters */
+       DPM_PASSWORD_QUALITY_ALPHABETIC      = 0x40,    /**< Containing at least alphabetic (or other symbol) characters */
+       DPM_PASSWORD_QUALITY_ALPHANUMERIC    = 0x80,    /**< Containing at least numeric and alphabetic characters */
+} dpm_password_quality_e;
+
+/**
+ * @brief       Enumeration for dpm password status type
+ * @since_tizen 3.0
+ */
+typedef enum {
+       DPM_PASSWORD_STATUS_NORMAL,                     /**< Password normal status */
+       DPM_PASSWORD_STATUS_CHANGED,                    /**< Password successfully changed */
+       DPM_PASSWORD_STATUS_NOT_CHANGED,                /**< Password not changed */
+       DPM_PASSWORD_STATUS_CHANGE_REQUIRED ,           /**< Password change required */
+       DPM_PASSWORD_STATUS_MAX_ATTEMPTS_EXCEEDED,      /**< Password Max Attempts Exceeded*/
+
+       DPM_PASSWORD_STATUS_EXPIRED,                    /**< Password expired */
+       DPM_PASSWORD_STATUS_RECOVERY_PASSWORD_FAILED,   /**< Device unlock failed by Password Recovery */
+       DPM_PASSWORD_STATUS_RECOVERY_PASSWORD_SUCCEEDED,/**< Device unlock succeeded by Password Recovery */
+
+       DPM_PASSWORD_STATUS_QUALITY_CHANGED,            /**< Password quality successfully changed */
+       DPM_PASSWORD_STATUS_MIN_LENGTH_CHANGED,         /**< Password min_length successfully changed */
+       DPM_PASSWORD_STATUS_COMPLEX_CHAR_CHANGED,       /**< Password complex_char successfully changed */
+       DPM_PASSWORD_STATUS_PATTERN_CHANGED             /**< Password pattern successfully changed */
+} dpm_password_status_e;
+
+/**
+ * @partner
+ * @brief       Sets password quality.
+ * @details     An administrator can set the password restrictions it is imposing.
+ *              After setting this, the user will not be able to
+ *              enter a new password that is not at least as restrictive as what has been set.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   quality Password quality type, values of #dpm_password_quality_e combined with bitwise 'or'
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_set_quality(device_policy_manager_h handle, int quality);
+
+/**
+ * @partner
+ * @brief       Gets password quality.
+ * @details     An administrator can get the password restrictions it is imposing.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   handle Device policy manager handle
+ * @param[out]   quality Password quality type, values of #dpm_password_quality_e combined with bitwise 'or'
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_get_quality(device_policy_manager_h handle, int *quality);
+
+/**
+ * @partner
+ * @brief       Sets password minimum length.
+ * @details     Sets the minimum allowed password length. After setting this,
+ *              the user will not be able to enter a new password that is
+ *              shorter than the setting length.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   value Allowed minimum password length
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_set_minimum_length(device_policy_manager_h handle, int value);
+
+/**
+ * @partner
+ * @brief       Gets password minimum length.
+ * @details     Gets the minimum allowed password length.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   handle Device policy manager handle
+ * @param[out]   value Allowed minimum password length
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_get_minimum_length(device_policy_manager_h handle, int *value);
+
+/**
+ * @partner
+ * @brief       Sets minimum complex char in password.
+ * @details     Complex characters are all non-alphabetic characters;
+ *              that is, numbers and symbols. Admin can configure this
+ *              setting and make the password more secure.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   value Number of minimum complex char in password.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_set_min_complex_chars(device_policy_manager_h handle, int value);
+
+/**
+ * @partner
+ * @brief       Gets minimum complex char in password.
+ * @details     Complex characters are all non-alphabetic characters;
+ *              that is, numbers and symbols.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   handle Device policy manager handle
+ * @param[out]   value Number of minimum complex char in password.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_get_min_complex_chars(device_policy_manager_h handle, int *value);
+
+/**
+ * @partner
+ * @brief       Sets maximum number of failed attempts before device is wiped.
+ * @details     If user fails the last attempt, device will be wiped.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   value Maximum count for failed passwords.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_set_maximum_failed_attempts_for_wipe(device_policy_manager_h handle, int value);
+
+/**
+ * @partner
+ * @brief       Gets maximum number of failed attempts before device is wiped.
+ * @details     If user fails the last attempt, device will be wiped.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   handle Device policy manager handle
+ * @param[out]   value Maximum count for failed passwords.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_get_maximum_failed_attempts_for_wipe(device_policy_manager_h handle, int *value);
+
+/**
+ * @partner
+ * @brief       Sets the number of days password expires.
+ * @details     An administrator can configure the password age to force
+ *              the user to enter a new password after every expiration period.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   value Number of days after which the password expires.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_set_expires(device_policy_manager_h handle, int value);
+
+/**
+ * @partner
+ * @brief       Gets the number of days password expires.
+ * @details     An administrator can get the password age to force
+ *              the user to enter a new password after every expiration period.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   handle Device policy manager handle
+ * @param[out]   value Number of days after which the password expires.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_get_expires(device_policy_manager_h handle, int *value);
+
+/**
+ * @partner
+ * @brief       Sets the number of min password history to avoid previous password.
+ * @details     An administrator can configure the number of previous
+ *              passwords which cannot be used when entering a new password.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   value Number of previous passwords which cannot be used when
+ *              settings a new password.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_set_history(device_policy_manager_h handle, int value);
+
+/**
+ * @partner
+ * @brief       Gets the number of min password history to avoid previous password.
+ * @details     An administrator can get the number of previous
+ *              passwords which cannot be used when entering a new password.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   handle Device policy manager handle
+ * @param[out]   value Number of previous passwords which cannot be used when
+ *              settings a new password.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_get_history(device_policy_manager_h handle, int *value);
+
+/**
+ * @partner
+ * @brief       Sets the required password pattern.
+ * @details     An administrator can force User to enter password based on
+ *              a regular expression.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   pattern Password pattern. If regular expression is
+ *              [a-zA-Z]{4}[0-9]{4}, we can force user to enter a 8 character
+ *              password with first 4 alphabetic characters and next 4
+ *              numeric characters. An administrator must take care when
+ *              setting this pattern.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_set_pattern(device_policy_manager_h handle, const char *pattern);
+
+/**
+ * @partner
+ * @brief       Resets password.
+ * @details     This takes effect immediately to the device password.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   password New password
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_reset(device_policy_manager_h handle, const char *password);
+
+/**
+ * @partner
+ * @brief       Enforces password change.
+ * @details     An administrator can enforce password change. PasswordPolicy
+ *              change setting is launched.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   handle Device policy manager handle
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_enforce_change(device_policy_manager_h handle);
+
+/**
+ * @partner
+ * @brief       Sets the maximum number of seconds of inactivity time
+ *              before the screen timeout occurs.
+ * @details     An administrator sets the maximum number of seconds of inactivity
+ *              time before the screen timeout occurs and a device user must
+ *              type the password to unlock the device.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   value Maximum inactivity time for device lock. Specifies how soon
+ *              the device can be unlocked again after use, without reprompting for
+ *              the passcode.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_set_max_inactivity_time_device_lock(device_policy_manager_h handle, int value);
+
+/**
+ * @partner
+ * @brief       Gets the maximum number of seconds of inactivity time
+ *              before the screen timeout occurs.
+ * @details     Called by an application that is managing the device to get
+ *              the value of timeout period.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   handle Device policy manager handle
+ * @param[out]  value Pointer of Maximum inactivity time for device lock.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_get_max_inactivity_time_device_lock(device_policy_manager_h handle, int *value);
+
+/**
+ * @partner
+ * @brief       Sets password status
+ * @details     An administrator can know password status for this API.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   status Password status
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_set_status(device_policy_manager_h handle, dpm_password_status_e status);
+
+/**
+ * @partner
+ * @brief       Gets password status
+ * @details     An administrator can know password status for this API.
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @param[out]   status Password status
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_get_status(device_policy_manager_h handle, dpm_password_status_e *status);
+
+
+/**
+ * @partner
+ * @brief       Removes all password patterns.
+ * @details     An administrator can remove all password patterns.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   handle Device policy manager handle
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_delete_pattern(device_policy_manager_h handle);
+
+/**
+ * @partner
+ * @brief       Gets password pattern.
+ * @details     This API can be used for applying complexity on new password value.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @remarks     The @a pattern should be freed using free().
+ * @param[in]   handle Device policy manager handle
+ * @param[out]  pattern Password pattern
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_get_pattern(device_policy_manager_h handle, char **pattern);
+
+/**
+ * @partner
+ * @brief       Sets the maximum number of times a character can occur in
+ *              the device password.
+ * @details     Called by an admin that is managing the device to specify that
+ *              any character in the device password cannot occur more than
+ *              the specified maximum number of times. Characters can be numeric
+ *              or alphabetic or symbolic. "aaabcde" has 'a' which occurs 3 times,
+ *              "1b1c1de" has '1' which occurs 3 times and "a@b@c@" has '@' which
+ *              occurs 3 times. A value of '0' specifies that no restrictions are
+ *              applied.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   value Maximum character occurrences
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_set_maximum_character_occurrences(device_policy_manager_h handle, int value);
+
+/**
+ * @partner
+ * @brief       Gets the maximum number of times a character can occur in
+ *              the device password.
+ * @details     An administrator can retrieve the maximum number of times
+ *              a character can occur in the device password. If more than
+ *              one admin has set this value then the least value will take
+ *              preference.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   handle Device policy manager handle
+ * @param[out]   value Pointer of Maximum Character Occurrences
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_get_maximum_character_occurrences(device_policy_manager_h handle, int *value);
+
+/**
+ * @partner
+ * @brief       Sets the maximum length of the numeric sequence
+ *              which is allowed in the device password.
+ * @details     Called by an administrator that is managing the device to set
+ *              the maximum numeric sequence length. This specifies that
+ *              the device password must not contain numeric sequences greater
+ *              than the given length.
+ *              Numeric sequences can be increasing successively by one like
+ *              "12345", or decreasing successively by one like "98765", or
+ *              repeating like "55555".
+ *              These are all numeric sequences of length '5'.
+ *              If maximum value is set to '5' then "123456" or "987654" or
+ *              "555555" are not allowed.
+ *              A value of '0' specifies that no such numeric sequence
+ *              restrictions are applied.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   value Maximum numeric sequence length
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_set_maximum_numeric_sequence_length(device_policy_manager_h handle, int value);
+
+/**
+ * @partner
+ * @brief       Gets the maximum numeric sequence length allowed in
+ *              the device password.
+ * @details     An administrator can retrieve the length of numeric sequences
+ *              which are allowed in the device password.
+ *              For instance, if the return value is '3' then "123", "987",
+ *              "555" would all be numeric sequences of length '3' and will be
+ *              allowed in the device password.
+ *              If more than one admin has set this value then the least value
+ *              will take preference.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   handle Device policy manager handle
+ * @param[out]  value Pointer of maximum numeric sequence length
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_get_maximum_numeric_sequence_length(device_policy_manager_h handle, int *value);
+
+/**
+ * @brief       The password forbidden string list iterator handle
+ * @since_tizen 3.0
+ * @see         dpm_password_create_iterator()
+ * @see         dpm_password_iterator_next()
+ * @see         dpm_password_destroy_iterator()
+ */
+typedef void *dpm_password_iterator_h;
+
+/**
+ * @partner
+ * @brief       Creates a password forbidden string list iterator.
+ * @details     The password forbidden string list iterator can be used to get all forbidden strings.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   handle Device policy manager handle
+ * @return      A password forbidden string list iterator on success, otherwise
+ *              null value
+ * @remarks     The specific error code can be obtained by using the
+ *              get_last_result() method. Error codes are described in
+ *              exception section.
+ *              The returned iterator should be released using dpm_password_destroy_iterator().
+ * @exception   #DPM_ERROR_NONE No error
+ * @exception   #DPM_ERROR_OUT_OF_MEMORY Out of memory
+ * @exception   #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception   #DPM_ERROR_TIMED_OUT Time out
+ * @exception   #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_password_iterator_next()
+ * @see         dpm_password_destroy_iterator()
+ * @see         get_last_result()
+ */
+dpm_password_iterator_h dpm_password_create_iterator(device_policy_manager_h handle);
+
+/**
+ * @partner
+ * @brief       Fetches a password forbidden string and forwards the iterator.
+ * @details     This API returns a password forbidden string indicated by the iterator, and then
+ *              the iterator is moved to the next position. If the iterator reaches
+ *              the end of the list, null value will be returned.
+ * @since_tizen 3.0
+ * @param[in]   iter The iterator to be controlled
+ * @param[out]  forbidden_string The forbidden string got from the iterator
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @remarks     The @a forbidden_string should not be freed using free().
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @pre         The iter must be created by dpm_password_create_iterator().
+ * @see         dpm_passsword_create_iterator()
+ * @see         dpm_password_destroy_iterator()
+ */
+int dpm_password_iterator_next(dpm_password_iterator_h iter, const char **forbidden_string);
+
+/**
+ * @partner
+ * @brief       Frees the password forbidden string iterator.
+ * @details     This API frees the password forbidden string iterator. This API must be called
+ *              if the iterator no longer used.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   iter The iterator to be removed
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The iter must be created by dpm_password_create_iterator()
+ * @see         dpm_password_create_iterator()
+ * @see         dpm_password_iterator_next()
+ */
+int dpm_password_destroy_iterator(dpm_password_iterator_h iter);
+
+/**
+ * @partner
+ * @brief       Sets strings which are forbidden in the device password.
+ * @details     Called by an admin that is managing the device to set strings that are forbidden to be used in the device password.
+ *              This specifies any strings which must not be present in the device password such as personal data (variations on the user's name, email address or X400 address), or any other strings.
+ *              If the parameter list has only one blank string(""), then the stored strings are cleared.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.password
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   strings The forbidden strings
+ * @param[in]   length The length of the strings
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_password_set_forbidden_strings(device_policy_manager_h handle, const char *strings[], int length);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*  __CAPI_PASSWORD_POLICY_H__ */
diff --git a/libs/dpm/password_internal.h b/libs/dpm/password_internal.h
new file mode 100644 (file)
index 0000000..a02274d
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ *  Copyright (c) 2015 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
+ */
+
+#ifndef __CAPI_PASSWORD_INTERNAL_POLICY_H__
+#define __CAPI_PASSWORD_INTERNAL_POLICY_H__
+
+#include <dpm/device-policy-manager.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int dpm_password_set_recovery(device_policy_manager_h handle, int enable);
+int dpm_password_get_recovery(device_policy_manager_h handle, int *enable);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*  __CAPI_PASSWORD_INTERNAL_POLICY_H__ */
+
diff --git a/libs/dpm/restriction.h b/libs/dpm/restriction.h
new file mode 100644 (file)
index 0000000..9262341
--- /dev/null
@@ -0,0 +1,696 @@
+/*
+ *  Copyright (c) 2016 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
+ */
+
+#ifndef __CAPI_RESTRICTION_POLICY_H__
+#define __CAPI_RESTRICTION_POLICY_H__
+
+#include <dpm/device-policy-manager.h>
+
+/**
+ * @file restriction.h
+ * @brief This file provides APIs to control restriction functionality.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup  CAPI_DPM_RESTRICTION_POLICY_MODULE
+ * @{
+ */
+
+/**
+ * @partner
+ * @brief       Allows or disallows the use of camera.
+ * @details     An administrator can use this API to set whether the use of camera
+ *              is allowed or not.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.camera
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   allow If true, allow the use of camera, if false, disallow the use of camera
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_restriction_get_camera_state()
+ */
+int dpm_restriction_set_camera_state(device_policy_manager_h handle, int allow);
+
+/**
+ * @brief       Check whether the use of camera is allowed or not.
+ * @details     An administrator can use this API to check whether the use of camera
+ *              is allowed or not.
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @param[out]  is_allowed true if the use of camera is allowed, false otherwise.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_restriction_set_camera_state()
+ */
+int dpm_restriction_get_camera_state(device_policy_manager_h handle, int *is_allowed);
+
+/**
+ * @partner
+ * @brief       Allows or disallows the use of microphone.
+ * @details     An administrator can use this API to set whether the use of microphone
+ *              is allowed or not.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.microphone
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   allow If true, allow the use of microphone,
+ *              if false, disallow the use of microphone
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_restriction_get_microphone_state()
+ */
+int dpm_restriction_set_microphone_state(device_policy_manager_h handle, int allow);
+
+/**
+ * @brief       Checks whether the use of microphone is allowed or not.
+ * @details     An administrator can use this API to check whether the use of microphone
+ *              is allowed of not.
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @param[out]  is_allowed true if the use of microphone is allowed, false otherwise.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_restriction_set_microphone_state()
+ */
+int dpm_restriction_get_microphone_state(device_policy_manager_h handle, int *is_allowed);
+
+/**
+ * @partner
+ * @brief       Allows or disallows user to change the location state.
+ * @details     An administrator can use this API to allow or disallow user to change
+ *              the location state.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.location
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   allow If true, allow user to change the location state, if false, disallow
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_restriction_get_location_state()
+ */
+int dpm_restriction_set_location_state(device_policy_manager_h handle, int allow);
+
+/**
+ * @brief       Check whether user is allowed to change location state or not.
+ * @details     An administrator can use this API to check whether user is allowed to change
+ *              the location state or not.
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @param[out]  is_allowed true if the location state change is allowed, false otherwise.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_restriction_set_location_state()
+ */
+int dpm_restriction_get_location_state(device_policy_manager_h handle, int *is_allowed);
+
+/**
+ * @partner
+ * @brief       Allows or disallows user to use usb mass storage.
+ * @details     An administrator can use this API to set whether the usb mass
+ *              storage is allowed or not.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.storage
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   allow If true, allow user to use the external storages, if false, disallow
+ *              the external storage
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_storage_get_external_storage_state()
+ */
+int dpm_restriction_set_external_storage_state(device_policy_manager_h handle, int allow);
+
+/**
+ * @brief       Checks whether the use of external storage is allowed or not.
+ * @details     An administrator can use this API to check whether the use of external storage is
+ *              allowed or not.
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @param[out]  is_allowed true if the use of external storage is allowed, false otherwise.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_storage_set_external_storage_state()
+ */
+int dpm_restriction_get_external_storage_state(device_policy_manager_h handle, int *is_allowed);
+
+/**
+ * @partner
+ * @brief       Allows or disallows user to access the clipboard.
+ * @details     An administrator can use this API to set whether the clipboard access.
+ *              is allowed or not
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.clipboard
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   allow If true, allow the clipboard access, if false, disallow the clipboard access.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_restriction_get_clipboard_state()
+ */
+int dpm_restriction_set_clipboard_state(device_policy_manager_h handle, int allow);
+
+/**
+ * @brief       Checks whether the clipboard access is allowed or not.
+ * @details     An administrator can use this API to check whether the clipboard access
+ *              is allowed or not.
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @param[out]  is_allowed true if the access is allowed, false otherwise.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_restriction_set_clipboard_state()
+ */
+int dpm_restriction_get_clipboard_state(device_policy_manager_h handle, int *is_allowed);
+
+/**
+ * @partner
+ * @brief       Allows or disallows the usb debugging.
+ * @details     An administrator can use this API to set whether the usb debugging
+ *              is allowed or not.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.debugging
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   allow If true, allow the usb debugging, if false, disallow the usb
+ *              debugging
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_restriction_get_usb_debugging_state()
+ */
+int dpm_restriction_set_usb_debugging_state(device_policy_manager_h handle, int allow);
+
+/**
+ * @brief       Checks whether the usb debugging is allowed or not.
+ * @details     An administrator can use this API to check whether the usb debugging
+ *              is allowed or not.
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @param[out]   is_allowed true if the usb debugging is allowed, false otherwise.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_restriction_set_usb_debugging_state()
+ */
+int dpm_restriction_get_usb_debugging_state(device_policy_manager_h handle, int *is_allowed);
+
+/**
+ * @partner
+ * @brief       Allows or disallows user to change the Wi-Fi state.
+ * @details     An administrator can use this API to allow or disallow user to
+ *              change the Wi-Fi state. If it is disallowed, user does not have UI
+ *              access to change the state.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.wifi
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   allow If true, allow user to change Wi-Fi state,
+ *              if false, disallow user to change Wi-Fi state.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_restriction_get_wifi_state()
+ */
+int dpm_restriction_set_wifi_state(device_policy_manager_h handle, int allow);
+
+/**
+ * @brief       Checks whether the Wi-Fi state change is allowed or not.
+ * @details     An administrator can use this API to check whether user is
+ *              allowed to change Wi-Fi state or not.
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @param[out]  is_allowed true if the change is allowed, false otherwise.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_restriction_set_wifi_state()
+ */
+int dpm_restriction_get_wifi_state(device_policy_manager_h handle, int *is_allowed);
+
+/**
+ * @partner
+ * @brief       Allows or disallows user to change Wi-Fi hotspot state change.
+ * @details     An administrator can use this API to allow or disallow user to change Wi-Fi
+ *              hotspot state. When it is disallowed, the UI is grayed out so user cannot
+ *              change Wi-Fi hotspot state.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.wifi
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   allow If true, allow user to change Wi-Fi hostspot state,
+ *              if false, disallow user to change Wi-Fi hotspot state.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_restriction_get_wifi_hotspot_state()
+ */
+int dpm_restriction_set_wifi_hotspot_state(device_policy_manager_h handle, int allow);
+
+/**
+ * @brief       Checks whether the the Wi-Fi hotspot state change is allowed or not.
+ * @details     An administrator can use this API to check whether user is allowed to change
+ *              Wi-Fi hotspot state or not.
+ *              If the Wi-Fi hotspot state change is disallowed, the UI is grayed out so user can not
+ *              change its state.
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @param[out]  is_allowed true if the state change is allowed, false otherwise.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_restriction_set_wifi_hotspot_state()
+ */
+int dpm_restriction_get_wifi_hotspot_state(device_policy_manager_h handle, int *is_allowed);
+
+/**
+ * @partner
+ * @brief       Allows or disallows user to change the bluetooth tethering state.
+ * @details     An administrator can use this API to allow of disallow user
+ *              to chanage the bluetooth tethering state.
+ *              When disallowed, the UI is grayed out so user cannot change the state.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.bluetooth
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   allow If true, allow user to change the bluetooth tethering state,
+ *              if false, disallow user to change the bluetooth tethering state.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_restriction_get_bluetooth_tethering_state()
+ */
+int dpm_restriction_set_bluetooth_tethering_state(device_policy_manager_h handle, int allow);
+
+/**
+ * @brief       Checks whether the bluetooth tethering state change is allowed.
+ * @details     An administrator can use this API to check whether user is allowed
+ *              to change bluetooth tethering state.
+ *              is allowed or not.
+ *              If the bluetooth tethering state change is disallowed, the UI is grayed out
+ *              so user can not change its state.
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @param[out]  is_allowed true if the change is allowed, false otherwise.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_restriction_set_bluetooth_tethering_state()
+ */
+int dpm_restriction_get_bluetooth_tethering_state(device_policy_manager_h handle, int *is_allowed);
+
+/**
+ * @partner
+ * @brief       Allows or disallows user to change USB tethering settings.
+ * @details     An administrator can use this API to allow or disallow user
+ *              to change USB tethering settings.
+ *              When disallowed, the UI is grayed out so user cannot change the state.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.usb
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   allow If true, allow USB tethering state change,
+ *              if false, disallow USB tethering state change.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_restriction_get_usb_tethering_state()
+ */
+int dpm_restriction_set_usb_tethering_state(device_policy_manager_h handle, int allow);
+
+/**
+ * @brief       Checks whether the USB tethering state change is allowed.
+ * @details     An administrator can use this API to check whether the USB tethering state change
+ *              is allowed or not.
+ *              If the USB tethering state change is disallowed, the UI is grayed out
+ *              so user can not change its state.
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @param[out]  is_allowed true if the change is allowed, false otherwise.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_restriction_set_usb_tethering_state()
+ */
+int dpm_restriction_get_usb_tethering_state(device_policy_manager_h handle, int *is_allowed);
+
+/**
+ * @partner
+ * @brief       Allows or disallows user to change the bluetooth state.
+ * @details     An administrator can use this API to allow or disallow user
+ *              to change the bluetooth state.
+ *              When disallowed, the UI is grayed out so user cannot change the state.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.bluetooth
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   allow If true, allow user to change bluetooth state,
+ *              if false, disallow user to change bluetooth state.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_restriction_get_bluetooth_mode_change_state()
+ */
+int dpm_restriction_set_bluetooth_mode_change_state(device_policy_manager_h handle, int allow);
+
+/**
+ * @brief       Checks whether the the bluetooth state change is allowed of not.
+ * @details     An administrator can use this API to check whether the bluetooth state change
+ *              is allowed or not.
+ *              If the bluetooth state change is disallowed, the UI is grayed out
+ *              so user can not change its state.
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @param[out]  is_allowed true if the change is allowed, false otherwise.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_restriction_set_bluetooth_mode_change_state()
+ */
+int dpm_restriction_get_bluetooth_mode_change_state(device_policy_manager_h handle, int *is_allowed);
+
+/**
+ * @partner
+ * @brief       Allows or disallows the bluetooth desktop connectivity.
+ * @details     An administrator can use this API to allow or disallow the bluetooth
+ *              desktop connectivity.
+ *              If the bluetooth desktop connectivity is disallowed, the UI is grayed out
+ *              so user can not
+ *              change its state.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.bluetooth
+ * @param[in]   handle Device policy manager handle
+ * @param[out]  allow If true, allow the bluetooth desktop connectivity,
+ *              if false, disallow the bluetooth desktop connectivitiy
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_restriction_get_bluetooth_desktop_connectivity_state()
+ */
+int dpm_restriction_set_bluetooth_desktop_connectivity_state(device_policy_manager_h handle, int allow);
+
+/**
+ * @brief       Checks whether the the Bluetooth desktop connectivity is allowed or not.
+ * @details     An administrator can use this API to check whether the Bluetooth desktop
+ *              connectivity is allowed or not.
+ *              If the Bluetooth desktop connectivity is disallowed, the UI is grayed out
+ *              so user can not change its state.
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @param[out]  is_allowed true if the connectivity is allowed, false otherwise.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_restriction_set_bluetooth_desktop_connectivity_state()
+ */
+int dpm_restriction_get_bluetooth_desktop_connectivity_state(device_policy_manager_h handle, int *is_allowed);
+
+/**
+ * @partner
+ * @brief       Allows or disallows user to change the bluetooth pairing.
+ * @details     An administrator can use this API to allow or disallow the bluetooth pairing.
+ *              If the bluetooth pairing is disallowed, the UI is grayed out
+ *              so user can not change its state.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.bluetooth
+ * @param[in]   handle Device policy manager handle
+ * @param[out]  allow If true, allow the bluetooth pairing, if false, disallow the bluetooth pairing.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_restriction_get_bluetooth_pairing_state()
+ */
+int dpm_restriction_set_bluetooth_pairing_state(device_policy_manager_h handle, int allow);
+
+/**
+ * @brief       Checks whether the the bluetooth pairing is allowed or not.
+ * @details     An administrator can use this API to check whether the bluetooth
+ *              pairing is allowed or not.
+ *              If the bluetooth pairing is disallowed, the UI is grayed out
+ *              so user can not change its state.
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @param[out]  is_allowed true if the pairing is allowed, false otherwise.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_restriction_set_bluetooth_pairing_state()
+ */
+int dpm_restriction_get_bluetooth_pairing_state(device_policy_manager_h handle, int *is_allowed);
+
+/**
+ * @partner
+ * @brief       Allows or disallows user to use of SMS or text messaging.
+ * @details     An administrator can disable the text messaging capability
+ *              without any user interaction
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.message
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   sim_id SIM identifier
+ * @param[in]   allow If true, allow the use of SMS or text messaging,
+ *              if false, disallow the use of SMS or text messaging.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_restriction_get_messaging_state()
+ */
+int dpm_restriction_set_messaging_state(device_policy_manager_h handle, const char *sim_id, int allow);
+
+/**
+ * @brief       Checks whether the text messaging is allowed or not.
+ * @details     An administrator can use this API to check whether text messaging capability
+ *              is enabled or not.
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   sim_id SIM identifier
+ * @param[out]  is_allowed true if the messaging is allowed, false otherwise.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_restriction_set_messaging_state()
+ */
+int dpm_restriction_get_messaging_state(device_policy_manager_h handle, const char *sim_id, int *is_allowed);
+
+/**
+ * @partner
+ * @brief       Allows or disallows the access to POP or IMAP email.
+ * @details     An administrator can disable the email capability without any user interaction
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.email
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   allow If ture, allow POP or IMAP email, if false, disallow POP or IMAP email.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_restriction_get_popimap_email_state()
+ */
+int dpm_restriction_set_popimap_email_state(device_policy_manager_h handle, int allow);
+
+/**
+ * @brief       Checks whether the access to POP or IMAP email is allowed or not.
+ * @details     An administrator can use this API to check the access to POP or IMAP email
+ *              is allowed or not.
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @param[out]  is_allowed true if the POP or IMAP email is allowed, false otherwise.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_restriction_set_popimap_email_state()
+ */
+int dpm_restriction_get_popimap_email_state(device_policy_manager_h handle, int *is_allowed);
+
+/**
+ * @partner
+ * @brief       Allows or disallows the use of web browser.
+ * @details     An administrator can allows or disallow the use of web browser without
+ *              any user interaction
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.browser
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   allow If true, allow the use of web browser,
+ *              if false, disallow the use of web browser.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_restriction_get_browser_state()
+ */
+int dpm_restriction_set_browser_state(device_policy_manager_h handle, int allow);
+
+/**
+ * @brief       Checks whether the use of web browser is allowed or not.
+ * @details     An administrator can use this API to check whether the use of web browser
+ *              is allowed or not.
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @param[out]  is_allowed true if the use of web browser is allowed, false otherwise.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_restriction_set_browser_state()
+ */
+int dpm_restriction_get_browser_state(device_policy_manager_h handle, int *is_allowed);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __CAPI_RESTRICTION_POLICY_H__ */
diff --git a/libs/dpm/security.h b/libs/dpm/security.h
new file mode 100644 (file)
index 0000000..a688991
--- /dev/null
@@ -0,0 +1,181 @@
+/*
+ *  Copyright (c) 2015 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
+ */
+
+#ifndef __CAPI_SECURITY_POLICY_H__
+#define __CAPI_SECURITY_POLICY_H__
+
+#include <dpm/device-policy-manager.h>
+
+/**
+ * @file security.h
+ * @brief This file provides APIs to control security functionality such as
+ *        device encryption and screen lock.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup  CAPI_DPM_SECURITY_POLICY_MODULE
+ * @{
+ */
+
+/**
+ * @partner
+ * @brief       Locks device screen immediately.
+ * @details     An administrator can use this API to lock the device screen
+ *              immediately
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.lock
+ * @param[in]   handle Device policy manager handle
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_security_lockout_screen(device_policy_manager_h handle);
+
+/**
+ * @partner
+ * @brief       Encrypts or decrypts internal storage.
+ * @details     An administrator can use this API to enable full device
+ *              encryption, which includes device memory and internal SD card.
+ *              Before calling this API, administrator must ensure that
+ *              the device password is set to alphanumeric quality.
+ *              The administrator can set an alphanumeric password by using
+ *              dpm_set_password_quality() API
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.security
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   encrypt true if encryption is required, false if decryption is
+ *              required
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_security_is_internal_storage_encrypted()
+ */
+int dpm_security_set_internal_storage_encryption(device_policy_manager_h handle, int encrypt);
+
+/**
+ * @brief       Checks the internal storage encryption state.
+ * @details     An administrator can use this API to check whether internal
+ *              storage encryption is enabled.
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @param[out]  is_encrypted true if internal storage is encrypted or being encrypted,
+ *              else false.
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_security_set_internal_storage_encryption()
+ */
+int dpm_security_is_internal_storage_encrypted(device_policy_manager_h handle, int *is_encrypted);
+
+/**
+ * @partner
+ * @brief       Encrypts or decrypts external storage.
+ * @details     An administrator can use this API to enable external SD card
+ *              encryption. Before calling this API, administrator must
+ *              ensure that the device password is set to alphanumeric quality.
+ *              The administrator can set an alphanumeric password by using
+ *              dpm_set_password_quality() API
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.security
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   encrypt true if encryption is required, false if decryption is
+ *              required
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_security_is_external_storage_encryped()
+ */
+int dpm_security_set_external_storage_encryption(device_policy_manager_h handle, int encrypt);
+
+/**
+ * @brief       Checks the external storage encryption state.
+ * @details     An administrator can use this API to check whether external
+ *              storage encryption is enabled.
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @param[out]   is_encrypted true if external storage is encrypted or being encrypted,
+ *              else false
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_security_set_external_storage_encryption()
+ */
+int dpm_security_is_external_storage_encrypted(device_policy_manager_h handle, int *is_encrypted);
+
+/**
+ * @brief       Enumeration for device wipe type.
+ * @since_tizen 3.0
+ */
+typedef enum {
+       DPM_SECURITY_WIPE_INTERNAL_STORAGE = (1 << 0), /**< Wipe internal memory */
+       DPM_SECURITY_WIPE_EXTERNAL_STORAGE = (1 << 1),  /**< Wipe external memory */
+} dpm_security_wipe_type_e;
+
+/**
+ * @partner
+ * @brief       Wipes external memory, internal memory, or both selectively.
+ * @details     Device Admin can use this API to wipe both SD card data
+ *              and application data.
+ *              Calling this API may require rebooting the device.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.wipe
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   type The target storage for wipe
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ */
+int dpm_security_wipe_data(device_policy_manager_h handle, dpm_security_wipe_type_e type);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //! __CAPI_SECURITY_POLICY_H__
diff --git a/libs/dpm/storage.h b/libs/dpm/storage.h
new file mode 100644 (file)
index 0000000..c6fb900
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ *  Copyright (c) 2015 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
+ */
+
+#ifndef __CAPI_STORAGE_POLICY_H__
+#define __CAPI_STORAGE_POLICY_H__
+
+#include <dpm/device-policy-manager.h>
+
+/**
+ * @file storage.h
+ * @brief This file provides APIs to control storage
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup  CAPI_DPM_STORAGE_POLICY_MODULE
+ * @{
+ */
+
+/**
+ * @brief       Enumeration for device wipe type
+ * @since_tizen 3.0
+ */
+typedef enum {
+       WIPE_INTERNAL_STORAGE = (1 << 0), /**< Wipe internal memory. */
+       WIPE_EXTERNAL_STORAGE = (1 << 1)  /**< Wipe external memory. */
+} dpm_wipe_type_e;
+
+/**
+ * @brief       The storage policy handle
+ * @since_tizen 3.0
+ * @see         dpm_context_acquire_storage_policy()
+ * @see         dpm_context_release_storage_policy()
+ */
+typedef void* dpm_storage_policy_h;
+
+/**
+ * @brief       Acquires the storage policy handle.
+ * @details     This API acquires storage policy handle required to enforce
+ *              the storage policies.
+ * @since_tizen 3.0
+ * @param[in]   handle The device policy context handle
+ * @return      Storage policy handle on success, otherwise NULL
+ * @remark      The specific error code can be obtained by using the
+ *              get_last_result() method. Error codes are described in
+ *              exception section.
+ * @exception   #DPM_ERROR_NONE No error
+ * @exception   #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception   #DPM_ERROR_TIMED_OUT Time out
+ * @see         dpm_context_release_storage_policy()
+ * @see         get_last_result()
+ */
+dpm_storage_policy_h dpm_context_acquire_storage_policy(dpm_context_h handle);
+
+/**
+ * @brief       Releases the storage policy handle.
+ * @details     This API must be called if interaction with the device
+ *              policy manager is no longer required.
+ * @since_tizen 3.0
+ * @param[in]   handle The device policy context
+ * @param[in]   handle The storage policy handle
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @pre         The handle must be created by dpm_context_acquire_storage_policy().
+ * @see         dpm_context_acquire_storage_policy()
+ */
+int dpm_context_release_storage_policy(dpm_context_h context, dpm_storage_policy_h handle);
+
+/**
+ * @brief       API to selectively wipe external memory, internal memory,
+ *              or both.
+ * @details     Device Admin can use this API to wipe both SD card data
+ *              and application data.
+ *              Calling this API may require rebooting the device.
+ * @since_tizen 3.0
+ * @param[in]   handle Storage policy handle
+ * @param[in]   type DPM_WIPE_INTERNAL_STORAGE or DPM_WIPE_EXTERNAL_STORAGE
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         handle must be created by dpm_context_acquire_storage_policy()
+ * @see         dpm_context_acquire_storage_policy()
+ * @see         dpm_context_release_storage_policy()
+ */
+int dpm_storage_wipe_data(dpm_storage_policy_h handle, const dpm_wipe_type_e type);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__CAPI_STORAGE_POLICY_H__
diff --git a/libs/dpm/wifi.h b/libs/dpm/wifi.h
new file mode 100644 (file)
index 0000000..95d0b1a
--- /dev/null
@@ -0,0 +1,172 @@
+/*
+ *  Copyright (c) 2015 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
+ */
+
+#ifndef __CAPI_WIFI_POLICY_H__
+#define __CAPI_WIFI_POLICY_H__
+
+#include <dpm/device-policy-manager.h>
+
+/**
+ * @file wifi.h
+ * @brief This file provides APIs to control wifi policy
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup  CAPI_DPM_WIFI_POLICY_MODULE
+ * @{
+ */
+
+/**
+ * @brief       Allows or disallows user to modify some Wi-Fi profiles of network settings.
+ * @details     An administrator can use this API to allow or disallow users to modify selected
+ *              Wi-Fi profiles like static ip configuration, proxy settings, security type
+ *              and others. When this policy is in effect the user is only allowed to
+ *              modify only the username, password, anonymous identity, and wep key.
+ *              In addition, the user cannot remove the network. When false, the user can
+ *              modify all Wi-fi network profiles normally and also remove it.
+ * @since_tizen 3.0
+ * @param[in]   handle The device policy manager handle
+ * @param[in]   enable true to enable restriction mode for wifi profile changes, else false
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMEOUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         handle must be created by dpm_context_acquire_wifi_policy()
+ * @see         dpm_context_acquire_wifi_policy()
+ * @see         dpm_context_release_wifi_policy()
+ * @see         dpm_wifi_is_profile_change_restricted()
+ */
+int dpm_wifi_set_profile_change_restriction(device_policy_manager_h handle, int enable);
+
+/**
+ * @brief       Checks if the user is allowed to modify certain Wi-Fi profiles.
+ * @details     An administrator can use this API to check whether the user is
+ *              allowed to modify Wi-Fi profiles. The user is restricted in modifying
+ *              Wi-Fi profiles if at least one administrator has set the value to TRUE.
+ * @since_tizen 3.0
+ * @param[in]   handle The device policy manager handle
+ * @param[out]  is_enabled true if one or more administrators enabled restriction
+ *              false if user can change all Wi-Fi profiles
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMEOUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre         handle must be created by dpm_context_acquire_wifi_policy()
+ * @see         dpm_context_acquire_wifi_policy()
+ * @see         dpm_context_release_wifi_policy()
+ * @see         dpm_wifi_set_profile_change_restriction()
+ */
+int dpm_wifi_is_profile_change_restricted(device_policy_manager_h handle, int *is_enabled);
+
+/**
+ * @brief       Restricts network access based on the Wi-Fi network service set
+ *              identifier(SSID).
+ * @details     An administrator can use this API to restrict connecting to the Wi-Fi
+ *              network based on the blocked network list.
+ * @since_tizen 3.0
+ * @param[in]   handle The device policy manager handle
+ * @param[in]   enable true to enable the Wi-Fi network access restriction,
+ *              false to disable the Wi-Fi network access restriction
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMEOUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         handle must be created by dpm_manager_create()
+ * @pre         Blocked network list must be added by dpm_wifi_add_ssid_to_blocklist()
+ * @see         dpm_wifi_is_network_access_restricted()
+ * @see         dpm_wifi_add_ssid_to_blocklist()
+ * @see         dpm_wifi_remove_ssid_from_blocklist()
+ */
+int dpm_wifi_set_network_access_restriction(device_policy_manager_h handle, int enable);
+
+/**
+ * @brief       Checks whether the SSID-based Wi-Fi network access restriction is
+ *              enabled.
+ * @details     An administrator can use this API to check whether the SSID-based
+ *              Wi-Fi network restriction is enabled.
+ * @since_tizen 3.0
+ * @param[in]   handle The device policy manager handle
+ * @param[out]  is_enabled true if restriction mode is enabled or
+ *              false if restriction mode is disabled
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMEOUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre         handle must be created by dpm_manager_create()
+ * @see         dpm_wifi_set_network_access_restriction()
+ */
+int dpm_wifi_is_network_access_restricted(device_policy_manager_h handle, int *is_enabled);
+
+/**
+ * @brief       Adds a service set identifier(SSID) to the list of blocked network.
+ * @details     An administrator can use this API to add an SSID to the list of blocked
+ *              networks, which prevents the user from connecting to it.
+ *              The blocked network still appears in the Access Point list but is disabled.
+ * @since_tizen 3.0
+ * @param[in]   handle The device policy manager handle
+ * @param[in]   ssid The SSID to block
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMEOUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @retval      #DPM_ERROR_OUT_OF_MEMORY Too many SSIDs in blocked network list
+ * @pre         handle must be created by dpm_manager_create()
+ * @post        dpm_wifi_set_network_access_restriction() must be called
+ *              when SSIDs in the blacklist are needed to get restricted
+ * @see         dpm_wifi_remove_ssid_from_blocklist()
+ * @see         dpm_wifi_set_network_access_restriction()
+ */
+int dpm_wifi_add_ssid_to_blocklist(device_policy_manager_h handle, const char* ssid);
+
+/**
+ * @brief       Removes a service set identifier(SSID) from the list of blocked
+ *              networks.
+ * @details     An administrator can use this API to remove an SSID from the list of
+ *              blocked networks, which allows the user to connect to it.
+ * @since_tizen 3.0
+ * @param[in]   handle The device policy manager handle
+ * @param[in]   ssid The SSID to be removed from the list of blocked networks
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMEOUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         handle must be created by dpm_manager_create()
+ * @see         dpm_wifi_add_ssid_to_blocklist()
+ * @see         dpm_wifi_set_network_access_restriction()
+ */
+int dpm_wifi_remove_ssid_from_blocklist(device_policy_manager_h handle, const char* ssid);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //! __CAPI_WIFI_POLICY_H__
diff --git a/libs/dpm/zone.h b/libs/dpm/zone.h
new file mode 100644 (file)
index 0000000..e7b56d8
--- /dev/null
@@ -0,0 +1,160 @@
+/*
+ *  Copyright (c) 2015 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
+ */
+
+#ifndef __CAPI_ZONE_POLICY_H__
+#define __CAPI_ZONE_POLICY_H__
+
+#include <dpm/device-policy-manager.h>
+
+/**
+ * @file zone.h
+ * @brief This file provides APIs to control zones
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup  CAPI_DPM_ZONE_POLICY_MODULE
+ * @{
+ */
+
+/**
+ * @partner
+ * @brief       Creates a new zone.
+ * @details     An administrator can use this API to create a container. Once the container
+ *              is created, the admin package given to the parameter will be installed inside
+ *              the container. Then ownership of the container gets transferred to the admin
+ *              package from the client which triggered the container creation process.
+ * @since_tizen 3.0
+ * @privlevel   partner
+ * @privilege   %http://tizen.org/privilege/dpm.zone
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   name The zone name to be created
+ * @param[in]   pkgname Admin package container ownership will be transferred
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_NOT_PERMITTED Operation not permitted
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_zone_destroy()
+ * @see         dpm_zone_create_iterator()
+ */
+int dpm_zone_create(device_policy_manager_h handle, const char* name, const char* pkgname);
+
+/**
+ * @partner
+ * @brief       Removes existing zone.
+ * @details     Administrator can use this API to remove zone. All file system objects
+ *              created for the zone will be also erased.
+ * @since_tizen 3.0
+ * @privlevel  partner
+ * @privilege  %http://tizen.org/privilege/dpm.zone
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   name The zone name to be removed
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_PERMISSION_DENIED The application does not have
+ *              the privilege to call this API or the caller is not the owner
+ *              of the zone
+ * @pre         The handle must be created by dpm_manager_create().
+ * @pre         The zone corresponding to the given name must be
+ *              created before use of this API.
+ * @see         dpm_manager_create()
+ * @see         dpm_zone_create()
+ * @see         dpm_zone_create_iterator()
+ */
+int dpm_zone_destroy(device_policy_manager_h handle, const char* name);
+
+/**
+ * @brief       Enumeration for zone state
+ * @since_tizen 3.0
+ */
+typedef enum {
+       DPM_ZONE_STATE_LOCKED       = 0x01,  /**< Zone has been defined, but it can not start. */
+       DPM_ZONE_STATE_RUNNING      = 0x02, /**< Zone has been started. */
+       DPM_ZONE_STATE_ALL          = 0xff  /**< This presents all of the state  */
+} dpm_zone_state_e;
+
+/**
+ * @brief       Gets the zone state.
+ * @details     This API can be used to get the state of the zone. The zone can
+ *              have one of the three states(running, locked).
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   name The zone name
+ * @param[out]  state The zone state
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_NO_DATA No such zone to get state
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_zone_create()
+ * @see         dpm_zone_destroy()
+ */
+int dpm_zone_get_state(device_policy_manager_h handle, const char* name, dpm_zone_state_e *state);
+
+/**
+ * @brief       Called to get all the name of created zones.
+ * @since_tizen 3.0
+ * @param[in]   name The zone name
+ * @param[in]   user_data The user data passed from dpm_zone_foreach_name
+ * @return      true to continue with the next iteration of the loop, otherwise false to break out out the loop
+ * @see         dpm_zone_foreach_name()
+ */
+typedef bool(*dpm_zone_foreach_name_cb)(const char* name, void *user_data);
+
+/**
+ * @brief       Retrieves all the name of created zones
+ * @details     This API calls dpm_zone_foreach_cb() once for each zone name
+ *              with traversing the created zones list.
+ * @since_tizen 3.0
+ * @param[in]   handle Device policy manager handle
+ * @param[in]   state a combination of the zone state to look
+ * @param[in]   callback The iteration callback function
+ * @param[in]   user_data The user data passed to the callback function
+ * @return      #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval      #DPM_ERROR_NONE Successful
+ * @retval      #DPM_ERROR_TIMED_OUT Time out
+ * @retval      #DPM_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre         The handle must be created by dpm_manager_create().
+ * @see         dpm_manager_create()
+ * @see         dpm_zone_create()
+ * @see         dpm_zone_destroy()
+ */
+int dpm_zone_foreach_name(device_policy_manager_h handle,
+                                                 dpm_zone_state_e state,
+                                                 dpm_zone_foreach_name_cb callback, void* user_data);
+
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CAPI_ZONE_POLICY__ */
diff --git a/libs/password.cpp b/libs/password.cpp
new file mode 100644 (file)
index 0000000..131113e
--- /dev/null
@@ -0,0 +1,579 @@
+/*
+ *  Copyright (c) 2015 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
+ */
+
+#include <cstring>
+#include <cassert>
+
+#include "dpm/password.h"
+#include "dpm/password_internal.h"
+
+#include "array.h"
+#include "debug.h"
+#include "status.h"
+#include "policy-client.h"
+
+EXPORT_API int dpm_password_set_quality(device_policy_manager_h handle, int quality)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(quality >= 0, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Password::setQuality", quality);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_password_get_quality(device_policy_manager_h handle, int *quality)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(quality, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { 0 };
+               status = client.methodCall<int>("Password::getQuality");
+               if (status.get() < 0)
+                       return -1;
+
+               *quality = (dpm_password_quality_e)status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_password_set_minimum_length(device_policy_manager_h handle, int value)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(value >= 0, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { 0 };
+               status = client.methodCall<int>("Password::setMinimumLength", value);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_password_get_minimum_length(device_policy_manager_h handle, int *value)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(value, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { 0 };
+               status = client.methodCall<int>("Password::getMinimumLength");
+               if (status.get() < 0)
+                       return -1;
+
+               *value = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_password_set_min_complex_chars(device_policy_manager_h handle, int value)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(value >= 0, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Password::setMinComplexChars", value);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_password_get_min_complex_chars(device_policy_manager_h handle, int *value)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(value, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { 0 };
+               status = client.methodCall<int>("Password::getMinComplexChars");
+               if (status.get() < 0)
+                       return -1;
+
+               *value = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_password_set_maximum_failed_attempts_for_wipe(device_policy_manager_h handle, int value)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(value >= 0, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Password::setMaximumFailedForWipe", value);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_password_get_maximum_failed_attempts_for_wipe(device_policy_manager_h handle, int *value)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(value, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { 0 };
+               status = client.methodCall<int>("Password::getMaximumFailedForWipe");
+               if (status.get() < 0)
+                       return -1;
+
+               *value = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_password_set_expires(device_policy_manager_h handle, int value)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(value >= 0, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Password::setExpires", value);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_password_get_expires(device_policy_manager_h handle, int *value)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(value, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { 0 };
+               status = client.methodCall<int>("Password::getExpires");
+               if (status.get() < 0)
+                       return -1;
+
+               *value = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_password_set_history(device_policy_manager_h handle, int value)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(value >= 0, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Password::setHistory", value);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_password_get_history(device_policy_manager_h handle, int *value)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(value, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { 0 };
+               status = client.methodCall<int>("Password::getHistory");
+               if (status.get() < 0)
+                       return -1;
+
+               *value = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_password_set_pattern(device_policy_manager_h handle, const char *pattern)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(pattern, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Password::setPattern", pattern);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_password_reset(device_policy_manager_h handle, const char *passwd)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(passwd, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Password::reset", passwd);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_password_enforce_change(device_policy_manager_h handle)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Password::enforceChange");
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_password_set_max_inactivity_time_device_lock(device_policy_manager_h handle, int value)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(value >= 0, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Password::setMaxInactivityTimeDeviceLock", value);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_password_get_max_inactivity_time_device_lock(device_policy_manager_h handle, int *value)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(value, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { 0 };
+               status = client.methodCall<int>("Password::getMaxInactivityTimeDeviceLock");;
+               if (status.get() < 0)
+                       return -1;
+
+               *value = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_password_set_status(device_policy_manager_h handle, dpm_password_status_e stat)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(stat >= DPM_PASSWORD_STATUS_NORMAL &&
+                                  stat <= DPM_PASSWORD_STATUS_PATTERN_CHANGED,
+                                  DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Password::setStatus", (int)stat);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_password_get_status(device_policy_manager_h handle, dpm_password_status_e *stat)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(stat, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { 0 };
+               status = client.methodCall<int>("Password::getStatus");
+               if (status.get() < 0)
+                       return -1;
+
+               *stat = (dpm_password_status_e)status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_password_delete_pattern(device_policy_manager_h handle)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Password::deletePattern");
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_password_get_pattern(device_policy_manager_h handle, char **pattern)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(pattern, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<std::string> status { std::string() };
+               status = client.methodCall<std::string>("Password::getPattern");
+               *pattern = ::strdup(status.get().c_str());
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_password_set_maximum_character_occurrences(device_policy_manager_h handle, int value)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(value >= 0, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Password::setMaximumCharacterOccurrences", value);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_password_get_maximum_character_occurrences(device_policy_manager_h handle, int *value)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(value, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { 0 };
+               status = client.methodCall<int>("Password::getMaximumCharacterOccurrences");
+               if (status.get() < 0)
+                       return -1;
+
+               *value = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_password_set_maximum_numeric_sequence_length(device_policy_manager_h handle, int value)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(value >= 0, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Password::setMaximumNumericSequenceLength", value);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_password_get_maximum_numeric_sequence_length(device_policy_manager_h handle, int *value)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(value, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { 0 };
+               status = client.methodCall<int>("Password::getMaximumNumericSequenceLength");
+               if (status.get() < 0)
+                       return -1;
+
+               *value = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+typedef runtime::Array<std::string> dpm_password_iterator;
+
+EXPORT_API dpm_password_iterator_h dpm_password_create_iterator(device_policy_manager_h handle)
+{
+       RET_ON_FAILURE(handle, NULL);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       Status<std::vector<std::string>> status { std::vector<std::string>() };
+       status = client.methodCall<std::vector<std::string>>("Password::getForbiddenStrings");
+
+       dpm_password_iterator *iter = new dpm_password_iterator(status.get());
+       return reinterpret_cast<dpm_password_iterator_h>(iter);
+}
+
+EXPORT_API int dpm_password_iterator_next(dpm_password_iterator_h iter, const char **result)
+{
+       RET_ON_FAILURE(iter, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(result, DPM_ERROR_INVALID_PARAMETER);
+
+       dpm_password_iterator *it = reinterpret_cast<dpm_password_iterator *>(iter);
+
+       if (it->isEnd())
+               *result = NULL;
+       else
+               *result = it->next()->c_str();
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_password_destroy_iterator(dpm_password_iterator_h iter)
+{
+       RET_ON_FAILURE(iter, DPM_ERROR_INVALID_PARAMETER);
+
+       delete reinterpret_cast<dpm_password_iterator *>(iter);
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_password_set_forbidden_strings(device_policy_manager_h handle, const char *strings[], int length)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(strings, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(length >= 0, DPM_ERROR_INVALID_PARAMETER);
+
+       int iter;
+       std::vector<std::string> forbiddenStrings;
+
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(strings, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       for (iter = 0; iter < length; iter++)
+               forbiddenStrings.push_back(strings[iter]);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Password::setForbiddenStrings", forbiddenStrings);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_password_set_recovery(device_policy_manager_h handle, int enable)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Password::setRecovery", enable);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_password_get_recovery(device_policy_manager_h handle, int *enable)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(enable, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { false };
+               status = client.methodCall<int>("Password::getRecovery");
+               if (status.get() < 0)
+                       return -1;
+
+               *enable = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
diff --git a/libs/policy-client.cpp b/libs/policy-client.cpp
new file mode 100644 (file)
index 0000000..8c819c3
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ *  Copyright (c) 2015 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
+ */
+
+#include <system_info.h>
+#include <klay/filesystem.h>
+
+#include "policy-client.h"
+
+namespace {
+
+const std::string SIGNAL_INTERFACE = "DevicePolicyManager::subscribeSignal";
+
+const std::string POLICY_MANAGER_ADDRESS = "/tmp/.device-policy-manager.sock";
+
+int GetPolicyEnforceMode()
+{
+       runtime::File policyManagerSocket(POLICY_MANAGER_ADDRESS);
+
+       if (policyManagerSocket.exists()) {
+               return 1;
+       }
+
+       return 0;
+}
+
+} // namespace
+
+
+DevicePolicyClient::DevicePolicyClient() noexcept :
+       maintenanceMode(GetPolicyEnforceMode())
+{
+}
+
+DevicePolicyClient::~DevicePolicyClient() noexcept
+{
+       disconnect();
+}
+
+int DevicePolicyClient::connect(const std::string& address) noexcept
+{
+       try {
+               client.reset(new rmi::Client(address));
+               if (maintenanceMode) {
+                       client->connect();
+               }
+       } catch (runtime::Exception& e) {
+               return -1;
+       }
+
+       return 0;
+}
+
+int DevicePolicyClient::connect() noexcept
+{
+       return connect(POLICY_MANAGER_ADDRESS);
+}
+
+void DevicePolicyClient::disconnect() noexcept
+{
+       client.reset();
+}
+
+int DevicePolicyClient::subscribeSignal(const std::string& name,
+                                                                               const SignalHandler& handler,
+                                                                               void* data)
+{
+       auto dispatch = [handler, data](const std::string &name, const std::string &object) {
+               handler(name.c_str(), object.c_str(), data);
+       };
+
+       if (!maintenanceMode) {
+               return 0;
+       }
+
+       try {
+               return client->subscribe<std::string, std::string>(SIGNAL_INTERFACE, name, dispatch);
+       } catch (runtime::Exception& e) {
+               std::cout << e.what() << std::endl;
+               return -1;
+       }
+}
+
+int DevicePolicyClient::unsubscribeSignal(int id)
+{
+       if (!maintenanceMode) {
+               return 0;
+       }
+
+       return client->unsubscribe("", id);
+}
diff --git a/libs/policy-client.h b/libs/policy-client.h
new file mode 100644 (file)
index 0000000..3fa15a3
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ *  Copyright (c) 2015 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
+ */
+
+#ifndef __POLICY_CLIENT_H__
+#define __POLICY_CLIENT_H__
+
+#include <string>
+#include <memory>
+#include <functional>
+#include <cerrno>
+
+#include <klay/rmi/client.h>
+
+typedef std::function<void(const char*, const char*, void*)> SignalHandler;
+
+class DevicePolicyClient {
+public:
+       DevicePolicyClient() noexcept;
+       ~DevicePolicyClient() noexcept;
+
+       int connect() noexcept;
+       int connect(const std::string& address) noexcept;
+       void disconnect() noexcept;
+
+       int subscribeSignal(const std::string& name, const SignalHandler& handler, void* data);
+       int unsubscribeSignal(int subscriberId);
+
+       template<typename Type, typename... Args>
+       Type methodCall(const std::string& method, Args&&... args)
+       {
+               if (maintenanceMode) {
+                       return client->methodCall<Type, Args...>(method, std::forward<Args>(args)...);
+               }
+
+               errno = EPROTONOSUPPORT;
+               return Type();
+       }
+
+private:
+       int maintenanceMode;
+       std::unique_ptr<rmi::Client> client;
+};
+
+DevicePolicyClient& GetDevicePolicyClient(void* handle);
+
+#endif //__POLICY_CLIENT_H__
diff --git a/libs/restriction.cpp b/libs/restriction.cpp
new file mode 100644 (file)
index 0000000..662ddff
--- /dev/null
@@ -0,0 +1,549 @@
+/*
+ *  Copyright (c) 2016 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
+ */
+
+#include "dpm/restriction.h"
+
+#include "debug.h"
+#include "status.h"
+#include "policy-client.h"
+
+EXPORT_API int dpm_restriction_set_camera_state(device_policy_manager_h handle, int allow)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Media::setCameraState", allow);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_restriction_get_camera_state(device_policy_manager_h handle, int *is_allowed)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<bool> status { true };
+               status = client.methodCall<bool>("Media::getCameraState");
+               *is_allowed = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_restriction_set_microphone_state(device_policy_manager_h handle, int allow)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Media::setMicrophoneState", allow);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_restriction_get_microphone_state(device_policy_manager_h handle, int *is_allowed)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<bool> status { true };
+               status = client.methodCall<bool>("Media::getMicrophoneState");
+               *is_allowed = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_restriction_set_location_state(device_policy_manager_h handle, int allow)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Location::setState", allow);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_restriction_get_location_state(device_policy_manager_h handle, int *is_allowed)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<bool> status { true };
+               status = client.methodCall<bool>("Location::getState");
+               *is_allowed = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_restriction_set_usb_debugging_state(device_policy_manager_h handle, int allow)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Usb::setDebuggingState", allow);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_restriction_get_usb_debugging_state(device_policy_manager_h handle, int *is_allowed)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<bool> status { true };
+               status = client.methodCall<bool>("Usb::getDebuggingState");
+               *is_allowed = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_restriction_set_usb_tethering_state(device_policy_manager_h handle, int allow)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Usb::setTetheringState", allow);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_restriction_get_usb_tethering_state(device_policy_manager_h handle, int *is_allowed)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<bool> status { true };
+               status = client.methodCall<bool>("Usb::getTetheringState");
+               *is_allowed = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_restriction_set_external_storage_state(device_policy_manager_h handle, int allow)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Storage::setExternalStorageState", allow);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_restriction_get_external_storage_state(device_policy_manager_h handle, int *is_allowed)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<bool> status { true };
+               status = client.methodCall<bool>("Storage::getExternalStorageState");
+               *is_allowed = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_restriction_set_clipboard_state(device_policy_manager_h handle, int allow)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Media::setClipboardState", allow);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_restriction_get_clipboard_state(device_policy_manager_h handle, int *is_allowed)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<bool> status { true };
+               status = client.methodCall<bool>("Media::getClipboardState");
+               *is_allowed = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_restriction_set_wifi_state(device_policy_manager_h handle, int allow)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Wifi::setState", allow);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_restriction_get_wifi_state(device_policy_manager_h handle, int *is_allowed)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<bool> status { true };
+               status = client.methodCall<bool>("Wifi::getState");
+               *is_allowed = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_restriction_set_wifi_hotspot_state(device_policy_manager_h handle, int allow)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Wifi::setHotspotState", allow);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_restriction_get_wifi_hotspot_state(device_policy_manager_h handle, int *is_allowed)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<bool> status { true };
+               status = client.methodCall<bool>("Wifi::getHotspotState");
+               *is_allowed = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_restriction_set_bluetooth_tethering_state(device_policy_manager_h handle, int allow)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Bluetooth::setTetheringState", allow);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_restriction_get_bluetooth_tethering_state(device_policy_manager_h handle, int *is_allowed)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<bool> status { true };
+               status = client.methodCall<bool>("Bluetooth::getTetheringState");
+               *is_allowed = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_restriction_set_bluetooth_mode_change_state(device_policy_manager_h handle, int allow)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Bluetooth::setModeChangeState", allow);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_restriction_get_bluetooth_mode_change_state(device_policy_manager_h handle, int *is_allowed)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<bool> status { true };
+               status = client.methodCall<bool>("Bluetooth::getModeChangeState");
+               *is_allowed = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_restriction_set_bluetooth_desktop_connectivity_state(device_policy_manager_h handle, int allow)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<bool>("Bluetooth::setDesktopConnectivityState", allow);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_restriction_get_bluetooth_desktop_connectivity_state(device_policy_manager_h handle, int *is_allowed)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<bool> status { true };
+               status = client.methodCall<bool>("Bluetooth::getDesktopConnectivityState");
+               *is_allowed = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_restriction_set_bluetooth_pairing_state(device_policy_manager_h handle, int allow)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Bluetooth::setPairingState", allow);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_restriction_get_bluetooth_pairing_state(device_policy_manager_h handle, int *is_allowed)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<bool> status { true };
+               status = client.methodCall<bool>("Bluetooth::getPairingState");
+               *is_allowed = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_restriction_set_popimap_email_state(device_policy_manager_h handle, int allow)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("EMail::setPopImapState", allow);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_restriction_get_popimap_email_state(device_policy_manager_h handle, int *is_allowed)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<bool> status { true };
+               status = client.methodCall<bool>("EMail::getPopImapState");
+               *is_allowed = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_restriction_set_messaging_state(device_policy_manager_h handle, const char *sim_id, int allow)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Telephony::setMessagingState", sim_id, allow);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_restriction_get_messaging_state(device_policy_manager_h handle, const char *sim_id, int *is_allowed)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<bool> status { true };
+               status = client.methodCall<bool>("Telephony::getMessagingState", sim_id);
+               *is_allowed = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_restriction_set_browser_state(device_policy_manager_h handle, int allow)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Browser::setState", allow);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_restriction_get_browser_state(device_policy_manager_h handle, int *is_allowed)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<bool> status { true };
+               status = client.methodCall<bool>("Browser::getState");
+               *is_allowed = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
diff --git a/libs/security.cpp b/libs/security.cpp
new file mode 100644 (file)
index 0000000..78b77f3
--- /dev/null
@@ -0,0 +1,114 @@
+/*
+ *  Copyright (c) 2015 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
+ */
+
+#include "dpm/security.h"
+
+#include "debug.h"
+#include "status.h"
+#include "policy-client.h"
+
+EXPORT_API int dpm_security_lockout_screen(device_policy_manager_h handle)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Security::lockoutScreen");
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_security_set_internal_storage_encryption(device_policy_manager_h handle, int encrypt)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Security::setInternalStorageEncryption", encrypt);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_security_is_internal_storage_encrypted(device_policy_manager_h handle, int *is_encrypted)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(is_encrypted, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+       try {
+               Status<bool> status { false };
+               status = client.methodCall<int>("Security::isInternalStorageEncrypted");
+               *is_encrypted = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_security_set_external_storage_encryption(device_policy_manager_h handle, int encrypt)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Security::setExternalStorageEncryption", encrypt);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_security_is_external_storage_encrypted(device_policy_manager_h handle, int *is_encrypted)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(is_encrypted, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+       try {
+               Status<bool> status { false };
+               status = client.methodCall<int>("Security::isExternalStorageEncrypted");
+               *is_encrypted = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_security_wipe_data(device_policy_manager_h handle, dpm_security_wipe_type_e type)
+{
+       int mask = type & (DPM_SECURITY_WIPE_INTERNAL_STORAGE | DPM_SECURITY_WIPE_EXTERNAL_STORAGE);
+
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(mask, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Security::wipeData", (int)type);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
diff --git a/libs/status.h b/libs/status.h
new file mode 100644 (file)
index 0000000..2336af6
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ *  Copyright (c) 2015 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
+ */
+
+#ifndef __STATUS_H__
+#define __STATUS_H__
+
+#include <cerrno>
+#include <utility>
+
+template<typename Type>
+class Status {
+public:
+       Status() = delete;
+       Status(Type&& defaultValue) : value(std::forward<Type>(defaultValue))
+       {
+               errno = 0;
+       }
+
+       void operator=(Type&& newValue)
+       {
+               if (errno == 0)
+                       value = newValue;
+       }
+
+       Type get() const
+       {
+               return value;
+       }
+
+private:
+       Type value;
+};
+
+#endif //!__STATUS_H__
diff --git a/libs/storage.cpp b/libs/storage.cpp
new file mode 100644 (file)
index 0000000..60398bc
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ *  Copyright (c) 2015 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
+ */
+
+#include "dpm/storage.h"
+
+#include "debug.h"
+#include "status.h"
+#include "policy-client.h"
+
+dpm_storage_policy_h dpm_client_acquire_storage_policy(dpm_client_h handle)
+{
+       return handle;
+}
+
+int dpm_client_release_storage_policy(dpm_storage_policy_h handle)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       return DPM_ERROR_NONE;
+}
+
+int dpm_storage_wipe_data(dpm_storage_policy_h handle, const dpm_wipe_type_e type)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+       try {
+               return storage.wipeData(type);
+       } catch (...) {
+               return -1;
+       }
+}
diff --git a/libs/wifi.cpp b/libs/wifi.cpp
new file mode 100644 (file)
index 0000000..ae056c8
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+ *  Copyright (c) 2015 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
+ */
+
+#include "dpm/wifi.h"
+
+#include "debug.h"
+#include "status.h"
+#include "policy-client.h"
+
+EXPORT_API int dpm_wifi_set_profile_change_restriction(device_policy_manager_h handle, int enable)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Wifi::setProfileChangeRestriction", enable);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_wifi_is_profile_change_restricted(device_policy_manager_h handle, int *enable)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(enable, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<bool> status { false };
+               status = client.methodCall<bool>("Wifi::isProfileChangeRestricted");
+               *enable = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_wifi_set_network_access_restriction(device_policy_manager_h handle, int enable)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Wifi::setNetworkAccessRestriction", enable);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_wifi_is_network_access_restricted(device_policy_manager_h handle, int *enable)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(enable, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<bool> status { false };
+               status = client.methodCall<bool>("Wifi::isNetworkAccessRestricted");
+               *enable = status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_wifi_add_ssid_to_blocklist(device_policy_manager_h handle, const char* ssid)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(ssid, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Wifi::addSsidToBlocklist", ssid);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_wifi_remove_ssid_from_blocklist(device_policy_manager_h handle, const char* ssid)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(ssid, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Wifi::removeSsidFromBlocklist", ssid);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
diff --git a/libs/zone.cpp b/libs/zone.cpp
new file mode 100755 (executable)
index 0000000..ac99b4d
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ *  Copyright (c) 2015 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
+ */
+
+#include "dpm/zone.h"
+
+#include "array.h"
+#include "debug.h"
+#include "status.h"
+#include "policy-client.h"
+
+EXPORT_API int dpm_zone_create(device_policy_manager_h handle, const char* name, const char* pkgname)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(name, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(pkgname, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Zone::create", name, pkgname);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_zone_destroy(device_policy_manager_h handle, const char* name)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(name, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { -1 };
+               status = client.methodCall<int>("Zone::remove", name);
+               return status.get();
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_zone_get_state(device_policy_manager_h handle, const char* name, dpm_zone_state_e *state)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(name, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(state, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<int> status { 0 };
+               status = client.methodCall<int>("Zone::getState", name);
+               if (status.get() == 0)
+                       return DPM_ERROR_NO_DATA;
+
+               *state = (dpm_zone_state_e)status.get();
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_zone_foreach_name(device_policy_manager_h handle, dpm_zone_state_e state,
+                                                                        dpm_zone_foreach_name_cb callback, void* user_data)
+{
+       int mask = state & (DPM_ZONE_STATE_LOCKED | DPM_ZONE_STATE_RUNNING);
+
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(callback, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(mask, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+       try {
+               Status<std::vector<std::string>> status { std::vector<std::string>() };
+               status = client.methodCall<std::vector<std::string>>("Zone::enumerate", (int)state);
+               for (const std::string& name : status.get()) {
+                       if (!callback(name.c_str(), user_data))
+                               break;
+               }
+       } catch (...) {
+               return -1;
+       }
+
+       return DPM_ERROR_NONE;
+}
diff --git a/location.cpp b/location.cpp
deleted file mode 100644 (file)
index 5a5bcb6..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- *  Copyright (c) 2016 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
- */
-
-#include "status.h"
-#include "location.hxx"
-
-namespace DevicePolicyManager {
-
-struct LocationPolicy::Private {
-       Private(PolicyControlContext& ctxt) : context(ctxt) {}
-       PolicyControlContext& context;
-};
-
-LocationPolicy::LocationPolicy(LocationPolicy&& rhs) = default;
-LocationPolicy& LocationPolicy::operator=(LocationPolicy&& rhs) = default;
-
-LocationPolicy::LocationPolicy(const LocationPolicy& rhs)
-{
-       if (rhs.pimpl) {
-               pimpl.reset(new Private(*rhs.pimpl));
-       }
-}
-
-LocationPolicy& LocationPolicy::operator=(const LocationPolicy& rhs)
-{
-       if (!rhs.pimpl) {
-               pimpl.reset();
-       } else {
-               pimpl.reset(new Private(*rhs.pimpl));
-       }
-
-       return *this;
-}
-
-LocationPolicy::LocationPolicy(PolicyControlContext& ctxt) :
-       pimpl(new Private(ctxt))
-{
-}
-
-LocationPolicy::~LocationPolicy()
-{
-}
-
-int LocationPolicy::setLocationState(bool enable)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("LocationPolicy::setLocationState", enable);
-
-       return status.get();
-}
-
-bool LocationPolicy::getLocationState()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<bool> status { true };
-
-       status = context.methodCall<bool>("LocationPolicy::getLocationState");
-
-       return status.get();
-}
-
-} //namespace DevicePolicyManager
diff --git a/password.cpp b/password.cpp
deleted file mode 100644 (file)
index 8724c47..0000000
+++ /dev/null
@@ -1,375 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#include "status.h"
-#include "password.hxx"
-
-namespace DevicePolicyManager {
-
-struct PasswordPolicy::Private {
-       Private(PolicyControlContext& ctxt) : context(ctxt) {}
-       PolicyControlContext& context;
-};
-
-PasswordPolicy::PasswordPolicy(PasswordPolicy&& rhs) = default;
-PasswordPolicy& PasswordPolicy::operator=(PasswordPolicy&& rhs) = default;
-
-PasswordPolicy::PasswordPolicy(const PasswordPolicy& rhs)
-{
-       if (rhs.pimpl) {
-               pimpl.reset(new Private(*rhs.pimpl));
-       }
-}
-
-PasswordPolicy& PasswordPolicy::operator=(const PasswordPolicy& rhs)
-{
-       if (!rhs.pimpl) {
-               pimpl.reset();
-       } else {
-               pimpl.reset(new Private(*rhs.pimpl));
-       }
-
-       return *this;
-}
-
-PasswordPolicy::PasswordPolicy(PolicyControlContext &ctxt) :
-       pimpl(new Private(ctxt))
-{
-}
-
-PasswordPolicy::~PasswordPolicy()
-{
-}
-
-int PasswordPolicy::setQuality(const int quality)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("PasswordPolicy::setQuality", quality);
-
-       return status.get();
-}
-
-int PasswordPolicy::getQuality()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { 0 };
-
-       status = context.methodCall<int>("PasswordPolicy::getQuality");
-
-       return status.get();
-}
-
-int PasswordPolicy::setMinimumLength(int value)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { 0 };
-
-       status = context.methodCall<int>("PasswordPolicy::setMinimumLength", value);
-
-       return status.get();
-}
-
-int PasswordPolicy::getMinimumLength()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { 0 };
-
-       status = context.methodCall<int>("PasswordPolicy::getMinimumLength");
-
-       return status.get();
-}
-
-int PasswordPolicy::setMinComplexChars(int value)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("PasswordPolicy::setMinComplexChars", value);
-
-       return status.get();
-}
-
-int PasswordPolicy::getMinComplexChars()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { 0 };
-
-       status = context.methodCall<int>("PasswordPolicy::getMinComplexChars");
-
-       return status.get();
-}
-
-int PasswordPolicy::setMaximumFailedForWipe(int value)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("PasswordPolicy::setMaximumFailedForWipe", value);
-
-       return status.get();
-}
-
-int PasswordPolicy::getMaximumFailedForWipe()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { 0 };
-
-       status = context.methodCall<int>("PasswordPolicy::getMaximumFailedForWipe");
-
-       return status.get();
-}
-
-int PasswordPolicy::setExpires(int value)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("PasswordPolicy::setExpires", value);
-
-       return status.get();
-}
-
-int PasswordPolicy::getExpires()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { 0 };
-
-       status = context.methodCall<int>("PasswordPolicy::getExpires");
-
-       return status.get();
-}
-
-int PasswordPolicy::setHistory(int value)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("PasswordPolicy::setHistory", value);
-
-       return status.get();
-}
-
-int PasswordPolicy::getHistory()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { 0 };
-
-       status = context.methodCall<int>("PasswordPolicy::getHistory");
-
-       return status.get();
-}
-
-int PasswordPolicy::setPattern(const std::string &pattern)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("PasswordPolicy::setPattern", pattern);
-
-       return status.get();
-}
-
-int PasswordPolicy::reset(const std::string &passwd)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("PasswordPolicy::reset", passwd);
-
-       return status.get();
-}
-
-int PasswordPolicy::enforceChange()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("PasswordPolicy::enforceChange");
-
-       return status.get();
-}
-
-int PasswordPolicy::setMaxInactivityTimeDeviceLock(int value)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("PasswordPolicy::setMaxInactivityTimeDeviceLock", value);
-
-       return status.get();
-}
-
-int PasswordPolicy::getMaxInactivityTimeDeviceLock()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { 0 };
-
-       status = context.methodCall<int>("PasswordPolicy::getMaxInactivityTimeDeviceLock");;
-
-       return status.get();
-}
-
-int PasswordPolicy::setStatus(int status)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> rstatus { -1 };
-
-       rstatus = context.methodCall<int>("PasswordPolicy::setStatus", status);
-
-       return rstatus.get();
-}
-
-int PasswordPolicy::getStatus()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { 0 };
-
-       status = context.methodCall<int>("PasswordPolicy::getStatus");
-
-       return status.get();
-}
-
-int PasswordPolicy::deletePattern()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("PasswordPolicy::deletePattern");
-
-       return status.get();
-}
-
-std::string PasswordPolicy::getPattern()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<std::string> status { std::string() };
-
-       status = context.methodCall<std::string>("PasswordPolicy::getPattern");
-
-       return status.get();
-}
-
-int PasswordPolicy::setMaximumCharacterOccurrences(int value)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("PasswordPolicy::setMaximumCharacterOccurrences", value);
-
-       return status.get();
-}
-
-int PasswordPolicy::getMaximumCharacterOccurrences()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { 0 };
-
-       status = context.methodCall<int>("PasswordPolicy::getMaximumCharacterOccurrences");
-
-       return status.get();
-}
-
-int PasswordPolicy::setMaximumNumericSequenceLength(int value)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("PasswordPolicy::setMaximumNumericSequenceLength", value);
-
-       return status.get();
-}
-
-int PasswordPolicy::getMaximumNumericSequenceLength()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { 0 };
-
-       status = context.methodCall<int>("PasswordPolicy::getMaximumNumericSequenceLength");
-
-       return status.get();
-}
-
-int PasswordPolicy::setForbiddenStrings(const std::vector<std::string> &forbiddenStrings)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("PasswordPolicy::setForbiddenStrings", forbiddenStrings);
-
-       return status.get();
-}
-
-std::vector<std::string> PasswordPolicy::getForbiddenStrings()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<std::vector<std::string>> status { std::vector<std::string>() };
-
-       status = context.methodCall<std::vector<std::string>>("PasswordPolicy::getForbiddenStrings");
-
-       return status.get();
-}
-
-int PasswordPolicy::setRecovery(int enable)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("PasswordPolicy::setRecovery", enable);
-
-       return status.get();
-}
-
-int PasswordPolicy::getRecovery()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { false };
-
-       status = context.methodCall<int>("PasswordPolicy::getRecovery");
-
-       return status.get();
-}
-} /* namespace DevicePolicyManager */
diff --git a/policy-client.cpp b/policy-client.cpp
deleted file mode 100644 (file)
index ebcc32a..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#include <system_info.h>
-#include <klay/filesystem.h>
-
-#include "policy-client.h"
-
-namespace {
-
-const std::string SUBSCRIBER_REGISTER = "Server::registerNotificationSubscriber";
-const std::string SUBSCRIBER_UNREGISTER = "Server::unregisterNotificationSubscriber";
-
-const std::string POLICY_MANAGER_ADDRESS = "/tmp/.device-policy-manager.sock";
-
-int GetPolicyEnforceMode()
-{
-       runtime::File policyManagerSocket(POLICY_MANAGER_ADDRESS);
-
-       if (policyManagerSocket.exists()) {
-               return 1;
-       }
-
-       return 0;
-}
-
-} // namespace
-
-
-DevicePolicyContext::DevicePolicyContext() noexcept :
-       maintenanceMode(GetPolicyEnforceMode())
-{
-}
-
-DevicePolicyContext::~DevicePolicyContext() noexcept
-{
-       disconnect();
-}
-
-int DevicePolicyContext::connect(const std::string& address) noexcept
-{
-       try {
-               client.reset(new rmi::Client(address));
-               if (maintenanceMode) {
-                       client->connect();
-               }
-       } catch (runtime::Exception& e) {
-               return -1;
-       }
-
-       return 0;
-}
-
-int DevicePolicyContext::connect() noexcept
-{
-       return connect(POLICY_MANAGER_ADDRESS);
-}
-
-void DevicePolicyContext::disconnect() noexcept
-{
-       client.reset();
-}
-
-int DevicePolicyContext::subscribePolicyChange(const std::string& name,
-                                                                                         const PolicyChangeListener& listener,
-                                                                                         void* data)
-{
-       auto listenerDispatcher = [listener, data](const std::string& policy, std::string &state) {
-               listener(policy.c_str(), state.c_str(), data);
-       };
-
-       if (!maintenanceMode) {
-               return 0;
-       }
-
-       try {
-               return client->subscribe<std::string, std::string>(SUBSCRIBER_REGISTER,
-                                                                                                                  name, listenerDispatcher);
-       } catch (runtime::Exception& e) {
-               std::cout << e.what() << std::endl;
-               return -1;
-       }
-}
-
-int DevicePolicyContext::unsubscribePolicyChange(int subscriberId)
-{
-       if (!maintenanceMode) {
-               return 0;
-       }
-
-       return client->unsubscribe(SUBSCRIBER_UNREGISTER, subscriberId);
-}
-
-int DevicePolicyContext::subscribeSignal(const std::string& name,
-                                                                               const SignalListener& listener,
-                                                                               void* data)
-{
-       auto listenerDispatcher = [listener, data](std::string &name, std::string &from, std::string &object) {
-               listener(from.c_str(), object.c_str(), data);
-       };
-
-       if (!maintenanceMode) {
-               return 0;
-       }
-
-       try {
-               return client->subscribe<std::string, std::string, std::string>(SUBSCRIBER_REGISTER,
-                                                                                                                                               name, listenerDispatcher);
-       } catch (runtime::Exception& e) {
-               std::cout << e.what() << std::endl;
-               return -1;
-       }
-}
-
-int DevicePolicyContext::unsubscribeSignal(int subscriberId)
-{
-       if (!maintenanceMode) {
-               return 0;
-       }
-
-       return client->unsubscribe(SUBSCRIBER_UNREGISTER, subscriberId);
-}
diff --git a/policy-client.h b/policy-client.h
deleted file mode 100644 (file)
index 4d5145d..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#ifndef __POLICY_CLIENT_H__
-#define __POLICY_CLIENT_H__
-
-#include <string>
-#include <memory>
-#include <functional>
-#include <cerrno>
-
-#include <klay/rmi/client.h>
-
-typedef std::function<void(const char*, const char*, void*)> PolicyChangeListener;
-typedef std::function<void(const char*, const char*, void*)> SignalListener;
-
-class DevicePolicyContext {
-public:
-       typedef DevicePolicyContext PolicyControlContext;
-
-       DevicePolicyContext() noexcept;
-       ~DevicePolicyContext() noexcept;
-
-       int connect() noexcept;
-       int connect(const std::string& address) noexcept;
-       void disconnect() noexcept;
-
-       int subscribePolicyChange(const std::string& name, const PolicyChangeListener& listener, void* data);
-       int unsubscribePolicyChange(int subscriberId);
-
-       int subscribeSignal(const std::string& name, const SignalListener& listener, void* data);
-       int unsubscribeSignal(int subscriberId);
-
-       template<typename Policy, typename... Args>
-       Policy createPolicyInterface(Args&&... args) noexcept
-       {
-               return Policy(getPolicyControlContext(), std::forward<Args>(args)...);
-       }
-
-       template<typename Type, typename... Args>
-       Type methodCall(const std::string& method, Args&&... args)
-       {
-               if (maintenanceMode) {
-                       return client->methodCall<Type, Args...>(method, std::forward<Args>(args)...);
-               }
-
-               errno = EPROTONOSUPPORT;
-               return Type();
-       }
-
-private:
-       PolicyControlContext& getPolicyControlContext()
-       {
-               return *this;
-       }
-
-private:
-       int maintenanceMode;
-       std::unique_ptr<rmi::Client> client;
-};
-
-DevicePolicyContext& GetDevicePolicyContext(void* handle);
-
-#endif //__POLICY_CLIENT_H__
diff --git a/policy-context.hxx b/policy-context.hxx
deleted file mode 100644 (file)
index f5d872f..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#ifndef __DEVICE_POLICY_CONTEXT__
-#define __DEVICE_POLICY_CONTEXT__
-
-#include <memory>
-
-#include "policy-client.h"
-
-using PolicyControlContext = ::DevicePolicyContext::PolicyControlContext;
-
-#endif //!__DEVICE_POLICY_CONTEXT__
diff --git a/policy/administration.hxx b/policy/administration.hxx
deleted file mode 100644 (file)
index 9cc1fbb..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#ifndef __ADMINISTRATION_POLICY__
-#define __ADMINISTRATION_POLICY__
-
-#include "policy-context.hxx"
-
-namespace DevicePolicyManager {
-
-class AdministrationPolicy {
-public:
-       AdministrationPolicy(PolicyControlContext& ctxt);
-       ~AdministrationPolicy();
-
-       AdministrationPolicy(const AdministrationPolicy& rhs);
-       AdministrationPolicy(AdministrationPolicy&& rhs);
-
-       AdministrationPolicy& operator=(const AdministrationPolicy& rhs);
-       AdministrationPolicy& operator=(AdministrationPolicy&& rhs);
-
-       int registerPolicyClient(const std::string& name, uid_t uid);
-       int deregisterPolicyClient(const std::string& name, uid_t uid);
-
-private:
-       struct Private;
-       std::unique_ptr<Private> pimpl;
-};
-
-} // namespace DevicePolicyManager
-#endif // __ADMINISTRATION_POLICY__
diff --git a/policy/application.hxx b/policy/application.hxx
deleted file mode 100644 (file)
index c141441..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#ifndef __APPLICATION_POLICY__
-#define __APPLICATION_POLICY__
-
-#include "policy-context.hxx"
-
-namespace DevicePolicyManager {
-
-class ApplicationPolicy {
-public:
-       enum PrivilegeType {
-               PRIVILEGE_TYPE_WRT = 0,
-               PRIVILEGE_TYPE_CORE = 1
-       };
-
-       enum RestrictionMode {
-               RESTRICTION_MODE_ALL = 0x0F,
-               RESTRICTION_MODE_INSTALL = 0x01,
-               RESTRICTION_MODE_UNINSTALL = 0x02,
-               RESTRICTION_MODE_REINSTALL = 0x04,
-               RESTRICTION_MODE_MVOE = 0x08
-       };
-
-       ApplicationPolicy(PolicyControlContext& ctxt);
-       ~ApplicationPolicy();
-
-       ApplicationPolicy(const ApplicationPolicy& rhs);
-       ApplicationPolicy(ApplicationPolicy&& rhs);
-
-       ApplicationPolicy& operator=(const ApplicationPolicy& rhs);
-       ApplicationPolicy& operator=(ApplicationPolicy&& rhs);
-
-
-       int installPackage(const std::string& pkgpath);
-       int uninstallPackage(const std::string& pkgid);
-
-       int setModeRestriction(int mode);
-       int unsetModeRestriction(int mode);
-       int getModeRestriction();
-
-       int addPrivilegeToBlacklist(int type, const std::string& privilege);
-       int removePrivilegeFromBlacklist(int type, const std::string& privilege);
-       int checkPrivilegeIsBlacklisted(int type, const std::string& privilege);
-
-private:
-       struct Private;
-       std::unique_ptr<Private> pimpl;
-};
-
-} // namespace DevicePolicyManager
-#endif // __APPLICATION_POLICY__
diff --git a/policy/bluetooth.hxx b/policy/bluetooth.hxx
deleted file mode 100644 (file)
index fd2e3bb..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *  Copyright (c) 2016 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
- */
-
-#ifndef __BLUETOOTH_POLICY__
-#define __BLUETOOTH_POLICY__
-
-#include "policy-context.hxx"
-
-namespace DevicePolicyManager {
-
-/**
- * This class provides APIs to control bluetooth functionalities
- * such as bluetooth device or uuid restriction
- */
-
-class BluetoothPolicy {
-public:
-       BluetoothPolicy(PolicyControlContext& ctxt);
-       ~BluetoothPolicy();
-
-       BluetoothPolicy(const BluetoothPolicy& rhs);
-       BluetoothPolicy(BluetoothPolicy&& rhs);
-
-       BluetoothPolicy& operator=(const BluetoothPolicy& rhs);
-       BluetoothPolicy& operator=(BluetoothPolicy&& rhs);
-
-       // for restriction CPIs
-       int setModeChangeState(bool enable);
-       bool getModeChangeState();
-       int setDesktopConnectivityState(bool enable);
-       bool getDesktopConnectivityState();
-       int setTetheringState(bool enable);
-       bool getTetheringState();
-       int setPairingState(bool enable);
-       bool getPairingState();
-
-       // for bluetooth CAPIs
-       int addDeviceToBlacklist(const std::string& mac);
-       int removeDeviceFromBlacklist(const std::string& mac);
-       int setDeviceRestriction(bool enable);
-       bool isDeviceRestricted();
-
-       int addUuidToBlacklist(const std::string& uuid);
-       int removeUuidFromBlacklist(const std::string& uuid);
-       int setUuidRestriction(bool enable);
-       bool isUuidRestricted();
-
-private:
-       struct Private;
-       std::unique_ptr<Private> pimpl;
-};
-
-} // namespace DevicePolicyManager
-#endif // __BLUETOOTH_POLICY__
diff --git a/policy/krate.hxx b/policy/krate.hxx
deleted file mode 100644 (file)
index a638c54..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#ifndef __KRATE_POLICY__
-#define __KRATE_POLICY__
-
-#include "policy-context.hxx"
-
-namespace DevicePolicyManager {
-
-class KratePolicy {
-public:
-       enum State {
-               Locked      = 0x01,
-               Running     = 0x02,
-       };
-
-       KratePolicy(PolicyControlContext& ctxt);
-       ~KratePolicy();
-
-       KratePolicy(const KratePolicy& rhs);
-       KratePolicy(KratePolicy&& rhs);
-
-       KratePolicy& operator=(const KratePolicy& rhs);
-       KratePolicy& operator=(KratePolicy&& rhs);
-
-       int createKrate(const std::string& name, const std::string& setupWizardAppid);
-       int removeKrate(const std::string& name);
-
-       int getKrateState(const std::string& name);
-
-       std::vector<std::string> getKrateList(int state);
-
-private:
-       struct Private;
-       std::unique_ptr<Private> pimpl;
-};
-
-} // namespace DevicePolicyManager
-#endif // __KRATE_POLICY__
diff --git a/policy/location.hxx b/policy/location.hxx
deleted file mode 100644 (file)
index 4f071c3..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  Copyright (c) 2016 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
- */
-
-#ifndef __LOCATION_POLICY__
-#define __LOCATION_POLICY__
-
-#include "policy-context.hxx"
-
-namespace DevicePolicyManager {
-
-class LocationPolicy {
-public:
-       LocationPolicy(PolicyControlContext& ctxt);
-       ~LocationPolicy();
-
-       LocationPolicy(const LocationPolicy& rhs);
-       LocationPolicy(LocationPolicy&& rhs);
-
-       LocationPolicy& operator=(const LocationPolicy& rhs);
-       LocationPolicy& operator=(LocationPolicy&& rhs);
-
-       int setLocationState(bool enable);
-       bool getLocationState();
-
-private:
-       struct Private;
-       std::unique_ptr<Private> pimpl;
-};
-
-} // namespace DevicePolicyManager
-
-#endif /* __LOCATION_POLICY__ */
diff --git a/policy/password.hxx b/policy/password.hxx
deleted file mode 100644 (file)
index f35d323..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#ifndef __PASSWORD_POLICY__
-#define __PASSWORD_POLICY__
-
-#include "policy-context.hxx"
-
-namespace DevicePolicyManager {
-
-class PasswordPolicy {
-public:
-       typedef enum {
-               DPM_PASSWORD_QUALITY_UNSPECIFIED     = 0x00,    /**< No requirements for password. */
-               DPM_PASSWORD_QUALITY_SIMPLE_PASSWORD = 0x01,    /**< Eas requirement for simple password */
-               DPM_PASSWORD_QUALITY_SOMETHING       = 0x10,    /**< Some kind password is required, but doesn't care what it is */
-               DPM_PASSWORD_QUALITY_NUMERIC         = 0x20,    /**< Containing at least numeric characters */
-               DPM_PASSWORD_QUALITY_ALPHABETIC      = 0x40,    /**< Containing at least alphabetic (or other symbol) characters */
-               DPM_PASSWORD_QUALITY_ALPHANUMERIC    = 0x80,    /**< Containing at least numeric and alphabetic characters */
-       } PasswordPolicyQuality;
-
-       typedef enum {
-               DPM_PASSWORD_STATUS_NORMAL,                  /**< Password normal status */
-               DPM_PASSWORD_STATUS_CHANGED,                 /**< Password successfully changed */
-               DPM_PASSWORD_STATUS_NOT_CHANGED,             /**< Password not changed */
-               DPM_PASSWORD_STATUS_CHANGE_REQUIRED ,        /**< Password change required */
-               DPM_PASSWORD_STATUS_MAX_ATTEMPTS_EXCEEDED,   /**< Password Max Attempts Exceeded*/
-
-               DPM_PASSWORD_STATUS_EXPIRED,                                    /**< Password expired */
-               DPM_PASSWORD_STATUS_RECOVERY_PASSWORD_FAILED,   /**< Device unlock failed by Password Recovery */
-               DPM_PASSWORD_STATUS_RECOVERY_PASSWORD_SUCCEEDED,/**< Device unlock succeeded by Password Recovery */
-
-               DPM_PASSWORD_STATUS_QUALITY_CHANGED,                    /**< Password quality successfully changed */
-               DPM_PASSWORD_STATUS_MIN_LENGTH_CHANGED,                 /**< Password min_length successfully changed */
-               DPM_PASSWORD_STATUS_COMPLEX_CHAR_CHANGED,               /**< Password complex_char successfully changed */
-               DPM_PASSWORD_STATUS_PATTERN_CHANGED,                    /**< Password pattern successfully changed */
-               DPM_PASSWORD_STATUS_MAX
-       } PasswordPolicyStatus;
-
-       PasswordPolicy(PolicyControlContext &ctxt);
-       ~PasswordPolicy();
-
-       PasswordPolicy(const PasswordPolicy& rhs);
-       PasswordPolicy(PasswordPolicy&& rhs);
-
-       PasswordPolicy& operator=(const PasswordPolicy& rhs);
-       PasswordPolicy& operator=(PasswordPolicy&& rhs);
-
-       int setQuality(int quality);
-       int getQuality();
-       int setMinimumLength(int value);
-       int getMinimumLength();
-       int setMinComplexChars(int value);
-       int getMinComplexChars();
-       int setMaximumFailedForWipe(int value);
-       int getMaximumFailedForWipe();
-       int setExpires(int value);
-       int getExpires();
-       int setHistory(int value);
-       int getHistory();
-       int setPattern(const std::string &pattern);
-       int reset(const std::string &passwd);
-       int enforceChange();
-       int setMaxInactivityTimeDeviceLock(int value);
-       int getMaxInactivityTimeDeviceLock();
-       int setStatus(int status);
-       int getStatus();
-       int deletePattern();
-       std::string getPattern();
-       int setMaximumCharacterOccurrences(int value);
-       int getMaximumCharacterOccurrences();
-       int setMaximumNumericSequenceLength(int value);
-       int getMaximumNumericSequenceLength();
-       int setForbiddenStrings(const std::vector<std::string> &forbiddenStrings);
-       std::vector<std::string> getForbiddenStrings();
-       int setRecovery(int enable);
-       int getRecovery();
-
-private:
-       struct Private;
-       std::unique_ptr<Private> pimpl;
-};
-
-} /* namespace DevicePolicyManager */
-#endif /* __PASSWORD_POLICY__ */
diff --git a/policy/restriction.hxx b/policy/restriction.hxx
deleted file mode 100644 (file)
index 8a5245a..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- *  Copyright (c) 2016 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
- */
-
-#ifndef __RESTRICTION_POLICY__
-#define __RESTRICTION_POLICY__
-
-#include "policy-context.hxx"
-
-namespace DevicePolicyManager {
-
-class RestrictionPolicy {
-public:
-       RestrictionPolicy(PolicyControlContext& ctxt);
-       ~RestrictionPolicy();
-
-       RestrictionPolicy(const RestrictionPolicy& rhs);
-       RestrictionPolicy(RestrictionPolicy&& rhs);
-
-       RestrictionPolicy& operator=(const RestrictionPolicy& rhs);
-       RestrictionPolicy& operator=(RestrictionPolicy&& rhs);
-
-       int setCameraState(bool enable);
-       bool getCameraState();
-
-       int setMicrophoneState(bool enable);
-       bool getMicrophoneState();
-
-       int setClipboardState(bool enable);
-       bool getClipboardState();
-
-       int setUsbDebuggingState(bool enable);
-       bool getUsbDebuggingState();
-
-       int setUsbTetheringState(bool enable);
-       bool getUsbTetheringState();
-
-       int setExternalStorageState(bool enable);
-       bool getExternalStorageState();
-
-       int setPopImapEmailState(bool enable);
-       bool getPopImapEmailState();
-
-       int setMessagingState(const std::string& sim_id, bool enable);
-       bool getMessagingState(const std::string& sim_id);
-
-       int setBrowserState(bool enable);
-       bool getBrowserState();
-
-private:
-       struct Private;
-       std::unique_ptr<Private> pimpl;
-};
-
-} // namespace DevicePolicyManager
-
-#endif /* __RESTRICTION_POLICY__ */
diff --git a/policy/security.hxx b/policy/security.hxx
deleted file mode 100644 (file)
index 9fa0801..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#ifndef __SECURITY_POLICY__
-#define __SECURITY_POLICY__
-
-#include "policy-context.hxx"
-
-namespace DevicePolicyManager {
-
-/**
- * This class provides APIs to control security functionalities
- * such as certificate installation, encryption and wipe
- */
-
-class SecurityPolicy {
-public:
-       SecurityPolicy(PolicyControlContext& ctxt);
-       ~SecurityPolicy();
-
-       SecurityPolicy(const SecurityPolicy& rhs);
-       SecurityPolicy(SecurityPolicy&& rhs);
-
-       SecurityPolicy& operator=(const SecurityPolicy& rhs);
-       SecurityPolicy& operator=(SecurityPolicy&& rhs);
-
-       int lockoutScreen();
-       int wipeData(int id);
-       int setInternalStorageEncryption(bool encrypt);
-       bool isInternalStorageEncrypted();
-       int setExternalStorageEncryption(bool encrypt);
-       bool isExternalStorageEncrypted();
-
-private:
-       struct Private;
-       std::unique_ptr<Private> pimpl;
-};
-
-} // namespace DevicePolicyManager
-#endif // __SECURITY_POLICY__
diff --git a/policy/smack.hxx b/policy/smack.hxx
deleted file mode 100644 (file)
index 8b3f13d..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- *  Copyright (c) 2017 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 smack.hxx
- *  @brief SMACK agent internal interface.
- *  @author Dmytro Logachev (d.logachev@samsung.com)
- *  @date Created Oct 13, 2016
- *  @par In Samsung Ukraine R&D Center (SRK) under a contract between
- *  @par LLC "Samsung Electronics Ukraine Company" (Kyiv, Ukraine)
- *  @par and "Samsung Electronics Co", Ltd (Seoul, Republic of Korea)
- *  @par Copyright: (c) Samsung Electronics Co, Ltd 2016. All rights reserved.
-**/
-
-#ifndef __SMACK_SECURITY_MONITOR__
-#define __SMACK_SECURITY_MONITOR__
-
-#include "policy-context.hxx"
-
-namespace DevicePolicyManager {
-
-/**
- * This class provides APIs to control smack security monitor functionalities
- */
-
-class SmackSecurityMonitor {
-public:
-       SmackSecurityMonitor(PolicyControlContext &ctxt);
-       ~SmackSecurityMonitor();
-
-       SmackSecurityMonitor(const SmackSecurityMonitor &rhs);
-       SmackSecurityMonitor(SmackSecurityMonitor &&rhs);
-
-       SmackSecurityMonitor &operator=(const SmackSecurityMonitor &rhs);
-       SmackSecurityMonitor &operator=(SmackSecurityMonitor &&rhs);
-
-       /**
-       * @brief       Returns SMACK report.
-       * @details     This API can be used for requesting current SMACK report
-       * @return      String contains SMACK report
-       */
-       std::string getReport();
-
-       /**
-        * @brief       Returns number of SMACK issues.
-        * @details     This API can be used for requesting current number of of SMACK issues
-        * @return      Number of threats
-        */
-       int getIssueCount();
-
-private:
-       struct Private;
-       std::unique_ptr<Private> pimpl;
-};
-
-} // namespace DevicePolicyManager
-#endif // __SMACK_SECURITY_MONITOR__
diff --git a/policy/storage.hxx b/policy/storage.hxx
deleted file mode 100644 (file)
index 31ca994..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *  Copyright (c) 2016 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
- */
-
-#ifndef __STORAGE_POLICY__
-#define __STORAGE_POLICY__
-
-#include "policy-context.hxx"
-
-namespace DevicePolicyManager {
-
-class StoragePolicy {
-public:
-       enum {
-               WIPE_INTERNAL_STORAGE = (1 << 0),
-               WIPE_EXTERNAL_STORAGE = (1 << 1)
-       };
-
-       StoragePolicy(PolicyControlContext& ctxt);
-       ~StoragePolicy();
-
-       StoragePolicy(const StoragePolicy& rhs);
-       StoragePolicy(StoragePolicy&& rhs);
-
-       StoragePolicy& operator=(const StoragePolicy& rhs);
-       StoragePolicy& operator=(StoragePolicy&& rhs);
-
-       int wipeData(int id);
-
-private:
-       struct Private;
-       std::unique_ptr<Private> pimpl;
-};
-
-} // namespace DeivcePolicyManager
-
-#endif //!__STORAGE_POLICY__
diff --git a/policy/wifi.hxx b/policy/wifi.hxx
deleted file mode 100644 (file)
index e77c050..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#ifndef __WIFI_POLICY__
-#define __WIFI_POLICY__
-
-#include "policy-context.hxx"
-
-namespace DevicePolicyManager {
-
-/**
- * This class provides APIs to configure Wi-Fi related settings and manage Wi-Fi profiles.
- */
-
-class WifiPolicy {
-public:
-       WifiPolicy(PolicyControlContext& ctxt);
-       ~WifiPolicy();
-
-       WifiPolicy(const WifiPolicy& rhs);
-       WifiPolicy(WifiPolicy&& rhs);
-
-       WifiPolicy& operator=(const WifiPolicy& rhs);
-       WifiPolicy& operator=(WifiPolicy&& rhs);
-
-       int setState(bool enable);
-       bool getState();
-
-       int setHotspotState(bool enable);
-       bool getHotspotState();
-
-       int setProfileChangeRestriction(bool restrict);
-       bool isProfileChangeRestricted();
-
-       int setNetworkAccessRestriction(bool restrict);
-       bool isNetworkAccessRestricted();
-
-       int addSsidToBlocklist(const std::string& ssid);
-       int removeSsidFromBlocklist(const std::string& ssid);
-
-private:
-       struct Private;
-       std::unique_ptr<Private> pimpl;
-};
-
-} // namespace DevicePolicyManager
-#endif // __WIFI_POLICY__
diff --git a/restriction.cpp b/restriction.cpp
deleted file mode 100644 (file)
index 9decd7f..0000000
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- *  Copyright (c) 2016 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
- */
-
-#include "status.h"
-#include "restriction.hxx"
-
-namespace DevicePolicyManager {
-
-struct RestrictionPolicy::Private {
-       Private(PolicyControlContext& ctxt) : context(ctxt) {}
-       PolicyControlContext& context;
-};
-
-RestrictionPolicy::RestrictionPolicy(RestrictionPolicy&& rhs) = default;
-RestrictionPolicy& RestrictionPolicy::operator=(RestrictionPolicy&& rhs) = default;
-
-RestrictionPolicy::RestrictionPolicy(const RestrictionPolicy& rhs)
-{
-       std::cout << "Copy Constructor" << std::endl;
-       if (rhs.pimpl) {
-               pimpl.reset(new Private(*rhs.pimpl));
-       }
-}
-
-RestrictionPolicy& RestrictionPolicy::operator=(const RestrictionPolicy& rhs)
-{
-       std::cout << "Copy Operator" << std::endl;
-       if (!rhs.pimpl) {
-               pimpl.reset();
-       } else {
-               pimpl.reset(new Private(*rhs.pimpl));
-       }
-
-       return *this;
-}
-
-RestrictionPolicy::RestrictionPolicy(PolicyControlContext& ctxt) :
-       pimpl(new Private(ctxt))
-{
-}
-
-RestrictionPolicy::~RestrictionPolicy()
-{
-}
-
-int RestrictionPolicy::setMicrophoneState(bool enable)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("RestrictionPolicy::setMicrophoneState", enable);
-
-       return status.get();
-}
-
-bool RestrictionPolicy::getMicrophoneState()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<bool> status { true };
-
-       status = context.methodCall<bool>("RestrictionPolicy::getMicrophoneState");
-
-       return status.get();
-}
-
-int RestrictionPolicy::setCameraState(bool enable)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("RestrictionPolicy::setCameraState", enable);
-
-       return status.get();
-}
-
-bool RestrictionPolicy::getCameraState()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<bool> status { true };
-
-       status = context.methodCall<bool>("RestrictionPolicy::getCameraState");
-
-       return status.get();
-}
-
-int RestrictionPolicy::setClipboardState(bool enable)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("RestrictionPolicy::setClipboardState", enable);
-
-       return status.get();
-}
-
-bool RestrictionPolicy::getClipboardState()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<bool> status { true };
-
-       status = context.methodCall<bool>("RestrictionPolicy::getClipboardState");
-
-       return status.get();
-}
-
-int RestrictionPolicy::setUsbDebuggingState(bool enable)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("RestrictionPolicy::setUsbDebuggingState", enable);
-
-       return status.get();
-}
-
-bool RestrictionPolicy::getUsbDebuggingState()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<bool> status { true };
-
-       status = context.methodCall<bool>("RestrictionPolicy::getUsbDebuggingState");
-
-       return status.get();
-}
-
-int RestrictionPolicy::setUsbTetheringState(bool enable)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("RestrictionPolicy::setUsbTetheringState", enable);
-
-       return status.get();
-}
-
-bool RestrictionPolicy::getUsbTetheringState()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<bool> status { true };
-
-       status = context.methodCall<bool>("RestrictionPolicy::getUsbTetheringState");
-
-       return status.get();
-}
-
-int RestrictionPolicy::setExternalStorageState(bool enable)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("RestrictionPolicy::setExternalStorageState", enable);
-
-       return status.get();
-}
-
-bool RestrictionPolicy::getExternalStorageState()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<bool> status { true };
-
-       status = context.methodCall<bool>("RestrictionPolicy::getExternalStorageState");
-
-       return status.get();
-}
-
-int RestrictionPolicy::setPopImapEmailState(bool enable)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("RestrictionPolicy::setPopImapEmailState", enable);
-
-       return status.get();
-}
-
-bool RestrictionPolicy::getPopImapEmailState()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<bool> status { true };
-
-       status = context.methodCall<bool>("RestrictionPolicy::getPopImapEmailState");
-
-       return status.get();
-}
-
-int RestrictionPolicy::setMessagingState(const std::string &sim_id, bool enable)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("RestrictionPolicy::setMessagingState", sim_id, enable);
-
-       return status.get();
-}
-
-bool RestrictionPolicy::getMessagingState(const std::string &sim_id)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<bool> status { true };
-
-       status = context.methodCall<bool>("RestrictionPolicy::getMessagingState", sim_id);
-
-       return status.get();
-}
-
-int RestrictionPolicy::setBrowserState(bool enable)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("RestrictionPolicy::setBrowserState", enable);
-
-       return status.get();
-}
-
-bool RestrictionPolicy::getBrowserState()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<bool> status { true };
-
-       status = context.methodCall<bool>("RestrictionPolicy::getBrowserState");
-
-       return status.get();
-}
-
-} //namespace DevicePolicyManager
diff --git a/security.cpp b/security.cpp
deleted file mode 100644 (file)
index cb2513d..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#include "status.h"
-#include "security.hxx"
-
-namespace DevicePolicyManager {
-
-struct SecurityPolicy::Private {
-       Private(PolicyControlContext& ctxt) : context(ctxt) {}
-       PolicyControlContext& context;
-};
-
-SecurityPolicy::SecurityPolicy(SecurityPolicy&& rhs) = default;
-SecurityPolicy& SecurityPolicy::operator=(SecurityPolicy&& rhs) = default;
-
-SecurityPolicy::SecurityPolicy(const SecurityPolicy& rhs)
-{
-       if (rhs.pimpl) {
-               pimpl.reset(new Private(*rhs.pimpl));
-       }
-}
-
-SecurityPolicy& SecurityPolicy::operator=(const SecurityPolicy& rhs)
-{
-       if (!rhs.pimpl) {
-               pimpl.reset();
-       } else {
-               pimpl.reset(new Private(*rhs.pimpl));
-       }
-
-       return *this;
-}
-
-SecurityPolicy::SecurityPolicy(PolicyControlContext& ctxt) :
-       pimpl(new Private(ctxt))
-{
-}
-
-SecurityPolicy::~SecurityPolicy()
-{
-}
-
-int SecurityPolicy::lockoutScreen()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("SecurityPolicy::lockoutScreen");
-
-       return status.get();
-}
-
-int SecurityPolicy::setInternalStorageEncryption(bool encrypt)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("SecurityPolicy::setInternalStorageEncryption", encrypt);
-
-       return status.get();
-}
-
-bool SecurityPolicy::isInternalStorageEncrypted()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<bool> status { false };
-
-       status = context.methodCall<int>("SecurityPolicy::isInternalStorageEncrypted");
-
-       return status.get();
-}
-
-int SecurityPolicy::setExternalStorageEncryption(bool encrypt)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("SecurityPolicy::setExternalStorageEncryption", encrypt);
-
-       return status.get();
-}
-
-bool SecurityPolicy::isExternalStorageEncrypted()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<bool> status { false };
-
-       status = context.methodCall<int>("SecurityPolicy::isExternalStorageEncrypted");
-
-       return status.get();
-}
-
-} // namespace DevicePolicyManager
diff --git a/status.h b/status.h
deleted file mode 100644 (file)
index 2336af6..0000000
--- a/status.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#ifndef __STATUS_H__
-#define __STATUS_H__
-
-#include <cerrno>
-#include <utility>
-
-template<typename Type>
-class Status {
-public:
-       Status() = delete;
-       Status(Type&& defaultValue) : value(std::forward<Type>(defaultValue))
-       {
-               errno = 0;
-       }
-
-       void operator=(Type&& newValue)
-       {
-               if (errno == 0)
-                       value = newValue;
-       }
-
-       Type get() const
-       {
-               return value;
-       }
-
-private:
-       Type value;
-};
-
-#endif //!__STATUS_H__
diff --git a/storage.cpp b/storage.cpp
deleted file mode 100644 (file)
index 2d98adc..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#include "status.h"
-#include "storage.hxx"
-
-namespace DevicePolicyManager {
-
-struct StoragePolicy::Private {
-       Private(PolicyControlContext& ctxt) : context(ctxt) {}
-       PolicyControlContext& context;
-};
-
-StoragePolicy::StoragePolicy(StoragePolicy&& rhs) = default;
-StoragePolicy& StoragePolicy::operator=(StoragePolicy&& rhs) = default;
-
-StoragePolicy::StoragePolicy(const StoragePolicy& rhs)
-{
-       if (rhs.pimpl) {
-               pimpl.reset(new Private(*rhs.pimpl));
-       }
-}
-
-StoragePolicy& StoragePolicy::operator=(const StoragePolicy& rhs)
-{
-       if (!rhs.pimpl) {
-               pimpl.reset();
-       } else {
-               pimpl.reset(new Private(*rhs.pimpl));
-       }
-
-       return *this;
-}
-
-StoragePolicy::StoragePolicy(PolicyControlContext& ctx) :
-       pimpl(new Private(ctx))
-{
-}
-
-StoragePolicy::~StoragePolicy()
-{
-}
-
-int StoragePolicy::wipeData(int type)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("StoragePolicy::wipeData", type);
-
-       return status.get();
-}
-
-} //namespace DevicePolicyManager
diff --git a/wifi.cpp b/wifi.cpp
deleted file mode 100644 (file)
index 69d338e..0000000
--- a/wifi.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#include "status.h"
-#include "wifi.hxx"
-
-namespace DevicePolicyManager {
-
-struct WifiPolicy::Private {
-       Private(PolicyControlContext& ctxt) : context(ctxt) {}
-       PolicyControlContext& context;
-};
-
-WifiPolicy::WifiPolicy(WifiPolicy&& rhs) = default;
-WifiPolicy& WifiPolicy::operator=(WifiPolicy&& rhs) = default;
-
-WifiPolicy::WifiPolicy(const WifiPolicy& rhs)
-{
-       if (rhs.pimpl) {
-               pimpl.reset(new Private(*rhs.pimpl));
-       }
-}
-
-
-WifiPolicy& WifiPolicy::operator=(const WifiPolicy& rhs)
-{
-       if (!rhs.pimpl) {
-               pimpl.reset();
-       } else {
-               pimpl.reset(new Private(*rhs.pimpl));
-       }
-
-       return *this;
-}
-
-WifiPolicy::WifiPolicy(PolicyControlContext& ctxt) :
-       pimpl(new Private(ctxt))
-{
-}
-
-WifiPolicy::~WifiPolicy()
-{
-}
-
-int WifiPolicy::setState(bool enable)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("WifiPolicy::setState", enable);
-
-       return status.get();
-}
-
-bool WifiPolicy::getState()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<bool> status { true };
-
-       status = context.methodCall<bool>("WifiPolicy::getState");
-
-       return status.get();
-}
-
-int WifiPolicy::setHotspotState(bool enable)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("WifiPolicy::setHotspotState", enable);
-
-       return status.get();
-}
-
-bool WifiPolicy::getHotspotState()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<bool> status { true };
-
-       status = context.methodCall<bool>("WifiPolicy::getHotspotState");
-
-       return status.get();
-}
-
-int WifiPolicy::setProfileChangeRestriction(bool enable)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("WifiPolicy::setProfileChangeRestriction", enable);
-
-       return status.get();
-}
-
-bool WifiPolicy::isProfileChangeRestricted()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<bool> status { false };
-
-       status = context.methodCall<bool>("WifiPolicy::isProfileChangeRestricted");
-
-       return status.get();
-}
-
-int WifiPolicy::setNetworkAccessRestriction(bool enable)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("WifiPolicy::setNetworkAccessRestriction", enable);
-
-       return status.get();
-}
-
-bool WifiPolicy::isNetworkAccessRestricted()
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<bool> status { false };
-
-       status = context.methodCall<bool>("WifiPolicy::isNetworkAccessRestricted");
-
-       return status.get();
-}
-
-int WifiPolicy::addSsidToBlocklist(const std::string& ssid)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("WifiPolicy::addSsidToBlocklist", ssid);
-
-       return status.get();
-}
-
-int WifiPolicy::removeSsidFromBlocklist(const std::string& ssid)
-{
-       PolicyControlContext& context = pimpl->context;
-
-       Status<int> status { -1 };
-
-       status = context.methodCall<int>("WifiPolicy::removeSsidFromBlocklist", ssid);
-
-       return status.get();
-}
-
-} // namespace DevicePolicyManager