My Project
3.2.0
C++ Distributed Hash Table
Loading...
Searching...
No Matches
include
opendht
node_export.h
1
/*
2
* Copyright (C) 2014-2023 Savoir-faire Linux Inc.
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 3 of the License, or
7
* (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <https://www.gnu.org/licenses/>.
16
*/
17
#pragma once
18
19
#include "def.h"
20
#include "infohash.h"
21
#include "sockaddr.h"
22
23
#include <string_view>
24
25
namespace
dht
{
26
using namespace
std::literals;
27
28
struct
OPENDHT_PUBLIC
NodeExport
{
29
InfoHash
id;
30
SockAddr
addr;
31
32
template
<
typename
Packer>
33
void
msgpack_pack(Packer& pk)
const
34
{
35
pk.pack_map(2);
36
pk.pack(
"id"
sv);
37
pk.pack(
id
);
38
pk.pack(
"addr"
sv);
39
pk.pack_bin(addr.
getLength
());
40
pk.pack_bin_body((
const
char
*)addr.
get
(), (
size_t
)addr.
getLength
());
41
}
42
43
void
msgpack_unpack(msgpack::object o);
44
45
OPENDHT_PUBLIC
friend
std::ostream& operator<< (std::ostream& s,
const
NodeExport
& h);
46
};
47
48
}
dht::Hash< HASH_LEN >
dht::SockAddr
Definition
sockaddr.h:62
dht::SockAddr::get
const sockaddr * get() const
Definition
sockaddr.h:223
dht::SockAddr::getLength
socklen_t getLength() const
Definition
sockaddr.h:210
dht
Definition
callbacks.h:35
dht::NodeExport
Definition
node_export.h:28
Generated on Sun Oct 6 2024 07:38:54 for My Project by
1.10.0