summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1998-08-20 14:37:17 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1998-08-20 14:37:17 +0000
commit3f098aed4500da38db8afdff111f02198158203a (patch)
tree370225501caf56821883daa3971214b3d82e28bb
parentc197b6c2ec838f1c9e37804c43774b3864bf9ba3 (diff)
downloadrtems-3f098aed4500da38db8afdff111f02198158203a.tar.bz2
FreeBSD stack compiles for the first time (except libc/strsep.c).
-rw-r--r--c/src/exec/libnetworking/machine/conf.h0
-rw-r--r--c/src/exec/libnetworking/machine/cpu.h0
-rw-r--r--c/src/exec/libnetworking/machine/cpufunc.h0
-rw-r--r--c/src/exec/libnetworking/machine/endian.h60
-rw-r--r--c/src/exec/libnetworking/machine/in_cksum.h118
-rw-r--r--c/src/exec/libnetworking/machine/limits.h0
-rw-r--r--c/src/exec/libnetworking/machine/param.h88
-rw-r--r--c/src/exec/libnetworking/machine/types.h32
-rw-r--r--c/src/exec/libnetworking/machine/vmparam.h0
-rw-r--r--c/src/lib/libnetworking/include/Makefile.in65
-rw-r--r--c/src/lib/libnetworking/kern/Makefile.in5
-rw-r--r--c/src/lib/libnetworking/lib/Makefile.in2
-rw-r--r--c/src/lib/libnetworking/libc/Makefile.in6
-rw-r--r--c/src/lib/libnetworking/machine/conf.h0
-rw-r--r--c/src/lib/libnetworking/machine/cpu.h0
-rw-r--r--c/src/lib/libnetworking/machine/cpufunc.h0
-rw-r--r--c/src/lib/libnetworking/machine/endian.h60
-rw-r--r--c/src/lib/libnetworking/machine/in_cksum.h118
-rw-r--r--c/src/lib/libnetworking/machine/limits.h0
-rw-r--r--c/src/lib/libnetworking/machine/param.h88
-rw-r--r--c/src/lib/libnetworking/machine/types.h32
-rw-r--r--c/src/lib/libnetworking/machine/vmparam.h0
-rw-r--r--c/src/lib/libnetworking/net/Makefile.in3
-rw-r--r--c/src/lib/libnetworking/netinet/Makefile.in5
-rw-r--r--c/src/lib/libnetworking/nfs/Makefile.in3
-rw-r--r--c/src/lib/libnetworking/rtems/Makefile.in3
-rw-r--r--c/src/lib/libnetworking/wrapup/Makefile.in2
-rw-r--r--c/src/libnetworking/include/Makefile.in65
-rw-r--r--c/src/libnetworking/kern/Makefile.in5
-rw-r--r--c/src/libnetworking/lib/Makefile.in2
-rw-r--r--c/src/libnetworking/libc/Makefile.in6
-rw-r--r--c/src/libnetworking/machine/conf.h0
-rw-r--r--c/src/libnetworking/machine/cpu.h0
-rw-r--r--c/src/libnetworking/machine/cpufunc.h0
-rw-r--r--c/src/libnetworking/machine/endian.h60
-rw-r--r--c/src/libnetworking/machine/in_cksum.h118
-rw-r--r--c/src/libnetworking/machine/limits.h0
-rw-r--r--c/src/libnetworking/machine/param.h88
-rw-r--r--c/src/libnetworking/machine/types.h32
-rw-r--r--c/src/libnetworking/machine/vmparam.h0
-rw-r--r--c/src/libnetworking/net/Makefile.in3
-rw-r--r--c/src/libnetworking/netinet/Makefile.in5
-rw-r--r--c/src/libnetworking/nfs/Makefile.in3
-rw-r--r--c/src/libnetworking/rtems/Makefile.in3
-rw-r--r--c/src/libnetworking/wrapup/Makefile.in2
-rw-r--r--cpukit/libnetworking/machine/conf.h0
-rw-r--r--cpukit/libnetworking/machine/cpu.h0
-rw-r--r--cpukit/libnetworking/machine/cpufunc.h0
-rw-r--r--cpukit/libnetworking/machine/endian.h60
-rw-r--r--cpukit/libnetworking/machine/in_cksum.h118
-rw-r--r--cpukit/libnetworking/machine/limits.h0
-rw-r--r--cpukit/libnetworking/machine/param.h88
-rw-r--r--cpukit/libnetworking/machine/types.h32
-rw-r--r--cpukit/libnetworking/machine/vmparam.h0
54 files changed, 1356 insertions, 24 deletions
diff --git a/c/src/exec/libnetworking/machine/conf.h b/c/src/exec/libnetworking/machine/conf.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/c/src/exec/libnetworking/machine/conf.h
diff --git a/c/src/exec/libnetworking/machine/cpu.h b/c/src/exec/libnetworking/machine/cpu.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/c/src/exec/libnetworking/machine/cpu.h
diff --git a/c/src/exec/libnetworking/machine/cpufunc.h b/c/src/exec/libnetworking/machine/cpufunc.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/c/src/exec/libnetworking/machine/cpufunc.h
diff --git a/c/src/exec/libnetworking/machine/endian.h b/c/src/exec/libnetworking/machine/endian.h
new file mode 100644
index 0000000000..cd0d6f551c
--- /dev/null
+++ b/c/src/exec/libnetworking/machine/endian.h
@@ -0,0 +1,60 @@
+#ifndef _MACHINE_ENDIAN_H_
+#define _MACHINE_ENDIAN_H_
+
+#include <rtems/score/cpu.h>
+
+/*
+ * BSD-style endian declaration
+ */
+#define BIG_ENDIAN 4321
+#define LITTLE_ENDIAN 1234
+
+#if CPU_BIG_ENDIAN
+# define BYTE_ORDER BIG_ENDIAN
+#elif CPU_LITTLE_ENDIAN
+# define BYTE_ORDER LITTLE_ENDIAN
+#else
+# error "Can't decide which end is which!"
+#endif
+
+#if ( CPU_HAS_OWN_HOST_TO_NETWORK_ROUTINES == FALSE )
+
+#if ( CPU_BIG_ENDIAN == TRUE )
+
+/*
+ * Very simply on big endian CPUs
+ */
+
+#define ntohl(_x) (_x)
+#define ntohs(_x) (_x)
+#define htonl(_x) (_x)
+#define htons(_x) (_x)
+
+#define NTOHS(x)
+#define HTONS(x)
+#define NTOHL(x)
+#define HTONL(x)
+
+#elif ( CPU_LITTLE_ENDIAN == TRUE )
+
+/*
+ * A little more complicated on little endian CPUs
+ */
+
+#define ntohl(_x) ((long) CPU_swap_u32((unsigned32)_x))
+#define ntohs(_x) ((short) CPU_swap_u16((unsigned16)_x))
+#define htonl(_x) ((long) CPU_swap_u32((unsigned32)_x))
+#define htons(_x) ((short) CPU_swap_u16((unsigned16)_x))
+
+#define NTOHS(x) (x) = ntohs(x)
+#define HTONS(x) (x) = htons(x)
+#define NTOHL(x) (x) = ntohl(x)
+#define HTONL(x) (x) = htonl(x)
+
+#else
+#error "Unknown endian-ness for this cpu"
+#endif
+
+#endif /* CPU_HAS_OWN_HOST_TO_NETWORK_ROUTINES */
+
+#endif /* _MACHINE_ENDIAN_H_ */
diff --git a/c/src/exec/libnetworking/machine/in_cksum.h b/c/src/exec/libnetworking/machine/in_cksum.h
new file mode 100644
index 0000000000..15509b3888
--- /dev/null
+++ b/c/src/exec/libnetworking/machine/in_cksum.h
@@ -0,0 +1,118 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from tahoe: in_cksum.c 1.2 86/01/05
+ * from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91
+ * from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp
+ * $Id$
+ */
+
+#ifndef _MACHINE_IN_CKSUM_H_
+#define _MACHINE_IN_CKSUM_H_ 1
+
+#include <sys/cdefs.h>
+
+/*
+ * It it useful to have an Internet checksum routine which is inlineable
+ * and optimized specifically for the task of computing IP header checksums
+ * in the normal case (where there are no options and the header length is
+ * therefore always exactly five 32-bit words.
+ */
+#if (defined(__GNUC__) && defined(__i386__))
+static __inline u_int
+in_cksum_hdr(const struct ip *ip)
+{
+ register u_int sum = 0;
+
+#define ADD(n) __asm("addl " #n "(%2), %0" : "=r" (sum) : "0" (sum), "r" (ip))
+#define ADDC(n) __asm("adcl " #n "(%2), %0" : "=r" (sum) : "0" (sum), "r" (ip))
+#define MOP __asm("adcl $0, %0" : "=r" (sum) : "0" (sum))
+
+ ADD(0);
+ ADDC(4);
+ ADDC(8);
+ ADDC(12);
+ ADDC(16);
+ MOP;
+ sum = (sum & 0xffff) + (sum >> 16);
+ if (sum > 0xffff)
+ sum -= 0xffff;
+
+ return ~sum & 0xffff;
+}
+
+static __inline void
+in_cksum_update(struct ip *ip)
+{
+ int __tmpsum;
+ __tmpsum = (int)ntohs(ip->ip_sum) + 256;
+ ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16));
+}
+
+#elif (defined(__GNUC__) && (defined(__mc68000__) || defined(__m68k__)))
+
+static __inline__ u_int
+in_cksum_hdr(const struct ip *ip)
+{
+ register u_int *ap = (u_int *)ip;
+ register u_int sum = *ap++;
+ register u_int tmp;
+
+ __asm__("addl %2@+,%0\n\t"
+ "movel %2@+,%1\n\t"
+ "addxl %1,%0\n\t"
+ "movel %2@+,%1\n\t"
+ "addxl %1,%0\n\t"
+ "movel %2@,%1\n\t"
+ "addxl %1,%0\n\t"
+ "moveq #0,%1\n\t"
+ "addxl %1,%0\n" :
+ "=d" (sum), "=d" (tmp), "=a" (ap) :
+ "0" (sum), "2" (ap));
+ sum = (sum & 0xffff) + (sum >> 16);
+ if (sum > 0xffff)
+ sum -= 0xffff;
+ return ~sum & 0xffff;
+}
+
+#else
+u_int in_cksum_hdr __P((const struct ip *));
+#define in_cksum_update(ip) \
+ do { \
+ int __tmpsum; \
+ __tmpsum = (int)ntohs(ip->ip_sum) + 256; \
+ ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); \
+ } while(0)
+
+#endif
+
+#endif /* _MACHINE_IN_CKSUM_H_ */
diff --git a/c/src/exec/libnetworking/machine/limits.h b/c/src/exec/libnetworking/machine/limits.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/c/src/exec/libnetworking/machine/limits.h
diff --git a/c/src/exec/libnetworking/machine/param.h b/c/src/exec/libnetworking/machine/param.h
new file mode 100644
index 0000000000..eae8554c2a
--- /dev/null
+++ b/c/src/exec/libnetworking/machine/param.h
@@ -0,0 +1,88 @@
+#ifndef _MACHINE_PARAM_H_
+#define _MACHINE_PARAM_H_
+
+/*
+ * These aren't really machine-dependent for RTEMS.....
+ */
+
+/*
+#define MACHINE "i386"
+#define MID_MACHINE MID_I386
+*/
+
+/*
+ * Round p (pointer or byte index) up to a correctly-aligned value
+ * for all data types (int, long, ...). The result is unsigned int
+ * and must be cast to any desired pointer type.
+ */
+#define ALIGNBYTES (sizeof(int) - 1)
+#define ALIGN(p) (((unsigned)(p) + ALIGNBYTES) & ~ALIGNBYTES)
+
+#define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */
+#define PAGE_SIZE (1<<PAGE_SHIFT) /* bytes/page */
+#define PAGE_MASK (PAGE_SIZE-1)
+#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t)))
+
+#define NPDEPG (PAGE_SIZE/(sizeof (pd_entry_t)))
+#define PDRSHIFT 22 /* LOG2(NBPDR) */
+#define NBPDR (1<<PDRSHIFT) /* bytes/page dir */
+
+#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
+#define DEV_BSIZE (1<<DEV_BSHIFT)
+
+#define BLKDEV_IOSIZE 2048
+#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
+
+#define UPAGES 2 /* pages of u-area */
+
+/*
+ * Constants related to network buffer management.
+ * MCLBYTES must be no larger than CLBYTES (the software page size), and,
+ * on machines that exchange pages of input or output buffers with mbuf
+ * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
+ * of the hardware page size.
+ */
+#ifndef MSIZE
+#define MSIZE 128 /* size of an mbuf */
+#endif /* MSIZE */
+
+#ifndef MCLSHIFT
+#define MCLSHIFT 11 /* convert bytes to m_buf clusters */
+#endif /* MCLSHIFT */
+#define MCLBYTES (1 << MCLSHIFT) /* size of an m_buf cluster */
+#define MCLOFSET (MCLBYTES - 1) /* offset within an m_buf cluster */
+
+/*
+ * Some macros for units conversion
+ */
+
+/* clicks to bytes */
+#define ctob(x) ((x)<<PAGE_SHIFT)
+
+/* bytes to clicks */
+#define btoc(x) (((unsigned)(x)+PAGE_MASK)>>PAGE_SHIFT)
+
+/*
+ * btodb() is messy and perhaps slow because `bytes' may be an off_t. We
+ * want to shift an unsigned type to avoid sign extension and we don't
+ * want to widen `bytes' unnecessarily. Assume that the result fits in
+ * a daddr_t.
+ */
+#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
+ (sizeof (bytes) > sizeof(long) \
+ ? (daddr_t)((unsigned long long)(bytes) >> DEV_BSHIFT) \
+ : (daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT))
+
+#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \
+ ((off_t)(db) << DEV_BSHIFT)
+
+/*
+ * Mach derived conversion macros
+ */
+#define trunc_page(x) ((unsigned)(x) & ~PAGE_MASK)
+#define round_page(x) ((((unsigned)(x)) + PAGE_MASK) & ~PAGE_MASK)
+
+#define atop(x) ((unsigned)(x) >> PAGE_SHIFT)
+#define ptoa(x) ((unsigned)(x) << PAGE_SHIFT)
+
+#endif /* !_MACHINE_PARAM_H_ */
diff --git a/c/src/exec/libnetworking/machine/types.h b/c/src/exec/libnetworking/machine/types.h
new file mode 100644
index 0000000000..1f9ee143a5
--- /dev/null
+++ b/c/src/exec/libnetworking/machine/types.h
@@ -0,0 +1,32 @@
+/*
+ * This file will have to be incorparated into the RTEMS source
+ * tree (probably in the existing <machine/types.h> so that these
+ * contents are included when an application source file includes
+ * <sys/types.h>.
+ */
+
+#ifndef _MACHINE_TYPES_H_
+#define _MACHINE_TYPES_H_
+
+#include <rtems.h>
+#include <machine/endian.h>
+
+typedef rtems_signed64 int64_t;
+typedef rtems_signed32 int32_t;
+typedef rtems_signed16 int16_t;
+typedef rtems_signed8 int8_t;
+
+typedef rtems_unsigned64 u_int64_t;
+typedef rtems_unsigned32 u_int32_t;
+typedef rtems_unsigned16 u_int16_t;
+typedef rtems_unsigned8 u_int8_t;
+
+#define _CLOCK_T_ unsigned long
+#define _TIME_T_ long
+
+#ifdef _COMPILING_BSD_KERNEL_
+#include <rtems/rtems_bsdnet_internal.h>
+#include <rtems/rtems_bsdnet.h>
+#endif
+
+#endif /* _MACHINE_TYPES_H_ */
diff --git a/c/src/exec/libnetworking/machine/vmparam.h b/c/src/exec/libnetworking/machine/vmparam.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/c/src/exec/libnetworking/machine/vmparam.h
diff --git a/c/src/lib/libnetworking/include/Makefile.in b/c/src/lib/libnetworking/include/Makefile.in
new file mode 100644
index 0000000000..e5b1506e62
--- /dev/null
+++ b/c/src/lib/libnetworking/include/Makefile.in
@@ -0,0 +1,65 @@
+#
+# $Id$
+#
+
+@SET_MAKE@
+srcdir = @srcdir@
+VPATH = @srcdir@
+RTEMS_ROOT = @top_srcdir@
+PROJECT_ROOT = @PROJECT_ROOT@
+
+H_PIECES=bpfilter loop netdb networkconfig opt_ipfw opt_mrouting \
+ opt_tcpdebug poll resolv syslog
+H_FILES=$(H_PIECES:%=$(srcdir)/../%.h)
+
+SYS_H_PIECES=buf callout cdefs conf domain filio ioccom ioctl kernel \
+ libkern malloc mbuf mount param proc protosw queue reboot \
+ resourcevar rtprio select signalvar socket socketvar \
+ sockio sysctl syslimits syslog systm ttycom ttydefaults \
+ ucred uio
+SYS_H_FILES=$(SYS_H_PIECES:%=$(srcdir)/../sys/%.h)
+
+RTEMS_H_PIECES= rtems_bsdnet
+RTEMS_H_FILES=$(RTEMS_H_PIECES:%=$(srcdir)/../rtems/%.h)
+
+MACHINE_H_PIECES= conf cpu cpufunc endian in_cksum limits param types vmparam
+MACHINE_H_FILES=$(MACHINE_H_PIECES:%=$(srcdir)/../machine/%.h)
+
+VM_H_PIECES= vm vm_extern vm_kern vm_param
+VM_H_FILES=$(VM_H_PIECES:%=$(srcdir)/../vm/%.h)
+
+NET_H_PIECES= bpf ethernet if if_arp if_dl if_llc if_types netisr \
+ radix raw_cb route
+NET_H_FILES=$(NET_H_PIECES:%=$(srcdir)/../net/%.h)
+
+NETINET_H_PIECES= icmp_var if_ether igmp igmp_var in in_pcb in_systm in_var \
+ ip ip_fw ip_icmp ip_mroute ip_var tcp tcp_debug tcp_fsm \
+ tcp_seq tcp_timer tcp_var tcpip udp udp_var
+NETINET_H_FILES=$(NETINET_H_PIECES:%=$(srcdir)/../netinet/%.h)
+
+ARPA_H_PIECES= ftp inet nameser nameser_compat telnet
+ARPA_H_FILES=$(ARPA_H_PIECES:%=$(srcdir)/../arpa/%.h)
+
+NFS_H_PIECES= krpc nfs nfsdiskless nfsproto rpcv2 xdr_subs
+NFS_H_FILES=$(NFS_H_PIECES:%=$(srcdir)/../nfs/%.h)
+
+SRCS=$(H_FILES) $(SYS_H_FILES) $(RTEMS_H_FILES) $(MACHINE_H_FILES) \
+ $(VM_H_FILES) $(NET_H_FILES) $(NETINET_H_FILES) $(ARPA_H_FILES) \
+ $(NFS_H_FILES)
+
+include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
+include $(RTEMS_ROOT)/make/leaf.cfg
+
+CLEAN_ADDITIONS +=
+CLOBBER_ADDITIONS +=
+
+all: $(SRCS)
+ $(INSTALL) -m 444 $(H_FILES) $(PROJECT_INCLUDE)/networking
+ $(INSTALL) -m 444 $(SYS_H_FILES) $(PROJECT_INCLUDE)/networking/sys
+ $(INSTALL) -m 444 $(RTEMS_H_FILES) $(PROJECT_INCLUDE)/networking/rtems
+ $(INSTALL) -m 444 $(MACHINE_H_FILES) $(PROJECT_INCLUDE)/networking/machine
+ $(INSTALL) -m 444 $(VM_H_FILES) $(PROJECT_INCLUDE)/networking/vm
+ $(INSTALL) -m 444 $(NET_H_FILES) $(PROJECT_INCLUDE)/networking/net
+ $(INSTALL) -m 444 $(NETINET_H_FILES) $(PROJECT_INCLUDE)/networking/netinet
+ $(INSTALL) -m 444 $(ARPA_H_FILES) $(PROJECT_INCLUDE)/networking/arpa
+ $(INSTALL) -m 444 $(NFS_H_FILES) $(PROJECT_INCLUDE)/networking/nfs
diff --git a/c/src/lib/libnetworking/kern/Makefile.in b/c/src/lib/libnetworking/kern/Makefile.in
index 7801bb77ba..35804e14ef 100644
--- a/c/src/lib/libnetworking/kern/Makefile.in
+++ b/c/src/lib/libnetworking/kern/Makefile.in
@@ -8,7 +8,7 @@ VPATH = @srcdir@
RTEMS_ROOT = @top_srcdir@
PROJECT_ROOT = @PROJECT_ROOT@
-LIBNAME=kern.a
+LIBNAME=lib.a
LIB=${ARCH}/${LIBNAME}
# C and C++ source names, if any, go here -- minus the .c or .cc
@@ -26,7 +26,8 @@ include $(RTEMS_ROOT)/make/lib.cfg
# Add local stuff here using +=
#
-DEFINES +=
+DEFINES += -D_COMPILING_BSD_KERNEL_ -DKERNEL -DINET -DNFS \
+ -DDIAGNOSTIC -DBOOTP_COMPAT
CPPFLAGS +=
CFLAGS +=
diff --git a/c/src/lib/libnetworking/lib/Makefile.in b/c/src/lib/libnetworking/lib/Makefile.in
index a568b8cc96..869818fadf 100644
--- a/c/src/lib/libnetworking/lib/Makefile.in
+++ b/c/src/lib/libnetworking/lib/Makefile.in
@@ -26,7 +26,7 @@ include $(RTEMS_ROOT)/make/lib.cfg
# Add local stuff here using +=
#
-DEFINES +=
+DEFINES += -DNOPOLL -DNOSELECT
CPPFLAGS +=
CFLAGS +=
diff --git a/c/src/lib/libnetworking/libc/Makefile.in b/c/src/lib/libnetworking/libc/Makefile.in
index 64417585cf..132c059cab 100644
--- a/c/src/lib/libnetworking/libc/Makefile.in
+++ b/c/src/lib/libnetworking/libc/Makefile.in
@@ -12,10 +12,10 @@ LIBNAME=lib.a
LIB=${ARCH}/${LIBNAME}
# C and C++ source names, if any, go here -- minus the .c or .cc
-C_PIECES= base64 \
+C_PIECES= base64 \
gethostbydns gethostbyht gethostbynis gethostnamadr \
herror \
- inet_addr inet_ntoa inet_ntop inet_pton \
+ inet_addr inet_ntoa inet_ntop inet_pton \
map_v4v6 \
nsap_addr ns_name ns_netint ns_parse ns_print ns_ttl \
res_comp res_data res_debug res_init res_mkquery res_mkupdate \
@@ -34,7 +34,7 @@ include $(RTEMS_ROOT)/make/lib.cfg
# Add local stuff here using +=
#
-DEFINES +=
+DEFINES += -DNOPOLL -DNOSELECT
CPPFLAGS +=
CFLAGS +=
diff --git a/c/src/lib/libnetworking/machine/conf.h b/c/src/lib/libnetworking/machine/conf.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/c/src/lib/libnetworking/machine/conf.h
diff --git a/c/src/lib/libnetworking/machine/cpu.h b/c/src/lib/libnetworking/machine/cpu.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/c/src/lib/libnetworking/machine/cpu.h
diff --git a/c/src/lib/libnetworking/machine/cpufunc.h b/c/src/lib/libnetworking/machine/cpufunc.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/c/src/lib/libnetworking/machine/cpufunc.h
diff --git a/c/src/lib/libnetworking/machine/endian.h b/c/src/lib/libnetworking/machine/endian.h
new file mode 100644
index 0000000000..cd0d6f551c
--- /dev/null
+++ b/c/src/lib/libnetworking/machine/endian.h
@@ -0,0 +1,60 @@
+#ifndef _MACHINE_ENDIAN_H_
+#define _MACHINE_ENDIAN_H_
+
+#include <rtems/score/cpu.h>
+
+/*
+ * BSD-style endian declaration
+ */
+#define BIG_ENDIAN 4321
+#define LITTLE_ENDIAN 1234
+
+#if CPU_BIG_ENDIAN
+# define BYTE_ORDER BIG_ENDIAN
+#elif CPU_LITTLE_ENDIAN
+# define BYTE_ORDER LITTLE_ENDIAN
+#else
+# error "Can't decide which end is which!"
+#endif
+
+#if ( CPU_HAS_OWN_HOST_TO_NETWORK_ROUTINES == FALSE )
+
+#if ( CPU_BIG_ENDIAN == TRUE )
+
+/*
+ * Very simply on big endian CPUs
+ */
+
+#define ntohl(_x) (_x)
+#define ntohs(_x) (_x)
+#define htonl(_x) (_x)
+#define htons(_x) (_x)
+
+#define NTOHS(x)
+#define HTONS(x)
+#define NTOHL(x)
+#define HTONL(x)
+
+#elif ( CPU_LITTLE_ENDIAN == TRUE )
+
+/*
+ * A little more complicated on little endian CPUs
+ */
+
+#define ntohl(_x) ((long) CPU_swap_u32((unsigned32)_x))
+#define ntohs(_x) ((short) CPU_swap_u16((unsigned16)_x))
+#define htonl(_x) ((long) CPU_swap_u32((unsigned32)_x))
+#define htons(_x) ((short) CPU_swap_u16((unsigned16)_x))
+
+#define NTOHS(x) (x) = ntohs(x)
+#define HTONS(x) (x) = htons(x)
+#define NTOHL(x) (x) = ntohl(x)
+#define HTONL(x) (x) = htonl(x)
+
+#else
+#error "Unknown endian-ness for this cpu"
+#endif
+
+#endif /* CPU_HAS_OWN_HOST_TO_NETWORK_ROUTINES */
+
+#endif /* _MACHINE_ENDIAN_H_ */
diff --git a/c/src/lib/libnetworking/machine/in_cksum.h b/c/src/lib/libnetworking/machine/in_cksum.h
new file mode 100644
index 0000000000..15509b3888
--- /dev/null
+++ b/c/src/lib/libnetworking/machine/in_cksum.h
@@ -0,0 +1,118 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from tahoe: in_cksum.c 1.2 86/01/05
+ * from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91
+ * from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp
+ * $Id$
+ */
+
+#ifndef _MACHINE_IN_CKSUM_H_
+#define _MACHINE_IN_CKSUM_H_ 1
+
+#include <sys/cdefs.h>
+
+/*
+ * It it useful to have an Internet checksum routine which is inlineable
+ * and optimized specifically for the task of computing IP header checksums
+ * in the normal case (where there are no options and the header length is
+ * therefore always exactly five 32-bit words.
+ */
+#if (defined(__GNUC__) && defined(__i386__))
+static __inline u_int
+in_cksum_hdr(const struct ip *ip)
+{
+ register u_int sum = 0;
+
+#define ADD(n) __asm("addl " #n "(%2), %0" : "=r" (sum) : "0" (sum), "r" (ip))
+#define ADDC(n) __asm("adcl " #n "(%2), %0" : "=r" (sum) : "0" (sum), "r" (ip))
+#define MOP __asm("adcl $0, %0" : "=r" (sum) : "0" (sum))
+
+ ADD(0);
+ ADDC(4);
+ ADDC(8);
+ ADDC(12);
+ ADDC(16);
+ MOP;
+ sum = (sum & 0xffff) + (sum >> 16);
+ if (sum > 0xffff)
+ sum -= 0xffff;
+
+ return ~sum & 0xffff;
+}
+
+static __inline void
+in_cksum_update(struct ip *ip)
+{
+ int __tmpsum;
+ __tmpsum = (int)ntohs(ip->ip_sum) + 256;
+ ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16));
+}
+
+#elif (defined(__GNUC__) && (defined(__mc68000__) || defined(__m68k__)))
+
+static __inline__ u_int
+in_cksum_hdr(const struct ip *ip)
+{
+ register u_int *ap = (u_int *)ip;
+ register u_int sum = *ap++;
+ register u_int tmp;
+
+ __asm__("addl %2@+,%0\n\t"
+ "movel %2@+,%1\n\t"
+ "addxl %1,%0\n\t"
+ "movel %2@+,%1\n\t"
+ "addxl %1,%0\n\t"
+ "movel %2@,%1\n\t"
+ "addxl %1,%0\n\t"
+ "moveq #0,%1\n\t"
+ "addxl %1,%0\n" :
+ "=d" (sum), "=d" (tmp), "=a" (ap) :
+ "0" (sum), "2" (ap));
+ sum = (sum & 0xffff) + (sum >> 16);
+ if (sum > 0xffff)
+ sum -= 0xffff;
+ return ~sum & 0xffff;
+}
+
+#else
+u_int in_cksum_hdr __P((const struct ip *));
+#define in_cksum_update(ip) \
+ do { \
+ int __tmpsum; \
+ __tmpsum = (int)ntohs(ip->ip_sum) + 256; \
+ ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); \
+ } while(0)
+
+#endif
+
+#endif /* _MACHINE_IN_CKSUM_H_ */
diff --git a/c/src/lib/libnetworking/machine/limits.h b/c/src/lib/libnetworking/machine/limits.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/c/src/lib/libnetworking/machine/limits.h
diff --git a/c/src/lib/libnetworking/machine/param.h b/c/src/lib/libnetworking/machine/param.h
new file mode 100644
index 0000000000..eae8554c2a
--- /dev/null
+++ b/c/src/lib/libnetworking/machine/param.h
@@ -0,0 +1,88 @@
+#ifndef _MACHINE_PARAM_H_
+#define _MACHINE_PARAM_H_
+
+/*
+ * These aren't really machine-dependent for RTEMS.....
+ */
+
+/*
+#define MACHINE "i386"
+#define MID_MACHINE MID_I386
+*/
+
+/*
+ * Round p (pointer or byte index) up to a correctly-aligned value
+ * for all data types (int, long, ...). The result is unsigned int
+ * and must be cast to any desired pointer type.
+ */
+#define ALIGNBYTES (sizeof(int) - 1)
+#define ALIGN(p) (((unsigned)(p) + ALIGNBYTES) & ~ALIGNBYTES)
+
+#define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */
+#define PAGE_SIZE (1<<PAGE_SHIFT) /* bytes/page */
+#define PAGE_MASK (PAGE_SIZE-1)
+#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t)))
+
+#define NPDEPG (PAGE_SIZE/(sizeof (pd_entry_t)))
+#define PDRSHIFT 22 /* LOG2(NBPDR) */
+#define NBPDR (1<<PDRSHIFT) /* bytes/page dir */
+
+#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
+#define DEV_BSIZE (1<<DEV_BSHIFT)
+
+#define BLKDEV_IOSIZE 2048
+#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
+
+#define UPAGES 2 /* pages of u-area */
+
+/*
+ * Constants related to network buffer management.
+ * MCLBYTES must be no larger than CLBYTES (the software page size), and,
+ * on machines that exchange pages of input or output buffers with mbuf
+ * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
+ * of the hardware page size.
+ */
+#ifndef MSIZE
+#define MSIZE 128 /* size of an mbuf */
+#endif /* MSIZE */
+
+#ifndef MCLSHIFT
+#define MCLSHIFT 11 /* convert bytes to m_buf clusters */
+#endif /* MCLSHIFT */
+#define MCLBYTES (1 << MCLSHIFT) /* size of an m_buf cluster */
+#define MCLOFSET (MCLBYTES - 1) /* offset within an m_buf cluster */
+
+/*
+ * Some macros for units conversion
+ */
+
+/* clicks to bytes */
+#define ctob(x) ((x)<<PAGE_SHIFT)
+
+/* bytes to clicks */
+#define btoc(x) (((unsigned)(x)+PAGE_MASK)>>PAGE_SHIFT)
+
+/*
+ * btodb() is messy and perhaps slow because `bytes' may be an off_t. We
+ * want to shift an unsigned type to avoid sign extension and we don't
+ * want to widen `bytes' unnecessarily. Assume that the result fits in
+ * a daddr_t.
+ */
+#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
+ (sizeof (bytes) > sizeof(long) \
+ ? (daddr_t)((unsigned long long)(bytes) >> DEV_BSHIFT) \
+ : (daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT))
+
+#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \
+ ((off_t)(db) << DEV_BSHIFT)
+
+/*
+ * Mach derived conversion macros
+ */
+#define trunc_page(x) ((unsigned)(x) & ~PAGE_MASK)
+#define round_page(x) ((((unsigned)(x)) + PAGE_MASK) & ~PAGE_MASK)
+
+#define atop(x) ((unsigned)(x) >> PAGE_SHIFT)
+#define ptoa(x) ((unsigned)(x) << PAGE_SHIFT)
+
+#endif /* !_MACHINE_PARAM_H_ */
diff --git a/c/src/lib/libnetworking/machine/types.h b/c/src/lib/libnetworking/machine/types.h
new file mode 100644
index 0000000000..1f9ee143a5
--- /dev/null
+++ b/c/src/lib/libnetworking/machine/types.h
@@ -0,0 +1,32 @@
+/*
+ * This file will have to be incorparated into the RTEMS source
+ * tree (probably in the existing <machine/types.h> so that these
+ * contents are included when an application source file includes
+ * <sys/types.h>.
+ */
+
+#ifndef _MACHINE_TYPES_H_
+#define _MACHINE_TYPES_H_
+
+#include <rtems.h>
+#include <machine/endian.h>
+
+typedef rtems_signed64 int64_t;
+typedef rtems_signed32 int32_t;
+typedef rtems_signed16 int16_t;
+typedef rtems_signed8 int8_t;
+
+typedef rtems_unsigned64 u_int64_t;
+typedef rtems_unsigned32 u_int32_t;
+typedef rtems_unsigned16 u_int16_t;
+typedef rtems_unsigned8 u_int8_t;
+
+#define _CLOCK_T_ unsigned long
+#define _TIME_T_ long
+
+#ifdef _COMPILING_BSD_KERNEL_
+#include <rtems/rtems_bsdnet_internal.h>
+#include <rtems/rtems_bsdnet.h>
+#endif
+
+#endif /* _MACHINE_TYPES_H_ */
diff --git a/c/src/lib/libnetworking/machine/vmparam.h b/c/src/lib/libnetworking/machine/vmparam.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/c/src/lib/libnetworking/machine/vmparam.h
diff --git a/c/src/lib/libnetworking/net/Makefile.in b/c/src/lib/libnetworking/net/Makefile.in
index c47fdb90fe..5a68c81ec0 100644
--- a/c/src/lib/libnetworking/net/Makefile.in
+++ b/c/src/lib/libnetworking/net/Makefile.in
@@ -28,7 +28,8 @@ include $(RTEMS_ROOT)/make/lib.cfg
# Add local stuff here using +=
#
-DEFINES +=
+DEFINES += -D_COMPILING_BSD_KERNEL_ -DKERNEL -DINET -DNFS \
+ -DDIAGNOSTIC -DBOOTP_COMPAT
CPPFLAGS +=
CFLAGS +=
diff --git a/c/src/lib/libnetworking/netinet/Makefile.in b/c/src/lib/libnetworking/netinet/Makefile.in
index d7b74746a8..94a8f2f0b8 100644
--- a/c/src/lib/libnetworking/netinet/Makefile.in
+++ b/c/src/lib/libnetworking/netinet/Makefile.in
@@ -16,7 +16,7 @@ C_PIECES=if_ether \
igmp \
in in_cksum in_pcb in_proto in_rmx \
ip_divert ip_fw ip_icmp ip_input ip_mroute ip_output \
- raw_ip \
+ raw_ip \
tcp_debug tcp_input tcp_output tcp_subr tcp_timer tcp_usrreq \
udp_usrreq
C_FILES=$(C_PIECES:%=%.c)
@@ -32,7 +32,8 @@ include $(RTEMS_ROOT)/make/lib.cfg
# Add local stuff here using +=
#
-DEFINES +=
+DEFINES += -D_COMPILING_BSD_KERNEL_ -DKERNEL -DINET -DNFS \
+ -DDIAGNOSTIC -DBOOTP_COMPAT
CPPFLAGS +=
CFLAGS +=
diff --git a/c/src/lib/libnetworking/nfs/Makefile.in b/c/src/lib/libnetworking/nfs/Makefile.in
index 62cf991737..404d85040a 100644
--- a/c/src/lib/libnetworking/nfs/Makefile.in
+++ b/c/src/lib/libnetworking/nfs/Makefile.in
@@ -26,7 +26,8 @@ include $(RTEMS_ROOT)/make/lib.cfg
# Add local stuff here using +=
#
-DEFINES +=
+DEFINES += -D_COMPILING_BSD_KERNEL_ -DKERNEL -DINET -DNFS \
+ -DDIAGNOSTIC -DBOOTP_COMPAT
CPPFLAGS +=
CFLAGS +=
diff --git a/c/src/lib/libnetworking/rtems/Makefile.in b/c/src/lib/libnetworking/rtems/Makefile.in
index ea8297cf84..038fb5c68e 100644
--- a/c/src/lib/libnetworking/rtems/Makefile.in
+++ b/c/src/lib/libnetworking/rtems/Makefile.in
@@ -30,7 +30,8 @@ include $(RTEMS_ROOT)/make/lib.cfg
# Add local stuff here using +=
#
-DEFINES +=
+DEFINES += -D_COMPILING_BSD_KERNEL_ -DKERNEL -DINET -DNFS \
+ -DDIAGNOSTIC -DBOOTP_COMPAT
CPPFLAGS +=
CFLAGS +=
diff --git a/c/src/lib/libnetworking/wrapup/Makefile.in b/c/src/lib/libnetworking/wrapup/Makefile.in
index 5961c093e8..55b9f618ed 100644
--- a/c/src/lib/libnetworking/wrapup/Makefile.in
+++ b/c/src/lib/libnetworking/wrapup/Makefile.in
@@ -9,7 +9,7 @@ RTEMS_ROOT = @top_srcdir@
PROJECT_ROOT = @PROJECT_ROOT@
NET_PIECES=kern lib libc net netinet nfs rtems
-OBJS=$(foreach piece, $(NET_PIECES), ../$(piece)/$(ARCH)/$(piece).rel)
+OBJS=$(foreach piece, $(NET_PIECES), ../$(piece)/$(ARCH)/*.o)
LIB=$(ARCH)/libnetworking.a
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
diff --git a/c/src/libnetworking/include/Makefile.in b/c/src/libnetworking/include/Makefile.in
new file mode 100644
index 0000000000..e5b1506e62
--- /dev/null
+++ b/c/src/libnetworking/include/Makefile.in
@@ -0,0 +1,65 @@
+#
+# $Id$
+#
+
+@SET_MAKE@
+srcdir = @srcdir@
+VPATH = @srcdir@
+RTEMS_ROOT = @top_srcdir@
+PROJECT_ROOT = @PROJECT_ROOT@
+
+H_PIECES=bpfilter loop netdb networkconfig opt_ipfw opt_mrouting \
+ opt_tcpdebug poll resolv syslog
+H_FILES=$(H_PIECES:%=$(srcdir)/../%.h)
+
+SYS_H_PIECES=buf callout cdefs conf domain filio ioccom ioctl kernel \
+ libkern malloc mbuf mount param proc protosw queue reboot \
+ resourcevar rtprio select signalvar socket socketvar \
+ sockio sysctl syslimits syslog systm ttycom ttydefaults \
+ ucred uio
+SYS_H_FILES=$(SYS_H_PIECES:%=$(srcdir)/../sys/%.h)
+
+RTEMS_H_PIECES= rtems_bsdnet
+RTEMS_H_FILES=$(RTEMS_H_PIECES:%=$(srcdir)/../rtems/%.h)
+
+MACHINE_H_PIECES= conf cpu cpufunc endian in_cksum limits param types vmparam
+MACHINE_H_FILES=$(MACHINE_H_PIECES:%=$(srcdir)/../machine/%.h)
+
+VM_H_PIECES= vm vm_extern vm_kern vm_param
+VM_H_FILES=$(VM_H_PIECES:%=$(srcdir)/../vm/%.h)
+
+NET_H_PIECES= bpf ethernet if if_arp if_dl if_llc if_types netisr \
+ radix raw_cb route
+NET_H_FILES=$(NET_H_PIECES:%=$(srcdir)/../net/%.h)
+
+NETINET_H_PIECES= icmp_var if_ether igmp igmp_var in in_pcb in_systm in_var \
+ ip ip_fw ip_icmp ip_mroute ip_var tcp tcp_debug tcp_fsm \
+ tcp_seq tcp_timer tcp_var tcpip udp udp_var
+NETINET_H_FILES=$(NETINET_H_PIECES:%=$(srcdir)/../netinet/%.h)
+
+ARPA_H_PIECES= ftp inet nameser nameser_compat telnet
+ARPA_H_FILES=$(ARPA_H_PIECES:%=$(srcdir)/../arpa/%.h)
+
+NFS_H_PIECES= krpc nfs nfsdiskless nfsproto rpcv2 xdr_subs
+NFS_H_FILES=$(NFS_H_PIECES:%=$(srcdir)/../nfs/%.h)
+
+SRCS=$(H_FILES) $(SYS_H_FILES) $(RTEMS_H_FILES) $(MACHINE_H_FILES) \
+ $(VM_H_FILES) $(NET_H_FILES) $(NETINET_H_FILES) $(ARPA_H_FILES) \
+ $(NFS_H_FILES)
+
+include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
+include $(RTEMS_ROOT)/make/leaf.cfg
+
+CLEAN_ADDITIONS +=
+CLOBBER_ADDITIONS +=
+
+all: $(SRCS)
+ $(INSTALL) -m 444 $(H_FILES) $(PROJECT_INCLUDE)/networking
+ $(INSTALL) -m 444 $(SYS_H_FILES) $(PROJECT_INCLUDE)/networking/sys
+ $(INSTALL) -m 444 $(RTEMS_H_FILES) $(PROJECT_INCLUDE)/networking/rtems
+ $(INSTALL) -m 444 $(MACHINE_H_FILES) $(PROJECT_INCLUDE)/networking/machine
+ $(INSTALL) -m 444 $(VM_H_FILES) $(PROJECT_INCLUDE)/networking/vm
+ $(INSTALL) -m 444 $(NET_H_FILES) $(PROJECT_INCLUDE)/networking/net
+ $(INSTALL) -m 444 $(NETINET_H_FILES) $(PROJECT_INCLUDE)/networking/netinet
+ $(INSTALL) -m 444 $(ARPA_H_FILES) $(PROJECT_INCLUDE)/networking/arpa
+ $(INSTALL) -m 444 $(NFS_H_FILES) $(PROJECT_INCLUDE)/networking/nfs
diff --git a/c/src/libnetworking/kern/Makefile.in b/c/src/libnetworking/kern/Makefile.in
index 7801bb77ba..35804e14ef 100644
--- a/c/src/libnetworking/kern/Makefile.in
+++ b/c/src/libnetworking/kern/Makefile.in
@@ -8,7 +8,7 @@ VPATH = @srcdir@
RTEMS_ROOT = @top_srcdir@
PROJECT_ROOT = @PROJECT_ROOT@
-LIBNAME=kern.a
+LIBNAME=lib.a
LIB=${ARCH}/${LIBNAME}
# C and C++ source names, if any, go here -- minus the .c or .cc
@@ -26,7 +26,8 @@ include $(RTEMS_ROOT)/make/lib.cfg
# Add local stuff here using +=
#
-DEFINES +=
+DEFINES += -D_COMPILING_BSD_KERNEL_ -DKERNEL -DINET -DNFS \
+ -DDIAGNOSTIC -DBOOTP_COMPAT
CPPFLAGS +=
CFLAGS +=
diff --git a/c/src/libnetworking/lib/Makefile.in b/c/src/libnetworking/lib/Makefile.in
index a568b8cc96..869818fadf 100644
--- a/c/src/libnetworking/lib/Makefile.in
+++ b/c/src/libnetworking/lib/Makefile.in
@@ -26,7 +26,7 @@ include $(RTEMS_ROOT)/make/lib.cfg
# Add local stuff here using +=
#
-DEFINES +=
+DEFINES += -DNOPOLL -DNOSELECT
CPPFLAGS +=
CFLAGS +=
diff --git a/c/src/libnetworking/libc/Makefile.in b/c/src/libnetworking/libc/Makefile.in
index 64417585cf..132c059cab 100644
--- a/c/src/libnetworking/libc/Makefile.in
+++ b/c/src/libnetworking/libc/Makefile.in
@@ -12,10 +12,10 @@ LIBNAME=lib.a
LIB=${ARCH}/${LIBNAME}
# C and C++ source names, if any, go here -- minus the .c or .cc
-C_PIECES= base64 \
+C_PIECES= base64 \
gethostbydns gethostbyht gethostbynis gethostnamadr \
herror \
- inet_addr inet_ntoa inet_ntop inet_pton \
+ inet_addr inet_ntoa inet_ntop inet_pton \
map_v4v6 \
nsap_addr ns_name ns_netint ns_parse ns_print ns_ttl \
res_comp res_data res_debug res_init res_mkquery res_mkupdate \
@@ -34,7 +34,7 @@ include $(RTEMS_ROOT)/make/lib.cfg
# Add local stuff here using +=
#
-DEFINES +=
+DEFINES += -DNOPOLL -DNOSELECT
CPPFLAGS +=
CFLAGS +=
diff --git a/c/src/libnetworking/machine/conf.h b/c/src/libnetworking/machine/conf.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/c/src/libnetworking/machine/conf.h
diff --git a/c/src/libnetworking/machine/cpu.h b/c/src/libnetworking/machine/cpu.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/c/src/libnetworking/machine/cpu.h
diff --git a/c/src/libnetworking/machine/cpufunc.h b/c/src/libnetworking/machine/cpufunc.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/c/src/libnetworking/machine/cpufunc.h
diff --git a/c/src/libnetworking/machine/endian.h b/c/src/libnetworking/machine/endian.h
new file mode 100644
index 0000000000..cd0d6f551c
--- /dev/null
+++ b/c/src/libnetworking/machine/endian.h
@@ -0,0 +1,60 @@
+#ifndef _MACHINE_ENDIAN_H_
+#define _MACHINE_ENDIAN_H_
+
+#include <rtems/score/cpu.h>
+
+/*
+ * BSD-style endian declaration
+ */
+#define BIG_ENDIAN 4321
+#define LITTLE_ENDIAN 1234
+
+#if CPU_BIG_ENDIAN
+# define BYTE_ORDER BIG_ENDIAN
+#elif CPU_LITTLE_ENDIAN
+# define BYTE_ORDER LITTLE_ENDIAN
+#else
+# error "Can't decide which end is which!"
+#endif
+
+#if ( CPU_HAS_OWN_HOST_TO_NETWORK_ROUTINES == FALSE )
+
+#if ( CPU_BIG_ENDIAN == TRUE )
+
+/*
+ * Very simply on big endian CPUs
+ */
+
+#define ntohl(_x) (_x)
+#define ntohs(_x) (_x)
+#define htonl(_x) (_x)
+#define htons(_x) (_x)
+
+#define NTOHS(x)
+#define HTONS(x)
+#define NTOHL(x)
+#define HTONL(x)
+
+#elif ( CPU_LITTLE_ENDIAN == TRUE )
+
+/*
+ * A little more complicated on little endian CPUs
+ */
+
+#define ntohl(_x) ((long) CPU_swap_u32((unsigned32)_x))
+#define ntohs(_x) ((short) CPU_swap_u16((unsigned16)_x))
+#define htonl(_x) ((long) CPU_swap_u32((unsigned32)_x))
+#define htons(_x) ((short) CPU_swap_u16((unsigned16)_x))
+
+#define NTOHS(x) (x) = ntohs(x)
+#define HTONS(x) (x) = htons(x)
+#define NTOHL(x) (x) = ntohl(x)
+#define HTONL(x) (x) = htonl(x)
+
+#else
+#error "Unknown endian-ness for this cpu"
+#endif
+
+#endif /* CPU_HAS_OWN_HOST_TO_NETWORK_ROUTINES */
+
+#endif /* _MACHINE_ENDIAN_H_ */
diff --git a/c/src/libnetworking/machine/in_cksum.h b/c/src/libnetworking/machine/in_cksum.h
new file mode 100644
index 0000000000..15509b3888
--- /dev/null
+++ b/c/src/libnetworking/machine/in_cksum.h
@@ -0,0 +1,118 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from tahoe: in_cksum.c 1.2 86/01/05
+ * from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91
+ * from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp
+ * $Id$
+ */
+
+#ifndef _MACHINE_IN_CKSUM_H_
+#define _MACHINE_IN_CKSUM_H_ 1
+
+#include <sys/cdefs.h>
+
+/*
+ * It it useful to have an Internet checksum routine which is inlineable
+ * and optimized specifically for the task of computing IP header checksums
+ * in the normal case (where there are no options and the header length is
+ * therefore always exactly five 32-bit words.
+ */
+#if (defined(__GNUC__) && defined(__i386__))
+static __inline u_int
+in_cksum_hdr(const struct ip *ip)
+{
+ register u_int sum = 0;
+
+#define ADD(n) __asm("addl " #n "(%2), %0" : "=r" (sum) : "0" (sum), "r" (ip))
+#define ADDC(n) __asm("adcl " #n "(%2), %0" : "=r" (sum) : "0" (sum), "r" (ip))
+#define MOP __asm("adcl $0, %0" : "=r" (sum) : "0" (sum))
+
+ ADD(0);
+ ADDC(4);
+ ADDC(8);
+ ADDC(12);
+ ADDC(16);
+ MOP;
+ sum = (sum & 0xffff) + (sum >> 16);
+ if (sum > 0xffff)
+ sum -= 0xffff;
+
+ return ~sum & 0xffff;
+}
+
+static __inline void
+in_cksum_update(struct ip *ip)
+{
+ int __tmpsum;
+ __tmpsum = (int)ntohs(ip->ip_sum) + 256;
+ ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16));
+}
+
+#elif (defined(__GNUC__) && (defined(__mc68000__) || defined(__m68k__)))
+
+static __inline__ u_int
+in_cksum_hdr(const struct ip *ip)
+{
+ register u_int *ap = (u_int *)ip;
+ register u_int sum = *ap++;
+ register u_int tmp;
+
+ __asm__("addl %2@+,%0\n\t"
+ "movel %2@+,%1\n\t"
+ "addxl %1,%0\n\t"
+ "movel %2@+,%1\n\t"
+ "addxl %1,%0\n\t"
+ "movel %2@,%1\n\t"
+ "addxl %1,%0\n\t"
+ "moveq #0,%1\n\t"
+ "addxl %1,%0\n" :
+ "=d" (sum), "=d" (tmp), "=a" (ap) :
+ "0" (sum), "2" (ap));
+ sum = (sum & 0xffff) + (sum >> 16);
+ if (sum > 0xffff)
+ sum -= 0xffff;
+ return ~sum & 0xffff;
+}
+
+#else
+u_int in_cksum_hdr __P((const struct ip *));
+#define in_cksum_update(ip) \
+ do { \
+ int __tmpsum; \
+ __tmpsum = (int)ntohs(ip->ip_sum) + 256; \
+ ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); \
+ } while(0)
+
+#endif
+
+#endif /* _MACHINE_IN_CKSUM_H_ */
diff --git a/c/src/libnetworking/machine/limits.h b/c/src/libnetworking/machine/limits.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/c/src/libnetworking/machine/limits.h
diff --git a/c/src/libnetworking/machine/param.h b/c/src/libnetworking/machine/param.h
new file mode 100644
index 0000000000..eae8554c2a
--- /dev/null
+++ b/c/src/libnetworking/machine/param.h
@@ -0,0 +1,88 @@
+#ifndef _MACHINE_PARAM_H_
+#define _MACHINE_PARAM_H_
+
+/*
+ * These aren't really machine-dependent for RTEMS.....
+ */
+
+/*
+#define MACHINE "i386"
+#define MID_MACHINE MID_I386
+*/
+
+/*
+ * Round p (pointer or byte index) up to a correctly-aligned value
+ * for all data types (int, long, ...). The result is unsigned int
+ * and must be cast to any desired pointer type.
+ */
+#define ALIGNBYTES (sizeof(int) - 1)
+#define ALIGN(p) (((unsigned)(p) + ALIGNBYTES) & ~ALIGNBYTES)
+
+#define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */
+#define PAGE_SIZE (1<<PAGE_SHIFT) /* bytes/page */
+#define PAGE_MASK (PAGE_SIZE-1)
+#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t)))
+
+#define NPDEPG (PAGE_SIZE/(sizeof (pd_entry_t)))
+#define PDRSHIFT 22 /* LOG2(NBPDR) */
+#define NBPDR (1<<PDRSHIFT) /* bytes/page dir */
+
+#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
+#define DEV_BSIZE (1<<DEV_BSHIFT)
+
+#define BLKDEV_IOSIZE 2048
+#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
+
+#define UPAGES 2 /* pages of u-area */
+
+/*
+ * Constants related to network buffer management.
+ * MCLBYTES must be no larger than CLBYTES (the software page size), and,
+ * on machines that exchange pages of input or output buffers with mbuf
+ * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
+ * of the hardware page size.
+ */
+#ifndef MSIZE
+#define MSIZE 128 /* size of an mbuf */
+#endif /* MSIZE */
+
+#ifndef MCLSHIFT
+#define MCLSHIFT 11 /* convert bytes to m_buf clusters */
+#endif /* MCLSHIFT */
+#define MCLBYTES (1 << MCLSHIFT) /* size of an m_buf cluster */
+#define MCLOFSET (MCLBYTES - 1) /* offset within an m_buf cluster */
+
+/*
+ * Some macros for units conversion
+ */
+
+/* clicks to bytes */
+#define ctob(x) ((x)<<PAGE_SHIFT)
+
+/* bytes to clicks */
+#define btoc(x) (((unsigned)(x)+PAGE_MASK)>>PAGE_SHIFT)
+
+/*
+ * btodb() is messy and perhaps slow because `bytes' may be an off_t. We
+ * want to shift an unsigned type to avoid sign extension and we don't
+ * want to widen `bytes' unnecessarily. Assume that the result fits in
+ * a daddr_t.
+ */
+#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
+ (sizeof (bytes) > sizeof(long) \
+ ? (daddr_t)((unsigned long long)(bytes) >> DEV_BSHIFT) \
+ : (daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT))
+
+#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \
+ ((off_t)(db) << DEV_BSHIFT)
+
+/*
+ * Mach derived conversion macros
+ */
+#define trunc_page(x) ((unsigned)(x) & ~PAGE_MASK)
+#define round_page(x) ((((unsigned)(x)) + PAGE_MASK) & ~PAGE_MASK)
+
+#define atop(x) ((unsigned)(x) >> PAGE_SHIFT)
+#define ptoa(x) ((unsigned)(x) << PAGE_SHIFT)
+
+#endif /* !_MACHINE_PARAM_H_ */
diff --git a/c/src/libnetworking/machine/types.h b/c/src/libnetworking/machine/types.h
new file mode 100644
index 0000000000..1f9ee143a5
--- /dev/null
+++ b/c/src/libnetworking/machine/types.h
@@ -0,0 +1,32 @@
+/*
+ * This file will have to be incorparated into the RTEMS source
+ * tree (probably in the existing <machine/types.h> so that these
+ * contents are included when an application source file includes
+ * <sys/types.h>.
+ */
+
+#ifndef _MACHINE_TYPES_H_
+#define _MACHINE_TYPES_H_
+
+#include <rtems.h>
+#include <machine/endian.h>
+
+typedef rtems_signed64 int64_t;
+typedef rtems_signed32 int32_t;
+typedef rtems_signed16 int16_t;
+typedef rtems_signed8 int8_t;
+
+typedef rtems_unsigned64 u_int64_t;
+typedef rtems_unsigned32 u_int32_t;
+typedef rtems_unsigned16 u_int16_t;
+typedef rtems_unsigned8 u_int8_t;
+
+#define _CLOCK_T_ unsigned long
+#define _TIME_T_ long
+
+#ifdef _COMPILING_BSD_KERNEL_
+#include <rtems/rtems_bsdnet_internal.h>
+#include <rtems/rtems_bsdnet.h>
+#endif
+
+#endif /* _MACHINE_TYPES_H_ */
diff --git a/c/src/libnetworking/machine/vmparam.h b/c/src/libnetworking/machine/vmparam.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/c/src/libnetworking/machine/vmparam.h
diff --git a/c/src/libnetworking/net/Makefile.in b/c/src/libnetworking/net/Makefile.in
index c47fdb90fe..5a68c81ec0 100644
--- a/c/src/libnetworking/net/Makefile.in
+++ b/c/src/libnetworking/net/Makefile.in
@@ -28,7 +28,8 @@ include $(RTEMS_ROOT)/make/lib.cfg
# Add local stuff here using +=
#
-DEFINES +=
+DEFINES += -D_COMPILING_BSD_KERNEL_ -DKERNEL -DINET -DNFS \
+ -DDIAGNOSTIC -DBOOTP_COMPAT
CPPFLAGS +=
CFLAGS +=
diff --git a/c/src/libnetworking/netinet/Makefile.in b/c/src/libnetworking/netinet/Makefile.in
index d7b74746a8..94a8f2f0b8 100644
--- a/c/src/libnetworking/netinet/Makefile.in
+++ b/c/src/libnetworking/netinet/Makefile.in
@@ -16,7 +16,7 @@ C_PIECES=if_ether \
igmp \
in in_cksum in_pcb in_proto in_rmx \
ip_divert ip_fw ip_icmp ip_input ip_mroute ip_output \
- raw_ip \
+ raw_ip \
tcp_debug tcp_input tcp_output tcp_subr tcp_timer tcp_usrreq \
udp_usrreq
C_FILES=$(C_PIECES:%=%.c)
@@ -32,7 +32,8 @@ include $(RTEMS_ROOT)/make/lib.cfg
# Add local stuff here using +=
#
-DEFINES +=
+DEFINES += -D_COMPILING_BSD_KERNEL_ -DKERNEL -DINET -DNFS \
+ -DDIAGNOSTIC -DBOOTP_COMPAT
CPPFLAGS +=
CFLAGS +=
diff --git a/c/src/libnetworking/nfs/Makefile.in b/c/src/libnetworking/nfs/Makefile.in
index 62cf991737..404d85040a 100644
--- a/c/src/libnetworking/nfs/Makefile.in
+++ b/c/src/libnetworking/nfs/Makefile.in
@@ -26,7 +26,8 @@ include $(RTEMS_ROOT)/make/lib.cfg
# Add local stuff here using +=
#
-DEFINES +=
+DEFINES += -D_COMPILING_BSD_KERNEL_ -DKERNEL -DINET -DNFS \
+ -DDIAGNOSTIC -DBOOTP_COMPAT
CPPFLAGS +=
CFLAGS +=
diff --git a/c/src/libnetworking/rtems/Makefile.in b/c/src/libnetworking/rtems/Makefile.in
index ea8297cf84..038fb5c68e 100644
--- a/c/src/libnetworking/rtems/Makefile.in
+++ b/c/src/libnetworking/rtems/Makefile.in
@@ -30,7 +30,8 @@ include $(RTEMS_ROOT)/make/lib.cfg
# Add local stuff here using +=
#
-DEFINES +=
+DEFINES += -D_COMPILING_BSD_KERNEL_ -DKERNEL -DINET -DNFS \
+ -DDIAGNOSTIC -DBOOTP_COMPAT
CPPFLAGS +=
CFLAGS +=
diff --git a/c/src/libnetworking/wrapup/Makefile.in b/c/src/libnetworking/wrapup/Makefile.in
index 5961c093e8..55b9f618ed 100644
--- a/c/src/libnetworking/wrapup/Makefile.in
+++ b/c/src/libnetworking/wrapup/Makefile.in
@@ -9,7 +9,7 @@ RTEMS_ROOT = @top_srcdir@
PROJECT_ROOT = @PROJECT_ROOT@
NET_PIECES=kern lib libc net netinet nfs rtems
-OBJS=$(foreach piece, $(NET_PIECES), ../$(piece)/$(ARCH)/$(piece).rel)
+OBJS=$(foreach piece, $(NET_PIECES), ../$(piece)/$(ARCH)/*.o)
LIB=$(ARCH)/libnetworking.a
include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
diff --git a/cpukit/libnetworking/machine/conf.h b/cpukit/libnetworking/machine/conf.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/cpukit/libnetworking/machine/conf.h
diff --git a/cpukit/libnetworking/machine/cpu.h b/cpukit/libnetworking/machine/cpu.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/cpukit/libnetworking/machine/cpu.h
diff --git a/cpukit/libnetworking/machine/cpufunc.h b/cpukit/libnetworking/machine/cpufunc.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/cpukit/libnetworking/machine/cpufunc.h
diff --git a/cpukit/libnetworking/machine/endian.h b/cpukit/libnetworking/machine/endian.h
new file mode 100644
index 0000000000..cd0d6f551c
--- /dev/null
+++ b/cpukit/libnetworking/machine/endian.h
@@ -0,0 +1,60 @@
+#ifndef _MACHINE_ENDIAN_H_
+#define _MACHINE_ENDIAN_H_
+
+#include <rtems/score/cpu.h>
+
+/*
+ * BSD-style endian declaration
+ */
+#define BIG_ENDIAN 4321
+#define LITTLE_ENDIAN 1234
+
+#if CPU_BIG_ENDIAN
+# define BYTE_ORDER BIG_ENDIAN
+#elif CPU_LITTLE_ENDIAN
+# define BYTE_ORDER LITTLE_ENDIAN
+#else
+# error "Can't decide which end is which!"
+#endif
+
+#if ( CPU_HAS_OWN_HOST_TO_NETWORK_ROUTINES == FALSE )
+
+#if ( CPU_BIG_ENDIAN == TRUE )
+
+/*
+ * Very simply on big endian CPUs
+ */
+
+#define ntohl(_x) (_x)
+#define ntohs(_x) (_x)
+#define htonl(_x) (_x)
+#define htons(_x) (_x)
+
+#define NTOHS(x)
+#define HTONS(x)
+#define NTOHL(x)
+#define HTONL(x)
+
+#elif ( CPU_LITTLE_ENDIAN == TRUE )
+
+/*
+ * A little more complicated on little endian CPUs
+ */
+
+#define ntohl(_x) ((long) CPU_swap_u32((unsigned32)_x))
+#define ntohs(_x) ((short) CPU_swap_u16((unsigned16)_x))
+#define htonl(_x) ((long) CPU_swap_u32((unsigned32)_x))
+#define htons(_x) ((short) CPU_swap_u16((unsigned16)_x))
+
+#define NTOHS(x) (x) = ntohs(x)
+#define HTONS(x) (x) = htons(x)
+#define NTOHL(x) (x) = ntohl(x)
+#define HTONL(x) (x) = htonl(x)
+
+#else
+#error "Unknown endian-ness for this cpu"
+#endif
+
+#endif /* CPU_HAS_OWN_HOST_TO_NETWORK_ROUTINES */
+
+#endif /* _MACHINE_ENDIAN_H_ */
diff --git a/cpukit/libnetworking/machine/in_cksum.h b/cpukit/libnetworking/machine/in_cksum.h
new file mode 100644
index 0000000000..15509b3888
--- /dev/null
+++ b/cpukit/libnetworking/machine/in_cksum.h
@@ -0,0 +1,118 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from tahoe: in_cksum.c 1.2 86/01/05
+ * from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91
+ * from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp
+ * $Id$
+ */
+
+#ifndef _MACHINE_IN_CKSUM_H_
+#define _MACHINE_IN_CKSUM_H_ 1
+
+#include <sys/cdefs.h>
+
+/*
+ * It it useful to have an Internet checksum routine which is inlineable
+ * and optimized specifically for the task of computing IP header checksums
+ * in the normal case (where there are no options and the header length is
+ * therefore always exactly five 32-bit words.
+ */
+#if (defined(__GNUC__) && defined(__i386__))
+static __inline u_int
+in_cksum_hdr(const struct ip *ip)
+{
+ register u_int sum = 0;
+
+#define ADD(n) __asm("addl " #n "(%2), %0" : "=r" (sum) : "0" (sum), "r" (ip))
+#define ADDC(n) __asm("adcl " #n "(%2), %0" : "=r" (sum) : "0" (sum), "r" (ip))
+#define MOP __asm("adcl $0, %0" : "=r" (sum) : "0" (sum))
+
+ ADD(0);
+ ADDC(4);
+ ADDC(8);
+ ADDC(12);
+ ADDC(16);
+ MOP;
+ sum = (sum & 0xffff) + (sum >> 16);
+ if (sum > 0xffff)
+ sum -= 0xffff;
+
+ return ~sum & 0xffff;
+}
+
+static __inline void
+in_cksum_update(struct ip *ip)
+{
+ int __tmpsum;
+ __tmpsum = (int)ntohs(ip->ip_sum) + 256;
+ ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16));
+}
+
+#elif (defined(__GNUC__) && (defined(__mc68000__) || defined(__m68k__)))
+
+static __inline__ u_int
+in_cksum_hdr(const struct ip *ip)
+{
+ register u_int *ap = (u_int *)ip;
+ register u_int sum = *ap++;
+ register u_int tmp;
+
+ __asm__("addl %2@+,%0\n\t"
+ "movel %2@+,%1\n\t"
+ "addxl %1,%0\n\t"
+ "movel %2@+,%1\n\t"
+ "addxl %1,%0\n\t"
+ "movel %2@,%1\n\t"
+ "addxl %1,%0\n\t"
+ "moveq #0,%1\n\t"
+ "addxl %1,%0\n" :
+ "=d" (sum), "=d" (tmp), "=a" (ap) :
+ "0" (sum), "2" (ap));
+ sum = (sum & 0xffff) + (sum >> 16);
+ if (sum > 0xffff)
+ sum -= 0xffff;
+ return ~sum & 0xffff;
+}
+
+#else
+u_int in_cksum_hdr __P((const struct ip *));
+#define in_cksum_update(ip) \
+ do { \
+ int __tmpsum; \
+ __tmpsum = (int)ntohs(ip->ip_sum) + 256; \
+ ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); \
+ } while(0)
+
+#endif
+
+#endif /* _MACHINE_IN_CKSUM_H_ */
diff --git a/cpukit/libnetworking/machine/limits.h b/cpukit/libnetworking/machine/limits.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/cpukit/libnetworking/machine/limits.h
diff --git a/cpukit/libnetworking/machine/param.h b/cpukit/libnetworking/machine/param.h
new file mode 100644
index 0000000000..eae8554c2a
--- /dev/null
+++ b/cpukit/libnetworking/machine/param.h
@@ -0,0 +1,88 @@
+#ifndef _MACHINE_PARAM_H_
+#define _MACHINE_PARAM_H_
+
+/*
+ * These aren't really machine-dependent for RTEMS.....
+ */
+
+/*
+#define MACHINE "i386"
+#define MID_MACHINE MID_I386
+*/
+
+/*
+ * Round p (pointer or byte index) up to a correctly-aligned value
+ * for all data types (int, long, ...). The result is unsigned int
+ * and must be cast to any desired pointer type.
+ */
+#define ALIGNBYTES (sizeof(int) - 1)
+#define ALIGN(p) (((unsigned)(p) + ALIGNBYTES) & ~ALIGNBYTES)
+
+#define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */
+#define PAGE_SIZE (1<<PAGE_SHIFT) /* bytes/page */
+#define PAGE_MASK (PAGE_SIZE-1)
+#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t)))
+
+#define NPDEPG (PAGE_SIZE/(sizeof (pd_entry_t)))
+#define PDRSHIFT 22 /* LOG2(NBPDR) */
+#define NBPDR (1<<PDRSHIFT) /* bytes/page dir */
+
+#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
+#define DEV_BSIZE (1<<DEV_BSHIFT)
+
+#define BLKDEV_IOSIZE 2048
+#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */
+
+#define UPAGES 2 /* pages of u-area */
+
+/*
+ * Constants related to network buffer management.
+ * MCLBYTES must be no larger than CLBYTES (the software page size), and,
+ * on machines that exchange pages of input or output buffers with mbuf
+ * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
+ * of the hardware page size.
+ */
+#ifndef MSIZE
+#define MSIZE 128 /* size of an mbuf */
+#endif /* MSIZE */
+
+#ifndef MCLSHIFT
+#define MCLSHIFT 11 /* convert bytes to m_buf clusters */
+#endif /* MCLSHIFT */
+#define MCLBYTES (1 << MCLSHIFT) /* size of an m_buf cluster */
+#define MCLOFSET (MCLBYTES - 1) /* offset within an m_buf cluster */
+
+/*
+ * Some macros for units conversion
+ */
+
+/* clicks to bytes */
+#define ctob(x) ((x)<<PAGE_SHIFT)
+
+/* bytes to clicks */
+#define btoc(x) (((unsigned)(x)+PAGE_MASK)>>PAGE_SHIFT)
+
+/*
+ * btodb() is messy and perhaps slow because `bytes' may be an off_t. We
+ * want to shift an unsigned type to avoid sign extension and we don't
+ * want to widen `bytes' unnecessarily. Assume that the result fits in
+ * a daddr_t.
+ */
+#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
+ (sizeof (bytes) > sizeof(long) \
+ ? (daddr_t)((unsigned long long)(bytes) >> DEV_BSHIFT) \
+ : (daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT))
+
+#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \
+ ((off_t)(db) << DEV_BSHIFT)
+
+/*
+ * Mach derived conversion macros
+ */
+#define trunc_page(x) ((unsigned)(x) & ~PAGE_MASK)
+#define round_page(x) ((((unsigned)(x)) + PAGE_MASK) & ~PAGE_MASK)
+
+#define atop(x) ((unsigned)(x) >> PAGE_SHIFT)
+#define ptoa(x) ((unsigned)(x) << PAGE_SHIFT)
+
+#endif /* !_MACHINE_PARAM_H_ */
diff --git a/cpukit/libnetworking/machine/types.h b/cpukit/libnetworking/machine/types.h
new file mode 100644
index 0000000000..1f9ee143a5
--- /dev/null
+++ b/cpukit/libnetworking/machine/types.h
@@ -0,0 +1,32 @@
+/*
+ * This file will have to be incorparated into the RTEMS source
+ * tree (probably in the existing <machine/types.h> so that these
+ * contents are included when an application source file includes
+ * <sys/types.h>.
+ */
+
+#ifndef _MACHINE_TYPES_H_
+#define _MACHINE_TYPES_H_
+
+#include <rtems.h>
+#include <machine/endian.h>
+
+typedef rtems_signed64 int64_t;
+typedef rtems_signed32 int32_t;
+typedef rtems_signed16 int16_t;
+typedef rtems_signed8 int8_t;
+
+typedef rtems_unsigned64 u_int64_t;
+typedef rtems_unsigned32 u_int32_t;
+typedef rtems_unsigned16 u_int16_t;
+typedef rtems_unsigned8 u_int8_t;
+
+#define _CLOCK_T_ unsigned long
+#define _TIME_T_ long
+
+#ifdef _COMPILING_BSD_KERNEL_
+#include <rtems/rtems_bsdnet_internal.h>
+#include <rtems/rtems_bsdnet.h>
+#endif
+
+#endif /* _MACHINE_TYPES_H_ */
diff --git a/cpukit/libnetworking/machine/vmparam.h b/cpukit/libnetworking/machine/vmparam.h
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/cpukit/libnetworking/machine/vmparam.h