Move address_info.hpp to llarp/

pull/137/head
Michael 6 years ago
parent e76d49e92c
commit f51384f92e
No known key found for this signature in database
GPG Key ID: 2D51757B47E2434C

@ -1,12 +1,13 @@
#ifndef LLARP_NET_HPP #ifndef LLARP_NET_HPP
#define LLARP_NET_HPP #define LLARP_NET_HPP
#include <llarp/address_info.hpp> #include <address_info.hpp>
#include <llarp/net.h>
#include <functional>
#include "logger.hpp" #include "logger.hpp"
#include "mem.hpp" #include "mem.hpp"
#include <llarp/string_view.hpp> #include <llarp/net.h>
#include <llarp/net_int.hpp> #include <llarp/net_int.hpp>
#include <llarp/string_view.hpp>
#include <functional>
#include <vector> #include <vector>
#include <stdlib.h> // for itoa #include <stdlib.h> // for itoa

@ -1,11 +1,11 @@
#ifndef LLARP_NET_ADDR_HPP #ifndef LLARP_NET_ADDR_HPP
#define LLARP_NET_ADDR_HPP #define LLARP_NET_ADDR_HPP
#include <string> #include <address_info.hpp>
#include <llarp/net.h> #include <llarp/net.h>
#include <llarp/address_info.hpp> #include <llarp/net.hpp>
#include <llarp/string_view.hpp> #include <llarp/string_view.hpp>
#include <llarp/net.hpp> #include <string>
namespace llarp namespace llarp
{ {

@ -1,8 +1,9 @@
#ifndef LLARP_RC_HPP #ifndef LLARP_RC_HPP
#define LLARP_RC_HPP #define LLARP_RC_HPP
#include <llarp/address_info.hpp> #include <address_info.hpp>
#include <llarp/crypto.h>
#include <llarp/bencode.hpp> #include <llarp/bencode.hpp>
#include <llarp/crypto.h>
#include <llarp/exit_info.hpp> #include <llarp/exit_info.hpp>
#include <vector> #include <vector>

@ -1,4 +1,4 @@
#include <llarp/address_info.hpp> #include <address_info.hpp>
#ifndef _WIN32 #ifndef _WIN32
#include <arpa/inet.h> #include <arpa/inet.h>
#endif #endif
@ -25,17 +25,17 @@ namespace llarp
} }
bool bool
AddressInfo::operator==(const AddressInfo &other) const operator==(const AddressInfo& lhs, const AddressInfo& rhs)
{ {
// we don't care about rank // we don't care about rank
return pubkey == other.pubkey && port == other.port return lhs.pubkey == rhs.pubkey && lhs.port == rhs.port
&& dialect == other.dialect && ip == other.ip; && lhs.dialect == rhs.dialect && lhs.ip == rhs.ip;
} }
bool bool
AddressInfo::operator<(const AddressInfo &other) const operator<(const AddressInfo& lhs, const AddressInfo& rhs)
{ {
return rank < other.rank || ip < other.ip || port < other.port; return lhs.rank < rhs.rank || lhs.ip < rhs.ip || lhs.port < rhs.port;
} }
bool bool

@ -48,12 +48,6 @@ namespace llarp
AddressInfo& AddressInfo&
operator=(const AddressInfo& other); operator=(const AddressInfo& other);
bool
operator==(const AddressInfo& other) const;
bool
operator<(const AddressInfo& other) const;
bool bool
BEncode(llarp_buffer_t* buf) const override; BEncode(llarp_buffer_t* buf) const override;
@ -84,6 +78,13 @@ namespace llarp
}; };
}; };
bool
operator==(const AddressInfo& lhs, const AddressInfo& rhs);
bool
operator<(const AddressInfo& lhs, const AddressInfo& rhs);
} // namespace llarp } // namespace llarp
#endif #endif
Loading…
Cancel
Save