aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport-testing2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/transport-testing2.c')
-rw-r--r--src/transport/transport-testing2.c60
1 files changed, 55 insertions, 5 deletions
diff --git a/src/transport/transport-testing2.c b/src/transport/transport-testing2.c
index 22a767fce..41d4ab937 100644
--- a/src/transport/transport-testing2.c
+++ b/src/transport/transport-testing2.c
@@ -280,6 +280,54 @@ handle_communicator_available (
280 280
281 281
282/** 282/**
283 * Incoming message. Test message is well-formed.
284 *
285 * @param cls the client
286 * @param msg the send message that was sent
287 * @return #GNUNET_OK if message is well-formed
288 */
289static int
290check_communicator_backchannel (void *cls,
291 const struct
292 GNUNET_TRANSPORT_CommunicatorBackchannel *msg)
293{
294 // struct TransportClient *tc = cls;
295
296 // if (CT_COMMUNICATOR != tc->type)
297 // {
298 // GNUNET_break (0);
299 // return GNUNET_SYSERR;
300 // }
301 // GNUNET_MQ_check_boxed_message (msg);
302 return GNUNET_OK;
303}
304
305
306/**
307 * @brief Receive an incoming message.
308 *
309 * Pass the message to the client.
310 *
311 * @param cls Closure - communicator handle
312 * @param msg Message
313 */
314static void
315handle_communicator_backchannel (void *cls,
316 const struct
317 GNUNET_TRANSPORT_CommunicatorBackchannel *
318 bc_msg)
319{
320 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls;
321 struct GNUNET_MessageHeader *msg;
322 msg = (struct GNUNET_MessageHeader *) &bc_msg[1];
323 size_t payload_len = ntohs (msg->size) - sizeof (struct
324 GNUNET_MessageHeader);
325
326 GNUNET_SERVICE_client_continue (tc_h->client);
327}
328
329
330/**
283 * Address of our peer added. Test message is well-formed. 331 * Address of our peer added. Test message is well-formed.
284 * 332 *
285 * @param cls the client 333 * @param cls the client
@@ -373,6 +421,8 @@ handle_incoming_msg (void *cls,
373 msg = (struct GNUNET_MessageHeader *) &inc_msg[1]; 421 msg = (struct GNUNET_MessageHeader *) &inc_msg[1];
374 size_t payload_len = ntohs (msg->size) - sizeof (struct 422 size_t payload_len = ntohs (msg->size) - sizeof (struct
375 GNUNET_MessageHeader); 423 GNUNET_MessageHeader);
424 LOG (GNUNET_ERROR_TYPE_DEBUG,
425 "Incoming message from communicator!\n");
376 426
377 if (NULL != tc_h->incoming_msg_cb) 427 if (NULL != tc_h->incoming_msg_cb)
378 { 428 {
@@ -386,7 +436,7 @@ handle_incoming_msg (void *cls,
386 LOG (GNUNET_ERROR_TYPE_WARNING, 436 LOG (GNUNET_ERROR_TYPE_WARNING,
387 "Incoming message from communicator but no handler!\n"); 437 "Incoming message from communicator but no handler!\n");
388 } 438 }
389 if (0 != ntohl (inc_msg->fc_on)) 439 if (GNUNET_YES == ntohl (inc_msg->fc_on))
390 { 440 {
391 /* send ACK when done to communicator for flow control! */ 441 /* send ACK when done to communicator for flow control! */
392 struct GNUNET_MQ_Envelope *env; 442 struct GNUNET_MQ_Envelope *env;
@@ -613,10 +663,10 @@ transport_communicator_start (
613 GNUNET_MESSAGE_TYPE_TRANSPORT_NEW_COMMUNICATOR, 663 GNUNET_MESSAGE_TYPE_TRANSPORT_NEW_COMMUNICATOR,
614 struct GNUNET_TRANSPORT_CommunicatorAvailableMessage, 664 struct GNUNET_TRANSPORT_CommunicatorAvailableMessage,
615 tc_h), 665 tc_h),
616 // GNUNET_MQ_hd_var_size (communicator_backchannel, 666 GNUNET_MQ_hd_var_size (communicator_backchannel,
617 // GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL, 667 GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL,
618 // struct GNUNET_TRANSPORT_CommunicatorBackchannel, 668 struct GNUNET_TRANSPORT_CommunicatorBackchannel,
619 // NULL), 669 tc_h),
620 GNUNET_MQ_hd_var_size (add_address, 670 GNUNET_MQ_hd_var_size (add_address,
621 GNUNET_MESSAGE_TYPE_TRANSPORT_ADD_ADDRESS, 671 GNUNET_MESSAGE_TYPE_TRANSPORT_ADD_ADDRESS,
622 struct GNUNET_TRANSPORT_AddAddressMessage, 672 struct GNUNET_TRANSPORT_AddAddressMessage,