[SECIOTSW-498] Add device policy client library codes which were in device policy... 99/129799/4 accepted/tizen/unified/20170519.200506 submit/tizen/20170519.085134 tizen_4.0.m1_release
authorLee Sung Jun <sjun221.lee@samsung.com>
Thu, 18 May 2017 06:29:22 +0000 (15:29 +0900)
committerSeok Hong <seok85.hong@samsung.com>
Fri, 19 May 2017 08:25:00 +0000 (17:25 +0900)
Change-Id: Ie7bd2a84165c323e3c0fbc0d721b7bb8240ff85a
Signed-off-by: Lee Sung Jun <sjun221.lee@samsung.com>
Signed-off-by: Seok Hong <seok85.hong@samsung.com>
67 files changed:
CMakeLists.txt
LICENSE [new file with mode: 0644]
administration.cpp [new file with mode: 0644]
application.cpp [new file with mode: 0644]
bluetooth.cpp [new file with mode: 0644]
doc/diagram/class/dpm.uml [new file with mode: 0644]
doc/diagram/class/ipc.uml [new file with mode: 0644]
doc/diagram/sequence/ipc-dispatch.uml [new file with mode: 0644]
doc/diagram/sequence/ipc-transmit.uml [new file with mode: 0644]
doc/diagram/usecase/dpm.uml [new file with mode: 0644]
doc/documentation.sh [new file with mode: 0755]
doc/doxygen.cfg [new file with mode: 0644]
doc/dpm_doc.h [new file with mode: 0644]
doc/images/dpm.png [new file with mode: 0644]
doc/mainpage.dox [new file with mode: 0755]
dpm.pc.in [new file with mode: 0644]
dpm/administration.cpp [new file with mode: 0644]
dpm/administration.h [new file with mode: 0644]
dpm/application.cpp [new file with mode: 0644]
dpm/application.h [new file with mode: 0644]
dpm/array.h [new file with mode: 0644]
dpm/bluetooth.cpp [new file with mode: 0644]
dpm/bluetooth.h [new file with mode: 0644]
dpm/client-handle.cpp [new file with mode: 0644]
dpm/debug.h [new file with mode: 0644]
dpm/device-policy-manager.h [new file with mode: 0644]
dpm/password.cpp [new file with mode: 0644]
dpm/password.h [new file with mode: 0644]
dpm/password_internal.h [new file with mode: 0644]
dpm/restriction.cpp [new file with mode: 0644]
dpm/restriction.h [new file with mode: 0644]
dpm/security.cpp [new file with mode: 0644]
dpm/security.h [new file with mode: 0644]
dpm/storage.cpp [new file with mode: 0644]
dpm/storage.h [new file with mode: 0644]
dpm/wifi.cpp [new file with mode: 0644]
dpm/wifi.h [new file with mode: 0644]
dpm/zone.cpp [new file with mode: 0755]
dpm/zone.h [new file with mode: 0644]
dsm/CMakeLists.txt [new file with mode: 0644]
dsm/dsm.pc.in [new file with mode: 0644]
dsm/dsm/smack.cpp [new file with mode: 0644]
dsm/dsm/smack.h [new file with mode: 0644]
dsm/smack.cpp [new file with mode: 0644]
krate.cpp [new file with mode: 0644]
location.cpp [new file with mode: 0644]
packaging/device-policy-client.spec
password.cpp [new file with mode: 0644]
policy-client.cpp [new file with mode: 0644]
policy-client.h [new file with mode: 0644]
policy-context.hxx [moved from place-holder.c with 66% similarity]
policy/administration.hxx [new file with mode: 0644]
policy/application.hxx [new file with mode: 0644]
policy/bluetooth.hxx [new file with mode: 0644]
policy/krate.hxx [new file with mode: 0644]
policy/location.hxx [new file with mode: 0644]
policy/password.hxx [new file with mode: 0644]
policy/restriction.hxx [new file with mode: 0644]
policy/security.hxx [new file with mode: 0644]
policy/smack.hxx [new file with mode: 0644]
policy/storage.hxx [new file with mode: 0644]
policy/wifi.hxx [new file with mode: 0644]
restriction.cpp [new file with mode: 0644]
security.cpp [new file with mode: 0644]
status.h [new file with mode: 0644]
storage.cpp [new file with mode: 0644]
wifi.cpp [new file with mode: 0644]

index ed66685..ae7d9c0 100755 (executable)
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+# 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.
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-
 CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
 
-PROJECT(device-policy-client)
+PROJECT(dpm)
+SET(LIB_VERSION "${VERSION}")
+SET(LIB_SOVERSION "0")
+
+INCLUDE(FindPkgConfig)
+
+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}/)
+
+IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
+       SET(CXX_STD "c++0x")
+else()
+       SET(CXX_STD "c++11")
+endif()
+
+SET(COMPILE_BASE_FLAGS         "-g -fPIC -Werror -Wall -Wl,--as-needed -Wl,--no-whole-archive")
+SET(CMAKE_C_FLAGS_PROFILING    "${COMPILE_BASE_FLAGS} -O0 -pg")
+SET(CMAKE_CXX_FLAGS_PROFILING  "${COMPILE_BASE_FLAGS} -O0 -pg -std=${CXX_STD} -fno-rtti")
+SET(CMAKE_C_FLAGS_DEBUG                "${COMPILE_BASE_FLAGS} -O0 -ggdb")
+SET(CMAKE_CXX_FLAGS_DEBUG      "${COMPILE_BASE_FLAGS} -O0 -ggdb -std=${CXX_STD} -fno-rtti")
+SET(CMAKE_C_FLAGS_RELEASE      "${COMPILE_BASE_FLAGS} -O2 -DNDEBUG")
+SET(CMAKE_CXX_FLAGS_RELEASE    "${COMPILE_BASE_FLAGS} -O2 -DNDEBUG -std=${CXX_STD} -fno-rtti")
+SET(CMAKE_C_FLAGS_CCOV         "${COMPILE_BASE_FLAGS} -O0 --coverage")
+SET(CMAKE_CXX_FLAGS_CCOV       "${COMPILE_BASE_FLAGS} -O0 --coverage -std=${CXX_STD} -fno-rtti")
 
-ADD_EXECUTABLE(${PROJECT_NAME} place-holder.c)
+IF(NOT DEFINED LIB_INSTALL_DIR)
+       SET(LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}")
+ENDIF(NOT DEFINED LIB_INSTALL_DIR)
+
+IF(NOT DEFINED INCLUDE_INSTALL_DIR)
+       SET(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}")
+ENDIF(NOT DEFINED INCLUDE_INSTALL_DIR)
+
+IF(NOT DEFINED TEST_DATA_INSTALL_DIR)
+    SET(TEST_DATA_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/dpm")
+ENDIF(NOT DEFINED TEST_DATA_INSTALL_DIR)
+
+ADD_DEFINITIONS(-DUG_WAYLAND)
+
+SET(PC_FILE "${PROJECT_NAME}.pc")
+
+SET(FOUNDATION          policy-client.cpp
+                                               dpm/client-handle.cpp
+)
 
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-fPIE")
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-pie")
-TARGET_COMPILE_DEFINITIONS(${PROJECT_NAME} PRIVATE
-       DATA_PATH="${DATA_INSTALL_DIR}"
-       RUN_PATH="${RUN_INSTALL_DIR}"
-       DB_PATH="${DB_INSTALL_DIR}"
+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
 )
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
+
+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)
+
+#Tizen Device Security Monitor Client Library
+ADD_SUBDIRECTORY(dsm)
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..26b7de6
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,204 @@
+Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
+
diff --git a/administration.cpp b/administration.cpp
new file mode 100644 (file)
index 0000000..507076f
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ *  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
new file mode 100644 (file)
index 0000000..429e6bd
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ *  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
new file mode 100644 (file)
index 0000000..ade8f32
--- /dev/null
@@ -0,0 +1,234 @@
+/*
+ *  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/doc/diagram/class/dpm.uml b/doc/diagram/class/dpm.uml
new file mode 100644 (file)
index 0000000..c676e29
--- /dev/null
@@ -0,0 +1,44 @@
+@startuml
+namespace IPC {
+
+class Socket
+class Message <DataType, Transmitter>
+
+Message ..> Message : create for reply or error
+
+class Connection <MainloopContext>
+
+Connection "1" *--> "1" Socket
+Connection ..> Message : create
+
+class Mainloop
+
+class Client <RequestType, ResponseType>
+
+Client "1" *-left-> "1" Connection
+
+class Service
+
+
+Service -right-> "1..*" Connection
+Service *--> "1" Mainloop
+
+}
+
+namespace DevicePolicyManager {
+class Server
+
+Server *-- "1" IPC.Service
+}
+
+namespace DevicePolicyContext {
+
+class PolicyClient <Request, Response>
+
+PolicyClient *-- "1" IPC.Client
+
+}
+
+@enduml
+
+
diff --git a/doc/diagram/class/ipc.uml b/doc/diagram/class/ipc.uml
new file mode 100644 (file)
index 0000000..a69cb73
--- /dev/null
@@ -0,0 +1,80 @@
+@startuml
+namespace IPC {
+
+class Socket {
+-socketFd : int
++Socket(int)
++write(const void* buffer, const size_t size) const : void
++read(void *buffer, const size_t size) const : void
++accept() : Socket
++getFd() const : int
++{static} Socket create(const std::string& address)
++{static} Socket connect(const std::string& address)
+}
+
+class Message <DataType, Transmitter> {
+-id : int
+-type : int
++Message(const Message& message)
++createReplyMessage() const : Message
++createErrorMessage() const : Message
++enclose(const DataType& data) : void
++disclose(DataType& data) : void
++encode(const Transmitter& data) : void
++decode(Transmitter& data) : void
+}
+
+Message ..> Message : create for reply or error
+
+class Connection <MainloopContext> {
+-socket : Socket
++Connection(Socket&& sock)
++createMessage(...) : Message
++send(const Message& message) : void
++dispatch() const : Message
++attachMainloopContext(MainloopContext)
+}
+
+Connection "1" *--> "1" Socket
+Connection ..> Message : create
+
+class Mainloop {
+-pollFd : int
++addEventSource(...) : void
++removeEventSource(const int fd) : void
++dispatch(const int timeout) : bool
++run(const int timeout = -1) : void
+}
+
+class Client <RequestType, ResponseType> {
+-connection : std::shared_ptr<Connection>
+-address : std::string
++Clent(const std::sting& address)
++connect() : void
++stop() : void
++methodCall(...) : ResponseType
+}
+
+Client "1" *-left-> "1" Connection
+
+class Service {
+-onNewConnection : CallbackDispatcher
+-oncloseConnection : CallbackDispatcher
+-methodRegistry : MethodRegistry
+-connectionRegistry : ConnectionRegistry
+-mainloop : Mainloop
+-address : std::string
++Service(const std::string& address)
++start() : void
++stop() : void
+setMethodhandler(...) : void
++setNewConnectionCallback(...) : void
++setCloseConnectionCallback(...) : void
+}
+
+Service -right-> "1..*" Connection
+Service *--> "1" Mainloop
+
+@enduml
+
+
diff --git a/doc/diagram/sequence/ipc-dispatch.uml b/doc/diagram/sequence/ipc-dispatch.uml
new file mode 100644 (file)
index 0000000..5ae5922
--- /dev/null
@@ -0,0 +1,129 @@
+@startuml
+hide footbox
+
+actor DevicePolicyContext
+DevicePolicyContext --> Mainloop : Request remote method call
+activate Mainloop
+
+Mainloop -> Service : Event source callback
+activate Service
+
+Service -> Service : onMessageProcess
+activate Service
+
+Service -> Connection : dispatch
+activate Connection
+
+participant CallbackHolder
+
+Connection -> Message : decode
+activate Message
+
+Message -> Socket : read
+activate Socket
+
+Message <-- Socket
+deactivate Socket
+
+Connection <-- Message
+deactivate Message
+
+Service <-- Connection
+deactivate Connection
+
+Service -> CallbackHolder : dispatch
+activate CallbackHolder
+
+loop for all parameters
+CallbackHolder -> CallbackHolder : buildParameters
+activate CallbackHolder
+
+CallbackHolder -> Message : disclose
+activate Message
+
+Message -> Parameter : accept
+activate Parameter
+
+Parameter -> Deserializer : visit
+activate Deserializer
+
+participant Serializer
+
+Deserializer -> MessageBuffer : read
+activate MessageBuffer
+
+Deserializer <-- MessageBuffer
+deactivate MessageBuffer
+
+Parameter <-- Deserializer
+deactivate Deserializer
+
+Message <-- Parameter
+deactivate Parameter
+
+CallbackHolder <-- Message
+deactivate Message
+deactivate CallbackHolder
+
+end
+
+CallbackHolder -> CallbackHandler : dispatch
+activate CallbackHandler
+
+CallbackHolder <-- CallbackHandler : return result of callback handler
+deactivate CallbackHandler
+
+Service <-- CallbackHolder : return result of callback handler
+deactivate CallbackHolder
+
+Service -> Message : createReplyMessage
+activate Message
+
+Service <-- Message : return reply message
+deactivate Message
+
+Service -> Message : enclose
+activate Message
+Message -> Parameter : accept
+activate Parameter
+
+Parameter -> Serializer : visit
+activate Serializer
+
+Serializer -> MessageBuffer : write
+activate MessageBuffer
+
+Serializer <-- MessageBuffer
+deactivate MessageBuffer
+
+Parameter <-- Serializer
+deactivate Serializer
+
+Message <-- Parameter
+deactivate Parameter
+
+Service <-- Message
+deactivate Message
+
+Service -> Connection : send
+activate Connection
+
+Connection -> Message : encode
+activate Message
+
+Message -> Socket : write
+activate Socket
+
+Message <-- Socket
+deactivate Socket
+
+Connection <-- Message
+deactivate Message
+
+Service <-- Connection
+deactivate Connection
+
+Mainloop <-- Service
+deactivate Service
+
+@enduml
diff --git a/doc/diagram/sequence/ipc-transmit.uml b/doc/diagram/sequence/ipc-transmit.uml
new file mode 100644 (file)
index 0000000..c5e5a2a
--- /dev/null
@@ -0,0 +1,72 @@
+@startuml
+hide footbox
+actor Library
+
+Library -> PolicyClient : methodCall
+activate PolicyClient
+
+PolicyClient -> Client : methodCall
+activate Client
+
+Client -> Connection : createMessage
+activate Connection
+
+Client <-- Connection : return Message for method call
+deactivate Connection
+
+loop for all parameters
+Client -> Client : packParameters
+activate Client
+
+Client -> Message : enclose
+Activate Message
+
+Message -> Parameter : accept
+activate Parameter
+
+Parameter -> Serializer : visit
+activate Serializer
+
+Serializer -> MessageBuffer : write
+activate MessageBuffer
+
+Serializer <- MessageBuffer
+deactivate MessageBuffer
+
+Parameter <- Serializer
+deactivate Serializer
+
+Message <-- Parameter
+deactivate Parameter
+
+Client <-- Message
+deactivate Message
+deactivate Client
+end
+
+Client -> Connection : send
+activate Connection
+
+Connection -> Message : encode
+activate Message
+
+Message -> Socket : write
+activate Socket
+
+actor PolicyManager
+Socket --> PolicyManager : IPC
+activate PolicyManager
+Note right PolicyManager: PolicyManager dispatchs method call handler appropreate to the message
+Message <-- Socket
+deactivate Socket
+
+Connection <-- Message
+deactivate Message
+
+Client <-- Connection
+deactivate Connection
+
+... Wait for response...
+
+
+@enduml
diff --git a/doc/diagram/usecase/dpm.uml b/doc/diagram/usecase/dpm.uml
new file mode 100644 (file)
index 0000000..e10b785
--- /dev/null
@@ -0,0 +1,12 @@
+@startuml
+DevicePolicyToolkit --> DPC : use
+:Device Policy Client Library: as DPC
+:Device Policy Manager: as DPM
+:Tizen Framework: as Framework
+
+DPC --> DPM :IPC
+MDM --> DPC :use
+
+(DPM) --> (Policies) : manage
+(DPM) --> (Framework) : enforce
+@enduml
diff --git a/doc/documentation.sh b/doc/documentation.sh
new file mode 100755 (executable)
index 0000000..e9f4721
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/bash -e
+
+DOC_CFG="doxygen.cfg"
+
+# Check if doxy is visible
+echo -n "Checking for doxygen... "
+EXE_PATH=$(which doxygen)
+if [ ! -x "$EXE_PATH" ] ; then
+    echo "NOT FOUND, EXITING"
+else
+    echo "FOUND"
+fi
+
+# Change pwd to script dir, to keep the paths consistent
+pushd . > /dev/null
+cd "$(dirname "${BASH_SOURCE[0]}" )"
+
+doxygen "$DOC_CFG"
+
+popd > /dev/null
diff --git a/doc/doxygen.cfg b/doc/doxygen.cfg
new file mode 100644 (file)
index 0000000..8c2d3dd
--- /dev/null
@@ -0,0 +1,2309 @@
+# Doxyfile 1.8.6
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed in
+# front of the TAG it is preceding.
+#
+# All text after a single hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists, items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (\" \").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all text
+# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
+# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
+# for the list of possible encodings.
+# The default value is: UTF-8.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
+# double-quotes, unless you are using Doxywizard) that should identify the
+# project for which the documentation is generated. This name is used in the
+# title of most generated pages and in a few other places.
+# The default value is: My Project.
+
+PROJECT_NAME           = Device Policy Management
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
+# could be handy for archiving the generated documentation or if some version
+# control system is used.
+
+PROJECT_NUMBER         =
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer a
+# quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF          =
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
+# the documentation. The maximum height of the logo should not exceed 55 pixels
+# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
+# to the output directory.
+
+PROJECT_LOGO           =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
+# into which the generated documentation will be written. If a relative path is
+# entered, it will be relative to the location where doxygen was started. If
+# left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = ./
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
+# directories (in 2 levels) under the output directory of each output format and
+# will distribute the generated files over these directories. Enabling this
+# option can be useful when feeding doxygen a huge amount of source files, where
+# putting all generated files in the same directory would otherwise causes
+# performance problems for the file system.
+# The default value is: NO.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
+# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
+# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
+# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
+# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
+# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
+# Ukrainian and Vietnamese.
+# The default value is: English.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member
+# descriptions after the members that are listed in the file and class
+# documentation (similar to Javadoc). Set to NO to disable this.
+# The default value is: YES.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief
+# description of a member or function before the detailed description
+#
+# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+# The default value is: YES.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator that is
+# used to form the text in various listings. Each string in this list, if found
+# as the leading text of the brief description, will be stripped from the text
+# and the result, after processing the whole list, is used as the annotated
+# text. Otherwise, the brief description is used as-is. If left blank, the
+# following values are used ($name is automatically replaced with the name of
+# the entity):The $name class, The $name widget, The $name file, is, provides,
+# specifies, contains, represents, a, an and the.
+
+ABBREVIATE_BRIEF       =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# doxygen will generate a detailed section even if there is only a brief
+# description.
+# The default value is: NO.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+# The default value is: NO.
+
+INLINE_INHERITED_MEMB  = YES
+
+# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path
+# before files name in the file list and in the header files. If set to NO the
+# shortest path that makes the file name unique will be used
+# The default value is: YES.
+
+FULL_PATH_NAMES        = YES
+
+# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
+# Stripping is only done if one of the specified strings matches the left-hand
+# part of the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the path to
+# strip.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# will be relative from the directory where doxygen is started.
+# This tag requires that the tag FULL_PATH_NAMES is set to YES.
+
+STRIP_FROM_PATH        = ../
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
+# path mentioned in the documentation of a class, which tells the reader which
+# header file to include in order to use a class. If left blank only the name of
+# the header file containing the class definition is used. Otherwise one should
+# specify the list of include paths that are normally passed to the compiler
+# using the -I flag.
+
+STRIP_FROM_INC_PATH    =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
+# less readable) file names. This can be useful is your file systems doesn't
+# support long names like on DOS, Mac, or CD-ROM.
+# The default value is: NO.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
+# first line (until the first dot) of a Javadoc-style comment as the brief
+# description. If set to NO, the Javadoc-style will behave just like regular Qt-
+# style comments (thus requiring an explicit @brief command for a brief
+# description.)
+# The default value is: NO.
+
+JAVADOC_AUTOBRIEF      = YES
+
+# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
+# line (until the first dot) of a Qt-style comment as the brief description. If
+# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
+# requiring an explicit \brief command for a brief description.)
+# The default value is: NO.
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
+# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
+# a brief description. This used to be the default behavior. The new default is
+# to treat a multi-line C++ comment block as a detailed description. Set this
+# tag to YES if you prefer the old behavior instead.
+#
+# Note that setting this tag to YES also means that rational rose comments are
+# not recognized any more.
+# The default value is: NO.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
+# documentation from any documented member that it re-implements.
+# The default value is: YES.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a
+# new page for each member. If set to NO, the documentation of a member will be
+# part of the file/class/namespace that contains it.
+# The default value is: NO.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
+# uses this value to replace tabs by spaces in code fragments.
+# Minimum value: 1, maximum value: 16, default value: 4.
+
+TAB_SIZE               = 4
+
+# This tag can be used to specify a number of aliases that act as commands in
+# the documentation. An alias has the form:
+# name=value
+# For example adding
+# "sideeffect=@par Side Effects:\n"
+# will allow you to put the command \sideeffect (or @sideeffect) in the
+# documentation, which will result in a user-defined paragraph with heading
+# "Side Effects:". You can put \n's in the value part of an alias to insert
+# newlines.
+
+ALIASES                =
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding "class=itcl::class"
+# will allow you to use the command class in the itcl::class meaning.
+
+TCL_SUBST              =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C. For
+# instance, some of the names that are used will be different. The list of all
+# members will be omitted, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
+# Python sources only. Doxygen will then generate output that is more tailored
+# for that language. For instance, namespaces will be presented as packages,
+# qualified scopes will look different, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources. Doxygen will then generate output that is tailored for Fortran.
+# The default value is: NO.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for VHDL.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension, and
+# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
+# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
+# (default is Fortran), use: inc=Fortran f=C.
+#
+# Note For files without extension you can use no_extension as a placeholder.
+#
+# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
+# the files are not read by doxygen.
+
+EXTENSION_MAPPING      =
+
+# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
+# according to the Markdown format, which allows for more readable
+# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you can
+# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
+# case of backward compatibilities issues.
+# The default value is: YES.
+
+MARKDOWN_SUPPORT       = YES
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by by putting a % sign in front of the word
+# or globally by setting AUTOLINK_SUPPORT to NO.
+# The default value is: YES.
+
+AUTOLINK_SUPPORT       = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should set this
+# tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string);
+# versus func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+# The default value is: NO.
+
+BUILTIN_STL_SUPPORT    = YES
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+# The default value is: NO.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
+# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
+# will parse them like normal C++ but will assume all classes use public instead
+# of private inheritance when no explicit protection keyword is present.
+# The default value is: NO.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES will make
+# doxygen to replace the get and set methods by a property in the documentation.
+# This will only work if the methods are indeed getting or setting a simple
+# type. If this is not the case, or you want to show the methods anyway, you
+# should set this option to NO.
+# The default value is: YES.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+# The default value is: NO.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES to allow class member groups of the same type
+# (for instance a group of public functions) to be put as a subgroup of that
+# type (e.g. under the Public Functions section). Set it to NO to prevent
+# subgrouping. Alternatively, this can be done per class using the
+# \nosubgrouping command.
+# The default value is: YES.
+
+SUBGROUPING            = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
+# are shown inside the group in which they are included (e.g. using \ingroup)
+# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
+# and RTF).
+#
+# Note that this feature does not work in combination with
+# SEPARATE_MEMBER_PAGES.
+# The default value is: NO.
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
+# with only public data fields or simple typedef fields will be shown inline in
+# the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO, structs, classes, and unions are shown on a separate page (for HTML and
+# Man pages) or section (for LaTeX and RTF).
+# The default value is: NO.
+
+INLINE_SIMPLE_STRUCTS  = NO
+
+# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
+# enum is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically be
+# useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+# The default value is: NO.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can be
+# an expensive process and often the same symbol appears multiple times in the
+# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
+# doxygen will become slower. If the cache is too large, memory is wasted. The
+# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
+# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
+# symbols. At the end of a run doxygen will report the cache usage and suggest
+# the optimal cache size from a speed point of view.
+# Minimum value: 0, maximum value: 9, default value: 0.
+
+LOOKUP_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available. Private
+# class members and static file members will be hidden unless the
+# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
+# Note: This will also disable the warnings about undocumented members that are
+# normally produced when WARNINGS is set to YES.
+# The default value is: NO.
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
+# be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIVATE        = YES
+
+# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
+# scope will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PACKAGE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
+# included in the documentation.
+# The default value is: NO.
+
+EXTRACT_STATIC         = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
+# locally in source files will be included in the documentation. If set to NO
+# only classes defined in header files are included. Does not have any effect
+# for Java sources.
+# The default value is: YES.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local methods,
+# which are defined in the implementation section but not in the interface are
+# included in the documentation. If set to NO only methods in the interface are
+# included.
+# The default value is: NO.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base name of
+# the file that contains the anonymous namespace. By default anonymous namespace
+# are hidden.
+# The default value is: NO.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
+# undocumented members inside documented classes or files. If set to NO these
+# members will be included in the various overviews, but no documentation
+# section is generated. This option has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy. If set
+# to NO these classes will be included in the various overviews. This option has
+# no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
+# (class|struct|union) declarations. If set to NO these declarations will be
+# included in the documentation.
+# The default value is: NO.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
+# documentation blocks found inside the body of a function. If set to NO these
+# blocks will be appended to the function's detailed documentation block.
+# The default value is: NO.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation that is typed after a
+# \internal command is included. If the tag is set to NO then the documentation
+# will be excluded. Set it to YES to include the internal documentation.
+# The default value is: NO.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
+# names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+# The default value is: system dependent.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
+# their full class and namespace scopes in the documentation. If set to YES the
+# scope will be hidden.
+# The default value is: NO.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
+# the files that are included by a file in the documentation of that file.
+# The default value is: YES.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
+# grouped member an include statement to the documentation, telling the reader
+# which file to include in order to use the member.
+# The default value is: NO.
+
+SHOW_GROUPED_MEMB_INC  = NO
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
+# files with double quotes in the documentation rather than with sharp brackets.
+# The default value is: NO.
+
+FORCE_LOCAL_INCLUDES   = NO
+
+# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
+# documentation for inline members.
+# The default value is: YES.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
+# (detailed) documentation of file and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order.
+# The default value is: YES.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+# descriptions of file, namespace and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order. Note that
+# this will also influence the order of the classes in the class list.
+# The default value is: NO.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
+# (brief and detailed) documentation of class members so that constructors and
+# destructors are listed first. If set to NO the constructors will appear in the
+# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
+# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
+# member documentation.
+# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
+# detailed member documentation.
+# The default value is: NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
+# of group names into alphabetical order. If set to NO the group names will
+# appear in their defined order.
+# The default value is: NO.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
+# fully-qualified names, including namespaces. If set to NO, the class list will
+# be sorted only by class name, not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the alphabetical
+# list.
+# The default value is: NO.
+
+SORT_BY_SCOPE_NAME     = YES
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
+# type resolution of all parameters of a function it will reject a match between
+# the prototype and the implementation of a member function even if there is
+# only one candidate or it is obvious which candidate to choose by doing a
+# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
+# accept a match between prototype and implementation in such cases.
+# The default value is: NO.
+
+STRICT_PROTO_MATCHING  = NO
+
+# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the
+# todo list. This list is created by putting \todo commands in the
+# documentation.
+# The default value is: YES.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the
+# test list. This list is created by putting \test commands in the
+# documentation.
+# The default value is: YES.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug
+# list. This list is created by putting \bug commands in the documentation.
+# The default value is: YES.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO)
+# the deprecated list. This list is created by putting \deprecated commands in
+# the documentation.
+# The default value is: YES.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional documentation
+# sections, marked by \if <section_label> ... \endif and \cond <section_label>
+# ... \endcond blocks.
+
+ENABLED_SECTIONS       =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
+# initial value of a variable or macro / define can have for it to appear in the
+# documentation. If the initializer consists of more lines than specified here
+# it will be hidden. Use a value of 0 to hide initializers completely. The
+# appearance of the value of individual variables and macros / defines can be
+# controlled using \showinitializer or \hideinitializer command in the
+# documentation regardless of this setting.
+# Minimum value: 0, maximum value: 10000, default value: 30.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
+# the bottom of the documentation of classes and structs. If set to YES the list
+# will mention the files that were used to generate the documentation.
+# The default value is: YES.
+
+SHOW_USED_FILES        = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
+# will remove the Files entry from the Quick Index and from the Folder Tree View
+# (if specified).
+# The default value is: YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
+# page. This will remove the Namespaces entry from the Quick Index and from the
+# Folder Tree View (if specified).
+# The default value is: YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command command input-file, where command is the value of the
+# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
+# by doxygen. Whatever the program writes to standard output is used as the file
+# version. For an example see the documentation.
+
+FILE_VERSION_FILTER    =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option. You can
+# optionally specify a file name after the option, if omitted DoxygenLayout.xml
+# will be used as the name of the layout file.
+#
+# Note that if you run doxygen from a directory containing a file called
+# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
+# tag is left empty.
+
+LAYOUT_FILE            =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
+# the reference definitions. This must be a list of .bib files. The .bib
+# extension is automatically appended if omitted. This requires the bibtex tool
+# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
+# For LaTeX the style of the bibliography can be controlled using
+# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
+# search path. Do not use file names with spaces, bibtex cannot handle them. See
+# also \cite for info how to create references.
+
+CITE_BIB_FILES         =
+
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated to
+# standard output by doxygen. If QUIET is set to YES this implies that the
+# messages are off.
+# The default value is: NO.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES
+# this implies that the warnings are on.
+#
+# Tip: Turn warnings on while writing the documentation.
+# The default value is: YES.
+
+WARNINGS               = YES
+
+# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate
+# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
+# will automatically be disabled.
+# The default value is: YES.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some parameters
+# in a documented function, or documenting parameters that don't exist or using
+# markup commands wrongly.
+# The default value is: YES.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
+# are documented, but have no documentation for their parameters or return
+# value. If set to NO doxygen will only warn about wrong or incomplete parameter
+# documentation, but not about the absence of documentation.
+# The default value is: NO.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that doxygen
+# can produce. The string should contain the $file, $line, and $text tags, which
+# will be replaced by the file and line number from which the warning originated
+# and the warning text. Optionally the format may contain $version, which will
+# be replaced by the version of the file (if it could be obtained via
+# FILE_VERSION_FILTER)
+# The default value is: $file:$line: $text.
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning and error
+# messages should be written. If left blank the output is written to standard
+# error (stderr).
+
+WARN_LOGFILE           =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag is used to specify the files and/or directories that contain
+# documented source files. You may enter file names like myfile.cpp or
+# directories like /usr/src/myproject. Separate the files or directories with
+# spaces.
+# Note: If this tag is empty the current directory is searched.
+
+INPUT                  = mainpage.dox     \
+                         dpm_doc.h        \
+                         ../libs/dpm/device-policy-manager.h \
+                         ../libs/dpm/password.h \
+                         ../libs/dpm/restriction.h \
+                         ../libs/dpm/security.h \
+                         ../libs/dpm/zone.h
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
+# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
+# documentation (see: http://www.gnu.org/software/libiconv) for the list of
+# possible encodings.
+# The default value is: UTF-8.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank the
+# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
+# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
+# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
+# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
+# *.qsf, *.as and *.js.
+
+FILE_PATTERNS          =
+
+# The RECURSIVE tag can be used to specify whether or not subdirectories should
+# be searched for input files as well.
+# The default value is: NO.
+
+RECURSIVE              = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+#
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE                =
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+# The default value is: NO.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories use the pattern */test/*
+
+EXCLUDE_SYMBOLS        =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or directories
+# that contain example code fragments that are included (see the \include
+# command).
+
+EXAMPLE_PATH           =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank all
+# files are included.
+
+EXAMPLE_PATTERNS       =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude commands
+# irrespective of the value of the RECURSIVE tag.
+# The default value is: NO.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or directories
+# that contain images that are to be included in the documentation (see the
+# \image command).
+
+IMAGE_PATH             = ./images
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command:
+#
+# <filter> <input-file>
+#
+# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
+# name of an input file. Doxygen will then use the output that the filter
+# program writes to standard output. If FILTER_PATTERNS is specified, this tag
+# will be ignored.
+#
+# Note that the filter must not add or remove lines; it is applied before the
+# code is scanned, but not when the output code is generated. If lines are added
+# or removed, the anchors will not be placed correctly.
+
+INPUT_FILTER           =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form: pattern=filter
+# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
+# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
+# patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS        =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER ) will also be used to filter the input files that are used for
+# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
+# The default value is: NO.
+
+FILTER_SOURCE_FILES    = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
+# it is also possible to disable source filtering for a specific pattern using
+# *.ext= (so without naming a filter).
+# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
+
+FILTER_SOURCE_PATTERNS =
+
+# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page
+# (index.html). This can be useful if you have a project on for instance GitHub
+# and want to reuse the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
+# generated. Documented entities will be cross-referenced with these sources.
+#
+# Note: To get rid of all source code in the generated output, make sure that
+# also VERBATIM_HEADERS is set to NO.
+# The default value is: NO.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body of functions,
+# classes and enums directly into the documentation.
+# The default value is: NO.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
+# special comment blocks from generated source code fragments. Normal C, C++ and
+# Fortran comments will always remain visible.
+# The default value is: YES.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
+# function all documented functions referencing it will be listed.
+# The default value is: NO.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES then for each documented function
+# all documented entities called/used by that function will be listed.
+# The default value is: NO.
+
+REFERENCES_RELATION    = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
+# to YES, then the hyperlinks from functions in REFERENCES_RELATION and
+# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
+# link to the documentation.
+# The default value is: YES.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
+# source code will show a tooltip with additional information such as prototype,
+# brief description and links to the definition and documentation. Since this
+# will make the HTML file larger and loading of large files a bit slower, you
+# can opt to disable this feature.
+# The default value is: YES.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+SOURCE_TOOLTIPS        = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code will
+# point to the HTML generated by the htags(1) tool instead of doxygen built-in
+# source browser. The htags tool is part of GNU's global source tagging system
+# (see http://www.gnu.org/software/global/global.html). You will need version
+# 4.8.6 or higher.
+#
+# To use it do the following:
+# - Install the latest version of global
+# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
+# - Make sure the INPUT points to the root of the source tree
+# - Run doxygen as normal
+#
+# Doxygen will invoke htags (and that will in turn invoke gtags), so these
+# tools must be available from the command line (i.e. in the search path).
+#
+# The result: instead of the source browser generated by doxygen, the links to
+# source code will now point to the output of htags.
+# The default value is: NO.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
+# verbatim copy of the header file for each class for which an include is
+# specified. Set to NO to disable this.
+# See also: Section \class.
+# The default value is: YES.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
+# compounds will be generated. Enable this if the project contains a lot of
+# classes, structs, unions or interfaces.
+# The default value is: YES.
+
+ALPHABETICAL_INDEX     = YES
+
+# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
+# which the alphabetical index list will be split.
+# Minimum value: 1, maximum value: 20, default value: 5.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+COLS_IN_ALPHA_INDEX    = 1
+
+# In case all classes in a project start with a common prefix, all classes will
+# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
+# can be used to specify a prefix (or a list of prefixes) that should be ignored
+# while generating the index headers.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+IGNORE_PREFIX          =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output
+# The default value is: YES.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
+# generated HTML page (for example: .htm, .php, .asp).
+# The default value is: .html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
+# each generated HTML page. If the tag is left blank doxygen will generate a
+# standard header.
+#
+# To get valid HTML the header file that includes any scripts and style sheets
+# that doxygen needs, which is dependent on the configuration options used (e.g.
+# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
+# default header using
+# doxygen -w html new_header.html new_footer.html new_stylesheet.css
+# YourConfigFile
+# and then modify the file new_header.html. See also section "Doxygen usage"
+# for information on how to generate the default header that doxygen normally
+# uses.
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. For a description
+# of the possible markers and block names see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+#HTML_HEADER            = header.html
+
+# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
+# generated HTML page. If the tag is left blank doxygen will generate a standard
+# footer. See HTML_HEADER for more information on how to generate a default
+# footer and what special commands can be used inside the footer. See also
+# section "Doxygen usage" for information on how to generate the default footer
+# that doxygen normally uses.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+#HTML_FOOTER            = footer.html
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
+# sheet that is used by each HTML page. It can be used to fine-tune the look of
+# the HTML output. If left blank doxygen will generate a default style sheet.
+# See also section "Doxygen usage" for information on how to generate the style
+# sheet that doxygen normally uses.
+# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
+# it is more robust and this tag (HTML_STYLESHEET) will in the future become
+# obsolete.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+#HTML_STYLESHEET        =
+
+# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user-
+# defined cascading style sheet that is included after the standard style sheets
+# created by doxygen. Using this option one can overrule certain style aspects.
+# This is preferred over using HTML_STYLESHEET since it does not replace the
+# standard style sheet and is therefor more robust against future updates.
+# Doxygen will copy the style sheet file to the output directory. For an example
+# see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+#HTML_EXTRA_STYLESHEET  = stylesheet.css
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
+# files will be copied as-is; there are no commands or markers available.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+#HTML_EXTRA_FILES       =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
+# will adjust the colors in the stylesheet and background images according to
+# this color. Hue is specified as an angle on a colorwheel, see
+# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
+# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
+# purple, and 360 is red again.
+# Minimum value: 0, maximum value: 359, default value: 220.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+#HTML_COLORSTYLE_HUE    = 46
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
+# in the HTML output. For a value of 0 the output will use grayscales only. A
+# value of 255 will produce the most vivid colors.
+# Minimum value: 0, maximum value: 255, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+#HTML_COLORSTYLE_SAT    = 180
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
+# luminance component of the colors in the HTML output. Values below 100
+# gradually make the output lighter, whereas values above 100 make the output
+# darker. The value divided by 100 is the actual gamma applied, so 80 represents
+# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
+# change the gamma.
+# Minimum value: 40, maximum value: 240, default value: 80.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+#HTML_COLORSTYLE_GAMMA  = 180
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting this
+# to NO can help when comparing the output of multiple runs.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_TIMESTAMP         = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_SECTIONS  = YES
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
+# shown in the various tree structured indices initially; the user can expand
+# and collapse entries dynamically later on. Doxygen will expand the tree to
+# such a level that at most the specified number of entries are visible (unless
+# a fully collapsed tree already exceeds this amount). So setting the number of
+# entries 1 will produce a full collapsed tree by default. 0 is a special value
+# representing an infinite number of entries and will result in a full expanded
+# tree by default.
+# Minimum value: 0, maximum value: 9999, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files will be
+# generated that can be used as input for Apple's Xcode 3 integrated development
+# environment (see: http://developer.apple.com/tools/xcode/), introduced with
+# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
+# Makefile in the HTML output directory. Running make will produce the docset in
+# that directory and running make install will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
+# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_DOCSET        = NO
+
+# This tag determines the name of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# The default value is: Doxygen generated docs.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# This tag specifies a string that should uniquely identify the documentation
+# set bundle. This should be a reverse domain-name style string, e.g.
+# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+# The default value is: org.doxygen.Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+
+# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
+# The default value is: Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_NAME  = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
+# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
+# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
+# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
+# Windows.
+#
+# The HTML Help Workshop contains a compiler that can convert all HTML output
+# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
+# files are now used as the Windows 98 help format, and will replace the old
+# Windows help format (.hlp) on all Windows platforms in the future. Compressed
+# HTML files also contain an index, a table of contents, and you can search for
+# words in the documentation. The HTML workshop also contains a viewer for
+# compressed HTML files.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_HTMLHELP      = NO
+
+# The CHM_FILE tag can be used to specify the file name of the resulting .chm
+# file. You can add a path in front of the file if the result should not be
+# written to the html output directory.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_FILE               =
+
+# The HHC_LOCATION tag can be used to specify the location (absolute path
+# including file name) of the HTML help compiler ( hhc.exe). If non-empty
+# doxygen will try to run the HTML help compiler on the generated index.hhp.
+# The file has to be specified with full path.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+HHC_LOCATION           =
+
+# The GENERATE_CHI flag controls if a separate .chi index file is generated (
+# YES) or that it should be included in the master .chm file ( NO).
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+GENERATE_CHI           = NO
+
+# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc)
+# and project file content.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_INDEX_ENCODING     =
+
+# The BINARY_TOC flag controls whether a binary table of contents is generated (
+# YES) or a normal table of contents ( NO) in the .chm file.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members to
+# the table of contents of the HTML help documentation and to the tree view.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
+# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
+# (.qch) of the generated HTML documentation.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
+# the file name of the resulting .qch file. The path specified is relative to
+# the HTML output folder.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QCH_FILE               =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
+# Project output. For more information please see Qt Help Project / Namespace
+# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_NAMESPACE          = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
+# Help Project output. For more information please see Qt Help Project / Virtual
+# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
+# folders).
+# The default value is: doc.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
+# filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_NAME   =
+
+# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_ATTRS  =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's filter section matches. Qt Help Project / Filter Attributes (see:
+# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_SECT_FILTER_ATTRS  =
+
+# The QHG_LOCATION tag can be used to specify the location of Qt's
+# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
+# generated .qhp file.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHG_LOCATION           =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
+# generated, together with the HTML files, they form an Eclipse help plugin. To
+# install this plugin and make it available under the help contents menu in
+# Eclipse, the contents of the directory containing the HTML and XML files needs
+# to be copied into the plugins directory of eclipse. The name of the directory
+# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
+# After copying Eclipse needs to be restarted before the help appears.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_ECLIPSEHELP   = NO
+
+# A unique identifier for the Eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have this
+# name. Each documentation set should have its own identifier.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
+
+ECLIPSE_DOC_ID         = org.doxygen.Project
+
+# If you want full control over the layout of the generated HTML pages it might
+# be necessary to disable the index and replace it with your own. The
+# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
+# of each HTML page. A value of NO enables the index and the value YES disables
+# it. Since the tabs in the index contain the same information as the navigation
+# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+DISABLE_INDEX          = YES
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information. If the tag
+# value is set to YES, a side panel will be generated containing a tree-like
+# index structure (just like the one that is generated for HTML Help). For this
+# to work a browser that supports JavaScript, DHTML, CSS and frames is required
+# (i.e. any modern browser). Windows users are probably better off using the
+# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can
+# further fine-tune the look of the index. As an example, the default style
+# sheet generated by doxygen has an example that shows how to put an image at
+# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
+# the same information as the tab index, you could consider setting
+# DISABLE_INDEX to YES when enabling this option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_TREEVIEW      = YES
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
+# doxygen will group on one line in the generated HTML documentation.
+#
+# Note that a value of 0 will completely suppress the enum values from appearing
+# in the overview section.
+# Minimum value: 0, maximum value: 20, default value: 4.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
+# to set the initial width (in pixels) of the frame in which the tree is shown.
+# Minimum value: 0, maximum value: 1500, default value: 250.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+TREEVIEW_WIDTH         = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to
+# external symbols imported via tag files in a separate window.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+EXT_LINKS_IN_WINDOW    = NO
+
+# Use this tag to change the font size of LaTeX formulas included as images in
+# the HTML documentation. When you change the font size after a successful
+# doxygen run you need to manually remove any form_*.png images from the HTML
+# output directory to force them to be regenerated.
+# Minimum value: 8, maximum value: 50, default value: 10.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_FONTSIZE       = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are not
+# supported properly for IE 6.0, but are supported on all modern browsers.
+#
+# Note that when changing this option you need to delete any form_*.png files in
+# the HTML output directory before the changes have effect.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_TRANSPARENT    = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
+# http://www.mathjax.org) which uses client side Javascript for the rendering
+# instead of using prerendered bitmaps. Use this if you do not have LaTeX
+# installed or if you want to formulas look prettier in the HTML output. When
+# enabled you may also need to install MathJax separately and configure the path
+# to it using the MATHJAX_RELPATH option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+USE_MATHJAX            = NO
+
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output. See the MathJax site (see:
+# http://docs.mathjax.org/en/latest/output.html) for more details.
+# Possible values are: HTML-CSS (which is slower, but has the best
+# compatibility), NativeMML (i.e. MathML) and SVG.
+# The default value is: HTML-CSS.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_FORMAT         = HTML-CSS
+
+# When MathJax is enabled you need to specify the location relative to the HTML
+# output directory using the MATHJAX_RELPATH option. The destination directory
+# should contain the MathJax.js script. For instance, if the mathjax directory
+# is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
+# Content Delivery Network so you can quickly see the result without installing
+# MathJax. However, it is strongly recommended to install a local copy of
+# MathJax from http://www.mathjax.org before deployment.
+# The default value is: http://cdn.mathjax.org/mathjax/latest.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_RELPATH        = http://www.mathjax.org/mathjax
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
+# extension names that should be enabled during MathJax rendering. For example
+# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_EXTENSIONS     =
+
+# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
+# of code that will be used on startup of the MathJax code. See the MathJax site
+# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
+# example see the documentation.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_CODEFILE       =
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
+# the HTML output. The underlying search engine uses javascript and DHTML and
+# should work on any modern browser. Note that when using HTML help
+# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
+# there is already a search function so this one should typically be disabled.
+# For large projects the javascript based search engine can be slow, then
+# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
+# search using the keyboard; to jump to the search box use <access key> + S
+# (what the <access key> is depends on the OS and browser, but it is typically
+# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
+# key> to jump into the search results window, the results can be navigated
+# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
+# the search. The filter options can be selected when the cursor is inside the
+# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
+# to select a filter and <Enter> or <escape> to activate or cancel the filter
+# option.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+SEARCHENGINE           = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript. There
+# are two flavours of web server based searching depending on the
+# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
+# searching and an index file used by the script. When EXTERNAL_SEARCH is
+# enabled the indexing and searching needs to be provided by external tools. See
+# the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SERVER_BASED_SEARCH    = NO
+
+# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
+# search results.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/).
+#
+# See the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH        = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will return the search results when EXTERNAL_SEARCH is enabled.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/). See the section "External Indexing and
+# Searching" for details.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHENGINE_URL       =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+# The default file is: searchdata.xml.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHDATA_FILE        = searchdata.xml
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH_ID     =
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
+# to a relative location where the documentation can be found. The format is:
+# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTRA_SEARCH_MAPPINGS  =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.
+# The default value is: YES.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked.
+#
+# Note that when enabling USE_PDFLATEX this option is only used for generating
+# bitmaps for formulas in the HTML output, but not in the Makefile that is
+# written to the output directory.
+# The default file is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
+# index for LaTeX.
+# The default file is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used by the
+# printer.
+# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
+# 14 inches) and executive (7.25 x 10.5 inches).
+# The default value is: a4.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PAPER_TYPE             = a4
+
+# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
+# that should be included in the LaTeX output. To get the times font for
+# instance you can specify
+# EXTRA_PACKAGES=times
+# If left blank no extra packages will be included.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+EXTRA_PACKAGES         =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
+# generated LaTeX document. The header should contain everything until the first
+# chapter. If it is left blank doxygen will generate a standard header. See
+# section "Doxygen usage" for information on how to let doxygen write the
+# default header to a separate file.
+#
+# Note: Only use a user-defined header if you know what you are doing! The
+# following commands have a special meaning inside the header: $title,
+# $datetime, $date, $doxygenversion, $projectname, $projectnumber. Doxygen will
+# replace them by respectively the title of the page, the current date and time,
+# only the current date, the version number of doxygen, the project name (see
+# PROJECT_NAME), or the project number (see PROJECT_NUMBER).
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HEADER           =
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
+# generated LaTeX document. The footer should contain everything after the last
+# chapter. If it is left blank doxygen will generate a standard footer.
+#
+# Note: Only use a user-defined footer if you know what you are doing!
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_FOOTER           =
+
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the LATEX_OUTPUT output
+# directory. Note that the files will be copied as-is; there are no commands or
+# markers available.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_FILES      =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
+# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
+# contain links (just like the HTML output) instead of page references. This
+# makes the output suitable for online browsing using a PDF viewer.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PDF_HYPERLINKS         = YES
+
+# If the LATEX_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
+# the PDF file directly from the LaTeX files. Set this option to YES to get a
+# higher quality PDF documentation.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
+# command to the generated LaTeX files. This will instruct LaTeX to keep running
+# if errors occur, instead of asking the user for help. This option is also used
+# when generating formulas in HTML.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BATCHMODE        = NO
+
+# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
+# index chapters (such as File Index, Compound Index, etc.) in the output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HIDE_INDICES     = NO
+
+# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
+# code with syntax highlighting in the LaTeX output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_SOURCE_CODE      = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. See
+# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
+# The default value is: plain.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BIB_STYLE        = plain
+
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The
+# RTF output is optimized for Word 97 and may not look too pretty with other RTF
+# readers/editors.
+# The default value is: NO.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: rtf.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
+# contain hyperlink fields. The RTF file will contain links (just like the HTML
+# output) instead of page references. This makes the output suitable for online
+# browsing using Word or some other Word compatible readers that support those
+# fields.
+#
+# Note: WordPad (write) and others do not support links.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's config
+# file, i.e. a series of assignments. You only have to provide replacements,
+# missing definitions are set to their default value.
+#
+# See also section "Doxygen usage" for information on how to generate the
+# default style sheet that doxygen normally uses.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_STYLESHEET_FILE    =
+
+# Set optional variables used in the generation of an RTF document. Syntax is
+# similar to doxygen's config file. A template extensions file can be generated
+# using doxygen -e rtf extensionFile.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_EXTENSIONS_FILE    =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for
+# classes and files.
+# The default value is: NO.
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it. A directory man3 will be created inside the directory specified by
+# MAN_OUTPUT.
+# The default directory is: man.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to the generated
+# man pages. In case the manual section does not start with a number, the number
+# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
+# optional.
+# The default value is: .3.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
+# will generate one additional man file for each entity documented in the real
+# man page(s). These additional files only source the real man page, but without
+# them the man command would be unable to find the correct page.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that
+# captures the structure of the code including all documentation.
+# The default value is: NO.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: xml.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a
+# validating XML parser to check the syntax of the XML files.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_SCHEMA             =
+
+# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
+# validating XML parser to check the syntax of the XML files.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_DTD                =
+
+# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
+# listings (including syntax highlighting and cross-referencing information) to
+# the XML output. Note that enabling this will significantly increase the size
+# of the XML output.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files
+# that can be used to generate PDF.
+# The default value is: NO.
+
+GENERATE_DOCBOOK       = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it.
+# The default directory is: docbook.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_OUTPUT         = docbook
+
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen
+# Definitions (see http://autogen.sf.net) file that captures the structure of
+# the code including all documentation. Note that this feature is still
+# experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module
+# file that captures the structure of the code including all documentation.
+#
+# Note that this feature is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary
+# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
+# output from the Perl module output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely
+# formatted so it can be parsed by a human reader. This is useful if you want to
+# understand what is going on. On the other hand, if this tag is set to NO the
+# size of the Perl module output will be much smaller and Perl will parse it
+# just the same.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file are
+# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
+# so different doxyrules.make files included by the same Makefile don't
+# overwrite each other's variables.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all
+# C-preprocessor directives found in the sources and include files.
+# The default value is: YES.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names
+# in the source code. If set to NO only conditional compilation will be
+# performed. Macro expansion can be done in a controlled way by setting
+# EXPAND_ONLY_PREDEF to YES.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
+# the macro expansion is limited to the macros specified with the PREDEFINED and
+# EXPAND_AS_DEFINED tags.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES the includes files in the
+# INCLUDE_PATH will be searched if a #include is found.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by the
+# preprocessor.
+# This tag requires that the tag SEARCH_INCLUDES is set to YES.
+
+INCLUDE_PATH           =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will be
+# used.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+INCLUDE_FILE_PATTERNS  =
+
+# The PREDEFINED tag can be used to specify one or more macro names that are
+# defined before the preprocessor is started (similar to the -D option of e.g.
+# gcc). The argument of the tag is a list of macros of the form: name or
+# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
+# is assumed. To prevent a macro definition from being undefined via #undef or
+# recursively expanded use the := operator instead of the = operator.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+PREDEFINED             =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
+# tag can be used to specify a list of macro names that should be expanded. The
+# macro definition that is found in the sources will be used. Use the PREDEFINED
+# tag if you want to use a different macro definition that overrules the
+# definition found in the source code.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_AS_DEFINED      =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
+# remove all refrences to function-like macros that are alone on a line, have an
+# all uppercase name, and do not end with a semicolon. Such function macros are
+# typically used for boiler-plate code, and will confuse the parser if not
+# removed.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tag files. For each tag
+# file the location of the external documentation should be added. The format of
+# a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where loc1 and loc2 can be relative or absolute paths or URLs. See the
+# section "Linking to external documentation" for more information about the use
+# of tag files.
+# Note: Each tag file must have an unique name (where the name does NOT include
+# the path). If a tag file is not located in the directory in which doxygen is
+# run, you must also specify the path to the tagfile here.
+
+TAGFILES               =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
+# tag file that is based on the input files it reads. See section "Linking to
+# external documentation" for more information about the usage of tag files.
+
+GENERATE_TAGFILE       =
+
+# If the ALLEXTERNALS tag is set to YES all external class will be listed in the
+# class index. If set to NO only the inherited external classes will be listed.
+# The default value is: NO.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in
+# the modules index. If set to NO, only the current project's groups will be
+# listed.
+# The default value is: YES.
+
+EXTERNAL_GROUPS        = YES
+
+# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in
+# the related pages index. If set to NO, only the current project's pages will
+# be listed.
+# The default value is: YES.
+
+EXTERNAL_PAGES         = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of 'which perl').
+# The default file (with absolute path) is: /usr/bin/perl.
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram
+# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
+# NO turns the diagrams off. Note that this option also works with HAVE_DOT
+# disabled, but it is recommended to install and use dot, since it yields more
+# powerful graphs.
+# The default value is: YES.
+
+CLASS_DIAGRAMS         = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see:
+# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH            =
+
+# You can include diagrams made with dia in doxygen documentation. Doxygen will
+# then run dia to produce the diagram and insert it in the documentation. The
+# DIA_PATH tag allows you to specify the directory where the dia binary resides.
+# If left empty dia is assumed to be found in the default search path.
+
+DIA_PATH               =
+
+# If set to YES, the inheritance and collaboration graphs will hide inheritance
+# and usage relations if the target is undocumented or is not a class.
+# The default value is: YES.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz (see:
+# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
+# Bell Labs. The other options in this section have no effect if this option is
+# set to NO
+# The default value is: NO.
+
+HAVE_DOT               = NO
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
+# to run in parallel. When set to 0 doxygen will base this on the number of
+# processors available in the system. You can set it explicitly to a value
+# larger than 0 to get control over the balance between CPU load and processing
+# speed.
+# Minimum value: 0, maximum value: 32, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_NUM_THREADS        = 0
+
+# When you want a differently looking font n the dot files that doxygen
+# generates you can specify the font name using DOT_FONTNAME. You need to make
+# sure dot is able to find the font, which can be done by putting it in a
+# standard location or by setting the DOTFONTPATH environment variable or by
+# setting DOT_FONTPATH to the directory containing the font.
+# The default value is: Helvetica.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+#DOT_FONTNAME           = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
+# dot graphs.
+# Minimum value: 4, maximum value: 24, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+#DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the default font as specified with
+# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
+# the path where dot can find it using this tag.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+#DOT_FONTPATH           =
+
+# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
+# each documented class showing the direct and indirect inheritance relations.
+# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
+# graph for each documented class showing the direct and indirect implementation
+# dependencies (inheritance, containment, and class references variables) of the
+# class with other documented classes.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
+# groups, showing the direct groups dependencies.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LOOK               = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
+# class node. If there are many fields or methods and many nodes the graph may
+# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
+# number of items for each type to make the size more manageable. Set this to 0
+# for no limit. Note that the threshold may be exceeded by 50% before the limit
+# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
+# but if the number exceeds 15, the total amount of fields shown is limited to
+# 10.
+# Minimum value: 0, maximum value: 100, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LIMIT_NUM_FIELDS   = 10
+
+# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
+# collaboration graphs will show the relations between templates and their
+# instances.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
+# YES then doxygen will generate a graph for each documented file showing the
+# direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDE_GRAPH          = YES
+
+# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
+# set to YES then doxygen will generate a graph for each documented file showing
+# the direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALL_GRAPH             = NO
+
+# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALLER_GRAPH           = NO
+
+# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
+# hierarchy of all classes instead of a textual one.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
+# dependencies a directory has on other directories in a graphical way. The
+# dependency relations are determined by the #include relations between the
+# files in the directories.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot.
+# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
+# to make the SVG files visible in IE 9+ (other browsers do not have this
+# requirement).
+# Possible values are: png, jpg, gif and svg.
+# The default value is: png.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_IMAGE_FORMAT       = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+#
+# Note that this requires a modern browser other than Internet Explorer. Tested
+# and working are Firefox, Chrome, Safari, and Opera.
+# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
+# the SVG files visible. Older versions of IE do not have SVG support.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INTERACTIVE_SVG        = NO
+
+# The DOT_PATH tag can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_PATH               =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the \dotfile
+# command).
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOTFILE_DIRS           =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the \mscfile
+# command).
+
+MSCFILE_DIRS           =
+
+# The DIAFILE_DIRS tag can be used to specify one or more directories that
+# contain dia files that are included in the documentation (see the \diafile
+# command).
+
+DIAFILE_DIRS           =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
+# that will be shown in the graph. If the number of nodes in a graph becomes
+# larger than this value, doxygen will truncate the graph, which is visualized
+# by representing a node as a red box. Note that doxygen if the number of direct
+# children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
+# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+# Minimum value: 0, maximum value: 10000, default value: 50.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
+# generated by dot. A depth value of 3 means that only nodes reachable from the
+# root by following a path via at most 3 edges will be shown. Nodes that lay
+# further from the root node will be omitted. Note that setting this option to 1
+# or 2 may greatly reduce the computation time needed for large code bases. Also
+# note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+# Minimum value: 0, maximum value: 1000, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not seem
+# to support this out of the box.
+#
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10) support
+# this, this feature is disabled by default.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_MULTI_TARGETS      = YES
+
+# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
+# explaining the meaning of the various boxes and arrows in the dot generated
+# graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot
+# files that are used to generate the various graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_CLEANUP            = YES
diff --git a/doc/dpm_doc.h b/doc/dpm_doc.h
new file mode 100644 (file)
index 0000000..da18fca
--- /dev/null
@@ -0,0 +1,198 @@
+/*
+ *  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 __DPM_DOC_H__
+#define __DPM_DOC_H__
+
+
+ /**
+  * @ingroup CAPI_SECURITY_FRAMEWORK
+  * @defgroup CAPI_SECURITY_DPM_MODULE Device Policy Manager
+  * @brief The Device Policy Management framework provides APIs to create
+  * security-aware applications that are useful in enterprise settings.
+  * <br>
+  * @section CAPI_SECURITY_DPM_MODULE_OVERVIEW Overview
+  * The primary purpose of the DPM(Device Policy Management) framework is
+  * to support enterprise applications, which require integration with
+  * policies enforced on the device to restrict their operations on
+  * some circumstance, such as Exchange ActiveSync or corporate apps.<br>
+  * The device policy API supports the policies listed in the below table, and
+  * any application can subscribe those policies by registring policy changed callback to
+  * the device policy manager.<br>
+  * @subsection CAPI_SECURITY_DPM_MODULE_POLICY Policy List
+  *<table>
+  *  <tr>
+  *   <td>Policy Name</td>
+  *   <td>State</td>
+  *   <td>Description</td>
+  *  </tr>
+  *  <tr>
+  *   <td>wifi</td>
+  *   <td>allowed / disallowed</td>
+  *   <td>Specifies wether the use of Wi-Fi is allowed or not</td>
+  *  </tr>
+  *  <tr>
+  *   <td>wifi-hotspot</td>
+  *   <td>allowed / disallowed</td>
+  *   <td>Specifies whether the use of Wi-Fi hotspot is allowed or not</td>
+  *  </tr>
+  *  <tr>
+  *   <td>bluetooth</td>
+  *   <td>allowed / disallowed</td>
+  *   <td>Specifies whether the use of bluetooth is allowed or not</td>
+  *  </tr>
+  *  <tr>
+  *   <td>camera</td>
+  *   <td>allowed / disallowed</td>
+  *   <td>Specifies whether the use of camera is allowed or not</td>
+  *  </tr>
+  *  <tr>
+  *   <td>microphone</td>
+  *   <td>allowed / disallowed</td>
+  *   <td>Specifies whether the use of microphone is allowed or not</td>
+  *  </tr>
+  *  <tr>
+  *   <td>location</td>
+  *   <td>allowed / disallowed</td>
+  *   <td>Specifies whether the use of GPS is allowed or not</td>
+  *  </tr>
+  *  <tr>
+  *   <td>external-storage</td>
+  *   <td>allowed / disallowed</td>
+  *   <td>Specifies whether the use of external storage is allowed or not</td>
+  *  </tr>
+  *  <tr>
+  *   <td>text-messaging</td>
+  *   <td>allowed / disallowed</td>
+  *   <td>Specifies whether the use of text messaging is allowed or not</td>
+  *  </tr>
+  *  <tr>
+  *   <td>pop-imap-email</td>
+  *   <td>allowed / disallowed</td>
+  *   <td>Specifies whether the use of POP/IMAP Email is allowed or not</td>
+  *  </tr>
+  *  <tr>
+  *   <td>browser</td>
+  *   <td>allowed / disallowed</td>
+  *   <td>Specifies whether the use of browser is allowed or not</td>
+  *  </tr>
+  *  <tr>
+  *   <td>bluetooth-tethering</td>
+  *   <td>allowed / disallowed</td>
+  *   <td>Specifies whether the use of bluetooth tethering is allowed or not</td>
+  *  </tr>
+  *  <tr>
+  *   <td>usb-tethering</td>
+  *   <td>allowed / disallowed</td>
+  *   <td>Specifies whether the use of usb tethering is allowed or not</td>
+  *  </tr>
+  * </table>
+  * <br>
+  * @subsection CAPI_DPM_SECURITY_MODULE_SIGNAL Signal List
+  * <table>
+  *  <tr>
+  *   <td>Signal Name</td>
+  *   <td>Object</td>
+  *   <td>Description</td>
+  *  </tr>
+  *  <tr>
+  *   <td>on-admin-client-registered</td>
+  *   <td>Policy admin client name</td>
+  *   <td>Triggered by the device policy manager when new policy admin client is registered</td>
+  *  </tr>
+  *  <tr>
+  *   <td>on-admin-client-deregistered</td>
+  *   <td>Policy admin client name</td>
+  *   <td>Triggered by the device policy manager when policy admin client is deregistered</td>
+  *  </tr>
+  * </table>
+  * <br>
+  * @subsection Privilege
+  * In order to enforce policy on the device, the client must be registered to the device policy
+  * manager as the device admin client by enrollment process. Other unregistered
+  * application are only allowed to subscribe policy change notification published by
+  * the device policy manager.
+  *<br>
+  */
+
+ /**
+  * @ingroup CAPI_SECURITY_DPM_MODULE
+  * @defgroup CAPI_DPM_MANAGER_MODULE Policy Manager Interface
+  * @brief The policy client provides functions required to access the device policy APIs.
+  * @section CAPI_DPM_MANAGER_MODULE_HEADER Required Header
+  *  \#include <dpm/device-policy-manager.h>
+  * @section CAPI_DPM_MANAGER_MODULE_OVERVIEW Overview
+  * The Policy Manager module provides Device Policy Manager handle which keeps track of
+  * state between the device admin client and the device policy manager.
+  * The device admin clients must create the handle by using dpm_manager_create()
+  * before attempting to use almost any of the device policy APIs, and the handle should be
+  * freed by using dpm_manager_destroy() when interaction with the device policy manager
+  * is no longer required.
+  */
+
+ /**
+  * @ingroup CAPI_SECURITY_DPM_MODULE
+  * @defgroup CAPI_DPM_PASSWORD_POLICY_MODULE Password policy group
+  * @brief Password policy group provides APIs to control password policies.
+  * @section CAPI_DPM_PASSWORD_POLICY_MODULE_HEADER Required Header
+  *  \#include <dpm/password.h>
+  * @section CAPI_DPM_PASSWORD_POLICY_MODULE_OVERVIEW Overview
+  * Password policy group provides APIs to control password policies such as
+  * password type, password quality and expiration date. Any API which requires privileges
+  * is only available for the registered device admin client which is enrolled to the device
+  * by enrollment process.
+  */
+
+ /**
+  * @ingroup CAPI_SECURITY_DPM_MODULE
+  * @defgroup CAPI_DPM_RESTRICTION_POLICY_MODULE Restriction policy group
+  * @brief Restriction policy group provides APIs to control restriction functionality.
+  * @section CAPI_DPM_RESTRICTION_POLICY_MODULE_HEADER Required Header
+  *  \#include <dpm/restriction.h>
+  * @section CAPI_DPM_RESTRICTION_POLICY_MODULE_OVERVIEW Overview
+  * Restriction policy group provides APIs to restrict functions of the device such as
+  * Camera, Microphone, Wi-Fi, bluetooth, USB and so on. Any API which requires privileges
+  * is only available for the registered device admin client which is enrolled to the device
+  * by enrollment process.
+  */
+
+ /**
+  * @ingroup CAPI_SECURITY_DPM_MODULE
+  * @defgroup CAPI_DPM_SECURITY_POLICY_MODULE Security policy group
+  * @brief Security policy group provides APIs to control security functionality
+  * @section CAPI_DPM_SECURITY_POLICY_MODULE_HEADER Required Header
+  *  \#include <dpm/security.h>
+  * @section CAPI_DPM_SECURITY_POLICY_MODULE_OVERVIEW Overview
+  * Security policy group provides APIs to control security functionality such as
+  * device encryption and screen lock. Any API which requires privileges
+  * is only available for the registered device admin client which is enrolled to the device
+  * by enrollment process.
+  */
+
+ /**
+  * @ingroup CAPI_SECURITY_DPM_MODULE
+  * @defgroup CAPI_DPM_ZONE_POLICY_MODULE Zone policy group
+  * @brief Zone policy group provides APIs to control containers
+  * @section CAPI_DPM_ZONE_POLICY_MODULE_HEADER Required Header
+  * \#include <dpm/zone.h>
+  * @section CAPI_DPM_ZONE_POLICY_MODULE_OVERVIEW Overview
+  * This module provides APIs to manage application containers. Any API which requires
+  * privileges is only available for the registered device policy client which is enrolled to
+  * the device by enrollment process.
+  *
+  */
+
+#endif /* __DPM_DOC_H__ */
diff --git a/doc/images/dpm.png b/doc/images/dpm.png
new file mode 100644 (file)
index 0000000..1bf1aaf
Binary files /dev/null and b/doc/images/dpm.png differ
diff --git a/doc/mainpage.dox b/doc/mainpage.dox
new file mode 100755 (executable)
index 0000000..27d96e7
--- /dev/null
@@ -0,0 +1,49 @@
+/**
+ @mainpage Tizen Device Policy Management Framework
+
+ @section Introduction
+ The primary purpose of the DPM(Device Policy Management) framework is to support enterprise applications, which require integration with policies enforced on the device to restrict their operations on some circumstance, such as exchange or corporate apps.<br>
+<br>
+<br>
+ @section Architecture
+The Device Policy Management framework consists of the device policy manager and policy client library as shown in the figure.
+The device policy manager manages all policies enforced on the device and exposes APIs to administrator via the policy client library called libdpm. Thus, the policy client should link the policy client library to enforce policies.
+
+<br>
+ @image html dpm.png "Tizen Device Policy Management Framework"
+ <br>
+ @section PolicyGroup Policy Groups
+ The Device Policy Management framework supposts following three policy groups.
+ Each policy group has dedicated header file. So, you should include it to use any API associated to the policy group
+   <center>
+   <table>
+   <tr>
+       <td><b>Policy Group</b></td>
+       <td><center><b>Description</b></center></td>
+       <td><b>Related header file</b></td>
+   </tr>
+   <tr>
+       <td>PasswordPolicy</td>
+       <td>Provide functionality to control password policy</td>
+       <td>dpm/password.h</td>
+   </tr>
+   <tr>
+       <td>SecurityPolicy</td>
+       <td>Provide functionality to control security such as encryption and device wipe</td>
+       <td>dpm/security.h</td>
+   </tr>
+   <tr>
+       <td>ZonePolicy</td>
+       <td>Provide functionality to control application containers</td>
+       <td>dpm/zone.h</td>
+   </tr>
+   </table>
+   </center>
+<br>
+<br>
+<br>
+ @section Priviliges
+Only privileged client, which is registered to the policy manager can enforce policies. Other unprivileged application are only allowed to subscribe policy change notification published by the device policy manager.<br>
+<br>
+<br>
+*/
diff --git a/dpm.pc.in b/dpm.pc.in
new file mode 100644 (file)
index 0000000..6ba2138
--- /dev/null
+++ b/dpm.pc.in
@@ -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/dpm/administration.cpp b/dpm/administration.cpp
new file mode 100644 (file)
index 0000000..6a19eaf
--- /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 "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
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/dpm/application.cpp b/dpm/application.cpp
new file mode 100644 (file)
index 0000000..0983819
--- /dev/null
@@ -0,0 +1,157 @@
+/*
+ *  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
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/dpm/array.h b/dpm/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/dpm/bluetooth.cpp b/dpm/bluetooth.cpp
new file mode 100644 (file)
index 0000000..cb8c409
--- /dev/null
@@ -0,0 +1,143 @@
+/*
+ *  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
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/dpm/client-handle.cpp b/dpm/client-handle.cpp
new file mode 100644 (file)
index 0000000..1c5eb7d
--- /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 "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
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/dpm/device-policy-manager.h b/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/dpm/password.cpp b/dpm/password.cpp
new file mode 100644 (file)
index 0000000..377788a
--- /dev/null
@@ -0,0 +1,572 @@
+/*
+ *  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
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/dpm/password_internal.h b/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/dpm/restriction.cpp b/dpm/restriction.cpp
new file mode 100644 (file)
index 0000000..97021a4
--- /dev/null
@@ -0,0 +1,522 @@
+/*
+ *  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
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/dpm/security.cpp b/dpm/security.cpp
new file mode 100644 (file)
index 0000000..328c4c7
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ *  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
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/dpm/storage.cpp b/dpm/storage.cpp
new file mode 100644 (file)
index 0000000..ca828af
--- /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
+ */
+
+#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
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/dpm/wifi.cpp b/dpm/wifi.cpp
new file mode 100644 (file)
index 0000000..bdcf094
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ *  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
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/dpm/zone.cpp b/dpm/zone.cpp
new file mode 100755 (executable)
index 0000000..9e51c67
--- /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 "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
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/dsm/CMakeLists.txt b/dsm/CMakeLists.txt
new file mode 100644 (file)
index 0000000..5af3f4b
--- /dev/null
@@ -0,0 +1,54 @@
+#
+# 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.
+#
+
+PROJECT(dsm)
+SET(LIB_VERSION "${VERSION}")
+SET(LIB_SOVERSION "0")
+
+SET(PC_FILE "${PROJECT_NAME}.pc")
+
+SET(FOUNDATION          ../policy-client.cpp
+                                               ../dpm/client-handle.cpp
+)
+
+SET(SECURITY_MONITOR    smack.cpp
+                                               dsm/smack.cpp
+)
+
+SET(CAPI                dsm/smack.h
+)
+
+SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,noexecstack")
+
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${FOUNDATION} ${SECURITY_MONITOR})
+
+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(DSM_LIBS_DEPS        REQUIRED
+                                                               klay
+                                                               glib-2.0
+)
+
+INCLUDE_DIRECTORIES(SYSTEM ${DSM_LIBS_DEPS_INCLUDE_DIRS} ../ ../dpm dsm)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${DSM_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}/dsm)
diff --git a/dsm/dsm.pc.in b/dsm/dsm.pc.in
new file mode 100644 (file)
index 0000000..7060c3b
--- /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: dsm
+Description: Tizen Device Security Monitor Client library
+Version: @VERSION@
+Libs: -L${libdir} -ldsm
+Cflags: -I${includedir}/dpm -I${includedir}/dsm
diff --git a/dsm/dsm/smack.cpp b/dsm/dsm/smack.cpp
new file mode 100644 (file)
index 0000000..393ab8d
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ *  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.cpp
+ *  @brief Implementation of SMACK agent module.
+ *  @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.
+**/
+
+#include <cstring>
+#include <cassert>
+
+#include "smack.h"
+#include "smack.hxx"
+
+#include "debug.h"
+#include "policy-client.h"
+
+using namespace DevicePolicyManager;
+
+EXPORT_API int dpm_smack_get_report(device_policy_manager_h handle, char **report)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(report, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyContext &client = GetDevicePolicyContext(handle);
+       SmackSecurityMonitor smack = client.createPolicyInterface<SmackSecurityMonitor>();
+
+       try {
+               std::string str = smack.getReport();
+               if (!str.empty()) {
+                       if (str.compare("[]") == 0) {
+                               return DPM_ERROR_INVALID_PARAMETER;
+                       }
+                       *report = ::strdup(str.c_str());
+                       if (*report == 0)
+                               return DPM_ERROR_OUT_OF_MEMORY;
+               } else {
+                       return DPM_ERROR_TIMED_OUT;
+               }
+
+               return DPM_ERROR_NONE;
+       } catch (...) {
+               return -1;
+       }
+}
+
+EXPORT_API int dpm_smack_release_report(char **report)
+{
+       RET_ON_FAILURE(*report, DPM_ERROR_INVALID_PARAMETER);
+
+       free(*report);
+       *report = nullptr;
+       return DPM_ERROR_NONE;
+}
+
+EXPORT_API int dpm_smack_get_issue_count(device_policy_manager_h handle, int *count)
+{
+       RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+       RET_ON_FAILURE(count, DPM_ERROR_INVALID_PARAMETER);
+
+       DevicePolicyContext &client = GetDevicePolicyContext(handle);
+       SmackSecurityMonitor smack = client.createPolicyInterface<SmackSecurityMonitor>();
+
+       try {
+               int issueCount = smack.getIssueCount();
+               if (issueCount == -1) {
+                       return DPM_ERROR_OUT_OF_MEMORY;
+               }
+
+               *count = issueCount;
+
+               return DPM_ERROR_NONE;
+       } catch (...) {
+               return -1;
+       }
+}
diff --git a/dsm/dsm/smack.h b/dsm/dsm/smack.h
new file mode 100644 (file)
index 0000000..045df9b
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ *  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.h
+ *  @brief Smack agent module external C API.
+ *  @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 __CAPI_SMACK_SECURITY_MONITOR_H__
+#define __CAPI_SMACK_SECURITY_MONITOR_H__
+
+#include <sys/types.h>
+
+#include <dpm/device-policy-manager.h>
+
+/**
+ * @file smack.h
+ * @brief This file provides APIs to get/release the smack report and issue count
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup  CAPI_DSM_SMACK_SECURITY_MONITOR_MODULE
+ * @{
+ */
+
+/**
+ * @brief       Returns SMACK report.
+ * @details     This API can be used for requesting current SMACK report
+ * @remarks     The SMACK report output should be freed using dpm_smart_security_release_report()
+ * @param[in]   handle SMACK report handle
+ * @param[out]  report SMACK report string
+ * @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
+ * @pre         handle must be created by dpm_context_create()
+ */
+int dpm_smack_get_report(device_policy_manager_h handle, char **report);
+
+/**
+ * @brief       Releases SMACK report.
+ * @details     This API can be used for releasing previously got SMACK report
+ * @remarks     The SMACK report should be got using tsm_smack_get_report()
+ * @param[in]   report SMACK report output
+ * @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
+ * @pre         The handle must be created by dpm_context_create().
+ */
+int dpm_smack_release_report(char **report);
+
+/**
+ * @brief       Returns number of SMACK issues.
+ * @details     This API can be used for requesting current number of
+                SMACK issues
+ * @param[in]   handle SMACK report handle
+ * @param[out]  count Number of SMACK Issues
+ * @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
+ * @pre         The handle must be created by dpm_context_create().
+ */
+int dpm_smack_get_issue_count(device_policy_manager_h handle, int *count);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__CAPI_SMACK_SECURITY_MONITOR_H__
diff --git a/dsm/smack.cpp b/dsm/smack.cpp
new file mode 100644 (file)
index 0000000..20a0bdf
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ *  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
+ */
+
+#include "status.h"
+#include "smack.hxx"
+
+namespace DevicePolicyManager {
+
+struct SmackSecurityMonitor::Private {
+       Private(PolicyControlContext &ctx) : context(ctx) {}
+       PolicyControlContext &context;
+};
+
+SmackSecurityMonitor::SmackSecurityMonitor(SmackSecurityMonitor &&rhs) = default;
+SmackSecurityMonitor &SmackSecurityMonitor::operator=(SmackSecurityMonitor &&rhs) = default;
+
+SmackSecurityMonitor::SmackSecurityMonitor(const SmackSecurityMonitor &rhs) :
+       pimpl(nullptr)
+{
+       if (rhs.pimpl) {
+               pimpl.reset(new Private(*rhs.pimpl));
+       }
+}
+
+SmackSecurityMonitor &SmackSecurityMonitor::operator=(const SmackSecurityMonitor &rhs)
+{
+       if (!rhs.pimpl) {
+               pimpl.reset();
+       } else {
+               pimpl.reset(new Private(*rhs.pimpl));
+       }
+
+       return *this;
+}
+
+SmackSecurityMonitor::SmackSecurityMonitor(PolicyControlContext &ctx) :
+       pimpl(new Private(ctx))
+{
+}
+
+SmackSecurityMonitor::~SmackSecurityMonitor()
+{
+}
+
+std::string SmackSecurityMonitor::getReport()
+{
+       PolicyControlContext &context = pimpl->context;
+
+       Status<std::string> status { std::string() };
+
+       status = context.methodCall<std::string>("SmackSecurityMonitor::getReport");
+
+       return status.get();
+}
+
+int SmackSecurityMonitor::getIssueCount()
+{
+       PolicyControlContext &context = pimpl->context;
+
+       Status<int> status { -1 };
+
+       status = context.methodCall<int>("SmackSecurityMonitor::getIssueCount");
+
+       return status.get();
+}
+
+} // namespace DevicePolicyManager
diff --git a/krate.cpp b/krate.cpp
new file mode 100644 (file)
index 0000000..b49ac3f
--- /dev/null
+++ b/krate.cpp
@@ -0,0 +1,101 @@
+/*
+ *  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/location.cpp b/location.cpp
new file mode 100644 (file)
index 0000000..5a5bcb6
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ *  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
index e4b1d81..1eec5cd 100755 (executable)
@@ -1,12 +1,16 @@
-Name:    device-policy-client
+Name:    libdpm
 Version: 0.0.1
 Release: 0
 License: Apache-2.0
 Source0: %{name}-%{version}.tar.gz
-Summary: Tizen Device Policy Manager Client
+Summary: Tizen Device Policy Client
 Group:   Security/Other
 BuildRequires: gcc
 BuildRequires: cmake
+BuildRequires: pkgconfig(klay)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(capi-base-common)
+BuildRequires: pkgconfig(capi-system-info)
 
 %description
 Tizen Device Policy Client Library
@@ -14,7 +18,8 @@ Tizen Device Policy Client Library
 %files
 %manifest device-policy-client.manifest
 %defattr(644,root,root,755)
-%attr(700,root,root) %{_bindir}/device-policy-client
+%attr(755,root,root) %{_libdir}/libdpm.so.%{version}
+%{_libdir}/libdpm.so.0
 
 %prep
 %setup -q
@@ -51,3 +56,54 @@ rm -rf %{buildroot}
 %preun
 
 %postun
+
+## Devel Package ##############################################################
+%package -n libdpm-devel
+Summary: Libraries and header files for device policy client development
+Group: Development/Libraries
+Requires: libdpm = %{version}-%{release}
+
+%description -n libdpm-devel
+The libdpm-devel package includes the libraries and header files necessary for
+developing the DPM client program.
+
+%files -n libdpm-devel
+%manifest device-policy-client.manifest
+%defattr(644,root,root,755)
+%{_libdir}/libdpm.so
+%{_includedir}/dpm
+%{_libdir}/pkgconfig/dpm.pc
+
+## DSM Client Package ######################################################
+%package -n libdsm
+Summary: Tizen Device Security Monitor Client Library
+Group: Development/Libraries
+
+%description -n libdsm
+Tizen Device Security Monitor Client Library.
+
+%post -n libdsm -p /sbin/ldconfig
+
+%postun -n libdsm -p /sbin/ldconfig
+
+%files -n libdsm
+%manifest device-policy-client.manifest
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libdsm.so.%{version}
+%{_libdir}/libdsm.so.0
+
+## DSM Devel Package ##############################################################
+%package -n libdsm-devel
+Summary: Libraries and header files for device security monitor client development
+Group: Development/Libraries
+
+%description -n libdsm-devel
+The libdsm-devel package includes the libraries and header files necessary for
+developing the DSM client program.
+
+%files -n libdsm-devel
+%manifest device-policy-client.manifest
+%defattr(644,root,root,755)
+%{_libdir}/libdsm.so
+%{_includedir}/dsm
+%{_libdir}/pkgconfig/dsm.pc
\ No newline at end of file
diff --git a/password.cpp b/password.cpp
new file mode 100644 (file)
index 0000000..8724c47
--- /dev/null
@@ -0,0 +1,375 @@
+/*
+ *  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
new file mode 100644 (file)
index 0000000..ebcc32a
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ *  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
new file mode 100644 (file)
index 0000000..4d5145d
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ *  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__
similarity index 66%
rename from place-holder.c
rename to policy-context.hxx
index bb4b746..f5d872f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+ *  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.
  *  limitations under the License
  */
 
-#include <stdio.h>
+#ifndef __DEVICE_POLICY_CONTEXT__
+#define __DEVICE_POLICY_CONTEXT__
 
-int main()
-{
-       return 0;
-}
\ No newline at end of file
+#include <memory>
+
+#include "policy-client.h"
+
+using PolicyControlContext = ::DevicePolicyContext::PolicyControlContext;
+
+#endif //!__DEVICE_POLICY_CONTEXT__
diff --git a/policy/administration.hxx b/policy/administration.hxx
new file mode 100644 (file)
index 0000000..9cc1fbb
--- /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
+ */
+
+#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
new file mode 100644 (file)
index 0000000..c141441
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ *  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
new file mode 100644 (file)
index 0000000..fd2e3bb
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ *  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
new file mode 100644 (file)
index 0000000..a638c54
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ *  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
new file mode 100644 (file)
index 0000000..4f071c3
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ *  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
new file mode 100644 (file)
index 0000000..f35d323
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ *  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
new file mode 100644 (file)
index 0000000..8a5245a
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ *  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
new file mode 100644 (file)
index 0000000..9fa0801
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ *  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
new file mode 100644 (file)
index 0000000..8b3f13d
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ *  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
new file mode 100644 (file)
index 0000000..31ca994
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ *  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
new file mode 100644 (file)
index 0000000..e77c050
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ *  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
new file mode 100644 (file)
index 0000000..9decd7f
--- /dev/null
@@ -0,0 +1,257 @@
+/*
+ *  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
new file mode 100644 (file)
index 0000000..cb2513d
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ *  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
new file mode 100644 (file)
index 0000000..2336af6
--- /dev/null
+++ b/status.h
@@ -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/storage.cpp b/storage.cpp
new file mode 100644 (file)
index 0000000..2d98adc
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ *  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
new file mode 100644 (file)
index 0000000..69d338e
--- /dev/null
+++ b/wifi.cpp
@@ -0,0 +1,168 @@
+/*
+ *  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