Add skeleton codes for channel interface
authorInkyun Kil <inkyun.kil@samsung.com>
Fri, 8 Jan 2021 01:27:45 +0000 (10:27 +0900)
committerInkyun Kil <inkyun.kil@samsung.com>
Fri, 8 Jan 2021 01:39:24 +0000 (10:39 +0900)
Signed-off-by: Inkyun Kil <inkyun.kil@samsung.com>
19 files changed:
cion/CMakeLists.txt
cion/channel/BroadcastChannel.cc [new file with mode: 0755]
cion/channel/BroadcastChannel.h [new file with mode: 0755]
cion/channel/ClientChannel.cc [new file with mode: 0755]
cion/channel/ClientChannel.h [new file with mode: 0755]
cion/channel/IConnectionInfo.cc [new file with mode: 0755]
cion/channel/IConnectionInfo.h [new file with mode: 0755]
cion/channel/IControlInfo.cc [new file with mode: 0755]
cion/channel/IControlInfo.h [new file with mode: 0755]
cion/channel/IDataInfo.cc [new file with mode: 0755]
cion/channel/IDataInfo.h [new file with mode: 0755]
cion/channel/IEventListener.cc [new file with mode: 0755]
cion/channel/IEventListener.h [new file with mode: 0755]
cion/channel/IEventObserver.h [new file with mode: 0755]
cion/channel/IEventSender.cc [new file with mode: 0755]
cion/channel/IEventSender.h [new file with mode: 0755]
cion/channel/SecurityInfo.h [new file with mode: 0644]
cion/channel/ServerChannel.cc [new file with mode: 0755]
cion/channel/ServerChannel.h [new file with mode: 0755]

index 133358fd914cdd594fe03874371297c0a0cc56b5..edc02697037e1597115b0b3869c9f21f5e681eb8 100644 (file)
@@ -27,8 +27,9 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../)
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/tizen-api/)
 
 AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/common/ COMMON_SOURCES)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/channel/ CHANNEL_SOURCES)
 AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/tizen-api/ SOURCES)
-ADD_LIBRARY (${PROJECT_NAME} SHARED ${SOURCES} ${COMMON_SOURCES})
+ADD_LIBRARY (${PROJECT_NAME} SHARED ${SOURCES} ${COMMON_SOURCES} ${CHANNEL_SOURCES})
 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${FULLVER})
 SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${MAJORVER})
 
diff --git a/cion/channel/BroadcastChannel.cc b/cion/channel/BroadcastChannel.cc
new file mode 100755 (executable)
index 0000000..baaf8d3
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * 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 "BroadcastChannel.h"
+
+/**
+ * BroadcastChannel implementation
+ */
+
+namespace cion_channel {
+
+
+BroadcastChannel::BroadcastChannel(std::string& topic, IEventSender* sender,
+    IEventListener* listener) : sender_(sender), listener_(listener) {
+
+}
+
+void BroadcastChannel::Subscribe() {
+
+}
+
+void BroadcastChannel::Unsubscribe() {
+
+}
+
+void BroadcastChannel::SendMessage(std::vector<char> message) {
+
+}
+
+void BroadcastChannel::OnDataEvent(IDataInfo info, std::vector<char> data) {
+
+}
+
+void BroadcastChannel::OnConnectionEvent(IConnectionInfo info, std::vector<char> serialized_peerInfo) {
+
+}
+
+std::string BroadcastChannel::GetServiceName() {
+  return "";
+}
+
+std::string BroadcastChannel::GetUUID() {
+  return "";
+}
+
+} //namespace cion_channel
diff --git a/cion/channel/BroadcastChannel.h b/cion/channel/BroadcastChannel.h
new file mode 100755 (executable)
index 0000000..597edcd
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ */
+
+#ifndef __CION_BROADCASTCHANNEL_H__
+#define __CION_BROADCASTCHANNEL_H__
+
+#include <string>
+#include <vector>
+
+#include "IEventObserver.h"
+#include "IEventListener.h"
+#include "IEventSender.h"
+#include "../common/peer_info.h"
+
+using namespace cion_common;
+
+namespace cion_channel {
+
+class BroadcastChannel: public IEventObserver {
+public:
+  BroadcastChannel(std::string& topic, IEventSender* sender,
+      IEventListener* listener);
+  void Subscribe();
+  void Unsubscribe();
+  void SendMessage(std::vector<char> message);
+
+protected:
+  virtual void OnMessageReceived(std::string data, PeerInfo peer) = 0;
+  void OnDataEvent(IDataInfo info,
+      std::vector<char> serialized_payload) override;
+  void OnConnectionEvent(IConnectionInfo info,
+      std::vector<char> serialized_peerinfo) override;
+  std::string GetServiceName() override;
+  std::string GetUUID() override;
+
+private:
+  IEventSender* sender_;
+  IEventListener* listener_;
+};
+
+} //namespace cion_channel
+
+#endif //__CION_BROADCASTCHANNEL_H__
diff --git a/cion/channel/ClientChannel.cc b/cion/channel/ClientChannel.cc
new file mode 100755 (executable)
index 0000000..cacc09c
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * 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 "ClientChannel.h"
+
+/**
+ * ClientChannel implementation
+ */
+
+namespace cion_channel {
+
+
+ClientChannel::ClientChannel(std::string& service_name, IEventSender* sender,
+    IEventListener* listener) : sender_(sender), listener_(listener) {
+
+}
+
+void ClientChannel::TryDiscovery() {
+
+}
+
+void ClientChannel::StopDiscovery() {
+
+}
+
+void ClientChannel::Connect(PeerInfo peer) {
+
+}
+
+void ClientChannel::Disconnect() {
+
+}
+
+std::vector<char> ClientChannel::SendData(std::vector<char> data, int timeout) {
+  return {};
+}
+
+void ClientChannel::SendPayLoadAsync(IPayLoad data) {
+
+}
+
+std::unique_ptr<PeerInfo> ClientChannel::GetPeerInfo() {
+  return {};
+}
+
+void ClientChannel::OnDataEvent(IDataInfo info, std::vector<char> data) {
+
+}
+
+void ClientChannel::OnConnectionEvent(IConnectionInfo info,
+    std::vector<char> serialized_peerInfo) {
+
+}
+
+std::string ClientChannel::GetServiceName() {
+  return "";
+}
+
+std::string ClientChannel::GetUUID() {
+  return "";
+}
+
+} //namespace cion_channel
diff --git a/cion/channel/ClientChannel.h b/cion/channel/ClientChannel.h
new file mode 100755 (executable)
index 0000000..4f4ce1c
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+
+#ifndef __CION_CLIENTCHANNEL_H__
+#define __CION_CLIENTCHANNEL_H__
+
+#include <string>
+#include <memory>
+#include <vector>
+
+#include "IEventObserver.h"
+#include "IEventListener.h"
+#include "IEventSender.h"
+#include "SecurityInfo.h"
+#include "../common/peer_info.h"
+
+using namespace cion_common;
+
+namespace cion_channel {
+
+class ClientChannel: public IEventObserver {
+public:
+  ClientChannel(std::string& service_name, IEventSender* sender,
+      IEventListener* listener);
+  void TryDiscovery();
+  void StopDiscovery();
+  void Connect(PeerInfo peer);
+  void Disconnect();
+  std::vector<char> SendData(std::vector<char> data, int timeout);
+  void SendPayLoadAsync(IPayLoad data);
+  std::unique_ptr<PeerInfo> GetPeerInfo();
+  void SetSecurity(SecurityInfo sec);
+
+protected:
+  virtual void OnConnentionStatusChaneged(PeerInfo peer,
+      ConnectionStatus status) = 0;
+  virtual std::vector<char> OnDataReceived(std::vector<char> data) = 0;
+  virtual void OnPayloadReceived(IPayLoad data) = 0;
+  virtual void OnErrorReported(int code, PeerInfo peer) = 0;
+  virtual void OnDiscovered(PeerInfo peer) = 0;
+
+  void OnDataEvent(IDataInfo info,
+      std::vector<char> serialized_payload) override;
+  void OnConnectionEvent(IConnectionInfo info,
+      std::vector<char> serialized_peerinfo) override;
+  std::string GetServiceName() override;
+  std::string GetUUID() override;
+
+private:
+  IEventSender* sender_;
+  IEventListener* listener_;
+};
+
+} //namespace cion_channel
+
+#endif //__CION_CLIENTCHANNEL_H__
diff --git a/cion/channel/IConnectionInfo.cc b/cion/channel/IConnectionInfo.cc
new file mode 100755 (executable)
index 0000000..32a9b6b
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * 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 "IConnectionInfo.h"
+
+/**
+ * IConnectionInfo implementation
+ */
+
+namespace cion_channel {
+
+int IConnectionInfo::GetConnectionType() {
+    return 0;
+}
+
+std::string IConnectionInfo::GetUUID() {
+    return "";
+}
+
+} //namespace cion_channel
diff --git a/cion/channel/IConnectionInfo.h b/cion/channel/IConnectionInfo.h
new file mode 100755 (executable)
index 0000000..8b93385
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+#ifndef __CION_ICONNECTIONINFO_H__
+#define __CION_ICONNECTIONINFO_H__
+
+#include <string>
+
+namespace cion_channel {
+
+enum class ConnectionStatus {
+  ONLINE,
+  OFFLINE,
+};
+
+class IConnectionInfo {
+ public:
+  int GetConnectionType();
+  std::string GetUUID();
+};
+
+} //namespace cion_channel
+
+#endif //__CION_ICONNECTIONINFO_H__
diff --git a/cion/channel/IControlInfo.cc b/cion/channel/IControlInfo.cc
new file mode 100755 (executable)
index 0000000..810036c
--- /dev/null
@@ -0,0 +1,34 @@
+
+/*
+ * 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 "IControlInfo.h"
+
+/**
+ * IControlInfo implementation
+ */
+
+namespace cion_channel {
+
+int IControlInfo::GetControlType() {
+    return 0;
+}
+
+int IControlInfo::GetChannelType() {
+    return 0;
+}
+
+} //namespace cion_channel
diff --git a/cion/channel/IControlInfo.h b/cion/channel/IControlInfo.h
new file mode 100755 (executable)
index 0000000..8c3dedd
--- /dev/null
@@ -0,0 +1,31 @@
+
+/*
+ * 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.
+ */
+
+#ifndef __CION_ICONTROLINFO_H__
+#define __CION_ICONTROLINFO_H__
+
+namespace cion_channel {
+
+class IControlInfo {
+ public:
+  int GetControlType();
+  int GetChannelType();
+};
+
+} //namespace cion_channel
+
+#endif //__CION_ICONTROLINFO_H__
diff --git a/cion/channel/IDataInfo.cc b/cion/channel/IDataInfo.cc
new file mode 100755 (executable)
index 0000000..22b9335
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * 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 "IDataInfo.h"
+
+/**
+ * IDataInfo implementation
+ */
+
+namespace cion_channel {
+
+int IDataInfo::GetType() {
+  return 0;
+}
+
+std::string IDataInfo::GetUUID() {
+  return "";
+}
+
+} //namespace cion_channel
diff --git a/cion/channel/IDataInfo.h b/cion/channel/IDataInfo.h
new file mode 100755 (executable)
index 0000000..1013b25
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+#ifndef _IDATAINFO_H
+#define _IDATAINFO_H
+
+#include <string>
+
+namespace cion_channel {
+
+class IDataInfo {
+ public:
+  int GetType();
+  std::string GetUUID();
+};
+
+} //namespace cion_channel
+
+#endif //_IDATAINFO_H
diff --git a/cion/channel/IEventListener.cc b/cion/channel/IEventListener.cc
new file mode 100755 (executable)
index 0000000..bb5ad7a
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * 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 "IEventListener.h"
+
+
+/**
+ * Channel.IEventListener implementation
+ */
+
+namespace cion_channel {
+
+void IEventListener::RegisteObserver(IEventObserver* observer) {
+
+}
+
+
+void IEventListener::UnregisteObserver(IEventObserver* observer) {
+
+}
+
+} //namespace cion_channel
diff --git a/cion/channel/IEventListener.h b/cion/channel/IEventListener.h
new file mode 100755 (executable)
index 0000000..2d6c63d
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+#ifndef __CION_IEVENTLISTENER_H__
+#define __CION_IEVENTLISTENER_H__
+
+#include "IEventObserver.h"
+
+namespace cion_channel {
+
+class IEventListener {
+public:
+  void RegisteObserver(IEventObserver* observer);
+  void UnregisteObserver(IEventObserver* observer);
+};
+
+} //namespace cion_channel
+
+#endif //__CION_IEVENTLISTENER_H__
diff --git a/cion/channel/IEventObserver.h b/cion/channel/IEventObserver.h
new file mode 100755 (executable)
index 0000000..fb93f32
--- /dev/null
@@ -0,0 +1,47 @@
+
+/*
+ * 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.
+ */
+
+#ifndef __CION_IEVENTOBSERVER_H__
+#define __CION_IEVENTOBSERVER_H__
+
+#include <string>
+#include <vector>
+
+#include "IConnectionInfo.h"
+#include "IDataInfo.h"
+
+namespace cion_channel {
+
+class IEventObserver {
+ public:
+
+  virtual void OnDataEvent(IDataInfo info,
+      std::vector<char> serialized_payload) = 0;
+
+  virtual void OnConnectionEvent(IConnectionInfo info,
+      std::vector<char> serialized_peerinfo) = 0;
+
+  virtual std::string GetServiceName() = 0;
+  virtual std::string GetUUID() = 0;
+};
+
+class IPayLoad{
+};
+
+} //namespace cion_channel
+
+#endif //__CION_IEVENTOBSERVER_H__
diff --git a/cion/channel/IEventSender.cc b/cion/channel/IEventSender.cc
new file mode 100755 (executable)
index 0000000..14644a6
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * 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 "IEventSender.h"
+
+/**
+ * Channel.IEventSender implementation
+ */
+
+namespace cion_channel {
+
+void IEventSender::SendDataAsync(std::vector<char> data, IDataInfo info) {
+
+}
+
+void IEventSender::SendData(std::vector<char> data, IDataInfo info, std::string uuid) {
+
+}
+
+int IEventSender::OperateChannel(IControlInfo info, std::string uuid) {
+  return 0;
+}
+
+} //namespace cion_channel
diff --git a/cion/channel/IEventSender.h b/cion/channel/IEventSender.h
new file mode 100755 (executable)
index 0000000..679fb25
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+#ifndef __CION_IEVENTSENDER_H__
+#define __CION_IEVENTSENDER_H__
+
+#include <string>
+#include <vector>
+
+#include "IDataInfo.h"
+#include "IControlInfo.h"
+#include "SecurityInfo.h"
+
+namespace cion_channel {
+
+class IEventSender {
+ public:
+  virtual void SendDataAsync(std::vector<char> data, IDataInfo info);
+  virtual void SendData(std::vector<char> data, IDataInfo info, std::string uuid);
+  virtual int OperateChannel(IControlInfo info, std::string uuid);
+  void SetSecurity(SecurityInfo sec);
+};
+
+} //namespace cion_channel
+
+
+#endif //__CION_IEVENTSENDER_H__
diff --git a/cion/channel/SecurityInfo.h b/cion/channel/SecurityInfo.h
new file mode 100644 (file)
index 0000000..cb6d691
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+#ifndef _SECURITY_INFO_H
+#define _SECURITY_INFO_H
+
+#include <string>
+
+namespace cion_channel {
+
+class SecurityInfo {
+ public:
+  void SetCaPath(std::string path);
+  void SetCertPath(std::string path);
+  void SetPrivatePath(std::string path);
+  std::string GetCaPath();
+  std::string GetCertPath();
+  std::string GetPrivatePath();
+};
+
+} //namespace cion_channel
+
+
+#endif //_SECURITY_INFO_H
diff --git a/cion/channel/ServerChannel.cc b/cion/channel/ServerChannel.cc
new file mode 100755 (executable)
index 0000000..c095a6a
--- /dev/null
@@ -0,0 +1,76 @@
+
+/*
+ * 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 "ServerChannel.h"
+
+/**
+ * ServerChannel implementation
+ */
+
+namespace cion_channel {
+
+ServerChannel::ServerChannel(std::string& service_name, IEventSender* sender,
+    IEventListener* listener) : sender_(sender), listener_(listener) {
+
+}
+
+void ServerChannel::Listen() {
+
+}
+
+void ServerChannel::Stop() {
+
+}
+
+void ServerChannel::Disconnect(PeerInfo peer) {
+
+}
+
+std::vector<char> ServerChannel::SendData(std::vector<char> data, PeerInfo peer,
+    int timeout) {
+  return {};
+}
+
+void ServerChannel::SendPayLoadAsync(IPayLoad data) {
+
+}
+
+void ServerChannel::SendPayLoadAsync(IPayLoad data, PeerInfo peer) {
+
+}
+
+std::list<PeerInfo> ServerChannel::GetConnectedPeerList() {
+  return {};
+}
+
+void ServerChannel::OnDataEvent(IDataInfo info, std::vector<char> data) {
+
+}
+
+void ServerChannel::OnConnectionEvent(IConnectionInfo info, std::vector<char> serialized_peerInfo) {
+
+}
+
+std::string ServerChannel::GetServiceName() {
+  return "";
+}
+
+std::string ServerChannel::GetUUID() {
+  return "";
+}
+
+} //namespace cion_channel
diff --git a/cion/channel/ServerChannel.h b/cion/channel/ServerChannel.h
new file mode 100755 (executable)
index 0000000..041c682
--- /dev/null
@@ -0,0 +1,71 @@
+
+/*
+ * 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.
+ */
+
+#ifndef __CION_SERVERCHANNEL_H__
+#define __CION_SERVERCHANNEL_H__
+
+#include <string>
+#include <vector>
+#include <list>
+
+#include "IEventObserver.h"
+#include "IEventSender.h"
+#include "IEventListener.h"
+#include "SecurityInfo.h"
+#include "../common/peer_info.h"
+
+using namespace cion_common;
+
+namespace cion_channel {
+
+class ServerChannel: public IEventObserver {
+ public:
+  ServerChannel(std::string& service_name, IEventSender* sender,
+      IEventListener* listener);
+  void Listen();
+  void Stop();
+  void Disconnect(PeerInfo peer);
+  std::vector<char> SendData(std::vector<char> data, PeerInfo peer, int timeout);
+  void SendPayLoadAsync(IPayLoad data);
+  void SendPayLoadAsync(IPayLoad data, PeerInfo peer);
+  std::list<PeerInfo> GetConnectedPeerList();
+  void SetSecurity(SecurityInfo sec);
+
+ protected:
+  virtual void OnConnentionStatusChaneged(PeerInfo peer,
+      ConnectionStatus status) = 0;
+  virtual std::vector<char> OnDataReceived(std::vector<char> data,
+      PeerInfo peer) = 0;
+  virtual void OnPayloadReceived(IPayLoad data, PeerInfo peer) = 0;
+  virtual bool OnConnentionRequest(PeerInfo peer) = 0;
+  virtual void OnErrorReported(int code, PeerInfo peer) = 0;
+
+  void OnDataEvent(IDataInfo info,
+      std::vector<char> serialized_payload) override;
+  void OnConnectionEvent(IConnectionInfo info,
+      std::vector<char> serialized_peerinfo) override;
+  std::string GetServiceName() override;
+  std::string GetUUID() override;
+
+private:
+  IEventSender* sender_;
+  IEventListener* listener_;
+};
+
+} //namespace cion_channel
+
+#endif //__CION_SERVERCHANNEL_H__