Fork for fixes

Revision:
8:4acb22344932
Parent:
4:d774541a34da
Child:
9:a156d3de5647
diff -r 1bc7e6120801 -r 4acb22344932 utility/uip.h
--- a/utility/uip.h	Tue Apr 26 18:37:14 2016 +0000
+++ b/utility/uip.h	Fri Jun 30 19:51:28 2017 +0000
@@ -1,21 +1,19 @@
 
-/**
+   /**
  * \addtogroup uip
  * @{
  */
 
 /**
  * \file
- * Header file for the uIP TCP/IP stack.
+ * Header file for the UIP TCP/IP stack.
  * \author Adam Dunkels <adam@dunkels.com>
  *
- * The uIP TCP/IP stack header file contains definitions for a number
- * of C macros that are used by uIP programs as well as internal uIP
+ * The UIP TCP/IP stack header file contains definitions for a number
+ * of C macros that are used by UIP programs as well as internal UIP
  * structures, TCP/IP header structures and function declarations.
  *
  */
-
-
 /*
  * Copyright (c) 2001-2003, Adam Dunkels.
  * All rights reserved.
@@ -44,12 +42,11 @@
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * This file is part of the uIP TCP/IP stack.
+ * This file is part of the UIP TCP/IP stack.
  *
  * $Id: uip.h,v 1.40 2006/06/08 07:12:07 adam Exp $
  *
  */
-
 #ifndef __UIP_H__
 #define __UIP_H__
 
@@ -59,26 +56,28 @@
  * Repressentation of an IP address.
  *
  */
+
 typedef u16_t uip_ip4addr_t[2];
-typedef u16_t uip_ip6addr_t[8];
+typedef u16_t           uip_ip6addr_t[8];
 #if UIP_CONF_IPV6
-typedef uip_ip6addr_t uip_ipaddr_t;
+typedef uip_ip6addr_t   uip_ipaddr_t;
 #else /* UIP_CONF_IPV6 */
-typedef uip_ip4addr_t uip_ipaddr_t;
+
+typedef uip_ip4addr_t   uip_ipaddr_t;
 #endif /* UIP_CONF_IPV6 */
 
 /*---------------------------------------------------------------------------*/
+
 /* First, the functions that should be called from the
  * system. Initialization, the periodic timer and incoming packets are
  * handled by the following three functions.
  */
-
 /**
- * \defgroup uipconffunc uIP configuration functions
+ * \defgroup uipconffunc UIP configuration functions
  * @{
  *
- * The uIP configuration functions are used for setting run-time
- * parameters in uIP such as IP addresses.
+ * The UIP configuration functions are used for setting run-time
+ * parameters in UIP such as IP addresses.
  */
 
 /**
@@ -103,7 +102,7 @@
  *
  * \hideinitializer
  */
-#define uip_sethostaddr(addr) uip_ipaddr_copy(uip_hostaddr, (addr))
+#define uip_sethostaddr(addr)   uip_ipaddr_copy(uip_hostaddr, (addr))
 
 /**
  * Get the IP address of this host.
@@ -123,7 +122,8 @@
  *
  * \hideinitializer
  */
-#define uip_gethostaddr(addr) uip_ipaddr_copy((addr), uip_hostaddr)
+
+#define uip_gethostaddr(addr)   uip_ipaddr_copy((addr), uip_hostaddr)
 
 /**
  * Set the default router's IP address.
@@ -135,6 +135,7 @@
  *
  * \hideinitializer
  */
+
 #define uip_setdraddr(addr) uip_ipaddr_copy(uip_draddr, (addr))
 
 /**
@@ -147,8 +148,8 @@
  *
  * \hideinitializer
  */
-#define uip_setnetmask(addr) uip_ipaddr_copy(uip_netmask, (addr))
 
+#define uip_setnetmask(addr)    uip_ipaddr_copy(uip_netmask, (addr))
 
 /**
  * Get the default router's IP address.
@@ -158,6 +159,7 @@
  *
  * \hideinitializer
  */
+
 #define uip_getdraddr(addr) uip_ipaddr_copy((addr), uip_draddr)
 
 /**
@@ -168,40 +170,40 @@
  *
  * \hideinitializer
  */
-#define uip_getnetmask(addr) uip_ipaddr_copy((addr), uip_netmask)
+
+#define uip_getnetmask(addr)    uip_ipaddr_copy((addr), uip_netmask)
 
 /** @} */
 
 /**
- * \defgroup uipinit uIP initialization functions
+ * \defgroup uipinit UIP initialization functions
  * @{
  *
- * The uIP initialization functions are used for booting uIP.
+ * The UIP initialization functions are used for booting UIP.
  */
+/**
+ * UIP initialization function.
+ *
+ * This function should be called at boot up to initilize the UIP
+ * TCP/IP stack.
+ */
+void    uip_init(void);
 
 /**
- * uIP initialization function.
- *
- * This function should be called at boot up to initilize the uIP
- * TCP/IP stack.
- */
-void uip_init(void);
-
-/**
- * uIP initialization function.
+ * UIP initialization function.
  *
  * This function may be used at boot time to set the initial ip_id.
  */
-void uip_setipid(u16_t id);
+void    uip_setipid(u16_t id);
 
 /** @} */
 
 /**
- * \defgroup uipdevfunc uIP device driver functions
+ * \defgroup uipdevfunc UIP device driver functions
  * @{
  *
  * These functions are used by a network device driver for interacting
- * with uIP.
+ * with UIP.
  */
 
 /**
@@ -229,9 +231,9 @@
   }
  \endcode
  *
- * \note If you are writing a uIP device driver that needs ARP
- * (Address Resolution Protocol), e.g., when running uIP over
- * Ethernet, you will need to call the uIP ARP code before calling
+ * \note If you are writing a UIP device driver that needs ARP
+ * (Address Resolution Protocol), e.g., when running UIP over
+ * Ethernet, you will need to call the UIP ARP code before calling
  * this function:
  \code
   #define BUF ((struct uip_eth_hdr *)&uip_buf[0])
@@ -254,18 +256,18 @@
  *
  * \hideinitializer
  */
-#define uip_input()        uip_process(UIP_DATA)
+#define uip_input() uip_process(UIP_DATA)
 
 /**
  * Periodic processing for a connection identified by its number.
  *
  * This function does the necessary periodic processing (timers,
- * polling) for a uIP TCP conneciton, and should be called when the
- * periodic uIP timer goes off. It should be called for every
+ * polling) for a UIP TCP conneciton, and should be called when the
+ * periodic UIP timer goes off. It should be called for every
  * connection, regardless of whether they are open of closed.
  *
  * When the function returns, it may have an outbound packet waiting
- * for service in the uIP packet buffer, and if so the uip_len
+ * for service in the UIP packet buffer, and if so the uip_len
  * variable is set to a value larger than zero. The device driver
  * should be called to send out the packet.
  *
@@ -280,8 +282,8 @@
   }
  \endcode
  *
- * \note If you are writing a uIP device driver that needs ARP
- * (Address Resolution Protocol), e.g., when running uIP over
+ * \note If you are writing a UIP device driver that needs ARP
+ * (Address Resolution Protocol), e.g., when running UIP over
  * Ethernet, you will need to call the uip_arp_out() function before
  * calling the device driver:
  \code
@@ -298,14 +300,19 @@
  *
  * \hideinitializer
  */
-#define uip_periodic(conn) do { uip_conn = &uip_conns[conn]; \
-                                uip_process(UIP_TIMER); } while (0)
+
+#define uip_periodic(conn) \
+    do { \
+        uip_conn = &uip_conns[conn]; \
+        uip_process(UIP_TIMER); \
+    } while (0)
 
 /**
  *
  *
  */
-#define uip_conn_active(conn) (uip_conns[conn].tcpstateflags != UIP_CLOSED)
+
+#define uip_conn_active(conn)   (uip_conns[conn].tcpstateflags != UIP_CLOSED)
 
 /**
  * Perform periodic processing for a connection identified by a pointer
@@ -320,8 +327,12 @@
  *
  * \hideinitializer
  */
-#define uip_periodic_conn(conn) do { uip_conn = conn; \
-                                     uip_process(UIP_TIMER); } while (0)
+
+#define uip_periodic_conn(conn) \
+    do { \
+        uip_conn = conn; \
+        uip_process(UIP_TIMER); \
+    } while (0)
 
 /**
  * Reuqest that a particular connection should be polled.
@@ -334,11 +345,14 @@
  *
  * \hideinitializer
  */
-#define uip_poll_conn(conn) do { uip_conn = conn; \
-                                 uip_process(UIP_POLL_REQUEST); } while (0)
 
+#define uip_poll_conn(conn) \
+    do { \
+        uip_conn = conn; \
+        uip_process(UIP_POLL_REQUEST); \
+    } while (0)
+#if UIP_UDP
 
-#if UIP_UDP
 /**
  * Periodic processing for a UDP connection identified by its number.
  *
@@ -355,7 +369,7 @@
  \endcode
  *
  * \note As for the uip_periodic() function, special care has to be
- * taken when using uIP together with ARP and Ethernet:
+ * taken when using UIP together with ARP and Ethernet:
  \code
   for(i = 0; i < UIP_UDP_CONNS; i++) {
     uip_udp_periodic(i);
@@ -370,8 +384,12 @@
  *
  * \hideinitializer
  */
-#define uip_udp_periodic(conn) do { uip_udp_conn = &uip_udp_conns[conn]; \
-                                uip_process(UIP_UDP_TIMER); } while (0)
+
+#define uip_udp_periodic(conn) \
+    do { \
+        uip_udp_conn = &uip_udp_conns[conn]; \
+        uip_process(UIP_UDP_TIMER); \
+    } while (0)
 
 /**
  * Periodic processing for a UDP connection identified by a pointer to
@@ -387,14 +405,16 @@
  *
  * \hideinitializer
  */
-#define uip_udp_periodic_conn(conn) do { uip_udp_conn = conn; \
-                                         uip_process(UIP_UDP_TIMER); } while (0)
 
-
+#define uip_udp_periodic_conn(conn) \
+    do { \
+        uip_udp_conn = conn; \
+        uip_process(UIP_UDP_TIMER); \
+    } while (0)
 #endif /* UIP_UDP */
 
-/**
- * The uIP packet buffer.
+                    /**
+ * The UIP packet buffer.
  *
  * The uip_buf array is used to hold incoming and outgoing
  * packets. The device driver should place incoming data into this
@@ -419,22 +439,21 @@
  }
  \endcode
  */
-extern u8_t uip_buf[UIP_BUFSIZE+2];
+                    extern u8_t uip_buf[UIP_BUFSIZE + 2];
 
 /** @} */
 
 /*---------------------------------------------------------------------------*/
-/* Functions that are used by the uIP application program. Opening and
+/* Functions that are used by the UIP application program. Opening and
  * closing connections, sending and receiving data, etc. is all
  * handled by the functions below.
 */
 /**
- * \defgroup uipappfunc uIP application functions
+ * \defgroup uipappfunc UIP application functions
  * @{
  *
- * Functions used by an application running of top of uIP.
+ * Functions used by an application running of top of UIP.
  */
-
 /**
  * Start listening to the specified port.
  *
@@ -447,7 +466,7 @@
  *
  * \param port A 16-bit port number in network byte order.
  */
-void uip_listen(u16_t port);
+void                            uip_listen(u16_t port);
 
 /**
  * Stop listening to the specified port.
@@ -461,7 +480,7 @@
  *
  * \param port A 16-bit port number in network byte order.
  */
-void uip_unlisten(u16_t port);
+void                            uip_unlisten(u16_t port);
 
 /**
  * Connect to a remote host using TCP.
@@ -491,13 +510,11 @@
  *
  * \param port A 16-bit port number in network byte order.
  *
- * \return A pointer to the uIP connection identifier for the new connection,
+ * \return A pointer to the UIP connection identifier for the new connection,
  * or NULL if no connection could be allocated.
  *
  */
-struct uip_conn *uip_connect(uip_ipaddr_t *ripaddr, u16_t port);
-
-
+struct uip_conn*                uip_connect(uip_ipaddr_t* ripaddr, u16_t port);
 
 /**
  * \internal
@@ -508,20 +525,21 @@
  *
  * \hideinitializer
  */
-#define uip_outstanding(conn) ((conn)->len)
+
+#define uip_outstanding(conn)   ((conn)->len)
 
 /**
  * Send data on the current connection.
  *
  * This function is used to send out a single segment of TCP
- * data. Only applications that have been invoked by uIP for event
+ * data. Only applications that have been invoked by UIP for event
  * processing can send data.
  *
  * The amount of data that actually is sent out after a call to this
- * funcion is determined by the maximum amount of data TCP allows. uIP
+ * funcion is determined by the maximum amount of data TCP allows. UIP
  * will automatically crop the data so that only the appropriate
  * amount of data is sent. The function uip_mss() can be used to query
- * uIP for the amount of data that actually will be sent.
+ * UIP for the amount of data that actually will be sent.
  *
  * \note This function does not guarantee that the sent data will
  * arrive at the destination. If the data is lost in the network, the
@@ -535,7 +553,7 @@
  *
  * \hideinitializer
  */
-void uip_send(const void *data, int len);
+void    uip_send(const void* data, int len);
 
 /**
  * The length of any incoming data that is currently avaliable (if avaliable)
@@ -546,8 +564,9 @@
  *
  * \hideinitializer
  */
+
 /*void uip_datalen(void);*/
-#define uip_datalen()       uip_len
+#define uip_datalen()   uip_len
 
 /**
  * The length of any out-of-band data (urgent data) that has arrived
@@ -558,6 +577,7 @@
  *
  * \hideinitializer
  */
+
 #define uip_urgdatalen()    uip_urglen
 
 /**
@@ -567,7 +587,8 @@
  *
  * \hideinitializer
  */
-#define uip_close()         (uip_flags = UIP_CLOSE)
+
+#define uip_close() (uip_flags = UIP_CLOSE)
 
 /**
  * Abort the current connection.
@@ -578,7 +599,8 @@
  *
  * \hideinitializer
  */
-#define uip_abort()         (uip_flags = UIP_ABORT)
+
+#define uip_abort() (uip_flags = UIP_ABORT)
 
 /**
  * Tell the sending host to stop sending data.
@@ -588,7 +610,8 @@
  *
  * \hideinitializer
  */
-#define uip_stop()          (uip_conn->tcpstateflags |= UIP_STOPPED)
+
+#define uip_stop()  (uip_conn->tcpstateflags |= UIP_STOPPED)
 
 /**
  * Find out if the current connection has been previously stopped with
@@ -596,6 +619,7 @@
  *
  * \hideinitializer
  */
+
 #define uip_stopped(conn)   ((conn)->tcpstateflags & UIP_STOPPED)
 
 /**
@@ -607,12 +631,14 @@
  *
  * \hideinitializer
  */
-#define uip_restart()         do { uip_flags |= UIP_NEWDATA; \
-                                   uip_conn->tcpstateflags &= ~UIP_STOPPED; \
-                              } while(0)
 
+#define uip_restart() \
+    do { \
+        uip_flags |= UIP_NEWDATA; \
+        uip_conn->tcpstateflags &= ~UIP_STOPPED; \
+    } while (0)
 
-/* uIP tests that can be made to determine in what state the current
+    /* UIP tests that can be made to determine in what state the current
    connection is, and what the application function should do. */
 
 /**
@@ -634,6 +660,7 @@
  *
  * \hideinitializer
  */
+
 #define uip_newdata()   (uip_flags & UIP_NEWDATA)
 
 /**
@@ -645,7 +672,8 @@
  *
  * \hideinitializer
  */
-#define uip_acked()   (uip_flags & UIP_ACKDATA)
+
+#define uip_acked() (uip_flags & UIP_ACKDATA)
 
 /**
  * Has the connection just been connected?
@@ -657,6 +685,7 @@
  *
  * \hideinitializer
  */
+
 #define uip_connected() (uip_flags & UIP_CONNECTED)
 
 /**
@@ -667,6 +696,7 @@
  *
  * \hideinitializer
  */
+
 #define uip_closed()    (uip_flags & UIP_CLOSE)
 
 /**
@@ -677,7 +707,8 @@
  *
  * \hideinitializer
  */
-#define uip_aborted()    (uip_flags & UIP_ABORT)
+
+#define uip_aborted()   (uip_flags & UIP_ABORT)
 
 /**
  * Has the connection timed out?
@@ -687,7 +718,8 @@
  *
  * \hideinitializer
  */
-#define uip_timedout()    (uip_flags & UIP_TIMEDOUT)
+
+#define uip_timedout()  (uip_flags & UIP_TIMEDOUT)
 
 /**
  * Do we need to retransmit previously data?
@@ -699,10 +731,11 @@
  *
  * \hideinitializer
  */
-#define uip_rexmit()     (uip_flags & UIP_REXMIT)
+
+#define uip_rexmit()    (uip_flags & UIP_REXMIT)
 
 /**
- * Is the connection being polled by uIP?
+ * Is the connection being polled by UIP?
  *
  * Is non-zero if the reason the application is invoked is that the
  * current connection has been idle for a while and should be
@@ -713,7 +746,8 @@
  *
  * \hideinitializer
  */
-#define uip_poll()       (uip_flags & UIP_POLL)
+
+#define uip_poll()  (uip_flags & UIP_POLL)
 
 /**
  * Get the initial maxium segment size (MSS) of the current
@@ -721,7 +755,8 @@
  *
  * \hideinitializer
  */
-#define uip_initialmss()             (uip_conn->initialmss)
+
+#define uip_initialmss()    (uip_conn->initialmss)
 
 /**
  * Get the current maxium segment size that can be sent on the current
@@ -734,9 +769,9 @@
  *
  * \hideinitializer
  */
-#define uip_mss()             (uip_conn->mss)
 
-/**
+#define uip_mss()   (uip_conn->mss)
+    /**
  * Set up a new UDP connection.
  *
  * This function sets up a new UDP connection. The function will
@@ -763,7 +798,7 @@
  * \return The uip_udp_conn structure for the new connection or NULL
  * if no connection could be allocated.
  */
-struct uip_udp_conn *uip_udp_new(uip_ipaddr_t *ripaddr, u16_t rport);
+    struct uip_udp_conn*    uip_udp_new(uip_ipaddr_t* ripaddr, u16_t rport);
 
 /**
  * Removed a UDP connection.
@@ -772,7 +807,8 @@
  *
  * \hideinitializer
  */
-#define uip_udp_remove(conn) (conn)->lport = 0
+
+#define uip_udp_remove(conn)    (conn)->lport = 0
 
 /**
  * Bind a UDP connection to a local port.
@@ -784,7 +820,8 @@
  *
  * \hideinitializer
  */
-#define uip_udp_bind(conn, port) (conn)->lport = port
+
+#define uip_udp_bind(conn, port)    (conn)->lport = port
 
 /**
  * Send a UDP datagram of length len on the current connection.
@@ -797,24 +834,24 @@
  *
  * \hideinitializer
  */
-#define uip_udp_send(len) uip_send((char *)uip_appdata, len)
+
+#define uip_udp_send(len)   uip_send((char*)uip_appdata, len)
 
 /** @} */
 
-/* uIP convenience and converting functions. */
-
+/* UIP convenience and converting functions. */
 /**
- * \defgroup uipconvfunc uIP conversion functions
+ * \defgroup uipconvfunc UIP conversion functions
  * @{
  *
  * These functions can be used for converting between different data
- * formats used by uIP.
+ * formats used by UIP.
  */
- 
+
 /**
  * Construct an IP address from four bytes.
  *
- * This function constructs an IP address of the type that uIP handles
+ * This function constructs an IP address of the type that UIP handles
  * internally from four bytes. The function is handy for specifying IP
  * addresses to use with e.g. the uip_connect() function.
  *
@@ -837,10 +874,11 @@
  *
  * \hideinitializer
  */
-#define uip_ipaddr(addr, addr0,addr1,addr2,addr3) do { \
-                     ((u16_t *)(addr))[0] = HTONS(((addr0) << 8) | (addr1)); \
-                     ((u16_t *)(addr))[1] = HTONS(((addr2) << 8) | (addr3)); \
-                  } while(0)
+#define uip_ipaddr(addr, addr0, addr1, addr2, addr3) \
+    do { \
+        ((u16_t *) (addr))[0] = HTONS(((addr0) << 8) | (addr1)); \
+        ((u16_t *) (addr))[1] = HTONS(((addr2) << 8) | (addr3)); \
+    } while (0)
 
 /**
  * Construct an IPv6 address from eight 16-bit words.
@@ -849,18 +887,18 @@
  *
  * \hideinitializer
  */
-#define uip_ip6addr(addr, addr0,addr1,addr2,addr3,addr4,addr5,addr6,addr7) do { \
-                     ((u16_t *)(addr))[0] = HTONS((addr0)); \
-                     ((u16_t *)(addr))[1] = HTONS((addr1)); \
-                     ((u16_t *)(addr))[2] = HTONS((addr2)); \
-                     ((u16_t *)(addr))[3] = HTONS((addr3)); \
-                     ((u16_t *)(addr))[4] = HTONS((addr4)); \
-                     ((u16_t *)(addr))[5] = HTONS((addr5)); \
-                     ((u16_t *)(addr))[6] = HTONS((addr6)); \
-                     ((u16_t *)(addr))[7] = HTONS((addr7)); \
-                  } while(0)
 
-/**
+#define uip_ip6addr(addr, addr0, addr1, addr2, addr3, addr4, addr5, addr6, addr7) \
+    do { \
+        ((u16_t *) (addr))[0] = HTONS((addr0)); \
+        ((u16_t *) (addr))[1] = HTONS((addr1)); \
+        ((u16_t *) (addr))[2] = HTONS((addr2)); \
+        ((u16_t *) (addr))[3] = HTONS((addr3)); \
+        ((u16_t *) (addr))[4] = HTONS((addr4)); \
+        ((u16_t *) (addr))[5] = HTONS((addr5)); \
+        ((u16_t *) (addr))[6] = HTONS((addr6)); \
+        ((u16_t *) (addr))[7] = HTONS((addr7)); \
+    } while (0) /**
  * Copy an IP address to another IP address.
  *
  * Copies an IP address from one place to another.
@@ -878,16 +916,19 @@
  *
  * \hideinitializer
  */
+
 #if !UIP_CONF_IPV6
-#define uip_ipaddr_copy(dest, src) do { \
-                     ((u16_t *)dest)[0] = ((u16_t *)src)[0]; \
-                     ((u16_t *)dest)[1] = ((u16_t *)src)[1]; \
-                  } while(0)
+#define uip_ipaddr_copy(dest, src) \
+    do { \
+        ((u16_t*)dest)[0] = ((u16_t*)src)[0]; \
+        ((u16_t*)dest)[1] = ((u16_t*)src)[1]; \
+    } while (0)
 #else /* !UIP_CONF_IPV6 */
-#define uip_ipaddr_copy(dest, src) memcpy(dest, src, sizeof(uip_ip6addr_t))
+
+#define uip_ipaddr_copy(dest, src)  memcpy(dest, src, sizeof(uip_ip6addr_t))
 #endif /* !UIP_CONF_IPV6 */
 
-/**
+            /**
  * Compare two IP addresses
  *
  * Compares two IP addresses.
@@ -907,11 +948,13 @@
  *
  * \hideinitializer
  */
+
 #if !UIP_CONF_IPV6
-#define uip_ipaddr_cmp(addr1, addr2) (((u16_t *)addr1)[0] == ((u16_t *)addr2)[0] && \
-				      ((u16_t *)addr1)[1] == ((u16_t *)addr2)[1])
+#define uip_ipaddr_cmp(addr1, addr2) \
+        (((u16_t*)addr1)[0] == ((u16_t*)addr2)[0] && ((u16_t*)addr1)[1] == ((u16_t*)addr2)[1])
 #else /* !UIP_CONF_IPV6 */
-#define uip_ipaddr_cmp(addr1, addr2) (memcmp(addr1, addr2, sizeof(uip_ip6addr_t)) == 0)
+
+#define uip_ipaddr_cmp(addr1, addr2)    (memcmp(addr1, addr2, sizeof(uip_ip6addr_t)) == 0)
 #endif /* !UIP_CONF_IPV6 */
 
 /**
@@ -938,12 +981,12 @@
  *
  * \hideinitializer
  */
+
 #define uip_ipaddr_maskcmp(addr1, addr2, mask) \
-                          (((((u16_t *)addr1)[0] & ((u16_t *)mask)[0]) == \
-                            (((u16_t *)addr2)[0] & ((u16_t *)mask)[0])) && \
-                           ((((u16_t *)addr1)[1] & ((u16_t *)mask)[1]) == \
-                            (((u16_t *)addr2)[1] & ((u16_t *)mask)[1])))
-
+        ( \
+            ((((u16_t*)addr1)[0] & ((u16_t*)mask)[0]) == (((u16_t*)addr2)[0] & ((u16_t*)mask)[0])) \
+        &&  ((((u16_t*)addr1)[1] & ((u16_t*)mask)[1]) == (((u16_t*)addr2)[1] & ((u16_t*)mask)[1])) \
+        )
 
 /**
  * Mask out the network part of an IP address.
@@ -969,10 +1012,12 @@
  *
  * \hideinitializer
  */
-#define uip_ipaddr_mask(dest, src, mask) do { \
-                     ((u16_t *)dest)[0] = ((u16_t *)src)[0] & ((u16_t *)mask)[0]; \
-                     ((u16_t *)dest)[1] = ((u16_t *)src)[1] & ((u16_t *)mask)[1]; \
-                  } while(0)
+
+#define uip_ipaddr_mask(dest, src, mask) \
+    do { \
+        ((u16_t*)dest)[0] = ((u16_t*)src)[0] & ((u16_t*)mask)[0]; \
+        ((u16_t*)dest)[1] = ((u16_t*)src)[1] & ((u16_t*)mask)[1]; \
+    } while (0)
 
 /**
  * Pick the first octet of an IP address.
@@ -992,7 +1037,8 @@
  *
  * \hideinitializer
  */
-#define uip_ipaddr1(addr) (htons(((u16_t *)(addr))[0]) >> 8)
+
+#define uip_ipaddr1(addr)   (htons(((u16_t *) (addr))[0]) >> 8)
 
 /**
  * Pick the second octet of an IP address.
@@ -1012,7 +1058,8 @@
  *
  * \hideinitializer
  */
-#define uip_ipaddr2(addr) (htons(((u16_t *)(addr))[0]) & 0xff)
+
+#define uip_ipaddr2(addr)   (htons(((u16_t *) (addr))[0]) & 0xff)
 
 /**
  * Pick the third octet of an IP address.
@@ -1032,7 +1079,8 @@
  *
  * \hideinitializer
  */
-#define uip_ipaddr3(addr) (htons(((u16_t *)(addr))[1]) >> 8)
+
+#define uip_ipaddr3(addr)   (htons(((u16_t *) (addr))[1]) >> 8)
 
 /**
  * Pick the fourth octet of an IP address.
@@ -1052,9 +1100,9 @@
  *
  * \hideinitializer
  */
-#define uip_ipaddr4(addr) (htons(((u16_t *)(addr))[1]) & 0xff)
 
-/**
+#define uip_ipaddr4(addr)   (htons(((u16_t *) (addr))[1]) & 0xff)
+                /**
  * Convert 16-bit quantity from host byte order to network byte order.
  *
  * This macro is primarily used for converting constants from host
@@ -1063,30 +1111,34 @@
  *
  * \hideinitializer
  */
+
 #ifndef HTONS
-#   if UIP_BYTE_ORDER == UIP_BIG_ENDIAN
-#      define HTONS(n) (n)
-#   else /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */
-#      define HTONS(n) (u16_t)((((u16_t) (n)) << 8) | (((u16_t) (n)) >> 8))
-#   endif /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */
+#if UIP_BYTE_ORDER == UIP_BIG_ENDIAN
+#define HTONS(n)    (n)
+#else /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */
+
+#define HTONS(n)    (u16_t) ((((u16_t) (n)) << 8) | (((u16_t) (n)) >> 8))
+#endif /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */
+
 #else
 #error "HTONS already defined!"
 #endif /* HTONS */
 
-/**
+                /**
  * Convert 16-bit quantity from host byte order to network byte order.
  *
  * This function is primarily used for converting variables from host
  * byte order to network byte order. For converting constants to
  * network byte order, use the HTONS() macro instead.
  */
+
 #ifndef htons
-u16_t htons(u16_t val);
+                u16_t htons(u16_t val);
 #endif /* htons */
+
 #ifndef ntohs
-#define ntohs htons
+#define ntohs   htons
 #endif
-
 /** @} */
 
 /**
@@ -1096,7 +1148,7 @@
  * called. If the application wishes to send data, the application may
  * use this space to write the data into before calling uip_send().
  */
-extern void *uip_appdata;
+extern void*    uip_appdata;
 
 #if UIP_URGDATA > 0
 /* u8_t *uip_urgdata:
@@ -1104,16 +1156,15 @@
  * This pointer points to any urgent data that has been received. Only
  * present if compiled with support for urgent data (UIP_URGDATA).
  */
-extern void *uip_urgdata;
+extern void*    uip_urgdata;
 #endif /* UIP_URGDATA > 0 */
 
-
 /**
- * \defgroup uipdrivervars Variables used in uIP device drivers
+ * \defgroup uipdrivervars Variables used in UIP device drivers
  * @{
  *
- * uIP has a few global variables that are used in device drivers for
- * uIP.
+ * UIP has a few global variables that are used in device drivers for
+ * UIP.
  */
 
 /**
@@ -1122,7 +1173,7 @@
  * The global variable uip_len holds the length of the packet in the
  * uip_buf buffer.
  *
- * When the network device driver calls the uIP input function,
+ * When the network device driver calls the UIP input function,
  * uip_len should be set to the length of the packet in the uip_buf
  * buffer.
  *
@@ -1131,17 +1182,15 @@
  * packet.
  *
  */
-extern u16_t uip_len;
+extern u16_t    uip_len;
 
 /** @} */
-
 #if UIP_URGDATA > 0
-extern u16_t uip_urglen, uip_surglen;
+extern u16_t    uip_urglen, uip_surglen;
 #endif /* UIP_URGDATA > 0 */
 
-
 /**
- * Representation of a uIP TCP connection.
+ * Representation of a UIP TCP connection.
  *
  * The uip_conn structure is used for identifying a connection. All
  * but one field in the structure are to be considered read-only by an
@@ -1150,78 +1199,81 @@
  * file pointers) for the connection. The type of this field is
  * configured in the "uipopt.h" header file.
  */
-struct uip_conn {
-  uip_ipaddr_t ripaddr;   /**< The IP address of the remote host. */
-  
-  u16_t lport;        /**< The local TCP port, in network byte order. */
-  u16_t rport;        /**< The local remote TCP port, in network byte
+
+struct uip_conn
+{
+    uip_ipaddr_t        ripaddr;        /**< The IP address of the remote host. */
+
+    u16_t               lport;          /**< The local TCP port, in network byte order. */
+    u16_t               rport;          /**< The local remote TCP port, in network byte
 			 order. */
-  
-  u8_t rcv_nxt[4];    /**< The sequence number that we expect to
+
+    u8_t                rcv_nxt[4];     /**< The sequence number that we expect to
 			 receive next. */
-  u8_t snd_nxt[4];    /**< The sequence number that was last sent by
+    u8_t                snd_nxt[4];     /**< The sequence number that was last sent by
                          us. */
-  u16_t len;          /**< Length of the data that was previously sent. */
-  u16_t mss;          /**< Current maximum segment size for the
+    u16_t               len;            /**< Length of the data that was previously sent. */
+    u16_t               mss;            /**< Current maximum segment size for the
 			 connection. */
-  u16_t initialmss;   /**< Initial maximum segment size for the
+    u16_t               initialmss;     /**< Initial maximum segment size for the
 			 connection. */
-  u8_t sa;            /**< Retransmission time-out calculation state
+    u8_t                sa;             /**< Retransmission time-out calculation state
 			 variable. */
-  u8_t sv;            /**< Retransmission time-out calculation state
+    u8_t                sv;             /**< Retransmission time-out calculation state
 			 variable. */
-  u8_t rto;           /**< Retransmission time-out. */
-  u8_t tcpstateflags; /**< TCP state and flags. */
-  u8_t timer;         /**< The retransmission timer. */
-  u8_t nrtx;          /**< The number of retransmissions for the last
+    u8_t                rto;            /**< Retransmission time-out. */
+    u8_t                tcpstateflags;  /**< TCP state and flags. */
+    u8_t                timer;          /**< The retransmission timer. */
+    u8_t                nrtx;           /**< The number of retransmissions for the last
 			 segment sent. */
 
-  /** The application state. */
-  uip_tcp_appstate_t appstate;
+    /** The application state. */
+    uip_tcp_appstate_t  appstate;
 };
 
-
 /**
  * Pointer to the current TCP connection.
  *
  * The uip_conn pointer can be used to access the current TCP
  * connection.
  */
-extern struct uip_conn *uip_conn;
-/* The array containing all uIP connections. */
-extern struct uip_conn uip_conns[UIP_CONNS];
+extern struct uip_conn*     uip_conn;
+
+/* The array containing all UIP connections. */
+extern struct uip_conn      uip_conns[UIP_CONNS];
+
 /**
  * \addtogroup uiparch
  * @{
  */
-
 /**
  * 4-byte array used for the 32-bit sequence number calculations.
  */
-extern u8_t uip_acc32[4];
+extern u8_t                 uip_acc32[4];
 
 /** @} */
 
+#if UIP_UDP
 
-#if UIP_UDP
 /**
- * Representation of a uIP UDP connection.
+ * Representation of a UIP UDP connection.
  */
-struct uip_udp_conn {
-  uip_ipaddr_t ripaddr;   /**< The IP address of the remote peer. */
-  u16_t lport;        /**< The local port number in network byte order. */
-  u16_t rport;        /**< The remote port number in network byte order. */
-  u8_t  ttl;          /**< Default time-to-live. */
+struct uip_udp_conn
+{
+    uip_ipaddr_t        ripaddr;    /**< The IP address of the remote peer. */
+    u16_t               lport;      /**< The local port number in network byte order. */
+    u16_t               rport;      /**< The remote port number in network byte order. */
+    u8_t                ttl;        /**< Default time-to-live. */
 
-  /** The application state. */
-  uip_udp_appstate_t appstate;
+    /** The application state. */
+    uip_udp_appstate_t  appstate;
 };
 
 /**
  * The current UDP connection.
  */
-extern struct uip_udp_conn *uip_udp_conn;
-extern struct uip_udp_conn uip_udp_conns[UIP_UDP_CONNS];
+extern struct uip_udp_conn*     uip_udp_conn;
+extern struct uip_udp_conn      uip_udp_conns[UIP_UDP_CONNS];
 #endif /* UIP_UDP */
 
 /**
@@ -1229,70 +1281,75 @@
  * UIP_STATISTICS is set to 1.
  *
  */
-struct uip_stats {
-  struct {
-    uip_stats_t drop;     /**< Number of dropped packets at the IP
+
+struct uip_stats
+{
+    struct
+    {
+        uip_stats_t drop;       /**< Number of dropped packets at the IP
 			     layer. */
-    uip_stats_t recv;     /**< Number of received packets at the IP
+        uip_stats_t recv;       /**< Number of received packets at the IP
 			     layer. */
-    uip_stats_t sent;     /**< Number of sent packets at the IP
+        uip_stats_t sent;       /**< Number of sent packets at the IP
 			     layer. */
-    uip_stats_t vhlerr;   /**< Number of packets dropped due to wrong
+        uip_stats_t vhlerr;     /**< Number of packets dropped due to wrong
 			     IP version or header length. */
-    uip_stats_t hblenerr; /**< Number of packets dropped due to wrong
+        uip_stats_t hblenerr;   /**< Number of packets dropped due to wrong
 			     IP length, high byte. */
-    uip_stats_t lblenerr; /**< Number of packets dropped due to wrong
+        uip_stats_t lblenerr;   /**< Number of packets dropped due to wrong
 			     IP length, low byte. */
-    uip_stats_t fragerr;  /**< Number of packets dropped since they
+        uip_stats_t fragerr;    /**< Number of packets dropped since they
 			     were IP fragments. */
-    uip_stats_t chkerr;   /**< Number of packets dropped due to IP
+        uip_stats_t chkerr;     /**< Number of packets dropped due to IP
 			     checksum errors. */
-    uip_stats_t protoerr; /**< Number of packets dropped since they
+        uip_stats_t protoerr;   /**< Number of packets dropped since they
 			     were neither ICMP, UDP nor TCP. */
-  } ip;                   /**< IP statistics. */
-  struct {
-    uip_stats_t drop;     /**< Number of dropped ICMP packets. */
-    uip_stats_t recv;     /**< Number of received ICMP packets. */
-    uip_stats_t sent;     /**< Number of sent ICMP packets. */
-    uip_stats_t typeerr;  /**< Number of ICMP packets with a wrong
+    } ip;   /**< IP statistics. */
+    struct
+    {
+        uip_stats_t drop;       /**< Number of dropped ICMP packets. */
+        uip_stats_t recv;       /**< Number of received ICMP packets. */
+        uip_stats_t sent;       /**< Number of sent ICMP packets. */
+        uip_stats_t typeerr;    /**< Number of ICMP packets with a wrong
 			     type. */
-  } icmp;                 /**< ICMP statistics. */
-  struct {
-    uip_stats_t drop;     /**< Number of dropped TCP segments. */
-    uip_stats_t recv;     /**< Number of recived TCP segments. */
-    uip_stats_t sent;     /**< Number of sent TCP segments. */
-    uip_stats_t chkerr;   /**< Number of TCP segments with a bad
+    } icmp; /**< ICMP statistics. */
+    struct
+    {
+        uip_stats_t drop;       /**< Number of dropped TCP segments. */
+        uip_stats_t recv;       /**< Number of recived TCP segments. */
+        uip_stats_t sent;       /**< Number of sent TCP segments. */
+        uip_stats_t chkerr;     /**< Number of TCP segments with a bad
 			     checksum. */
-    uip_stats_t ackerr;   /**< Number of TCP segments with a bad ACK
+        uip_stats_t ackerr;     /**< Number of TCP segments with a bad ACK
 			     number. */
-    uip_stats_t rst;      /**< Number of recevied TCP RST (reset) segments. */
-    uip_stats_t rexmit;   /**< Number of retransmitted TCP segments. */
-    uip_stats_t syndrop;  /**< Number of dropped SYNs due to too few
+        uip_stats_t rst;        /**< Number of recevied TCP RST (reset) segments. */
+        uip_stats_t rexmit;     /**< Number of retransmitted TCP segments. */
+        uip_stats_t syndrop;    /**< Number of dropped SYNs due to too few
 			     connections was avaliable. */
-    uip_stats_t synrst;   /**< Number of SYNs for closed ports,
+        uip_stats_t synrst;     /**< Number of SYNs for closed ports,
 			     triggering a RST. */
-  } tcp;                  /**< TCP statistics. */
+    } tcp;  /**< TCP statistics. */
 #if UIP_UDP
-  struct {
-    uip_stats_t drop;     /**< Number of dropped UDP segments. */
-    uip_stats_t recv;     /**< Number of recived UDP segments. */
-    uip_stats_t sent;     /**< Number of sent UDP segments. */
-    uip_stats_t chkerr;   /**< Number of UDP segments with a bad
+    struct
+    {
+        uip_stats_t drop;   /**< Number of dropped UDP segments. */
+        uip_stats_t recv;   /**< Number of recived UDP segments. */
+        uip_stats_t sent;   /**< Number of sent UDP segments. */
+        uip_stats_t chkerr; /**< Number of UDP segments with a bad
 			     checksum. */
-  } udp;                  /**< UDP statistics. */
+    } udp;  /**< UDP statistics. */
 #endif /* UIP_UDP */
 };
 
 /**
- * The uIP TCP/IP statistics.
+ * The UIP TCP/IP statistics.
  *
- * This is the variable in which the uIP TCP/IP statistics are gathered.
+ * This is the variable in which the UIP TCP/IP statistics are gathered.
  */
 extern struct uip_stats uip_stat;
 
-
 /*---------------------------------------------------------------------------*/
-/* All the stuff below this point is internal to uIP and should not be
+/* All the stuff below this point is internal to UIP and should not be
  * used directly by an application or by a device driver.
  */
 /*---------------------------------------------------------------------------*/
@@ -1302,49 +1359,55 @@
  * that are defined in this file. Please read below for more
  * infomation.
  */
-extern u8_t uip_flags;
+extern u8_t             uip_flags;
 
 /* The following flags may be set in the global variable uip_flags
    before calling the application callback. The UIP_ACKDATA,
    UIP_NEWDATA, and UIP_CLOSE flags may both be set at the same time,
    whereas the others are mutualy exclusive. Note that these flags
-   should *NOT* be accessed directly, but only through the uIP
+   should *NOT* be accessed directly, but only through the UIP
    functions/macros. */
 
-#define UIP_ACKDATA   1     /* Signifies that the outstanding data was
+#define UIP_ACKDATA     1       /* Signifies that the outstanding data was
 			       acked and the application should send
 			       out new data instead of retransmitting
 			       the last data. */
-#define UIP_NEWDATA   2     /* Flags the fact that the peer has sent
+
+#define UIP_NEWDATA     2       /* Flags the fact that the peer has sent
 			       us new data. */
-#define UIP_REXMIT    4     /* Tells the application to retransmit the
+
+#define UIP_REXMIT      4       /* Tells the application to retransmit the
 			       data that was last sent. */
-#define UIP_POLL      8     /* Used for polling the application, to
+
+#define UIP_POLL        8       /* Used for polling the application, to
 			       check if the application has data that
 			       it wants to send. */
-#define UIP_CLOSE     16    /* The remote host has closed the
+
+#define UIP_CLOSE       16      /* The remote host has closed the
 			       connection, thus the connection has
 			       gone away. Or the application signals
 			       that it wants to close the
 			       connection. */
-#define UIP_ABORT     32    /* The remote host has aborted the
+
+#define UIP_ABORT       32      /* The remote host has aborted the
 			       connection, thus the connection has
 			       gone away. Or the application signals
 			       that it wants to abort the
 			       connection. */
-#define UIP_CONNECTED 64    /* We have got a connection from a remote
+
+#define UIP_CONNECTED   64      /* We have got a connection from a remote
                                host and have set up a new connection
                                for it, or an active connection has
                                been successfully established. */
 
-#define UIP_TIMEDOUT  128   /* The connection has been aborted due to
+#define UIP_TIMEDOUT    128     /* The connection has been aborted due to
 			       too many retransmissions. */
 
 /* uip_process(flag):
  *
- * The actual uIP function which does all the work.
+ * The actual UIP function which does all the work.
  */
-void uip_process(u8_t flag);
+void    uip_process(u8_t flag);
 
 /* The following flags are passed as an argument to the uip_process()
    function. They are used to distinguish between the two cases where
@@ -1352,23 +1415,28 @@
    incoming data that should be processed, or because the periodic
    timer has fired. These values are never used directly, but only in
    the macrose defined in this file. */
- 
-#define UIP_DATA          1     /* Tells uIP that there is incoming
+
+#define UIP_DATA            1   /* Tells UIP that there is incoming
 				   data in the uip_buf buffer. The
 				   length of the data is stored in the
 				   global variable uip_len. */
-#define UIP_TIMER         2     /* Tells uIP that the periodic timer
+
+#define UIP_TIMER           2   /* Tells UIP that the periodic timer
 				   has fired. */
-#define UIP_POLL_REQUEST  3     /* Tells uIP that a connection should
+
+#define UIP_POLL_REQUEST    3   /* Tells UIP that a connection should
 				   be polled. */
-#define UIP_UDP_SEND_CONN 4     /* Tells uIP that a UDP datagram
+
+#define UIP_UDP_SEND_CONN   4   /* Tells UIP that a UDP datagram
 				   should be constructed in the
 				   uip_buf buffer. */
+
 #if UIP_UDP
-#define UIP_UDP_TIMER     5
+#define UIP_UDP_TIMER   5
 #endif /* UIP_UDP */
 
 /* The TCP states used in the uip_conn->tcpstateflags. */
+
 #define UIP_CLOSED      0
 #define UIP_SYN_RCVD    1
 #define UIP_SYN_SENT    2
@@ -1379,116 +1447,92 @@
 #define UIP_TIME_WAIT   7
 #define UIP_LAST_ACK    8
 #define UIP_TS_MASK     15
-  
-#define UIP_STOPPED      16
+
+#define UIP_STOPPED     16
 
 /* The TCP and IP headers. */
-struct uip_tcpip_hdr {
+struct uip_tcpip_hdr
+{
 #if UIP_CONF_IPV6
-  /* IPv6 header. */
-  u8_t vtc,
-    tcflow;
-  u16_t flow;
-  u8_t len[2];
-  u8_t proto, ttl;
-  uip_ip6addr_t srcipaddr, destipaddr;
+    /* IPv6 header. */
+    u8_t            vtc, tcflow;
+    u16_t           flow;
+    u8_t            len[2];
+    u8_t            proto, ttl;
+    uip_ip6addr_t   srcipaddr, destipaddr;
 #else /* UIP_CONF_IPV6 */
-  /* IPv4 header. */
-  u8_t vhl,
-    tos,
-    len[2],
-    ipid[2],
-    ipoffset[2],
-    ttl,
-    proto;
-  u16_t ipchksum;
-  u16_t srcipaddr[2],
-    destipaddr[2];
+    /* IPv4 header. */
+
+    u8_t            vhl, tos, len[2], ipid[2], ipoffset[2], ttl, proto;
+    u16_t           ipchksum;
+    u16_t           srcipaddr[2], destipaddr[2];
 #endif /* UIP_CONF_IPV6 */
-  
-  /* TCP header. */
-  u16_t srcport,
-    destport;
-  u8_t seqno[4],
-    ackno[4],
-    tcpoffset,
-    flags,
-    wnd[2];
-  u16_t tcpchksum;
-  u8_t urgp[2];
-  u8_t optdata[4];
+
+    /* TCP header. */
+
+    u16_t           srcport, destport;
+    u8_t            seqno[4], ackno[4], tcpoffset, flags, wnd[2];
+    u16_t           tcpchksum;
+    u8_t            urgp[2];
+    u8_t            optdata[4];
 };
 
 /* The ICMP and IP headers. */
-struct uip_icmpip_hdr {
+struct uip_icmpip_hdr
+{
 #if UIP_CONF_IPV6
-  /* IPv6 header. */
-  u8_t vtc,
-    tcf;
-  u16_t flow;
-  u8_t len[2];
-  u8_t proto, ttl;
-  uip_ip6addr_t srcipaddr, destipaddr;
+    /* IPv6 header. */
+    u8_t            vtc, tcf;
+    u16_t           flow;
+    u8_t            len[2];
+    u8_t            proto, ttl;
+    uip_ip6addr_t   srcipaddr, destipaddr;
 #else /* UIP_CONF_IPV6 */
-  /* IPv4 header. */
-  u8_t vhl,
-    tos,
-    len[2],
-    ipid[2],
-    ipoffset[2],
-    ttl,
-    proto;
-  u16_t ipchksum;
-  u16_t srcipaddr[2],
-    destipaddr[2];
+    /* IPv4 header. */
+
+    u8_t            vhl, tos, len[2], ipid[2], ipoffset[2], ttl, proto;
+    u16_t           ipchksum;
+    u16_t           srcipaddr[2], destipaddr[2];
 #endif /* UIP_CONF_IPV6 */
-  
-  /* ICMP (echo) header. */
-  u8_t type, icode;
-  u16_t icmpchksum;
+
+    /* ICMP (echo) header. */
+
+    u8_t            type, icode;
+    u16_t           icmpchksum;
 #if !UIP_CONF_IPV6
-  u16_t id, seqno;
+    u16_t           id, seqno;
 #else /* !UIP_CONF_IPV6 */
-  u8_t flags, reserved1, reserved2, reserved3;
-  u8_t icmp6data[16];
-  u8_t options[1];
+    u8_t            flags, reserved1, reserved2, reserved3;
+    u8_t            icmp6data[16];
+    u8_t            options[1];
 #endif /* !UIP_CONF_IPV6 */
 };
 
-
 /* The UDP and IP headers. */
-struct uip_udpip_hdr {
+struct uip_udpip_hdr
+{
 #if UIP_CONF_IPV6
-  /* IPv6 header. */
-  u8_t vtc,
-    tcf;
-  u16_t flow;
-  u8_t len[2];
-  u8_t proto, ttl;
-  uip_ip6addr_t srcipaddr, destipaddr;
+    /* IPv6 header. */
+    u8_t            vtc, tcf;
+    u16_t           flow;
+    u8_t            len[2];
+    u8_t            proto, ttl;
+    uip_ip6addr_t   srcipaddr, destipaddr;
 #else /* UIP_CONF_IPV6 */
-  /* IP header. */
-  u8_t vhl,
-    tos,
-    len[2],
-    ipid[2],
-    ipoffset[2],
-    ttl,
-    proto;
-  u16_t ipchksum;
-  u16_t srcipaddr[2],
-    destipaddr[2];
+    /* IP header. */
+
+    u8_t            vhl, tos, len[2], ipid[2], ipoffset[2], ttl, proto;
+    u16_t           ipchksum;
+    u16_t           srcipaddr[2], destipaddr[2];
 #endif /* UIP_CONF_IPV6 */
-  
-  /* UDP header. */
-  u16_t srcport,
-    destport;
-  u16_t udplen;
-  u16_t udpchksum;
+
+    /* UDP header. */
+
+    u16_t           srcport, destport;
+    u16_t           udplen;
+    u16_t           udpchksum;
 };
 
-
-
 /**
  * The buffer size available for user data in the \ref uip_buf buffer.
  *
@@ -1503,44 +1547,49 @@
  *
  * \hideinitializer
  */
-#define UIP_APPDATA_SIZE (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN)
-
-
-#define UIP_PROTO_ICMP  1
-#define UIP_PROTO_TCP   6
-#define UIP_PROTO_UDP   17
-#define UIP_PROTO_ICMP6 58
+#define UIP_APPDATA_SIZE    (UIP_BUFSIZE - UIP_LLH_LEN - UIP_TCPIP_HLEN)
+#define UIP_PROTO_ICMP      1
+#define UIP_PROTO_TCP       6
+#define UIP_PROTO_UDP       17
+#define UIP_PROTO_ICMP6     58
 
 /* Header sizes. */
+
 #if UIP_CONF_IPV6
-#define UIP_IPH_LEN    40
+#define UIP_IPH_LEN 40
 #else /* UIP_CONF_IPV6 */
-#define UIP_IPH_LEN    20    /* Size of IP header */
+
+#define UIP_IPH_LEN 20      /* Size of IP header */
 #endif /* UIP_CONF_IPV6 */
-#define UIP_UDPH_LEN    8    /* Size of UDP header */
-#define UIP_TCPH_LEN   20    /* Size of TCP header */
-#define UIP_IPUDPH_LEN (UIP_UDPH_LEN + UIP_IPH_LEN)    /* Size of IP +
+
+#define UIP_UDPH_LEN    8   /* Size of UDP header */
+
+#define UIP_TCPH_LEN    20  /* Size of TCP header */
+
+#define UIP_IPUDPH_LEN  (UIP_UDPH_LEN + UIP_IPH_LEN)    /* Size of IP +
 							  UDP
 							  header */
-#define UIP_IPTCPH_LEN (UIP_TCPH_LEN + UIP_IPH_LEN)    /* Size of IP +
+
+#define UIP_IPTCPH_LEN  (UIP_TCPH_LEN + UIP_IPH_LEN)    /* Size of IP +
 							  TCP
 							  header */
-#define UIP_TCPIP_HLEN UIP_IPTCPH_LEN
 
+#define UIP_TCPIP_HLEN  UIP_IPTCPH_LEN
 
 #if UIP_FIXEDADDR
-extern const uip_ipaddr_t uip_hostaddr, uip_netmask, uip_draddr;
+extern const uip_ipaddr_t   uip_hostaddr, uip_netmask, uip_draddr;
 #else /* UIP_FIXEDADDR */
-extern uip_ipaddr_t uip_hostaddr, uip_netmask, uip_draddr;
+
+extern uip_ipaddr_t         uip_hostaddr, uip_netmask, uip_draddr;
 #endif /* UIP_FIXEDADDR */
 
-
-
 /**
  * Representation of a 48-bit Ethernet address.
  */
-struct uip_eth_addr {
-  u8_t addr[6];
+
+struct uip_eth_addr
+{
+    u8_t    addr[6];
 };
 
 /**
@@ -1559,7 +1608,7 @@
  *
  * \return The Internet checksum of the buffer.
  */
-u16_t uip_chksum(u16_t *buf, u16_t len);
+u16_t   uip_chksum(u16_t* buf, u16_t len);
 
 /**
  * Calculate the IP header checksum of the packet header in uip_buf.
@@ -1570,7 +1619,7 @@
  * \return The IP header checksum of the IP header in the uip_buf
  * buffer.
  */
-u16_t uip_ipchksum(void);
+u16_t   uip_ipchksum(void);
 
 /**
  * Calculate the TCP checksum of the packet in uip_buf and uip_appdata.
@@ -1581,7 +1630,7 @@
  * \return The TCP checksum of the TCP segment in uip_buf and pointed
  * to by uip_appdata.
  */
-u16_t uip_tcpchksum(void);
+u16_t   uip_tcpchksum(void);
 
 /**
  * Calculate the UDP checksum of the packet in uip_buf and uip_appdata.
@@ -1592,10 +1641,7 @@
  * \return The UDP checksum of the UDP segment in uip_buf and pointed
  * to by uip_appdata.
  */
-u16_t uip_udpchksum(void);
-
-
+u16_t   uip_udpchksum(void);
 #endif /* __UIP_H__ */
 
-
 /** @} */