diff options
Diffstat (limited to 'src/transport/transport_api2_communication.c')
-rw-r--r-- | src/transport/transport_api2_communication.c | 105 |
1 files changed, 62 insertions, 43 deletions
diff --git a/src/transport/transport_api2_communication.c b/src/transport/transport_api2_communication.c index 6704f0cd8..a89802ddd 100644 --- a/src/transport/transport_api2_communication.c +++ b/src/transport/transport_api2_communication.c | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | */ | 17 | */ |
@@ -29,8 +29,8 @@ | |||
29 | 29 | ||
30 | 30 | ||
31 | /** | 31 | /** |
32 | * How many messages do we keep at most in the queue to the | 32 | * How many messages do we keep at most in the queue to the |
33 | * transport service before we start to drop (default, | 33 | * transport service before we start to drop (default, |
34 | * can be changed via the configuration file). | 34 | * can be changed via the configuration file). |
35 | */ | 35 | */ |
36 | #define DEFAULT_MAX_QUEUE_LENGTH 16 | 36 | #define DEFAULT_MAX_QUEUE_LENGTH 16 |
@@ -60,7 +60,7 @@ struct FlowControl | |||
60 | * Closure for @e cb | 60 | * Closure for @e cb |
61 | */ | 61 | */ |
62 | void *cb_cls; | 62 | void *cb_cls; |
63 | 63 | ||
64 | /** | 64 | /** |
65 | * Which peer is this about? | 65 | * Which peer is this about? |
66 | */ | 66 | */ |
@@ -93,7 +93,7 @@ struct AckPending | |||
93 | * Communicator this entry belongs to. | 93 | * Communicator this entry belongs to. |
94 | */ | 94 | */ |
95 | struct GNUNET_TRANSPORT_CommunicatorHandle *ch; | 95 | struct GNUNET_TRANSPORT_CommunicatorHandle *ch; |
96 | 96 | ||
97 | /** | 97 | /** |
98 | * Which peer is this about? | 98 | * Which peer is this about? |
99 | */ | 99 | */ |
@@ -145,12 +145,12 @@ struct GNUNET_TRANSPORT_CommunicatorHandle | |||
145 | * DLL of queues we offer. | 145 | * DLL of queues we offer. |
146 | */ | 146 | */ |
147 | struct GNUNET_TRANSPORT_QueueHandle *queue_head; | 147 | struct GNUNET_TRANSPORT_QueueHandle *queue_head; |
148 | 148 | ||
149 | /** | 149 | /** |
150 | * DLL of queues we offer. | 150 | * DLL of queues we offer. |
151 | */ | 151 | */ |
152 | struct GNUNET_TRANSPORT_QueueHandle *queue_tail; | 152 | struct GNUNET_TRANSPORT_QueueHandle *queue_tail; |
153 | 153 | ||
154 | /** | 154 | /** |
155 | * Our configuration. | 155 | * Our configuration. |
156 | */ | 156 | */ |
@@ -181,12 +181,12 @@ struct GNUNET_TRANSPORT_CommunicatorHandle | |||
181 | * Queue to talk to the transport service. | 181 | * Queue to talk to the transport service. |
182 | */ | 182 | */ |
183 | struct GNUNET_MQ_Handle *mq; | 183 | struct GNUNET_MQ_Handle *mq; |
184 | 184 | ||
185 | /** | 185 | /** |
186 | * Maximum permissable queue length. | 186 | * Maximum permissable queue length. |
187 | */ | 187 | */ |
188 | unsigned long long max_queue_length; | 188 | unsigned long long max_queue_length; |
189 | 189 | ||
190 | /** | 190 | /** |
191 | * Flow-control identifier generator. | 191 | * Flow-control identifier generator. |
192 | */ | 192 | */ |
@@ -202,7 +202,12 @@ struct GNUNET_TRANSPORT_CommunicatorHandle | |||
202 | * Queue identifier generator. | 202 | * Queue identifier generator. |
203 | */ | 203 | */ |
204 | uint32_t queue_gen; | 204 | uint32_t queue_gen; |
205 | 205 | ||
206 | /** | ||
207 | * Characteristics of the communicator. | ||
208 | */ | ||
209 | enum GNUNET_TRANSPORT_CommunicatorCharacteristics cc; | ||
210 | |||
206 | }; | 211 | }; |
207 | 212 | ||
208 | 213 | ||
@@ -222,21 +227,26 @@ struct GNUNET_TRANSPORT_QueueHandle | |||
222 | * Kept in a DLL. | 227 | * Kept in a DLL. |
223 | */ | 228 | */ |
224 | struct GNUNET_TRANSPORT_QueueHandle *prev; | 229 | struct GNUNET_TRANSPORT_QueueHandle *prev; |
225 | 230 | ||
226 | /** | 231 | /** |
227 | * Handle this queue belongs to. | 232 | * Handle this queue belongs to. |
228 | */ | 233 | */ |
229 | struct GNUNET_TRANSPORT_CommunicatorHandle *ch; | 234 | struct GNUNET_TRANSPORT_CommunicatorHandle *ch; |
230 | 235 | ||
231 | /** | 236 | /** |
232 | * Which peer we can communciate with. | 237 | * Address used by the communication queue. |
233 | */ | 238 | */ |
234 | struct GNUNET_PeerIdentity peer; | 239 | char *address; |
235 | 240 | ||
236 | /** | 241 | /** |
237 | * Address used by the communication queue. | 242 | * The queue itself. |
238 | */ | 243 | */ |
239 | char *address; | 244 | struct GNUNET_MQ_Handle *mq; |
245 | |||
246 | /** | ||
247 | * Which peer we can communciate with. | ||
248 | */ | ||
249 | struct GNUNET_PeerIdentity peer; | ||
240 | 250 | ||
241 | /** | 251 | /** |
242 | * Network type of the communciation queue. | 252 | * Network type of the communciation queue. |
@@ -247,11 +257,11 @@ struct GNUNET_TRANSPORT_QueueHandle | |||
247 | * Communication status of the queue. | 257 | * Communication status of the queue. |
248 | */ | 258 | */ |
249 | enum GNUNET_TRANSPORT_ConnectionStatus cs; | 259 | enum GNUNET_TRANSPORT_ConnectionStatus cs; |
250 | 260 | ||
251 | /** | 261 | /** |
252 | * The queue itself. | 262 | * How many hops is the target away (DV-only) |
253 | */ | 263 | */ |
254 | struct GNUNET_MQ_Handle *mq; | 264 | uint32_t distance; |
255 | 265 | ||
256 | /** | 266 | /** |
257 | * ID for this queue when talking to the transport service. | 267 | * ID for this queue when talking to the transport service. |
@@ -262,7 +272,7 @@ struct GNUNET_TRANSPORT_QueueHandle | |||
262 | * Maximum transmission unit for the queue. | 272 | * Maximum transmission unit for the queue. |
263 | */ | 273 | */ |
264 | uint32_t mtu; | 274 | uint32_t mtu; |
265 | 275 | ||
266 | }; | 276 | }; |
267 | 277 | ||
268 | 278 | ||
@@ -282,7 +292,7 @@ struct GNUNET_TRANSPORT_AddressIdentifier | |||
282 | * Kept in a DLL. | 292 | * Kept in a DLL. |
283 | */ | 293 | */ |
284 | struct GNUNET_TRANSPORT_AddressIdentifier *prev; | 294 | struct GNUNET_TRANSPORT_AddressIdentifier *prev; |
285 | 295 | ||
286 | /** | 296 | /** |
287 | * Transport handle where the address was added. | 297 | * Transport handle where the address was added. |
288 | */ | 298 | */ |
@@ -298,7 +308,7 @@ struct GNUNET_TRANSPORT_AddressIdentifier | |||
298 | * address.) | 308 | * address.) |
299 | */ | 309 | */ |
300 | struct GNUNET_TIME_Relative expiration; | 310 | struct GNUNET_TIME_Relative expiration; |
301 | 311 | ||
302 | /** | 312 | /** |
303 | * Internal UUID for the address used in communication with the | 313 | * Internal UUID for the address used in communication with the |
304 | * transport service. | 314 | * transport service. |
@@ -309,7 +319,7 @@ struct GNUNET_TRANSPORT_AddressIdentifier | |||
309 | * Network type for the address. | 319 | * Network type for the address. |
310 | */ | 320 | */ |
311 | enum GNUNET_ATS_Network_Type nt; | 321 | enum GNUNET_ATS_Network_Type nt; |
312 | 322 | ||
313 | }; | 323 | }; |
314 | 324 | ||
315 | 325 | ||
@@ -333,7 +343,7 @@ send_add_address (struct GNUNET_TRANSPORT_AddressIdentifier *ai) | |||
333 | { | 343 | { |
334 | struct GNUNET_MQ_Envelope *env; | 344 | struct GNUNET_MQ_Envelope *env; |
335 | struct GNUNET_TRANSPORT_AddAddressMessage *aam; | 345 | struct GNUNET_TRANSPORT_AddAddressMessage *aam; |
336 | 346 | ||
337 | if (NULL == ai->ch->mq) | 347 | if (NULL == ai->ch->mq) |
338 | return; | 348 | return; |
339 | env = GNUNET_MQ_msg_extra (aam, | 349 | env = GNUNET_MQ_msg_extra (aam, |
@@ -360,10 +370,10 @@ send_del_address (struct GNUNET_TRANSPORT_AddressIdentifier *ai) | |||
360 | { | 370 | { |
361 | struct GNUNET_MQ_Envelope *env; | 371 | struct GNUNET_MQ_Envelope *env; |
362 | struct GNUNET_TRANSPORT_DelAddressMessage *dam; | 372 | struct GNUNET_TRANSPORT_DelAddressMessage *dam; |
363 | 373 | ||
364 | if (NULL == ai->ch->mq) | 374 | if (NULL == ai->ch->mq) |
365 | return; | 375 | return; |
366 | env = GNUNET_MQ_msg (dam, | 376 | env = GNUNET_MQ_msg (dam, |
367 | GNUNET_MESSAGE_TYPE_TRANSPORT_DEL_ADDRESS); | 377 | GNUNET_MESSAGE_TYPE_TRANSPORT_DEL_ADDRESS); |
368 | dam->aid = htonl (ai->aid); | 378 | dam->aid = htonl (ai->aid); |
369 | GNUNET_MQ_send (ai->ch->mq, | 379 | GNUNET_MQ_send (ai->ch->mq, |
@@ -382,7 +392,7 @@ send_add_queue (struct GNUNET_TRANSPORT_QueueHandle *qh) | |||
382 | { | 392 | { |
383 | struct GNUNET_MQ_Envelope *env; | 393 | struct GNUNET_MQ_Envelope *env; |
384 | struct GNUNET_TRANSPORT_AddQueueMessage *aqm; | 394 | struct GNUNET_TRANSPORT_AddQueueMessage *aqm; |
385 | 395 | ||
386 | if (NULL == qh->ch->mq) | 396 | if (NULL == qh->ch->mq) |
387 | return; | 397 | return; |
388 | env = GNUNET_MQ_msg_extra (aqm, | 398 | env = GNUNET_MQ_msg_extra (aqm, |
@@ -393,6 +403,7 @@ send_add_queue (struct GNUNET_TRANSPORT_QueueHandle *qh) | |||
393 | aqm->nt = htonl ((uint32_t) qh->nt); | 403 | aqm->nt = htonl ((uint32_t) qh->nt); |
394 | aqm->mtu = htonl (qh->mtu); | 404 | aqm->mtu = htonl (qh->mtu); |
395 | aqm->cs = htonl ((uint32_t) qh->cs); | 405 | aqm->cs = htonl ((uint32_t) qh->cs); |
406 | aqm->distance = htonl (qh->distance); | ||
396 | memcpy (&aqm[1], | 407 | memcpy (&aqm[1], |
397 | qh->address, | 408 | qh->address, |
398 | strlen (qh->address) + 1); | 409 | strlen (qh->address) + 1); |
@@ -412,10 +423,10 @@ send_del_queue (struct GNUNET_TRANSPORT_QueueHandle *qh) | |||
412 | { | 423 | { |
413 | struct GNUNET_MQ_Envelope *env; | 424 | struct GNUNET_MQ_Envelope *env; |
414 | struct GNUNET_TRANSPORT_DelQueueMessage *dqm; | 425 | struct GNUNET_TRANSPORT_DelQueueMessage *dqm; |
415 | 426 | ||
416 | if (NULL == qh->ch->mq) | 427 | if (NULL == qh->ch->mq) |
417 | return; | 428 | return; |
418 | env = GNUNET_MQ_msg (dqm, | 429 | env = GNUNET_MQ_msg (dqm, |
419 | GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_TEARDOWN); | 430 | GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_TEARDOWN); |
420 | dqm->qid = htonl (qh->queue_id); | 431 | dqm->qid = htonl (qh->queue_id); |
421 | dqm->receiver = qh->peer; | 432 | dqm->receiver = qh->peer; |
@@ -437,7 +448,7 @@ disconnect (struct GNUNET_TRANSPORT_CommunicatorHandle *ch) | |||
437 | { | 448 | { |
438 | struct FlowControl *fcn; | 449 | struct FlowControl *fcn; |
439 | struct AckPending *apn; | 450 | struct AckPending *apn; |
440 | 451 | ||
441 | for (struct FlowControl *fc = ch->fc_head; | 452 | for (struct FlowControl *fc = ch->fc_head; |
442 | NULL != fc; | 453 | NULL != fc; |
443 | fc = fcn) | 454 | fc = fcn) |
@@ -497,7 +508,7 @@ handle_incoming_ack (void *cls, | |||
497 | const struct GNUNET_TRANSPORT_IncomingMessageAck *incoming_ack) | 508 | const struct GNUNET_TRANSPORT_IncomingMessageAck *incoming_ack) |
498 | { | 509 | { |
499 | struct GNUNET_TRANSPORT_CommunicatorHandle *ch = cls; | 510 | struct GNUNET_TRANSPORT_CommunicatorHandle *ch = cls; |
500 | 511 | ||
501 | for (struct FlowControl *fc = ch->fc_head; | 512 | for (struct FlowControl *fc = ch->fc_head; |
502 | NULL != fc; | 513 | NULL != fc; |
503 | fc = fc->next) | 514 | fc = fc->next) |
@@ -563,7 +574,7 @@ handle_create_queue (void *cls, | |||
563 | const char *addr = (const char *) &cq[1]; | 574 | const char *addr = (const char *) &cq[1]; |
564 | struct GNUNET_TRANSPORT_CreateQueueResponse *cqr; | 575 | struct GNUNET_TRANSPORT_CreateQueueResponse *cqr; |
565 | struct GNUNET_MQ_Envelope *env; | 576 | struct GNUNET_MQ_Envelope *env; |
566 | 577 | ||
567 | if (GNUNET_OK != | 578 | if (GNUNET_OK != |
568 | ch->mq_init (ch->mq_init_cls, | 579 | ch->mq_init (ch->mq_init_cls, |
569 | &cq->receiver, | 580 | &cq->receiver, |
@@ -573,12 +584,12 @@ handle_create_queue (void *cls, | |||
573 | "Address `%s' invalid for this communicator\n", | 584 | "Address `%s' invalid for this communicator\n", |
574 | addr); | 585 | addr); |
575 | env = GNUNET_MQ_msg (cqr, | 586 | env = GNUNET_MQ_msg (cqr, |
576 | GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_CREATE_FAIL); | 587 | GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_CREATE_FAIL); |
577 | } | 588 | } |
578 | else | 589 | else |
579 | { | 590 | { |
580 | env = GNUNET_MQ_msg (cqr, | 591 | env = GNUNET_MQ_msg (cqr, |
581 | GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_CREATE_OK); | 592 | GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_CREATE_OK); |
582 | } | 593 | } |
583 | cqr->request_id = cq->request_id; | 594 | cqr->request_id = cq->request_id; |
584 | GNUNET_MQ_send (ch->mq, | 595 | GNUNET_MQ_send (ch->mq, |
@@ -678,12 +689,12 @@ handle_send_msg (void *cls, | |||
678 | struct AckPending *ap; | 689 | struct AckPending *ap; |
679 | struct GNUNET_TRANSPORT_QueueHandle *qh; | 690 | struct GNUNET_TRANSPORT_QueueHandle *qh; |
680 | 691 | ||
681 | for (qh = ch->queue_head;NULL != qh; qh = qh->next) | 692 | for (qh = ch->queue_head;NULL != qh; qh = qh->next) |
682 | if ( (qh->queue_id == smt->qid) && | 693 | if ( (qh->queue_id == smt->qid) && |
683 | (0 == memcmp (&qh->peer, | 694 | (0 == memcmp (&qh->peer, |
684 | &smt->receiver, | 695 | &smt->receiver, |
685 | sizeof (struct GNUNET_PeerIdentity))) ) | 696 | sizeof (struct GNUNET_PeerIdentity))) ) |
686 | break; | 697 | break; |
687 | if (NULL == qh) | 698 | if (NULL == qh) |
688 | { | 699 | { |
689 | /* queue is already gone, tell transport this one failed */ | 700 | /* queue is already gone, tell transport this one failed */ |
@@ -737,7 +748,7 @@ reconnect (struct GNUNET_TRANSPORT_CommunicatorHandle *ch) | |||
737 | }; | 748 | }; |
738 | struct GNUNET_TRANSPORT_CommunicatorAvailableMessage *cam; | 749 | struct GNUNET_TRANSPORT_CommunicatorAvailableMessage *cam; |
739 | struct GNUNET_MQ_Envelope *env; | 750 | struct GNUNET_MQ_Envelope *env; |
740 | 751 | ||
741 | ch->mq = GNUNET_CLIENT_connect (ch->cfg, | 752 | ch->mq = GNUNET_CLIENT_connect (ch->cfg, |
742 | "transport", | 753 | "transport", |
743 | handlers, | 754 | handlers, |
@@ -745,9 +756,10 @@ reconnect (struct GNUNET_TRANSPORT_CommunicatorHandle *ch) | |||
745 | ch); | 756 | ch); |
746 | if (NULL == ch->mq) | 757 | if (NULL == ch->mq) |
747 | return; | 758 | return; |
748 | env = GNUNET_MQ_msg_extra (cam, | 759 | env = GNUNET_MQ_msg_extra (cam, |
749 | strlen (ch->addr_prefix) + 1, | 760 | strlen (ch->addr_prefix) + 1, |
750 | GNUNET_MESSAGE_TYPE_TRANSPORT_NEW_COMMUNICATOR); | 761 | GNUNET_MESSAGE_TYPE_TRANSPORT_NEW_COMMUNICATOR); |
762 | cam->cc = htonl ((uint32_t) ch->cc); | ||
751 | memcpy (&cam[1], | 763 | memcpy (&cam[1], |
752 | ch->addr_prefix, | 764 | ch->addr_prefix, |
753 | strlen (ch->addr_prefix) + 1); | 765 | strlen (ch->addr_prefix) + 1); |
@@ -771,6 +783,7 @@ reconnect (struct GNUNET_TRANSPORT_CommunicatorHandle *ch) | |||
771 | * @param config_section section of the configuration to use for options | 783 | * @param config_section section of the configuration to use for options |
772 | * @param addr_prefix address prefix for addresses supported by this | 784 | * @param addr_prefix address prefix for addresses supported by this |
773 | * communicator, could be NULL for incoming-only communicators | 785 | * communicator, could be NULL for incoming-only communicators |
786 | * @param cc what characteristics does the communicator have? | ||
774 | * @param mtu maximum message size supported by communicator, 0 if | 787 | * @param mtu maximum message size supported by communicator, 0 if |
775 | * sending is not supported, SIZE_MAX for no MTU | 788 | * sending is not supported, SIZE_MAX for no MTU |
776 | * @param mq_init function to call to initialize a message queue given | 789 | * @param mq_init function to call to initialize a message queue given |
@@ -783,17 +796,19 @@ struct GNUNET_TRANSPORT_CommunicatorHandle * | |||
783 | GNUNET_TRANSPORT_communicator_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | 796 | GNUNET_TRANSPORT_communicator_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, |
784 | const char *config_section, | 797 | const char *config_section, |
785 | const char *addr_prefix, | 798 | const char *addr_prefix, |
799 | enum GNUNET_TRANSPORT_CommunicatorCharacteristics cc, | ||
786 | GNUNET_TRANSPORT_CommunicatorMqInit mq_init, | 800 | GNUNET_TRANSPORT_CommunicatorMqInit mq_init, |
787 | void *mq_init_cls) | 801 | void *mq_init_cls) |
788 | { | 802 | { |
789 | struct GNUNET_TRANSPORT_CommunicatorHandle *ch; | 803 | struct GNUNET_TRANSPORT_CommunicatorHandle *ch; |
790 | 804 | ||
791 | ch = GNUNET_new (struct GNUNET_TRANSPORT_CommunicatorHandle); | 805 | ch = GNUNET_new (struct GNUNET_TRANSPORT_CommunicatorHandle); |
792 | ch->cfg = cfg; | 806 | ch->cfg = cfg; |
793 | ch->config_section = config_section; | 807 | ch->config_section = config_section; |
794 | ch->addr_prefix = addr_prefix; | 808 | ch->addr_prefix = addr_prefix; |
795 | ch->mq_init = mq_init; | 809 | ch->mq_init = mq_init; |
796 | ch->mq_init_cls = mq_init_cls; | 810 | ch->mq_init_cls = mq_init_cls; |
811 | ch->cc = cc; | ||
797 | reconnect (ch); | 812 | reconnect (ch); |
798 | if (GNUNET_OK != | 813 | if (GNUNET_OK != |
799 | GNUNET_CONFIGURATION_get_value_number (cfg, | 814 | GNUNET_CONFIGURATION_get_value_number (cfg, |
@@ -858,7 +873,7 @@ GNUNET_TRANSPORT_communicator_receive (struct GNUNET_TRANSPORT_CommunicatorHandl | |||
858 | struct GNUNET_MQ_Envelope *env; | 873 | struct GNUNET_MQ_Envelope *env; |
859 | struct GNUNET_TRANSPORT_IncomingMessage *im; | 874 | struct GNUNET_TRANSPORT_IncomingMessage *im; |
860 | uint16_t msize; | 875 | uint16_t msize; |
861 | 876 | ||
862 | if (NULL == ch->mq) | 877 | if (NULL == ch->mq) |
863 | return GNUNET_SYSERR; | 878 | return GNUNET_SYSERR; |
864 | if ( (NULL == cb) && | 879 | if ( (NULL == cb) && |
@@ -869,7 +884,7 @@ GNUNET_TRANSPORT_communicator_receive (struct GNUNET_TRANSPORT_CommunicatorHandl | |||
869 | ch->max_queue_length); | 884 | ch->max_queue_length); |
870 | return GNUNET_NO; | 885 | return GNUNET_NO; |
871 | } | 886 | } |
872 | 887 | ||
873 | msize = ntohs (msg->size); | 888 | msize = ntohs (msg->size); |
874 | env = GNUNET_MQ_msg_extra (im, | 889 | env = GNUNET_MQ_msg_extra (im, |
875 | msize, | 890 | msize, |
@@ -918,6 +933,8 @@ GNUNET_TRANSPORT_communicator_receive (struct GNUNET_TRANSPORT_CommunicatorHandl | |||
918 | * @param mtu maximum message size supported by queue, 0 if | 933 | * @param mtu maximum message size supported by queue, 0 if |
919 | * sending is not supported, SIZE_MAX for no MTU | 934 | * sending is not supported, SIZE_MAX for no MTU |
920 | * @param nt which network type does the @a address belong to? | 935 | * @param nt which network type does the @a address belong to? |
936 | * @param cc what characteristics does the communicator have? | ||
937 | * @param distance how many hops does this queue use (DV-only)? | ||
921 | * @param cs what is the connection status of the queue? | 938 | * @param cs what is the connection status of the queue? |
922 | * @param mq message queue of the @a peer | 939 | * @param mq message queue of the @a peer |
923 | * @return API handle identifying the new MQ | 940 | * @return API handle identifying the new MQ |
@@ -928,6 +945,7 @@ GNUNET_TRANSPORT_communicator_mq_add (struct GNUNET_TRANSPORT_CommunicatorHandle | |||
928 | const char *address, | 945 | const char *address, |
929 | uint32_t mtu, | 946 | uint32_t mtu, |
930 | enum GNUNET_ATS_Network_Type nt, | 947 | enum GNUNET_ATS_Network_Type nt, |
948 | uint32_t distance, | ||
931 | enum GNUNET_TRANSPORT_ConnectionStatus cs, | 949 | enum GNUNET_TRANSPORT_ConnectionStatus cs, |
932 | struct GNUNET_MQ_Handle *mq) | 950 | struct GNUNET_MQ_Handle *mq) |
933 | { | 951 | { |
@@ -939,6 +957,7 @@ GNUNET_TRANSPORT_communicator_mq_add (struct GNUNET_TRANSPORT_CommunicatorHandle | |||
939 | qh->address = GNUNET_strdup (address); | 957 | qh->address = GNUNET_strdup (address); |
940 | qh->nt = nt; | 958 | qh->nt = nt; |
941 | qh->mtu = mtu; | 959 | qh->mtu = mtu; |
960 | qh->distance = distance; | ||
942 | qh->cs = cs; | 961 | qh->cs = cs; |
943 | qh->mq = mq; | 962 | qh->mq = mq; |
944 | qh->queue_id = ch->queue_gen++; | 963 | qh->queue_id = ch->queue_gen++; |
@@ -960,7 +979,7 @@ void | |||
960 | GNUNET_TRANSPORT_communicator_mq_del (struct GNUNET_TRANSPORT_QueueHandle *qh) | 979 | GNUNET_TRANSPORT_communicator_mq_del (struct GNUNET_TRANSPORT_QueueHandle *qh) |
961 | { | 980 | { |
962 | struct GNUNET_TRANSPORT_CommunicatorHandle *ch = qh->ch; | 981 | struct GNUNET_TRANSPORT_CommunicatorHandle *ch = qh->ch; |
963 | 982 | ||
964 | send_del_queue (qh); | 983 | send_del_queue (qh); |
965 | GNUNET_CONTAINER_DLL_remove (ch->queue_head, | 984 | GNUNET_CONTAINER_DLL_remove (ch->queue_head, |
966 | ch->queue_tail, | 985 | ch->queue_tail, |