diff options
Diffstat (limited to 'src/transport/transport_api2_communication.c')
-rw-r--r-- | src/transport/transport_api2_communication.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/transport/transport_api2_communication.c b/src/transport/transport_api2_communication.c index 3a68c6eba..6704f0cd8 100644 --- a/src/transport/transport_api2_communication.c +++ b/src/transport/transport_api2_communication.c | |||
@@ -193,11 +193,6 @@ struct GNUNET_TRANSPORT_CommunicatorHandle | |||
193 | uint64_t fc_gen; | 193 | uint64_t fc_gen; |
194 | 194 | ||
195 | /** | 195 | /** |
196 | * MTU of the communicator | ||
197 | */ | ||
198 | size_t mtu; | ||
199 | |||
200 | /** | ||
201 | * Internal UUID for the address used in communication with the | 196 | * Internal UUID for the address used in communication with the |
202 | * transport service. | 197 | * transport service. |
203 | */ | 198 | */ |
@@ -249,6 +244,11 @@ struct GNUNET_TRANSPORT_QueueHandle | |||
249 | enum GNUNET_ATS_Network_Type nt; | 244 | enum GNUNET_ATS_Network_Type nt; |
250 | 245 | ||
251 | /** | 246 | /** |
247 | * Communication status of the queue. | ||
248 | */ | ||
249 | enum GNUNET_TRANSPORT_ConnectionStatus cs; | ||
250 | |||
251 | /** | ||
252 | * The queue itself. | 252 | * The queue itself. |
253 | */ | 253 | */ |
254 | struct GNUNET_MQ_Handle *mq; | 254 | struct GNUNET_MQ_Handle *mq; |
@@ -257,6 +257,11 @@ struct GNUNET_TRANSPORT_QueueHandle | |||
257 | * ID for this queue when talking to the transport service. | 257 | * ID for this queue when talking to the transport service. |
258 | */ | 258 | */ |
259 | uint32_t queue_id; | 259 | uint32_t queue_id; |
260 | |||
261 | /** | ||
262 | * Maximum transmission unit for the queue. | ||
263 | */ | ||
264 | uint32_t mtu; | ||
260 | 265 | ||
261 | }; | 266 | }; |
262 | 267 | ||
@@ -383,9 +388,11 @@ send_add_queue (struct GNUNET_TRANSPORT_QueueHandle *qh) | |||
383 | env = GNUNET_MQ_msg_extra (aqm, | 388 | env = GNUNET_MQ_msg_extra (aqm, |
384 | strlen (qh->address) + 1, | 389 | strlen (qh->address) + 1, |
385 | GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_SETUP); | 390 | GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_SETUP); |
391 | aqm->qid = htonl (qh->queue_id); | ||
386 | aqm->receiver = qh->peer; | 392 | aqm->receiver = qh->peer; |
387 | aqm->nt = htonl ((uint32_t) qh->nt); | 393 | aqm->nt = htonl ((uint32_t) qh->nt); |
388 | aqm->qid = htonl (qh->queue_id); | 394 | aqm->mtu = htonl (qh->mtu); |
395 | aqm->cs = htonl ((uint32_t) qh->cs); | ||
389 | memcpy (&aqm[1], | 396 | memcpy (&aqm[1], |
390 | qh->address, | 397 | qh->address, |
391 | strlen (qh->address) + 1); | 398 | strlen (qh->address) + 1); |
@@ -776,7 +783,6 @@ struct GNUNET_TRANSPORT_CommunicatorHandle * | |||
776 | GNUNET_TRANSPORT_communicator_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | 783 | GNUNET_TRANSPORT_communicator_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, |
777 | const char *config_section, | 784 | const char *config_section, |
778 | const char *addr_prefix, | 785 | const char *addr_prefix, |
779 | size_t mtu, | ||
780 | GNUNET_TRANSPORT_CommunicatorMqInit mq_init, | 786 | GNUNET_TRANSPORT_CommunicatorMqInit mq_init, |
781 | void *mq_init_cls) | 787 | void *mq_init_cls) |
782 | { | 788 | { |
@@ -786,7 +792,6 @@ GNUNET_TRANSPORT_communicator_connect (const struct GNUNET_CONFIGURATION_Handle | |||
786 | ch->cfg = cfg; | 792 | ch->cfg = cfg; |
787 | ch->config_section = config_section; | 793 | ch->config_section = config_section; |
788 | ch->addr_prefix = addr_prefix; | 794 | ch->addr_prefix = addr_prefix; |
789 | ch->mtu = mtu; | ||
790 | ch->mq_init = mq_init; | 795 | ch->mq_init = mq_init; |
791 | ch->mq_init_cls = mq_init_cls; | 796 | ch->mq_init_cls = mq_init_cls; |
792 | reconnect (ch); | 797 | reconnect (ch); |
@@ -910,7 +915,10 @@ GNUNET_TRANSPORT_communicator_receive (struct GNUNET_TRANSPORT_CommunicatorHandl | |||
910 | * @param ch connection to transport service | 915 | * @param ch connection to transport service |
911 | * @param peer peer with which we can now communicate | 916 | * @param peer peer with which we can now communicate |
912 | * @param address address in human-readable format, 0-terminated, UTF-8 | 917 | * @param address address in human-readable format, 0-terminated, UTF-8 |
918 | * @param mtu maximum message size supported by queue, 0 if | ||
919 | * sending is not supported, SIZE_MAX for no MTU | ||
913 | * @param nt which network type does the @a address belong to? | 920 | * @param nt which network type does the @a address belong to? |
921 | * @param cs what is the connection status of the queue? | ||
914 | * @param mq message queue of the @a peer | 922 | * @param mq message queue of the @a peer |
915 | * @return API handle identifying the new MQ | 923 | * @return API handle identifying the new MQ |
916 | */ | 924 | */ |
@@ -918,7 +926,9 @@ struct GNUNET_TRANSPORT_QueueHandle * | |||
918 | GNUNET_TRANSPORT_communicator_mq_add (struct GNUNET_TRANSPORT_CommunicatorHandle *ch, | 926 | GNUNET_TRANSPORT_communicator_mq_add (struct GNUNET_TRANSPORT_CommunicatorHandle *ch, |
919 | const struct GNUNET_PeerIdentity *peer, | 927 | const struct GNUNET_PeerIdentity *peer, |
920 | const char *address, | 928 | const char *address, |
929 | uint32_t mtu, | ||
921 | enum GNUNET_ATS_Network_Type nt, | 930 | enum GNUNET_ATS_Network_Type nt, |
931 | enum GNUNET_TRANSPORT_ConnectionStatus cs, | ||
922 | struct GNUNET_MQ_Handle *mq) | 932 | struct GNUNET_MQ_Handle *mq) |
923 | { | 933 | { |
924 | struct GNUNET_TRANSPORT_QueueHandle *qh; | 934 | struct GNUNET_TRANSPORT_QueueHandle *qh; |
@@ -928,6 +938,8 @@ GNUNET_TRANSPORT_communicator_mq_add (struct GNUNET_TRANSPORT_CommunicatorHandle | |||
928 | qh->peer = *peer; | 938 | qh->peer = *peer; |
929 | qh->address = GNUNET_strdup (address); | 939 | qh->address = GNUNET_strdup (address); |
930 | qh->nt = nt; | 940 | qh->nt = nt; |
941 | qh->mtu = mtu; | ||
942 | qh->cs = cs; | ||
931 | qh->mq = mq; | 943 | qh->mq = mq; |
932 | qh->queue_id = ch->queue_gen++; | 944 | qh->queue_id = ch->queue_gen++; |
933 | GNUNET_CONTAINER_DLL_insert (ch->queue_head, | 945 | GNUNET_CONTAINER_DLL_insert (ch->queue_head, |