diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-02 11:09:33 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-03-02 11:09:33 +0000 |
commit | 9336010863e2fddb329675148e090de718b6d5b7 (patch) | |
tree | b97611138ebfdc26984d4748448457cfad39a435 /src/namestore/test_namestore_api_lookup.c | |
parent | a9a895d090282d08c58460f20cab807337e82109 (diff) | |
download | gnunet-9336010863e2fddb329675148e090de718b6d5b7.tar.gz gnunet-9336010863e2fddb329675148e090de718b6d5b7.zip |
- create test
Diffstat (limited to 'src/namestore/test_namestore_api_lookup.c')
-rw-r--r-- | src/namestore/test_namestore_api_lookup.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/namestore/test_namestore_api_lookup.c b/src/namestore/test_namestore_api_lookup.c index daca07b14..05a3b270c 100644 --- a/src/namestore/test_namestore_api_lookup.c +++ b/src/namestore/test_namestore_api_lookup.c | |||
@@ -45,7 +45,7 @@ static struct GNUNET_CRYPTO_RsaPrivateKey * privkey; | |||
45 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; | 45 | static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey; |
46 | struct GNUNET_CRYPTO_RsaSignature *s_signature; | 46 | struct GNUNET_CRYPTO_RsaSignature *s_signature; |
47 | static GNUNET_HashCode s_zone; | 47 | static GNUNET_HashCode s_zone; |
48 | struct GNUNET_NAMESTORE_RecordData *s_rd; | 48 | struct GNUNET_NAMESTORE_RecordData *first_record; |
49 | static char *s_name; | 49 | static char *s_name; |
50 | 50 | ||
51 | 51 | ||
@@ -113,8 +113,8 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
113 | 113 | ||
114 | int c; | 114 | int c; |
115 | for (c = 0; c < RECORDS; c++) | 115 | for (c = 0; c < RECORDS; c++) |
116 | GNUNET_free_non_null((void *) s_rd[c].data); | 116 | GNUNET_free_non_null((void *) first_record[c].data); |
117 | GNUNET_free (s_rd); | 117 | GNUNET_free (first_record); |
118 | 118 | ||
119 | if (privkey != NULL) | 119 | if (privkey != NULL) |
120 | GNUNET_CRYPTO_rsa_key_free (privkey); | 120 | GNUNET_CRYPTO_rsa_key_free (privkey); |
@@ -169,10 +169,10 @@ void name_lookup_proc (void *cls, | |||
169 | 169 | ||
170 | for (c = 0; c < RECORDS; c++) | 170 | for (c = 0; c < RECORDS; c++) |
171 | { | 171 | { |
172 | GNUNET_break (rd[c].expiration.abs_value == s_rd[c].expiration.abs_value); | 172 | GNUNET_break (rd[c].expiration.abs_value == first_record[c].expiration.abs_value); |
173 | GNUNET_break (rd[c].record_type == TEST_RECORD_TYPE); | 173 | GNUNET_break (rd[c].record_type == TEST_RECORD_TYPE); |
174 | GNUNET_break (rd[c].data_size == TEST_RECORD_DATALEN); | 174 | GNUNET_break (rd[c].data_size == TEST_RECORD_DATALEN); |
175 | GNUNET_break (0 == memcmp (rd[c].data, s_rd[c].data, TEST_RECORD_DATALEN)); | 175 | GNUNET_break (0 == memcmp (rd[c].data, first_record[c].data, TEST_RECORD_DATALEN)); |
176 | } | 176 | } |
177 | found = GNUNET_YES; | 177 | found = GNUNET_YES; |
178 | res = 0; | 178 | res = 0; |
@@ -262,14 +262,14 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
262 | 262 | ||
263 | /* create record */ | 263 | /* create record */ |
264 | s_name = "dummy.dummy.gnunet"; | 264 | s_name = "dummy.dummy.gnunet"; |
265 | s_rd = create_record (RECORDS); | 265 | first_record = create_record (RECORDS); |
266 | 266 | ||
267 | rd_ser_len = GNUNET_NAMESTORE_records_get_size(RECORDS, s_rd); | 267 | rd_ser_len = GNUNET_NAMESTORE_records_get_size(RECORDS, first_record); |
268 | char rd_ser[rd_ser_len]; | 268 | char rd_ser[rd_ser_len]; |
269 | GNUNET_NAMESTORE_records_serialize(RECORDS, s_rd, rd_ser_len, rd_ser); | 269 | GNUNET_NAMESTORE_records_serialize(RECORDS, first_record, rd_ser_len, rd_ser); |
270 | 270 | ||
271 | /* sign */ | 271 | /* sign */ |
272 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, s_name, s_rd, RECORDS); | 272 | s_signature = GNUNET_NAMESTORE_create_signature(privkey, s_name, first_record, RECORDS); |
273 | 273 | ||
274 | /* create random zone hash */ | 274 | /* create random zone hash */ |
275 | GNUNET_CRYPTO_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone); | 275 | GNUNET_CRYPTO_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone); |
@@ -280,12 +280,12 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
280 | nsh = GNUNET_NAMESTORE_connect (cfg); | 280 | nsh = GNUNET_NAMESTORE_connect (cfg); |
281 | GNUNET_break (NULL != nsh); | 281 | GNUNET_break (NULL != nsh); |
282 | 282 | ||
283 | GNUNET_break (s_rd != NULL); | 283 | GNUNET_break (first_record != NULL); |
284 | GNUNET_break (s_name != NULL); | 284 | GNUNET_break (s_name != NULL); |
285 | 285 | ||
286 | GNUNET_NAMESTORE_record_put (nsh, &pubkey, s_name, | 286 | GNUNET_NAMESTORE_record_put (nsh, &pubkey, s_name, |
287 | GNUNET_TIME_absolute_get_forever(), | 287 | GNUNET_TIME_absolute_get_forever(), |
288 | RECORDS, s_rd, s_signature, put_cont, s_name); | 288 | RECORDS, first_record, s_signature, put_cont, s_name); |
289 | 289 | ||
290 | 290 | ||
291 | 291 | ||