- if (addrlen != 6)
- {
- /* invalid address (MAC addresses have 6 bytes) */
- GNUNET_break (0);
- return NULL;
- }
- input = (const unsigned char*) addr;
- GNUNET_snprintf(ret, sizeof(ret), "%s Mac-Address %.2X:%.2X:%.2X:%.2X:%.2X:%.2X",
- PROTOCOL_PREFIX, input[0], input[1], input[2], input[3], input[4],
- input[5]);
- return ret;
-}
-
-/**
- * Function to test if fragment number already exists in the fragments received
- *
- * @param session session the fragment belongs to
- * @param fh Fragmentheader of the fragment
- * @return GNUNET_YES if fragment exists already, GNUNET_NO if it does not exists in the queue of the session
- */
-
-static const int
-is_double_msg(struct Session * session, struct FragmentationHeader * fh)
-{
- struct RecQueue * rec_queue = session->frag_head;
- while (rec_queue != NULL)
- {
- if (rec_queue->num == fh->fragment_off_or_num)
- {
- return GNUNET_YES;
- }
- rec_queue = rec_queue->next;
-
- }
- return GNUNET_NO;
-}
-
-/**
- * Function to insert a fragment in a queue of a session
- * @param session session the fragment belongs to
- * @param rec_queue fragment to add
- */
-
-static void
-insert_fragment_in_queue(struct Session * session, struct RecQueue * rec_queue)
-{
- struct RecQueue * rec_queue2 = session->frag_head;
- struct WlanHeader * wlanheader = NULL;
- //first received fragment of message
- if (session->rec_size == NO_MESSAGE_OR_MESSAGE_FINISHED)
- {
- session->rec_size = MESSAGE_LENGHT_UNKNOWN;
- }
- //this is the first fragment of the message (fragment id 0)
- if (rec_queue->num == 0)
- {
- wlanheader = (struct WlanHeader *) rec_queue->msg;
- session->rec_size = ntohs(wlanheader->header.size);
- }
-
- //sort into list
- while (rec_queue2 != NULL)
- {
- if (rec_queue2->num > rec_queue->num)
- {
- //next element number is grater than the current num
- GNUNET_CONTAINER_DLL_insert_before(session->frag_head, session->frag_tail, rec_queue2, rec_queue);
- return;
- }
- rec_queue = rec_queue->next;
- }
- //no element has a grater number
- GNUNET_CONTAINER_DLL_insert_tail(session->frag_head, session->frag_tail, rec_queue);
-}
-
-/**
- * Function to dispose the fragments received for a message
- * @param session session to free the fragments from
- */
-
-static void
-free_rec_frag_queue(struct Session * session)
-{
- struct RecQueue * rec_queue = session->frag_head;
- struct RecQueue * rec_queue2;
- while (rec_queue != NULL)
- {
- rec_queue2 = rec_queue;
- rec_queue = rec_queue->next;
- GNUNET_free(rec_queue2);
- }
- session->frag_head = NULL;
- session->frag_tail = NULL;
- session->rec_size = NO_MESSAGE_OR_MESSAGE_FINISHED;
-}
-
-/**
- * Function to check if all fragments of a message have been received
- * @param plugin the plugin handle
- * @param session_light information of the message sender
- * @param session session the message belongs to
- */
-
-static void
-check_rec_finished_msg(struct Plugin* plugin,
- struct Session_light * session_light, struct Session * session)
-{
- struct RecQueue * rec_queue = session->frag_head;
- int packetsize = session->rec_size;
- int sum = 0;
- int aktnum = 0;
- char * msg;
- //some fragment should be received
- GNUNET_assert(session->rec_size != NO_MESSAGE_OR_MESSAGE_FINISHED);
- //check if first fragment is present
- if (session->rec_size == MESSAGE_LENGHT_UNKNOWN)
- {
- return;
- }
- while (rec_queue != NULL)
- {
- sum += rec_queue->size;
- //check if all fragment numbers are present
- if (rec_queue->num != aktnum)
- {
- return;
- }
- aktnum++;
- rec_queue = rec_queue->next;
- }
- //sum should always be smaller or equal of
- GNUNET_assert(sum <= packetsize);
- if (sum == packetsize)
- {
-
+ if (addrlen != sizeof (struct MacAddress))
+ {
+ /* invalid address (MAC addresses have 6 bytes) */
+ //GNUNET_break (0);
+#if DEBUG_wlan
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
+ "Func wlan_plugin_address_pretty_printer got size: %u, worng size!\n",
+ addrlen);
+#endif
+ asc (asc_cls, NULL);
+ return;
+ }
+ input = (const unsigned char *) addr;
+ GNUNET_asprintf (&ret,
+ "Transport %s: %s Mac-Address %.2X:%.2X:%.2X:%.2X:%.2X:%.2X",
+ type, PROTOCOL_PREFIX, input[0], input[1], input[2],
+ input[3], input[4], input[5]);