diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-10-06 20:55:28 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-10-06 20:55:28 +0000 |
commit | 61c39c60565b386e0e12ea669556b030e8cd7180 (patch) | |
tree | 59109aeab8297bdc996faca8c4e38ec7426c36cf /src/transport/plugin_transport_wlan.c | |
parent | 780eb09dd8040ecf8649d40ddf8314464e0fc48e (diff) | |
download | gnunet-61c39c60565b386e0e12ea669556b030e8cd7180.tar.gz gnunet-61c39c60565b386e0e12ea669556b030e8cd7180.zip |
-remove trailing whitespace
Diffstat (limited to 'src/transport/plugin_transport_wlan.c')
-rw-r--r-- | src/transport/plugin_transport_wlan.c | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index ec0947648..932d3b762 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c | |||
@@ -75,7 +75,7 @@ GNUNET_NETWORK_STRUCT_BEGIN | |||
75 | /** | 75 | /** |
76 | * Header for messages which need fragmentation. This is the format of | 76 | * Header for messages which need fragmentation. This is the format of |
77 | * a message we obtain AFTER defragmentation. We then need to check | 77 | * a message we obtain AFTER defragmentation. We then need to check |
78 | * the CRC and then tokenize the payload and pass it to the | 78 | * the CRC and then tokenize the payload and pass it to the |
79 | * 'receive' callback. | 79 | * 'receive' callback. |
80 | */ | 80 | */ |
81 | struct WlanHeader | 81 | struct WlanHeader |
@@ -398,7 +398,7 @@ struct Plugin | |||
398 | 398 | ||
399 | /** | 399 | /** |
400 | * Handle to helper process for priviledged operations. | 400 | * Handle to helper process for priviledged operations. |
401 | */ | 401 | */ |
402 | struct GNUNET_HELPER_Handle *suid_helper; | 402 | struct GNUNET_HELPER_Handle *suid_helper; |
403 | 403 | ||
404 | /** | 404 | /** |
@@ -560,7 +560,7 @@ get_radiotap_header (struct MacEndpoint *endpoint, | |||
560 | static void | 560 | static void |
561 | get_wlan_header (struct Plugin *plugin, | 561 | get_wlan_header (struct Plugin *plugin, |
562 | struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *header, | 562 | struct GNUNET_TRANSPORT_WLAN_Ieee80211Frame *header, |
563 | const struct GNUNET_TRANSPORT_WLAN_MacAddress *to_mac_addr, | 563 | const struct GNUNET_TRANSPORT_WLAN_MacAddress *to_mac_addr, |
564 | unsigned int size) | 564 | unsigned int size) |
565 | { | 565 | { |
566 | const int rate = 11000000; | 566 | const int rate = 11000000; |
@@ -606,12 +606,12 @@ send_ack (void *cls, uint32_t msg_id, | |||
606 | GNUNET_break (0); | 606 | GNUNET_break (0); |
607 | return; | 607 | return; |
608 | } | 608 | } |
609 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 609 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
610 | "Sending ACK to helper\n"); | 610 | "Sending ACK to helper\n"); |
611 | radio_header = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) buf; | 611 | radio_header = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) buf; |
612 | get_radiotap_header (endpoint, radio_header, size); | 612 | get_radiotap_header (endpoint, radio_header, size); |
613 | get_wlan_header (endpoint->plugin, | 613 | get_wlan_header (endpoint->plugin, |
614 | &radio_header->frame, | 614 | &radio_header->frame, |
615 | &endpoint->addr.mac, | 615 | &endpoint->addr.mac, |
616 | size); | 616 | size); |
617 | memcpy (&radio_header[1], hdr, msize); | 617 | memcpy (&radio_header[1], hdr, msize); |
@@ -619,7 +619,7 @@ send_ack (void *cls, uint32_t msg_id, | |||
619 | GNUNET_HELPER_send (endpoint->plugin->suid_helper, | 619 | GNUNET_HELPER_send (endpoint->plugin->suid_helper, |
620 | &radio_header->header, | 620 | &radio_header->header, |
621 | GNUNET_NO /* dropping ACKs is bad */, | 621 | GNUNET_NO /* dropping ACKs is bad */, |
622 | NULL, NULL)) | 622 | NULL, NULL)) |
623 | GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# WLAN ACKs sent"), | 623 | GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# WLAN ACKs sent"), |
624 | 1, GNUNET_NO); | 624 | 1, GNUNET_NO); |
625 | } | 625 | } |
@@ -643,7 +643,7 @@ wlan_data_message_handler (void *cls, const struct GNUNET_MessageHeader *hdr) | |||
643 | GNUNET_NO); | 643 | GNUNET_NO); |
644 | mas.session = NULL; | 644 | mas.session = NULL; |
645 | mas.endpoint = endpoint; | 645 | mas.endpoint = endpoint; |
646 | (void) GNUNET_SERVER_mst_receive (plugin->fragment_data_tokenizer, | 646 | (void) GNUNET_SERVER_mst_receive (plugin->fragment_data_tokenizer, |
647 | &mas, | 647 | &mas, |
648 | (const char *) hdr, | 648 | (const char *) hdr, |
649 | ntohs (hdr->size), | 649 | ntohs (hdr->size), |
@@ -661,7 +661,7 @@ free_session (struct Session *session) | |||
661 | { | 661 | { |
662 | struct MacEndpoint *endpoint = session->mac; | 662 | struct MacEndpoint *endpoint = session->mac; |
663 | struct PendingMessage *pm; | 663 | struct PendingMessage *pm; |
664 | 664 | ||
665 | endpoint->plugin->env->session_end (endpoint->plugin->env->cls, | 665 | endpoint->plugin->env->session_end (endpoint->plugin->env->cls, |
666 | &session->target, | 666 | &session->target, |
667 | session); | 667 | session); |
@@ -677,7 +677,7 @@ free_session (struct Session *session) | |||
677 | GNUNET_free (pm->msg); | 677 | GNUNET_free (pm->msg); |
678 | GNUNET_free (pm); | 678 | GNUNET_free (pm); |
679 | } | 679 | } |
680 | GNUNET_CONTAINER_DLL_remove (endpoint->sessions_head, | 680 | GNUNET_CONTAINER_DLL_remove (endpoint->sessions_head, |
681 | endpoint->sessions_tail, | 681 | endpoint->sessions_tail, |
682 | session); | 682 | session); |
683 | if (session->timeout_task != GNUNET_SCHEDULER_NO_TASK) | 683 | if (session->timeout_task != GNUNET_SCHEDULER_NO_TASK) |
@@ -705,7 +705,7 @@ session_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
705 | 705 | ||
706 | session->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 706 | session->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
707 | timeout = GNUNET_TIME_absolute_get_remaining (session->timeout); | 707 | timeout = GNUNET_TIME_absolute_get_remaining (session->timeout); |
708 | if (0 == timeout.rel_value_us) | 708 | if (0 == timeout.rel_value_us) |
709 | { | 709 | { |
710 | free_session (session); | 710 | free_session (session); |
711 | return; | 711 | return; |
@@ -800,7 +800,7 @@ get_session (struct MacEndpoint *endpoint, | |||
800 | * message to the SUID helper process and we are thus ready for | 800 | * message to the SUID helper process and we are thus ready for |
801 | * the next fragment. | 801 | * the next fragment. |
802 | * | 802 | * |
803 | * @param cls the 'struct FragmentMessage' | 803 | * @param cls the 'struct FragmentMessage' |
804 | * @param result result of the operation (GNUNET_OK on success, GNUNET_NO if the helper died, GNUNET_SYSERR | 804 | * @param result result of the operation (GNUNET_OK on success, GNUNET_NO if the helper died, GNUNET_SYSERR |
805 | * if the helper was stopped) | 805 | * if the helper was stopped) |
806 | */ | 806 | */ |
@@ -820,7 +820,7 @@ fragment_transmission_done (void *cls, | |||
820 | * Transmit a fragment of a message. | 820 | * Transmit a fragment of a message. |
821 | * | 821 | * |
822 | * @param cls 'struct FragmentMessage' this fragment message belongs to | 822 | * @param cls 'struct FragmentMessage' this fragment message belongs to |
823 | * @param hdr pointer to the start of the fragment message | 823 | * @param hdr pointer to the start of the fragment message |
824 | */ | 824 | */ |
825 | static void | 825 | static void |
826 | transmit_fragment (void *cls, | 826 | transmit_fragment (void *cls, |
@@ -846,7 +846,7 @@ transmit_fragment (void *cls, | |||
846 | radio_header = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) buf; | 846 | radio_header = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage *) buf; |
847 | get_radiotap_header (endpoint, radio_header, size); | 847 | get_radiotap_header (endpoint, radio_header, size); |
848 | get_wlan_header (endpoint->plugin, | 848 | get_wlan_header (endpoint->plugin, |
849 | &radio_header->frame, | 849 | &radio_header->frame, |
850 | &endpoint->addr.mac, | 850 | &endpoint->addr.mac, |
851 | size); | 851 | size); |
852 | memcpy (&radio_header[1], hdr, msize); | 852 | memcpy (&radio_header[1], hdr, msize); |
@@ -881,7 +881,7 @@ free_fragment_message (struct FragmentMessage *fm) | |||
881 | { | 881 | { |
882 | struct MacEndpoint *endpoint = fm->macendpoint; | 882 | struct MacEndpoint *endpoint = fm->macendpoint; |
883 | 883 | ||
884 | GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# WLAN messages pending (with fragmentation)"), | 884 | GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# WLAN messages pending (with fragmentation)"), |
885 | -1, GNUNET_NO); | 885 | -1, GNUNET_NO); |
886 | GNUNET_CONTAINER_DLL_remove (endpoint->sending_messages_head, | 886 | GNUNET_CONTAINER_DLL_remove (endpoint->sending_messages_head, |
887 | endpoint->sending_messages_tail, fm); | 887 | endpoint->sending_messages_tail, fm); |
@@ -941,7 +941,7 @@ fragmentmessage_timeout (void *cls, | |||
941 | static void | 941 | static void |
942 | send_with_fragmentation (struct MacEndpoint *endpoint, | 942 | send_with_fragmentation (struct MacEndpoint *endpoint, |
943 | struct GNUNET_TIME_Relative timeout, | 943 | struct GNUNET_TIME_Relative timeout, |
944 | const struct GNUNET_PeerIdentity *target, | 944 | const struct GNUNET_PeerIdentity *target, |
945 | const struct GNUNET_MessageHeader *msg, | 945 | const struct GNUNET_MessageHeader *msg, |
946 | size_t payload_size, | 946 | size_t payload_size, |
947 | GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls) | 947 | GNUNET_TRANSPORT_TransmitContinuation cont, void *cont_cls) |
@@ -968,7 +968,7 @@ send_with_fragmentation (struct MacEndpoint *endpoint, | |||
968 | msg, | 968 | msg, |
969 | &transmit_fragment, fm); | 969 | &transmit_fragment, fm); |
970 | fm->timeout_task = | 970 | fm->timeout_task = |
971 | GNUNET_SCHEDULER_add_delayed (timeout, | 971 | GNUNET_SCHEDULER_add_delayed (timeout, |
972 | &fragmentmessage_timeout, fm); | 972 | &fragmentmessage_timeout, fm); |
973 | GNUNET_CONTAINER_DLL_insert_tail (endpoint->sending_messages_head, | 973 | GNUNET_CONTAINER_DLL_insert_tail (endpoint->sending_messages_head, |
974 | endpoint->sending_messages_tail, | 974 | endpoint->sending_messages_tail, |
@@ -978,7 +978,7 @@ send_with_fragmentation (struct MacEndpoint *endpoint, | |||
978 | 978 | ||
979 | /** | 979 | /** |
980 | * Free a MAC endpoint. | 980 | * Free a MAC endpoint. |
981 | * | 981 | * |
982 | * @param endpoint pointer to the MacEndpoint to free | 982 | * @param endpoint pointer to the MacEndpoint to free |
983 | */ | 983 | */ |
984 | static void | 984 | static void |
@@ -994,8 +994,8 @@ free_macendpoint (struct MacEndpoint *endpoint) | |||
994 | free_session (session); | 994 | free_session (session); |
995 | while (NULL != (fm = endpoint->sending_messages_head)) | 995 | while (NULL != (fm = endpoint->sending_messages_head)) |
996 | free_fragment_message (fm); | 996 | free_fragment_message (fm); |
997 | GNUNET_CONTAINER_DLL_remove (plugin->mac_head, | 997 | GNUNET_CONTAINER_DLL_remove (plugin->mac_head, |
998 | plugin->mac_tail, | 998 | plugin->mac_tail, |
999 | endpoint); | 999 | endpoint); |
1000 | 1000 | ||
1001 | if (NULL != endpoint->defrag) | 1001 | if (NULL != endpoint->defrag) |
@@ -1028,7 +1028,7 @@ macendpoint_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1028 | 1028 | ||
1029 | endpoint->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 1029 | endpoint->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
1030 | timeout = GNUNET_TIME_absolute_get_remaining (endpoint->timeout); | 1030 | timeout = GNUNET_TIME_absolute_get_remaining (endpoint->timeout); |
1031 | if (0 == timeout.rel_value_us) | 1031 | if (0 == timeout.rel_value_us) |
1032 | { | 1032 | { |
1033 | free_macendpoint (endpoint); | 1033 | free_macendpoint (endpoint); |
1034 | return; | 1034 | return; |
@@ -1054,14 +1054,14 @@ create_macendpoint (struct Plugin *plugin, | |||
1054 | 1054 | ||
1055 | for (pos = plugin->mac_head; NULL != pos; pos = pos->next) | 1055 | for (pos = plugin->mac_head; NULL != pos; pos = pos->next) |
1056 | if (0 == memcmp (addr, &pos->addr, sizeof (struct WlanAddress))) | 1056 | if (0 == memcmp (addr, &pos->addr, sizeof (struct WlanAddress))) |
1057 | return pos; | 1057 | return pos; |
1058 | pos = GNUNET_malloc (sizeof (struct MacEndpoint)); | 1058 | pos = GNUNET_malloc (sizeof (struct MacEndpoint)); |
1059 | pos->addr = *addr; | 1059 | pos->addr = *addr; |
1060 | pos->plugin = plugin; | 1060 | pos->plugin = plugin; |
1061 | pos->defrag = | 1061 | pos->defrag = |
1062 | GNUNET_DEFRAGMENT_context_create (plugin->env->stats, WLAN_MTU, | 1062 | GNUNET_DEFRAGMENT_context_create (plugin->env->stats, WLAN_MTU, |
1063 | MESSAGES_IN_DEFRAG_QUEUE_PER_MAC, | 1063 | MESSAGES_IN_DEFRAG_QUEUE_PER_MAC, |
1064 | pos, | 1064 | pos, |
1065 | &wlan_data_message_handler, | 1065 | &wlan_data_message_handler, |
1066 | &send_ack); | 1066 | &send_ack); |
1067 | 1067 | ||
@@ -1076,7 +1076,7 @@ create_macendpoint (struct Plugin *plugin, | |||
1076 | plugin->mac_count++; | 1076 | plugin->mac_count++; |
1077 | GNUNET_STATISTICS_update (plugin->env->stats, _("# WLAN MAC endpoints allocated"), | 1077 | GNUNET_STATISTICS_update (plugin->env->stats, _("# WLAN MAC endpoints allocated"), |
1078 | 1, GNUNET_NO); | 1078 | 1, GNUNET_NO); |
1079 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1079 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1080 | "New MAC endpoint `%s'\n", | 1080 | "New MAC endpoint `%s'\n", |
1081 | wlan_plugin_address_to_string(NULL, addr, sizeof (struct WlanAddress))); | 1081 | wlan_plugin_address_to_string(NULL, addr, sizeof (struct WlanAddress))); |
1082 | return pos; | 1082 | return pos; |
@@ -1091,7 +1091,7 @@ create_macendpoint (struct Plugin *plugin, | |||
1091 | * @return the network type in HBO or GNUNET_SYSERR | 1091 | * @return the network type in HBO or GNUNET_SYSERR |
1092 | */ | 1092 | */ |
1093 | static enum GNUNET_ATS_Network_Type | 1093 | static enum GNUNET_ATS_Network_Type |
1094 | wlan_get_network (void *cls, | 1094 | wlan_get_network (void *cls, |
1095 | struct Session *session) | 1095 | struct Session *session) |
1096 | { | 1096 | { |
1097 | GNUNET_assert (NULL != session); | 1097 | GNUNET_assert (NULL != session); |
@@ -1196,7 +1196,7 @@ wlan_plugin_send (void *cls, | |||
1196 | size_t size = msgbuf_size + sizeof (struct WlanHeader); | 1196 | size_t size = msgbuf_size + sizeof (struct WlanHeader); |
1197 | char buf[size] GNUNET_ALIGN; | 1197 | char buf[size] GNUNET_ALIGN; |
1198 | 1198 | ||
1199 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1199 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1200 | "Transmitting %u bytes of payload to peer `%s' (starting with %u byte message of type %u)\n", | 1200 | "Transmitting %u bytes of payload to peer `%s' (starting with %u byte message of type %u)\n", |
1201 | msgbuf_size, | 1201 | msgbuf_size, |
1202 | GNUNET_i2s (&session->target), | 1202 | GNUNET_i2s (&session->target), |
@@ -1256,7 +1256,7 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) | |||
1256 | switch (ntohs (hdr->type)) | 1256 | switch (ntohs (hdr->type)) |
1257 | { | 1257 | { |
1258 | case GNUNET_MESSAGE_TYPE_HELLO: | 1258 | case GNUNET_MESSAGE_TYPE_HELLO: |
1259 | if (GNUNET_OK != | 1259 | if (GNUNET_OK != |
1260 | GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) hdr, &tmpsource)) | 1260 | GNUNET_HELLO_get_id ((const struct GNUNET_HELLO_Message *) hdr, &tmpsource)) |
1261 | { | 1261 | { |
1262 | GNUNET_break_op (0); | 1262 | GNUNET_break_op (0); |
@@ -1271,9 +1271,9 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) | |||
1271 | GNUNET_STATISTICS_update (plugin->env->stats, | 1271 | GNUNET_STATISTICS_update (plugin->env->stats, |
1272 | _("# HELLO messages received via WLAN"), 1, | 1272 | _("# HELLO messages received via WLAN"), 1, |
1273 | GNUNET_NO); | 1273 | GNUNET_NO); |
1274 | plugin->env->receive (plugin->env->cls, | 1274 | plugin->env->receive (plugin->env->cls, |
1275 | &tmpsource, | 1275 | &tmpsource, |
1276 | hdr, | 1276 | hdr, |
1277 | mas->session, | 1277 | mas->session, |
1278 | (mas->endpoint == NULL) ? NULL : (const char *) &mas->endpoint->addr, | 1278 | (mas->endpoint == NULL) ? NULL : (const char *) &mas->endpoint->addr, |
1279 | (mas->endpoint == NULL) ? 0 : sizeof (struct WlanAddress)); | 1279 | (mas->endpoint == NULL) ? 0 : sizeof (struct WlanAddress)); |
@@ -1290,7 +1290,7 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) | |||
1290 | GNUNET_break (0); | 1290 | GNUNET_break (0); |
1291 | break; | 1291 | break; |
1292 | } | 1292 | } |
1293 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1293 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1294 | "Processing %u bytes of FRAGMENT from MAC %s\n", | 1294 | "Processing %u bytes of FRAGMENT from MAC %s\n", |
1295 | (unsigned int) msize, | 1295 | (unsigned int) msize, |
1296 | wlan_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress))); | 1296 | wlan_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress))); |
@@ -1312,7 +1312,7 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) | |||
1312 | ret = GNUNET_FRAGMENT_process_ack (fm->fragcontext, hdr); | 1312 | ret = GNUNET_FRAGMENT_process_ack (fm->fragcontext, hdr); |
1313 | if (GNUNET_OK == ret) | 1313 | if (GNUNET_OK == ret) |
1314 | { | 1314 | { |
1315 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1315 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1316 | "Got last ACK, finished message transmission to `%s' (%p)\n", | 1316 | "Got last ACK, finished message transmission to `%s' (%p)\n", |
1317 | wlan_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress)), | 1317 | wlan_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress)), |
1318 | fm); | 1318 | fm); |
@@ -1327,13 +1327,13 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) | |||
1327 | } | 1327 | } |
1328 | if (GNUNET_NO == ret) | 1328 | if (GNUNET_NO == ret) |
1329 | { | 1329 | { |
1330 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1330 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1331 | "Got an ACK, message transmission to `%s' not yet finished\n", | 1331 | "Got an ACK, message transmission to `%s' not yet finished\n", |
1332 | wlan_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress))); | 1332 | wlan_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress))); |
1333 | break; | 1333 | break; |
1334 | } | 1334 | } |
1335 | } | 1335 | } |
1336 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1336 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1337 | "ACK not matched against any active fragmentation with MAC `%s'\n", | 1337 | "ACK not matched against any active fragmentation with MAC `%s'\n", |
1338 | wlan_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress))); | 1338 | wlan_plugin_address_to_string (NULL, &mas->endpoint->addr, sizeof (struct WlanAddress))); |
1339 | break; | 1339 | break; |
@@ -1347,13 +1347,13 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) | |||
1347 | { | 1347 | { |
1348 | GNUNET_break (0); | 1348 | GNUNET_break (0); |
1349 | break; | 1349 | break; |
1350 | } | 1350 | } |
1351 | wlanheader = (const struct WlanHeader *) hdr; | 1351 | wlanheader = (const struct WlanHeader *) hdr; |
1352 | if (0 != memcmp (&wlanheader->target, | 1352 | if (0 != memcmp (&wlanheader->target, |
1353 | plugin->env->my_identity, | 1353 | plugin->env->my_identity, |
1354 | sizeof (struct GNUNET_PeerIdentity))) | 1354 | sizeof (struct GNUNET_PeerIdentity))) |
1355 | { | 1355 | { |
1356 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1356 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1357 | "WLAN data for `%s', not for me, ignoring\n", | 1357 | "WLAN data for `%s', not for me, ignoring\n", |
1358 | GNUNET_i2s (&wlanheader->target)); | 1358 | GNUNET_i2s (&wlanheader->target)); |
1359 | break; | 1359 | break; |
@@ -1380,11 +1380,11 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) | |||
1380 | "Processing %u bytes of WLAN DATA from peer `%s'\n", | 1380 | "Processing %u bytes of WLAN DATA from peer `%s'\n", |
1381 | (unsigned int) msize, | 1381 | (unsigned int) msize, |
1382 | GNUNET_i2s (&wlanheader->sender)); | 1382 | GNUNET_i2s (&wlanheader->sender)); |
1383 | (void) GNUNET_SERVER_mst_receive (plugin->wlan_header_payload_tokenizer, | 1383 | (void) GNUNET_SERVER_mst_receive (plugin->wlan_header_payload_tokenizer, |
1384 | &xmas, | 1384 | &xmas, |
1385 | (const char *) &wlanheader[1], | 1385 | (const char *) &wlanheader[1], |
1386 | msize - sizeof (struct WlanHeader), | 1386 | msize - sizeof (struct WlanHeader), |
1387 | GNUNET_YES, GNUNET_NO); | 1387 | GNUNET_YES, GNUNET_NO); |
1388 | break; | 1388 | break; |
1389 | default: | 1389 | default: |
1390 | if (NULL == mas->endpoint) | 1390 | if (NULL == mas->endpoint) |
@@ -1402,9 +1402,9 @@ process_data (void *cls, void *client, const struct GNUNET_MessageHeader *hdr) | |||
1402 | (unsigned int) msize, | 1402 | (unsigned int) msize, |
1403 | (unsigned int) ntohs (hdr->type), | 1403 | (unsigned int) ntohs (hdr->type), |
1404 | GNUNET_i2s (&mas->session->target)); | 1404 | GNUNET_i2s (&mas->session->target)); |
1405 | plugin->env->receive (plugin->env->cls, | 1405 | plugin->env->receive (plugin->env->cls, |
1406 | &mas->session->target, | 1406 | &mas->session->target, |
1407 | hdr, | 1407 | hdr, |
1408 | mas->session, | 1408 | mas->session, |
1409 | (mas->endpoint == NULL) ? NULL : (const char *) &mas->endpoint->addr, | 1409 | (mas->endpoint == NULL) ? NULL : (const char *) &mas->endpoint->addr, |
1410 | (mas->endpoint == NULL) ? 0 : sizeof (struct WlanAddress)); | 1410 | (mas->endpoint == NULL) ? 0 : sizeof (struct WlanAddress)); |
@@ -1478,7 +1478,7 @@ handle_helper_message (void *cls, void *client, | |||
1478 | "wlan"); | 1478 | "wlan"); |
1479 | break; | 1479 | break; |
1480 | case GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER: | 1480 | case GNUNET_MESSAGE_TYPE_WLAN_DATA_FROM_HELPER: |
1481 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1481 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1482 | "Got data message from helper with %u bytes\n", | 1482 | "Got data message from helper with %u bytes\n", |
1483 | msize); | 1483 | msize); |
1484 | GNUNET_STATISTICS_update (plugin->env->stats, | 1484 | GNUNET_STATISTICS_update (plugin->env->stats, |
@@ -1515,7 +1515,7 @@ handle_helper_message (void *cls, void *client, | |||
1515 | /* packet is FROM us, thus not FOR us */ | 1515 | /* packet is FROM us, thus not FOR us */ |
1516 | break; | 1516 | break; |
1517 | } | 1517 | } |
1518 | 1518 | ||
1519 | GNUNET_STATISTICS_update (plugin->env->stats, | 1519 | GNUNET_STATISTICS_update (plugin->env->stats, |
1520 | _("# WLAN DATA messages processed"), | 1520 | _("# WLAN DATA messages processed"), |
1521 | 1, GNUNET_NO); | 1521 | 1, GNUNET_NO); |
@@ -1527,7 +1527,7 @@ handle_helper_message (void *cls, void *client, | |||
1527 | wa.options = htonl (0); | 1527 | wa.options = htonl (0); |
1528 | mas.endpoint = create_macendpoint (plugin, &wa); | 1528 | mas.endpoint = create_macendpoint (plugin, &wa); |
1529 | mas.session = NULL; | 1529 | mas.session = NULL; |
1530 | (void) GNUNET_SERVER_mst_receive (plugin->helper_payload_tokenizer, | 1530 | (void) GNUNET_SERVER_mst_receive (plugin->helper_payload_tokenizer, |
1531 | &mas, | 1531 | &mas, |
1532 | (const char*) &rxinfo[1], | 1532 | (const char*) &rxinfo[1], |
1533 | msize - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage), | 1533 | msize - sizeof (struct GNUNET_TRANSPORT_WLAN_RadiotapReceiveMessage), |
@@ -1535,7 +1535,7 @@ handle_helper_message (void *cls, void *client, | |||
1535 | break; | 1535 | break; |
1536 | default: | 1536 | default: |
1537 | GNUNET_break (0); | 1537 | GNUNET_break (0); |
1538 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1538 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1539 | "Unexpected message of type %u (%u bytes)", | 1539 | "Unexpected message of type %u (%u bytes)", |
1540 | ntohs (hdr->type), ntohs (hdr->size)); | 1540 | ntohs (hdr->type), ntohs (hdr->size)); |
1541 | break; | 1541 | break; |
@@ -1568,7 +1568,7 @@ send_hello_beacon (void *cls, | |||
1568 | { | 1568 | { |
1569 | char buf[size] GNUNET_ALIGN; | 1569 | char buf[size] GNUNET_ALIGN; |
1570 | 1570 | ||
1571 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1571 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1572 | "Sending %u byte HELLO beacon\n", | 1572 | "Sending %u byte HELLO beacon\n", |
1573 | (unsigned int) size); | 1573 | (unsigned int) size); |
1574 | radioHeader = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage*) buf; | 1574 | radioHeader = (struct GNUNET_TRANSPORT_WLAN_RadiotapSendMessage*) buf; |
@@ -1612,13 +1612,13 @@ wlan_plugin_address_suggested (void *cls, const void *addr, size_t addrlen) | |||
1612 | struct WlanAddress *wa = (struct WlanAddress *) addr; | 1612 | struct WlanAddress *wa = (struct WlanAddress *) addr; |
1613 | 1613 | ||
1614 | if (addrlen != sizeof (struct WlanAddress)) | 1614 | if (addrlen != sizeof (struct WlanAddress)) |
1615 | { | 1615 | { |
1616 | GNUNET_break_op (0); | 1616 | GNUNET_break_op (0); |
1617 | return GNUNET_SYSERR; | 1617 | return GNUNET_SYSERR; |
1618 | } | 1618 | } |
1619 | if (GNUNET_YES != plugin->have_mac) | 1619 | if (GNUNET_YES != plugin->have_mac) |
1620 | { | 1620 | { |
1621 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1621 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1622 | "Rejecting MAC `%s': I don't know my MAC!\n", | 1622 | "Rejecting MAC `%s': I don't know my MAC!\n", |
1623 | mac_to_string (addr)); | 1623 | mac_to_string (addr)); |
1624 | return GNUNET_NO; /* don't know my MAC */ | 1624 | return GNUNET_NO; /* don't know my MAC */ |
@@ -1627,7 +1627,7 @@ wlan_plugin_address_suggested (void *cls, const void *addr, size_t addrlen) | |||
1627 | &plugin->mac_address, | 1627 | &plugin->mac_address, |
1628 | sizeof (wa->mac))) | 1628 | sizeof (wa->mac))) |
1629 | { | 1629 | { |
1630 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1630 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1631 | "Rejecting MAC `%s': not my MAC!\n", | 1631 | "Rejecting MAC `%s': not my MAC!\n", |
1632 | mac_to_string (addr)); | 1632 | mac_to_string (addr)); |
1633 | return GNUNET_NO; /* not my MAC */ | 1633 | return GNUNET_NO; /* not my MAC */ |
@@ -1705,7 +1705,7 @@ wlan_plugin_address_pretty_printer (void *cls, const char *type, | |||
1705 | 1705 | ||
1706 | 1706 | ||
1707 | /** | 1707 | /** |
1708 | * Exit point from the plugin. | 1708 | * Exit point from the plugin. |
1709 | * | 1709 | * |
1710 | * @param cls pointer to the api struct | 1710 | * @param cls pointer to the api struct |
1711 | */ | 1711 | */ |
@@ -1861,7 +1861,7 @@ libgnunet_plugin_transport_wlan_init (void *cls) | |||
1861 | 1861 | ||
1862 | testmode = 0; | 1862 | testmode = 0; |
1863 | /* check configuration */ | 1863 | /* check configuration */ |
1864 | if ( (GNUNET_YES == | 1864 | if ( (GNUNET_YES == |
1865 | GNUNET_CONFIGURATION_have_value (env->cfg, "transport-wlan", "TESTMODE")) && | 1865 | GNUNET_CONFIGURATION_have_value (env->cfg, "transport-wlan", "TESTMODE")) && |
1866 | ( (GNUNET_SYSERR == | 1866 | ( (GNUNET_SYSERR == |
1867 | GNUNET_CONFIGURATION_get_value_number (env->cfg, "transport-wlan", | 1867 | GNUNET_CONFIGURATION_get_value_number (env->cfg, "transport-wlan", |
@@ -1890,7 +1890,7 @@ libgnunet_plugin_transport_wlan_init (void *cls) | |||
1890 | { | 1890 | { |
1891 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, | 1891 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, |
1892 | "transport-wlan", "INTERFACE"); | 1892 | "transport-wlan", "INTERFACE"); |
1893 | return NULL; | 1893 | return NULL; |
1894 | } | 1894 | } |
1895 | 1895 | ||
1896 | plugin = GNUNET_malloc (sizeof (struct Plugin)); | 1896 | plugin = GNUNET_malloc (sizeof (struct Plugin)); |
@@ -1906,7 +1906,7 @@ libgnunet_plugin_transport_wlan_init (void *cls) | |||
1906 | plugin->fragment_data_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin); | 1906 | plugin->fragment_data_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin); |
1907 | plugin->wlan_header_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin); | 1907 | plugin->wlan_header_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin); |
1908 | plugin->helper_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin); | 1908 | plugin->helper_payload_tokenizer = GNUNET_SERVER_mst_create (&process_data, plugin); |
1909 | plugin->beacon_task = GNUNET_SCHEDULER_add_now (&send_hello_beacon, | 1909 | plugin->beacon_task = GNUNET_SCHEDULER_add_now (&send_hello_beacon, |
1910 | plugin); | 1910 | plugin); |
1911 | 1911 | ||
1912 | plugin->options = 0; | 1912 | plugin->options = 0; |
@@ -1914,7 +1914,7 @@ libgnunet_plugin_transport_wlan_init (void *cls) | |||
1914 | /* some compilers do not like switch on 'long long'... */ | 1914 | /* some compilers do not like switch on 'long long'... */ |
1915 | switch ((unsigned int) testmode) | 1915 | switch ((unsigned int) testmode) |
1916 | { | 1916 | { |
1917 | case 0: /* normal */ | 1917 | case 0: /* normal */ |
1918 | plugin->helper_argv[0] = (char *) "gnunet-helper-transport-wlan"; | 1918 | plugin->helper_argv[0] = (char *) "gnunet-helper-transport-wlan"; |
1919 | plugin->helper_argv[1] = interface; | 1919 | plugin->helper_argv[1] = interface; |
1920 | plugin->helper_argv[2] = NULL; | 1920 | plugin->helper_argv[2] = NULL; |