2 This file is part of GNUnet.
3 Copyright (C) 2009-2016 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * @file dht/gnunet-service-dht.h
21 * @brief GNUnet DHT globals
22 * @author Christian Grothoff
24 #ifndef GNUNET_SERVICE_DHT_H
25 #define GNUNET_SERVICE_DHT_H
27 #include "gnunet_util_lib.h"
28 #include "gnunet_statistics_service.h"
29 #include "gnunet_transport_service.h"
30 #include "gnunet_block_lib.h"
32 #define DEBUG_DHT GNUNET_EXTRA_LOGGING
35 * Configuration we use.
37 extern const struct GNUNET_CONFIGURATION_Handle *GDS_cfg;
40 * Handle for the service.
42 extern struct GNUNET_SERVICE_Handle *GDS_service;
45 * Our handle to the BLOCK library.
47 extern struct GNUNET_BLOCK_Context *GDS_block_context;
50 * Handle for the statistics service.
52 extern struct GNUNET_STATISTICS_Handle *GDS_stats;
57 extern struct GNUNET_MessageHeader *GDS_my_hello;
62 * Handle a reply we've received from another peer. If the reply
63 * matches any of our pending queries, forward it to the respective
66 * @param expiration when will the reply expire
67 * @param key the query this reply is for
68 * @param get_path_length number of peers in @a get_path
69 * @param get_path path the reply took on get
70 * @param put_path_length number of peers in @a put_path
71 * @param put_path path the reply took on put
72 * @param type type of the reply
73 * @param data_size number of bytes in @a data
74 * @param data application payload data
77 GDS_CLIENTS_handle_reply (struct GNUNET_TIME_Absolute expiration,
78 const struct GNUNET_HashCode *key,
79 unsigned int get_path_length,
80 const struct GNUNET_PeerIdentity *get_path,
81 unsigned int put_path_length,
82 const struct GNUNET_PeerIdentity *put_path,
83 enum GNUNET_BLOCK_Type type,
89 * Check if some client is monitoring GET messages and notify
92 * @param options Options, for instance RecordRoute, DemultiplexEverywhere.
93 * @param type The type of data in the request.
94 * @param hop_count Hop count so far.
95 * @param path_length number of entries in path (or 0 if not recorded).
96 * @param path peers on the GET path (or NULL if not recorded).
97 * @param desired_replication_level Desired replication level.
98 * @param key Key of the requested data.
101 GDS_CLIENTS_process_get (uint32_t options,
102 enum GNUNET_BLOCK_Type type,
104 uint32_t desired_replication_level,
105 unsigned int path_length,
106 const struct GNUNET_PeerIdentity *path,
107 const struct GNUNET_HashCode *key);
111 * Check if some client is monitoring GET RESP messages and notify
114 * @param type The type of data in the result.
115 * @param get_path Peers on GET path (or NULL if not recorded).
116 * @param get_path_length number of entries in @a get_path.
117 * @param put_path peers on the PUT path (or NULL if not recorded).
118 * @param put_path_length number of entries in @a get_path.
119 * @param exp Expiration time of the data.
120 * @param key Key of the @a data.
121 * @param data Pointer to the result data.
122 * @param size Number of bytes in @a data.
125 GDS_CLIENTS_process_get_resp (enum GNUNET_BLOCK_Type type,
126 const struct GNUNET_PeerIdentity *get_path,
127 unsigned int get_path_length,
128 const struct GNUNET_PeerIdentity *put_path,
129 unsigned int put_path_length,
130 struct GNUNET_TIME_Absolute exp,
131 const struct GNUNET_HashCode * key,
137 * Check if some client is monitoring PUT messages and notify
140 * @param options Options, for instance RecordRoute, DemultiplexEverywhere.
141 * @param type The type of data in the request.
142 * @param hop_count Hop count so far.
143 * @param path_length number of entries in path (or 0 if not recorded).
144 * @param path peers on the PUT path (or NULL if not recorded).
145 * @param desired_replication_level Desired replication level.
146 * @param exp Expiration time of the data.
147 * @param key Key under which data is to be stored.
148 * @param data Pointer to the data carried.
149 * @param size Number of bytes in data.
152 GDS_CLIENTS_process_put (uint32_t options,
153 enum GNUNET_BLOCK_Type type,
155 uint32_t desired_replication_level,
156 unsigned int path_length,
157 const struct GNUNET_PeerIdentity *path,
158 struct GNUNET_TIME_Absolute exp,
159 const struct GNUNET_HashCode *key,