From 8a058fcb3491dcbd63dbc61ee021c117933ff78e Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 15 Jun 2019 15:55:14 +0100 Subject: [PATCH] Move other messages --- llarp/CMakeLists.txt | 6 +- llarp/messages/path_latency.cpp | 58 ------------------ llarp/messages/relay_commit.cpp | 3 +- llarp/path/path.cpp | 2 +- llarp/path/transit_hop.cpp | 4 +- llarp/routing/message_parser.cpp | 6 +- llarp/{messages => routing}/path_confirm.cpp | 2 +- llarp/{messages => routing}/path_confirm.hpp | 0 llarp/routing/path_latency.cpp | 59 ++++++++++++++++++- llarp/{messages => routing}/path_latency.hpp | 0 llarp/{messages => routing}/path_transfer.cpp | 2 +- llarp/{messages => routing}/path_transfer.hpp | 0 llarp/service/endpoint.cpp | 2 +- llarp/service/sendcontext.cpp | 4 +- llarp/service/sendcontext.hpp | 4 +- 15 files changed, 76 insertions(+), 76 deletions(-) delete mode 100644 llarp/messages/path_latency.cpp rename llarp/{messages => routing}/path_confirm.cpp (97%) rename llarp/{messages => routing}/path_confirm.hpp (100%) rename llarp/{messages => routing}/path_latency.hpp (100%) rename llarp/{messages => routing}/path_transfer.cpp (97%) rename llarp/{messages => routing}/path_transfer.hpp (100%) diff --git a/llarp/CMakeLists.txt b/llarp/CMakeLists.txt index f74c741c1..4d92f19f9 100644 --- a/llarp/CMakeLists.txt +++ b/llarp/CMakeLists.txt @@ -180,9 +180,6 @@ set(LIB_SRC messages/link_intro.cpp messages/link_message_parser.cpp messages/link_message.cpp - messages/path_confirm.cpp - messages/path_latency.cpp - messages/path_transfer.cpp messages/relay.cpp messages/relay_commit.cpp net/address_info.cpp @@ -207,6 +204,9 @@ set(LIB_SRC routing/handler.cpp routing/message_parser.cpp routing/message.cpp + routing/path_confirm.cpp + routing/path_latency.cpp + routing/path_transfer.cpp routing/transfer_traffic.cpp rpc/rpc.cpp service/address.cpp diff --git a/llarp/messages/path_latency.cpp b/llarp/messages/path_latency.cpp deleted file mode 100644 index c4ea1e541..000000000 --- a/llarp/messages/path_latency.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include - -#include -#include - -namespace llarp -{ - namespace routing - { - PathLatencyMessage::PathLatencyMessage() - { - } - - bool - PathLatencyMessage::DecodeKey(const llarp_buffer_t& key, - llarp_buffer_t* val) - { - bool read = false; - if(!BEncodeMaybeReadDictInt("L", L, read, key, val)) - return false; - if(!BEncodeMaybeReadDictInt("S", S, read, key, val)) - return false; - if(!BEncodeMaybeReadDictInt("T", T, read, key, val)) - return false; - return read; - } - - bool - PathLatencyMessage::BEncode(llarp_buffer_t* buf) const - { - if(!bencode_start_dict(buf)) - return false; - if(!BEncodeWriteDictMsgType(buf, "A", "L")) - return false; - if(L) - { - if(!BEncodeWriteDictInt("L", L, buf)) - return false; - } - if(T) - { - if(!BEncodeWriteDictInt("T", T, buf)) - return false; - } - if(!BEncodeWriteDictInt("S", S, buf)) - return false; - return bencode_end(buf); - } - - bool - PathLatencyMessage::HandleMessage(IMessageHandler* h, - AbstractRouter* r) const - { - return h && h->HandlePathLatencyMessage(*this, r); - } - - } // namespace routing -} // namespace llarp diff --git a/llarp/messages/relay_commit.cpp b/llarp/messages/relay_commit.cpp index 853956463..dd3c3cc8b 100644 --- a/llarp/messages/relay_commit.cpp +++ b/llarp/messages/relay_commit.cpp @@ -1,16 +1,15 @@ #include #include -#include #include #include #include +#include #include #include #include #include #include -#include #include diff --git a/llarp/path/path.cpp b/llarp/path/path.cpp index 57e002936..91abfaa24 100644 --- a/llarp/path/path.cpp +++ b/llarp/path/path.cpp @@ -2,13 +2,13 @@ #include #include -#include #include #include #include #include #include #include +#include #include #include #include diff --git a/llarp/path/transit_hop.cpp b/llarp/path/transit_hop.cpp index 532dbeb23..bed3973ca 100644 --- a/llarp/path/transit_hop.cpp +++ b/llarp/path/transit_hop.cpp @@ -4,12 +4,12 @@ #include #include #include -#include -#include #include #include #include #include +#include +#include #include #include #include diff --git a/llarp/routing/message_parser.cpp b/llarp/routing/message_parser.cpp index b6e421769..47aa38045 100644 --- a/llarp/routing/message_parser.cpp +++ b/llarp/routing/message_parser.cpp @@ -2,11 +2,11 @@ #include #include -#include -#include -#include #include #include +#include +#include +#include #include #include diff --git a/llarp/messages/path_confirm.cpp b/llarp/routing/path_confirm.cpp similarity index 97% rename from llarp/messages/path_confirm.cpp rename to llarp/routing/path_confirm.cpp index 3875b06c5..b020f061a 100644 --- a/llarp/messages/path_confirm.cpp +++ b/llarp/routing/path_confirm.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/llarp/messages/path_confirm.hpp b/llarp/routing/path_confirm.hpp similarity index 100% rename from llarp/messages/path_confirm.hpp rename to llarp/routing/path_confirm.hpp diff --git a/llarp/routing/path_latency.cpp b/llarp/routing/path_latency.cpp index 6556762ce..54975e1c5 100644 --- a/llarp/routing/path_latency.cpp +++ b/llarp/routing/path_latency.cpp @@ -1 +1,58 @@ -#include +#include + +#include +#include + +namespace llarp +{ + namespace routing + { + PathLatencyMessage::PathLatencyMessage() + { + } + + bool + PathLatencyMessage::DecodeKey(const llarp_buffer_t& key, + llarp_buffer_t* val) + { + bool read = false; + if(!BEncodeMaybeReadDictInt("L", L, read, key, val)) + return false; + if(!BEncodeMaybeReadDictInt("S", S, read, key, val)) + return false; + if(!BEncodeMaybeReadDictInt("T", T, read, key, val)) + return false; + return read; + } + + bool + PathLatencyMessage::BEncode(llarp_buffer_t* buf) const + { + if(!bencode_start_dict(buf)) + return false; + if(!BEncodeWriteDictMsgType(buf, "A", "L")) + return false; + if(L) + { + if(!BEncodeWriteDictInt("L", L, buf)) + return false; + } + if(T) + { + if(!BEncodeWriteDictInt("T", T, buf)) + return false; + } + if(!BEncodeWriteDictInt("S", S, buf)) + return false; + return bencode_end(buf); + } + + bool + PathLatencyMessage::HandleMessage(IMessageHandler* h, + AbstractRouter* r) const + { + return h && h->HandlePathLatencyMessage(*this, r); + } + + } // namespace routing +} // namespace llarp diff --git a/llarp/messages/path_latency.hpp b/llarp/routing/path_latency.hpp similarity index 100% rename from llarp/messages/path_latency.hpp rename to llarp/routing/path_latency.hpp diff --git a/llarp/messages/path_transfer.cpp b/llarp/routing/path_transfer.cpp similarity index 97% rename from llarp/messages/path_transfer.cpp rename to llarp/routing/path_transfer.cpp index 030de0291..ff718f4c5 100644 --- a/llarp/messages/path_transfer.cpp +++ b/llarp/routing/path_transfer.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/llarp/messages/path_transfer.hpp b/llarp/routing/path_transfer.hpp similarity index 100% rename from llarp/messages/path_transfer.hpp rename to llarp/routing/path_transfer.hpp diff --git a/llarp/service/endpoint.cpp b/llarp/service/endpoint.cpp index 35ef45806..059dd5974 100644 --- a/llarp/service/endpoint.cpp +++ b/llarp/service/endpoint.cpp @@ -5,11 +5,11 @@ #include #include #include -#include #include #include #include #include +#include #include #include #include diff --git a/llarp/service/sendcontext.cpp b/llarp/service/sendcontext.cpp index f83fc7f77..fe1134d98 100644 --- a/llarp/service/sendcontext.cpp +++ b/llarp/service/sendcontext.cpp @@ -1,8 +1,8 @@ #include -#include -#include #include +#include +#include #include namespace llarp diff --git a/llarp/service/sendcontext.hpp b/llarp/service/sendcontext.hpp index 73e6f3c19..3d87e0c14 100644 --- a/llarp/service/sendcontext.hpp +++ b/llarp/service/sendcontext.hpp @@ -1,11 +1,13 @@ #ifndef LLARP_SERVICE_SENDCONTEXT_HPP #define LLARP_SERVICE_SENDCONTEXT_HPP -#include + #include +#include #include #include #include #include + #include namespace llarp