diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-12-05 14:15:25 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-12-05 14:15:25 +0000 |
commit | 44d957c38051c6e778595b74f4a831da8ad1a179 (patch) | |
tree | 235e33b27ba570e6e857f306ff4ed27791d21d14 | |
parent | b83fc2e7baf2713881c1ff59971e6dbd4609e771 (diff) | |
download | gnunet-44d957c38051c6e778595b74f4a831da8ad1a179.tar.gz gnunet-44d957c38051c6e778595b74f4a831da8ad1a179.zip |
- change mesh channel creation/notification API
-rw-r--r-- | src/conversation/gnunet-service-conversation.c | 6 | ||||
-rw-r--r-- | src/exit/gnunet-daemon-exit.c | 3 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_mesh_client.c | 6 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_mesh_server.c | 3 | ||||
-rw-r--r-- | src/include/gnunet_mesh_service.h | 19 | ||||
-rw-r--r-- | src/mesh/mesh_api.c | 65 | ||||
-rw-r--r-- | src/mesh/test_mesh_local.c | 5 | ||||
-rw-r--r-- | src/mesh/test_mesh_single.c | 6 | ||||
-rw-r--r-- | src/mesh/test_mesh_small.c | 12 | ||||
-rw-r--r-- | src/pt/gnunet-daemon-pt.c | 3 | ||||
-rw-r--r-- | src/scalarproduct/gnunet-service-scalarproduct.c | 37 | ||||
-rw-r--r-- | src/set/gnunet-service-set.c | 72 | ||||
-rw-r--r-- | src/vpn/gnunet-service-vpn.c | 8 |
13 files changed, 111 insertions, 134 deletions
diff --git a/src/conversation/gnunet-service-conversation.c b/src/conversation/gnunet-service-conversation.c index 38344f5ce..1a2f439b6 100644 --- a/src/conversation/gnunet-service-conversation.c +++ b/src/conversation/gnunet-service-conversation.c | |||
@@ -701,8 +701,7 @@ handle_client_call_message (void *cls, | |||
701 | ch, | 701 | ch, |
702 | &msg->target, | 702 | &msg->target, |
703 | GNUNET_APPLICATION_TYPE_CONVERSATION_CONTROL, | 703 | GNUNET_APPLICATION_TYPE_CONVERSATION_CONTROL, |
704 | GNUNET_NO, | 704 | GNUNET_MESH_OPTION_RELIABLE); |
705 | GNUNET_YES); | ||
706 | ch->reliable_mq = GNUNET_MESH_mq_create (ch->channel_reliable); | 705 | ch->reliable_mq = GNUNET_MESH_mq_create (ch->channel_reliable); |
707 | e = GNUNET_MQ_msg (ring, GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RING); | 706 | e = GNUNET_MQ_msg (ring, GNUNET_MESSAGE_TYPE_CONVERSATION_MESH_PHONE_RING); |
708 | ring->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING); | 707 | ring->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CONVERSATION_RING); |
@@ -1073,8 +1072,7 @@ handle_mesh_pickup_message (void *cls, | |||
1073 | ch, | 1072 | ch, |
1074 | &ch->target, | 1073 | &ch->target, |
1075 | GNUNET_APPLICATION_TYPE_CONVERSATION_AUDIO, | 1074 | GNUNET_APPLICATION_TYPE_CONVERSATION_AUDIO, |
1076 | GNUNET_YES, | 1075 | GNUNET_MESH_OPTION_DEFAULT); |
1077 | GNUNET_NO); | ||
1078 | if (NULL == ch->channel_unreliable) | 1076 | if (NULL == ch->channel_unreliable) |
1079 | { | 1077 | { |
1080 | GNUNET_break (0); | 1078 | GNUNET_break (0); |
diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c index 819e4f4b6..3bdac2d51 100644 --- a/src/exit/gnunet-daemon-exit.c +++ b/src/exit/gnunet-daemon-exit.c | |||
@@ -3008,13 +3008,14 @@ receive_udp_service (void *cls, | |||
3008 | * @param channel new handle to the channel | 3008 | * @param channel new handle to the channel |
3009 | * @param initiator peer that started the channel | 3009 | * @param initiator peer that started the channel |
3010 | * @param port destination port | 3010 | * @param port destination port |
3011 | * @param options channel options flags | ||
3011 | * @return initial channel context for the channel | 3012 | * @return initial channel context for the channel |
3012 | */ | 3013 | */ |
3013 | static void * | 3014 | static void * |
3014 | new_channel (void *cls, | 3015 | new_channel (void *cls, |
3015 | struct GNUNET_MESH_Channel *channel, | 3016 | struct GNUNET_MESH_Channel *channel, |
3016 | const struct GNUNET_PeerIdentity *initiator, | 3017 | const struct GNUNET_PeerIdentity *initiator, |
3017 | uint32_t port) | 3018 | uint32_t port, enum MeshOption options) |
3018 | { | 3019 | { |
3019 | struct ChannelState *s = GNUNET_new (struct ChannelState); | 3020 | struct ChannelState *s = GNUNET_new (struct ChannelState); |
3020 | 3021 | ||
diff --git a/src/fs/gnunet-service-fs_mesh_client.c b/src/fs/gnunet-service-fs_mesh_client.c index 7bf6fb115..95e370274 100644 --- a/src/fs/gnunet-service-fs_mesh_client.c +++ b/src/fs/gnunet-service-fs_mesh_client.c | |||
@@ -228,8 +228,7 @@ reset_mesh (struct MeshHandle *mh) | |||
228 | mh, | 228 | mh, |
229 | &mh->target, | 229 | &mh->target, |
230 | GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER, | 230 | GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER, |
231 | GNUNET_NO, | 231 | GNUNET_MESH_OPTION_RELIABLE); |
232 | GNUNET_YES); | ||
233 | transmit_pending (mh); | 232 | transmit_pending (mh); |
234 | } | 233 | } |
235 | 234 | ||
@@ -543,8 +542,7 @@ get_mesh (const struct GNUNET_PeerIdentity *target) | |||
543 | mh, | 542 | mh, |
544 | &mh->target, | 543 | &mh->target, |
545 | GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER, | 544 | GNUNET_APPLICATION_TYPE_FS_BLOCK_TRANSFER, |
546 | GNUNET_NO, | 545 | GNUNET_MESH_OPTION_RELIABLE); |
547 | GNUNET_YES); | ||
548 | GNUNET_assert (mh == | 546 | GNUNET_assert (mh == |
549 | GNUNET_CONTAINER_multipeermap_get (mesh_map, | 547 | GNUNET_CONTAINER_multipeermap_get (mesh_map, |
550 | target)); | 548 | target)); |
diff --git a/src/fs/gnunet-service-fs_mesh_server.c b/src/fs/gnunet-service-fs_mesh_server.c index 4e11221e4..fe2d43135 100644 --- a/src/fs/gnunet-service-fs_mesh_server.c +++ b/src/fs/gnunet-service-fs_mesh_server.c | |||
@@ -458,13 +458,14 @@ request_cb (void *cls, | |||
458 | * @param initiator the identity of the peer who wants to establish a mesh | 458 | * @param initiator the identity of the peer who wants to establish a mesh |
459 | * with us; NULL on binding error | 459 | * with us; NULL on binding error |
460 | * @param port mesh port used for the incoming connection | 460 | * @param port mesh port used for the incoming connection |
461 | * @param options channel option flags | ||
461 | * @return initial channel context (our 'struct MeshClient') | 462 | * @return initial channel context (our 'struct MeshClient') |
462 | */ | 463 | */ |
463 | static void * | 464 | static void * |
464 | accept_cb (void *cls, | 465 | accept_cb (void *cls, |
465 | struct GNUNET_MESH_Channel *channel, | 466 | struct GNUNET_MESH_Channel *channel, |
466 | const struct GNUNET_PeerIdentity *initiator, | 467 | const struct GNUNET_PeerIdentity *initiator, |
467 | uint32_t port) | 468 | uint32_t port, enum MeshOption options) |
468 | { | 469 | { |
469 | struct MeshClient *sc; | 470 | struct MeshClient *sc; |
470 | 471 | ||
diff --git a/src/include/gnunet_mesh_service.h b/src/include/gnunet_mesh_service.h index d5d4e39d1..00894506e 100644 --- a/src/include/gnunet_mesh_service.h +++ b/src/include/gnunet_mesh_service.h | |||
@@ -62,6 +62,11 @@ struct GNUNET_MESH_Channel; | |||
62 | enum MeshOption | 62 | enum MeshOption |
63 | { | 63 | { |
64 | /** | 64 | /** |
65 | * Default options: unreliable, default buffering, not out of order. | ||
66 | */ | ||
67 | GNUNET_MESH_OPTION_DEFAULT = 0x0, | ||
68 | |||
69 | /** | ||
65 | * Disable buffering on intermediate nodes (for minimum latency). | 70 | * Disable buffering on intermediate nodes (for minimum latency). |
66 | * Yes/No. | 71 | * Yes/No. |
67 | */ | 72 | */ |
@@ -81,6 +86,7 @@ enum MeshOption | |||
81 | 86 | ||
82 | /** | 87 | /** |
83 | * Who is the peer at the other end of the channel. | 88 | * Who is the peer at the other end of the channel. |
89 | * Only for use in @c GNUNET_MESH_channel_get_info | ||
84 | * struct GNUNET_PeerIdentity *peer | 90 | * struct GNUNET_PeerIdentity *peer |
85 | */ | 91 | */ |
86 | GNUNET_MESH_OPTION_PEER = 0x8 | 92 | GNUNET_MESH_OPTION_PEER = 0x8 |
@@ -146,6 +152,8 @@ struct GNUNET_MESH_MessageHandler | |||
146 | * @param channel new handle to the channel | 152 | * @param channel new handle to the channel |
147 | * @param initiator peer that started the channel | 153 | * @param initiator peer that started the channel |
148 | * @param port Port this channel is for. | 154 | * @param port Port this channel is for. |
155 | * @param options MeshOption flag field, with all active option bits set to 1. | ||
156 | * | ||
149 | * @return initial channel context for the channel | 157 | * @return initial channel context for the channel |
150 | * (can be NULL -- that's not an error) | 158 | * (can be NULL -- that's not an error) |
151 | */ | 159 | */ |
@@ -156,7 +164,9 @@ typedef void *(GNUNET_MESH_InboundChannelNotificationHandler) (void *cls, | |||
156 | const struct | 164 | const struct |
157 | GNUNET_PeerIdentity | 165 | GNUNET_PeerIdentity |
158 | * initiator, | 166 | * initiator, |
159 | uint32_t port); | 167 | uint32_t port, |
168 | enum MeshOption | ||
169 | options); | ||
160 | 170 | ||
161 | 171 | ||
162 | /** | 172 | /** |
@@ -229,8 +239,8 @@ GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle); | |||
229 | * @param channel_ctx client's channel context to associate with the channel | 239 | * @param channel_ctx client's channel context to associate with the channel |
230 | * @param peer peer identity the channel should go to | 240 | * @param peer peer identity the channel should go to |
231 | * @param port Port number. | 241 | * @param port Port number. |
232 | * @param nobuffer Flag for disabling buffering on relay nodes. | 242 | * @param options MeshOption flag field, with all desired option bits set to 1. |
233 | * @param reliable Flag for end-to-end reliability. | 243 | * |
234 | * @return handle to the channel | 244 | * @return handle to the channel |
235 | */ | 245 | */ |
236 | struct GNUNET_MESH_Channel * | 246 | struct GNUNET_MESH_Channel * |
@@ -238,8 +248,7 @@ GNUNET_MESH_channel_create (struct GNUNET_MESH_Handle *h, | |||
238 | void *channel_ctx, | 248 | void *channel_ctx, |
239 | const struct GNUNET_PeerIdentity *peer, | 249 | const struct GNUNET_PeerIdentity *peer, |
240 | uint32_t port, | 250 | uint32_t port, |
241 | int nobuffer, | 251 | enum MeshOption options); |
242 | int reliable); | ||
243 | 252 | ||
244 | 253 | ||
245 | /** | 254 | /** |
diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c index 0d1d70026..46dfe546f 100644 --- a/src/mesh/mesh_api.c +++ b/src/mesh/mesh_api.c | |||
@@ -277,19 +277,9 @@ struct GNUNET_MESH_Channel | |||
277 | unsigned int packet_size; | 277 | unsigned int packet_size; |
278 | 278 | ||
279 | /** | 279 | /** |
280 | * Is the channel allowed to buffer? | 280 | * Channel options: reliability, etc. |
281 | */ | 281 | */ |
282 | int nobuffer; | 282 | enum MeshOption options; |
283 | |||
284 | /** | ||
285 | * Is the channel realiable? | ||
286 | */ | ||
287 | int reliable; | ||
288 | |||
289 | /** | ||
290 | * If reliable, is the channel out of order? | ||
291 | */ | ||
292 | int ooorder; | ||
293 | 283 | ||
294 | /** | 284 | /** |
295 | * Are we allowed to send to the service? | 285 | * Are we allowed to send to the service? |
@@ -439,7 +429,6 @@ create_channel (struct GNUNET_MESH_Handle *h, MESH_ChannelNumber chid) | |||
439 | ch->chid = chid; | 429 | ch->chid = chid; |
440 | } | 430 | } |
441 | ch->allow_send = GNUNET_NO; | 431 | ch->allow_send = GNUNET_NO; |
442 | ch->nobuffer = GNUNET_NO; | ||
443 | return ch; | 432 | return ch; |
444 | } | 433 | } |
445 | 434 | ||
@@ -782,24 +771,10 @@ process_channel_created (struct GNUNET_MESH_Handle *h, | |||
782 | ch->mesh = h; | 771 | ch->mesh = h; |
783 | ch->chid = chid; | 772 | ch->chid = chid; |
784 | ch->port = port; | 773 | ch->port = port; |
785 | if (0 != (msg->opt & GNUNET_MESH_OPTION_NOBUFFER)) | 774 | ch->options = ntohl (msg->opt); |
786 | ch->nobuffer = GNUNET_YES; | ||
787 | else | ||
788 | ch->nobuffer = GNUNET_NO; | ||
789 | |||
790 | if (0 != (msg->opt & GNUNET_MESH_OPTION_RELIABLE)) | ||
791 | ch->reliable = GNUNET_YES; | ||
792 | else | ||
793 | ch->reliable = GNUNET_NO; | ||
794 | |||
795 | if (GNUNET_YES == ch->reliable && | ||
796 | 0 != (msg->opt & GNUNET_MESH_OPTION_OOORDER)) | ||
797 | ch->ooorder = GNUNET_YES; | ||
798 | else | ||
799 | ch->ooorder = GNUNET_NO; | ||
800 | 775 | ||
801 | LOG (GNUNET_ERROR_TYPE_DEBUG, " created channel %p\n", ch); | 776 | LOG (GNUNET_ERROR_TYPE_DEBUG, " created channel %p\n", ch); |
802 | ctx = h->new_channel (h->cls, ch, &msg->peer, ch->port); | 777 | ctx = h->new_channel (h->cls, ch, &msg->peer, ch->port, ch->options); |
803 | if (NULL != ctx) | 778 | if (NULL != ctx) |
804 | ch->ctx = ctx; | 779 | ch->ctx = ctx; |
805 | LOG (GNUNET_ERROR_TYPE_DEBUG, "User notified\n"); | 780 | LOG (GNUNET_ERROR_TYPE_DEBUG, "User notified\n"); |
@@ -1398,18 +1373,16 @@ GNUNET_MESH_disconnect (struct GNUNET_MESH_Handle *handle) | |||
1398 | * @param channel_ctx client's channel context to associate with the channel | 1373 | * @param channel_ctx client's channel context to associate with the channel |
1399 | * @param peer peer identity the channel should go to | 1374 | * @param peer peer identity the channel should go to |
1400 | * @param port Port number. | 1375 | * @param port Port number. |
1401 | * @param nobuffer Flag for disabling buffering on relay nodes. | 1376 | * @param options MeshOption flag field, with all desired option bits set to 1. |
1402 | * @param reliable Flag for end-to-end reliability. | ||
1403 | * | 1377 | * |
1404 | * @return handle to the channel | 1378 | * @return handle to the channel |
1405 | */ | 1379 | */ |
1406 | struct GNUNET_MESH_Channel * | 1380 | struct GNUNET_MESH_Channel * |
1407 | GNUNET_MESH_channel_create (struct GNUNET_MESH_Handle *h, | 1381 | GNUNET_MESH_channel_create (struct GNUNET_MESH_Handle *h, |
1408 | void *channel_ctx, | 1382 | void *channel_ctx, |
1409 | const struct GNUNET_PeerIdentity *peer, | 1383 | const struct GNUNET_PeerIdentity *peer, |
1410 | uint32_t port, | 1384 | uint32_t port, |
1411 | int nobuffer, | 1385 | enum MeshOption options) |
1412 | int reliable) | ||
1413 | { | 1386 | { |
1414 | struct GNUNET_MESH_Channel *ch; | 1387 | struct GNUNET_MESH_Channel *ch; |
1415 | struct GNUNET_MESH_ChannelMessage msg; | 1388 | struct GNUNET_MESH_ChannelMessage msg; |
@@ -1427,12 +1400,7 @@ GNUNET_MESH_channel_create (struct GNUNET_MESH_Handle *h, | |||
1427 | msg.channel_id = htonl (ch->chid); | 1400 | msg.channel_id = htonl (ch->chid); |
1428 | msg.port = htonl (port); | 1401 | msg.port = htonl (port); |
1429 | msg.peer = *peer; | 1402 | msg.peer = *peer; |
1430 | msg.opt = 0; | 1403 | msg.opt = htonl (options); |
1431 | if (GNUNET_YES == reliable) | ||
1432 | msg.opt |= GNUNET_MESH_OPTION_RELIABLE; | ||
1433 | if (GNUNET_YES == nobuffer) | ||
1434 | msg.opt |= GNUNET_MESH_OPTION_NOBUFFER; | ||
1435 | msg.opt = htonl (msg.opt); | ||
1436 | ch->allow_send = 0; | 1404 | ch->allow_send = 0; |
1437 | send_packet (h, &msg.header, ch); | 1405 | send_packet (h, &msg.header, ch); |
1438 | return ch; | 1406 | return ch; |
@@ -1489,20 +1457,21 @@ GNUNET_MESH_channel_destroy (struct GNUNET_MESH_Channel *channel) | |||
1489 | */ | 1457 | */ |
1490 | const union GNUNET_MESH_ChannelInfo * | 1458 | const union GNUNET_MESH_ChannelInfo * |
1491 | GNUNET_MESH_channel_get_info (struct GNUNET_MESH_Channel *channel, | 1459 | GNUNET_MESH_channel_get_info (struct GNUNET_MESH_Channel *channel, |
1492 | enum MeshOption option, ...) | 1460 | enum MeshOption option, ...) |
1493 | { | 1461 | { |
1462 | static int bool_flag; | ||
1494 | const union GNUNET_MESH_ChannelInfo *ret; | 1463 | const union GNUNET_MESH_ChannelInfo *ret; |
1495 | 1464 | ||
1496 | switch (option) | 1465 | switch (option) |
1497 | { | 1466 | { |
1498 | case GNUNET_MESH_OPTION_NOBUFFER: | 1467 | case GNUNET_MESH_OPTION_NOBUFFER: |
1499 | ret = (const union GNUNET_MESH_ChannelInfo *) &channel->nobuffer; | ||
1500 | break; | ||
1501 | case GNUNET_MESH_OPTION_RELIABLE: | 1468 | case GNUNET_MESH_OPTION_RELIABLE: |
1502 | ret = (const union GNUNET_MESH_ChannelInfo *) &channel->reliable; | ||
1503 | break; | ||
1504 | case GNUNET_MESH_OPTION_OOORDER: | 1469 | case GNUNET_MESH_OPTION_OOORDER: |
1505 | ret = (const union GNUNET_MESH_ChannelInfo *) &channel->ooorder; | 1470 | if (0 != (option & channel->options)) |
1471 | bool_flag = GNUNET_YES; | ||
1472 | else | ||
1473 | bool_flag = GNUNET_NO; | ||
1474 | ret = (const union GNUNET_MESH_ChannelInfo *) &bool_flag; | ||
1506 | break; | 1475 | break; |
1507 | case GNUNET_MESH_OPTION_PEER: | 1476 | case GNUNET_MESH_OPTION_PEER: |
1508 | ret = (const union GNUNET_MESH_ChannelInfo *) GNUNET_PEER_resolve2 (channel->peer); | 1477 | ret = (const union GNUNET_MESH_ChannelInfo *) GNUNET_PEER_resolve2 (channel->peer); |
diff --git a/src/mesh/test_mesh_local.c b/src/mesh/test_mesh_local.c index bdd603351..35a16b0d9 100644 --- a/src/mesh/test_mesh_local.c +++ b/src/mesh/test_mesh_local.c | |||
@@ -141,13 +141,14 @@ data_callback (void *cls, struct GNUNET_MESH_Channel *channel, | |||
141 | * @param channel new handle to the channel | 141 | * @param channel new handle to the channel |
142 | * @param initiator peer that started the channel | 142 | * @param initiator peer that started the channel |
143 | * @param port port number | 143 | * @param port port number |
144 | * @param options channel options | ||
144 | * @return initial channel context for the channel | 145 | * @return initial channel context for the channel |
145 | * (can be NULL -- that's not an error) | 146 | * (can be NULL -- that's not an error) |
146 | */ | 147 | */ |
147 | static void * | 148 | static void * |
148 | inbound_channel (void *cls, struct GNUNET_MESH_Channel *channel, | 149 | inbound_channel (void *cls, struct GNUNET_MESH_Channel *channel, |
149 | const struct GNUNET_PeerIdentity *initiator, | 150 | const struct GNUNET_PeerIdentity *initiator, |
150 | uint32_t port) | 151 | uint32_t port, enum MeshOption options) |
151 | { | 152 | { |
152 | long id = (long) cls; | 153 | long id = (long) cls; |
153 | 154 | ||
@@ -256,7 +257,7 @@ do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
256 | GNUNET_TESTING_peer_get_identity (me, &id); | 257 | GNUNET_TESTING_peer_get_identity (me, &id); |
257 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CONNECT BY PORT\n"); | 258 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CONNECT BY PORT\n"); |
258 | ch = GNUNET_MESH_channel_create (mesh_peer_1, NULL, &id, 1, | 259 | ch = GNUNET_MESH_channel_create (mesh_peer_1, NULL, &id, 1, |
259 | GNUNET_YES, GNUNET_NO); | 260 | GNUNET_MESH_OPTION_DEFAULT); |
260 | mth = GNUNET_MESH_notify_transmit_ready (ch, GNUNET_NO, | 261 | mth = GNUNET_MESH_notify_transmit_ready (ch, GNUNET_NO, |
261 | GNUNET_TIME_UNIT_FOREVER_REL, | 262 | GNUNET_TIME_UNIT_FOREVER_REL, |
262 | sizeof (struct GNUNET_MessageHeader), | 263 | sizeof (struct GNUNET_MessageHeader), |
diff --git a/src/mesh/test_mesh_single.c b/src/mesh/test_mesh_single.c index 15e8a1dbd..689139b82 100644 --- a/src/mesh/test_mesh_single.c +++ b/src/mesh/test_mesh_single.c | |||
@@ -162,13 +162,14 @@ data_callback (void *cls, struct GNUNET_MESH_Channel *channel, | |||
162 | * @param channel new handle to the channel | 162 | * @param channel new handle to the channel |
163 | * @param initiator peer that started the channel | 163 | * @param initiator peer that started the channel |
164 | * @param port port number | 164 | * @param port port number |
165 | * @param options channel option flags | ||
165 | * @return initial channel context for the channel | 166 | * @return initial channel context for the channel |
166 | * (can be NULL -- that's not an error) | 167 | * (can be NULL -- that's not an error) |
167 | */ | 168 | */ |
168 | static void * | 169 | static void * |
169 | inbound_channel (void *cls, struct GNUNET_MESH_Channel *channel, | 170 | inbound_channel (void *cls, struct GNUNET_MESH_Channel *channel, |
170 | const struct GNUNET_PeerIdentity *initiator, | 171 | const struct GNUNET_PeerIdentity *initiator, |
171 | uint32_t port) | 172 | uint32_t port, enum MeshOption options) |
172 | { | 173 | { |
173 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 174 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
174 | "received incoming channel on port %u\n", | 175 | "received incoming channel on port %u\n", |
@@ -256,7 +257,8 @@ do_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
256 | 257 | ||
257 | GNUNET_TESTING_peer_get_identity (me, &id); | 258 | GNUNET_TESTING_peer_get_identity (me, &id); |
258 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CONNECT BY PORT\n"); | 259 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "CONNECT BY PORT\n"); |
259 | ch1 = GNUNET_MESH_channel_create (mesh, NULL, &id, 1, GNUNET_YES, GNUNET_NO); | 260 | ch1 = GNUNET_MESH_channel_create (mesh, NULL, &id, 1, |
261 | GNUNET_MESH_OPTION_DEFAULT); | ||
260 | GNUNET_MESH_notify_transmit_ready (ch1, GNUNET_NO, | 262 | GNUNET_MESH_notify_transmit_ready (ch1, GNUNET_NO, |
261 | GNUNET_TIME_UNIT_FOREVER_REL, | 263 | GNUNET_TIME_UNIT_FOREVER_REL, |
262 | size, &do_send, NULL); | 264 | size, &do_send, NULL); |
diff --git a/src/mesh/test_mesh_small.c b/src/mesh/test_mesh_small.c index 49e394f03..e63e343cf 100644 --- a/src/mesh/test_mesh_small.c +++ b/src/mesh/test_mesh_small.c | |||
@@ -536,13 +536,14 @@ static struct GNUNET_MESH_MessageHandler handlers[] = { | |||
536 | * @param channel New handle to the channel. | 536 | * @param channel New handle to the channel. |
537 | * @param initiator Peer that started the channel. | 537 | * @param initiator Peer that started the channel. |
538 | * @param port Port this channel is connected to. | 538 | * @param port Port this channel is connected to. |
539 | * @param options channel option flags | ||
539 | * @return Initial channel context for the channel | 540 | * @return Initial channel context for the channel |
540 | * (can be NULL -- that's not an error). | 541 | * (can be NULL -- that's not an error). |
541 | */ | 542 | */ |
542 | static void * | 543 | static void * |
543 | incoming_channel (void *cls, struct GNUNET_MESH_Channel *channel, | 544 | incoming_channel (void *cls, struct GNUNET_MESH_Channel *channel, |
544 | const struct GNUNET_PeerIdentity *initiator, | 545 | const struct GNUNET_PeerIdentity *initiator, |
545 | uint32_t port) | 546 | uint32_t port, enum MeshOption options) |
546 | { | 547 | { |
547 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 548 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
548 | "Incoming channel from %s to peer %d\n", | 549 | "Incoming channel from %s to peer %d\n", |
@@ -629,7 +630,7 @@ channel_cleaner (void *cls, const struct GNUNET_MESH_Channel *channel, | |||
629 | static void | 630 | static void |
630 | do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 631 | do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
631 | { | 632 | { |
632 | int rel; | 633 | enum MeshOption flags; |
633 | 634 | ||
634 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test_task\n"); | 635 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test_task\n"); |
635 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "add peer 2\n"); | 636 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "add peer 2\n"); |
@@ -641,14 +642,13 @@ do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
641 | GNUNET_SCHEDULER_cancel (disconnect_task); | 642 | GNUNET_SCHEDULER_cancel (disconnect_task); |
642 | } | 643 | } |
643 | 644 | ||
645 | flags = GNUNET_MESH_OPTION_DEFAULT; | ||
644 | if (SPEED_REL == test) | 646 | if (SPEED_REL == test) |
645 | { | 647 | { |
646 | test = SPEED; | 648 | test = SPEED; |
647 | rel = GNUNET_YES; | 649 | flags |= GNUNET_MESH_OPTION_RELIABLE; |
648 | } | 650 | } |
649 | else | 651 | ch = GNUNET_MESH_channel_create (h1, NULL, p_id[1], 1, flags); |
650 | rel = GNUNET_NO; | ||
651 | ch = GNUNET_MESH_channel_create (h1, NULL, p_id[1], 1, GNUNET_NO, rel); | ||
652 | 652 | ||
653 | disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME, | 653 | disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME, |
654 | &disconnect_mesh_peers, | 654 | &disconnect_mesh_peers, |
diff --git a/src/pt/gnunet-daemon-pt.c b/src/pt/gnunet-daemon-pt.c index 6375406d9..166f9df1d 100644 --- a/src/pt/gnunet-daemon-pt.c +++ b/src/pt/gnunet-daemon-pt.c | |||
@@ -352,8 +352,7 @@ try_open_exit () | |||
352 | pos, | 352 | pos, |
353 | &pos->peer, | 353 | &pos->peer, |
354 | GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER, | 354 | GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER, |
355 | GNUNET_YES /* no buffer */, | 355 | GNUNET_MESH_OPTION_DEFAULT); |
356 | GNUNET_NO /* reliable */); | ||
357 | if (NULL == pos->mesh_channel) | 356 | if (NULL == pos->mesh_channel) |
358 | { | 357 | { |
359 | GNUNET_break (0); | 358 | GNUNET_break (0); |
diff --git a/src/scalarproduct/gnunet-service-scalarproduct.c b/src/scalarproduct/gnunet-service-scalarproduct.c index b6c8e6077..5a917b20c 100644 --- a/src/scalarproduct/gnunet-service-scalarproduct.c +++ b/src/scalarproduct/gnunet-service-scalarproduct.c | |||
@@ -226,9 +226,9 @@ struct ServiceSession | |||
226 | * Send a multi part chunk of a service request from alice to bob. | 226 | * Send a multi part chunk of a service request from alice to bob. |
227 | * This element only contains a part of the elements-vector (session->a[]), | 227 | * This element only contains a part of the elements-vector (session->a[]), |
228 | * mask and public key set have to be contained within the first message | 228 | * mask and public key set have to be contained within the first message |
229 | * | 229 | * |
230 | * This allows a ~32kbit key length while using 32000 elements or 62000 elements per request. | 230 | * This allows a ~32kbit key length while using 32000 elements or 62000 elements per request. |
231 | * | 231 | * |
232 | * @param cls the associated service session | 232 | * @param cls the associated service session |
233 | */ | 233 | */ |
234 | static void | 234 | static void |
@@ -237,7 +237,7 @@ prepare_service_request_multipart (void *cls); | |||
237 | /** | 237 | /** |
238 | * Send a multi part chunk of a service response from bob to alice. | 238 | * Send a multi part chunk of a service response from bob to alice. |
239 | * This element only contains the two permutations of R, R'. | 239 | * This element only contains the two permutations of R, R'. |
240 | * | 240 | * |
241 | * @param cls the associated service session | 241 | * @param cls the associated service session |
242 | */ | 242 | */ |
243 | static void | 243 | static void |
@@ -657,7 +657,7 @@ permute_vector (gcry_mpi_t * vector, | |||
657 | /** | 657 | /** |
658 | * Finds a not terminated client/service session in the | 658 | * Finds a not terminated client/service session in the |
659 | * given DLL based on session key, element count and state. | 659 | * given DLL based on session key, element count and state. |
660 | * | 660 | * |
661 | * @param tail - the tail of the DLL | 661 | * @param tail - the tail of the DLL |
662 | * @param key - the key we want to search for | 662 | * @param key - the key we want to search for |
663 | * @param element_count - the total element count of the dataset (session->total) | 663 | * @param element_count - the total element count of the dataset (session->total) |
@@ -694,7 +694,7 @@ find_matching_session (struct ServiceSession * tail, | |||
694 | 694 | ||
695 | /** | 695 | /** |
696 | * Safely frees ALL memory areas referenced by a session. | 696 | * Safely frees ALL memory areas referenced by a session. |
697 | * | 697 | * |
698 | * @param session - the session to free elements from | 698 | * @param session - the session to free elements from |
699 | */ | 699 | */ |
700 | static void | 700 | static void |
@@ -769,7 +769,7 @@ handle_client_disconnect (void *cls, | |||
769 | struct GNUNET_SERVER_Client *client) | 769 | struct GNUNET_SERVER_Client *client) |
770 | { | 770 | { |
771 | struct ServiceSession *session; | 771 | struct ServiceSession *session; |
772 | 772 | ||
773 | if (NULL != client) | 773 | if (NULL != client) |
774 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 774 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
775 | _ ("Client (%p) disconnected from us.\n"), client); | 775 | _ ("Client (%p) disconnected from us.\n"), client); |
@@ -851,7 +851,7 @@ prepare_client_end_notification (void * cls, | |||
851 | } | 851 | } |
852 | else | 852 | else |
853 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, _ ("Sending session-end notification to client (%p) for session %s\n"), &session->client, GNUNET_h2s (&session->key)); | 853 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, _ ("Sending session-end notification to client (%p) for session %s\n"), &session->client, GNUNET_h2s (&session->key)); |
854 | 854 | ||
855 | free_session_variables (session); | 855 | free_session_variables (session); |
856 | } | 856 | } |
857 | 857 | ||
@@ -953,7 +953,7 @@ prepare_client_response (void *cls, | |||
953 | /** | 953 | /** |
954 | * Send a multipart chunk of a service response from bob to alice. | 954 | * Send a multipart chunk of a service response from bob to alice. |
955 | * This element only contains the two permutations of R, R'. | 955 | * This element only contains the two permutations of R, R'. |
956 | * | 956 | * |
957 | * @param cls the associated service session | 957 | * @param cls the associated service session |
958 | */ | 958 | */ |
959 | static void | 959 | static void |
@@ -1396,9 +1396,9 @@ except: | |||
1396 | * Send a multi part chunk of a service request from alice to bob. | 1396 | * Send a multi part chunk of a service request from alice to bob. |
1397 | * This element only contains a part of the elements-vector (session->a[]), | 1397 | * This element only contains a part of the elements-vector (session->a[]), |
1398 | * mask and public key set have to be contained within the first message | 1398 | * mask and public key set have to be contained within the first message |
1399 | * | 1399 | * |
1400 | * This allows a ~32kbit key length while using 32000 elements or 62000 elements per request. | 1400 | * This allows a ~32kbit key length while using 32000 elements or 62000 elements per request. |
1401 | * | 1401 | * |
1402 | * @param cls the associated service session | 1402 | * @param cls the associated service session |
1403 | */ | 1403 | */ |
1404 | static void | 1404 | static void |
@@ -1751,8 +1751,7 @@ handle_client_request (void *cls, | |||
1751 | session->channel = GNUNET_MESH_channel_create (my_mesh, session, | 1751 | session->channel = GNUNET_MESH_channel_create (my_mesh, session, |
1752 | &session->peer, | 1752 | &session->peer, |
1753 | GNUNET_APPLICATION_TYPE_SCALARPRODUCT, | 1753 | GNUNET_APPLICATION_TYPE_SCALARPRODUCT, |
1754 | GNUNET_NO, | 1754 | GNUNET_MESH_OPTION_RELIABLE); |
1755 | GNUNET_YES); | ||
1756 | //prepare_service_request, channel_peer_disconnect_handler, | 1755 | //prepare_service_request, channel_peer_disconnect_handler, |
1757 | if (!session->channel) { | 1756 | if (!session->channel) { |
1758 | GNUNET_break (0); | 1757 | GNUNET_break (0); |
@@ -1815,18 +1814,20 @@ handle_client_request (void *cls, | |||
1815 | * @param channel new handle to the channel | 1814 | * @param channel new handle to the channel |
1816 | * @param initiator peer that started the channel | 1815 | * @param initiator peer that started the channel |
1817 | * @param port unused | 1816 | * @param port unused |
1817 | * @param options unused | ||
1818 | * | ||
1818 | * @return session associated with the channel | 1819 | * @return session associated with the channel |
1819 | */ | 1820 | */ |
1820 | static void * | 1821 | static void * |
1821 | channel_incoming_handler (void *cls, | 1822 | channel_incoming_handler (void *cls, |
1822 | struct GNUNET_MESH_Channel *channel, | 1823 | struct GNUNET_MESH_Channel *channel, |
1823 | const struct GNUNET_PeerIdentity *initiator, | 1824 | const struct GNUNET_PeerIdentity *initiator, |
1824 | uint32_t port) | 1825 | uint32_t port, enum MeshOption options) |
1825 | { | 1826 | { |
1826 | struct ServiceSession * c = GNUNET_new (struct ServiceSession); | 1827 | struct ServiceSession * c = GNUNET_new (struct ServiceSession); |
1827 | 1828 | ||
1828 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _ ("New incoming channel from peer %s.\n"), GNUNET_i2s (initiator)); | 1829 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _ ("New incoming channel from peer %s.\n"), GNUNET_i2s (initiator)); |
1829 | 1830 | ||
1830 | c->peer = *initiator; | 1831 | c->peer = *initiator; |
1831 | c->channel = channel; | 1832 | c->channel = channel; |
1832 | c->role = BOB; | 1833 | c->role = BOB; |
@@ -1861,7 +1862,7 @@ channel_destruction_handler (void *cls, | |||
1861 | GNUNET_i2s (&session->peer)); | 1862 | GNUNET_i2s (&session->peer)); |
1862 | if (ALICE == session->role) { | 1863 | if (ALICE == session->role) { |
1863 | // as we have only one peer connected in each session, just remove the session | 1864 | // as we have only one peer connected in each session, just remove the session |
1864 | 1865 | ||
1865 | if ((SERVICE_RESPONSE_RECEIVED > session->state) && (!do_shutdown)) { | 1866 | if ((SERVICE_RESPONSE_RECEIVED > session->state) && (!do_shutdown)) { |
1866 | session->channel = NULL; | 1867 | session->channel = NULL; |
1867 | // if this happened before we received the answer, we must terminate the session | 1868 | // if this happened before we received the answer, we must terminate the session |
@@ -2288,7 +2289,7 @@ handle_service_response_multipart (void *cls, | |||
2288 | return GNUNET_OK; | 2289 | return GNUNET_OK; |
2289 | session->state = SERVICE_RESPONSE_RECEIVED; | 2290 | session->state = SERVICE_RESPONSE_RECEIVED; |
2290 | session->product = compute_scalar_product (session); //never NULL | 2291 | session->product = compute_scalar_product (session); //never NULL |
2291 | 2292 | ||
2292 | invalid_msg: | 2293 | invalid_msg: |
2293 | GNUNET_break_op (NULL != session->product); | 2294 | GNUNET_break_op (NULL != session->product); |
2294 | 2295 | ||
@@ -2342,7 +2343,7 @@ handle_service_response (void *cls, | |||
2342 | //we need at least a full message without elements attached | 2343 | //we need at least a full message without elements attached |
2343 | msg_size = ntohs (msg->header.size); | 2344 | msg_size = ntohs (msg->header.size); |
2344 | required_size = sizeof (struct GNUNET_SCALARPRODUCT_service_response) + 2 * PAILLIER_ELEMENT_LENGTH; | 2345 | required_size = sizeof (struct GNUNET_SCALARPRODUCT_service_response) + 2 * PAILLIER_ELEMENT_LENGTH; |
2345 | 2346 | ||
2346 | if (required_size > msg_size) { | 2347 | if (required_size > msg_size) { |
2347 | goto invalid_msg; | 2348 | goto invalid_msg; |
2348 | } | 2349 | } |
@@ -2393,7 +2394,7 @@ handle_service_response (void *cls, | |||
2393 | 2394 | ||
2394 | session->state = SERVICE_RESPONSE_RECEIVED; | 2395 | session->state = SERVICE_RESPONSE_RECEIVED; |
2395 | session->product = compute_scalar_product (session); //never NULL | 2396 | session->product = compute_scalar_product (session); //never NULL |
2396 | 2397 | ||
2397 | invalid_msg: | 2398 | invalid_msg: |
2398 | GNUNET_break_op (NULL != session->product); | 2399 | GNUNET_break_op (NULL != session->product); |
2399 | // send message with product to client | 2400 | // send message with product to client |
diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c index 749154010..27c8d3bc0 100644 --- a/src/set/gnunet-service-set.c +++ b/src/set/gnunet-service-set.c | |||
@@ -237,7 +237,7 @@ listener_destroy (struct Listener *listener) | |||
237 | * Collect and destroy elements that are not needed anymore, because | 237 | * Collect and destroy elements that are not needed anymore, because |
238 | * their lifetime (as determined by their generation) does not overlap with any active | 238 | * their lifetime (as determined by their generation) does not overlap with any active |
239 | * set operation. | 239 | * set operation. |
240 | * | 240 | * |
241 | * We hereby replace the old element hashmap with a new one, instead of removing elements. | 241 | * We hereby replace the old element hashmap with a new one, instead of removing elements. |
242 | */ | 242 | */ |
243 | void | 243 | void |
@@ -252,7 +252,7 @@ collect_generation_garbage (struct Set *set) | |||
252 | new_elements = GNUNET_CONTAINER_multihashmap_create (1, GNUNET_NO); | 252 | new_elements = GNUNET_CONTAINER_multihashmap_create (1, GNUNET_NO); |
253 | iter = GNUNET_CONTAINER_multihashmap_iterator_create (set->elements); | 253 | iter = GNUNET_CONTAINER_multihashmap_iterator_create (set->elements); |
254 | while (GNUNET_OK == | 254 | while (GNUNET_OK == |
255 | (res = GNUNET_CONTAINER_multihashmap_iterator_next (iter, NULL, (const void **) &ee))) | 255 | (res = GNUNET_CONTAINER_multihashmap_iterator_next (iter, NULL, (const void **) &ee))) |
256 | { | 256 | { |
257 | if (GNUNET_NO == ee->removed) | 257 | if (GNUNET_NO == ee->removed) |
258 | goto still_needed; | 258 | goto still_needed; |
@@ -449,7 +449,7 @@ incoming_destroy (struct Operation *incoming) | |||
449 | 449 | ||
450 | /** | 450 | /** |
451 | * remove & free state of the operation from the incoming list | 451 | * remove & free state of the operation from the incoming list |
452 | * | 452 | * |
453 | * @param incoming the element to remove | 453 | * @param incoming the element to remove |
454 | */ | 454 | */ |
455 | 455 | ||
@@ -510,7 +510,7 @@ incoming_suggest (struct Operation *incoming, struct Listener *listener) | |||
510 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != incoming->state->timeout_task); | 510 | GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != incoming->state->timeout_task); |
511 | GNUNET_SCHEDULER_cancel (incoming->state->timeout_task); | 511 | GNUNET_SCHEDULER_cancel (incoming->state->timeout_task); |
512 | incoming->state->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 512 | incoming->state->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
513 | 513 | ||
514 | mqm = GNUNET_MQ_msg_nested_mh (cmsg, GNUNET_MESSAGE_TYPE_SET_REQUEST, | 514 | mqm = GNUNET_MQ_msg_nested_mh (cmsg, GNUNET_MESSAGE_TYPE_SET_REQUEST, |
515 | incoming->spec->context_msg); | 515 | incoming->spec->context_msg); |
516 | GNUNET_assert (NULL != mqm); | 516 | GNUNET_assert (NULL != mqm); |
@@ -524,9 +524,9 @@ incoming_suggest (struct Operation *incoming, struct Listener *listener) | |||
524 | 524 | ||
525 | /** | 525 | /** |
526 | * Handle a request for a set operation from | 526 | * Handle a request for a set operation from |
527 | * another peer. | 527 | * another peer. |
528 | * | 528 | * |
529 | * This msg is expected as the first and only msg handled through the | 529 | * This msg is expected as the first and only msg handled through the |
530 | * non-operation bound virtual table, acceptance of this operation replaces | 530 | * non-operation bound virtual table, acceptance of this operation replaces |
531 | * our virtual table and subsequent msgs would be routed differently. | 531 | * our virtual table and subsequent msgs would be routed differently. |
532 | * | 532 | * |
@@ -685,7 +685,7 @@ handle_client_create_set (void *cls, | |||
685 | ntohs (msg->operation)); | 685 | ntohs (msg->operation)); |
686 | 686 | ||
687 | // max. one set per client! | 687 | // max. one set per client! |
688 | if (NULL != set_get (client)) | 688 | if (NULL != set_get (client)) |
689 | { | 689 | { |
690 | GNUNET_break (0); | 690 | GNUNET_break (0); |
691 | GNUNET_SERVER_client_disconnect (client); | 691 | GNUNET_SERVER_client_disconnect (client); |
@@ -742,7 +742,7 @@ handle_client_listen (void *cls, | |||
742 | GNUNET_SERVER_client_disconnect (client); | 742 | GNUNET_SERVER_client_disconnect (client); |
743 | return; | 743 | return; |
744 | } | 744 | } |
745 | 745 | ||
746 | listener = GNUNET_new (struct Listener); | 746 | listener = GNUNET_new (struct Listener); |
747 | listener->client = client; | 747 | listener->client = client; |
748 | listener->client_mq = GNUNET_MQ_queue_for_server_client (client); | 748 | listener->client_mq = GNUNET_MQ_queue_for_server_client (client); |
@@ -751,7 +751,7 @@ handle_client_listen (void *cls, | |||
751 | GNUNET_CONTAINER_DLL_insert_tail (listeners_head, listeners_tail, listener); | 751 | GNUNET_CONTAINER_DLL_insert_tail (listeners_head, listeners_tail, listener); |
752 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "new listener created (op %u, app %s)\n", | 752 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "new listener created (op %u, app %s)\n", |
753 | listener->operation, GNUNET_h2s (&listener->app_id)); | 753 | listener->operation, GNUNET_h2s (&listener->app_id)); |
754 | 754 | ||
755 | /* check for incoming requests the listener is interested in */ | 755 | /* check for incoming requests the listener is interested in */ |
756 | for (op = incoming_head; NULL != op; op = op->next) | 756 | for (op = incoming_head; NULL != op; op = op->next) |
757 | { | 757 | { |
@@ -805,7 +805,7 @@ handle_client_reject (void *cls, | |||
805 | return; | 805 | return; |
806 | } | 806 | } |
807 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "peer request rejected by client\n"); | 807 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "peer request rejected by client\n"); |
808 | 808 | ||
809 | GNUNET_MESH_channel_destroy (incoming->channel); | 809 | GNUNET_MESH_channel_destroy (incoming->channel); |
810 | //channel destruction handler called immediately upon destruction | 810 | //channel destruction handler called immediately upon destruction |
811 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 811 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
@@ -925,7 +925,7 @@ handle_client_evaluate (void *cls, | |||
925 | spec->result_mode = ntohs (msg->result_mode); | 925 | spec->result_mode = ntohs (msg->result_mode); |
926 | spec->client_request_id = ntohl (msg->request_id); | 926 | spec->client_request_id = ntohl (msg->request_id); |
927 | spec->context_msg = GNUNET_MQ_extract_nested_mh (msg); | 927 | spec->context_msg = GNUNET_MQ_extract_nested_mh (msg); |
928 | 928 | ||
929 | // for simplicity we just backup the context msg instead of rebuilding it later on | 929 | // for simplicity we just backup the context msg instead of rebuilding it later on |
930 | if (NULL != spec->context_msg) | 930 | if (NULL != spec->context_msg) |
931 | spec->context_msg = GNUNET_copy_message (spec->context_msg); | 931 | spec->context_msg = GNUNET_copy_message (spec->context_msg); |
@@ -938,8 +938,7 @@ handle_client_evaluate (void *cls, | |||
938 | 938 | ||
939 | op->channel = GNUNET_MESH_channel_create (mesh, op, &msg->target_peer, | 939 | op->channel = GNUNET_MESH_channel_create (mesh, op, &msg->target_peer, |
940 | GNUNET_APPLICATION_TYPE_SET, | 940 | GNUNET_APPLICATION_TYPE_SET, |
941 | GNUNET_YES, | 941 | GNUNET_MESH_OPTION_RELIABLE); |
942 | GNUNET_YES); | ||
943 | 942 | ||
944 | op->mq = GNUNET_MESH_mq_create (op->channel); | 943 | op->mq = GNUNET_MESH_mq_create (op->channel); |
945 | 944 | ||
@@ -950,7 +949,7 @@ handle_client_evaluate (void *cls, | |||
950 | 949 | ||
951 | /** | 950 | /** |
952 | * Handle an ack from a client, and send the next element. | 951 | * Handle an ack from a client, and send the next element. |
953 | * | 952 | * |
954 | * @param cls unused | 953 | * @param cls unused |
955 | * @param client the client | 954 | * @param client the client |
956 | * @param m the message | 955 | * @param m the message |
@@ -1027,7 +1026,7 @@ handle_client_cancel (void *cls, | |||
1027 | GNUNET_SERVER_client_disconnect (client); | 1026 | GNUNET_SERVER_client_disconnect (client); |
1028 | return; | 1027 | return; |
1029 | } | 1028 | } |
1030 | 1029 | ||
1031 | _GSS_operation_destroy (op); | 1030 | _GSS_operation_destroy (op); |
1032 | } | 1031 | } |
1033 | 1032 | ||
@@ -1036,7 +1035,7 @@ handle_client_cancel (void *cls, | |||
1036 | * Handle a request from the client to accept | 1035 | * Handle a request from the client to accept |
1037 | * a set operation that came from a remote peer. | 1036 | * a set operation that came from a remote peer. |
1038 | * We forward the accept to the associated operation for handling | 1037 | * We forward the accept to the associated operation for handling |
1039 | * | 1038 | * |
1040 | * @param cls unused | 1039 | * @param cls unused |
1041 | * @param client the client | 1040 | * @param client the client |
1042 | * @param mh the message | 1041 | * @param mh the message |
@@ -1066,7 +1065,7 @@ handle_client_accept (void *cls, | |||
1066 | 1065 | ||
1067 | // client without a set requested an operation | 1066 | // client without a set requested an operation |
1068 | set = set_get (client); | 1067 | set = set_get (client); |
1069 | 1068 | ||
1070 | if (NULL == set) | 1069 | if (NULL == set) |
1071 | { | 1070 | { |
1072 | GNUNET_break (0); | 1071 | GNUNET_break (0); |
@@ -1126,7 +1125,7 @@ shutdown_task (void *cls, | |||
1126 | 1125 | ||
1127 | /** | 1126 | /** |
1128 | * Timeout happens iff: | 1127 | * Timeout happens iff: |
1129 | * - we suggested an operation to our listener, | 1128 | * - we suggested an operation to our listener, |
1130 | * but did not receive a response in time | 1129 | * but did not receive a response in time |
1131 | * - we got the channel from a peer but no GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST | 1130 | * - we got the channel from a peer but no GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST |
1132 | * - shutdown (obviously) | 1131 | * - shutdown (obviously) |
@@ -1152,14 +1151,14 @@ incoming_timeout_cb (void *cls, | |||
1152 | /** | 1151 | /** |
1153 | * Terminates an incoming operation in case we have not yet received an | 1152 | * Terminates an incoming operation in case we have not yet received an |
1154 | * operation request. Called by the channel destruction handler. | 1153 | * operation request. Called by the channel destruction handler. |
1155 | * | 1154 | * |
1156 | * @param op the channel context | 1155 | * @param op the channel context |
1157 | */ | 1156 | */ |
1158 | static void | 1157 | static void |
1159 | handle_incoming_disconnect (struct Operation *op) | 1158 | handle_incoming_disconnect (struct Operation *op) |
1160 | { | 1159 | { |
1161 | GNUNET_assert (GNUNET_YES == op->is_incoming); | 1160 | GNUNET_assert (GNUNET_YES == op->is_incoming); |
1162 | 1161 | ||
1163 | if (NULL == op->channel) | 1162 | if (NULL == op->channel) |
1164 | return; | 1163 | return; |
1165 | 1164 | ||
@@ -1171,16 +1170,17 @@ handle_incoming_disconnect (struct Operation *op) | |||
1171 | * Method called whenever another peer has added us to a channel | 1170 | * Method called whenever another peer has added us to a channel |
1172 | * the other peer initiated. | 1171 | * the other peer initiated. |
1173 | * Only called (once) upon reception of data with a message type which was | 1172 | * Only called (once) upon reception of data with a message type which was |
1174 | * subscribed to in GNUNET_MESH_connect. | 1173 | * subscribed to in GNUNET_MESH_connect. |
1175 | * | 1174 | * |
1176 | * The channel context represents the operation itself and gets added to a DLL, | 1175 | * The channel context represents the operation itself and gets added to a DLL, |
1177 | * from where it gets looked up when our local listener client responds | 1176 | * from where it gets looked up when our local listener client responds |
1178 | * to a proposed/suggested operation or connects and associates with this operation. | 1177 | * to a proposed/suggested operation or connects and associates with this operation. |
1179 | * | 1178 | * |
1180 | * @param cls closure | 1179 | * @param cls closure |
1181 | * @param channel new handle to the channel | 1180 | * @param channel new handle to the channel |
1182 | * @param initiator peer that started the channel | 1181 | * @param initiator peer that started the channel |
1183 | * @param port Port this channel is for. | 1182 | * @param port Port this channel is for. |
1183 | * @param options Unused. | ||
1184 | * @return initial channel context for the channel | 1184 | * @return initial channel context for the channel |
1185 | * (can be NULL -- that's not an error) | 1185 | * (can be NULL -- that's not an error) |
1186 | */ | 1186 | */ |
@@ -1188,7 +1188,7 @@ static void * | |||
1188 | channel_new_cb (void *cls, | 1188 | channel_new_cb (void *cls, |
1189 | struct GNUNET_MESH_Channel *channel, | 1189 | struct GNUNET_MESH_Channel *channel, |
1190 | const struct GNUNET_PeerIdentity *initiator, | 1190 | const struct GNUNET_PeerIdentity *initiator, |
1191 | uint32_t port) | 1191 | uint32_t port, enum MeshOption options) |
1192 | { | 1192 | { |
1193 | struct Operation *incoming; | 1193 | struct Operation *incoming; |
1194 | static const struct SetVT incoming_vt = { | 1194 | static const struct SetVT incoming_vt = { |
@@ -1202,7 +1202,7 @@ channel_new_cb (void *cls, | |||
1202 | { | 1202 | { |
1203 | GNUNET_break (0); | 1203 | GNUNET_break (0); |
1204 | GNUNET_MESH_channel_destroy (channel); | 1204 | GNUNET_MESH_channel_destroy (channel); |
1205 | return; | 1205 | return NULL; |
1206 | } | 1206 | } |
1207 | 1207 | ||
1208 | incoming = GNUNET_new (struct Operation); | 1208 | incoming = GNUNET_new (struct Operation); |
@@ -1225,12 +1225,12 @@ channel_new_cb (void *cls, | |||
1225 | * any associated state. | 1225 | * any associated state. |
1226 | * GNUNET_MESH_channel_destroy. It must NOT call GNUNET_MESH_channel_destroy on | 1226 | * GNUNET_MESH_channel_destroy. It must NOT call GNUNET_MESH_channel_destroy on |
1227 | * the channel. | 1227 | * the channel. |
1228 | * | 1228 | * |
1229 | * The peer_disconnect function is part of a a virtual table set initially either | 1229 | * The peer_disconnect function is part of a a virtual table set initially either |
1230 | * when a peer creates a new channel with us (channel_new_cb), or once we create | 1230 | * when a peer creates a new channel with us (channel_new_cb), or once we create |
1231 | * a new channel ourselves (evaluate). | 1231 | * a new channel ourselves (evaluate). |
1232 | * | 1232 | * |
1233 | * Once we know the exact type of operation (union/intersection), the vt is | 1233 | * Once we know the exact type of operation (union/intersection), the vt is |
1234 | * replaced with an operation specific instance (_GSS_[op]_vt). | 1234 | * replaced with an operation specific instance (_GSS_[op]_vt). |
1235 | * | 1235 | * |
1236 | * @param cls closure (set from GNUNET_MESH_connect) | 1236 | * @param cls closure (set from GNUNET_MESH_connect) |
@@ -1259,11 +1259,11 @@ channel_end_cb (void *cls, | |||
1259 | * Functions with this signature are called whenever any message is | 1259 | * Functions with this signature are called whenever any message is |
1260 | * received via the mesh channel. | 1260 | * received via the mesh channel. |
1261 | * | 1261 | * |
1262 | * The msg_handler is a virtual table set in initially either when a peer | 1262 | * The msg_handler is a virtual table set in initially either when a peer |
1263 | * creates a new channel with us (channel_new_cb), or once we create a new channel | 1263 | * creates a new channel with us (channel_new_cb), or once we create a new channel |
1264 | * ourselves (evaluate). | 1264 | * ourselves (evaluate). |
1265 | * | 1265 | * |
1266 | * Once we know the exact type of operation (union/intersection), the vt is | 1266 | * Once we know the exact type of operation (union/intersection), the vt is |
1267 | * replaced with an operation specific instance (_GSS_[op]_vt). | 1267 | * replaced with an operation specific instance (_GSS_[op]_vt). |
1268 | * | 1268 | * |
1269 | * @param cls Closure (set from GNUNET_MESH_connect). | 1269 | * @param cls Closure (set from GNUNET_MESH_connect). |
diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c index eebdcac55..16e84e715 100644 --- a/src/vpn/gnunet-service-vpn.c +++ b/src/vpn/gnunet-service-vpn.c | |||
@@ -731,8 +731,7 @@ handle_regex_result (void *cls, | |||
731 | ts, | 731 | ts, |
732 | id, | 732 | id, |
733 | apptype, | 733 | apptype, |
734 | GNUNET_YES, | 734 | GNUNET_MESH_OPTION_DEFAULT); |
735 | GNUNET_NO); | ||
736 | } | 735 | } |
737 | 736 | ||
738 | 737 | ||
@@ -778,8 +777,7 @@ create_channel_to_destination (struct DestinationChannel *dt, | |||
778 | ts, | 777 | ts, |
779 | &dt->destination->details.service_destination.target, | 778 | &dt->destination->details.service_destination.target, |
780 | apptype, | 779 | apptype, |
781 | GNUNET_YES, | 780 | GNUNET_MESH_OPTION_DEFAULT); |
782 | GNUNET_NO); | ||
783 | if (NULL == ts->channel) | 781 | if (NULL == ts->channel) |
784 | { | 782 | { |
785 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 783 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
@@ -815,7 +813,7 @@ create_channel_to_destination (struct DestinationChannel *dt, | |||
815 | char address[GNUNET_TUN_IPV6_REGEXLEN]; | 813 | char address[GNUNET_TUN_IPV6_REGEXLEN]; |
816 | 814 | ||
817 | GNUNET_TUN_ipv6toregexsearch (&dt->destination->details.exit_destination.ip.v6, | 815 | GNUNET_TUN_ipv6toregexsearch (&dt->destination->details.exit_destination.ip.v6, |
818 | dt->destination_port, | 816 | dt->destination_port, |
819 | address); | 817 | address); |
820 | GNUNET_asprintf (&policy, "%s%s", | 818 | GNUNET_asprintf (&policy, "%s%s", |
821 | GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX, | 819 | GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX, |