diff options
Diffstat (limited to 'src/dht/gnunet-service-dht.h')
-rw-r--r-- | src/dht/gnunet-service-dht.h | 218 |
1 files changed, 0 insertions, 218 deletions
diff --git a/src/dht/gnunet-service-dht.h b/src/dht/gnunet-service-dht.h deleted file mode 100644 index a1513fcce..000000000 --- a/src/dht/gnunet-service-dht.h +++ /dev/null | |||
@@ -1,218 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2009-2016 GNUnet e.V. | ||
4 | |||
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. | ||
9 | |||
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. | ||
14 | |||
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/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file dht/gnunet-service-dht.h | ||
23 | * @brief GNUnet DHT globals | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | #ifndef GNUNET_SERVICE_DHT_H | ||
27 | #define GNUNET_SERVICE_DHT_H | ||
28 | |||
29 | #include "gnunet-service-dht_datacache.h" | ||
30 | #include "gnunet-service-dht_neighbours.h" | ||
31 | #include "gnunet_statistics_service.h" | ||
32 | #include "gnunet_transport_service.h" | ||
33 | |||
34 | |||
35 | #define DEBUG_DHT GNUNET_EXTRA_LOGGING | ||
36 | |||
37 | /** | ||
38 | * Information we keep per underlay. | ||
39 | */ | ||
40 | struct GDS_Underlay; | ||
41 | |||
42 | /** | ||
43 | * Configuration we use. | ||
44 | */ | ||
45 | extern const struct GNUNET_CONFIGURATION_Handle *GDS_cfg; | ||
46 | |||
47 | /** | ||
48 | * Handle for the service. | ||
49 | */ | ||
50 | extern struct GNUNET_SERVICE_Handle *GDS_service; | ||
51 | |||
52 | /** | ||
53 | * Our handle to the BLOCK library. | ||
54 | */ | ||
55 | extern struct GNUNET_BLOCK_Context *GDS_block_context; | ||
56 | |||
57 | /** | ||
58 | * Handle for the statistics service. | ||
59 | */ | ||
60 | extern struct GNUNET_STATISTICS_Handle *GDS_stats; | ||
61 | |||
62 | /** | ||
63 | * Our HELLO builder. | ||
64 | */ | ||
65 | extern struct GNUNET_HELLO_Builder *GDS_my_hello; | ||
66 | |||
67 | /** | ||
68 | * Identity of this peer. | ||
69 | */ | ||
70 | extern struct GNUNET_PeerIdentity GDS_my_identity; | ||
71 | |||
72 | /** | ||
73 | * Hash of the identity of this peer. | ||
74 | */ | ||
75 | extern struct GNUNET_HashCode GDS_my_identity_hash; | ||
76 | |||
77 | /** | ||
78 | * Our private key. | ||
79 | */ | ||
80 | extern struct GNUNET_CRYPTO_EddsaPrivateKey GDS_my_private_key; | ||
81 | |||
82 | |||
83 | /** | ||
84 | * Ask all underlays to connect to peer @a pid at @a address. | ||
85 | * | ||
86 | * @param pid identity of the peer we would connect to | ||
87 | * @param address an address of @a pid | ||
88 | */ | ||
89 | void | ||
90 | GDS_u_try_connect (const struct GNUNET_PeerIdentity *pid, | ||
91 | const char *address); | ||
92 | |||
93 | |||
94 | /** | ||
95 | * Send message to some other participant over the network. Note that | ||
96 | * sending is not guaranteeing that the other peer actually received the | ||
97 | * message. For any given @a target, the DHT must wait for the @a | ||
98 | * finished_cb to be called before calling send() again. | ||
99 | * | ||
100 | * @param u underlay to use for transmission | ||
101 | * @param target receiver identification | ||
102 | * @param msg message | ||
103 | * @param msg_size number of bytes in @a msg | ||
104 | * @param finished_cb function called once transmission is done | ||
105 | * (not called if @a target disconnects, then only the | ||
106 | * disconnect_cb is called). | ||
107 | * @param finished_cb_cls closure for @a finished_cb | ||
108 | */ | ||
109 | void | ||
110 | GDS_u_send (struct GDS_Underlay *u, | ||
111 | struct GNUNET_DHTU_Target *target, | ||
112 | const void *msg, | ||
113 | size_t msg_size, | ||
114 | GNUNET_SCHEDULER_TaskCallback finished_cb, | ||
115 | void *finished_cb_cls); | ||
116 | |||
117 | |||
118 | /** | ||
119 | * Drop a hold @a ph from underlay @a u. | ||
120 | * | ||
121 | * @param u the underlay controlling the hold | ||
122 | * @param ph the preference handle | ||
123 | */ | ||
124 | void | ||
125 | GDS_u_drop (struct GDS_Underlay *u, | ||
126 | struct GNUNET_DHTU_PreferenceHandle *ph); | ||
127 | |||
128 | |||
129 | /** | ||
130 | * Create a hold on @a target at underlay @a u. | ||
131 | * | ||
132 | * @param u the underlay controlling the target | ||
133 | * @param target the peer to hold the connection to | ||
134 | */ | ||
135 | struct GNUNET_DHTU_PreferenceHandle * | ||
136 | GDS_u_hold (struct GDS_Underlay *u, | ||
137 | struct GNUNET_DHTU_Target *target); | ||
138 | |||
139 | |||
140 | /** | ||
141 | * Handle a reply we've received from another peer. If the reply | ||
142 | * matches any of our pending queries, forward it to the respective | ||
143 | * client(s). | ||
144 | * | ||
145 | * @param bd block details | ||
146 | * @param query_hash hash of the original query, might not match key in @a bd | ||
147 | * @param get_path_length number of entries in @a get_path | ||
148 | * @param get_path path the reply has taken | ||
149 | * @return true on success, false on failures | ||
150 | */ | ||
151 | bool | ||
152 | GDS_CLIENTS_handle_reply (const struct GDS_DATACACHE_BlockData *bd, | ||
153 | const struct GNUNET_HashCode *query_hash, | ||
154 | unsigned int get_path_length, | ||
155 | const struct GNUNET_DHT_PathElement *get_path); | ||
156 | |||
157 | |||
158 | /** | ||
159 | * Check if some client is monitoring GET messages and notify | ||
160 | * them in that case. | ||
161 | * | ||
162 | * @param options Options, for instance RecordRoute, DemultiplexEverywhere. | ||
163 | * @param type The type of data in the request. | ||
164 | * @param hop_count Hop count so far. | ||
165 | * @param path_length number of entries in path (or 0 if not recorded). | ||
166 | * @param path peers on the GET path (or NULL if not recorded). | ||
167 | * @param desired_replication_level Desired replication level. | ||
168 | * @param key Key of the requested data. | ||
169 | */ | ||
170 | void | ||
171 | GDS_CLIENTS_process_get (enum GNUNET_DHT_RouteOption options, | ||
172 | enum GNUNET_BLOCK_Type type, | ||
173 | uint32_t hop_count, | ||
174 | uint32_t desired_replication_level, | ||
175 | unsigned int path_length, | ||
176 | const struct GNUNET_DHT_PathElement *path, | ||
177 | const struct GNUNET_HashCode *key); | ||
178 | |||
179 | |||
180 | /** | ||
181 | * Check if some client is monitoring GET RESP messages and notify | ||
182 | * them in that case. | ||
183 | * | ||
184 | * @param bd block details | ||
185 | * @param get_path Peers on GET path (or NULL if not recorded). | ||
186 | * @param get_path_length number of entries in @a get_path. | ||
187 | */ | ||
188 | void | ||
189 | GDS_CLIENTS_process_get_resp (const struct GDS_DATACACHE_BlockData *bd, | ||
190 | const struct GNUNET_DHT_PathElement *get_path, | ||
191 | unsigned int get_path_length); | ||
192 | |||
193 | |||
194 | /** | ||
195 | * Check if some client is monitoring PUT messages and notify | ||
196 | * them in that case. The @a path should include our own | ||
197 | * peer ID (if recorded). | ||
198 | * | ||
199 | * @param options routing options to apply | ||
200 | * @param bd details about the block | ||
201 | * @param hop_count Hop count so far. | ||
202 | * @param desired_replication_level Desired replication level. | ||
203 | */ | ||
204 | void | ||
205 | GDS_CLIENTS_process_put (enum GNUNET_DHT_RouteOption options, | ||
206 | const struct GDS_DATACACHE_BlockData *bd, | ||
207 | uint32_t hop_count, | ||
208 | uint32_t desired_replication_level); | ||
209 | |||
210 | /** | ||
211 | * Return the current NSE | ||
212 | * | ||
213 | * @return the current NSE as a logarithm | ||
214 | */ | ||
215 | double | ||
216 | GDS_NSE_get (void); | ||
217 | |||
218 | #endif | ||