aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-01-26 21:32:42 +0000
committerChristian Grothoff <christian@grothoff.org>2015-01-26 21:32:42 +0000
commitb1970ab977139ccc00cdc05c6df3f20b676e56ea (patch)
tree57d287149432f908c9c73c56dd31cfd425cc5384 /src/transport
parent47be1a48f383fc4b84a1b9369a62468dabb4bfba (diff)
downloadgnunet-b1970ab977139ccc00cdc05c6df3f20b676e56ea.tar.gz
gnunet-b1970ab977139ccc00cdc05c6df3f20b676e56ea.zip
-do not send any messages until we have our own MAC from the helper
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/gnunet-helper-transport-wlan-dummy.c40
-rw-r--r--src/transport/plugin_transport_wlan.c221
2 files changed, 178 insertions, 83 deletions
diff --git a/src/transport/gnunet-helper-transport-wlan-dummy.c b/src/transport/gnunet-helper-transport-wlan-dummy.c
index 162774b5d..6e4e15d40 100644
--- a/src/transport/gnunet-helper-transport-wlan-dummy.c
+++ b/src/transport/gnunet-helper-transport-wlan-dummy.c
@@ -103,10 +103,14 @@ send_mac_to_plugin (char *buffer, struct GNUNET_TRANSPORT_WLAN_MacAddress *mac)
103 103
104 struct GNUNET_TRANSPORT_WLAN_HelperControlMessage macmsg; 104 struct GNUNET_TRANSPORT_WLAN_HelperControlMessage macmsg;
105 105
106 memcpy (&macmsg.mac, (char *) mac, sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress)); 106 memcpy (&macmsg.mac,
107 (char *) mac,
108 sizeof (struct GNUNET_TRANSPORT_WLAN_MacAddress));
107 macmsg.hdr.size = htons (sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage)); 109 macmsg.hdr.size = htons (sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage));
108 macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL); 110 macmsg.hdr.type = htons (GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL);
109 memcpy (buffer, &macmsg, sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage)); 111 memcpy (buffer,
112 &macmsg,
113 sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage));
110 return sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage); 114 return sizeof (struct GNUNET_TRANSPORT_WLAN_HelperControlMessage);
111} 115}
112 116
@@ -228,7 +232,9 @@ main (int argc, char *argv[])
228 if ( (GNUNET_OK != GNUNET_DISK_directory_create_for_file (FIFO_FILE1)) || 232 if ( (GNUNET_OK != GNUNET_DISK_directory_create_for_file (FIFO_FILE1)) ||
229 (GNUNET_OK != GNUNET_DISK_directory_create_for_file (FIFO_FILE2)) ) 233 (GNUNET_OK != GNUNET_DISK_directory_create_for_file (FIFO_FILE2)) )
230 { 234 {
231 FPRINTF (stderr, "Failed to create directory for file `%s'\n", FIFO_FILE1); 235 FPRINTF (stderr,
236 "Failed to create directory for file `%s'\n",
237 FIFO_FILE1);
232 return 1; 238 return 1;
233 } 239 }
234 if (0 == strcmp (argv[1], "1") ) 240 if (0 == strcmp (argv[1], "1") )
@@ -247,7 +253,9 @@ main (int argc, char *argv[])
247 { 253 {
248 GNUNET_break (0 == (erg = mkfifo (FIFO_FILE2, 0666))); 254 GNUNET_break (0 == (erg = mkfifo (FIFO_FILE2, 0666)));
249 if ( (0 != erg) && (EEXIST != errno) ) 255 if ( (0 != erg) && (EEXIST != errno) )
250 FPRINTF (stderr, "Error in mkfifo(%s): %s\n", FIFO_FILE2, 256 FPRINTF (stderr,
257 "Error in mkfifo(%s): %s\n",
258 FIFO_FILE2,
251 strerror (errno)); 259 strerror (errno));
252 } 260 }
253 } 261 }
@@ -258,7 +266,9 @@ main (int argc, char *argv[])
258 fpin = fopen (FIFO_FILE1, "r"); 266 fpin = fopen (FIFO_FILE1, "r");
259 if (NULL == fpin) 267 if (NULL == fpin)
260 { 268 {
261 FPRINTF (stderr, "fopen of read FIFO_FILE1 failed: %s\n", STRERROR (errno)); 269 FPRINTF (stderr,
270 "fopen of read FIFO_FILE1 failed: %s\n",
271 STRERROR (errno));
262 goto end; 272 goto end;
263 } 273 }
264 if (NULL == (fpout = fopen (FIFO_FILE2, "w"))) 274 if (NULL == (fpout = fopen (FIFO_FILE2, "w")))
@@ -268,7 +278,9 @@ main (int argc, char *argv[])
268 } 278 }
269 if (NULL == fpout) 279 if (NULL == fpout)
270 { 280 {
271 FPRINTF (stderr, "fopen of write FIFO_FILE2 failed: %s\n", STRERROR (errno)); 281 FPRINTF (stderr,
282 "fopen of write FIFO_FILE2 failed: %s\n",
283 STRERROR (errno));
272 goto end; 284 goto end;
273 } 285 }
274 } 286 }
@@ -282,13 +294,17 @@ main (int argc, char *argv[])
282 } 294 }
283 if (NULL == fpout) 295 if (NULL == fpout)
284 { 296 {
285 FPRINTF (stderr, "fopen of write FIFO_FILE1 failed: %s\n", STRERROR (errno)); 297 FPRINTF (stderr,
298 "fopen of write FIFO_FILE1 failed: %s\n",
299 STRERROR (errno));
286 goto end; 300 goto end;
287 } 301 }
288 fpin = fopen (FIFO_FILE2, "r"); 302 fpin = fopen (FIFO_FILE2, "r");
289 if (NULL == fpin) 303 if (NULL == fpin)
290 { 304 {
291 FPRINTF (stderr, "fopen of read FIFO_FILE2 failed: %s\n", STRERROR (errno)); 305 FPRINTF (stderr,
306 "fopen of read FIFO_FILE2 failed: %s\n",
307 STRERROR (errno));
292 goto end; 308 goto end;
293 } 309 }
294 } 310 }
@@ -297,7 +313,9 @@ main (int argc, char *argv[])
297 GNUNET_assert (fpin >= 0); 313 GNUNET_assert (fpin >= 0);
298 if (fdpin >= FD_SETSIZE) 314 if (fdpin >= FD_SETSIZE)
299 { 315 {
300 FPRINTF (stderr, "File fdpin number too large (%d > %u)\n", fdpin, 316 FPRINTF (stderr,
317 "File fdpin number too large (%d > %u)\n",
318 fdpin,
301 (unsigned int) FD_SETSIZE); 319 (unsigned int) FD_SETSIZE);
302 goto end; 320 goto end;
303 } 321 }
@@ -307,7 +325,9 @@ main (int argc, char *argv[])
307 325
308 if (fdpout >= FD_SETSIZE) 326 if (fdpout >= FD_SETSIZE)
309 { 327 {
310 FPRINTF (stderr, "File fdpout number too large (%d > %u)\n", fdpout, 328 FPRINTF (stderr,
329 "File fdpout number too large (%d > %u)\n",
330 fdpout,
311 (unsigned int) FD_SETSIZE); 331 (unsigned int) FD_SETSIZE);
312 goto end; 332 goto end;
313 } 333 }
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c
index 0ae698cd6..9b60aea5c 100644
--- a/src/transport/plugin_transport_wlan.c
+++ b/src/transport/plugin_transport_wlan.c
@@ -308,6 +308,12 @@ struct FragmentMessage
308 GNUNET_TRANSPORT_TransmitContinuation cont; 308 GNUNET_TRANSPORT_TransmitContinuation cont;
309 309
310 /** 310 /**
311 * Message we need to fragment and transmit, NULL after the
312 * @e fragmentcontext has been created.
313 */
314 struct GNUNET_MessageHeader *msg;
315
316 /**
311 * Closure for @e cont 317 * Closure for @e cont
312 */ 318 */
313 void *cont_cls; 319 void *cont_cls;
@@ -484,7 +490,7 @@ struct Plugin
484 /** 490 /**
485 * Task that periodically sends a HELLO beacon via the helper. 491 * Task that periodically sends a HELLO beacon via the helper.
486 */ 492 */
487 struct GNUNET_SCHEDULER_Task * beacon_task; 493 struct GNUNET_SCHEDULER_Task *beacon_task;
488 494
489 /** 495 /**
490 * Tracker for bandwidth limit 496 * Tracker for bandwidth limit
@@ -688,7 +694,8 @@ get_wlan_header (struct Plugin *plugin,
688 * @param hdr pointer to the hdr where the ack is stored 694 * @param hdr pointer to the hdr where the ack is stored
689 */ 695 */
690static void 696static void
691send_ack (void *cls, uint32_t msg_id, 697send_ack (void *cls,
698 uint32_t msg_id,
692 const struct GNUNET_MessageHeader *hdr) 699 const struct GNUNET_MessageHeader *hdr)
693{ 700{
694 struct MacEndpoint *endpoint = cls; 701 struct MacEndpoint *endpoint = cls;
@@ -708,7 +715,8 @@ send_ack (void *cls, uint32_t msg_id,
708 return; 715 return;
709 } 716 }
710 LOG (GNUNET_ERROR_TYPE_DEBUG, 717 LOG (GNUNET_ERROR_TYPE_DEBUG,
711 "Sending ACK to helper\n"); 718 "Sending ACK to %s\n",
719 mac_to_string (&endpoint->wlan_addr.mac));
712 radio_header = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) buf; 720 radio_header = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) buf;
713 get_radiotap_header (endpoint, radio_header, size); 721 get_radiotap_header (endpoint, radio_header, size);
714 get_wlan_header (endpoint->plugin, 722 get_wlan_header (endpoint->plugin,
@@ -939,9 +947,9 @@ fragment_transmission_done (void *cls,
939{ 947{
940 struct FragmentMessage *fm = cls; 948 struct FragmentMessage *fm = cls;
941 949
942
943 fm->sh = NULL; 950 fm->sh = NULL;
944 GNUNET_FRAGMENT_context_transmission_done (fm->fragcontext); 951 GNUNET_FRAGMENT_context_transmission_done (fm->fragcontext);
952 fm->fragcontext = NULL;
945} 953}
946 954
947 955
@@ -973,6 +981,11 @@ transmit_fragment (void *cls,
973 981
974 radio_header = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) buf; 982 radio_header = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) buf;
975 get_radiotap_header (endpoint, radio_header, size); 983 get_radiotap_header (endpoint, radio_header, size);
984 LOG (GNUNET_ERROR_TYPE_DEBUG,
985 "Sending %u bytes of data to MAC `%s'\n",
986 (unsigned int) msize,
987 mac_to_string (&endpoint->wlan_addr.mac));
988
976 get_wlan_header (endpoint->plugin, 989 get_wlan_header (endpoint->plugin,
977 &radio_header->frame, 990 &radio_header->frame,
978 &endpoint->wlan_addr.mac, 991 &endpoint->wlan_addr.mac,
@@ -985,12 +998,17 @@ transmit_fragment (void *cls,
985 &fragment_transmission_done, fm); 998 &fragment_transmission_done, fm);
986 fm->size_on_wire += size; 999 fm->size_on_wire += size;
987 if (NULL != fm->sh) 1000 if (NULL != fm->sh)
1001 {
988 GNUNET_STATISTICS_update (endpoint->plugin->env->stats, 1002 GNUNET_STATISTICS_update (endpoint->plugin->env->stats,
989 _("# message fragments sent"), 1003 _("# message fragments sent"),
990 1, 1004 1,
991 GNUNET_NO); 1005 GNUNET_NO);
1006 }
992 else 1007 else
1008 {
993 GNUNET_FRAGMENT_context_transmission_done (fm->fragcontext); 1009 GNUNET_FRAGMENT_context_transmission_done (fm->fragcontext);
1010 fm->fragcontext = NULL;
1011 }
994 GNUNET_STATISTICS_update (endpoint->plugin->env->stats, 1012 GNUNET_STATISTICS_update (endpoint->plugin->env->stats,
995 "# bytes currently in buffers", 1013 "# bytes currently in buffers",
996 -msize, GNUNET_NO); 1014 -msize, GNUNET_NO);
@@ -1022,10 +1040,18 @@ free_fragment_message (struct FragmentMessage *fm)
1022 GNUNET_HELPER_send_cancel (fm->sh); 1040 GNUNET_HELPER_send_cancel (fm->sh);
1023 fm->sh = NULL; 1041 fm->sh = NULL;
1024 } 1042 }
1025 GNUNET_FRAGMENT_context_destroy (fm->fragcontext, 1043 if (NULL != fm->msg)
1026 &endpoint->msg_delay, 1044 {
1027 &endpoint->ack_delay); 1045 GNUNET_free (fm->msg);
1028 if (fm->timeout_task != NULL) 1046 fm->msg = NULL;
1047 }
1048 if (NULL != fm->fragcontext)
1049 {
1050 GNUNET_FRAGMENT_context_destroy (fm->fragcontext,
1051 &endpoint->msg_delay,
1052 &endpoint->ack_delay);
1053 }
1054 if (NULL != fm->timeout_task)
1029 { 1055 {
1030 GNUNET_SCHEDULER_cancel (fm->timeout_task); 1056 GNUNET_SCHEDULER_cancel (fm->timeout_task);
1031 fm->timeout_task = NULL; 1057 fm->timeout_task = NULL;
@@ -1096,17 +1122,25 @@ send_with_fragmentation (struct MacEndpoint *endpoint,
1096 fm->cont = cont; 1122 fm->cont = cont;
1097 fm->cont_cls = cont_cls; 1123 fm->cont_cls = cont_cls;
1098 /* 1 MBit/s typical data rate, 1430 byte fragments => ~100 ms per message */ 1124 /* 1 MBit/s typical data rate, 1430 byte fragments => ~100 ms per message */
1099 fm->fragcontext =
1100 GNUNET_FRAGMENT_context_create (plugin->env->stats,
1101 WLAN_MTU,
1102 &plugin->tracker,
1103 endpoint->msg_delay,
1104 endpoint->ack_delay,
1105 msg,
1106 &transmit_fragment, fm);
1107 fm->timeout_task = 1125 fm->timeout_task =
1108 GNUNET_SCHEDULER_add_delayed (timeout, 1126 GNUNET_SCHEDULER_add_delayed (timeout,
1109 &fragmentmessage_timeout, fm); 1127 &fragmentmessage_timeout,
1128 fm);
1129 if (GNUNET_YES == plugin->have_mac)
1130 {
1131 fm->fragcontext =
1132 GNUNET_FRAGMENT_context_create (plugin->env->stats,
1133 WLAN_MTU,
1134 &plugin->tracker,
1135 fm->macendpoint->msg_delay,
1136 fm->macendpoint->ack_delay,
1137 msg,
1138 &transmit_fragment, fm);
1139 }
1140 else
1141 {
1142 fm->msg = GNUNET_copy_message (msg);
1143 }
1110 GNUNET_CONTAINER_DLL_insert_tail (endpoint->sending_messages_head, 1144 GNUNET_CONTAINER_DLL_insert_tail (endpoint->sending_messages_head,
1111 endpoint->sending_messages_tail, 1145 endpoint->sending_messages_tail,
1112 fm); 1146 fm);
@@ -1362,13 +1396,13 @@ wlan_plugin_send (void *cls,
1362 wlanheader->sender = *plugin->env->my_identity; 1396 wlanheader->sender = *plugin->env->my_identity;
1363 wlanheader->target = session->target; 1397 wlanheader->target = session->target;
1364 wlanheader->crc = htonl (GNUNET_CRYPTO_crc32_n (msgbuf, msgbuf_size)); 1398 wlanheader->crc = htonl (GNUNET_CRYPTO_crc32_n (msgbuf, msgbuf_size));
1365 memcpy (&wlanheader[1], msgbuf, msgbuf_size); 1399 memcpy (&wlanheader[1],
1366 1400 msgbuf,
1401 msgbuf_size);
1367 GNUNET_STATISTICS_update (plugin->env->stats, 1402 GNUNET_STATISTICS_update (plugin->env->stats,
1368 "# bytes currently in buffers", 1403 "# bytes currently in buffers",
1369 msgbuf_size, 1404 msgbuf_size,
1370 GNUNET_NO); 1405 GNUNET_NO);
1371
1372 send_with_fragmentation (session->mac, 1406 send_with_fragmentation (session->mac,
1373 to, 1407 to,
1374 &session->target, 1408 &session->target,
@@ -1631,6 +1665,59 @@ process_data (void *cls,
1631 1665
1632 1666
1633/** 1667/**
1668 * Task to (periodically) send a HELLO beacon
1669 *
1670 * @param cls pointer to the plugin struct
1671 * @param tc scheduler context
1672 */
1673static void
1674send_hello_beacon (void *cls,
1675 const struct GNUNET_SCHEDULER_TaskContext *tc)
1676{
1677 struct Plugin *plugin = cls;
1678 uint16_t size;
1679 uint16_t hello_size;
1680 struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *radioHeader;
1681 const struct GNUNET_MessageHeader *hello;
1682
1683 hello = plugin->env->get_our_hello ();
1684 hello_size = GNUNET_HELLO_size ((struct GNUNET_HELLO_Message *) hello);
1685 GNUNET_assert (sizeof (struct WlanHeader) + hello_size <= WLAN_MTU);
1686 size = sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage) + hello_size;
1687 {
1688 char buf[size] GNUNET_ALIGN;
1689
1690 LOG (GNUNET_ERROR_TYPE_DEBUG,
1691 "Sending %u byte HELLO beacon\n",
1692 (unsigned int) size);
1693 radioHeader = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage*) buf;
1694 get_radiotap_header (NULL, radioHeader, size);
1695 LOG (GNUNET_ERROR_TYPE_DEBUG,
1696 "Broadcasting %u bytes of data to MAC `%s'\n",
1697 (unsigned int) size,
1698 mac_to_string (&bc_all_mac));
1699 get_wlan_header (plugin, &radioHeader->frame, &bc_all_mac, size);
1700 memcpy (&radioHeader[1], hello, hello_size);
1701 if (NULL !=
1702 GNUNET_HELPER_send (plugin->suid_helper,
1703 &radioHeader->header,
1704 GNUNET_YES /* can drop */,
1705 NULL, NULL))
1706 GNUNET_STATISTICS_update (plugin->env->stats,
1707 _("# HELLO beacons sent"),
1708 1, GNUNET_NO);
1709 }
1710 plugin->beacon_task =
1711 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
1712 (HELLO_BEACON_SCALING_FACTOR,
1713 plugin->mac_count + 1),
1714 &send_hello_beacon,
1715 plugin);
1716
1717}
1718
1719
1720/**
1634 * Function used for to process the data from the suid process 1721 * Function used for to process the data from the suid process
1635 * 1722 *
1636 * @param cls the plugin handle 1723 * @param cls the plugin handle
@@ -1648,6 +1735,8 @@ handle_helper_message (void *cls, void *client,
1648 struct WlanAddress wa; 1735 struct WlanAddress wa;
1649 struct MacAndSession mas; 1736 struct MacAndSession mas;
1650 uint16_t msize; 1737 uint16_t msize;
1738 struct FragmentMessage *fm;
1739 struct MacEndpoint *endpoint;
1651 1740
1652 msize = ntohs (hdr->size); 1741 msize = ntohs (hdr->size);
1653 switch (ntohs (hdr->type)) 1742 switch (ntohs (hdr->type))
@@ -1677,9 +1766,38 @@ handle_helper_message (void *cls, void *client,
1677 GNUNET_NO, 1766 GNUNET_NO,
1678 my_address); 1767 my_address);
1679 GNUNET_HELLO_address_free (my_address); 1768 GNUNET_HELLO_address_free (my_address);
1769 plugin->mac_address = cm->mac;
1770 }
1771 else
1772 {
1773 plugin->mac_address = cm->mac;
1774 plugin->have_mac = GNUNET_YES;
1775 for (endpoint = plugin->mac_head; NULL != endpoint; endpoint = endpoint->next)
1776 {
1777 for (fm = endpoint->sending_messages_head; NULL != fm; fm = fm->next)
1778 {
1779 if (NULL != fm->fragcontext)
1780 {
1781 GNUNET_break (0); /* should not happen */
1782 continue;
1783 }
1784 fm->fragcontext =
1785 GNUNET_FRAGMENT_context_create (plugin->env->stats,
1786 WLAN_MTU,
1787 &plugin->tracker,
1788 fm->macendpoint->msg_delay,
1789 fm->macendpoint->ack_delay,
1790 fm->msg,
1791 &transmit_fragment, fm);
1792 GNUNET_free (fm->msg);
1793 fm->msg = NULL;
1794 }
1795 }
1796 GNUNET_break (NULL == plugin->beacon_task);
1797 plugin->beacon_task = GNUNET_SCHEDULER_add_now (&send_hello_beacon,
1798 plugin);
1799
1680 } 1800 }
1681 plugin->mac_address = cm->mac;
1682 plugin->have_mac = GNUNET_YES;
1683 1801
1684 memset (&wa, 0, sizeof (struct WlanAddress)); 1802 memset (&wa, 0, sizeof (struct WlanAddress));
1685 wa.mac = plugin->mac_address; 1803 wa.mac = plugin->mac_address;
@@ -1743,6 +1861,14 @@ handle_helper_message (void *cls, void *client,
1743 "Receiving %u bytes of data from MAC `%s'\n", 1861 "Receiving %u bytes of data from MAC `%s'\n",
1744 (unsigned int) (msize - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage)), 1862 (unsigned int) (msize - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage)),
1745 mac_to_string (&rxinfo->frame.addr2)); 1863 mac_to_string (&rxinfo->frame.addr2));
1864 LOG (GNUNET_ERROR_TYPE_DEBUG,
1865 "Receiving %u bytes of data to MAC `%s'\n",
1866 (unsigned int) (msize - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage)),
1867 mac_to_string (&rxinfo->frame.addr1));
1868 LOG (GNUNET_ERROR_TYPE_DEBUG,
1869 "Receiving %u bytes of data with BSSID MAC `%s'\n",
1870 (unsigned int) (msize - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage)),
1871 mac_to_string (&rxinfo->frame.addr3));
1746 wa.mac = rxinfo->frame.addr2; 1872 wa.mac = rxinfo->frame.addr2;
1747 wa.options = htonl (0); 1873 wa.options = htonl (0);
1748 mas.endpoint = create_macendpoint (plugin, &wa); 1874 mas.endpoint = create_macendpoint (plugin, &wa);
@@ -1765,55 +1891,6 @@ handle_helper_message (void *cls, void *client,
1765 1891
1766 1892
1767/** 1893/**
1768 * Task to (periodically) send a HELLO beacon
1769 *
1770 * @param cls pointer to the plugin struct
1771 * @param tc scheduler context
1772 */
1773static void
1774send_hello_beacon (void *cls,
1775 const struct GNUNET_SCHEDULER_TaskContext *tc)
1776{
1777 struct Plugin *plugin = cls;
1778 uint16_t size;
1779 uint16_t hello_size;
1780 struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *radioHeader;
1781 const struct GNUNET_MessageHeader *hello;
1782
1783 hello = plugin->env->get_our_hello ();
1784 hello_size = GNUNET_HELLO_size ((struct GNUNET_HELLO_Message *) hello);
1785 GNUNET_assert (sizeof (struct WlanHeader) + hello_size <= WLAN_MTU);
1786 size = sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage) + hello_size;
1787 {
1788 char buf[size] GNUNET_ALIGN;
1789
1790 LOG (GNUNET_ERROR_TYPE_DEBUG,
1791 "Sending %u byte HELLO beacon\n",
1792 (unsigned int) size);
1793 radioHeader = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage*) buf;
1794 get_radiotap_header (NULL, radioHeader, size);
1795 get_wlan_header (plugin, &radioHeader->frame, &bc_all_mac, size);
1796 memcpy (&radioHeader[1], hello, hello_size);
1797 if (NULL !=
1798 GNUNET_HELPER_send (plugin->suid_helper,
1799 &radioHeader->header,
1800 GNUNET_YES /* can drop */,
1801 NULL, NULL))
1802 GNUNET_STATISTICS_update (plugin->env->stats,
1803 _("# HELLO beacons sent"),
1804 1, GNUNET_NO);
1805 }
1806 plugin->beacon_task =
1807 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
1808 (HELLO_BEACON_SCALING_FACTOR,
1809 plugin->mac_count + 1),
1810 &send_hello_beacon,
1811 plugin);
1812
1813}
1814
1815
1816/**
1817 * Another peer has suggested an address for this 1894 * Another peer has suggested an address for this
1818 * peer and transport plugin. Check that this could be a valid 1895 * peer and transport plugin. Check that this could be a valid
1819 * address. If so, consider adding it to the list 1896 * address. If so, consider adding it to the list
@@ -2204,8 +2281,6 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls)
2204 plugin); 2281 plugin);
2205 plugin->helper_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, 2282 plugin->helper_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data,
2206 plugin); 2283 plugin);
2207 plugin->beacon_task = GNUNET_SCHEDULER_add_now (&send_hello_beacon,
2208 plugin);
2209 2284
2210 plugin->options = 0; 2285 plugin->options = 0;
2211 2286