aboutsummaryrefslogtreecommitdiff
path: root/src/nat/nat.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-07-01 08:46:27 +0000
committerChristian Grothoff <christian@grothoff.org>2011-07-01 08:46:27 +0000
commit11a2d8cd5b619a0fea63e766585c6ec4687a0707 (patch)
tree0b18ea0e567fd7bf5ca50b5994df5abe1ba77d95 /src/nat/nat.c
parent9b986bcca579585f4f113d22b7c841a2ab28de0c (diff)
downloadgnunet-11a2d8cd5b619a0fea63e766585c6ec4687a0707.tar.gz
gnunet-11a2d8cd5b619a0fea63e766585c6ec4687a0707.zip
renaming gnunet-nat-server/client for consistency, other minor fixes
Diffstat (limited to 'src/nat/nat.c')
-rw-r--r--src/nat/nat.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/src/nat/nat.c b/src/nat/nat.c
index 48d7faf9c..418c619e3 100644
--- a/src/nat/nat.c
+++ b/src/nat/nat.c
@@ -160,12 +160,12 @@ struct GNUNET_NAT_Handle
160 struct GNUNET_RESOLVER_RequestHandle *hostname_dns; 160 struct GNUNET_RESOLVER_RequestHandle *hostname_dns;
161 161
162 /** 162 /**
163 * stdout pipe handle for the gnunet-nat-server process 163 * stdout pipe handle for the gnunet-helper-nat-server process
164 */ 164 */
165 struct GNUNET_DISK_PipeHandle *server_stdout; 165 struct GNUNET_DISK_PipeHandle *server_stdout;
166 166
167 /** 167 /**
168 * stdout file handle (for reading) for the gnunet-nat-server process 168 * stdout file handle (for reading) for the gnunet-helper-nat-server process
169 */ 169 */
170 const struct GNUNET_DISK_FileHandle *server_stdout_handle; 170 const struct GNUNET_DISK_FileHandle *server_stdout_handle;
171 171
@@ -180,12 +180,12 @@ struct GNUNET_NAT_Handle
180 struct LocalAddressList *lal_tail; 180 struct LocalAddressList *lal_tail;
181 181
182 /** 182 /**
183 * How long do we wait for restarting a crashed gnunet-nat-server? 183 * How long do we wait for restarting a crashed gnunet-helper-nat-server?
184 */ 184 */
185 struct GNUNET_TIME_Relative server_retry_delay; 185 struct GNUNET_TIME_Relative server_retry_delay;
186 186
187 /** 187 /**
188 * ID of select gnunet-nat-server stdout read task 188 * ID of select gnunet-helper-nat-server stdout read task
189 */ 189 */
190 GNUNET_SCHEDULER_TaskIdentifier server_read_task; 190 GNUNET_SCHEDULER_TaskIdentifier server_read_task;
191 191
@@ -266,7 +266,7 @@ struct GNUNET_NAT_Handle
266 int enable_nat_client; 266 int enable_nat_client;
267 267
268 /** 268 /**
269 * Should we run the gnunet-nat-server? 269 * Should we run the gnunet-helper-nat-server?
270 */ 270 */
271 int enable_nat_server; 271 int enable_nat_server;
272 272
@@ -299,7 +299,7 @@ struct GNUNET_NAT_Handle
299 299
300 300
301/** 301/**
302 * Try to start the gnunet-nat-server (if it is not 302 * Try to start the gnunet-helper-nat-server (if it is not
303 * already running). 303 * already running).
304 * 304 *
305 * @param h handle to NAT 305 * @param h handle to NAT
@@ -380,7 +380,7 @@ add_to_address_list_as_is (struct GNUNET_NAT_Handle *h,
380 * Add the given address to the list of 'local' addresses, thereby 380 * Add the given address to the list of 'local' addresses, thereby
381 * making it a 'legal' address for this peer to have. Set the 381 * making it a 'legal' address for this peer to have. Set the
382 * port number in the process to the advertised port and possibly 382 * port number in the process to the advertised port and possibly
383 * also to zero (if we have the gnunet-nat-server). 383 * also to zero (if we have the gnunet-helper-nat-server).
384 * 384 *
385 * @param plugin the plugin 385 * @param plugin the plugin
386 * @param src where did the local address originate from? 386 * @param src where did the local address originate from?
@@ -773,7 +773,7 @@ check_gnunet_nat_binary (const char *binary)
773 773
774 774
775/** 775/**
776 * Task that restarts the gnunet-nat-server process after a crash 776 * Task that restarts the gnunet-helper-nat-server process after a crash
777 * after a certain delay. 777 * after a certain delay.
778 * 778 *
779 * @param cls the 'struct GNUNET_NAT_Handle' 779 * @param cls the 'struct GNUNET_NAT_Handle'
@@ -793,7 +793,7 @@ restart_nat_server (void *cls,
793 793
794 794
795/** 795/**
796 * We have been notified that gnunet-nat-server has written something to stdout. 796 * We have been notified that gnunet-helper-nat-server has written something to stdout.
797 * Handle the output, then reschedule this function to be called again once 797 * Handle the output, then reschedule this function to be called again once
798 * more is available. 798 * more is available.
799 * 799 *
@@ -870,10 +870,10 @@ nat_server_read (void *cls,
870 (1 != sscanf (port_start, "%d", &port)) || 870 (1 != sscanf (port_start, "%d", &port)) ||
871 (-1 == inet_pton(AF_INET, mybuf, &sin_addr.sin_addr)) ) 871 (-1 == inet_pton(AF_INET, mybuf, &sin_addr.sin_addr)) )
872 { 872 {
873 /* should we restart gnunet-nat-server? */ 873 /* should we restart gnunet-helper-nat-server? */
874 GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, 874 GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING,
875 "nat", 875 "nat",
876 _("gnunet-nat-server generated malformed address `%s'\n"), 876 _("gnunet-helper-nat-server generated malformed address `%s'\n"),
877 mybuf); 877 mybuf);
878 h->server_read_task 878 h->server_read_task
879 = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, 879 = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
@@ -886,7 +886,7 @@ nat_server_read (void *cls,
886#if DEBUG_NAT 886#if DEBUG_NAT
887 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, 887 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
888 "nat", 888 "nat",
889 "gnunet-nat-server read: %s:%d\n", 889 "gnunet-helper-nat-server read: %s:%d\n",
890 mybuf, port); 890 mybuf, port);
891#endif 891#endif
892 h->reversal_callback (h->callback_cls, 892 h->reversal_callback (h->callback_cls,
@@ -901,7 +901,7 @@ nat_server_read (void *cls,
901 901
902 902
903/** 903/**
904 * Try to start the gnunet-nat-server (if it is not 904 * Try to start the gnunet-helper-nat-server (if it is not
905 * already running). 905 * already running).
906 * 906 *
907 * @param h handle to NAT 907 * @param h handle to NAT
@@ -920,14 +920,14 @@ start_gnunet_nat_server (struct GNUNET_NAT_Handle *h)
920 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, 920 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
921 "nat" 921 "nat"
922 "Starting %s at `%s'\n", 922 "Starting %s at `%s'\n",
923 "gnunet-nat-server", 923 "gnunet-helper-nat-server",
924 h->internal_address); 924 h->internal_address);
925#endif 925#endif
926 /* Start the server process */ 926 /* Start the server process */
927 h->server_proc = GNUNET_OS_start_process (NULL, 927 h->server_proc = GNUNET_OS_start_process (NULL,
928 h->server_stdout, 928 h->server_stdout,
929 "gnunet-nat-server", 929 "gnunet-helper-nat-server",
930 "gnunet-nat-server", 930 "gnunet-helper-nat-server",
931 h->internal_address, 931 h->internal_address,
932 NULL); 932 NULL);
933 if (h->server_proc == NULL) 933 if (h->server_proc == NULL)
@@ -935,7 +935,7 @@ start_gnunet_nat_server (struct GNUNET_NAT_Handle *h)
935 GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, 935 GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING,
936 "nat", 936 "nat",
937 _("Failed to start %s\n"), 937 _("Failed to start %s\n"),
938 "gnunet-nat-server"); 938 "gnunet-helper-nat-server");
939 GNUNET_DISK_pipe_close (h->server_stdout); 939 GNUNET_DISK_pipe_close (h->server_stdout);
940 h->server_stdout = NULL; 940 h->server_stdout = NULL;
941 } 941 }
@@ -1180,20 +1180,20 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg,
1180 /* Test for SUID binaries */ 1180 /* Test for SUID binaries */
1181 if ( (h->behind_nat == GNUNET_YES) && 1181 if ( (h->behind_nat == GNUNET_YES) &&
1182 (GNUNET_YES == h->enable_nat_server) && 1182 (GNUNET_YES == h->enable_nat_server) &&
1183 (GNUNET_YES != check_gnunet_nat_binary("gnunet-nat-server")) ) 1183 (GNUNET_YES != check_gnunet_nat_binary("gnunet-helper-nat-server")) )
1184 { 1184 {
1185 h->enable_nat_server = GNUNET_NO; 1185 h->enable_nat_server = GNUNET_NO;
1186 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1186 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1187 _("Configuration requires `%s', but binary is not installed properly (SUID bit not set). Option disabled.\n"), 1187 _("Configuration requires `%s', but binary is not installed properly (SUID bit not set). Option disabled.\n"),
1188 "gnunet-nat-server"); 1188 "gnunet-helper-nat-server");
1189 } 1189 }
1190 if ( (GNUNET_YES == h->enable_nat_client) && 1190 if ( (GNUNET_YES == h->enable_nat_client) &&
1191 (GNUNET_YES != check_gnunet_nat_binary("gnunet-nat-client")) ) 1191 (GNUNET_YES != check_gnunet_nat_binary("gnunet-helper-nat-client")) )
1192 { 1192 {
1193 h->enable_nat_client = GNUNET_NO; 1193 h->enable_nat_client = GNUNET_NO;
1194 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1194 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1195 _("Configuration requires `%s', but binary is not installed properly (SUID bit not set). Option disabled.\n"), 1195 _("Configuration requires `%s', but binary is not installed properly (SUID bit not set). Option disabled.\n"),
1196 "gnunet-nat-client"); 1196 "gnunet-helper-nat-client");
1197 } 1197 }
1198 1198
1199 start_gnunet_nat_server (h); 1199 start_gnunet_nat_server (h);
@@ -1291,7 +1291,7 @@ GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *h)
1291 1291
1292/** 1292/**
1293 * We learned about a peer (possibly behind NAT) so run the 1293 * We learned about a peer (possibly behind NAT) so run the
1294 * gnunet-nat-client to send dummy ICMP responses to cause 1294 * gnunet-helper-nat-client to send dummy ICMP responses to cause
1295 * that peer to connect to us (connection reversal). 1295 * that peer to connect to us (connection reversal).
1296 * 1296 *
1297 * @param h NAT handle for us (largely used for configuration) 1297 * @param h NAT handle for us (largely used for configuration)
@@ -1330,22 +1330,22 @@ GNUNET_NAT_run_client (struct GNUNET_NAT_Handle *h,
1330#if DEBUG_TCP_NAT 1330#if DEBUG_TCP_NAT
1331 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, 1331 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
1332 "nat", 1332 "nat",
1333 _("Running gnunet-nat-client %s %s %u\n"), 1333 _("Running gnunet-helper-nat-client %s %s %u\n"),
1334 h->internal_address, 1334 h->internal_address,
1335 inet4, 1335 inet4,
1336 (unsigned int) h->adv_port); 1336 (unsigned int) h->adv_port);
1337#endif 1337#endif
1338 proc = GNUNET_OS_start_process (NULL, 1338 proc = GNUNET_OS_start_process (NULL,
1339 NULL, 1339 NULL,
1340 "gnunet-nat-client", 1340 "gnunet-helper-nat-client",
1341 "gnunet-nat-client", 1341 "gnunet-helper-nat-client",
1342 h->internal_address, 1342 h->internal_address,
1343 inet4, 1343 inet4,
1344 port_as_string, 1344 port_as_string,
1345 NULL); 1345 NULL);
1346 if (NULL == proc) 1346 if (NULL == proc)
1347 return; 1347 return;
1348 /* we know that the gnunet-nat-client will terminate virtually 1348 /* we know that the gnunet-helper-nat-client will terminate virtually
1349 instantly */ 1349 instantly */
1350 GNUNET_OS_process_wait (proc); 1350 GNUNET_OS_process_wait (proc);
1351 GNUNET_OS_process_close (proc); 1351 GNUNET_OS_process_close (proc);