|
GNUnet
GNU’s decentralized anonymous and censorship-resistant P2P framework. |
|
||
A DISCOVERY message is used to let another peer know that the sender supports the DHT protocol and also to exchange topology information. A DISCOVERY message contains the amount of space available for the DHT at the sender as well as the identities of other DHT participants known to the sender. The format of the DISCOVERY message is the following:
| P2P_DHT_Discovery | ||||
|---|---|---|---|---|
| Offset | Bit position | |||
| 0-7 | 8-15 | 16-23 | 24-31 | |
| 0 | message size (8 + N * 64)(NBO) | request type (18,NBO) | ||
| 4 | available space (in bytes)(NBO) | |||
| 8 | known DHT participants | |||
ASK HELLO messages are used by DHT peers if they would like to contact another peer in the network but do not have the necessary address information. If possible, other peers respond to ASK HELLO messages with the respective HELLO message. The format of the ASK HELLO message is the following:
| P2P_DHT_ASK_HELLO | ||||
|---|---|---|---|---|
| Offset | Bit position | |||
| 0-7 | 8-15 | 16-23 | 24-31 | |
| 0 | message size (72,NBO) | request type (19,NBO) | ||
| 4 | resreved (0,NBO) | |||
| 8 | identity of peer | |||
A DHT_GET message is used to ask other peers to find content matching a particular type and key. Other peers should respond with the respective DHT RESULT message if they can find the data.
| DHT_MESSAGE | ||||
|---|---|---|---|---|
| Offset | Bit position | |||
| 0-7 | 8-15 | 16-23 | 24-31 | |
| 0 | message size (80,NBO) | request type (20,NBO) | ||
| 4 | type of requested content(NBO) | |||
| 8 | hop count(NBO) | |||
| 12 | network size estimate(NBO) | |||
| 16 | key | |||
A DHT PUT message is used to store data in the DHT. Peers should make an effort to store the data either in their own datastore or in the datastore of other peers (by forwarding the request). Peers do not send any response or confirmation to a DHT PUT request. Peers can validate the success of a PUT by issuing the corresponding GET request and wainting for results.
| DHT_MESSAGE | ||||
|---|---|---|---|---|
| Offset | Bit position | |||
| 0-7 | 8-15 | 16-23 | 24-31 | |
| 0 | message size (80 + X)(NBO) | request type (21,NBO) | ||
| 4 | type of requested content(NBO) | |||
| 8 | hop count(NBO) | |||
| 12 | network size estimate(NBO) | |||
| 16 | key | |||
| 80 | data(NBO) | |||
| 0-7 | 8-15 | 16-23 | 24-31 | |
A DHT RESULT message is transmitted in response to a DHT GET request. Peers should forward the result to the previous peer in the request chain (or the respective local client for local requests). Peers do not send any response or confirmation to a DHT RESULT request.
| DHT_MESSAGE | ||||
|---|---|---|---|---|
| Offset | Bit position | |||
| 0-7 | 8-15 | 16-23 | 24-31 | |
| 0 | message size (80 + X)(NBO) | request type (22,NBO) | ||
| 4 | type of requested content(NBO) | |||
| 8 | hop count(NBO) | |||
| 12 | network size estimate(NBO) | |||
| 16 | key | |||
| 80 | result data(NBO) | |||
| 0-7 | 8-15 | 16-23 | 24-31 | |
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Christian Grothoff. Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.
Translation engine based on i18nHTML (C) 2003, 2004, 2005, 2006, 2007 Christian Grothoff.
Fields of this type are in network byte order. Before reading these fields, they must be converted to host byte order using htons for 2-byte values, htonl for 4-byte values and htonll for 8-byte values. Before writing to these fields, the value must be converted using ntohs, ntohl and ntohll respectively.