/**
* scaling factor for hello beacon
*/
-#define HALLO_BEACON_SCALING_FACTOR 1
+#define HELLO_BEACON_SCALING_FACTOR 30
/**
* max size of fragment queue
/**
* DEBUG switch
*/
-#define DEBUG_wlan GNUNET_YES
-#define DEBUG_wlan_retransmission GNUNET_NO
+#define DEBUG_wlan GNUNET_EXTRA_LOGGING
+#define DEBUG_wlan_retransmission GNUNET_EXTRA_LOGGING
#define DEBUG_wlan_ip_udp_packets_on_air GNUNET_NO
-#define DEBUG_wlan_msg_dump GNUNET_NO
+#define DEBUG_wlan_msg_dump GNUNET_EXTRA_LOGGING
#define IEEE80211_ADDR_LEN 6 /* size of 802.11 address */
u_int8_t i_addr3[IEEE80211_ADDR_LEN];
u_int8_t i_seq[2];
u_int8_t llc[4];
-#if DEBUG_wlan_ip_udp_packets_on_air
+#if DEBUG_wlan_ip_udp_packets_on_air > 1
struct iph ip;
struct udphdr udp;
#endif
while (queue != NULL)
{
- GNUNET_assert (queue->sessions_head != NULL);
+ //GNUNET_assert (queue->sessions_head != NULL);
if (memcmp (addr, &queue->addr, sizeof (struct MacAddress)) == 0)
return queue; /* session found */
queue = queue->next;
GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (),
GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS,
- HALLO_BEACON_SCALING_FACTOR));
+ HELLO_BEACON_SCALING_FACTOR));
}
//under 30 known peers: every 10 seconds
else if (plugin->mac_count < 30)
GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (),
GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS,
- 10 * HALLO_BEACON_SCALING_FACTOR));
+ 10 * HELLO_BEACON_SCALING_FACTOR));
}
//over 30 known peers: once a minute
else
GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (),
GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_MINUTES,
- HALLO_BEACON_SCALING_FACTOR));
+ HELLO_BEACON_SCALING_FACTOR));
}
}
Header->llc[0] = WLAN_LLC_DSAP_FIELD;
Header->llc[1] = WLAN_LLC_SSAP_FIELD;
-#if DEBUG_wlan_ip_udp_packets_on_air
+#if DEBUG_wlan_ip_udp_packets_on_air > 1
uint crc = 0;
uint16_t *x;
int count;
struct GNUNET_MessageHeader *msgheader2;
uint16_t size;
-#if DEBUG_wlan_retransmission
- GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
+#if DEBUG_wlan_retransmission > 1
+ GNUNET_loHELLO_BEACON_SCALING_FACTORg_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
"Adding fragment of message %p to send, session %p, endpoint %p, type %u\n",
fm, fm->session, endpoint, hdr->type);
#endif
}
/**
- * function to send a hallo beacon
+ * function to send a hello beacon
* @param plugin pointer to the plugin struct
*/
static void
uint16_t size;
ssize_t bytes;
- uint16_t hallo_size;
+ uint16_t hello_size;
struct GNUNET_MessageHeader *msgheader;
struct ieee80211_frame *ieeewlanheader;
struct Radiotap_Send *radioHeader;
GNUNET_STATISTICS_update (plugin->env->stats, _("# wlan hello beacons send"), 1, GNUNET_NO);
hello = plugin->env->get_our_hello ();
- hallo_size = GNUNET_HELLO_size ((struct GNUNET_HELLO_Message *) hello);
- GNUNET_assert (sizeof (struct WlanHeader) + hallo_size <= WLAN_MTU);
+ hello_size = GNUNET_HELLO_size ((struct GNUNET_HELLO_Message *) hello);
+ GNUNET_assert (sizeof (struct WlanHeader) + hello_size <= WLAN_MTU);
size =
sizeof (struct GNUNET_MessageHeader) + sizeof (struct Radiotap_Send) +
- sizeof (struct ieee80211_frame) + hallo_size;
+ sizeof (struct ieee80211_frame) + hello_size;
msgheader = GNUNET_malloc (size);
msgheader->size = htons (size);
sizeof (struct GNUNET_MessageHeader));
msgheader2->type = htons (GNUNET_MESSAGE_TYPE_WLAN_ADVERTISEMENT);*/
- memcpy (msgheader2, hello, hallo_size);
+ memcpy (msgheader2, hello, hello_size);
bytes = GNUNET_DISK_file_write (plugin->server_stdin_handle, msgheader, size);
GNUNET_CONTAINER_DLL_insert_tail (plugin->ack_send_queue_head,
plugin->ack_send_queue_tail, ack);
-#if DEBUG_wlan_retransmission
+#if DEBUG_wlan_retransmission > 1
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
"Adding ack with message id %u to send, AckSendQueue %p, endpoint %p\n",
msg_id, ack, endpoint);
if (session != NULL)
{
pm = session->pending_message_head;
+ GNUNET_assert (pm != NULL);
GNUNET_CONTAINER_DLL_remove (session->pending_message_head,
session->pending_message_tail, pm);
session->mac->fragment_messages_out_count++;
session->fragment_messages_out_count++;
plugin->pending_Fragment_Messages++;
- GNUNET_assert (pm != NULL);
fm = GNUNET_malloc (sizeof (struct FragmentMessage));
fm->session = session;
_
("Error writing to wlan healper. errno == %d, ERROR: %s\n"),
errno, strerror (errno));
-
+ //TODO START NEW WLAN HELPER
+ /*
+ * alle sessions beenden
+ * neu starten (alle 5 sec)
+ * alles bis dahin ablehnen
+ */
}
- GNUNET_assert (bytes != GNUNET_SYSERR);
+ //GNUNET_assert (bytes != GNUNET_SYSERR);
if (bytes != fm->size)
{
if (session->pending_message_head != NULL)
{
newmsg = session->pending_message_head;
- GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, PLUGIN_LOG_NAME,
+ GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
"wlan_plugin_send: a pending message is already in the queue for this client\n remaining time to send this message is %u, queued fragment messages for this mac connection %u\n",
GNUNET_TIME_absolute_get_remaining (newmsg->
timeout).rel_value,
"New message for %p with size (incl wlan header) %u added\n",
session, newmsg->message_size);
#endif
-#if DEBUG_wlan_msg_dump
+#if DEBUG_wlan_msg_dump > 1
hexdump (msgbuf, GNUNET_MIN (msgbuf_size, 256));
#endif
//queue session
GNUNET_CONTAINER_DLL_remove (endpoint->sessions_head, endpoint->sessions_tail,
queue);
-
+ //Check that no ohter session on this endpoint for this session exits
+ GNUNET_assert(search_session(plugin, endpoint, &queue->content->target) == NULL);
if (endpoint->sessions_head == NULL && do_free_macendpoint == GNUNET_YES)
{
free_macendpoint (plugin, endpoint);
+ //check if no endpoint with the same address exists
+ GNUNET_assert(get_macendpoint(plugin, &endpoint->addr, GNUNET_NO) == NULL);
}
if (queue->content->timeout_task != GNUNET_SCHEDULER_NO_TASK)
GNUNET_SCHEDULER_cancel (queue->content->timeout_task);
GNUNET_free (queue);
+
check_fragment_queue (plugin);
}
struct Session *session = (struct Session *) client;
struct Plugin *plugin = (struct Plugin *) cls;
- struct GNUNET_TRANSPORT_ATS_Information distance[2];
+ struct GNUNET_ATS_Information distance;
- distance[0].type = htonl (GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE);
- distance[0].value = htonl (1);
- distance[1].type = htonl (GNUNET_TRANSPORT_ATS_ARRAY_TERMINATOR);
- distance[1].value = htonl (0);
+ distance.type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE);
+ distance.value = htonl (1);
#if DEBUG_wlan
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
#endif
plugin->env->receive (plugin->env->cls, &(session->target), hdr,
- (const struct GNUNET_TRANSPORT_ATS_Information *)
- &distance, 2, session,
+ (const struct GNUNET_ATS_Information *)
+ &distance, 1, session,
(const char *) &session->mac->addr,
sizeof (session->mac->addr));
}
{
session_light->session = create_session (plugin, session_light->macendpoint, &tmpsource);
}
- GNUNET_STATISTICS_update (plugin->env->stats, _("# wlan hallo messages received"), 1, GNUNET_NO);
+ GNUNET_STATISTICS_update (plugin->env->stats, _("# wlan hello messages received"), 1, GNUNET_NO);
plugin->env->receive(plugin->env->cls,&session_light->session->target,hdr, NULL, 0, session_light->session,
(const char *) &session_light->session->mac->addr,
sizeof (session_light->session->mac->addr));
if (ret == GNUNET_OK)
{
-#if DEBUG_wlan_retransmission
+#if DEBUG_wlan_retransmission > 1
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
"Got last ack, finished fragment message %p\n", fm);
#endif
}
if (ret == GNUNET_NO)
{
-#if DEBUG_wlan_retransmission
+#if DEBUG_wlan_retransmission > 1
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
"Got ack for: %p\n", fm);
#endif
fm = fm2;
}
-#if DEBUG_wlan_retransmission
+#if DEBUG_wlan_retransmission > 1
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, PLUGIN_LOG_NAME,
"WLAN fragment not in fragment list\n");
#endif
ntohs (hdr->type), ntohs (hdr->size));
#endif
-#if DEBUG_wlan_msg_dump
+#if DEBUG_wlan_msg_dump > 1
hexdump (hdr, GNUNET_MIN (ntohs (hdr->size), 256));
#endif
GNUNET_break (0);