summaryrefslogtreecommitdiff
path: root/src/ipcpd/unicast/dir/dht.proto
blob: ea74805f97ee2631c36a92ba355a46da23344f2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * Ouroboros - Copyright (C) 2016 - 2024
 *
 * DHT protocol, based on Kademlia
 *
 *    Dimitri Staessens <dimitri@ouroboros.rocks>
 *    Sander Vrijders   <sander@ouroboros.rocks>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * version 2.1 as published by the Free Software Foundation.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., http://www.fsf.org/about/contact/.
 */

syntax = "proto2";

message dht_contact_msg {
        required bytes  id   = 1;
        required uint64 addr = 2;
}

message dht_find_req_msg {
        required uint64 cookie = 1;
        required bytes key     = 2;
}

message dht_find_node_rsp_msg {
        required uint64          cookie   = 1;
        required bytes           key      = 2;
        repeated dht_contact_msg contacts = 3;
}

message dht_find_value_rsp_msg {
        repeated bytes values = 1;
}

message dht_store_msg {
        required bytes  key = 1;
        required bytes  val = 2;
        required uint32 exp = 3;
}

message dht_msg {
        required uint32                 code  = 1;
        required dht_contact_msg        src   = 2;
        optional dht_store_msg          store = 3;
        optional dht_find_req_msg       find  = 4;
        optional dht_find_node_rsp_msg  node  = 5;
        optional dht_find_value_rsp_msg val   = 6;
}