Start of tunnel request handling.
This commit is contained in:
13
crypto.cc
13
crypto.cc
@@ -302,11 +302,24 @@ void CryptoPubServerConnection::OnHandshake(const TLVNode& decoded) {
|
|||||||
|
|
||||||
bool CryptoPubServerConnection::OnMessage(const TLVNode& message) {
|
bool CryptoPubServerConnection::OnMessage(const TLVNode& message) {
|
||||||
switch (message.GetType()) {
|
switch (message.GetType()) {
|
||||||
|
case TLV_TYPE_TUNNEL_REQUEST:
|
||||||
|
return OnTunnelRequest(message);
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CryptoPubServerConnection::OnTunnelRequest(const TLVNode& message) {
|
||||||
|
Log() << "New tunnel request" << std::endl;
|
||||||
|
for (auto child : message.GetChildren()) {
|
||||||
|
if (child->GetType() != TLV_TYPE_CHANNEL) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Log() << "Channel" << std::endl;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void CryptoPubServerConnection::SendHandshake() {
|
void CryptoPubServerConnection::SendHandshake() {
|
||||||
auto handshake = BuildSecureHandshake();
|
auto handshake = BuildSecureHandshake();
|
||||||
std::string out;
|
std::string out;
|
||||||
|
|||||||
1
crypto.h
1
crypto.h
@@ -80,6 +80,7 @@ class CryptoPubServerConnection : public CryptoPubConnBase {
|
|||||||
private:
|
private:
|
||||||
void OnHandshake(const TLVNode& decoded);
|
void OnHandshake(const TLVNode& decoded);
|
||||||
bool OnMessage(const TLVNode& node);
|
bool OnMessage(const TLVNode& node);
|
||||||
|
bool OnTunnelRequest(const TLVNode& node);
|
||||||
|
|
||||||
static void OnError_(struct bufferevent* bev, const short what, void* this__);
|
static void OnError_(struct bufferevent* bev, const short what, void* this__);
|
||||||
void OnError(const short what);
|
void OnError(const short what);
|
||||||
|
|||||||
5
tlv.cc
5
tlv.cc
@@ -105,3 +105,8 @@ const std::string& TLVNode::GetValue() const {
|
|||||||
assert(!this->IsContainer());
|
assert(!this->IsContainer());
|
||||||
return value_;
|
return value_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::list<TLVNode*>& TLVNode::GetChildren() const {
|
||||||
|
assert(this->IsContainer());
|
||||||
|
return children_;
|
||||||
|
}
|
||||||
|
|||||||
1
tlv.h
1
tlv.h
@@ -18,6 +18,7 @@ class TLVNode {
|
|||||||
bool IsContainer() const;
|
bool IsContainer() const;
|
||||||
uint16_t GetType() const;
|
uint16_t GetType() const;
|
||||||
const std::string& GetValue() const;
|
const std::string& GetValue() const;
|
||||||
|
const std::list<TLVNode*>& GetChildren() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const uint16_t type_;
|
const uint16_t type_;
|
||||||
|
|||||||
Reference in New Issue
Block a user