Merge vine_manager/wrapper to cion library
authorSangyoon Jang <jeremy.jang@samsung.com>
Thu, 25 Feb 2021 07:45:07 +0000 (16:45 +0900)
committer장상윤/Tizen Platform Lab(SR)/Engineer/삼성전자 <jeremy.jang@samsung.com>
Wed, 3 Mar 2021 06:31:56 +0000 (15:31 +0900)
Change-Id: I9bb723dae8c69f9bb2bba0769569761e840db1de
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
57 files changed:
CMakeLists.txt
cion/CMakeLists.txt
cion/channel/broadcast_channel.cc
cion/channel/broadcast_channel.hh
cion/channel/client_channel.cc
cion/channel/client_channel.hh
cion/channel/client_channel_implementation.hh
cion/channel/control_info.hh
cion/channel/data_info.cc
cion/channel/data_info.hh
cion/channel/ievent_listener.hh
cion/channel/ievent_observer.hh
cion/channel/ievent_sender.hh
cion/channel/server_channel.cc
cion/channel/server_channel.hh
cion/channel/server_channel_implementation.hh
cion/common/data_payload.cc
cion/common/data_payload.hh
cion/common/file_payload.cc
cion/common/file_payload.hh
cion/common/util/factory_manager.cc
cion/common/util/id_generator.cc
cion/security/security_info.cc
cion/vine_manager/vine_listener.cc [new file with mode: 0644]
cion/vine_manager/vine_listener.hh [new file with mode: 0644]
cion/vine_manager/vine_listener_implementation.hh [new file with mode: 0644]
cion/vine_manager/vine_manager.cc [new file with mode: 0644]
cion/vine_manager/vine_manager.hh [new file with mode: 0644]
cion/vine_manager/vine_manager_implementation.hh [new file with mode: 0644]
cion/vine_manager/vine_sender.cc [new file with mode: 0644]
cion/vine_manager/vine_sender.hh [new file with mode: 0644]
cion/vine_manager/vine_sender_implementation.hh [new file with mode: 0644]
cion/vine_wrapper/vine.cc [new file with mode: 0644]
cion/vine_wrapper/vine.hh [new file with mode: 0644]
cion/vine_wrapper/vine_implementation.hh [new file with mode: 0644]
packaging/cion.spec
unittests/CMakeLists.txt
unittests/src/test-vine_data_path.cc
unittests/src/test-vine_security.cc
unittests/src/test-vine_service.cc
unittests/src/test-vine_session.cc
vine_manager/CMakeLists.txt [deleted file]
vine_manager/vine_listener.cc [deleted file]
vine_manager/vine_listener.hh [deleted file]
vine_manager/vine_listener_implementation.hh [deleted file]
vine_manager/vine_manager.cc [deleted file]
vine_manager/vine_manager.hh [deleted file]
vine_manager/vine_manager.pc.in [deleted file]
vine_manager/vine_manager_implementation.hh [deleted file]
vine_manager/vine_sender.cc [deleted file]
vine_manager/vine_sender.hh [deleted file]
vine_manager/vine_sender_implementation.hh [deleted file]
vine_wrapper/CMakeLists.txt [deleted file]
vine_wrapper/vine.cc [deleted file]
vine_wrapper/vine.hh [deleted file]
vine_wrapper/vine_implementation.hh [deleted file]
vine_wrapper/vine_wrapper.pc.in [deleted file]

index aa012fb1d0598328ce7e99dd0484da4300600688..e75c8d682199dce7948ccb47bb64567775665145 100644 (file)
@@ -40,8 +40,6 @@ PKG_CHECK_MODULES(VINE_DEPS REQUIRED vine)
 
 ADD_SUBDIRECTORY(cion)
 #ADD_SUBDIRECTORY(cion-service)
-ADD_SUBDIRECTORY(vine_wrapper)
-ADD_SUBDIRECTORY(vine_manager)
 
 IF(NOT DEFINED MINIMUM_BUILD)
 ENABLE_TESTING()
index c5167b8a6bbeb1e76d2c6ba6eefe54a65ffe5711..131c2b3febdbe9920e7c6b33e30231767ab00b75 100644 (file)
@@ -3,6 +3,8 @@ AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/common/util COMMON_SOURCES)
 AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/channel/ CHANNEL_SOURCES)
 AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/security SECURITY_SOURCES)
 AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/tizen-api/ SOURCES)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/vine_manager/ SOURCES)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/vine_wrapper/ SOURCES)
 ADD_LIBRARY(${TARGET_CION} SHARED ${SOURCES} ${COMMON_SOURCES} ${CHANNEL_SOURCES} ${SECURITY_SOURCES})
 
 TARGET_INCLUDE_DIRECTORIES(${TARGET_CION} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../)
@@ -17,6 +19,7 @@ APPLY_PKG_CONFIG(${TARGET_CION} PUBLIC
     PARCEL_DEPS
     PKGMGR_INFO_DEPS
     UUID_DEPS
+    VINE_DEPS
 )
 
 SET_TARGET_PROPERTIES(${TARGET_CION} PROPERTIES VERSION ${FULLVER})
index 2246306e398e400820b70a2dbcfcb2b030e0525e..6e63df3f8a0ad864ef3527570f3b847989e8704a 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include "broadcast_channel.hh"
+#include "cion/channel/broadcast_channel.hh"
 
 /**
  * BroadcastChannel implementation
index d1d93b8fcc850645c88bea62c9a0962198a89295..a39fafea6086a2050cb1bcf4ffb5a5ed9a65e008 100644 (file)
@@ -20,9 +20,9 @@
 #include <string>
 #include <vector>
 
-#include "ievent_observer.hh"
-#include "ievent_listener.hh"
-#include "ievent_sender.hh"
+#include "cion/channel/ievent_observer.hh"
+#include "cion/channel/ievent_listener.hh"
+#include "cion/channel/ievent_sender.hh"
 #include "cion/common/peer_info.hh"
 #include "cion/common/interface_payload.hh"
 
index 6dfd8755057787d4d3fa889e4c7a6a3cb1ad2c4f..b8493bce436b9de6d2e0d4c1f55c6f9f2948046f 100644 (file)
  * limitations under the License.
  */
 
+#include "cion/channel/client_channel.hh"
+
 #include <memory>
 
-#include "client_channel.hh"
-#include "client_channel_implementation.hh"
-#include "control_info.hh"
-#include "data_info.hh"
-#include "vine_manager/vine_manager.hh"
-#include "vine_manager/vine_sender.hh"
-#include "vine_manager/vine_listener.hh"
+#include "cion/channel/client_channel_implementation.hh"
+#include "cion/channel/control_info.hh"
+#include "cion/channel/data_info.hh"
 #include "cion/common/util/id_generator.hh"
+#include "cion/vine_manager/vine_manager.hh"
+#include "cion/vine_manager/vine_sender.hh"
+#include "cion/vine_manager/vine_listener.hh"
 
 /**
  * ClientChannel implementation
index 5dd76a0130bcea509e22d61464bc6344b10926a1..c9c5350a072588b4000f3d8b7702bfb06cfc4c19 100644 (file)
@@ -21,9 +21,9 @@
 #include <memory>
 #include <vector>
 
-#include "ievent_observer.hh"
-#include "ievent_listener.hh"
-#include "ievent_sender.hh"
+#include "cion/channel/ievent_observer.hh"
+#include "cion/channel/ievent_listener.hh"
+#include "cion/channel/ievent_sender.hh"
 #include "cion/security/security_info.hh"
 #include "cion/common/peer_info.hh"
 #include "cion/common/interface_payload.hh"
index 66de5d734e963e774a1e8a3149bd3c9721c63990..6b28026924dbf0e7d7460e05e3db628b0f207d38 100644 (file)
@@ -22,7 +22,7 @@
 #include <vector>
 #include <list>
 
-#include "client_channel.hh"
+#include "cion/channel/client_channel.hh"
 
 namespace cion {
 namespace channel {
index 03636a9bcb8f887593e62d5b93a1f79a85c89ffa..bcc3e952ac7201a2489d877f2a6ef06fb0e4508a 100644 (file)
@@ -20,7 +20,7 @@
 #include <vector>
 #include <string>
 
-#include "icontrol_info.hh"
+#include "cion/channel/icontrol_info.hh"
 
 namespace cion {
 namespace channel {
index 905a8cf5a142984997abadf18bfe2709d7397137..b025b9e87e9e9584b10538be8e7dbbc56a96f4f8 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include "data_info.hh"
+#include "cion/channel/data_info.hh"
 
 namespace cion {
 namespace channel {
index 6addb01036904e87ecb8a64f76c2599f159b16ce..885e00cd5becad676e2e0fcc49299396933c6cd0 100644 (file)
@@ -20,7 +20,7 @@
 #include <vector>
 #include <string>
 
-#include "idata_info.hh"
+#include "cion/channel/idata_info.hh"
 
 namespace cion {
 namespace channel {
index b66a16759de40aa8b5dda3020b0003bfe86019fd..86f0a36612716d5812458d08145a7789f2f5e176 100644 (file)
@@ -17,7 +17,7 @@
 #ifndef CION_CION_CHANNEL_EVENT_LISTENER_HH_
 #define CION_CION_CHANNEL_EVENT_LISTENER_HH_
 
-#include "ievent_observer.hh"
+#include "cion/channel/ievent_observer.hh"
 
 namespace cion {
 namespace channel {
index b54c922f79debcbcb4393f55afe89bf390039adf..b020e742b62c0636393d631c34f04f97aaa8ef28 100644 (file)
@@ -22,8 +22,8 @@
 #include <string>
 #include <vector>
 
-#include "iconnection_info.hh"
-#include "idata_info.hh"
+#include "cion/channel/iconnection_info.hh"
+#include "cion/channel/idata_info.hh"
 #include "cion/common/interface_payload.hh"
 
 namespace cion {
index 2f1d340b2c34ed09a1c4237f13ff5a4041d7bbe7..b167d6c81f35239b0d074dd14c8a7b0bd981fcc1 100644 (file)
@@ -21,8 +21,8 @@
 #include <vector>
 #include <memory>
 
-#include "idata_info.hh"
-#include "icontrol_info.hh"
+#include "cion/channel/idata_info.hh"
+#include "cion/channel/icontrol_info.hh"
 #include "cion/common/peer_info.hh"
 #include "cion/security/security_info.hh"
 
index b5850d487fd3b93af8105e26142285c953d67496..d3be83af19441ad871c174417cf618f3da4a237d 100644 (file)
 
 #include <memory>
 
-#include "server_channel.hh"
-#include "server_channel_implementation.hh"
-#include "control_info.hh"
+#include "cion/channel/server_channel.hh"
 
-#include "vine_manager/vine_manager.hh"
-#include "vine_manager/vine_sender.hh"
-#include "vine_manager/vine_listener.hh"
+#include "cion/channel/server_channel_implementation.hh"
+#include "cion/channel/control_info.hh"
 #include "cion/common/util/id_generator.hh"
+#include "cion/vine_manager/vine_manager.hh"
+#include "cion/vine_manager/vine_sender.hh"
+#include "cion/vine_manager/vine_listener.hh"
 
 /**
  * ServerChannel implementation
index 3c81dc7f219a3fece59d703bb0bb01c4d499bb5f..1e6760cfd672ca1d632a62661510bf7e8fd81e7e 100644 (file)
@@ -23,9 +23,9 @@
 #include <string>
 #include <vector>
 
-#include "ievent_observer.hh"
-#include "ievent_sender.hh"
-#include "ievent_listener.hh"
+#include "cion/channel/ievent_observer.hh"
+#include "cion/channel/ievent_sender.hh"
+#include "cion/channel/ievent_listener.hh"
 #include "cion/security/security_info.hh"
 #include "cion/common/peer_info.hh"
 #include "cion/common/interface_payload.hh"
index 8ec4114aa7cc080b89fe8fe8ee0e70ba4767f4dd..8fd24624b323878fa476d45346c9e7339f161e43 100644 (file)
@@ -22,7 +22,7 @@
 #include <vector>
 #include <list>
 
-#include "server_channel.hh"
+#include "cion/channel/server_channel.hh"
 
 namespace cion {
 namespace channel {
index affedeebc256608a5f02d72b71c4de95884d8199..5dac69c4129cd7b4da11eef2fc894784f9fa67cf 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include "data_payload.hh"
+#include "cion/common/data_payload.hh"
 
 #include <stdexcept>
 
index 95ac22b330c5c612485359a26a31cb511dfaa20f..43f931ded81bdd8519aa987bb71e25f893291539 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <vector>
 
-#include "interface_payload.hh"
+#include "cion/common/interface_payload.hh"
 
 namespace cion {
 
index 2a450bdb6fcde1d9ba63c569b28dc9b9f8334abe..2c98cba21abed2c991a5e3df5e7c1344483d59bc 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include "file_payload.hh"
+#include "cion/common/file_payload.hh"
 
 namespace cion {
 
index ce184f0986814d66021f6c4e43d165e73fe56368..a33ebac42e3cbaf129f401218a23cbedda8422a7 100644 (file)
@@ -20,7 +20,7 @@
 #include <vector>
 #include <string>
 
-#include "interface_payload.hh"
+#include "cion/common/interface_payload.hh"
 
 namespace cion {
 
index ebff8769901f69b36a0eba1bfbd8f878e0b13f57..c39a1747829cd5e474bfe41fc5bc5083c8f44590 100644 (file)
  * limitations under the License.
  */
 
-#include "factory_manager.hh"
-#include "../interface_payload.hh"
-#include "../data_payload.hh"
-#include "../file_payload.hh"
+#include "cion/common/util/factory_manager.hh"
+
+#include "cion/common/interface_payload.hh"
+#include "cion/common/data_payload.hh"
+#include "cion/common/file_payload.hh"
 
 namespace cion {
 
index 8f27b88e90c45baaf0c996a8062b4ad6ddb341ac..30eb3415c85d81886b1cdf9126553b9d5d1af8c4 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include "id_generator.hh"
+#include "cion/common/util/id_generator.hh"
 
 namespace cion {
 
index 6039ee3c84fd9b1f5a29e456f5ab127a5e5b41b1..3d48f9ff5e76a19c7c79ab56e0f31964c90fc6b2 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include "security_info.hh"
+#include "cion/security/security_info.hh"
 
 namespace cion {
 
diff --git a/cion/vine_manager/vine_listener.cc b/cion/vine_manager/vine_listener.cc
new file mode 100644 (file)
index 0000000..da0cbf6
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2020 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 <dlog.h>
+#include <unistd.h>
+#include <memory>
+
+#include "cion/vine_manager/vine_manager.hh"
+#include "cion/vine_manager/vine_listener.hh"
+#include "cion/vine_manager/vine_listener_implementation.hh"
+
+namespace cion {
+
+VineListener::VineListener()
+  : impl_(new Impl()) {
+}
+
+VineListener::~VineListener() {
+}
+
+VineListener::Impl::Impl() {
+}
+
+void VineListener::RegisterObserver(channel::IEventObserver* observer) {
+       VineManager::GetInst().RegisterObserver(observer);
+}
+
+void VineListener::UnregisterObserver(channel::IEventObserver* observer) {
+       VineManager::GetInst().UnregisterObserver(observer);
+}
+
+}   // namespace cion
diff --git a/cion/vine_manager/vine_listener.hh b/cion/vine_manager/vine_listener.hh
new file mode 100644 (file)
index 0000000..9f9a0c4
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2020 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 CION_VINE_MANAGER_VINE_LISTENER_HH_
+#define CION_VINE_MANAGER_VINE_LISTENER_HH_
+
+#include <memory>
+
+#include "cion/channel/ievent_observer.hh"
+#include "cion/channel/ievent_listener.hh"
+
+namespace cion {
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__((visibility("default")))
+#endif
+
+class EXPORT_API VineListener : public channel::IEventListener {
+
+ public:
+  VineListener();
+  virtual ~VineListener();
+  void RegisterObserver(channel::IEventObserver* observer) override;
+  void UnregisterObserver(channel::IEventObserver* observer) override;
+
+
+ private:
+  class Impl;
+  std::unique_ptr<Impl> impl_;
+};
+
+}   // namespace cion
+
+#endif  // CION_VINE_MANAGER_VINE_LISTENER_HH_
diff --git a/cion/vine_manager/vine_listener_implementation.hh b/cion/vine_manager/vine_listener_implementation.hh
new file mode 100644 (file)
index 0000000..62a4343
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2020 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 CION_API_VINE_LISTENER_IMPLEMENTATION_HH_
+#define CION_API_VINE_LISTENER_IMPLEMENTATION_HH_
+
+namespace cion {
+
+class VineListener::Impl {
+ public:
+  virtual ~Impl() = default;
+
+ private:
+  friend class VineListener;
+  Impl();
+
+
+ private:
+};
+
+}   // namespace cion
+
+#endif  // CION_API_VINE_LISTENER_IMPLEMENTATION_HH_
diff --git a/cion/vine_manager/vine_manager.cc b/cion/vine_manager/vine_manager.cc
new file mode 100644 (file)
index 0000000..cda676f
--- /dev/null
@@ -0,0 +1,279 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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 <dlog.h>
+#include <unistd.h>
+#include <vine.h>
+#include <glib-unix.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+
+#include <memory>
+#include <utility>
+
+#include "cion/vine_manager/vine_manager.hh"
+#include "cion/vine_manager/vine_manager_implementation.hh"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "VINE_MANAGER"
+
+#define VINE_TEST_TOPIC "CION_TOPIC"
+#define VINE_TEST_SERVICE "CION_TEST"
+#define VINE_TEST_SERVER_PORT 55555
+#define VINE_TEST_CLIENT_PORT 55556
+#define VINE_TEST_SERVICE_TYPE "_cion"
+
+namespace cion {
+
+VineManager& VineManager::GetInst() {
+  static VineManager w_inst;
+  int ret;
+
+  if (w_inst.impl_ == nullptr) {
+    ret = w_inst.Init();
+    if (ret != CION_ERROR_NONE)
+      throw ret;
+  }
+  return w_inst;
+}
+
+VineManager::VineManager() = default;
+VineManager::~VineManager() = default;
+VineManager::Impl::Impl() = default;
+
+VineManager::Impl::~Impl() {
+  vine_session_unset_discovered_cb(session_);
+  vine_deinitialize();
+}
+
+int VineManager::Init() {
+  std::unique_ptr<Impl> tmp_impl;
+
+  try {
+    tmp_impl = std::unique_ptr<VineManager::Impl>(new Impl());
+  } catch (const std::bad_alloc &ba) {
+    LOGE("Out of memory");
+    return -1;
+  }
+
+  impl_ = std::move(tmp_impl);
+  vine_initialize();
+  vine_session_create(&impl_->session_);
+  int fd;
+  vine_session_get_event_fd(impl_->session_, &fd);
+  g_unix_fd_add(fd, G_IO_IN, [] (int fd, GIOCondition condition,
+    gpointer user_data) -> int {
+      LOGE("@@@ gio in!!");
+      VineManager* ptr = (VineManager*)user_data;
+      vine_session_process_event(ptr->impl_->session_);
+      LOGE("@@@ process event done !!");
+      return G_SOURCE_CONTINUE;
+    }, this);
+
+  LOGI("VineManager init done");
+  return 0;
+}
+
+void VineManager::Impl::AddSenderInfo(std::string service_name,
+    int channel_id) {
+  for (auto& sender : sender_list_) {
+    if (service_name == sender.GetServiceName()
+        && channel_id == sender.GetChannelId()) {
+      LOGW("Already exist");
+      return;
+    }
+  }
+  SenderInfo info(service_name, channel_id);
+  sender_list_.push_back(info);
+}
+
+bool VineManager::Impl::ValidateSender(std::string service_name) {
+  for (auto& sender : sender_list_) {
+    if (service_name == sender.GetServiceName())
+      return true;
+  }
+  return false;
+}
+
+void VineManager::Discovery() {
+  vine_session_set_discovered_cb(impl_->session_,
+      [] (vine_session_h session, vine_service_h service,
+          vine_service_state_e state, void *user_data) -> void {
+        char* name;
+        int port;
+        vine_service_get_name(service, &name);
+        vine_service_get_port(service, &port);
+
+        LOGD("Available Service");
+        LOGD("Service Name: %s", name);
+        LOGD("Port: %d", port);
+
+        VineManager* ptr = (VineManager*)user_data;
+        if (ptr == nullptr) {
+          LOGE("null vine manager");
+          return;
+        }
+
+        if (state == VINE_SERVICE_AVAILABLE) {
+            LOGW("A service is discovered\n");
+  /*
+
+
+
+            vine_dp_h dp;
+            vine_dp_create(session, VINE_DP_TYPE_PUBSUB, &dp);
+            vine_dp_set_port(dp, VINE_TEST_CLIENT_PORT);
+            vine_dp_set_topic(dp, VINE_TEST_TOPIC);
+            vine_dp_open(dp,
+                [](vine_dp_h dp, vine_error_e result, void *user_data) {
+                  LOGW("@@@@@@@ open");
+                  std::string msg = "test string";
+                  vine_dp_send(dp, (unsigned char*)msg.c_str(), msg.size());
+                }, nullptr);
+*/
+            vine_session_set_ip_resolved_cb(ptr->impl_->session_, service,
+                [] (vine_session_h session, vine_service_h service,
+                    const char *ip, vine_address_family_e address_family,
+                    void *user_data) -> void {
+                      LOGW("IP address: %s\n", ip);
+                      vine_dp_h dp;
+                      vine_dp_create(session, VINE_DP_TYPE_CLIENT, &dp);
+                      vine_dp_set_remote_ip(dp, VINE_ADDRESS_FAMILY_IPV4, ip);
+                      vine_dp_set_security(dp, nullptr);
+                      vine_dp_set_port(dp, VINE_TEST_SERVER_PORT);
+                      vine_dp_open(dp,
+                        [](vine_dp_h dp, vine_error_e result, void *user_data)
+                         -> void {
+                          LOGW("@@@@@@@ open");
+                          vine_dp_send(dp, (unsigned char*)"TEST", 5);
+                        }, nullptr);
+              }, nullptr);
+        }
+      }, this);
+  vine_session_start_discovery(impl_->session_,
+      VINE_TEST_SERVICE_TYPE, nullptr);
+}
+
+void VineManager::RegisterSender(std::string service_name, int channel_id) {
+  impl_->AddSenderInfo(service_name, channel_id);
+}
+
+void VineManager::UnregisterSender(int channel_id) {
+}
+
+void VineManager::RegisterObserver(channel::IEventObserver* observer) {
+  vine_session_set_registered_cb(impl_->session_, [] (
+      vine_session_h session, const char* service_name,
+      vine_error_e error, void* user_data) -> void {
+      LOGI("session registered : %s", service_name);
+
+      /*vine_dp_h dp;
+      vine_dp_create(session, VINE_DP_TYPE_PUBSUB, &dp);
+      vine_dp_set_address_family(g_pubsub_dp, VINE_ADDRESS_FAMILY_IPV4);
+      vine_dp_set_port(dp, VINE_TEST_SERVER_PORT);
+      vine_dp_set_topic(dp, VINE_TEST_TOPIC);
+      vine_dp_open(dp,
+          [](vine_dp_h dp, vine_error_e result, void *user_data) {
+
+            vine_dp_set_received_cb(dp, [](vine_dp_h dp, size_t received_len,
+                void *user_data) {
+                  unsigned char buf[20] = {0, };
+                  size_t bytes = 0;
+                  LOGW("[RECV_CB] %p received %zd bytes.", dp, received_len);
+                  printf("[RECV_CB] %p received %zd bytes.\n", dp, received_len);
+                  do {
+                    vine_dp_recv(dp, buf, 20, &bytes);
+                    for (int i = 0; i < (int)received_len; i++)
+                      printf("%c", buf[i]);
+                    printf("\n");
+                    received_len -= bytes;
+                  } while (received_len > 0);
+            }, nullptr);
+
+            LOGW("@@@@@@@ open");
+            //std::string msg = "test string";
+            //vine_dp_send(dp, (unsigned char*)msg.c_str(), msg.size());
+          }, nullptr);*/
+
+
+      vine_dp_h dp;
+      vine_dp_create(session, VINE_DP_TYPE_SERVER, &dp);
+      vine_dp_set_port(dp, VINE_TEST_SERVER_PORT);
+      vine_dp_open(dp,
+          [] (vine_dp_h dp, vine_error_e result, void *user_data) -> void {
+            LOGW("Opened !!!");
+            vine_dp_set_received_cb(dp, [](vine_dp_h dp, size_t received_len,
+                void *user_data) -> void {
+                  unsigned char buf[20] = {0, };
+                  size_t bytes = 0;
+                  LOGW("[RECV_CB] %p received %zd bytes.", dp, received_len);
+                  printf("[RECV_CB] %p received %zd bytes.\n", dp, received_len);
+                  do {
+                    vine_dp_recv(dp, buf, 20, &bytes);
+                    for (int i = 0; i < (int)received_len; i++)
+                      printf("%c", buf[i]);
+                    printf("\n");
+                    received_len -= bytes;
+                  } while (received_len > 0);
+            }, nullptr);
+
+          }, nullptr);
+      vine_dp_set_accepted_cb(dp, [] (vine_dp_h dp, void *user_data) -> void {
+      }, nullptr);
+
+    }, nullptr);
+
+  vine_service_h service;
+  vine_service_create(&service);
+  vine_service_set_type(service, VINE_TEST_SERVICE_TYPE);
+  std::string channel_id = "test";
+
+  vine_service_set_name(service, VINE_TEST_SERVICE);
+  impl_->port_ = VINE_TEST_SERVER_PORT;
+  vine_service_set_port(service, impl_->port_);
+  vine_service_add_attribute(service, "id", VINE_TEST_SERVICE);
+  vine_service_add_attribute(service,
+      "channel", channel_id.c_str());
+  impl_->service_ = service;
+
+  vine_session_register(impl_->session_, service, nullptr);
+  LOGI("session register !! : %s", VINE_TEST_SERVICE);
+}
+
+void VineManager::UnregisterObserver(channel::IEventObserver* observer) {
+}
+
+void VineManager::SendDataAsync(const std::vector<char>& serialized_payload,
+    std::shared_ptr<channel::IDataInfo> info, int channel_id,
+    std::shared_ptr<PeerInfo> peer_info) {
+}
+
+std::vector<char> VineManager::SendData(
+    const std::vector<char>& serialized_payload,
+    std::shared_ptr<channel::IDataInfo> info, int channel_id,
+    std::string peer_uuid, int timeout) {
+  return {};
+}
+
+void VineManager::OperateChannel(int channel_id,
+    std::shared_ptr<channel::IControlInfo> info,
+    std::shared_ptr<PeerInfo> peer_info) {
+}
+
+}  // namespace cion
\ No newline at end of file
diff --git a/cion/vine_manager/vine_manager.hh b/cion/vine_manager/vine_manager.hh
new file mode 100644 (file)
index 0000000..a7d4eb6
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2020 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 CION_VINE_MANAGER_VINE_MANAGER_HH_
+#define CION_VINE_MANAGER_VINE_MANAGER_HH_
+
+#include <vector>
+#include <string>
+#include <memory>
+
+#include "cion/tizen-api/cion_error.h"
+#include "cion/channel/ievent_observer.hh"
+#include "cion/common/data_payload.hh"
+#include "cion/common/peer_info.hh"
+#include "cion/channel/idata_info.hh"
+#include "cion/channel/icontrol_info.hh"
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__((visibility("default")))
+#endif
+
+namespace cion {
+
+class EXPORT_API VineManager {
+ public:
+  static VineManager& GetInst();
+  void RegisterSender(std::string service_name, int channel_id);
+  void UnregisterSender(int channel_id);
+  void RegisterObserver(channel::IEventObserver* observer);
+  void UnregisterObserver(channel::IEventObserver* observer);
+  void SendDataAsync(const std::vector<char>& serialized_payload,
+      std::shared_ptr<channel::IDataInfo> info, int channel_id,
+      std::shared_ptr<PeerInfo> peer_info);
+  std::vector<char> SendData(const std::vector<char>& serialized_payload,
+      std::shared_ptr<channel::IDataInfo> info, int channel_id,
+      std::string peer_uuid, int timeout);
+  void OperateChannel(int channel_id,
+      std::shared_ptr<channel::IControlInfo> info,
+      std::shared_ptr<PeerInfo> peer_info);
+  void Discovery();
+  VineManager();
+
+ private:
+  virtual ~VineManager();
+  int Init();
+
+ private:
+  class Impl;
+  std::unique_ptr<Impl> impl_;
+};
+
+}   // namespace cion
+
+#endif  // CION_VINE_MANAGER_VINE_MANAGER_HH_
diff --git a/cion/vine_manager/vine_manager_implementation.hh b/cion/vine_manager/vine_manager_implementation.hh
new file mode 100644 (file)
index 0000000..ce9901b
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2020 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 CION_API_VINE_MANAGER_IMPLEMENTATION_HH_
+#define CION_API_VINE_MANAGER_IMPLEMENTATION_HH_
+
+#include<string>
+#include<list>
+#include<dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "VINE_MANAGER"
+
+
+namespace cion {
+
+class SenderInfo {
+ public:
+  SenderInfo(std::string service_name, int channel_id) {
+    service_name_ = service_name;
+    channel_id_ = channel_id;
+  }
+
+  std::string GetServiceName() {
+    return  service_name_;
+  }
+
+  int GetChannelId() {
+    return channel_id_;
+  }
+
+ private:
+  std::string service_name_;
+  int channel_id_;
+};
+
+class VineManager::Impl {
+ public:
+  virtual ~Impl();
+  void AddSenderInfo(std::string service_name, int channel_id);
+  bool ValidateSender(std::string service_name);
+
+ private:
+  friend class VineManager;
+  Impl();
+
+ private:
+  vine_session_h session_;
+  vine_service_h service_;
+  std::list<SenderInfo> sender_list_;
+  int port_;
+};
+
+}   // namespace cion
+
+#endif  // CION_API_VINE_MANAGER_IMPLEMENTATION_HH_
diff --git a/cion/vine_manager/vine_sender.cc b/cion/vine_manager/vine_sender.cc
new file mode 100644 (file)
index 0000000..91f7685
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2020 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 <dlog.h>
+#include <unistd.h>
+#include <memory>
+
+#include "vine_manager.hh"
+
+#include "cion/vine_manager/vine_sender.hh"
+#include "cion/vine_manager/vine_sender_implementation.hh"
+
+namespace cion {
+
+VineSender::VineSender(std::string service_name, int channel_id)
+  : impl_(new Impl(service_name, channel_id)) {
+}
+
+VineSender::~VineSender() {
+
+}
+
+VineSender::Impl::Impl(std::string service_name, int channel_id)
+    : service_name_(service_name), channel_id_(channel_id) {
+  port_ = 0;
+  VineManager::GetInst().RegisterSender(service_name, channel_id);
+}
+
+VineSender::Impl::~Impl() {
+  VineManager::GetInst().UnregisterSender(channel_id_);
+}
+
+void VineSender::Impl::OperateChannel(
+  std::shared_ptr<channel::IControlInfo> info,
+  std::shared_ptr<PeerInfo> peer_info) {
+  VineManager::GetInst().OperateChannel(channel_id_, info, peer_info);
+}
+
+void VineSender::SendDataAsync(const std::vector<char>& serialized_payload,
+    std::shared_ptr<channel::IDataInfo> info,
+    std::shared_ptr<PeerInfo> peer_info) {
+}
+
+std::vector<char> VineSender::SendData(
+    const std::vector<char>& serialized_payload,
+    std::shared_ptr<channel::IDataInfo> info,
+    std::shared_ptr<PeerInfo> peer_info, int timeout) {
+  return {};
+}
+
+void VineSender::OperateChannel(std::shared_ptr<channel::IControlInfo> info,
+    std::shared_ptr<PeerInfo> peer_info) {
+  impl_->OperateChannel(info, peer_info);
+}
+
+void VineSender::SetSecurity(SecurityInfo sec) {
+}
+
+}   // namespace cion
diff --git a/cion/vine_manager/vine_sender.hh b/cion/vine_manager/vine_sender.hh
new file mode 100644 (file)
index 0000000..c08bc94
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2021 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 CION_VINE_MANAGER_VINE_SENDER_HH_
+#define CION_VINE_MANAGER_VINE_SENDER_HH_
+
+#include <string>
+#include <vector>
+#include <memory>
+
+#include "cion/common/data_payload.hh"
+#include "cion/common/peer_info.hh"
+#include "cion/channel/idata_info.hh"
+#include "cion/channel/icontrol_info.hh"
+#include "cion/channel/ievent_sender.hh"
+#include "cion/security/security_info.hh"
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__((visibility("default")))
+#endif
+
+namespace cion {
+
+class EXPORT_API VineSender : public channel::IEventSender {
+ public:
+  VineSender(std::string service_name, int channel_id);
+  virtual ~VineSender();
+
+ protected:
+  void SendDataAsync(const std::vector<char>& serialized_payload,
+      std::shared_ptr<channel::IDataInfo> info,
+      std::shared_ptr<PeerInfo> peer_info) override;
+  std::vector<char> SendData(const std::vector<char>& serialized_payload,
+      std::shared_ptr<channel::IDataInfo> info,
+      std::shared_ptr<PeerInfo> peer_info, int timeout) override;
+  void OperateChannel(std::shared_ptr<channel::IControlInfo> info,
+      std::shared_ptr<PeerInfo> peer_info) override;
+  void SetSecurity(SecurityInfo sec) override;
+
+ private:
+  class Impl;
+  std::unique_ptr<Impl> impl_;
+};
+
+}   // namespace cion
+
+#endif  // CION_VINE_MANAGER_VINE_SENDER_HH_
diff --git a/cion/vine_manager/vine_sender_implementation.hh b/cion/vine_manager/vine_sender_implementation.hh
new file mode 100644 (file)
index 0000000..8aabe5f
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2020 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 CION_API_VINE_SENDER_IMPLEMENTATION_HH_
+#define CION_API_VINE_SENDER_IMPLEMENTATION_HH_
+
+#include <memory>
+
+#include "cion/common/peer_info.hh"
+#include "cion/channel/idata_info.hh"
+#include "cion/channel/icontrol_info.hh"
+#include "cion/security/security_info.hh"
+
+namespace cion {
+
+class VineSender::Impl {
+ public:
+  virtual ~Impl();
+
+ private:
+  friend class VineSender;
+
+  explicit Impl(std::string service_name, int channel_id);
+  void OperateChannel(std::shared_ptr<channel::IControlInfo> info,
+      std::shared_ptr<PeerInfo> peer_info);
+
+ private:
+  std::string service_name_;
+  int channel_id_;
+  int port_;
+};
+
+}   // namespace cion
+
+#endif  // CION_API_VINE_SENDER_IMPLEMENTATION_HH_
diff --git a/cion/vine_wrapper/vine.cc b/cion/vine_wrapper/vine.cc
new file mode 100644 (file)
index 0000000..76d97b1
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * 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 <unistd.h>
+
+#include "cion/tizen-api/cion_error.h"
+#include "cion/vine_wrapper/vine.hh"
+#include "cion/vine_wrapper/vine_implementation.hh"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "VINE_WRAPPER"
+
+using namespace std;
+namespace cion {
+
+Vine& Vine::GetInst() {
+  static Vine w_inst;
+  int ret;
+
+  if (w_inst.impl_ == nullptr) {
+    ret = w_inst.Init();
+    if (ret != CION_ERROR_NONE)
+      throw ret;
+  }
+  return w_inst;
+}
+
+Vine::Vine() = default;
+Vine::~Vine() = default;
+Vine::Impl::Impl() = default;
+
+Vine::Impl::~Impl() {
+  vine_deinitialize();
+}
+
+int Vine::Init() {
+  std::unique_ptr<Impl> tmp_impl;
+
+  try {
+    tmp_impl = std::unique_ptr<Vine::Impl>(new Impl());
+  } catch (const std::bad_alloc &ba) {
+    LOGE("Out of memory");
+    return -1;
+  }
+
+  vine_initialize();
+
+  impl_ = std::move(tmp_impl);
+  return 0;
+}
+
+shared_ptr<Vine::VineService> Vine::CreateVineService() {
+  vine_service_h service = nullptr;
+  vine_service_create(&service);
+
+  return make_shared<Vine::VineService>(service);
+}
+
+shared_ptr<Vine::VineService> Vine::CloneVineService(shared_ptr<Vine::VineService> service) {
+  vine_service_h cloned = nullptr;
+  vine_service_clone(static_cast<vine_service_h>(service->GetService()), &cloned);
+
+  return make_shared<Vine::VineService>(cloned);
+}
+
+shared_ptr<Vine::VineSession> Vine::CreateVineSession() {
+  vine_session_h session = nullptr;
+  vine_session_create(&session);
+
+  return make_shared<Vine::VineSession>(session);
+}
+
+shared_ptr<Vine::VineSecurity> Vine::CreateVineSecurity() {
+  vine_security_h security = nullptr;
+  vine_security_create(&security);
+
+  return make_shared<Vine::VineSecurity>(security);
+}
+
+shared_ptr<Vine::VineDataPath> Vine::CreateVineDataPath(shared_ptr<Vine::VineSession> session,
+    Vine::VineDataPath::DataPathType type) {
+  vine_dp_h data_path = nullptr;
+  vine_dp_create(static_cast<vine_session_h>(session->GetSession()),
+      static_cast<vine_dp_type_e>(type), &data_path);
+
+  return make_shared<Vine::VineDataPath>(data_path);
+}
+
+}  // namespace cion
diff --git a/cion/vine_wrapper/vine.hh b/cion/vine_wrapper/vine.hh
new file mode 100644 (file)
index 0000000..dc87494
--- /dev/null
@@ -0,0 +1,665 @@
+/*
+ * Copyright (c) 2021 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 CION_API_VINE_HH_
+#define CION_API_VINE_HH_
+
+#include <memory>
+#include <string>
+#include <unistd.h>
+#include <map>
+#include <functional>
+
+#include <dlog.h>
+#include <vine.h>
+
+#include <stdio.h>
+
+using namespace std;
+
+namespace cion {
+
+class Vine {
+ public:
+  class VineService {
+   public:
+    VineService(vine_service_h service) : service_(service) {
+    }
+
+    ~VineService() {
+      vine_service_destroy(service_);
+    }
+
+    typedef void* vine_service;
+
+    enum AddressFamily {
+      IPV4 = VINE_ADDRESS_FAMILY_IPV4,
+      IPV6 = VINE_ADDRESS_FAMILY_IPV6
+    };
+
+    void SetType(string service_type) {
+      int ret;
+      ret = vine_service_set_type(service_, service_type.c_str());
+
+      LOGD("Service SetType : %d", ret);
+    }
+
+    string GetType() {
+      char *type;
+      int ret;
+
+      ret = vine_service_get_type(service_, &type);
+      LOGD("Service GetType : %d", ret);
+
+      return string(type);
+    }
+
+    void SetName(string service_name) {
+      int ret;
+      ret = vine_service_set_name(service_, service_name.c_str());
+
+      LOGD("Service SetName : %d", ret);
+    }
+
+    string GetName() {
+      char *name;
+      int ret;
+
+      ret = vine_service_get_name(service_, &name);
+
+      LOGD("Service GetName : %d", ret);
+      return string(name);
+    }
+
+    void AddAttribute(string key, string value) {
+      int ret;
+      ret = vine_service_add_attribute(service_, key.c_str(), value.c_str());
+
+      LOGD("Service AddAttribute : %d", ret);
+    }
+
+    void RemoveAttribute(string key) {
+      int ret;
+      ret = vine_service_remove_attribute(service_, key.c_str());
+
+      LOGD("Service RemoveAttribute : %d", ret);
+    }
+
+    map<string, string> GetAttribute() {
+      int ret;
+      ret = vine_service_foreach_attribute(service_, VineServiceAttrCb, this);
+
+      LOGD("Service GetAttribute : %d", ret);
+
+      return attrs;
+    }
+
+    void SetPort(int port) {
+      int ret;
+      ret = vine_service_set_port(service_, port);
+
+      LOGD("Service SetPort : %d", ret);
+    }
+
+    int GetPort() {
+      int port;
+      int ret;
+
+      ret = vine_service_get_port(service_, &port);
+
+      LOGD("Service GetPort : %d", ret);
+
+      return port;
+    }
+
+    vine_service GetService() {
+      return service_;
+    }
+
+   private:
+    void SetAttr(string key, string value) {
+      attrs[key] = value;
+    }
+
+    static bool VineServiceAttrCb(const char *key, const char* value, void* user_data) {
+      VineService* service = static_cast<VineService*>(user_data);
+
+      service->SetAttr(string(key), string(value));
+
+      return true;
+    }
+
+   private:
+    vine_service service_ = nullptr;
+    map<string, string> attrs;
+  };
+
+  class VineSecurity {
+   public:
+    VineSecurity(vine_security_h security) : security_(security) {
+    }
+
+    ~VineSecurity() {
+      vine_security_destroy(security_);
+    }
+
+    typedef void* vine_security;
+
+    enum SecurityType {
+      SECURITY_TYPE_NONE = VINE_SECURITY_TYPE_NONE,
+      SECURITY_TYPE_TLS = VINE_SECURITY_TYPE_TLS,
+      SECURITY_TYPE_PSK_OVER_TLS = VINE_SECURITY_TYPE_PSK_OVER_TLS
+    };
+
+    enum TlsVersion {
+      TLS_VERSION_DEFAULT = VINE_SECURITY_TLS_VERSION_DEFAULT,
+      TLS_VERSION_1_0 = VINE_SECURITY_TLS_VERSION_1_0,
+      TLS_VERSION_1_1 = VINE_SECURITY_TLS_VERSION_1_1,
+      TLS_VERSION_1_2 = VINE_SECURITY_TLS_VERSION_1_2,
+      TLS_VERSION_1_3 = VINE_SECURITY_TLS_VERSION_1_3
+    };
+
+    enum VerificationFlag {
+      VERIFICATION_FLAG_DEFAAULT = VINE_SECURITY_VERIFICATION_FLAG_DEFAULT,
+      VERIFICATION_FLAG_ALLOW_SELF_SIGNED = VINE_SECURITY_VERIFICATION_FLAG_ALLOW_SELF_SIGNED,
+      VERIFICATION_FLAG_SKIP_HOST_NAME_CHECK = VINE_SECURITY_VERIFICATION_FLAG_SKIP_HOST_NAME_CHECK
+    };
+
+    void SetType(SecurityType type) {
+      int ret;
+      ret = vine_security_set_type(security_, static_cast<vine_security_type_e>(type));
+
+      LOGD("Security SetType : %d", ret);
+    }
+
+    SecurityType GetType() {
+      vine_security_type_e type;
+      int ret;
+
+      ret = vine_security_get_type(security_, &type);
+
+      LOGD("Security GetType : %d", ret);
+
+      return static_cast<SecurityType>(type);
+    }
+
+    void SetTlsVersion(TlsVersion version) {
+      int ret;
+      ret = vine_security_set_tls_version(security_, static_cast<vine_security_tls_version_e>(version));
+
+      LOGD("Security SetTlsVersion : %d", ret);
+    }
+
+    TlsVersion GetTlsVersion() {
+      vine_security_tls_version_e version;
+      int ret;
+
+      ret = vine_security_get_tls_version(security_, &version);
+
+      LOGD("Security GetTlsVersion : %d", ret);
+
+      return static_cast<TlsVersion>(version);
+    }
+
+    void SetVerificationFlags(int flags) {
+      int ret;
+      ret = vine_security_set_verification_flags(security_, flags);
+
+      LOGD("Security SetVerificationFlags : %d", ret);
+    }
+
+    int GetVerificationFlags() {
+      int flags;
+      int ret;
+
+      ret = vine_security_get_verification_flags(security_, &flags);
+
+      LOGD("Security GetVerificationFlags : %d", ret);
+
+      return flags;
+    }
+
+    void SetCaPath(string ca_path) {
+      int ret;
+      ret = vine_security_set_ca_path(security_, ca_path.c_str());
+
+      LOGD("Security SetCaPath : %d", ret);
+    }
+
+    string GetCaPath() {
+      char* ca_path;
+      int ret;
+
+      ret = vine_security_get_ca_path(security_, &ca_path);
+
+      LOGD("Security GetCaPath : %d", ret);
+
+      return string(ca_path);
+    }
+
+    void SetCertPath(string cert_path) {
+      int ret;
+      ret = vine_security_set_cert_path(security_, cert_path.c_str());
+
+      LOGD("Security SetCertPath : %d", ret);
+    }
+
+    string GetCertPath() {
+      char* cert_path;
+      int ret;
+
+      ret = vine_security_get_cert_path(security_, &cert_path);
+
+      LOGD("Security GetCertPath : %d", ret);
+
+      return string(cert_path);
+    }
+
+    void SetPrivateKey(string key_path) {
+      int ret;
+      ret = vine_security_set_private_key(security_, key_path.c_str());
+
+      LOGD("Security SetPrivateKey : %d", ret);
+    }
+
+    string GetPrivateKey() {
+      char* key_path;
+      int ret;
+
+      ret = vine_security_get_private_key(security_, &key_path);
+
+      LOGD("Security GetPrivateKey : %d", ret);
+
+      return string(key_path);
+    }
+
+    void SetPresharedKey(string key) {
+      int ret;
+      ret = vine_security_set_psk(security_, key.c_str());
+
+      LOGD("Security SetPresharedKey : %d", ret);
+    }
+
+    string GetPresharedKey() {
+      char* key;
+      int ret;
+
+      ret = vine_security_get_psk(security_, &key);
+
+      LOGD("Security GetPresharedKey : %d", ret);
+
+      return string(key);
+    }
+
+    vine_security GetSecurity() {
+      return security_;
+    }
+
+   private:
+    vine_security security_ = nullptr;
+
+  };
+
+  class VineSession {
+   public:
+    VineSession(vine_session_h session) : session_(session) {
+    }
+
+    ~VineSession() {
+      vine_session_destroy(session_);
+    }
+
+    typedef void* vine_session;
+
+    int GetEventFd() {
+      int fd;
+      int ret;
+
+      ret = vine_session_get_event_fd(session_, &fd);
+
+      LOGD("Session GetEventFd : %d", ret);
+
+      return fd;
+    }
+
+    void ProcessEvent() {
+      int ret;
+
+      ret = vine_session_process_event(session_);
+
+      LOGD("Session ProcessEvent : %d", ret);
+    }
+
+    void SetRegisteredCallback() {
+      int ret;
+
+      ret = vine_session_set_registered_cb(session_, RegisteredCallback, nullptr);
+
+      LOGD("Session ProcessEvent : %d", ret);
+    }
+
+    void UnsetRegisterCallback() {
+      int ret;
+
+      ret = vine_session_unset_registered_cb(session_);
+
+      LOGD("Session UnsetRegisterCallback : %d", ret);
+    }
+
+
+    void SetDiscoveredCallback() {
+      int ret;
+
+      ret = vine_session_set_discovered_cb(session_, DiscoveredCallback, nullptr);
+
+      LOGD("Session SetDiscoveredCallback : %d", ret);
+    }
+
+    void UnsetDiscoveredCallback() {
+      int ret;
+
+      ret = vine_session_unset_discovered_cb(session_);
+
+      LOGD("Session UnsetDiscoveredCallback : %d", ret);
+    }
+
+    enum DiscoveryMethod {
+      DISCOVERY_METHOD_DNS_SD = VINE_DISCOVERY_METHOD_DNS_SD
+    };
+
+    void SetDiscoveryMethod(DiscoveryMethod method) {
+      int ret;
+
+      ret = vine_session_set_discovery_method(session_,
+              static_cast<vine_discovery_method_e>(method));
+
+      LOGD("Session SetDiscoveryMethod : %d", ret);
+    }
+
+    void RegisterService(shared_ptr<VineService> service, std::string iface_name) {
+      int ret;
+
+      ret = vine_session_register(session_, static_cast<vine_service_h>(service->GetService()), iface_name.c_str());
+
+      LOGD("Session RegisterService : %d", ret);
+    }
+
+    void UnregisterService() {
+      int ret;
+
+      ret = vine_session_unregister(session_);
+
+      LOGD("Session UnregisterService : %d", ret);
+    }
+
+    void StartDiscovery(string service_type, string iface_name) {
+      int ret;
+
+      ret = vine_session_start_discovery(session_, service_type.c_str(),
+              iface_name.c_str());
+
+      LOGD("Session StartDiscovery : %d", ret);
+    }
+
+    void StopDiscovery() {
+      int ret;
+
+      ret = vine_session_stop_discovery(session_);
+
+      LOGD("Session StopDiscovery : %d", ret);
+    }
+
+    void SetIpResolvedCallback(shared_ptr<VineService> service) {
+      int ret;
+
+      ret = vine_session_set_ip_resolved_cb(session_, static_cast<vine_service_h>(service->GetService()), IpResolvedCallback, nullptr);
+
+      LOGD("Session SetIpResolvedCallback : %d", ret);
+    }
+
+    void UnsetIpResolvedCallback(shared_ptr<VineService> service) {
+      int ret;
+
+      ret = vine_session_unset_ip_resolved_cb(session_, static_cast<vine_service_h>(service->GetService()));
+
+      LOGD("Session UnsetIpResolvedCallback : %d", ret);
+    }
+
+    vine_session GetSession() {
+      return session_;
+    }
+
+   private:
+    static void RegisteredCallback(vine_session_h session,
+      const char *service_name, vine_error_e error, void *user_data) {
+      printf("service registered \n");
+    }
+
+    // discovered_service can not be set data
+    static void DiscoveredCallback(vine_session_h session,
+      vine_service_h discovered_service, vine_service_state_e state, void *user_data) {
+      printf("service discovered \n");
+    }
+
+    static void IpResolvedCallback(vine_session_h session, vine_service_h service,
+           const char *ip, vine_address_family_e address_family, void *user_data) {
+      printf("ip resolved\n");
+    }
+
+   private:
+    vine_session session_ = nullptr;
+
+  };
+
+  class VineDataPath {
+   public:
+    VineDataPath(vine_dp_h dp) : dp_(dp) {
+    }
+
+    ~VineDataPath() {
+      vine_dp_destroy(dp_);
+    }
+
+    typedef void* vine_data_path;
+
+    enum DataPathType {
+      DP_TYPE_SERVER = VINE_DP_TYPE_SERVER,
+      DP_TYPE_CLIENT = VINE_DP_TYPE_CLIENT,
+      DP_TYPE_PUBSUB = VINE_DP_TYPE_PUBSUB,
+      DP_TYPE_UNKNOWN = VINE_DP_TYPE_UNKNOWN
+    };
+
+    void SetIfaceName(std::string name){
+      int ret;
+
+      ret = vine_dp_set_iface_name(dp_, name.c_str());
+
+      LOGD("DataPath SetIfaceName : %d", ret);
+    }
+
+    // DP_TYPE_SERVER || DP_TYPE_PUBSUB possible
+    void SetAddressFamily(VineService::AddressFamily addr_family) {
+      int ret;
+
+      ret = vine_dp_set_address_family(dp_,
+              static_cast<vine_address_family_e>(addr_family));
+
+      LOGD("DataPath SetAddressFamily : %d", ret);
+    }
+
+    // DP_TYPE_CLIENT possible
+    void SetRemoteIp(VineService::AddressFamily addr_family, std::string ip) {
+      int ret;
+
+      ret = vine_dp_set_remote_ip(dp_,
+              static_cast<vine_address_family_e>(addr_family), ip.c_str());
+
+      LOGD("DataPath SetRemoteIp : %d", ret);
+    }
+
+    void SetPort(int port) {
+      int ret;
+
+      ret = vine_dp_set_port(dp_, port);
+
+      LOGD("DataPath SetPort : %d", ret);
+    }
+
+    int GetPort() {
+      int port;
+      int ret;
+
+      ret = vine_dp_get_port(dp_, &port);
+
+      LOGD("DataPath GetPort : %d", ret);
+
+      return port;
+    }
+
+    // DP_TYPE_PUBSUB possible
+    void SetTopic(std::string topic) {
+      int ret;
+
+      ret = vine_dp_set_topic(dp_, topic.c_str());
+
+      LOGD("DataPath SetTopic : %d", ret);
+    }
+
+    void SetSecurity(shared_ptr<VineSecurity> security) {
+      int ret;
+
+      ret = vine_dp_set_security(dp_, static_cast<vine_security_h>(security->GetSecurity()));
+
+      LOGD("DataPath SetSecurity : %d", ret);
+    }
+
+    // DP_TYPE_SERVER only
+    void SetAcceptedCallback() {
+      int ret;
+
+      ret = vine_dp_set_accepted_cb(dp_, DataPathAcceptedCallback, nullptr);
+
+      LOGD("DataPath SetAcceptedCallback : %d", ret);
+    }
+
+    // DP_TYPE_SERVER only
+    void UnsetAcceptedCallback() {
+      int ret;
+
+      ret = vine_dp_unset_accepted_cb(dp_);
+
+      LOGD("DataPath UnsetAcceptedCallback : %d", ret);
+    }
+
+    void SetTerminatedCallback() {
+      int ret;
+
+      ret = vine_dp_set_terminated_cb(dp_, DataPathTerminatedCallback, nullptr);
+
+      LOGD("DataPath SetTerminatedCallback : %d", ret);
+    }
+
+    void UnsetTerminatedCallback() {
+      int ret;
+
+      ret = vine_dp_unset_terminated_cb(dp_);
+
+      LOGD("DataPath SetTerminatedCallback : %d", ret);
+    }
+
+    void DataPathOpen() {
+      int ret;
+
+      ret = vine_dp_open(dp_, DataPathOpenedCallback, nullptr);
+
+      LOGD("DataPath SetTerminatedCallback : %d", ret);
+    }
+
+    void DataPathClose() {
+      int ret;
+
+      ret = vine_dp_close(dp_);
+
+      LOGD("DataPath DataPathClose : %d", ret);
+    }
+
+    void Send(std::string buf, size_t len) {
+      //vine_dp_send(dp_, buf.c_str(), len);
+    }
+
+    void Receive(std::string buf, size_t buf_len, size_t* read_len) {
+      //vine_dp_recv(dp_, buf.c_str(), buf_len, read_len);
+    }
+
+    void SetReceivedCallback() {
+      int ret;
+
+      ret = vine_dp_set_received_cb(dp_, DataPathReceivedCallback, nullptr);
+
+      LOGD("DataPath SetReceivedCallback : %d", ret);
+    }
+
+    void UnsetReceivedCallback() {
+      int ret;
+
+      ret = vine_dp_unset_received_cb(dp_);
+
+      LOGD("DataPath UnsetReceivedCallback : %d", ret);
+    }
+
+   private:
+    static void DataPathAcceptedCallback(vine_dp_h dp, void *user_data) {
+      printf("data path accepted\n");
+    }
+
+    static void DataPathTerminatedCallback(vine_dp_h dp, void *user_data) {
+      printf("data path accepted\n");
+    }
+
+    static void DataPathOpenedCallback(vine_dp_h dp, vine_error_e result, void *user_data) {
+      printf("data path opened\n");
+    }
+
+    static void DataPathReceivedCallback(vine_dp_h dp, size_t received_len, void *user_data) {
+      printf("data path received\n");
+    }
+
+   private:
+    vine_data_path dp_ = nullptr;
+  };
+
+ public:
+  static Vine& GetInst();
+  shared_ptr<VineService> CreateVineService();
+  shared_ptr<VineService> CloneVineService(shared_ptr<VineService> service);
+  shared_ptr<VineSession> CreateVineSession();
+  shared_ptr<VineSecurity> CreateVineSecurity();
+  shared_ptr<VineDataPath> CreateVineDataPath(shared_ptr<VineSession> session,
+      VineDataPath::DataPathType type);
+
+ private:
+  Vine();
+  virtual ~Vine();
+  int Init();
+
+ private:
+  class Impl;
+  unique_ptr<Impl> impl_;
+};
+
+}   // namespace cion
+
+#endif  // CION_API_VINE_HH_
diff --git a/cion/vine_wrapper/vine_implementation.hh b/cion/vine_wrapper/vine_implementation.hh
new file mode 100644 (file)
index 0000000..b4d900d
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2021 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 CION_API_VINE_MANAGER_IMPLEMENTATION_HH_
+#define CION_API_VINE_MANAGER_IMPLEMENTATION_HH_
+
+namespace cion {
+
+class Vine::Impl {
+ public:
+  virtual ~Impl();
+
+ private:
+  friend class Vine;
+  Impl();
+
+ private:
+};
+
+}   // namespace cion
+
+#endif  // CION_API_VINE_MANAGER_IMPLEMENTATION_HH_
index 9168bf4c54f6eae400db2aada074945635b289de..84cf19d6548b14a681e69a8b5f861283ba1a5192 100644 (file)
@@ -65,28 +65,6 @@ Group:   Application Framework/Communication
 %description -n cion-service
 Tizen Companion Service Application
 
-#################################################
-# Vine-Manager
-#################################################
-%package -n libvine_manager
-Summary: Vine Manager module
-License: Apache-2.0
-Group:   Application Framework/Communication
-
-%description -n libvine_manager
-Vine Manager module
-
-#################################################
-# libvine_wrapper
-#################################################
-%package -n libvine_wrapper
-Summary: Vine API wrapper module
-License: Apache-2.0
-Group:   Application Framework/Communication
-
-%description -n libvine_wrapper
-Vine API wrapper module
-
 #################################################
 # unittests
 #################################################
@@ -152,7 +130,7 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj
 #TODO: enable check section
 #%check
 #ctest --output-on-failure %{?_smp_mflags}
-export LD_LIBRARY_PATH=../cion:../vine_manager:../vine_wrapper
+export LD_LIBRARY_PATH=../cion
 ctest -V
 %if 0%{?gcov:1}
 lcov -c --ignore-errors graph --no-external -q -d . -o cion.info
@@ -205,38 +183,6 @@ install -m 0644 cion.zip %{buildroot}%{_datadir}/gcov/
 #%{_manifestdir}/org.tizen.%{name}-service.xml
 #%{_shareddir}/*
 
-#################################################
-# Vine-Manager
-#################################################
-%post -n libvine_manager -p /sbin/ldconfig
-
-%postun -n libvine_manager -p /sbin/ldconfig
-
-%files -n libvine_manager
-%manifest %{name}.manifest
-%license LICENSE
-%defattr(-,root,root,-)
-%{_libdir}/libvine_manager.so.*
-%{_includedir}/vine_manager/*.hh
-%{_libdir}/libvine_manager.so
-%{_libdir}/pkgconfig/vine_manager.pc
-
-#################################################
-# libvine_wrapper
-#################################################
-%post -n libvine_wrapper -p /sbin/ldconfig
-
-%postun -n libvine_wrapper -p /sbin/ldconfig
-
-%files -n libvine_wrapper
-%manifest %{name}.manifest
-%license LICENSE
-%defattr(-,root,root,-)
-%{_libdir}/libvine_wrapper.so.*
-%{_includedir}/vine_wrapper/*.hh
-%{_libdir}/libvine_wrapper.so
-%{_libdir}/pkgconfig/vine_wrapper.pc
-
 #################################################
 # unittests
 #################################################
index 3b4bb638800598f37bfc082bfa53805e33dc9d25..01aa5fa35cac85eef5cf84705e98aa12bfc35821 100644 (file)
@@ -1,10 +1,8 @@
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../vine_wrapper VINE_WRAPPER_SOURCE)
 AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src SOURCES)
 AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/mock MOCK_SRCS)
 ADD_EXECUTABLE(${TARGET_CION_UNITTESTS}
     ${SOURCES}
     ${MOCK_SRCS}
-    ${VINE_WRAPPER_SOURCE}
 )
 
 TARGET_INCLUDE_DIRECTORIES(${TARGET_CION_UNITTESTS} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../)
@@ -14,6 +12,6 @@ APPLY_PKG_CONFIG(${TARGET_CION_UNITTESTS} PUBLIC
     GMOCK_DEPS
 )
 
-TARGET_LINK_LIBRARIES(${TARGET_CION_UNITTESTS} PRIVATE ${TARGET_CION} ${TARGET_VINE_MANAGER} ${TARGET_VINE_WRAPPER})
+TARGET_LINK_LIBRARIES(${TARGET_CION_UNITTESTS} PRIVATE ${TARGET_CION})
 
 INSTALL(TARGETS ${TARGET_CION_UNITTESTS} DESTINATION ${BINDIR})
index 97b49ab46cead084c91a6204681f5d2d56ab2fc0..ed42cf6c8fa9efae40a6c70db853fbde37e9eee1 100644 (file)
@@ -18,9 +18,9 @@
 #include <gmock/gmock.h>
 #include <stdio.h>
 
+#include "cion/vine_wrapper/vine.hh"
 #include "unittests/mock/test_fixture.hh"
 #include "unittests/mock/vine_mock.hh"
-#include "vine_wrapper/vine.hh"
 
 using namespace std;
 using namespace cion;
index c8e872df1e7ac10a3cdf04b52deab58c6d80c7f1..fb880885ed703283e0920f845b3ee05db0f432f9 100644 (file)
@@ -18,9 +18,9 @@
 #include <gmock/gmock.h>
 #include <stdio.h>
 
+#include "cion/vine_wrapper/vine.hh"
 #include "unittests/mock/test_fixture.hh"
 #include "unittests/mock/vine_mock.hh"
-#include "vine_wrapper/vine.hh"
 
 using namespace std;
 using namespace cion;
index 536542fc6ebef50782922f2c4842c41ad906faa4..9a624eebe8ae3f5d6f1b6703aae0c4215fbd0011 100644 (file)
@@ -18,9 +18,9 @@
 #include <gmock/gmock.h>
 #include <stdio.h>
 
+#include "cion/vine_wrapper/vine.hh"
 #include "unittests/mock/test_fixture.hh"
 #include "unittests/mock/vine_mock.hh"
-#include "vine_wrapper/vine.hh"
 
 using namespace std;
 using namespace cion;
@@ -45,7 +45,7 @@ TEST_F(VineServiceTest, ServiceTest) {
   EXPECT_NE(service->GetService(), nullptr);
 
   string type;
-  
+
   service->SetType(string("vine_type"));
 
   type = service->GetType();
index 22cd3b0186a20b135acd271b4e6fb27e1bdd03d4..7f5827be0b5ec7bd84ecea59165d646b3e97d875 100644 (file)
@@ -18,9 +18,9 @@
 #include <gmock/gmock.h>
 #include <stdio.h>
 
+#include "cion/vine_wrapper/vine.hh"
 #include "unittests/mock/test_fixture.hh"
 #include "unittests/mock/vine_mock.hh"
-#include "vine_wrapper/vine.hh"
 
 using namespace std;
 using namespace cion;
diff --git a/vine_manager/CMakeLists.txt b/vine_manager/CMakeLists.txt
deleted file mode 100644 (file)
index e490cf6..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCES)
-ADD_LIBRARY(${TARGET_VINE_MANAGER} SHARED ${SOURCES})
-
-TARGET_INCLUDE_DIRECTORIES(${TARGET_VINE_MANAGER} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/)
-TARGET_INCLUDE_DIRECTORIES(${TARGET_VINE_MANAGER} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../)
-
-APPLY_PKG_CONFIG(${TARGET_VINE_MANAGER} PUBLIC DLOG_DEPS VINE_DEPS GLIB_DEPS)
-
-SET_TARGET_PROPERTIES(${TARGET_VINE_MANAGER} PROPERTIES VERSION ${FULLVER})
-SET_TARGET_PROPERTIES(${TARGET_VINE_MANAGER} PROPERTIES SOVERSION ${MAJORVER})
-
-CONFIGURE_FILE(${TARGET_VINE_MANAGER}.pc.in ${TARGET_VINE_MANAGER}.pc @ONLY)
-
-INSTALL(TARGETS ${TARGET_VINE_MANAGER} DESTINATION ${LIB_INSTALL_DIR})
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_VINE_MANAGER}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/vine_listener.hh DESTINATION include/${TARGET_VINE_MANAGER})
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/vine_manager.hh DESTINATION include/${TARGET_VINE_MANAGER})
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/vine_sender.hh DESTINATION include/${TARGET_VINE_MANAGER})
diff --git a/vine_manager/vine_listener.cc b/vine_manager/vine_listener.cc
deleted file mode 100644 (file)
index 6ba0177..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2020 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 <dlog.h>
-#include <unistd.h>
-#include <memory>
-
-#include "vine_manager.hh"
-#include "vine_listener.hh"
-#include "vine_listener_implementation.hh"
-
-namespace cion {
-
-VineListener::VineListener()
-  : impl_(new Impl()) {
-}
-
-VineListener::~VineListener() {
-}
-
-VineListener::Impl::Impl() {
-}
-
-void VineListener::RegisterObserver(channel::IEventObserver* observer) {
-       VineManager::GetInst().RegisterObserver(observer);
-}
-
-void VineListener::UnregisterObserver(channel::IEventObserver* observer) {
-       VineManager::GetInst().UnregisterObserver(observer);
-}
-
-}   // namespace cion
diff --git a/vine_manager/vine_listener.hh b/vine_manager/vine_listener.hh
deleted file mode 100644 (file)
index 9f9a0c4..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2020 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 CION_VINE_MANAGER_VINE_LISTENER_HH_
-#define CION_VINE_MANAGER_VINE_LISTENER_HH_
-
-#include <memory>
-
-#include "cion/channel/ievent_observer.hh"
-#include "cion/channel/ievent_listener.hh"
-
-namespace cion {
-
-#ifndef EXPORT_API
-#define EXPORT_API __attribute__((visibility("default")))
-#endif
-
-class EXPORT_API VineListener : public channel::IEventListener {
-
- public:
-  VineListener();
-  virtual ~VineListener();
-  void RegisterObserver(channel::IEventObserver* observer) override;
-  void UnregisterObserver(channel::IEventObserver* observer) override;
-
-
- private:
-  class Impl;
-  std::unique_ptr<Impl> impl_;
-};
-
-}   // namespace cion
-
-#endif  // CION_VINE_MANAGER_VINE_LISTENER_HH_
diff --git a/vine_manager/vine_listener_implementation.hh b/vine_manager/vine_listener_implementation.hh
deleted file mode 100644 (file)
index 62a4343..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2020 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 CION_API_VINE_LISTENER_IMPLEMENTATION_HH_
-#define CION_API_VINE_LISTENER_IMPLEMENTATION_HH_
-
-namespace cion {
-
-class VineListener::Impl {
- public:
-  virtual ~Impl() = default;
-
- private:
-  friend class VineListener;
-  Impl();
-
-
- private:
-};
-
-}   // namespace cion
-
-#endif  // CION_API_VINE_LISTENER_IMPLEMENTATION_HH_
diff --git a/vine_manager/vine_manager.cc b/vine_manager/vine_manager.cc
deleted file mode 100644 (file)
index 22585e7..0000000
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
- *
- * 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 <dlog.h>
-#include <unistd.h>
-#include <vine.h>
-#include <glib-unix.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-
-#include <memory>
-#include <utility>
-
-#include "vine_manager.hh"
-#include "vine_manager_implementation.hh"
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "VINE_MANAGER"
-
-#define VINE_TEST_TOPIC "CION_TOPIC"
-#define VINE_TEST_SERVICE "CION_TEST"
-#define VINE_TEST_SERVER_PORT 55555
-#define VINE_TEST_CLIENT_PORT 55556
-#define VINE_TEST_SERVICE_TYPE "_cion"
-
-namespace cion {
-
-VineManager& VineManager::GetInst() {
-  static VineManager w_inst;
-  int ret;
-
-  if (w_inst.impl_ == nullptr) {
-    ret = w_inst.Init();
-    if (ret != CION_ERROR_NONE)
-      throw ret;
-  }
-  return w_inst;
-}
-
-VineManager::VineManager() = default;
-VineManager::~VineManager() = default;
-VineManager::Impl::Impl() = default;
-
-VineManager::Impl::~Impl() {
-  vine_session_unset_discovered_cb(session_);
-  vine_deinitialize();
-}
-
-int VineManager::Init() {
-  std::unique_ptr<Impl> tmp_impl;
-
-  try {
-    tmp_impl = std::unique_ptr<VineManager::Impl>(new Impl());
-  } catch (const std::bad_alloc &ba) {
-    LOGE("Out of memory");
-    return -1;
-  }
-
-  impl_ = std::move(tmp_impl);
-  vine_initialize();
-  vine_session_create(&impl_->session_);
-  int fd;
-  vine_session_get_event_fd(impl_->session_, &fd);
-  g_unix_fd_add(fd, G_IO_IN, [] (int fd, GIOCondition condition,
-    gpointer user_data) -> int {
-      LOGE("@@@ gio in!!");
-      VineManager* ptr = (VineManager*)user_data;
-      vine_session_process_event(ptr->impl_->session_);
-      LOGE("@@@ process event done !!");
-      return G_SOURCE_CONTINUE;
-    }, this);
-
-  LOGI("VineManager init done");
-  return 0;
-}
-
-void VineManager::Impl::AddSenderInfo(std::string service_name,
-    int channel_id) {
-  for (auto& sender : sender_list_) {
-    if (service_name == sender.GetServiceName()
-        && channel_id == sender.GetChannelId()) {
-      LOGW("Already exist");
-      return;
-    }
-  }
-  SenderInfo info(service_name, channel_id);
-  sender_list_.push_back(info);
-}
-
-bool VineManager::Impl::ValidateSender(std::string service_name) {
-  for (auto& sender : sender_list_) {
-    if (service_name == sender.GetServiceName())
-      return true;
-  }
-  return false;
-}
-
-void VineManager::Discovery() {
-  vine_session_set_discovered_cb(impl_->session_,
-      [] (vine_session_h session, vine_service_h service,
-          vine_service_state_e state, void *user_data) -> void {
-        char* name;
-        int port;
-        vine_service_get_name(service, &name);
-        vine_service_get_port(service, &port);
-
-        LOGD("Available Service");
-        LOGD("Service Name: %s", name);
-        LOGD("Port: %d", port);
-
-        VineManager* ptr = (VineManager*)user_data;
-        if (ptr == nullptr) {
-          LOGE("null vine manager");
-          return;
-        }
-
-        if (state == VINE_SERVICE_AVAILABLE) {
-            LOGW("A service is discovered\n");
-  /*
-
-
-
-            vine_dp_h dp;
-            vine_dp_create(session, VINE_DP_TYPE_PUBSUB, &dp);
-            vine_dp_set_port(dp, VINE_TEST_CLIENT_PORT);
-            vine_dp_set_topic(dp, VINE_TEST_TOPIC);
-            vine_dp_open(dp,
-                [](vine_dp_h dp, vine_error_e result, void *user_data) {
-                  LOGW("@@@@@@@ open");
-                  std::string msg = "test string";
-                  vine_dp_send(dp, (unsigned char*)msg.c_str(), msg.size());
-                }, nullptr);
-*/
-            vine_session_set_ip_resolved_cb(ptr->impl_->session_, service,
-                [] (vine_session_h session, vine_service_h service,
-                    const char *ip, vine_address_family_e address_family,
-                    void *user_data) -> void {
-                      LOGW("IP address: %s\n", ip);
-                      vine_dp_h dp;
-                      vine_dp_create(session, VINE_DP_TYPE_CLIENT, &dp);
-                      vine_dp_set_remote_ip(dp, VINE_ADDRESS_FAMILY_IPV4, ip);
-                      vine_dp_set_security(dp, nullptr);
-                      vine_dp_set_port(dp, VINE_TEST_SERVER_PORT);
-                      vine_dp_open(dp,
-                        [](vine_dp_h dp, vine_error_e result, void *user_data)
-                         -> void {
-                          LOGW("@@@@@@@ open");
-                          vine_dp_send(dp, (unsigned char*)"TEST", 5);
-                        }, nullptr);
-              }, nullptr);
-        }
-      }, this);
-  vine_session_start_discovery(impl_->session_,
-      VINE_TEST_SERVICE_TYPE, nullptr);
-}
-
-void VineManager::RegisterSender(std::string service_name, int channel_id) {
-  impl_->AddSenderInfo(service_name, channel_id);
-}
-
-void VineManager::UnregisterSender(int channel_id) {
-}
-
-void VineManager::RegisterObserver(channel::IEventObserver* observer) {
-  vine_session_set_registered_cb(impl_->session_, [] (
-      vine_session_h session, const char* service_name,
-      vine_error_e error, void* user_data) -> void {
-      LOGI("session registered : %s", service_name);
-
-      /*vine_dp_h dp;
-      vine_dp_create(session, VINE_DP_TYPE_PUBSUB, &dp);
-      vine_dp_set_address_family(g_pubsub_dp, VINE_ADDRESS_FAMILY_IPV4);
-      vine_dp_set_port(dp, VINE_TEST_SERVER_PORT);
-      vine_dp_set_topic(dp, VINE_TEST_TOPIC);
-      vine_dp_open(dp,
-          [](vine_dp_h dp, vine_error_e result, void *user_data) {
-
-            vine_dp_set_received_cb(dp, [](vine_dp_h dp, size_t received_len,
-                void *user_data) {
-                  unsigned char buf[20] = {0, };
-                  size_t bytes = 0;
-                  LOGW("[RECV_CB] %p received %zd bytes.", dp, received_len);
-                  printf("[RECV_CB] %p received %zd bytes.\n", dp, received_len);
-                  do {
-                    vine_dp_recv(dp, buf, 20, &bytes);
-                    for (int i = 0; i < (int)received_len; i++)
-                      printf("%c", buf[i]);
-                    printf("\n");
-                    received_len -= bytes;
-                  } while (received_len > 0);
-            }, nullptr);
-
-            LOGW("@@@@@@@ open");
-            //std::string msg = "test string";
-            //vine_dp_send(dp, (unsigned char*)msg.c_str(), msg.size());
-          }, nullptr);*/
-
-
-      vine_dp_h dp;
-      vine_dp_create(session, VINE_DP_TYPE_SERVER, &dp);
-      vine_dp_set_port(dp, VINE_TEST_SERVER_PORT);
-      vine_dp_open(dp,
-          [] (vine_dp_h dp, vine_error_e result, void *user_data) -> void {
-            LOGW("Opened !!!");
-            vine_dp_set_received_cb(dp, [](vine_dp_h dp, size_t received_len,
-                void *user_data) -> void {
-                  unsigned char buf[20] = {0, };
-                  size_t bytes = 0;
-                  LOGW("[RECV_CB] %p received %zd bytes.", dp, received_len);
-                  printf("[RECV_CB] %p received %zd bytes.\n", dp, received_len);
-                  do {
-                    vine_dp_recv(dp, buf, 20, &bytes);
-                    for (int i = 0; i < (int)received_len; i++)
-                      printf("%c", buf[i]);
-                    printf("\n");
-                    received_len -= bytes;
-                  } while (received_len > 0);
-            }, nullptr);
-
-          }, nullptr);
-      vine_dp_set_accepted_cb(dp, [] (vine_dp_h dp, void *user_data) -> void {
-      }, nullptr);
-
-    }, nullptr);
-
-  vine_service_h service;
-  vine_service_create(&service);
-  vine_service_set_type(service, VINE_TEST_SERVICE_TYPE);
-  std::string channel_id = "test";
-
-  vine_service_set_name(service, VINE_TEST_SERVICE);
-  impl_->port_ = VINE_TEST_SERVER_PORT;
-  vine_service_set_port(service, impl_->port_);
-  vine_service_add_attribute(service, "id", VINE_TEST_SERVICE);
-  vine_service_add_attribute(service,
-      "channel", channel_id.c_str());
-  impl_->service_ = service;
-
-  vine_session_register(impl_->session_, service, nullptr);
-  LOGI("session register !! : %s", VINE_TEST_SERVICE);
-}
-
-void VineManager::UnregisterObserver(channel::IEventObserver* observer) {
-}
-
-void VineManager::SendDataAsync(const std::vector<char>& serialized_payload,
-    std::shared_ptr<channel::IDataInfo> info, int channel_id,
-    std::shared_ptr<PeerInfo> peer_info) {
-}
-
-std::vector<char> VineManager::SendData(
-    const std::vector<char>& serialized_payload,
-    std::shared_ptr<channel::IDataInfo> info, int channel_id,
-    std::string peer_uuid, int timeout) {
-  return {};
-}
-
-void VineManager::OperateChannel(int channel_id,
-    std::shared_ptr<channel::IControlInfo> info,
-    std::shared_ptr<PeerInfo> peer_info) {
-}
-
-}  // namespace cion
\ No newline at end of file
diff --git a/vine_manager/vine_manager.hh b/vine_manager/vine_manager.hh
deleted file mode 100644 (file)
index a7d4eb6..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2020 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 CION_VINE_MANAGER_VINE_MANAGER_HH_
-#define CION_VINE_MANAGER_VINE_MANAGER_HH_
-
-#include <vector>
-#include <string>
-#include <memory>
-
-#include "cion/tizen-api/cion_error.h"
-#include "cion/channel/ievent_observer.hh"
-#include "cion/common/data_payload.hh"
-#include "cion/common/peer_info.hh"
-#include "cion/channel/idata_info.hh"
-#include "cion/channel/icontrol_info.hh"
-
-#ifndef EXPORT_API
-#define EXPORT_API __attribute__((visibility("default")))
-#endif
-
-namespace cion {
-
-class EXPORT_API VineManager {
- public:
-  static VineManager& GetInst();
-  void RegisterSender(std::string service_name, int channel_id);
-  void UnregisterSender(int channel_id);
-  void RegisterObserver(channel::IEventObserver* observer);
-  void UnregisterObserver(channel::IEventObserver* observer);
-  void SendDataAsync(const std::vector<char>& serialized_payload,
-      std::shared_ptr<channel::IDataInfo> info, int channel_id,
-      std::shared_ptr<PeerInfo> peer_info);
-  std::vector<char> SendData(const std::vector<char>& serialized_payload,
-      std::shared_ptr<channel::IDataInfo> info, int channel_id,
-      std::string peer_uuid, int timeout);
-  void OperateChannel(int channel_id,
-      std::shared_ptr<channel::IControlInfo> info,
-      std::shared_ptr<PeerInfo> peer_info);
-  void Discovery();
-  VineManager();
-
- private:
-  virtual ~VineManager();
-  int Init();
-
- private:
-  class Impl;
-  std::unique_ptr<Impl> impl_;
-};
-
-}   // namespace cion
-
-#endif  // CION_VINE_MANAGER_VINE_MANAGER_HH_
diff --git a/vine_manager/vine_manager.pc.in b/vine_manager/vine_manager.pc.in
deleted file mode 100644 (file)
index 910a120..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@PREFIX@
-exec_prefix=@EXEC_PREFIX@
-libdir=@LIB_INSTALL_DIR@
-includedir=@INCLUDE_INSTALL_DIR@
-
-Name: vine_manager
-Description: Support development of the Tizen Companion Library
-Version: @VERSION@
-Libs: -L${libdir} -lcion -lvine_manager -lvine
-Cflags: -I${includedir} -I${includedir}/vine_manager
-cppflags: -I${includedir}
diff --git a/vine_manager/vine_manager_implementation.hh b/vine_manager/vine_manager_implementation.hh
deleted file mode 100644 (file)
index ce9901b..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2020 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 CION_API_VINE_MANAGER_IMPLEMENTATION_HH_
-#define CION_API_VINE_MANAGER_IMPLEMENTATION_HH_
-
-#include<string>
-#include<list>
-#include<dlog.h>
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "VINE_MANAGER"
-
-
-namespace cion {
-
-class SenderInfo {
- public:
-  SenderInfo(std::string service_name, int channel_id) {
-    service_name_ = service_name;
-    channel_id_ = channel_id;
-  }
-
-  std::string GetServiceName() {
-    return  service_name_;
-  }
-
-  int GetChannelId() {
-    return channel_id_;
-  }
-
- private:
-  std::string service_name_;
-  int channel_id_;
-};
-
-class VineManager::Impl {
- public:
-  virtual ~Impl();
-  void AddSenderInfo(std::string service_name, int channel_id);
-  bool ValidateSender(std::string service_name);
-
- private:
-  friend class VineManager;
-  Impl();
-
- private:
-  vine_session_h session_;
-  vine_service_h service_;
-  std::list<SenderInfo> sender_list_;
-  int port_;
-};
-
-}   // namespace cion
-
-#endif  // CION_API_VINE_MANAGER_IMPLEMENTATION_HH_
diff --git a/vine_manager/vine_sender.cc b/vine_manager/vine_sender.cc
deleted file mode 100644 (file)
index 5d706cf..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2020 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 <dlog.h>
-#include <unistd.h>
-#include <memory>
-
-#include "vine_manager.hh"
-
-#include "vine_sender.hh"
-#include "vine_sender_implementation.hh"
-
-namespace cion {
-
-VineSender::VineSender(std::string service_name, int channel_id)
-  : impl_(new Impl(service_name, channel_id)) {
-}
-
-VineSender::~VineSender() {
-
-}
-
-VineSender::Impl::Impl(std::string service_name, int channel_id)
-    : service_name_(service_name), channel_id_(channel_id) {
-  port_ = 0;
-  VineManager::GetInst().RegisterSender(service_name, channel_id);
-}
-
-VineSender::Impl::~Impl() {
-  VineManager::GetInst().UnregisterSender(channel_id_);
-}
-
-void VineSender::Impl::OperateChannel(
-  std::shared_ptr<channel::IControlInfo> info,
-  std::shared_ptr<PeerInfo> peer_info) {
-  VineManager::GetInst().OperateChannel(channel_id_, info, peer_info);
-}
-
-void VineSender::SendDataAsync(const std::vector<char>& serialized_payload,
-    std::shared_ptr<channel::IDataInfo> info,
-    std::shared_ptr<PeerInfo> peer_info) {
-}
-
-std::vector<char> VineSender::SendData(
-    const std::vector<char>& serialized_payload,
-    std::shared_ptr<channel::IDataInfo> info,
-    std::shared_ptr<PeerInfo> peer_info, int timeout) {
-  return {};
-}
-
-void VineSender::OperateChannel(std::shared_ptr<channel::IControlInfo> info,
-    std::shared_ptr<PeerInfo> peer_info) {
-  impl_->OperateChannel(info, peer_info);
-}
-
-void VineSender::SetSecurity(SecurityInfo sec) {
-}
-
-}   // namespace cion
diff --git a/vine_manager/vine_sender.hh b/vine_manager/vine_sender.hh
deleted file mode 100644 (file)
index c08bc94..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2021 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 CION_VINE_MANAGER_VINE_SENDER_HH_
-#define CION_VINE_MANAGER_VINE_SENDER_HH_
-
-#include <string>
-#include <vector>
-#include <memory>
-
-#include "cion/common/data_payload.hh"
-#include "cion/common/peer_info.hh"
-#include "cion/channel/idata_info.hh"
-#include "cion/channel/icontrol_info.hh"
-#include "cion/channel/ievent_sender.hh"
-#include "cion/security/security_info.hh"
-
-#ifndef EXPORT_API
-#define EXPORT_API __attribute__((visibility("default")))
-#endif
-
-namespace cion {
-
-class EXPORT_API VineSender : public channel::IEventSender {
- public:
-  VineSender(std::string service_name, int channel_id);
-  virtual ~VineSender();
-
- protected:
-  void SendDataAsync(const std::vector<char>& serialized_payload,
-      std::shared_ptr<channel::IDataInfo> info,
-      std::shared_ptr<PeerInfo> peer_info) override;
-  std::vector<char> SendData(const std::vector<char>& serialized_payload,
-      std::shared_ptr<channel::IDataInfo> info,
-      std::shared_ptr<PeerInfo> peer_info, int timeout) override;
-  void OperateChannel(std::shared_ptr<channel::IControlInfo> info,
-      std::shared_ptr<PeerInfo> peer_info) override;
-  void SetSecurity(SecurityInfo sec) override;
-
- private:
-  class Impl;
-  std::unique_ptr<Impl> impl_;
-};
-
-}   // namespace cion
-
-#endif  // CION_VINE_MANAGER_VINE_SENDER_HH_
diff --git a/vine_manager/vine_sender_implementation.hh b/vine_manager/vine_sender_implementation.hh
deleted file mode 100644 (file)
index 8aabe5f..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2020 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 CION_API_VINE_SENDER_IMPLEMENTATION_HH_
-#define CION_API_VINE_SENDER_IMPLEMENTATION_HH_
-
-#include <memory>
-
-#include "cion/common/peer_info.hh"
-#include "cion/channel/idata_info.hh"
-#include "cion/channel/icontrol_info.hh"
-#include "cion/security/security_info.hh"
-
-namespace cion {
-
-class VineSender::Impl {
- public:
-  virtual ~Impl();
-
- private:
-  friend class VineSender;
-
-  explicit Impl(std::string service_name, int channel_id);
-  void OperateChannel(std::shared_ptr<channel::IControlInfo> info,
-      std::shared_ptr<PeerInfo> peer_info);
-
- private:
-  std::string service_name_;
-  int channel_id_;
-  int port_;
-};
-
-}   // namespace cion
-
-#endif  // CION_API_VINE_SENDER_IMPLEMENTATION_HH_
diff --git a/vine_wrapper/CMakeLists.txt b/vine_wrapper/CMakeLists.txt
deleted file mode 100644 (file)
index 434159a..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCES)
-ADD_LIBRARY(${TARGET_VINE_WRAPPER} SHARED ${SOURCES})
-
-TARGET_INCLUDE_DIRECTORIES(${TARGET_VINE_WRAPPER} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/)
-TARGET_INCLUDE_DIRECTORIES(${TARGET_VINE_WRAPPER} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../)
-
-APPLY_PKG_CONFIG(${TARGET_VINE_WRAPPER} PUBLIC DLOG_DEPS VINE_DEPS)
-
-SET_TARGET_PROPERTIES(${TARGET_VINE_WRAPPER} PROPERTIES VERSION ${FULLVER})
-SET_TARGET_PROPERTIES(${TARGET_VINE_WRAPPER} PROPERTIES SOVERSION ${MAJORVER})
-
-CONFIGURE_FILE(${TARGET_VINE_WRAPPER}.pc.in ${TARGET_VINE_WRAPPER}.pc @ONLY)
-
-INSTALL(TARGETS ${TARGET_VINE_WRAPPER} DESTINATION ${LIB_INSTALL_DIR})
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_VINE_WRAPPER}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/vine.hh DESTINATION include/${TARGET_VINE_WRAPPER})
diff --git a/vine_wrapper/vine.cc b/vine_wrapper/vine.cc
deleted file mode 100644 (file)
index 13d2a8d..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
- *
- * 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 <unistd.h>
-
-#include "cion/tizen-api/cion_error.h"
-#include "vine_wrapper/vine.hh"
-#include "vine_wrapper/vine_implementation.hh"
-
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-
-#define LOG_TAG "VINE_WRAPPER"
-
-using namespace std;
-namespace cion {
-
-Vine& Vine::GetInst() {
-  static Vine w_inst;
-  int ret;
-
-  if (w_inst.impl_ == nullptr) {
-    ret = w_inst.Init();
-    if (ret != CION_ERROR_NONE)
-      throw ret;
-  }
-  return w_inst;
-}
-
-Vine::Vine() = default;
-Vine::~Vine() = default;
-Vine::Impl::Impl() = default;
-
-Vine::Impl::~Impl() {
-  vine_deinitialize();
-}
-
-int Vine::Init() {
-  std::unique_ptr<Impl> tmp_impl;
-
-  try {
-    tmp_impl = std::unique_ptr<Vine::Impl>(new Impl());
-  } catch (const std::bad_alloc &ba) {
-    LOGE("Out of memory");
-    return -1;
-  }
-
-  vine_initialize();
-
-  impl_ = std::move(tmp_impl);
-  return 0;
-}
-
-shared_ptr<Vine::VineService> Vine::CreateVineService() {
-  vine_service_h service = nullptr;
-  vine_service_create(&service);
-
-  return make_shared<Vine::VineService>(service);
-}
-
-shared_ptr<Vine::VineService> Vine::CloneVineService(shared_ptr<Vine::VineService> service) {
-  vine_service_h cloned = nullptr;
-  vine_service_clone(static_cast<vine_service_h>(service->GetService()), &cloned);
-
-  return make_shared<Vine::VineService>(cloned);
-}
-
-shared_ptr<Vine::VineSession> Vine::CreateVineSession() {
-  vine_session_h session = nullptr;
-  vine_session_create(&session);
-
-  return make_shared<Vine::VineSession>(session);
-}
-
-shared_ptr<Vine::VineSecurity> Vine::CreateVineSecurity() {
-  vine_security_h security = nullptr;
-  vine_security_create(&security);
-
-  return make_shared<Vine::VineSecurity>(security);
-}
-
-shared_ptr<Vine::VineDataPath> Vine::CreateVineDataPath(shared_ptr<Vine::VineSession> session,
-    Vine::VineDataPath::DataPathType type) {
-  vine_dp_h data_path = nullptr;
-  vine_dp_create(static_cast<vine_session_h>(session->GetSession()),
-      static_cast<vine_dp_type_e>(type), &data_path);
-
-  return make_shared<Vine::VineDataPath>(data_path);
-}
-
-}  // namespace cion
diff --git a/vine_wrapper/vine.hh b/vine_wrapper/vine.hh
deleted file mode 100644 (file)
index dc87494..0000000
+++ /dev/null
@@ -1,665 +0,0 @@
-/*
- * Copyright (c) 2021 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 CION_API_VINE_HH_
-#define CION_API_VINE_HH_
-
-#include <memory>
-#include <string>
-#include <unistd.h>
-#include <map>
-#include <functional>
-
-#include <dlog.h>
-#include <vine.h>
-
-#include <stdio.h>
-
-using namespace std;
-
-namespace cion {
-
-class Vine {
- public:
-  class VineService {
-   public:
-    VineService(vine_service_h service) : service_(service) {
-    }
-
-    ~VineService() {
-      vine_service_destroy(service_);
-    }
-
-    typedef void* vine_service;
-
-    enum AddressFamily {
-      IPV4 = VINE_ADDRESS_FAMILY_IPV4,
-      IPV6 = VINE_ADDRESS_FAMILY_IPV6
-    };
-
-    void SetType(string service_type) {
-      int ret;
-      ret = vine_service_set_type(service_, service_type.c_str());
-
-      LOGD("Service SetType : %d", ret);
-    }
-
-    string GetType() {
-      char *type;
-      int ret;
-
-      ret = vine_service_get_type(service_, &type);
-      LOGD("Service GetType : %d", ret);
-
-      return string(type);
-    }
-
-    void SetName(string service_name) {
-      int ret;
-      ret = vine_service_set_name(service_, service_name.c_str());
-
-      LOGD("Service SetName : %d", ret);
-    }
-
-    string GetName() {
-      char *name;
-      int ret;
-
-      ret = vine_service_get_name(service_, &name);
-
-      LOGD("Service GetName : %d", ret);
-      return string(name);
-    }
-
-    void AddAttribute(string key, string value) {
-      int ret;
-      ret = vine_service_add_attribute(service_, key.c_str(), value.c_str());
-
-      LOGD("Service AddAttribute : %d", ret);
-    }
-
-    void RemoveAttribute(string key) {
-      int ret;
-      ret = vine_service_remove_attribute(service_, key.c_str());
-
-      LOGD("Service RemoveAttribute : %d", ret);
-    }
-
-    map<string, string> GetAttribute() {
-      int ret;
-      ret = vine_service_foreach_attribute(service_, VineServiceAttrCb, this);
-
-      LOGD("Service GetAttribute : %d", ret);
-
-      return attrs;
-    }
-
-    void SetPort(int port) {
-      int ret;
-      ret = vine_service_set_port(service_, port);
-
-      LOGD("Service SetPort : %d", ret);
-    }
-
-    int GetPort() {
-      int port;
-      int ret;
-
-      ret = vine_service_get_port(service_, &port);
-
-      LOGD("Service GetPort : %d", ret);
-
-      return port;
-    }
-
-    vine_service GetService() {
-      return service_;
-    }
-
-   private:
-    void SetAttr(string key, string value) {
-      attrs[key] = value;
-    }
-
-    static bool VineServiceAttrCb(const char *key, const char* value, void* user_data) {
-      VineService* service = static_cast<VineService*>(user_data);
-
-      service->SetAttr(string(key), string(value));
-
-      return true;
-    }
-
-   private:
-    vine_service service_ = nullptr;
-    map<string, string> attrs;
-  };
-
-  class VineSecurity {
-   public:
-    VineSecurity(vine_security_h security) : security_(security) {
-    }
-
-    ~VineSecurity() {
-      vine_security_destroy(security_);
-    }
-
-    typedef void* vine_security;
-
-    enum SecurityType {
-      SECURITY_TYPE_NONE = VINE_SECURITY_TYPE_NONE,
-      SECURITY_TYPE_TLS = VINE_SECURITY_TYPE_TLS,
-      SECURITY_TYPE_PSK_OVER_TLS = VINE_SECURITY_TYPE_PSK_OVER_TLS
-    };
-
-    enum TlsVersion {
-      TLS_VERSION_DEFAULT = VINE_SECURITY_TLS_VERSION_DEFAULT,
-      TLS_VERSION_1_0 = VINE_SECURITY_TLS_VERSION_1_0,
-      TLS_VERSION_1_1 = VINE_SECURITY_TLS_VERSION_1_1,
-      TLS_VERSION_1_2 = VINE_SECURITY_TLS_VERSION_1_2,
-      TLS_VERSION_1_3 = VINE_SECURITY_TLS_VERSION_1_3
-    };
-
-    enum VerificationFlag {
-      VERIFICATION_FLAG_DEFAAULT = VINE_SECURITY_VERIFICATION_FLAG_DEFAULT,
-      VERIFICATION_FLAG_ALLOW_SELF_SIGNED = VINE_SECURITY_VERIFICATION_FLAG_ALLOW_SELF_SIGNED,
-      VERIFICATION_FLAG_SKIP_HOST_NAME_CHECK = VINE_SECURITY_VERIFICATION_FLAG_SKIP_HOST_NAME_CHECK
-    };
-
-    void SetType(SecurityType type) {
-      int ret;
-      ret = vine_security_set_type(security_, static_cast<vine_security_type_e>(type));
-
-      LOGD("Security SetType : %d", ret);
-    }
-
-    SecurityType GetType() {
-      vine_security_type_e type;
-      int ret;
-
-      ret = vine_security_get_type(security_, &type);
-
-      LOGD("Security GetType : %d", ret);
-
-      return static_cast<SecurityType>(type);
-    }
-
-    void SetTlsVersion(TlsVersion version) {
-      int ret;
-      ret = vine_security_set_tls_version(security_, static_cast<vine_security_tls_version_e>(version));
-
-      LOGD("Security SetTlsVersion : %d", ret);
-    }
-
-    TlsVersion GetTlsVersion() {
-      vine_security_tls_version_e version;
-      int ret;
-
-      ret = vine_security_get_tls_version(security_, &version);
-
-      LOGD("Security GetTlsVersion : %d", ret);
-
-      return static_cast<TlsVersion>(version);
-    }
-
-    void SetVerificationFlags(int flags) {
-      int ret;
-      ret = vine_security_set_verification_flags(security_, flags);
-
-      LOGD("Security SetVerificationFlags : %d", ret);
-    }
-
-    int GetVerificationFlags() {
-      int flags;
-      int ret;
-
-      ret = vine_security_get_verification_flags(security_, &flags);
-
-      LOGD("Security GetVerificationFlags : %d", ret);
-
-      return flags;
-    }
-
-    void SetCaPath(string ca_path) {
-      int ret;
-      ret = vine_security_set_ca_path(security_, ca_path.c_str());
-
-      LOGD("Security SetCaPath : %d", ret);
-    }
-
-    string GetCaPath() {
-      char* ca_path;
-      int ret;
-
-      ret = vine_security_get_ca_path(security_, &ca_path);
-
-      LOGD("Security GetCaPath : %d", ret);
-
-      return string(ca_path);
-    }
-
-    void SetCertPath(string cert_path) {
-      int ret;
-      ret = vine_security_set_cert_path(security_, cert_path.c_str());
-
-      LOGD("Security SetCertPath : %d", ret);
-    }
-
-    string GetCertPath() {
-      char* cert_path;
-      int ret;
-
-      ret = vine_security_get_cert_path(security_, &cert_path);
-
-      LOGD("Security GetCertPath : %d", ret);
-
-      return string(cert_path);
-    }
-
-    void SetPrivateKey(string key_path) {
-      int ret;
-      ret = vine_security_set_private_key(security_, key_path.c_str());
-
-      LOGD("Security SetPrivateKey : %d", ret);
-    }
-
-    string GetPrivateKey() {
-      char* key_path;
-      int ret;
-
-      ret = vine_security_get_private_key(security_, &key_path);
-
-      LOGD("Security GetPrivateKey : %d", ret);
-
-      return string(key_path);
-    }
-
-    void SetPresharedKey(string key) {
-      int ret;
-      ret = vine_security_set_psk(security_, key.c_str());
-
-      LOGD("Security SetPresharedKey : %d", ret);
-    }
-
-    string GetPresharedKey() {
-      char* key;
-      int ret;
-
-      ret = vine_security_get_psk(security_, &key);
-
-      LOGD("Security GetPresharedKey : %d", ret);
-
-      return string(key);
-    }
-
-    vine_security GetSecurity() {
-      return security_;
-    }
-
-   private:
-    vine_security security_ = nullptr;
-
-  };
-
-  class VineSession {
-   public:
-    VineSession(vine_session_h session) : session_(session) {
-    }
-
-    ~VineSession() {
-      vine_session_destroy(session_);
-    }
-
-    typedef void* vine_session;
-
-    int GetEventFd() {
-      int fd;
-      int ret;
-
-      ret = vine_session_get_event_fd(session_, &fd);
-
-      LOGD("Session GetEventFd : %d", ret);
-
-      return fd;
-    }
-
-    void ProcessEvent() {
-      int ret;
-
-      ret = vine_session_process_event(session_);
-
-      LOGD("Session ProcessEvent : %d", ret);
-    }
-
-    void SetRegisteredCallback() {
-      int ret;
-
-      ret = vine_session_set_registered_cb(session_, RegisteredCallback, nullptr);
-
-      LOGD("Session ProcessEvent : %d", ret);
-    }
-
-    void UnsetRegisterCallback() {
-      int ret;
-
-      ret = vine_session_unset_registered_cb(session_);
-
-      LOGD("Session UnsetRegisterCallback : %d", ret);
-    }
-
-
-    void SetDiscoveredCallback() {
-      int ret;
-
-      ret = vine_session_set_discovered_cb(session_, DiscoveredCallback, nullptr);
-
-      LOGD("Session SetDiscoveredCallback : %d", ret);
-    }
-
-    void UnsetDiscoveredCallback() {
-      int ret;
-
-      ret = vine_session_unset_discovered_cb(session_);
-
-      LOGD("Session UnsetDiscoveredCallback : %d", ret);
-    }
-
-    enum DiscoveryMethod {
-      DISCOVERY_METHOD_DNS_SD = VINE_DISCOVERY_METHOD_DNS_SD
-    };
-
-    void SetDiscoveryMethod(DiscoveryMethod method) {
-      int ret;
-
-      ret = vine_session_set_discovery_method(session_,
-              static_cast<vine_discovery_method_e>(method));
-
-      LOGD("Session SetDiscoveryMethod : %d", ret);
-    }
-
-    void RegisterService(shared_ptr<VineService> service, std::string iface_name) {
-      int ret;
-
-      ret = vine_session_register(session_, static_cast<vine_service_h>(service->GetService()), iface_name.c_str());
-
-      LOGD("Session RegisterService : %d", ret);
-    }
-
-    void UnregisterService() {
-      int ret;
-
-      ret = vine_session_unregister(session_);
-
-      LOGD("Session UnregisterService : %d", ret);
-    }
-
-    void StartDiscovery(string service_type, string iface_name) {
-      int ret;
-
-      ret = vine_session_start_discovery(session_, service_type.c_str(),
-              iface_name.c_str());
-
-      LOGD("Session StartDiscovery : %d", ret);
-    }
-
-    void StopDiscovery() {
-      int ret;
-
-      ret = vine_session_stop_discovery(session_);
-
-      LOGD("Session StopDiscovery : %d", ret);
-    }
-
-    void SetIpResolvedCallback(shared_ptr<VineService> service) {
-      int ret;
-
-      ret = vine_session_set_ip_resolved_cb(session_, static_cast<vine_service_h>(service->GetService()), IpResolvedCallback, nullptr);
-
-      LOGD("Session SetIpResolvedCallback : %d", ret);
-    }
-
-    void UnsetIpResolvedCallback(shared_ptr<VineService> service) {
-      int ret;
-
-      ret = vine_session_unset_ip_resolved_cb(session_, static_cast<vine_service_h>(service->GetService()));
-
-      LOGD("Session UnsetIpResolvedCallback : %d", ret);
-    }
-
-    vine_session GetSession() {
-      return session_;
-    }
-
-   private:
-    static void RegisteredCallback(vine_session_h session,
-      const char *service_name, vine_error_e error, void *user_data) {
-      printf("service registered \n");
-    }
-
-    // discovered_service can not be set data
-    static void DiscoveredCallback(vine_session_h session,
-      vine_service_h discovered_service, vine_service_state_e state, void *user_data) {
-      printf("service discovered \n");
-    }
-
-    static void IpResolvedCallback(vine_session_h session, vine_service_h service,
-           const char *ip, vine_address_family_e address_family, void *user_data) {
-      printf("ip resolved\n");
-    }
-
-   private:
-    vine_session session_ = nullptr;
-
-  };
-
-  class VineDataPath {
-   public:
-    VineDataPath(vine_dp_h dp) : dp_(dp) {
-    }
-
-    ~VineDataPath() {
-      vine_dp_destroy(dp_);
-    }
-
-    typedef void* vine_data_path;
-
-    enum DataPathType {
-      DP_TYPE_SERVER = VINE_DP_TYPE_SERVER,
-      DP_TYPE_CLIENT = VINE_DP_TYPE_CLIENT,
-      DP_TYPE_PUBSUB = VINE_DP_TYPE_PUBSUB,
-      DP_TYPE_UNKNOWN = VINE_DP_TYPE_UNKNOWN
-    };
-
-    void SetIfaceName(std::string name){
-      int ret;
-
-      ret = vine_dp_set_iface_name(dp_, name.c_str());
-
-      LOGD("DataPath SetIfaceName : %d", ret);
-    }
-
-    // DP_TYPE_SERVER || DP_TYPE_PUBSUB possible
-    void SetAddressFamily(VineService::AddressFamily addr_family) {
-      int ret;
-
-      ret = vine_dp_set_address_family(dp_,
-              static_cast<vine_address_family_e>(addr_family));
-
-      LOGD("DataPath SetAddressFamily : %d", ret);
-    }
-
-    // DP_TYPE_CLIENT possible
-    void SetRemoteIp(VineService::AddressFamily addr_family, std::string ip) {
-      int ret;
-
-      ret = vine_dp_set_remote_ip(dp_,
-              static_cast<vine_address_family_e>(addr_family), ip.c_str());
-
-      LOGD("DataPath SetRemoteIp : %d", ret);
-    }
-
-    void SetPort(int port) {
-      int ret;
-
-      ret = vine_dp_set_port(dp_, port);
-
-      LOGD("DataPath SetPort : %d", ret);
-    }
-
-    int GetPort() {
-      int port;
-      int ret;
-
-      ret = vine_dp_get_port(dp_, &port);
-
-      LOGD("DataPath GetPort : %d", ret);
-
-      return port;
-    }
-
-    // DP_TYPE_PUBSUB possible
-    void SetTopic(std::string topic) {
-      int ret;
-
-      ret = vine_dp_set_topic(dp_, topic.c_str());
-
-      LOGD("DataPath SetTopic : %d", ret);
-    }
-
-    void SetSecurity(shared_ptr<VineSecurity> security) {
-      int ret;
-
-      ret = vine_dp_set_security(dp_, static_cast<vine_security_h>(security->GetSecurity()));
-
-      LOGD("DataPath SetSecurity : %d", ret);
-    }
-
-    // DP_TYPE_SERVER only
-    void SetAcceptedCallback() {
-      int ret;
-
-      ret = vine_dp_set_accepted_cb(dp_, DataPathAcceptedCallback, nullptr);
-
-      LOGD("DataPath SetAcceptedCallback : %d", ret);
-    }
-
-    // DP_TYPE_SERVER only
-    void UnsetAcceptedCallback() {
-      int ret;
-
-      ret = vine_dp_unset_accepted_cb(dp_);
-
-      LOGD("DataPath UnsetAcceptedCallback : %d", ret);
-    }
-
-    void SetTerminatedCallback() {
-      int ret;
-
-      ret = vine_dp_set_terminated_cb(dp_, DataPathTerminatedCallback, nullptr);
-
-      LOGD("DataPath SetTerminatedCallback : %d", ret);
-    }
-
-    void UnsetTerminatedCallback() {
-      int ret;
-
-      ret = vine_dp_unset_terminated_cb(dp_);
-
-      LOGD("DataPath SetTerminatedCallback : %d", ret);
-    }
-
-    void DataPathOpen() {
-      int ret;
-
-      ret = vine_dp_open(dp_, DataPathOpenedCallback, nullptr);
-
-      LOGD("DataPath SetTerminatedCallback : %d", ret);
-    }
-
-    void DataPathClose() {
-      int ret;
-
-      ret = vine_dp_close(dp_);
-
-      LOGD("DataPath DataPathClose : %d", ret);
-    }
-
-    void Send(std::string buf, size_t len) {
-      //vine_dp_send(dp_, buf.c_str(), len);
-    }
-
-    void Receive(std::string buf, size_t buf_len, size_t* read_len) {
-      //vine_dp_recv(dp_, buf.c_str(), buf_len, read_len);
-    }
-
-    void SetReceivedCallback() {
-      int ret;
-
-      ret = vine_dp_set_received_cb(dp_, DataPathReceivedCallback, nullptr);
-
-      LOGD("DataPath SetReceivedCallback : %d", ret);
-    }
-
-    void UnsetReceivedCallback() {
-      int ret;
-
-      ret = vine_dp_unset_received_cb(dp_);
-
-      LOGD("DataPath UnsetReceivedCallback : %d", ret);
-    }
-
-   private:
-    static void DataPathAcceptedCallback(vine_dp_h dp, void *user_data) {
-      printf("data path accepted\n");
-    }
-
-    static void DataPathTerminatedCallback(vine_dp_h dp, void *user_data) {
-      printf("data path accepted\n");
-    }
-
-    static void DataPathOpenedCallback(vine_dp_h dp, vine_error_e result, void *user_data) {
-      printf("data path opened\n");
-    }
-
-    static void DataPathReceivedCallback(vine_dp_h dp, size_t received_len, void *user_data) {
-      printf("data path received\n");
-    }
-
-   private:
-    vine_data_path dp_ = nullptr;
-  };
-
- public:
-  static Vine& GetInst();
-  shared_ptr<VineService> CreateVineService();
-  shared_ptr<VineService> CloneVineService(shared_ptr<VineService> service);
-  shared_ptr<VineSession> CreateVineSession();
-  shared_ptr<VineSecurity> CreateVineSecurity();
-  shared_ptr<VineDataPath> CreateVineDataPath(shared_ptr<VineSession> session,
-      VineDataPath::DataPathType type);
-
- private:
-  Vine();
-  virtual ~Vine();
-  int Init();
-
- private:
-  class Impl;
-  unique_ptr<Impl> impl_;
-};
-
-}   // namespace cion
-
-#endif  // CION_API_VINE_HH_
diff --git a/vine_wrapper/vine_implementation.hh b/vine_wrapper/vine_implementation.hh
deleted file mode 100644 (file)
index b4d900d..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2021 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 CION_API_VINE_MANAGER_IMPLEMENTATION_HH_
-#define CION_API_VINE_MANAGER_IMPLEMENTATION_HH_
-
-namespace cion {
-
-class Vine::Impl {
- public:
-  virtual ~Impl();
-
- private:
-  friend class Vine;
-  Impl();
-
- private:
-};
-
-}   // namespace cion
-
-#endif  // CION_API_VINE_MANAGER_IMPLEMENTATION_HH_
diff --git a/vine_wrapper/vine_wrapper.pc.in b/vine_wrapper/vine_wrapper.pc.in
deleted file mode 100644 (file)
index 4c6b305..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@PREFIX@
-exec_prefix=@EXEC_PREFIX@
-libdir=@LIB_INSTALL_DIR@
-includedir=@INCLUDE_INSTALL_DIR@
-
-Name: vine_wrapper
-Description: Vine API wrapper module
-Version: @VERSION@
-Libs: -L${libdir} -lcion
-Cflags: -I${includedir} -I${includedir}/vine_wrapper
-cppflags: -I${includedir}