2018-07-11 13:20:14 +00:00
|
|
|
#ifndef LLARP_SERVICE_ADDRESS_HPP
|
|
|
|
#define LLARP_SERVICE_ADDRESS_HPP
|
|
|
|
#include <llarp/aligned.hpp>
|
2018-07-12 13:43:37 +00:00
|
|
|
#include <llarp/dht/key.hpp>
|
2018-07-11 13:20:14 +00:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace llarp
|
|
|
|
{
|
|
|
|
namespace service
|
|
|
|
{
|
2018-07-12 13:43:37 +00:00
|
|
|
struct Address : public llarp::AlignedBuffer< 32 >
|
|
|
|
{
|
|
|
|
std::string
|
|
|
|
ToString() const;
|
2018-07-11 13:20:14 +00:00
|
|
|
|
2018-07-12 13:43:37 +00:00
|
|
|
Address() : llarp::AlignedBuffer< 32 >()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Address(const byte_t* data) : llarp::AlignedBuffer< 32 >(data)
|
|
|
|
{
|
|
|
|
}
|
2018-07-12 18:21:44 +00:00
|
|
|
struct Hash
|
|
|
|
{
|
|
|
|
size_t
|
|
|
|
operator()(const Address& addr) const
|
|
|
|
{
|
|
|
|
size_t idx = 0;
|
|
|
|
memcpy(&idx, addr, sizeof(idx));
|
|
|
|
return idx;
|
|
|
|
}
|
|
|
|
};
|
2018-07-12 13:43:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace service
|
|
|
|
} // namespace llarp
|
2018-07-11 13:20:14 +00:00
|
|
|
|
|
|
|
#endif
|