diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dhtu/Makefile.am | 12 | ||||
-rw-r--r-- | src/dhtu/plugin_dhtu_gnunet.c | 163 | ||||
-rw-r--r-- | src/dhtu/plugin_dhtu_ip.c | 4 | ||||
-rw-r--r-- | src/include/gnunet_common.h | 8 | ||||
-rw-r--r-- | src/include/gnunet_dhtu_plugin.h | 54 | ||||
-rw-r--r-- | src/include/gnunet_hello_lib.h | 7 | ||||
-rw-r--r-- | src/include/gnunet_mq_lib.h | 21 | ||||
-rw-r--r-- | src/include/gnunet_transport_service.h | 21 | ||||
-rw-r--r-- | src/transport/test_transport_port_forward.c | 2 | ||||
-rw-r--r-- | src/util/gnunet-config.c | 59 |
10 files changed, 266 insertions, 85 deletions
diff --git a/src/dhtu/Makefile.am b/src/dhtu/Makefile.am index 72b422812..f4b968526 100644 --- a/src/dhtu/Makefile.am +++ b/src/dhtu/Makefile.am | |||
@@ -11,6 +11,7 @@ if USE_COVERAGE | |||
11 | endif | 11 | endif |
12 | 12 | ||
13 | plugin_LTLIBRARIES = \ | 13 | plugin_LTLIBRARIES = \ |
14 | libgnunet_plugin_dhtu_gnunet.la \ | ||
14 | libgnunet_plugin_dhtu_ip.la | 15 | libgnunet_plugin_dhtu_ip.la |
15 | 16 | ||
16 | libgnunet_plugin_dhtu_ip_la_SOURCES = \ | 17 | libgnunet_plugin_dhtu_ip_la_SOURCES = \ |
@@ -22,3 +23,14 @@ libgnunet_plugin_dhtu_ip_la_LIBADD = \ | |||
22 | libgnunet_plugin_dhtu_ip_la_LDFLAGS = \ | 23 | libgnunet_plugin_dhtu_ip_la_LDFLAGS = \ |
23 | $(GN_PLUGIN_LDFLAGS) | 24 | $(GN_PLUGIN_LDFLAGS) |
24 | 25 | ||
26 | |||
27 | |||
28 | libgnunet_plugin_dhtu_gnunet_la_SOURCES = \ | ||
29 | plugin_dhtu_gnunet.c | ||
30 | libgnunet_plugin_dhtu_gnunet_la_LIBADD = \ | ||
31 | $(top_builddir)/src/core/libgnunetcore.la \ | ||
32 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
33 | $(XLIBS) \ | ||
34 | $(LTLIBINTL) | ||
35 | libgnunet_plugin_dhtu_gnunet_la_LDFLAGS = \ | ||
36 | $(GN_PLUGIN_LDFLAGS) | ||
diff --git a/src/dhtu/plugin_dhtu_gnunet.c b/src/dhtu/plugin_dhtu_gnunet.c index d6cd75242..ccd329e8e 100644 --- a/src/dhtu/plugin_dhtu_gnunet.c +++ b/src/dhtu/plugin_dhtu_gnunet.c | |||
@@ -21,11 +21,44 @@ | |||
21 | /** | 21 | /** |
22 | * @author Christian Grothoff | 22 | * @author Christian Grothoff |
23 | * | 23 | * |
24 | * @file plugin_dhtu_ip.c | 24 | * @file plugin_dhtu_gnunet.c |
25 | * @brief plain IP based DHT network underlay | 25 | * @brief plain IP based DHT network underlay |
26 | */ | 26 | */ |
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #incluce "gnunet_dhtu_plugin.h" | 28 | #include "gnunet_dhtu_plugin.h" |
29 | #include "gnunet_core_service.h" | ||
30 | |||
31 | /** | ||
32 | * Handle for a private key used by this underlay. | ||
33 | */ | ||
34 | struct GNUNET_DHTU_PrivateKey | ||
35 | { | ||
36 | /** | ||
37 | * GNUnet uses eddsa for peers. | ||
38 | */ | ||
39 | struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_priv; | ||
40 | |||
41 | }; | ||
42 | |||
43 | |||
44 | /** | ||
45 | * Handle for a public key used by this underlay. | ||
46 | */ | ||
47 | struct PublicKey | ||
48 | { | ||
49 | |||
50 | /** | ||
51 | * Header. | ||
52 | */ | ||
53 | struct GNUNET_DHTU_PublicKey header; | ||
54 | |||
55 | /** | ||
56 | * GNUnet uses eddsa for peers. | ||
57 | */ | ||
58 | struct GNUNET_CRYPTO_EddsaPublicKey eddsa_pub; | ||
59 | |||
60 | }; | ||
61 | |||
29 | 62 | ||
30 | /** | 63 | /** |
31 | * Opaque handle that the underlay offers for our address to be used when | 64 | * Opaque handle that the underlay offers for our address to be used when |
@@ -47,7 +80,7 @@ struct GNUNET_DHTU_Source | |||
47 | */ | 80 | */ |
48 | struct GNUNET_DHTU_Target | 81 | struct GNUNET_DHTU_Target |
49 | { | 82 | { |
50 | 83 | ||
51 | /** | 84 | /** |
52 | * Application context for this target. | 85 | * Application context for this target. |
53 | */ | 86 | */ |
@@ -94,23 +127,20 @@ struct GNUNET_DHTU_PreferenceHandle | |||
94 | 127 | ||
95 | 128 | ||
96 | /** | 129 | /** |
97 | * Opaque handle for a private key used by this underlay. | ||
98 | */ | ||
99 | struct GNUNET_DHTU_PrivateKey | ||
100 | { | ||
101 | /* we are IP, we do not do crypto */ | ||
102 | }; | ||
103 | |||
104 | |||
105 | /** | ||
106 | * Closure for all plugin functions. | 130 | * Closure for all plugin functions. |
107 | */ | 131 | */ |
108 | struct Plugin | 132 | struct Plugin |
109 | { | 133 | { |
110 | /** | 134 | /** |
111 | * Callbacks into the DHT. | 135 | * Callbacks into the DHT. |
112 | */ | 136 | */ |
113 | struct GNUNET_DHTU_PluginEnvironment *env; | 137 | struct GNUNET_DHTU_PluginEnvironment *env; |
138 | |||
139 | /** | ||
140 | * Handle to the CORE service. | ||
141 | */ | ||
142 | struct GNUNET_CORE_Handle *core; | ||
143 | |||
114 | }; | 144 | }; |
115 | 145 | ||
116 | 146 | ||
@@ -126,10 +156,17 @@ struct Plugin | |||
126 | static ssize_t | 156 | static ssize_t |
127 | ip_sign (void *cls, | 157 | ip_sign (void *cls, |
128 | const struct GNUNET_DHTU_PrivateKey *pk, | 158 | const struct GNUNET_DHTU_PrivateKey *pk, |
129 | const struct GNUNET_DHTU_SignaturePurpose *purpose, | 159 | const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, |
130 | void **sig) | 160 | void **sig) |
131 | { | 161 | { |
132 | return 0; | 162 | struct GNUNET_CRYPTO_EddsaSignature *es; |
163 | |||
164 | es = GNUNET_new (struct GNUNET_CRYPTO_EddsaSignature); | ||
165 | GNUNET_CRYPTO_eddsa_sign_ (&pk->eddsa_priv, | ||
166 | purpose, | ||
167 | es); | ||
168 | *sig = es; | ||
169 | return sizeof (*es); | ||
133 | } | 170 | } |
134 | 171 | ||
135 | 172 | ||
@@ -148,11 +185,31 @@ ip_sign (void *cls, | |||
148 | static enum GNUNET_GenericReturnValue | 185 | static enum GNUNET_GenericReturnValue |
149 | ip_verify (void *cls, | 186 | ip_verify (void *cls, |
150 | const struct GNUNET_DHTU_PublicKey *pk, | 187 | const struct GNUNET_DHTU_PublicKey *pk, |
151 | const struct GNUNET_DHTU_SignaturePurpose *purpose, | 188 | const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, |
152 | const void *sig, | 189 | const void *sig, |
153 | size_t sig_size) | 190 | size_t sig_size) |
154 | { | 191 | { |
155 | return GNUNET_NO; | 192 | const struct GNUNET_CRYPTO_EddsaSignature *es = sig; |
193 | const struct PublicKey *pub; | ||
194 | |||
195 | GNUNET_assert (sizeof (struct PublicKey) == | ||
196 | ntohs (pk->size)); | ||
197 | pub = (const struct PublicKey *) pk; | ||
198 | if (sizeof (*es) != sig_size) | ||
199 | { | ||
200 | GNUNET_break_op (0); | ||
201 | return GNUNET_SYSERR; | ||
202 | } | ||
203 | if (GNUNET_OK != | ||
204 | GNUNET_CRYPTO_eddsa_verify_ (ntohl (purpose->purpose), | ||
205 | purpose, | ||
206 | es, | ||
207 | &pub->eddsa_pub)) | ||
208 | { | ||
209 | GNUNET_break_op (0); | ||
210 | return GNUNET_SYSERR; | ||
211 | } | ||
212 | return GNUNET_OK; | ||
156 | } | 213 | } |
157 | 214 | ||
158 | 215 | ||
@@ -174,7 +231,7 @@ ip_try_connect (void *cls, | |||
174 | * Request underlay to keep the connection to @a target alive if possible. | 231 | * Request underlay to keep the connection to @a target alive if possible. |
175 | * Hold may be called multiple times to express a strong preference to | 232 | * Hold may be called multiple times to express a strong preference to |
176 | * keep a connection, say because a @a target is in multiple tables. | 233 | * keep a connection, say because a @a target is in multiple tables. |
177 | * | 234 | * |
178 | * @param cls closure | 235 | * @param cls closure |
179 | * @param target connection to keep alive | 236 | * @param target connection to keep alive |
180 | */ | 237 | */ |
@@ -196,7 +253,7 @@ ip_hold (void *cls, | |||
196 | 253 | ||
197 | /** | 254 | /** |
198 | * Do no long request underlay to keep the connection alive. | 255 | * Do no long request underlay to keep the connection alive. |
199 | * | 256 | * |
200 | * @param cls closure | 257 | * @param cls closure |
201 | * @param target connection to keep alive | 258 | * @param target connection to keep alive |
202 | */ | 259 | */ |
@@ -204,7 +261,7 @@ static void | |||
204 | ip_drop (struct GNUNET_DHTU_PreferenceHandle *ph) | 261 | ip_drop (struct GNUNET_DHTU_PreferenceHandle *ph) |
205 | { | 262 | { |
206 | struct GNUNET_DHTU_Target *target = ph->target; | 263 | struct GNUNET_DHTU_Target *target = ph->target; |
207 | 264 | ||
208 | GNUNET_CONTAINER_DLL_remove (target->ph_head, | 265 | GNUNET_CONTAINER_DLL_remove (target->ph_head, |
209 | target->ph_tail, | 266 | target->ph_tail, |
210 | ph); | 267 | ph); |
@@ -225,7 +282,7 @@ ip_drop (struct GNUNET_DHTU_PreferenceHandle *ph) | |||
225 | * @param msg_size number of bytes in @a msg | 282 | * @param msg_size number of bytes in @a msg |
226 | * @param finished_cb function called once transmission is done | 283 | * @param finished_cb function called once transmission is done |
227 | * (not called if @a target disconnects, then only the | 284 | * (not called if @a target disconnects, then only the |
228 | * disconnect_cb is called). | 285 | * disconnect_cb is called). |
229 | * @param finished_cb_cls closure for @a finished_cb | 286 | * @param finished_cb_cls closure for @a finished_cb |
230 | */ | 287 | */ |
231 | static void | 288 | static void |
@@ -240,6 +297,60 @@ ip_send (void *cls, | |||
240 | } | 297 | } |
241 | 298 | ||
242 | 299 | ||
300 | |||
301 | /** | ||
302 | * Method called whenever a given peer connects. | ||
303 | * | ||
304 | * @param cls closure | ||
305 | * @param peer peer identity this notification is about | ||
306 | * @return closure associated with @a peer. given to mq callbacks and | ||
307 | * #GNUNET_CORE_DisconnectEventHandler | ||
308 | */ | ||
309 | static void * | ||
310 | core_connect_cb (void *cls, | ||
311 | const struct GNUNET_PeerIdentity *peer, | ||
312 | struct GNUNET_MQ_Handle *mq) | ||
313 | { | ||
314 | return NULL; | ||
315 | } | ||
316 | |||
317 | |||
318 | /** | ||
319 | * Method called whenever a peer disconnects. | ||
320 | * | ||
321 | * @param cls closure | ||
322 | * @param peer peer identity this notification is about | ||
323 | * @param peer_cls closure associated with peer. given in | ||
324 | * #GNUNET_CORE_ConnectEventHandler | ||
325 | */ | ||
326 | static void | ||
327 | core_disconnect_cb (void *cls, | ||
328 | const struct GNUNET_PeerIdentity *peer, | ||
329 | void *peer_cls) | ||
330 | { | ||
331 | } | ||
332 | |||
333 | |||
334 | /** | ||
335 | * Function called after #GNUNET_CORE_connect has succeeded (or failed | ||
336 | * for good). Note that the private key of the peer is intentionally | ||
337 | * not exposed here; if you need it, your process should try to read | ||
338 | * the private key file directly (which should work if you are | ||
339 | * authorized...). Implementations of this function must not call | ||
340 | * #GNUNET_CORE_disconnect (other than by scheduling a new task to | ||
341 | * do this later). | ||
342 | * | ||
343 | * @param cls closure | ||
344 | * @param my_identity ID of this peer, NULL if we failed | ||
345 | */ | ||
346 | static void | ||
347 | core_init_cb (void *cls, | ||
348 | const struct GNUNET_PeerIdentity *my_identity) | ||
349 | { | ||
350 | struct Plugin *plugin = cls; | ||
351 | } | ||
352 | |||
353 | |||
243 | /** | 354 | /** |
244 | * Entry point for the plugin. | 355 | * Entry point for the plugin. |
245 | * | 356 | * |
@@ -252,6 +363,9 @@ libgnunet_plugin_dhtu_ip_init (void *cls) | |||
252 | struct GNUNET_DHTU_PluginEnvironment *env = cls; | 363 | struct GNUNET_DHTU_PluginEnvironment *env = cls; |
253 | struct GNUNET_DHTU_PluginFunctions *api; | 364 | struct GNUNET_DHTU_PluginFunctions *api; |
254 | struct Plugin *plugin; | 365 | struct Plugin *plugin; |
366 | struct GNUNET_MQ_MessageHandler handlers[] = { | ||
367 | GNUNET_MQ_handler_end () | ||
368 | }; | ||
255 | 369 | ||
256 | plugin = GNUNET_new (struct Plugin); | 370 | plugin = GNUNET_new (struct Plugin); |
257 | plugin->env = env; | 371 | plugin->env = env; |
@@ -263,6 +377,12 @@ libgnunet_plugin_dhtu_ip_init (void *cls) | |||
263 | api->hold = &ip_hold; | 377 | api->hold = &ip_hold; |
264 | api->drop = &ip_drop; | 378 | api->drop = &ip_drop; |
265 | api->send = &ip_send; | 379 | api->send = &ip_send; |
380 | plugin->core = GNUNET_CORE_connect (env->cfg, | ||
381 | plugin, | ||
382 | &core_init_cb, | ||
383 | &core_connect_cb, | ||
384 | &core_disconnect_cb, | ||
385 | handlers); | ||
266 | return api; | 386 | return api; |
267 | } | 387 | } |
268 | 388 | ||
@@ -279,6 +399,7 @@ libgnunet_plugin_dhtu_gnunet_done (void *cls) | |||
279 | struct GNUNET_DHTU_PluginFunctions *api = cls; | 399 | struct GNUNET_DHTU_PluginFunctions *api = cls; |
280 | struct Plugin *plugin = api->cls; | 400 | struct Plugin *plugin = api->cls; |
281 | 401 | ||
402 | GNUNET_CORE_disconnect (plugin->core); | ||
282 | GNUNET_free (plugin); | 403 | GNUNET_free (plugin); |
283 | GNUNET_free (api); | 404 | GNUNET_free (api); |
284 | return NULL; | 405 | return NULL; |
diff --git a/src/dhtu/plugin_dhtu_ip.c b/src/dhtu/plugin_dhtu_ip.c index 8593a69ef..ae35adb37 100644 --- a/src/dhtu/plugin_dhtu_ip.c +++ b/src/dhtu/plugin_dhtu_ip.c | |||
@@ -240,7 +240,7 @@ struct Plugin | |||
240 | static ssize_t | 240 | static ssize_t |
241 | ip_sign (void *cls, | 241 | ip_sign (void *cls, |
242 | const struct GNUNET_DHTU_PrivateKey *pk, | 242 | const struct GNUNET_DHTU_PrivateKey *pk, |
243 | const struct GNUNET_DHTU_SignaturePurpose *purpose, | 243 | const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, |
244 | void **sig) | 244 | void **sig) |
245 | { | 245 | { |
246 | return 0; | 246 | return 0; |
@@ -262,7 +262,7 @@ ip_sign (void *cls, | |||
262 | static enum GNUNET_GenericReturnValue | 262 | static enum GNUNET_GenericReturnValue |
263 | ip_verify (void *cls, | 263 | ip_verify (void *cls, |
264 | const struct GNUNET_DHTU_PublicKey *pk, | 264 | const struct GNUNET_DHTU_PublicKey *pk, |
265 | const struct GNUNET_DHTU_SignaturePurpose *purpose, | 265 | const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, |
266 | const void *sig, | 266 | const void *sig, |
267 | size_t sig_size) | 267 | size_t sig_size) |
268 | { | 268 | { |
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index ca3ddceaa..4472d3ee8 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h | |||
@@ -151,10 +151,10 @@ enum GNUNET_GenericReturnValue | |||
151 | */ | 151 | */ |
152 | 152 | ||
153 | #if __BYTE_ORDER == __LITTLE_ENDIAN | 153 | #if __BYTE_ORDER == __LITTLE_ENDIAN |
154 | #if defined(__linux__) | 154 | #ifdef HAVE_BYTESWAP_H |
155 | #define BYTE_SWAP_16(x) __bswap_16 (x) | 155 | #define BYTE_SWAP_16(x) bswap_16 (x) |
156 | #define BYTE_SWAP_32(x) __bswap_32 (x) | 156 | #define BYTE_SWAP_32(x) bswap_32 (x) |
157 | #define BYTE_SWAP_64(x) __bswap_64 (x) | 157 | #define BYTE_SWAP_64(x) bswap_64 (x) |
158 | #else | 158 | #else |
159 | #define BYTE_SWAP_16(x) ((((x) & 0x00ff) << 8) | (((x) & 0xff00) >> 8)) | 159 | #define BYTE_SWAP_16(x) ((((x) & 0x00ff) << 8) | (((x) & 0xff00) >> 8)) |
160 | 160 | ||
diff --git a/src/include/gnunet_dhtu_plugin.h b/src/include/gnunet_dhtu_plugin.h index df9729a23..e65318fb5 100644 --- a/src/include/gnunet_dhtu_plugin.h +++ b/src/include/gnunet_dhtu_plugin.h | |||
@@ -75,42 +75,18 @@ struct GNUNET_DHTU_PublicKey | |||
75 | 75 | ||
76 | /* followed by size-2 bytes of the actual public key */ | 76 | /* followed by size-2 bytes of the actual public key */ |
77 | }; | 77 | }; |
78 | 78 | ||
79 | 79 | ||
80 | /** | 80 | /** |
81 | * Hash used by the DHT for keys and peers. | 81 | * Hash used by the DHT for keys and peers. |
82 | */ | 82 | */ |
83 | struct GNUNET_DHTU_Hash | 83 | struct GNUNET_DHTU_Hash |
84 | { | 84 | { |
85 | |||
86 | /** | ||
87 | * For now, use a 512 bit hash. (To be discussed). | ||
88 | */ | ||
89 | struct GNUNET_HashCode hc; | ||
90 | }; | ||
91 | |||
92 | 85 | ||
93 | /** | ||
94 | * @brief header of what an DHTU signature signs | ||
95 | * this must be followed by "size - 8" bytes of | ||
96 | * the actual signed data | ||
97 | */ | ||
98 | struct GNUNET_DHTU_SignaturePurpose | ||
99 | { | ||
100 | /** | 86 | /** |
101 | * How many bytes does this signature sign? | 87 | * For now, use a 512 bit hash. (To be discussed). |
102 | * (including this purpose header); in network | ||
103 | * byte order (!). | ||
104 | */ | ||
105 | uint32_t size GNUNET_PACKED; | ||
106 | |||
107 | /** | ||
108 | * What does this signature vouch for? This | ||
109 | * must contain a GNUNET_SIGNATURE_PURPOSE_XXX | ||
110 | * constant (from gnunet_signatures.h). In | ||
111 | * network byte order! | ||
112 | */ | 88 | */ |
113 | uint32_t purpose GNUNET_PACKED; | 89 | struct GNUNET_HashCode hc; |
114 | }; | 90 | }; |
115 | 91 | ||
116 | 92 | ||
@@ -131,7 +107,7 @@ struct GNUNET_DHTU_PluginEnvironment | |||
131 | */ | 107 | */ |
132 | void *cls; | 108 | void *cls; |
133 | 109 | ||
134 | /** | 110 | /** |
135 | * Function to call with new addresses of this peer. | 111 | * Function to call with new addresses of this peer. |
136 | * | 112 | * |
137 | * @param cls the closure | 113 | * @param cls the closure |
@@ -151,7 +127,7 @@ struct GNUNET_DHTU_PluginEnvironment | |||
151 | struct GNUNET_DHTU_Source *source, | 127 | struct GNUNET_DHTU_Source *source, |
152 | void **ctx); | 128 | void **ctx); |
153 | 129 | ||
154 | /** | 130 | /** |
155 | * Function to call with expired addresses of this peer. | 131 | * Function to call with expired addresses of this peer. |
156 | * | 132 | * |
157 | * @param[in] ctx storage space used by the DHT in association with this address | 133 | * @param[in] ctx storage space used by the DHT in association with this address |
@@ -160,7 +136,7 @@ struct GNUNET_DHTU_PluginEnvironment | |||
160 | (*address_del_cb)(void *ctx); | 136 | (*address_del_cb)(void *ctx); |
161 | 137 | ||
162 | /** | 138 | /** |
163 | * We have a new estimate on the size of the underlay. | 139 | * We have a new estimate on the size of the underlay. |
164 | * | 140 | * |
165 | * @param cls closure | 141 | * @param cls closure |
166 | * @param timestamp time when the estimate was received from the server (or created by the server) | 142 | * @param timestamp time when the estimate was received from the server (or created by the server) |
@@ -172,7 +148,7 @@ struct GNUNET_DHTU_PluginEnvironment | |||
172 | struct GNUNET_TIME_Absolute timestamp, | 148 | struct GNUNET_TIME_Absolute timestamp, |
173 | double logestimate, | 149 | double logestimate, |
174 | double std_dev); | 150 | double std_dev); |
175 | 151 | ||
176 | /** | 152 | /** |
177 | * Function to call when we connect to a peer and can henceforth transmit to | 153 | * Function to call when we connect to a peer and can henceforth transmit to |
178 | * that peer. | 154 | * that peer. |
@@ -208,7 +184,7 @@ struct GNUNET_DHTU_PluginEnvironment | |||
208 | * @param cls the closure | 184 | * @param cls the closure |
209 | * @param origin where the message originated from | 185 | * @param origin where the message originated from |
210 | * @param[in,out] tctx ctx of target address where we received the message from | 186 | * @param[in,out] tctx ctx of target address where we received the message from |
211 | * @param[in,out] sctx ctx of our own source address at which we received the message | 187 | * @param[in,out] sctx ctx of our own source address at which we received the message |
212 | * @param message the message we received @param message_size number of | 188 | * @param message the message we received @param message_size number of |
213 | * bytes in @a message | 189 | * bytes in @a message |
214 | */ | 190 | */ |
@@ -244,7 +220,7 @@ struct GNUNET_DHTU_PluginFunctions | |||
244 | ssize_t | 220 | ssize_t |
245 | (*sign)(void *cls, | 221 | (*sign)(void *cls, |
246 | const struct GNUNET_DHTU_PrivateKey *pk, | 222 | const struct GNUNET_DHTU_PrivateKey *pk, |
247 | const struct GNUNET_DHTU_SignaturePurpose *purpose, | 223 | const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, |
248 | void **sig); | 224 | void **sig); |
249 | 225 | ||
250 | /** | 226 | /** |
@@ -262,7 +238,7 @@ struct GNUNET_DHTU_PluginFunctions | |||
262 | enum GNUNET_GenericReturnValue | 238 | enum GNUNET_GenericReturnValue |
263 | (*verify)(void *cls, | 239 | (*verify)(void *cls, |
264 | const struct GNUNET_DHTU_PublicKey *pk, | 240 | const struct GNUNET_DHTU_PublicKey *pk, |
265 | const struct GNUNET_DHTU_SignaturePurpose *purpose, | 241 | const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, |
266 | const void *sig, | 242 | const void *sig, |
267 | size_t sig_size); | 243 | size_t sig_size); |
268 | 244 | ||
@@ -281,7 +257,7 @@ struct GNUNET_DHTU_PluginFunctions | |||
281 | * Request underlay to keep the connection to @a target alive if possible. | 257 | * Request underlay to keep the connection to @a target alive if possible. |
282 | * Hold may be called multiple times to express a strong preference to | 258 | * Hold may be called multiple times to express a strong preference to |
283 | * keep a connection, say because a @a target is in multiple tables. | 259 | * keep a connection, say because a @a target is in multiple tables. |
284 | * | 260 | * |
285 | * @param cls closure | 261 | * @param cls closure |
286 | * @param target connection to keep alive | 262 | * @param target connection to keep alive |
287 | */ | 263 | */ |
@@ -291,13 +267,13 @@ struct GNUNET_DHTU_PluginFunctions | |||
291 | 267 | ||
292 | /** | 268 | /** |
293 | * Do no long request underlay to keep the connection alive. | 269 | * Do no long request underlay to keep the connection alive. |
294 | * | 270 | * |
295 | * @param cls closure | 271 | * @param cls closure |
296 | * @param target connection to keep alive | 272 | * @param target connection to keep alive |
297 | */ | 273 | */ |
298 | void | 274 | void |
299 | (*drop)(struct GNUNET_DHTU_PreferenceHandle *ph); | 275 | (*drop)(struct GNUNET_DHTU_PreferenceHandle *ph); |
300 | 276 | ||
301 | /** | 277 | /** |
302 | * Send message to some other participant over the network. Note that | 278 | * Send message to some other participant over the network. Note that |
303 | * sending is not guaranteeing that the other peer actually received the | 279 | * sending is not guaranteeing that the other peer actually received the |
@@ -310,7 +286,7 @@ struct GNUNET_DHTU_PluginFunctions | |||
310 | * @param msg_size number of bytes in @a msg | 286 | * @param msg_size number of bytes in @a msg |
311 | * @param finished_cb function called once transmission is done | 287 | * @param finished_cb function called once transmission is done |
312 | * (not called if @a target disconnects, then only the | 288 | * (not called if @a target disconnects, then only the |
313 | * disconnect_cb is called). | 289 | * disconnect_cb is called). |
314 | * @param finished_cb_cls closure for @a finished_cb | 290 | * @param finished_cb_cls closure for @a finished_cb |
315 | */ | 291 | */ |
316 | void | 292 | void |
@@ -320,7 +296,7 @@ struct GNUNET_DHTU_PluginFunctions | |||
320 | size_t msg_size, | 296 | size_t msg_size, |
321 | GNUNET_SCHEDULER_TaskCallback finished_cb, | 297 | GNUNET_SCHEDULER_TaskCallback finished_cb, |
322 | void *finished_cb_cls); | 298 | void *finished_cb_cls); |
323 | 299 | ||
324 | }; | 300 | }; |
325 | 301 | ||
326 | 302 | ||
diff --git a/src/include/gnunet_hello_lib.h b/src/include/gnunet_hello_lib.h index fff0045aa..74eca999d 100644 --- a/src/include/gnunet_hello_lib.h +++ b/src/include/gnunet_hello_lib.h | |||
@@ -268,9 +268,10 @@ GNUNET_HELLO_add_address (const struct GNUNET_HELLO_Address *address, | |||
268 | * @return number of bytes written or 0, #GNUNET_SYSERR to signal the | 268 | * @return number of bytes written or 0, #GNUNET_SYSERR to signal the |
269 | * end of the iteration. | 269 | * end of the iteration. |
270 | */ | 270 | */ |
271 | typedef ssize_t (*GNUNET_HELLO_GenerateAddressListCallback) (void *cls, | 271 | typedef ssize_t |
272 | size_t max, | 272 | (*GNUNET_HELLO_GenerateAddressListCallback) (void *cls, |
273 | void *buf); | 273 | size_t max, |
274 | void *buf); | ||
274 | 275 | ||
275 | 276 | ||
276 | /** | 277 | /** |
diff --git a/src/include/gnunet_mq_lib.h b/src/include/gnunet_mq_lib.h index 37bba8c1b..765647a98 100644 --- a/src/include/gnunet_mq_lib.h +++ b/src/include/gnunet_mq_lib.h | |||
@@ -331,9 +331,10 @@ typedef int (*GNUNET_MQ_MessageValidationCallback) ( | |||
331 | * @param msg the message to send | 331 | * @param msg the message to send |
332 | * @param impl_state state of the implementation | 332 | * @param impl_state state of the implementation |
333 | */ | 333 | */ |
334 | typedef void (*GNUNET_MQ_SendImpl) (struct GNUNET_MQ_Handle *mq, | 334 | typedef void |
335 | const struct GNUNET_MessageHeader *msg, | 335 | (*GNUNET_MQ_SendImpl) (struct GNUNET_MQ_Handle *mq, |
336 | void *impl_state); | 336 | const struct GNUNET_MessageHeader *msg, |
337 | void *impl_state); | ||
337 | 338 | ||
338 | 339 | ||
339 | /** | 340 | /** |
@@ -345,8 +346,9 @@ typedef void (*GNUNET_MQ_SendImpl) (struct GNUNET_MQ_Handle *mq, | |||
345 | * @param mq the message queue to destroy | 346 | * @param mq the message queue to destroy |
346 | * @param impl_state state of the implementation | 347 | * @param impl_state state of the implementation |
347 | */ | 348 | */ |
348 | typedef void (*GNUNET_MQ_DestroyImpl) (struct GNUNET_MQ_Handle *mq, | 349 | typedef void |
349 | void *impl_state); | 350 | (*GNUNET_MQ_DestroyImpl) (struct GNUNET_MQ_Handle *mq, |
351 | void *impl_state); | ||
350 | 352 | ||
351 | 353 | ||
352 | /** | 354 | /** |
@@ -355,8 +357,9 @@ typedef void (*GNUNET_MQ_DestroyImpl) (struct GNUNET_MQ_Handle *mq, | |||
355 | * @param mq message queue | 357 | * @param mq message queue |
356 | * @param impl_state state specific to the implementation | 358 | * @param impl_state state specific to the implementation |
357 | */ | 359 | */ |
358 | typedef void (*GNUNET_MQ_CancelImpl) (struct GNUNET_MQ_Handle *mq, | 360 | typedef void |
359 | void *impl_state); | 361 | (*GNUNET_MQ_CancelImpl) (struct GNUNET_MQ_Handle *mq, |
362 | void *impl_state); | ||
360 | 363 | ||
361 | 364 | ||
362 | /** | 365 | /** |
@@ -368,7 +371,9 @@ typedef void (*GNUNET_MQ_CancelImpl) (struct GNUNET_MQ_Handle *mq, | |||
368 | * @param cls closure | 371 | * @param cls closure |
369 | * @param error error code | 372 | * @param error error code |
370 | */ | 373 | */ |
371 | typedef void (*GNUNET_MQ_ErrorHandler) (void *cls, enum GNUNET_MQ_Error error); | 374 | typedef void |
375 | (*GNUNET_MQ_ErrorHandler) (void *cls, | ||
376 | enum GNUNET_MQ_Error error); | ||
372 | 377 | ||
373 | 378 | ||
374 | /** | 379 | /** |
diff --git a/src/include/gnunet_transport_service.h b/src/include/gnunet_transport_service.h index d190eff92..545bb28d2 100644 --- a/src/include/gnunet_transport_service.h +++ b/src/include/gnunet_transport_service.h | |||
@@ -115,7 +115,8 @@ struct GNUNET_TRANSPORT_AddressToStringContext; | |||
115 | * if #GNUNET_NO: address was invalid (or not supported) | 115 | * if #GNUNET_NO: address was invalid (or not supported) |
116 | * if #GNUNET_SYSERR: communication error (IPC error) | 116 | * if #GNUNET_SYSERR: communication error (IPC error) |
117 | */ | 117 | */ |
118 | typedef void (*GNUNET_TRANSPORT_AddressToStringCallback) (void *cls, | 118 | typedef void |
119 | (*GNUNET_TRANSPORT_AddressToStringCallback) (void *cls, | ||
119 | const char *address, | 120 | const char *address, |
120 | int res); | 121 | int res); |
121 | 122 | ||
@@ -326,7 +327,8 @@ struct GNUNET_TRANSPORT_PeerMonitoringContext; | |||
326 | * @param state current state this peer is in | 327 | * @param state current state this peer is in |
327 | * @param state_timeout timeout for the current state of the peer | 328 | * @param state_timeout timeout for the current state of the peer |
328 | */ | 329 | */ |
329 | typedef void (*GNUNET_TRANSPORT_PeerIterateCallback) ( | 330 | typedef void |
331 | (*GNUNET_TRANSPORT_PeerIterateCallback) ( | ||
330 | void *cls, | 332 | void *cls, |
331 | const struct GNUNET_PeerIdentity *peer, | 333 | const struct GNUNET_PeerIdentity *peer, |
332 | const struct GNUNET_HELLO_Address *address, | 334 | const struct GNUNET_HELLO_Address *address, |
@@ -394,7 +396,8 @@ struct GNUNET_TRANSPORT_Blacklist; | |||
394 | * @param pid peer to approve or disapproave | 396 | * @param pid peer to approve or disapproave |
395 | * @return #GNUNET_OK if the connection is allowed, #GNUNET_SYSERR if not | 397 | * @return #GNUNET_OK if the connection is allowed, #GNUNET_SYSERR if not |
396 | */ | 398 | */ |
397 | typedef int (*GNUNET_TRANSPORT_BlacklistCallback) ( | 399 | typedef int |
400 | (*GNUNET_TRANSPORT_BlacklistCallback) ( | ||
398 | void *cls, | 401 | void *cls, |
399 | const struct GNUNET_PeerIdentity *pid); | 402 | const struct GNUNET_PeerIdentity *pid); |
400 | 403 | ||
@@ -541,7 +544,8 @@ struct GNUNET_TRANSPORT_SessionInfo | |||
541 | * NULL with @a session being non-NULL if the monitor | 544 | * NULL with @a session being non-NULL if the monitor |
542 | * was being cancelled while sessions were active | 545 | * was being cancelled while sessions were active |
543 | */ | 546 | */ |
544 | typedef void (*GNUNET_TRANSPORT_SessionMonitorCallback) ( | 547 | typedef void |
548 | (*GNUNET_TRANSPORT_SessionMonitorCallback) ( | ||
545 | void *cls, | 549 | void *cls, |
546 | struct GNUNET_TRANSPORT_PluginSession *session, | 550 | struct GNUNET_TRANSPORT_PluginSession *session, |
547 | void **session_ctx, | 551 | void **session_ctx, |
@@ -593,7 +597,8 @@ struct GNUNET_TRANSPORT_CoreHandle; | |||
593 | * @param mq message queue to use to transmit to @a peer | 597 | * @param mq message queue to use to transmit to @a peer |
594 | * @return closure to use in MQ handlers | 598 | * @return closure to use in MQ handlers |
595 | */ | 599 | */ |
596 | typedef void *(*GNUNET_TRANSPORT_NotifyConnect) ( | 600 | typedef void * |
601 | (*GNUNET_TRANSPORT_NotifyConnect) ( | ||
597 | void *cls, | 602 | void *cls, |
598 | const struct GNUNET_PeerIdentity *peer, | 603 | const struct GNUNET_PeerIdentity *peer, |
599 | struct GNUNET_MQ_Handle *mq); | 604 | struct GNUNET_MQ_Handle *mq); |
@@ -610,7 +615,8 @@ typedef void *(*GNUNET_TRANSPORT_NotifyConnect) ( | |||
610 | * @param handlers_cls closure of the handlers, was returned from the | 615 | * @param handlers_cls closure of the handlers, was returned from the |
611 | * connect notification callback | 616 | * connect notification callback |
612 | */ | 617 | */ |
613 | typedef void (*GNUNET_TRANSPORT_NotifyDisconnect) ( | 618 | typedef void |
619 | (*GNUNET_TRANSPORT_NotifyDisconnect) ( | ||
614 | void *cls, | 620 | void *cls, |
615 | const struct GNUNET_PeerIdentity *peer, | 621 | const struct GNUNET_PeerIdentity *peer, |
616 | void *handler_cls); | 622 | void *handler_cls); |
@@ -632,7 +638,8 @@ typedef void (*GNUNET_TRANSPORT_NotifyDisconnect) ( | |||
632 | * @param handlers_cls closure of the handlers, was returned from the | 638 | * @param handlers_cls closure of the handlers, was returned from the |
633 | * connect notification callback | 639 | * connect notification callback |
634 | */ | 640 | */ |
635 | typedef void (*GNUNET_TRANSPORT_NotifyExcessBandwidth) ( | 641 | typedef void |
642 | (*GNUNET_TRANSPORT_NotifyExcessBandwidth) ( | ||
636 | void *cls, | 643 | void *cls, |
637 | const struct GNUNET_PeerIdentity *neighbour, | 644 | const struct GNUNET_PeerIdentity *neighbour, |
638 | void *handlers_cls); | 645 | void *handlers_cls); |
diff --git a/src/transport/test_transport_port_forward.c b/src/transport/test_transport_port_forward.c index b0f0b113e..d3233c2da 100644 --- a/src/transport/test_transport_port_forward.c +++ b/src/transport/test_transport_port_forward.c | |||
@@ -21,7 +21,7 @@ | |||
21 | /** | 21 | /** |
22 | * @file transport/test_transport_port_forward.c | 22 | * @file transport/test_transport_port_forward.c |
23 | * @brief Test case executing a script which sends a test UDP message from a nated peer | 23 | * @brief Test case executing a script which sends a test UDP message from a nated peer |
24 | * to a gloabl known peer. There is a tcp port forwarding in place towards the | 24 | * to a global known peer. There is a tcp port forwarding in place towards the |
25 | * natted peer to test the backchannel functionality of the TNG service. | 25 | * natted peer to test the backchannel functionality of the TNG service. |
26 | * @author t3sserakt | 26 | * @author t3sserakt |
27 | */ | 27 | */ |
diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c index 797de0b0d..2ca78577e 100644 --- a/src/util/gnunet-config.c +++ b/src/util/gnunet-config.c | |||
@@ -36,6 +36,25 @@ static char *backend_check; | |||
36 | 36 | ||
37 | 37 | ||
38 | /** | 38 | /** |
39 | * If printing the value of CFLAGS has been requested. | ||
40 | */ | ||
41 | static int cflags; | ||
42 | |||
43 | |||
44 | /** | ||
45 | * If printing the value of LIBS has been requested. | ||
46 | */ | ||
47 | static int libs; | ||
48 | |||
49 | |||
50 | /** | ||
51 | * If printing the value of PREFIX has been requested. | ||
52 | */ | ||
53 | static int prefix; | ||
54 | |||
55 | |||
56 | /** | ||
57 | * Print each option in a given section. | ||
39 | * Main task to run to perform operations typical for | 58 | * Main task to run to perform operations typical for |
40 | * gnunet-config as per the configuration settings | 59 | * gnunet-config as per the configuration settings |
41 | * given in @a cls. | 60 | * given in @a cls. |
@@ -54,6 +73,28 @@ run (void *cls, | |||
54 | { | 73 | { |
55 | struct GNUNET_CONFIGURATION_ConfigSettings *cs = cls; | 74 | struct GNUNET_CONFIGURATION_ConfigSettings *cs = cls; |
56 | 75 | ||
76 | if (1 == cflags || 1 == libs || 1 == prefix) | ||
77 | { | ||
78 | char *prefixdir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_PREFIX); | ||
79 | char *libdir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LIBDIR); | ||
80 | |||
81 | if (1 == cflags) | ||
82 | { | ||
83 | fprintf (stdout, "-I%sinclude\n", prefixdir); | ||
84 | } | ||
85 | if (1 == libs) | ||
86 | { | ||
87 | fprintf (stdout, "-L%s -lgnunetutil\n", libdir); | ||
88 | } | ||
89 | if (1 == prefix) | ||
90 | { | ||
91 | fprintf (stdout, "%s\n", prefixdir); | ||
92 | } | ||
93 | cs->global_ret = 0; | ||
94 | GNUNET_free (prefixdir); | ||
95 | GNUNET_free (libdir); | ||
96 | return; | ||
97 | } | ||
57 | if (NULL != backend_check) | 98 | if (NULL != backend_check) |
58 | { | 99 | { |
59 | char *name; | 100 | char *name; |
@@ -97,6 +138,24 @@ main (int argc, | |||
97 | gettext_noop ( | 138 | gettext_noop ( |
98 | "test if the current installation supports the specified BACKEND"), | 139 | "test if the current installation supports the specified BACKEND"), |
99 | &backend_check)), | 140 | &backend_check)), |
141 | GNUNET_GETOPT_option_flag ( | ||
142 | 'C', | ||
143 | "cflags", | ||
144 | gettext_noop ( | ||
145 | "Provide an appropriate value for CFLAGS to applications building on top of GNUnet"), | ||
146 | &cflags), | ||
147 | GNUNET_GETOPT_option_flag ( | ||
148 | 'j', | ||
149 | "libs", | ||
150 | gettext_noop ( | ||
151 | "Provide an appropriate value for LIBS to applications building on top of GNUnet"), | ||
152 | &libs), | ||
153 | GNUNET_GETOPT_option_flag ( | ||
154 | 'p', | ||
155 | "prefix", | ||
156 | gettext_noop ( | ||
157 | "Provide the path under which GNUnet was installed"), | ||
158 | &prefix), | ||
100 | GNUNET_CONFIGURATION_CONFIG_OPTIONS (&cs), | 159 | GNUNET_CONFIGURATION_CONFIG_OPTIONS (&cs), |
101 | GNUNET_GETOPT_OPTION_END | 160 | GNUNET_GETOPT_OPTION_END |
102 | }; | 161 | }; |