My Project: /home/noptrix/ba/blackarch/packages/opendht-c/src/opendht/include/opendht/node_export.h Source File

My Project 3.7.7 C++ Distributed Hash Table

Loading...
Searching...
No Matches
node_export.h
1// Copyright (c) 2014-2026 Savoir-faire Linux Inc.
2// SPDX-License-Identifier: MIT
3#pragma once
4
5#include "def.h"
6#include "infohash.h"
7#include "sockaddr.h"
8
9#include <string_view>
10
11namespace dht {
12using namespace std::literals;
13
14 struct OPENDHT_PUBLIC NodeExport
15{
16 InfoHash id;
17 SockAddr addr;
18
19 template<typename Packer>
20 void msgpack_pack(Packer& pk) const
21 {
22 pk.pack_map(2);
23 pk.pack("id"sv);
24 pk.pack(id);
25 pk.pack("addr"sv);
26 pk.pack_bin(addr.getLength());
27 pk.pack_bin_body((const char*) addr.get(), (size_t) addr.getLength());
28 }
29
30 void msgpack_unpack(msgpack::object o);
31
32 OPENDHT_PUBLIC friend std::ostream& operator<<(std::ostream& s, const NodeExport& h);
33};
34
35} // namespace dht
dht::SockAddr
Definition sockaddr.h:47
dht
Definition callbacks.h:17
dht::NodeExport
Definition node_export.h:15