$(GN_PLUGIN_LDFLAGS)
check_PROGRAMS = \
- test_transport_api \
+ test_transport_api_tcp \
+ test_transport_api_udp \
test_plugin_transport \
test_plugin_transport_udp
# TODO: add tests for tcp, udp, http, nat, etc.
TESTS = $(check_PROGRAMS)
-test_transport_api_SOURCES = \
+test_transport_api_tcp_SOURCES = \
test_transport_api.c
-test_transport_api_LDADD = \
+test_transport_api_tcp_LDADD = \
$(top_builddir)/src/transport/libgnunettransport.la \
$(top_builddir)/src/util/libgnunetutil.la
+test_transport_api_udp_SOURCES = \
+ test_transport_api.c
+test_transport_api_udp_LDADD = \
+ $(top_builddir)/src/transport/libgnunettransport.la \
+ $(top_builddir)/src/util/libgnunetutil.la
test_plugin_transport_SOURCES = \
test_plugin_transport.c
/**
* Message used to ask a peer to validate receipt (to check an address
- * from a HELLO). Followed by the address used. Note that the
- * recipients response does not affirm that he has this address,
- * only that he got the challenge message.
+ * from a HELLO).
*/
struct UDPPingMessage
{
*/
uint32_t challenge GNUNET_PACKED;
-
-
};
/**
- * Message used to validate a HELLO. The challenge is included in the
- * confirmation to make matching of replies to requests possible. The
- * signature signs the original challenge number, our public key, the
- * sender's address (so that the sender can check that the address we
- * saw is plausible for him and possibly detect a MiM attack) and a
- * timestamp (to limit replay).<p>
+ * Message used to validate a HELLO. The challenge number
+ * is sent along with whatever address the peer received
+ * the ping from. Used to validate our address (or at
+ * least give us a better idea where we look like we're
+ * coming from).
*
- * This message is followed by the address of the
- * client that we are observing (which is part of what
- * is being signed).
*/
struct UDPPongMessage
{
buf = GNUNET_malloc (buflen);
fromlen = sizeof (addr);
-
#if DEBUG_UDP
GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, "udp", _
("src_addr_len is %u\n"), fromlen);
#endif
-
memset (&addr, 0, fromlen);
ret =
GNUNET_NETWORK_socket_recvfrom (udp_sock, buf, buflen,
GNUNET_free (buf);
return;
}
-
msg = (struct UDPMessage *) buf;
#if DEBUG_UDP
static int ok;
+static int is_tcp;
+
+static int is_udp;
+
#if VERBOSE
#define OKPP do { ok++; fprintf (stderr, "Now at stage %u at %s:%u\n", ok, __FILE__, __LINE__); } while (0)
#else
{
int ret;
+ if (strstr(argv[0], "test_transport_api_tcp") == 0)
+ {
+ is_tcp = GNUNET_YES;
+ }
+ else if (strstr(argv[0], "test_transport_api_udp") == 0)
+ {
+ is_udp = GNUNET_NO;
+ }
+
+
GNUNET_log_setup ("test-transport-api",
#if VERBOSE
"DEBUG",