return nullptr;
}
+void VineManager::SetSecurity(SecurityInfo sec, int channel_id) {
+ vine_dp_h dp = nullptr;
+ vine_security_h vs = nullptr;
+
+ for (auto& i : impl_->data_path_list_) {
+ if (channel_id != i->GetLocalChannelId()) {
+ dp = i->GetDataPath();
+ break;
+ }
+ }
+
+ if (dp == nullptr) {
+ LOGE("No vine data path for %d", channel_id);
+ return;
+ }
+
+ int ret = vine_security_create(&vs);
+ if (ret != VINE_ERROR_NONE) {
+ LOGE("vine_security_create error %d" , ret);
+ return;
+ }
+
+ ret = vine_security_set_ca_path(vs, sec.GetCaPath().c_str());
+ if (ret != VINE_ERROR_NONE) {
+ LOGE("vine_security_set_ca_path error %d" , ret);
+ vine_security_destroy(vs);
+ return;
+ }
+
+ ret = vine_security_set_cert_path(vs, sec.GetCertPath().c_str());
+ if (ret != VINE_ERROR_NONE) {
+ LOGE("vine_security_set_cert_path error %d" , ret);
+ vine_security_destroy(vs);
+ return;
+ }
+
+ ret = vine_security_set_private_key(vs, sec.GetPrivatePath().c_str());
+ if (ret != VINE_ERROR_NONE) {
+ LOGE("vine_security_set_private_key error %d" , ret);
+ vine_security_destroy(vs);
+ return;
+ }
+
+ //TODO
+ //vine_security_set_type
+ //vine_security_set_tls_version
+ //vine_security_set_verification_flags
+ //vine_security_set_psk
+
+ ret = vine_dp_set_security(dp, vs);
+ if (ret != VINE_ERROR_NONE)
+ LOGE("vine_dp_set_security error %d" , ret);
+
+ LOGD("Success for set security");
+ vine_security_destroy(vs);
+}
+
void VineManager::HandlingDiscoveredPeer(vine_dp_h dp, size_t received_len,
int channel_id, channel::IEventObserver* observer) {
unsigned char buf[256] = {0, };
#include "cion/common/peer_info.hh"
#include "cion/channel/idata_info.hh"
#include "cion/channel/icontrol_info.hh"
+#include "cion/security/security_info.hh"
#include "data_path_info.hh"
#include "session_info.hh"
void OpenServer(int channel_id);
channel::IEventObserver* GetObserver(int channel_id);
std::shared_ptr<SessionInfo> GetSessionInfo(int channel_id);
+ void SetSecurity(SecurityInfo sec, 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);