aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-01-16 14:01:23 +0100
committerChristian Grothoff <christian@grothoff.org>2022-02-19 12:41:01 +0100
commit8ca9b2754d10419c9d8c041549d5747ec482b83a (patch)
tree5b6f8b46a419c58780ba09a9e9b6d38ef5647a98 /src
parenta98b548418bd0dcb8882ef913bcc2fbb516e0f2c (diff)
downloadgnunet-8ca9b2754d10419c9d8c041549d5747ec482b83a.tar.gz
gnunet-8ca9b2754d10419c9d8c041549d5747ec482b83a.zip
-DHT: add gnunet-dht-hello for bootstrapping
Diffstat (limited to 'src')
-rw-r--r--src/dht/.gitignore1
-rw-r--r--src/dht/Makefile.am14
-rw-r--r--src/dht/dht_api.c157
-rw-r--r--src/dht/gnunet-dht-hello.c178
-rw-r--r--src/dht/gnunet-service-dht_clients.c101
-rw-r--r--src/dht/gnunet-service-dht_neighbours.c8
-rw-r--r--src/dht/gnunet-service-dht_neighbours.h12
-rw-r--r--src/include/gnunet_dht_service.h57
-rw-r--r--src/include/gnunet_protocols.h15
9 files changed, 530 insertions, 13 deletions
diff --git a/src/dht/.gitignore b/src/dht/.gitignore
index 25b1daf28..bd8af1217 100644
--- a/src/dht/.gitignore
+++ b/src/dht/.gitignore
@@ -10,3 +10,4 @@ test_dht_monitor
10test_dht_multipeer 10test_dht_multipeer
11test_dht_tools.py 11test_dht_tools.py
12test_dht_twopeer 12test_dht_twopeer
13gnunet-dht-hello
diff --git a/src/dht/Makefile.am b/src/dht/Makefile.am
index ab4ec1b3c..6d1090901 100644
--- a/src/dht/Makefile.am
+++ b/src/dht/Makefile.am
@@ -50,7 +50,8 @@ libexec_PROGRAMS = \
50bin_PROGRAMS = \ 50bin_PROGRAMS = \
51 gnunet-dht-monitor \ 51 gnunet-dht-monitor \
52 gnunet-dht-get \ 52 gnunet-dht-get \
53 gnunet-dht-put 53 gnunet-dht-put \
54 gnunet-dht-hello
54 55
55noinst_PROGRAMS = \ 56noinst_PROGRAMS = \
56 gnunet-dht-profiler 57 gnunet-dht-profiler
@@ -80,7 +81,14 @@ gnunet_dht_get_SOURCES = \
80 gnunet-dht-get.c 81 gnunet-dht-get.c
81gnunet_dht_get_LDADD = \ 82gnunet_dht_get_LDADD = \
82 libgnunetdht.la \ 83 libgnunetdht.la \
83 $(top_builddir)/src/core/libgnunetcore.la \ 84 $(top_builddir)/src/util/libgnunetutil.la
85gnunet_dht_get_LDFLAGS = \
86 $(GN_LIBINTL)
87
88gnunet_dht_hello_SOURCES = \
89 gnunet-dht-hello.c
90gnunet_dht_hello_LDADD = \
91 libgnunetdht.la \
84 $(top_builddir)/src/util/libgnunetutil.la 92 $(top_builddir)/src/util/libgnunetutil.la
85gnunet_dht_get_LDFLAGS = \ 93gnunet_dht_get_LDFLAGS = \
86 $(GN_LIBINTL) 94 $(GN_LIBINTL)
@@ -89,7 +97,6 @@ gnunet_dht_put_SOURCES = \
89 gnunet-dht-put.c 97 gnunet-dht-put.c
90gnunet_dht_put_LDADD = \ 98gnunet_dht_put_LDADD = \
91 libgnunetdht.la \ 99 libgnunetdht.la \
92 $(top_builddir)/src/core/libgnunetcore.la \
93 $(top_builddir)/src/util/libgnunetutil.la 100 $(top_builddir)/src/util/libgnunetutil.la
94gnunet_dht_put_LDFLAGS = \ 101gnunet_dht_put_LDFLAGS = \
95 $(GN_LIBINTL) 102 $(GN_LIBINTL)
@@ -98,7 +105,6 @@ gnunet_dht_monitor_SOURCES = \
98 gnunet-dht-monitor.c 105 gnunet-dht-monitor.c
99gnunet_dht_monitor_LDADD = \ 106gnunet_dht_monitor_LDADD = \
100 libgnunetdht.la \ 107 libgnunetdht.la \
101 $(top_builddir)/src/core/libgnunetcore.la \
102 $(top_builddir)/src/util/libgnunetutil.la 108 $(top_builddir)/src/util/libgnunetutil.la
103gnunet_dht_monitor_LDFLAGS = \ 109gnunet_dht_monitor_LDFLAGS = \
104 $(GN_LIBINTL) 110 $(GN_LIBINTL)
diff --git a/src/dht/dht_api.c b/src/dht/dht_api.c
index a0c30d5e7..cae8de726 100644
--- a/src/dht/dht_api.c
+++ b/src/dht/dht_api.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2009, 2010, 2011, 2012, 2016, 2018 GNUnet e.V. 3 Copyright (C) 2009-2012, 2016, 2018, 2022 GNUnet e.V.
4 4
5 GNUnet is free software: you can redistribute it and/or modify it 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 6 under the terms of the GNU Affero General Public License as published
@@ -197,6 +197,40 @@ struct GNUNET_DHT_MonitorHandle
197 197
198 198
199/** 199/**
200 * Handle to get a HELLO URL from the DHT for manual bootstrapping.
201 */
202struct GNUNET_DHT_HelloGetHandle
203{
204
205 /**
206 * DLL.
207 */
208 struct GNUNET_DHT_HelloGetHandle *next;
209
210 /**
211 * DLL.
212 */
213 struct GNUNET_DHT_HelloGetHandle *prev;
214
215 /**
216 * Function to call with the result.
217 */
218 GNUNET_DHT_HelloGetCallback cb;
219
220 /**
221 * Closure for @a cb.
222 */
223 void *cb_cls;
224
225 /**
226 * Connection to the DHT service.
227 */
228 struct GNUNET_DHT_Handle *dht_handle;
229
230};
231
232
233/**
200 * Connection to the DHT service. 234 * Connection to the DHT service.
201 */ 235 */
202struct GNUNET_DHT_Handle 236struct GNUNET_DHT_Handle
@@ -232,6 +266,16 @@ struct GNUNET_DHT_Handle
232 struct GNUNET_DHT_PutHandle *put_tail; 266 struct GNUNET_DHT_PutHandle *put_tail;
233 267
234 /** 268 /**
269 * DLL.
270 */
271 struct GNUNET_DHT_HelloGetHandle *hgh_head;
272
273 /**
274 * DLL.
275 */
276 struct GNUNET_DHT_HelloGetHandle *hgh_tail;
277
278 /**
235 * Hash map containing the current outstanding unique GET requests 279 * Hash map containing the current outstanding unique GET requests
236 * (values are of type `struct GNUNET_DHT_GetHandle`). 280 * (values are of type `struct GNUNET_DHT_GetHandle`).
237 */ 281 */
@@ -820,6 +864,53 @@ handle_client_result (void *cls,
820 864
821 865
822/** 866/**
867 * Process a client HELLO message received from the service.
868 *
869 * @param cls The DHT handle.
870 * @param hdr HELLO URL message from the service.
871 * @return #GNUNET_OK if @a hdr is well-formed
872 */
873static enum GNUNET_GenericReturnValue
874check_client_hello (void *cls,
875 const struct GNUNET_MessageHeader *hdr)
876{
877 uint16_t len = ntohs (hdr->size);
878 const char *buf = (const char *) &hdr[1];
879
880 (void) cls;
881 if ('\0' != buf[len - sizeof (*hdr) - 1])
882 {
883 GNUNET_break (0);
884 return GNUNET_SYSERR;
885 }
886 return GNUNET_OK;
887}
888
889
890/**
891 * Process a client HELLO message received from the service.
892 *
893 * @param cls The DHT handle.
894 * @param hdr HELLO URL message from the service.
895 */
896static void
897handle_client_hello (void *cls,
898 const struct GNUNET_MessageHeader *hdr)
899{
900 struct GNUNET_DHT_Handle *handle = cls;
901 const char *url = (const char *) &hdr[1];
902 struct GNUNET_DHT_HelloGetHandle *hgh;
903
904 while (NULL != (hgh = handle->hgh_head))
905 {
906 hgh->cb (hgh->cb_cls,
907 url);
908 GNUNET_DHT_hello_get_cancel (hgh);
909 }
910}
911
912
913/**
823 * Process a MQ PUT transmission notification. 914 * Process a MQ PUT transmission notification.
824 * 915 *
825 * @param cls The DHT handle. 916 * @param cls The DHT handle.
@@ -866,6 +957,10 @@ try_connect (struct GNUNET_DHT_Handle *h)
866 GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT, 957 GNUNET_MESSAGE_TYPE_DHT_CLIENT_RESULT,
867 struct GNUNET_DHT_ClientResultMessage, 958 struct GNUNET_DHT_ClientResultMessage,
868 h), 959 h),
960 GNUNET_MQ_hd_var_size (client_hello,
961 GNUNET_MESSAGE_TYPE_DHT_CLIENT_HELLO_URL,
962 struct GNUNET_MessageHeader,
963 h),
869 GNUNET_MQ_handler_end () 964 GNUNET_MQ_handler_end ()
870 }; 965 };
871 966
@@ -1257,4 +1352,64 @@ GNUNET_DHT_verify_path (const struct GNUNET_HashCode *key,
1257} 1352}
1258 1353
1259 1354
1355struct GNUNET_DHT_HelloGetHandle *
1356GNUNET_DHT_hello_get (struct GNUNET_DHT_Handle *dht_handle,
1357 GNUNET_DHT_HelloGetCallback cb,
1358 void *cb_cls)
1359{
1360 struct GNUNET_DHT_HelloGetHandle *hgh;
1361 struct GNUNET_MessageHeader *hdr;
1362 struct GNUNET_MQ_Envelope *env;
1363
1364 hgh = GNUNET_new (struct GNUNET_DHT_HelloGetHandle);
1365 hgh->cb = cb;
1366 hgh->cb_cls = cb_cls;
1367 hgh->dht_handle = dht_handle;
1368 GNUNET_CONTAINER_DLL_insert (dht_handle->hgh_head,
1369 dht_handle->hgh_tail,
1370 hgh);
1371 env = GNUNET_MQ_msg (hdr,
1372 GNUNET_MESSAGE_TYPE_DHT_CLIENT_HELLO_GET);
1373 GNUNET_MQ_send (dht_handle->mq,
1374 env);
1375 return hgh;
1376}
1377
1378
1379void
1380GNUNET_DHT_hello_get_cancel (struct GNUNET_DHT_HelloGetHandle *hgh)
1381{
1382 struct GNUNET_DHT_Handle *dht_handle = hgh->dht_handle;
1383
1384 GNUNET_CONTAINER_DLL_remove (dht_handle->hgh_head,
1385 dht_handle->hgh_tail,
1386 hgh);
1387 GNUNET_free (hgh);
1388}
1389
1390
1391void
1392GNUNET_DHT_hello_offer (struct GNUNET_DHT_Handle *dht_handle,
1393 const char *url,
1394 GNUNET_SCHEDULER_TaskCallback cb,
1395 void *cb_cls)
1396{
1397 struct GNUNET_MessageHeader *hdr;
1398 size_t slen = strlen (url) + 1;
1399 struct GNUNET_MQ_Envelope *env;
1400
1401 env = GNUNET_MQ_msg_extra (hdr,
1402 slen,
1403 GNUNET_MESSAGE_TYPE_DHT_CLIENT_HELLO_URL);
1404 memcpy (&hdr[1],
1405 url,
1406 slen);
1407 GNUNET_MQ_notify_sent (env,
1408 cb,
1409 cb_cls);
1410 GNUNET_MQ_send (dht_handle->mq,
1411 env);
1412}
1413
1414
1260/* end of dht_api.c */ 1415/* end of dht_api.c */
diff --git a/src/dht/gnunet-dht-hello.c b/src/dht/gnunet-dht-hello.c
new file mode 100644
index 000000000..369ed5643
--- /dev/null
+++ b/src/dht/gnunet-dht-hello.c
@@ -0,0 +1,178 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2022 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 * @file dht/gnunet-dht-hello.c
22 * @brief Obtain HELLO from DHT for bootstrapping
23 * @author Christian Grothoff
24 */
25#include "platform.h"
26#include "gnunet_dht_service.h"
27
28#define LOG(kind, ...) GNUNET_log_from (kind, "dht-clients", __VA_ARGS__)
29
30/**
31 * Handle to the DHT
32 */
33static struct GNUNET_DHT_Handle *dht_handle;
34
35/**
36 * Handle to the DHT hello get operation.
37 */
38static struct GNUNET_DHT_HelloGetHandle *get_hello_handle;
39
40/**
41 * Global status value
42 */
43static int global_ret;
44
45
46/**
47 * Task run to clean up on shutdown.
48 *
49 * @param cls unused
50 */
51static void
52cleanup_task (void *cls)
53{
54 if (NULL != get_hello_handle)
55 {
56 GNUNET_DHT_hello_get_cancel (get_hello_handle);
57 get_hello_handle = NULL;
58 }
59 if (NULL != dht_handle)
60 {
61 GNUNET_DHT_disconnect (dht_handle);
62 dht_handle = NULL;
63 }
64}
65
66
67/**
68 * Task run when we are finished. Triggers shutdown.
69 *
70 * @param cls unused
71 */
72static void
73hello_done_cb (void *cls)
74{
75 GNUNET_SCHEDULER_shutdown ();
76}
77
78
79/**
80 * Function called on our HELLO.
81 *
82 * @param cls closure
83 * @param url the HELLO URL
84 */
85static void
86hello_result_cb (void *cls,
87 const char *url)
88{
89 get_hello_handle = NULL;
90 fprintf (stdout,
91 "%s\n",
92 url);
93 GNUNET_SCHEDULER_shutdown ();
94}
95
96
97/**
98 * Main function that will be run by the scheduler.
99 *
100 * @param cls closure, NULL
101 * @param args remaining command-line arguments
102 * @param cfgfile name of the configuration file used (for saving, can be NULL!)
103 * @param cfg configuration
104 */
105static void
106run (void *cls,
107 char *const *args,
108 const char *cfgfile,
109 const struct GNUNET_CONFIGURATION_Handle *cfg)
110{
111 (void) cls;
112 (void) cfgfile;
113 GNUNET_SCHEDULER_add_shutdown (&cleanup_task,
114 NULL);
115 if (NULL == (dht_handle = GNUNET_DHT_connect (cfg,
116 1)))
117 {
118 fprintf (stderr,
119 _ ("Failed to connect to DHT service!\n"));
120 global_ret = EXIT_NOTCONFIGURED;
121 GNUNET_SCHEDULER_shutdown ();
122 return;
123 }
124 if (NULL == args[0])
125 {
126 get_hello_handle = GNUNET_DHT_hello_get (dht_handle,
127 &hello_result_cb,
128 NULL);
129 GNUNET_break (NULL != get_hello_handle);
130 }
131 else
132 {
133 GNUNET_DHT_hello_offer (dht_handle,
134 args[0],
135 &hello_done_cb,
136 NULL);
137 }
138}
139
140
141/**
142 * Entry point for gnunet-dht-hello
143 *
144 * @param argc number of arguments from the command line
145 * @param argv command line arguments
146 * @return 0 ok, 1 on error
147 */
148int
149main (int argc,
150 char *const *argv)
151{
152 struct GNUNET_GETOPT_CommandLineOption options[] = {
153 GNUNET_GETOPT_OPTION_END
154 };
155 enum GNUNET_GenericReturnValue iret;
156
157 if (GNUNET_OK !=
158 GNUNET_STRINGS_get_utf8_args (argc, argv,
159 &argc, &argv))
160 return 2;
161 iret = GNUNET_PROGRAM_run (
162 argc,
163 argv,
164 "gnunet-dht-hello [URL]",
165 gettext_noop (
166 "Obtain HELLO from DHT or provide HELLO to DHT for bootstrapping"),
167 options,
168 &run,
169 NULL);
170 if (GNUNET_SYSERR == iret)
171 return EXIT_FAILURE;
172 if (GNUNET_NO == iret)
173 return EXIT_SUCCESS;
174 return global_ret;
175}
176
177
178/* end of gnunet-dht-hello.c */
diff --git a/src/dht/gnunet-service-dht_clients.c b/src/dht/gnunet-service-dht_clients.c
index bc39e004a..88db7b0ea 100644
--- a/src/dht/gnunet-service-dht_clients.c
+++ b/src/dht/gnunet-service-dht_clients.c
@@ -1060,6 +1060,95 @@ GDS_CLIENTS_handle_reply (const struct GDS_DATACACHE_BlockData *bd,
1060} 1060}
1061 1061
1062 1062
1063/* **************** HELLO logic ***************** */
1064
1065/**
1066 * Handler for HELLO GET message. Reply to client
1067 * with a URL of our HELLO.
1068 *
1069 * @param cls the client we received this message from
1070 * @param msg the actual message received
1071 *
1072 */
1073static void
1074handle_dht_local_hello_get (void *cls,
1075 const struct GNUNET_MessageHeader *msg)
1076{
1077 struct ClientHandle *ch = cls;
1078 char *url = GNUNET_HELLO_builder_to_url (GDS_my_hello,
1079 &GDS_my_private_key);
1080 size_t slen = strlen (url) + 1;
1081 struct GNUNET_MessageHeader *hdr;
1082 struct GNUNET_MQ_Envelope *env;
1083
1084 env = GNUNET_MQ_msg_extra (hdr,
1085 slen,
1086 GNUNET_MESSAGE_TYPE_DHT_CLIENT_HELLO_URL);
1087 memcpy (&hdr[1],
1088 url,
1089 slen);
1090 GNUNET_free (url);
1091 GNUNET_MQ_send (ch->mq,
1092 env);
1093}
1094
1095
1096/**
1097 * Process a client HELLO message received from the service.
1098 *
1099 * @param cls the client we received this message from
1100 * @param hdr HELLO URL message from the service.
1101 * @return #GNUNET_OK if @a hdr is well-formed
1102 */
1103static enum GNUNET_GenericReturnValue
1104check_dht_local_hello_offer (void *cls,
1105 const struct GNUNET_MessageHeader *hdr)
1106{
1107 uint16_t len = ntohs (hdr->size);
1108 const char *buf = (const char *) &hdr[1];
1109
1110 (void) cls;
1111 if ('\0' != buf[len - sizeof (*hdr) - 1])
1112 {
1113 GNUNET_break (0);
1114 return GNUNET_SYSERR;
1115 }
1116 return GNUNET_OK;
1117}
1118
1119
1120/**
1121 * Handler for HELLO OFFER message. Try to use the
1122 * HELLO to connect to another peer.
1123 *
1124 * @param cls the client we received this message from
1125 * @param msg the actual message received
1126 */
1127static void
1128handle_dht_local_hello_offer (void *cls,
1129 const struct GNUNET_MessageHeader *msg)
1130{
1131 struct ClientHandle *ch = cls;
1132 const char *url = (const char *) &msg[1];
1133 struct GNUNET_HELLO_Builder *b;
1134 struct GNUNET_PeerIdentity pid;
1135
1136 b = GNUNET_HELLO_builder_from_url (url);
1137 if (NULL == b)
1138 {
1139 GNUNET_break (0);
1140 GNUNET_SERVICE_client_drop (ch->client);
1141 return;
1142 }
1143 GNUNET_SERVICE_client_continue (ch->client);
1144 GNUNET_HELLO_builder_iterate (b,
1145 &pid,
1146 &GDS_try_connect,
1147 &pid);
1148 GNUNET_HELLO_builder_free (b);
1149}
1150
1151
1063/* ************* logic for monitors ************** */ 1152/* ************* logic for monitors ************** */
1064 1153
1065 1154
@@ -1330,8 +1419,8 @@ response_action (void *cls,
1330 bd->put_path_length * sizeof(struct GNUNET_DHT_PathElement)); 1419 bd->put_path_length * sizeof(struct GNUNET_DHT_PathElement));
1331 GNUNET_memcpy (path, 1420 GNUNET_memcpy (path,
1332 resp_ctx->get_path, 1421 resp_ctx->get_path,
1333 resp_ctx->get_path_length * sizeof(struct 1422 resp_ctx->get_path_length
1334 GNUNET_DHT_PathElement)); 1423 * sizeof(struct GNUNET_DHT_PathElement));
1335 GNUNET_memcpy (&path[resp_ctx->get_path_length], 1424 GNUNET_memcpy (&path[resp_ctx->get_path_length],
1336 bd->data, 1425 bd->data,
1337 bd->data_size); 1426 bd->data_size);
@@ -1504,6 +1593,14 @@ GDS_CLIENTS_stop (void)
1504 GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_RESULTS_KNOWN, \ 1593 GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_RESULTS_KNOWN, \
1505 struct GNUNET_DHT_ClientGetResultSeenMessage, \ 1594 struct GNUNET_DHT_ClientGetResultSeenMessage, \
1506 NULL), \ 1595 NULL), \
1596 GNUNET_MQ_hd_fixed_size (dht_local_hello_get, \
1597 GNUNET_MESSAGE_TYPE_DHT_CLIENT_HELLO_GET, \
1598 struct GNUNET_MessageHeader, \
1599 NULL), \
1600 GNUNET_MQ_hd_var_size (dht_local_hello_offer, \
1601 GNUNET_MESSAGE_TYPE_DHT_CLIENT_HELLO_URL, \
1602 struct GNUNET_MessageHeader, \
1603 NULL), \
1507 GNUNET_MQ_handler_end ()) 1604 GNUNET_MQ_handler_end ())
1508 1605
1509 1606
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c
index 213308ca6..fc025fa18 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -2246,9 +2246,9 @@ check_dht_p2p_result (void *cls,
2246 * @param cls closure pointing to a `struct GNUNET_PeerIdentity *` 2246 * @param cls closure pointing to a `struct GNUNET_PeerIdentity *`
2247 * @param uri one of the URIs 2247 * @param uri one of the URIs
2248 */ 2248 */
2249static void 2249void
2250try_connect (void *cls, 2250GDS_try_connect (void *cls,
2251 const char *uri) 2251 const char *uri)
2252{ 2252{
2253 const struct GNUNET_PeerIdentity *pid = cls; 2253 const struct GNUNET_PeerIdentity *pid = cls;
2254 struct GNUNET_HashCode phash; 2254 struct GNUNET_HashCode phash;
@@ -2367,7 +2367,7 @@ handle_dht_p2p_result (void *cls,
2367 if (GNUNET_YES != disable_try_connect) 2367 if (GNUNET_YES != disable_try_connect)
2368 GNUNET_HELLO_builder_iterate (b, 2368 GNUNET_HELLO_builder_iterate (b,
2369 &pid, 2369 &pid,
2370 &try_connect, 2370 &GDS_try_connect,
2371 &pid); 2371 &pid);
2372 GNUNET_HELLO_builder_free (b); 2372 GNUNET_HELLO_builder_free (b);
2373 } 2373 }
diff --git a/src/dht/gnunet-service-dht_neighbours.h b/src/dht/gnunet-service-dht_neighbours.h
index fecdbe9f1..5c327e019 100644
--- a/src/dht/gnunet-service-dht_neighbours.h
+++ b/src/dht/gnunet-service-dht_neighbours.h
@@ -133,6 +133,18 @@ GDS_am_closest_peer (const struct GNUNET_HashCode *key,
133 133
134 134
135/** 135/**
136 * Callback function used to extract URIs from a builder.
137 * Called when we should consider connecting to a peer.
138 *
139 * @param cls closure pointing to a `struct GNUNET_PeerIdentity *`
140 * @param uri one of the URIs
141 */
142void
143GDS_try_connect (void *cls,
144 const char *uri);
145
146
147/**
136 * Function to call when we connect to a peer and can henceforth transmit to 148 * Function to call when we connect to a peer and can henceforth transmit to
137 * that peer. 149 * that peer.
138 * 150 *
diff --git a/src/include/gnunet_dht_service.h b/src/include/gnunet_dht_service.h
index abe5a03e4..e0f9f6fc3 100644
--- a/src/include/gnunet_dht_service.h
+++ b/src/include/gnunet_dht_service.h
@@ -512,6 +512,63 @@ GNUNET_DHT_verify_path (const struct GNUNET_HashCode *key,
512 const struct GNUNET_PeerIdentity *me); 512 const struct GNUNET_PeerIdentity *me);
513 513
514 514
515/**
516 * Handle to get a HELLO URL from the DHT for manual bootstrapping.
517 */
518struct GNUNET_DHT_HelloGetHandle;
519
520
521/**
522 * Signature called with the result of a HELLO GET operation.
523 *
524 * @param cls closure
525 * @param hello_url the resulting HELLO URL, NULL on error
526 */
527typedef void
528(*GNUNET_DHT_HelloGetCallback)(void *cls,
529 const char *hello_url);
530
531
532/**
533 * Obtain HELLO URL of the DHT identified by @a dht_handle.
534 *
535 * @param dht_handle DHT to query
536 * @param cb function to call with the result
537 * @param cb_cls closure for @a cb
538 * @return NULL on failure
539 */
540struct GNUNET_DHT_HelloGetHandle *
541GNUNET_DHT_hello_get (struct GNUNET_DHT_Handle *dht_handle,
542 GNUNET_DHT_HelloGetCallback cb,
543 void *cb_cls);
544
545
546/**
547 * Cancel hello get operation.
548 *
549 * @param[in] hgh operation to cancel.
550 */
551void
552GNUNET_DHT_hello_get_cancel (struct GNUNET_DHT_HelloGetHandle *hgh);
553
554
555/**
556 * Offer HELLO URL of the DHT identified by @a dht_handle.
557 * Callback may be invoked once, only way to cancel is to
558 * disconnect @a dht_handle.
559 *
560 * @param dht_handle DHT to query
561 * @param url URL with a HELLO to offer to the DHT
562 * @param cb function called when done
563 * @param cb_cls closure for @a cb
564 */
565void
566GNUNET_DHT_hello_offer (struct GNUNET_DHT_Handle *dht_handle,
567 const char *url,
568 GNUNET_SCHEDULER_TaskCallback cb,
569 void *cb_cls);
570
571
515#if 0 /* keep Emacsens' auto-indent happy */ 572#if 0 /* keep Emacsens' auto-indent happy */
516{ 573{
517#endif 574#endif
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index cddacc8a6..f2892e125 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -665,9 +665,20 @@ extern "C" {
665#define GNUNET_MESSAGE_TYPE_DHT_P2P_HELLO 157 665#define GNUNET_MESSAGE_TYPE_DHT_P2P_HELLO 157
666 666
667/** 667/**
668 * DHT wants to use CORE to transmit data. 668 * Encapsulation of DHT messages in CORE service.
669 */ 669 */
670#define GNUNET_MESSAGE_TYPE_DHT_CORE 143 670#define GNUNET_MESSAGE_TYPE_DHT_CORE 158
671
672/**
673 * HELLO URL send between client and service (in
674 * either direction).
675 */
676#define GNUNET_MESSAGE_TYPE_DHT_CLIENT_HELLO_URL 159
677
678/**
679 * Client requests DHT service's HELLO URL.
680 */
681#define GNUNET_MESSAGE_TYPE_DHT_CLIENT_HELLO_GET 161
671 682
672 683
673/******************************************************************************* 684/*******************************************************************************