diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-01-15 19:24:33 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-02-19 12:39:55 +0100 |
commit | b0abdf7127f2403ff583d224e0d9d4e68c1c5bfc (patch) | |
tree | 47df762cdbcce501ec5536c8963b5c9ee55da31d /src/include | |
parent | 3a71153405e8fc26712807b4bdb5987fb3bf2b9e (diff) | |
download | gnunet-b0abdf7127f2403ff583d224e0d9d4e68c1c5bfc.tar.gz gnunet-b0abdf7127f2403ff583d224e0d9d4e68c1c5bfc.zip |
-more work on DHTU integration
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_datacache_lib.h | 2 | ||||
-rw-r--r-- | src/include/gnunet_datacache_plugin.h | 2 | ||||
-rw-r--r-- | src/include/gnunet_dht_service.h | 10 | ||||
-rw-r--r-- | src/include/gnunet_dhtu_plugin.h | 5 | ||||
-rw-r--r-- | src/include/gnunet_hello_uri_lib.h | 44 | ||||
-rw-r--r-- | src/include/gnunet_protocols.h | 8 |
6 files changed, 60 insertions, 11 deletions
diff --git a/src/include/gnunet_datacache_lib.h b/src/include/gnunet_datacache_lib.h index 11076e3e7..737a5c845 100644 --- a/src/include/gnunet_datacache_lib.h +++ b/src/include/gnunet_datacache_lib.h | |||
@@ -154,6 +154,7 @@ GNUNET_DATACACHE_get (struct GNUNET_DATACACHE_Handle *h, | |||
154 | * | 154 | * |
155 | * @param h handle to the datacache | 155 | * @param h handle to the datacache |
156 | * @param key area of the keyspace to look into | 156 | * @param key area of the keyspace to look into |
157 | * @param type entries of which type are relevant? | ||
157 | * @param num_results number of results that should be returned to @a iter | 158 | * @param num_results number of results that should be returned to @a iter |
158 | * @param iter maybe NULL (to just count) | 159 | * @param iter maybe NULL (to just count) |
159 | * @param iter_cls closure for @a iter | 160 | * @param iter_cls closure for @a iter |
@@ -162,6 +163,7 @@ GNUNET_DATACACHE_get (struct GNUNET_DATACACHE_Handle *h, | |||
162 | unsigned int | 163 | unsigned int |
163 | GNUNET_DATACACHE_get_closest (struct GNUNET_DATACACHE_Handle *h, | 164 | GNUNET_DATACACHE_get_closest (struct GNUNET_DATACACHE_Handle *h, |
164 | const struct GNUNET_HashCode *key, | 165 | const struct GNUNET_HashCode *key, |
166 | enum GNUNET_BLOCK_Type type, | ||
165 | unsigned int num_results, | 167 | unsigned int num_results, |
166 | GNUNET_DATACACHE_Iterator iter, | 168 | GNUNET_DATACACHE_Iterator iter, |
167 | void *iter_cls); | 169 | void *iter_cls); |
diff --git a/src/include/gnunet_datacache_plugin.h b/src/include/gnunet_datacache_plugin.h index 24570be72..914aaf15c 100644 --- a/src/include/gnunet_datacache_plugin.h +++ b/src/include/gnunet_datacache_plugin.h | |||
@@ -165,6 +165,7 @@ struct GNUNET_DATACACHE_PluginFunctions | |||
165 | * | 165 | * |
166 | * @param cls closure (internal context for the plugin) | 166 | * @param cls closure (internal context for the plugin) |
167 | * @param key area of the keyspace to look into | 167 | * @param key area of the keyspace to look into |
168 | * @param type desired block type for the replies | ||
168 | * @param num_results number of results that should be returned to @a iter | 169 | * @param num_results number of results that should be returned to @a iter |
169 | * @param iter maybe NULL (to just count) | 170 | * @param iter maybe NULL (to just count) |
170 | * @param iter_cls closure for @a iter | 171 | * @param iter_cls closure for @a iter |
@@ -173,6 +174,7 @@ struct GNUNET_DATACACHE_PluginFunctions | |||
173 | unsigned int | 174 | unsigned int |
174 | (*get_closest) (void *cls, | 175 | (*get_closest) (void *cls, |
175 | const struct GNUNET_HashCode *key, | 176 | const struct GNUNET_HashCode *key, |
177 | enum GNUNET_BLOCK_Type type, | ||
176 | unsigned int num_results, | 178 | unsigned int num_results, |
177 | GNUNET_DATACACHE_Iterator iter, | 179 | GNUNET_DATACACHE_Iterator iter, |
178 | void *iter_cls); | 180 | void *iter_cls); |
diff --git a/src/include/gnunet_dht_service.h b/src/include/gnunet_dht_service.h index 768b19fb1..abe5a03e4 100644 --- a/src/include/gnunet_dht_service.h +++ b/src/include/gnunet_dht_service.h | |||
@@ -101,14 +101,14 @@ enum GNUNET_DHT_RouteOption | |||
101 | GNUNET_DHT_RO_RECORD_ROUTE = 2, | 101 | GNUNET_DHT_RO_RECORD_ROUTE = 2, |
102 | 102 | ||
103 | /** | 103 | /** |
104 | * This is a 'FIND-PEER' request, so approximate results are fine. | 104 | * Approximate results are fine. |
105 | */ | 105 | */ |
106 | GNUNET_DHT_RO_FIND_PEER = 4, | 106 | GNUNET_DHT_RO_FIND_APPROXIMATE = 4, |
107 | 107 | ||
108 | /** | 108 | /** |
109 | * Flag given to monitors if this was the last hop for a GET/PUT. | 109 | * Flag given to monitors if this was the last hop for a GET/PUT. |
110 | * This is only used for internal processing. | 110 | * This is only used for internal processing. |
111 | */ | 111 | */ |
112 | GNUNET_DHT_RO_LAST_HOP = 65535 | 112 | GNUNET_DHT_RO_LAST_HOP = 65535 |
113 | }; | 113 | }; |
114 | 114 | ||
diff --git a/src/include/gnunet_dhtu_plugin.h b/src/include/gnunet_dhtu_plugin.h index b709ce9ae..fa0b5f667 100644 --- a/src/include/gnunet_dhtu_plugin.h +++ b/src/include/gnunet_dhtu_plugin.h | |||
@@ -129,6 +129,7 @@ struct GNUNET_DHTU_PluginEnvironment | |||
129 | const struct GNUNET_PeerIdentity *pid, | 129 | const struct GNUNET_PeerIdentity *pid, |
130 | void **ctx); | 130 | void **ctx); |
131 | 131 | ||
132 | |||
132 | /** | 133 | /** |
133 | * Function to call when we disconnected from a peer and can henceforth | 134 | * Function to call when we disconnected from a peer and can henceforth |
134 | * cannot transmit to that peer anymore. | 135 | * cannot transmit to that peer anymore. |
@@ -177,7 +178,7 @@ struct GNUNET_DHTU_PluginFunctions | |||
177 | */ | 178 | */ |
178 | void | 179 | void |
179 | (*try_connect) (void *cls, | 180 | (*try_connect) (void *cls, |
180 | struct GNUNET_PeerIdentity *pid, | 181 | const struct GNUNET_PeerIdentity *pid, |
181 | const char *address); | 182 | const char *address); |
182 | 183 | ||
183 | 184 | ||
@@ -194,7 +195,7 @@ struct GNUNET_DHTU_PluginFunctions | |||
194 | struct GNUNET_DHTU_Target *target); | 195 | struct GNUNET_DHTU_Target *target); |
195 | 196 | ||
196 | /** | 197 | /** |
197 | * Do no long request underlay to keep the connection alive. | 198 | * Do no longer request underlay to keep the connection alive. |
198 | * | 199 | * |
199 | * @param cls closure | 200 | * @param cls closure |
200 | * @param target connection to keep alive | 201 | * @param target connection to keep alive |
diff --git a/src/include/gnunet_hello_uri_lib.h b/src/include/gnunet_hello_uri_lib.h index ec9cdfa5e..c109a151a 100644 --- a/src/include/gnunet_hello_uri_lib.h +++ b/src/include/gnunet_hello_uri_lib.h | |||
@@ -49,6 +49,13 @@ struct GNUNET_HELLO_Builder; | |||
49 | 49 | ||
50 | 50 | ||
51 | /** | 51 | /** |
52 | * For how long are HELLO signatures valid? | ||
53 | */ | ||
54 | #define GNUNET_HELLO_ADDRESS_EXPIRATION GNUNET_TIME_relative_multiply ( \ | ||
55 | GNUNET_TIME_UNIT_DAYS, 2) | ||
56 | |||
57 | |||
58 | /** | ||
52 | * Allocate builder. | 59 | * Allocate builder. |
53 | * | 60 | * |
54 | * @param pid peer the builder is for | 61 | * @param pid peer the builder is for |
@@ -100,7 +107,8 @@ GNUNET_HELLO_builder_from_url (const char *url); | |||
100 | 107 | ||
101 | 108 | ||
102 | /** | 109 | /** |
103 | * Generate HELLO message from a @a builder | 110 | * Generate envelope with GNUnet HELLO message (including |
111 | * peer ID) from a @a builder | ||
104 | * | 112 | * |
105 | * @param builder builder to serialize | 113 | * @param builder builder to serialize |
106 | * @param priv private key to use to sign the result | 114 | * @param priv private key to use to sign the result |
@@ -112,6 +120,19 @@ GNUNET_HELLO_builder_to_env (const struct GNUNET_HELLO_Builder *builder, | |||
112 | 120 | ||
113 | 121 | ||
114 | /** | 122 | /** |
123 | * Generate DHT HELLO message (without peer ID) from a @a builder | ||
124 | * | ||
125 | * @param builder builder to serialize | ||
126 | * @param priv private key to use to sign the result | ||
127 | * @return HELLO message matching @a builder | ||
128 | */ | ||
129 | struct GNUNET_MessageHeader * | ||
130 | GNUNET_HELLO_builder_to_dht_hello_msg ( | ||
131 | const struct GNUNET_HELLO_Builder *builder, | ||
132 | const struct GNUNET_CRYPTO_EddsaPrivateKey *priv); | ||
133 | |||
134 | |||
135 | /** | ||
115 | * Generate GNUnet HELLO URI from a @a builder | 136 | * Generate GNUnet HELLO URI from a @a builder |
116 | * | 137 | * |
117 | * @param builder builder to serialize | 138 | * @param builder builder to serialize |
@@ -191,6 +212,27 @@ GNUNET_HELLO_builder_iterate (const struct GNUNET_HELLO_Builder *builder, | |||
191 | GNUNET_HELLO_UriCallback uc, | 212 | GNUNET_HELLO_UriCallback uc, |
192 | void *uc_cls); | 213 | void *uc_cls); |
193 | 214 | ||
215 | |||
216 | /** | ||
217 | * Convert a DHT @a hello message to a HELLO @a block. | ||
218 | * | ||
219 | * @param hello the HELLO message | ||
220 | * @param pid peer that created the @a hello | ||
221 | * @param[out] block set to the HELLO block | ||
222 | * @param[out] block_size set to number of bytes in @a block | ||
223 | * @param[out] block_expiration set to expiration time of @a block | ||
224 | * @return #GNUNET_OK on success, | ||
225 | * #GNUNET_NO if the @a hello is expired (@a block is set!) | ||
226 | * #GNUNET_SYSERR if @a hello is invalid (@a block will be set to NULL) | ||
227 | */ | ||
228 | enum GNUNET_GenericReturnValue | ||
229 | GNUNET_HELLO_dht_msg_to_block (const struct GNUNET_MessageHeader *hello, | ||
230 | const struct GNUNET_PeerIdentity *pid, | ||
231 | void **block, | ||
232 | size_t *block_size, | ||
233 | struct GNUNET_TIME_Absolute *block_expiration); | ||
234 | |||
235 | |||
194 | #if 0 /* keep Emacsens' auto-indent happy */ | 236 | #if 0 /* keep Emacsens' auto-indent happy */ |
195 | { | 237 | { |
196 | #endif | 238 | #endif |
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index f5ccd2971..cddacc8a6 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h | |||
@@ -660,13 +660,15 @@ extern "C" { | |||
660 | #define GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_RESULTS_KNOWN 156 | 660 | #define GNUNET_MESSAGE_TYPE_DHT_CLIENT_GET_RESULTS_KNOWN 156 |
661 | 661 | ||
662 | /** | 662 | /** |
663 | * DHT wants to use CORE to transmit data. | 663 | * HELLO advertising a neighbours addresses. |
664 | */ | 664 | */ |
665 | #define GNUNET_MESSAGE_TYPE_DHT_CORE 143 | 665 | #define GNUNET_MESSAGE_TYPE_DHT_P2P_HELLO 157 |
666 | 666 | ||
667 | /** | 667 | /** |
668 | * Further X-VINE DHT messages continued from 880 | 668 | * DHT wants to use CORE to transmit data. |
669 | */ | 669 | */ |
670 | #define GNUNET_MESSAGE_TYPE_DHT_CORE 143 | ||
671 | |||
670 | 672 | ||
671 | /******************************************************************************* | 673 | /******************************************************************************* |
672 | * HOSTLIST message types | 674 | * HOSTLIST message types |