#define VERBOSE GNUNET_YES
/* Timeout for entire testcase */
-#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 5)
+#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30)
/* If number of peers not in config file, use this number */
#define DEFAULT_NUM_PEERS 2
on_lookup_result(void *cls, uint32_t rd_count,
const struct GNUNET_NAMESTORE_RecordData *rd)
{
- struct in_addr a;
int i;
- char* addr;
- int mx_found = 0;
- int ip_found = 0;
uint16_t mx_preference;
char* mx;
for (i=0; i<rd_count; i++)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "type: %d\n", rd[i].record_type);
- if (rd[i].record_type == GNUNET_GNS_RECORD_TYPE_A)
- {
- memcpy(&a, rd[i].data, sizeof(a));
- addr = inet_ntoa(a);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "address: %s\n", addr);
- if (0 == strcmp(addr, TEST_IP))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "%s correctly resolved to %s!\n", TEST_DOMAIN, addr);
- ip_found = 1;
- }
- }
- else if (rd[i].record_type == GNUNET_GNS_RECORD_MX)
+ if (rd[i].record_type == GNUNET_GNS_RECORD_MX)
{
mx = (char*)rd[i].data+sizeof(uint16_t);
mx_preference = *(uint16_t*)rd[i].data;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"%s correctly resolved to %s!\n", TEST_DOMAIN,
TEST_EXPECTED_MX);
- mx_found = 1;
+ ok = 0;
}
}
}
}
- if (ip_found && mx_found)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Test succeeded!\n");
- ok = 0;
- }
-
- if (!ip_found && mx_found)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "A record not passed along!(NOT IMPLEMENTED)\n");
- ok = 0;
- }
-
GNUNET_GNS_disconnect(gns_handle);
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down peer1!\n");
GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
#include "gnunet_namestore_service.h"
#include "../namestore/namestore.h"
#include "gnunet_dnsparser_lib.h"
+#include "../dns/dnsparser.h"
#include "gnunet_gns_service.h"
/* DEFINES */
ok = 1;
}
-GNUNET_NETWORK_STRUCT_BEGIN
-struct srv_data
-{
- uint16_t prio GNUNET_PACKED;
- uint16_t weight GNUNET_PACKED;
- uint16_t port GNUNET_PACKED;
-};
-GNUNET_NETWORK_STRUCT_END
static void
do_lookup(void *cls, const struct GNUNET_PeerIdentity *id,