#include "gnunet_crypto_lib.h"
#include "gnunet_fragmentation_lib.h"
#include "gnunet_constants.h"
-//#include "wlan/ieee80211.h"
-//#include <netinet/ip.h>
#include <string.h>
/**
* Session infos gathered from a messages
*/
-
struct Session_light
{
/**
/**
* Struct for Messages in the fragment queue
*/
-
struct FragmentMessage
{
/**
* Session this message belongs to
*/
-
struct Session *session;
/**
static void
do_transmit (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
+
static void
free_session (struct Plugin *plugin, struct Sessionqueue *queue,
int do_free_macendpoint);
+
static struct MacEndpoint *
create_macendpoint (struct Plugin *plugin, const struct MacAddress *addr);
* @param peer peer identity to use for this session
* @return returns the session
*/
-
static struct Session *
create_session (struct Plugin *plugin, struct MacEndpoint *endpoint,
const struct GNUNET_PeerIdentity *peer)
* Function to calculate the time of the next periodic "hello-beacon"
* @param plugin pointer to the plugin struct
*/
-
static void
set_next_beacon_time (struct Plugin *const plugin)
{
* Function to set the timer for the next timeout of the fragment queue
* @param plugin the handle to the plugin struct
*/
-
static void
set_next_send (struct Plugin *const plugin)
{
return GNUNET_YES;
}
-/**
- * 32bit CRC
- *
- * @param msgbuf pointer tor the data
- * @param msgbuf_size size of the data
- *
- * @return 32bit crc value
- */
-
-uint32_t
-getcrc32 (const char *msgbuf, size_t msgbuf_size)
-{
-
- return GNUNET_CRYPTO_crc32_n (msgbuf, msgbuf_size);;
-}
-
-/**
- * 16bit CRC
- *
- * @param msgbuf pointer tor the data
- * @param msgbuf_size size of the data
- *
- * @return 16bit crc value
- */
-
-uint16_t
-getcrc16 (const char *msgbuf, size_t msgbuf_size)
-{
- //TODO calc some crc
- return 0;
-}
/**
* function to add a fragment of a message to send
* @param cls FragmentMessage this message belongs to
* @param hdr pointer to the start of the message
*/
-
-void
+static void
add_message_for_send (void *cls, const struct GNUNET_MessageHeader *hdr)
{
* @param hdr pointer to the hdr where the ack is stored
*
*/
-
static void
add_ack_for_send (void *cls, uint32_t msg_id,
const struct GNUNET_MessageHeader *hdr)
wlanheader->crc = 0;
memcpy (&wlanheader[1], msgbuf, msgbuf_size);
wlanheader->crc =
- htonl (getcrc32
+ htonl (GNUNET_CRYPTO_crc32_n
((char *) wlanheader, msgbuf_size + sizeof (struct WlanHeader)));
- //GNUNET_log_from(GNUNET_ERROR_TYPE_INFO, PLUGIN_LOG_NAME, "Wlan message Header crc: %u, %u\n",getcrc32((char*) wlanheader, msgbuf_size + sizeof(struct WlanHeader)), wlanheader->crc);
- //hexdump(newmsg->msg, msgbuf_size + sizeof(struct WlanHeader));
newmsg->transmit_cont = cont;
newmsg->transmit_cont_cls = cont_cls;
temp_hdr = (const struct GNUNET_MessageHeader *) &wlanheader[1];
crc = ntohl (wlanheader->crc);
wlanheader->crc = 0;
- if (getcrc32 ((char *) wlanheader, ntohs (wlanheader->header.size)) != crc)
+ if (GNUNET_CRYPTO_crc32_n ((char *) wlanheader, ntohs (wlanheader->header.size)) != crc)
{
//wrong crc, dispose message
GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, PLUGIN_LOG_NAME,
"Wlan message header crc was wrong: %u != %u\n",
- getcrc32 ((char *) wlanheader,
- ntohs (wlanheader->header.size)), crc);
+ GNUNET_CRYPTO_crc32_n ((char *) wlanheader,
+ ntohs (wlanheader->header.size)), crc);
hexdump ((void *) hdr, ntohs (hdr->size));
return;
}
}
+#if DEBUG_wlan
/**
* Function to print mac addresses nice *
* @param pointer to 6 byte with the mac address
* @return pointer to the chars which hold the print out
*/
-const char *
+static const char *
macprinter (const u_int8_t * mac)
{
static char macstr[20];
mac[2], mac[3], mac[4], mac[5]);
return macstr;
}
+#endif
/**
* Function for the scheduler if a mac endpoint times out