diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-10-11 18:54:14 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-10-11 18:54:14 +0000 |
commit | 99629a9c829ae596f84ac0969cff26cb0f649ba9 (patch) | |
tree | d614bec9528c17355b762ca8c6b38b38a8159b64 /src/testing | |
parent | f1a027865aa177aaa92edb9b39d4d1b2eed100cc (diff) | |
download | gnunet-99629a9c829ae596f84ac0969cff26cb0f649ba9.tar.gz gnunet-99629a9c829ae596f84ac0969cff26cb0f649ba9.zip |
using header-defined hostkeyfilesize
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/testing.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/testing/testing.c b/src/testing/testing.c index 8a5ff6679..b4f8c8100 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c | |||
@@ -37,11 +37,6 @@ | |||
37 | GNUNET_log_from (kind, "testing-api", __VA_ARGS__) | 37 | GNUNET_log_from (kind, "testing-api", __VA_ARGS__) |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * Size of a hostkey when written to a file | ||
41 | */ | ||
42 | #define HOSTKEYFILESIZE 914 | ||
43 | |||
44 | /** | ||
45 | * Lowest port used for GNUnet testing. Should be high enough to not | 40 | * Lowest port used for GNUnet testing. Should be high enough to not |
46 | * conflict with other applications running on the hosts but be low | 41 | * conflict with other applications running on the hosts but be low |
47 | * enough to not conflict with client-ports (typically starting around | 42 | * enough to not conflict with client-ports (typically starting around |
@@ -79,7 +74,7 @@ struct GNUNET_TESTING_System | |||
79 | char *hostname; | 74 | char *hostname; |
80 | 75 | ||
81 | /** | 76 | /** |
82 | * Hostkeys data, contains "HOSTKEYFILESIZE * total_hostkeys" bytes. | 77 | * Hostkeys data, contains "GNUNET_TESTING_HOSTKEYFILESIZE * total_hostkeys" bytes. |
83 | */ | 78 | */ |
84 | char *hostkeys_data; | 79 | char *hostkeys_data; |
85 | 80 | ||
@@ -213,7 +208,7 @@ hostkeys_load (struct GNUNET_TESTING_System *system) | |||
213 | GNUNET_free (filename); | 208 | GNUNET_free (filename); |
214 | return GNUNET_SYSERR; /* File is empty */ | 209 | return GNUNET_SYSERR; /* File is empty */ |
215 | } | 210 | } |
216 | if (0 != (fs % HOSTKEYFILESIZE)) | 211 | if (0 != (fs % GNUNET_TESTING_HOSTKEYFILESIZE)) |
217 | { | 212 | { |
218 | LOG (GNUNET_ERROR_TYPE_ERROR, | 213 | LOG (GNUNET_ERROR_TYPE_ERROR, |
219 | _("Incorrect hostkey file format: %s\n"), filename); | 214 | _("Incorrect hostkey file format: %s\n"), filename); |
@@ -228,7 +223,7 @@ hostkeys_load (struct GNUNET_TESTING_System *system) | |||
228 | GNUNET_free (filename); | 223 | GNUNET_free (filename); |
229 | return GNUNET_SYSERR; | 224 | return GNUNET_SYSERR; |
230 | } | 225 | } |
231 | system->total_hostkeys = fs / HOSTKEYFILESIZE; | 226 | system->total_hostkeys = fs / GNUNET_TESTING_HOSTKEYFILESIZE; |
232 | system->hostkeys_data = GNUNET_DISK_file_map (system->map_fd, | 227 | system->hostkeys_data = GNUNET_DISK_file_map (system->map_fd, |
233 | &system->map, | 228 | &system->map, |
234 | GNUNET_DISK_MAP_TYPE_READ, | 229 | GNUNET_DISK_MAP_TYPE_READ, |
@@ -524,8 +519,9 @@ GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system, | |||
524 | return NULL; | 519 | return NULL; |
525 | } | 520 | } |
526 | private_key = GNUNET_CRYPTO_rsa_decode_key (system->hostkeys_data + | 521 | private_key = GNUNET_CRYPTO_rsa_decode_key (system->hostkeys_data + |
527 | (key_number * HOSTKEYFILESIZE), | 522 | (key_number * |
528 | HOSTKEYFILESIZE); | 523 | GNUNET_TESTING_HOSTKEYFILESIZE), |
524 | GNUNET_TESTING_HOSTKEYFILESIZE); | ||
529 | if (NULL == private_key) | 525 | if (NULL == private_key) |
530 | { | 526 | { |
531 | LOG (GNUNET_ERROR_TYPE_ERROR, | 527 | LOG (GNUNET_ERROR_TYPE_ERROR, |
@@ -892,10 +888,10 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system, | |||
892 | GNUNET_break (0); | 888 | GNUNET_break (0); |
893 | return NULL; | 889 | return NULL; |
894 | } | 890 | } |
895 | if (HOSTKEYFILESIZE != | 891 | if (GNUNET_TESTING_HOSTKEYFILESIZE != |
896 | GNUNET_DISK_file_write (fd, system->hostkeys_data | 892 | GNUNET_DISK_file_write (fd, system->hostkeys_data |
897 | + (key_number * HOSTKEYFILESIZE), | 893 | + (key_number * GNUNET_TESTING_HOSTKEYFILESIZE), |
898 | HOSTKEYFILESIZE)) | 894 | GNUNET_TESTING_HOSTKEYFILESIZE)) |
899 | { | 895 | { |
900 | GNUNET_asprintf (&emsg_, | 896 | GNUNET_asprintf (&emsg_, |
901 | _("Failed to write hostkey file for peer %u: %s\n"), | 897 | _("Failed to write hostkey file for peer %u: %s\n"), |