init Service Adaptor 67/39567/1
authorYongjin Kim <youth.kim@samsung.com>
Tue, 19 May 2015 00:13:26 +0000 (09:13 +0900)
committerYongjin Kim <youth.kim@samsung.com>
Tue, 19 May 2015 00:13:26 +0000 (09:13 +0900)
Change-Id: Ibf5295f071f949bda2d4208bc60352000bcf9a8c
Signed-off-by: Yongjin Kim <youth.kim@samsung.com>
43 files changed:
CMakeLists.txt [new file with mode: 0644]
LICENSE.APLv2 [new file with mode: 0644]
NOTICE [new file with mode: 0644]
adaptor/CMakeLists.txt [new file with mode: 0644]
adaptor/auth-adaptor/auth_adaptor.c [new file with mode: 0644]
adaptor/auth-adaptor/auth_adaptor.h [new file with mode: 0644]
adaptor/contact-adaptor/contact_adaptor.c [new file with mode: 0644]
adaptor/contact-adaptor/contact_adaptor.h [new file with mode: 0644]
adaptor/storage-adaptor/storage_adaptor.c [new file with mode: 0644]
adaptor/storage-adaptor/storage_adaptor.h [new file with mode: 0644]
client/CMakeLists.txt [new file with mode: 0644]
client/sal_core_api.c [new file with mode: 0644]
client/sal_core_api.h [new file with mode: 0644]
client/sal_plugin_api.c [new file with mode: 0644]
client/sal_restful_api.c [new file with mode: 0644]
common/CMakeLists.txt [new file with mode: 0644]
common/ipc/sal_ipc.c [new file with mode: 0644]
common/ipc/sal_ipc.h [new file with mode: 0644]
common/sal_common.c [new file with mode: 0644]
include/service_adaptor.h [new file with mode: 0644]
include/service_adaptor_errors.h [new file with mode: 0644]
include/service_adaptor_internal.h [new file with mode: 0644]
include/service_adaptor_types.h [new file with mode: 0644]
packaging/service-adaptor.service [new file with mode: 0644]
packaging/service-adaptor.spec [new file with mode: 0644]
server/CMakeLists.txt [new file with mode: 0644]
server/sal.h [new file with mode: 0644]
server/sal_auth.c [new file with mode: 0644]
server/sal_auth.h [new file with mode: 0644]
server/sal_coherence.c [new file with mode: 0644]
server/sal_contact.c [new file with mode: 0644]
server/sal_contact.h [new file with mode: 0644]
server/sal_generator.c [new file with mode: 0644]
server/sal_group.c [new file with mode: 0644]
server/sal_main.c [new file with mode: 0644]
server/sal_observer.c [new file with mode: 0644]
server/sal_observer.h [new file with mode: 0644]
server/sal_storage.c [new file with mode: 0644]
server/sal_storage.h [new file with mode: 0644]
service-adaptor.manifest [new file with mode: 0644]
service-adaptor.pc.in [new file with mode: 0644]
test/CMakeLists.txt [new file with mode: 0644]
test/test.c [new file with mode: 0644]

diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..8a55c90
--- /dev/null
@@ -0,0 +1,50 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(service-adaptor)
+
+SET(CMAKE_SKIP_BUILD_RPATH TRUE)
+SET(VERSION_MAJOR 1)
+SET(VERSION "${VERSION_MAJOR}.1.0")
+
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+        SET(CMAKE_BUILD_TYPE "Debug")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+
+MESSAGE("")
+MESSAGE(">>> current directory: ${CMAKE_CURRENT_SOURCE_DIR}")
+MESSAGE(">>> Build type: ${CMAKE_BUILD_TYPE}")
+
+
+##########################################################
+# Define BASE LIB
+##########################################################
+ADD_SUBDIRECTORY(common)
+
+##########################################################
+# Define Adaptor
+##########################################################
+ADD_SUBDIRECTORY(adaptor)
+
+##########################################################
+# Define Adaptor API
+##########################################################
+ADD_SUBDIRECTORY(client)
+
+##########################################################
+# Define Adaptor Manager & Execute File
+##########################################################
+ADD_SUBDIRECTORY(server)
+
+##########################################################
+# Define Test App
+##########################################################
+ADD_SUBDIRECTORY(test)
+
+##########################################################
+# Define Install Files
+##########################################################
+
+CONFIGURE_FILE(service-adaptor.pc.in service-adaptor.pc @ONLY)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/service-adaptor.pc DESTINATION lib/pkgconfig)
+
+# LICENSE file
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE.APLv2 DESTINATION /usr/share/license/service-adaptor)
diff --git a/LICENSE.APLv2 b/LICENSE.APLv2
new file mode 100644 (file)
index 0000000..9443128
--- /dev/null
@@ -0,0 +1,204 @@
+Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.\r
+\r
+                                 Apache License\r
+                           Version 2.0, January 2004\r
+                        http://www.apache.org/licenses/\r
+\r
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r
+\r
+   1. Definitions.\r
+\r
+      "License" shall mean the terms and conditions for use, reproduction,\r
+      and distribution as defined by Sections 1 through 9 of this document.\r
+\r
+      "Licensor" shall mean the copyright owner or entity authorized by\r
+      the copyright owner that is granting the License.\r
+\r
+      "Legal Entity" shall mean the union of the acting entity and all\r
+      other entities that control, are controlled by, or are under common\r
+      control with that entity. For the purposes of this definition,\r
+      "control" means (i) the power, direct or indirect, to cause the\r
+      direction or management of such entity, whether by contract or\r
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the\r
+      outstanding shares, or (iii) beneficial ownership of such entity.\r
+\r
+      "You" (or "Your") shall mean an individual or Legal Entity\r
+      exercising permissions granted by this License.\r
+\r
+      "Source" form shall mean the preferred form for making modifications,\r
+      including but not limited to software source code, documentation\r
+      source, and configuration files.\r
+\r
+      "Object" form shall mean any form resulting from mechanical\r
+      transformation or translation of a Source form, including but\r
+      not limited to compiled object code, generated documentation,\r
+      and conversions to other media types.\r
+\r
+      "Work" shall mean the work of authorship, whether in Source or\r
+      Object form, made available under the License, as indicated by a\r
+      copyright notice that is included in or attached to the work\r
+      (an example is provided in the Appendix below).\r
+\r
+      "Derivative Works" shall mean any work, whether in Source or Object\r
+      form, that is based on (or derived from) the Work and for which the\r
+      editorial revisions, annotations, elaborations, or other modifications\r
+      represent, as a whole, an original work of authorship. For the purposes\r
+      of this License, Derivative Works shall not include works that remain\r
+      separable from, or merely link (or bind by name) to the interfaces of,\r
+      the Work and Derivative Works thereof.\r
+\r
+      "Contribution" shall mean any work of authorship, including\r
+      the original version of the Work and any modifications or additions\r
+      to that Work or Derivative Works thereof, that is intentionally\r
+      submitted to Licensor for inclusion in the Work by the copyright owner\r
+      or by an individual or Legal Entity authorized to submit on behalf of\r
+      the copyright owner. For the purposes of this definition, "submitted"\r
+      means any form of electronic, verbal, or written communication sent\r
+      to the Licensor or its representatives, including but not limited to\r
+      communication on electronic mailing lists, source code control systems,\r
+      and issue tracking systems that are managed by, or on behalf of, the\r
+      Licensor for the purpose of discussing and improving the Work, but\r
+      excluding communication that is conspicuously marked or otherwise\r
+      designated in writing by the copyright owner as "Not a Contribution."\r
+\r
+      "Contributor" shall mean Licensor and any individual or Legal Entity\r
+      on behalf of whom a Contribution has been received by Licensor and\r
+      subsequently incorporated within the Work.\r
+\r
+   2. Grant of Copyright License. Subject to the terms and conditions of\r
+      this License, each Contributor hereby grants to You a perpetual,\r
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+      copyright license to reproduce, prepare Derivative Works of,\r
+      publicly display, publicly perform, sublicense, and distribute the\r
+      Work and such Derivative Works in Source or Object form.\r
+\r
+   3. Grant of Patent License. Subject to the terms and conditions of\r
+      this License, each Contributor hereby grants to You a perpetual,\r
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+      (except as stated in this section) patent license to make, have made,\r
+      use, offer to sell, sell, import, and otherwise transfer the Work,\r
+      where such license applies only to those patent claims licensable\r
+      by such Contributor that are necessarily infringed by their\r
+      Contribution(s) alone or by combination of their Contribution(s)\r
+      with the Work to which such Contribution(s) was submitted. If You\r
+      institute patent litigation against any entity (including a\r
+      cross-claim or counterclaim in a lawsuit) alleging that the Work\r
+      or a Contribution incorporated within the Work constitutes direct\r
+      or contributory patent infringement, then any patent licenses\r
+      granted to You under this License for that Work shall terminate\r
+      as of the date such litigation is filed.\r
+\r
+   4. Redistribution. You may reproduce and distribute copies of the\r
+      Work or Derivative Works thereof in any medium, with or without\r
+      modifications, and in Source or Object form, provided that You\r
+      meet the following conditions:\r
+\r
+      (a) You must give any other recipients of the Work or\r
+          Derivative Works a copy of this License; and\r
+\r
+      (b) You must cause any modified files to carry prominent notices\r
+          stating that You changed the files; and\r
+\r
+      (c) You must retain, in the Source form of any Derivative Works\r
+          that You distribute, all copyright, patent, trademark, and\r
+          attribution notices from the Source form of the Work,\r
+          excluding those notices that do not pertain to any part of\r
+          the Derivative Works; and\r
+\r
+      (d) If the Work includes a "NOTICE" text file as part of its\r
+          distribution, then any Derivative Works that You distribute must\r
+          include a readable copy of the attribution notices contained\r
+          within such NOTICE file, excluding those notices that do not\r
+          pertain to any part of the Derivative Works, in at least one\r
+          of the following places: within a NOTICE text file distributed\r
+          as part of the Derivative Works; within the Source form or\r
+          documentation, if provided along with the Derivative Works; or,\r
+          within a display generated by the Derivative Works, if and\r
+          wherever such third-party notices normally appear. The contents\r
+          of the NOTICE file are for informational purposes only and\r
+          do not modify the License. You may add Your own attribution\r
+          notices within Derivative Works that You distribute, alongside\r
+          or as an addendum to the NOTICE text from the Work, provided\r
+          that such additional attribution notices cannot be construed\r
+          as modifying the License.\r
+\r
+      You may add Your own copyright statement to Your modifications and\r
+      may provide additional or different license terms and conditions\r
+      for use, reproduction, or distribution of Your modifications, or\r
+      for any such Derivative Works as a whole, provided Your use,\r
+      reproduction, and distribution of the Work otherwise complies with\r
+      the conditions stated in this License.\r
+\r
+   5. Submission of Contributions. Unless You explicitly state otherwise,\r
+      any Contribution intentionally submitted for inclusion in the Work\r
+      by You to the Licensor shall be under the terms and conditions of\r
+      this License, without any additional terms or conditions.\r
+      Notwithstanding the above, nothing herein shall supersede or modify\r
+      the terms of any separate license agreement you may have executed\r
+      with Licensor regarding such Contributions.\r
+\r
+   6. Trademarks. This License does not grant permission to use the trade\r
+      names, trademarks, service marks, or product names of the Licensor,\r
+      except as required for reasonable and customary use in describing the\r
+      origin of the Work and reproducing the content of the NOTICE file.\r
+\r
+   7. Disclaimer of Warranty. Unless required by applicable law or\r
+      agreed to in writing, Licensor provides the Work (and each\r
+      Contributor provides its Contributions) on an "AS IS" BASIS,\r
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r
+      implied, including, without limitation, any warranties or conditions\r
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r
+      PARTICULAR PURPOSE. You are solely responsible for determining the\r
+      appropriateness of using or redistributing the Work and assume any\r
+      risks associated with Your exercise of permissions under this License.\r
+\r
+   8. Limitation of Liability. In no event and under no legal theory,\r
+      whether in tort (including negligence), contract, or otherwise,\r
+      unless required by applicable law (such as deliberate and grossly\r
+      negligent acts) or agreed to in writing, shall any Contributor be\r
+      liable to You for damages, including any direct, indirect, special,\r
+      incidental, or consequential damages of any character arising as a\r
+      result of this License or out of the use or inability to use the\r
+      Work (including but not limited to damages for loss of goodwill,\r
+      work stoppage, computer failure or malfunction, or any and all\r
+      other commercial damages or losses), even if such Contributor\r
+      has been advised of the possibility of such damages.\r
+\r
+   9. Accepting Warranty or Additional Liability. While redistributing\r
+      the Work or Derivative Works thereof, You may choose to offer,\r
+      and charge a fee for, acceptance of support, warranty, indemnity,\r
+      or other liability obligations and/or rights consistent with this\r
+      License. However, in accepting such obligations, You may act only\r
+      on Your own behalf and on Your sole responsibility, not on behalf\r
+      of any other Contributor, and only if You agree to indemnify,\r
+      defend, and hold each Contributor harmless for any liability\r
+      incurred by, or claims asserted against, such Contributor by reason\r
+      of your accepting any such warranty or additional liability.\r
+\r
+   END OF TERMS AND CONDITIONS\r
+\r
+   APPENDIX: How to apply the Apache License to your work.\r
+\r
+      To apply the Apache License to your work, attach the following\r
+      boilerplate notice, with the fields enclosed by brackets "[]"\r
+      replaced with your own identifying information. (Don't include\r
+      the brackets!)  The text should be enclosed in the appropriate\r
+      comment syntax for the file format. We also recommend that a\r
+      file or class name and description of purpose be included on the\r
+      same "printed page" as the copyright notice for easier\r
+      identification within third-party archives.\r
+\r
+   Copyright [yyyy] [name of copyright owner]\r
+\r
+   Licensed under the Apache License, Version 2.0 (the "License");\r
+   you may not use this file except in compliance with the License.\r
+   You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+\r
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..eec59a3
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,3 @@
+Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE.APLv2 file for Apache License, Version 2 terms and conditions.
diff --git a/adaptor/CMakeLists.txt b/adaptor/CMakeLists.txt
new file mode 100644 (file)
index 0000000..c435db1
--- /dev/null
@@ -0,0 +1,132 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(sal-adaptor)
+
+SET(CMAKE_SKIP_BUILD_RPATH TRUE)
+
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+        SET(CMAKE_BUILD_TYPE "Debug")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+
+MESSAGE("")
+MESSAGE(">>> current directory: ${CMAKE_CURRENT_SOURCE_DIR}")
+MESSAGE(">>> Build type: ${CMAKE_BUILD_TYPE}")
+
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIBILITY} -fvisibility=hidden")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--gc-sections")
+
+##########################################################
+# Define auth adaptor lib
+##########################################################
+
+SET(AUTH-LIB "auth-adaptor")
+SET(AUTH-SRCS
+        ./auth-adaptor/auth_adaptor.c
+)
+
+INCLUDE_DIRECTORIES(
+        ${CMAKE_SOURCE_DIR}/include
+        ${CMAKE_SOURCE_DIR}/common
+        ${CMAKE_SOURCE_DIR}/adaptor/auth-adaptor
+)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(auth_pkgs REQUIRED dlog glib-2.0)
+
+set(EXTRA_CFLAGS "")
+FOREACH(flag ${auth_pkgs_CFLAGS})
+        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+#message(">>> extra_cflags ${EXTRA_CFLAGS}")
+#message(">>> result ${CMAKE_C_FLAGS}")
+#message(">>> ld flag ${device_pkgs_LDFLAGS}")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
+
+ADD_LIBRARY(${AUTH-LIB} SHARED ${AUTH-SRCS})
+TARGET_LINK_LIBRARIES(${AUTH-LIB} ${auth_pkgs_LDFLAGS} sal-common)
+SET_TARGET_PROPERTIES(${AUTH-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${AUTH-LIB} PROPERTIES VERSION ${VERSION})
+
+INSTALL(TARGETS ${AUTH-LIB} DESTINATION lib COMPONENT RuntimeLibraries)
+
+
+##########################################################
+# Define contact adaptor lib
+##########################################################
+
+SET(CONTACT-LIB "contact-adaptor")
+SET(CONTACT-SRCS
+        ./contact-adaptor/contact_adaptor.c
+)
+
+INCLUDE_DIRECTORIES(
+        ${CMAKE_SOURCE_DIR}/include
+        ${CMAKE_SOURCE_DIR}/common
+        ${CMAKE_SOURCE_DIR}/adaptor/contact-adaptor
+)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(contact_pkgs REQUIRED dlog glib-2.0)
+
+set(EXTRA_CFLAGS "")
+FOREACH(flag ${contact_pkgs_CFLAGS})
+        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+#message(">>> extra_cflags ${EXTRA_CFLAGS}")
+#message(">>> result ${CMAKE_C_FLAGS}")
+#message(">>> ld flag ${device_pkgs_LDFLAGS}")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
+
+ADD_LIBRARY(${CONTACT-LIB} SHARED ${CONTACT-SRCS})
+TARGET_LINK_LIBRARIES(${CONTACT-LIB} ${contact_pkgs_LDFLAGS} sal-common)
+SET_TARGET_PROPERTIES(${CONTACT-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${CONTACT-LIB} PROPERTIES VERSION ${VERSION})
+
+INSTALL(TARGETS ${CONTACT-LIB} DESTINATION lib COMPONENT RuntimeLibraries)
+
+
+##########################################################
+# Define storage adaptor lib
+##########################################################
+
+SET(STORAGE-LIB "storage-adaptor")
+SET(STORAGE-SRCS
+        ./storage-adaptor/storage_adaptor.c
+)
+
+INCLUDE_DIRECTORIES(
+        ${CMAKE_SOURCE_DIR}/include
+        ${CMAKE_SOURCE_DIR}/common
+        ${CMAKE_SOURCE_DIR}/adaptor/storage-adaptor
+)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(storage_pkgs REQUIRED dlog glib-2.0)
+
+set(EXTRA_CFLAGS "")
+FOREACH(flag ${storage_pkgs_CFLAGS})
+        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+#message(">>> extra_cflags ${EXTRA_CFLAGS}")
+#message(">>> result ${CMAKE_C_FLAGS}")
+#message(">>> ld flag ${storage_pkgs_LDFLAGS}")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
+
+ADD_LIBRARY(${STORAGE-LIB} SHARED ${STORAGE-SRCS})
+TARGET_LINK_LIBRARIES(${STORAGE-LIB} ${storage_pkgs_LDFLAGS} sal-common)
+SET_TARGET_PROPERTIES(${STORAGE-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${STORAGE-LIB} PROPERTIES VERSION ${VERSION})
+
+INSTALL(TARGETS ${STORAGE-LIB} DESTINATION lib COMPONENT RuntimeLibraries)
diff --git a/adaptor/auth-adaptor/auth_adaptor.c b/adaptor/auth-adaptor/auth_adaptor.c
new file mode 100644 (file)
index 0000000..ccc4d73
--- /dev/null
@@ -0,0 +1,39 @@
+#include <stdio.h>
+#include <glib.h>
+
+#include "auth_adaptor.h"
+#include "service_adaptor_internal.h"
+
+auth_adaptor_h auth_adaptor_create()
+{
+       auth_adaptor_h auth = (auth_adaptor_h) g_malloc0(sizeof(auth_adaptor_s));
+
+       return auth;
+}
+
+service_adaptor_error_e auth_adaptor_destroy(auth_adaptor_h auth)
+{
+       SAL_FREE(auth);
+
+       return SERVICE_ADAPTOR_ERROR_NONE;
+}
+
+service_adaptor_error_e auth_adaptor_start(auth_adaptor_h auth)
+{
+       return SERVICE_ADAPTOR_ERROR_NONE;
+}
+
+service_adaptor_error_e auth_adaptor_stop(auth_adaptor_h auth)
+{
+       return SERVICE_ADAPTOR_ERROR_NONE;
+}
+
+service_adaptor_error_e auth_adaptor_register_listener(auth_adaptor_h auth, auth_adaptor_listener_h listener)
+{
+       return SERVICE_ADAPTOR_ERROR_NONE;
+}
+
+service_adaptor_error_e auth_adaptor_unregister_listener(auth_adaptor_h auth, auth_adaptor_listener_h listener)
+{
+       return SERVICE_ADAPTOR_ERROR_NONE;
+}
diff --git a/adaptor/auth-adaptor/auth_adaptor.h b/adaptor/auth-adaptor/auth_adaptor.h
new file mode 100644 (file)
index 0000000..616dc63
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Auth Adaptor
+ *
+ * Copyright (c) 2014 - 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 __AUTH_ADAPTOR_H__
+#define __AUTH_ADAPTOR_H__
+
+#ifndef API
+#define API __attribute__ ((visibility("default")))
+#endif
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <stdio.h>
+#include "service_adaptor_errors.h"
+
+/**
+ * @file auth_adaptor.h
+ */
+
+/**
+ * @ingroup
+ * @defgroup
+ *
+ * @brief
+ *
+ * @section
+ *  \#include <auth_adaptor.h>
+ *
+ * <BR>
+ * @{
+ */
+
+typedef struct _auth_adaptor_s
+{
+       int i;
+} auth_adaptor_s;
+typedef struct auth_adaptor_s *auth_adaptor_h;
+
+typedef struct _auth_adaptor_listener_s
+{
+       int i;
+} auth_adaptor_listener_s;
+typedef struct auth_adaptor_listener_s *auth_adaptor_listener_h;
+
+API auth_adaptor_h auth_adaptor_create();
+API service_adaptor_error_e auth_adaptor_destroy(auth_adaptor_h auth);
+API service_adaptor_error_e auth_adaptor_start(auth_adaptor_h auth);
+API service_adaptor_error_e auth_adaptor_stop(auth_adaptor_h auth);
+API service_adaptor_error_e auth_adaptor_register_listener(auth_adaptor_h auth, auth_adaptor_listener_h listener);
+API service_adaptor_error_e auth_adaptor_unregister_listener(auth_adaptor_h auth, auth_adaptor_listener_h listener);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AUTH_ADAPTOR_H__ */
diff --git a/adaptor/contact-adaptor/contact_adaptor.c b/adaptor/contact-adaptor/contact_adaptor.c
new file mode 100644 (file)
index 0000000..202e65c
--- /dev/null
@@ -0,0 +1,39 @@
+#include <stdio.h>
+#include <glib.h>
+
+#include "contact_adaptor.h"
+#include "service_adaptor_internal.h"
+
+contact_adaptor_h contact_adaptor_create()
+{
+       contact_adaptor_h contact = (contact_adaptor_h) g_malloc0(sizeof(contact_adaptor_s));
+
+       return contact;
+}
+
+service_adaptor_error_e contact_adaptor_destroy(contact_adaptor_h contact)
+{
+       SAL_FREE(contact);
+
+       return SERVICE_ADAPTOR_ERROR_NONE;
+}
+
+service_adaptor_error_e contact_adaptor_start(contact_adaptor_h contact)
+{
+       return SERVICE_ADAPTOR_ERROR_NONE;
+}
+
+service_adaptor_error_e contact_adaptor_stop(contact_adaptor_h contact)
+{
+       return SERVICE_ADAPTOR_ERROR_NONE;
+}
+
+service_adaptor_error_e contact_adaptor_register_listener(contact_adaptor_h contact, contact_adaptor_listener_h listener)
+{
+       return SERVICE_ADAPTOR_ERROR_NONE;
+}
+
+service_adaptor_error_e contact_adaptor_unregister_listener(contact_adaptor_h contact, contact_adaptor_listener_h listener)
+{
+       return SERVICE_ADAPTOR_ERROR_NONE;
+}
diff --git a/adaptor/contact-adaptor/contact_adaptor.h b/adaptor/contact-adaptor/contact_adaptor.h
new file mode 100644 (file)
index 0000000..c497de7
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Contact Adaptor
+ *
+ * Copyright (c) 2014 - 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 __CONTACT_ADAPTOR_H__
+#define __CONTACT_ADAPTOR_H__
+
+#ifndef API
+#define API __attribute__ ((visibility("default")))
+#endif
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <stdio.h>
+#include "service_adaptor_errors.h"
+
+/**
+ * @file contact_adaptor.h
+ */
+
+/**
+ * @ingroup
+ * @defgroup
+ *
+ * @brief
+ *
+ * @section
+ *  \#include <contact_adaptor.h>
+ *
+ * <BR>
+ * @{
+ */
+
+typedef struct _contact_adaptor_s
+{
+       int i;
+} contact_adaptor_s;
+typedef struct _contact_adaptor_s *contact_adaptor_h;
+
+typedef struct _contact_adaptor_listener_s
+{
+       int i;
+} contact_adaptor_listener_s;
+typedef struct _contact_adaptor_listener_s *contact_adaptor_listener_h;
+
+API contact_adaptor_h contact_adaptor_create();
+API service_adaptor_error_e contact_adaptor_destroy(contact_adaptor_h contact);
+API service_adaptor_error_e contact_adaptor_start(contact_adaptor_h contact);
+API service_adaptor_error_e contact_adaptor_stop(contact_adaptor_h contact);
+API service_adaptor_error_e contact_adaptor_register_listener(contact_adaptor_h contact, contact_adaptor_listener_h listener);
+API service_adaptor_error_e contact_adaptor_unregister_listener(contact_adaptor_h contact, contact_adaptor_listener_h listener);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CONTACT_ADAPTOR_H__ */
diff --git a/adaptor/storage-adaptor/storage_adaptor.c b/adaptor/storage-adaptor/storage_adaptor.c
new file mode 100644 (file)
index 0000000..2244d3d
--- /dev/null
@@ -0,0 +1,39 @@
+#include <stdio.h>
+#include <glib.h>
+
+#include "storage_adaptor.h"
+#include "service_adaptor_internal.h"
+
+storage_adaptor_h storage_adaptor_create()
+{
+       storage_adaptor_h storage = (storage_adaptor_h) g_malloc0(sizeof(storage_adaptor_s));
+
+       return storage;
+}
+
+service_adaptor_error_e storage_adaptor_destroy(storage_adaptor_h storage)
+{
+       SAL_FREE(storage);
+
+       return SERVICE_ADAPTOR_ERROR_NONE;
+}
+
+service_adaptor_error_e storage_adaptor_start(storage_adaptor_h storage)
+{
+       return SERVICE_ADAPTOR_ERROR_NONE;
+}
+
+service_adaptor_error_e storage_adaptor_stop(storage_adaptor_h storage)
+{
+       return SERVICE_ADAPTOR_ERROR_NONE;
+}
+
+service_adaptor_error_e storage_adaptor_register_listener(storage_adaptor_h storage, storage_adaptor_listener_h listener)
+{
+       return SERVICE_ADAPTOR_ERROR_NONE;
+}
+
+service_adaptor_error_e storage_adaptor_unregister_listener(storage_adaptor_h storage, storage_adaptor_listener_h listener)
+{
+       return SERVICE_ADAPTOR_ERROR_NONE;
+}
diff --git a/adaptor/storage-adaptor/storage_adaptor.h b/adaptor/storage-adaptor/storage_adaptor.h
new file mode 100644 (file)
index 0000000..5b52a87
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Auth Adaptor
+ *
+ * Copyright (c) 2014 - 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 __STORAGE_ADAPTOR_H__
+#define __STORAGE_ADAPTOR_H__
+
+#ifndef API
+#define API __attribute__ ((visibility("default")))
+#endif
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <stdio.h>
+#include "service_adaptor_errors.h"
+
+/**
+ * @file storage_adaptor.h
+ */
+
+/**
+ * @ingroup
+ * @defgroup
+ *
+ * @brief
+ *
+ * @section
+ *  \#include <storage_adaptor.h>
+ *
+ * <BR>
+ * @{
+ */
+
+typedef struct _storage_adaptor_s
+{
+       int i;
+} storage_adaptor_s;
+typedef struct _storage_adaptor_s *storage_adaptor_h;
+
+typedef struct _storage_adaptor_listener_s
+{
+       int i;
+} storage_adaptor_listener_s;
+typedef struct _storage_adaptor_listener_s *storage_adaptor_listener_h;
+
+API storage_adaptor_h storage_adaptor_create();
+API service_adaptor_error_e storage_adaptor_destroy(storage_adaptor_h storage);
+API service_adaptor_error_e storage_adaptor_start(storage_adaptor_h storage);
+API service_adaptor_error_e storage_adaptor_stop(storage_adaptor_h storage);
+API service_adaptor_error_e storage_adaptor_register_listener(storage_adaptor_h storage, storage_adaptor_listener_h listener);
+API service_adaptor_error_e storage_adaptor_unregister_listener(storage_adaptor_h storage, storage_adaptor_listener_h listener);
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STORAGE_ADAPTOR_H__ */
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt
new file mode 100644 (file)
index 0000000..b421dab
--- /dev/null
@@ -0,0 +1,63 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(sal-client)
+
+SET(CMAKE_SKIP_BUILD_RPATH TRUE)
+
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+        SET(CMAKE_BUILD_TYPE "Debug")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+
+MESSAGE("")
+MESSAGE(">>> current directory: ${CMAKE_CURRENT_SOURCE_DIR}")
+MESSAGE(">>> Build type: ${CMAKE_BUILD_TYPE}")
+
+SET(VISIBILITY "-DEXPORT_API=\"__attribute__((visibility(\\\"default\\\")))\"")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIBILITY} -fvisibility=hidden")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--gc-sections")
+
+##########################################################
+# Define Service Adaptor CLIENT
+##########################################################
+
+SET(CLIENT-LIB "sal-client")
+SET(CLIENT-SRCS
+        ${CMAKE_SOURCE_DIR}/client/sal_core_api.c
+)
+
+INCLUDE_DIRECTORIES(
+        ${CMAKE_SOURCE_DIR}/include
+        ${CMAKE_SOURCE_DIR}/common
+        ${CMAKE_SOURCE_DIR}/common/ipc
+        ${CMAKE_SOURCE_DIR}/client
+        ${CMAKE_SOURCE_DIR}/adaptor/auth-adaptor
+        ${CMAKE_SOURCE_DIR}/adaptor/contact-adaptor
+        ${CMAKE_SOURCE_DIR}/adaptor/storage-adaptor
+)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(client_pkgs REQUIRED dlog glib-2.0)
+
+FOREACH(flag ${client_pkgs_CFLAGS})
+        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
+
+ADD_LIBRARY(${CLIENT-LIB} SHARED ${CLIENT-SRCS})
+
+TARGET_LINK_LIBRARIES(${CLIENT-LIB} ${client_pkgs_LDFLAGS} sal-common)
+SET_TARGET_PROPERTIES(${CLIENT-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${CLIENT-LIB} PROPERTIES VERSION ${VERSION})
+
+INSTALL(TARGETS ${CLIENT-LIB} DESTINATION lib COMPONENT RuntimeLibraries)
+
+SET(SAL-CLIENT-HEADERS
+        ${CMAKE_SOURCE_DIR}/include/service_adaptor.h
+        ${CMAKE_SOURCE_DIR}/include/service_adaptor_types.h
+        ${CMAKE_SOURCE_DIR}/include/service_adaptor_errors.h
+        ${CMAKE_SOURCE_DIR}/include/service_adaptor_internal.h
+)
+
+INSTALL(FILES ${SAL-CLIENT-HEADERS} DESTINATION include/service-adaptor)
diff --git a/client/sal_core_api.c b/client/sal_core_api.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/client/sal_core_api.h b/client/sal_core_api.h
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/client/sal_plugin_api.c b/client/sal_plugin_api.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/client/sal_restful_api.c b/client/sal_restful_api.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
new file mode 100644 (file)
index 0000000..b3187b1
--- /dev/null
@@ -0,0 +1,48 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(sal-common)
+
+SET(CMAKE_SKIP_BUILD_RPATH TRUE)
+
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+        SET(CMAKE_BUILD_TYPE "Debug")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+
+MESSAGE("")
+MESSAGE(">>> current directory: ${CMAKE_CURRENT_SOURCE_DIR}")
+MESSAGE(">>> Build type: ${CMAKE_BUILD_TYPE}")
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIBILITY} -fvisibility=hidden")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--gc-sections")
+
+SET(COMMON-LIB "sal-common")
+SET(COMMON-SRCS
+        ${CMAKE_SOURCE_DIR}/common/sal_common.c
+        ${CMAKE_SOURCE_DIR}/common/ipc/sal_ipc.c
+)
+
+INCLUDE_DIRECTORIES(
+        ${CMAKE_SOURCE_DIR}/include
+        ${CMAKE_SOURCE_DIR}/common
+        ${CMAKE_SOURCE_DIR}/common/ipc
+)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(common_pkgs REQUIRED dlog glib-2.0)
+
+FOREACH(flag ${common_pkgs_CFLAGS})
+        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+#message(">>>[${COMMON-LIB}] extra_cflags ${EXTRA_CFLAGS}")
+#message(">>>[${COMMON-LIB}] common_pkgs_cflags ${common_pkgs_CFLAGS}")
+#message(">>>[${COMMON-LIB}] result ${CMAKE_C_FLAGS}")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
+
+ADD_LIBRARY(${COMMON-LIB} SHARED ${COMMON-SRCS})
+TARGET_LINK_LIBRARIES(${COMMON-LIB} ${common_pkgs_LDFLAGS})
+SET_TARGET_PROPERTIES(${COMMON-LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${COMMON-LIB} PROPERTIES VERSION ${VERSION})
+
+INSTALL(TARGETS ${COMMON-LIB} DESTINATION lib COMPONENT RuntimeLibraries)
diff --git a/common/ipc/sal_ipc.c b/common/ipc/sal_ipc.c
new file mode 100644 (file)
index 0000000..fb83e28
--- /dev/null
@@ -0,0 +1,11 @@
+#include "sal_ipc.h"
+
+service_adaptor_error_e sal_ipc_init_server()
+{
+       return SERVICE_ADAPTOR_ERROR_NONE;
+}
+
+service_adaptor_error_e sal_ipc_deinit_server()
+{
+       return SERVICE_ADAPTOR_ERROR_NONE;
+}
diff --git a/common/ipc/sal_ipc.h b/common/ipc/sal_ipc.h
new file mode 100644 (file)
index 0000000..009d59b
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Service Adaptor
+ *
+ * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Yongjin Kim <youth.kim@samsung.com>
+ *          Jinhyeong Ahn <jinh.ahn@samsung.com>
+ *          Jiwon Kim <jiwon177.kim@samsung.com>
+ *
+ * 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 __TIZEN_CONVERGENCE_SAL_IPC_H__
+#define __TIZEN_CONVERGENCE_SAL_IPC_H__
+
+#ifndef API
+#define API __attribute__ ((visibility("default")))
+#endif
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include "service_adaptor_errors.h"
+
+API service_adaptor_error_e sal_ipc_init_server();
+API service_adaptor_error_e sal_ipc_deinit_server();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_CONVERGENCE_SAL_IPC_H__ */
diff --git a/common/sal_common.c b/common/sal_common.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/include/service_adaptor.h b/include/service_adaptor.h
new file mode 100644 (file)
index 0000000..0591e52
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Service Adaptor
+ *
+ * Copyright (c) 2014 - 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 __TIZEN_CONVERGENCE_SERVICE_ADAPTOR_H__
+#define __TIZEN_CONVERGENCE_SERVICE_ADAPTOR_H__
+
+#include <service_adaptor_errors.h>
+#include <service_adaptor_types.h>
+#include <service_adaptor_internal.h>
+
+#endif /* __TIZEN_CONVERGENCE_SERVICE_ADAPTOR_H__ */
diff --git a/include/service_adaptor_errors.h b/include/service_adaptor_errors.h
new file mode 100644 (file)
index 0000000..d811555
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Service Adaptor
+ *
+ * Copyright (c) 2014 - 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 __TIZEN_CONVERGENCE_SERVICE_ADAPTOR_ERRORS_H__
+#define __TIZEN_CONVERGENCE_SERVICE_ADAPTOR_ERRORS_H__
+
+#include <tizen.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#ifndef TIZEN_ERROR_SERVICE_ADAPTOR
+#define TIZEN_ERROR_SERVICE_ADAPTOR     -0x02F30000
+#endif
+
+/**
+ * @file service_adaptor_errors.h
+ */
+
+/**
+ * @addtogroup CAPI_CONVERGENCE_SERVICE_ADAPTOR_ERROR_MODULE
+ * @{
+ */
+
+/**
+ * @brief Enumeration for service adaptor errors.
+ *
+ * @since_tizen @if MOBILE 3.0 @elseif WEARABLE 3.0 @endif
+ *
+ */
+typedef enum
+{
+       SERVICE_ADAPTOR_ERROR_NONE                      = TIZEN_ERROR_NONE,                     /**< Success */
+       SERVICE_ADAPTOR_ERROR_NOT_SUPPORTED             = TIZEN_ERROR_NOT_SUPPORTED,            /**< Service plugin does not support API */
+       SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER         = TIZEN_ERROR_INVALID_PARAMETER,        /**< The parameter is invalid */
+       SERVICE_ADAPTOR_ERROR_TIMED_OUT                 = TIZEN_ERROR_TIMED_OUT,                /**< API time out */
+       SERVICE_ADAPTOR_ERROR_NO_DATA                   = TIZEN_ERROR_NO_DATA,                  /**< There is no data available */
+       SERVICE_ADAPTOR_ERROR_PERMISSION_DENIED         = TIZEN_ERROR_PERMISSION_DENIED,        /**< Permission denied */
+       SERVICE_ADAPTOR_ERROR_UNKNOWN                   = TIZEN_ERROR_UNKNOWN,                  /**< Unknown error */
+       SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE              = TIZEN_ERROR_SERVICE_ADAPTOR | 0x01,   /**< IPC Connection unstabled */
+       SERVICE_ADAPTOR_ERROR_PLUGIN_FAILED             = TIZEN_ERROR_SERVICE_ADAPTOR | 0x02,   /**< The error occured from Plugin, See detail from service_adaptor_get_last_result() and Plugin SPEC */
+       SERVICE_ADAPTOR_ERROR_NOT_AUTHOLIZED            = TIZEN_ERROR_SERVICE_ADAPTOR | 0x03,   /**< Need Autholization */
+       SERVICE_ADAPTOR_ERROR_INVALID_STATE             = TIZEN_ERROR_SERVICE_ADAPTOR | 0x04,   /**< The handle state is invalid for processing API */
+       SERVICE_ADAPTOR_ERROR_SYSTEM                    = TIZEN_ERROR_SERVICE_ADAPTOR | 0x05,   /**< Internal system module error */
+       SERVICE_ADAPTOR_ERROR_INTERNAL                  = TIZEN_ERROR_SERVICE_ADAPTOR | 0x06,   /**< Implementation Error */
+} service_adaptor_error_e;
+
+ /**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_CONVERGENCE_SERVICE_ADAPTOR_ERRORS_H__ */
diff --git a/include/service_adaptor_internal.h b/include/service_adaptor_internal.h
new file mode 100644 (file)
index 0000000..d4e12a8
--- /dev/null
@@ -0,0 +1,129 @@
+/*
+ * Service Adaptor
+ *
+ * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Yongjin Kim <youth.kim@samsung.com>
+ *          Jinhyeong Ahn <jinh.ahn@samsung.com>
+ *          Jiwon Kim <jiwon177.kim@samsung.com>
+ *
+ * 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 __TIZEN_CONVERGENCE_SAL_INTERNAL_H__
+#define __TIZEN_CONVERGENCE_SAL_INTERNAL_H__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#ifdef API
+#undef API
+#endif
+#define API __attribute__ ((visibility("default")))
+
+#define LOG_TAG "SERVICE_ADAPTOR"
+#include <dlog.h>
+#define DLOG(prio, fmt, arg...) \
+        do { SLOG(prio, LOG_TAG, fmt, ##arg); } while (0)
+
+
+#if defined(_SERVICE_ADAPTOR_IPC_SERVER)
+#define IPC_ROLE "[SERVER]"
+#elif defined(_SERVICE_ADAPTOR_IPC_CLIENT)
+#define IPC_ROLE "[CLIENT]"
+#else
+#define IPC_ROLE "[LIB]"
+#endif
+
+#define INFO(fmt, arg...) SLOGI(IPC_ROLE" "fmt, ##arg)
+#define ERR(fmt, arg...) SLOGE(IPC_ROLE" "fmt, ##arg)
+#define DBG(fmt, arg...) SLOGD(IPC_ROLE" "fmt, ##arg)
+#define WARN(fmt, arg...) SLOGD(IPC_ROLE" "fmt, ##arg)
+#define VERBOSE(fmt, arg...) SLOGV(IPC_ROLE" "fmt, ##arg)
+
+#ifdef SERVICE_ADAPTOR_DEBUGGING
+
+        #define SAL_FN_CALL DBG(">>>>>>>> called")
+        #define SAL_FN_END DBG("<<<<<<<< ended")
+
+        #define SAL_DBG(fmt, arg...) DBG(fmt, ##arg)
+        #define SAL_WARN(fmt, arg...) WARN(fmt, ##arg)
+        #define SAL_ERR(fmt, arg...) ERR(fmt, ##arg)
+        #define SAL_INFO(fmt, arg...) INFO(fmt, ##arg)
+        #define SAL_VERBOSE(fmt, arg...) VERBOSE(fmt, ##arg)
+
+#else /* SERVICE_ADAPTOR_DEBUGGING */
+        #define SAL_FN_CALL
+        #define SAL_FN_END
+
+        #define SAL_DBG(fmt, arg...)
+        #define SAL_WARN(fmt, arg...)
+        #define SAL_ERR(fmt, arg...) ERR(fmt, ##arg)
+        #define SAL_INFO(fmt, arg...)
+        #define SAL_VERBOSE(fmt, arg...)
+
+#endif /* SERVICE_ADAPTOR_DEBUGGING */
+
+#define WARN_IF(expr, fmt, arg...) do { \
+        if (expr) { \
+                SAL_WARN(fmt, ##arg); \
+        } \
+} while (0)
+#define RET_IF(expr) do { \
+        if (expr) { \
+                SAL_ERR("(%s)", #expr); \
+                return; \
+        } \
+} while (0)
+#define RETV_IF(expr, val) do { \
+        if (expr) { \
+                SAL_ERR("(%s)", #expr); \
+                return (val); \
+        } \
+} while (0)
+#define RETM_IF(expr, fmt, arg...) do { \
+        if (expr) { \
+                SAL_ERR(fmt, ##arg); \
+                return; \
+        } \
+} while (0)
+#define RETVM_IF(expr, val, fmt, arg...) do { \
+        if (expr) { \
+                SAL_ERR(fmt, ##arg); \
+                return (val); \
+        } \
+} while (0)
+#define TRYM_IF(expr, fmt, arg...) do { \
+        if (expr) { \
+                SAL_ERR(fmt, ##arg); \
+                goto catch; \
+        } \
+} while (0)
+#define TRYVM_IF(expr, val, fmt, arg...) do { \
+        if (expr) { \
+                SAL_ERR(fmt, ##arg); \
+                val; \
+               goto catch; \
+        } \
+} while (0)
+
+
+#define SAL_FREE(ptr) do { \
+       if (ptr) \
+               free(ptr); \
+       ptr = NULL; \
+} while(0)
+
+#endif /* __TIZEN_CONVERGENCE_SAL_INTERNAL_H__ */
diff --git a/include/service_adaptor_types.h b/include/service_adaptor_types.h
new file mode 100644 (file)
index 0000000..e51c010
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Service Adaptor
+ *
+ * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Yongjin Kim <youth.kim@samsung.com>
+ *          Jinhyeong Ahn <jinh.ahn@samsung.com>
+ *          Jiwon Kim <jiwon177.kim@samsung.com>
+ *
+ * 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 __TIZEN_CONVERGENCE_SERVICE_ADAPTOR_TYPES_H__
+#define __TIZEN_CONVERGENCE_SERVICE_ADAPTOR_TYPES_H__
+
+#include <stdio.h>
+#include <glib.h>
+
+#include "auth_adaptor.h"
+#include "contact_adaptor.h"
+#include "storage_adaptor.h"
+
+#define FILE_PATH_LEN  256
+
+typedef struct _service_adaptor_s
+{
+       GList *svc_list;
+
+       auth_adaptor_h                  auth;
+       contact_adaptor_h               contact;
+       storage_adaptor_h               storage;
+
+       auth_adaptor_listener_h         auth_listener;
+       contact_adaptor_listener_h      contact_listener;
+       storage_adaptor_listener_h      storage_listener;
+
+       GMutex mutex;
+       GCond cond;
+       int start;
+} service_adaptor_s;
+typedef struct _service_adaptor_s *service_adaptor_h;
+
+
+#endif /* __TIZEN_CONVERGENCE_SERVICE_ADAPTOR_TYPES_H__ */
diff --git a/packaging/service-adaptor.service b/packaging/service-adaptor.service
new file mode 100644 (file)
index 0000000..925a7e4
--- /dev/null
@@ -0,0 +1,18 @@
+[Unit]
+Description=Service Adaptor daemon
+Requires=dbus.socket
+After=dlog_logger.service tizen-runtime.target
+
+[Service]
+User=system
+Group=system
+SmackProcessLabel=service-adaptor
+Type=dbus
+BusName=com.samsung.svcadaptor
+ExecStart=/usr/bin/service-adaptor
+Restart=none
+RestartSec=0
+KillMode=none
+
+[Install]
+WantedBy=multi-user.target
diff --git a/packaging/service-adaptor.spec b/packaging/service-adaptor.spec
new file mode 100644 (file)
index 0000000..9003ff8
--- /dev/null
@@ -0,0 +1,86 @@
+Name:       service-adaptor
+Summary:    Service Adaptor Framework for Convergence
+Version:    0.0.1
+Release:    1
+Group:      System/Libraries
+License:    Apache-2.0
+Source0:    %{name}-%{version}.tar.gz
+Source1:    service-adaptor.service
+
+BuildRequires:  cmake
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(gio-2.0)
+BuildRequires:  pkgconfig(glib-2.0)
+BuildRequires:  pkgconfig(gobject-2.0)
+BuildRequires:  pkgconfig(gthread-2.0)
+BuildRequires:  pkgconfig(capi-base-common)
+BuildRequires:  pkgconfig(capi-appfw-app-manager)
+BuildRequires:  pkgconfig(capi-appfw-package-manager)
+BuildRequires:  pkgconfig(libsmack)
+BuildRequires:  pkgconfig(service-discovery)
+BuildRequires:  pkgconfig(service-federation)
+BuildRequires:  service-discovery-devel
+BuildRequires:  service-federation-devel
+
+%description
+Service Adaptor Framework Library/Binary package
+
+%package -n service-adaptor-devel
+Summary:    Headers for Service Adaptor Framework (devel)
+Group:      Development/Libraries
+Requires:   %{name} = %{version}-%{release}
+
+%description -n service-adaptor-devel
+This package contains the header and pc files of Service Adaptor.
+
+%prep
+%setup -q
+
+%build
+export CFLAGS="${CFLAGS} -fPIC -Wall -g -fvisibility=hidden -fdata-sections -ffunction-sections"
+export CXXFLAGS="${CXXFLAGS} -fPIC -Wall -g -fvisibility=hidden"
+export LDFLAGS="${LDFLAGS} -Wl,--hash-style=both -Wl,--rpath=%{_prefix}/lib -Wl,--as-needed"
+
+%if 0%{?sec_build_binary_debug_enable}
+export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
+export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
+export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
+%endif
+
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
+
+make %{?_smp_mflags}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants
+install -m 0644 %SOURCE1 %{buildroot}%{_libdir}/systemd/system/
+ln -sf ../service-adaptor.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/
+
+mkdir -p %{buildroot}/usr/share/license
+cp LICENSE.APLv2 %{buildroot}/usr/share/license/service-adaptor
+cp LICENSE.APLv2 %{buildroot}/usr/share/license/service-adaptor-devel
+
+%post -n service-adaptor
+/sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files -n service-adaptor
+%manifest service-adaptor.manifest
+%defattr(-,system,system,-)
+%{_libdir}/lib*.so.*
+%{_bindir}/service-adaptor
+%{_bindir}/sal-test
+%{_libdir}/systemd/system/service-adaptor.service
+%{_libdir}/systemd/system/multi-user.target.wants/service-adaptor.service
+/usr/share/license/%{name}
+
+%files -n service-adaptor-devel
+%defattr(-,system,system,-)
+%{_libdir}/lib*.so
+%{_libdir}/pkgconfig/service-adaptor.pc
+%{_includedir}/service-adaptor/*.h
+/usr/share/license/%{name}-devel
diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt
new file mode 100644 (file)
index 0000000..0a6ce71
--- /dev/null
@@ -0,0 +1,56 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(sal-server)
+
+SET(CMAKE_SKIP_BUILD_RPATH TRUE)
+
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+        SET(CMAKE_BUILD_TYPE "Debug")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+
+MESSAGE("")
+MESSAGE(">>> current directory: ${CMAKE_CURRENT_SOURCE_DIR}")
+MESSAGE(">>> Build type: ${CMAKE_BUILD_TYPE}")
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIBILITY} -fvisibility=hidden")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--gc-sections -fPIE")
+
+
+##########################################################
+# Define Execute File
+##########################################################
+
+SET(MAIN-EXE "service-adaptor")
+SET(MAIN-SRCS
+        ${CMAKE_SOURCE_DIR}/server/sal_auth.c
+        ${CMAKE_SOURCE_DIR}/server/sal_contact.c
+        ${CMAKE_SOURCE_DIR}/server/sal_storage.c
+        ${CMAKE_SOURCE_DIR}/server/sal_observer.c
+        ${CMAKE_SOURCE_DIR}/server/sal_main.c
+)
+
+INCLUDE_DIRECTORIES(
+        ${CMAKE_SOURCE_DIR}/include
+        ${CMAKE_SOURCE_DIR}/common
+        ${CMAKE_SOURCE_DIR}/common/ipc
+        ${CMAKE_SOURCE_DIR}/server
+        ${CMAKE_SOURCE_DIR}/adaptor/auth-adaptor
+        ${CMAKE_SOURCE_DIR}/adaptor/contact-adaptor
+        ${CMAKE_SOURCE_DIR}/adaptor/storage-adaptor
+)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(main_pkgs REQUIRED dlog glib-2.0 capi-base-common capi-appfw-app-manager capi-appfw-package-manager libsmack service-discovery service-federation)
+
+FOREACH(flag ${main_pkgs_CFLAGS})
+        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
+
+ADD_DEFINITIONS("-DSERVICE_ADAPTOR_DEBUGGING")
+ADD_DEFINITIONS("-D_SERVICE_ADAPTOR_IPC_SERVER")
+
+ADD_EXECUTABLE(${MAIN-EXE} ${MAIN-SRCS})
+TARGET_LINK_LIBRARIES(${MAIN-EXE} ${main_pkgs_LDFLAGS} sal-common auth-adaptor contact-adaptor storage-adaptor)
+INSTALL(TARGETS ${MAIN-EXE} DESTINATION bin)
diff --git a/server/sal.h b/server/sal.h
new file mode 100644 (file)
index 0000000..4d2a66e
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Service Adaptor
+ *
+ * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Yongjin Kim <youth.kim@samsung.com>
+ *          Jinhyeong Ahn <jinh.ahn@samsung.com>
+ *          Jiwon Kim <jiwon177.kim@samsung.com>
+ *
+ * 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 __TIZEN_CONVERGENCE_SAL_H__
+#define __TIZEN_CONVERGENCE_SAL_H__
+
+#include "service_adaptor_errors.h"
+#include "service_adaptor_types.h"
+#include "service_adaptor_internal.h"
+
+service_adaptor_h sal_get_handle();
+char *sal_get_root_path();
+service_adaptor_error_e sal_connect(service_adaptor_h sal);
+service_adaptor_error_e sal_disconnect(service_adaptor_h sal);
+
+#endif /* __TIZEN_CONVERGENCE_SAL_H__ */
diff --git a/server/sal_auth.c b/server/sal_auth.c
new file mode 100644 (file)
index 0000000..4cb12ac
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Service Adaptor
+ *
+ * Copyright (c) 2014 - 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 <glib.h>
+
+#include "sal_auth.h"
+#include "service_adaptor_internal.h"
+
+//******************************************************************************
+//* Global variables and defines
+//******************************************************************************
+
+//******************************************************************************
+//* Private interface
+//******************************************************************************
+
+//******************************************************************************
+//* Private interface definition
+//******************************************************************************
+
+//******************************************************************************
+//* Public interface definition
+//******************************************************************************
+
+auth_adaptor_h sal_auth_create_handle()
+{
+       auth_adaptor_h auth_adaptor = auth_adaptor_create();
+
+       return auth_adaptor;
+}
+
+auth_adaptor_listener_h sal_auth_register_listener(auth_adaptor_h auth)
+{
+       int ret = SERVICE_ADAPTOR_ERROR_NONE;
+
+       auth_adaptor_listener_h listener =
+                       (auth_adaptor_listener_h) g_malloc0(sizeof(auth_adaptor_listener_s));
+
+       ret = auth_adaptor_register_listener(auth, listener);
+
+       if (SERVICE_ADAPTOR_ERROR_NONE != ret)
+       {
+               SAL_FREE(listener);
+       }
+
+       return listener;
+}
diff --git a/server/sal_auth.h b/server/sal_auth.h
new file mode 100644 (file)
index 0000000..c2b61b1
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Service Adaptor
+ *
+ * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Yongjin Kim <youth.kim@samsung.com>
+ *          Jinhyeong Ahn <jinh.ahn@samsung.com>
+ *          Jiwon Kim <jiwon177.kim@samsung.com>
+ *
+ * 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 __TIZEN_CONVERGENCE_SAL_AUTH_H__
+#define __TIZEN_CONVERGENCE_SAL_AUTH_H__
+
+#include "auth_adaptor.h"
+
+auth_adaptor_h sal_auth_create_handle();
+auth_adaptor_listener_h sal_auth_register_listener(auth_adaptor_h auth);
+
+#endif /* __TIZEN_CONVERGENCE_SAL_AUTH_H__ */
diff --git a/server/sal_coherence.c b/server/sal_coherence.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/server/sal_contact.c b/server/sal_contact.c
new file mode 100644 (file)
index 0000000..570c4e1
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Service Adaptor
+ *
+ * Copyright (c) 2014 - 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 <glib.h>
+
+#include "sal_contact.h"
+#include "service_adaptor_internal.h"
+
+//******************************************************************************
+//* Global variables and defines
+//******************************************************************************
+
+//******************************************************************************
+//* Private interface
+//******************************************************************************
+
+//******************************************************************************
+//* Private interface definition
+//******************************************************************************
+
+//******************************************************************************
+//* Public interface definition
+//******************************************************************************
+
+contact_adaptor_h sal_contact_create_handle()
+{
+       contact_adaptor_h contact_adaptor = contact_adaptor_create();
+
+       return contact_adaptor;
+}
+
+contact_adaptor_listener_h sal_contact_register_listener(contact_adaptor_h contact)
+{
+       int ret = SERVICE_ADAPTOR_ERROR_NONE;
+
+       contact_adaptor_listener_h listener =
+                       (contact_adaptor_listener_h) g_malloc0(sizeof(contact_adaptor_listener_s));
+
+       ret = contact_adaptor_register_listener(contact, listener);
+
+       if (SERVICE_ADAPTOR_ERROR_NONE != ret)
+       {
+               SAL_FREE(listener);
+       }
+
+       return listener;
+}
diff --git a/server/sal_contact.h b/server/sal_contact.h
new file mode 100644 (file)
index 0000000..e7b5a06
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Service Adaptor
+ *
+ * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Yongjin Kim <youth.kim@samsung.com>
+ *          Jinhyeong Ahn <jinh.ahn@samsung.com>
+ *          Jiwon Kim <jiwon177.kim@samsung.com>
+ *
+ * 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 __TIZEN_CONVERGENCE_SAL_CONTACT_H__
+#define __TIZEN_CONVERGENCE_SAL_CONTACT_H__
+
+#include "contact_adaptor.h"
+
+contact_adaptor_h sal_contact_create_handle();
+contact_adaptor_listener_h sal_contact_register_listener(contact_adaptor_h contact);
+
+#endif /* __TIZEN_CONVERGENCE_SAL_CONTACT_H__ */
diff --git a/server/sal_generator.c b/server/sal_generator.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/server/sal_group.c b/server/sal_group.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/server/sal_main.c b/server/sal_main.c
new file mode 100644 (file)
index 0000000..7ef46c9
--- /dev/null
@@ -0,0 +1,374 @@
+/*
+ * Service Adaptor
+ *
+ * Copyright (c) 2014 - 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 <stdio.h>
+#include <glib-object.h>
+#include <glib-unix.h>
+
+#include "service_adaptor.h"
+#include "service_discovery.h"
+#include "service_federation.h"
+#include "sal.h"
+#include "sal_ipc.h"
+#include "sal_auth.h"
+#include "sal_contact.h"
+#include "sal_storage.h"
+#include "sal_observer.h"
+
+//******************************************************************************
+//* Global variables and defines
+//******************************************************************************
+#define SAL_PLUGIN_METADATA_KEY_ADAPTOR        "service-adaptor"
+
+static service_adaptor_h g_service_adaptor = NULL;
+
+//******************************************************************************
+//* Private interface
+//******************************************************************************
+
+//******************************************************************************
+//* Private interface definition
+//******************************************************************************
+
+/**
+ * @brief create spec file
+ *
+ * @return      void.
+ */
+static service_adaptor_error_e _sal_create_spec_file(service_adaptor_h sal)
+{
+       SAL_FN_CALL;
+
+       int ret = 0;
+       RETV_IF(NULL == sal, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+
+       return ret;
+}
+
+/**
+ * @brief destroy spec file
+ *
+ * @return      void.
+ */
+static service_adaptor_error_e _sal_destroy_spec_file(service_adaptor_h sal)
+{
+       SAL_FN_CALL;
+
+       int ret = 0;
+       RETV_IF(NULL == sal, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+
+       return ret;
+}
+
+/**
+ * @brief start service adaptor
+ *
+ * @return      void.
+ */
+static service_adaptor_error_e _sal_start(service_adaptor_h sal)
+{
+       SAL_FN_CALL;
+
+       int ret = 0;
+       RETV_IF(NULL == sal, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+
+       ret = auth_adaptor_start(sal->auth);
+       RETVM_IF(SERVICE_ADAPTOR_ERROR_NONE != ret, SERVICE_ADAPTOR_ERROR_INTERNAL, "auth_adaptor_start() Fail(%d)", ret);
+
+       ret = contact_adaptor_start(sal->contact);
+       RETVM_IF(SERVICE_ADAPTOR_ERROR_NONE != ret, SERVICE_ADAPTOR_ERROR_INTERNAL, "contact_adaptor_start() Fail(%d)", ret);
+
+       ret = storage_adaptor_start(sal->storage);
+       RETVM_IF(SERVICE_ADAPTOR_ERROR_NONE != ret, SERVICE_ADAPTOR_ERROR_INTERNAL, "storage_adaptor_start() Fail(%d)", ret);
+
+       g_mutex_lock(&sal->mutex);
+       sal->start = sal->start + 1;
+       g_cond_signal(&sal->cond);
+       g_mutex_unlock(&sal->mutex);
+
+       return ret;
+}
+
+/**
+ * @brief stop service adaptor
+ *
+ * @return      void.
+ */
+static service_adaptor_error_e _sal_stop(service_adaptor_h sal)
+{
+       SAL_FN_CALL;
+
+       int ret = 0;
+       RETV_IF(NULL == sal, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+       RETVM_IF(0 == sal->start, SERVICE_ADAPTOR_ERROR_INTERNAL, "could not start service adaptor");
+
+       ret += auth_adaptor_stop(sal->auth);
+       ret += contact_adaptor_stop(sal->contact);
+       ret += storage_adaptor_stop(sal->storage);
+       RETVM_IF(SERVICE_ADAPTOR_ERROR_NONE != ret, SERVICE_ADAPTOR_ERROR_INTERNAL, "could not stop service adaptor(%d)", ret);
+
+       sal->start = 0;
+
+       return ret;
+}
+
+/**
+ * @brief create service adaptor
+ *
+ * @return      void.
+ */
+static service_adaptor_h _sal_create()
+{
+       SAL_FN_CALL;
+
+       service_adaptor_h sal = NULL;
+
+       // 1) create auth adaptor handle
+       auth_adaptor_h auth = sal_auth_create_handle();
+       TRYM_IF(NULL == auth, "sal_auth_create_handle() Fail");
+
+       // 2) create contact adaptor handle
+       contact_adaptor_h contact = sal_contact_create_handle();
+       TRYM_IF(NULL == contact, "sal_contact_create_handle() Fail");
+
+       // 3) create storage adaptor handle
+       storage_adaptor_h storage = sal_storage_create_handle();
+       TRYM_IF(NULL == storage, "sal_storage_create_handle() Fail");
+
+       // 4) register auth adaptor listener
+       auth_adaptor_listener_h auth_listener = sal_auth_register_listener(auth);
+       TRYM_IF(NULL == auth_listener, "sal_auth_register_listener() Fail");
+
+       // 5) register contact adaptor listener
+       contact_adaptor_listener_h contact_listener = sal_contact_register_listener(contact);
+       TRYM_IF(NULL == contact_listener, "sal_contact_register_listener() Fail");
+
+       // 6) register storage adaptor listener
+       storage_adaptor_listener_h storage_listener = sal_storage_register_listener(storage);
+       TRYM_IF(NULL == storage_listener, "sal_storage_register_listener() Fail");
+
+       // 7) create service adaptor
+       sal = (service_adaptor_h) g_malloc0(sizeof(service_adaptor_s));
+       TRYM_IF(NULL == sal, "could not create service adaptor");
+
+       sal->auth = auth;
+       sal->contact = contact;
+       sal->storage = storage;
+
+       g_mutex_init(&sal->mutex);
+       g_cond_init(&sal->cond);
+
+catch:
+       // free
+
+       return sal;
+}
+
+/**
+ * @brief destroy service adaptor
+ *
+ * @return      void.
+ */
+static void _sal_destroy(service_adaptor_h sal)
+{
+       SAL_FN_CALL;
+
+       RET_IF(NULL == sal);
+
+        // 1) destroy service list
+        if (NULL != sal->svc_list)
+        {
+                g_list_free(sal->svc_list);
+                sal->svc_list = NULL;
+        }
+
+       // 2) free service adaptor handle
+       SAL_FREE(sal);
+
+       SAL_FN_END;
+}
+
+/**
+ * @brief init service adaptor
+ *
+ * @return      void.
+ */
+static service_adaptor_error_e _sal_init()
+{
+       SAL_FN_CALL;
+       int ret = SERVICE_ADAPTOR_ERROR_NONE;
+
+       // 1) create adaptor (memory allocation)
+       service_adaptor_h sal = _sal_create();
+       RETVM_IF(NULL == sal, SERVICE_ADAPTOR_ERROR_INTERNAL, "_sal_create() Fail");
+
+       // 2) start adaptor (plugin loading)
+       ret = _sal_start(sal);
+       RETVM_IF(SERVICE_ADAPTOR_ERROR_NONE != ret, SERVICE_ADAPTOR_ERROR_INTERNAL, "_sal_start() Fail(%d)", ret);
+
+       // 3) start adaptor (spec file creation)
+       ret = _sal_create_spec_file(sal);
+       RETVM_IF(SERVICE_ADAPTOR_ERROR_NONE != ret, SERVICE_ADAPTOR_ERROR_INTERNAL, "_sal_create_spec_file() Fail(%d)", ret);
+
+       // 4) init dbus
+       ret = sal_ipc_init_server();
+       RETVM_IF(SERVICE_ADAPTOR_ERROR_NONE != ret, SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE, "sal_ipc_init_server() Fail(%d)", ret);
+
+       // 5) assign to global service adaptor handle
+       g_service_adaptor = sal;
+
+       // 6) register callback for package event
+       ret = sal_observer_start();
+       RETVM_IF(SERVICE_ADAPTOR_ERROR_NONE != ret, ret, "sal_observer_start() Fail(%d)", ret);
+
+       // 7) create service discovery
+       ret = service_discovery_create();
+       RETVM_IF(SERVICE_ADAPTOR_ERROR_NONE != ret, ret, "service_discovery_create() Fail(%d)", ret);
+
+       // 8) create service federation
+       ret = service_federation_create();
+       RETVM_IF(SERVICE_ADAPTOR_ERROR_NONE != ret, ret, "service_federation_create() Fail(%d)", ret);
+
+       return ret;
+}
+
+/**
+ * @brief deinit service adaptor
+ *
+ * @param[in]   service_adaptor         specifies handle of service adaptor
+ * @return      void.
+ */
+static void _sal_deinit(service_adaptor_h sal)
+{
+       SAL_FN_CALL;
+
+       RET_IF(NULL == sal);
+
+       sal_ipc_deinit_server();
+
+       _sal_destroy_spec_file(sal);
+
+        if (0 < sal->start)
+        {
+               _sal_stop(sal);
+       }
+
+       _sal_destroy(sal);
+
+       SAL_FN_END;
+}
+
+/**
+ * @brief main signal function
+ *
+ * @param[in]   data            specifies user data passed by main function
+ * @return      void.
+ */
+static gint _sigterm_callback(void *data)
+{
+       g_main_loop_quit((GMainLoop*)data);
+
+       return 0;
+}
+
+/**
+ * @brief main function
+ *
+ * @param[in]   argc            specifies count of arguments
+ * @param[in]   argv            specifies value list of arguments
+ * @return      void.
+ */
+int main(int argc, char *argv[])
+{
+       int ret = SERVICE_ADAPTOR_ERROR_NONE;
+       GMainLoop *loop = NULL;
+
+#if !GLIB_CHECK_VERSION(2,32,0)
+       g_thread_init(NULL);
+#endif
+#if !GLIB_CHECK_VERSION(2,35,0)
+       g_type_init();
+#endif
+
+       ret = _sal_init();
+       RETVM_IF(SERVICE_ADAPTOR_ERROR_NONE != ret, 0, "_sal_init() Fail(%d)", ret);
+
+       // mainloop of main thread
+       loop = g_main_loop_new(NULL, FALSE);
+
+       // installing signal handlers
+       g_unix_signal_add_full(G_PRIORITY_HIGH, SIGINT,
+                       _sigterm_callback, loop, NULL );
+       g_unix_signal_add_full(G_PRIORITY_HIGH, SIGTERM,
+                       _sigterm_callback, loop, NULL );
+
+       // start application's main loop
+       g_main_loop_run(loop);
+
+       // cleanup after mainloop
+       g_main_loop_unref(loop);
+
+       service_adaptor_h sal = sal_get_handle();
+       _sal_deinit(sal);
+
+       return 0;
+}
+
+//******************************************************************************
+//* Public interface definition
+//******************************************************************************
+
+service_adaptor_h sal_get_handle()
+{
+       SAL_FN_CALL;
+
+        return g_service_adaptor;
+}
+
+char *sal_get_root_path()
+{
+       SAL_FN_CALL;
+
+        char *root_path = NULL;
+        char tnfs_root_path[FILE_PATH_LEN] = {0,};
+
+        // TODO: tmp -> need to use get_path APIs of TNFS
+        snprintf(tnfs_root_path, FILE_PATH_LEN, "%s", "/opt/storage/tnfs");
+        root_path = strdup(tnfs_root_path);
+
+        return root_path;
+}
+
+service_adaptor_error_e sal_connect(service_adaptor_h sal)
+{
+       SAL_FN_CALL;
+
+       RETV_IF(NULL == sal, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+
+        return SERVICE_ADAPTOR_ERROR_NONE;
+}
+
+service_adaptor_error_e sal_disconnect(service_adaptor_h sal)
+{
+       SAL_FN_CALL;
+
+       RETV_IF(NULL == sal, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+
+        return SERVICE_ADAPTOR_ERROR_NONE;
+}
diff --git a/server/sal_observer.c b/server/sal_observer.c
new file mode 100644 (file)
index 0000000..b012215
--- /dev/null
@@ -0,0 +1,155 @@
+/*
+ * Service Adaptor
+ *
+ * Copyright (c) 2014 - 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 <stdio.h>
+#include <glib.h>
+
+#include <tizen.h>
+#include <app_info.h>
+#include <package_manager.h>
+
+#include "sal.h"
+#include "sal_observer.h"
+
+//******************************************************************************
+//* Global variables and defines
+//******************************************************************************
+#define SAL_PLUGIN_METADATA_KEY_ADAPTOR        "service-adaptor"
+
+//******************************************************************************
+//* Private interface
+//******************************************************************************
+
+//******************************************************************************
+//* Private interface definition
+//******************************************************************************
+
+/**
+ * @brief callback of app info
+ *
+ * @return      void.
+ */
+static bool _sal_app_meta_cb(const char *key, const char *value, void *user_data)
+{
+       SAL_FN_CALL;
+
+       char **app_meta = (char **) user_data;
+
+       if ((NULL != key) && (NULL != value))
+       {
+               if (0 == strncmp(SAL_PLUGIN_METADATA_KEY_ADAPTOR, key, strlen(SAL_PLUGIN_METADATA_KEY_ADAPTOR)))
+               {
+                       app_meta[0] = strdup(value);
+                       SAL_INFO("SAL_PLUGIN_METADATA_KEY_ADAPTOR: %s", value);
+               }
+       }
+
+       return true;
+}
+
+/**
+ * @brief callback of app info
+ *
+ * @return      void.
+ */
+static bool _sal_app_info_cb(package_info_app_component_type_e comp_type, const char *app_id, void *user_data)
+{
+       SAL_FN_CALL;
+
+       app_info_h app_info = NULL;
+       int ret = PACKAGE_MANAGER_ERROR_NONE;
+       char *pkg_path = (char *) user_data;
+       char **app_meta = (char **) g_malloc0(sizeof(char *) * 1);
+
+       (void) pkg_path;
+
+       app_info_create(app_id, &app_info);
+       ret = app_info_foreach_metadata(app_info, _sal_app_meta_cb, (void *) app_meta);
+       RETVM_IF(PACKAGE_MANAGER_ERROR_NONE != ret, false, "app_info_foreach_metadata() Fail(%d)", ret);
+
+       app_info_destroy(app_info);
+
+       // TODO: using app_meta
+
+       SAL_FREE(app_meta);
+
+       return true;
+}
+
+/**
+ * @brief callback of package manager
+ *
+ * @return      void.
+ */
+static void _sal_package_event_cb(const char *type,
+                const char *package,
+                package_manager_event_type_e event_type,
+                package_manager_event_state_e event_state,
+                int progress,
+                package_manager_error_e error,
+                void *user_data)
+{
+        SAL_FN_CALL;
+
+        if ((PACKAGE_MANAGER_EVENT_TYPE_INSTALL == event_type)
+                        && (PACKAGE_MANAGER_EVENT_STATE_COMPLETED == event_state))
+        {
+                int ret = PACKAGE_MANAGER_ERROR_NONE;
+                package_info_h p_info = NULL;
+
+                ret = package_manager_get_package_info(package, &p_info);
+                RETM_IF(PACKAGE_MANAGER_ERROR_NONE != ret, "package_manager_get_package_info() Fail(%d)", ret);
+
+                char *path = NULL;
+                ret = package_info_get_root_path(p_info, &path);
+                RETM_IF(PACKAGE_MANAGER_ERROR_NONE != ret, "package_info_get_root_path() Fail(%d)", ret);
+
+                ret = package_info_foreach_app_from_package(p_info, PACKAGE_INFO_ALLAPP, _sal_app_info_cb, path);
+                RETM_IF(PACKAGE_MANAGER_ERROR_NONE != ret, "package_info_foreach_app_from_package() Fail(%d)", ret);
+
+                ret = package_info_destroy(p_info);
+                RETM_IF(PACKAGE_MANAGER_ERROR_NONE != ret, "package_info_destroy() Fail(%d)", ret);
+
+                SAL_FREE(path);
+        }
+
+        SAL_FN_END;
+}
+
+//******************************************************************************
+//* Public interface definition
+//******************************************************************************
+
+/**
+ * @brief start observer using package manager
+ *
+ * @return      void.
+ */
+service_adaptor_error_e sal_observer_start()
+{
+       int ret = 0;
+       package_manager_h package = NULL;
+
+       package_manager_create(&package);
+
+       ret = package_manager_set_event_cb(package, _sal_package_event_cb, NULL);
+       RETVM_IF(PACKAGE_MANAGER_ERROR_NONE != ret, SERVICE_ADAPTOR_ERROR_SYSTEM, "package_manager_set_event_cb() Fail(%d)", ret);
+
+       return SERVICE_ADAPTOR_ERROR_NONE;
+}
diff --git a/server/sal_observer.h b/server/sal_observer.h
new file mode 100644 (file)
index 0000000..1f87a3e
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Service Adaptor
+ *
+ * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Yongjin Kim <youth.kim@samsung.com>
+ *          Jinhyeong Ahn <jinh.ahn@samsung.com>
+ *          Jiwon Kim <jiwon177.kim@samsung.com>
+ *
+ * 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 __TIZEN_CONVERGENCE_SAL_OBSERVER_H__
+#define __TIZEN_CONVERGENCE_SAL_OBSERVER_H__
+
+#include "service_adaptor_errors.h"
+
+service_adaptor_error_e sal_observer_start();
+
+#endif /* __TIZEN_CONVERGENCE_SAL_OBSERVER_H__ */
diff --git a/server/sal_storage.c b/server/sal_storage.c
new file mode 100644 (file)
index 0000000..cd7e901
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Service Adaptor
+ *
+ * Copyright (c) 2014 - 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 <glib.h>
+
+#include "sal_storage.h"
+#include "service_adaptor_internal.h"
+
+//******************************************************************************
+//* Global variables and defines
+//******************************************************************************
+
+//******************************************************************************
+//* Private interface
+//******************************************************************************
+
+//******************************************************************************
+//* Private interface definition
+//******************************************************************************
+
+//******************************************************************************
+//* Public interface definition
+//******************************************************************************
+
+storage_adaptor_h sal_storage_create_handle()
+{
+       storage_adaptor_h storage_adaptor = storage_adaptor_create();
+
+       return storage_adaptor;
+}
+
+storage_adaptor_listener_h sal_storage_register_listener(storage_adaptor_h storage)
+{
+       int ret = SERVICE_ADAPTOR_ERROR_NONE;
+
+       storage_adaptor_listener_h listener =
+                       (storage_adaptor_listener_h) g_malloc0(sizeof(storage_adaptor_listener_s));
+
+       ret = storage_adaptor_register_listener(storage, listener);
+
+       if (SERVICE_ADAPTOR_ERROR_NONE != ret)
+       {
+               SAL_FREE(listener);
+       }
+
+       return listener;
+}
diff --git a/server/sal_storage.h b/server/sal_storage.h
new file mode 100644 (file)
index 0000000..9ee3680
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Service Adaptor
+ *
+ * Copyright (c) 2014 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact: Yongjin Kim <youth.kim@samsung.com>
+ *          Jinhyeong Ahn <jinh.ahn@samsung.com>
+ *          Jiwon Kim <jiwon177.kim@samsung.com>
+ *
+ * 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 __TIZEN_CONVERGENCE_SAL_STORAGE_H__
+#define __TIZEN_CONVERGENCE_SAL_STORAGE_H__
+
+#include "storage_adaptor.h"
+
+storage_adaptor_h sal_storage_create_handle();
+storage_adaptor_listener_h sal_storage_register_listener(storage_adaptor_h storage);
+
+#endif /* __TIZEN_CONVERGENCE_SAL_STORAGE_H__ */
diff --git a/service-adaptor.manifest b/service-adaptor.manifest
new file mode 100644 (file)
index 0000000..ef546a3
--- /dev/null
@@ -0,0 +1,29 @@
+<manifest>
+       <define>
+               <domain name="service-adaptor" />
+               <provide>
+                       <label name="service-adaptor::svc"/>
+               </provide>
+               <permit>
+                       <smack permit="system::use_internet" type="w" />
+               </permit>
+               <request>
+                       <smack request="system::use_internet" type="rw"/>
+                       <smack request="system::media" type="rwxt"/>
+                       <smack request="sys-assert::core" type="rwx"/>
+                       <smack request="pkgmgr::info" type="rxw"/>
+                       <smack request="pkgmgr::db" type="rxwl"/>
+                       <smack request="pkgmgr::svc" type="rxw"/>
+                       <smack request="ail::db" type="rxwl"/>
+                       <smack request="system::vconf" type="rxw"/>
+                       <smack request="system::vconf_inhouse" type="rxw"/>
+                       <smack request="aul::launch" type="rxw"/>
+                       <smack request="aul::terminate" type="rxw"/>
+               </request>
+       </define>
+       <assign>
+       </assign>
+       <request>
+               <domain name="service-adaptor" />
+       </request>
+</manifest>
diff --git a/service-adaptor.pc.in b/service-adaptor.pc.in
new file mode 100644 (file)
index 0000000..73a9e12
--- /dev/null
@@ -0,0 +1,9 @@
+prefix=/usr
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+Name: service-adaptor library
+Description: service-adaptor library 1.0
+Version: $version
+Libs: -L${libdir} -lsal-common -lsal-client
+Cflags: -I${includedir}/service-adaptor
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644 (file)
index 0000000..437d198
--- /dev/null
@@ -0,0 +1,43 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(sal-test)
+
+SET(CMAKE_SKIP_BUILD_RPATH TRUE)
+
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+        SET(CMAKE_BUILD_TYPE "Debug")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+
+MESSAGE("")
+MESSAGE(">>> current directory: ${CMAKE_CURRENT_SOURCE_DIR}")
+MESSAGE(">>> Build type: ${CMAKE_BUILD_TYPE}")
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VISIBILITY} -fvisibility=hidden")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--gc-sections")
+
+SET(TEST-EXE "sal-test")
+SET(TEST-SRCS
+        ${CMAKE_SOURCE_DIR}/test/test.c
+)
+
+INCLUDE_DIRECTORIES(
+        ${CMAKE_SOURCE_DIR}/include
+)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(test_pkgs REQUIRED dlog glib-2.0)
+
+FOREACH(flag ${test_pkgs_CFLAGS})
+        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+#message(">>>[${TEST-EXE}] extra_cflags ${EXTRA_CFLAGS}")
+#message(">>>[${TEST-EXE}] test_pkgs_cflags ${test_pkgs_CFLAGS}")
+#message(">>>[${TEST-EXE}] result ${CMAKE_C_FLAGS}")
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
+
+ADD_EXECUTABLE(${TEST-EXE} ${TEST-SRCS})
+TARGET_LINK_LIBRARIES(${TEST-EXE} ${test_pkgs_LDFLAGS} sal-client)
+INSTALL(TARGETS ${TEST-EXE} DESTINATION bin)
diff --git a/test/test.c b/test/test.c
new file mode 100644 (file)
index 0000000..7fb1ab9
--- /dev/null
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+int main()
+{
+       return 0;
+}