Start of tunnel request handling.

This commit is contained in:
Ian Gulliver
2015-02-07 16:04:40 -08:00
parent 578615a99e
commit 6fc6070d5f
4 changed files with 20 additions and 0 deletions

View File

@@ -302,11 +302,24 @@ void CryptoPubServerConnection::OnHandshake(const TLVNode& decoded) {
bool CryptoPubServerConnection::OnMessage(const TLVNode& message) {
switch (message.GetType()) {
case TLV_TYPE_TUNNEL_REQUEST:
return OnTunnelRequest(message);
default:
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() {
auto handshake = BuildSecureHandshake();
std::string out;

View File

@@ -80,6 +80,7 @@ class CryptoPubServerConnection : public CryptoPubConnBase {
private:
void OnHandshake(const TLVNode& decoded);
bool OnMessage(const TLVNode& node);
bool OnTunnelRequest(const TLVNode& node);
static void OnError_(struct bufferevent* bev, const short what, void* this__);
void OnError(const short what);

5
tlv.cc
View File

@@ -105,3 +105,8 @@ const std::string& TLVNode::GetValue() const {
assert(!this->IsContainer());
return value_;
}
const std::list<TLVNode*>& TLVNode::GetChildren() const {
assert(this->IsContainer());
return children_;
}

1
tlv.h
View File

@@ -18,6 +18,7 @@ class TLVNode {
bool IsContainer() const;
uint16_t GetType() const;
const std::string& GetValue() const;
const std::list<TLVNode*>& GetChildren() const;
private:
const uint16_t type_;