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.
17 * @file dht/gnunet-service-dht.h
18 * @brief GNUnet DHT globals
19 * @author Christian Grothoff
21 #ifndef GNUNET_SERVICE_DHT_H
22 #define GNUNET_SERVICE_DHT_H
24 #include "gnunet_util_lib.h"
25 #include "gnunet_statistics_service.h"
26 #include "gnunet_transport_service.h"
27 #include "gnunet_block_lib.h"
29 #define DEBUG_DHT GNUNET_EXTRA_LOGGING
32 * Configuration we use.
34 extern const struct GNUNET_CONFIGURATION_Handle *GDS_cfg;
37 * Handle for the service.
39 extern struct GNUNET_SERVICE_Handle *GDS_service;
42 * Our handle to the BLOCK library.
44 extern struct GNUNET_BLOCK_Context *GDS_block_context;
47 * Handle for the statistics service.
49 extern struct GNUNET_STATISTICS_Handle *GDS_stats;
54 extern struct GNUNET_MessageHeader *GDS_my_hello;
59 * Handle a reply we've received from another peer. If the reply
60 * matches any of our pending queries, forward it to the respective
63 * @param expiration when will the reply expire
64 * @param key the query this reply is for
65 * @param get_path_length number of peers in @a get_path
66 * @param get_path path the reply took on get
67 * @param put_path_length number of peers in @a put_path
68 * @param put_path path the reply took on put
69 * @param type type of the reply
70 * @param data_size number of bytes in @a data
71 * @param data application payload data
74 GDS_CLIENTS_handle_reply (struct GNUNET_TIME_Absolute expiration,
75 const struct GNUNET_HashCode *key,
76 unsigned int get_path_length,
77 const struct GNUNET_PeerIdentity *get_path,
78 unsigned int put_path_length,
79 const struct GNUNET_PeerIdentity *put_path,
80 enum GNUNET_BLOCK_Type type,
86 * Check if some client is monitoring GET messages and notify
89 * @param options Options, for instance RecordRoute, DemultiplexEverywhere.
90 * @param type The type of data in the request.
91 * @param hop_count Hop count so far.
92 * @param path_length number of entries in path (or 0 if not recorded).
93 * @param path peers on the GET path (or NULL if not recorded).
94 * @param desired_replication_level Desired replication level.
95 * @param key Key of the requested data.
98 GDS_CLIENTS_process_get (uint32_t options,
99 enum GNUNET_BLOCK_Type type,
101 uint32_t desired_replication_level,
102 unsigned int path_length,
103 const struct GNUNET_PeerIdentity *path,
104 const struct GNUNET_HashCode *key);
108 * Check if some client is monitoring GET RESP messages and notify
111 * @param type The type of data in the result.
112 * @param get_path Peers on GET path (or NULL if not recorded).
113 * @param get_path_length number of entries in @a get_path.
114 * @param put_path peers on the PUT path (or NULL if not recorded).
115 * @param put_path_length number of entries in @a get_path.
116 * @param exp Expiration time of the data.
117 * @param key Key of the @a data.
118 * @param data Pointer to the result data.
119 * @param size Number of bytes in @a data.
122 GDS_CLIENTS_process_get_resp (enum GNUNET_BLOCK_Type type,
123 const struct GNUNET_PeerIdentity *get_path,
124 unsigned int get_path_length,
125 const struct GNUNET_PeerIdentity *put_path,
126 unsigned int put_path_length,
127 struct GNUNET_TIME_Absolute exp,
128 const struct GNUNET_HashCode * key,
134 * Check if some client is monitoring PUT messages and notify
137 * @param options Options, for instance RecordRoute, DemultiplexEverywhere.
138 * @param type The type of data in the request.
139 * @param hop_count Hop count so far.
140 * @param path_length number of entries in path (or 0 if not recorded).
141 * @param path peers on the PUT path (or NULL if not recorded).
142 * @param desired_replication_level Desired replication level.
143 * @param exp Expiration time of the data.
144 * @param key Key under which data is to be stored.
145 * @param data Pointer to the data carried.
146 * @param size Number of bytes in data.
149 GDS_CLIENTS_process_put (uint32_t options,
150 enum GNUNET_BLOCK_Type type,
152 uint32_t desired_replication_level,
153 unsigned int path_length,
154 const struct GNUNET_PeerIdentity *path,
155 struct GNUNET_TIME_Absolute exp,
156 const struct GNUNET_HashCode *key,