Patrick Barrett / libexositecoap
Revision:
23:e94087cd483d
Parent:
20:e98884244926
Child:
24:cfbd25fc62c4
diff -r 6a6810897eb9 -r e94087cd483d src/exosite.c
--- a/src/exosite.c	Tue Jan 06 10:08:06 2015 -0600
+++ b/src/exosite.c	Tue Jan 06 11:22:43 2015 -0600
@@ -62,6 +62,9 @@
 static uint16_t message_id_counter;
 static exo_device_state device_state = EXO_STATE_UNINITIALIZED;
 
+// Internal Constants
+static const int MINIMUM_DATAGRAM_SIZE = 576; // RFC791: all hosts must accept minimum of 576 octets
+
 /*!
  * \brief  Initializes the Exosite library
  *
@@ -290,13 +293,13 @@
 
 static void exo_process_waiting_datagrams(exo_op *op, uint8_t count)
 {
-  uint8_t buf[576];
+  uint8_t buf[MINIMUM_DATAGRAM_SIZE];
   coap_pdu pdu;
   coap_payload payload;
   int i;
 
   pdu.buf = buf;
-  pdu.max = 576;
+  pdu.max = MINIMUM_DATAGRAM_SIZE;
   pdu.len = 0;
 
   // receive a UDP packet if one or more waiting
@@ -431,13 +434,13 @@
 // process all ops that are in an active state
 static void exo_process_active_ops(exo_op *op, uint8_t count)
 {
-  uint8_t buf[576];
+  uint8_t buf[MINIMUM_DATAGRAM_SIZE];
   coap_pdu pdu;
   int i;
   uint64_t now = exopal_get_time();
 
   pdu.buf = buf;
-  pdu.max = 576;
+  pdu.max = MINIMUM_DATAGRAM_SIZE;
   pdu.len = 0;
 
   for (i = 0; i < count; i++) {