Merge branch 'master' of https://github.sec.samsung.net/appfw/cion into working_codes
authorhyunho <hhstark.kang@samsung.com>
Thu, 4 Mar 2021 06:54:46 +0000 (15:54 +0900)
committerhyunho <hhstark.kang@samsung.com>
Thu, 4 Mar 2021 06:54:46 +0000 (15:54 +0900)
Signed-off-by: hyunho <hhstark.kang@samsung.com>
15 files changed:
1  2 
cion/CMakeLists.txt
cion/channel/client_channel.cc
cion/channel/client_channel.hh
cion/channel/control_info.hh
cion/channel/ievent_sender.hh
cion/channel/server_channel.cc
cion/common/data_payload.cc
cion/common/data_payload.hh
cion/common/peer_info.hh
cion/vine_manager/vine_listener.cc
cion/vine_manager/vine_manager.cc
cion/vine_manager/vine_manager.hh
cion/vine_manager/vine_manager_implementation.hh
cion/vine_manager/vine_sender.cc
cion/vine_manager/vine_sender.hh

Simple merge
index ec724072309f4e7a733da52f6ea4d54c5d6468a5,39e6518fbf5fd75d1bdf7951bc2efe29767f5b72..109434741f9d6f594f7bb765a5300946572d893e
   * limitations under the License.
   */
  
 -#include "cion/channel/client_channel.hh"
 -
  #include <memory>
++#include <utility>
  
- #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 <dlog.h>
 +
++#include "cion/channel/client_channel.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"
  
 +#ifdef LOG_TAG
 +#undef LOG_TAG
 +#endif
 +
 +#define LOG_TAG "CION"
 +
  /**
   * ClientChannel implementation
   */
  namespace cion {
  namespace channel {
  
 -ClientChannel::ClientChannel(std::string& service_name) {
 +ClientChannel::ClientChannel(const std::string& service_name) {
    int channel_id = IDGenerator::GetInst().GenChannelId();
+   auto peer_info = std::make_shared<PeerInfo>();
    std::unique_ptr<IEventSender> sender(new VineSender(service_name,
-       channel_id));
+       channel_id, peer_info));
    std::unique_ptr<IEventListener> listener(new VineListener());
    impl_ = std::unique_ptr<Impl>(new Impl(this, service_name, channel_id,
        std::move(sender), std::move(listener)));
@@@ -97,8 -89,7 +97,7 @@@ std::vector<char> ClientChannel::SendDa
  }
  
  void ClientChannel::SendPayLoadAsync(IPayload* data) {
-   auto di = std::make_shared<DataInfo>(IDataInfo::MessageType::Sync,
-       impl_->peer_->GetUUID());
 -  auto di = std::make_shared<DataInfo>(IDataInfo::MessageType::Sync);
++  auto di = std::make_shared<DataInfo>(IDataInfo::MessageType::Async);
    impl_->sender_->SendData(data->Serialize(), di, impl_->peer_, -1);
  }
  
Simple merge
Simple merge
Simple merge
index 1e38af81530422aa7cfcd41b3198f63cfc22c043,bf5e74aaea34158bd8c297a1d7cf870325e9e428..ea480c4bbf88c149eff720a5ee0c5e934451fdfe
@@@ -53,11 -52,8 +53,9 @@@ ServerChannel::Impl::Impl(ServerChannel
    int channel_id,
      std::unique_ptr<IEventSender> sender,
      std::unique_ptr<IEventListener> listener) : parent_(parent),
 -    service_name_(service_name), channel_id_(channel_id), sender_(std::move(sender)),
 -    listener_(std::move(listener)) {
 +    service_name_(service_name), channel_id_(channel_id),
 +    sender_(std::move(sender)), listener_(std::move(listener)) {
-   VineManager::GetInst().RegisterSender(service_name_, channel_id_);
 +  peer_info_ = std::make_shared<PeerInfo>();
  }
  
  void ServerChannel::Listen() {
Simple merge
Simple merge
index 3f0bd0a21356eb2013fa27518acb6a568ba887d7,7c1af063e0550b569bc5a71fc830ab75dde2a953..27dd01d314147dd0a83441e3d4479500f39ccb55
@@@ -44,15 -45,14 +44,13 @@@ class PeerInfo : public tizen_base::Par
    std::string GetAppID() const;
    std::string GetAppVersion() const;
    std::string GetUUID() const;
 +  int GetChannelID() const;
  
    bool IsValid() const noexcept;
 -
    std::vector<uint8_t> Serialize() const;
-  private:
 -  int GetChannelID();
    void SetChannelID(int id);
  
+  private:
    bool valid_;
    std::string device_id_;
    std::string device_name_;
index 0000000000000000000000000000000000000000,da0cbf647b92e60a8bdadc6e91e6d8ceada610ff..02193bcc0e6b91fe33d8a742977aa74f1281e130
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,45 +1,45 @@@
 -      VineManager::GetInst().RegisterObserver(observer);
+ /*
+  * 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().UnregisterObserver(observer);
++  VineManager::GetInst().RegisterObserver(observer);
+ }
+ void VineListener::UnregisterObserver(channel::IEventObserver* observer) {
++  VineManager::GetInst().UnregisterObserver(observer);
+ }
+ }   // namespace cion
index 0000000000000000000000000000000000000000,fc54ec9c3196c69cdaad6ce206b53f6fdcfbe9f3..a303525d528988f9cf01f653c6bec8ca95861698
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,510 +1,638 @@@
 -#define LOG_TAG "VINE_MANAGER"
+ /*
+  * 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 <dlog.h>
+ #include <unistd.h>
+ #include <glib-unix.h>
+ #include <sys/socket.h>
+ #include <sys/types.h>
+ #include <glib.h>
++#include <string.h>
+ #include <memory>
+ #include <utility>
+ #include <parcel.hh>
+ #include "vine_manager.hh"
+ #include "vine_manager_implementation.hh"
+ #include "cion/channel/data_info.hh"
+ #ifdef LOG_TAG
+ #undef LOG_TAG
+ #endif
 -#define VINE_TEST_TOPIC "CION_TOPIC"
++#define LOG_TAG "CION"
 -#define VINE_TEST_SERVER_PORT 55555
 -#define VINE_TEST_CLIENT_PORT 55556
+ #define VINE_TEST_SERVICE "CION_TEST"
 -                      vine_dp_set_received_cb(dp,
 -                          [](vine_dp_h dp,
 -                              size_t received_len, void *user_data) {
 -                            int channel_id = GPOINTER_TO_INT(user_data);
 -                            unsigned char buf[256] = {0, };
 -                            size_t bytes = 0;
 -                            LOGW("[RECV_CB] %p received %zd bytes.",
 -                                 dp, received_len);
 -                            vine_dp_recv(dp, buf, 256, &bytes);
 -
 -                            std::vector<char> serialized_peerinfo;
 -                            serialized_peerinfo.assign(buf, buf + bytes);
 -                            channel::IEventObserver* observer =
 -                                VineManager::GetInst().GetObserver(channel_id);
 -                            if (observer == nullptr) {
 -                              LOGE("cannot find observer (%d)", channel_id);
 -                              return;
 -                            }
 -                            observer->OnConnectionEvent(
 -                                std::make_shared<ConnectionInfo>(
 -                                  IConnectionInfo::ConnectionType::Discovered),
 -                                  serialized_peerinfo);
 -
 -                            PeerInfo p_info(buf, bytes);
 -                            VineManager::GetInst().AddDataPath(
 -                                channel_id, p_info.GetUUID(),
 -                                p_info.GetChannelID(), dp);
 -                      }, user_data);
+ #define VINE_TEST_SERVICE_TYPE "_cion"
+ using namespace cion::channel;
+ 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_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();
+   LOGI("VineManager init done");
+   return 0;
+ }
+ void VineManager::Impl::AddSenderInfo(std::string service_name,
+     int channel_id, std::shared_ptr<PeerInfo> peer_info) {
+   auto result = sender_list_.find(channel_id);
+   if (result != sender_list_.end()) {
+       LOGW("Already exist");
+       return;
+     }
+  sender_list_[channel_id] =
+       std::make_shared<SenderInfo>(service_name, channel_id, peer_info);
+ }
+ std::shared_ptr<SenderInfo> VineManager::Impl::GetSenderInfo(int channel_id) {
+   auto result = sender_list_.find(channel_id);
+   if (result != sender_list_.end())
+     return result->second;
+   return {};
+ }
+ bool VineManager::Impl::ValidateSender(std::string service_name) {
+   for (auto& sender : sender_list_) {
+     if (service_name == sender.second->GetServiceName())
+       return true;
+   }
+   return false;
+ }
+ channel::IEventObserver* VineManager::GetObserver(int channel_id) {
+   for (channel::IEventObserver* i : impl_->observer_list_) {
+     if (i->GetChannelId() == channel_id)
+       return i;
+   }
+   return nullptr;
+ }
++void VineManager::HandlingDiscoveredPeer(vine_dp_h dp, size_t received_len,
++    int channel_id, channel::IEventObserver* observer) {
++  unsigned char buf[256] = {0, };
++  size_t bytes = 0;
++
++  LOGW("[RECV_CB] %p received %zd bytes.", dp, received_len);
++  vine_dp_recv(dp, buf, 256, &bytes);
++  std::vector<char> serialized_peerinfo;
++  serialized_peerinfo.assign(buf, buf + bytes);
++
++  std::shared_ptr<PeerInfo> p_info = std::make_shared<PeerInfo>(buf, bytes);
++  std::shared_ptr<DataPathInfo> dp_info =
++      VineManager::GetInst().AddDataPath(channel_id, p_info->GetUUID(),
++          p_info->GetChannelID(), dp);
++  dp_info->SetPeerInfo(p_info);
++
++  observer->OnConnectionEvent(
++    std::make_shared<ConnectionInfo>(
++      IConnectionInfo::ConnectionType::Discovered),
++      serialized_peerinfo);
++}
++
++void VineManager::HandlingConnReqResp(vine_dp_h dp, size_t received_len,
++    int channel_id, std::shared_ptr<DataPathInfo> dp_info,
++    channel::IEventObserver* observer) {
++  unsigned char buf[256] = {0, };
++  size_t bytes = 0;
++
++  vine_dp_recv(dp, buf, 256, &bytes);
++  std::vector<char> serialized_data_payload;
++  serialized_data_payload.assign(buf, buf + bytes);
++
++  DataPayload dpl(serialized_data_payload);
++  std::vector<char> dpl_data = dpl.GetData();
++  std::string str(dpl_data.begin(), dpl_data.end());
++  LOGI("connection request resp (%s)", str.c_str());
++
++  std::shared_ptr<PeerInfo> pinfo = dp_info->GetPeerInfo();
++  std::vector<uint8_t> data = pinfo->Serialize();
++  char* p = reinterpret_cast<char*>(&data[0]);
++  std::vector<char> serialized_peerinfo(p, p + data.size());
++  if (strcmp(str.c_str(), "__accept__") == 0) {
++    LOGI("connection accepted");
++    observer->OnConnectionEvent(std::make_shared<ConnectionInfo>(
++        IConnectionInfo::ConnectionType::Connected), serialized_peerinfo);
++    dp_info->SetState(DataPathInfo::State::Connected);
++  } else if (strcmp(str.c_str(), "__reject__") == 0) {
++    LOGI("connection rejected");
++    observer->OnConnectionEvent(std::make_shared<ConnectionInfo>(
++        IConnectionInfo::ConnectionType::Rejected), serialized_peerinfo);
++    dp_info->SetState(DataPathInfo::State::Rejected);
++  }
++}
++
++void VineManager::SetClientRecvCallback(vine_dp_h client_dp, void* user_data) {
++  vine_dp_set_received_cb(client_dp,
++      [](vine_dp_h dp,
++          size_t received_len, void *user_data) {
++        int channel_id = GPOINTER_TO_INT(user_data);
++
++        channel::IEventObserver* observer =
++          VineManager::GetInst().GetObserver(channel_id);
++        if (observer == nullptr) {
++          LOGE("cannot find observer (%d)", channel_id);
++          return;
++        }
++
++        std::shared_ptr<DataPathInfo> dp_info =
++            VineManager::GetInst().GetDataPathInfo(
++                channel_id, dp);
++        if (dp_info == nullptr) {
++          VineManager::GetInst()
++              .HandlingDiscoveredPeer(dp, received_len, channel_id, observer);
++        } else if (dp_info->GetState() ==
++            DataPathInfo::State::ConnectionRequested) {
++          VineManager::GetInst().HandlingConnReqResp(dp, received_len,
++                  channel_id, dp_info, observer);
++        } else {
++          LOGI("@@@@@@@@ recv");
++        }
++  }, user_data);
++}
++
+ bool VineManager::Discovery(int channel_id) {
+   std::shared_ptr<SessionInfo> info = GetSessionInfo(channel_id);
+   if (info->IsDiscovering()) {
+     LOGE("Already discovering (%d)", channel_id);
+     return false;
+   }
+   vine_session_set_discovered_cb(info->GetSession(),
+       [] (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);
+         if (state != VINE_SERVICE_AVAILABLE) {
+           LOGE("Vine service unavailable (%d)", state);
+           return;
+         }
+         LOGW("A service is discovered\n");
+         vine_session_set_ip_resolved_cb(session, service,
+             [] (vine_session_h session, vine_service_h service,
+                 const char *ip, vine_address_family_e address_family,
+                 void *user_data) -> void {
+                   int port;
+                   vine_service_get_port(service, &port);
+                   LOGW("IP address: %s\n", ip);
+                   LOGW("port: %d\n", port);
+                   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, port);
+                   vine_dp_open(dp,
+                     [](vine_dp_h dp, vine_error_e result, void *user_data)
+                       -> void {
+                       LOGW("@@@@@@@ open");
 -void VineManager::AddDataPath(int channel_id, std::string remote_uuid,
++                      VineManager::GetInst()
++                          .SetClientRecvCallback(dp, user_data);
+                     }, user_data);
+           }, user_data);
+       }, GINT_TO_POINTER(channel_id));
+   vine_session_start_discovery(info->GetSession(),
+       VINE_TEST_SERVICE_TYPE, nullptr);
+   info->SetIsDiscovering(true);
+   LOGI("start discovery");
+   return true;
+ }
 -  DataPathInfo dp_info(channel_id, remote_uuid, remote_channel_id, dp);
++std::shared_ptr<DataPathInfo> VineManager::AddDataPath(
++    int channel_id, std::string remote_uuid,
+     int remote_channel_id, vine_dp_h dp) {
+   LOGE("@@@ uuid (%s)(%p)", remote_uuid.c_str(), dp);
 -    if (channel_id != i.GetLocalChannelId())
++  std::shared_ptr<DataPathInfo> dp_info = std::make_shared<DataPathInfo>(
++        channel_id, remote_uuid, remote_channel_id, dp);
+   impl_->data_path_list_.push_back(dp_info);
++  return dp_info;
+ }
+ vine_dp_h VineManager::Impl::FindDataPath(int channel_id, std::string remote_uuid,
+       int remote_channel_id) {
+   for (auto& i : data_path_list_) {
 -    if (remote_channel_id != -1 && remote_channel_id != i.GetRemoteChannelId())
++    if (channel_id != i->GetLocalChannelId())
+       continue;
 -    if (remote_uuid.empty() == false && remote_uuid != i.GetRemoteUUID())
++    if (remote_channel_id != -1 && remote_channel_id != i->GetRemoteChannelId())
+       continue;
 -    return i.GetDataPath();
++    if (remote_uuid.empty() == false && remote_uuid != i->GetRemoteUUID())
+       continue;
 -void VineManager::RegisterSender(std::string service_name, int channel_id, std::shared_ptr<cion::PeerInfo> peer_info) {
 -   impl_->AddSenderInfo(service_name, channel_id, peer_info);
++    return i->GetDataPath();
+   }
+   return nullptr;
+ }
 -      int channel_id) {
++void VineManager::RegisterSender(std::string service_name,
++    int channel_id, std::shared_ptr<cion::PeerInfo> peer_info) {
++  impl_->AddSenderInfo(service_name, channel_id, peer_info);
+ }
+ void VineManager::UnregisterSender(int channel_id) {
+ }
+ void VineManager::Subscribe(int channel_id) {
+   std::shared_ptr<SessionInfo> info = GetSessionInfo(channel_id);
+   vine_dp_h dp;
+   vine_dp_create(info->GetSession(), VINE_DP_TYPE_PUBSUB, &dp);
+   vine_dp_set_address_family(dp, VINE_ADDRESS_FAMILY_IPV4);
+   vine_dp_set_port(dp, 0);
+   vine_dp_set_topic(dp, impl_->sender_list_[channel_id]->GetServiceName().c_str());
+   vine_dp_open(dp,
+       [] (vine_dp_h client_dp, vine_error_e result, void *user_data) -> void {
+         LOGI("@@@@@@@ dp open");
+         int channel_id = GPOINTER_TO_INT(user_data);
+         vine_dp_set_received_cb(client_dp,
+           [](vine_dp_h client_dp, size_t received_len, void *user_data) -> void {
+             int channel_id = GPOINTER_TO_INT(user_data);
+             unsigned char *data = new unsigned char[received_len];
+             size_t bytes;
+             vine_dp_recv(client_dp, data, received_len, &bytes);
+             LOGI("received_len bytes  %d %d ", received_len, bytes);
+             uint32_t size;
+             tizen_base::Parcel parcel(data, bytes);
+             delete[] data;
+             parcel.ReadUInt32(&size);
+             data = new unsigned char[size];
+             parcel.Read(data, size);
+             auto peer_info = std::make_shared<PeerInfo>(data, size);
+             delete[] data;
+             parcel.ReadUInt32(&size);
+             data = new unsigned char[size];
+             parcel.Read(data, size);
+             channel::IEventObserver* observer =
+                 VineManager::GetInst().GetObserver(channel_id);
+             observer->OnDataEvent(std::make_shared<DataInfo>(IDataInfo::MessageType::BroadCast),
+                 std::vector<char>(data, data + size), peer_info);
+             delete[] data;
+           }, user_data);
+         VineManager::GetInst().AddDataPath(channel_id, "", -1, client_dp);
+   }, GINT_TO_POINTER(channel_id));
+   LOGI("Subscribe done");
+ }
+ void VineManager::RegisterService(std::shared_ptr<SessionInfo> info, int port) {
+   info->SetPort(port);
+   vine_session_set_registered_cb(info->GetSession(), [] (
+       vine_session_h session, const char* service_name,
+       vine_error_e error, void* user_data) -> void {
+     LOGI("session registered");
+   }, nullptr);
+   vine_session_register(info->GetSession(), info->GetService(), nullptr);
+ }
+ std::shared_ptr<SessionInfo> VineManager::GetSessionInfo(
 -bool VineManager::IsDataPathExist(int channel_id, vine_dp_h dp) {
++    int channel_id) {
+   auto result = impl_->sessions_.find(channel_id);
+   if (result != impl_->sessions_.end())
+     return result->second;
+   LOGI("Not found try create new(%d)", channel_id);
+   vine_session_h session;
+   vine_session_create(&session);
+   int fd;
+   vine_session_get_event_fd(session, &fd);
+   g_unix_fd_add(fd,  G_IO_IN , [] (int fd, GIOCondition condition,
+     gpointer user_data) -> int {
+       LOGI("gio in!! %d", (int)condition);
+       vine_session_h session = static_cast<VineManager*>(user_data);
+       vine_session_process_event(session);
+       LOGI("process event done !!");
+       return G_SOURCE_CONTINUE;
+     }, session);
+   impl_->sessions_[channel_id] =
+       std::make_shared<SessionInfo>(channel_id, session);
+   LOGI("create session(%d) done !!", channel_id);
+   result = impl_->sessions_.find(channel_id);
+   return result->second;
+ }
+ void VineManager::SendPeerInfo(vine_dp_h dp) {
+   PeerInfo info;
+   std::vector<uint8_t> data = info.Serialize();
+   if (data.size() == 0) {
+     LOGE("fail to serialize peer info");
+     return;
+   }
+   auto* p = reinterpret_cast<unsigned char*>(&data[0]);
+   vine_dp_send(dp, p, data.size());
+   LOGW("send peerinfo %d", data.size());
+ }
++std::shared_ptr<DataPathInfo> VineManager::GetDataPathInfo(
++    int channel_id, vine_dp_h dp) {
++  for (auto& i : impl_->data_path_list_) {
++    if (i->GetLocalChannelId() == channel_id && i->GetDataPath() == dp)
++      return i;
++  }
++  return nullptr;
++}
 -    if (i.GetLocalChannelId() == channel_id && i.GetDataPath() == dp)
 -      return true;
++std::shared_ptr<DataPathInfo> VineManager::GetDataPathInfo(
++    int channel_id, std::shared_ptr<PeerInfo> peer_info) {
++  LOGI("Try Connect");
++  int remote_channel_id = peer_info->GetChannelID();
++  std::string remote_uuid = peer_info->GetUUID();
++  LOGI("data path cnt (%d)", impl_->data_path_list_.size());
+   for (auto& i : impl_->data_path_list_) {
 -  return false;
++    LOGI("%d, %d, %s", channel_id, remote_channel_id, remote_uuid.c_str());
++    LOGI("peer %d, %d, %s", i->GetLocalChannelId(),
++          i->GetRemoteChannelId(), i->GetRemoteUUID().c_str());
++    if (i->GetLocalChannelId() == channel_id &&
++        i->GetRemoteChannelId() == remote_channel_id &&
++        i->GetRemoteUUID() == remote_uuid) {
++      return i;
++    }
+   }
 -      vine_dp_h dp, vine_dp_h accepted_dp, void *user_data) -> void {
++  return nullptr;
++}
++
++void VineManager::Accept(int channel_id, std::shared_ptr<PeerInfo> peer_info) {
++  channel::IEventObserver* observer = GetObserver(channel_id);
++  if (observer == nullptr) {
++    LOGE("cannot find observer (%d)", channel_id);
++    return;
++  }
++
++  std::vector<unsigned char> u_serialized_peerinfo = peer_info->Serialize();
++  std::vector<char> serialized_peerinfo(
++      u_serialized_peerinfo.begin(), u_serialized_peerinfo.end());
++  observer->OnConnectionEvent(
++      std::make_shared<ConnectionInfo>(
++        IConnectionInfo::ConnectionType::Connected),
++        serialized_peerinfo);
++  std::shared_ptr<DataPathInfo> dpInfo = GetDataPathInfo(channel_id, peer_info);
++
++  vine_dp_h dp = dpInfo->GetDataPath();
++  char cmd[] = "__accept__";
++  std::vector<char> cmd_data(cmd, cmd + sizeof(cmd)/sizeof(*cmd));
++  DataPayload dpayload;
++  dpayload.SetData(cmd_data);
++  std::vector<char> serialized = dpayload.Serialize();
++  auto* p = reinterpret_cast<unsigned char*>(&serialized[0]);
++  vine_dp_send(dp, p, serialized.size());
++  LOGI("@@@@@@@@ send datapayload (%d)", serialized.size());
++
++  dpInfo->SetState(DataPathInfo::State::Connected);
++}
++
++void VineManager::Reject(int channel_id, std::shared_ptr<PeerInfo> peer_info) {
++  channel::IEventObserver* observer = GetObserver(channel_id);
++  if (observer == nullptr) {
++    LOGE("cannot find observer (%d)", channel_id);
++    return;
++  }
++
++  std::vector<unsigned char> u_serialized_peerinfo = peer_info->Serialize();
++  std::vector<char> serialized_peerinfo(
++      u_serialized_peerinfo.begin(), u_serialized_peerinfo.end());
++  observer->OnConnectionEvent(
++      std::make_shared<ConnectionInfo>(
++        IConnectionInfo::ConnectionType::Rejected),
++        serialized_peerinfo);
++  std::shared_ptr<DataPathInfo> dpInfo = GetDataPathInfo(channel_id, peer_info);
++
++  vine_dp_h dp = dpInfo->GetDataPath();
++  char cmd[] = "__reject__";
++  std::vector<char> cmd_data(cmd, cmd + sizeof(cmd)/sizeof(*cmd));
++  DataPayload dpayload;
++  dpayload.SetData(cmd_data);
++  std::vector<char> serialized = dpayload.Serialize();
++  auto* p = reinterpret_cast<unsigned char*>(&serialized[0]);
++  vine_dp_send(dp, p, serialized.size());
+ }
+ void VineManager::OpenServer(int channel_id) {
+   std::shared_ptr<SessionInfo> info = GetSessionInfo(channel_id);
+   vine_dp_h dp;
++
+   vine_dp_create(info->GetSession(), VINE_DP_TYPE_SERVER, &dp);
+   LOGI("create dp done");
+   vine_dp_set_accepted_cb(dp, [] (
 -    vine_dp_set_received_cb(accepted_dp,
++      vine_dp_h dp, vine_dp_h client_dp, void *user_data) -> void {
+     LOGW("accpeted");
 -        if (VineManager::GetInst().IsDataPathExist(channel_id, client_dp)) {
 -          // data recieved
++    vine_dp_set_received_cb(client_dp,
+       [](vine_dp_h client_dp, size_t received_len,
+           void *user_data) -> void {
+         int channel_id = GPOINTER_TO_INT(user_data);
 -
++        std::shared_ptr<DataPathInfo> dpInfo =
++            VineManager::GetInst().GetDataPathInfo(channel_id, client_dp);
++        if (dpInfo) {
++          if (dpInfo->GetState() == DataPathInfo::State::Connected) {
++            // data recieved
++          }
+         } else {    // connection request
+           channel::IEventObserver* observer =
+               VineManager::GetInst().GetObserver(channel_id);
+           if (observer == nullptr) {
+             LOGE("cannot find observer (%d)", channel_id);
+             return;
+           }
+           unsigned char buf[256] = {0, };
+           size_t bytes = 0;
++
+           LOGW("[RECV_CB] %p received %zd bytes.",
+                 client_dp, received_len);
+           vine_dp_recv(client_dp, buf, 256, &bytes);
 -          //impl_->AddDataPath(
 -          //    channel_id, p_info.GetUUID(), p_info.GetChannelID(), client_dp);
+           std::vector<char> serialized_peerinfo;
+           serialized_peerinfo.assign(buf, buf + bytes);
++
++          PeerInfo p_info(buf, bytes);
++          VineManager::GetInst().AddDataPath(
++              channel_id, p_info.GetUUID(), p_info.GetChannelID(), client_dp);
++
+           observer->OnConnectionEvent(
+               std::make_shared<ConnectionInfo>(
+                 IConnectionInfo::ConnectionType::ConnectionRequested),
+                 serialized_peerinfo);
 -    VineManager::GetInst().SendPeerInfo(accepted_dp);
+         }
+       }, user_data);
+     // send peer info to Client
 -    if (i.GetLocalChannelId() == channel_id &&
 -        i.GetRemoteChannelId() == remote_channel_id &&
 -        i.GetRemoteUUID() == remote_uuid) {
++    VineManager::GetInst().SendPeerInfo(client_dp);
+   }, GINT_TO_POINTER(channel_id));
+   LOGI("accepted callback add done");
+   vine_dp_set_port(dp, 0);
+   vine_dp_open(dp,
+       [] (vine_dp_h dp, vine_error_e result, void *user_data) -> void {
+         LOGW("Opened !!! %d", result);
+         int port;
+         int channel_id = GPOINTER_TO_INT(user_data);
+         vine_dp_get_port(dp, &port);
+         VineManager::GetInst().RegisterService(
+             VineManager::GetInst().GetSessionInfo(channel_id), port);
+       }, GINT_TO_POINTER(channel_id));
+ }
+ void VineManager::RegisterObserver(channel::IEventObserver* observer) {
+   int channel_id = observer->GetChannelId();
+   std::string service_name = observer->GetServiceName();
+   std::shared_ptr<SessionInfo> info = GetSessionInfo(channel_id);
+   vine_service_h service;
+   vine_service_create(&service);
+   vine_service_set_type(service, VINE_TEST_SERVICE_TYPE);
+   vine_service_set_name(service, service_name.c_str());
+   info->SetService(service);
+   impl_->observer_list_.push_back(observer);
+   LOGI("session register !! : %s", service_name.c_str());
+ }
+ void VineManager::UnregisterObserver(channel::IEventObserver* observer) {
+ }
+ void VineManager::Connect(int channel_id, std::shared_ptr<PeerInfo> peer_info) {
+   LOGI("Try Connect");
+   int remote_channel_id = peer_info->GetChannelID();
+   std::string remote_uuid = peer_info->GetUUID();
++  LOGI("data path cnt (%d)", impl_->data_path_list_.size());
+   for (auto& i : impl_->data_path_list_) {
 -      SendPeerInfo(i.GetDataPath());
++    LOGI("%d, %d, %s", channel_id, remote_channel_id, remote_uuid.c_str());
++    LOGI("peer %d, %d, %s", i->GetLocalChannelId(),
++          i->GetRemoteChannelId(), i->GetRemoteUUID().c_str());
++    if (i->GetLocalChannelId() == channel_id &&
++        i->GetRemoteChannelId() == remote_channel_id &&
++        i->GetRemoteUUID() == remote_uuid) {
+       LOGI("Peer info (%d -> %s:%d)",
+           channel_id, remote_uuid.c_str(), remote_channel_id);
 -      }
 -}
 -
 -/*
 -
 -enum ControlType {
 -    LISTEN,
 -    STOP,
 -    CONNECT,
 -    DISCONNECT,
 -    DISCOVERY,
 -    STOP_DISCOVERY
 -  };
 -
 -  enum ChannelType {
 -    COMMUNICATION,
 -    BROADCAST,
 -  };
 -
 -*/
++      SendPeerInfo(i->GetDataPath());
++      i->SetState(DataPathInfo::State::ConnectionRequested);
+       break;
+     }
+   }
+ }
+ void VineManager::SendDataAsync(const std::vector<char>& serialized_payload,
+     std::shared_ptr<channel::IDataInfo> info, int channel_id,
+     std::shared_ptr<PeerInfo> remote_peer_info) {
+   auto sender = impl_->GetSenderInfo(channel_id);
+   auto session = GetSessionInfo(channel_id);
+   auto datapath = impl_->FindDataPath(channel_id, "", -1);
+   if (info->GetType() == IDataInfo::MessageType::BroadCast) {
+     tizen_base::Parcel parcel;
+     std::vector<uint8_t> peer = sender->GetPeerInfo()->Serialize();
+     if (peer.size() == 0) {
+       LOGE("fail to serialize peer info");
+       return;
+     }
+     parcel.WriteUInt32(peer.size());
+     parcel.Write(peer.data(), peer.size());
+     parcel.WriteUInt32(serialized_payload.size());
+     parcel.Write(serialized_payload.data(), serialized_payload.size());
+     auto* p = reinterpret_cast<unsigned char*>(const_cast<uint8_t*>(parcel.GetRaw().data()));
+     vine_dp_send(datapath , p, parcel.GetRaw().size());
+     LOGW("send payload %d", parcel.GetRaw().size());
+   }
+ }
+ 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) {
+   if (info->GetChannelType() == IControlInfo::ChannelType::COMMUNICATION) {
+     switch (info->GetControlType()) {
+       case IControlInfo::ControlType::LISTEN :
+         OpenServer(channel_id);
+         break;
+       case IControlInfo::ControlType::STOP :
+         break;
+       case IControlInfo::ControlType::CONNECT :
+         Connect(channel_id, peer_info);
+         break;
+       case IControlInfo::ControlType::DISCONNECT :
+         break;
+       case IControlInfo::ControlType::DISCOVERY :
+         Discovery(channel_id);
+         break;
+       case IControlInfo::ControlType::STOP_DISCOVERY :
+         break;
+     }
+   } else if(info->GetChannelType() == IControlInfo::ChannelType::BROADCAST)
+     switch (info->GetControlType()) {
+       case IControlInfo::ControlType::LISTEN :
+         Subscribe(channel_id);
+         break;
+       case IControlInfo::ControlType::STOP :
+         break;
+       default :
+         break;
++    }
++  }
+ }  // namespace cion
index 0000000000000000000000000000000000000000,45908e04ae4c73004bc9499c2d84b8bb7082720d..be1e2e951988659441a8a74dfa93f483c26849f4
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,100 +1,110 @@@
 - * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ /*
 -
++ * 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 <vine.h>
+ #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"
 -      void AddDataPath(int channel_id, std::string remote_uuid,
 -      int remote_channel_id, vine_dp_h dp);
++#include "data_path_info.hh"
+ #include "session_info.hh"
++
+ #ifndef EXPORT_API
+ #define EXPORT_API __attribute__((visibility("default")))
+ #endif
+ namespace cion {
+ class ConnectionInfo : public channel::IConnectionInfo {
+  public:
+   explicit ConnectionInfo(
+         channel::IConnectionInfo::ConnectionType connection_type)
+     : connection_type_(connection_type) {
+   }
+   channel::IConnectionInfo::ConnectionType GetConnectionType() const override {
+     return connection_type_;
+   }
+   std::string GetUUID() const override {
+     return "";
+   }
+  private:
+   channel::IConnectionInfo::ConnectionType connection_type_;
+ };
+ class EXPORT_API VineManager {
+  public:
+   static VineManager& GetInst();
++  std::shared_ptr<DataPathInfo> AddDataPath(int channel_id,
++      std::string remote_uuid, int remote_channel_id, vine_dp_h dp);
+   void RegisterSender(std::string service_name, int channel_id, std::shared_ptr<cion::PeerInfo> peer_info);
 -  bool IsDataPathExist(int channel_id, vine_dp_h dp);
+   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 RegisterService(std::shared_ptr<SessionInfo> info, int port);
+   bool Discovery(int channel_id);
+   void OpenServer(int channel_id);
+   channel::IEventObserver* GetObserver(int channel_id);
+   std::shared_ptr<SessionInfo> GetSessionInfo(int channel_id);
+   void SendPeerInfo(vine_dp_h dp);
+   void Connect(int channel_id, std::shared_ptr<PeerInfo> peer_info);
++  void Accept(int channel_id, std::shared_ptr<PeerInfo> peer_info);
++  void Reject(int channel_id, std::shared_ptr<PeerInfo> peer_info);
++  std::shared_ptr<DataPathInfo> GetDataPathInfo(int channel_id, vine_dp_h dp);
++  std::shared_ptr<DataPathInfo> GetDataPathInfo(
++      int channel_id, std::shared_ptr<PeerInfo> peer_info);
+   void Subscribe(int channel_id);
++  void SetClientRecvCallback(vine_dp_h client_dp, void* user_data);
++  void HandlingDiscoveredPeer(vine_dp_h dp, size_t received_len,
++      int channel_id, channel::IEventObserver* observer);
++  void HandlingConnReqResp(vine_dp_h dp, size_t received_len, int channel_id,
++      std::shared_ptr<DataPathInfo> dp_info, channel::IEventObserver* observer);
+   VineManager();
+  private:
+   virtual ~VineManager();
+   int Init();
+  private:
+   class Impl;
+   std::unique_ptr<Impl> impl_;
+ };
+ }   // namespace cion
+ #endif  // CION_VINE_MANAGER_VINE_MANAGER_HH_
index 0000000000000000000000000000000000000000,ac013181b664ff54a462c715c1244ce2ffd535f1..fa1789c13a14cda7442052bafd22f55f54b184fc
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,112 +1,82 @@@
 - * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ /*
 -class DataPathInfo {
 - public:
 -  explicit DataPathInfo(int local, std::string remote_uuid,
 -      int remote_channel, vine_dp_h dp)
 -    : local_channel_id_(local), remote_uuid_(remote_uuid),
 -      remote_channel_id_(remote_channel), dp_(dp) {
 -  }
 -
 -  int GetLocalChannelId() {
 -    return local_channel_id_;
 -  }
 -
 -  int GetRemoteChannelId() {
 -    return remote_channel_id_;
 -  }
 -
 -  std::string GetRemoteUUID() {
 -    return remote_uuid_;
 -  }
 -
 -  vine_dp_h GetDataPath() {
 -    return dp_;
 -  }
 -
 - private:
 -  int local_channel_id_;
 -  std::string remote_uuid_;
 -  int remote_channel_id_;
 -  vine_dp_h dp_;
 -};
 -
++ * 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 VINE_MANAGER_VINE_MANAGER_IMPLEMENTATION_HH_
+ #define VINE_MANAGER_VINE_MANAGER_IMPLEMENTATION_HH_
+ #include<string>
+ #include<list>
+ #include<map>
+ #include<memory>
+ #include "cion/common/peer_info.hh"
+ #include "session_info.hh"
+ #include "cion/channel/ievent_observer.hh"
++#include "data_path_info.hh"
+ namespace cion {
+ class SenderInfo {
+  public:
+   SenderInfo(std::string service_name, int channel_id, std::shared_ptr<PeerInfo> peer_info) {
+     service_name_ = service_name;
+     channel_id_ = channel_id;
+     peer_info_ = peer_info;
+   }
+   std::string GetServiceName() {
+     return  service_name_;
+   }
+   std::shared_ptr<PeerInfo> GetPeerInfo() {
+     return  peer_info_;
+   }
+   int GetChannelId() {
+     return channel_id_;
+   }
+  private:
+   std::string service_name_;
+   int channel_id_;
+   std::shared_ptr<PeerInfo> peer_info_;
+ };
 -  std::list<DataPathInfo> data_path_list_;
+ class VineManager::Impl {
+  public:
+   virtual ~Impl();
+   void AddSenderInfo(std::string service_name, int channel_id,
+       std::shared_ptr<PeerInfo> peer_info);
+   bool ValidateSender(std::string service_name);
+   std::shared_ptr<SenderInfo> GetSenderInfo(int channel_id);
+   vine_dp_h FindDataPath(int channel_id, std::string remote_uuid,
+       int remote_channel_id);
+  private:
+   friend class VineManager;
+   Impl();
+  private:
+   std::map<int, std::shared_ptr<SessionInfo>> sessions_;
+   std::map<int, std::shared_ptr<SenderInfo>> sender_list_;
+   std::list<channel::IEventObserver*> observer_list_;
++  std::list<std::shared_ptr<DataPathInfo>> data_path_list_;
+   int port_;
+ };
+ }   // namespace cion
+ #endif  // VINE_MANAGER_VINE_MANAGER_IMPLEMENTATION_HH_
index 0000000000000000000000000000000000000000,fa4c4375d56d189f8eb10b03d68e6ca80e361397..4874362d03f515053c5b8f3e38b272291415b243
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,68 +1,77 @@@
 -void VineSender::OperateChannel(std::shared_ptr<channel::IControlInfo> info,
 -    std::shared_ptr<PeerInfo> remote_peer_info) {
 -   VineManager::GetInst().OperateChannel(impl_->channel_id_, info, remote_peer_info);
 -}
 -
+ /*
+  * 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, std::shared_ptr<PeerInfo> peer_info)
+   : impl_(new Impl(service_name, channel_id, peer_info)) {
+ }
+ VineSender::~VineSender() {
+ }
+ VineSender::Impl::Impl(std::string service_name, int channel_id, std::shared_ptr<PeerInfo> peer_info)
+     : service_name_(service_name), channel_id_(channel_id), peer_info_(peer_info) {
+   port_ = 0;
+   peer_info->SetChannelID(channel_id);
+   VineManager::GetInst().RegisterSender(service_name, channel_id, peer_info);
+ }
+ VineSender::Impl::~Impl() {
+   VineManager::GetInst().UnregisterSender(channel_id_);
+ }
++void VineSender::OperateChannel(
++  std::shared_ptr<channel::IControlInfo> info,
++  std::shared_ptr<PeerInfo> peer_info) {
++  VineManager::GetInst().OperateChannel(impl_->channel_id_, info, peer_info);
++}
++
++void VineSender::Accept(std::shared_ptr<PeerInfo> peer_info) {
++  VineManager::GetInst().Accept(impl_->channel_id_, peer_info);
++}
++
++void VineSender::Reject(std::shared_ptr<PeerInfo> peer_info) {
++  VineManager::GetInst().Reject(impl_->channel_id_, peer_info);
++}
++
+ void VineSender::SendDataAsync(const std::vector<char>& serialized_payload,
+     std::shared_ptr<channel::IDataInfo> info,
+     std::shared_ptr<PeerInfo> remote_peer_info) {
+     VineManager::GetInst().SendDataAsync(serialized_payload, info, impl_->channel_id_, remote_peer_info);
+ }
+ std::vector<char> VineSender::SendData(
+     const std::vector<char>& serialized_payload,
+     std::shared_ptr<channel::IDataInfo> info,
+     std::shared_ptr<PeerInfo> remote_peer_info, int timeout) {
+   return {};
+ }
+ void VineSender::SetSecurity(SecurityInfo sec) {
+ }
+ }   // namespace cion
index 0000000000000000000000000000000000000000,94fa2cdc62ce4e74a3cbe511782cf59d9e10a2d2..e9ef84af09aaee62a3a3970fc664d1b98d75eeb6
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,60 +1,62 @@@
+ /*
+  * 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, std::shared_ptr<PeerInfo> peer_info);
+   virtual ~VineSender();
+  protected:
+   void SendDataAsync(const std::vector<char>& serialized_payload,
+       std::shared_ptr<channel::IDataInfo> info,
+       std::shared_ptr<PeerInfo> remote_peer_info) override;
+   std::vector<char> SendData(const std::vector<char>& serialized_payload,
+       std::shared_ptr<channel::IDataInfo> info,
+       std::shared_ptr<PeerInfo> remote_peer_info, int timeout) override;
+   void OperateChannel(std::shared_ptr<channel::IControlInfo> info,
+       std::shared_ptr<PeerInfo> remote_peer_info) override;
+   void SetSecurity(SecurityInfo sec) override;
++  void Accept(std::shared_ptr<PeerInfo> peer_info) override;
++  void Reject(std::shared_ptr<PeerInfo> peer_info) override;
+  private:
+   class Impl;
+   std::unique_ptr<Impl> impl_;
+ };
+ }   // namespace cion
+ #endif  // CION_VINE_MANAGER_VINE_SENDER_HH_