aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-09-14 11:59:46 +0000
committerChristian Grothoff <christian@grothoff.org>2011-09-14 11:59:46 +0000
commit1fe79fd553e21a20206301c18568d30158c9dd46 (patch)
tree3db4e42adb872d1e8aa792643c341a14b2959736 /src/transport
parentf709218364f7d40e5a13938886514e866602715d (diff)
downloadgnunet-1fe79fd553e21a20206301c18568d30158c9dd46.tar.gz
gnunet-1fe79fd553e21a20206301c18568d30158c9dd46.zip
indentation
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c6
-rw-r--r--src/transport/gnunet-transport-wlan-helper.c1
-rw-r--r--src/transport/plugin_transport_wlan.c88
-rw-r--r--src/transport/test_plugin_transport_wlan_dummy.c4
-rw-r--r--src/transport/test_transport_api_limited_sockets.c23
-rw-r--r--src/transport/transport_api_address_lookup.c8
-rw-r--r--src/transport/transport_api_peer_address_lookup.c9
-rw-r--r--src/transport/wlan/helper_common.c4
8 files changed, 79 insertions, 64 deletions
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index 6d44d84c4..9c3a65450 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -582,9 +582,11 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer,
582 GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, 582 GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
583 &neighbour_timeout_task, n); 583 &neighbour_timeout_task, n);
584 connect_msg.header.size = htons (sizeof (struct SessionConnectMessage)); 584 connect_msg.header.size = htons (sizeof (struct SessionConnectMessage));
585 connect_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT); 585 connect_msg.header.type =
586 htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_CONNECT);
586 connect_msg.reserved = htonl (0); 587 connect_msg.reserved = htonl (0);
587 connect_msg.timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); 588 connect_msg.timestamp =
589 GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ());
588 GST_neighbours_send (peer, &connect_msg, sizeof (connect_msg), 590 GST_neighbours_send (peer, &connect_msg, sizeof (connect_msg),
589 GNUNET_TIME_UNIT_FOREVER_REL, NULL, NULL); 591 GNUNET_TIME_UNIT_FOREVER_REL, NULL, NULL);
590} 592}
diff --git a/src/transport/gnunet-transport-wlan-helper.c b/src/transport/gnunet-transport-wlan-helper.c
index 74632e617..7df94b68b 100644
--- a/src/transport/gnunet-transport-wlan-helper.c
+++ b/src/transport/gnunet-transport-wlan-helper.c
@@ -1026,4 +1026,3 @@ getChannelFromFrequency (int frequency)
1026 else 1026 else
1027 return -1; 1027 return -1;
1028} 1028}
1029
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c
index c012e950c..6d06b1af1 100644
--- a/src/transport/plugin_transport_wlan.c
+++ b/src/transport/plugin_transport_wlan.c
@@ -1905,7 +1905,7 @@ wlan_plugin_send (void *cls, const struct GNUNET_PeerIdentity *target,
1905 session, newmsg->message_size); 1905 session, newmsg->message_size);
1906#endif 1906#endif
1907#if DEBUG_wlan_msg_dump 1907#if DEBUG_wlan_msg_dump
1908 hexdump(msgbuf,GNUNET_MIN(msgbuf_size, 256)); 1908 hexdump (msgbuf, GNUNET_MIN (msgbuf_size, 256));
1909#endif 1909#endif
1910 //queue session 1910 //queue session
1911 queue_session (plugin, session); 1911 queue_session (plugin, session);
@@ -2239,7 +2239,8 @@ wlan_data_message_handler (void *cls, const struct GNUNET_MessageHeader *hdr)
2239 else 2239 else
2240 { 2240 {
2241 GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, PLUGIN_LOG_NAME, 2241 GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, PLUGIN_LOG_NAME,
2242 "wlan_data_message_handler got wrong message type: %u\n", ntohs (hdr->size)); 2242 "wlan_data_message_handler got wrong message type: %u\n",
2243 ntohs (hdr->size));
2243 return; 2244 return;
2244 } 2245 }
2245} 2246}
@@ -2665,12 +2666,11 @@ wlan_process_helper (void *cls, void *client,
2665#if DEBUG_wlan 2666#if DEBUG_wlan
2666 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME, 2667 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
2667 "Func wlan_process_helper got unknown message with number %u, size %u\n", 2668 "Func wlan_process_helper got unknown message with number %u, size %u\n",
2668 ntohs (hdr->type), 2669 ntohs (hdr->type), ntohs (hdr->size));
2669 ntohs (hdr->size));
2670 2670
2671#endif 2671#endif
2672#if DEBUG_wlan_msg_dump 2672#if DEBUG_wlan_msg_dump
2673 hexdump(hdr,GNUNET_MIN(ntohs (hdr->size), 256)); 2673 hexdump (hdr, GNUNET_MIN (ntohs (hdr->size), 256));
2674#endif 2674#endif
2675 GNUNET_break (0); 2675 GNUNET_break (0);
2676 return; 2676 return;
@@ -2754,25 +2754,25 @@ wlan_transport_start_wlan_helper (struct Plugin *plugin, int testmode)
2754 filenamehw, plugin->interface, testmode); 2754 filenamehw, plugin->interface, testmode);
2755#endif 2755#endif
2756 2756
2757 if (GNUNET_OS_check_helper_binary(filenamehw) == GNUNET_YES) 2757 if (GNUNET_OS_check_helper_binary (filenamehw) == GNUNET_YES)
2758 { 2758 {
2759 plugin->server_proc = 2759 plugin->server_proc =
2760 GNUNET_OS_start_process (plugin->server_stdin, plugin->server_stdout, 2760 GNUNET_OS_start_process (plugin->server_stdin, plugin->server_stdout,
2761 filenamehw, filenamehw, plugin->interface, 2761 filenamehw, filenamehw, plugin->interface,
2762 NULL); 2762 NULL);
2763 } 2763 }
2764 else if (GNUNET_OS_check_helper_binary(filenamehw) == GNUNET_NO) 2764 else if (GNUNET_OS_check_helper_binary (filenamehw) == GNUNET_NO)
2765 { 2765 {
2766 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, PLUGIN_LOG_NAME, 2766 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, PLUGIN_LOG_NAME,
2767 "gnunet-transport-wlan-helper is not suid, please change it or look at the doku\n"); 2767 "gnunet-transport-wlan-helper is not suid, please change it or look at the doku\n");
2768 GNUNET_break(0); 2768 GNUNET_break (0);
2769 } 2769 }
2770 else 2770 else
2771 { 2771 {
2772 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, PLUGIN_LOG_NAME, 2772 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, PLUGIN_LOG_NAME,
2773 "gnunet-transport-wlan-helper not found, please look if it exists and is the $PATH variable!\n"); 2773 "gnunet-transport-wlan-helper not found, please look if it exists and is the $PATH variable!\n");
2774 GNUNET_break(0); 2774 GNUNET_break (0);
2775 } 2775 }
2776 2776
2777 } 2777 }
2778 else if (testmode == 1) 2778 else if (testmode == 1)
@@ -2784,18 +2784,19 @@ wlan_transport_start_wlan_helper (struct Plugin *plugin, int testmode)
2784 filenameloopback, plugin->interface, testmode); 2784 filenameloopback, plugin->interface, testmode);
2785#endif 2785#endif
2786 2786
2787 if (GNUNET_OS_check_helper_binary(filenameloopback) != GNUNET_SYSERR) 2787 if (GNUNET_OS_check_helper_binary (filenameloopback) != GNUNET_SYSERR)
2788 { 2788 {
2789 plugin->server_proc = 2789 plugin->server_proc =
2790 GNUNET_OS_start_process (plugin->server_stdin, plugin->server_stdout, 2790 GNUNET_OS_start_process (plugin->server_stdin, plugin->server_stdout,
2791 filenameloopback, filenameloopback, "1", NULL); 2791 filenameloopback, filenameloopback, "1",
2792 } 2792 NULL);
2793 }
2793 else 2794 else
2794 { 2795 {
2795 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, PLUGIN_LOG_NAME, 2796 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, PLUGIN_LOG_NAME,
2796 "gnunet-transport-wlan-helper-dummy not found, please look if it exists and is the $PATH variable!\n"); 2797 "gnunet-transport-wlan-helper-dummy not found, please look if it exists and is the $PATH variable!\n");
2797 GNUNET_break(0); 2798 GNUNET_break (0);
2798 } 2799 }
2799 } 2800 }
2800 else if (testmode == 2) 2801 else if (testmode == 2)
2801 { 2802 {
@@ -2804,18 +2805,19 @@ wlan_transport_start_wlan_helper (struct Plugin *plugin, int testmode)
2804 "Starting gnunet-wlan-helper loopback 2 process cmd: %s %s %i\n", 2805 "Starting gnunet-wlan-helper loopback 2 process cmd: %s %s %i\n",
2805 filenameloopback, plugin->interface, testmode); 2806 filenameloopback, plugin->interface, testmode);
2806#endif 2807#endif
2807 if (GNUNET_OS_check_helper_binary(filenameloopback) != GNUNET_SYSERR) 2808 if (GNUNET_OS_check_helper_binary (filenameloopback) != GNUNET_SYSERR)
2808 { 2809 {
2809 plugin->server_proc = 2810 plugin->server_proc =
2810 GNUNET_OS_start_process (plugin->server_stdin, plugin->server_stdout, 2811 GNUNET_OS_start_process (plugin->server_stdin, plugin->server_stdout,
2811 filenameloopback, filenameloopback, "2", NULL); 2812 filenameloopback, filenameloopback, "2",
2812 } 2813 NULL);
2814 }
2813 else 2815 else
2814 { 2816 {
2815 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, PLUGIN_LOG_NAME, 2817 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, PLUGIN_LOG_NAME,
2816 "gnunet-transport-wlan-helper-dummy not found, please look if it exists and is in the $PATH variable!\n"); 2818 "gnunet-transport-wlan-helper-dummy not found, please look if it exists and is in the $PATH variable!\n");
2817 GNUNET_break(0); 2819 GNUNET_break (0);
2818 } 2820 }
2819 } 2821 }
2820 if (plugin->server_proc == NULL) 2822 if (plugin->server_proc == NULL)
2821 { 2823 {
diff --git a/src/transport/test_plugin_transport_wlan_dummy.c b/src/transport/test_plugin_transport_wlan_dummy.c
index 077fdac29..c8d9ea21b 100644
--- a/src/transport/test_plugin_transport_wlan_dummy.c
+++ b/src/transport/test_plugin_transport_wlan_dummy.c
@@ -163,13 +163,13 @@ testmode (int argc, char *argv[])
163 erg = mkfifo (FIFO_FILE1, 0666); 163 erg = mkfifo (FIFO_FILE1, 0666);
164 if (0 != erg) 164 if (0 != erg)
165 { 165 {
166 fprintf (stderr, "Error at mkfifo1: %s\n", strerror(errno)); 166 fprintf (stderr, "Error at mkfifo1: %s\n", strerror (errno));
167 //exit(1); 167 //exit(1);
168 } 168 }
169 erg = mkfifo (FIFO_FILE2, 0666); 169 erg = mkfifo (FIFO_FILE2, 0666);
170 if (0 != erg) 170 if (0 != erg)
171 { 171 {
172 fprintf (stderr, "Error at mkfifo2: %s\n", strerror(errno)); 172 fprintf (stderr, "Error at mkfifo2: %s\n", strerror (errno));
173 //exit(1); 173 //exit(1);
174 } 174 }
175 175
diff --git a/src/transport/test_transport_api_limited_sockets.c b/src/transport/test_transport_api_limited_sockets.c
index 0dc6c2a86..9e7bdb9b6 100644
--- a/src/transport/test_transport_api_limited_sockets.c
+++ b/src/transport/test_transport_api_limited_sockets.c
@@ -284,6 +284,7 @@ main (int argc, char *argv[])
284{ 284{
285 int ret = 0; 285 int ret = 0;
286 int nat_res; 286 int nat_res;
287
287 test_plugin = NULL; 288 test_plugin = NULL;
288 289
289 GNUNET_TRANSPORT_TESTING_get_test_source_name (__FILE__, &test_source); 290 GNUNET_TRANSPORT_TESTING_get_test_source_name (__FILE__, &test_source);
@@ -299,8 +300,9 @@ main (int argc, char *argv[])
299#endif 300#endif
300 NULL); 301 NULL);
301 302
302 if ((test_plugin != NULL) && ((strcmp (test_plugin, "tcp_nat") == 0) || 303 if ((test_plugin != NULL) &&
303 (strcmp (test_plugin, "udp_nat") == 0))) 304 ((strcmp (test_plugin, "tcp_nat") == 0) ||
305 (strcmp (test_plugin, "udp_nat") == 0)))
304 { 306 {
305 nat_res = GNUNET_OS_check_helper_binary ("gnunet-nat-server"); 307 nat_res = GNUNET_OS_check_helper_binary ("gnunet-nat-server");
306 if (GNUNET_NO == nat_res) 308 if (GNUNET_NO == nat_res)
@@ -329,13 +331,17 @@ main (int argc, char *argv[])
329 struct rlimit r_file_old; 331 struct rlimit r_file_old;
330 struct rlimit r_file_new; 332 struct rlimit r_file_new;
331 int res; 333 int res;
332 res = getrlimit(RLIMIT_NOFILE, &r_file_old);
333 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Maximum number of open files was: %u/%u\n", r_file_old.rlim_cur, r_file_old.rlim_max);
334 334
335 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Setting maximum number of open files to: %u\n", MAX_FILES); 335 res = getrlimit (RLIMIT_NOFILE, &r_file_old);
336 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
337 "Maximum number of open files was: %u/%u\n", r_file_old.rlim_cur,
338 r_file_old.rlim_max);
339
340 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
341 "Setting maximum number of open files to: %u\n", MAX_FILES);
336 r_file_new.rlim_cur = MAX_FILES; 342 r_file_new.rlim_cur = MAX_FILES;
337 r_file_new.rlim_max = r_file_old.rlim_max; 343 r_file_new.rlim_max = r_file_old.rlim_max;
338 res = setrlimit(RLIMIT_NOFILE, &r_file_new); 344 res = setrlimit (RLIMIT_NOFILE, &r_file_new);
339 345
340 if (res != 0) 346 if (res != 0)
341 { 347 {
@@ -360,8 +366,9 @@ main (int argc, char *argv[])
360 GNUNET_free (test_name); 366 GNUNET_free (test_name);
361 367
362#if HAVE_SETRLIMIT 368#if HAVE_SETRLIMIT
363 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Restoring previous value maximum number of open files\n"); 369 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
364 res = setrlimit(RLIMIT_NOFILE, &r_file_old); 370 "Restoring previous value maximum number of open files\n");
371 res = setrlimit (RLIMIT_NOFILE, &r_file_old);
365 if (res != 0) 372 if (res != 0)
366 { 373 {
367 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Restoring limit failed!\n"); 374 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Restoring limit failed!\n");
diff --git a/src/transport/transport_api_address_lookup.c b/src/transport/transport_api_address_lookup.c
index a760f4775..968a4324f 100644
--- a/src/transport/transport_api_address_lookup.c
+++ b/src/transport/transport_api_address_lookup.c
@@ -140,8 +140,8 @@ GNUNET_TRANSPORT_address_lookup (const struct GNUNET_CONFIGURATION_Handle *cfg,
140 return NULL; 140 return NULL;
141 } 141 }
142 client = GNUNET_CLIENT_connect ("transport", cfg); 142 client = GNUNET_CLIENT_connect ("transport", cfg);
143 if (client == NULL) 143 if (client == NULL)
144 return NULL; 144 return NULL;
145 msg = GNUNET_malloc (len); 145 msg = GNUNET_malloc (len);
146 msg->header.size = htons (len); 146 msg->header.size = htons (len);
147 msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_LOOKUP); 147 msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_LOOKUP);
@@ -172,7 +172,9 @@ GNUNET_TRANSPORT_address_lookup (const struct GNUNET_CONFIGURATION_Handle *cfg,
172 * @param alc handle for the request to cancel 172 * @param alc handle for the request to cancel
173 */ 173 */
174void 174void
175GNUNET_TRANSPORT_address_lookup_cancel (struct GNUNET_TRANSPORT_AddressLookupContext *alc) 175GNUNET_TRANSPORT_address_lookup_cancel (struct
176 GNUNET_TRANSPORT_AddressLookupContext
177 *alc)
176{ 178{
177 GNUNET_CLIENT_disconnect (alc->client, GNUNET_NO); 179 GNUNET_CLIENT_disconnect (alc->client, GNUNET_NO);
178 GNUNET_free (alc); 180 GNUNET_free (alc);
diff --git a/src/transport/transport_api_peer_address_lookup.c b/src/transport/transport_api_peer_address_lookup.c
index 83ed074a3..a564058ce 100644
--- a/src/transport/transport_api_peer_address_lookup.c
+++ b/src/transport/transport_api_peer_address_lookup.c
@@ -141,12 +141,13 @@ GNUNET_TRANSPORT_peer_address_lookup (const struct GNUNET_CONFIGURATION_Handle
141 141
142 client = GNUNET_CLIENT_connect ("transport", cfg); 142 client = GNUNET_CLIENT_connect ("transport", cfg);
143 if (client == NULL) 143 if (client == NULL)
144 return NULL; 144 return NULL;
145 msg.header.size = htons (sizeof (struct PeerAddressLookupMessage)); 145 msg.header.size = htons (sizeof (struct PeerAddressLookupMessage));
146 msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_PEER_ADDRESS_LOOKUP); 146 msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_PEER_ADDRESS_LOOKUP);
147 msg.timeout = GNUNET_TIME_relative_hton (timeout); 147 msg.timeout = GNUNET_TIME_relative_hton (timeout);
148 memcpy (&msg.peer, peer, sizeof (struct GNUNET_PeerIdentity)); 148 memcpy (&msg.peer, peer, sizeof (struct GNUNET_PeerIdentity));
149 alc = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PeerAddressLookupContext)); 149 alc =
150 GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PeerAddressLookupContext));
150 alc->cb = peer_address_callback; 151 alc->cb = peer_address_callback;
151 alc->cb_cls = peer_address_callback_cls; 152 alc->cb_cls = peer_address_callback_cls;
152 alc->timeout = GNUNET_TIME_relative_to_absolute (timeout); 153 alc->timeout = GNUNET_TIME_relative_to_absolute (timeout);
@@ -166,7 +167,9 @@ GNUNET_TRANSPORT_peer_address_lookup (const struct GNUNET_CONFIGURATION_Handle
166 * @param alc handle for the request to cancel 167 * @param alc handle for the request to cancel
167 */ 168 */
168void 169void
169GNUNET_TRANSPORT_peer_address_lookup_cancel (struct GNUNET_TRANSPORT_PeerAddressLookupContext *alc) 170GNUNET_TRANSPORT_peer_address_lookup_cancel (struct
171 GNUNET_TRANSPORT_PeerAddressLookupContext
172 *alc)
170{ 173{
171 GNUNET_CLIENT_disconnect (alc->client, GNUNET_NO); 174 GNUNET_CLIENT_disconnect (alc->client, GNUNET_NO);
172 GNUNET_free (alc); 175 GNUNET_free (alc);
diff --git a/src/transport/wlan/helper_common.c b/src/transport/wlan/helper_common.c
index 6a7a5da09..8e1c59421 100644
--- a/src/transport/wlan/helper_common.c
+++ b/src/transport/wlan/helper_common.c
@@ -34,12 +34,12 @@
34 * @return number of bytes written 34 * @return number of bytes written
35 */ 35 */
36int 36int
37send_mac_to_plugin (char *buffer, struct MacAddress * mac) 37send_mac_to_plugin (char *buffer, struct MacAddress *mac)
38{ 38{
39 39
40 struct Wlan_Helper_Control_Message macmsg; 40 struct Wlan_Helper_Control_Message macmsg;
41 41
42 memcpy (&macmsg.mac,(char *) mac, sizeof (struct MacAddress)); 42 memcpy (&macmsg.mac, (char *) mac, sizeof (struct MacAddress));
43 macmsg.hdr.size = htons (sizeof (struct Wlan_Helper_Control_Message)); 43 macmsg.hdr.size = htons (sizeof (struct Wlan_Helper_Control_Message));
44 macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL); 44 macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL);
45 45