uip: Move UIP into a new ipv4 directory.

ipv4 will continue to be implemented by uip, but that's an implementation
detail which should be hidden from other parts of the codebase.

Change-Id: I68f12c5f3db010a1b6bb89ecda064a638607a6b6
diff --git a/src/debug/netboot.c b/src/debug/netboot.c
index 24a8636..517fc3d 100644
--- a/src/debug/netboot.c
+++ b/src/debug/netboot.c
@@ -22,7 +22,7 @@
 #include "drivers/console/display.h"
 #include "net/netboot/netboot.h"
 #include "net/netboot/params.h"
-#include "net/uip/uip.h"
+#include "net/ipv4/uip/uip.h"
 
 /*
  * These are the real implementations for developer-build features that override
diff --git a/src/module/netboot.c b/src/module/netboot.c
index 3e4168b..764f682 100644
--- a/src/module/netboot.c
+++ b/src/module/netboot.c
@@ -35,7 +35,7 @@
 #include "module/module.h"
 #include "net/netboot/netboot.h"
 #include "net/netboot/params.h"
-#include "net/uip/uip.h"
+#include "net/ipv4/uip/uip.h"
 #include "vboot/vbnv.h"
 
 static void enable_graphics(void)
diff --git a/src/module/uefi/netboot.c b/src/module/uefi/netboot.c
index 8b9af31..c8eb541 100644
--- a/src/module/uefi/netboot.c
+++ b/src/module/uefi/netboot.c
@@ -29,7 +29,7 @@
 #include "module/uefi/fwdb.h"
 #include "net/netboot/netboot.h"
 #include "net/netboot/params.h"
-#include "net/uip/uip.h"
+#include "net/ipv4/uip/uip.h"
 
 void module_main(void)
 {
diff --git a/src/net/Kconfig b/src/net/Kconfig
index 50e41fe..1fd8836 100644
--- a/src/net/Kconfig
+++ b/src/net/Kconfig
@@ -14,4 +14,4 @@
 ## along with this program; if not, write to the Free Software
 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
-source src/net/uip/Kconfig
+source src/net/ipv4/Kconfig
diff --git a/src/net/Makefile.inc b/src/net/Makefile.inc
index 091a42c..9ebe9a2 100644
--- a/src/net/Makefile.inc
+++ b/src/net/Makefile.inc
@@ -15,6 +15,6 @@
 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 ##
 
-subdirs-y += netboot uip
+subdirs-y += netboot ipv4
 
 net-y += net.c
diff --git a/src/net/ipv4/Kconfig b/src/net/ipv4/Kconfig
new file mode 100644
index 0000000..1302770
--- /dev/null
+++ b/src/net/ipv4/Kconfig
@@ -0,0 +1,17 @@
+##
+## Copyright 2016 Google Inc.  All rights reserved.
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; version 2 of the License.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+source src/net/ipv4/uip/Kconfig
diff --git a/src/net/ipv4/Makefile.inc b/src/net/ipv4/Makefile.inc
new file mode 100644
index 0000000..61859dd
--- /dev/null
+++ b/src/net/ipv4/Makefile.inc
@@ -0,0 +1,18 @@
+##
+## Copyright (c) 2016 Google Inc.
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; version 2 of the License.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+##
+
+subdirs-y += uip
diff --git a/src/net/uip/Kconfig b/src/net/ipv4/uip/Kconfig
similarity index 100%
rename from src/net/uip/Kconfig
rename to src/net/ipv4/uip/Kconfig
diff --git a/src/net/uip/Makefile.inc b/src/net/ipv4/uip/Makefile.inc
similarity index 100%
rename from src/net/uip/Makefile.inc
rename to src/net/ipv4/uip/Makefile.inc
diff --git a/src/net/uip/arch.h b/src/net/ipv4/uip/arch.h
similarity index 96%
rename from src/net/uip/arch.h
rename to src/net/ipv4/uip/arch.h
index a8ddb88..149841c 100644
--- a/src/net/uip/arch.h
+++ b/src/net/ipv4/uip/arch.h
@@ -58,10 +58,10 @@
  *
  */
 
-#ifndef __NET_UIP_ARCH_H__
-#define __NET_UIP_ARCH_H__
+#ifndef __NET_IPV4_UIP_ARCH_H__
+#define __NET_IPV4_UIP_ARCH_H__
 
-#include "net/uip/uip.h"
+#include "net/ipv4/uip/uip.h"
 
 /**
  * Carry out a 32-bit addition.
@@ -135,4 +135,4 @@
 /** @} */
 /** @} */
 
-#endif /* __NET_UIP_ARCH_H__ */
+#endif /* __NET_IPV4_UIP_ARCH_H__ */
diff --git a/src/net/uip/arp.c b/src/net/ipv4/uip/arp.c
similarity index 99%
rename from src/net/uip/arp.c
rename to src/net/ipv4/uip/arp.c
index dab8b0f..db4be5b 100644
--- a/src/net/uip/arp.c
+++ b/src/net/ipv4/uip/arp.c
@@ -60,7 +60,7 @@
 
 
 #include "net/ethernet.h"
-#include "net/uip/arp.h"
+#include "net/ipv4/uip/arp.h"
 
 #include <string.h>
 
diff --git a/src/net/uip/arp.h b/src/net/ipv4/uip/arp.h
similarity index 96%
rename from src/net/uip/arp.h
rename to src/net/ipv4/uip/arp.h
index 2cdffa2..c0cc10f 100644
--- a/src/net/uip/arp.h
+++ b/src/net/ipv4/uip/arp.h
@@ -49,11 +49,11 @@
  *
  */
 
-#ifndef __NET_UIP_ARP_H__
-#define __NET_UIP_ARP_H__
+#ifndef __NET_IPV4_UIP_ARP_H__
+#define __NET_IPV4_UIP_ARP_H__
 
 #include "net/ethernet.h"
-#include "net/uip/uip.h"
+#include "net/ipv4/uip/uip.h"
 
 
 extern MacAddress uip_ethaddr;
@@ -129,5 +129,5 @@
 /** @} */
 
 
-#endif /* __NET_UIP_ARP_H__ */
+#endif /* __NET_IPV4_UIP_ARP_H__ */
 /** @} */
diff --git a/src/net/uip/debug.c b/src/net/ipv4/uip/debug.c
similarity index 98%
rename from src/net/uip/debug.c
rename to src/net/ipv4/uip/debug.c
index 060618d..dbf1bd9 100644
--- a/src/net/uip/debug.c
+++ b/src/net/ipv4/uip/debug.c
@@ -37,7 +37,7 @@
  *         Joakim Eriksson <joakime@sics.se>
  */
 
-#include "net/uip/debug.h"
+#include "net/ipv4/uip/debug.h"
 
 /*---------------------------------------------------------------------------*/
 void
diff --git a/src/net/uip/debug.h b/src/net/ipv4/uip/debug.h
similarity index 95%
rename from src/net/uip/debug.h
rename to src/net/ipv4/uip/debug.h
index f563859..e523209 100644
--- a/src/net/uip/debug.h
+++ b/src/net/ipv4/uip/debug.h
@@ -39,10 +39,10 @@
  *         Joakim Eriksson <joakime@sics.se>
  */
 
-#ifndef __NET_UIP_DEBUG_H__
-#define __NET_UIP_DEBUG_H__
+#ifndef __NET_IPV4_UIP_DEBUG_H__
+#define __NET_IPV4_UIP_DEBUG_H__
 
-#include "net/uip/uip.h"
+#include "net/ipv4/uip/uip.h"
 #include <stdio.h>
 
 void uip_debug_ipaddr_print(const uip_ipaddr_t *addr);
@@ -85,4 +85,4 @@
 #define PRINTLLADDR(lladdr)
 #endif /* (DEBUG) & DEBUG_PRINT */
 
-#endif /* __NET_UIP_DEBUG_H__ */
+#endif /* __NET_IPV4_UIP_DEBUG_H__ */
diff --git a/src/net/uip/lib.c b/src/net/ipv4/uip/lib.c
similarity index 95%
rename from src/net/uip/lib.c
rename to src/net/ipv4/uip/lib.c
index be08d57..c41214a 100644
--- a/src/net/uip/lib.c
+++ b/src/net/ipv4/uip/lib.c
@@ -34,12 +34,12 @@
  */
 
 
-#include "net/uip/uip.h"
-#include "net/uip/lib.h"
+#include "net/ipv4/uip/uip.h"
+#include "net/ipv4/uip/lib.h"
 #include <string.h>
 
 #define DEBUG DEBUG_NONE
-#include "net/uip/debug.h"
+#include "net/ipv4/uip/debug.h"
 
 /*---------------------------------------------------------------------------*/
 int uiplib_ipaddrconv(const char *addrstr, uip_ipaddr_t *ipaddr)
diff --git a/src/net/uip/lib.h b/src/net/ipv4/uip/lib.h
similarity index 94%
rename from src/net/uip/lib.h
rename to src/net/ipv4/uip/lib.h
index f5475e7..9002abc 100644
--- a/src/net/uip/lib.h
+++ b/src/net/ipv4/uip/lib.h
@@ -40,10 +40,10 @@
  * $Id: uiplib.h,v 1.3 2010/05/31 15:22:08 nifi Exp $
  *
  */
-#ifndef __NET_UIP_LIB_H__
-#define __NET_UIP_LIB_H__
+#ifndef __NET_IPV4_UIP_LIB_H__
+#define __NET_IPV4_UIP_LIB_H__
 
-#include "net/uip/uip.h"
+#include "net/ipv4/uip/uip.h"
 
 /**
  * \addtogroup uipconvfunc
@@ -71,4 +71,4 @@
 
 /** @} */
 
-#endif /* __NET_UIP_LIB_H__ */
+#endif /* __NET_IPV4_UIP_LIB_H__ */
diff --git a/src/net/uip/opt.h b/src/net/ipv4/uip/opt.h
similarity index 98%
rename from src/net/uip/opt.h
rename to src/net/ipv4/uip/opt.h
index 555e1f1..4d1936d 100644
--- a/src/net/uip/opt.h
+++ b/src/net/ipv4/uip/opt.h
@@ -48,8 +48,8 @@
  *
  */
 
-#ifndef __NET_UIP_OPT_H__
-#define __NET_UIP_OPT_H__
+#ifndef __NET_IPV4_UIP_OPT_H__
+#define __NET_IPV4_UIP_OPT_H__
 
 #include <stdint.h>
 
diff --git a/src/net/uip/udp/Makefile.inc b/src/net/ipv4/uip/udp/Makefile.inc
similarity index 100%
rename from src/net/uip/udp/Makefile.inc
rename to src/net/ipv4/uip/udp/Makefile.inc
diff --git a/src/net/uip/udp/packet.c b/src/net/ipv4/uip/udp/packet.c
similarity index 97%
rename from src/net/uip/udp/packet.c
rename to src/net/ipv4/uip/udp/packet.c
index 68675c8..2c8d2bc 100644
--- a/src/net/uip/udp/packet.c
+++ b/src/net/ipv4/uip/udp/packet.c
@@ -43,8 +43,8 @@
 extern uint16_t uip_slen;
 
 #include "drivers/net/net.h"
-#include "net/uip/arp.h"
-#include "net/uip/udp/packet.h"
+#include "net/ipv4/uip/arp.h"
+#include "net/ipv4/uip/udp/packet.h"
 
 #include <string.h>
 
diff --git a/src/net/uip/udp/packet.h b/src/net/ipv4/uip/udp/packet.h
similarity index 93%
rename from src/net/uip/udp/packet.h
rename to src/net/ipv4/uip/udp/packet.h
index d42e727..9eaf28b 100644
--- a/src/net/uip/udp/packet.h
+++ b/src/net/ipv4/uip/udp/packet.h
@@ -38,11 +38,11 @@
  *         Adam Dunkels <adam@sics.se>
  */
 
-#ifndef __NET_UIP_UDP_PACKET_H__
-#define __NET_UIP_UDP_PACKET_H__
+#ifndef __NET_IPV4_UIP_UDP_PACKET_H__
+#define __NET_IPV4_UIP_UDP_PACKET_H__
 
 #include "drivers/net/net.h"
-#include "net/uip/uip.h"
+#include "net/ipv4/uip/uip.h"
 
 void uip_udp_packet_send(NetDevice *dev, struct uip_udp_conn *c,
 			 const void *data, int len);
@@ -50,4 +50,4 @@
 			   const void *data, int len,
 			   const uip_ipaddr_t *toaddr, uint16_t toport);
 
-#endif /* __NET_UIP_UDP_PACKET_H__ */
+#endif /* __NET_IPV4_UIP_UDP_PACKET_H__ */
diff --git a/src/net/uip/uip.c b/src/net/ipv4/uip/uip.c
similarity index 99%
rename from src/net/uip/uip.c
rename to src/net/ipv4/uip/uip.c
index 15b2cd1..cad4b7d 100644
--- a/src/net/uip/uip.c
+++ b/src/net/ipv4/uip/uip.c
@@ -75,10 +75,10 @@
 
 #include "base/algorithm.h"
 #include "net/ethernet.h"
-#include "net/uip/arch.h"
-#include "net/uip/arp.h"
-#include "net/uip/opt.h"
-#include "net/uip/uip.h"
+#include "net/ipv4/uip/arch.h"
+#include "net/ipv4/uip/arp.h"
+#include "net/ipv4/uip/opt.h"
+#include "net/ipv4/uip/uip.h"
 
 /*---------------------------------------------------------------------------*/
 /* Variable definitions. */
diff --git a/src/net/uip/uip.h b/src/net/ipv4/uip/uip.h
similarity index 99%
rename from src/net/uip/uip.h
rename to src/net/ipv4/uip/uip.h
index b3a26a3..458c5c3 100644
--- a/src/net/uip/uip.h
+++ b/src/net/ipv4/uip/uip.h
@@ -51,10 +51,10 @@
  *
  */
 
-#ifndef __NET_UIP_UIP_H__
-#define __NET_UIP_UIP_H__
+#ifndef __NET_IPV4_UIP_UIP_H__
+#define __NET_IPV4_UIP_UIP_H__
 
-#include "net/uip/opt.h"
+#include "net/ipv4/uip/opt.h"
 
 /**
  * Representation of an IP address.
@@ -1790,7 +1790,7 @@
 uint16_t uip_icmp6chksum(void);
 
 
-#endif /* __NET_UIP_UIP_H__ */
+#endif /* __NET_IPV4_UIP_UIP_H__ */
 
 
 /** @} */
diff --git a/src/net/net.c b/src/net/net.c
index 65fef30..344a265 100644
--- a/src/net/net.c
+++ b/src/net/net.c
@@ -23,9 +23,9 @@
 #include <endian.h>
 #include <stdio.h>
 
+#include "net/ipv4/uip/arp.h"
+#include "net/ipv4/uip/uip.h"
 #include "net/net.h"
-#include "net/uip/arp.h"
-#include "net/uip/uip.h"
 
 static NetCallback net_callback_func;
 
diff --git a/src/net/netboot/dhcp.c b/src/net/netboot/dhcp.c
index a0e8fb0..51a1df3 100644
--- a/src/net/netboot/dhcp.c
+++ b/src/net/netboot/dhcp.c
@@ -27,11 +27,11 @@
 #include "base/time.h"
 #include "base/xalloc.h"
 #include "drivers/net/net.h"
+#include "net/ipv4/uip/arp.h"
+#include "net/ipv4/uip/udp/packet.h"
+#include "net/ipv4/uip/uip.h"
 #include "net/net.h"
 #include "net/netboot/dhcp.h"
-#include "net/uip/arp.h"
-#include "net/uip/udp/packet.h"
-#include "net/uip/uip.h"
 
 typedef enum DhcpOpcode
 {
diff --git a/src/net/netboot/dhcp.h b/src/net/netboot/dhcp.h
index 3982f0c..e318642 100644
--- a/src/net/netboot/dhcp.h
+++ b/src/net/netboot/dhcp.h
@@ -26,7 +26,7 @@
 #include <stdint.h>
 
 #include "drivers/net/net.h"
-#include "net/uip/uip.h"
+#include "net/ipv4/uip/uip.h"
 
 int dhcp_request(NetDevice *dev, uip_ipaddr_t *next_ip, uip_ipaddr_t *server_ip,
 		 const char **bootfile);
diff --git a/src/net/netboot/netboot.c b/src/net/netboot/netboot.c
index 46d5a3b..521d4f0 100644
--- a/src/net/netboot/netboot.c
+++ b/src/net/netboot/netboot.c
@@ -32,8 +32,8 @@
 #include "net/netboot/netboot.h"
 #include "net/netboot/params.h"
 #include "net/netboot/tftp.h"
-#include "net/uip/arp.h"
-#include "net/uip/uip.h"
+#include "net/ipv4/uip/arp.h"
+#include "net/ipv4/uip/uip.h"
 
 static void print_ip_addr(const uip_ipaddr_t *ip)
 {
diff --git a/src/net/netboot/netboot.h b/src/net/netboot/netboot.h
index 314bfe7..cefe35c 100644
--- a/src/net/netboot/netboot.h
+++ b/src/net/netboot/netboot.h
@@ -20,7 +20,7 @@
 #ifndef __NETBOOT_NETBOOT_H__
 #define __NETBOOT_NETBOOT_H__
 
-#include "net/uip/uip.h"
+#include "net/ipv4/uip/uip.h"
 
 // argsfile takes precedence before args. All parameters can be NULL.
 void netboot(uip_ipaddr_t *tftp_ip, char *bootfile, char *argsfile, char *args);
diff --git a/src/net/netboot/params.c b/src/net/netboot/params.c
index c9c838c..c9e45cd 100644
--- a/src/net/netboot/params.c
+++ b/src/net/netboot/params.c
@@ -28,7 +28,7 @@
 #include "drivers/board/board.h"
 #include "drivers/storage/storage.h"
 #include "net/netboot/params.h"
-#include "net/uip/uip.h"
+#include "net/ipv4/uip/uip.h"
 
 static NetbootParam netboot_params[NetbootParamIdMax];
 
diff --git a/src/net/netboot/params.h b/src/net/netboot/params.h
index 41b0367..d598021 100644
--- a/src/net/netboot/params.h
+++ b/src/net/netboot/params.h
@@ -26,7 +26,7 @@
 #include <stdint.h>
 
 #include "drivers/storage/storage.h"
-#include "net/uip/uip.h"
+#include "net/ipv4/uip/uip.h"
 
 typedef enum NetbootParamId
 {
diff --git a/src/net/netboot/tftp.c b/src/net/netboot/tftp.c
index cf2a9bf..98c1352 100644
--- a/src/net/netboot/tftp.c
+++ b/src/net/netboot/tftp.c
@@ -30,8 +30,8 @@
 #include "drivers/net/net.h"
 #include "net/net.h"
 #include "net/netboot/tftp.h"
-#include "net/uip/udp/packet.h"
-#include "net/uip/uip.h"
+#include "net/ipv4/uip/udp/packet.h"
+#include "net/ipv4/uip/uip.h"
 
 static const uint64_t TftpReceiveTimeoutUs = 100000;
 
diff --git a/src/net/netboot/tftp.h b/src/net/netboot/tftp.h
index 8ec699d..90bd4de 100644
--- a/src/net/netboot/tftp.h
+++ b/src/net/netboot/tftp.h
@@ -23,7 +23,7 @@
 #ifndef __NETBOOT_TFTP_H__
 #define __NETBOOT_TFTP_H__
 
-#include "net/uip/uip.h"
+#include "net/ipv4/uip/uip.h"
 
 typedef enum TftpOpcode
 {