test_communicator_basic-unix \
test_communicator_basic-tcp \
test_communicator_basic-udp \
- test_communicator_rekey-tcp
+ test_communicator_rekey-tcp \
+ test_communicator_rekey-udp \
+ test_communicator_backchannel-udp
endif
endif
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
+test_communicator_rekey_udp_SOURCES = \
+ test_communicator_basic.c
+test_communicator_rekey_udp_LDADD = \
+ libgnunettransporttesting2.la \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/util/libgnunetutil.la
+
+test_communicator_backchannel_udp_SOURCES = \
+ test_communicator_basic.c
+test_communicator_backchannel_udp_LDADD = \
+ libgnunettransporttesting2.la \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/util/libgnunetutil.la
endif
test_plugin_unix_SOURCES = \
test_communicator_basic_udp_peer1.conf \
test_communicator_basic_udp_peer2.conf \
test_communicator_rekey_tcp_peer1.conf \
-test_communicator_rekey_tcp_peer2.conf
+test_communicator_rekey_tcp_peer2.conf \
+test_communicator_rekey_udp_peer1.conf \
+test_communicator_rekey_udp_peer2.conf \
+test_communicator_backchannel_udp_peer1.conf \
+test_communicator_backchannel_udp_peer2.conf
--- /dev/null
+@INLINE@ test_transport_defaults.conf
+
+[PATHS]
+GNUNET_TEST_HOME = $GNUNET_TMP/test-communicator-unix-1/
+
+[PEER]
+PRIVATE_KEY = $GNUNET_TMP/test-communicator-unix-1/private.key
+
+[transport-tcp]
+PORT = 52400
+
+[transport-udp]
+PORT = 52401
+
+[transport]
+PORT = 60000
+UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-transport_test_1.sock
+
+[nat]
+UNIXPATH = $GNUNET_TMP/test-communicator-unix-1/nat.sock
+ENABLE_IPSCAN = YES
+
+[communicator-unix]
+UNIXPATH = $GNUNET_RUNTIME_DIR/test_gnunet-communicator-unix_1.sock
+
+[communicator-tcp]
+BINDTO = 60002
+DISABLE_V6 = YES
+
+[communicator-udp]
+BINDTO = 60002
+DISABLE_V6 = YES
+MAX_QUEUE_LENGTH=5000
+
+[communicator-test]
+BACKCHANNEL_ENABLED = YES
--- /dev/null
+@INLINE@ test_transport_defaults.conf
+
+[PATHS]
+GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunetd-plugin-transport/
+
+[PEER]
+PRIVATE_KEY = $GNUNET_TMP/test-communicator-unix-2/private.key
+
+
+[transport-tcp]
+PORT = 52400
+
+[transport-udp]
+PORT = 52401
+
+[transport]
+PORT = 60001
+UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-transport_test_2.sock
+
+[nat]
+UNIXPATH = $GNUNET_TMP/test-communicator-unix-2/nat.sock
+
+[communicator-unix]
+UNIXPATH = $GNUNET_RUNTIME_DIR/test_gnunet-communicator-unix_2.sock
+
+[communicator-tcp]
+BINDTO = 60003
+DISABLE_V6 = YES
+
+[communicator-udp]
+BINDTO = 60003
+DISABLE_V6 = YES
+MAX_QUEUE_LENGTH=5000
+
+[communicator-test]
+BACKCHANNEL_ENABLED = YES
--- /dev/null
+@INLINE@ test_transport_defaults.conf
+
+[PATHS]
+GNUNET_TEST_HOME = $GNUNET_TMP/test-communicator-unix-1/
+
+[PEER]
+PRIVATE_KEY = $GNUNET_TMP/test-communicator-unix-1/private.key
+
+[transport-tcp]
+PORT = 52400
+
+[transport-udp]
+PORT = 52401
+
+[transport]
+PORT = 60000
+UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-transport_test_1.sock
+
+[nat]
+UNIXPATH = $GNUNET_TMP/test-communicator-unix-1/nat.sock
+ENABLE_IPSCAN = YES
+
+[communicator-unix]
+UNIXPATH = $GNUNET_RUNTIME_DIR/test_gnunet-communicator-unix_1.sock
+
+[communicator-tcp]
+BINDTO = 60002
+DISABLE_V6 = YES
+
+[communicator-udp]
+BINDTO = 60002
+DISABLE_V6 = YES
+MAX_QUEUE_LENGTH=5000
+++ /dev/null
-@INLINE@ test_transport_defaults.conf
-
-[PATHS]
-GNUNET_TEST_HOME = $GNUNET_TMP/test-communicator-unix-1/
-
-[PEER]
-PRIVATE_KEY = $GNUNET_TMP/test-communicator-unix-1/private.key
-
-[transport-tcp]
-PORT = 52400
-
-[transport-udp]
-PORT = 52401
-
-[transport]
-PORT = 60000
-UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-transport_test_1.sock
-
-[nat]
-UNIXPATH = $GNUNET_TMP/test-communicator-unix-1/nat.sock
-ENABLE_IPSCAN = YES
-
-[communicator-unix]
-UNIXPATH = $GNUNET_RUNTIME_DIR/test_gnunet-communicator-unix_1.sock
-
-[communicator-tcp]
-BINDTO = 60002
-DISABLE_V6 = YES
-
-[communicator-udp]
-BINDTO = 60002
-DISABLE_V6 = YES
-MAX_QUEUE_LENGTH=5000
* @brief Closure to the callback
*/
void *cb_cls;
+
+ /**
+ * Backchannel supported
+ */
+ int bc_enabled;
};
struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls;
struct GNUNET_MessageHeader *msg;
msg = (struct GNUNET_MessageHeader *) &bc_msg[1];
- size_t payload_len = ntohs (msg->size) - sizeof (struct
- GNUNET_MessageHeader);
-
+ struct GNUNET_TRANSPORT_CommunicatorBackchannelIncoming *cbi;
+ struct GNUNET_MQ_Envelope *env;
+ uint16_t isize = ntohs (msg->size);
+ const char *target_communicator = ((const char *) msg) + isize;
+ if (tc_h->bc_enabled != GNUNET_YES)
+ {
+ GNUNET_SERVICE_client_continue (tc_h->client);
+ return;
+ }
+ /* Find client providing this communicator */
+ /* Finally, deliver backchannel message to communicator */
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Delivering backchannel message of type %u to %s\n",
+ ntohs (msg->type),
+ target_communicator);
+ env = GNUNET_MQ_msg_extra (
+ cbi,
+ isize,
+ GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL_INCOMING);
+ cbi->pid = bc_msg->pid;
+ memcpy (&cbi[1], msg, isize);
+ GNUNET_MQ_send (tc_h->c_mq, env);
GNUNET_SERVICE_client_continue (tc_h->client);
}
GNUNET_free (tc_h);
return NULL;
}
+ tc_h->bc_enabled = GNUNET_CONFIGURATION_get_value_yesno (tc_h->cfg,
+ "communicator-test",
+ "BACKCHANNEL_ENABLED");
tc_h->communicator_available_cb = communicator_available_cb;
tc_h->add_address_cb = add_address_cb;
tc_h->queue_create_reply_cb = queue_create_reply_cb;