*/
#include "platform.h"
#include "gnunet_util_lib.h"
+#include "gnunet_dnsparser_lib.h"
#include "gnunet_gnsrecord_lib.h"
#define RECORDS 5
-#define TEST_RECORD_TYPE 1234
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TEST_RECORD_DATALEN 123
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_gnsrecord_lib.h"
+#include "gnunet_dnsparser_lib.h"
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100)
static void
-run (void *cls, char *const *args, const char *cfgfile,
+run (void *cls,
+ char *const *args,
+ const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
size_t len;
data_len = 0;
for (c = 0; c < rd_count; c++)
{
- src[c].record_type = c+1;
+ src[c].record_type = GNUNET_DNSPARSER_TYPE_TXT;
src[c].data_size = data_len;
src[c].data = GNUNET_malloc (data_len);
(unsigned int) len);
GNUNET_assert (rd_ser != NULL);
-
- struct GNUNET_GNSRECORD_Data dst[rd_count];
- GNUNET_assert (GNUNET_OK ==
- GNUNET_GNSRECORD_records_deserialize (len,
- rd_ser,
- rd_count,
- dst));
-
- GNUNET_assert (dst != NULL);
-
- for (c = 0; c < rd_count; c++)
{
- if (src[c].data_size != dst[c].data_size)
- {
- GNUNET_break (0);
- res = 1;
- }
- if (src[c].expiration_time != dst[c].expiration_time)
- {
- GNUNET_break (0);
- res = 1;
- }
- if (src[c].flags != dst[c].flags)
- {
- GNUNET_break (0);
- res = 1;
- }
- if (src[c].record_type != dst[c].record_type)
- {
- GNUNET_break (0);
- res = 1;
- }
+ struct GNUNET_GNSRECORD_Data dst[rd_count];
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_GNSRECORD_records_deserialize (len,
+ rd_ser,
+ rd_count,
+ dst));
- size_t data_size = src[c].data_size;
- char data[data_size];
- memset (data, 'a', data_size);
- if (0 != memcmp (data, dst[c].data, data_size))
- {
- GNUNET_break (0);
- res = 1;
- }
- if (0 != memcmp (data, src[c].data, data_size))
- {
- GNUNET_break (0);
- res = 1;
- }
- if (0 != memcmp (src[c].data, dst[c].data, src[c].data_size))
+ GNUNET_assert (dst != NULL);
+
+ for (c = 0; c < rd_count; c++)
{
- GNUNET_break (0);
- res = 1;
+ if (src[c].data_size != dst[c].data_size)
+ {
+ GNUNET_break (0);
+ res = 1;
+ }
+ if (src[c].expiration_time != dst[c].expiration_time)
+ {
+ GNUNET_break (0);
+ res = 1;
+ }
+ if (src[c].flags != dst[c].flags)
+ {
+ GNUNET_break (0);
+ res = 1;
+ }
+ if (src[c].record_type != dst[c].record_type)
+ {
+ GNUNET_break (0);
+ res = 1;
+ }
+
+ {
+ size_t data_size = src[c].data_size;
+ char data[data_size];
+
+ memset (data, 'a', data_size);
+ if (0 != memcmp (data, dst[c].data, data_size))
+ {
+ GNUNET_break (0);
+ res = 1;
+ }
+ if (0 != memcmp (data, src[c].data, data_size))
+ {
+ GNUNET_break (0);
+ res = 1;
+ }
+ if (0 != memcmp (src[c].data, dst[c].data, src[c].data_size))
+ {
+ GNUNET_break (0);
+ res = 1;
+ }
+ }
}
-
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Element [%i]: EQUAL\n", c);
}
#include "platform.h"
#include "gnunet_namecache_service.h"
#include "gnunet_testing_lib.h"
+#include "gnunet_dnsparser_lib.h"
-#define TEST_RECORD_TYPE 1234
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TEST_RECORD_DATALEN 123
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Block was decrypted successfully \n");
-
+
GNUNET_SCHEDULER_add_now (&end, NULL);
}
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
#include "namestore.h"
+#include "gnunet_dnsparser_lib.h"
+
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
/**
* A #BENCHMARK_SIZE of 1000 takes less than a minute on a reasonably
rd = GNUNET_malloc (count + sizeof (struct GNUNET_GNSRECORD_Data));
rd->expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us;
- rd->record_type = count;
+ rd->record_type = TEST_RECORD_TYPE;
rd->data_size = count;
rd->data = (void *) &rd[1];
rd->flags = 0;
#include "platform.h"
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
+#include "gnunet_dnsparser_lib.h"
-#define TEST_RECORD_TYPE 1234
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TEST_RECORD_DATALEN 123
#include "platform.h"
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
+#include "gnunet_dnsparser_lib.h"
-#define TEST_RECORD_TYPE 1234
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TEST_RECORD_DATALEN 123
#include "gnunet_namecache_service.h"
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
+#include "gnunet_dnsparser_lib.h"
-#define TEST_RECORD_TYPE 1234
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TEST_RECORD_DATALEN 123
#include "gnunet_namecache_service.h"
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
+#include "gnunet_dnsparser_lib.h"
-#define TEST_RECORD_TYPE 1234
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TEST_RECORD_DATALEN 123
#include "gnunet_namecache_service.h"
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
+#include "gnunet_dnsparser_lib.h"
+
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TEST_NAME "dummy.dummy.gnunet"
-#define TEST_RECORD_TYPE 1234
#define TEST_RECORD_DATALEN 123
#define TEST_RECORD_DATA 'a'
#define TEST_SHADOW_RECORD_DATA 'b'
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
#include "namestore.h"
+#include "gnunet_dnsparser_lib.h"
+
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
+
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100)
static struct GNUNET_GNSRECORD_Data *
create_record (unsigned int count)
{
- unsigned int c;
- struct GNUNET_GNSRECORD_Data * rd;
+ struct GNUNET_GNSRECORD_Data *rd;
- rd = GNUNET_malloc (count * sizeof (struct GNUNET_GNSRECORD_Data));
- for (c = 0; c < count; c++)
+ rd = GNUNET_new_array (count,
+ struct GNUNET_GNSRECORD_Data);
+ for (unsigned int c = 0; c < count; c++)
{
rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us;
- rd[c].record_type = 1111;
+ rd[c].record_type = TEST_RECORD_TYPE;
rd[c].data_size = 50;
rd[c].data = GNUNET_malloc(50);
rd[c].flags = 0;
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
#include "namestore.h"
+#include "gnunet_dnsparser_lib.h"
+
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
for (unsigned int c = 0; c < count; c++)
{
rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us;
- rd[c].record_type = 1111;
+ rd[c].record_type = TEST_RECORD_TYPE;
rd[c].data_size = 50;
rd[c].data = GNUNET_malloc(50);
rd[c].flags = 0;
#include "platform.h"
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
+#include "gnunet_dnsparser_lib.h"
-#define TEST_RECORD_TYPE 1234
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TEST_RECORD_DATALEN 123
#include "platform.h"
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
+#include "gnunet_dnsparser_lib.h"
-#define TEST_RECORD_TYPE 1234
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TEST_RECORD_DATALEN 123
#include "gnunet_namecache_service.h"
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
+#include "gnunet_dnsparser_lib.h"
-#define TEST_RECORD_TYPE 1234
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TEST_RECORD_DATALEN 123
#define TEST_RECORD_DATA 'a'
-#define TEST_RECORD_TYPE2 4321
-
#define TEST_RECORD_DATALEN2 234
#define TEST_RECORD_DATA2 'b'
rd_new.flags = GNUNET_GNSRECORD_RF_NONE;
rd_new.expiration_time = GNUNET_TIME_absolute_get().abs_value_us + 1000000000;
- rd_new.record_type = TEST_RECORD_TYPE2;
+ rd_new.record_type = TEST_RECORD_TYPE;
rd_new.data_size = TEST_RECORD_DATALEN2;
rd_new.data = GNUNET_malloc (TEST_RECORD_DATALEN2);
memset ((char *) rd_new.data,
memset (rd_cmp_data,
TEST_RECORD_DATA2,
TEST_RECORD_DATALEN2);
- GNUNET_assert (TEST_RECORD_TYPE2 == rd[0].record_type);
+ GNUNET_assert (TEST_RECORD_TYPE == rd[0].record_type);
GNUNET_assert (TEST_RECORD_DATALEN2 == rd[0].data_size);
GNUNET_assert (0 == memcmp (&rd_cmp_data,
rd[0].data,
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
#include "namestore.h"
+#include "gnunet_dnsparser_lib.h"
+
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100)
for (unsigned int c = 0; c < count; c++)
{
rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us;
- rd[c].record_type = 1111;
+ rd[c].record_type = TEST_RECORD_TYPE;
rd[c].data_size = 50;
rd[c].data = GNUNET_malloc(50);
rd[c].flags = 0;
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
#include "namestore.h"
+#include "gnunet_dnsparser_lib.h"
+
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define ZONE_NICK_1 "nick1"
#define ZONE_NICK_2 "nick2"
for (unsigned int c = 0; c < count; c++)
{
rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us;
- rd[c].record_type = 1111;
+ rd[c].record_type = TEST_RECORD_TYPE;
rd[c].data_size = 50;
rd[c].data = GNUNET_malloc(50);
rd[c].flags = 0;
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
#include "namestore.h"
+#include "gnunet_dnsparser_lib.h"
+
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100)
for (unsigned int c = 0; c < count; c++)
{
rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us;
- rd[c].record_type = 1111;
+ rd[c].record_type = TEST_RECORD_TYPE;
rd[c].data_size = 50;
rd[c].data = GNUNET_malloc(50);
rd[c].flags = 0;
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
#include "namestore.h"
+#include "gnunet_dnsparser_lib.h"
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100)
#define WAIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2)
static struct GNUNET_GNSRECORD_Data *
create_record (unsigned int count)
{
- unsigned int c;
- struct GNUNET_GNSRECORD_Data * rd;
+ struct GNUNET_GNSRECORD_Data *rd;
- rd = GNUNET_malloc (count * sizeof (struct GNUNET_GNSRECORD_Data));
- for (c = 0; c < count; c++)
+ rd = GNUNET_new_array (count,
+ struct GNUNET_GNSRECORD_Data);
+ for (unsigned int c = 0; c < count; c++)
{
rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us;
- rd[c].record_type = 1111;
+ rd[c].record_type = TEST_RECORD_TYPE;
rd[c].data_size = 50;
rd[c].data = GNUNET_malloc(50);
rd[c].flags = 0;
#include "gnunet_namestore_service.h"
#include "gnunet_testing_lib.h"
#include "namestore.h"
+#include "gnunet_dnsparser_lib.h"
-#define RECORDS 5
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
-#define TEST_RECORD_TYPE 1234
+#define RECORDS 5
#define TEST_RECORD_DATALEN 123
#include "gnunet_util_lib.h"
#include "gnunet_namestore_plugin.h"
#include "gnunet_testing_lib.h"
+#include "gnunet_dnsparser_lib.h"
+#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
static int ok;
{
GNUNET_assert (rd[i].data_size == id % 10);
GNUNET_assert (0 == memcmp ("Hello World", rd[i].data, id % 10));
- GNUNET_assert (rd[i].record_type == 1 + (id % 13));
+ GNUNET_assert (rd[i].record_type == TEST_RECORD_TYPE);
GNUNET_assert (rd[i].flags == 0);
}
memset (&tzone_private_key,
rd[i].data = "Hello World";
rd[i].data_size = id % 10;
rd[i].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES).abs_value_us;
- rd[i].record_type = 1 + (id % 13);
+ rd[i].record_type = TEST_RECORD_TYPE;
rd[i].flags = 0;
}
memset (&zone_private_key, (id % 241), sizeof (zone_private_key));