gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r14229 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r14229 - gnunet/src/transport
Date: Sun, 23 Jan 2011 18:15:22 +0100

Author: brodski
Date: 2011-01-23 18:15:21 +0100 (Sun, 23 Jan 2011)
New Revision: 14229

Added:
   gnunet/src/transport/test_transport_api_wlan
Modified:
   gnunet/src/transport/gnunet-transport-wlan-helper.c
   gnunet/src/transport/plugin_transport_wlan.c
Log:
Some errors fixed, most of them where buffer-position errors.

Modified: gnunet/src/transport/gnunet-transport-wlan-helper.c
===================================================================
--- gnunet/src/transport/gnunet-transport-wlan-helper.c 2011-01-23 15:23:45 UTC 
(rev 14228)
+++ gnunet/src/transport/gnunet-transport-wlan-helper.c 2011-01-23 17:15:21 UTC 
(rev 14229)
@@ -38,6 +38,7 @@
 #include "plugin_transport_wlan.h"
 #include "gnunet_common.h"
 #include "gnunet-transport-wlan-helper.h"
+#include "gnunet_crypto_lib.h"
 #include "ieee80211_radiotap.h"
 #include <pcap.h>
 #include <stdio.h>
@@ -395,7 +396,7 @@
 
 #define FIFO_FILE1       "/tmp/MYFIFOin"
 #define FIFO_FILE2       "/tmp/MYFIFOout"
-#define MAXLINE         20
+#define MAXLINE         4096
 
 static int first;
 static int closeprog;
@@ -420,22 +421,36 @@
                       const struct GNUNET_MessageHeader *hdr)
 {
   struct sendbuf *write_pout = cls;
-  int sendsize = ntohs(hdr->size) - sizeof(struct RadiotapHeader) ;
+  int sendsize;
   struct GNUNET_MessageHeader newheader;
+  char * from;
+  char * to;
 
-  GNUNET_assert(GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA == ntohs(hdr->type));
-  GNUNET_assert (sendsize + write_pout->size < MAXLINE *2);
+  sendsize = ntohs(hdr->size) - sizeof(struct RadiotapHeader) ;
 
 
+  if(GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA != ntohs(hdr->type)){
+    fprintf(stderr, "Function stdin_send: wrong packet type\n");
+    exit(1);
+  }
+  if((sendsize + write_pout->size) > MAXLINE * 2){
+    fprintf(stderr, "Function stdin_send: Packet too big for buffer\n");
+    exit(1);
+  }
+
+
   newheader.size = htons(sendsize);
   newheader.type = htons(GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA);
 
 
-  memcpy(write_pout->buf + write_pout->size, &newheader, sizeof(struct 
GNUNET_MessageHeader));
+  to = write_pout->buf + write_pout->size;
+  memcpy(to, &newheader, sizeof(struct GNUNET_MessageHeader));
   write_pout->size += sizeof(struct GNUNET_MessageHeader);
 
-  memcpy(write_pout->buf + write_pout->size, hdr + sizeof(struct 
RadiotapHeader) + sizeof(struct GNUNET_MessageHeader), sizeof(struct 
GNUNET_MessageHeader));
-  write_pout->size += sendsize;
+  from = (char *) hdr + sizeof(struct RadiotapHeader) + sizeof(struct 
GNUNET_MessageHeader);
+  to = write_pout->buf + write_pout->size;
+  memcpy(to, from, sendsize - sizeof(struct GNUNET_MessageHeader));
+  write_pout->size += sendsize - sizeof(struct GNUNET_MessageHeader);
 }
 
 static void
@@ -444,11 +459,19 @@
                       const struct GNUNET_MessageHeader *hdr)
 {
   struct sendbuf * write_std = cls;
-  int sendsize = ntohs(hdr->size);
+  int sendsize;
 
-  GNUNET_assert(GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA == ntohs(hdr->type));
-  GNUNET_assert (sendsize + write_std->size < MAXLINE *2);
+  sendsize = ntohs(hdr->size);
 
+  if(GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA != ntohs(hdr->type)){
+    fprintf(stderr, "Function file_in_send: wrong packet type\n");
+    exit(1);
+  }
+  if((sendsize + write_std->size) > MAXLINE * 2){
+    fprintf(stderr, "Function file_in_send: Packet too big for buffer\n");
+    exit(1);
+  }
+
   memcpy(write_std->buf + write_std->size, hdr, sendsize);
   write_std->size += sendsize;
 }
@@ -470,7 +493,7 @@
     {
       if (0 == stat(FIFO_FILE2, &st))
         {
-        fprintf(stderr, "FIFO_FILE2 exists, but FIFO_FILE1 not");
+        fprintf(stderr, "FIFO_FILE2 exists, but FIFO_FILE1 not\n");
           exit(1);
         }
 
@@ -484,7 +507,7 @@
 
       if (0 != stat(FIFO_FILE2, &st))
         {
-        fprintf(stderr, "FIFO_FILE1 exists, but FIFO_FILE2 not");
+        fprintf(stderr, "FIFO_FILE1 exists, but FIFO_FILE2 not\n");
           exit(1);
         }
 
@@ -497,12 +520,12 @@
       fpin = fopen(FIFO_FILE1, "r");
       if (NULL == fpin)
         {
-        fprintf(stderr, "fopen of read FIFO_FILE1");
+        fprintf(stderr, "fopen of read FIFO_FILE1\n");
           exit(1);
         }
       if (NULL == (fpout = fopen(FIFO_FILE2, "w")))
         {
-        fprintf(stderr, "fopen of write FIFO_FILE2");
+        fprintf(stderr, "fopen of write FIFO_FILE2\n");
           exit(1);
         }
 
@@ -513,12 +536,12 @@
       //fprintf(stderr, "Second\n");
       if (NULL == (fpout = fopen(FIFO_FILE1, "w")))
         {
-        fprintf(stderr, "fopen of write FIFO_FILE1");
+        fprintf(stderr, "fopen of write FIFO_FILE1\n");
           exit(1);
         }
       if (NULL == (fpin = fopen(FIFO_FILE2, "r")))
         {
-        fprintf(stderr, "fopen of read FIFO_FILE2");
+        fprintf(stderr, "fopen of read FIFO_FILE2\n");
           exit(1);
         }
 
@@ -581,8 +604,8 @@
   macmsg.mac.mac[1] = 0x22;
   macmsg.mac.mac[2] = 0x33;
   macmsg.mac.mac[3] = 0x44;
-  macmsg.mac.mac[4] = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, 
255);
-  macmsg.mac.mac[5] = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, 
255);
+  macmsg.mac.mac[4] = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_STRONG, 
256);
+  macmsg.mac.mac[5] = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_NONCE, 
256);
   macmsg.hdr.size = htons(sizeof(struct Wlan_Helper_Control_Message));
   macmsg.hdr.type = htons(GNUNET_MESSAGE_TYPE_WLAN_HELPER_CONTROL);
 
@@ -690,7 +713,7 @@
           if (0 > ret)
             {
               closeprog = 1;
-              fprintf(stderr, "Write ERROR to STDOUT");
+              fprintf(stderr, "Write ERROR to STDOUT\n");
               exit(1);
             }
           else
@@ -713,7 +736,7 @@
           if (0 > ret)
             {
               closeprog = 1;
-              fprintf(stderr, "Write ERROR to fdpout");
+              fprintf(stderr, "Write ERROR to fdpout\n");
               exit(1);
             }
           else
@@ -735,10 +758,10 @@
           if (0 > readsize)
             {
               closeprog = 1;
-              fprintf(stderr, "Read ERROR to STDIN_FILENO");
+              fprintf(stderr, "Read ERROR to STDIN_FILENO\n");
               exit(1);
             }
-          else
+          else if (0 < readsize)
             {
               GNUNET_SERVER_mst_receive(stdin_mst, NULL, readbuf, readsize,
                   GNUNET_NO, GNUNET_NO);
@@ -753,10 +776,10 @@
           if (0 > readsize)
             {
               closeprog = 1;
-              fprintf(stderr, "Read ERROR to fdpin");
+              fprintf(stderr, "Read ERROR to fdpin: %s\n", strerror(errno));
               exit(1);
             }
-          else
+          else if (0 < readsize)
             {
               GNUNET_SERVER_mst_receive(file_in_mst, NULL, readbuf, readsize,
                   GNUNET_NO, GNUNET_NO);

Modified: gnunet/src/transport/plugin_transport_wlan.c
===================================================================
--- gnunet/src/transport/plugin_transport_wlan.c        2011-01-23 15:23:45 UTC 
(rev 14228)
+++ gnunet/src/transport/plugin_transport_wlan.c        2011-01-23 17:15:21 UTC 
(rev 14229)
@@ -206,6 +206,14 @@
 
 };
 
+struct Finish_send
+{
+  struct Plugin * plugin;
+  char * msgheader;
+  struct GNUNET_MessageHeader * msgstart;
+  ssize_t size;
+};
+
 /**
  * Queue of sessions, for the general session queue and the pending session 
queue
  */
@@ -555,6 +563,9 @@
                       void *client,
                       const struct GNUNET_MessageHeader *hdr);
 
+static void
+finish_sending(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+
 /**
  * get the next message number, at the moment just a random one
  * @return returns the next valid message-number for sending packets
@@ -562,7 +573,7 @@
 uint32_t
 get_next_message_id()
 {
-  return GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX);
+  return GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX);
 }
 
 /**
@@ -1006,14 +1017,14 @@
 }
 
 /**
- * Function called to when wlan helper is ready to get some data
+ * Function called when wlan helper is ready to get some data
  *
  * @param cls closure
  * @param tc GNUNET_SCHEDULER_TaskContext
  */
 
 static void
-do_transmit (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+do_transmit(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
 
   struct Plugin * plugin = cls;
@@ -1032,6 +1043,7 @@
   struct GNUNET_MessageHeader * msgheader2 = NULL;
   struct FragmentationHeader fragheader;
   struct FragmentationHeader * fragheaderptr = NULL;
+  struct Finish_send * finish = NULL;
   uint16_t size = 0;
   const char * copystart = NULL;
   uint16_t copysize = 0;
@@ -1060,162 +1072,264 @@
       getWlanHeader(ieeewlanheader);
 
       msgheader2 = (struct GNUNET_MessageHeader *) &ieeewlanheader[1];
-      msgheader2->size = htons(GNUNET_HELLO_size(*(plugin->env->our_hello)) + 
sizeof(struct GNUNET_MessageHeader));
+      msgheader2->size = htons(GNUNET_HELLO_size(*(plugin->env->our_hello))
+          + sizeof(struct GNUNET_MessageHeader));
       msgheader2->type = htons(GNUNET_MESSAGE_TYPE_WLAN_ADVERTISEMENT);
 
       memcpy(&msgheader2[1], *plugin->env->our_hello, GNUNET_HELLO_size(
           *(plugin->env->our_hello)));
 
-
       bytes = GNUNET_DISK_file_write(plugin->server_stdin_handle, msgheader,
           size);
+      if (bytes == GNUNET_SYSERR)
+        {
+          GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
+              _("Error writing to wlan healper. errno == %d, ERROR: %s\n"),
+              errno, strerror(errno));
+
+        }
+      GNUNET_assert(bytes != GNUNET_SYSERR);
       GNUNET_assert(bytes == size);
 
+      GNUNET_free(msgheader);
+
       set_next_beacon_time(plugin);
       check_next_fragment_timeout(plugin);
+
       return;
 
     }
 
-
   fm = plugin->pending_Fragment_Messages_head;
   GNUNET_assert(fm != NULL);
   session = fm->session;
   GNUNET_assert(session != NULL);
 
   // test if message timed out
-  if (GNUNET_TIME_absolute_get_remaining(fm->timeout).rel_value == 0){
-         free_acks(fm);
-         GNUNET_assert(plugin->pending_fragment_messages > 0);
-         plugin->pending_fragment_messages --;
-         GNUNET_CONTAINER_DLL_remove(plugin->pending_Fragment_Messages_head,
-                         plugin->pending_Fragment_Messages_tail, fm);
+  if (GNUNET_TIME_absolute_get_remaining(fm->timeout).rel_value == 0)
+    {
+      free_acks(fm);
+      GNUNET_assert(plugin->pending_fragment_messages > 0);
+      plugin->pending_fragment_messages--;
+      GNUNET_CONTAINER_DLL_remove(plugin->pending_Fragment_Messages_head,
+          plugin->pending_Fragment_Messages_tail, fm);
 
-         GNUNET_free(fm->msg);
+      GNUNET_free(fm->msg);
 
-         GNUNET_free(fm);
-         check_fragment_queue(plugin);
-  } else {
+      GNUNET_free(fm);
+      check_fragment_queue(plugin);
+    }
+  else
+    {
 
-         if (fm->message_size > WLAN_MTU) {
-               size += sizeof(struct FragmentationHeader);
-               // check/set for retransmission
-               if (GNUNET_TIME_absolute_get_duration(fm->next_ack).rel_value 
== 0) {
+      if (fm->message_size > WLAN_MTU)
+        {
+          size += sizeof(struct FragmentationHeader);
+          // check/set for retransmission
+          if (GNUNET_TIME_absolute_get_duration(fm->next_ack).rel_value == 0)
+            {
 
-                       // be positive and try again later :-D
-                       fm->next_ack = 
GNUNET_TIME_relative_to_absolute(get_ack_timeout(fm));
-                       // find first missing fragment
-                       akt = fm->head;
-                       fm->message_pos = 0;
+              // be positive and try again later :-D
+              fm->next_ack = GNUNET_TIME_relative_to_absolute(get_ack_timeout(
+                  fm));
+              // find first missing fragment
+              akt = fm->head;
+              fm->message_pos = 0;
 
-                       //test if ack 0 was already received
-                       while (akt != NULL){
-                               //if fragment is present, take next
-                               if (akt->fragment_num == fm->message_pos) {
-                                       fm->message_pos ++;
-                               }
-                               //next ack is bigger then the fragment number
-                               //in case there is something like this: (acks) 
1, 2, 5, 6, ...
-                               //and we send 3 again, the next number should 
be 4
-                               else if (akt->fragment_num > fm->message_pos) {
-                                       break;
-                               }
+              //test if ack 0 was already received
+              while (akt != NULL)
+                {
+                  //if fragment is present, take next
+                  if (akt->fragment_num == fm->message_pos)
+                    {
+                      fm->message_pos++;
+                    }
+                  //next ack is bigger then the fragment number
+                  //in case there is something like this: (acks) 1, 2, 5, 6, 
...
+                  //and we send 3 again, the next number should be 4
+                  else if (akt->fragment_num > fm->message_pos)
+                    {
+                      break;
+                    }
 
-                               akt = akt->next;
+                  akt = akt->next;
 
-                       }
+                }
 
+            }
 
-               }
+          copyoffset = (WLAN_MTU - sizeof(struct FragmentationHeader))
+              * fm->message_pos;
+          fragheader.fragment_off_or_num = htons(fm->message_pos);
+          fragheader.message_id = htonl(session->message_id_out);
 
-               copyoffset = (WLAN_MTU - sizeof(struct FragmentationHeader)) * 
fm->message_pos;
-               fragheader.fragment_off_or_num = htons(fm->message_pos);
-               fragheader.message_id = htonl(session->message_id_out);
+          // start should be smaller then the packet size
+          GNUNET_assert(copyoffset < fm->message_size);
+          copystart = fm->msg + copyoffset;
 
-               // start should be smaller then the packet size
-               GNUNET_assert(copyoffset < fm->message_size);
-               copystart = fm->msg + copyoffset;
+          //size of the fragment is either the MTU - overhead
+          //or the missing part of the message in case this is the last 
fragment
+          copysize = GNUNET_MIN(fm->message_size - copyoffset,
+              WLAN_MTU - sizeof(struct FragmentationHeader));
+          fragheader.header.size = htons(copysize
+              + sizeof(struct FragmentationHeader));
+          fragheader.header.type = htons(GNUNET_MESSAGE_TYPE_WLAN_FRAGMENT);
 
-               //size of the fragment is either the MTU - overhead
-               //or the missing part of the message in case this is the last 
fragment
-               copysize = GNUNET_MIN(fm->message_size - copyoffset,
-                               WLAN_MTU - sizeof(struct FragmentationHeader));
-               fragheader.header.size = htons(copysize + sizeof(struct 
FragmentationHeader));
-               fragheader.header.type = 
htons(GNUNET_MESSAGE_TYPE_WLAN_FRAGMENT);
+          //get the next missing fragment
+          akt = fm->head;
+          fm->message_pos++;
 
+          //test if ack was already received
+          while (akt != NULL)
+            {
+              //if fragment is present, take next
+              if (akt->fragment_num == fm->message_pos)
+                {
+                  fm->message_pos++;
+                }
+              //next ack is bigger then the fragment number
+              //in case there is something like this: (acks) 1, 2, 5, 6, ...
+              //and we send 3 again, the next number should be 4
+              else if (akt->fragment_num > fm->message_pos)
+                {
+                  break;
+                }
 
-               //get the next missing fragment
-               akt = fm->head;
-               fm->message_pos ++;
+              akt = akt->next;
+            }
+        }
+      else
+        {
+          // there is no need to split
+          copystart = fm->msg;
+          copysize = fm->message_size;
+        }
 
-               //test if ack was already received
-               while (akt != NULL){
-                       //if fragment is present, take next
-                       if (akt->fragment_num == fm->message_pos) {
-                               fm->message_pos ++;
-                       }
-                       //next ack is bigger then the fragment number
-                       //in case there is something like this: (acks) 1, 2, 5, 
6, ...
-                       //and we send 3 again, the next number should be 4
-                       else if (akt->fragment_num > fm->message_pos) {
-                               break;
-                       }
+      size += copysize;
+      size += sizeof(struct RadiotapHeader) + sizeof(struct IeeeHeader)
+          + sizeof(struct GNUNET_MessageHeader);
+      msgheader = GNUNET_malloc(size);
+      msgheader->size = htons(size);
+      msgheader->type = htons(GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA);
 
-                       akt = akt->next;
-               }
-         } else {
-               // there is no need to split
-               copystart = fm->msg;
-               copysize = fm->message_size;
-         }
+      radioHeader = (struct RadiotapHeader*) &msgheader[1];
+      getRadiotapHeader(radioHeader);
 
-       size += copysize;
-       size += sizeof(struct RadiotapHeader) + sizeof(struct IeeeHeader)
-               + sizeof(struct GNUNET_MessageHeader);
-       msgheader = GNUNET_malloc(size);
-       msgheader->size = htons(size);
-       msgheader->type = htons(GNUNET_MESSAGE_TYPE_WLAN_HELPER_DATA);
+      ieeewlanheader = (struct IeeeHeader *) &radioHeader[1];
+      getWlanHeader(ieeewlanheader);
 
-       radioHeader = (struct RadiotapHeader*) &msgheader[1];
-       getRadiotapHeader(radioHeader);
+      //could be faster if content is just send and not copyed before
+      //fragmentheader is needed
+      if (fm->message_size > WLAN_MTU)
+        {
+          fragheader.message_crc = htons(getcrc16(copystart, copysize));
+          memcpy(&ieeewlanheader[1], &fragheader,
+              sizeof(struct FragmentationHeader));
+          fragheaderptr = (struct FragmentationHeader *) &ieeewlanheader[1];
+          memcpy(&fragheaderptr[1], copystart, copysize);
+        }
+      else
+        {
+          memcpy(&ieeewlanheader[1], copystart, copysize);
+        }
 
-       ieeewlanheader = (struct IeeeHeader *) &radioHeader[1];
-       getWlanHeader(ieeewlanheader);
+      bytes = GNUNET_DISK_file_write(plugin->server_stdin_handle, msgheader, 
size);
+      if (bytes == GNUNET_SYSERR){
+        GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
+            _("Error writing to wlan healper. errno == %d, ERROR: %s\n"), 
errno, strerror(errno) );
 
+      }
+      GNUNET_assert(bytes != GNUNET_SYSERR);
 
-       //could be faster if content is just send and not copyed before
-       //fragmentheader is needed
-       if (fm->message_size > WLAN_MTU){
-               fragheader.message_crc = htons(getcrc16(copystart, copysize));
-               memcpy(&ieeewlanheader[1],&fragheader, sizeof(struct 
FragmentationHeader));
-               fragheaderptr = (struct FragmentationHeader *) 
&ieeewlanheader[1];
-               memcpy(&fragheaderptr[1],copystart,copysize);
-       } else {
-               memcpy(&ieeewlanheader[1],copystart,copysize);
-       }
+      if (bytes != size)
+        {
+          finish = GNUNET_malloc(sizeof( struct Finish_send));
+          finish->plugin = plugin;
+          finish->msgheader = (char * ) msgheader + bytes;
+          finish->size = size - bytes;
+          finish->msgstart = msgheader;
 
-       bytes = GNUNET_DISK_file_write(plugin->server_stdin_handle, msgheader, 
size);
-       GNUNET_assert(bytes == size);
+          GNUNET_assert(plugin->server_write_task == GNUNET_SCHEDULER_NO_TASK);
 
-       //check if this was the last fragment of this message, if true then 
queue at the end of the list
-       if (copysize + copyoffset >= fm->message_size){
-               GNUNET_assert(copysize + copyoffset == fm->message_size);
+          plugin->server_write_task = GNUNET_SCHEDULER_add_write_file(
+              GNUNET_TIME_UNIT_FOREVER_REL, plugin->server_stdin_handle,
+              &finish_sending, finish);
 
-               GNUNET_CONTAINER_DLL_remove 
(plugin->pending_Fragment_Messages_head,
-                               plugin->pending_Fragment_Messages_tail, fm);
+        }
+      else
+        {
+          GNUNET_assert(bytes == size);
 
-               
GNUNET_CONTAINER_DLL_insert_tail(plugin->pending_Fragment_Messages_head,
-                               plugin->pending_Fragment_Messages_tail, fm);
-               // if fragments have opimized timeouts
-               //sort_fragment_into_queue(plugin,fm);
+          GNUNET_free(msgheader);
+          check_next_fragment_timeout(plugin);
+        }
 
-       }
-       check_next_fragment_timeout(plugin);
+      //check if this was the last fragment of this message, if true then 
queue at the end of the list
+      if (copysize + copyoffset >= fm->message_size)
+        {
+          GNUNET_assert(copysize + copyoffset == fm->message_size);
 
-  }
+          GNUNET_CONTAINER_DLL_remove (plugin->pending_Fragment_Messages_head,
+              plugin->pending_Fragment_Messages_tail, fm);
+
+          
GNUNET_CONTAINER_DLL_insert_tail(plugin->pending_Fragment_Messages_head,
+              plugin->pending_Fragment_Messages_tail, fm);
+          // if fragments have opimized timeouts
+          //sort_fragment_into_queue(plugin,fm);
+
+        }
+
+    }
 }
 
 
+static void
+finish_sending(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+  struct Finish_send * finish;
+  struct Plugin * plugin;
+  ssize_t bytes;
+
+  finish = cls;
+  plugin = finish->plugin;
+
+  plugin->server_write_task = GNUNET_SCHEDULER_NO_TASK;
+
+  bytes = GNUNET_DISK_file_write(plugin->server_stdin_handle, 
finish->msgheader, finish->size);
+  GNUNET_assert(bytes != GNUNET_SYSERR);
+
+  GNUNET_assert(plugin->server_write_task == GNUNET_SCHEDULER_NO_TASK);
+  if (bytes != finish->size)
+    {
+
+      finish->plugin = plugin;
+      finish->msgheader = finish->msgheader + bytes;
+      finish->size = finish->size - bytes;
+      plugin->server_write_task = GNUNET_SCHEDULER_add_write_file(
+          GNUNET_TIME_UNIT_FOREVER_REL, plugin->server_stdin_handle,
+          &finish_sending, finish);
+    }
+  else
+    {
+      GNUNET_free(finish->msgstart);
+      GNUNET_free(finish);
+      check_next_fragment_timeout(plugin);
+    }
+
+}
+
+int
+getRadiotapHeader(struct RadiotapHeader * Header){
+  return GNUNET_YES;
+};
+
+int
+getWlanHeader(struct IeeeHeader * Header){
+
+  return GNUNET_YES;
+}
+
+
 /**
  * 32bit CRC
  *
@@ -1746,7 +1860,7 @@
           session_light->session = search_session(plugin, session_light->addr);
         }
       session = session_light->session;
-      wlanheader = (struct WlanHeader *) &hdr[1];
+      wlanheader = (struct WlanHeader *) &hdr;
       tempmsg = (char*) &wlanheader[1];
       temp_hdr = (const struct GNUNET_MessageHeader *) &wlanheader[1];
 
@@ -2149,6 +2263,8 @@
       "Adding server_read_task for the wlan-helper\n");
 #endif
 
+  sleep(2);
+
   plugin->server_read_task = GNUNET_SCHEDULER_add_read_file(
       GNUNET_TIME_UNIT_FOREVER_REL, plugin->server_stdout_handle,
       &wlan_plugin_helper_read, plugin);

Added: gnunet/src/transport/test_transport_api_wlan
===================================================================
--- gnunet/src/transport/test_transport_api_wlan                                
(rev 0)
+++ gnunet/src/transport/test_transport_api_wlan        2011-01-23 17:15:21 UTC 
(rev 14229)
@@ -0,0 +1,148 @@
+#! /bin/sh
+
+# test_transport_api_wlan - temporary wrapper script for 
.libs/test_transport_api_wlan
+# Generated by ltmain.sh (GNU libtool) 2.2.6b
+#
+# The test_transport_api_wlan program cannot be directly executed until all 
the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='/bin/sed -e 1s/^X//'
+sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command="(cd /home/david/Dokumente/gnunet/src/transport; { test -z 
\"\${LIBRARY_PATH+set}\" || unset LIBRARY_PATH || { LIBRARY_PATH=; export 
LIBRARY_PATH; }; }; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH 
|| { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z 
\"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; 
export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset 
LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; { test -z 
\"\${LD_LIBRARY_PATH+set}\" || unset LD_LIBRARY_PATH || { LD_LIBRARY_PATH=; 
export LD_LIBRARY_PATH; }; }; 
PATH=/usr/lib64/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/david/bin;
 export PATH; gcc -fno-strict-aliasing -Wall -g -O2 -o \$progdir/\$file 
test_transport_api.o  -L/home/david/lib 
../../src/transport/.libs/libgnunettransport.so 
/home/david/Dokumente/gnunet/src/hello/.libs/libgnunethello.so
  /home/david/Dokumente/gnunet/src/util/.libs/libgnunetutil.so 
../../src/util/.libs/libgnunetutil.so -lgcrypt -lgpg-error -lltdl -lz -lm -ldl 
-Wl,-rpath -Wl,/home/david/Dokumente/gnunet/src/transport/.libs -Wl,-rpath 
-Wl,/home/david/Dokumente/gnunet/src/hello/.libs -Wl,-rpath 
-Wl,/home/david/Dokumente/gnunet/src/util/.libs -Wl,-rpath -Wl,/home/david/lib)"
+
+# This environment variable determines our operation mode.
+if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then
+  # install mode needs the following variables:
+  generated_by_libtool_version='2.2.6b'
+  notinst_deplibs=' ../../src/transport/libgnunettransport.la 
/home/david/Dokumente/gnunet/src/hello/libgnunethello.la 
/home/david/Dokumente/gnunet/src/util/libgnunetutil.la 
../../src/util/libgnunetutil.la'
+else
+  # When we are sourced in execute mode, $file and $ECHO are already set.
+  if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
+    ECHO="echo"
+    file="$0"
+    # Make sure echo works.
+    if test "X$1" = X--no-reexec; then
+      # Discard the --no-reexec flag, and continue.
+      shift
+    elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
+      # Yippee, $ECHO works!
+      :
+    else
+      # Restart under the correct shell, and then maybe $ECHO will work.
+      exec /bin/sh "$0" --no-reexec ${1+"$@"}
+    fi
+  fi
+
+  # Find the directory that this script lives in.
+  thisdir=`$ECHO "X$file" | $Xsed -e 's%/[^/]*$%%'`
+  test "x$thisdir" = "x$file" && thisdir=.
+
+  # Follow symbolic links until we get to the real thisdir.
+  file=`ls -ld "$file" | /bin/sed -n 's/.*-> //p'`
+  while test -n "$file"; do
+    destdir=`$ECHO "X$file" | $Xsed -e 's%/[^/]*$%%'`
+
+    # If there was a directory component, then change thisdir.
+    if test "x$destdir" != "x$file"; then
+      case "$destdir" in
+      [\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;;
+      *) thisdir="$thisdir/$destdir" ;;
+      esac
+    fi
+
+    file=`$ECHO "X$file" | $Xsed -e 's%^.*/%%'`
+    file=`ls -ld "$thisdir/$file" | /bin/sed -n 's/.*-> //p'`
+  done
+
+
+  # Usually 'no', except on cygwin/mingw when embedded into
+  # the cwrapper.
+  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no
+  if test "$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR" = "yes"; then
+    # special case for '.'
+    if test "$thisdir" = "."; then
+      thisdir=`pwd`
+    fi
+    # remove .libs from thisdir
+    case "$thisdir" in
+    *[\\/].libs ) thisdir=`$ECHO "X$thisdir" | $Xsed -e 's%[\\/][^\\/]*$%%'` ;;
+    .libs )   thisdir=. ;;
+    esac
+  fi
+
+  # Try to get the absolute directory name.
+  absdir=`cd "$thisdir" && pwd`
+  test -n "$absdir" && thisdir="$absdir"
+
+  program=lt-'test_transport_api_wlan'
+  progdir="$thisdir/.libs"
+
+  if test ! -f "$progdir/$program" ||
+     { file=`ls -1dt "$progdir/$program" "$progdir/../$program" 2>/dev/null | 
/bin/sed 1q`; \
+       test "X$file" != "X$progdir/$program"; }; then
+
+    file="$$-$program"
+
+    if test ! -d "$progdir"; then
+      mkdir "$progdir"
+    else
+      rm -f "$progdir/$file"
+    fi
+
+    # relink executable if necessary
+    if test -n "$relink_command"; then
+      if relink_command_output=`eval $relink_command 2>&1`; then :
+      else
+       echo "$relink_command_output" >&2
+       rm -f "$progdir/$file"
+       exit 1
+      fi
+    fi
+
+    mv -f "$progdir/$file" "$progdir/$program" 2>/dev/null ||
+    { rm -f "$progdir/$program";
+      mv -f "$progdir/$file" "$progdir/$program"; }
+    rm -f "$progdir/$file"
+  fi
+
+  if test -f "$progdir/$program"; then
+    if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then
+      # Run the actual program with our arguments.
+
+      exec "$progdir/$program" ${1+"$@"}
+
+      $ECHO "$0: cannot exec $program $*" 1>&2
+      exit 1
+    fi
+  else
+    # The program doesn't exist.
+    $ECHO "$0: error: \`$progdir/$program' does not exist" 1>&2
+    $ECHO "This script is just a wrapper for $program." 1>&2
+    echo "See the libtool documentation for more information." 1>&2
+    exit 1
+  fi
+fi


Property changes on: gnunet/src/transport/test_transport_api_wlan
___________________________________________________________________
Added: svn:executable
   + *




reply via email to

[Prev in Thread] Current Thread [Next in Thread]