diff options
Diffstat (limited to 'src/setup/gnunet-setup-transport-test.c')
-rw-r--r-- | src/setup/gnunet-setup-transport-test.c | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/src/setup/gnunet-setup-transport-test.c b/src/setup/gnunet-setup-transport-test.c index 6c21777e..f351ddf5 100644 --- a/src/setup/gnunet-setup-transport-test.c +++ b/src/setup/gnunet-setup-transport-test.c | |||
@@ -25,7 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | #include "gnunet-setup.h" | 26 | #include "gnunet-setup.h" |
27 | #include <gnunet/gnunet_resolver_service.h> | 27 | #include <gnunet/gnunet_resolver_service.h> |
28 | #include <gnunet/gnunet_nat_lib.h> | 28 | #include <gnunet/gnunet_nat_auto_service.h> |
29 | 29 | ||
30 | /** | 30 | /** |
31 | * How long do we wait for the NAT test to report success? | 31 | * How long do we wait for the NAT test to report success? |
@@ -39,7 +39,7 @@ struct TestContext | |||
39 | /** | 39 | /** |
40 | * Handle to the active NAT test. | 40 | * Handle to the active NAT test. |
41 | */ | 41 | */ |
42 | struct GNUNET_NAT_Test *tst; | 42 | struct GNUNET_NAT_AUTO_Test *tst; |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * Name of widget to show on success. | 45 | * Name of widget to show on success. |
@@ -85,7 +85,7 @@ display_test_result (struct TestContext *tc, int result) | |||
85 | } | 85 | } |
86 | if (NULL != tc->tst) | 86 | if (NULL != tc->tst) |
87 | { | 87 | { |
88 | GNUNET_NAT_test_stop (tc->tst); | 88 | GNUNET_NAT_AUTO_test_stop (tc->tst); |
89 | tc->tst = NULL; | 89 | tc->tst = NULL; |
90 | } | 90 | } |
91 | GNUNET_free (tc); | 91 | GNUNET_free (tc); |
@@ -117,31 +117,19 @@ result_callback (void *cls, | |||
117 | * transport configuration. | 117 | * transport configuration. |
118 | * | 118 | * |
119 | * @param section_name section with the port numbers | 119 | * @param section_name section with the port numbers |
120 | * @param is_tcp #GNUNET_YES for TCP, #GNUNET_NO for UDP | 120 | * @param proto IPPROTO_TCP or IPPROTO_UDP |
121 | * @param success_image image to show on success | 121 | * @param success_image image to show on success |
122 | * @param failure_image image to show on failure | 122 | * @param failure_image image to show on failure |
123 | */ | 123 | */ |
124 | void | 124 | void |
125 | GNUNET_setup_transport_test (const char *section_name, int is_tcp, | 125 | GNUNET_setup_transport_test (const char *section_name, |
126 | int proto, | ||
126 | const char *success_image, | 127 | const char *success_image, |
127 | const char *failure_image) | 128 | const char *failure_image) |
128 | { | 129 | { |
129 | struct TestContext *tc; | 130 | struct TestContext *tc; |
130 | unsigned long long bnd_port; | ||
131 | unsigned long long adv_port; | ||
132 | GtkWidget *w; | 131 | GtkWidget *w; |
133 | 132 | ||
134 | if (GNUNET_OK != | ||
135 | GNUNET_CONFIGURATION_get_value_number (cfg, section_name, "PORT", | ||
136 | &bnd_port)) | ||
137 | { | ||
138 | GNUNET_break (0); | ||
139 | return; | ||
140 | } | ||
141 | if (GNUNET_OK != | ||
142 | GNUNET_CONFIGURATION_get_value_number (cfg, section_name, | ||
143 | "ADVERTISED_PORT", &adv_port)) | ||
144 | adv_port = bnd_port; | ||
145 | tc = GNUNET_new (struct TestContext); | 133 | tc = GNUNET_new (struct TestContext); |
146 | tc->success_image = success_image; | 134 | tc->success_image = success_image; |
147 | tc->failure_image = failure_image; | 135 | tc->failure_image = failure_image; |
@@ -149,10 +137,11 @@ GNUNET_setup_transport_test (const char *section_name, int is_tcp, | |||
149 | gtk_widget_hide (w); | 137 | gtk_widget_hide (w); |
150 | GNUNET_assert (NULL != cfg); | 138 | GNUNET_assert (NULL != cfg); |
151 | GNUNET_RESOLVER_connect (cfg); | 139 | GNUNET_RESOLVER_connect (cfg); |
152 | tc->tst = | 140 | tc->tst = GNUNET_NAT_AUTO_test_start (cfg, |
153 | GNUNET_NAT_test_start (cfg, is_tcp, (uint16_t) bnd_port, | 141 | proto, |
154 | (uint16_t) adv_port, TIMEOUT, | 142 | section_name, |
155 | &result_callback, tc); | 143 | &result_callback, |
144 | tc); | ||
156 | } | 145 | } |
157 | 146 | ||
158 | /* end of gnunet-setup-transport-test.c */ | 147 | /* end of gnunet-setup-transport-test.c */ |