Added a #define option to send more data than needed to be able to test fragmentation

This commit is contained in:
adamdunkels 2010-02-06 09:58:59 +00:00
parent 9011013fb0
commit 99db24ec2d

View file

@ -30,6 +30,7 @@
#include "contiki.h" #include "contiki.h"
#include "contiki-lib.h" #include "contiki-lib.h"
#include "contiki-net.h" #include "contiki-net.h"
#include "net/uip-netif.h"
#include <string.h> #include <string.h>
@ -46,7 +47,6 @@
#endif #endif
#define UDP_NB 5 #define UDP_NB 5
#define UDP_MAX_DATA_LEN 32
static struct etimer udp_periodic_timer; static struct etimer udp_periodic_timer;
@ -78,7 +78,11 @@ udphandler(process_event_t ev, process_data_t data)
printf("Sender sending to: "); printf("Sender sending to: ");
PRINT6ADDR(&udpconn->ripaddr); PRINT6ADDR(&udpconn->ripaddr);
printf("\n"); printf("\n");
#if SEND_TOO_LARGE_PACKET_TO_TEST_FRAGMENTATION
uip_udp_packet_send(udpconn, "Sender says Hi!", UIP_APPDATA_SIZE);
#else /* SEND_TOO_LARGE_PACKET_TO_TEST_FRAGMENTATION */
uip_udp_packet_send(udpconn, "Sender says Hi!", strlen("Sender says Hi!")); uip_udp_packet_send(udpconn, "Sender says Hi!", strlen("Sender says Hi!"));
#endif /* SEND_TOO_LARGE_PACKET_TO_TEST_FRAGMENTATION */
} }
etimer_set(&udp_periodic_timer, 13*CLOCK_SECOND + random_rand()%(4*CLOCK_SECOND)); etimer_set(&udp_periodic_timer, 13*CLOCK_SECOND + random_rand()%(4*CLOCK_SECOND));