summaryrefslogtreecommitdiff
path: root/ecos/packages/net/tcpip/current/include
diff options
context:
space:
mode:
Diffstat (limited to 'ecos/packages/net/tcpip/current/include')
-rw-r--r--ecos/packages/net/tcpip/current/include/lib/libkern/libkern.h217
-rw-r--r--ecos/packages/net/tcpip/current/include/machine/cdefs.h33
-rw-r--r--ecos/packages/net/tcpip/current/include/machine/cpu.h33
-rw-r--r--ecos/packages/net/tcpip/current/include/machine/limits.h35
-rw-r--r--ecos/packages/net/tcpip/current/include/machine/param.h138
-rw-r--r--ecos/packages/net/tcpip/current/include/machine/signal.h30
-rw-r--r--ecos/packages/net/tcpip/current/include/machine/stdarg.h31
-rw-r--r--ecos/packages/net/tcpip/current/include/machine/types.h84
-rw-r--r--ecos/packages/net/tcpip/current/include/net/bpf.h307
-rw-r--r--ecos/packages/net/tcpip/current/include/net/bpfdesc.h141
-rw-r--r--ecos/packages/net/tcpip/current/include/net/if.h481
-rw-r--r--ecos/packages/net/tcpip/current/include/net/if_arp.h123
-rw-r--r--ecos/packages/net/tcpip/current/include/net/if_bridge.h319
-rw-r--r--ecos/packages/net/tcpip/current/include/net/if_dl.h117
-rw-r--r--ecos/packages/net/tcpip/current/include/net/if_gif.h115
-rw-r--r--ecos/packages/net/tcpip/current/include/net/if_llc.h178
-rw-r--r--ecos/packages/net/tcpip/current/include/net/if_slvar.h88
-rw-r--r--ecos/packages/net/tcpip/current/include/net/if_tun.h86
-rw-r--r--ecos/packages/net/tcpip/current/include/net/if_types.h139
-rw-r--r--ecos/packages/net/tcpip/current/include/net/netisr.h137
-rw-r--r--ecos/packages/net/tcpip/current/include/net/radix.h199
-rw-r--r--ecos/packages/net/tcpip/current/include/net/raw_cb.h105
-rw-r--r--ecos/packages/net/tcpip/current/include/net/route.h383
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/icmp6.h66
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/icmp_var.h108
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/if_arc.h158
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/if_atm.h75
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/if_ether.h314
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/igmp.h131
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/igmp_var.h116
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/in.h680
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/in_gif.h71
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/in_pcb.h308
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/in_systm.h93
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/in_var.h254
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/ip.h223
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/ip6.h32
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/ip_ah.h145
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/ip_auth.h96
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/ip_blf.h108
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/ip_cast.h51
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/ip_castsb.h577
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/ip_ecn.h90
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/ip_esp.h139
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/ip_ether.h93
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/ip_fil.h605
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/ip_fil_compat.h865
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/ip_frag.h92
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/ip_icmp.h223
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/ip_ip4.h110
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/ip_ipsp.h600
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/ip_mroute.h269
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/ip_nat.h277
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/ip_proxy.h158
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/ip_rmd160.h66
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/ip_sha1.h52
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/ip_skipjack.h50
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/ip_state.h194
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/ip_var.h239
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/ipl.h46
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/tcp.h155
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/tcp_debug.h99
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/tcp_fsm.h123
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/tcp_seq.h99
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/tcp_timer.h166
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/tcp_var.h428
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/tcpip.h95
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/udp.h82
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet/udp_var.h141
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/debug.h244
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/debug_inet6.h55
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/icmp6.h680
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/icmpv6.h110
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/icmpv6_var.h82
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/in6.h682
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/in6_gif.h69
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/in6_ifattach.h79
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/in6_pcb.h207
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/in6_prefix.h121
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/in6_var.h593
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/ip6.h316
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/ip6_mroute.h277
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/ip6_var.h287
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/ip6protosw.h158
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/ipv6.h153
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/ipv6_addrconf.h52
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/ipv6_icmp.h287
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/ipv6_trans.h56
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/ipv6_var.h385
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/mld6_var.h80
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/nd6.h335
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/nd6_protocol.h129
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/osdep.h147
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/pim6.h102
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/pim6_var.h99
-rw-r--r--ecos/packages/net/tcpip/current/include/netinet6/tcpipv6.h68
-rw-r--r--ecos/packages/net/tcpip/current/include/sys/bsdselect.h55
-rw-r--r--ecos/packages/net/tcpip/current/include/sys/bsdtypes.h194
-rw-r--r--ecos/packages/net/tcpip/current/include/sys/cdefs.h170
-rw-r--r--ecos/packages/net/tcpip/current/include/sys/domain.h102
-rw-r--r--ecos/packages/net/tcpip/current/include/sys/endian.h222
-rw-r--r--ecos/packages/net/tcpip/current/include/sys/errno.h30
-rw-r--r--ecos/packages/net/tcpip/current/include/sys/ioccom.h103
-rw-r--r--ecos/packages/net/tcpip/current/include/sys/ioctl.h122
-rw-r--r--ecos/packages/net/tcpip/current/include/sys/kernel.h101
-rw-r--r--ecos/packages/net/tcpip/current/include/sys/malloc.h469
-rw-r--r--ecos/packages/net/tcpip/current/include/sys/mbuf.h473
-rw-r--r--ecos/packages/net/tcpip/current/include/sys/param.h344
-rw-r--r--ecos/packages/net/tcpip/current/include/sys/protosw.h271
-rw-r--r--ecos/packages/net/tcpip/current/include/sys/queue.h514
-rw-r--r--ecos/packages/net/tcpip/current/include/sys/socket.h454
-rw-r--r--ecos/packages/net/tcpip/current/include/sys/socketvar.h338
-rw-r--r--ecos/packages/net/tcpip/current/include/sys/sockio.h179
-rw-r--r--ecos/packages/net/tcpip/current/include/sys/syscallargs.h1411
-rw-r--r--ecos/packages/net/tcpip/current/include/sys/time.h239
115 files changed, 24325 insertions, 0 deletions
diff --git a/ecos/packages/net/tcpip/current/include/lib/libkern/libkern.h b/ecos/packages/net/tcpip/current/include/lib/libkern/libkern.h
new file mode 100644
index 0000000..25c0245
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/lib/libkern/libkern.h
@@ -0,0 +1,217 @@
+//==========================================================================
+//
+// include/lib/libkern/libkern.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: libkern.h,v 1.14 1997/11/30 21:47:45 mickey Exp $ */
+/* $NetBSD: libkern.h,v 1.7 1996/03/14 18:52:08 christos Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * 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.
+ *
+ * @(#)libkern.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef __LIBKERN_H__
+#define __LIBKERN_H__
+
+#ifdef __INSIDE_NET
+
+#include <sys/types.h>
+
+#ifndef LIBKERN_INLINE
+#ifndef NO_LIBKERN_INLINE
+#define LIBKERN_INLINE static __inline
+#define LIBKERN_BODY
+#else
+#define LIBKERN_INLINE
+#endif
+#endif
+
+
+LIBKERN_INLINE int imax __P((int, int));
+LIBKERN_INLINE int imin __P((int, int));
+LIBKERN_INLINE u_int max __P((u_int, u_int));
+LIBKERN_INLINE u_int min __P((u_int, u_int));
+LIBKERN_INLINE long lmax __P((long, long));
+LIBKERN_INLINE long lmin __P((long, long));
+LIBKERN_INLINE u_long ulmax __P((u_long, u_long));
+LIBKERN_INLINE u_long ulmin __P((u_long, u_long));
+LIBKERN_INLINE int abs __P((int));
+
+#ifdef LIBKERN_BODY
+LIBKERN_INLINE int
+imax(a, b)
+ int a, b;
+{
+ return (a > b ? a : b);
+}
+LIBKERN_INLINE int
+imin(a, b)
+ int a, b;
+{
+ return (a < b ? a : b);
+}
+LIBKERN_INLINE long
+lmax(a, b)
+ long a, b;
+{
+ return (a > b ? a : b);
+}
+LIBKERN_INLINE long
+lmin(a, b)
+ long a, b;
+{
+ return (a < b ? a : b);
+}
+LIBKERN_INLINE u_int
+max(a, b)
+ u_int a, b;
+{
+ return (a > b ? a : b);
+}
+LIBKERN_INLINE u_int
+min(a, b)
+ u_int a, b;
+{
+ return (a < b ? a : b);
+}
+LIBKERN_INLINE u_long
+ulmax(a, b)
+ u_long a, b;
+{
+ return (a > b ? a : b);
+}
+LIBKERN_INLINE u_long
+ulmin(a, b)
+ u_long a, b;
+{
+ return (a < b ? a : b);
+}
+
+LIBKERN_INLINE int
+abs(j)
+ int j;
+{
+ return(j < 0 ? -j : j);
+}
+#endif
+
+#ifndef __ECOS
+#ifdef NDEBUG /* tradition! */
+#define assert(e) ((void)0)
+#else
+#ifdef __STDC__
+#define assert(e) ((e) ? (void)0 : \
+ __assert("", __FILE__, __LINE__, #e))
+#else
+#define assert(e) ((e) ? (void)0 : \
+ __assert("", __FILE__, __LINE__, "e"))
+#endif
+#endif
+
+#ifndef DIAGNOSTIC
+#define KASSERT(e) ((void)0)
+#else
+#ifdef __STDC__
+#define KASSERT(e) ((e) ? (void)0 : \
+ __assert("diagnostic ", __FILE__, __LINE__, #e))
+#else
+#define KASSERT(e) ((e) ? (void)0 : \
+ __assert("diagnostic ", __FILE__, __LINE__, "e"))
+#endif
+#endif
+
+#ifndef DEBUG
+#define KDASSERT(e) ((void)0)
+#else
+#ifdef __STDC__
+#define KDASSERT(e) ((e) ? (void)0 : \
+ __assert("debugging ", __FILE__, __LINE__, #e))
+#else
+#define KDASSERT(e) ((e) ? (void)0 : \
+ __assert("debugging ", __FILE__, __LINE__, "e"))
+#endif
+#endif
+#endif
+
+/* Prototypes for non-quad routines. */
+#ifndef __ECOS
+void __assert __P((const char *, const char *, int, const char *))
+ __attribute__ ((__noreturn__));
+#endif
+int bcmp __P((const void *, const void *, size_t));
+int ffs __P((int));
+int locc __P((int, char *, u_int));
+void *memchr __P((const void *, int, size_t));
+int scanc __P((u_int, const u_char *, const u_char *, int));
+int skpc __P((int, size_t, u_char *));
+size_t strlen __P((const char *));
+char *strcat __P((char *, const char *));
+char *strcpy __P((char *, const char *));
+char *strncpy __P((char *, const char *, size_t));
+int strcmp __P((const char *, const char *));
+int strncmp __P((const char *, const char *, size_t));
+int strncasecmp __P((const char *, const char *, size_t));
+int getsn __P((char *, int));
+
+extern u_int8_t const __bcd2bin[], __bin2bcd[];
+#define bcd2bin(b) (__bcd2bin[(b)&0xff])
+#define bin2bcd(b) (__bin2bcd[(b)&0xff])
+
+#endif /* __INSIDE_NET */
+
+#endif /* __LIBKERN_H__ */
diff --git a/ecos/packages/net/tcpip/current/include/machine/cdefs.h b/ecos/packages/net/tcpip/current/include/machine/cdefs.h
new file mode 100644
index 0000000..fe027bf
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/machine/cdefs.h
@@ -0,0 +1,33 @@
+//==========================================================================
+//
+// include/machine/cdefs.h
+//
+// Architecture/platform specific parameters
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+#ifndef _MACHINE_CDEFS_H_
+#define _MACHINE_CDEFS_H_
+
+#endif // _MACHINE_CDEFS_H_
diff --git a/ecos/packages/net/tcpip/current/include/machine/cpu.h b/ecos/packages/net/tcpip/current/include/machine/cpu.h
new file mode 100644
index 0000000..cd0c166
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/machine/cpu.h
@@ -0,0 +1,33 @@
+//==========================================================================
+//
+// include/machine/cpu.h
+//
+// Architecture/platform specific parameters
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+#ifndef _MACHINE_CPU_H_
+#define _MACHINE_CPU_H_
+
+#endif // _MACHINE_CPU_H_
diff --git a/ecos/packages/net/tcpip/current/include/machine/limits.h b/ecos/packages/net/tcpip/current/include/machine/limits.h
new file mode 100644
index 0000000..516be12
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/machine/limits.h
@@ -0,0 +1,35 @@
+//==========================================================================
+//
+// include/machine/limits.h
+//
+// Architecture/platform specific limits
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+#ifndef _MACHINE_LIMITS_H_
+#define _MACHINE_LIMITS_H_
+
+#include <limits.h> // Compiler provided
+
+#endif /* _MACHINE_LIMITS_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/machine/param.h b/ecos/packages/net/tcpip/current/include/machine/param.h
new file mode 100644
index 0000000..5f41b25
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/machine/param.h
@@ -0,0 +1,138 @@
+//==========================================================================
+//
+// include/machine/param.h
+//
+// Architecture/platform specific parameters
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+#ifndef _MACHINE_PARAM_H_
+#define _MACHINE_PARAM_H_
+
+#include <pkgconf/net.h>
+
+/*
+ * 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.
+ */
+#define MSIZE 128 /* size of an mbuf */
+#define MCLSHIFT 11 /* convert bytes to m_buf clusters */
+#define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */
+#define MCLOFSET (MCLBYTES - 1) /* offset within a m_buf cluster */
+#define CLBYTES 4096 /* size of actual cluster */
+
+/*
+ * Round p (pointer or byte index) up to a correctly-aligned value
+ * for all data types (int, long, ...). The result is u_int and
+ * must be cast to any desired pointer type.
+ */
+#define ALIGNBYTES (sizeof(int) - 1)
+#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
+
+// These symbols are used in the IPV6 stuff
+// (be more defensive about external setup)
+#ifdef __linux__
+#undef __linux__
+#endif
+#ifdef __bsdi__
+#undef __bsdi__
+#endif
+#ifdef __FreeBSD__
+#undef __FreeBSD__
+#endif
+#ifdef __OpenBSD__
+#undef __OpenBSD__
+#endif
+#ifdef __NetBSD__
+#undef __NetBSD__
+#endif
+
+
+#define __linux__ 0
+#define __bsdi__ 0
+#define __FreeBSD__ 0
+#define __OpenBSD__ 1
+#define __NetBSD__ 0
+
+// These definitions here to avoid needing <sys/systm.h>
+// This probably doesn't belong here, but we need these definitions
+#include <lib/libkern/libkern.h>
+#define SCARG(p,k) ((p)->k.datum) /* get arg from args pointer */
+#include <stdarg.h>
+
+// TEMP
+
+#include <cyg/infra/diag.h>
+#include <cyg/hal/hal_intr.h>
+#include <cyg/kernel/kapi.h>
+#include <cyg/io/file.h>
+
+struct net_stats {
+ int count;
+ cyg_uint32 min_time, max_time, total_time;
+};
+
+#ifdef CYGDBG_NET_TIMING_STATS
+#define START_STATS() \
+ cyg_uint32 start_time, end_time, elapsed_time; \
+ HAL_CLOCK_READ(&start_time);
+#define FINISH_STATS(stats) \
+ HAL_CLOCK_READ(&end_time); \
+ if (end_time < start_time) { \
+ elapsed_time = (end_time+CYGNUM_KERNEL_COUNTERS_RTC_PERIOD) - start_time; \
+ } else { \
+ elapsed_time = end_time - start_time; \
+ } \
+ if (stats.min_time == 0) { \
+ stats.min_time = 0x7FFFFFFF; \
+ } \
+ if (elapsed_time < stats.min_time) \
+ stats.min_time = elapsed_time; \
+ if (elapsed_time > stats.max_time) \
+ stats.max_time = elapsed_time; \
+ stats.total_time += elapsed_time; \
+ stats.count++;
+#else
+#define START_STATS()
+#define FINISH_STATS(X)
+#endif
+
+// timeout support
+typedef void (timeout_fun)(void *);
+extern cyg_uint32 timeout(timeout_fun *fun, void *arg, cyg_int32 delta);
+extern void untimeout(timeout_fun *fun, void *arg);
+extern int uiomove(caddr_t cp, int n, struct uio *uio);
+extern int copyout(const void *s, void *d, size_t len);
+extern int copyin(const void *s, void *d, size_t len);
+extern void ovbcopy(const void *s, void *d, size_t len);
+extern void get_mono_time(void);
+extern int arc4random(void);
+extern void get_random_bytes(void *buf, size_t len);
+
+extern void *hashinit(int elements, int type, int flags, u_long *hashmask);
+
+#endif // _MACHINE_PARAM_H_
diff --git a/ecos/packages/net/tcpip/current/include/machine/signal.h b/ecos/packages/net/tcpip/current/include/machine/signal.h
new file mode 100644
index 0000000..713237f
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/machine/signal.h
@@ -0,0 +1,30 @@
+//==========================================================================
+//
+// include/machine/signal.h
+//
+// Architecture specific 'signal' support
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+// None defined
diff --git a/ecos/packages/net/tcpip/current/include/machine/stdarg.h b/ecos/packages/net/tcpip/current/include/machine/stdarg.h
new file mode 100644
index 0000000..e691eb3
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/machine/stdarg.h
@@ -0,0 +1,31 @@
+//==========================================================================
+//
+// include/machine/stdarg.h
+//
+// Architecture/compiler specifics
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+// Get this from the compiler
+#include <stdarg.h>
diff --git a/ecos/packages/net/tcpip/current/include/machine/types.h b/ecos/packages/net/tcpip/current/include/machine/types.h
new file mode 100644
index 0000000..255d94d
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/machine/types.h
@@ -0,0 +1,84 @@
+//==========================================================================
+//
+// include/machine/types.h
+//
+// Architecture/platform specific support for data types
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+#ifndef _MACHINE_TYPES_H_
+#define _MACHINE_TYPES_H_
+
+#include <sys/cdefs.h>
+#include <cyg/infra/cyg_type.h>
+#include <cyg/hal/hal_arch.h>
+
+#define __BIT_TYPES_DEFINED__
+typedef __signed char int8_t;
+typedef unsigned char u_int8_t;
+typedef unsigned char uint8_t;
+typedef short int16_t;
+typedef unsigned short u_int16_t;
+typedef unsigned short uint16_t;
+typedef int int32_t;
+typedef unsigned int u_int32_t;
+typedef unsigned int uint32_t;
+typedef long long int64_t;
+typedef unsigned long long u_int64_t;
+typedef unsigned long long uint64_t;
+
+// Types inherited from HAL
+
+typedef CYG_ADDRESS vaddr_t;
+typedef CYG_ADDRWORD vsize_t;
+typedef CYG_ADDRESS paddr_t;
+typedef CYG_ADDRWORD psize_t;
+
+typedef CYG_ADDRESS vm_offset_t;
+typedef CYG_ADDRWORD vm_size_t;
+
+// No good HAL definition for this
+
+typedef CYG_ADDRWORD register_t;
+
+
+// From <arch/ansi.h>
+/*
+ * Types which are fundamental to the implementation and may appear in
+ * more than one standard header are defined here. Standard headers
+ * then use:
+ * #ifdef _BSD_SIZE_T_
+ * typedef _BSD_SIZE_T_ size_t;
+ * #undef _BSD_SIZE_T_
+ * #endif
+ */
+#define _BSD_SSIZE_T_ int /* byte count or error */
+#define _BSD_CLOCKID_T_ int
+#define _BSD_TIMER_T_ int
+#ifndef __time_t_defined // As defined/used by eCos libc
+#define _BSD_CLOCK_T_ cyg_int64 /* clock() */
+#define _BSD_TIME_T_ cyg_count32 /* time() */
+#endif
+
+#endif // _MACHINE_TYPES_H_
diff --git a/ecos/packages/net/tcpip/current/include/net/bpf.h b/ecos/packages/net/tcpip/current/include/net/bpf.h
new file mode 100644
index 0000000..47665ba
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/net/bpf.h
@@ -0,0 +1,307 @@
+//==========================================================================
+//
+// include/net/bpf.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: bpf.h,v 1.12 1999/08/08 00:43:00 niklas Exp $ */
+/* $NetBSD: bpf.h,v 1.15 1996/12/13 07:57:33 mikel Exp $ */
+
+/*
+ * Copyright (c) 1990, 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from the Stanford/CMU enet packet filter,
+ * (net/enet.c) distributed as part of 4.3BSD, and code contributed
+ * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
+ * Berkeley Laboratory.
+ *
+ * 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.
+ *
+ * @(#)bpf.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NET_BPF_H_
+#define _NET_BPF_H_
+
+/* BSD style release date */
+#define BPF_RELEASE 199606
+
+typedef int32_t bpf_int32;
+typedef u_int32_t bpf_u_int32;
+/*
+ * Alignment macros. BPF_WORDALIGN rounds up to the next even multiple of
+ * BPF_ALIGNMENT (which is at least as much as what a timeval needs).
+ */
+#define BPF_ALIGNMENT sizeof(long)
+#define BPF_WORDALIGN(x) (((x) + (BPF_ALIGNMENT - 1)) & ~(BPF_ALIGNMENT - 1))
+
+#define BPF_MAXINSNS 512
+#define BPF_MAXBUFSIZE 0x80000
+#define BPF_MINBUFSIZE 32
+
+/*
+ * Structure for BIOCSETF.
+ */
+struct bpf_program {
+ u_int bf_len;
+ struct bpf_insn *bf_insns;
+};
+
+/*
+ * Struct returned by BIOCGSTATS.
+ */
+struct bpf_stat {
+ u_int bs_recv; /* number of packets received */
+ u_int bs_drop; /* number of packets dropped */
+};
+
+/*
+ * Struct return by BIOCVERSION. This represents the version number of
+ * the filter language described by the instruction encodings below.
+ * bpf understands a program iff kernel_major == filter_major &&
+ * kernel_minor >= filter_minor, that is, if the value returned by the
+ * running kernel has the same major number and a minor number equal
+ * equal to or less than the filter being downloaded. Otherwise, the
+ * results are undefined, meaning an error may be returned or packets
+ * may be accepted haphazardly.
+ * It has nothing to do with the source code version.
+ */
+struct bpf_version {
+ u_short bv_major;
+ u_short bv_minor;
+};
+/* Current version number of filter architecture. */
+#define BPF_MAJOR_VERSION 1
+#define BPF_MINOR_VERSION 1
+
+/*
+ * BPF ioctls
+ *
+ * The first set is for compatibility with Sun's pcc style
+ * header files. If you're using gcc, we assume that you
+ * have run fixincludes so the latter set should work.
+ */
+#if (defined(sun) || defined(ibm032)) && !defined(__GNUC__)
+#define BIOCGBLEN _IOR(B,102, u_int)
+#define BIOCSBLEN _IOWR(B,102, u_int)
+#define BIOCSETF _IOW(B,103, struct bpf_program)
+#define BIOCFLUSH _IO(B,104)
+#define BIOCPROMISC _IO(B,105)
+#define BIOCGDLT _IOR(B,106, u_int)
+#define BIOCGETIF _IOR(B,107, struct ifreq)
+#define BIOCSETIF _IOW(B,108, struct ifreq)
+#define BIOCSRTIMEOUT _IOW(B,109, struct timeval)
+#define BIOCGRTIMEOUT _IOR(B,110, struct timeval)
+#define BIOCGSTATS _IOR(B,111, struct bpf_stat)
+#define BIOCIMMEDIATE _IOW(B,112, u_int)
+#define BIOCVERSION _IOR(B,113, struct bpf_version)
+#define BIOCSRSIG _IOW(B,114, u_int)
+#define BIOCGRSIG _IOR(B,115, u_int)
+#else
+#define BIOCGBLEN _IOR('B',102, u_int)
+#define BIOCSBLEN _IOWR('B',102, u_int)
+#define BIOCSETF _IOW('B',103, struct bpf_program)
+#define BIOCFLUSH _IO('B',104)
+#define BIOCPROMISC _IO('B',105)
+#define BIOCGDLT _IOR('B',106, u_int)
+#define BIOCGETIF _IOR('B',107, struct ifreq)
+#define BIOCSETIF _IOW('B',108, struct ifreq)
+#define BIOCSRTIMEOUT _IOW('B',109, struct timeval)
+#define BIOCGRTIMEOUT _IOR('B',110, struct timeval)
+#define BIOCGSTATS _IOR('B',111, struct bpf_stat)
+#define BIOCIMMEDIATE _IOW('B',112, u_int)
+#define BIOCVERSION _IOR('B',113, struct bpf_version)
+#define BIOCSRSIG _IOW('B',114, u_int)
+#define BIOCGRSIG _IOR('B',115, u_int)
+#endif
+
+/*
+ * Structure prepended to each packet.
+ */
+struct bpf_hdr {
+ struct timeval bh_tstamp; /* time stamp */
+ u_int32_t bh_caplen; /* length of captured portion */
+ u_int32_t bh_datalen; /* original length of packet */
+ u_int16_t bh_hdrlen; /* length of bpf header (this struct
+ plus alignment padding) */
+};
+/*
+ * Because the structure above is not a multiple of 4 bytes, some compilers
+ * will insist on inserting padding; hence, sizeof(struct bpf_hdr) won't work.
+ * Only the kernel needs to know about it; applications use bh_hdrlen.
+ * XXX To save a few bytes on 32-bit machines, we avoid end-of-struct
+ * XXX padding by using the size of the header data elements. This is
+ * XXX fail-safe: on new machines, we just use the 'safe' sizeof.
+ */
+#ifdef _KERNEL
+#if defined(__arm32__) || defined(__i386__) || defined(__m68k__) || \
+ defined(__mips__) || defined(__ns32k__) || defined(__sparc__) || \
+ defined(__vax__)
+#define SIZEOF_BPF_HDR 18
+#else
+#define SIZEOF_BPF_HDR sizeof(struct bpf_hdr)
+#endif
+#endif
+
+/*
+ * Data-link level type codes.
+ */
+#define DLT_NULL 0 /* no link-layer encapsulation */
+#define DLT_EN10MB 1 /* Ethernet (10Mb) */
+#define DLT_EN3MB 2 /* Experimental Ethernet (3Mb) */
+#define DLT_AX25 3 /* Amateur Radio AX.25 */
+#define DLT_PRONET 4 /* Proteon ProNET Token Ring */
+#define DLT_CHAOS 5 /* Chaos */
+#define DLT_IEEE802 6 /* IEEE 802 Networks */
+#define DLT_ARCNET 7 /* ARCNET */
+#define DLT_SLIP 8 /* Serial Line IP */
+#define DLT_PPP 9 /* Point-to-point Protocol */
+#define DLT_FDDI 10 /* FDDI */
+#define DLT_ATM_RFC1483 11 /* LLC/SNAP encapsulated atm */
+#define DLT_LOOP 12 /* loopback type (af header) */
+#define DLT_ENC 13 /* IPSEC enc type (af header, spi, flags) */
+#define DLT_RAW 14 /* raw IP */
+#define DLT_SLIP_BSDOS 15 /* BSD/OS Serial Line IP */
+#define DLT_PPP_BSDOS 16 /* BSD/OS Point-to-point Protocol */
+
+/*
+ * The instruction encodings.
+ */
+/* instruction classes */
+#define BPF_CLASS(code) ((code) & 0x07)
+#define BPF_LD 0x00
+#define BPF_LDX 0x01
+#define BPF_ST 0x02
+#define BPF_STX 0x03
+#define BPF_ALU 0x04
+#define BPF_JMP 0x05
+#define BPF_RET 0x06
+#define BPF_MISC 0x07
+
+/* ld/ldx fields */
+#define BPF_SIZE(code) ((code) & 0x18)
+#define BPF_W 0x00
+#define BPF_H 0x08
+#define BPF_B 0x10
+#define BPF_MODE(code) ((code) & 0xe0)
+#define BPF_IMM 0x00
+#define BPF_ABS 0x20
+#define BPF_IND 0x40
+#define BPF_MEM 0x60
+#define BPF_LEN 0x80
+#define BPF_MSH 0xa0
+
+/* alu/jmp fields */
+#define BPF_OP(code) ((code) & 0xf0)
+#define BPF_ADD 0x00
+#define BPF_SUB 0x10
+#define BPF_MUL 0x20
+#define BPF_DIV 0x30
+#define BPF_OR 0x40
+#define BPF_AND 0x50
+#define BPF_LSH 0x60
+#define BPF_RSH 0x70
+#define BPF_NEG 0x80
+#define BPF_JA 0x00
+#define BPF_JEQ 0x10
+#define BPF_JGT 0x20
+#define BPF_JGE 0x30
+#define BPF_JSET 0x40
+#define BPF_SRC(code) ((code) & 0x08)
+#define BPF_K 0x00
+#define BPF_X 0x08
+
+/* ret - BPF_K and BPF_X also apply */
+#define BPF_RVAL(code) ((code) & 0x18)
+#define BPF_A 0x10
+
+/* misc */
+#define BPF_MISCOP(code) ((code) & 0xf8)
+#define BPF_TAX 0x00
+#define BPF_TXA 0x80
+
+/*
+ * The instruction data structure.
+ */
+struct bpf_insn {
+ u_int16_t code;
+ u_char jt;
+ u_char jf;
+ int32_t k;
+};
+
+/*
+ * Macros for insn array initializers.
+ */
+#define BPF_STMT(code, k) { (u_int16_t)(code), 0, 0, k }
+#define BPF_JUMP(code, k, jt, jf) { (u_int16_t)(code), jt, jf, k }
+
+#ifdef _KERNEL
+int bpf_validate __P((struct bpf_insn *, int));
+void bpf_tap __P((caddr_t, u_char *, u_int));
+void bpf_mtap __P((caddr_t, struct mbuf *));
+void bpfattach __P((caddr_t *, struct ifnet *, u_int, u_int));
+void bpfdetach __P((struct ifnet *));
+void bpfilterattach __P((int));
+u_int bpf_filter __P((struct bpf_insn *, u_char *, u_int, u_int));
+#endif
+
+/*
+ * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST).
+ */
+#define BPF_MEMWORDS 16
+
+extern int ticks; /* from kern/kern_clock.c; incremented each */
+ /* clock tick. */
+
+#endif /* _NET_BPF_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/net/bpfdesc.h b/ecos/packages/net/tcpip/current/include/net/bpfdesc.h
new file mode 100644
index 0000000..5ab584f
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/net/bpfdesc.h
@@ -0,0 +1,141 @@
+//==========================================================================
+//
+// include/net/bpfdesc.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: bpfdesc.h,v 1.5 1999/08/08 00:43:00 niklas Exp $ */
+/* $NetBSD: bpfdesc.h,v 1.11 1995/09/27 18:30:42 thorpej Exp $ */
+
+/*
+ * Copyright (c) 1990, 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from the Stanford/CMU enet packet filter,
+ * (net/enet.c) distributed as part of 4.3BSD, and code contributed
+ * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence
+ * Berkeley Laboratory.
+ *
+ * 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.
+ *
+ * @(#)bpfdesc.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NET_BPFDESC_H_
+#define _NET_BPFDESC_H_
+
+#include <sys/select.h>
+
+/*
+ * Descriptor associated with each open bpf file.
+ */
+struct bpf_d {
+ struct bpf_d *bd_next; /* Linked list of descriptors */
+ /*
+ * Buffer slots: two mbuf clusters buffer the incoming packets.
+ * The model has three slots. Sbuf is always occupied.
+ * sbuf (store) - Receive interrupt puts packets here.
+ * hbuf (hold) - When sbuf is full, put cluster here and
+ * wakeup read (replace sbuf with fbuf).
+ * fbuf (free) - When read is done, put cluster here.
+ * On receiving, if sbuf is full and fbuf is 0, packet is dropped.
+ */
+ caddr_t bd_sbuf; /* store slot */
+ caddr_t bd_hbuf; /* hold slot */
+ caddr_t bd_fbuf; /* free slot */
+ int bd_slen; /* current length of store buffer */
+ int bd_hlen; /* current length of hold buffer */
+
+ int bd_bufsize; /* absolute length of buffers */
+
+ struct bpf_if * bd_bif; /* interface descriptor */
+ u_long bd_rtout; /* Read timeout in 'ticks' */
+ u_long bd_rdStart; /* when the read started */
+ struct bpf_insn *bd_filter; /* filter code */
+ u_long bd_rcount; /* number of packets received */
+ u_long bd_dcount; /* number of packets dropped */
+
+ u_char bd_promisc; /* true if listening promiscuously */
+ u_char bd_state; /* idle, waiting, or timed out */
+ u_char bd_immediate; /* true to return on packet arrival */
+ int bd_async; /* non-zero if packet reception should generate signal */
+ int bd_sig; /* signal to send upon packet reception */
+ pid_t bd_pgid; /* process or group id for signal */
+ uid_t bd_siguid; /* uid for process that set pgid */
+ uid_t bd_sigeuid; /* euid for process that set pgid */
+#if BSD < 199103
+ u_char bd_selcoll; /* true if selects collide */
+ int bd_timedout;
+ struct proc * bd_selproc; /* process that last selected us */
+#else
+ u_char bd_pad; /* explicit alignment */
+ struct selinfo bd_sel; /* bsd select info */
+#endif
+};
+
+/*
+ * Descriptor associated with each attached hardware interface.
+ */
+struct bpf_if {
+ struct bpf_if *bif_next; /* list of all interfaces */
+ struct bpf_d *bif_dlist; /* descriptor list */
+ struct bpf_if **bif_driverp; /* pointer into softc */
+ u_int bif_dlt; /* link layer type */
+ u_int bif_hdrlen; /* length of header (with padding) */
+ struct ifnet *bif_ifp; /* correspoding interface */
+};
+
+#ifdef _KERNEL
+int bpf_setf __P((struct bpf_d *, struct bpf_program *));
+#endif
+
+#endif // _NET_BPFDESC_H_
diff --git a/ecos/packages/net/tcpip/current/include/net/if.h b/ecos/packages/net/tcpip/current/include/net/if.h
new file mode 100644
index 0000000..cc8b060
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/net/if.h
@@ -0,0 +1,481 @@
+//==========================================================================
+//
+// include/net/if.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: if.h,v 1.14 1999/12/08 06:50:17 itojun Exp $ */
+/* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1993
+ * 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.
+ *
+ * @(#)if.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NET_IF_H_
+#define _NET_IF_H_
+
+#include <sys/queue.h>
+
+/*
+ * Structures defining a network interface, providing a packet
+ * transport mechanism (ala level 0 of the PUP protocols).
+ *
+ * Each interface accepts output datagrams of a specified maximum
+ * length, and provides higher level routines with input datagrams
+ * received from its medium.
+ *
+ * Output occurs when the routine if_output is called, with four parameters:
+ * (*ifp->if_output)(ifp, m, dst, rt)
+ * Here m is the mbuf chain to be sent and dst is the destination address.
+ * The output routine encapsulates the supplied datagram if necessary,
+ * and then transmits it on its medium.
+ *
+ * On input, each interface unwraps the data received by it, and either
+ * places it on the input queue of a internetwork datagram routine
+ * and posts the associated software interrupt, or passes the datagram to a raw
+ * packet input routine.
+ *
+ * Routines exist for locating interfaces by their addresses
+ * or for locating a interface on a certain network, as well as more general
+ * routing and gateway routines maintaining information used to locate
+ * interfaces. These routines live in the files if.c and route.c
+ */
+#include <sys/time.h>
+
+struct mbuf;
+struct proc;
+struct rtentry;
+struct socket;
+struct ether_header;
+struct arpcom;
+
+/*
+ * Structure defining statistics and other data kept regarding a network
+ * interface.
+ */
+struct if_data {
+ /* generic interface information */
+ u_char ifi_type; /* ethernet, tokenring, etc. */
+ u_char ifi_addrlen; /* media address length */
+ u_char ifi_hdrlen; /* media header length */
+ u_long ifi_mtu; /* maximum transmission unit */
+ u_long ifi_metric; /* routing metric (external only) */
+ u_long ifi_baudrate; /* linespeed */
+ /* volatile statistics */
+ u_long ifi_ipackets; /* packets received on interface */
+ u_long ifi_ierrors; /* input errors on interface */
+ u_long ifi_opackets; /* packets sent on interface */
+ u_long ifi_oerrors; /* output errors on interface */
+ u_long ifi_collisions; /* collisions on csma interfaces */
+ u_long ifi_ibytes; /* total number of octets received */
+ u_long ifi_obytes; /* total number of octets sent */
+ u_long ifi_imcasts; /* packets received via multicast */
+ u_long ifi_omcasts; /* packets sent via multicast */
+ u_long ifi_iqdrops; /* dropped on input, this interface */
+ u_long ifi_noproto; /* destined for unsupported protocol */
+ struct timeval ifi_lastchange; /* last updated */
+};
+
+/*
+ * Structure defining a queue for a network interface.
+ *
+ * (Would like to call this struct ``if'', but C isn't PL/1.)
+ */
+TAILQ_HEAD(ifnet_head, ifnet); /* the actual queue head */
+
+/*
+ * Length of interface external name, including terminating '\0'.
+ * Note: this is the same size as a generic device's external name.
+ */
+#define IFNAMSIZ 16
+#define IF_NAMESIZE IFNAMSIZ
+
+struct ifnet { /* and the entries */
+ void *if_softc; /* lower-level data for this if */
+ TAILQ_ENTRY(ifnet) if_list; /* all struct ifnets are chained */
+ TAILQ_HEAD(, ifaddr) if_addrlist; /* linked list of addresses per if */
+ char if_xname[IFNAMSIZ]; /* external name (name + unit) */
+ int if_pcount; /* number of promiscuous listeners */
+ caddr_t if_bpf; /* packet filter structure */
+ caddr_t if_bridge; /* bridge structure */
+ u_short if_index; /* numeric abbreviation for this if */
+ short if_timer; /* time 'til if_watchdog called */
+ short if_flags; /* up/down, broadcast, etc. */
+ struct if_data if_data; /* statistics and other data about if */
+/* procedure handles */
+ int (*if_output) /* output routine (enqueue) */
+ __P((struct ifnet *, struct mbuf *, struct sockaddr *,
+ struct rtentry *));
+ void (*if_start) /* initiate output routine */
+ __P((struct ifnet *));
+ int (*if_ioctl) /* ioctl routine */
+ __P((struct ifnet *, u_long, caddr_t));
+ int (*if_reset) /* XXX bus reset routine */
+ __P((struct ifnet *));
+ void (*if_watchdog) /* timer routine */
+ __P((struct ifnet *));
+ struct ifqueue {
+ struct mbuf *ifq_head;
+ struct mbuf *ifq_tail;
+ int ifq_len;
+ int ifq_maxlen;
+ int ifq_drops;
+ } if_snd; /* output queue */
+ struct ifprefix *if_prefixlist; /* linked list of prefixes per if */
+};
+#define if_mtu if_data.ifi_mtu
+#define if_type if_data.ifi_type
+#define if_addrlen if_data.ifi_addrlen
+#define if_hdrlen if_data.ifi_hdrlen
+#define if_metric if_data.ifi_metric
+#define if_baudrate if_data.ifi_baudrate
+#define if_ipackets if_data.ifi_ipackets
+#define if_ierrors if_data.ifi_ierrors
+#define if_opackets if_data.ifi_opackets
+#define if_oerrors if_data.ifi_oerrors
+#define if_collisions if_data.ifi_collisions
+#define if_ibytes if_data.ifi_ibytes
+#define if_obytes if_data.ifi_obytes
+#define if_imcasts if_data.ifi_imcasts
+#define if_omcasts if_data.ifi_omcasts
+#define if_iqdrops if_data.ifi_iqdrops
+#define if_noproto if_data.ifi_noproto
+#define if_lastchange if_data.ifi_lastchange
+
+#define IFF_UP 0x1 /* interface is up */
+#define IFF_BROADCAST 0x2 /* broadcast address valid */
+#define IFF_DEBUG 0x4 /* turn on debugging */
+#define IFF_LOOPBACK 0x8 /* is a loopback net */
+#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */
+#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */
+#define IFF_RUNNING 0x40 /* resources allocated */
+#define IFF_NOARP 0x80 /* no address resolution protocol */
+#define IFF_PROMISC 0x100 /* receive all packets */
+#define IFF_ALLMULTI 0x200 /* receive all multicast packets */
+#define IFF_OACTIVE 0x400 /* transmission in progress */
+#define IFF_SIMPLEX 0x800 /* can't hear own transmissions */
+#define IFF_LINK0 0x1000 /* per link layer defined bit */
+#define IFF_LINK1 0x2000 /* per link layer defined bit */
+#define IFF_LINK2 0x4000 /* per link layer defined bit */
+#define IFF_MULTICAST 0x8000 /* supports multicast */
+
+/* flags set internally only: */
+#define IFF_CANTCHANGE \
+ (IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\
+ IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI)
+
+/*
+ * Output queues (ifp->if_snd) and internetwork datagram level (pup level 1)
+ * input routines have queues of messages stored on ifqueue structures
+ * (defined above). Entries are added to and deleted from these structures
+ * by these macros, which should be called with ipl raised to splimp().
+ */
+#define IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen)
+#define IF_DROP(ifq) ((ifq)->ifq_drops++)
+#define IF_ENQUEUE(ifq, m) { \
+ (m)->m_nextpkt = 0; \
+ if ((ifq)->ifq_tail == 0) \
+ (ifq)->ifq_head = m; \
+ else \
+ (ifq)->ifq_tail->m_nextpkt = m; \
+ (ifq)->ifq_tail = m; \
+ (ifq)->ifq_len++; \
+}
+#define IF_PREPEND(ifq, m) { \
+ (m)->m_nextpkt = (ifq)->ifq_head; \
+ if ((ifq)->ifq_tail == 0) \
+ (ifq)->ifq_tail = (m); \
+ (ifq)->ifq_head = (m); \
+ (ifq)->ifq_len++; \
+}
+#define IF_DEQUEUE(ifq, m) { \
+ (m) = (ifq)->ifq_head; \
+ if (m) { \
+ if (((ifq)->ifq_head = (m)->m_nextpkt) == 0) \
+ (ifq)->ifq_tail = 0; \
+ (m)->m_nextpkt = 0; \
+ (ifq)->ifq_len--; \
+ } \
+}
+#define IF_IS_EMPTY(ifq) ((ifq)->ifq_len == 0)
+
+#define IFQ_ENQUEUE(ifq, m, pattr, err) \
+do { \
+ if (IF_QFULL((ifq))) { \
+ m_freem((m)); \
+ (err) = ENOBUFS; \
+ } else { \
+ IF_ENQUEUE((ifq), (m)); \
+ (err) = 0; \
+ } \
+ if ((err)) \
+ (ifq)->ifq_drops++; \
+} while (0)
+
+#define IFQ_MAXLEN 50
+#define IFNET_SLOWHZ 1 /* granularity is 1 second */
+
+/*
+ * The ifaddr structure contains information about one address
+ * of an interface. They are maintained by the different address families,
+ * are allocated and attached when an address is set, and are linked
+ * together so all addresses for an interface can be located.
+ */
+struct ifaddr {
+ struct sockaddr *ifa_addr; /* address of interface */
+ struct sockaddr *ifa_dstaddr; /* other end of p-to-p link */
+#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */
+ struct sockaddr *ifa_netmask; /* used to determine subnet */
+ struct ifnet *ifa_ifp; /* back-pointer to interface */
+ TAILQ_ENTRY(ifaddr) ifa_list; /* list of addresses for interface */
+ void (*ifa_rtrequest) /* check or clean routes (+ or -)'d */
+ __P((int, struct rtentry *, struct sockaddr *));
+ u_short ifa_flags; /* mostly rt_flags for cloning */
+ u_int ifa_refcnt; /* count of references */
+ int ifa_metric; /* cost of going out this interface */
+};
+#define IFA_ROUTE RTF_UP /* route installed */
+
+/*
+ * The prefix structure contains information about one prefix
+ * of an interface. They are maintained by the different address families,
+ * are allocated and attached when an prefix or an address is set,
+ * and are linked together so all prfefixes for an interface can be located.
+ */
+struct ifprefix {
+ struct sockaddr *ifpr_prefix; /* prefix of interface */
+ struct ifnet *ifpr_ifp; /* back-pointer to interface */
+ struct ifprefix *ifpr_next;
+ u_char ifpr_plen; /* prefix length in bits */
+ u_char ifpr_type; /* protocol dependent prefix type */
+};
+
+/*
+ * Message format for use in obtaining information about interfaces
+ * from sysctl and the routing socket.
+ */
+struct if_msghdr {
+ u_short ifm_msglen; /* to skip over non-understood messages */
+ u_char ifm_version; /* future binary compatability */
+ u_char ifm_type; /* message type */
+ int ifm_addrs; /* like rtm_addrs */
+ int ifm_flags; /* value of if_flags */
+ u_short ifm_index; /* index for associated ifp */
+ struct if_data ifm_data;/* statistics and other data about if */
+};
+
+/*
+ * Message format for use in obtaining information about interface addresses
+ * from sysctl and the routing socket.
+ */
+struct ifa_msghdr {
+ u_short ifam_msglen; /* to skip over non-understood messages */
+ u_char ifam_version; /* future binary compatability */
+ u_char ifam_type; /* message type */
+ int ifam_addrs; /* like rtm_addrs */
+ int ifam_flags; /* value of ifa_flags */
+ u_short ifam_index; /* index for associated ifp */
+ int ifam_metric; /* value of ifa_metric */
+};
+
+/*
+ * Interface request structure used for socket
+ * ioctl's. All interface ioctl's must have parameter
+ * definitions which begin with ifr_name. The
+ * remainder may be interface specific.
+ */
+struct ifreq {
+#define IFHWADDRLEN 6
+ char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
+ union {
+ struct sockaddr ifru_addr;
+ struct sockaddr ifru_dstaddr;
+ struct sockaddr ifru_broadaddr;
+ struct sockaddr ifru_hwaddr;
+ short ifru_flags;
+ int ifru_metric;
+ caddr_t ifru_data;
+ } ifr_ifru;
+#define ifr_addr ifr_ifru.ifru_addr /* address */
+#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
+#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */
+#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
+#define ifr_flags ifr_ifru.ifru_flags /* flags */
+#define ifr_metric ifr_ifru.ifru_metric /* metric */
+#define ifr_media ifr_ifru.ifru_metric /* media options (overload) */
+#define ifr_data ifr_ifru.ifru_data /* for use by interface */
+};
+
+struct ifaliasreq {
+ char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */
+ struct sockaddr ifra_addr;
+ struct sockaddr ifra_dstaddr;
+#define ifra_broadaddr ifra_dstaddr
+ struct sockaddr ifra_mask;
+};
+
+struct ifmediareq {
+ char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */
+ int ifm_current; /* current media options */
+ int ifm_mask; /* don't care mask */
+ int ifm_status; /* media status */
+ int ifm_active; /* active options */
+ int ifm_count; /* # entries in ifm_ulist
+ array */
+ int *ifm_ulist; /* media words */
+};
+
+/*
+ * Structure used in SIOCGIFCONF request.
+ * Used to retrieve interface configuration
+ * for machine (useful for programs which
+ * must know all networks accessible).
+ */
+struct ifconf {
+ int ifc_len; /* size of associated buffer */
+ union {
+ caddr_t ifcu_buf;
+ struct ifreq *ifcu_req;
+ } ifc_ifcu;
+#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
+#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */
+};
+
+/*
+ * Structure for SIOC[AGD]LIFADDR
+ */
+struct if_laddrreq {
+ char iflr_name[IFNAMSIZ];
+ unsigned int flags;
+#define IFLR_PREFIX 0x8000 /* in: prefix given out: kernel fills id */
+ unsigned int prefixlen; /* in/out */
+ struct sockaddr_storage addr; /* in/out */
+ struct sockaddr_storage dstaddr; /* out */
+};
+
+struct if_nameindex {
+ unsigned int if_index;
+ char *if_name;
+};
+
+#ifndef _KERNEL
+__BEGIN_DECLS
+unsigned int if_nametoindex __P((const char *));
+char *if_indextoname __P((unsigned int, char *));
+struct if_nameindex *if_nameindex __P((void));
+__END_DECLS
+#define if_freenameindex(x) free(x)
+#endif
+
+#include <net/if_arp.h>
+
+#ifdef _KERNEL
+#define IFAFREE(ifa) { \
+ if ((ifa)->ifa_refcnt <= 0) \
+ ifafree(ifa); \
+ else \
+ (ifa)->ifa_refcnt--; \
+ }
+
+struct ifnet_head ifnet;
+struct ifnet **ifindex2ifnet;
+#if 0
+struct ifnet loif[];
+#endif
+int if_index;
+
+void ether_ifattach __P((struct ifnet *));
+void ether_ifdetach __P((struct ifnet *));
+int ether_ioctl __P((struct ifnet *, struct arpcom *, u_long, caddr_t));
+void ether_input __P((struct ifnet *, struct ether_header *, struct mbuf *));
+int ether_output __P((struct ifnet *,
+ struct mbuf *, struct sockaddr *, struct rtentry *));
+char *ether_sprintf __P((u_char *));
+
+void if_attach __P((struct ifnet *));
+void if_attachtail __P((struct ifnet *));
+void if_attachhead __P((struct ifnet *));
+void if_detach __P((struct ifnet *));
+void if_down __P((struct ifnet *));
+void if_qflush __P((struct ifqueue *));
+void if_slowtimo __P((void *));
+void if_up __P((struct ifnet *));
+int ifconf __P((u_long, caddr_t));
+void ifinit __P((void));
+int ifioctl __P((struct socket *, u_long, caddr_t, struct proc *));
+int ifpromisc __P((struct ifnet *, int));
+struct ifnet *ifunit __P((char *));
+struct ifnet *if_withname __P((struct sockaddr *));
+
+struct ifaddr *ifa_ifwithaddr __P((struct sockaddr *));
+struct ifaddr *ifa_ifwithaf __P((int));
+struct ifaddr *ifa_ifwithdstaddr __P((struct sockaddr *));
+struct ifaddr *ifa_ifwithnet __P((struct sockaddr *));
+struct ifaddr *ifa_ifwithroute __P((int, struct sockaddr *,
+ struct sockaddr *));
+struct ifaddr *ifaof_ifpforaddr __P((struct sockaddr *, struct ifnet *));
+void ifafree __P((struct ifaddr *));
+void link_rtrequest __P((int, struct rtentry *, struct sockaddr *));
+
+int loioctl __P((struct ifnet *, u_long, caddr_t));
+void loopattach __P((int));
+int looutput __P((struct ifnet *,
+ struct mbuf *, struct sockaddr *, struct rtentry *));
+void lortrequest __P((int, struct rtentry *, struct sockaddr *));
+#endif /* _KERNEL */
+
+#endif // _NET_IF_H_
diff --git a/ecos/packages/net/tcpip/current/include/net/if_arp.h b/ecos/packages/net/tcpip/current/include/net/if_arp.h
new file mode 100644
index 0000000..cf9f4db
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/net/if_arp.h
@@ -0,0 +1,123 @@
+//==========================================================================
+//
+// include/net/if_arp.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: if_arp.h,v 1.3 1999/07/30 22:22:19 fgsch Exp $ */
+/* $NetBSD: if_arp.h,v 1.8 1995/03/08 02:56:52 cgd Exp $ */
+
+/*
+ * Copyright (c) 1986, 1993
+ * 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.
+ *
+ * @(#)if_arp.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NET_IF_ARP_H_
+#define _NET_IF_ARP_H_
+
+/*
+ * Address Resolution Protocol.
+ *
+ * See RFC 826 for protocol description. ARP packets are variable
+ * in size; the arphdr structure defines the fixed-length portion.
+ * Protocol type values are the same as those for 10 Mb/s Ethernet.
+ * It is followed by the variable-sized fields ar_sha, arp_spa,
+ * arp_tha and arp_tpa in that order, according to the lengths
+ * specified. Field names used correspond to RFC 826.
+ */
+struct arphdr {
+ u_int16_t ar_hrd; /* format of hardware address */
+#define ARPHRD_ETHER 1 /* ethernet hardware format */
+#define ARPHRD_IEEE802 6 /* IEEE 802 hardware format */
+#define ARPHRD_FRELAY 15 /* frame relay hardware format */
+ u_int16_t ar_pro; /* format of protocol address */
+ u_int8_t ar_hln; /* length of hardware address */
+ u_int8_t ar_pln; /* length of protocol address */
+ u_int16_t ar_op; /* one of: */
+#define ARPOP_REQUEST 1 /* request to resolve address */
+#define ARPOP_REPLY 2 /* response to previous request */
+#define ARPOP_REVREQUEST 3 /* request protocol address given hardware */
+#define ARPOP_REVREPLY 4 /* response giving protocol address */
+#define ARPOP_INVREQUEST 8 /* request to identify peer */
+#define ARPOP_INVREPLY 9 /* response identifying peer */
+/*
+ * The remaining fields are variable in size,
+ * according to the sizes above.
+ */
+#ifdef COMMENT_ONLY
+ u_int8_t ar_sha[]; /* sender hardware address */
+ u_int8_t ar_spa[]; /* sender protocol address */
+ u_int8_t ar_tha[]; /* target hardware address */
+ u_int8_t ar_tpa[]; /* target protocol address */
+#endif
+};
+
+/*
+ * ARP ioctl request
+ */
+struct arpreq {
+ struct sockaddr arp_pa; /* protocol address */
+ struct sockaddr arp_ha; /* hardware address */
+ int arp_flags; /* flags */
+};
+/* arp_flags and at_flags field values */
+#define ATF_INUSE 0x01 /* entry in use */
+#define ATF_COM 0x02 /* completed entry (enaddr valid) */
+#define ATF_PERM 0x04 /* permanent entry */
+#define ATF_PUBL 0x08 /* publish entry (respond for other host) */
+#define ATF_USETRAILERS 0x10 /* has requested trailers */
+
+#endif // _NET_IF_ARP_H_
diff --git a/ecos/packages/net/tcpip/current/include/net/if_bridge.h b/ecos/packages/net/tcpip/current/include/net/if_bridge.h
new file mode 100644
index 0000000..7fcb33e
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/net/if_bridge.h
@@ -0,0 +1,319 @@
+//==========================================================================
+//
+// include/net/if_bridge.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): Jason L. Wright (jason@thought.net)
+// Contributors: andrew.lunn@ascom.ch (Andrew Lunn), hmt, manu.sharma@ascom.ch
+// Date: 2000-07-18
+// Purpose: Ethernet bridge
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+/* $OpenBSD: if_bridge.h,v 1.25 2003/07/15 03:41:15 jason Exp $ */
+
+/*
+ * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net)
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *
+ * Effort sponsored in part by the Defense Advanced Research Projects
+ * Agency (DARPA) and Air Force Research Laboratory, Air Force
+ * Materiel Command, USAF, under agreement number F30602-01-2-0537.
+ *
+ */
+
+/*
+ * Bridge control request: add/delete member interfaces.
+ */
+struct ifbreq {
+ char ifbr_name[IFNAMSIZ]; /* bridge ifs name */
+ char ifbr_ifsname[IFNAMSIZ]; /* member ifs name */
+ u_int32_t ifbr_ifsflags; /* member ifs flags */
+ u_int8_t ifbr_state; /* member stp state */
+ u_int8_t ifbr_priority; /* member stp priority */
+ u_int8_t ifbr_portno; /* member port number */
+ u_int32_t ifbr_path_cost; /* member stp path cost */
+};
+/* SIOCBRDGIFFLGS, SIOCBRDGIFFLGS */
+#define IFBIF_LEARNING 0x0001 /* ifs can learn */
+#define IFBIF_DISCOVER 0x0002 /* ifs sends packets w/unknown dest */
+#define IFBIF_BLOCKNONIP 0x0004 /* ifs blocks non-IP/ARP in/out */
+#define IFBIF_STP 0x0008 /* ifs participates in spanning tree */
+#define IFBIF_SPAN 0x0100 /* ifs is a span port (ro) */
+#define IFBIF_RO_MASK 0xff00 /* read only bits */
+/* SIOCBRDGFLUSH */
+#define IFBF_FLUSHDYN 0x0 /* flush dynamic addresses only */
+#define IFBF_FLUSHALL 0x1 /* flush all addresses from cache */
+
+/* port states */
+#define BSTP_IFSTATE_DISABLED 0
+#define BSTP_IFSTATE_LISTENING 1
+#define BSTP_IFSTATE_LEARNING 2
+#define BSTP_IFSTATE_FORWARDING 3
+#define BSTP_IFSTATE_BLOCKING 4
+
+/*
+ * Interface list structure
+ */
+struct ifbifconf {
+ char ifbic_name[IFNAMSIZ]; /* bridge ifs name */
+ u_int32_t ifbic_len; /* buffer size */
+ union {
+ caddr_t ifbicu_buf;
+ struct ifbreq *ifbicu_req;
+ } ifbic_ifbicu;
+#define ifbic_buf ifbic_ifbicu.ifbicu_buf
+#define ifbic_req ifbic_ifbicu.ifbicu_req
+};
+
+/*
+ * Bridge address request
+ */
+struct ifbareq {
+ char ifba_name[IFNAMSIZ]; /* bridge name */
+ char ifba_ifsname[IFNAMSIZ]; /* destination ifs */
+ u_int8_t ifba_age; /* address age */
+ u_int8_t ifba_flags; /* address flags */
+ struct ether_addr ifba_dst; /* destination addr */
+};
+
+#define IFBAF_TYPEMASK 0x03 /* address type mask */
+#define IFBAF_DYNAMIC 0x00 /* dynamically learned */
+#define IFBAF_STATIC 0x01 /* static address */
+
+struct ifbaconf {
+ char ifbac_name[IFNAMSIZ]; /* bridge ifs name */
+ u_int32_t ifbac_len; /* buffer size */
+ union {
+ caddr_t ifbacu_buf; /* buffer */
+ struct ifbareq *ifbacu_req; /* request pointer */
+ } ifbac_ifbacu;
+#define ifbac_buf ifbac_ifbacu.ifbacu_buf
+#define ifbac_req ifbac_ifbacu.ifbacu_req
+};
+
+struct ifbrparam {
+ char ifbrp_name[IFNAMSIZ];
+ union {
+ u_int32_t ifbrpu_csize; /* cache size */
+ int ifbrpu_ctime; /* cache time (sec) */
+ u_int16_t ifbrpu_prio; /* bridge priority */
+ u_int8_t ifbrpu_hellotime; /* hello time (sec) */
+ u_int8_t ifbrpu_fwddelay; /* fwd delay (sec) */
+ u_int8_t ifbrpu_maxage; /* max age (sec) */
+ } ifbrp_ifbrpu;
+};
+#define ifbrp_csize ifbrp_ifbrpu.ifbrpu_csize
+#define ifbrp_ctime ifbrp_ifbrpu.ifbrpu_ctime
+#define ifbrp_prio ifbrp_ifbrpu.ifbrpu_prio
+#define ifbrp_hellotime ifbrp_ifbrpu.ifbrpu_hellotime
+#define ifbrp_fwddelay ifbrp_ifbrpu.ifbrpu_fwddelay
+#define ifbrp_maxage ifbrp_ifbrpu.ifbrpu_maxage
+
+/*
+ * Bridge cache size get/set
+ */
+struct ifbcachereq {
+ char ifbc_name[IFNAMSIZ]; /* bridge ifs name */
+ u_int32_t ifbc_size; /* cache size */
+};
+
+/*
+ * Bridge cache timeout get/set
+ */
+struct ifbcachetoreq {
+ char ifbct_name[IFNAMSIZ]; /* bridge ifs name */
+ u_int32_t ifbct_time; /* cache time (sec) */
+};
+
+/*
+ * Bridge mac rules
+ */
+struct ifbrlreq {
+ char ifbr_name[IFNAMSIZ]; /* bridge ifs name */
+ char ifbr_ifsname[IFNAMSIZ]; /* member ifs name */
+ u_int8_t ifbr_action; /* disposition */
+ u_int8_t ifbr_flags; /* flags */
+ struct ether_addr ifbr_src; /* source mac */
+ struct ether_addr ifbr_dst; /* destination mac */
+};
+#define BRL_ACTION_BLOCK 0x01 /* block frame */
+#define BRL_ACTION_PASS 0x02 /* pass frame */
+#define BRL_FLAG_IN 0x08 /* input rule */
+#define BRL_FLAG_OUT 0x04 /* output rule */
+#define BRL_FLAG_SRCVALID 0x02 /* src valid */
+#define BRL_FLAG_DSTVALID 0x01 /* dst valid */
+
+struct ifbrlconf {
+ char ifbrl_name[IFNAMSIZ]; /* bridge ifs name */
+ char ifbrl_ifsname[IFNAMSIZ]; /* member ifs name */
+ u_int32_t ifbrl_len; /* buffer size */
+ union {
+ caddr_t ifbrlu_buf;
+ struct ifbrlreq *ifbrlu_req;
+ } ifbrl_ifbrlu;
+#define ifbrl_buf ifbrl_ifbrlu.ifbrlu_buf
+#define ifbrl_req ifbrl_ifbrlu.ifbrlu_req
+};
+
+/*
+ * Bridge filtering rules
+ */
+SIMPLEQ_HEAD(brl_head, brl_node);
+
+struct brl_node {
+ SIMPLEQ_ENTRY(brl_node) brl_next; /* next rule */
+ struct ether_addr brl_src; /* source mac address */
+ struct ether_addr brl_dst; /* destination mac address */
+ u_int16_t brl_tag; /* pf tag ID */
+ u_int8_t brl_action; /* what to do with match */
+ u_int8_t brl_flags; /* comparision flags */
+};
+
+struct bridge_timer {
+ u_int16_t active;
+ u_int16_t value;
+};
+
+struct bstp_config_unit {
+ u_int64_t cu_rootid;
+ u_int64_t cu_bridge_id;
+ u_int32_t cu_root_path_cost;
+ u_int16_t cu_message_age;
+ u_int16_t cu_max_age;
+ u_int16_t cu_hello_time;
+ u_int16_t cu_forward_delay;
+ u_int16_t cu_port_id;
+ u_int8_t cu_message_type;
+ u_int8_t cu_topology_change_acknowledgment;
+ u_int8_t cu_topology_change;
+};
+
+struct bstp_tcn_unit {
+ u_int8_t tu_message_type;
+};
+
+/*
+ * Bridge interface list
+ */
+struct bridge_iflist {
+ LIST_ENTRY(bridge_iflist) next; /* next in list */
+ u_int64_t bif_designated_root;
+ u_int64_t bif_designated_bridge;
+ u_int32_t bif_path_cost;
+ u_int32_t bif_designated_cost;
+ struct bridge_timer bif_hold_timer;
+ struct bridge_timer bif_message_age_timer;
+ struct bridge_timer bif_forward_delay_timer;
+ struct bstp_config_unit bif_config_bpdu;
+ u_int16_t bif_port_id;
+ u_int16_t bif_designated_port;
+ u_int8_t bif_state;
+ u_int8_t bif_topology_change_acknowledge;
+ u_int8_t bif_config_pending;
+ u_int8_t bif_change_detection_enabled;
+ u_int8_t bif_priority;
+ struct brl_head bif_brlin; /* input rules */
+ struct brl_head bif_brlout; /* output rules */
+ struct ifnet *ifp; /* member interface */
+ u_int32_t bif_flags; /* member flags */
+};
+
+/*
+ * Bridge route node
+ */
+struct bridge_rtnode {
+ LIST_ENTRY(bridge_rtnode) brt_next; /* next in list */
+ struct ifnet *brt_if; /* destination ifs */
+ u_int8_t brt_flags; /* address flags */
+ u_int8_t brt_age; /* age counter */
+ struct ether_addr brt_addr; /* dst addr */
+};
+
+/*
+ * Software state for each bridge
+ */
+struct bridge_softc {
+ struct ifnet sc_if; /* the interface */
+ u_int64_t sc_designated_root;
+ u_int64_t sc_bridge_id;
+ struct bridge_iflist *sc_root_port;
+ u_int32_t sc_root_path_cost;
+ u_int16_t sc_max_age;
+ u_int16_t sc_hello_time;
+ u_int16_t sc_forward_delay;
+ u_int16_t sc_bridge_max_age;
+ u_int16_t sc_bridge_hello_time;
+ u_int16_t sc_bridge_forward_delay;
+ u_int16_t sc_topology_change_time;
+ u_int16_t sc_hold_time;
+ u_int16_t sc_bridge_priority;
+ u_int8_t sc_topology_change_detected;
+ u_int8_t sc_topology_change;
+ struct bridge_timer sc_hello_timer;
+ struct bridge_timer sc_topology_change_timer;
+ struct bridge_timer sc_tcn_timer;
+ u_int32_t sc_brtmax; /* max # addresses */
+ u_int32_t sc_brtcnt; /* current # addrs */
+ int sc_brttimeout; /* timeout ticks */
+ u_int32_t sc_hashkey; /* hash key */
+#ifndef __ECOS
+ struct timeout sc_brtimeout; /* timeout state */
+ struct timeout sc_bstptimeout; /* stp timeout */
+#endif
+ LIST_HEAD(, bridge_iflist) sc_iflist; /* interface list */
+ LIST_HEAD(bridge_rthead, bridge_rtnode) *sc_rts;/* hash table */
+ LIST_HEAD(, bridge_iflist) sc_spanlist; /* span ports */
+};
+
+#ifdef _KERNEL
+extern u_int8_t bstp_etheraddr[];
+
+void bridge_ifdetach(struct ifnet *);
+struct mbuf *bridge_input(struct ifnet *, struct ether_header *,
+ struct mbuf *);
+int bridge_output(struct ifnet *, struct mbuf *, struct sockaddr *,
+ struct rtentry *);
+struct mbuf *bstp_input(struct bridge_softc *, struct ifnet *,
+ struct ether_header *, struct mbuf *);
+void bstp_initialization(struct bridge_softc *);
+int bstp_ioctl(struct ifnet *, u_long, caddr_t);
+void bridge_rtdelete(struct bridge_softc *, struct ifnet *, int);
+#endif /* _KERNEL */
diff --git a/ecos/packages/net/tcpip/current/include/net/if_dl.h b/ecos/packages/net/tcpip/current/include/net/if_dl.h
new file mode 100644
index 0000000..2dba2a0
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/net/if_dl.h
@@ -0,0 +1,117 @@
+//==========================================================================
+//
+// include/net/if_dl.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: if_dl.h,v 1.2 1997/02/24 13:33:58 niklas Exp $ */
+/* $NetBSD: if_dl.h,v 1.8 1995/03/26 20:30:13 jtc Exp $ */
+
+/*
+ * Copyright (c) 1990, 1993
+ * 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.
+ *
+ * @(#)if_dl.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NET_IF_DL_H_
+#define _NET_IF_DL_H_
+
+/*
+ * A Link-Level Sockaddr may specify the interface in one of two
+ * ways: either by means of a system-provided index number (computed
+ * anew and possibly differently on every reboot), or by a human-readable
+ * string such as "il0" (for managerial convenience).
+ *
+ * Census taking actions, such as something akin to SIOCGCONF would return
+ * both the index and the human name.
+ *
+ * High volume transactions (such as giving a link-level ``from'' address
+ * in a recvfrom or recvmsg call) may be likely only to provide the indexed
+ * form, (which requires fewer copy operations and less space).
+ *
+ * The form and interpretation of the link-level address is purely a matter
+ * of convention between the device driver and its consumers; however, it is
+ * expected that all drivers for an interface of a given if_type will agree.
+ */
+
+/*
+ * Structure of a Link-Level sockaddr:
+ */
+struct sockaddr_dl {
+ u_char sdl_len; /* Total length of sockaddr */
+ u_char sdl_family; /* AF_DLI */
+ u_int16_t sdl_index; /* if != 0, system given index for interface */
+ u_char sdl_type; /* interface type */
+ u_char sdl_nlen; /* interface name length, no trailing 0 reqd. */
+ u_char sdl_alen; /* link level address length */
+ u_char sdl_slen; /* link layer selector length */
+ char sdl_data[12]; /* minimum work area, can be larger;
+ contains both if name and ll address */
+};
+
+#define LLADDR(s) ((caddr_t)((s)->sdl_data + (s)->sdl_nlen))
+
+#ifndef _KERNEL
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+void link_addr __P((const char *, struct sockaddr_dl *));
+char *link_ntoa __P((const struct sockaddr_dl *));
+__END_DECLS
+
+#endif /* !_KERNEL */
+
+#endif // _NET_IF_DL_H_
diff --git a/ecos/packages/net/tcpip/current/include/net/if_gif.h b/ecos/packages/net/tcpip/current/include/net/if_gif.h
new file mode 100644
index 0000000..52c8d5d
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/net/if_gif.h
@@ -0,0 +1,115 @@
+//==========================================================================
+//
+// include/net/if_gif.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: if_gif.h,v 1.1 1999/12/08 06:50:18 itojun Exp $ */
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+
+/*
+ * if_gif.h
+ */
+
+#ifndef _NET_IF_GIF_H_
+#define _NET_IF_GIF_H_
+
+
+#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__NetBSD__)
+#if defined(_KERNEL) && !defined(_LKM)
+#include "opt_inet.h"
+#endif
+#endif
+
+#include <netinet/in.h>
+/* xxx sigh, why route have struct route instead of pointer? */
+
+struct gif_softc {
+ struct ifnet gif_if; /* common area */
+ struct sockaddr *gif_psrc; /* Physical src addr */
+ struct sockaddr *gif_pdst; /* Physical dst addr */
+ union {
+ struct route gifscr_ro; /* xxx */
+#ifdef INET6
+ struct route_in6 gifscr_ro6; /* xxx */
+#endif
+ } gifsc_gifscr;
+ int gif_flags;
+};
+
+#define gif_ro gifsc_gifscr.gifscr_ro
+#ifdef INET6
+#define gif_ro6 gifsc_gifscr.gifscr_ro6
+#endif
+
+#define GIFF_INUSE 0x1 /* gif is in use */
+
+#define GIF_MTU (1280) /* Default MTU */
+#define GIF_MTU_MIN (1280) /* Minimum MTU */
+#define GIF_MTU_MAX (8192) /* Maximum MTU */
+
+extern int ngif;
+extern struct gif_softc *gif;
+
+/* Prototypes */
+void gif_input __P((struct mbuf *, int, struct ifnet *));
+int gif_output __P((struct ifnet *, struct mbuf *,
+ struct sockaddr *, struct rtentry *));
+#if defined(__FreeBSD__) && __FreeBSD__ < 3
+int gif_ioctl __P((struct ifnet *, int, caddr_t));
+#else
+int gif_ioctl __P((struct ifnet *, u_long, caddr_t));
+#endif
+
+#endif /* _NET_IF_GIF_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/net/if_llc.h b/ecos/packages/net/tcpip/current/include/net/if_llc.h
new file mode 100644
index 0000000..a4e5adc
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/net/if_llc.h
@@ -0,0 +1,178 @@
+//==========================================================================
+//
+// include/net/if_llc.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: if_llc.h,v 1.3 1999/07/28 20:02:41 fgsch Exp $ */
+/* $NetBSD: if_llc.h,v 1.6 1995/03/08 02:56:57 cgd Exp $ */
+
+/*
+ * Copyright (c) 1988, 1993
+ * 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.
+ *
+ * @(#)if_llc.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NET_IF_LLC_H_
+#define _NET_IF_LLC_H_
+
+/*
+ * IEEE 802.2 Link Level Control headers, for use in conjunction with
+ * 802.{3,4,5} media access control methods.
+ *
+ * Headers here do not use bit fields due to shortcommings in many
+ * compilers.
+ */
+
+struct llc {
+ u_int8_t llc_dsap;
+ u_int8_t llc_ssap;
+ union {
+ struct {
+ u_int8_t control;
+ u_int8_t format_id;
+ u_int8_t class;
+ u_int8_t window_x2;
+ } type_u;
+ struct {
+ u_int8_t num_snd_x2;
+ u_int8_t num_rcv_x2;
+ } type_i;
+ struct {
+ u_int8_t control;
+ u_int8_t num_rcv_x2;
+ } type_s;
+ struct {
+ u_int8_t control;
+ struct frmrinfo {
+ u_int8_t rej_pdu_0;
+ u_int8_t rej_pdu_1;
+ u_int8_t frmr_control;
+ u_int8_t frmr_control_ext;
+ u_int8_t frmr_cause;
+ } frmrinfo;
+ } type_frmr;
+ struct {
+ u_int8_t control;
+ u_int8_t org_code[3];
+ u_int16_t ether_type;
+ } type_snap;
+ struct {
+ u_int8_t control;
+ u_int8_t control_ext;
+ } type_raw;
+ } llc_un;
+};
+#define llc_control llc_un.type_u.control
+#define llc_control_ext llc_un.type_raw.control_ext
+#define llc_fid llc_un.type_u.format_id
+#define llc_class llc_un.type_u.class
+#define llc_window llc_un.type_u.window_x2
+#define llc_frmrinfo llc_un.type_frmr.frmrinfo
+#define llc_frmr_pdu0 llc_un.type_frmr.frmrinfo.rej_pdu0
+#define llc_frmr_pdu1 llc_un.type_frmr.frmrinfo.rej_pdu1
+#define llc_frmr_control llc_un.type_frmr.frmrinfo.frmr_control
+#define llc_frmr_control_ext llc_un.type_frmr.frmrinfo.frmr_control_ext
+#define llc_frmr_cause llc_un.type_frmr.frmrinfo.frmr_control_ext
+
+/*
+ * Don't use sizeof(struct llc_un) for LLC header sizes
+ */
+#define LLC_UFRAMELEN 3
+#define LLC_ISFRAMELEN 4
+#define LLC_FRMRLEN 7
+#define LLC_SNAPFRAMELEN 8
+
+/*
+ * Unnumbered LLC format commands
+ */
+#define LLC_UI 0x3
+#define LLC_UI_P 0x13
+#define LLC_DISC 0x43
+#define LLC_DISC_P 0x53
+#define LLC_UA 0x63
+#define LLC_UA_P 0x73
+#define LLC_TEST 0xe3
+#define LLC_TEST_P 0xf3
+#define LLC_FRMR 0x87
+#define LLC_FRMR_P 0x97
+#define LLC_DM 0x0f
+#define LLC_DM_P 0x1f
+#define LLC_XID 0xaf
+#define LLC_XID_P 0xbf
+#define LLC_SABME 0x6f
+#define LLC_SABME_P 0x7f
+
+/*
+ * Supervisory LLC commands
+ */
+#define LLC_RR 0x01
+#define LLC_RNR 0x05
+#define LLC_REJ 0x09
+
+/*
+ * Info format - dummy only
+ */
+#define LLC_INFO 0x00
+
+/*
+ * ISO PDTR 10178 contains among others
+ */
+#define LLC_8021D_LSAP 0x42
+#define LLC_X25_LSAP 0x7e
+#define LLC_SNAP_LSAP 0xaa
+#define LLC_ISO_LSAP 0xfe
+
+#endif // _NET_IF_LLC_H_
diff --git a/ecos/packages/net/tcpip/current/include/net/if_slvar.h b/ecos/packages/net/tcpip/current/include/net/if_slvar.h
new file mode 100644
index 0000000..55e87f8
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/net/if_slvar.h
@@ -0,0 +1,88 @@
+/* $OpenBSD: if_slvar.h,v 1.4 1997/02/24 13:34:01 niklas Exp $ */
+/* $NetBSD: if_slvar.h,v 1.16 1996/05/07 02:40:46 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 1991, 1993
+ * 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.
+ *
+ * @(#)if_slvar.h 8.3 (Berkeley) 2/1/94
+ */
+
+/*
+ * Definitions for SLIP interface data structures
+ *
+ * (This exists so programs like slstats can get at the definition
+ * of sl_softc.)
+ */
+struct sl_softc {
+ struct ifnet sc_if; /* network-visible interface */
+ int sc_unit; /* XXX unit number */
+ struct ifqueue sc_fastq; /* interactive output queue */
+ struct tty *sc_ttyp; /* pointer to tty structure */
+ u_char *sc_mp; /* pointer to next available buf char */
+ u_char *sc_ep; /* pointer to last available buf char */
+ u_char *sc_buf; /* input buffer */
+ u_int sc_flags; /* see below */
+ u_int sc_escape; /* =1 if last char input was FRAME_ESCAPE */
+ long sc_lasttime; /* last time a char arrived */
+ long sc_abortcount; /* number of abort esacpe chars */
+ long sc_starttime; /* time of first abort in window */
+ long sc_oqlen; /* previous output queue size */
+ long sc_otimeout; /* number of times output's stalled */
+#if defined(__NetBSD__) || defined(__OpenBSD__)
+ int sc_oldbufsize; /* previous output buffer size */
+ int sc_oldbufquot; /* previous output buffer quoting */
+#endif
+#ifdef INET /* XXX */
+ struct slcompress sc_comp; /* tcp compression data */
+#endif
+ caddr_t sc_bpf; /* BPF data */
+};
+
+/* internal flags */
+#define SC_ERROR 0x0001 /* had an input error */
+
+/* visible flags */
+#define SC_COMPRESS IFF_LINK0 /* compress TCP traffic */
+#define SC_NOICMP IFF_LINK1 /* supress ICMP traffic */
+#define SC_AUTOCOMP IFF_LINK2 /* auto-enable TCP compression */
+
+#ifdef _KERNEL
+void slattach __P((void));
+void slclose __P((struct tty *));
+void slinput __P((int, struct tty *));
+int slioctl __P((struct ifnet *, u_long, caddr_t));
+int slopen __P((dev_t, struct tty *));
+int sloutput __P((struct ifnet *,
+ struct mbuf *, struct sockaddr *, struct rtentry *));
+void slstart __P((struct tty *));
+int sltioctl __P((struct tty *, u_long, caddr_t, int));
+#endif /* _KERNEL */
diff --git a/ecos/packages/net/tcpip/current/include/net/if_tun.h b/ecos/packages/net/tcpip/current/include/net/if_tun.h
new file mode 100644
index 0000000..b1e754a
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/net/if_tun.h
@@ -0,0 +1,86 @@
+//==========================================================================
+//
+// include/net/if_tun.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: if_tun.h,v 1.8 1998/08/02 07:17:44 brian Exp $ */
+
+/*
+ * Copyright (c) 1988, Julian Onions <jpo@cs.nott.ac.uk>
+ * Nottingham University 1987.
+ *
+ * This source may be freely distributed, however I would be interested
+ * in any changes that are made.
+ *
+ * This driver takes packets off the IP i/f and hands them up to a
+ * user process to have it's wicked way with. This driver has it's
+ * roots in a similar driver written by Phil Cockcroft (formerly) at
+ * UCL. This driver is based much more on read/write/select mode of
+ * operation though.
+ *
+ * from: @Header: if_tnreg.h,v 1.1.2.1 1992/07/16 22:39:16 friedl Exp
+ */
+
+#ifndef _NET_IF_TUN_H_
+#define _NET_IF_TUN_H_
+
+#include <sys/ioccom.h>
+
+#define TUN_OPEN 0x0001
+#define TUN_INITED 0x0002
+#define TUN_RCOLL 0x0004
+#define TUN_IASET 0x0008
+#define TUN_DSTADDR 0x0010
+#define TUN_RWAIT 0x0040
+#define TUN_ASYNC 0x0080
+#define TUN_NBIO 0x0100
+#define TUN_BRDADDR 0x0200
+#define TUN_STAYUP 0x0400
+
+#define TUN_READY (TUN_OPEN | TUN_INITED | TUN_IASET)
+
+/* Maximum packet size */
+#define TUNMTU 3000
+
+/* Maximum receive packet size (hard limit) */
+#define TUNMRU 16384
+
+/* ioctl's for get/set debug */
+#define TUNSDEBUG _IOW('t', 89, int)
+#define TUNGDEBUG _IOR('t', 90, int)
+
+/* iface info */
+struct tuninfo {
+ u_int mtu;
+ u_short type;
+ u_short flags;
+ u_int baudrate;
+};
+#define TUNSIFINFO _IOW('t', 91, struct tuninfo)
+#define TUNGIFINFO _IOR('t', 92, struct tuninfo)
+
+#endif /* !_NET_IF_TUN_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/net/if_types.h b/ecos/packages/net/tcpip/current/include/net/if_types.h
new file mode 100644
index 0000000..60e10aa
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/net/if_types.h
@@ -0,0 +1,139 @@
+//==========================================================================
+//
+// include/net/if_types.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: if_types.h,v 1.4 1999/12/08 06:50:18 itojun Exp $ */
+/* $NetBSD: if_types.h,v 1.7 1995/02/27 09:10:24 glass Exp $ */
+
+/*
+ * Copyright (c) 1989, 1993, 1994
+ * 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.
+ *
+ * @(#)if_types.h 8.2 (Berkeley) 4/20/94
+ */
+
+#ifndef _NET_IF_TYPES_H_
+#define _NET_IF_TYPES_H_
+
+/*
+ * Interface types for benefit of parsing media address headers.
+ * This list is derived from the SNMP list of ifTypes, currently
+ * documented in RFC1573.
+ */
+
+#define IFT_OTHER 0x1 /* none of the following */
+#define IFT_1822 0x2 /* old-style arpanet imp */
+#define IFT_HDH1822 0x3 /* HDH arpanet imp */
+#define IFT_X25DDN 0x4 /* x25 to imp */
+#define IFT_X25 0x5 /* PDN X25 interface (RFC877) */
+#define IFT_ETHER 0x6 /* Ethernet CSMACD */
+#define IFT_ISO88023 0x7 /* CMSA CD */
+#define IFT_ISO88024 0x8 /* Token Bus */
+#define IFT_ISO88025 0x9 /* Token Ring */
+#define IFT_ISO88026 0xa /* MAN */
+#define IFT_STARLAN 0xb
+#define IFT_P10 0xc /* Proteon 10MBit ring */
+#define IFT_P80 0xd /* Proteon 80MBit ring */
+#define IFT_HY 0xe /* Hyperchannel */
+#define IFT_FDDI 0xf
+#define IFT_LAPB 0x10
+#define IFT_SDLC 0x11
+#define IFT_T1 0x12
+#define IFT_CEPT 0x13 /* E1 - european T1 */
+#define IFT_ISDNBASIC 0x14
+#define IFT_ISDNPRIMARY 0x15
+#define IFT_PTPSERIAL 0x16 /* Proprietary PTP serial */
+#define IFT_PPP 0x17 /* RFC 1331 */
+#define IFT_LOOP 0x18 /* loopback */
+#define IFT_EON 0x19 /* ISO over IP */
+#define IFT_XETHER 0x1a /* obsolete 3MB experimental ethernet */
+#define IFT_NSIP 0x1b /* XNS over IP */
+#define IFT_SLIP 0x1c /* IP over generic TTY */
+#define IFT_ULTRA 0x1d /* Ultra Technologies */
+#define IFT_DS3 0x1e /* Generic T3 */
+#define IFT_SIP 0x1f /* SMDS */
+#define IFT_FRELAY 0x20 /* Frame Relay DTE only */
+#define IFT_RS232 0x21
+#define IFT_PARA 0x22 /* parallel-port */
+#define IFT_ARCNET 0x23
+#define IFT_ARCNETPLUS 0x24
+#define IFT_ATM 0x25 /* ATM cells */
+#define IFT_MIOX25 0x26
+#define IFT_SONET 0x27 /* SONET or SDH */
+#define IFT_X25PLE 0x28
+#define IFT_ISO88022LLC 0x29
+#define IFT_LOCALTALK 0x2a
+#define IFT_SMDSDXI 0x2b
+#define IFT_FRELAYDCE 0x2c /* Frame Relay DCE */
+#define IFT_V35 0x2d
+#define IFT_HSSI 0x2e
+#define IFT_HIPPI 0x2f
+#define IFT_MODEM 0x30 /* Generic Modem */
+#define IFT_AAL5 0x31 /* AAL5 over ATM */
+#define IFT_SONETPATH 0x32
+#define IFT_SONETVT 0x33
+#define IFT_SMDSICIP 0x34 /* SMDS InterCarrier Interface */
+#define IFT_PROPVIRTUAL 0x35 /* Proprietary Virtual/internal */
+#define IFT_PROPMUX 0x36 /* Proprietary Multiplexing */
+#define IFT_ENC 0x37 /* Encapsulation */
+
+/* private usage... how should we define these? */
+#define IFT_GIF 0xf0
+#define IFT_DUMMY 0xf1
+#define IFT_PVC 0xf2
+#define IFT_FAITH 0xf3
+
+#endif // _NET_IF_TYPES_H_
diff --git a/ecos/packages/net/tcpip/current/include/net/netisr.h b/ecos/packages/net/tcpip/current/include/net/netisr.h
new file mode 100644
index 0000000..6c37e33
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/net/netisr.h
@@ -0,0 +1,137 @@
+//==========================================================================
+//
+// include/net/netisr.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: netisr.h,v 1.14 1999/12/08 15:58:30 itojun Exp $ */
+/* $NetBSD: netisr.h,v 1.12 1995/08/12 23:59:24 mycroft Exp $ */
+
+/*
+ * Copyright (c) 1980, 1986, 1989, 1993
+ * 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.
+ *
+ * @(#)netisr.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NET_NETISR_H_
+#define _NET_NETISR_H_
+
+/*
+ * The networking code runs off software interrupts.
+ *
+ * You can switch into the network by doing splsoftnet() and return by splx().
+ * The software interrupt level for the network is higher than the software
+ * level for the clock (so you can enter the network in routines called
+ * at timeout time).
+ *
+ * The routine to request a network software interrupt, setsoftnet(),
+ * is defined in the machine-specific include files.
+ */
+
+/*
+ * Each ``pup-level-1'' input queue has a bit in a ``netisr'' status
+ * word which is used to de-multiplex a single software
+ * interrupt used for scheduling the network code to calls
+ * on the lowest level routine of each protocol.
+ */
+#ifdef __ECOS
+#define NETISR_SOFTNET 1 // Just used to force an interrupt
+#endif
+#define NETISR_IP 2 /* same as AF_INET */
+#define NETISR_IMP 3 /* same as AF_IMPLINK */
+#define NETISR_NS 6 /* same as AF_NS */
+#define NETISR_ISO 7 /* same as AF_ISO */
+#define NETISR_CCITT 10 /* same as AF_CCITT */
+#define NETISR_ATALK 16 /* same as AF_APPLETALK */
+#define NETISR_ARP 18 /* same as AF_LINK */
+#define NETISR_IPX 23 /* same as AF_IPX */
+#define NETISR_IPV6 24 /* same as AF_INET6 */
+#define NETISR_ISDN 26 /* same as AF_E164 */
+#define NETISR_NATM 27 /* same as AF_ATM */
+#define NETISR_PPP 28 /* for PPP processing */
+#define NETISR_BRIDGE 29 /* for bridge processing */
+
+#ifndef _LOCORE
+#ifdef _KERNEL
+#ifdef __ECOS
+#include <cyg/kernel/kapi.h>
+extern cyg_flag_t netint_flags;
+#else
+int netisr; /* scheduling bits for network */
+#endif
+
+void arpintr __P((void));
+void ipintr __P((void));
+void ip6intr __P((void));
+void atintr __P((void));
+void nsintr __P((void));
+void clnlintr __P((void));
+void natmintr __P((void));
+void pppintr __P((void));
+void ccittintr __P((void));
+void bridgeintr __P((void));
+
+#ifdef __ECOS
+#define schednetisr(anisr) cyg_flag_setbits(&netint_flags, 1<<(anisr));
+#else
+#include <dev/rndvar.h>
+
+#define schednetisr(anisr) \
+ { netisr |= 1<<(anisr); add_net_randomness(anisr); setsoftnet(); }
+#endif
+#endif
+#endif
+
+#endif // _NET_NETISR_H_
diff --git a/ecos/packages/net/tcpip/current/include/net/radix.h b/ecos/packages/net/tcpip/current/include/net/radix.h
new file mode 100644
index 0000000..a176186
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/net/radix.h
@@ -0,0 +1,199 @@
+//==========================================================================
+//
+// include/net/radix.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: radix.h,v 1.3 1996/09/05 08:42:34 mickey Exp $ */
+/* $NetBSD: radix.h,v 1.8 1996/02/13 22:00:37 christos Exp $ */
+
+/*
+ * Copyright (c) 1988, 1989, 1993
+ * 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.
+ *
+ * @(#)radix.h 8.2 (Berkeley) 10/31/94
+ */
+
+#ifndef _NET_RADIX_H_
+#define _NET_RADIX_H_
+
+/*
+ * Radix search tree node layout.
+ */
+
+struct radix_node {
+ struct radix_mask *rn_mklist; /* list of masks contained in subtree */
+ struct radix_node *rn_p; /* parent */
+ short rn_b; /* bit offset; -1-index(netmask) */
+ char rn_bmask; /* node: mask for bit test*/
+ u_char rn_flags; /* enumerated next */
+#define RNF_NORMAL 1 /* leaf contains normal route */
+#define RNF_ROOT 2 /* leaf is root leaf for tree */
+#define RNF_ACTIVE 4 /* This node is alive (for rtfree) */
+ union {
+ struct { /* leaf only data: */
+ caddr_t rn_Key; /* object of search */
+ caddr_t rn_Mask; /* netmask, if present */
+ struct radix_node *rn_Dupedkey;
+ } rn_leaf;
+ struct { /* node only data: */
+ int rn_Off; /* where to start compare */
+ struct radix_node *rn_L;/* progeny */
+ struct radix_node *rn_R;/* progeny */
+ } rn_node;
+ } rn_u;
+#ifdef RN_DEBUG
+ int rn_info;
+ struct radix_node *rn_twin;
+ struct radix_node *rn_ybro;
+#endif
+};
+
+#define rn_dupedkey rn_u.rn_leaf.rn_Dupedkey
+#define rn_key rn_u.rn_leaf.rn_Key
+#define rn_mask rn_u.rn_leaf.rn_Mask
+#define rn_off rn_u.rn_node.rn_Off
+#define rn_l rn_u.rn_node.rn_L
+#define rn_r rn_u.rn_node.rn_R
+
+/*
+ * Annotations to tree concerning potential routes applying to subtrees.
+ */
+
+extern struct radix_mask {
+ short rm_b; /* bit offset; -1-index(netmask) */
+ char rm_unused; /* cf. rn_bmask */
+ u_char rm_flags; /* cf. rn_flags */
+ struct radix_mask *rm_mklist; /* more masks to try */
+ union {
+ caddr_t rmu_mask; /* the mask */
+ struct radix_node *rmu_leaf; /* for normal routes */
+ } rm_rmu;
+ int rm_refs; /* # of references to this struct */
+} *rn_mkfreelist;
+
+#define rm_mask rm_rmu.rmu_mask
+#define rm_leaf rm_rmu.rmu_leaf /* extra field would make 32 bytes */
+
+#define MKGet(m) {\
+ if (rn_mkfreelist) {\
+ m = rn_mkfreelist; \
+ rn_mkfreelist = (m)->rm_mklist; \
+ } else \
+ R_Malloc(m, struct radix_mask *, sizeof (*(m))); }\
+
+#define MKFree(m) { (m)->rm_mklist = rn_mkfreelist; rn_mkfreelist = (m);}
+
+struct radix_node_head {
+ struct radix_node *rnh_treetop;
+ int rnh_addrsize; /* permit, but not require fixed keys */
+ int rnh_pktsize; /* permit, but not require fixed keys */
+ struct radix_node *(*rnh_addaddr) /* add based on sockaddr */
+ __P((void *v, void *mask,
+ struct radix_node_head *head, struct radix_node nodes[]));
+ struct radix_node *(*rnh_addpkt) /* add based on packet hdr */
+ __P((void *v, void *mask,
+ struct radix_node_head *head, struct radix_node nodes[]));
+ struct radix_node *(*rnh_deladdr) /* remove based on sockaddr */
+ __P((void *v, void *mask, struct radix_node_head *head));
+ struct radix_node *(*rnh_delpkt) /* remove based on packet hdr */
+ __P((void *v, void *mask, struct radix_node_head *head));
+ struct radix_node *(*rnh_matchaddr) /* locate based on sockaddr */
+ __P((void *v, struct radix_node_head *head));
+ struct radix_node *(*rnh_lookup) /* locate based on sockaddr */
+ __P((void *v, void *mask, struct radix_node_head *head));
+ struct radix_node *(*rnh_matchpkt) /* locate based on packet hdr */
+ __P((void *v, struct radix_node_head *head));
+ int (*rnh_walktree) /* traverse tree */
+ __P((struct radix_node_head *,
+ int (*)(struct radix_node *, void *), void *));
+ struct radix_node rnh_nodes[3]; /* empty tree for common case */
+};
+
+
+#ifndef _KERNEL
+#define Bcmp(a, b, n) bcmp(((char *)(a)), ((char *)(b)), (n))
+#define Bcopy(a, b, n) bcopy(((char *)(a)), ((char *)(b)), (unsigned)(n))
+#define Bzero(p, n) bzero((char *)(p), (int)(n));
+#define R_Malloc(p, t, n) (p = (t) malloc((unsigned int)(n)))
+#define Free(p) free((char *)p);
+#else
+#define Bcmp(a, b, n) bcmp(((caddr_t)(a)), ((caddr_t)(b)), (unsigned)(n))
+#define Bcopy(a, b, n) bcopy(((caddr_t)(a)), ((caddr_t)(b)), (unsigned)(n))
+#define Bzero(p, n) bzero((caddr_t)(p), (unsigned)(n));
+#define R_Malloc(p, t, n) (p = (t) malloc((unsigned long)(n), M_RTABLE, M_DONTWAIT))
+#define Free(p) free((caddr_t)p, M_RTABLE);
+#endif /* !_KERNEL */
+
+#if defined(_KERNEL) || defined(_ROUTED)
+void rn_init __P((void));
+int rn_inithead __P((void **, int));
+int rn_refines __P((void *, void *));
+int rn_walktree __P((struct radix_node_head *,
+ int (*)(struct radix_node *, void *), void *));
+struct radix_node
+ *rn_addmask __P((void *, int, int)),
+ *rn_addroute __P((void *, void *, struct radix_node_head *,
+ struct radix_node [2])),
+ *rn_delete __P((void *, void *, struct radix_node_head *)),
+ *rn_insert __P((void *, struct radix_node_head *, int *,
+ struct radix_node [2])),
+ *rn_lookup __P((void *, void *, struct radix_node_head *)),
+ *rn_match __P((void *, struct radix_node_head *)),
+ *rn_newpair __P((void *, int, struct radix_node[2])),
+ *rn_search __P((void *, struct radix_node *)),
+ *rn_search_m __P((void *, struct radix_node *, void *));
+#endif /* define(_KERNEL) || defined(_ROUTED) */
+
+#endif /* !_NET_RADIX_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/net/raw_cb.h b/ecos/packages/net/tcpip/current/include/net/raw_cb.h
new file mode 100644
index 0000000..68c0a25
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/net/raw_cb.h
@@ -0,0 +1,105 @@
+//==========================================================================
+//
+// include/net/raw_cb.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: raw_cb.h,v 1.2 1996/03/03 21:07:17 niklas Exp $ */
+/* $NetBSD: raw_cb.h,v 1.9 1996/02/13 22:00:41 christos Exp $ */
+
+/*
+ * Copyright (c) 1980, 1986, 1993
+ * 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.
+ *
+ * @(#)raw_cb.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NET_RAW_CB_H_
+#define _NET_RAW_CB_H_
+
+/*
+ * Raw protocol interface control block. Used
+ * to tie a socket to the generic raw interface.
+ */
+struct rawcb {
+ LIST_ENTRY(rawcb) rcb_list; /* doubly linked list */
+ struct socket *rcb_socket; /* back pointer to socket */
+ struct sockaddr *rcb_faddr; /* destination address */
+ struct sockaddr *rcb_laddr; /* socket's address */
+ struct sockproto rcb_proto; /* protocol family, protocol */
+};
+
+#define sotorawcb(so) ((struct rawcb *)(so)->so_pcb)
+
+/*
+ * Nominal space allocated to a raw socket.
+ */
+#define RAWSNDQ 8192
+#define RAWRCVQ 8192
+
+#ifdef _KERNEL
+LIST_HEAD(, rawcb) rawcb; /* head of list */
+
+int raw_attach __P((struct socket *, int));
+void *raw_ctlinput __P((int, struct sockaddr *, void *));
+void raw_detach __P((struct rawcb *));
+void raw_disconnect __P((struct rawcb *));
+void raw_init __P((void));
+void raw_input __P((struct mbuf *, ...));
+int raw_usrreq __P((struct socket *,
+ int, struct mbuf *, struct mbuf *, struct mbuf *));
+
+#endif /* _KERNEL */
+
+#endif // _NET_RAW_CB_H_
diff --git a/ecos/packages/net/tcpip/current/include/net/route.h b/ecos/packages/net/tcpip/current/include/net/route.h
new file mode 100644
index 0000000..622beb2
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/net/route.h
@@ -0,0 +1,383 @@
+//==========================================================================
+//
+// include/net/route.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: route.h,v 1.7 1999/12/08 06:50:18 itojun Exp $ */
+/* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */
+
+/*
+ * Copyright (c) 1980, 1986, 1993
+ * 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.
+ *
+ * @(#)route.h 8.3 (Berkeley) 4/19/94
+ */
+
+#ifndef _NET_ROUTE_H_
+#define _NET_ROUTE_H_
+
+#include <sys/queue.h>
+
+/*
+ * Kernel resident routing tables.
+ *
+ * The routing tables are initialized when interface addresses
+ * are set by making entries for all directly connected interfaces.
+ */
+
+/*
+ * A route consists of a destination address and a reference
+ * to a routing entry. These are often held by protocols
+ * in their control blocks, e.g. inpcb.
+ */
+struct route {
+ struct rtentry *ro_rt;
+ struct sockaddr ro_dst;
+};
+
+/*
+ * These numbers are used by reliable protocols for determining
+ * retransmission behavior and are included in the routing structure.
+ */
+struct rt_metrics {
+ u_long rmx_locks; /* Kernel must leave these values alone */
+ u_long rmx_mtu; /* MTU for this path */
+ u_long rmx_hopcount; /* max hops expected */
+ u_long rmx_expire; /* lifetime for route, e.g. redirect */
+ u_long rmx_recvpipe; /* inbound delay-bandwith product */
+ u_long rmx_sendpipe; /* outbound delay-bandwith product */
+ u_long rmx_ssthresh; /* outbound gateway buffer limit */
+ u_long rmx_rtt; /* estimated round trip time */
+ u_long rmx_rttvar; /* estimated rtt variance */
+ u_long rmx_pksent; /* packets sent using this route */
+};
+
+/*
+ * rmx_rtt and rmx_rttvar are stored as microseconds;
+ * RTTTOPRHZ(rtt) converts to a value suitable for use
+ * by a protocol slowtimo counter.
+ */
+#define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */
+#define RTTTOPRHZ(r) ((r) / (RTM_RTTUNIT / PR_SLOWHZ))
+
+/*
+ * We distinguish between routes to hosts and routes to networks,
+ * preferring the former if available. For each route we infer
+ * the interface to use from the gateway address supplied when
+ * the route was entered. Routes that forward packets through
+ * gateways are marked so that the output routines know to address the
+ * gateway rather than the ultimate destination.
+ */
+#ifndef RNF_NORMAL
+#include <net/radix.h>
+#endif
+struct rtentry {
+ struct radix_node rt_nodes[2]; /* tree glue, and other values */
+#define rt_key(r) ((struct sockaddr *)((r)->rt_nodes->rn_key))
+#define rt_mask(r) ((struct sockaddr *)((r)->rt_nodes->rn_mask))
+ struct sockaddr *rt_gateway; /* value */
+ u_int rt_flags; /* up/down?, host/net */
+ short rt_refcnt; /* # held references */
+ short rt_filler; /* XXX */
+ u_long rt_use; /* raw # packets forwarded */
+ struct ifnet *rt_ifp; /* the answer: interface to use */
+ struct ifaddr *rt_ifa; /* the answer: interface to use */
+ struct sockaddr *rt_genmask; /* for generation of cloned routes */
+ caddr_t rt_llinfo; /* pointer to link level info cache */
+ struct rt_metrics rt_rmx; /* metrics used by rx'ing protocols */
+ struct rtentry *rt_gwroute; /* implied entry for gatewayed routes */
+ struct rtentry *rt_parent; /* If cloned, parent of this route. */
+ LIST_HEAD(, rttimer) rt_timer; /* queue of timeouts for misc funcs */
+};
+#define rt_use rt_rmx.rmx_pksent
+
+#ifdef __ECOS
+/*
+ * This structure modelled after the Linux 'route' functions
+ * Used by the SIOCADDRT and SIOCDELRT calls
+ */
+struct ecos_rtentry
+ {
+ struct sockaddr rt_dst; /* Target address. */
+ struct sockaddr rt_gateway; /* Gateway addr (RTF_GATEWAY). */
+ struct sockaddr rt_genmask; /* Target network mask (IP). */
+ unsigned short int rt_flags;
+ unsigned char rt_tos;
+ unsigned char rt_class;
+ short int rt_metric; /* +1 for binary compatibility! */
+ char *rt_dev; /* Forcing the device at add. */
+ unsigned long int rt_mtu; /* Per route MTU/Window. */
+ unsigned long int rt_window; /* Window clamping. */
+ unsigned short int rt_irtt; /* Initial RTT. */
+ };
+/* Compatibility hack. */
+#define rt_mss rt_mtu
+#endif
+
+/*
+ * Following structure necessary for 4.3 compatibility;
+ * We should eventually move it to a compat file.
+ */
+struct ortentry {
+ u_int32_t rt_hash; /* to speed lookups */
+ struct sockaddr rt_dst; /* key */
+ struct sockaddr rt_gateway; /* value */
+ int16_t rt_flags; /* up/down?, host/net */
+ int16_t rt_refcnt; /* # held references */
+ u_int32_t rt_ouse; /* raw # packets forwarded (was: rt_use) */
+ struct ifnet *rt_ifp; /* the answer: interface to use */
+};
+
+#define RTF_UP 0x1 /* route usable */
+#define RTF_GATEWAY 0x2 /* destination is a gateway */
+#define RTF_HOST 0x4 /* host entry (net otherwise) */
+#define RTF_REJECT 0x8 /* host or net unreachable */
+#define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */
+#define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */
+#define RTF_DONE 0x40 /* message confirmed */
+#define RTF_MASK 0x80 /* subnet mask present */
+#define RTF_CLONING 0x100 /* generate new routes on use */
+#define RTF_XRESOLVE 0x200 /* external daemon resolves name */
+#define RTF_LLINFO 0x400 /* generated by ARP or ESIS */
+#define RTF_STATIC 0x800 /* manually added */
+#define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */
+#define RTF_PROTO3 0x2000 /* protocol specific routing flag */
+#define RTF_PROTO2 0x4000 /* protocol specific routing flag */
+#define RTF_PROTO1 0x8000 /* protocol specific routing flag */
+
+/*
+ * New IPv6 routing flags.
+ *
+ * PROTO1 and PROTO2 are used, and defined in netinet6/ipv6_var.h.
+ */
+#define RTF_TUNNEL 0x100000 /* Tunnelling bit. */
+
+/*
+ * Routing statistics.
+ */
+struct rtstat {
+ u_int32_t rts_badredirect; /* bogus redirect calls */
+ u_int32_t rts_dynamic; /* routes created by redirects */
+ u_int32_t rts_newgateway; /* routes modified by redirects */
+ u_int32_t rts_unreach; /* lookups which failed */
+ u_int32_t rts_wildcard; /* lookups satisfied by a wildcard */
+};
+
+/*
+ * Structures for routing messages.
+ */
+struct rt_msghdr {
+ u_short rtm_msglen; /* to skip over non-understood messages */
+ u_char rtm_version; /* future binary compatibility */
+ u_char rtm_type; /* message type */
+ u_short rtm_index; /* index for associated ifp */
+ int rtm_flags; /* flags, incl. kern & message, e.g. DONE */
+ int rtm_addrs; /* bitmask identifying sockaddrs in msg */
+ pid_t rtm_pid; /* identify sender */
+ int rtm_seq; /* for sender to identify action */
+ int rtm_errno; /* why failed */
+ int rtm_use; /* from rtentry */
+ u_long rtm_inits; /* which metrics we are initializing */
+ struct rt_metrics rtm_rmx; /* metrics themselves */
+};
+
+#define RTM_VERSION 3 /* Up the ante and ignore older versions */
+
+#define RTM_ADD 0x1 /* Add Route */
+#define RTM_DELETE 0x2 /* Delete Route */
+#define RTM_CHANGE 0x3 /* Change Metrics or flags */
+#define RTM_GET 0x4 /* Report Metrics */
+#define RTM_LOSING 0x5 /* Kernel Suspects Partitioning */
+#define RTM_REDIRECT 0x6 /* Told to use different route */
+#define RTM_MISS 0x7 /* Lookup failed on this address */
+#define RTM_LOCK 0x8 /* fix specified metrics */
+#define RTM_OLDADD 0x9 /* caused by SIOCADDRT */
+#define RTM_OLDDEL 0xa /* caused by SIOCDELRT */
+#define RTM_RESOLVE 0xb /* req to resolve dst to LL addr */
+#define RTM_NEWADDR 0xc /* address being added to iface */
+#define RTM_DELADDR 0xd /* address being removed from iface */
+#define RTM_IFINFO 0xe /* iface going up/down etc. */
+
+#define RTV_MTU 0x1 /* init or lock _mtu */
+#define RTV_HOPCOUNT 0x2 /* init or lock _hopcount */
+#define RTV_EXPIRE 0x4 /* init or lock _hopcount */
+#define RTV_RPIPE 0x8 /* init or lock _recvpipe */
+#define RTV_SPIPE 0x10 /* init or lock _sendpipe */
+#define RTV_SSTHRESH 0x20 /* init or lock _ssthresh */
+#define RTV_RTT 0x40 /* init or lock _rtt */
+#define RTV_RTTVAR 0x80 /* init or lock _rttvar */
+
+/*
+ * Bitmask values for rtm_addr.
+ */
+#define RTA_DST 0x1 /* destination sockaddr present */
+#define RTA_GATEWAY 0x2 /* gateway sockaddr present */
+#define RTA_NETMASK 0x4 /* netmask sockaddr present */
+#define RTA_GENMASK 0x8 /* cloning mask sockaddr present */
+#define RTA_IFP 0x10 /* interface name sockaddr present */
+#define RTA_IFA 0x20 /* interface addr sockaddr present */
+#define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */
+#define RTA_BRD 0x80 /* for NEWADDR, broadcast or p-p dest addr */
+
+/*
+ * Index offsets for sockaddr array for alternate internal encoding.
+ */
+#define RTAX_DST 0 /* destination sockaddr present */
+#define RTAX_GATEWAY 1 /* gateway sockaddr present */
+#define RTAX_NETMASK 2 /* netmask sockaddr present */
+#define RTAX_GENMASK 3 /* cloning mask sockaddr present */
+#define RTAX_IFP 4 /* interface name sockaddr present */
+#define RTAX_IFA 5 /* interface addr sockaddr present */
+#define RTAX_AUTHOR 6 /* sockaddr for author of redirect */
+#define RTAX_BRD 7 /* for NEWADDR, broadcast or p-p dest addr */
+#define RTAX_MAX 8 /* size of array to allocate */
+
+struct rt_addrinfo {
+ int rti_addrs;
+ struct sockaddr *rti_info[RTAX_MAX];
+};
+
+struct route_cb {
+ int ip_count;
+ int ip6_count;
+ int ns_count;
+ int iso_count;
+ int any_count;
+};
+
+/*
+ * This structure, and the prototypes for the rt_timer_{init,remove_all,
+ * add,timer} functions all used with the kind permission of BSDI.
+ * These allow functions to be called for routes at specific times.
+ */
+
+struct rttimer {
+ TAILQ_ENTRY(rttimer) rtt_next; /* entry on timer queue */
+ LIST_ENTRY(rttimer) rtt_link; /* multiple timers per rtentry */
+ struct rttimer_queue *rtt_queue;/* back pointer to queue */
+ struct rtentry *rtt_rt; /* Back pointer to the route */
+ void (*rtt_func) __P((struct rtentry *,
+ struct rttimer *));
+ time_t rtt_time; /* When this timer was registered */
+};
+
+struct rttimer_queue {
+ long rtq_timeout;
+ TAILQ_HEAD(, rttimer) rtq_head;
+ LIST_ENTRY(rttimer_queue) rtq_link;
+};
+
+#ifdef _KERNEL
+#define RTFREE(rt) do { \
+ if ((rt)->rt_refcnt <= 1) \
+ rtfree(rt); \
+ else \
+ (rt)->rt_refcnt--; \
+} while (0)
+
+/*
+ * Values for additional argument to rtalloc_noclone() and rtalloc2()
+ */
+#define ALL_CLONING 0
+#define ONNET_CLONING 1
+#define NO_CLONING 2
+
+struct route_cb route_cb;
+struct rtstat rtstat;
+struct radix_node_head *rt_tables[AF_MAX+1];
+
+struct socket;
+void route_init __P((void));
+int route_output __P((struct mbuf *, ...));
+int route_usrreq __P((struct socket *, int, struct mbuf *,
+ struct mbuf *, struct mbuf *));
+void rt_ifmsg __P((struct ifnet *));
+void rt_maskedcopy __P((struct sockaddr *,
+ struct sockaddr *, struct sockaddr *));
+void rt_missmsg __P((int, struct rt_addrinfo *, int, int));
+void rt_newaddrmsg __P((int, struct ifaddr *, int, struct rtentry *));
+int rt_setgate __P((struct rtentry *, struct sockaddr *,
+ struct sockaddr *));
+void rt_setmetrics __P((u_long, struct rt_metrics *, struct rt_metrics *));
+int rt_timer_add __P((struct rtentry *,
+ void(*)(struct rtentry *, struct rttimer *),
+ struct rttimer_queue *));
+void rt_timer_init __P((void));
+struct rttimer_queue *
+ rt_timer_queue_create __P((u_int));
+void rt_timer_queue_change __P((struct rttimer_queue *, long));
+void rt_timer_queue_destroy __P((struct rttimer_queue *, int));
+void rt_timer_remove_all __P((struct rtentry *));
+void rt_timer_timer __P((void *));
+void rtable_init __P((void **));
+void rtalloc __P((struct route *));
+struct rtentry *
+ rtalloc1 __P((struct sockaddr *, int));
+void rtalloc_noclone __P((struct route *, int));
+struct rtentry *
+ rtalloc2 __P((struct sockaddr *, int, int));
+void rtfree __P((struct rtentry *));
+int rtinit __P((struct ifaddr *, int, int));
+int rtioctl __P((u_long, caddr_t, struct proc *));
+void rtredirect __P((struct sockaddr *, struct sockaddr *,
+ struct sockaddr *, int, struct sockaddr *,
+ struct rtentry **));
+int rtrequest __P((int, struct sockaddr *,
+ struct sockaddr *, struct sockaddr *, int,
+ struct rtentry **));
+void ipv4_tunnelsetup __P((struct rtentry *));
+#endif /* _KERNEL */
+
+#endif // _NET_ROUTE_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/icmp6.h b/ecos/packages/net/tcpip/current/include/netinet/icmp6.h
new file mode 100644
index 0000000..2c53488
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/icmp6.h
@@ -0,0 +1,66 @@
+//==========================================================================
+//
+// include/netinet/icmp6.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: icmp6.h,v 1.1 1999/12/08 06:50:18 itojun Exp $ */
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+
+#ifndef _NETINET_ICMP6_H_
+#define _NETINET_ICMP6_H_
+
+#include <netinet6/icmp6.h>
+
+#endif /* !_NETINET_ICMP6_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/netinet/icmp_var.h b/ecos/packages/net/tcpip/current/include/netinet/icmp_var.h
new file mode 100644
index 0000000..8ba142b
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/icmp_var.h
@@ -0,0 +1,108 @@
+//==========================================================================
+//
+// include/netinet/icmp_var.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: icmp_var.h,v 1.4 1998/01/06 01:38:35 deraadt Exp $ */
+/* $NetBSD: icmp_var.h,v 1.8 1995/03/26 20:32:19 jtc Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * 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.
+ *
+ * @(#)icmp_var.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_ICMP_VAR_H_
+#define _NETINET_ICMP_VAR_H_
+
+/*
+ * Variables related to this implementation
+ * of the internet control message protocol.
+ */
+struct icmpstat {
+/* statistics related to icmp packets generated */
+ u_long icps_error; /* # of calls to icmp_error */
+ u_long icps_oldshort; /* no error 'cuz old ip too short */
+ u_long icps_oldicmp; /* no error 'cuz old was icmp */
+ u_long icps_outhist[ICMP_MAXTYPE + 1];
+/* statistics related to input messages processed */
+ u_long icps_badcode; /* icmp_code out of range */
+ u_long icps_tooshort; /* packet < ICMP_MINLEN */
+ u_long icps_checksum; /* bad checksum */
+ u_long icps_badlen; /* calculated bound mismatch */
+ u_long icps_reflect; /* number of responses */
+ u_long icps_bmcastecho; /* rejected broadcast icmps */
+ u_long icps_inhist[ICMP_MAXTYPE + 1];
+};
+
+/*
+ * Names for ICMP sysctl objects
+ */
+#define ICMPCTL_MASKREPL 1 /* allow replies to netmask requests */
+#define ICMPCTL_BMCASTECHO 2 /* reply to icmps to broadcast/mcast */
+#define ICMPCTL_MAXID 3
+
+#define ICMPCTL_NAMES { \
+ { 0, 0 }, \
+ { "maskrepl", CTLTYPE_INT }, \
+ { "bmcastecho", CTLTYPE_INT }, \
+}
+
+#ifdef _KERNEL
+struct icmpstat icmpstat;
+#endif
+
+#endif // _NETINET_ICMP_VAR_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/if_arc.h b/ecos/packages/net/tcpip/current/include/netinet/if_arc.h
new file mode 100644
index 0000000..424e4d3
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/if_arc.h
@@ -0,0 +1,158 @@
+//==========================================================================
+//
+// include/netinet/if_arc.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: if_arc.h,v 1.2 1997/02/24 14:06:34 niklas Exp $ */
+/* $NetBSD: if_arc.h,v 1.5 1995/06/07 00:14:04 cgd Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * 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: NetBSD: if_ether.h,v 1.10 1994/06/29 06:37:55 cgd Exp
+ * @(#)if_ether.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_IF_ARC_H_
+#define _NETINET_IF_ARC_H_
+
+/*
+ * Arcnet address - 1 octets
+ * don't know who uses this.
+ */
+struct arc_addr {
+ u_int8_t arc_addr_octet[1];
+};
+
+/*
+ * Structure of a 2.5MB/s Arcnet header.
+ * as given to interface code.
+ */
+struct arc_header {
+ u_int8_t arc_shost;
+ u_int8_t arc_dhost;
+ u_int8_t arc_type;
+ /*
+ * only present for newstyle encoding with LL fragmentation.
+ * Don't use sizeof(anything), use ARC_HDR{,NEW}LEN instead.
+ */
+ u_int8_t arc_flag;
+ u_int16_t arc_seqid;
+
+ /*
+ * only present in exception packets (arc_flag == 0xff)
+ */
+ u_int8_t arc_type2; /* same as arc_type */
+ u_int8_t arc_flag2; /* real flag value */
+ u_int16_t arc_seqid2; /* real seqid value */
+};
+
+#define ARC_ADDR_LEN 1
+
+#define ARC_HDRLEN 3
+#define ARC_HDRNEWLEN 6
+
+/* these lengths are data link layer length - 2*ARC_ADDR_LEN */
+#define ARC_MIN_LEN 1
+#define ARC_MIN_FORBID_LEN 254
+#define ARC_MAX_FORBID_LEN 256
+#define ARC_MAX_LEN 508
+
+
+/* RFC 1051 */
+#define ARCTYPE_IP_OLD 240 /* IP protocol */
+#define ARCTYPE_ARP_OLD 241 /* address resolution protocol */
+
+/* RFC 1201 */
+#define ARCTYPE_IP 212 /* IP protocol */
+#define ARCTYPE_ARP 213 /* address resolution protocol */
+#define ARCTYPE_REVARP 214 /* reverse addr resolution protocol */
+
+#define ARCTYPE_ATALK 221 /* Appletalk */
+#define ARCTYPE_BANIAN 247 /* Banyan Vines */
+#define ARCTYPE_IPX 250 /* Novell IPX */
+
+#define ARCMTU 507
+#define ARCMIN 0
+
+struct arccom {
+ struct ifnet ac_if; /* network-visible interface */
+ u_int8_t ac_anaddr; /* arcnet hardware address */
+ struct in_addr ac_ipaddr; /* copy of ip address- XXX */
+
+ u_int16_t ac_seqid; /* seq. id used by PHDS encap. */
+
+ struct ac_frag {
+ u_int8_t af_maxflag; /* from first packet */
+ u_int8_t af_lastseen; /* last split flag seen */
+ u_int16_t af_seqid;
+ struct mbuf *af_packet;
+ } ac_fragtab[256]; /* indexed by sender ll address */
+
+};
+
+#ifdef _KERNEL
+u_int8_t arcbroadcastaddr;
+
+void arc_ifattach __P((struct ifnet *));
+char *arc_sprintf __P((u_int8_t *));
+void arc_input __P((struct ifnet *, struct mbuf *));
+int arc_output __P((struct ifnet *, struct mbuf *, struct sockaddr *,
+ struct rtentry *));
+int arc_isphds __P((int));
+#endif
+
+#endif // _NETINET_IF_ARC_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/if_atm.h b/ecos/packages/net/tcpip/current/include/netinet/if_atm.h
new file mode 100644
index 0000000..9b62458
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/if_atm.h
@@ -0,0 +1,75 @@
+//==========================================================================
+//
+// include/netinet/if_atm.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: if_atm.h,v 1.3 1996/07/03 17:14:32 chuck Exp $ */
+
+/*
+ *
+ * Copyright (c) 1996 Charles D. Cranor and Washington University.
+ * 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 Charles D. Cranor and
+ * Washington University.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+
+#ifndef _NETINET_IF_ATM_H_
+#define _NETINET_IF_ATM_H_
+
+/*
+ * if_atm.h
+ */
+
+void atm_rtrequest __P((int, struct rtentry *, struct sockaddr *));
+int atmresolve __P((struct rtentry *, struct mbuf *, struct sockaddr *,
+ struct atm_pseudohdr *));
+
+#endif // _NETINET_IF_ATM_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/if_ether.h b/ecos/packages/net/tcpip/current/include/netinet/if_ether.h
new file mode 100644
index 0000000..9b70fb9
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/if_ether.h
@@ -0,0 +1,314 @@
+//==========================================================================
+//
+// include/netinet/if_ether.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: if_ether.h,v 1.10 1999/12/08 06:50:19 itojun Exp $ */
+/* $NetBSD: if_ether.h,v 1.22 1996/05/11 13:00:00 mycroft Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * 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.
+ *
+ * @(#)if_ether.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_IF_ETHER_H_
+#define _NETINET_IF_ETHER_H_
+
+/*
+ * Ethernet address - 6 octets
+ * this is only used by the ethers(3) functions.
+ */
+struct ether_addr {
+ u_int8_t ether_addr_octet[6];
+} __attribute__ ((aligned(1), packed));
+
+/*
+ * Structure of a Ethernet header.
+ */
+#define ETHER_ADDR_LEN 6
+
+struct ether_header {
+ u_int8_t ether_dhost[ETHER_ADDR_LEN];
+ u_int8_t ether_shost[ETHER_ADDR_LEN];
+ u_int16_t ether_type;
+} __attribute__ ((aligned(1), packed));
+
+#define ETHERTYPE_PUP 0x0200 /* PUP protocol */
+#define ETHERTYPE_IP 0x0800 /* IP protocol */
+#define ETHERTYPE_ARP 0x0806 /* address resolution protocol */
+#define ETHERTYPE_REVARP 0x8035 /* reverse addr resolution protocol */
+#define ETHERTYPE_IPV6 0x86DD /* IPv6 protocol */
+
+/*
+ * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
+ * (type-ETHERTYPE_TRAIL)*512 bytes of data followed
+ * by an ETHER type (as given above) and then the (variable-length) header.
+ */
+#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */
+#define ETHERTYPE_NTRAILER 16
+
+#define ETHER_IS_MULTICAST(addr) (*(addr) & 0x01) /* is address mcast/bcast? */
+
+#define ETHERMTU 1500
+#define ETHERMIN (60-14)
+
+#ifdef _KERNEL
+/*
+ * Macro to map an IP multicast address to an Ethernet multicast address.
+ * The high-order 25 bits of the Ethernet address are statically assigned,
+ * and the low-order 23 bits are taken from the low end of the IP address.
+ */
+#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \
+ /* struct in_addr *ipaddr; */ \
+ /* u_int8_t enaddr[ETHER_ADDR_LEN]; */ \
+{ \
+ (enaddr)[0] = 0x01; \
+ (enaddr)[1] = 0x00; \
+ (enaddr)[2] = 0x5e; \
+ (enaddr)[3] = ((u_int8_t *)ipaddr)[1] & 0x7f; \
+ (enaddr)[4] = ((u_int8_t *)ipaddr)[2]; \
+ (enaddr)[5] = ((u_int8_t *)ipaddr)[3]; \
+}
+
+/*
+ * Macro to map an IPv6 multicast address to an Ethernet multicast address.
+ * The high-order 16 bits of the Ethernet address are statically assigned,
+ * and the low-order 32 bits are taken from the low end of the IPv6 address.
+ */
+#define ETHER_MAP_IPV6_MULTICAST(ip6addr, enaddr) \
+ /* struct in6_addr *ip6addr; */ \
+ /* u_int8_t enaddr[ETHER_ADDR_LEN]; */ \
+{ \
+ (enaddr)[0] = 0x33; \
+ (enaddr)[1] = 0x33; \
+ (enaddr)[2] = ((u_int8_t *)ip6addr)[12]; \
+ (enaddr)[3] = ((u_int8_t *)ip6addr)[13]; \
+ (enaddr)[4] = ((u_int8_t *)ip6addr)[14]; \
+ (enaddr)[5] = ((u_int8_t *)ip6addr)[15]; \
+}
+#endif
+
+/*
+ * Ethernet Address Resolution Protocol.
+ *
+ * See RFC 826 for protocol description. Structure below is adapted
+ * to resolving internet addresses. Field names used correspond to
+ * RFC 826.
+ */
+struct ether_arp {
+ struct arphdr ea_hdr; /* fixed-size header */
+ u_int8_t arp_sha[ETHER_ADDR_LEN]; /* sender hardware address */
+ u_int8_t arp_spa[4]; /* sender protocol address */
+ u_int8_t arp_tha[ETHER_ADDR_LEN]; /* target hardware address */
+ u_int8_t arp_tpa[4]; /* target protocol address */
+};
+#define arp_hrd ea_hdr.ar_hrd
+#define arp_pro ea_hdr.ar_pro
+#define arp_hln ea_hdr.ar_hln
+#define arp_pln ea_hdr.ar_pln
+#define arp_op ea_hdr.ar_op
+
+/*
+ * Structure shared between the ethernet driver modules and
+ * the address resolution code. For example, each ec_softc or il_softc
+ * begins with this structure.
+ */
+struct arpcom {
+ struct ifnet ac_if; /* network-visible interface */
+ u_int8_t ac_enaddr[ETHER_ADDR_LEN]; /* ethernet hardware address */
+ char ac__pad[2]; /* pad for some machines */
+ LIST_HEAD(, ether_multi) ac_multiaddrs; /* list of ether multicast addrs */
+ int ac_multicnt; /* length of ac_multiaddrs list */
+};
+
+struct llinfo_arp {
+ LIST_ENTRY(llinfo_arp) la_list;
+ struct rtentry *la_rt;
+ struct mbuf *la_hold; /* last packet until resolved/timeout */
+ long la_asked; /* last time we QUERIED for this addr */
+#define la_timer la_rt->rt_rmx.rmx_expire /* deletion time in seconds */
+};
+
+struct sockaddr_inarp {
+ u_int8_t sin_len;
+ u_int8_t sin_family;
+ u_int16_t sin_port;
+ struct in_addr sin_addr;
+ struct in_addr sin_srcaddr;
+ u_int16_t sin_tos;
+ u_int16_t sin_other;
+#define SIN_PROXY 1
+};
+
+/*
+ * IP and ethernet specific routing flags
+ */
+#define RTF_USETRAILERS RTF_PROTO1 /* use trailers */
+#define RTF_ANNOUNCE RTF_PROTO2 /* announce new arp entry */
+#define RTF_PERMANENT_ARP RTF_PROTO3 /* only manual overwrite of entry */
+
+#ifdef _KERNEL
+extern u_int8_t etherbroadcastaddr[ETHER_ADDR_LEN];
+extern u_int8_t ether_ipmulticast_min[ETHER_ADDR_LEN];
+extern u_int8_t ether_ipmulticast_max[ETHER_ADDR_LEN];
+extern struct ifqueue arpintrq;
+
+void arpwhohas __P((struct arpcom *, struct in_addr *));
+void arpintr __P((void));
+int arpresolve __P((struct arpcom *,
+ struct rtentry *, struct mbuf *, struct sockaddr *, u_char *));
+void arp_ifinit __P((struct arpcom *, struct ifaddr *));
+void arp_rtrequest __P((int, struct rtentry *, struct sockaddr *));
+
+int ether_addmulti __P((struct ifreq *, struct arpcom *));
+int ether_delmulti __P((struct ifreq *, struct arpcom *));
+#endif /* _KERNEL */
+
+/*
+ * Ethernet multicast address structure. There is one of these for each
+ * multicast address or range of multicast addresses that we are supposed
+ * to listen to on a particular interface. They are kept in a linked list,
+ * rooted in the interface's arpcom structure. (This really has nothing to
+ * do with ARP, or with the Internet address family, but this appears to be
+ * the minimally-disrupting place to put it.)
+ */
+struct ether_multi {
+ u_int8_t enm_addrlo[ETHER_ADDR_LEN]; /* low or only address of range */
+ u_int8_t enm_addrhi[ETHER_ADDR_LEN]; /* high or only address of range */
+ struct arpcom *enm_ac; /* back pointer to arpcom */
+ u_int enm_refcount; /* no. claims to this addr/range */
+ LIST_ENTRY(ether_multi) enm_list;
+};
+
+/*
+ * Structure used by macros below to remember position when stepping through
+ * all of the ether_multi records.
+ */
+struct ether_multistep {
+ struct ether_multi *e_enm;
+};
+
+/*
+ * Macro for looking up the ether_multi record for a given range of Ethernet
+ * multicast addresses connected to a given arpcom structure. If no matching
+ * record is found, "enm" returns NULL.
+ */
+#define ETHER_LOOKUP_MULTI(addrlo, addrhi, ac, enm) \
+ /* u_int8_t addrlo[ETHER_ADDR_LEN]; */ \
+ /* u_int8_t addrhi[ETHER_ADDR_LEN]; */ \
+ /* struct arpcom *ac; */ \
+ /* struct ether_multi *enm; */ \
+{ \
+ for ((enm) = (ac)->ac_multiaddrs.lh_first; \
+ (enm) != NULL && \
+ (bcmp((enm)->enm_addrlo, (addrlo), ETHER_ADDR_LEN) != 0 || \
+ bcmp((enm)->enm_addrhi, (addrhi), ETHER_ADDR_LEN) != 0); \
+ (enm) = (enm)->enm_list.le_next); \
+}
+
+/*
+ * Macro to step through all of the ether_multi records, one at a time.
+ * The current position is remembered in "step", which the caller must
+ * provide. ETHER_FIRST_MULTI(), below, must be called to initialize "step"
+ * and get the first record. Both macros return a NULL "enm" when there
+ * are no remaining records.
+ */
+#define ETHER_NEXT_MULTI(step, enm) \
+ /* struct ether_multistep step; */ \
+ /* struct ether_multi *enm; */ \
+{ \
+ if (((enm) = (step).e_enm) != NULL) \
+ (step).e_enm = (enm)->enm_list.le_next; \
+}
+
+#define ETHER_FIRST_MULTI(step, ac, enm) \
+ /* struct ether_multistep step; */ \
+ /* struct arpcom *ac; */ \
+ /* struct ether_multi *enm; */ \
+{ \
+ (step).e_enm = (ac)->ac_multiaddrs.lh_first; \
+ ETHER_NEXT_MULTI((step), (enm)); \
+}
+
+#ifdef _KERNEL
+
+extern struct ifnet *myip_ifp;
+
+void arp_rtrequest __P((int, struct rtentry *, struct sockaddr *));
+int arpresolve __P((struct arpcom *, struct rtentry *, struct mbuf *,
+ struct sockaddr *, u_char *));
+void arpintr __P((void));
+int arpioctl __P((u_long, caddr_t));
+void arp_ifinit __P((struct arpcom *, struct ifaddr *));
+void revarpinput __P((struct mbuf *));
+void in_revarpinput __P((struct mbuf *));
+void revarprequest __P((struct ifnet *));
+int revarpwhoarewe __P((struct ifnet *, struct in_addr *, struct in_addr *));
+int revarpwhoami __P((struct in_addr *, struct ifnet *));
+int db_show_arptab __P((void));
+
+#else
+
+char *ether_ntoa __P((struct ether_addr *));
+struct ether_addr *ether_aton __P((char *));
+int ether_ntohost __P((char *, struct ether_addr *));
+int ether_hostton __P((char *, struct ether_addr *));
+int ether_line __P((char *, struct ether_addr *, char *));
+
+#endif // _KERNEL
+
+#endif // _NETINET_IF_ETHER_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/igmp.h b/ecos/packages/net/tcpip/current/include/netinet/igmp.h
new file mode 100644
index 0000000..4220ce2
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/igmp.h
@@ -0,0 +1,131 @@
+//==========================================================================
+//
+// include/netinet/igmp.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: igmp.h,v 1.3 1999/08/08 00:43:00 niklas Exp $ */
+/* $NetBSD: igmp.h,v 1.6 1995/05/31 06:08:21 mycroft Exp $ */
+
+/*
+ * Copyright (c) 1988 Stephen Deering.
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Stephen Deering of Stanford University.
+ *
+ * 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.
+ *
+ * @(#)igmp.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_IGMP_H_
+#define _NETINET_IGMP_H_
+
+/*
+ * Internet Group Management Protocol (IGMP) definitions.
+ *
+ * MULTICAST 1.3
+ */
+
+/*
+ * IGMP packet format.
+ */
+struct igmp {
+ u_int8_t igmp_type; /* version & type of IGMP message */
+ u_int8_t igmp_code; /* code for routing sub-messages */
+ u_int16_t igmp_cksum; /* IP-style checksum */
+ struct in_addr igmp_group; /* group address being reported */
+}; /* (zero for queries) */
+
+#define IGMP_MINLEN 8
+
+#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* membership query */
+#define IGMP_v1_HOST_MEMBERSHIP_REPORT 0x12 /* v1 membership report */
+#define IGMP_DVMRP 0x13 /* DVMRP routing message */
+#define IGMP_PIM 0x14 /* PIM routing message */
+#define IGMP_v2_HOST_MEMBERSHIP_REPORT 0x16 /* v2 membership report */
+#define IGMP_HOST_LEAVE_MESSAGE 0x17 /* leave-group message */
+#define IGMP_MTRACE_REPLY 0x1e /* traceroute reply */
+#define IGMP_MTRACE_QUERY 0x1f /* traceroute query */
+
+#define IGMP_MAX_HOST_REPORT_DELAY 10 /* max delay for response to */
+ /* query (in seconds) */
+
+#define IGMP_TIMER_SCALE 10 /* denominator for igmp_timer */
+
+/*
+ * States for the IGMP v2 state table.
+ */
+#define IGMP_DELAYING_MEMBER 1
+#define IGMP_IDLE_MEMBER 2
+#define IGMP_LAZY_MEMBER 3
+#define IGMP_SLEEPING_MEMBER 4
+#define IGMP_AWAKENING_MEMBER 5
+
+/*
+ * States for IGMP router version cache.
+ */
+#define IGMP_v1_ROUTER 1
+#define IGMP_v2_ROUTER 2
+
+/*
+ * Revert to v2 if we haven't heard from the router in this amount of time.
+ */
+#define IGMP_AGE_THRESHOLD 540
+
+#ifdef _KERNEL
+void rti_delete __P((struct ifnet *));
+#endif
+
+#endif // _NETINET_IGMP_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/igmp_var.h b/ecos/packages/net/tcpip/current/include/netinet/igmp_var.h
new file mode 100644
index 0000000..3a1820d
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/igmp_var.h
@@ -0,0 +1,116 @@
+//==========================================================================
+//
+// include/netinet/igmp_var.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: igmp_var.h,v 1.3 1997/02/05 15:48:22 deraadt Exp $ */
+/* $NetBSD: igmp_var.h,v 1.9 1996/02/13 23:41:31 christos Exp $ */
+
+/*
+ * Copyright (c) 1988 Stephen Deering.
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Stephen Deering of Stanford University.
+ *
+ * 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.
+ *
+ * @(#)igmp_var.h 8.1 (Berkeley) 7/19/93
+ */
+
+#ifndef _NETINET_IGMP_VAR_H_
+#define _NETINET_IGMP_VAR_H_
+
+/*
+ * Internet Group Management Protocol (IGMP),
+ * implementation-specific definitions.
+ *
+ * Written by Steve Deering, Stanford, May 1988.
+ * Modified by Rosen Sharma, Stanford, Aug 1994.
+ * Modified by Bill Fenner, Xerox PARC, Feb 1995.
+ *
+ * MULTICAST 1.3
+ */
+
+struct igmpstat {
+ u_long igps_rcv_total; /* total IGMP messages received */
+ u_long igps_rcv_tooshort; /* received with too few bytes */
+ u_long igps_rcv_badsum; /* received with bad checksum */
+ u_long igps_rcv_queries; /* received membership queries */
+ u_long igps_rcv_badqueries; /* received invalid queries */
+ u_long igps_rcv_reports; /* received membership reports */
+ u_long igps_rcv_badreports; /* received invalid reports */
+ u_long igps_rcv_ourreports; /* received reports for our groups */
+ u_long igps_snd_reports; /* sent membership reports */
+};
+
+#ifdef _KERNEL
+struct igmpstat igmpstat;
+
+/*
+ * Macro to compute a random timer value between 1 and (IGMP_MAX_REPORTING_
+ * DELAY * countdown frequency). We assume that the routine random()
+ * is defined somewhere (and that it returns a positive number).
+ */
+#define IGMP_RANDOM_DELAY(X) (arc4random() % (X) + 1)
+
+void igmp_init __P((void));
+void igmp_input __P((struct mbuf *, ...));
+void igmp_joingroup __P((struct in_multi *));
+void igmp_leavegroup __P((struct in_multi *));
+void igmp_fasttimo __P((void));
+void igmp_slowtimo __P((void));
+#endif
+
+#endif // _NETINET_IGMP_VAR_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/in.h b/ecos/packages/net/tcpip/current/include/netinet/in.h
new file mode 100644
index 0000000..128149b
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/in.h
@@ -0,0 +1,680 @@
+//==========================================================================
+//
+// include/netinet/in.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: in.h,v 1.27 1999/12/16 21:30:34 deraadt Exp $ */
+/* $NetBSD: in.h,v 1.20 1996/02/13 23:41:47 christos Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1990, 1993
+ * 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.
+ *
+ * @(#)in.h 8.3 (Berkeley) 1/3/94
+ */
+
+/*
+ * Constants and structures defined by the internet system,
+ * Per RFC 790, September 1981, and numerous additions.
+ */
+
+#ifndef _NETINET_IN_H_
+#define _NETINET_IN_H_
+
+/*
+ * Protocols
+ */
+#define IPPROTO_IP 0 /* dummy for IP */
+#define IPPROTO_HOPOPTS IPPROTO_IP /* Hop-by-hop option header. */
+#define IPPROTO_ICMP 1 /* control message protocol */
+#define IPPROTO_IGMP 2 /* group mgmt protocol */
+#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */
+#define IPPROTO_IPIP 4 /* IP inside IP */
+#define IPPROTO_IPV4 IPPROTO_IPIP /* IP inside IP */
+#define IPPROTO_TCP 6 /* tcp */
+#define IPPROTO_EGP 8 /* exterior gateway protocol */
+#define IPPROTO_PUP 12 /* pup */
+#define IPPROTO_UDP 17 /* user datagram protocol */
+#define IPPROTO_IDP 22 /* xns idp */
+#define IPPROTO_TP 29 /* tp-4 w/ class negotiation */
+#define IPPROTO_IPV6 41 /* IPv6 in IPv6 */
+#define IPPROTO_ROUTING 43 /* Routing header. */
+#define IPPROTO_FRAGMENT 44 /* Fragmentation/reassembly header. */
+#define IPPROTO_RSVP 46 /* resource reservation */
+#define IPPROTO_ESP 50 /* Encap. Security Payload */
+#define IPPROTO_AH 51 /* Authentication header */
+#define IPPROTO_ICMPV6 58 /* ICMP for IPv6 */
+#define IPPROTO_NONE 59 /* No next header */
+#define IPPROTO_DSTOPTS 60 /* Destination options header. */
+#define IPPROTO_EON 80 /* ISO cnlp */
+#define IPPROTO_ETHERIP 97 /* Ethernet in IPv4 */
+#define IPPROTO_ENCAP 98 /* encapsulation header */
+#define IPPROTO_PIM 103 /* Protocol indep. multicast */
+#define IPPROTO_IPCOMP 108 /* IP Payload Comp. Protocol */
+#define IPPROTO_RAW 255 /* raw IP packet */
+
+#define IPPROTO_MAX 256
+
+/*
+ * From FreeBSD:
+ *
+ * Local port number conventions:
+ *
+ * When a user does a bind(2) or connect(2) with a port number of zero,
+ * a non-conflicting local port address is chosen.
+ * The default range is IPPORT_RESERVED through
+ * IPPORT_USERRESERVED, although that is settable by sysctl.
+ *
+ * A user may set the IPPROTO_IP option IP_PORTRANGE to change this
+ * default assignment range.
+ *
+ * The value IP_PORTRANGE_DEFAULT causes the default behavior.
+ *
+ * The value IP_PORTRANGE_HIGH changes the range of candidate port numbers
+ * into the "high" range. These are reserved for client outbound connections
+ * which do not want to be filtered by any firewalls.
+ *
+ * The value IP_PORTRANGE_LOW changes the range to the "low" are
+ * that is (by convention) restricted to privileged processes. This
+ * convention is based on "vouchsafe" principles only. It is only secure
+ * if you trust the remote host to restrict these ports.
+ *
+ * The default range of ports and the high range can be changed by
+ * sysctl(3). (net.inet.ip.port{hi}{first,last})
+ *
+ * Changing those values has bad security implications if you are
+ * using a a stateless firewall that is allowing packets outside of that
+ * range in order to allow transparent outgoing connections.
+ *
+ * Such a firewall configuration will generally depend on the use of these
+ * default values. If you change them, you may find your Security
+ * Administrator looking for you with a heavy object.
+ */
+
+/*
+ * Ports < IPPORT_RESERVED are reserved for
+ * privileged processes (e.g. root).
+ * Ports > IPPORT_USERRESERVED are reserved
+ * for servers, not necessarily privileged.
+ */
+#define IPPORT_RESERVED 1024
+#define IPPORT_USERRESERVED 49151
+
+/*
+ * Default local port range to use by setting IP_PORTRANGE_HIGH
+ */
+#define IPPORT_HIFIRSTAUTO 49152
+#define IPPORT_HILASTAUTO 65535
+
+/*
+ * IP Version 4 Internet address (a structure for historical reasons)
+ */
+struct in_addr {
+ in_addr_t s_addr;
+};
+
+#if 0 /*NRL IPv6*/
+/*
+ * IP Version 6 Internet address
+ */
+struct in6_addr {
+ union {
+ u_int8_t s6u_addr8[16];
+ u_int16_t s6u_addr16[8];
+ u_int32_t s6u_addr32[4];
+ } s6_u;
+#define s6_addr s6_u.s6u_addr8
+/*
+ * The rest are common, but not guaranteed to be portable. 64 bit access are
+ * not available because the in6_addr in a sockaddr_in6 is not 64 bit aligned.
+ */
+#define s6_addr8 s6_u.s6u_addr8
+#define s6_addr16 s6_u.s6u_addr16
+#define s6_addr32 s6_u.s6u_addr32
+};
+#endif
+
+/* last return value of *_input(), meaning "all job for this pkt is done". */
+#define IPPROTO_DONE 257
+
+/*
+ * Definitions of bits in internet address integers.
+ * On subnets, the decomposition of addresses to host and net parts
+ * is done according to subnet mask, not the masks here.
+ *
+ * By byte-swapping the constants, we avoid ever having to byte-swap IP
+ * addresses inside the kernel. Unfortunately, user-level programs rely
+ * on these macros not doing byte-swapping.
+ */
+#ifdef _KERNEL
+#define __IPADDR(x) ((u_int32_t) htonl((u_int32_t)(x)))
+#else
+#define __IPADDR(x) ((u_int32_t)(x))
+#endif
+
+#define IN_CLASSA(i) (((u_int32_t)(i) & __IPADDR(0x80000000)) == \
+ __IPADDR(0x00000000))
+#define IN_CLASSA_NET __IPADDR(0xff000000)
+#define IN_CLASSA_NSHIFT 24
+#define IN_CLASSA_HOST __IPADDR(0x00ffffff)
+#define IN_CLASSA_MAX 128
+
+#define IN_CLASSB(i) (((u_int32_t)(i) & __IPADDR(0xc0000000)) == \
+ __IPADDR(0x80000000))
+#define IN_CLASSB_NET __IPADDR(0xffff0000)
+#define IN_CLASSB_NSHIFT 16
+#define IN_CLASSB_HOST __IPADDR(0x0000ffff)
+#define IN_CLASSB_MAX 65536
+
+#define IN_CLASSC(i) (((u_int32_t)(i) & __IPADDR(0xe0000000)) == \
+ __IPADDR(0xc0000000))
+#define IN_CLASSC_NET __IPADDR(0xffffff00)
+#define IN_CLASSC_NSHIFT 8
+#define IN_CLASSC_HOST __IPADDR(0x000000ff)
+
+#define IN_CLASSD(i) (((u_int32_t)(i) & __IPADDR(0xf0000000)) == \
+ __IPADDR(0xe0000000))
+/* These ones aren't really net and host fields, but routing needn't know. */
+#define IN_CLASSD_NET __IPADDR(0xf0000000)
+#define IN_CLASSD_NSHIFT 28
+#define IN_CLASSD_HOST __IPADDR(0x0fffffff)
+#define IN_MULTICAST(i) IN_CLASSD(i)
+
+#define IN_EXPERIMENTAL(i) (((u_int32_t)(i) & __IPADDR(0xf0000000)) == \
+ __IPADDR(0xf0000000))
+#define IN_BADCLASS(i) (((u_int32_t)(i) & __IPADDR(0xf0000000)) == \
+ __IPADDR(0xf0000000))
+
+#define IN_LOCAL_GROUP(i) (((u_int32_t)(i) & __IPADDR(0xffffff00)) == \
+ __IPADDR(0xe0000000))
+
+#define INADDR_ANY __IPADDR(0x00000000)
+#define INADDR_LOOPBACK __IPADDR(0x7f000001)
+#define INADDR_BROADCAST __IPADDR(0xffffffff) /* must be masked */
+#ifndef _KERNEL
+#define INADDR_NONE __IPADDR(0xffffffff) /* -1 return */
+#endif
+
+#define INADDR_UNSPEC_GROUP __IPADDR(0xe0000000) /* 224.0.0.0 */
+#define INADDR_ALLHOSTS_GROUP __IPADDR(0xe0000001) /* 224.0.0.1 */
+#define INADDR_MAX_LOCAL_GROUP __IPADDR(0xe00000ff) /* 224.0.0.255 */
+
+#define IN_LOOPBACKNET 127 /* official! */
+
+#if 0 /*NRL IPv6*/
+/*
+ * Tests for IPv6 address types
+ */
+
+#define IN6_IS_ADDR_LINKLOCAL(addr) \
+ (((addr)->s6_addr32[0] & htonl(0xffc00000)) == htonl(0xfe800000))
+
+#define IN6_IS_ADDR_LOOPBACK(addr) \
+ (((addr)->s6_addr32[0] == 0) && ((addr)->s6_addr32[1] == 0) && \
+ ((addr)->s6_addr32[2] == 0) && ((addr)->s6_addr32[3] == htonl(1)))
+
+#define IN6_IS_ADDR_MULTICAST(addr) \
+ ((addr)->s6_addr8[0] == 0xff)
+
+#define IN6_IS_ADDR_SITELOCAL(addr) \
+ (((addr)->s6_addr32[0] & htonl(0xffc00000)) == htonl(0xfec00000))
+
+#define IN6_IS_ADDR_UNSPECIFIED(addr) \
+ (((addr)->s6_addr32[0] == 0) && ((addr)->s6_addr32[1] == 0) && \
+ ((addr)->s6_addr32[2] == 0) && ((addr)->s6_addr32[3] == 0))
+
+#define IN6_IS_ADDR_V4COMPAT(addr) \
+ (((addr)->s6_addr32[0] == 0) && ((addr)->s6_addr32[1] == 0) && \
+ ((addr)->s6_addr32[2] == 0) && ((addr)->s6_addr32[3] & ~htonl(1)))
+
+#define IN6_IS_ADDR_V4MAPPED(addr) \
+ (((addr)->s6_addr32[0] == 0) && ((addr)->s6_addr32[1] == 0) && \
+ ((addr)->s6_addr32[2] == htonl(0xffff)))
+
+#define IN6_ARE_ADDR_EQUAL(addr1, addr2) \
+ (((addr1)->s6_addr32[0] == (addr2)->s6_addr32[0]) && \
+ ((addr1)->s6_addr32[1] == (addr2)->s6_addr32[1]) && \
+ ((addr1)->s6_addr32[2] == (addr2)->s6_addr32[2]) && \
+ ((addr1)->s6_addr32[3] == (addr2)->s6_addr32[3]))
+
+/*
+ * IPv6 Multicast scoping. The scope is stored
+ * in the bottom 4 bits of the second byte of the
+ * multicast address.
+ */
+ /* 0x0 */ /* reserved */
+#define IN6_NODE_LOCAL 0x1 /* node-local scope */
+#define IN6_LINK_LOCAL 0x2 /* link-local scope */
+ /* 0x3 */ /* (unassigned) */
+ /* 0x4 */ /* (unassigned) */
+#define IN6_SITE_LOCAL 0x5 /* site-local scope */
+ /* 0x6 */ /* (unassigned) */
+ /* 0x7 */ /* (unassigned) */
+#define IN6_ORG_LOCAL 0x8 /* organization-local scope */
+ /* 0x9 */ /* (unassigned) */
+ /* 0xA */ /* (unassigned) */
+ /* 0xB */ /* (unassigned) */
+ /* 0xC */ /* (unassigned) */
+ /* 0xD */ /* (unassigned) */
+#define IN6_GLOBAL 0xE /* global scope */
+ /* 0xF */ /* reserved */
+
+#define IN6_MSCOPE(addr) ((addr)->s6_addr8[1] & 0x0f)
+
+#define IN6_IS_ADDR_MC_NODELOCAL(addr) \
+ (IN6_IS_ADDR_MULTICAST(addr) && (IN6_MSCOPE(addr) == IN6_NODE_LOCAL))
+#define IN6_IS_ADDR_MC_LINKLOCAL(addr) \
+ (IN6_IS_ADDR_MULTICAST(addr) && (IN6_MSCOPE(addr) == IN6_LINK_LOCAL))
+#define IN6_IS_ADDR_MC_SITELOCAL(addr) \
+ (IN6_IS_ADDR_MULTICAST(addr) && (IN6_MSCOPE(addr) == IN6_SITE_LOCAL))
+#define IN6_IS_ADDR_MC_ORGLOCAL(addr) \
+ (IN6_IS_ADDR_MULTICAST(addr) && (IN6_MSCOPE(addr) == IN6_ORG_LOCAL))
+#define IN6_IS_ADDR_MC_GLOBAL(addr) \
+ (IN6_IS_ADDR_MULTICAST(addr) && (IN6_MSCOPE(addr) == IN6_GLOBAL))
+
+/*
+ * Definitions of the IPv6 special addresses
+ */
+extern const struct in6_addr in6addr_any;
+#define IN6ADDR_ANY_INIT {{{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }}}
+
+extern const struct in6_addr in6addr_loopback;
+#define IN6ADDR_LOOPBACK_INIT {{{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }}}
+#endif
+
+/*
+ * IP Version 4 socket address.
+ */
+struct sockaddr_in {
+ u_int8_t sin_len;
+ sa_family_t sin_family;
+ in_port_t sin_port;
+ struct in_addr sin_addr;
+ int8_t sin_zero[8];
+};
+
+#if 0 /*NRL IPv6*/
+/*
+ * IP Version 6 socket address.
+ */
+#define SIN6_LEN 1
+struct sockaddr_in6 {
+ u_int8_t sin6_len;
+ sa_family_t sin6_family;
+ in_port_t sin6_port;
+ u_int32_t sin6_flowinfo;
+ struct in6_addr sin6_addr;
+ u_int32_t sin6_scope_id;
+};
+#endif
+
+#define INET_ADDRSTRLEN 16
+
+/*
+ * Structure used to describe IP options.
+ * Used to store options internally, to pass them to a process,
+ * or to restore options retrieved earlier.
+ * The ip_dst is used for the first-hop gateway when using a source route
+ * (this gets put into the header proper).
+ */
+struct ip_opts {
+ struct in_addr ip_dst; /* first hop, 0 w/o src rt */
+#if defined(__cplusplus)
+ int8_t Ip_opts[40]; /* cannot have same name as class */
+#else
+ int8_t ip_opts[40]; /* actually variable in size */
+#endif
+};
+
+/*
+ * Options for use with [gs]etsockopt at the IP level.
+ * First word of comment is data type; bool is stored in int.
+ */
+#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */
+#define IP_HDRINCL 2 /* int; header is included with data */
+#define IP_TOS 3 /* int; IP type of service and preced. */
+#define IP_TTL 4 /* int; IP time to live */
+#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */
+#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */
+#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */
+#define IP_RETOPTS 8 /* ip_opts; set/get IP options */
+#define IP_MULTICAST_IF 9 /* in_addr; set/get IP multicast i/f */
+#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */
+#define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */
+#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */
+#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */
+
+/* 14-17 left empty for future compatibility with FreeBSD */
+
+#define IP_PORTRANGE 19 /* int; range to choose for unspec port */
+#define IP_AUTH_LEVEL 20 /* u_char; authentication used */
+#define IP_ESP_TRANS_LEVEL 21 /* u_char; transport encryption */
+#define IP_ESP_NETWORK_LEVEL 22 /* u_char; full-packet encryption */
+
+#if 0 /* NRL IPv6 */
+#define IPV6_MULTICAST_IF 23 /* u_int; set/get multicast interface */
+#define IPV6_MULTICAST_HOPS 24 /* int; set/get multicast hop limit */
+#define IPV6_MULTICAST_LOOP 25 /* u_int; set/get multicast loopback */
+#define IPV6_JOIN_GROUP 26 /* ipv6_mreq; join multicast group */
+#define IPV6_ADD_MEMBERSHIP IPV6_JOIN_GROUP /* XXX - for compatibility */
+#define IPV6_LEAVE_GROUP 27 /* ipv6_mreq: leave multicast group */
+#define IPV6_DROP_MEMBERSHIP IPV6_LEAVE_GROUP /* XXX - for compatibility */
+#define IPV6_ADDRFORM 28 /* int; get/set form of returned addrs */
+#define IPV6_UNICAST_HOPS 29 /* int; get/set unicast hop limit */
+#define IPV6_PKTINFO 30 /* int; receive in6_pktinfo as cmsg */
+#define IPV6_HOPLIMIT 31 /* int; receive int hoplimit as cmsg */
+#define IPV6_NEXTHOP 32 /* int; receive sockaddr_in6 as cmsg */
+#define IPV6_HOPOPTS 33 /* int; receive hop options as cmsg */
+#define IPV6_DSTOPTS 34 /* int; receive dst options as cmsg */
+#define IPV6_RTHDR 35 /* int; receive routing header as cmsg */
+#define IPV6_PKTOPTIONS 36 /* int; send/receive cmsgs for TCP */
+#define IPV6_CHECKSUM 37 /* int; offset to place send checksum */
+#define ICMPV6_FILTER 38 /* struct icmpv6_filter; get/set filter */
+#define ICMP6_FILTER ICMP6_FILTER
+#endif
+
+#define IPSEC_OUTSA 39 /* set the outbound SA for a socket */
+
+#if 0 /*KAME IPSEC*/
+#define IP_IPSEC_POLICY ?? /* struct; get/set security policy */
+#endif
+
+/*
+ * Security levels - IPsec, not IPSO
+ */
+
+#define IPSEC_LEVEL_BYPASS 0x00 /* Bypass policy altogether */
+#define IPSEC_LEVEL_NONE 0x00 /* Send clear, accept any */
+#define IPSEC_LEVEL_AVAIL 0x01 /* Send secure if SA available */
+#define IPSEC_LEVEL_USE 0x02 /* Send secure, accept any */
+#define IPSEC_LEVEL_REQUIRE 0x03 /* Require secure inbound, also use */
+#define IPSEC_LEVEL_UNIQUE 0x04 /* Use outbound SA that is unique */
+#define IPSEC_LEVEL_DEFAULT IPSEC_LEVEL_AVAIL
+
+#define IPSEC_AUTH_LEVEL_DEFAULT IPSEC_LEVEL_DEFAULT
+#define IPSEC_ESP_TRANS_LEVEL_DEFAULT IPSEC_LEVEL_DEFAULT
+#define IPSEC_ESP_NETWORK_LEVEL_DEFAULT IPSEC_LEVEL_DEFAULT
+
+#if 0 /* NRL IPv6 */
+/*
+ * IPv6 Routing header types
+ */
+#define IPV6_RTHDR_TYPE_0 0 /* IPv6 Routing header type 0 */
+
+#define IPV6_RTHDR_LOOSE 0 /* this hop need not be a neighbor */
+#define IPV6_RTHDR_STRICT 1 /* this hop must be a neighbor */
+#endif
+
+/*
+ * Defaults and limits for options
+ */
+#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */
+#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
+#define IP_MAX_MEMBERSHIPS 20 /* per socket; must fit in one mbuf */
+
+/*
+ * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
+ */
+struct ip_mreq {
+ struct in_addr imr_multiaddr; /* IP multicast address of group */
+ struct in_addr imr_interface; /* local IP address of interface */
+};
+
+#if 0 /* NRL IPv6 */
+/*
+ * Argument structure for IPV6_ADD_MEMBERSHIP and IPV6_DROP_MEMBERSHIP.
+ */
+struct ipv6_mreq {
+ struct in6_addr ipv6mr_multiaddr; /* IPv6 multicast addr */
+ unsigned int ipv6mr_interface; /* Interface index */
+};
+
+/*
+ * Argument structure for IPV6_PKTINFO control messages
+ */
+struct in6_pktinfo {
+ struct in6_addr ipi6_addr;
+ unsigned int ipi6_ifindex;
+};
+#endif
+
+/*
+ * Argument for IP_PORTRANGE:
+ * - which range to search when port is unspecified at bind() or connect()
+ */
+#define IP_PORTRANGE_DEFAULT 0 /* default range */
+#define IP_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */
+#define IP_PORTRANGE_LOW 2 /* "low" - vouchsafe security */
+
+/*
+ * Buffer lengths for strings containing printable IP addresses
+ */
+#define INET_ADDRSTRLEN 16
+#if 0 /* NRL IPv6 */
+#define INET6_ADDRSTRLEN 46
+#endif
+
+/*
+ * Definitions for inet sysctl operations.
+ *
+ * Third level is protocol number.
+ * Fourth level is desired variable within that protocol.
+ */
+#define IPPROTO_MAXID (IPPROTO_AH + 1) /* don't list to IPPROTO_MAX */
+
+#define CTL_IPPROTO_NAMES { \
+ { "ip", CTLTYPE_NODE }, \
+ { "icmp", CTLTYPE_NODE }, \
+ { "igmp", CTLTYPE_NODE }, \
+ { "ggp", CTLTYPE_NODE }, \
+ { "ip4", CTLTYPE_NODE }, \
+ { 0, 0 }, \
+ { "tcp", CTLTYPE_NODE }, \
+ { 0, 0 }, \
+ { "egp", CTLTYPE_NODE }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { "pup", CTLTYPE_NODE }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { "udp", CTLTYPE_NODE }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { "esp", CTLTYPE_NODE }, \
+ { "ah", CTLTYPE_NODE }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { "etherip", CTLTYPE_NODE }, \
+}
+
+/*
+ * Names for IP sysctl objects
+ */
+#define IPCTL_FORWARDING 1 /* act as router */
+#define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */
+#define IPCTL_DEFTTL 3 /* default TTL */
+#ifdef notyet
+#define IPCTL_DEFMTU 4 /* default MTU */
+#endif
+#define IPCTL_SOURCEROUTE 5 /* may perform source routes */
+#define IPCTL_DIRECTEDBCAST 6 /* default broadcast behavior */
+#define IPCTL_IPPORT_FIRSTAUTO 7
+#define IPCTL_IPPORT_LASTAUTO 8
+#define IPCTL_IPPORT_HIFIRSTAUTO 9
+#define IPCTL_IPPORT_HILASTAUTO 10
+#define IPCTL_IPPORT_MAXQUEUE 11
+#define IPCTL_ENCDEBUG 12
+#define IPCTL_GIF_TTL 13 /* default TTL for gif encap packet */
+#define IPCTL_MAXID 14
+
+#define IPCTL_NAMES { \
+ { 0, 0 }, \
+ { "forwarding", CTLTYPE_INT }, \
+ { "redirect", CTLTYPE_INT }, \
+ { "ttl", CTLTYPE_INT }, \
+ /* { "mtu", CTLTYPE_INT }, */ { 0, 0 }, \
+ { "sourceroute", CTLTYPE_INT }, \
+ { "directed-broadcast", CTLTYPE_INT }, \
+ { "portfirst", CTLTYPE_INT }, \
+ { "portlast", CTLTYPE_INT }, \
+ { "porthifirst", CTLTYPE_INT }, \
+ { "porthilast", CTLTYPE_INT }, \
+ { "maxqueue", CTLTYPE_INT }, \
+ { "encdebug", CTLTYPE_INT }, \
+ { "gifttl", CTLTYPE_INT }, \
+}
+
+/* INET6 stuff */
+#include <netinet6/in6.h>
+
+#ifndef _KERNEL
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int bindresvport __P((int, struct sockaddr_in *));
+int bindresvport_af __P((int, struct sockaddr *, int af));
+__END_DECLS
+
+#else
+int in_broadcast __P((struct in_addr, struct ifnet *));
+int in_canforward __P((struct in_addr));
+int in_cksum __P((struct mbuf *, int));
+int in_localaddr __P((struct in_addr));
+void in_socktrim __P((struct sockaddr_in *));
+char *inet_ntoa __P((struct in_addr));
+char *inet_ntoa_r __P((struct in_addr, char *));
+
+#define satosin(sa) ((struct sockaddr_in *)(sa))
+#define sintosa(sin) ((struct sockaddr *)(sin))
+#define ifatoia(ifa) ((struct in_ifaddr *)(ifa))
+#endif
+#endif /* !_NETINET_IN_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/netinet/in_gif.h b/ecos/packages/net/tcpip/current/include/netinet/in_gif.h
new file mode 100644
index 0000000..a8e5e2f
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/in_gif.h
@@ -0,0 +1,71 @@
+//==========================================================================
+//
+// include/netinet/in_gif.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: in_gif.h,v 1.1 1999/12/08 06:50:19 itojun Exp $ */
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+
+#ifndef _NETINET_IN_GIF_H_
+#define _NETINET_IN_GIF_H_
+
+#define GIF_TTL 30
+
+extern int ip_gif_ttl;
+
+void in_gif_input __P((struct mbuf *, ...));
+int in_gif_output __P((struct ifnet *, int, struct mbuf *, struct rtentry *));
+
+#endif /*_NETINET_IN_GIF_H_*/
diff --git a/ecos/packages/net/tcpip/current/include/netinet/in_pcb.h b/ecos/packages/net/tcpip/current/include/netinet/in_pcb.h
new file mode 100644
index 0000000..c65b070
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/in_pcb.h
@@ -0,0 +1,308 @@
+//==========================================================================
+//
+// include/netinet/in_pcb.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: in_pcb.h,v 1.19 1999/12/12 12:10:43 itojun Exp $ */
+/* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1990, 1993
+ * 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.
+ *
+ * @(#)in_pcb.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_IN_PCB_H_
+#define _NETINET_IN_PCB_H_
+
+#include <sys/queue.h>
+#if 0 /*KAME IPSEC*/
+#include <netinet6/ipsec.h>
+#endif
+#include <netinet6/ip6.h>
+#include <netinet6/ip6_var.h>
+#include <netinet6/icmp6.h>
+#include <netinet/ip_ipsp.h>
+
+union inpaddru {
+ struct in6_addr iau_addr6;
+ struct {
+ uint8_t pad[12];
+ struct in_addr inaddr; /* easier transition */
+ } iau_a4u;
+};
+
+/*
+ * Common structure pcb for internet protocol implementation.
+ * Here are stored pointers to local and foreign host table
+ * entries, local and foreign socket numbers, and pointers
+ * up (to a socket structure) and down (to a protocol-specific)
+ * control block.
+ */
+struct inpcb {
+ LIST_ENTRY(inpcb) inp_hash;
+ CIRCLEQ_ENTRY(inpcb) inp_queue;
+ struct inpcbtable *inp_table;
+ union inpaddru inp_faddru; /* Foreign address. */
+ union inpaddru inp_laddru; /* Local address. */
+#define inp_faddr inp_faddru.iau_a4u.inaddr
+#define inp_faddr6 inp_faddru.iau_addr6
+#define inp_laddr inp_laddru.iau_a4u.inaddr
+#define inp_laddr6 inp_laddru.iau_addr6
+ u_int16_t inp_fport; /* foreign port */
+ u_int16_t inp_lport; /* local port */
+ struct socket *inp_socket; /* back pointer to socket */
+ caddr_t inp_ppcb; /* pointer to per-protocol pcb */
+ union { /* Route (notice increased size). */
+ struct route ru_route;
+ struct route_in6 ru_route6;
+ } inp_ru;
+#define inp_route inp_ru.ru_route
+#define inp_route6 inp_ru.ru_route6
+ int inp_flags; /* generic IP/datagram flags */
+ union { /* Header prototype. */
+ struct ip hu_ip;
+ struct ip6_hdr hu_ipv6;
+ } inp_hu;
+#define inp_ip inp_hu.hu_ip
+#define inp_ipv6 inp_hu.hu_ipv6
+ struct mbuf *inp_options; /* IP options */
+ struct ip6_pktopts *inp_outputopts6; /* IP6 options for outgoing packets */
+ int inp_hops;
+ union {
+ struct ip_moptions *mou_mo; /* IPv4 multicast options */
+ struct ip6_moptions *mou_mo6; /* IPv6 multicast options */
+ } inp_mou;
+#define inp_moptions inp_mou.mou_mo
+#define inp_moptions6 inp_mou.mou_mo6
+ u_char inp_seclevel[3]; /* Only the first 3 are used for now */
+#define SL_AUTH 0 /* Authentication level */
+#define SL_ESP_TRANS 1 /* ESP transport level */
+#define SL_ESP_NETWORK 2 /* ESP network (encapsulation) level */
+ u_int8_t inp_secrequire:4, /* Condensed State from above */
+ inp_secresult:4; /* Result from Key Management */
+#define SR_FAILED 1 /* Negotiation failed permanently */
+#define SR_SUCCESS 2 /* SA successfully established */
+#define SR_WAIT 3 /* Waiting for SA */
+ TAILQ_ENTRY(inpcb) inp_tdb_next;
+ struct tdb *inp_tdb; /* If tdb_dst matches our dst, use */
+ int inp_fflowinfo; /* Foreign flowlabel & priority */
+ int inp_csumoffset;
+ struct icmp6_filter *inp_icmp6filt;
+#if 0 /*KAME IPSEC*/
+ struct secpolicy *inp_sp; /* security policy. It may not be
+ * used according to policy selection.
+ */
+#endif
+};
+
+struct inpcbtable {
+ CIRCLEQ_HEAD(, inpcb) inpt_queue;
+ LIST_HEAD(inpcbhead, inpcb) *inpt_hashtbl;
+ u_long inpt_hash;
+ u_int16_t inpt_lastport;
+};
+
+/* flags in inp_flags: */
+#define INP_RECVOPTS 0x001 /* receive incoming IP options */
+#define INP_RECVRETOPTS 0x002 /* receive IP options for reply */
+#define INP_RECVDSTADDR 0x004 /* receive IP dst address */
+
+#define INP_RXDSTOPTS INP_RECVOPTS
+#define INP_RXHOPOPTS INP_RECVRETOPTS
+#define INP_RXINFO INP_RECVDSTADDR
+#define INP_RXSRCRT 0x010
+#define INP_HOPLIMIT 0x020
+
+#define INP_CONTROLOPTS (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR| \
+ INP_RXSRCRT|INP_HOPLIMIT)
+
+#define INP_HDRINCL 0x008 /* user supplies entire IP header */
+#define INP_HIGHPORT 0x010 /* user wants "high" port binding */
+#define INP_LOWPORT 0x020 /* user wants "low" port binding */
+
+/*
+ * These flags' values should be determined by either the transport
+ * protocol at PRU_BIND, PRU_LISTEN, PRU_CONNECT, etc, or by in_pcb*().
+ */
+#define INP_IPV6 0x100 /* sotopf(inp->inp_socket) == PF_INET6 */
+#define INP_IPV6_UNDEC 0x200 /* PCB is PF_INET6, but listens for V4/V6 */
+#define INP_IPV6_MAPPED 0x400 /* PF_INET6 PCB which is connected to
+ * an IPv4 host, or is bound to
+ * an IPv4 address (specified with
+ * the mapped form of v6 addresses) */
+#define INP_IPV6_MCAST 0x800 /* Set if inp_moptions points to ipv6 ones */
+
+#if 1 /*KAME*/
+/* flags in in6p_flags */
+#define IN6P_RECVOPTS INP_RECVOPTS /* receive incoming IP6 options */
+#define IN6P_RECVRETOPTS INP_RECVRETOPTS /* receive IP6 options for reply */
+#define IN6P_RECVDSTADDR INP_RECVDSTADDR /* receive IP6 dst address */
+#define IN6P_HIGHPORT INP_HIGHPORT /* user wants "high" port binding */
+#define IN6P_LOWPORT INP_LOWPORT /* user wants "low" port binding */
+#define IN6P_ANONPORT 0x40 /* port chosen for user */
+#define IN6P_FAITH 0x80 /* accept FAITH'ed connections */
+#define IN6P_PKTINFO 0x010000
+#define IN6P_HOPLIMIT 0x020000
+#define IN6P_NEXTHOP 0x040000
+#define IN6P_HOPOPTS 0x080000
+#define IN6P_DSTOPTS 0x100000
+#define IN6P_RTHDR 0x200000
+#define IN6P_CONTROLOPTS (0x3f0000 | IN6P_RECVOPTS | IN6P_RECVRETOPTS | IN6P_RECVDSTADDR)
+#endif
+
+#define INPLOOKUP_WILDCARD 1
+#define INPLOOKUP_SETLOCAL 2
+#define INPLOOKUP_IPV6 4
+
+#define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb)
+
+/* macros for handling bitmap of ports not to allocate dynamically */
+#define DP_MAPBITS (sizeof(u_int32_t) * NBBY)
+#define DP_MAPSIZE (howmany(IPPORT_RESERVED/2, DP_MAPBITS))
+#define DP_SET(m, p) ((m)[((p) - IPPORT_RESERVED/2) / DP_MAPBITS] |= (1 << ((p) % DP_MAPBITS)))
+#define DP_CLR(m, p) ((m)[((p) - IPPORT_RESERVED/2) / DP_MAPBITS] &= ~(1 << ((p) % DP_MAPBITS)))
+#define DP_ISSET(m, p) ((m)[((p) - IPPORT_RESERVED/2) / DP_MAPBITS] & (1 << ((p) % DP_MAPBITS)))
+
+/* default values for baddynamicports [see ip_init()] */
+#define DEFBADDYNAMICPORTS_TCP { 749, 750, 751, 760, 761, 871, 0 }
+#define DEFBADDYNAMICPORTS_UDP { 750, 751, 0 }
+
+struct baddynamicports {
+ u_int32_t tcp[DP_MAPSIZE];
+ u_int32_t udp[DP_MAPSIZE];
+};
+
+#ifdef _KERNEL
+
+#define sotopf(so) (so->so_proto->pr_domain->dom_family)
+
+void in_losing __P((struct inpcb *));
+int in_pcballoc __P((struct socket *, void *));
+int in_pcbbind __P((void *, struct mbuf *));
+int in_pcbconnect __P((void *, struct mbuf *));
+void in_pcbdetach __P((void *));
+void in_pcbdisconnect __P((void *));
+struct inpcb *
+ in_pcbhashlookup __P((struct inpcbtable *, struct in_addr,
+ u_int, struct in_addr, u_int));
+#ifdef INET6
+struct inpcb *
+ in6_pcbhashlookup __P((struct inpcbtable *, struct in6_addr *,
+ u_int, struct in6_addr *, u_int));
+int in6_pcbbind __P((struct inpcb *, struct mbuf *));
+int in6_pcbconnect __P((struct inpcb *, struct mbuf *));
+int in6_setsockaddr __P((struct inpcb *, struct mbuf *));
+int in6_setpeeraddr __P((struct inpcb *, struct mbuf *));
+#endif /* INET6 */
+void in_pcbinit __P((struct inpcbtable *, int));
+struct inpcb *
+ in_pcblookup __P((struct inpcbtable *, void *, u_int, void *,
+ u_int, int));
+void in_pcbnotify __P((struct inpcbtable *, struct sockaddr *,
+ u_int, struct in_addr, u_int, int, void (*)(struct inpcb *, int)));
+void in_pcbnotifyall __P((struct inpcbtable *, struct sockaddr *,
+ int, void (*)(struct inpcb *, int)));
+void in_pcbrehash __P((struct inpcb *));
+void in_rtchange __P((struct inpcb *, int));
+void in_setpeeraddr __P((struct inpcb *, struct mbuf *));
+void in_setsockaddr __P((struct inpcb *, struct mbuf *));
+int in_baddynamic __P((u_int16_t, u_int16_t));
+extern struct sockaddr_in *in_selectsrc __P((struct sockaddr_in *,
+ struct route *, int, struct ip_moptions *, int *));
+
+/* INET6 stuff */
+int in6_pcbnotify __P((struct inpcbtable *, struct sockaddr *,
+ u_int, struct in6_addr *, u_int, int,
+ void (*)(struct inpcb *, int)));
+struct in6_addr *in6_selectsrc __P((struct sockaddr_in6 *,
+ struct ip6_pktopts *,
+ struct ip6_moptions *,
+ struct route_in6 *,
+ struct in6_addr *, int *));
+int in6_selecthlim __P((struct inpcb *, struct ifnet *));
+#endif
+
+#endif // _NETINET_IN_PCB_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/in_systm.h b/ecos/packages/net/tcpip/current/include/netinet/in_systm.h
new file mode 100644
index 0000000..77cba0a
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/in_systm.h
@@ -0,0 +1,93 @@
+//==========================================================================
+//
+// include/netinet/in_systm.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: in_systm.h,v 1.2 1997/02/24 14:06:35 niklas Exp $ */
+/* $NetBSD: in_systm.h,v 1.8 1995/04/13 06:29:22 cgd Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * 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.
+ *
+ * @(#)in_systm.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_IN_SYSTM_H_
+#define _NETINET_IN_SYSTM_H_
+
+/*
+ * Miscellaneous internetwork
+ * definitions for kernel.
+ */
+
+/*
+ * Network types.
+ *
+ * Internally the system keeps counters in the headers with the bytes
+ * swapped so that VAX instructions will work on them. It reverses
+ * the bytes before transmission at each protocol level. The n_ types
+ * represent the types with the bytes in ``high-ender'' order.
+ */
+typedef u_int16_t n_short; /* short as received from the net */
+typedef u_int32_t n_long; /* long as received from the net */
+
+typedef u_int32_t n_time; /* ms since 00:00 GMT, byte rev */
+
+#ifdef _KERNEL
+n_time iptime __P((void));
+#endif
+
+#endif // _NETINET_IN_SYSTM_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/in_var.h b/ecos/packages/net/tcpip/current/include/netinet/in_var.h
new file mode 100644
index 0000000..db2a44e
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/in_var.h
@@ -0,0 +1,254 @@
+//==========================================================================
+//
+// include/netinet/in_var.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: in_var.h,v 1.3 1999/12/08 06:50:19 itojun Exp $ */
+/* $NetBSD: in_var.h,v 1.16 1996/02/13 23:42:15 christos Exp $ */
+
+/*
+ * Copyright (c) 1985, 1986, 1993
+ * 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.
+ *
+ * @(#)in_var.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_IN_VAR_H_
+#define _NETINET_IN_VAR_H_
+
+#include <sys/queue.h>
+
+/*
+ * Interface address, Internet version. One of these structures
+ * is allocated for each interface with an Internet address.
+ * The ifaddr structure contains the protocol-independent part
+ * of the structure and is assumed to be first.
+ */
+struct in_ifaddr {
+ struct ifaddr ia_ifa; /* protocol-independent info */
+#define ia_ifp ia_ifa.ifa_ifp
+#define ia_flags ia_ifa.ifa_flags
+ /* ia_{,sub}net{,mask} in host order */
+ u_int32_t ia_net; /* network number of interface */
+ u_int32_t ia_netmask; /* mask of net part */
+ u_int32_t ia_subnet; /* subnet number, including net */
+ u_int32_t ia_subnetmask; /* mask of subnet part */
+ struct in_addr ia_netbroadcast; /* to recognize net broadcasts */
+ TAILQ_ENTRY(in_ifaddr) ia_list; /* list of internet addresses */
+ struct sockaddr_in ia_addr; /* reserve space for interface name */
+ struct sockaddr_in ia_dstaddr; /* reserve space for broadcast addr */
+#define ia_broadaddr ia_dstaddr
+ struct sockaddr_in ia_sockmask; /* reserve space for general netmask */
+ LIST_HEAD(, in_multi) ia_multiaddrs; /* list of multicast addresses */
+};
+
+struct in_aliasreq {
+ char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */
+ struct sockaddr_in ifra_addr;
+ struct sockaddr_in ifra_dstaddr;
+#define ifra_broadaddr ifra_dstaddr
+ struct sockaddr_in ifra_mask;
+};
+/*
+ * Given a pointer to an in_ifaddr (ifaddr),
+ * return a pointer to the addr as a sockaddr_in.
+ */
+#define IA_SIN(ia) (&(((struct in_ifaddr *)(ia))->ia_addr))
+
+
+#ifdef _KERNEL
+TAILQ_HEAD(in_ifaddrhead, in_ifaddr);
+extern struct in_ifaddrhead in_ifaddr;
+extern struct ifqueue ipintrq; /* ip packet input queue */
+extern int inetctlerrmap[];
+void in_socktrim __P((struct sockaddr_in *));
+
+
+/*
+ * Macro for finding the interface (ifnet structure) corresponding to one
+ * of our IP addresses.
+ */
+#define INADDR_TO_IFP(addr, ifp) \
+ /* struct in_addr addr; */ \
+ /* struct ifnet *ifp; */ \
+{ \
+ register struct in_ifaddr *ia; \
+\
+ for (ia = in_ifaddr.tqh_first; \
+ ia != NULL && ia->ia_addr.sin_addr.s_addr != (addr).s_addr; \
+ ia = ia->ia_list.tqe_next) \
+ continue; \
+ (ifp) = (ia == NULL) ? NULL : ia->ia_ifp; \
+}
+
+/*
+ * Macro for finding the internet address structure (in_ifaddr) corresponding
+ * to a given interface (ifnet structure).
+ */
+#define IFP_TO_IA(ifp, ia) \
+ /* struct ifnet *ifp; */ \
+ /* struct in_ifaddr *ia; */ \
+{ \
+ for ((ia) = in_ifaddr.tqh_first; \
+ (ia) != NULL && (ia)->ia_ifp != (ifp); \
+ (ia) = (ia)->ia_list.tqe_next) \
+ continue; \
+}
+#endif
+
+/*
+ * Per-interface router version information.
+ */
+struct router_info {
+ struct ifnet *rti_ifp;
+ int rti_type; /* type of router on this interface */
+ int rti_age; /* time since last v1 query */
+ struct router_info *rti_next;
+};
+
+/*
+ * Internet multicast address structure. There is one of these for each IP
+ * multicast group to which this host belongs on a given network interface.
+ * They are kept in a linked list, rooted in the interface's in_ifaddr
+ * structure.
+ */
+struct in_multi {
+ struct in_addr inm_addr; /* IP multicast address */
+ struct ifnet *inm_ifp; /* back pointer to ifnet */
+ struct in_ifaddr *inm_ia; /* back pointer to in_ifaddr */
+ u_int inm_refcount; /* no. membership claims by sockets */
+ u_int inm_timer; /* IGMP membership report timer */
+ LIST_ENTRY(in_multi) inm_list; /* list of multicast addresses */
+ u_int inm_state; /* state of membership */
+ struct router_info *inm_rti; /* router version info */
+};
+
+#ifdef _KERNEL
+/*
+ * Structure used by macros below to remember position when stepping through
+ * all of the in_multi records.
+ */
+struct in_multistep {
+ struct in_ifaddr *i_ia;
+ struct in_multi *i_inm;
+};
+
+/*
+ * Macro for looking up the in_multi record for a given IP multicast address
+ * on a given interface. If no matching record is found, "inm" returns NULL.
+ */
+#define IN_LOOKUP_MULTI(addr, ifp, inm) \
+ /* struct in_addr addr; */ \
+ /* struct ifnet *ifp; */ \
+ /* struct in_multi *inm; */ \
+{ \
+ register struct in_ifaddr *ia; \
+\
+ IFP_TO_IA((ifp), ia); \
+ if (ia == NULL) \
+ (inm) = NULL; \
+ else \
+ for ((inm) = ia->ia_multiaddrs.lh_first; \
+ (inm) != NULL && (inm)->inm_addr.s_addr != (addr).s_addr; \
+ (inm) = inm->inm_list.le_next) \
+ continue; \
+}
+
+/*
+ * Macro to step through all of the in_multi records, one at a time.
+ * The current position is remembered in "step", which the caller must
+ * provide. IN_FIRST_MULTI(), below, must be called to initialize "step"
+ * and get the first record. Both macros return a NULL "inm" when there
+ * are no remaining records.
+ */
+#define IN_NEXT_MULTI(step, inm) \
+ /* struct in_multistep step; */ \
+ /* struct in_multi *inm; */ \
+{ \
+ if (((inm) = (step).i_inm) != NULL) \
+ (step).i_inm = (inm)->inm_list.le_next; \
+ else \
+ while ((step).i_ia != NULL) { \
+ (inm) = (step).i_ia->ia_multiaddrs.lh_first; \
+ (step).i_ia = (step).i_ia->ia_list.tqe_next; \
+ if ((inm) != NULL) { \
+ (step).i_inm = (inm)->inm_list.le_next; \
+ break; \
+ } \
+ } \
+}
+
+#define IN_FIRST_MULTI(step, inm) \
+ /* struct in_multistep step; */ \
+ /* struct in_multi *inm; */ \
+{ \
+ (step).i_ia = in_ifaddr.tqh_first; \
+ (step).i_inm = NULL; \
+ IN_NEXT_MULTI((step), (inm)); \
+}
+
+int in_ifinit __P((struct ifnet *,
+ struct in_ifaddr *, struct sockaddr_in *, int));
+struct in_multi *in_addmulti __P((struct in_addr *, struct ifnet *));
+void in_delmulti __P((struct in_multi *));
+void in_ifscrub __P((struct ifnet *, struct in_ifaddr *));
+int in_control __P((struct socket *, u_long, caddr_t, struct ifnet *));
+#endif
+
+
+/* INET6 stuff */
+#include <netinet6/in6_var.h>
+
+#endif // _NETINET_IN_VAR_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/ip.h b/ecos/packages/net/tcpip/current/include/netinet/ip.h
new file mode 100644
index 0000000..4e4813b
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/ip.h
@@ -0,0 +1,223 @@
+//==========================================================================
+//
+// include/netinet/ip.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ip.h,v 1.6 1999/12/08 06:50:19 itojun Exp $ */
+/* $NetBSD: ip.h,v 1.9 1995/05/15 01:22:44 cgd Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * 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.
+ *
+ * @(#)ip.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_IP_H_
+#define _NETINET_IP_H_
+
+#include <netinet/in_systm.h>
+
+/*
+ * Definitions for internet protocol version 4.
+ * Per RFC 791, September 1981.
+ */
+#define IPVERSION 4
+
+/*
+ * Structure of an internet header, naked of options.
+ */
+struct ip {
+#if BYTE_ORDER == LITTLE_ENDIAN
+ u_int8_t ip_hl:4, /* header length */
+ ip_v:4; /* version */
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+ u_int8_t ip_v:4, /* version */
+ ip_hl:4; /* header length */
+#endif
+ u_int8_t ip_tos; /* type of service */
+ u_int16_t ip_len; /* total length */
+ u_int16_t ip_id; /* identification */
+ u_int16_t ip_off; /* fragment offset field */
+#define IP_RF 0x8000 /* reserved fragment flag */
+#define IP_DF 0x4000 /* dont fragment flag */
+#define IP_MF 0x2000 /* more fragments flag */
+#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
+ u_int8_t ip_ttl; /* time to live */
+ u_int8_t ip_p; /* protocol */
+ u_int16_t ip_sum; /* checksum */
+ struct in_addr ip_src, ip_dst; /* source and dest address */
+} __attribute__ ((aligned(1), packed));
+
+#define IP_MAXPACKET 65535 /* maximum packet size */
+
+/*
+ * Definitions for IP type of service (ip_tos)
+ */
+#define IPTOS_LOWDELAY 0x10
+#define IPTOS_THROUGHPUT 0x08
+#define IPTOS_RELIABILITY 0x04
+/* IPTOS_LOWCOST 0x02 XXX */
+#if 1
+/* ECN bits proposed by Sally Floyd */
+#define IPTOS_CE 0x01 /* congestion experienced */
+#define IPTOS_ECT 0x02 /* ECN-capable transport */
+#endif
+
+/*
+ * Definitions for IP precedence (also in ip_tos) (hopefully unused)
+ */
+#define IPTOS_PREC_NETCONTROL 0xe0
+#define IPTOS_PREC_INTERNETCONTROL 0xc0
+#define IPTOS_PREC_CRITIC_ECP 0xa0
+#define IPTOS_PREC_FLASHOVERRIDE 0x80
+#define IPTOS_PREC_FLASH 0x60
+#define IPTOS_PREC_IMMEDIATE 0x40
+#define IPTOS_PREC_PRIORITY 0x20
+#define IPTOS_PREC_ROUTINE 0x00
+
+/*
+ * Definitions for options.
+ */
+#define IPOPT_COPIED(o) ((o)&0x80)
+#define IPOPT_CLASS(o) ((o)&0x60)
+#define IPOPT_NUMBER(o) ((o)&0x1f)
+
+#define IPOPT_CONTROL 0x00
+#define IPOPT_RESERVED1 0x20
+#define IPOPT_DEBMEAS 0x40
+#define IPOPT_RESERVED2 0x60
+
+#define IPOPT_EOL 0 /* end of option list */
+#define IPOPT_NOP 1 /* no operation */
+
+#define IPOPT_RR 7 /* record packet route */
+#define IPOPT_TS 68 /* timestamp */
+#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */
+#define IPOPT_LSRR 131 /* loose source route */
+#define IPOPT_SATID 136 /* satnet id */
+#define IPOPT_SSRR 137 /* strict source route */
+
+/*
+ * Offsets to fields in options other than EOL and NOP.
+ */
+#define IPOPT_OPTVAL 0 /* option ID */
+#define IPOPT_OLEN 1 /* option length */
+#define IPOPT_OFFSET 2 /* offset within option */
+#define IPOPT_MINOFF 4 /* min value of above */
+
+/*
+ * Time stamp option structure.
+ */
+struct ip_timestamp {
+ u_int8_t ipt_code; /* IPOPT_TS */
+ u_int8_t ipt_len; /* size of structure (variable) */
+ u_int8_t ipt_ptr; /* index of current entry */
+#if BYTE_ORDER == LITTLE_ENDIAN
+ u_int8_t ipt_flg:4, /* flags, see below */
+ ipt_oflw:4; /* overflow counter */
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+ u_int8_t ipt_oflw:4, /* overflow counter */
+ ipt_flg:4; /* flags, see below */
+#endif
+ union ipt_timestamp {
+ n_time ipt_time[1];
+ struct ipt_ta {
+ struct in_addr ipt_addr;
+ n_time ipt_time;
+ } ipt_ta[1];
+ } ipt_timestamp;
+} __attribute__ ((aligned(1), packed));
+
+/* flag bits for ipt_flg */
+#define IPOPT_TS_TSONLY 0 /* timestamps only */
+#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
+#define IPOPT_TS_PRESPEC 3 /* specified modules only */
+
+/* bits for security (not byte swapped) */
+#define IPOPT_SECUR_UNCLASS 0x0000
+#define IPOPT_SECUR_CONFID 0xf135
+#define IPOPT_SECUR_EFTO 0x789a
+#define IPOPT_SECUR_MMMM 0xbc4d
+#define IPOPT_SECUR_RESTR 0xaf13
+#define IPOPT_SECUR_SECRET 0xd788
+#define IPOPT_SECUR_TOPSECRET 0x6bc5
+
+/*
+ * Internet implementation parameters.
+ */
+#define MAXTTL 255 /* maximum time to live (seconds) */
+#define IPDEFTTL 64 /* default ttl, from RFC 1340 */
+#define IPFRAGTTL 60 /* time to live for frags, slowhz */
+#define IPTTLDEC 1 /* subtracted when forwarding */
+
+#define IP_MSS 576 /* default maximum segment size */
+
+/*
+ * This is the real IPv4 psuedo header, used for computing the TCP and UDP
+ * checksums. For the Internet checksum, struct ipovly can be used instead.
+ * For stronger checksums, the real thing must be used.
+ */
+struct ippseudo {
+ struct in_addr ippseudo_src; /* source internet address */
+ struct in_addr ippseudo_dst; /* destination internet address */
+ u_int8_t ippseudo_pad; /* pad, must be zero */
+ u_int8_t ippseudo_p; /* protocol */
+ u_int16_t ippseudo_len; /* protocol length */
+} __attribute__ ((aligned(1), packed));
+
+#endif // _NETINET_IP_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/ip6.h b/ecos/packages/net/tcpip/current/include/netinet/ip6.h
new file mode 100644
index 0000000..2d91f94
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/ip6.h
@@ -0,0 +1,32 @@
+//==========================================================================
+//
+// include/netinet/ip6.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ip6.h,v 1.1 1999/12/08 06:50:19 itojun Exp $ */
+
+#include <netinet6/ip6.h>
diff --git a/ecos/packages/net/tcpip/current/include/netinet/ip_ah.h b/ecos/packages/net/tcpip/current/include/netinet/ip_ah.h
new file mode 100644
index 0000000..c958373
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/ip_ah.h
@@ -0,0 +1,145 @@
+//==========================================================================
+//
+// include/netinet/ip_ah.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ip_ah.h,v 1.19 1999/12/09 10:11:11 angelos Exp $ */
+
+/*
+ * The authors of this code are John Ioannidis (ji@tla.org),
+ * Angelos D. Keromytis (kermit@csd.uch.gr) and
+ * Niels Provos (provos@physnet.uni-hamburg.de).
+ *
+ * This code was written by John Ioannidis for BSD/OS in Athens, Greece,
+ * in November 1995.
+ *
+ * Ported to OpenBSD and NetBSD, with additional transforms, in December 1996,
+ * by Angelos D. Keromytis.
+ *
+ * Additional transforms and features in 1997 and 1998 by Angelos D. Keromytis
+ * and Niels Provos.
+ *
+ * Additional features in 1999 by Angelos D. Keromytis.
+ *
+ * Copyright (C) 1995, 1996, 1997, 1998, 1999 by John Ioannidis,
+ * Angelos D. Keromytis and Niels Provos.
+ *
+ * Permission to use, copy, and modify this software without fee
+ * is hereby granted, provided that this entire notice is included in
+ * all copies of any software which is or includes a copy or
+ * modification of this software.
+ * You may use this code under the GNU public license if you so wish. Please
+ * contribute changes back to the authors under this freer than GPL license
+ * so that we may further the use of strong encryption without limitations to
+ * all.
+ *
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
+ * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
+ * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
+ * PURPOSE.
+ */
+
+#ifndef _NETINET_IP_AH_H_
+#define _NETINET_IP_AH_H_
+
+/*
+ * Authentication Header Processing
+ * Per RFC1826 (Atkinson, 1995)
+ */
+
+struct ah_old
+{
+ u_int8_t ah_nh; /* Next header (protocol) */
+ u_int8_t ah_hl; /* AH length, in 32-bit words */
+ u_int16_t ah_rv; /* reserved, must be 0 */
+ u_int32_t ah_spi; /* Security Parameters Index */
+ u_int8_t ah_data[1]; /* More, really */
+};
+
+#define AH_OLD_FLENGTH 8 /* size of fixed part */
+
+struct ahstat
+{
+ u_int32_t ahs_hdrops; /* packet shorter than header shows */
+ u_int32_t ahs_notdb;
+ u_int32_t ahs_badkcr;
+ u_int32_t ahs_badauth;
+ u_int32_t ahs_noxform;
+ u_int32_t ahs_qfull;
+ u_int32_t ahs_wrap;
+ u_int32_t ahs_replay;
+ u_int32_t ahs_badauthl; /* bad authenticator length */
+ u_int32_t ahs_input; /* Input AH packets */
+ u_int32_t ahs_output; /* Output AH packets */
+ u_int32_t ahs_invalid; /* Trying to use an invalid TDB */
+ u_int64_t ahs_ibytes; /* input bytes */
+ u_int64_t ahs_obytes; /* output bytes */
+ u_int32_t ahs_toobig; /* packet got larger than IP_MAXPACKET */
+ u_int32_t ahs_pdrops; /* packet blocked due to policy */
+};
+
+struct ah_new
+{
+ u_int8_t ah_nh; /* Next header (protocol) */
+ u_int8_t ah_hl; /* AH length, in 32-bit words */
+ u_int16_t ah_rv; /* reserved, must be 0 */
+ u_int32_t ah_spi; /* Security Parameters Index */
+ u_int32_t ah_rpl; /* Replay prevention */
+ u_int8_t ah_data[AH_HMAC_HASHLEN];/* Authenticator */
+};
+
+#define AH_NEW_FLENGTH (sizeof(struct ah_new))
+
+/* Size of the largest hash function output used in AH-new, in bytes */
+#define AH_MAX_HASHLEN 20
+
+/*
+ * Names for AH sysctl objects
+ */
+#define AHCTL_ENABLE 1 /* Enable AH processing */
+#define AHCTL_MAXID 2
+
+#define AHCTL_NAMES { \
+ { 0, 0 }, \
+ { "enable", CTLTYPE_INT }, \
+}
+
+#ifdef _KERNEL
+void ah_input __P((struct mbuf *, ...));
+int ah_output __P((struct mbuf *, struct tdb *, struct mbuf **));
+int ah_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
+
+#ifdef INET6
+void ah6_input __P((struct mbuf *, ...));
+#endif /* INET6 */
+
+extern int ah_enable;
+struct ahstat ahstat;
+#endif /* _KERNEL */
+
+#endif // _NETINET_IP_AH_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/ip_auth.h b/ecos/packages/net/tcpip/current/include/netinet/ip_auth.h
new file mode 100644
index 0000000..3324621
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/ip_auth.h
@@ -0,0 +1,96 @@
+//==========================================================================
+//
+// include/netinet/ip_auth.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ip_auth.h,v 1.4 1999/12/15 05:20:21 kjell Exp $ */
+/*
+ * Copyright (C) 1997-1998 by Darren Reed & Guido Van Rooij.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and due credit is given
+ * to the original author and the contributors.
+ *
+ */
+
+#ifndef _NETINET_IP_AUTH_H__
+#define _NETINET_IP_AUTH_H__
+
+#define FR_NUMAUTH 32
+
+typedef struct frauth {
+ int fra_age;
+ int fra_index;
+ u_32_t fra_pass;
+ fr_info_t fra_info;
+#if SOLARIS
+ queue_t *fra_q;
+#endif
+} frauth_t;
+
+typedef struct frauthent {
+ struct frentry fae_fr;
+ struct frauthent *fae_next;
+ u_long fae_age;
+} frauthent_t;
+
+typedef struct fr_authstat {
+ U_QUAD_T fas_hits;
+ U_QUAD_T fas_miss;
+ u_long fas_nospace;
+ u_long fas_added;
+ u_long fas_sendfail;
+ u_long fas_sendok;
+ u_long fas_queok;
+ u_long fas_quefail;
+ u_long fas_expire;
+ frauthent_t *fas_faelist;
+} fr_authstat_t;
+
+
+extern frentry_t *ipauth;
+extern struct fr_authstat fr_authstats;
+extern int fr_defaultauthage;
+extern int fr_authstart;
+extern int fr_authend;
+extern int fr_authsize;
+extern int fr_authused;
+extern u_32_t fr_checkauth __P((ip_t *, fr_info_t *));
+extern void fr_authexpire __P((void));
+extern void fr_authunload __P((void));
+extern mb_t *fr_authpkts[];
+#if defined(_KERNEL) && SOLARIS
+extern int fr_newauth __P((mb_t *, fr_info_t *, ip_t *, qif_t *));
+#else
+extern int fr_newauth __P((mb_t *, fr_info_t *, ip_t *));
+#endif
+#if defined(__NetBSD__) || defined(__OpenBSD__)
+extern int fr_auth_ioctl __P((caddr_t, u_long, frentry_t *, frentry_t **));
+#else
+extern int fr_auth_ioctl __P((caddr_t, int, frentry_t *, frentry_t **));
+#endif
+#endif /* _NETINET_IP_AUTH_H__ */
diff --git a/ecos/packages/net/tcpip/current/include/netinet/ip_blf.h b/ecos/packages/net/tcpip/current/include/netinet/ip_blf.h
new file mode 100644
index 0000000..c08fd2b
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/ip_blf.h
@@ -0,0 +1,108 @@
+//==========================================================================
+//
+// include/netinet/ip_blf.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ip_blf.h,v 1.2 1999/02/23 05:15:09 angelos Exp $ */
+/*
+ * Blowfish - a fast block cipher designed by Bruce Schneier
+ *
+ * Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
+ * 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 Niels Provos.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+
+#ifndef _NETINET_IP_BLF_H_
+#define _NETINET_IP_BLF_H_
+
+/* Schneier states the maximum key length to be 56 bytes.
+ * The way how the subkeys are initalized by the key up
+ * to (N+2)*4 i.e. 72 bytes are utilized.
+ * Warning: For normal blowfish encryption only 56 bytes
+ * of the key affect all cipherbits.
+ */
+
+#define BLF_N 16 /* Number of Subkeys */
+#define BLF_MAXKEYLEN ((BLF_N-2)*4) /* 448 bits */
+
+/* Blowfish context */
+typedef struct BlowfishContext {
+ u_int32_t S[4][256]; /* S-Boxes */
+ u_int32_t P[BLF_N + 2]; /* Subkeys */
+} blf_ctx;
+
+/* Raw access to customized Blowfish
+ * blf_key is just:
+ * Blowfish_initstate( state )
+ * Blowfish_expand0state( state, key, keylen )
+ */
+
+void Blowfish_encipher __P((blf_ctx *, u_int32_t *, u_int32_t *));
+void Blowfish_decipher __P((blf_ctx *, u_int32_t *, u_int32_t *));
+void Blowfish_initstate __P((blf_ctx *));
+void Blowfish_expand0state __P((blf_ctx *, const u_int8_t *, u_int16_t));
+void Blowfish_expandstate
+ __P((blf_ctx *, const u_int8_t *, u_int16_t, const u_int8_t *, u_int16_t));
+
+/* Standard Blowfish */
+
+void blf_key __P((blf_ctx *, const u_int8_t *, u_int16_t));
+void blf_enc __P((blf_ctx *, u_int32_t *, u_int16_t));
+void blf_dec __P((blf_ctx *, u_int32_t *, u_int16_t));
+
+/* Converts u_int8_t to u_int32_t */
+u_int32_t Blowfish_stream2word __P((const u_int8_t *, u_int16_t ,
+ u_int16_t *));
+
+void blf_ecb_encrypt __P((blf_ctx *, u_int8_t *, u_int32_t));
+void blf_ecb_decrypt __P((blf_ctx *, u_int8_t *, u_int32_t));
+
+#endif // _NETINET_IP_BLF_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/ip_cast.h b/ecos/packages/net/tcpip/current/include/netinet/ip_cast.h
new file mode 100644
index 0000000..4df26fd
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/ip_cast.h
@@ -0,0 +1,51 @@
+//==========================================================================
+//
+// include/netinet/ip_cast.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ip_cast.h,v 1.3 1999/02/17 18:09:55 deraadt Exp $ */
+
+/*
+ * CAST-128 in C
+ * Written by Steve Reid <sreid@sea-to-sky.net>
+ * 100% Public Domain - no warranty
+ * Released 1997.10.11
+ */
+
+#ifndef _NETINET_IP_CAST_H_
+#define _NETINET_IP_CAST_H_
+
+typedef struct {
+ u_int32_t xkey[32]; /* Key, after expansion */
+ int rounds; /* Number of rounds to use, 12 or 16 */
+} cast_key;
+
+void cast_setkey __P((cast_key * key, u_int8_t * rawkey, int keybytes));
+void cast_encrypt __P((cast_key * key, u_int8_t * inblock, u_int8_t * outblock));
+void cast_decrypt __P((cast_key * key, u_int8_t * inblock, u_int8_t * outblock));
+
+#endif /* ifndef _NETINET_IP_CAST_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/netinet/ip_castsb.h b/ecos/packages/net/tcpip/current/include/netinet/ip_castsb.h
new file mode 100644
index 0000000..7447e77
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/ip_castsb.h
@@ -0,0 +1,577 @@
+//==========================================================================
+//
+// include/netinet/ip_castsb.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ip_castsb.h,v 1.2 1999/02/17 18:09:55 deraadt Exp $ */
+/*
+ * CAST-128 in C
+ * Written by Steve Reid <sreid@sea-to-sky.net>
+ * 100% Public Domain - no warranty
+ * Released 1997.10.11
+ */
+
+#ifndef _NETINET_IP_CASTSB_H_
+#define _NETINET_IP_CASTSB_H_
+
+static const u_int32_t cast_sbox1[256] = {
+ 0x30FB40D4, 0x9FA0FF0B, 0x6BECCD2F, 0x3F258C7A,
+ 0x1E213F2F, 0x9C004DD3, 0x6003E540, 0xCF9FC949,
+ 0xBFD4AF27, 0x88BBBDB5, 0xE2034090, 0x98D09675,
+ 0x6E63A0E0, 0x15C361D2, 0xC2E7661D, 0x22D4FF8E,
+ 0x28683B6F, 0xC07FD059, 0xFF2379C8, 0x775F50E2,
+ 0x43C340D3, 0xDF2F8656, 0x887CA41A, 0xA2D2BD2D,
+ 0xA1C9E0D6, 0x346C4819, 0x61B76D87, 0x22540F2F,
+ 0x2ABE32E1, 0xAA54166B, 0x22568E3A, 0xA2D341D0,
+ 0x66DB40C8, 0xA784392F, 0x004DFF2F, 0x2DB9D2DE,
+ 0x97943FAC, 0x4A97C1D8, 0x527644B7, 0xB5F437A7,
+ 0xB82CBAEF, 0xD751D159, 0x6FF7F0ED, 0x5A097A1F,
+ 0x827B68D0, 0x90ECF52E, 0x22B0C054, 0xBC8E5935,
+ 0x4B6D2F7F, 0x50BB64A2, 0xD2664910, 0xBEE5812D,
+ 0xB7332290, 0xE93B159F, 0xB48EE411, 0x4BFF345D,
+ 0xFD45C240, 0xAD31973F, 0xC4F6D02E, 0x55FC8165,
+ 0xD5B1CAAD, 0xA1AC2DAE, 0xA2D4B76D, 0xC19B0C50,
+ 0x882240F2, 0x0C6E4F38, 0xA4E4BFD7, 0x4F5BA272,
+ 0x564C1D2F, 0xC59C5319, 0xB949E354, 0xB04669FE,
+ 0xB1B6AB8A, 0xC71358DD, 0x6385C545, 0x110F935D,
+ 0x57538AD5, 0x6A390493, 0xE63D37E0, 0x2A54F6B3,
+ 0x3A787D5F, 0x6276A0B5, 0x19A6FCDF, 0x7A42206A,
+ 0x29F9D4D5, 0xF61B1891, 0xBB72275E, 0xAA508167,
+ 0x38901091, 0xC6B505EB, 0x84C7CB8C, 0x2AD75A0F,
+ 0x874A1427, 0xA2D1936B, 0x2AD286AF, 0xAA56D291,
+ 0xD7894360, 0x425C750D, 0x93B39E26, 0x187184C9,
+ 0x6C00B32D, 0x73E2BB14, 0xA0BEBC3C, 0x54623779,
+ 0x64459EAB, 0x3F328B82, 0x7718CF82, 0x59A2CEA6,
+ 0x04EE002E, 0x89FE78E6, 0x3FAB0950, 0x325FF6C2,
+ 0x81383F05, 0x6963C5C8, 0x76CB5AD6, 0xD49974C9,
+ 0xCA180DCF, 0x380782D5, 0xC7FA5CF6, 0x8AC31511,
+ 0x35E79E13, 0x47DA91D0, 0xF40F9086, 0xA7E2419E,
+ 0x31366241, 0x051EF495, 0xAA573B04, 0x4A805D8D,
+ 0x548300D0, 0x00322A3C, 0xBF64CDDF, 0xBA57A68E,
+ 0x75C6372B, 0x50AFD341, 0xA7C13275, 0x915A0BF5,
+ 0x6B54BFAB, 0x2B0B1426, 0xAB4CC9D7, 0x449CCD82,
+ 0xF7FBF265, 0xAB85C5F3, 0x1B55DB94, 0xAAD4E324,
+ 0xCFA4BD3F, 0x2DEAA3E2, 0x9E204D02, 0xC8BD25AC,
+ 0xEADF55B3, 0xD5BD9E98, 0xE31231B2, 0x2AD5AD6C,
+ 0x954329DE, 0xADBE4528, 0xD8710F69, 0xAA51C90F,
+ 0xAA786BF6, 0x22513F1E, 0xAA51A79B, 0x2AD344CC,
+ 0x7B5A41F0, 0xD37CFBAD, 0x1B069505, 0x41ECE491,
+ 0xB4C332E6, 0x032268D4, 0xC9600ACC, 0xCE387E6D,
+ 0xBF6BB16C, 0x6A70FB78, 0x0D03D9C9, 0xD4DF39DE,
+ 0xE01063DA, 0x4736F464, 0x5AD328D8, 0xB347CC96,
+ 0x75BB0FC3, 0x98511BFB, 0x4FFBCC35, 0xB58BCF6A,
+ 0xE11F0ABC, 0xBFC5FE4A, 0xA70AEC10, 0xAC39570A,
+ 0x3F04442F, 0x6188B153, 0xE0397A2E, 0x5727CB79,
+ 0x9CEB418F, 0x1CACD68D, 0x2AD37C96, 0x0175CB9D,
+ 0xC69DFF09, 0xC75B65F0, 0xD9DB40D8, 0xEC0E7779,
+ 0x4744EAD4, 0xB11C3274, 0xDD24CB9E, 0x7E1C54BD,
+ 0xF01144F9, 0xD2240EB1, 0x9675B3FD, 0xA3AC3755,
+ 0xD47C27AF, 0x51C85F4D, 0x56907596, 0xA5BB15E6,
+ 0x580304F0, 0xCA042CF1, 0x011A37EA, 0x8DBFAADB,
+ 0x35BA3E4A, 0x3526FFA0, 0xC37B4D09, 0xBC306ED9,
+ 0x98A52666, 0x5648F725, 0xFF5E569D, 0x0CED63D0,
+ 0x7C63B2CF, 0x700B45E1, 0xD5EA50F1, 0x85A92872,
+ 0xAF1FBDA7, 0xD4234870, 0xA7870BF3, 0x2D3B4D79,
+ 0x42E04198, 0x0CD0EDE7, 0x26470DB8, 0xF881814C,
+ 0x474D6AD7, 0x7C0C5E5C, 0xD1231959, 0x381B7298,
+ 0xF5D2F4DB, 0xAB838653, 0x6E2F1E23, 0x83719C9E,
+ 0xBD91E046, 0x9A56456E, 0xDC39200C, 0x20C8C571,
+ 0x962BDA1C, 0xE1E696FF, 0xB141AB08, 0x7CCA89B9,
+ 0x1A69E783, 0x02CC4843, 0xA2F7C579, 0x429EF47D,
+ 0x427B169C, 0x5AC9F049, 0xDD8F0F00, 0x5C8165BF
+};
+
+static const u_int32_t cast_sbox2[256] = {
+ 0x1F201094, 0xEF0BA75B, 0x69E3CF7E, 0x393F4380,
+ 0xFE61CF7A, 0xEEC5207A, 0x55889C94, 0x72FC0651,
+ 0xADA7EF79, 0x4E1D7235, 0xD55A63CE, 0xDE0436BA,
+ 0x99C430EF, 0x5F0C0794, 0x18DCDB7D, 0xA1D6EFF3,
+ 0xA0B52F7B, 0x59E83605, 0xEE15B094, 0xE9FFD909,
+ 0xDC440086, 0xEF944459, 0xBA83CCB3, 0xE0C3CDFB,
+ 0xD1DA4181, 0x3B092AB1, 0xF997F1C1, 0xA5E6CF7B,
+ 0x01420DDB, 0xE4E7EF5B, 0x25A1FF41, 0xE180F806,
+ 0x1FC41080, 0x179BEE7A, 0xD37AC6A9, 0xFE5830A4,
+ 0x98DE8B7F, 0x77E83F4E, 0x79929269, 0x24FA9F7B,
+ 0xE113C85B, 0xACC40083, 0xD7503525, 0xF7EA615F,
+ 0x62143154, 0x0D554B63, 0x5D681121, 0xC866C359,
+ 0x3D63CF73, 0xCEE234C0, 0xD4D87E87, 0x5C672B21,
+ 0x071F6181, 0x39F7627F, 0x361E3084, 0xE4EB573B,
+ 0x602F64A4, 0xD63ACD9C, 0x1BBC4635, 0x9E81032D,
+ 0x2701F50C, 0x99847AB4, 0xA0E3DF79, 0xBA6CF38C,
+ 0x10843094, 0x2537A95E, 0xF46F6FFE, 0xA1FF3B1F,
+ 0x208CFB6A, 0x8F458C74, 0xD9E0A227, 0x4EC73A34,
+ 0xFC884F69, 0x3E4DE8DF, 0xEF0E0088, 0x3559648D,
+ 0x8A45388C, 0x1D804366, 0x721D9BFD, 0xA58684BB,
+ 0xE8256333, 0x844E8212, 0x128D8098, 0xFED33FB4,
+ 0xCE280AE1, 0x27E19BA5, 0xD5A6C252, 0xE49754BD,
+ 0xC5D655DD, 0xEB667064, 0x77840B4D, 0xA1B6A801,
+ 0x84DB26A9, 0xE0B56714, 0x21F043B7, 0xE5D05860,
+ 0x54F03084, 0x066FF472, 0xA31AA153, 0xDADC4755,
+ 0xB5625DBF, 0x68561BE6, 0x83CA6B94, 0x2D6ED23B,
+ 0xECCF01DB, 0xA6D3D0BA, 0xB6803D5C, 0xAF77A709,
+ 0x33B4A34C, 0x397BC8D6, 0x5EE22B95, 0x5F0E5304,
+ 0x81ED6F61, 0x20E74364, 0xB45E1378, 0xDE18639B,
+ 0x881CA122, 0xB96726D1, 0x8049A7E8, 0x22B7DA7B,
+ 0x5E552D25, 0x5272D237, 0x79D2951C, 0xC60D894C,
+ 0x488CB402, 0x1BA4FE5B, 0xA4B09F6B, 0x1CA815CF,
+ 0xA20C3005, 0x8871DF63, 0xB9DE2FCB, 0x0CC6C9E9,
+ 0x0BEEFF53, 0xE3214517, 0xB4542835, 0x9F63293C,
+ 0xEE41E729, 0x6E1D2D7C, 0x50045286, 0x1E6685F3,
+ 0xF33401C6, 0x30A22C95, 0x31A70850, 0x60930F13,
+ 0x73F98417, 0xA1269859, 0xEC645C44, 0x52C877A9,
+ 0xCDFF33A6, 0xA02B1741, 0x7CBAD9A2, 0x2180036F,
+ 0x50D99C08, 0xCB3F4861, 0xC26BD765, 0x64A3F6AB,
+ 0x80342676, 0x25A75E7B, 0xE4E6D1FC, 0x20C710E6,
+ 0xCDF0B680, 0x17844D3B, 0x31EEF84D, 0x7E0824E4,
+ 0x2CCB49EB, 0x846A3BAE, 0x8FF77888, 0xEE5D60F6,
+ 0x7AF75673, 0x2FDD5CDB, 0xA11631C1, 0x30F66F43,
+ 0xB3FAEC54, 0x157FD7FA, 0xEF8579CC, 0xD152DE58,
+ 0xDB2FFD5E, 0x8F32CE19, 0x306AF97A, 0x02F03EF8,
+ 0x99319AD5, 0xC242FA0F, 0xA7E3EBB0, 0xC68E4906,
+ 0xB8DA230C, 0x80823028, 0xDCDEF3C8, 0xD35FB171,
+ 0x088A1BC8, 0xBEC0C560, 0x61A3C9E8, 0xBCA8F54D,
+ 0xC72FEFFA, 0x22822E99, 0x82C570B4, 0xD8D94E89,
+ 0x8B1C34BC, 0x301E16E6, 0x273BE979, 0xB0FFEAA6,
+ 0x61D9B8C6, 0x00B24869, 0xB7FFCE3F, 0x08DC283B,
+ 0x43DAF65A, 0xF7E19798, 0x7619B72F, 0x8F1C9BA4,
+ 0xDC8637A0, 0x16A7D3B1, 0x9FC393B7, 0xA7136EEB,
+ 0xC6BCC63E, 0x1A513742, 0xEF6828BC, 0x520365D6,
+ 0x2D6A77AB, 0x3527ED4B, 0x821FD216, 0x095C6E2E,
+ 0xDB92F2FB, 0x5EEA29CB, 0x145892F5, 0x91584F7F,
+ 0x5483697B, 0x2667A8CC, 0x85196048, 0x8C4BACEA,
+ 0x833860D4, 0x0D23E0F9, 0x6C387E8A, 0x0AE6D249,
+ 0xB284600C, 0xD835731D, 0xDCB1C647, 0xAC4C56EA,
+ 0x3EBD81B3, 0x230EABB0, 0x6438BC87, 0xF0B5B1FA,
+ 0x8F5EA2B3, 0xFC184642, 0x0A036B7A, 0x4FB089BD,
+ 0x649DA589, 0xA345415E, 0x5C038323, 0x3E5D3BB9,
+ 0x43D79572, 0x7E6DD07C, 0x06DFDF1E, 0x6C6CC4EF,
+ 0x7160A539, 0x73BFBE70, 0x83877605, 0x4523ECF1
+};
+
+static const u_int32_t cast_sbox3[256] = {
+ 0x8DEFC240, 0x25FA5D9F, 0xEB903DBF, 0xE810C907,
+ 0x47607FFF, 0x369FE44B, 0x8C1FC644, 0xAECECA90,
+ 0xBEB1F9BF, 0xEEFBCAEA, 0xE8CF1950, 0x51DF07AE,
+ 0x920E8806, 0xF0AD0548, 0xE13C8D83, 0x927010D5,
+ 0x11107D9F, 0x07647DB9, 0xB2E3E4D4, 0x3D4F285E,
+ 0xB9AFA820, 0xFADE82E0, 0xA067268B, 0x8272792E,
+ 0x553FB2C0, 0x489AE22B, 0xD4EF9794, 0x125E3FBC,
+ 0x21FFFCEE, 0x825B1BFD, 0x9255C5ED, 0x1257A240,
+ 0x4E1A8302, 0xBAE07FFF, 0x528246E7, 0x8E57140E,
+ 0x3373F7BF, 0x8C9F8188, 0xA6FC4EE8, 0xC982B5A5,
+ 0xA8C01DB7, 0x579FC264, 0x67094F31, 0xF2BD3F5F,
+ 0x40FFF7C1, 0x1FB78DFC, 0x8E6BD2C1, 0x437BE59B,
+ 0x99B03DBF, 0xB5DBC64B, 0x638DC0E6, 0x55819D99,
+ 0xA197C81C, 0x4A012D6E, 0xC5884A28, 0xCCC36F71,
+ 0xB843C213, 0x6C0743F1, 0x8309893C, 0x0FEDDD5F,
+ 0x2F7FE850, 0xD7C07F7E, 0x02507FBF, 0x5AFB9A04,
+ 0xA747D2D0, 0x1651192E, 0xAF70BF3E, 0x58C31380,
+ 0x5F98302E, 0x727CC3C4, 0x0A0FB402, 0x0F7FEF82,
+ 0x8C96FDAD, 0x5D2C2AAE, 0x8EE99A49, 0x50DA88B8,
+ 0x8427F4A0, 0x1EAC5790, 0x796FB449, 0x8252DC15,
+ 0xEFBD7D9B, 0xA672597D, 0xADA840D8, 0x45F54504,
+ 0xFA5D7403, 0xE83EC305, 0x4F91751A, 0x925669C2,
+ 0x23EFE941, 0xA903F12E, 0x60270DF2, 0x0276E4B6,
+ 0x94FD6574, 0x927985B2, 0x8276DBCB, 0x02778176,
+ 0xF8AF918D, 0x4E48F79E, 0x8F616DDF, 0xE29D840E,
+ 0x842F7D83, 0x340CE5C8, 0x96BBB682, 0x93B4B148,
+ 0xEF303CAB, 0x984FAF28, 0x779FAF9B, 0x92DC560D,
+ 0x224D1E20, 0x8437AA88, 0x7D29DC96, 0x2756D3DC,
+ 0x8B907CEE, 0xB51FD240, 0xE7C07CE3, 0xE566B4A1,
+ 0xC3E9615E, 0x3CF8209D, 0x6094D1E3, 0xCD9CA341,
+ 0x5C76460E, 0x00EA983B, 0xD4D67881, 0xFD47572C,
+ 0xF76CEDD9, 0xBDA8229C, 0x127DADAA, 0x438A074E,
+ 0x1F97C090, 0x081BDB8A, 0x93A07EBE, 0xB938CA15,
+ 0x97B03CFF, 0x3DC2C0F8, 0x8D1AB2EC, 0x64380E51,
+ 0x68CC7BFB, 0xD90F2788, 0x12490181, 0x5DE5FFD4,
+ 0xDD7EF86A, 0x76A2E214, 0xB9A40368, 0x925D958F,
+ 0x4B39FFFA, 0xBA39AEE9, 0xA4FFD30B, 0xFAF7933B,
+ 0x6D498623, 0x193CBCFA, 0x27627545, 0x825CF47A,
+ 0x61BD8BA0, 0xD11E42D1, 0xCEAD04F4, 0x127EA392,
+ 0x10428DB7, 0x8272A972, 0x9270C4A8, 0x127DE50B,
+ 0x285BA1C8, 0x3C62F44F, 0x35C0EAA5, 0xE805D231,
+ 0x428929FB, 0xB4FCDF82, 0x4FB66A53, 0x0E7DC15B,
+ 0x1F081FAB, 0x108618AE, 0xFCFD086D, 0xF9FF2889,
+ 0x694BCC11, 0x236A5CAE, 0x12DECA4D, 0x2C3F8CC5,
+ 0xD2D02DFE, 0xF8EF5896, 0xE4CF52DA, 0x95155B67,
+ 0x494A488C, 0xB9B6A80C, 0x5C8F82BC, 0x89D36B45,
+ 0x3A609437, 0xEC00C9A9, 0x44715253, 0x0A874B49,
+ 0xD773BC40, 0x7C34671C, 0x02717EF6, 0x4FEB5536,
+ 0xA2D02FFF, 0xD2BF60C4, 0xD43F03C0, 0x50B4EF6D,
+ 0x07478CD1, 0x006E1888, 0xA2E53F55, 0xB9E6D4BC,
+ 0xA2048016, 0x97573833, 0xD7207D67, 0xDE0F8F3D,
+ 0x72F87B33, 0xABCC4F33, 0x7688C55D, 0x7B00A6B0,
+ 0x947B0001, 0x570075D2, 0xF9BB88F8, 0x8942019E,
+ 0x4264A5FF, 0x856302E0, 0x72DBD92B, 0xEE971B69,
+ 0x6EA22FDE, 0x5F08AE2B, 0xAF7A616D, 0xE5C98767,
+ 0xCF1FEBD2, 0x61EFC8C2, 0xF1AC2571, 0xCC8239C2,
+ 0x67214CB8, 0xB1E583D1, 0xB7DC3E62, 0x7F10BDCE,
+ 0xF90A5C38, 0x0FF0443D, 0x606E6DC6, 0x60543A49,
+ 0x5727C148, 0x2BE98A1D, 0x8AB41738, 0x20E1BE24,
+ 0xAF96DA0F, 0x68458425, 0x99833BE5, 0x600D457D,
+ 0x282F9350, 0x8334B362, 0xD91D1120, 0x2B6D8DA0,
+ 0x642B1E31, 0x9C305A00, 0x52BCE688, 0x1B03588A,
+ 0xF7BAEFD5, 0x4142ED9C, 0xA4315C11, 0x83323EC5,
+ 0xDFEF4636, 0xA133C501, 0xE9D3531C, 0xEE353783
+};
+
+static const u_int32_t cast_sbox4[256] = {
+ 0x9DB30420, 0x1FB6E9DE, 0xA7BE7BEF, 0xD273A298,
+ 0x4A4F7BDB, 0x64AD8C57, 0x85510443, 0xFA020ED1,
+ 0x7E287AFF, 0xE60FB663, 0x095F35A1, 0x79EBF120,
+ 0xFD059D43, 0x6497B7B1, 0xF3641F63, 0x241E4ADF,
+ 0x28147F5F, 0x4FA2B8CD, 0xC9430040, 0x0CC32220,
+ 0xFDD30B30, 0xC0A5374F, 0x1D2D00D9, 0x24147B15,
+ 0xEE4D111A, 0x0FCA5167, 0x71FF904C, 0x2D195FFE,
+ 0x1A05645F, 0x0C13FEFE, 0x081B08CA, 0x05170121,
+ 0x80530100, 0xE83E5EFE, 0xAC9AF4F8, 0x7FE72701,
+ 0xD2B8EE5F, 0x06DF4261, 0xBB9E9B8A, 0x7293EA25,
+ 0xCE84FFDF, 0xF5718801, 0x3DD64B04, 0xA26F263B,
+ 0x7ED48400, 0x547EEBE6, 0x446D4CA0, 0x6CF3D6F5,
+ 0x2649ABDF, 0xAEA0C7F5, 0x36338CC1, 0x503F7E93,
+ 0xD3772061, 0x11B638E1, 0x72500E03, 0xF80EB2BB,
+ 0xABE0502E, 0xEC8D77DE, 0x57971E81, 0xE14F6746,
+ 0xC9335400, 0x6920318F, 0x081DBB99, 0xFFC304A5,
+ 0x4D351805, 0x7F3D5CE3, 0xA6C866C6, 0x5D5BCCA9,
+ 0xDAEC6FEA, 0x9F926F91, 0x9F46222F, 0x3991467D,
+ 0xA5BF6D8E, 0x1143C44F, 0x43958302, 0xD0214EEB,
+ 0x022083B8, 0x3FB6180C, 0x18F8931E, 0x281658E6,
+ 0x26486E3E, 0x8BD78A70, 0x7477E4C1, 0xB506E07C,
+ 0xF32D0A25, 0x79098B02, 0xE4EABB81, 0x28123B23,
+ 0x69DEAD38, 0x1574CA16, 0xDF871B62, 0x211C40B7,
+ 0xA51A9EF9, 0x0014377B, 0x041E8AC8, 0x09114003,
+ 0xBD59E4D2, 0xE3D156D5, 0x4FE876D5, 0x2F91A340,
+ 0x557BE8DE, 0x00EAE4A7, 0x0CE5C2EC, 0x4DB4BBA6,
+ 0xE756BDFF, 0xDD3369AC, 0xEC17B035, 0x06572327,
+ 0x99AFC8B0, 0x56C8C391, 0x6B65811C, 0x5E146119,
+ 0x6E85CB75, 0xBE07C002, 0xC2325577, 0x893FF4EC,
+ 0x5BBFC92D, 0xD0EC3B25, 0xB7801AB7, 0x8D6D3B24,
+ 0x20C763EF, 0xC366A5FC, 0x9C382880, 0x0ACE3205,
+ 0xAAC9548A, 0xECA1D7C7, 0x041AFA32, 0x1D16625A,
+ 0x6701902C, 0x9B757A54, 0x31D477F7, 0x9126B031,
+ 0x36CC6FDB, 0xC70B8B46, 0xD9E66A48, 0x56E55A79,
+ 0x026A4CEB, 0x52437EFF, 0x2F8F76B4, 0x0DF980A5,
+ 0x8674CDE3, 0xEDDA04EB, 0x17A9BE04, 0x2C18F4DF,
+ 0xB7747F9D, 0xAB2AF7B4, 0xEFC34D20, 0x2E096B7C,
+ 0x1741A254, 0xE5B6A035, 0x213D42F6, 0x2C1C7C26,
+ 0x61C2F50F, 0x6552DAF9, 0xD2C231F8, 0x25130F69,
+ 0xD8167FA2, 0x0418F2C8, 0x001A96A6, 0x0D1526AB,
+ 0x63315C21, 0x5E0A72EC, 0x49BAFEFD, 0x187908D9,
+ 0x8D0DBD86, 0x311170A7, 0x3E9B640C, 0xCC3E10D7,
+ 0xD5CAD3B6, 0x0CAEC388, 0xF73001E1, 0x6C728AFF,
+ 0x71EAE2A1, 0x1F9AF36E, 0xCFCBD12F, 0xC1DE8417,
+ 0xAC07BE6B, 0xCB44A1D8, 0x8B9B0F56, 0x013988C3,
+ 0xB1C52FCA, 0xB4BE31CD, 0xD8782806, 0x12A3A4E2,
+ 0x6F7DE532, 0x58FD7EB6, 0xD01EE900, 0x24ADFFC2,
+ 0xF4990FC5, 0x9711AAC5, 0x001D7B95, 0x82E5E7D2,
+ 0x109873F6, 0x00613096, 0xC32D9521, 0xADA121FF,
+ 0x29908415, 0x7FBB977F, 0xAF9EB3DB, 0x29C9ED2A,
+ 0x5CE2A465, 0xA730F32C, 0xD0AA3FE8, 0x8A5CC091,
+ 0xD49E2CE7, 0x0CE454A9, 0xD60ACD86, 0x015F1919,
+ 0x77079103, 0xDEA03AF6, 0x78A8565E, 0xDEE356DF,
+ 0x21F05CBE, 0x8B75E387, 0xB3C50651, 0xB8A5C3EF,
+ 0xD8EEB6D2, 0xE523BE77, 0xC2154529, 0x2F69EFDF,
+ 0xAFE67AFB, 0xF470C4B2, 0xF3E0EB5B, 0xD6CC9876,
+ 0x39E4460C, 0x1FDA8538, 0x1987832F, 0xCA007367,
+ 0xA99144F8, 0x296B299E, 0x492FC295, 0x9266BEAB,
+ 0xB5676E69, 0x9BD3DDDA, 0xDF7E052F, 0xDB25701C,
+ 0x1B5E51EE, 0xF65324E6, 0x6AFCE36C, 0x0316CC04,
+ 0x8644213E, 0xB7DC59D0, 0x7965291F, 0xCCD6FD43,
+ 0x41823979, 0x932BCDF6, 0xB657C34D, 0x4EDFD282,
+ 0x7AE5290C, 0x3CB9536B, 0x851E20FE, 0x9833557E,
+ 0x13ECF0B0, 0xD3FFB372, 0x3F85C5C1, 0x0AEF7ED2
+};
+
+static const u_int32_t cast_sbox5[256] = {
+ 0x7EC90C04, 0x2C6E74B9, 0x9B0E66DF, 0xA6337911,
+ 0xB86A7FFF, 0x1DD358F5, 0x44DD9D44, 0x1731167F,
+ 0x08FBF1FA, 0xE7F511CC, 0xD2051B00, 0x735ABA00,
+ 0x2AB722D8, 0x386381CB, 0xACF6243A, 0x69BEFD7A,
+ 0xE6A2E77F, 0xF0C720CD, 0xC4494816, 0xCCF5C180,
+ 0x38851640, 0x15B0A848, 0xE68B18CB, 0x4CAADEFF,
+ 0x5F480A01, 0x0412B2AA, 0x259814FC, 0x41D0EFE2,
+ 0x4E40B48D, 0x248EB6FB, 0x8DBA1CFE, 0x41A99B02,
+ 0x1A550A04, 0xBA8F65CB, 0x7251F4E7, 0x95A51725,
+ 0xC106ECD7, 0x97A5980A, 0xC539B9AA, 0x4D79FE6A,
+ 0xF2F3F763, 0x68AF8040, 0xED0C9E56, 0x11B4958B,
+ 0xE1EB5A88, 0x8709E6B0, 0xD7E07156, 0x4E29FEA7,
+ 0x6366E52D, 0x02D1C000, 0xC4AC8E05, 0x9377F571,
+ 0x0C05372A, 0x578535F2, 0x2261BE02, 0xD642A0C9,
+ 0xDF13A280, 0x74B55BD2, 0x682199C0, 0xD421E5EC,
+ 0x53FB3CE8, 0xC8ADEDB3, 0x28A87FC9, 0x3D959981,
+ 0x5C1FF900, 0xFE38D399, 0x0C4EFF0B, 0x062407EA,
+ 0xAA2F4FB1, 0x4FB96976, 0x90C79505, 0xB0A8A774,
+ 0xEF55A1FF, 0xE59CA2C2, 0xA6B62D27, 0xE66A4263,
+ 0xDF65001F, 0x0EC50966, 0xDFDD55BC, 0x29DE0655,
+ 0x911E739A, 0x17AF8975, 0x32C7911C, 0x89F89468,
+ 0x0D01E980, 0x524755F4, 0x03B63CC9, 0x0CC844B2,
+ 0xBCF3F0AA, 0x87AC36E9, 0xE53A7426, 0x01B3D82B,
+ 0x1A9E7449, 0x64EE2D7E, 0xCDDBB1DA, 0x01C94910,
+ 0xB868BF80, 0x0D26F3FD, 0x9342EDE7, 0x04A5C284,
+ 0x636737B6, 0x50F5B616, 0xF24766E3, 0x8ECA36C1,
+ 0x136E05DB, 0xFEF18391, 0xFB887A37, 0xD6E7F7D4,
+ 0xC7FB7DC9, 0x3063FCDF, 0xB6F589DE, 0xEC2941DA,
+ 0x26E46695, 0xB7566419, 0xF654EFC5, 0xD08D58B7,
+ 0x48925401, 0xC1BACB7F, 0xE5FF550F, 0xB6083049,
+ 0x5BB5D0E8, 0x87D72E5A, 0xAB6A6EE1, 0x223A66CE,
+ 0xC62BF3CD, 0x9E0885F9, 0x68CB3E47, 0x086C010F,
+ 0xA21DE820, 0xD18B69DE, 0xF3F65777, 0xFA02C3F6,
+ 0x407EDAC3, 0xCBB3D550, 0x1793084D, 0xB0D70EBA,
+ 0x0AB378D5, 0xD951FB0C, 0xDED7DA56, 0x4124BBE4,
+ 0x94CA0B56, 0x0F5755D1, 0xE0E1E56E, 0x6184B5BE,
+ 0x580A249F, 0x94F74BC0, 0xE327888E, 0x9F7B5561,
+ 0xC3DC0280, 0x05687715, 0x646C6BD7, 0x44904DB3,
+ 0x66B4F0A3, 0xC0F1648A, 0x697ED5AF, 0x49E92FF6,
+ 0x309E374F, 0x2CB6356A, 0x85808573, 0x4991F840,
+ 0x76F0AE02, 0x083BE84D, 0x28421C9A, 0x44489406,
+ 0x736E4CB8, 0xC1092910, 0x8BC95FC6, 0x7D869CF4,
+ 0x134F616F, 0x2E77118D, 0xB31B2BE1, 0xAA90B472,
+ 0x3CA5D717, 0x7D161BBA, 0x9CAD9010, 0xAF462BA2,
+ 0x9FE459D2, 0x45D34559, 0xD9F2DA13, 0xDBC65487,
+ 0xF3E4F94E, 0x176D486F, 0x097C13EA, 0x631DA5C7,
+ 0x445F7382, 0x175683F4, 0xCDC66A97, 0x70BE0288,
+ 0xB3CDCF72, 0x6E5DD2F3, 0x20936079, 0x459B80A5,
+ 0xBE60E2DB, 0xA9C23101, 0xEBA5315C, 0x224E42F2,
+ 0x1C5C1572, 0xF6721B2C, 0x1AD2FFF3, 0x8C25404E,
+ 0x324ED72F, 0x4067B7FD, 0x0523138E, 0x5CA3BC78,
+ 0xDC0FD66E, 0x75922283, 0x784D6B17, 0x58EBB16E,
+ 0x44094F85, 0x3F481D87, 0xFCFEAE7B, 0x77B5FF76,
+ 0x8C2302BF, 0xAAF47556, 0x5F46B02A, 0x2B092801,
+ 0x3D38F5F7, 0x0CA81F36, 0x52AF4A8A, 0x66D5E7C0,
+ 0xDF3B0874, 0x95055110, 0x1B5AD7A8, 0xF61ED5AD,
+ 0x6CF6E479, 0x20758184, 0xD0CEFA65, 0x88F7BE58,
+ 0x4A046826, 0x0FF6F8F3, 0xA09C7F70, 0x5346ABA0,
+ 0x5CE96C28, 0xE176EDA3, 0x6BAC307F, 0x376829D2,
+ 0x85360FA9, 0x17E3FE2A, 0x24B79767, 0xF5A96B20,
+ 0xD6CD2595, 0x68FF1EBF, 0x7555442C, 0xF19F06BE,
+ 0xF9E0659A, 0xEEB9491D, 0x34010718, 0xBB30CAB8,
+ 0xE822FE15, 0x88570983, 0x750E6249, 0xDA627E55,
+ 0x5E76FFA8, 0xB1534546, 0x6D47DE08, 0xEFE9E7D4
+};
+
+static const u_int32_t cast_sbox6[256] = {
+ 0xF6FA8F9D, 0x2CAC6CE1, 0x4CA34867, 0xE2337F7C,
+ 0x95DB08E7, 0x016843B4, 0xECED5CBC, 0x325553AC,
+ 0xBF9F0960, 0xDFA1E2ED, 0x83F0579D, 0x63ED86B9,
+ 0x1AB6A6B8, 0xDE5EBE39, 0xF38FF732, 0x8989B138,
+ 0x33F14961, 0xC01937BD, 0xF506C6DA, 0xE4625E7E,
+ 0xA308EA99, 0x4E23E33C, 0x79CBD7CC, 0x48A14367,
+ 0xA3149619, 0xFEC94BD5, 0xA114174A, 0xEAA01866,
+ 0xA084DB2D, 0x09A8486F, 0xA888614A, 0x2900AF98,
+ 0x01665991, 0xE1992863, 0xC8F30C60, 0x2E78EF3C,
+ 0xD0D51932, 0xCF0FEC14, 0xF7CA07D2, 0xD0A82072,
+ 0xFD41197E, 0x9305A6B0, 0xE86BE3DA, 0x74BED3CD,
+ 0x372DA53C, 0x4C7F4448, 0xDAB5D440, 0x6DBA0EC3,
+ 0x083919A7, 0x9FBAEED9, 0x49DBCFB0, 0x4E670C53,
+ 0x5C3D9C01, 0x64BDB941, 0x2C0E636A, 0xBA7DD9CD,
+ 0xEA6F7388, 0xE70BC762, 0x35F29ADB, 0x5C4CDD8D,
+ 0xF0D48D8C, 0xB88153E2, 0x08A19866, 0x1AE2EAC8,
+ 0x284CAF89, 0xAA928223, 0x9334BE53, 0x3B3A21BF,
+ 0x16434BE3, 0x9AEA3906, 0xEFE8C36E, 0xF890CDD9,
+ 0x80226DAE, 0xC340A4A3, 0xDF7E9C09, 0xA694A807,
+ 0x5B7C5ECC, 0x221DB3A6, 0x9A69A02F, 0x68818A54,
+ 0xCEB2296F, 0x53C0843A, 0xFE893655, 0x25BFE68A,
+ 0xB4628ABC, 0xCF222EBF, 0x25AC6F48, 0xA9A99387,
+ 0x53BDDB65, 0xE76FFBE7, 0xE967FD78, 0x0BA93563,
+ 0x8E342BC1, 0xE8A11BE9, 0x4980740D, 0xC8087DFC,
+ 0x8DE4BF99, 0xA11101A0, 0x7FD37975, 0xDA5A26C0,
+ 0xE81F994F, 0x9528CD89, 0xFD339FED, 0xB87834BF,
+ 0x5F04456D, 0x22258698, 0xC9C4C83B, 0x2DC156BE,
+ 0x4F628DAA, 0x57F55EC5, 0xE2220ABE, 0xD2916EBF,
+ 0x4EC75B95, 0x24F2C3C0, 0x42D15D99, 0xCD0D7FA0,
+ 0x7B6E27FF, 0xA8DC8AF0, 0x7345C106, 0xF41E232F,
+ 0x35162386, 0xE6EA8926, 0x3333B094, 0x157EC6F2,
+ 0x372B74AF, 0x692573E4, 0xE9A9D848, 0xF3160289,
+ 0x3A62EF1D, 0xA787E238, 0xF3A5F676, 0x74364853,
+ 0x20951063, 0x4576698D, 0xB6FAD407, 0x592AF950,
+ 0x36F73523, 0x4CFB6E87, 0x7DA4CEC0, 0x6C152DAA,
+ 0xCB0396A8, 0xC50DFE5D, 0xFCD707AB, 0x0921C42F,
+ 0x89DFF0BB, 0x5FE2BE78, 0x448F4F33, 0x754613C9,
+ 0x2B05D08D, 0x48B9D585, 0xDC049441, 0xC8098F9B,
+ 0x7DEDE786, 0xC39A3373, 0x42410005, 0x6A091751,
+ 0x0EF3C8A6, 0x890072D6, 0x28207682, 0xA9A9F7BE,
+ 0xBF32679D, 0xD45B5B75, 0xB353FD00, 0xCBB0E358,
+ 0x830F220A, 0x1F8FB214, 0xD372CF08, 0xCC3C4A13,
+ 0x8CF63166, 0x061C87BE, 0x88C98F88, 0x6062E397,
+ 0x47CF8E7A, 0xB6C85283, 0x3CC2ACFB, 0x3FC06976,
+ 0x4E8F0252, 0x64D8314D, 0xDA3870E3, 0x1E665459,
+ 0xC10908F0, 0x513021A5, 0x6C5B68B7, 0x822F8AA0,
+ 0x3007CD3E, 0x74719EEF, 0xDC872681, 0x073340D4,
+ 0x7E432FD9, 0x0C5EC241, 0x8809286C, 0xF592D891,
+ 0x08A930F6, 0x957EF305, 0xB7FBFFBD, 0xC266E96F,
+ 0x6FE4AC98, 0xB173ECC0, 0xBC60B42A, 0x953498DA,
+ 0xFBA1AE12, 0x2D4BD736, 0x0F25FAAB, 0xA4F3FCEB,
+ 0xE2969123, 0x257F0C3D, 0x9348AF49, 0x361400BC,
+ 0xE8816F4A, 0x3814F200, 0xA3F94043, 0x9C7A54C2,
+ 0xBC704F57, 0xDA41E7F9, 0xC25AD33A, 0x54F4A084,
+ 0xB17F5505, 0x59357CBE, 0xEDBD15C8, 0x7F97C5AB,
+ 0xBA5AC7B5, 0xB6F6DEAF, 0x3A479C3A, 0x5302DA25,
+ 0x653D7E6A, 0x54268D49, 0x51A477EA, 0x5017D55B,
+ 0xD7D25D88, 0x44136C76, 0x0404A8C8, 0xB8E5A121,
+ 0xB81A928A, 0x60ED5869, 0x97C55B96, 0xEAEC991B,
+ 0x29935913, 0x01FDB7F1, 0x088E8DFA, 0x9AB6F6F5,
+ 0x3B4CBF9F, 0x4A5DE3AB, 0xE6051D35, 0xA0E1D855,
+ 0xD36B4CF1, 0xF544EDEB, 0xB0E93524, 0xBEBB8FBD,
+ 0xA2D762CF, 0x49C92F54, 0x38B5F331, 0x7128A454,
+ 0x48392905, 0xA65B1DB8, 0x851C97BD, 0xD675CF2F
+};
+
+static const u_int32_t cast_sbox7[256] = {
+ 0x85E04019, 0x332BF567, 0x662DBFFF, 0xCFC65693,
+ 0x2A8D7F6F, 0xAB9BC912, 0xDE6008A1, 0x2028DA1F,
+ 0x0227BCE7, 0x4D642916, 0x18FAC300, 0x50F18B82,
+ 0x2CB2CB11, 0xB232E75C, 0x4B3695F2, 0xB28707DE,
+ 0xA05FBCF6, 0xCD4181E9, 0xE150210C, 0xE24EF1BD,
+ 0xB168C381, 0xFDE4E789, 0x5C79B0D8, 0x1E8BFD43,
+ 0x4D495001, 0x38BE4341, 0x913CEE1D, 0x92A79C3F,
+ 0x089766BE, 0xBAEEADF4, 0x1286BECF, 0xB6EACB19,
+ 0x2660C200, 0x7565BDE4, 0x64241F7A, 0x8248DCA9,
+ 0xC3B3AD66, 0x28136086, 0x0BD8DFA8, 0x356D1CF2,
+ 0x107789BE, 0xB3B2E9CE, 0x0502AA8F, 0x0BC0351E,
+ 0x166BF52A, 0xEB12FF82, 0xE3486911, 0xD34D7516,
+ 0x4E7B3AFF, 0x5F43671B, 0x9CF6E037, 0x4981AC83,
+ 0x334266CE, 0x8C9341B7, 0xD0D854C0, 0xCB3A6C88,
+ 0x47BC2829, 0x4725BA37, 0xA66AD22B, 0x7AD61F1E,
+ 0x0C5CBAFA, 0x4437F107, 0xB6E79962, 0x42D2D816,
+ 0x0A961288, 0xE1A5C06E, 0x13749E67, 0x72FC081A,
+ 0xB1D139F7, 0xF9583745, 0xCF19DF58, 0xBEC3F756,
+ 0xC06EBA30, 0x07211B24, 0x45C28829, 0xC95E317F,
+ 0xBC8EC511, 0x38BC46E9, 0xC6E6FA14, 0xBAE8584A,
+ 0xAD4EBC46, 0x468F508B, 0x7829435F, 0xF124183B,
+ 0x821DBA9F, 0xAFF60FF4, 0xEA2C4E6D, 0x16E39264,
+ 0x92544A8B, 0x009B4FC3, 0xABA68CED, 0x9AC96F78,
+ 0x06A5B79A, 0xB2856E6E, 0x1AEC3CA9, 0xBE838688,
+ 0x0E0804E9, 0x55F1BE56, 0xE7E5363B, 0xB3A1F25D,
+ 0xF7DEBB85, 0x61FE033C, 0x16746233, 0x3C034C28,
+ 0xDA6D0C74, 0x79AAC56C, 0x3CE4E1AD, 0x51F0C802,
+ 0x98F8F35A, 0x1626A49F, 0xEED82B29, 0x1D382FE3,
+ 0x0C4FB99A, 0xBB325778, 0x3EC6D97B, 0x6E77A6A9,
+ 0xCB658B5C, 0xD45230C7, 0x2BD1408B, 0x60C03EB7,
+ 0xB9068D78, 0xA33754F4, 0xF430C87D, 0xC8A71302,
+ 0xB96D8C32, 0xEBD4E7BE, 0xBE8B9D2D, 0x7979FB06,
+ 0xE7225308, 0x8B75CF77, 0x11EF8DA4, 0xE083C858,
+ 0x8D6B786F, 0x5A6317A6, 0xFA5CF7A0, 0x5DDA0033,
+ 0xF28EBFB0, 0xF5B9C310, 0xA0EAC280, 0x08B9767A,
+ 0xA3D9D2B0, 0x79D34217, 0x021A718D, 0x9AC6336A,
+ 0x2711FD60, 0x438050E3, 0x069908A8, 0x3D7FEDC4,
+ 0x826D2BEF, 0x4EEB8476, 0x488DCF25, 0x36C9D566,
+ 0x28E74E41, 0xC2610ACA, 0x3D49A9CF, 0xBAE3B9DF,
+ 0xB65F8DE6, 0x92AEAF64, 0x3AC7D5E6, 0x9EA80509,
+ 0xF22B017D, 0xA4173F70, 0xDD1E16C3, 0x15E0D7F9,
+ 0x50B1B887, 0x2B9F4FD5, 0x625ABA82, 0x6A017962,
+ 0x2EC01B9C, 0x15488AA9, 0xD716E740, 0x40055A2C,
+ 0x93D29A22, 0xE32DBF9A, 0x058745B9, 0x3453DC1E,
+ 0xD699296E, 0x496CFF6F, 0x1C9F4986, 0xDFE2ED07,
+ 0xB87242D1, 0x19DE7EAE, 0x053E561A, 0x15AD6F8C,
+ 0x66626C1C, 0x7154C24C, 0xEA082B2A, 0x93EB2939,
+ 0x17DCB0F0, 0x58D4F2AE, 0x9EA294FB, 0x52CF564C,
+ 0x9883FE66, 0x2EC40581, 0x763953C3, 0x01D6692E,
+ 0xD3A0C108, 0xA1E7160E, 0xE4F2DFA6, 0x693ED285,
+ 0x74904698, 0x4C2B0EDD, 0x4F757656, 0x5D393378,
+ 0xA132234F, 0x3D321C5D, 0xC3F5E194, 0x4B269301,
+ 0xC79F022F, 0x3C997E7E, 0x5E4F9504, 0x3FFAFBBD,
+ 0x76F7AD0E, 0x296693F4, 0x3D1FCE6F, 0xC61E45BE,
+ 0xD3B5AB34, 0xF72BF9B7, 0x1B0434C0, 0x4E72B567,
+ 0x5592A33D, 0xB5229301, 0xCFD2A87F, 0x60AEB767,
+ 0x1814386B, 0x30BCC33D, 0x38A0C07D, 0xFD1606F2,
+ 0xC363519B, 0x589DD390, 0x5479F8E6, 0x1CB8D647,
+ 0x97FD61A9, 0xEA7759F4, 0x2D57539D, 0x569A58CF,
+ 0xE84E63AD, 0x462E1B78, 0x6580F87E, 0xF3817914,
+ 0x91DA55F4, 0x40A230F3, 0xD1988F35, 0xB6E318D2,
+ 0x3FFA50BC, 0x3D40F021, 0xC3C0BDAE, 0x4958C24C,
+ 0x518F36B2, 0x84B1D370, 0x0FEDCE83, 0x878DDADA,
+ 0xF2A279C7, 0x94E01BE8, 0x90716F4B, 0x954B8AA3
+};
+
+static const u_int32_t cast_sbox8[256] = {
+ 0xE216300D, 0xBBDDFFFC, 0xA7EBDABD, 0x35648095,
+ 0x7789F8B7, 0xE6C1121B, 0x0E241600, 0x052CE8B5,
+ 0x11A9CFB0, 0xE5952F11, 0xECE7990A, 0x9386D174,
+ 0x2A42931C, 0x76E38111, 0xB12DEF3A, 0x37DDDDFC,
+ 0xDE9ADEB1, 0x0A0CC32C, 0xBE197029, 0x84A00940,
+ 0xBB243A0F, 0xB4D137CF, 0xB44E79F0, 0x049EEDFD,
+ 0x0B15A15D, 0x480D3168, 0x8BBBDE5A, 0x669DED42,
+ 0xC7ECE831, 0x3F8F95E7, 0x72DF191B, 0x7580330D,
+ 0x94074251, 0x5C7DCDFA, 0xABBE6D63, 0xAA402164,
+ 0xB301D40A, 0x02E7D1CA, 0x53571DAE, 0x7A3182A2,
+ 0x12A8DDEC, 0xFDAA335D, 0x176F43E8, 0x71FB46D4,
+ 0x38129022, 0xCE949AD4, 0xB84769AD, 0x965BD862,
+ 0x82F3D055, 0x66FB9767, 0x15B80B4E, 0x1D5B47A0,
+ 0x4CFDE06F, 0xC28EC4B8, 0x57E8726E, 0x647A78FC,
+ 0x99865D44, 0x608BD593, 0x6C200E03, 0x39DC5FF6,
+ 0x5D0B00A3, 0xAE63AFF2, 0x7E8BD632, 0x70108C0C,
+ 0xBBD35049, 0x2998DF04, 0x980CF42A, 0x9B6DF491,
+ 0x9E7EDD53, 0x06918548, 0x58CB7E07, 0x3B74EF2E,
+ 0x522FFFB1, 0xD24708CC, 0x1C7E27CD, 0xA4EB215B,
+ 0x3CF1D2E2, 0x19B47A38, 0x424F7618, 0x35856039,
+ 0x9D17DEE7, 0x27EB35E6, 0xC9AFF67B, 0x36BAF5B8,
+ 0x09C467CD, 0xC18910B1, 0xE11DBF7B, 0x06CD1AF8,
+ 0x7170C608, 0x2D5E3354, 0xD4DE495A, 0x64C6D006,
+ 0xBCC0C62C, 0x3DD00DB3, 0x708F8F34, 0x77D51B42,
+ 0x264F620F, 0x24B8D2BF, 0x15C1B79E, 0x46A52564,
+ 0xF8D7E54E, 0x3E378160, 0x7895CDA5, 0x859C15A5,
+ 0xE6459788, 0xC37BC75F, 0xDB07BA0C, 0x0676A3AB,
+ 0x7F229B1E, 0x31842E7B, 0x24259FD7, 0xF8BEF472,
+ 0x835FFCB8, 0x6DF4C1F2, 0x96F5B195, 0xFD0AF0FC,
+ 0xB0FE134C, 0xE2506D3D, 0x4F9B12EA, 0xF215F225,
+ 0xA223736F, 0x9FB4C428, 0x25D04979, 0x34C713F8,
+ 0xC4618187, 0xEA7A6E98, 0x7CD16EFC, 0x1436876C,
+ 0xF1544107, 0xBEDEEE14, 0x56E9AF27, 0xA04AA441,
+ 0x3CF7C899, 0x92ECBAE6, 0xDD67016D, 0x151682EB,
+ 0xA842EEDF, 0xFDBA60B4, 0xF1907B75, 0x20E3030F,
+ 0x24D8C29E, 0xE139673B, 0xEFA63FB8, 0x71873054,
+ 0xB6F2CF3B, 0x9F326442, 0xCB15A4CC, 0xB01A4504,
+ 0xF1E47D8D, 0x844A1BE5, 0xBAE7DFDC, 0x42CBDA70,
+ 0xCD7DAE0A, 0x57E85B7A, 0xD53F5AF6, 0x20CF4D8C,
+ 0xCEA4D428, 0x79D130A4, 0x3486EBFB, 0x33D3CDDC,
+ 0x77853B53, 0x37EFFCB5, 0xC5068778, 0xE580B3E6,
+ 0x4E68B8F4, 0xC5C8B37E, 0x0D809EA2, 0x398FEB7C,
+ 0x132A4F94, 0x43B7950E, 0x2FEE7D1C, 0x223613BD,
+ 0xDD06CAA2, 0x37DF932B, 0xC4248289, 0xACF3EBC3,
+ 0x5715F6B7, 0xEF3478DD, 0xF267616F, 0xC148CBE4,
+ 0x9052815E, 0x5E410FAB, 0xB48A2465, 0x2EDA7FA4,
+ 0xE87B40E4, 0xE98EA084, 0x5889E9E1, 0xEFD390FC,
+ 0xDD07D35B, 0xDB485694, 0x38D7E5B2, 0x57720101,
+ 0x730EDEBC, 0x5B643113, 0x94917E4F, 0x503C2FBA,
+ 0x646F1282, 0x7523D24A, 0xE0779695, 0xF9C17A8F,
+ 0x7A5B2121, 0xD187B896, 0x29263A4D, 0xBA510CDF,
+ 0x81F47C9F, 0xAD1163ED, 0xEA7B5965, 0x1A00726E,
+ 0x11403092, 0x00DA6D77, 0x4A0CDD61, 0xAD1F4603,
+ 0x605BDFB0, 0x9EEDC364, 0x22EBE6A8, 0xCEE7D28A,
+ 0xA0E736A0, 0x5564A6B9, 0x10853209, 0xC7EB8F37,
+ 0x2DE705CA, 0x8951570F, 0xDF09822B, 0xBD691A6C,
+ 0xAA12E4F2, 0x87451C0F, 0xE0F6A27A, 0x3ADA4819,
+ 0x4CF1764F, 0x0D771C2B, 0x67CDB156, 0x350D8384,
+ 0x5938FA0F, 0x42399EF3, 0x36997B07, 0x0E84093D,
+ 0x4AA93E61, 0x8360D87B, 0x1FA98B0C, 0x1149382C,
+ 0xE97625A5, 0x0614D1B7, 0x0E25244B, 0x0C768347,
+ 0x589E8D82, 0x0D2059D1, 0xA466BB1E, 0xF8DA0A82,
+ 0x04F19130, 0xBA6E4EC0, 0x99265164, 0x1EE7230D,
+ 0x50B2AD80, 0xEAEE6801, 0x8DB2A283, 0xEA8BF59E
+};
+
+#endif // _NETINET_IP_CASTSB_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/ip_ecn.h b/ecos/packages/net/tcpip/current/include/netinet/ip_ecn.h
new file mode 100644
index 0000000..08e43f2
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/ip_ecn.h
@@ -0,0 +1,90 @@
+//==========================================================================
+//
+// include/netinet/ip_ecn.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ip_ecn.h,v 1.1 1999/12/08 06:50:19 itojun Exp $ */
+
+/*
+ * Copyright (C) 1999 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ *
+ * KAME Id: ip_ecn.h,v 1.2 1999/08/19 12:57:44 itojun Exp
+ */
+
+#ifndef _NETINET_IP_ECN_H_
+#define _NETINET_IP_ECN_H_
+
+/*
+ * ECN consideration on tunnel ingress/egress operation.
+ * http://www.aciri.org/floyd/papers/draft-ipsec-ecn-00.txt
+ */
+
+#if (defined(__FreeBSD__) && __FreeBSD__ >= 3) || defined(__NetBSD__)
+#if defined(_KERNEL) && !defined(_LKM)
+#include "opt_inet.h"
+#endif
+#endif
+
+#define ECN_ALLOWED 1 /* ECN allowed */
+#define ECN_FORBIDDEN 0 /* ECN forbidden */
+#define ECN_NOCARE (-1) /* no consideration to ECN */
+
+#if defined(KERNEL) || defined(_KERNEL)
+extern void ip_ecn_ingress __P((int, u_int8_t *, u_int8_t *));
+extern void ip_ecn_egress __P((int, u_int8_t *, u_int8_t *));
+#ifdef INET6
+extern void ip6_ecn_ingress __P((int, u_int32_t *, u_int32_t *));
+extern void ip6_ecn_egress __P((int, u_int32_t *, u_int32_t *));
+#endif
+#endif
+
+#endif // _NETINET_IP_ECN_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/ip_esp.h b/ecos/packages/net/tcpip/current/include/netinet/ip_esp.h
new file mode 100644
index 0000000..1c65473
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/ip_esp.h
@@ -0,0 +1,139 @@
+//==========================================================================
+//
+// include/netinet/ip_esp.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ip_esp.h,v 1.26 1999/12/09 00:33:29 angelos Exp $ */
+
+/*
+ * The authors of this code are John Ioannidis (ji@tla.org),
+ * Angelos D. Keromytis (kermit@csd.uch.gr) and
+ * Niels Provos (provos@physnet.uni-hamburg.de).
+ *
+ * This code was written by John Ioannidis for BSD/OS in Athens, Greece,
+ * in November 1995.
+ *
+ * Ported to OpenBSD and NetBSD, with additional transforms, in December 1996,
+ * by Angelos D. Keromytis.
+ *
+ * Additional transforms and features in 1997 and 1998 by Angelos D. Keromytis
+ * and Niels Provos.
+ *
+ * Additional features in 1999 by Angelos D. Keromytis.
+ *
+ * Copyright (C) 1995, 1996, 1997, 1998, 1999 by John Ioannidis,
+ * Angelos D. Keromytis and Niels Provos.
+ *
+ * Permission to use, copy, and modify this software without fee
+ * is hereby granted, provided that this entire notice is included in
+ * all copies of any software which is or includes a copy or
+ * modification of this software.
+ * You may use this code under the GNU public license if you so wish. Please
+ * contribute changes back to the authors under this freer than GPL license
+ * so that we may further the use of strong encryption without limitations to
+ * all.
+ *
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
+ * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
+ * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
+ * PURPOSE.
+ */
+
+#ifndef _NETINET_IP_ESP_H_
+#define _NETINET_IP_ESP_H_
+
+/*
+ * Encapsulation Security Payload Processing
+ * Per RFC1827 (Atkinson, 1995)
+ */
+
+/* Various defines for the "new" ESP */
+#define ESP_NEW_ALEN 12 /* 96bits authenticator */
+
+struct esp_old
+{
+ u_int32_t esp_spi; /* Security Parameters Index */
+ u_int8_t esp_iv[8]; /* iv[4] may actually be data! */
+};
+
+#define ESP_OLD_FLENGTH 12
+#define ESP_NEW_FLENGTH 16
+
+struct esp_new
+{
+ u_int32_t esp_spi; /* Security Parameter Index */
+ u_int32_t esp_rpl; /* Sequence Number, Replay Counter */
+ u_int8_t esp_iv[8]; /* Data may start already at iv[0]! */
+};
+
+struct espstat
+{
+ u_int32_t esps_hdrops; /* packet shorter than header shows */
+ u_int32_t esps_notdb;
+ u_int32_t esps_badkcr;
+ u_int32_t esps_qfull;
+ u_int32_t esps_noxform;
+ u_int32_t esps_badilen;
+ u_int32_t esps_wrap; /* Replay counter wrapped around */
+ u_int32_t esps_badenc; /* Bad encryption detected */
+ u_int32_t esps_badauth; /* Only valid for transforms with auth */
+ u_int32_t esps_replay; /* Possible packet replay detected */
+ u_int32_t esps_input; /* Input ESP packets */
+ u_int32_t esps_output; /* Output ESP packets */
+ u_int32_t esps_invalid; /* Trying to use an invalid TDB */
+ u_int64_t esps_ibytes; /* input bytes */
+ u_int64_t esps_obytes; /* output bytes */
+ u_int32_t esps_toobig; /* packet got larger than IP_MAXPACKET */
+ u_int32_t esps_pdrops; /* packet blocked due to policy */
+};
+
+/*
+ * Names for ESP sysctl objects
+ */
+#define ESPCTL_ENABLE 1 /* Enable ESP processing */
+#define ESPCTL_MAXID 2
+
+#define ESPCTL_NAMES { \
+ { 0, 0 }, \
+ { "enable", CTLTYPE_INT }, \
+}
+
+#ifdef _KERNEL
+void esp_input __P((struct mbuf *, ...));
+int esp_output __P((struct mbuf *, struct tdb *, struct mbuf **));
+int esp_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
+
+#ifdef INET6
+void esp6_input __P((struct mbuf *, ...));
+#endif /* INET6 */
+
+extern int esp_enable;
+struct espstat espstat;
+#endif /* _Kernel */
+
+#endif // _NETINET_IP_ESP_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/ip_ether.h b/ecos/packages/net/tcpip/current/include/netinet/ip_ether.h
new file mode 100644
index 0000000..bac3985
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/ip_ether.h
@@ -0,0 +1,93 @@
+//==========================================================================
+//
+// include/netinet/ip_ether.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ip_ether.h,v 1.2 1999/10/29 02:00:23 angelos Exp $ */
+
+/*
+ * The author of this code is Angelos D. Keromytis (angelos@adk.gr)
+ *
+ * This code was written by Angelos D. Keromytis in October 1999.
+ *
+ * Copyright (C) 1999, by Angelos D. Keromytis.
+ *
+ * Permission to use, copy, and modify this software without fee
+ * is hereby granted, provided that this entire notice is included in
+ * all copies of any software which is or includes a copy or
+ * modification of this software.
+ * You may use this code under the GNU public license if you so wish. Please
+ * contribute changes back to the authors under this freer than GPL license
+ * so that we may further the use of strong encryption without limitations to
+ * all.
+ *
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
+ * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
+ * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
+ * PURPOSE.
+ */
+
+#ifndef _NETINET_IP_ETHER_H_
+#define _NETINET_IP_ETHER_H_
+
+/*
+ * Ethernet-inside-IP processing.
+ */
+
+struct etheripstat
+{
+ u_int32_t etherip_hdrops; /* packet shorter than header shows */
+ u_int32_t etherip_qfull; /* bridge queue full, packet dropped */
+ u_int32_t etherip_noifdrops; /* no interface/bridge information */
+ u_int32_t etherip_pdrops; /* packet dropped due to policy */
+ u_int32_t etherip_adrops; /* all other drops */
+ u_int32_t etherip_ipackets; /* total input packets */
+ u_int32_t etherip_opackets; /* total output packets */
+ u_int64_t etherip_ibytes; /* input bytes */
+ u_int64_t etherip_obytes; /* output bytes */
+};
+
+/*
+ * Names for IP4 sysctl objects
+ */
+#define ETHERIPCTL_ALLOW 1 /* accept incoming EtherIP packets */
+#define ETHERIPCTL_MAXID 2
+
+#define ETHERIPCTL_NAMES { \
+ { 0, 0 }, \
+ { "allow", CTLTYPE_INT }, \
+}
+
+#ifdef _KERNEL
+int etherip_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
+
+extern int etherip_allow;
+extern struct etheripstat etheripstat;
+#endif
+
+#endif // _NETINET_IP_ETHER_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/ip_fil.h b/ecos/packages/net/tcpip/current/include/netinet/ip_fil.h
new file mode 100644
index 0000000..8924e01
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/ip_fil.h
@@ -0,0 +1,605 @@
+//==========================================================================
+//
+// include/netinet/ip_fil.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ip_fil.h,v 1.13 1999/12/15 05:20:21 kjell Exp $ */
+/*
+ * Copyright (C) 1993-1998 by Darren Reed.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and due credit is given
+ * to the original author and the contributors.
+ *
+ * @(#)ip_fil.h 1.35 6/5/96
+ */
+
+#ifndef _NETINET_IP_FIL_H__
+#define _NETINET_IP_FIL_H__
+
+/*
+ * Pathnames for various IP Filter control devices. Used by LKM
+ * and userland, so defined here.
+ */
+#define IPNAT_NAME "/dev/ipnat"
+#define IPSTATE_NAME "/dev/ipstate"
+#define IPAUTH_NAME "/dev/ipauth"
+
+#ifndef SOLARIS
+# define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
+#endif
+
+#if defined(KERNEL) && !defined(_KERNEL)
+# define _KERNEL
+#endif
+
+#ifndef __P
+# ifdef __STDC__
+# define __P(x) x
+# else
+# define __P(x) ()
+# endif
+#endif
+
+#if defined(__STDC__) || defined(__GNUC__)
+# define SIOCADAFR _IOW('r', 60, struct frentry)
+# define SIOCRMAFR _IOW('r', 61, struct frentry)
+# define SIOCSETFF _IOW('r', 62, u_int)
+# define SIOCGETFF _IOR('r', 63, u_int)
+# define SIOCGETFS _IOR('r', 64, struct friostat)
+# define SIOCIPFFL _IOWR('r', 65, int)
+# define SIOCIPFFB _IOR('r', 66, int)
+# define SIOCADIFR _IOW('r', 67, struct frentry)
+# define SIOCRMIFR _IOW('r', 68, struct frentry)
+# define SIOCSWAPA _IOR('r', 69, u_int)
+# define SIOCINAFR _IOW('r', 70, struct frentry)
+# define SIOCINIFR _IOW('r', 71, struct frentry)
+# define SIOCFRENB _IOW('r', 72, u_int)
+# define SIOCFRSYN _IOW('r', 73, u_int)
+# define SIOCFRZST _IOWR('r', 74, struct friostat)
+# define SIOCZRLST _IOWR('r', 75, struct frentry)
+# define SIOCAUTHW _IOWR('r', 76, struct fr_info)
+# define SIOCAUTHR _IOWR('r', 77, struct fr_info)
+# define SIOCATHST _IOWR('r', 78, struct fr_authstat)
+#else
+# define SIOCADAFR _IOW(r, 60, struct frentry)
+# define SIOCRMAFR _IOW(r, 61, struct frentry)
+# define SIOCSETFF _IOW(r, 62, u_int)
+# define SIOCGETFF _IOR(r, 63, u_int)
+# define SIOCGETFS _IOR(r, 64, struct friostat)
+# define SIOCIPFFL _IOWR(r, 65, int)
+# define SIOCIPFFB _IOR(r, 66, int)
+# define SIOCADIFR _IOW(r, 67, struct frentry)
+# define SIOCRMIFR _IOW(r, 68, struct frentry)
+# define SIOCSWAPA _IOR(r, 69, u_int)
+# define SIOCINAFR _IOW(r, 70, struct frentry)
+# define SIOCINIFR _IOW(r, 71, struct frentry)
+# define SIOCFRENB _IOW(r, 72, u_int)
+# define SIOCFRSYN _IOW(r, 73, u_int)
+# define SIOCFRZST _IOWR(r, 74, struct friostat)
+# define SIOCZRLST _IOWR(r, 75, struct frentry)
+# define SIOCAUTHW _IOWR(r, 76, struct fr_info)
+# define SIOCAUTHR _IOWR(r, 77, struct fr_info)
+# define SIOCATHST _IOWR(r, 78, struct fr_authstat)
+#endif
+#define SIOCADDFR SIOCADAFR
+#define SIOCDELFR SIOCRMAFR
+#define SIOCINSFR SIOCINAFR
+
+typedef struct fr_ip {
+ u_char fi_v:4; /* IP version */
+ u_char fi_fl:4; /* packet flags */
+ u_char fi_tos; /* IP packet TOS */
+ u_char fi_ttl; /* IP packet TTL */
+ u_char fi_p; /* IP packet protocol */
+ struct in_addr fi_src; /* source address from packet */
+ struct in_addr fi_dst; /* destination address from packet */
+ u_32_t fi_optmsk; /* bitmask composed from IP options */
+ u_short fi_secmsk; /* bitmask composed from IP security options */
+ u_short fi_auth; /* authentication code from IP sec. options */
+} fr_ip_t;
+
+#define FI_OPTIONS (FF_OPTIONS >> 24)
+#define FI_TCPUDP (FF_TCPUDP >> 24) /* TCP/UCP implied comparison*/
+#define FI_FRAG (FF_FRAG >> 24)
+#define FI_SHORT (FF_SHORT >> 24)
+#define FI_CMP (FI_OPTIONS|FI_TCPUDP|FI_SHORT)
+
+/*
+ * These are both used by the state and NAT code to indicate that one port or
+ * the other should be treated as a wildcard.
+ */
+#define FI_W_SPORT 0x00000100
+#define FI_W_DPORT 0x00000200
+#define FI_WILD (FI_W_SPORT|FI_W_DPORT)
+
+typedef struct fr_info {
+ void *fin_ifp; /* interface packet is `on' */
+ struct fr_ip fin_fi; /* IP Packet summary */
+ u_short fin_data[2]; /* TCP/UDP ports, ICMP code/type */
+ u_char fin_out; /* in or out ? 1 == out, 0 == in */
+ u_char fin_rev; /* state only: 1 = reverse */
+ u_short fin_hlen; /* length of IP header in bytes */
+ u_char fin_tcpf; /* TCP header flags (SYN, ACK, etc) */
+ /* From here on is packet specific */
+ u_char fin_icode; /* ICMP error to return */
+ u_short fin_rule; /* rule # last matched */
+ u_short fin_group; /* group number, -1 for none */
+ struct frentry *fin_fr; /* last matching rule */
+ char *fin_dp; /* start of data past IP header */
+ u_short fin_dlen; /* length of data portion of packet */
+ u_short fin_id; /* IP packet id field */
+ void *fin_mp; /* pointer to pointer to mbuf */
+#if SOLARIS && defined(_KERNEL)
+ void *fin_qfm; /* pointer to mblk where pkt starts */
+ void *fin_qif;
+#endif
+} fr_info_t;
+
+/*
+ * Size for compares on fr_info structures
+ */
+#define FI_CSIZE offsetof(fr_info_t, fin_icode)
+
+/*
+ * Size for copying cache fr_info structure
+ */
+#define FI_COPYSIZE offsetof(fr_info_t, fin_dp)
+
+typedef struct frdest {
+ void *fd_ifp;
+ struct in_addr fd_ip;
+ char fd_ifname[IFNAMSIZ];
+} frdest_t;
+
+typedef struct frentry {
+ struct frentry *fr_next;
+ u_short fr_group; /* group to which this rule belongs */
+ u_short fr_grhead; /* group # which this rule starts */
+ struct frentry *fr_grp;
+ int fr_ref; /* reference count - for grouping */
+ void *fr_ifa;
+#if BSD >= 199306
+ void *fr_oifa;
+#endif
+ /*
+ * These are only incremented when a packet matches this rule and
+ * it is the last match
+ */
+ U_QUAD_T fr_hits;
+ U_QUAD_T fr_bytes;
+ /*
+ * Fields after this may not change whilst in the kernel.
+ */
+ struct fr_ip fr_ip;
+ struct fr_ip fr_mip; /* mask structure */
+
+ u_char fr_tcpfm; /* tcp flags mask */
+ u_char fr_tcpf; /* tcp flags */
+
+ u_short fr_icmpm; /* data for ICMP packets (mask) */
+ u_short fr_icmp;
+
+ u_char fr_scmp; /* data for port comparisons */
+ u_char fr_dcmp;
+ u_short fr_dport;
+ u_short fr_sport;
+ u_short fr_stop; /* top port for <> and >< */
+ u_short fr_dtop; /* top port for <> and >< */
+ u_32_t fr_flags; /* per-rule flags && options (see below) */
+ u_short fr_skip; /* # of rules to skip */
+ u_short fr_loglevel; /* syslog log facility + priority */
+ int (*fr_func) __P((int, ip_t *, fr_info_t *)); /* call this function */
+ char fr_icode; /* return ICMP code */
+ char fr_ifname[IFNAMSIZ];
+#if BSD >= 199306
+ char fr_oifname[IFNAMSIZ];
+#endif
+ struct frdest fr_tif; /* "to" interface */
+ struct frdest fr_dif; /* duplicate packet interfaces */
+} frentry_t;
+
+#define fr_proto fr_ip.fi_p
+#define fr_ttl fr_ip.fi_ttl
+#define fr_tos fr_ip.fi_tos
+#define fr_dst fr_ip.fi_dst
+#define fr_src fr_ip.fi_src
+#define fr_dmsk fr_mip.fi_dst
+#define fr_smsk fr_mip.fi_src
+
+#ifndef offsetof
+#define offsetof(t,m) (int)((&((t *)0L)->m))
+#endif
+#define FR_CMPSIZ (sizeof(struct frentry) - offsetof(frentry_t, fr_ip))
+
+/*
+ * fr_flags
+ */
+#define FR_BLOCK 0x00001 /* do not allow packet to pass */
+#define FR_PASS 0x00002 /* allow packet to pass */
+#define FR_OUTQUE 0x00004 /* outgoing packets */
+#define FR_INQUE 0x00008 /* ingoing packets */
+#define FR_LOG 0x00010 /* Log */
+#define FR_LOGB 0x00011 /* Log-fail */
+#define FR_LOGP 0x00012 /* Log-pass */
+#define FR_LOGBODY 0x00020 /* Log the body */
+#define FR_LOGFIRST 0x00040 /* Log the first byte if state held */
+#define FR_RETRST 0x00080 /* Return TCP RST packet - reset connection */
+#define FR_RETICMP 0x00100 /* Return ICMP unreachable packet */
+#define FR_FAKEICMP 0x00180 /* Return ICMP unreachable with fake source */
+#define FR_NOMATCH 0x00200 /* no match occured */
+#define FR_ACCOUNT 0x00400 /* count packet bytes */
+#define FR_KEEPFRAG 0x00800 /* keep fragment information */
+#define FR_KEEPSTATE 0x01000 /* keep `connection' state information */
+#define FR_INACTIVE 0x02000
+#define FR_QUICK 0x04000 /* match & stop processing list */
+#define FR_FASTROUTE 0x08000 /* bypass normal routing */
+#define FR_CALLNOW 0x10000 /* call another function (fr_func) if matches */
+#define FR_DUP 0x20000 /* duplicate packet */
+#define FR_LOGORBLOCK 0x40000 /* block the packet if it can't be logged */
+#define FR_NOTSRCIP 0x80000 /* not the src IP# */
+#define FR_NOTDSTIP 0x100000 /* not the dst IP# */
+#define FR_AUTH 0x200000 /* use authentication */
+#define FR_PREAUTH 0x400000 /* require preauthentication */
+#define FR_DONTCACHE 0x800000 /* don't cache the result */
+
+#define FR_LOGMASK (FR_LOG|FR_LOGP|FR_LOGB)
+#define FR_RETMASK (FR_RETICMP|FR_RETRST|FR_FAKEICMP)
+
+/*
+ * These correspond to #define's for FI_* and are stored in fr_flags
+ */
+#define FF_OPTIONS 0x01000000
+#define FF_TCPUDP 0x02000000
+#define FF_FRAG 0x04000000
+#define FF_SHORT 0x08000000
+/*
+ * recognized flags for SIOCGETFF and SIOCSETFF, and get put in fr_flags
+ */
+#define FF_LOGPASS 0x10000000
+#define FF_LOGBLOCK 0x20000000
+#define FF_LOGNOMATCH 0x40000000
+#define FF_LOGGING (FF_LOGPASS|FF_LOGBLOCK|FF_LOGNOMATCH)
+#define FF_BLOCKNONIP 0x80000000 /* Solaris2 Only */
+
+#define FR_NONE 0
+#define FR_EQUAL 1
+#define FR_NEQUAL 2
+#define FR_LESST 3
+#define FR_GREATERT 4
+#define FR_LESSTE 5
+#define FR_GREATERTE 6
+#define FR_OUTRANGE 7
+#define FR_INRANGE 8
+
+typedef struct filterstats {
+ u_long fr_pass; /* packets allowed */
+ u_long fr_block; /* packets denied */
+ u_long fr_nom; /* packets which don't match any rule */
+ u_long fr_ppkl; /* packets allowed and logged */
+ u_long fr_bpkl; /* packets denied and logged */
+ u_long fr_npkl; /* packets unmatched and logged */
+ u_long fr_pkl; /* packets logged */
+ u_long fr_skip; /* packets to be logged but buffer full */
+ u_long fr_ret; /* packets for which a return is sent */
+ u_long fr_acct; /* packets for which counting was performed */
+ u_long fr_bnfr; /* bad attempts to allocate fragment state */
+ u_long fr_nfr; /* new fragment state kept */
+ u_long fr_cfr; /* add new fragment state but complete pkt */
+ u_long fr_bads; /* bad attempts to allocate packet state */
+ u_long fr_ads; /* new packet state kept */
+ u_long fr_chit; /* cached hit */
+ u_long fr_tcpbad; /* TCP checksum check failures */
+ u_long fr_pull[2]; /* good and bad pullup attempts */
+#if SOLARIS
+ u_long fr_notdata; /* PROTO/PCPROTO that have no data */
+ u_long fr_nodata; /* mblks that have no data */
+ u_long fr_bad; /* bad IP packets to the filter */
+ u_long fr_notip; /* packets passed through no on ip queue */
+ u_long fr_drop; /* packets dropped - no info for them! */
+#endif
+} filterstats_t;
+
+/*
+ * For SIOCGETFS
+ */
+typedef struct friostat {
+ struct filterstats f_st[2];
+ struct frentry *f_fin[2];
+ struct frentry *f_fout[2];
+ struct frentry *f_acctin[2];
+ struct frentry *f_acctout[2];
+ struct frentry *f_auth;
+ struct frgroup *f_groups[3][2];
+ u_long f_froute[2];
+ int f_active; /* 1 or 0 - active rule set */
+ int f_defpass; /* default pass - from fr_pass */
+ int f_running; /* 1 if running, else 0 */
+ int f_logging; /* 1 if enabled, else 0 */
+ char f_version[32]; /* version string */
+} friostat_t;
+
+typedef struct optlist {
+ u_short ol_val;
+ int ol_bit;
+} optlist_t;
+
+
+/*
+ * Group list structure.
+ */
+typedef struct frgroup {
+ u_short fg_num;
+ struct frgroup *fg_next;
+ struct frentry *fg_head;
+ struct frentry **fg_start;
+} frgroup_t;
+
+
+/*
+ * Log structure. Each packet header logged is prepended by one of these.
+ * Following this in the log records read from the device will be an ipflog
+ * structure which is then followed by any packet data.
+ */
+typedef struct iplog {
+ u_32_t ipl_magic;
+ u_int ipl_count;
+ u_long ipl_sec;
+ u_long ipl_usec;
+ size_t ipl_dsize;
+ struct iplog *ipl_next;
+} iplog_t;
+
+#define IPL_MAGIC 0x49504c4d /* 'IPLM' */
+
+typedef struct ipflog {
+#if (defined(NetBSD) && (NetBSD <= 1991011) && (NetBSD >= 199603)) || \
+ (defined(OpenBSD) && (OpenBSD >= 199603))
+ u_char fl_ifname[IFNAMSIZ];
+#else
+ u_int fl_unit;
+ u_char fl_ifname[4];
+#endif
+ u_char fl_plen; /* extra data after hlen */
+ u_char fl_hlen; /* length of IP headers saved */
+ u_short fl_rule; /* assume never more than 64k rules, total */
+ u_short fl_group;
+ u_short fl_loglevel; /* syslog log level */
+ u_32_t fl_flags;
+ u_32_t fl_lflags;
+} ipflog_t;
+
+
+#if !defined(__OpenBSD__)
+# ifndef ICMP_UNREACH_FILTER
+# define ICMP_UNREACH_FILTER 13
+# endif
+#endif
+
+#ifndef IPF_LOGGING
+# define IPF_LOGGING 0
+#endif
+#ifndef IPF_DEFAULT_PASS
+# define IPF_DEFAULT_PASS FR_PASS
+#endif
+
+#define IPMINLEN(i, h) ((i)->ip_len >= ((i)->ip_hl * 4 + sizeof(struct h)))
+#define IPLLOGSIZE 8192
+
+/*
+ * Device filenames for reading log information. Use ipf on Solaris2 because
+ * ipl is already a name used by something else.
+ */
+#ifndef IPL_NAME
+# if SOLARIS
+# define IPL_NAME "/dev/ipf"
+# else
+# define IPL_NAME "/dev/ipl"
+# endif
+#endif
+#define IPL_NAT IPNAT_NAME
+#define IPL_STATE IPSTATE_NAME
+#define IPL_AUTH IPAUTH_NAME
+
+#define IPL_LOGIPF 0 /* Minor device #'s for accessing logs */
+#define IPL_LOGNAT 1
+#define IPL_LOGSTATE 2
+#define IPL_LOGAUTH 3
+#define IPL_LOGMAX 3
+
+#if !defined(CDEV_MAJOR) && defined (__FreeBSD_version) && \
+ (__FreeBSD_version >= 220000)
+# define CDEV_MAJOR 79
+#endif
+
+/*
+ * Post NetBSD 1.2 has the PFIL interface for packet filters. This turns
+ * on those hooks. We don't need any special mods in non-IP Filter code
+ * with this!
+ */
+#if (defined(NetBSD) && (NetBSD > 199609) && (NetBSD <= 1991011)) || \
+ (defined(NetBSD1_2) && NetBSD1_2 > 1)
+# if (NetBSD >= 199905)
+# define PFIL_HOOKS
+# endif
+# ifdef PFIL_HOOKS
+# define NETBSD_PF
+# endif
+#endif
+
+
+#ifndef _KERNEL
+extern int fr_check __P((ip_t *, int, void *, int, mb_t **));
+extern int (*fr_checkp) __P((ip_t *, int, void *, int, mb_t **));
+extern int send_reset __P((ip_t *, struct ifnet *));
+extern int icmp_error __P((ip_t *, struct ifnet *));
+extern int ipf_log __P((void));
+extern int ipfr_fastroute __P((ip_t *, fr_info_t *, frdest_t *));
+extern struct ifnet *get_unit __P((char *));
+# if defined(__NetBSD__) || defined(__OpenBSD__) || \
+ (_BSDI_VERSION >= 199701) || (__FreeBSD_version >= 300000)
+extern int iplioctl __P((dev_t, u_long, caddr_t, int));
+# else
+extern int iplioctl __P((dev_t, int, caddr_t, int));
+# endif
+extern int iplopen __P((dev_t, int));
+extern int iplclose __P((dev_t, int));
+#else /* #ifndef _KERNEL */
+# if defined(__NetBSD__) && defined(PFIL_HOOKS)
+extern void ipfilterattach __P((int));
+# endif
+
+#if !defined(__OpenBSD__)
+/*
+ * OpenBSD has this call in the kernel but doesn't export it to userland.
+ * See ip_fil.c for actual hook and more details.
+ */
+extern int iplattach __P((void));
+#endif
+
+extern int ipl_enable __P((void));
+extern int ipl_disable __P((void));
+extern void ipflog_init __P((void));
+extern int ipflog_clear __P((minor_t));
+extern int ipflog_read __P((minor_t, struct uio *));
+extern int ipflog __P((u_int, ip_t *, fr_info_t *, mb_t *));
+extern int ipllog __P((int, fr_info_t *, void **, size_t *, int *, int));
+# if SOLARIS
+extern int fr_check __P((ip_t *, int, void *, int, qif_t *, mb_t **));
+extern int (*fr_checkp) __P((ip_t *, int, void *,
+ int, qif_t *, mb_t **));
+extern int icmp_error __P((ip_t *, int, int, qif_t *, struct in_addr));
+# if SOLARIS2 >= 7
+extern int iplioctl __P((dev_t, int, intptr_t, int, cred_t *, int *));
+# else
+extern int iplioctl __P((dev_t, int, int *, int, cred_t *, int *));
+# endif
+extern int iplopen __P((dev_t *, int, int, cred_t *));
+extern int iplclose __P((dev_t, int, int, cred_t *));
+extern int ipfsync __P((void));
+extern int send_reset __P((fr_info_t *, ip_t *, qif_t *));
+extern int ipfr_fastroute __P((qif_t *, ip_t *, mblk_t *, mblk_t **,
+ fr_info_t *, frdest_t *));
+extern void copyin_mblk __P((mblk_t *, size_t, size_t, char *));
+extern void copyout_mblk __P((mblk_t *, size_t, size_t, char *));
+extern int fr_qin __P((queue_t *, mblk_t *));
+extern int fr_qout __P((queue_t *, mblk_t *));
+# ifdef IPFILTER_LOG
+extern int iplread __P((dev_t, struct uio *, cred_t *));
+# endif
+# else /* SOLARIS */
+extern int fr_check __P((ip_t *, int, void *, int, mb_t **));
+extern int (*fr_checkp) __P((ip_t *, int, void *, int, mb_t **));
+# ifdef linux
+extern int send_reset __P((tcpiphdr_t *, struct ifnet *));
+# else
+extern int send_reset __P((fr_info_t *, struct ip *));
+extern int send_icmp_err __P((ip_t *, int, int, void *, struct in_addr));
+# endif
+extern int ipfr_fastroute __P((mb_t *, fr_info_t *, frdest_t *));
+extern size_t mbufchainlen __P((mb_t *));
+# ifdef __sgi
+# include <sys/cred.h>
+extern int iplioctl __P((dev_t, int, caddr_t, int, cred_t *, int *));
+extern int iplopen __P((dev_t *, int, int, cred_t *));
+extern int iplclose __P((dev_t, int, int, cred_t *));
+extern int iplread __P((dev_t, struct uio *, cred_t *));
+extern int ipfsync __P((void));
+extern int ipfilter_sgi_attach __P((void));
+extern void ipfilter_sgi_detach __P((void));
+extern void ipfilter_sgi_intfsync __P((void));
+# else
+# ifdef IPFILTER_LKM
+extern int iplidentify __P((char *));
+# endif
+# if (_BSDI_VERSION >= 199510) || (__FreeBSD_version >= 220000) || \
+ (NetBSD >= 199511) || defined(__OpenBSD__)
+# if defined(__NetBSD__) || (_BSDI_VERSION >= 199701) || \
+ defined(__OpenBSD__) || (__FreeBSD_version >= 300000)
+extern int iplioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
+# else
+extern int iplioctl __P((dev_t, int, caddr_t, int, struct proc *));
+# endif
+extern int iplopen __P((dev_t, int, int, struct proc *));
+extern int iplclose __P((dev_t, int, int, struct proc *));
+# else
+# ifndef linux
+extern int iplopen __P((dev_t, int));
+extern int iplclose __P((dev_t, int));
+extern int iplioctl __P((dev_t, int, caddr_t, int));
+# else
+extern int iplioctl(struct inode *, struct file *, u_int, u_long);
+extern int iplopen __P((struct inode *, struct file *));
+extern void iplclose __P((struct inode *, struct file *));
+# endif /* !linux */
+# endif /* (_BSDI_VERSION >= 199510) */
+# if BSD >= 199306
+extern int iplread __P((dev_t, struct uio *, int));
+# else
+# ifndef linux
+extern int iplread __P((dev_t, struct uio *));
+# else
+extern int iplread(struct inode *, struct file *, char *, int);
+# endif /* !linux */
+# endif /* BSD >= 199306 */
+# endif /* __ sgi */
+# endif /* SOLARIS */
+#endif /* #ifndef _KERNEL */
+
+extern void fixskip __P((frentry_t **, frentry_t *, int));
+extern int countbits __P((u_32_t));
+extern int ipldetach __P((void));
+extern u_short fr_tcpsum __P((mb_t *, ip_t *, tcphdr_t *));
+extern int fr_scanlist __P((u_32_t, ip_t *, fr_info_t *, void *));
+extern u_short ipf_cksum __P((u_short *, int));
+extern int fr_copytolog __P((int, char *, int));
+extern void fr_forgetifp __P((void *));
+extern int frflush __P((minor_t, int));
+extern void frsync __P((void));
+extern frgroup_t *fr_addgroup __P((u_int, frentry_t *, minor_t, int));
+extern frgroup_t *fr_findgroup __P((u_int, u_32_t, minor_t, int, frgroup_t ***));
+extern void fr_delgroup __P((u_int, u_32_t, minor_t, int));
+extern void fr_makefrip __P((int, ip_t *, fr_info_t *));
+extern int fr_ifpaddr __P((void *, struct in_addr *));
+extern char *memstr __P((char *, char *, int, int));
+extern int ipl_unreach;
+extern int ipl_inited;
+extern u_long ipl_frouteok[2];
+extern int fr_pass;
+extern int fr_flags;
+extern int fr_active;
+extern fr_info_t frcache[2];
+extern char ipfilter_version[];
+#ifdef IPFILTER_LOG
+extern iplog_t **iplh[IPL_LOGMAX+1], *iplt[IPL_LOGMAX+1];
+extern size_t iplused[IPL_LOGMAX + 1];
+#endif
+extern struct frentry *ipfilter[2][2], *ipacct[2][2];
+extern struct frgroup *ipfgroups[3][2];
+extern struct filterstats frstats[];
+
+#endif /* _NETINET_IP_FIL_H__ */
diff --git a/ecos/packages/net/tcpip/current/include/netinet/ip_fil_compat.h b/ecos/packages/net/tcpip/current/include/netinet/ip_fil_compat.h
new file mode 100644
index 0000000..e6f77cd
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/ip_fil_compat.h
@@ -0,0 +1,865 @@
+//==========================================================================
+//
+// include/netinet/ip_compat.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ip_fil_compat.h,v 1.11 1999/12/15 05:20:21 kjell Exp $ */
+/*
+ * Copyright (C) 1993-1998 by Darren Reed.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and due credit is given
+ * to the original author and the contributors.
+ *
+ * @(#)ip_compat.h 1.8 1/14/96
+ */
+
+#ifndef _NETINET_IP_COMPAT_H__
+#define _NETINET_IP_COMPAT_H__
+
+#ifndef __P
+# ifdef __STDC__
+# define __P(x) x
+# else
+# define __P(x) ()
+# endif
+#endif
+#ifndef __STDC__
+# undef const
+# define const
+#endif
+
+#ifndef SOLARIS
+#define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
+#endif
+
+#if defined(_KERNEL) || defined(KERNEL) || defined(__KERNEL__)
+# undef KERNEL
+# undef _KERNEL
+# undef __KERNEL__
+# define KERNEL
+# define _KERNEL
+# define __KERNEL__
+#endif
+
+#if defined(__SVR4) || defined(__svr4__) || defined(__sgi)
+#define index strchr
+# if !defined(KERNEL)
+# define bzero(a,b) memset(a,0,b)
+# define bcmp memcmp
+# define bcopy(a,b,c) memmove(b,a,c)
+# endif
+#endif
+
+#ifndef offsetof
+#define offsetof(t,m) (int)((&((t *)0L)->m))
+#endif
+
+#if defined(__sgi) || defined(bsdi)
+struct ether_addr {
+ u_char ether_addr_octet[6];
+};
+#endif
+
+#if defined(__sgi) && !defined(IPFILTER_LKM)
+# ifdef __STDC__
+# define IPL_EXTERN(ep) ipfilter##ep
+# else
+# define IPL_EXTERN(ep) ipfilter/**/ep
+# endif
+#else
+# ifdef __STDC__
+# define IPL_EXTERN(ep) ipl##ep
+# else
+# define IPL_EXTERN(ep) ipl/**/ep
+# endif
+#endif
+
+#ifdef linux
+# include <sys/sysmacros.h>
+#endif
+#if SOLARIS
+# define MTYPE(m) ((m)->b_datap->db_type)
+# include <sys/isa_defs.h>
+# include <sys/ioccom.h>
+# include <sys/sysmacros.h>
+# include <sys/kmem.h>
+/*
+ * because Solaris 2 defines these in two places :-/
+ */
+# undef IPOPT_EOL
+# undef IPOPT_NOP
+# undef IPOPT_LSRR
+# undef IPOPT_RR
+# undef IPOPT_SSRR
+# ifndef KERNEL
+# define _KERNEL
+# undef RES_INIT
+# include <inet/common.h>
+# include <inet/ip.h>
+# include <inet/ip_ire.h>
+# undef _KERNEL
+# else /* _KERNEL */
+# include <inet/common.h>
+# include <inet/ip.h>
+# include <inet/ip_ire.h>
+# endif /* _KERNEL */
+# if SOLARIS2 >= 8
+# include <netinet/ip6.h>
+# include <inet/ip6.h>
+# define ipif_local_addr ipif_lcl_addr
+# endif
+#else
+# if !defined(__sgi)
+typedef int minor_t;
+#endif
+#endif /* SOLARIS */
+#define IPMINLEN(i, h) ((i)->ip_len >= ((i)->ip_hl * 4 + sizeof(struct h)))
+
+#ifndef IP_OFFMASK
+#define IP_OFFMASK 0x1fff
+#endif
+
+#if BSD > 199306
+# define USE_QUAD_T
+# define U_QUAD_T u_quad_t
+# define QUAD_T quad_t
+#else /* BSD > 199306 */
+# define U_QUAD_T u_long
+# define QUAD_T long
+#endif /* BSD > 199306 */
+
+/*
+ * These operating systems already take care of the problem for us.
+ */
+#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || \
+ defined(__sgi)
+typedef u_int32_t u_32_t;
+#else
+/*
+ * Really, any arch where sizeof(long) != sizeof(int).
+ */
+# if defined(__alpha__) || defined(__alpha) || defined(_LP64)
+typedef unsigned int u_32_t;
+# else
+typedef unsigned long u_32_t;
+# endif
+#endif /* __NetBSD__ || __OpenBSD__ || __FreeBSD__ || __sgi */
+
+#ifndef MAX
+#define MAX(a,b) (((a) > (b)) ? (a) : (b))
+#endif
+
+/*
+ * Security Options for Intenet Protocol (IPSO) as defined in RFC 1108.
+ *
+ * Basic Option
+ *
+ * 00000001 - (Reserved 4)
+ * 00111101 - Top Secret
+ * 01011010 - Secret
+ * 10010110 - Confidential
+ * 01100110 - (Reserved 3)
+ * 11001100 - (Reserved 2)
+ * 10101011 - Unclassified
+ * 11110001 - (Reserved 1)
+ */
+#define IPSO_CLASS_RES4 0x01
+#define IPSO_CLASS_TOPS 0x3d
+#define IPSO_CLASS_SECR 0x5a
+#define IPSO_CLASS_CONF 0x96
+#define IPSO_CLASS_RES3 0x66
+#define IPSO_CLASS_RES2 0xcc
+#define IPSO_CLASS_UNCL 0xab
+#define IPSO_CLASS_RES1 0xf1
+
+#define IPSO_AUTH_GENSER 0x80
+#define IPSO_AUTH_ESI 0x40
+#define IPSO_AUTH_SCI 0x20
+#define IPSO_AUTH_NSA 0x10
+#define IPSO_AUTH_DOE 0x08
+#define IPSO_AUTH_UN 0x06
+#define IPSO_AUTH_FTE 0x01
+
+/*
+ * IP option #defines
+ */
+/*#define IPOPT_RR 7 */
+#define IPOPT_ZSU 10 /* ZSU */
+#define IPOPT_MTUP 11 /* MTUP */
+#define IPOPT_MTUR 12 /* MTUR */
+#define IPOPT_ENCODE 15 /* ENCODE */
+/*#define IPOPT_TS 68 */
+#define IPOPT_TR 82 /* TR */
+/*#define IPOPT_SECURITY 130 */
+/*#define IPOPT_LSRR 131 */
+#define IPOPT_E_SEC 133 /* E-SEC */
+#define IPOPT_CIPSO 134 /* CIPSO */
+/*#define IPOPT_SATID 136 */
+#ifndef IPOPT_SID
+# define IPOPT_SID IPOPT_SATID
+#endif
+/*#define IPOPT_SSRR 137 */
+#define IPOPT_ADDEXT 147 /* ADDEXT */
+#define IPOPT_VISA 142 /* VISA */
+#define IPOPT_IMITD 144 /* IMITD */
+#define IPOPT_EIP 145 /* EIP */
+#define IPOPT_FINN 205 /* FINN */
+
+
+#if defined(__FreeBSD__) && defined(KERNEL)
+# if __FreeBSD__ < 3
+# include <machine/spl.h>
+# endif
+# if defined(IPFILTER_LKM) && !defined(ACTUALLY_LKM_NOT_KERNEL)
+# define ACTUALLY_LKM_NOT_KERNEL
+# endif
+#endif /* __FreeBSD__ && KERNEL */
+
+/*
+ * Build some macros and #defines to enable the same code to compile anywhere
+ * Well, that's the idea, anyway :-)
+ */
+#ifdef KERNEL
+# if SOLARIS
+# define ATOMIC_INC(x) { mutex_enter(&ipf_rw); (x)++; \
+ mutex_exit(&ipf_rw); }
+# define ATOMIC_DEC(x) { mutex_enter(&ipf_rw); (x)--; \
+ mutex_exit(&ipf_rw); }
+# define MUTEX_ENTER(x) mutex_enter(x)
+# if 1
+# define KRWLOCK_T krwlock_t
+# define READ_ENTER(x) rw_enter(x, RW_READER)
+# define WRITE_ENTER(x) rw_enter(x, RW_WRITER)
+# define RW_UPGRADE(x) { if (rw_tryupgrade(x) == 0) { \
+ rw_exit(x); \
+ rw_enter(x, RW_WRITER); } \
+ }
+# define MUTEX_DOWNGRADE(x) rw_downgrade(x)
+# define RWLOCK_INIT(x, y, z) rw_init((x), (y), RW_DRIVER, (z))
+# define RWLOCK_EXIT(x) rw_exit(x)
+# define RW_DESTROY(x) rw_destroy(x)
+# else
+# define KRWLOCK_T kmutex_t
+# define READ_ENTER(x) mutex_enter(x)
+# define WRITE_ENTER(x) mutex_enter(x)
+# define MUTEX_DOWNGRADE(x) ;
+# define RWLOCK_INIT(x, y, z) mutex_init((x), (y), MUTEX_DRIVER, (z))
+# define RWLOCK_EXIT(x) mutex_exit(x)
+# define RW_DESTROY(x) mutex_destroy(x)
+# endif
+# define MUTEX_EXIT(x) mutex_exit(x)
+# define MTOD(m,t) (t)((m)->b_rptr)
+# define IRCOPY(a,b,c) copyin((a), (b), (c))
+# define IWCOPY(a,b,c) copyout((a), (b), (c))
+# define FREE_MB_T(m) freemsg(m)
+# define SPL_NET(x) ;
+# define SPL_IMP(x) ;
+# undef SPL_X
+# define SPL_X(x) ;
+# ifdef sparc
+# define ntohs(x) (x)
+# define ntohl(x) (x)
+# define htons(x) (x)
+# define htonl(x) (x)
+# endif /* sparc */
+# define KMALLOC(a,b) (a) = (b)kmem_alloc(sizeof(*(a)), KM_NOSLEEP)
+# define KMALLOCS(a,b,c) (a) = (b)kmem_alloc((c), KM_NOSLEEP)
+# define GET_MINOR(x) getminor(x)
+typedef struct qif {
+ struct qif *qf_next;
+ ill_t *qf_ill;
+ kmutex_t qf_lock;
+ void *qf_iptr;
+ void *qf_optr;
+ queue_t *qf_in;
+ queue_t *qf_out;
+ struct qinit *qf_wqinfo;
+ struct qinit *qf_rqinfo;
+ struct qinit qf_wqinit;
+ struct qinit qf_rqinit;
+ mblk_t *qf_m; /* These three fields are for passing data up from */
+ queue_t *qf_q; /* fr_qin and fr_qout to the packet processing. */
+ size_t qf_off;
+ size_t qf_len; /* this field is used for in ipfr_fastroute */
+ char qf_name[8];
+ /*
+ * in case the ILL has disappeared...
+ */
+ size_t qf_hl; /* header length */
+} qif_t;
+extern ill_t *get_unit __P((char *));
+# define GETUNIT(n) get_unit((n))
+# else /* SOLARIS */
+# if defined(__sgi)
+# define hz HZ
+# include <sys/ksynch.h>
+# define IPF_LOCK_PL plhi
+# include <sys/sema.h>
+#undef kmutex_t
+typedef struct {
+ lock_t *l;
+ int pl;
+} kmutex_t;
+# define ATOMIC_INC(x) { MUTEX_ENTER(&ipf_rw); \
+ (x)++; MUTEX_EXIT(&ipf_rw); }
+# define ATOMIC_DEC(x) { MUTEX_ENTER(&ipf_rw); \
+ (x)--; MUTEX_EXIT(&ipf_rw); }
+# define MUTEX_ENTER(x) (x)->pl = LOCK((x)->l, IPF_LOCK_PL);
+# define KRWLOCK_T kmutex_t
+# define READ_ENTER(x) MUTEX_ENTER(x)
+# define WRITE_ENTER(x) MUTEX_ENTER(x)
+# define RW_UPGRADE(x) ;
+# define MUTEX_DOWNGRADE(x) ;
+# define RWLOCK_EXIT(x) MUTEX_EXIT(x)
+# define MUTEX_EXIT(x) UNLOCK((x)->l, (x)->pl);
+# else /* __sgi */
+# define ATOMIC_INC(x) (x)++
+# define ATOMIC_DEC(x) (x)--
+# define MUTEX_ENTER(x) ;
+# define READ_ENTER(x) ;
+# define WRITE_ENTER(x) ;
+# define RW_UPGRADE(x) ;
+# define MUTEX_DOWNGRADE(x) ;
+# define RWLOCK_EXIT(x) ;
+# define MUTEX_EXIT(x) ;
+# endif /* __sgi */
+# ifndef linux
+# define FREE_MB_T(m) m_freem(m)
+# define MTOD(m,t) mtod(m,t)
+# define IRCOPY(a,b,c) bcopy((a), (b), (c))
+# define IWCOPY(a,b,c) bcopy((a), (b), (c))
+# endif /* !linux */
+# endif /* SOLARIS */
+
+# ifdef sun
+# if !SOLARIS
+# include <sys/kmem_alloc.h>
+# define GETUNIT(n) ifunit((n), IFNAMSIZ)
+# endif
+# else
+# ifndef linux
+# define GETUNIT(n) ifunit((n))
+# endif
+# endif /* sun */
+
+# if defined(sun) && !defined(linux) || defined(__sgi)
+# define UIOMOVE(a,b,c,d) uiomove((caddr_t)a,b,c,d)
+# define SLEEP(id, n) sleep((id), PZERO+1)
+# define WAKEUP(id) wakeup(id)
+# define KFREE(x) kmem_free((char *)(x), sizeof(*(x)))
+# define KFREES(x,s) kmem_free((char *)(x), (s))
+# if !SOLARIS
+extern void m_copydata __P((struct mbuf *, int, int, caddr_t));
+extern void m_copyback __P((struct mbuf *, int, int, caddr_t));
+# endif
+# ifdef __sgi
+# include <sys/kmem.h>
+# include <sys/ddi.h>
+# define KMALLOC(a,b) (a) = (b)kmem_alloc(sizeof(*(a)), KM_NOSLEEP)
+# define KMALLOCS(a,b,c) (a) = (b)kmem_alloc((c), KM_NOSLEEP)
+# define GET_MINOR(x) getminor(x)
+# else
+# if !SOLARIS
+# define KMALLOC(a,b) (a) = (b)new_kmem_alloc(sizeof(*(a)), \
+ KMEM_NOSLEEP)
+# define KMALLOCS(a,b,c) (a) = (b)new_kmem_alloc((c), KMEM_NOSLEEP)
+# endif /* SOLARIS */
+# endif /* __sgi */
+# endif /* sun && !linux */
+# ifndef GET_MINOR
+# define GET_MINOR(x) minor(x)
+# endif
+# if (BSD >= 199306) || defined(__FreeBSD__)
+# include <vm/vm.h>
+# if !defined(__FreeBSD__) || (defined (__FreeBSD__) && __FreeBSD__>=3)
+# include <vm/vm_extern.h>
+# include <sys/proc.h>
+extern vm_map_t kmem_map;
+# else /* !__FreeBSD__ || (__FreeBSD__ && __FreeBSD__>=3) */
+# include <vm/vm_kern.h>
+# endif /* !__FreeBSD__ || (__FreeBSD__ && __FreeBSD__>=3) */
+# ifdef M_PFIL
+# define KMALLOC(a, b) MALLOC((a), b, sizeof(*(a)), M_PFIL, M_NOWAIT)
+# define KMALLOCS(a, b, c) MALLOC((a), b, (c), M_PFIL, M_NOWAIT)
+# define KFREE(x) FREE((x), M_PFIL)
+# define KFREES(x,s) FREE((x), M_PFIL)
+# else
+# define KMALLOC(a, b) MALLOC((a), b, sizeof(*(a)), M_TEMP, M_NOWAIT)
+# define KMALLOCS(a, b, c) MALLOC((a), b, (c), M_TEMP, M_NOWAIT)
+# define KFREE(x) FREE((x), M_TEMP)
+# define KFREES(x,s) FREE((x), M_TEMP)
+# endif /* M_PFIL */
+# define UIOMOVE(a,b,c,d) uiomove(a,b,d)
+# define SLEEP(id, n) tsleep((id), PPAUSE|PCATCH, n, 0)
+# define WAKEUP(id) wakeup(id)
+# endif /* BSD */
+# if defined(NetBSD) && NetBSD <= 1991011 && NetBSD >= 199407
+# define SPL_NET(x) x = splsoftnet()
+# define SPL_X(x) (void) splx(x)
+# else
+# if !SOLARIS && !defined(linux)
+# define SPL_IMP(x) x = splimp()
+# define SPL_NET(x) x = splnet()
+# define SPL_X(x) (void) splx(x)
+# endif
+# endif /* NetBSD && NetBSD <= 1991011 && NetBSD >= 199407 */
+# define PANIC(x,y) if (x) panic y
+#else /* KERNEL */
+# define SLEEP(x,y) ;
+# define WAKEUP(x) ;
+# define PANIC(x,y) ;
+# define ATOMIC_INC(x) (x)++
+# define ATOMIC_DEC(x) (x)--
+# define MUTEX_ENTER(x) ;
+# define READ_ENTER(x) ;
+# define WRITE_ENTER(x) ;
+# define RW_UPGRADE(x) ;
+# define MUTEX_DOWNGRADE(x) ;
+# define RWLOCK_EXIT(x) ;
+# define MUTEX_EXIT(x) ;
+# define SPL_NET(x) ;
+# define SPL_IMP(x) ;
+# undef SPL_X
+# define SPL_X(x) ;
+# define KMALLOC(a,b) (a) = (b)malloc(sizeof(*a))
+# define KMALLOCS(a,b,c) (a) = (b)malloc(c)
+# define KFREE(x) free(x)
+# define KFREES(x,s) free(x)
+# define GETUNIT(x) get_unit(x)
+# define IRCOPY(a,b,c) bcopy((a), (b), (c))
+# define IWCOPY(a,b,c) bcopy((a), (b), (c))
+#endif /* KERNEL */
+
+#if SOLARIS
+typedef mblk_t mb_t;
+# if SOLARIS2 >= 7
+# ifdef lint
+# define ALIGN32(ptr) (ptr ? 0L : 0L)
+# define ALIGN16(ptr) (ptr ? 0L : 0L)
+# else
+# define ALIGN32(ptr) (ptr)
+# define ALIGN16(ptr) (ptr)
+# endif
+# endif
+#else
+# ifdef linux
+# ifndef kernel
+typedef struct mb {
+ struct mb *next;
+ u_int len;
+ u_char *data;
+} mb_t;
+# else
+typedef struct sk_buff mb_t;
+# endif
+# else
+typedef struct mbuf mb_t;
+# endif
+#endif /* SOLARIS */
+
+#if defined(linux) || defined(__sgi)
+/*
+ * These #ifdef's are here mainly for linux, but who knows, they may
+ * not be in other places or maybe one day linux will grow up and some
+ * of these will turn up there too.
+ */
+#ifndef ICMP_MINLEN
+# define ICMP_MINLEN 8
+#endif
+#ifndef ICMP_UNREACH
+# define ICMP_UNREACH ICMP_DEST_UNREACH
+#endif
+#ifndef ICMP_SOURCEQUENCH
+# define ICMP_SOURCEQUENCH ICMP_SOURCE_QUENCH
+#endif
+#ifndef ICMP_TIMXCEED
+# define ICMP_TIMXCEED ICMP_TIME_EXCEEDED
+#endif
+#ifndef ICMP_PARAMPROB
+# define ICMP_PARAMPROB ICMP_PARAMETERPROB
+#endif
+#ifndef ICMP_TSTAMP
+# define ICMP_TSTAMP ICMP_TIMESTAMP
+#endif
+#ifndef ICMP_TSTAMPREPLY
+# define ICMP_TSTAMPREPLY ICMP_TIMESTAMPREPLY
+#endif
+#ifndef ICMP_IREQ
+# define ICMP_IREQ ICMP_INFO_REQUEST
+#endif
+#ifndef ICMP_IREQREPLY
+# define ICMP_IREQREPLY ICMP_INFO_REPLY
+#endif
+#ifndef ICMP_MASKREQ
+# define ICMP_MASKREQ ICMP_ADDRESS
+#endif
+#ifndef ICMP_MASKREPLY
+# define ICMP_MASKREPLY ICMP_ADDRESSREPLY
+#endif
+#ifndef IPVERSION
+# define IPVERSION 4
+#endif
+#ifndef IPOPT_MINOFF
+# define IPOPT_MINOFF 4
+#endif
+#ifndef IPOPT_COPIED
+# define IPOPT_COPIED(x) ((x)&0x80)
+#endif
+#ifndef IPOPT_EOL
+# define IPOPT_EOL 0
+#endif
+#ifndef IPOPT_NOP
+# define IPOPT_NOP 1
+#endif
+#ifndef IP_MF
+# define IP_MF ((u_short)0x2000)
+#endif
+#ifndef ETHERTYPE_IP
+# define ETHERTYPE_IP ((u_short)0x0800)
+#endif
+#ifndef TH_FIN
+# define TH_FIN 0x01
+#endif
+#ifndef TH_SYN
+# define TH_SYN 0x02
+#endif
+#ifndef TH_RST
+# define TH_RST 0x04
+#endif
+#ifndef TH_PUSH
+# define TH_PUSH 0x08
+#endif
+#ifndef TH_ACK
+# define TH_ACK 0x10
+#endif
+#ifndef TH_URG
+# define TH_URG 0x20
+#endif
+#ifndef IPOPT_EOL
+# define IPOPT_EOL 0
+#endif
+#ifndef IPOPT_NOP
+# define IPOPT_NOP 1
+#endif
+#ifndef IPOPT_RR
+# define IPOPT_RR 7
+#endif
+#ifndef IPOPT_TS
+# define IPOPT_TS 68
+#endif
+#ifndef IPOPT_SECURITY
+# define IPOPT_SECURITY 130
+#endif
+#ifndef IPOPT_LSRR
+# define IPOPT_LSRR 131
+#endif
+#ifndef IPOPT_SATID
+# define IPOPT_SATID 136
+#endif
+#ifndef IPOPT_SSRR
+# define IPOPT_SSRR 137
+#endif
+#ifndef IPOPT_SECUR_UNCLASS
+# define IPOPT_SECUR_UNCLASS ((u_short)0x0000)
+#endif
+#ifndef IPOPT_SECUR_CONFID
+# define IPOPT_SECUR_CONFID ((u_short)0xf135)
+#endif
+#ifndef IPOPT_SECUR_EFTO
+# define IPOPT_SECUR_EFTO ((u_short)0x789a)
+#endif
+#ifndef IPOPT_SECUR_MMMM
+# define IPOPT_SECUR_MMMM ((u_short)0xbc4d)
+#endif
+#ifndef IPOPT_SECUR_RESTR
+# define IPOPT_SECUR_RESTR ((u_short)0xaf13)
+#endif
+#ifndef IPOPT_SECUR_SECRET
+# define IPOPT_SECUR_SECRET ((u_short)0xd788)
+#endif
+#ifndef IPOPT_SECUR_TOPSECRET
+# define IPOPT_SECUR_TOPSECRET ((u_short)0x6bc5)
+#endif
+#ifndef IPOPT_OLEN
+# define IPOPT_OLEN 1
+#endif
+#endif /* linux || __sgi */
+
+#ifdef linux
+#include <linux/in_systm.h>
+/*
+ * TCP States
+ */
+#define TCPS_CLOSED 0 /* closed */
+#define TCPS_LISTEN 1 /* listening for connection */
+#define TCPS_SYN_SENT 2 /* active, have sent syn */
+#define TCPS_SYN_RECEIVED 3 /* have send and received syn */
+/* states < TCPS_ESTABLISHED are those where connections not established */
+#define TCPS_ESTABLISHED 4 /* established */
+#define TCPS_CLOSE_WAIT 5 /* rcvd fin, waiting for close */
+/* states > TCPS_CLOSE_WAIT are those where user has closed */
+#define TCPS_FIN_WAIT_1 6 /* have closed, sent fin */
+#define TCPS_CLOSING 7 /* closed xchd FIN; await FIN ACK */
+#define TCPS_LAST_ACK 8 /* had fin and close; await FIN ACK */
+/* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */
+#define TCPS_FIN_WAIT_2 9 /* have closed, fin is acked */
+#define TCPS_TIME_WAIT 10 /* in 2*msl quiet wait after close */
+
+/*
+ * file flags.
+ */
+#ifdef WRITE
+#define FWRITE WRITE
+#define FREAD READ
+#else
+#define FWRITE _IOC_WRITE
+#define FREAD _IOC_READ
+#endif
+/*
+ * mbuf related problems.
+ */
+#define mtod(m,t) (t)((m)->data)
+#define m_len len
+#define m_next next
+
+#ifdef IP_DF
+#undef IP_DF
+#endif
+#define IP_DF 0x4000
+
+typedef struct {
+ __u16 th_sport;
+ __u16 th_dport;
+ __u32 th_seq;
+ __u32 th_ack;
+# if defined(__i386__) || defined(__MIPSEL__) || defined(__alpha__) ||\
+ defined(vax)
+ __u8 th_res:4;
+ __u8 th_off:4;
+#else
+ __u8 th_off:4;
+ __u8 th_res:4;
+#endif
+ __u8 th_flags;
+ __u16 th_win;
+ __u16 th_sum;
+ __u16 th_urp;
+} tcphdr_t;
+
+typedef struct {
+ __u16 uh_sport;
+ __u16 uh_dport;
+ __u16 uh_ulen;
+ __u16 uh_sum;
+} udphdr_t;
+
+typedef struct {
+# if defined(__i386__) || defined(__MIPSEL__) || defined(__alpha__) ||\
+ defined(vax)
+ __u8 ip_hl:4;
+ __u8 ip_v:4;
+# else
+ __u8 ip_v:4;
+ __u8 ip_hl:4;
+# endif
+ __u8 ip_tos;
+ __u16 ip_len;
+ __u16 ip_id;
+ __u16 ip_off;
+ __u8 ip_ttl;
+ __u8 ip_p;
+ __u16 ip_sum;
+ struct in_addr ip_src;
+ struct in_addr ip_dst;
+} ip_t;
+
+/*
+ * Structure of an icmp header.
+ */
+typedef struct icmp {
+ __u8 icmp_type; /* type of message, see below */
+ __u8 icmp_code; /* type sub code */
+ __u16 icmp_cksum; /* ones complement cksum of struct */
+ union {
+ __u8 ih_pptr; /* ICMP_PARAMPROB */
+ struct in_addr ih_gwaddr; /* ICMP_REDIRECT */
+ struct ih_idseq {
+ __u16 icd_id;
+ __u16 icd_seq;
+ } ih_idseq;
+ int ih_void;
+ } icmp_hun;
+# define icmp_pptr icmp_hun.ih_pptr
+# define icmp_gwaddr icmp_hun.ih_gwaddr
+# define icmp_id icmp_hun.ih_idseq.icd_id
+# define icmp_seq icmp_hun.ih_idseq.icd_seq
+# define icmp_void icmp_hun.ih_void
+ union {
+ struct id_ts {
+ n_time its_otime;
+ n_time its_rtime;
+ n_time its_ttime;
+ } id_ts;
+ struct id_ip {
+ ip_t idi_ip;
+ /* options and then 64 bits of data */
+ } id_ip;
+ u_long id_mask;
+ char id_data[1];
+ } icmp_dun;
+# define icmp_otime icmp_dun.id_ts.its_otime
+# define icmp_rtime icmp_dun.id_ts.its_rtime
+# define icmp_ttime icmp_dun.id_ts.its_ttime
+# define icmp_ip icmp_dun.id_ip.idi_ip
+# define icmp_mask icmp_dun.id_mask
+# define icmp_data icmp_dun.id_data
+} icmphdr_t;
+
+# ifndef LINUX_IPOVLY
+# define LINUX_IPOVLY
+struct ipovly {
+ caddr_t ih_next, ih_prev; /* for protocol sequence q's */
+ u_char ih_x1; /* (unused) */
+ u_char ih_pr; /* protocol */
+ short ih_len; /* protocol length */
+ struct in_addr ih_src; /* source internet address */
+ struct in_addr ih_dst; /* destination internet address */
+};
+# endif
+
+typedef struct {
+ __u8 ether_dhost[6];
+ __u8 ether_shost[6];
+ __u16 ether_type;
+} ether_header_t;
+
+typedef struct uio {
+ int uio_resid;
+ int uio_rw;
+ caddr_t uio_buf;
+} uio_t;
+
+# define UIO_READ 0
+# define UIO_WRITE 1
+# define UIOMOVE(a, b, c, d) uiomove(a,b,c,d)
+
+/*
+ * For masking struct ifnet onto struct device
+ */
+# define if_name name
+
+# ifdef KERNEL
+# define GETUNIT(x) dev_get(x)
+# define FREE_MB_T(m) kfree_skb(m, FREE_WRITE)
+# define uniqtime do_gettimeofday
+# undef INT_MAX
+# undef UINT_MAX
+# undef LONG_MAX
+# undef ULONG_MAX
+# include <linux/netdevice.h>
+# define SPL_X(x)
+# define SPL_NET(x)
+# define SPL_IMP(x)
+
+# define bcmp(a,b,c) memcmp(a,b,c)
+# define bcopy(a,b,c) memcpy(b,a,c)
+# define bzero(a,c) memset(a,0,c)
+
+# define UNITNAME(n) dev_get((n))
+
+# define KMALLOC(a,b) (a) = (b)kmalloc(sizeof(*(a)), GFP_ATOMIC)
+# define KMALLOCS(a,b,c) (a) = (b)kmalloc((c), GFP_ATOMIC)
+# define KFREE(x) kfree_s((x), sizeof(*(x)))
+# define KFREES(x,s) kfree_s((x), (s))
+# define IRCOPY(a,b,c) { \
+ error = verify_area(VERIFY_READ, (a) ,(c)); \
+ if (!error) \
+ memcpy_fromfs((b), (a), (c)); \
+ }
+# define IWCOPY(a,b,c) { \
+ error = verify_area(VERIFY_WRITE, (b), (c)); \
+ if (!error) \
+ memcpy_tofs((b), (a), (c)); \
+ }
+# else
+# define __KERNEL__
+# undef INT_MAX
+# undef UINT_MAX
+# undef LONG_MAX
+# undef ULONG_MAX
+# define s8 __s8
+# define u8 __u8
+# define s16 __s16
+# define u16 __u16
+# define s32 __s32
+# define u32 __u32
+# include <linux/netdevice.h>
+# undef __KERNEL__
+# endif
+# define ifnet device
+#else
+typedef struct tcphdr tcphdr_t;
+typedef struct udphdr udphdr_t;
+typedef struct icmp icmphdr_t;
+typedef struct ip ip_t;
+typedef struct ether_header ether_header_t;
+#endif /* linux */
+typedef struct tcpiphdr tcpiphdr_t;
+
+#if defined(hpux) || defined(linux)
+struct ether_addr {
+ char ether_addr_octet[6];
+};
+#endif
+
+/*
+ * XXX - This is one of those *awful* hacks which nobody likes
+ */
+#ifdef ultrix
+#define A_A
+#else
+#define A_A &
+#endif
+
+#ifndef ICMP_ROUTERADVERT
+# define ICMP_ROUTERADVERT 9
+#endif
+#ifndef ICMP_ROUTERSOLICIT
+# define ICMP_ROUTERSOLICIT 10
+#endif
+/*
+ * ICMP error replies have an IP header (20 bytes), 8 bytes of ICMP data,
+ * another IP header and then 64 bits of data, totalling 56. Of course,
+ * the last 64 bits is dependant on that being available.
+ */
+#define ICMPERR_ICMPHLEN 8
+#define ICMPERR_IPICMPHLEN (20 + 8)
+#define ICMPERR_MINPKTLEN (20 + 8 + 20)
+#define ICMPERR_MAXPKTLEN (20 + 8 + 20 + 8)
+
+#endif /* _NETINET_IP_COMPAT_H__ */
diff --git a/ecos/packages/net/tcpip/current/include/netinet/ip_frag.h b/ecos/packages/net/tcpip/current/include/netinet/ip_frag.h
new file mode 100644
index 0000000..c61df9d
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/ip_frag.h
@@ -0,0 +1,92 @@
+//==========================================================================
+//
+// include/netinet/ip_fil.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ip_frag.h,v 1.9 1999/12/15 05:20:22 kjell Exp $ */
+/*
+ * Copyright (C) 1993-1998 by Darren Reed.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and due credit is given
+ * to the original author and the contributors.
+ *
+ * @(#)ip_frag.h 1.5 3/24/96
+ */
+
+#ifndef _NETINET_IP_FRAG_H__
+#define _NETINET_IP_FRAG_H__
+
+#define IPFT_SIZE 257
+
+typedef struct ipfr {
+ struct ipfr *ipfr_next, *ipfr_prev;
+ void *ipfr_data;
+ struct in_addr ipfr_src;
+ struct in_addr ipfr_dst;
+ u_short ipfr_id;
+ u_char ipfr_p;
+ u_char ipfr_tos;
+ u_short ipfr_off;
+ u_short ipfr_ttl;
+ frentry_t *ipfr_rule;
+} ipfr_t;
+
+
+typedef struct ipfrstat {
+ u_long ifs_exists; /* add & already exists */
+ u_long ifs_nomem;
+ u_long ifs_new;
+ u_long ifs_hits;
+ u_long ifs_expire;
+ u_long ifs_inuse;
+ struct ipfr **ifs_table;
+ struct ipfr **ifs_nattab;
+} ipfrstat_t;
+
+#define IPFR_CMPSZ (4 + 4 + 2 + 1 + 1)
+
+extern int fr_ipfrttl;
+extern ipfrstat_t *ipfr_fragstats __P((void));
+extern int ipfr_newfrag __P((ip_t *, fr_info_t *, u_int));
+extern int ipfr_nat_newfrag __P((ip_t *, fr_info_t *, u_int, struct nat *));
+extern nat_t *ipfr_nat_knownfrag __P((ip_t *, fr_info_t *));
+extern frentry_t *ipfr_knownfrag __P((ip_t *, fr_info_t *));
+extern void ipfr_forget __P((void *));
+extern void ipfr_unload __P((void));
+
+#if (BSD >= 199306) || SOLARIS || defined(__sgi)
+# if defined(SOLARIS2) && (SOLARIS2 < 7)
+extern void ipfr_slowtimer __P((void));
+# else
+extern void ipfr_slowtimer __P((void *));
+# endif
+#else
+extern int ipfr_slowtimer __P((void));
+#endif
+
+#endif /* _NETINET_IP_FIL_H__ */
diff --git a/ecos/packages/net/tcpip/current/include/netinet/ip_icmp.h b/ecos/packages/net/tcpip/current/include/netinet/ip_icmp.h
new file mode 100644
index 0000000..fd92260
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/ip_icmp.h
@@ -0,0 +1,223 @@
+//==========================================================================
+//
+// include/netinet/ip_icmp.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ip_icmp.h,v 1.9 1999/01/07 09:20:17 deraadt Exp $ */
+/* $NetBSD: ip_icmp.h,v 1.10 1996/02/13 23:42:28 christos Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * 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.
+ *
+ * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_IP_ICMP_H_
+#define _NETINET_IP_ICMP_H_
+
+/*
+ * Interface Control Message Protocol Definitions.
+ * Per RFC 792, September 1981.
+ */
+
+/*
+ * ICMP Router Advertisement data
+ */
+struct icmp_ra_addr {
+ n_long ira_addr;
+ n_long ira_preference;
+} __attribute__ ((aligned(1), packed));
+
+/*
+ * Structure of an icmp header.
+ */
+struct icmp {
+ u_int8_t icmp_type; /* type of message, see below */
+ u_int8_t icmp_code; /* type sub code */
+ u_int16_t icmp_cksum; /* ones complement cksum of struct */
+ union {
+ u_int8_t ih_pptr; /* ICMP_PARAMPROB */
+ struct in_addr ih_gwaddr; /* ICMP_REDIRECT */
+ struct ih_idseq {
+ n_short icd_id;
+ n_short icd_seq;
+ } ih_idseq;
+ int32_t ih_void;
+
+ /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
+ struct ih_pmtu {
+ n_short ipm_void;
+ n_short ipm_nextmtu;
+ } ih_pmtu;
+
+ struct ih_rtradv {
+ u_int8_t irt_num_addrs;
+ u_int8_t irt_wpa;
+ n_short irt_lifetime;
+ } ih_rtradv;
+ } icmp_hun;
+#define icmp_pptr icmp_hun.ih_pptr
+#define icmp_gwaddr icmp_hun.ih_gwaddr
+#define icmp_id icmp_hun.ih_idseq.icd_id
+#define icmp_seq icmp_hun.ih_idseq.icd_seq
+#define icmp_void icmp_hun.ih_void
+#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void
+#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu
+#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs
+#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa
+#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime
+ union {
+ struct id_ts {
+ n_time its_otime;
+ n_time its_rtime;
+ n_time its_ttime;
+ } id_ts;
+ struct id_ip {
+ struct ip idi_ip;
+ /* options and then 64 bits of data */
+ } id_ip;
+ u_int32_t id_mask;
+ int8_t id_data[1];
+ } icmp_dun;
+#define icmp_otime icmp_dun.id_ts.its_otime
+#define icmp_rtime icmp_dun.id_ts.its_rtime
+#define icmp_ttime icmp_dun.id_ts.its_ttime
+#define icmp_ip icmp_dun.id_ip.idi_ip
+#define icmp_mask icmp_dun.id_mask
+#define icmp_data icmp_dun.id_data
+} __attribute__ ((aligned(1), packed));
+
+/*
+ * For IPv6 transition related ICMP errors.
+ */
+#define ICMP_V6ADVLENMIN (8 + sizeof(struct ip) + 40)
+#define ICMP_V6ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 40)
+
+/*
+ * Lower bounds on packet lengths for various types.
+ * For the error advice packets must first insure that the
+ * packet is large enought to contain the returned ip header.
+ * Only then can we do the check to see if 64 bits of packet
+ * data have been returned, since we need to check the returned
+ * ip header length.
+ */
+#define ICMP_MINLEN 8 /* abs minimum */
+#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */
+#define ICMP_MASKLEN 12 /* address mask */
+#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */
+#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8)
+ /* N.B.: must separately check that ip_hl >= 5 */
+
+/*
+ * Definition of type and code field values.
+ */
+#define ICMP_ECHOREPLY 0 /* echo reply */
+#define ICMP_UNREACH 3 /* dest unreachable, codes: */
+#define ICMP_UNREACH_NET 0 /* bad net */
+#define ICMP_UNREACH_HOST 1 /* bad host */
+#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */
+#define ICMP_UNREACH_PORT 3 /* bad port */
+#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */
+#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */
+#define ICMP_UNREACH_NET_UNKNOWN 6 /* unknown net */
+#define ICMP_UNREACH_HOST_UNKNOWN 7 /* unknown host */
+#define ICMP_UNREACH_ISOLATED 8 /* src host isolated */
+#define ICMP_UNREACH_NET_PROHIB 9 /* for crypto devs */
+#define ICMP_UNREACH_HOST_PROHIB 10 /* ditto */
+#define ICMP_UNREACH_TOSNET 11 /* bad tos for net */
+#define ICMP_UNREACH_TOSHOST 12 /* bad tos for host */
+#define ICMP_UNREACH_FILTER_PROHIB 13 /* prohibited access */
+#define ICMP_UNREACH_HOST_PRECEDENCE 14 /* precedence violat'n*/
+#define ICMP_UNREACH_PRECEDENCE_CUTOFF 15 /* precedence cutoff */
+#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */
+#define ICMP_REDIRECT 5 /* shorter route, codes: */
+#define ICMP_REDIRECT_NET 0 /* for network */
+#define ICMP_REDIRECT_HOST 1 /* for host */
+#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */
+#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */
+#define ICMP_ECHO 8 /* echo service */
+#define ICMP_ROUTERADVERT 9 /* router advertisement */
+#define ICMP_ROUTERSOLICIT 10 /* router solicitation */
+#define ICMP_TIMXCEED 11 /* time exceeded, code: */
+#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */
+#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */
+#define ICMP_PARAMPROB 12 /* ip header bad */
+#define ICMP_PARAMPROB_OPTABSENT 1 /* req. opt. absent */
+#define ICMP_TSTAMP 13 /* timestamp request */
+#define ICMP_TSTAMPREPLY 14 /* timestamp reply */
+#define ICMP_IREQ 15 /* information request */
+#define ICMP_IREQREPLY 16 /* information reply */
+#define ICMP_MASKREQ 17 /* address mask request */
+#define ICMP_MASKREPLY 18 /* address mask reply */
+
+#define ICMP_MAXTYPE 18
+
+#define ICMP_INFOTYPE(type) \
+ ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \
+ (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \
+ (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
+ (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
+ (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
+
+#ifdef _KERNEL
+void icmp_error __P((struct mbuf *, int, int, n_long, struct ifnet *));
+void icmp_input __P((struct mbuf *, ...));
+void icmp_reflect __P((struct mbuf *));
+void icmp_send __P((struct mbuf *, struct mbuf *));
+int icmp_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
+#endif
+
+#endif // _NETINET_IP_ICMP_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/ip_ip4.h b/ecos/packages/net/tcpip/current/include/netinet/ip_ip4.h
new file mode 100644
index 0000000..c5ab059
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/ip_ip4.h
@@ -0,0 +1,110 @@
+//==========================================================================
+//
+// include/netinet/ip_ip4.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ip_ip4.h,v 1.16 1999/12/09 09:02:59 angelos Exp $ */
+
+/*
+ * The authors of this code are John Ioannidis (ji@tla.org),
+ * Angelos D. Keromytis (kermit@csd.uch.gr) and
+ * Niels Provos (provos@physnet.uni-hamburg.de).
+ *
+ * This code was written by John Ioannidis for BSD/OS in Athens, Greece,
+ * in November 1995.
+ *
+ * Ported to OpenBSD and NetBSD, with additional transforms, in December 1996,
+ * by Angelos D. Keromytis.
+ *
+ * Additional transforms and features in 1997 and 1998 by Angelos D. Keromytis
+ * and Niels Provos.
+ *
+ * Additional features in 1999 by Angelos D. Keromytis.
+ *
+ * Copyright (C) 1995, 1996, 1997, 1998, 1999 by John Ioannidis,
+ * Angelos D. Keromytis and Niels Provos.
+ *
+ * Permission to use, copy, and modify this software without fee
+ * is hereby granted, provided that this entire notice is included in
+ * all copies of any software which is or includes a copy or
+ * modification of this software.
+ * You may use this code under the GNU public license if you so wish. Please
+ * contribute changes back to the authors under this freer than GPL license
+ * so that we may further the use of strong encryption without limitations to
+ * all.
+ *
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
+ * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
+ * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
+ * PURPOSE.
+ */
+
+#ifndef _NETINET_IP_IP4_H_
+#define _NETINET_IP_IP4_H_
+
+/*
+ * IP-inside-IP processing.
+ * Not quite all the functionality of RFC-1853, but the main idea is there.
+ */
+
+struct ip4stat
+{
+ u_int32_t ip4s_ipackets; /* total input packets */
+ u_int32_t ip4s_opackets; /* total output packets */
+ u_int32_t ip4s_hdrops; /* packet shorter than header shows */
+ u_int32_t ip4s_qfull;
+ u_int64_t ip4s_ibytes;
+ u_int64_t ip4s_obytes;
+ u_int32_t ip4s_pdrops; /* packet dropped due to policy */
+ u_int32_t ip4s_spoof; /* IP spoofing attempts */
+ u_int32_t ip4s_family; /* Protocol family mismatch */
+ u_int32_t ip4s_unspec; /* Missing tunnel endpoint address */
+};
+
+#define IP4_DEFAULT_TTL 0
+#define IP4_SAME_TTL -1
+
+/*
+ * Names for IP4 sysctl objects
+ */
+#define IP4CTL_ALLOW 1 /* accept incoming IP4 packets */
+#define IP4CTL_MAXID 2
+
+#define IP4CTL_NAMES { \
+ { 0, 0 }, \
+ { "allow", CTLTYPE_INT }, \
+}
+
+#ifdef _KERNEL
+int ip4_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
+
+extern int ip4_allow;
+extern struct ip4stat ip4stat;
+#endif
+
+#endif // _NETINET_IP_IP4_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/ip_ipsp.h b/ecos/packages/net/tcpip/current/include/netinet/ip_ipsp.h
new file mode 100644
index 0000000..98f1e4f
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/ip_ipsp.h
@@ -0,0 +1,600 @@
+//==========================================================================
+//
+// include/netinet/ipsp.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ip_ipsp.h,v 1.50 1999/12/08 12:10:25 angelos Exp $ */
+
+/*
+ * The authors of this code are John Ioannidis (ji@tla.org),
+ * Angelos D. Keromytis (kermit@csd.uch.gr),
+ * Niels Provos (provos@physnet.uni-hamburg.de) and
+ * Niklas Hallqvist (niklas@appli.se).
+ *
+ * This code was written by John Ioannidis for BSD/OS in Athens, Greece,
+ * in November 1995.
+ *
+ * Ported to OpenBSD and NetBSD, with additional transforms, in December 1996,
+ * by Angelos D. Keromytis.
+ *
+ * Additional transforms and features in 1997 and 1998 by Angelos D. Keromytis
+ * and Niels Provos.
+ *
+ * Additional features in 1999 by Angelos D. Keromytis and Niklas Hallqvist.
+ *
+ * Copyright (c) 1995, 1996, 1997, 1998, 1999 by John Ioannidis,
+ * Angelos D. Keromytis and Niels Provos.
+ * Copyright (c) 1999 Niklas Hallqvist.
+ *
+ * Permission to use, copy, and modify this software without fee
+ * is hereby granted, provided that this entire notice is included in
+ * all copies of any software which is or includes a copy or
+ * modification of this software.
+ * You may use this code under the GNU public license if you so wish. Please
+ * contribute changes back to the authors under this freer than GPL license
+ * so that we may further the use of strong encryption without limitations to
+ * all.
+ *
+ * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
+ * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
+ * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
+ * PURPOSE.
+ */
+
+#ifndef _NETINET_IPSP_H_
+#define _NETINET_IPSP_H_
+
+/*
+ * IPSP global definitions.
+ */
+
+#include <sys/types.h>
+#include <sys/queue.h>
+#include <netinet/in.h>
+#ifndef __ECOS
+#include <sys/md5k.h>
+#endif
+#include <netinet/ip_sha1.h>
+#include <netinet/ip_rmd160.h>
+#include <netinet/ip_blf.h>
+#include <netinet/ip_cast.h>
+#include <netinet/ip_skipjack.h>
+
+union sockaddr_union
+{
+ struct sockaddr sa;
+ struct sockaddr_in sin;
+ struct sockaddr_in6 sin6;
+};
+
+/* HMAC key sizes */
+#define MD5HMAC96_KEYSIZE 16
+#define SHA1HMAC96_KEYSIZE 20
+#define RIPEMD160HMAC96_KEYSIZE 20
+
+/* IV lengths */
+#define ESP_DES_IVS 8
+#define ESP_3DES_IVS 8
+#define ESP_BLF_IVS 8
+#define ESP_CAST_IVS 8
+#define ESP_SKIPJACK_IVS 8
+#define ESP_MAX_IVS 8 /* Keep updated */
+
+/* Block sizes -- it is assumed that they're powers of 2 */
+#define ESP_DES_BLKS 8
+#define ESP_3DES_BLKS 8
+#define ESP_BLF_BLKS 8
+#define ESP_CAST_BLKS 8
+#define ESP_SKIPJACK_BLKS 8
+#define ESP_MAX_BLKS 8 /* Keep updated */
+
+#define HMAC_BLOCK_LEN 64
+
+#define AH_HMAC_HASHLEN 12 /* 96 bits of authenticator */
+#define AH_HMAC_RPLENGTH 4 /* 32 bits of replay counter */
+#define AH_HMAC_INITIAL_RPL 1 /* Replay counter initial value */
+
+/* HMAC definitions */
+#define HMAC_IPAD_VAL 0x36
+#define HMAC_OPAD_VAL 0x5C
+#define HMAC_BLOCK_LEN 64
+
+/* Authenticator lengths */
+#define AH_MD5_ALEN 16
+#define AH_SHA1_ALEN 20
+#define AH_RMD160_ALEN 20
+#define AH_ALEN_MAX 20 /* Keep updated */
+
+/* Reserved SPI numbers */
+#define SPI_LOCAL_USE 0
+#define SPI_RESERVED_MIN 1
+#define SPI_RESERVED_MAX 255
+
+struct sockaddr_encap
+{
+ u_int8_t sen_len; /* length */
+ u_int8_t sen_family; /* PF_KEY */
+ u_int16_t sen_type; /* see SENT_* */
+ union
+ {
+ u_int8_t Data[16]; /* other stuff mapped here */
+
+ struct /* SENT_IP4 */
+ {
+ struct in_addr Src;
+ struct in_addr Dst;
+ u_int16_t Sport;
+ u_int16_t Dport;
+ u_int8_t Proto;
+ u_int8_t Filler[3];
+ } Sip4;
+
+ struct /* SENT_IP6 */
+ {
+ struct in6_addr Src;
+ struct in6_addr Dst;
+ u_int16_t Sport;
+ u_int16_t Dport;
+ u_int8_t Proto;
+ u_int8_t Filler[3];
+ } Sip6;
+
+ struct /* SENT_IPSP */
+ {
+ struct in_addr Dst;
+ u_int32_t Spi;
+ u_int8_t Sproto;
+ u_int8_t Filler[7];
+ } Sipsp;
+
+ struct /* SENT_IPSP6 */
+ {
+ struct in6_addr Dst;
+ u_int32_t Spi;
+ u_int8_t Sproto;
+ u_int8_t Filler[7];
+ } Sipsp6;
+ } Sen;
+};
+
+#define sen_data Sen.Data
+#define sen_ip_src Sen.Sip4.Src
+#define sen_ip_dst Sen.Sip4.Dst
+#define sen_proto Sen.Sip4.Proto
+#define sen_sport Sen.Sip4.Sport
+#define sen_dport Sen.Sip4.Dport
+#define sen_ip6_src Sen.Sip6.Src
+#define sen_ip6_dst Sen.Sip6.Dst
+#define sen_ip6_proto Sen.Sip6.Proto
+#define sen_ip6_sport Sen.Sip6.Sport
+#define sen_ip6_dport Sen.Sip6.Dport
+#define sen_ipsp_dst Sen.Sipsp.Dst
+#define sen_ipsp_spi Sen.Sipsp.Spi
+#define sen_ipsp_sproto Sen.Sipsp.Sproto
+#define sen_ipsp6_dst Sen.Sipsp6.Dst
+#define sen_ipsp6_spi Sen.Sipsp6.Spi
+#define sen_ipsp6_sproto Sen.Sipsp6.Sproto
+
+/*
+ * The "type" is really part of the address as far as the routing
+ * system is concerned. By using only one bit in the type field
+ * for each type, we sort-of make sure that different types of
+ * encapsulation addresses won't be matched against the wrong type.
+ *
+ */
+
+#define SENT_IP4 0x0001 /* data is two struct in_addr */
+#define SENT_IPSP 0x0002 /* data as in IP4/6 plus SPI */
+#define SENT_IP6 0x0004
+#define SENT_IPSP6 0x0008
+
+/*
+ * SENT_HDRLEN is the length of the "header"
+ * SENT_*_LEN are the lengths of various forms of sen_data
+ * SENT_*_OFF are the offsets in the sen_data array of various fields
+ */
+
+#define SENT_HDRLEN (2 * sizeof(u_int8_t) + sizeof(u_int16_t))
+
+#define SENT_IP4_SRCOFF (0)
+#define SENT_IP4_DSTOFF (sizeof (struct in_addr))
+
+#define SENT_IP6_SRCOFF (0)
+#define SENT_IP6_DSTOFF (sizeof (struct in6_addr))
+
+#define SENT_IP4_LEN 20
+#define SENT_IPSP_LEN 20
+#define SENT_IP6_LEN 44
+#define SENT_IPSP6_LEN 32
+
+#define NOTIFY_SOFT_EXPIRE 0 /* Soft expiration of SA */
+#define NOTIFY_HARD_EXPIRE 1 /* Hard expiration of SA */
+#define NOTIFY_REQUEST_SA 2 /* Establish an SA */
+
+#define NOTIFY_SATYPE_CONF 1 /* SA should do encryption */
+#define NOTIFY_SATYPE_AUTH 2 /* SA should do authentication */
+#define NOTIFY_SATYPE_TUNNEL 4 /* SA should use tunneling */
+
+/*
+ * For encapsulation routes are possible not only for the destination
+ * address but also for the protocol, source and destination ports
+ * if available
+ */
+
+struct route_enc {
+ struct rtentry *re_rt;
+ struct sockaddr_encap re_dst;
+};
+
+struct flow
+{
+ struct flow *flow_next; /* Next in flow chain */
+ struct flow *flow_prev; /* Previous in flow chain */
+ struct tdb *flow_sa; /* Pointer to the SA */
+ union sockaddr_union flow_src; /* Source address */
+ union sockaddr_union flow_srcmask; /* Source netmask */
+ union sockaddr_union flow_dst; /* Destination address */
+ union sockaddr_union flow_dstmask; /* Destination netmask */
+ u_int8_t flow_proto; /* Transport protocol, if applicable */
+ u_int8_t foo[3]; /* Alignment */
+};
+
+struct tdb /* tunnel descriptor block */
+{
+ struct tdb *tdb_hnext; /* Next in hash chain */
+ struct tdb *tdb_onext; /* Next in output */
+ struct tdb *tdb_inext; /* Previous in output */
+
+ struct xformsw *tdb_xform; /* Transformation to use */
+ struct enc_xform *tdb_encalgxform; /* Encryption algorithm xform */
+ struct auth_hash *tdb_authalgxform; /* Authentication algorithm xform */
+
+#define TDBF_UNIQUE 0x00001 /* This should not be used by others */
+#define TDBF_TIMER 0x00002 /* Absolute expiration timer in use */
+#define TDBF_BYTES 0x00004 /* Check the byte counters */
+#define TDBF_ALLOCATIONS 0x00008 /* Check the flows counters */
+#define TDBF_INVALID 0x00010 /* This SPI is not valid yet/anymore */
+#define TDBF_FIRSTUSE 0x00020 /* Expire after first use */
+#define TDBF_HALFIV 0x00040 /* Use half-length IV (ESP old only) */
+#define TDBF_SOFT_TIMER 0x00080 /* Soft expiration */
+#define TDBF_SOFT_BYTES 0x00100 /* Soft expiration */
+#define TDBF_SOFT_ALLOCATIONS 0x00200 /* Soft expiration */
+#define TDBF_SOFT_FIRSTUSE 0x00400 /* Soft expiration */
+#define TDBF_PFS 0x00800 /* Ask for PFS from Key Mgmt. */
+#define TDBF_TUNNELING 0x01000 /* Force IP-IP encapsulation */
+ u_int32_t tdb_flags; /* Flags related to this TDB */
+
+ TAILQ_ENTRY(tdb) tdb_expnext; /* Expiration cluster list link */
+ TAILQ_ENTRY(tdb) tdb_explink; /* Expiration ordered list link */
+
+ u_int32_t tdb_exp_allocations; /* Expire after so many flows */
+ u_int32_t tdb_soft_allocations; /* Expiration warning */
+ u_int32_t tdb_cur_allocations; /* Total number of allocations */
+
+ u_int64_t tdb_exp_bytes; /* Expire after so many bytes passed */
+ u_int64_t tdb_soft_bytes; /* Expiration warning */
+ u_int64_t tdb_cur_bytes; /* Current count of bytes */
+
+ u_int64_t tdb_exp_timeout; /* When does the SPI expire */
+ u_int64_t tdb_soft_timeout; /* Send a soft-expire warning */
+ u_int64_t tdb_established; /* When was the SPI established */
+ u_int64_t tdb_timeout; /* Next absolute expiration time. */
+
+ u_int64_t tdb_first_use; /* When was it first used */
+ u_int64_t tdb_soft_first_use; /* Soft warning */
+ u_int64_t tdb_exp_first_use; /* Expire if tdb_first_use +
+ * tdb_exp_first_use <= curtime */
+
+ u_int32_t tdb_spi; /* SPI */
+ u_int16_t tdb_amxkeylen; /* AH-old only */
+ u_int16_t tdb_ivlen; /* IV length */
+ u_int8_t tdb_sproto; /* IPsec protocol */
+ u_int8_t tdb_wnd; /* Replay window */
+ u_int8_t tdb_satype; /* SA type (RFC2367, PF_KEY) */
+ u_int8_t tdb_FILLER; /* Padding */
+
+ union sockaddr_union tdb_dst; /* Destination address for this SA */
+ union sockaddr_union tdb_src; /* Source address for this SA */
+ union sockaddr_union tdb_proxy;
+
+ u_int8_t *tdb_key; /* Key material (schedules) */
+ u_int8_t *tdb_ictx; /* Authentication contexts */
+ u_int8_t *tdb_octx;
+ u_int8_t *tdb_srcid; /* Source ID for this SA */
+ u_int8_t *tdb_dstid; /* Destination ID for this SA */
+ u_int8_t *tdb_amxkey; /* AH-old only */
+
+ union
+ {
+ u_int8_t Iv[ESP_3DES_IVS]; /* That's enough space */
+ u_int32_t Ivl; /* Make sure this is 4 bytes */
+ u_int64_t Ivq; /* Make sure this is 8 bytes! */
+ }IV;
+#define tdb_iv IV.Iv
+#define tdb_ivl IV.Ivl
+#define tdb_ivq IV.Ivq
+
+ u_int32_t tdb_rpl; /* Replay counter */
+ u_int32_t tdb_bitmap; /* Used for replay sliding window */
+ u_int32_t tdb_initial; /* Initial replay value */
+
+ u_int32_t tdb_epoch; /* Used by the kernfs interface */
+ u_int16_t tdb_srcid_len;
+ u_int16_t tdb_dstid_len;
+ u_int16_t tdb_srcid_type;
+ u_int16_t tdb_dstid_type;
+
+ caddr_t tdb_interface;
+ struct flow *tdb_flow; /* Which flows use this SA */
+
+ struct tdb *tdb_bind_out; /* Outgoing SA to use */
+ TAILQ_HEAD(tdb_bind_head, tdb) tdb_bind_in;
+ TAILQ_ENTRY(tdb) tdb_bind_in_next; /* Refering Incoming SAs */
+ TAILQ_HEAD(tdb_inp_head, inpcb) tdb_inp;
+};
+
+#ifndef __ECOS
+union authctx_old {
+ MD5_CTX md5ctx;
+ SHA1_CTX sha1ctx;
+};
+
+union authctx {
+ MD5_CTX md5ctx;
+ SHA1_CTX sha1ctx;
+ RMD160_CTX rmd160ctx;
+};
+#endif
+
+struct tdb_ident {
+ u_int32_t spi;
+ union sockaddr_union dst;
+ u_int8_t proto;
+};
+
+struct auth_hash {
+ int type;
+ char *name;
+ u_int16_t keysize;
+ u_int16_t hashsize;
+ u_int16_t ctxsize;
+ void (*Init)(void *);
+ void (*Update)(void *, u_int8_t *, u_int16_t);
+ void (*Final)(u_int8_t *, void *);
+};
+
+struct enc_xform {
+ int type;
+ char *name;
+ u_int16_t blocksize, ivsize;
+ u_int16_t minkey, maxkey;
+ u_int32_t ivmask; /* Or all possible modes, zero iv = 1 */
+ void (*encrypt)(struct tdb *, u_int8_t *);
+ void (*decrypt)(struct tdb *, u_int8_t *);
+ void (*setkey)(u_int8_t **, u_int8_t *, int len);
+ void (*zerokey)(u_int8_t **);
+};
+
+struct ipsecinit
+{
+ u_int8_t *ii_enckey;
+ u_int8_t *ii_authkey;
+ u_int16_t ii_enckeylen;
+ u_int16_t ii_authkeylen;
+ u_int8_t ii_encalg;
+ u_int8_t ii_authalg;
+};
+
+struct xformsw
+{
+ u_short xf_type; /* Unique ID of xform */
+ u_short xf_flags; /* flags (see below) */
+ char *xf_name; /* human-readable name */
+ int (*xf_attach)(void); /* called at config time */
+ int (*xf_init)(struct tdb *, struct xformsw *, struct ipsecinit *);
+ int (*xf_zeroize)(struct tdb *); /* termination */
+ struct mbuf *(*xf_input)(struct mbuf *, struct tdb *, int, int); /* input */
+ int (*xf_output)(struct mbuf *, struct tdb *, struct mbuf **, int, int); /* output */
+};
+
+/* xform IDs */
+#define XF_IP4 1 /* IP inside IP */
+#define XF_OLD_AH 2 /* RFCs 1828 & 1852 */
+#define XF_OLD_ESP 3 /* RFCs 1829 & 1851 */
+#define XF_NEW_AH 4 /* AH HMAC 96bits */
+#define XF_NEW_ESP 5 /* ESP + auth 96bits + replay counter */
+#define XF_TCPSIGNATURE 6 /* TCP MD5 Signature option, RFC 2358 */
+
+/* xform attributes */
+#define XFT_AUTH 0x0001
+#define XFT_CONF 0x0100
+
+#define IPSEC_ZEROES_SIZE 256 /* Larger than an IP6 extension hdr. */
+#define IPSEC_KERNFS_BUFSIZE 4096
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+static __inline u_int64_t
+htonq(u_int64_t q)
+{
+ register u_int32_t u, l;
+ u = q >> 32;
+ l = (u_int32_t) q;
+
+ return htonl(u) | ((u_int64_t)htonl(l) << 32);
+}
+
+#define ntohq(_x) htonq(_x)
+
+#elif BYTE_ORDER == BIG_ENDIAN
+
+#define htonq(_x) (_x)
+#define ntohq(_x) htonq(_x)
+
+#else
+#error "Please fix <machine/endian.h>"
+#endif
+
+#ifdef _KERNEL
+
+/*
+ * Protects all tdb lists.
+ * Must at least be splsoftnet (note: do not use splsoftclock as it is
+ * special on some architectures, assuming it is always an spl lowering
+ * operation).
+ */
+#define spltdb splsoftnet
+
+extern int encdebug;
+extern int ipsec_in_use;
+extern u_int8_t hmac_ipad_buffer[64];
+extern u_int8_t hmac_opad_buffer[64];
+
+extern TAILQ_HEAD(expclusterlist_head, tdb) expclusterlist;
+extern TAILQ_HEAD(explist_head, tdb) explist;
+extern struct xformsw xformsw[], *xformswNXFORMSW;
+
+/* Check if a given tdb has encryption, authentication and/or tunneling */
+#define TDB_ATTRIB(x) (((x)->tdb_encalgxform ? NOTIFY_SATYPE_CONF : 0)| \
+ ((x)->tdb_authalgxform ? NOTIFY_SATYPE_AUTH : 0))
+
+/* Traverse spi chain and get attributes */
+
+#define SPI_CHAIN_ATTRIB(have, TDB_DIR, TDBP) do {\
+ int s = spltdb(); \
+ struct tdb *tmptdb = (TDBP); \
+ \
+ (have) = 0; \
+ while (tmptdb && tmptdb->tdb_xform) { \
+ if (tmptdb == NULL || tmptdb->tdb_flags & TDBF_INVALID) \
+ break; \
+ (have) |= TDB_ATTRIB(tmptdb); \
+ tmptdb = tmptdb->TDB_DIR; \
+ } \
+ splx(s); \
+} while (0)
+
+/* Misc. */
+extern char *inet_ntoa4(struct in_addr);
+
+#ifdef INET6
+extern char *inet6_ntoa4(struct in6_addr);
+#endif /* INET6 */
+
+extern char *ipsp_address(union sockaddr_union);
+
+/* TDB management routines */
+extern void tdb_add_inp(struct tdb *tdb, struct inpcb *inp);
+extern u_int32_t reserve_spi(u_int32_t, u_int32_t, union sockaddr_union *,
+ union sockaddr_union *, u_int8_t, int *);
+extern struct tdb *gettdb(u_int32_t, union sockaddr_union *, u_int8_t);
+extern void puttdb(struct tdb *);
+extern void tdb_delete(struct tdb *, int, int);
+extern int tdb_init(struct tdb *, u_int16_t, struct ipsecinit *);
+extern void tdb_expiration(struct tdb *, int);
+/* Flag values for the last argument of tdb_expiration(). */
+#define TDBEXP_EARLY 1 /* The tdb is likely to end up early. */
+#define TDBEXP_TIMEOUT 2 /* Maintain expiration timeout. */
+extern int tdb_walk(int (*)(struct tdb *, void *), void *);
+extern void handle_expirations(void *);
+
+/* Flow management routines */
+extern struct flow *get_flow(void);
+extern void put_flow(struct flow *, struct tdb *);
+extern void delete_flow(struct flow *, struct tdb *);
+extern struct flow *find_flow(union sockaddr_union *, union sockaddr_union *,
+ union sockaddr_union *, union sockaddr_union *,
+ u_int8_t, struct tdb *);
+extern struct flow *find_global_flow(union sockaddr_union *,
+ union sockaddr_union *,
+ union sockaddr_union *,
+ union sockaddr_union *, u_int8_t);
+
+/* XF_IP4 */
+extern int ipe4_attach(void);
+extern int ipe4_init(struct tdb *, struct xformsw *, struct ipsecinit *);
+extern int ipe4_zeroize(struct tdb *);
+extern int ipe4_output(struct mbuf *, struct tdb *, struct mbuf **, int, int);
+extern void ipe4_input __P((struct mbuf *, ...));
+extern void ip4_input __P((struct mbuf *, ...));
+
+/* XF_ETHERIP */
+extern int etherip_output(struct mbuf *, struct tdb *, struct mbuf **,
+ int, int);
+extern void etherip_input __P((struct mbuf *, ...));
+
+/* XF_OLD_AH */
+extern int ah_old_attach(void);
+extern int ah_old_init(struct tdb *, struct xformsw *, struct ipsecinit *);
+extern int ah_old_zeroize(struct tdb *);
+extern int ah_old_output(struct mbuf *, struct tdb *, struct mbuf **,
+ int, int);
+extern struct mbuf *ah_old_input(struct mbuf *, struct tdb *, int, int);
+
+/* XF_NEW_AH */
+extern int ah_new_attach(void);
+extern int ah_new_init(struct tdb *, struct xformsw *, struct ipsecinit *);
+extern int ah_new_zeroize(struct tdb *);
+extern int ah_new_output(struct mbuf *, struct tdb *, struct mbuf **,
+ int, int);
+extern struct mbuf *ah_new_input(struct mbuf *, struct tdb *, int, int);
+
+/* XF_OLD_ESP */
+extern int esp_old_attach(void);
+extern int esp_old_init(struct tdb *, struct xformsw *, struct ipsecinit *);
+extern int esp_old_zeroize(struct tdb *);
+extern int esp_old_output(struct mbuf *, struct tdb *, struct mbuf **,
+ int, int);
+extern struct mbuf *esp_old_input(struct mbuf *, struct tdb *, int, int);
+
+/* XF_NEW_ESP */
+extern int esp_new_attach(void);
+extern int esp_new_init(struct tdb *, struct xformsw *, struct ipsecinit *);
+extern int esp_new_zeroize(struct tdb *);
+extern int esp_new_output(struct mbuf *, struct tdb *, struct mbuf **,
+ int, int);
+extern struct mbuf *esp_new_input(struct mbuf *, struct tdb *, int, int);
+
+/* XF_TCPSIGNATURE */
+extern int tcp_signature_tdb_attach __P((void));
+extern int tcp_signature_tdb_init __P((struct tdb *, struct xformsw *,
+ struct ipsecinit *));
+extern int tcp_signature_tdb_zeroize __P((struct tdb *));
+extern struct mbuf *tcp_signature_tdb_input __P((struct mbuf *, struct tdb *));
+extern int tcp_signature_tdb_output __P((struct mbuf *, struct tdb *,
+ struct mbuf **));
+
+/* Padding */
+extern caddr_t m_pad(struct mbuf *, int, int);
+
+/* Replay window */
+extern int checkreplaywindow32(u_int32_t, u_int32_t, u_int32_t *, u_int32_t,
+ u_int32_t *);
+
+extern unsigned char ipseczeroes[];
+#endif /* _KERNEL */
+#endif /* _NETINET_IPSP_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/netinet/ip_mroute.h b/ecos/packages/net/tcpip/current/include/netinet/ip_mroute.h
new file mode 100644
index 0000000..19edf20
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/ip_mroute.h
@@ -0,0 +1,269 @@
+//==========================================================================
+//
+// include/netinet/ip_mroute.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ip_mroute.h,v 1.5 1999/12/08 06:50:20 itojun Exp $ */
+/* $NetBSD: ip_mroute.h,v 1.10 1996/02/13 23:42:55 christos Exp $ */
+
+/*
+ * Definitions for IP multicast forwarding.
+ *
+ * Written by David Waitzman, BBN Labs, August 1988.
+ * Modified by Steve Deering, Stanford, February 1989.
+ * Modified by Ajit Thyagarajan, PARC, August 1993.
+ * Modified by Ajit Thyagarajan, PARC, August 1994.
+ *
+ * MROUTING Revision: 1.2
+ */
+
+#ifndef _NETINET_IP_MROUTE_H_
+#define _NETINET_IP_MROUTE_H_
+
+#include <sys/queue.h>
+
+/*
+ * Multicast Routing set/getsockopt commands.
+ */
+#define MRT_INIT 100 /* initialize forwarder */
+#define MRT_DONE 101 /* shut down forwarder */
+#define MRT_ADD_VIF 102 /* create virtual interface */
+#define MRT_DEL_VIF 103 /* delete virtual interface */
+#define MRT_ADD_MFC 104 /* insert forwarding cache entry */
+#define MRT_DEL_MFC 105 /* delete forwarding cache entry */
+#define MRT_VERSION 106 /* get kernel version number */
+#define MRT_ASSERT 107 /* enable PIM assert processing */
+
+
+/*
+ * Types and macros for handling bitmaps with one bit per virtual interface.
+ */
+#define MAXVIFS 32
+typedef u_int32_t vifbitmap_t;
+typedef u_int16_t vifi_t; /* type of a vif index */
+
+#define VIFM_SET(n, m) ((m) |= (1 << (n)))
+#define VIFM_CLR(n, m) ((m) &= ~(1 << (n)))
+#define VIFM_ISSET(n, m) ((m) & (1 << (n)))
+#define VIFM_SETALL(m) ((m) = 0xffffffff)
+#define VIFM_CLRALL(m) ((m) = 0x00000000)
+#define VIFM_COPY(mfrom, mto) ((mto) = (mfrom))
+#define VIFM_SAME(m1, m2) ((m1) == (m2))
+
+#define VIFF_TUNNEL 0x1 /* vif represents a tunnel end-point */
+#define VIFF_SRCRT 0x2 /* tunnel uses IP src routing */
+
+/*
+ * Argument structure for MRT_ADD_VIF.
+ * (MRT_DEL_VIF takes a single vifi_t argument.)
+ */
+struct vifctl {
+ vifi_t vifc_vifi; /* the index of the vif to be added */
+ u_int8_t vifc_flags; /* VIFF_ flags defined below */
+ u_int8_t vifc_threshold; /* min ttl required to forward on vif */
+ u_int32_t vifc_rate_limit; /* max rate */
+ struct in_addr vifc_lcl_addr;/* local interface address */
+ struct in_addr vifc_rmt_addr;/* remote address (tunnels only) */
+};
+
+/*
+ * Argument structure for MRT_ADD_MFC and MRT_DEL_MFC.
+ * (mfcc_tos to be added at a future point)
+ */
+struct mfcctl {
+ struct in_addr mfcc_origin; /* ip origin of mcasts */
+ struct in_addr mfcc_mcastgrp; /* multicast group associated */
+ vifi_t mfcc_parent; /* incoming vif */
+ u_int8_t mfcc_ttls[MAXVIFS]; /* forwarding ttls on vifs */
+};
+
+/*
+ * Argument structure used by mrouted to get src-grp pkt counts.
+ */
+struct sioc_sg_req {
+ struct in_addr src;
+ struct in_addr grp;
+ u_long pktcnt;
+ u_long bytecnt;
+ u_long wrong_if;
+};
+
+/*
+ * Argument structure used by mrouted to get vif pkt counts.
+ */
+struct sioc_vif_req {
+ vifi_t vifi; /* vif number */
+ u_long icount; /* input packet count on vif */
+ u_long ocount; /* output packet count on vif */
+ u_long ibytes; /* input byte count on vif */
+ u_long obytes; /* output byte count on vif */
+};
+
+
+/*
+ * The kernel's multicast routing statistics.
+ */
+struct mrtstat {
+ u_long mrts_mfc_lookups; /* # forw. cache hash table hits */
+ u_long mrts_mfc_misses; /* # forw. cache hash table misses */
+ u_long mrts_upcalls; /* # calls to mrouted */
+ u_long mrts_no_route; /* no route for packet's origin */
+ u_long mrts_bad_tunnel; /* malformed tunnel options */
+ u_long mrts_cant_tunnel; /* no room for tunnel options */
+ u_long mrts_wrong_if; /* arrived on wrong interface */
+ u_long mrts_upq_ovflw; /* upcall Q overflow */
+ u_long mrts_cache_cleanups; /* # entries with no upcalls */
+ u_long mrts_drop_sel; /* pkts dropped selectively */
+ u_long mrts_q_overflow; /* pkts dropped - Q overflow */
+ u_long mrts_pkt2large; /* pkts dropped - size > BKT SIZE */
+ u_long mrts_upq_sockfull; /* upcalls dropped - socket full */
+};
+
+
+#ifdef _KERNEL
+
+/*
+ * Token bucket filter at each vif
+ */
+struct tbf {
+ u_int32_t last_pkt_t; /* arr. time of last pkt */
+ u_int32_t n_tok; /* no of tokens in bucket */
+ u_int32_t q_len; /* length of queue at this vif */
+};
+
+/*
+ * The kernel's virtual-interface structure.
+ */
+struct vif {
+ u_int8_t v_flags; /* VIFF_ flags defined above */
+ u_int8_t v_threshold; /* min ttl required to forward on vif */
+ u_int32_t v_rate_limit; /* max rate */
+ struct tbf v_tbf; /* token bucket structure at intf. */
+ struct in_addr v_lcl_addr; /* local interface address */
+ struct in_addr v_rmt_addr; /* remote address (tunnels only) */
+ struct ifnet *v_ifp; /* pointer to interface */
+ u_long v_pkt_in; /* # pkts in on interface */
+ u_long v_pkt_out; /* # pkts out on interface */
+ u_long v_bytes_in; /* # bytes in on interface */
+ u_long v_bytes_out; /* # bytes out on interface */
+ struct route v_route; /* cached route if this is a tunnel */
+#ifdef RSVP_ISI
+ int v_rsvp_on; /* # RSVP listening on this vif */
+ struct socket *v_rsvpd; /* # RSVPD daemon */
+#endif /* RSVP_ISI */
+};
+
+/*
+ * The kernel's multicast forwarding cache entry structure.
+ * (A field for the type of service (mfc_tos) is to be added
+ * at a future point.)
+ */
+struct mfc {
+ LIST_ENTRY(mfc) mfc_hash;
+ struct in_addr mfc_origin; /* ip origin of mcasts */
+ struct in_addr mfc_mcastgrp; /* multicast group associated */
+ vifi_t mfc_parent; /* incoming vif */
+ u_int8_t mfc_ttls[MAXVIFS]; /* forwarding ttls on vifs */
+ u_long mfc_pkt_cnt; /* pkt count for src-grp */
+ u_long mfc_byte_cnt; /* byte count for src-grp */
+ u_long mfc_wrong_if; /* wrong if for src-grp */
+ int mfc_expire; /* time to clean entry up */
+ struct timeval mfc_last_assert; /* last time I sent an assert */
+ struct rtdetq *mfc_stall; /* pkts waiting for route */
+};
+
+/*
+ * Structure used to communicate from kernel to multicast router.
+ * (Note the convenient similarity to an IP packet.)
+ */
+struct igmpmsg {
+ u_int32_t unused1;
+ u_int32_t unused2;
+ u_int8_t im_msgtype; /* what type of message */
+#define IGMPMSG_NOCACHE 1
+#define IGMPMSG_WRONGVIF 2
+ u_int8_t im_mbz; /* must be zero */
+ u_int8_t im_vif; /* vif rec'd on */
+ u_int8_t unused3;
+ struct in_addr im_src, im_dst;
+};
+
+/*
+ * Argument structure used for pkt info. while upcall is made.
+ */
+struct rtdetq {
+ struct mbuf *m; /* a copy of the packet */
+ struct ifnet *ifp; /* interface pkt came in on */
+#ifdef UPCALL_TIMING
+ struct timeval t; /* timestamp */
+#endif /* UPCALL_TIMING */
+ struct rtdetq *next;
+};
+
+#define MFCTBLSIZ 256
+#define MAX_UPQ 4 /* max. no of pkts in upcall Q */
+
+/*
+ * Token bucket filter code
+ */
+#define MAX_BKT_SIZE 10000 /* 10K bytes size */
+#define MAXQSIZE 10 /* max. no of pkts in token queue */
+
+/*
+ * Queue structure at each vif
+ */
+struct pkt_queue {
+ u_int32_t pkt_len; /* length of packet in queue */
+ struct mbuf *pkt_m; /* pointer to packet mbuf */
+ struct ip *pkt_ip; /* pointer to ip header */
+};
+
+int ip_mrouter_set __P((int, struct socket *, struct mbuf **));
+int ip_mrouter_get __P((int, struct socket *, struct mbuf **));
+int mrt_ioctl __P((u_long, caddr_t));
+int ip_mrouter_done __P((void));
+void reset_vif __P((struct vif *));
+void vif_delete __P((struct ifnet *));
+#ifdef RSVP_ISI
+int ip_mforward __P((struct mbuf *, struct ifnet *, struct ip_moptions *));
+int legal_vif_num __P((int));
+int ip_rsvp_vif_init __P((struct socket *, struct mbuf *));
+int ip_rsvp_vif_done __P((struct socket *, struct mbuf *));
+void ip_rsvp_force_done __P((struct socket *));
+#if 0
+void rsvp_input __P((struct mbuf *, struct ifnet *));
+#else
+void rsvp_input __P((struct mbuf *, int, int));
+#endif
+#else
+int ip_mforward __P((struct mbuf *, struct ifnet *));
+#endif
+void ipip_input __P((struct mbuf *, ...));
+
+#endif /* _KERNEL */
+
+#endif // _NETINET_IP_MROUTE_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/ip_nat.h b/ecos/packages/net/tcpip/current/include/netinet/ip_nat.h
new file mode 100644
index 0000000..3afc4a9
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/ip_nat.h
@@ -0,0 +1,277 @@
+//==========================================================================
+//
+// include/netinet/ip_nat.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ip_nat.h,v 1.13 1999/12/15 05:20:22 kjell Exp $ */
+/*
+ * Copyright (C) 1995-1998 by Darren Reed.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and due credit is given
+ * to the original author and the contributors.
+ *
+ * @(#)ip_nat.h 1.5 2/4/96
+ */
+
+#ifndef _NETINET_IP_NAT_H__
+#define _NETINET_IP_NAT_H__
+
+#ifndef SOLARIS
+#define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
+#endif
+
+#if defined(__STDC__) || defined(__GNUC__)
+#define SIOCADNAT _IOW('r', 80, struct ipnat)
+#define SIOCRMNAT _IOW('r', 81, struct ipnat)
+#define SIOCGNATS _IOR('r', 82, struct natstat)
+#define SIOCGNATL _IOWR('r', 83, struct natlookup)
+#define SIOCGFRST _IOR('r', 84, struct ipfrstat)
+#define SIOCGIPST _IOR('r', 85, struct ips_stat)
+#define SIOCFLNAT _IOWR('r', 86, int)
+#define SIOCCNATL _IOWR('r', 87, int)
+#else
+#define SIOCADNAT _IOW(r, 80, struct ipnat)
+#define SIOCRMNAT _IOW(r, 81, struct ipnat)
+#define SIOCGNATS _IOR(r, 82, struct natstat)
+#define SIOCGNATL _IOWR(r, 83, struct natlookup)
+#define SIOCGFRST _IOR(r, 84, struct ipfrstat)
+#define SIOCGIPST _IOR(r, 85, struct ips_stat)
+#define SIOCFLNAT _IOWR(r, 86, int)
+#define SIOCCNATL _IOWR(r, 87, int)
+#endif
+
+#undef LARGE_NAT /* define this if you're setting up a system to NAT
+ * LARGE numbers of networks/hosts - i.e. in the
+ * hundreds or thousands. In such a case, you should
+ * also change the RDR_SIZE and NAT_SIZE below to more
+ * appropriate sizes. The figures below were used for
+ * a setup with 1000-2000 networks to NAT.
+ */
+#define NAT_SIZE 127
+#define RDR_SIZE 127
+#define NAT_TABLE_SZ 127
+#ifdef LARGE_NAT
+#undef NAT_SIZE
+#undef RDR_SIZE
+#undef NAT_TABLE_SZ
+#define NAT_SIZE 2047
+#define RDR_SIZE 2047
+#define NAT_TABLE_SZ 16383
+#endif
+#ifndef APR_LABELLEN
+#define APR_LABELLEN 16
+#endif
+#define NAT_HW_CKSUM 0x80000000
+
+#define DEF_NAT_AGE 1200 /* 10 minutes (600 seconds) */
+
+typedef struct nat {
+ u_long nat_age;
+ int nat_flags;
+ u_32_t nat_sumd[2];
+ u_32_t nat_ipsumd;
+ void *nat_data;
+ void *nat_aps; /* proxy session */
+ frentry_t *nat_fr; /* filter rule ptr if appropriate */
+ struct in_addr nat_inip;
+ struct in_addr nat_outip;
+ struct in_addr nat_oip; /* other ip */
+ U_QUAD_T nat_pkts;
+ U_QUAD_T nat_bytes;
+ u_short nat_oport; /* other port */
+ u_short nat_inport;
+ u_short nat_outport;
+ u_short nat_use;
+ u_char nat_tcpstate[2];
+ u_char nat_p; /* protocol for NAT */
+ struct ipnat *nat_ptr; /* pointer back to the rule */
+ struct nat *nat_next;
+ struct nat *nat_hnext[2];
+ struct nat **nat_hstart[2];
+ void *nat_ifp;
+ int nat_dir;
+} nat_t;
+
+typedef struct ipnat {
+ struct ipnat *in_next;
+ struct ipnat *in_rnext;
+ struct ipnat *in_mnext;
+ void *in_ifp;
+ void *in_apr;
+ u_long in_space;
+ u_int in_use;
+ u_int in_hits;
+ struct in_addr in_nextip;
+ u_short in_pnext;
+ u_short in_ppip; /* ports per IP */
+ u_short in_ippip; /* IP #'s per IP# */
+ u_short in_flags; /* From here to in_dport must be reflected */
+ u_short in_port[2]; /* correctly in IPN_CMPSIZ */
+ struct in_addr in_in[2];
+ struct in_addr in_out[2];
+ struct in_addr in_src[2];
+ int in_redir; /* 0 if it's a mapping, 1 if it's a hard redir */
+ char in_ifname[IFNAMSIZ];
+ char in_plabel[APR_LABELLEN]; /* proxy label */
+ char in_p; /* protocol */
+ u_short in_dport;
+} ipnat_t;
+
+#define in_pmin in_port[0] /* Also holds static redir port */
+#define in_pmax in_port[1]
+#define in_nip in_nextip.s_addr
+#define in_inip in_in[0].s_addr
+#define in_inmsk in_in[1].s_addr
+#define in_outip in_out[0].s_addr
+#define in_outmsk in_out[1].s_addr
+#define in_srcip in_src[0].s_addr
+#define in_srcmsk in_src[1].s_addr
+
+#define NAT_OUTBOUND 0
+#define NAT_INBOUND 1
+
+#define NAT_MAP 0x01
+#define NAT_REDIRECT 0x02
+#define NAT_BIMAP (NAT_MAP|NAT_REDIRECT)
+#define NAT_MAPBLK 0x04
+
+#define MAPBLK_MINPORT 1024 /* don't use reserved ports for src port */
+#define USABLE_PORTS (65536 - MAPBLK_MINPORT)
+
+#define IPN_CMPSIZ (sizeof(ipnat_t) - offsetof(ipnat_t, in_flags))
+
+typedef struct natlookup {
+ struct in_addr nl_inip;
+ struct in_addr nl_outip;
+ struct in_addr nl_realip;
+ int nl_flags;
+ u_short nl_inport;
+ u_short nl_outport;
+ u_short nl_realport;
+} natlookup_t;
+
+typedef struct natstat {
+ u_long ns_mapped[2];
+ u_long ns_rules;
+ u_long ns_added;
+ u_long ns_expire;
+ u_long ns_inuse;
+ u_long ns_logged;
+ u_long ns_logfail;
+ nat_t **ns_table[2];
+ ipnat_t *ns_list;
+ void *ns_apslist;
+ u_int ns_nattab_sz;
+ u_int ns_rultab_sz;
+ u_int ns_rdrtab_sz;
+ nat_t *ns_instances;
+} natstat_t;
+
+#define IPN_ANY 0x00
+#define IPN_TCP 0x01
+#define IPN_UDP 0x02
+#define IPN_TCPUDP (IPN_TCP|IPN_UDP)
+#define IPN_DELETE 0x04
+#define IPN_ICMPERR 0x08
+#define IPN_RF (IPN_TCPUDP|IPN_DELETE|IPN_ICMPERR)
+#define IPN_AUTOPORTMAP 0x10
+#define IPN_RANGE 0x20
+#define IPN_USERFLAGS (IPN_TCPUDP|IPN_AUTOPORTMAP|IPN_RANGE)
+
+
+typedef struct natlog {
+ struct in_addr nl_origip;
+ struct in_addr nl_outip;
+ struct in_addr nl_inip;
+ u_short nl_origport;
+ u_short nl_outport;
+ u_short nl_inport;
+ u_short nl_type;
+ int nl_rule;
+ U_QUAD_T nl_pkts;
+ U_QUAD_T nl_bytes;
+} natlog_t;
+
+
+#define NL_NEWMAP NAT_MAP
+#define NL_NEWRDR NAT_REDIRECT
+#define NL_EXPIRE 0xffff
+
+#define NAT_HASH_FN(k,m) (((k) + ((k) >> 12)) % (m))
+
+#define LONG_SUM(in) (((in) & 0xffff) + ((in) >> 16))
+
+#define CALC_SUMD(s1, s2, sd) { \
+ (s1) = ((s1) & 0xffff) + ((s1) >> 16); \
+ (s2) = ((s2) & 0xffff) + ((s2) >> 16); \
+ /* Do it twice */ \
+ (s1) = ((s1) & 0xffff) + ((s1) >> 16); \
+ (s2) = ((s2) & 0xffff) + ((s2) >> 16); \
+ /* Because ~1 == -2, We really need ~1 == -1 */ \
+ if ((s1) > (s2)) (s2)--; \
+ (sd) = (s2) - (s1); \
+ (sd) = ((sd) & 0xffff) + ((sd) >> 16); }
+
+
+extern u_int ipf_nattable_sz;
+extern u_int ipf_natrules_sz;
+extern u_int ipf_rdrrules_sz;
+extern void ip_natsync __P((void *));
+extern u_long fr_defnatage;
+extern u_long fr_defnaticmpage;
+extern nat_t **nat_table[2];
+extern nat_t *nat_instances;
+extern ipnat_t **nat_rules;
+extern ipnat_t **rdr_rules;
+extern natstat_t nat_stats;
+#if defined(__NetBSD__) || defined(__OpenBSD__)
+extern int nat_ioctl __P((caddr_t, u_long, int));
+#else
+extern int nat_ioctl __P((caddr_t, int, int));
+#endif
+extern void nat_ifdetach __P((struct ifnet *));
+extern int nat_init __P((void));
+extern nat_t *nat_new __P((ipnat_t *, ip_t *, fr_info_t *, u_int, int));
+extern nat_t *nat_outlookup __P((void *, u_int, u_int, struct in_addr,
+ struct in_addr, u_32_t));
+extern nat_t *nat_inlookup __P((void *, u_int, u_int, struct in_addr,
+ struct in_addr, u_32_t));
+extern nat_t *nat_maplookup __P((void *, u_int, struct in_addr,
+ struct in_addr));
+extern nat_t *nat_lookupredir __P((natlookup_t *));
+extern nat_t *nat_icmpinlookup __P((ip_t *, fr_info_t *));
+extern nat_t *nat_icmpin __P((ip_t *, fr_info_t *, u_int *));
+
+extern int ip_natout __P((ip_t *, fr_info_t *));
+extern int ip_natin __P((ip_t *, fr_info_t *));
+extern void ip_natunload __P((void)), ip_natexpire __P((void));
+extern void nat_log __P((struct nat *, u_int));
+extern void fix_incksum __P((u_short *, u_32_t, int));
+extern void fix_outcksum __P((u_short *, u_32_t, int));
+
+#endif /* _NETINET_IP_NAT_H__ */
diff --git a/ecos/packages/net/tcpip/current/include/netinet/ip_proxy.h b/ecos/packages/net/tcpip/current/include/netinet/ip_proxy.h
new file mode 100644
index 0000000..c66ac1e
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/ip_proxy.h
@@ -0,0 +1,158 @@
+//==========================================================================
+//
+// include/netinet/ip_proxy.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ip_proxy.h,v 1.4 1999/12/15 05:20:23 kjell Exp $ */
+/*
+ * Copyright (C) 1997-1998 by Darren Reed.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and due credit is given
+ * to the original author and the contributors.
+ *
+ */
+
+#ifndef _NETINET_IP_PROXY_H__
+#define _NETINET_IP_PROXY_H__
+
+#ifndef SOLARIS
+#define SOLARIS (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
+#endif
+
+#ifndef APR_LABELLEN
+#define APR_LABELLEN 16
+#endif
+#define AP_SESS_SIZE 53
+
+struct nat;
+struct ipnat;
+
+typedef struct ap_tcp {
+ u_short apt_sport; /* source port */
+ u_short apt_dport; /* destination port */
+ short apt_sel[2]; /* {seq,ack}{off,min} set selector */
+ short apt_seqoff[2]; /* sequence # difference */
+ tcp_seq apt_seqmin[2]; /* don't change seq-off until after this */
+ short apt_ackoff[2]; /* sequence # difference */
+ tcp_seq apt_ackmin[2]; /* don't change seq-off until after this */
+ u_char apt_state[2]; /* connection state */
+} ap_tcp_t;
+
+typedef struct ap_udp {
+ u_short apu_sport; /* source port */
+ u_short apu_dport; /* destination port */
+} ap_udp_t;
+
+typedef struct ap_session {
+ struct aproxy *aps_apr;
+ union {
+ struct ap_tcp apu_tcp;
+ struct ap_udp apu_udp;
+ } aps_un;
+ u_int aps_flags;
+ U_QUAD_T aps_bytes; /* bytes sent */
+ U_QUAD_T aps_pkts; /* packets sent */
+ void *aps_nat; /* pointer back to nat struct */
+ void *aps_data; /* private data */
+ int aps_p; /* protocol */
+ int aps_psiz; /* size of private data */
+ struct ap_session *aps_hnext;
+ struct ap_session *aps_next;
+} ap_session_t ;
+
+#define aps_sport aps_un.apu_tcp.apt_sport
+#define aps_dport aps_un.apu_tcp.apt_dport
+#define aps_sel aps_un.apu_tcp.apt_sel
+#define aps_seqoff aps_un.apu_tcp.apt_seqoff
+#define aps_seqmin aps_un.apu_tcp.apt_seqmin
+#define aps_state aps_un.apu_tcp.apt_state
+#define aps_ackoff aps_un.apu_tcp.apt_ackoff
+#define aps_ackmin aps_un.apu_tcp.apt_ackmin
+
+
+typedef struct aproxy {
+ char apr_label[APR_LABELLEN]; /* Proxy label # */
+ u_char apr_p; /* protocol */
+ int apr_ref; /* +1 per rule referencing it */
+ int apr_flags;
+ int (* apr_init) __P((void));
+ int (* apr_new) __P((fr_info_t *, ip_t *,
+ ap_session_t *, struct nat *));
+ int (* apr_inpkt) __P((fr_info_t *, ip_t *,
+ ap_session_t *, struct nat *));
+ int (* apr_outpkt) __P((fr_info_t *, ip_t *,
+ ap_session_t *, struct nat *));
+} aproxy_t;
+
+#define APR_DELETE 1
+
+
+/*
+ * Real audio proxy structure and #defines
+ */
+typedef struct {
+ int rap_seenpna;
+ int rap_seenver;
+ int rap_version;
+ int rap_eos; /* End Of Startup */
+ int rap_gotid;
+ int rap_gotlen;
+ int rap_mode;
+ int rap_sdone;
+ u_short rap_plport;
+ u_short rap_prport;
+ u_short rap_srport;
+ char rap_svr[19];
+ u_32_t rap_sbf; /* flag to indicate which of the 19 bytes have
+ * been filled
+ */
+ tcp_seq rap_sseq;
+} raudio_t;
+
+#define RA_ID_END 0
+#define RA_ID_UDP 1
+#define RA_ID_ROBUST 7
+
+#define RAP_M_UDP 1
+#define RAP_M_ROBUST 2
+#define RAP_M_TCP 4
+#define RAP_M_UDP_ROBUST (RAP_M_UDP|RAP_M_ROBUST)
+
+
+extern ap_session_t *ap_sess_tab[AP_SESS_SIZE];
+extern ap_session_t *ap_sess_list;
+extern aproxy_t ap_proxies[];
+
+extern int appr_init __P((void));
+extern int appr_ok __P((ip_t *, tcphdr_t *, struct ipnat *));
+extern void appr_free __P((aproxy_t *));
+extern void aps_free __P((ap_session_t *));
+extern int appr_check __P((ip_t *, fr_info_t *, struct nat *));
+extern aproxy_t *appr_match __P((u_int, char *));
+
+#endif /* _NETINET_IP_PROXY_H__ */
diff --git a/ecos/packages/net/tcpip/current/include/netinet/ip_rmd160.h b/ecos/packages/net/tcpip/current/include/netinet/ip_rmd160.h
new file mode 100644
index 0000000..ce94ca1
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/ip_rmd160.h
@@ -0,0 +1,66 @@
+//==========================================================================
+//
+// include/netinet/rmd160.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ip_rmd160.h,v 1.3 1999/02/17 18:10:08 deraadt Exp $ */
+
+/*
+ * FILE: rmd160.h
+ *
+ * CONTENTS: Header file for a sample C-implementation of the
+ * RIPEMD-160 hash-function.
+ * TARGET: any computer with an ANSI C compiler
+ *
+ * AUTHOR: Antoon Bosselaers, ESAT-COSIC
+ * DATE: 1 March 1996
+ * VERSION: 1.0
+ *
+ * Copyright (c) Katholieke Universiteit Leuven
+ * 1996, All Rights Reserved
+ *
+ */
+
+#ifndef _NETINET_RMD160_H /* make sure this file is read only once */
+#define _NETINET_RMD160_H
+
+typedef struct {
+ u_int32_t state[5]; /* state (ABCDE) */
+ u_int32_t length[2]; /* number of bits */
+ u_char bbuffer[64]; /* overflow buffer */
+ u_int32_t buflen; /* number of chars in bbuffer */
+} RMD160_CTX;
+
+void RMD160Init __P((RMD160_CTX *context));
+void RMD160Transform __P((u_int32_t state[5], const u_int32_t block[16]));
+void RMD160Update __P((RMD160_CTX *context, const u_char *data, u_int nbytes));
+void RMD160Final __P((u_char digest[20], RMD160_CTX *context));
+char *RMD160End __P((RMD160_CTX *, char *));
+char *RMD160File __P((char *, char *));
+char *RMD160Data __P((const u_char *, size_t, char *));
+
+#endif /* _NETINET_RMD160_H */
diff --git a/ecos/packages/net/tcpip/current/include/netinet/ip_sha1.h b/ecos/packages/net/tcpip/current/include/netinet/ip_sha1.h
new file mode 100644
index 0000000..02d2fe1
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/ip_sha1.h
@@ -0,0 +1,52 @@
+//==========================================================================
+//
+// include/netinet/sha1.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ip_sha1.h,v 1.5 1999/02/17 18:10:24 deraadt Exp $ */
+
+/*
+ * SHA-1 in C
+ * By Steve Reid <steve@edmweb.com>
+ * 100% Public Domain
+ */
+
+#ifndef _NETINET_SHA1_H_
+#define _NETINET_SHA1_H_
+
+typedef struct {
+ u_int32_t state[5];
+ u_int32_t count[2];
+ unsigned char buffer[64];
+} SHA1_CTX;
+
+void SHA1Transform __P((u_int32_t state[5], unsigned char buffer[64]));
+void SHA1Init __P((SHA1_CTX* context));
+void SHA1Update __P((SHA1_CTX* context, unsigned char* data, unsigned int len));
+void SHA1Final __P((unsigned char digest[20], SHA1_CTX* context));
+
+#endif /* _NETINET_SHA1_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/netinet/ip_skipjack.h b/ecos/packages/net/tcpip/current/include/netinet/ip_skipjack.h
new file mode 100644
index 0000000..3a1ea20
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/ip_skipjack.h
@@ -0,0 +1,50 @@
+//==========================================================================
+//
+// include/netinet/ip_skipjack.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/*
+ * Further optimized test implementation of SKIPJACK algorithm
+ * Mark Tillotson <markt@chaos.org.uk>, 25 June 98
+ * Optimizations suit RISC (lots of registers) machine best.
+ *
+ * based on unoptimized implementation of
+ * Panu Rissanen <bande@lut.fi> 960624
+ *
+ * SKIPJACK and KEA Algorithm Specifications
+ * Version 2.0
+ * 29 May 1998
+*/
+
+#ifndef _NETINET_IP_SKIPJACK_H_
+#define _NETINET_IP_SKIPJACK_H_
+
+extern void skipjack_forwards __P((u_int8_t *plain, u_int8_t *cipher, u_int8_t **key));
+extern void skipjack_backwards __P((u_int8_t *cipher, u_int8_t *plain, u_int8_t **key));
+extern void subkey_table_gen __P((u_int8_t *key, u_int8_t **key_tables));
+
+#endif // _NETINET_IP_SKIPJACK_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/ip_state.h b/ecos/packages/net/tcpip/current/include/netinet/ip_state.h
new file mode 100644
index 0000000..8b488f1
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/ip_state.h
@@ -0,0 +1,194 @@
+//==========================================================================
+//
+// include/netinet/ip_state.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ip_state.h,v 1.10 1999/12/15 05:20:23 kjell Exp $ */
+/*
+ * Copyright (C) 1995-1998 by Darren Reed.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and due credit is given
+ * to the original author and the contributors.
+ *
+ * @(#)ip_state.h 1.3 1/12/96 (C) 1995 Darren Reed
+ */
+
+#ifndef _NETINET_IP_STATE_H__
+#define _NETINET_IP_STATE_H__
+
+#define IPSTATE_SIZE 257
+#define IPSTATE_MAX 2048 /* Maximum number of states held */
+
+#define PAIRS(s1,d1,s2,d2) ((((s1) == (s2)) && ((d1) == (d2))) ||\
+ (((s1) == (d2)) && ((d1) == (s2))))
+#define IPPAIR(s1,d1,s2,d2) PAIRS((s1).s_addr, (d1).s_addr, \
+ (s2).s_addr, (d2).s_addr)
+
+
+typedef struct udpstate {
+ u_short us_sport;
+ u_short us_dport;
+} udpstate_t;
+
+typedef struct icmpstate {
+ u_short ics_id;
+ u_short ics_seq;
+ u_char ics_type;
+} icmpstate_t;
+
+typedef struct tcpdata {
+ u_32_t td_end;
+ u_32_t td_maxend;
+ u_short td_maxwin;
+} tcpdata_t;
+
+typedef struct tcpstate {
+ u_short ts_sport;
+ u_short ts_dport;
+ tcpdata_t ts_data[2];
+ u_char ts_state[2];
+} tcpstate_t;
+
+typedef struct ipstate {
+ struct ipstate *is_next;
+ u_long is_age;
+ u_int is_pass;
+ U_QUAD_T is_pkts;
+ U_QUAD_T is_bytes;
+ void *is_ifpin;
+ void *is_ifpout;
+ frentry_t *is_rule;
+ struct in_addr is_src;
+ struct in_addr is_dst;
+ u_char is_p; /* Protocol */
+ u_char is_rout; /* Is rule in/out ? */
+ u_32_t is_flags;
+ u_32_t is_opt; /* packet options set */
+ u_32_t is_optmsk; /* " " mask */
+ u_short is_sec; /* security options set */
+ u_short is_secmsk; /* " " mask */
+ u_short is_auth; /* authentication options set */
+ u_short is_authmsk; /* " " mask */
+ union {
+ icmpstate_t is_ics;
+ tcpstate_t is_ts;
+ udpstate_t is_us;
+ } is_ps;
+} ipstate_t;
+
+#define is_icmp is_ps.is_ics
+#define is_type is_icmp.ics_type
+#define is_code is_icmp.ics_code
+#define is_tcp is_ps.is_ts
+#define is_udp is_ps.is_us
+#define is_send is_tcp.ts_data[0].td_end
+#define is_dend is_tcp.ts_data[1].td_end
+#define is_maxswin is_tcp.ts_data[0].td_maxwin
+#define is_maxdwin is_tcp.ts_data[1].td_maxwin
+#define is_maxsend is_tcp.ts_data[0].td_maxend
+#define is_maxdend is_tcp.ts_data[1].td_maxend
+#define is_sport is_tcp.ts_sport
+#define is_dport is_tcp.ts_dport
+#define is_state is_tcp.ts_state
+
+#define TH_OPENING (TH_SYN|TH_ACK)
+/*
+ * is_flags:
+ * Bits 0 - 3 are use as a mask with the current packet's bits to check for
+ * whether it is short, tcp/udp, a fragment or the presence of IP options.
+ * Bits 4 - 7 are set from the initial packet and contain what the packet
+ * anded with bits 0-3 must match.
+ * Bits 8,9 are used to indicate wildcard source/destination port matching.
+ */
+
+
+typedef struct ipslog {
+ U_QUAD_T isl_pkts;
+ U_QUAD_T isl_bytes;
+ struct in_addr isl_src;
+ struct in_addr isl_dst;
+ u_char isl_p;
+ u_char isl_flags;
+ u_char isl_state[2];
+ u_short isl_type;
+ union {
+ u_short isl_filler[2];
+ u_short isl_ports[2];
+ u_short isl_icmp;
+ } isl_ps;
+} ipslog_t;
+
+#define isl_sport isl_ps.isl_ports[0]
+#define isl_dport isl_ps.isl_ports[1]
+#define isl_itype isl_ps.isl_icmp
+
+#define ISL_NEW 0
+#define ISL_EXPIRE 0xffff
+#define ISL_FLUSH 0xfffe
+
+
+typedef struct ips_stat {
+ u_long iss_hits;
+ u_long iss_miss;
+ u_long iss_max;
+ u_long iss_tcp;
+ u_long iss_udp;
+ u_long iss_icmp;
+ u_long iss_nomem;
+ u_long iss_expire;
+ u_long iss_fin;
+ u_long iss_active;
+ u_long iss_logged;
+ u_long iss_logfail;
+ u_long iss_inuse;
+ ipstate_t **iss_table;
+} ips_stat_t;
+
+
+extern u_long fr_tcpidletimeout;
+extern u_long fr_tcpclosewait;
+extern u_long fr_tcplastack;
+extern u_long fr_tcptimeout;
+extern u_long fr_tcpclosed;
+extern u_long fr_udptimeout;
+extern u_long fr_icmptimeout;
+extern int fr_stateinit __P((void));
+extern int fr_tcpstate __P((ipstate_t *, fr_info_t *, ip_t *, tcphdr_t *));
+extern ipstate_t *fr_addstate __P((ip_t *, fr_info_t *, u_int));
+extern frentry_t *fr_checkstate __P((ip_t *, fr_info_t *));
+extern void fr_timeoutstate __P((void));
+extern void fr_tcp_age __P((u_long *, u_char *, ip_t *, fr_info_t *, int));
+extern void fr_stateunload __P((void));
+extern void ipstate_log __P((struct ipstate *, u_int));
+#if defined(__NetBSD__) || defined(__OpenBSD__)
+extern int fr_state_ioctl __P((caddr_t, u_long, int));
+#else
+extern int fr_state_ioctl __P((caddr_t, int, int));
+#endif
+
+#endif /* _NETINET_IP_STATE_H__ */
diff --git a/ecos/packages/net/tcpip/current/include/netinet/ip_var.h b/ecos/packages/net/tcpip/current/include/netinet/ip_var.h
new file mode 100644
index 0000000..301c1c1
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/ip_var.h
@@ -0,0 +1,239 @@
+//==========================================================================
+//
+// include/netinet/ip_var.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ip_var.h,v 1.12 1999/12/08 06:50:20 itojun Exp $ */
+/* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * 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.
+ *
+ * @(#)ip_var.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_IP_VAR_H_
+#define _NETINET_IP_VAR_H_
+
+#include <sys/queue.h>
+
+/*
+ * Overlay for ip header used by other protocols (tcp, udp).
+ */
+struct ipovly {
+ u_int8_t ih_x1[9]; /* (unused) */
+ u_int8_t ih_pr; /* protocol */
+ u_int16_t ih_len; /* protocol length */
+ struct in_addr ih_src; /* source internet address */
+ struct in_addr ih_dst; /* destination internet address */
+};
+
+/*
+ * Ip (reassembly or sequence) queue structures.
+ *
+ * XXX -- The following explains why the ipqe_m field is here, for TCP's use:
+ * We want to avoid doing m_pullup on incoming packets but that
+ * means avoiding dtom on the tcp reassembly code. That in turn means
+ * keeping an mbuf pointer in the reassembly queue (since we might
+ * have a cluster). As a quick hack, the source & destination
+ * port numbers (which are no longer needed once we've located the
+ * tcpcb) are overlayed with an mbuf pointer.
+ */
+LIST_HEAD(ipqehead, ipqent);
+struct ipqent {
+ LIST_ENTRY(ipqent) ipqe_q;
+ union {
+ struct ip *_ip;
+ struct tcphdr *_tcp;
+ } _ipqe_u1;
+ union {
+ u_int8_t _mff; /* for IP fragmentation */
+ struct mbuf *_m; /* XXX for TCP; see above */
+ } _ipqe_u2;
+};
+#define ipqe_ip _ipqe_u1._ip
+#define ipqe_tcp _ipqe_u1._tcp
+#define ipqe_mff _ipqe_u2._mff
+#define ipqe_m _ipqe_u2._m
+
+/*
+ * Ip reassembly queue structure. Each fragment
+ * being reassembled is attached to one of these structures.
+ * They are timed out after ipq_ttl drops to 0, and may also
+ * be reclaimed if memory becomes tight.
+ */
+struct ipq {
+ LIST_ENTRY(ipq) ipq_q; /* to other reass headers */
+ u_int8_t ipq_ttl; /* time for reass q to live */
+ u_int8_t ipq_p; /* protocol of this fragment */
+ u_int16_t ipq_id; /* sequence id for reassembly */
+ struct ipqehead ipq_fragq; /* to ip fragment queue */
+ struct in_addr ipq_src, ipq_dst;
+};
+
+/*
+ * Structure stored in mbuf in inpcb.ip_options
+ * and passed to ip_output when ip options are in use.
+ * The actual length of the options (including ipopt_dst)
+ * is in m_len.
+ */
+#define MAX_IPOPTLEN 40
+
+struct ipoption {
+ struct in_addr ipopt_dst; /* first-hop dst if source routed */
+ int8_t ipopt_list[MAX_IPOPTLEN]; /* options proper */
+};
+
+/*
+ * Structure attached to inpcb.ip_moptions and
+ * passed to ip_output when IP multicast options are in use.
+ */
+struct ip_moptions {
+ struct ifnet *imo_multicast_ifp; /* ifp for outgoing multicasts */
+ u_int8_t imo_multicast_ttl; /* TTL for outgoing multicasts */
+ u_int8_t imo_multicast_loop; /* 1 => hear sends if a member */
+ u_int16_t imo_num_memberships; /* no. memberships this socket */
+ struct in_multi *imo_membership[IP_MAX_MEMBERSHIPS];
+};
+
+struct ipstat {
+ u_long ips_total; /* total packets received */
+ u_long ips_badsum; /* checksum bad */
+ u_long ips_tooshort; /* packet too short */
+ u_long ips_toosmall; /* not enough data */
+ u_long ips_badhlen; /* ip header length < data size */
+ u_long ips_badlen; /* ip length < ip header length */
+ u_long ips_fragments; /* fragments received */
+ u_long ips_fragdropped; /* frags dropped (dups, out of space) */
+ u_long ips_fragtimeout; /* fragments timed out */
+ u_long ips_forward; /* packets forwarded */
+ u_long ips_cantforward; /* packets rcvd for unreachable dest */
+ u_long ips_redirectsent; /* packets forwarded on same net */
+ u_long ips_noproto; /* unknown or unsupported protocol */
+ u_long ips_delivered; /* datagrams delivered to upper level*/
+ u_long ips_localout; /* total ip packets generated here */
+ u_long ips_odropped; /* lost packets due to nobufs, etc. */
+ u_long ips_reassembled; /* total packets reassembled ok */
+ u_long ips_fragmented; /* datagrams sucessfully fragmented */
+ u_long ips_ofragments; /* output fragments created */
+ u_long ips_cantfrag; /* don't fragment flag was set, etc. */
+ u_long ips_badoptions; /* error in option processing */
+ u_long ips_noroute; /* packets discarded due to no route */
+ u_long ips_badvers; /* ip version != 4 */
+ u_long ips_rawout; /* total raw ip packets generated */
+ u_long ips_badfrags; /* malformed fragments (bad length) */
+ u_long ips_rcvmemdrop; /* frags dropped for lack of memory */
+ u_long ips_toolong; /* ip length > max ip packet size */
+ u_long ips_nogif; /* no match gif found */
+};
+
+#ifdef _KERNEL
+/* flags passed to ip_output as last parameter */
+#define IP_FORWARDING 0x1 /* most of ip header exists */
+#define IP_RAWOUTPUT 0x2 /* raw ip header exists */
+#define IP_ROUTETOIF SO_DONTROUTE /* bypass routing tables */
+#define IP_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */
+
+#ifdef IPSEC
+#define IP_ENCAPSULATED 0x0800 /* encapsulated already */
+#endif
+
+extern struct ipstat ipstat;
+#ifndef RANDOM_IP_ID
+extern u_short ip_id; /* ip packet ctr, for ids */
+#endif
+LIST_HEAD(ipqhead, ipq) ipq; /* ip reass. queue */
+extern int ip_defttl; /* default IP ttl */
+extern int ipforwarding; /* IPforwarding state */
+
+int ip_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
+int ip_dooptions __P((struct mbuf *));
+void ip_drain __P((void));
+void ip_flush __P((void));
+void ip_forward __P((struct mbuf *, int));
+void ip_freef __P((struct ipq *));
+void ip_freemoptions __P((struct ip_moptions *));
+int ip_getmoptions __P((int, struct ip_moptions *, struct mbuf **));
+void ip_init __P((void));
+int ip_mforward __P((struct mbuf *, struct ifnet *));
+int ip_optcopy __P((struct ip *, struct ip *));
+int ip_output __P((struct mbuf *, ...));
+int ip_pcbopts __P((struct mbuf **, struct mbuf *));
+struct ip *
+ ip_reass __P((struct ipqent *, struct ipq *));
+struct in_ifaddr *
+ in_iawithaddr __P((struct in_addr, struct mbuf *));
+struct in_ifaddr *
+ ip_rtaddr __P((struct in_addr));
+u_int16_t
+ ip_randomid __P((void));
+int ip_setmoptions __P((int, struct ip_moptions **, struct mbuf *));
+void ip_slowtimo __P((void));
+struct mbuf *
+ ip_srcroute __P((void));
+void ip_stripoptions __P((struct mbuf *, struct mbuf *));
+int ip_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
+void ipintr __P((void));
+void ipv4_input __P((struct mbuf *, ...));
+int rip_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
+void rip_init __P((void));
+void rip_input __P((struct mbuf *, ...));
+int rip_output __P((struct mbuf *, ...));
+int rip_usrreq __P((struct socket *,
+ int, struct mbuf *, struct mbuf *, struct mbuf *));
+#endif
+
+#endif // _NETINET_IP_VAR_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/ipl.h b/ecos/packages/net/tcpip/current/include/netinet/ipl.h
new file mode 100644
index 0000000..71540b1
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/ipl.h
@@ -0,0 +1,46 @@
+//==========================================================================
+//
+// include/netinet/ipl.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ipl.h,v 1.2 1999/12/17 06:17:08 kjell Exp $ */
+/*
+ * Copyright (C) 1993-1999 by Darren Reed.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and due credit is given
+ * to the original author and the contributors.
+ *
+ * @(#)ipl.h 1.21 6/5/96
+ */
+
+#ifndef __IPL_H__
+#define __IPL_H__
+
+#define IPL_VERSION "IP Filter: v3.3.5"
+
+#endif
diff --git a/ecos/packages/net/tcpip/current/include/netinet/tcp.h b/ecos/packages/net/tcpip/current/include/netinet/tcp.h
new file mode 100644
index 0000000..2c65b81
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/tcp.h
@@ -0,0 +1,155 @@
+//==========================================================================
+//
+// include/netinet/tcp.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: tcp.h,v 1.8 1999/07/06 20:17:52 cmetz Exp $ */
+/* $NetBSD: tcp.h,v 1.8 1995/04/17 05:32:58 cgd Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * 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.
+ *
+ * @(#)tcp.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_TCP_H_
+#define _NETINET_TCP_H_
+
+typedef u_int32_t tcp_seq;
+
+/*
+ * TCP header.
+ * Per RFC 793, September, 1981.
+ */
+struct tcphdr {
+ u_int16_t th_sport; /* source port */
+ u_int16_t th_dport; /* destination port */
+ tcp_seq th_seq; /* sequence number */
+ tcp_seq th_ack; /* acknowledgement number */
+#if BYTE_ORDER == LITTLE_ENDIAN
+ u_int8_t th_x2:4, /* (unused) */
+ th_off:4; /* data offset */
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+ u_int8_t th_off:4, /* data offset */
+ th_x2:4; /* (unused) */
+#endif
+ u_int8_t th_flags;
+#define TH_FIN 0x01
+#define TH_SYN 0x02
+#define TH_RST 0x04
+#define TH_PUSH 0x08
+#define TH_ACK 0x10
+#define TH_URG 0x20
+ u_int16_t th_win; /* window */
+ u_int16_t th_sum; /* checksum */
+ u_int16_t th_urp; /* urgent pointer */
+} __attribute__ ((aligned(1), packed));
+#define th_reseqlen th_urp /* TCP data length for
+ resequencing/reassembly */
+
+#define TCPOPT_EOL 0
+#define TCPOPT_NOP 1
+#define TCPOPT_MAXSEG 2
+#define TCPOLEN_MAXSEG 4
+#define TCPOPT_WINDOW 3
+#define TCPOLEN_WINDOW 3
+#define TCPOPT_SACK_PERMITTED 4 /* Experimental */
+#define TCPOLEN_SACK_PERMITTED 2
+#define TCPOPT_SACK 5 /* Experimental */
+#define TCPOLEN_SACK 8 /* 2*sizeof(tcp_seq) */
+#define TCPOPT_TIMESTAMP 8
+#define TCPOLEN_TIMESTAMP 10
+#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */
+#define TCPOPT_SIGNATURE 19
+#define TCPOLEN_SIGNATURE 18
+
+#define MAX_TCPOPTLEN 40 /* Absolute maximum TCP options len */
+
+#define TCPOPT_TSTAMP_HDR \
+ (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
+
+/* Option definitions */
+#define TCPOPT_SACK_PERMIT_HDR \
+(TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_SACK_PERMITTED<<8|TCPOLEN_SACK_PERMITTED)
+#define TCPOPT_SACK_HDR (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_SACK<<8)
+/* Miscellaneous constants */
+#define MAX_SACK_BLKS 6 /* Max # SACK blocks stored at sender side */
+#define TCP_MAX_SACK 3 /* MAX # SACKs sent in any segment */
+
+#define TCP_MAXBURST 4 /* Max # packets after leaving Fast Rxmit */
+
+/*
+ * Default maximum segment size for TCP.
+ * With an IP MSS of 576, this is 536,
+ * but 512 is probably more convenient.
+ * This should be defined as min(512, IP_MSS - sizeof (struct tcpiphdr)).
+ */
+#define TCP_MSS 512
+
+#define TCP_MAXWIN 65535 /* largest value for (unscaled) window */
+
+#define TCP_MAX_WINSHIFT 14 /* maximum window shift */
+
+/*
+ * User-settable options (used with setsockopt).
+ */
+#define TCP_NODELAY 0x01 /* don't delay send to coalesce pkts */
+#define TCP_MAXSEG 0x02 /* set maximum segment size */
+#define TCP_SIGNATURE_ENABLE 0x04 /* enable TCP MD5 signature option */
+#define TCP_SACK_DISABLE 0x300 /* disable SACKs (if enabled by def.) */
+
+#endif /* !_NETINET_TCP_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/netinet/tcp_debug.h b/ecos/packages/net/tcpip/current/include/netinet/tcp_debug.h
new file mode 100644
index 0000000..44093fe
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/tcp_debug.h
@@ -0,0 +1,99 @@
+//==========================================================================
+//
+// include/netinet/tcp_debug.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: tcp_debug.h,v 1.4 1999/01/11 02:01:35 deraadt Exp $ */
+/* $NetBSD: tcp_debug.h,v 1.5 1994/06/29 06:38:38 cgd Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * 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.
+ *
+ * @(#)tcp_debug.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_TCP_DEBUG_H_
+#define _NETINET_TCP_DEBUG_H_
+
+#include <netinet6/tcpipv6.h>
+
+#ifdef TCPDEBUG
+struct tcp_debug {
+ n_time td_time;
+ short td_act;
+ short td_ostate;
+ caddr_t td_tcb;
+ struct tcpiphdr td_ti;
+ struct tcpipv6hdr td_ti6;
+ short td_req;
+ struct tcpcb td_cb;
+};
+
+#define TA_INPUT 0
+#define TA_OUTPUT 1
+#define TA_USER 2
+#define TA_RESPOND 3
+#define TA_DROP 4
+
+char *tanames[] =
+ { "input", "output", "user", "respond", "drop" };
+
+#define TCP_NDEBUG 100
+struct tcp_debug tcp_debug[TCP_NDEBUG];
+int tcp_debx;
+#endif
+
+#endif // _NETINET_TCP_DEBUG_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/tcp_fsm.h b/ecos/packages/net/tcpip/current/include/netinet/tcp_fsm.h
new file mode 100644
index 0000000..5bda84c
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/tcp_fsm.h
@@ -0,0 +1,123 @@
+//==========================================================================
+//
+// include/netinet_tcp_fsm.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: tcp_fsm.h,v 1.4 1997/11/08 19:54:12 deraadt Exp $ */
+/* $NetBSD: tcp_fsm.h,v 1.6 1994/10/14 16:01:48 mycroft Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * 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.
+ *
+ * @(#)tcp_fsm.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_TCP_FSM_H_
+#define _NETINET_TCP_FSM_H_
+
+/*
+ * TCP FSM state definitions.
+ * Per RFC793, September, 1981.
+ */
+
+#define TCP_NSTATES 11
+
+#define TCPS_CLOSED 0 /* closed */
+#define TCPS_LISTEN 1 /* listening for connection */
+#define TCPS_SYN_SENT 2 /* active, have sent syn */
+#define TCPS_SYN_RECEIVED 3 /* have sent and received syn */
+/* states < TCPS_ESTABLISHED are those where connections not established */
+#define TCPS_ESTABLISHED 4 /* established */
+#define TCPS_CLOSE_WAIT 5 /* rcvd fin, waiting for close */
+/* states > TCPS_CLOSE_WAIT are those where user has closed */
+#define TCPS_FIN_WAIT_1 6 /* have closed, sent fin */
+#define TCPS_CLOSING 7 /* closed xchd FIN; await ACK */
+#define TCPS_LAST_ACK 8 /* had fin and close; await FIN ACK */
+/* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */
+#define TCPS_FIN_WAIT_2 9 /* have closed, fin is acked */
+#define TCPS_TIME_WAIT 10 /* in 2*msl quiet wait after close */
+
+#define TCPS_HAVERCVDSYN(s) ((s) >= TCPS_SYN_RECEIVED)
+#define TCPS_HAVEESTABLISHED(s) ((s) >= TCPS_ESTABLISHED)
+#define TCPS_HAVERCVDFIN(s) ((s) >= TCPS_TIME_WAIT)
+
+#ifdef TCPOUTFLAGS
+/*
+ * Flags used when sending segments in tcp_output.
+ * Basic flags (TH_RST,TH_ACK,TH_SYN,TH_FIN) are totally
+ * determined by state, with the proviso that TH_FIN is sent only
+ * if all data queued for output is included in the segment.
+ */
+u_char tcp_outflags[TCP_NSTATES] = {
+ TH_RST|TH_ACK, 0, TH_SYN, TH_SYN|TH_ACK,
+ TH_ACK, TH_ACK,
+ TH_FIN|TH_ACK, TH_ACK, TH_FIN|TH_ACK, TH_ACK, TH_ACK,
+};
+#endif
+
+#ifdef KPROF
+int tcp_acounts[TCP_NSTATES][PRU_NREQ];
+#endif
+
+#ifdef TCPSTATES
+char *tcpstates[] = {
+ "CLOSED", "LISTEN", "SYN_SENT", "SYN_RCVD",
+ "ESTABLISHED", "CLOSE_WAIT", "FIN_WAIT_1", "CLOSING",
+ "LAST_ACK", "FIN_WAIT_2", "TIME_WAIT",
+};
+#endif
+
+#endif // _NETINET_TCP_FSM_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/tcp_seq.h b/ecos/packages/net/tcpip/current/include/netinet/tcp_seq.h
new file mode 100644
index 0000000..462ac53
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/tcp_seq.h
@@ -0,0 +1,99 @@
+//==========================================================================
+//
+// include/netinet_tcp_seq.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: tcp_seq.h,v 1.2 1997/02/24 14:06:46 niklas Exp $ */
+/* $NetBSD: tcp_seq.h,v 1.6 1995/03/26 20:32:35 jtc Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * 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.
+ *
+ * @(#)tcp_seq.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_TCP_SEQ_H_
+#define _NETINET_TCP_SEQ_H_
+
+/*
+ * TCP sequence numbers are 32 bit integers operated
+ * on with modular arithmetic. These macros can be
+ * used to compare such integers.
+ */
+#define SEQ_LT(a,b) ((int)((a)-(b)) < 0)
+#define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0)
+#define SEQ_GT(a,b) ((int)((a)-(b)) > 0)
+#define SEQ_GEQ(a,b) ((int)((a)-(b)) >= 0)
+
+/*
+ * Macros to initialize tcp sequence numbers for
+ * send and receive from initial send and receive
+ * sequence numbers.
+ */
+#define tcp_rcvseqinit(tp) \
+ (tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1
+
+#define tcp_sendseqinit(tp) \
+ (tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \
+ (tp)->iss
+
+#define TCP_ISSINCR (125*1024) /* increment for tcp_iss each second */
+
+#ifdef _KERNEL
+tcp_seq tcp_iss; /* tcp initial send seq # */
+#endif
+
+#endif // _NETINET_TCP_SEQ_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/tcp_timer.h b/ecos/packages/net/tcpip/current/include/netinet/tcp_timer.h
new file mode 100644
index 0000000..920441c
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/tcp_timer.h
@@ -0,0 +1,166 @@
+//==========================================================================
+//
+// include/netinet_tcp_timer.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: tcp_timer.h,v 1.3 1997/02/24 14:06:46 niklas Exp $ */
+/* $NetBSD: tcp_timer.h,v 1.6 1995/03/26 20:32:37 jtc Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * 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.
+ *
+ * @(#)tcp_timer.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_TCP_TIMER_H_
+#define _NETINET_TCP_TIMER_H_
+
+/*
+ * Definitions of the TCP timers. These timers are counted
+ * down PR_SLOWHZ times a second.
+ */
+#define TCPT_NTIMERS 4
+
+#define TCPT_REXMT 0 /* retransmit */
+#define TCPT_PERSIST 1 /* retransmit persistance */
+#define TCPT_KEEP 2 /* keep alive */
+#define TCPT_2MSL 3 /* 2*msl quiet time timer */
+
+/*
+ * The TCPT_REXMT timer is used to force retransmissions.
+ * The TCP has the TCPT_REXMT timer set whenever segments
+ * have been sent for which ACKs are expected but not yet
+ * received. If an ACK is received which advances tp->snd_una,
+ * then the retransmit timer is cleared (if there are no more
+ * outstanding segments) or reset to the base value (if there
+ * are more ACKs expected). Whenever the retransmit timer goes off,
+ * we retransmit one unacknowledged segment, and do a backoff
+ * on the retransmit timer.
+ *
+ * The TCPT_PERSIST timer is used to keep window size information
+ * flowing even if the window goes shut. If all previous transmissions
+ * have been acknowledged (so that there are no retransmissions in progress),
+ * and the window is too small to bother sending anything, then we start
+ * the TCPT_PERSIST timer. When it expires, if the window is nonzero,
+ * we go to transmit state. Otherwise, at intervals send a single byte
+ * into the peer's window to force him to update our window information.
+ * We do this at most as often as TCPT_PERSMIN time intervals,
+ * but no more frequently than the current estimate of round-trip
+ * packet time. The TCPT_PERSIST timer is cleared whenever we receive
+ * a window update from the peer.
+ *
+ * The TCPT_KEEP timer is used to keep connections alive. If an
+ * connection is idle (no segments received) for TCPTV_KEEP_INIT amount of time,
+ * but not yet established, then we drop the connection. Once the connection
+ * is established, if the connection is idle for TCPTV_KEEP_IDLE time
+ * (and keepalives have been enabled on the socket), we begin to probe
+ * the connection. We force the peer to send us a segment by sending:
+ * <SEQ=SND.UNA-1><ACK=RCV.NXT><CTL=ACK>
+ * This segment is (deliberately) outside the window, and should elicit
+ * an ack segment in response from the peer. If, despite the TCPT_KEEP
+ * initiated segments we cannot elicit a response from a peer in TCPT_MAXIDLE
+ * amount of time probing, then we drop the connection.
+ */
+
+/*
+ * Time constants.
+ */
+#define TCPTV_MSL ( 30*PR_SLOWHZ) /* max seg lifetime (hah!) */
+#define TCPTV_SRTTBASE 0 /* base roundtrip time;
+ if 0, no idea yet */
+#define TCPTV_SRTTDFLT ( 3*PR_SLOWHZ) /* assumed RTT if no info */
+
+#define TCPTV_PERSMIN ( 5*PR_SLOWHZ) /* retransmit persistance */
+#define TCPTV_PERSMAX ( 60*PR_SLOWHZ) /* maximum persist interval */
+
+#define TCPTV_KEEP_INIT ( 75*PR_SLOWHZ) /* initial connect keep alive */
+#define TCPTV_KEEP_IDLE (120*60*PR_SLOWHZ) /* dflt time before probing */
+#define TCPTV_KEEPINTVL ( 75*PR_SLOWHZ) /* default probe interval */
+#define TCPTV_KEEPCNT 8 /* max probes before drop */
+
+#define TCPTV_MIN ( 1*PR_SLOWHZ) /* minimum allowable value */
+#define TCPTV_REXMTMAX ( 64*PR_SLOWHZ) /* max allowable REXMT value */
+
+#define TCP_LINGERTIME 120 /* linger at most 2 minutes */
+
+#define TCP_MAXRXTSHIFT 12 /* maximum retransmits */
+
+#ifdef TCPTIMERS
+char *tcptimers[] =
+ { "REXMT", "PERSIST", "KEEP", "2MSL" };
+#endif
+
+/*
+ * Force a time value to be in a certain range.
+ */
+#define TCPT_RANGESET(tv, value, tvmin, tvmax) { \
+ (tv) = (value); \
+ if ((tv) < (tvmin)) \
+ (tv) = (tvmin); \
+ else if ((tv) > (tvmax)) \
+ (tv) = (tvmax); \
+}
+
+#ifdef _KERNEL
+extern int tcptv_keep_init;
+extern int tcp_keepidle; /* time before keepalive probes begin */
+extern int tcp_keepintvl; /* time between keepalive probes */
+extern int tcp_maxidle; /* time to drop after starting probes */
+extern int tcp_ttl; /* time to live for TCP segs */
+extern int tcp_backoff[];
+#endif
+
+#endif // _NETINET_TCP_TIMER_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/tcp_var.h b/ecos/packages/net/tcpip/current/include/netinet/tcp_var.h
new file mode 100644
index 0000000..f495240
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/tcp_var.h
@@ -0,0 +1,428 @@
+//==========================================================================
+//
+// include/netinet_tcp_var.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: tcp_var.h,v 1.25 1999/12/08 06:50:20 itojun Exp $ */
+/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993, 1994
+ * 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.
+ *
+ * @(#)tcp_var.h 8.3 (Berkeley) 4/10/94
+ */
+
+#ifndef _NETINET_TCP_VAR_H_
+#define _NETINET_TCP_VAR_H_
+
+struct sackblk {
+ tcp_seq start; /* start seq no. of sack block */
+ tcp_seq end; /* end seq no. */
+};
+
+struct sackhole {
+ tcp_seq start; /* start seq no. of hole */
+ tcp_seq end; /* end seq no. */
+ int dups; /* number of dup(s)acks for this hole */
+ tcp_seq rxmit; /* next seq. no in hole to be retransmitted */
+ struct sackhole *next; /* next in list */
+};
+
+/*
+ * Kernel variables for tcp.
+ */
+
+/*
+ * Tcp control block, one per tcp; fields:
+ */
+struct tcpcb {
+ struct ipqehead segq; /* sequencing queue */
+ short t_state; /* state of this connection */
+ short t_timer[TCPT_NTIMERS]; /* tcp timers */
+ short t_rxtshift; /* log(2) of rexmt exp. backoff */
+ short t_rxtcur; /* current retransmit value */
+ short t_dupacks; /* consecutive dup acks recd */
+ u_short t_maxseg; /* maximum segment size */
+ char t_force; /* 1 if forcing out a byte */
+ u_short t_flags;
+#define TF_ACKNOW 0x0001 /* ack peer immediately */
+#define TF_DELACK 0x0002 /* ack, but try to delay it */
+#define TF_NODELAY 0x0004 /* don't delay packets to coalesce */
+#define TF_NOOPT 0x0008 /* don't use tcp options */
+#define TF_SENTFIN 0x0010 /* have sent FIN */
+#define TF_REQ_SCALE 0x0020 /* have/will request window scaling */
+#define TF_RCVD_SCALE 0x0040 /* other side has requested scaling */
+#define TF_REQ_TSTMP 0x0080 /* have/will request timestamps */
+#define TF_RCVD_TSTMP 0x0100 /* a timestamp was received in SYN */
+#define TF_SACK_PERMIT 0x0200 /* other side said I could SACK */
+#define TF_SIGNATURE 0x0400 /* require TCP MD5 signature */
+
+ struct mbuf *t_template; /* skeletal packet for transmit */
+ struct inpcb *t_inpcb; /* back pointer to internet pcb */
+/*
+ * The following fields are used as in the protocol specification.
+ * See RFC783, Dec. 1981, page 21.
+ */
+/* send sequence variables */
+ tcp_seq snd_una; /* send unacknowledged */
+ tcp_seq snd_nxt; /* send next */
+ tcp_seq snd_up; /* send urgent pointer */
+ tcp_seq snd_wl1; /* window update seg seq number */
+ tcp_seq snd_wl2; /* window update seg ack number */
+ tcp_seq iss; /* initial send sequence number */
+ u_long snd_wnd; /* send window */
+#ifdef TCP_SACK
+ int sack_disable; /* disable SACK for this connection */
+ int snd_numholes; /* number of holes seen by sender */
+ struct sackhole *snd_holes; /* linked list of holes (sorted) */
+#if defined(TCP_SACK) && defined(TCP_FACK)
+ tcp_seq snd_fack; /* for FACK congestion control */
+ u_long snd_awnd; /* snd_nxt - snd_fack + */
+ /* retransmitted data */
+ int retran_data; /* amount of outstanding retx. data */
+#endif /* TCP_FACK */
+#endif /* TCP_SACK */
+#if defined(TCP_SACK) || defined(TCP_NEWRENO)
+ tcp_seq snd_last; /* for use in fast recovery */
+#endif
+/* receive sequence variables */
+ u_long rcv_wnd; /* receive window */
+ tcp_seq rcv_nxt; /* receive next */
+ tcp_seq rcv_up; /* receive urgent pointer */
+ tcp_seq irs; /* initial receive sequence number */
+#ifdef TCP_SACK
+ tcp_seq rcv_laststart; /* start of last segment recd. */
+ tcp_seq rcv_lastend; /* end of ... */
+ tcp_seq rcv_lastsack; /* last seq number(+1) sack'd by rcv'r*/
+ int rcv_numsacks; /* # distinct sack blks present */
+ struct sackblk sackblks[MAX_SACK_BLKS]; /* seq nos. of sack blocks */
+#endif
+
+/*
+ * Additional variables for this implementation.
+ */
+/* receive variables */
+ tcp_seq rcv_adv; /* advertised window */
+/* retransmit variables */
+ tcp_seq snd_max; /* highest sequence number sent;
+ * used to recognize retransmits
+ */
+/* congestion control (for slow start, source quench, retransmit after loss) */
+ u_long snd_cwnd; /* congestion-controlled window */
+ u_long snd_ssthresh; /* snd_cwnd size threshhold for
+ * for slow start exponential to
+ * linear switch
+ */
+ u_int t_maxopd; /* mss plus options */
+
+/*
+ * transmit timing stuff. See below for scale of srtt and rttvar.
+ * "Variance" is actually smoothed difference.
+ */
+ short t_idle; /* inactivity time */
+ short t_rtt; /* round trip time */
+ tcp_seq t_rtseq; /* sequence number being timed */
+ short t_srtt; /* smoothed round-trip time */
+ short t_rttvar; /* variance in round-trip time */
+ u_short t_rttmin; /* minimum rtt allowed */
+ u_long max_sndwnd; /* largest window peer has offered */
+
+/* out-of-band data */
+ char t_oobflags; /* have some */
+ char t_iobc; /* input character */
+#define TCPOOB_HAVEDATA 0x01
+#define TCPOOB_HADDATA 0x02
+ short t_softerror; /* possible error not yet reported */
+
+/* RFC 1323 variables */
+ u_char snd_scale; /* window scaling for send window */
+ u_char rcv_scale; /* window scaling for recv window */
+ u_char request_r_scale; /* pending window scaling */
+ u_char requested_s_scale;
+ u_int32_t ts_recent; /* timestamp echo data */
+ u_int32_t ts_recent_age; /* when last updated */
+ tcp_seq last_ack_sent;
+
+/* TUBA stuff */
+ caddr_t t_tuba_pcb; /* next level down pcb for TCP over z */
+
+ int pf;
+};
+
+#define intotcpcb(ip) ((struct tcpcb *)(ip)->inp_ppcb)
+#define sototcpcb(so) (intotcpcb(sotoinpcb(so)))
+
+/*
+ * The smoothed round-trip time and estimated variance
+ * are stored as fixed point numbers scaled by the values below.
+ * For convenience, these scales are also used in smoothing the average
+ * (smoothed = (1/scale)sample + ((scale-1)/scale)smoothed).
+ * With these scales, srtt has 3 bits to the right of the binary point,
+ * and thus an "ALPHA" of 0.875. rttvar has 2 bits to the right of the
+ * binary point, and is smoothed with an ALPHA of 0.75.
+ */
+#define TCP_RTT_SCALE 8 /* multiplier for srtt; 3 bits frac. */
+#define TCP_RTT_SHIFT 3 /* shift for srtt; 3 bits frac. */
+#define TCP_RTTVAR_SCALE 4 /* multiplier for rttvar; 2 bits */
+#define TCP_RTTVAR_SHIFT 2 /* multiplier for rttvar; 2 bits */
+
+/*
+ * The initial retransmission should happen at rtt + 4 * rttvar.
+ * Because of the way we do the smoothing, srtt and rttvar
+ * will each average +1/2 tick of bias. When we compute
+ * the retransmit timer, we want 1/2 tick of rounding and
+ * 1 extra tick because of +-1/2 tick uncertainty in the
+ * firing of the timer. The bias will give us exactly the
+ * 1.5 tick we need. But, because the bias is
+ * statistical, we have to test that we don't drop below
+ * the minimum feasible timer (which is 2 ticks).
+ * This macro assumes that the value of TCP_RTTVAR_SCALE
+ * is the same as the multiplier for rttvar.
+ */
+#define TCP_REXMTVAL(tp) \
+ ((((tp)->t_srtt >> TCP_RTT_SHIFT) + (tp)->t_rttvar) >> 2)
+
+/*
+ * TCP statistics.
+ * Many of these should be kept per connection,
+ * but that's inconvenient at the moment.
+ */
+struct tcpstat {
+ u_int32_t tcps_connattempt; /* connections initiated */
+ u_int32_t tcps_accepts; /* connections accepted */
+ u_int32_t tcps_connects; /* connections established */
+ u_int32_t tcps_drops; /* connections dropped */
+ u_int32_t tcps_conndrops; /* embryonic connections dropped */
+ u_int32_t tcps_closed; /* conn. closed (includes drops) */
+ u_int32_t tcps_segstimed; /* segs where we tried to get rtt */
+ u_int32_t tcps_rttupdated; /* times we succeeded */
+ u_int32_t tcps_delack; /* delayed acks sent */
+ u_int32_t tcps_timeoutdrop; /* conn. dropped in rxmt timeout */
+ u_int32_t tcps_rexmttimeo; /* retransmit timeouts */
+ u_int32_t tcps_persisttimeo; /* persist timeouts */
+ u_int32_t tcps_persistdrop; /* connections dropped in persist */
+ u_int32_t tcps_keeptimeo; /* keepalive timeouts */
+ u_int32_t tcps_keepprobe; /* keepalive probes sent */
+ u_int32_t tcps_keepdrops; /* connections dropped in keepalive */
+
+ u_int32_t tcps_sndtotal; /* total packets sent */
+ u_int32_t tcps_sndpack; /* data packets sent */
+ u_int64_t tcps_sndbyte; /* data bytes sent */
+ u_int32_t tcps_sndrexmitpack; /* data packets retransmitted */
+ u_int64_t tcps_sndrexmitbyte; /* data bytes retransmitted */
+ u_int64_t tcps_sndrexmitfast; /* Fast retransmits */
+ u_int32_t tcps_sndacks; /* ack-only packets sent */
+ u_int32_t tcps_sndprobe; /* window probes sent */
+ u_int32_t tcps_sndurg; /* packets sent with URG only */
+ u_int32_t tcps_sndwinup; /* window update-only packets sent */
+ u_int32_t tcps_sndctrl; /* control (SYN|FIN|RST) packets sent */
+
+ u_int32_t tcps_rcvtotal; /* total packets received */
+ u_int32_t tcps_rcvpack; /* packets received in sequence */
+ u_int64_t tcps_rcvbyte; /* bytes received in sequence */
+ u_int32_t tcps_rcvbadsum; /* packets received with ccksum errs */
+ u_int32_t tcps_rcvbadoff; /* packets received with bad offset */
+ u_int32_t tcps_rcvmemdrop; /* packets dropped for lack of memory */
+ u_int32_t tcps_rcvnosec; /* packets dropped for lack of ipsec */
+ u_int32_t tcps_rcvshort; /* packets received too short */
+ u_int32_t tcps_rcvduppack; /* duplicate-only packets received */
+ u_int64_t tcps_rcvdupbyte; /* duplicate-only bytes received */
+ u_int32_t tcps_rcvpartduppack; /* packets with some duplicate data */
+ u_int64_t tcps_rcvpartdupbyte; /* dup. bytes in part-dup. packets */
+ u_int32_t tcps_rcvoopack; /* out-of-order packets received */
+ u_int64_t tcps_rcvoobyte; /* out-of-order bytes received */
+ u_int32_t tcps_rcvpackafterwin; /* packets with data after window */
+ u_int64_t tcps_rcvbyteafterwin; /* bytes rcvd after window */
+ u_int32_t tcps_rcvafterclose; /* packets rcvd after "close" */
+ u_int32_t tcps_rcvwinprobe; /* rcvd window probe packets */
+ u_int32_t tcps_rcvdupack; /* rcvd duplicate acks */
+ u_int32_t tcps_rcvacktoomuch; /* rcvd acks for unsent data */
+ u_int32_t tcps_rcvackpack; /* rcvd ack packets */
+ u_int64_t tcps_rcvackbyte; /* bytes acked by rcvd acks */
+ u_int32_t tcps_rcvwinupd; /* rcvd window update packets */
+ u_int32_t tcps_pawsdrop; /* segments dropped due to PAWS */
+ u_int32_t tcps_predack; /* times hdr predict ok for acks */
+ u_int32_t tcps_preddat; /* times hdr predict ok for data pkts */
+
+ u_int32_t tcps_pcbhashmiss; /* input packets missing pcb hash */
+ u_int32_t tcps_noport; /* no socket on port */
+ u_int32_t tcps_badsyn; /* SYN packet with src==dst rcv'ed */
+
+ u_int32_t tcps_rcvbadsig; /* rcvd bad/missing TCP signatures */
+ u_int64_t tcps_rcvgoodsig; /* rcvd good TCP signatures */
+};
+
+/*
+ * Names for TCP sysctl objects.
+ */
+
+#define TCPCTL_RFC1323 1 /* enable/disable RFC1323 timestamps/scaling */
+#define TCPCTL_KEEPINITTIME 2 /* TCPT_KEEP value */
+#define TCPCTL_KEEPIDLE 3 /* allow tcp_keepidle to be changed */
+#define TCPCTL_KEEPINTVL 4 /* allow tcp_keepintvl to be changed */
+#define TCPCTL_SLOWHZ 5 /* return kernel idea of PR_SLOWHZ */
+#define TCPCTL_BADDYNAMIC 6 /* return bad dynamic port bitmap */
+#define TCPCTL_RECVSPACE 7 /* receive buffer space */
+#define TCPCTL_SENDSPACE 8 /* send buffer space */
+#define TCPCTL_IDENT 9 /* get connection owner */
+#define TCPCTL_SACK 10 /* selective acknowledgement, rfc 2018 */
+#define TCPCTL_MSSDFLT 11 /* Default maximum segment size */
+#define TCPCTL_MAXID 12
+
+#define TCPCTL_NAMES { \
+ { 0, 0 }, \
+ { "rfc1323", CTLTYPE_INT }, \
+ { "keepinittime", CTLTYPE_INT }, \
+ { "keepidle", CTLTYPE_INT }, \
+ { "keepintvl", CTLTYPE_INT }, \
+ { "slowhz", CTLTYPE_INT }, \
+ { "baddynamic", CTLTYPE_STRUCT }, \
+ { "recvspace", CTLTYPE_INT }, \
+ { "sendspace", CTLTYPE_INT }, \
+ { "ident", CTLTYPE_STRUCT }, \
+ { "sack", CTLTYPE_INT }, \
+ { "mssdflt", CTLTYPE_INT }, \
+}
+
+struct tcp_ident_mapping {
+ struct sockaddr faddr, laddr;
+ int euid, ruid;
+};
+
+#ifdef _KERNEL
+struct inpcbtable tcbtable; /* head of queue of active tcpcb's */
+struct tcpstat tcpstat; /* tcp statistics */
+u_int32_t tcp_now; /* for RFC 1323 timestamps */
+extern int tcp_do_rfc1323; /* enabled/disabled? */
+extern int tcp_mssdflt; /* default maximum segment size */
+#ifdef TCP_SACK
+extern int tcp_do_sack; /* SACK enabled/disabled */
+#endif
+
+int tcp_attach __P((struct socket *));
+void tcp_canceltimers __P((struct tcpcb *));
+struct tcpcb *
+ tcp_close __P((struct tcpcb *));
+#if defined(INET6) && !defined(TCP6)
+void tcp6_ctlinput __P((int, struct sockaddr *, void *));
+#endif
+void *tcp_ctlinput __P((int, struct sockaddr *, void *));
+int tcp_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
+struct tcpcb *
+ tcp_disconnect __P((struct tcpcb *));
+struct tcpcb *
+ tcp_drop __P((struct tcpcb *, int));
+void tcp_dooptions __P((struct tcpcb *, u_char *, int, struct tcphdr *,
+ int *, u_int32_t *, u_int32_t *));
+void tcp_drain __P((void));
+void tcp_fasttimo __P((void));
+void tcp_init __P((void));
+#if defined(INET6) && !defined(TCP6)
+int tcp6_input __P((struct mbuf **, int *, int));
+#endif
+void tcp_input __P((struct mbuf *, ...));
+int tcp_mss __P((struct tcpcb *, u_int));
+struct tcpcb *
+ tcp_newtcpcb __P((struct inpcb *));
+void tcp_notify __P((struct inpcb *, int));
+int tcp_output __P((struct tcpcb *));
+void tcp_pulloutofband __P((struct socket *, u_int, struct mbuf *, int));
+void tcp_quench __P((struct inpcb *, int));
+int tcp_reass __P((struct tcpcb *, struct tcphdr *, struct mbuf *, int *));
+void tcp_respond __P((struct tcpcb *, caddr_t, struct mbuf *, tcp_seq,
+ tcp_seq, int));
+void tcp_setpersist __P((struct tcpcb *));
+void tcp_slowtimo __P((void));
+struct mbuf *
+ tcp_template __P((struct tcpcb *));
+struct tcpcb *
+ tcp_timers __P((struct tcpcb *, int));
+void tcp_trace __P((int, int, struct tcpcb *, caddr_t, int, int));
+struct tcpcb *
+ tcp_usrclosed __P((struct tcpcb *));
+int tcp_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
+#if defined(INET6) && !defined(TCP6)
+int tcp6_usrreq __P((struct socket *,
+ int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *));
+#endif
+int tcp_usrreq __P((struct socket *,
+ int, struct mbuf *, struct mbuf *, struct mbuf *));
+void tcp_xmit_timer __P((struct tcpcb *, int));
+void tcpdropoldhalfopen __P((struct tcpcb *, u_int16_t));
+#ifdef TCP_SACK
+int tcp_sack_option __P((struct tcpcb *,struct tcphdr *,u_char *,int));
+void tcp_update_sack_list __P((struct tcpcb *tp));
+void tcp_del_sackholes __P((struct tcpcb *, struct tcphdr *));
+void tcp_clean_sackreport __P((struct tcpcb *tp));
+void tcp_sack_adjust __P((struct tcpcb *tp));
+struct sackhole *
+ tcp_sack_output __P((struct tcpcb *tp));
+int tcp_sack_partialack __P((struct tcpcb *, struct tcphdr *));
+#ifdef DEBUG
+void tcp_print_holes __P((struct tcpcb *tp));
+#endif
+#endif /* TCP_SACK */
+#if defined(TCP_NEWRENO) || defined(TCP_SACK)
+int tcp_newreno __P((struct tcpcb *, struct tcphdr *));
+u_long tcp_seq_subtract __P((u_long, u_long ));
+#endif /* TCP_NEWRENO || TCP_SACK */
+#ifdef TCP_SIGNATURE
+int tcp_signature_apply __P((caddr_t, caddr_t, unsigned int));
+#endif /* TCP_SIGNATURE */
+
+#endif /* _KERNEL */
+
+#endif // _NETINET_TCP_VAR_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/tcpip.h b/ecos/packages/net/tcpip/current/include/netinet/tcpip.h
new file mode 100644
index 0000000..d8c59b3
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/tcpip.h
@@ -0,0 +1,95 @@
+//==========================================================================
+//
+// include/netinet/tcpip.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: tcpip.h,v 1.4 1997/08/26 20:02:35 deraadt Exp $ */
+/* $NetBSD: tcpip.h,v 1.6 1995/11/21 01:07:44 cgd Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * 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.
+ *
+ * @(#)tcpip.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_TCPIP_H_
+#define _NETINET_TCPIP_H_
+
+/*
+ * Tcp+ip header, after ip options removed.
+ */
+struct tcpiphdr {
+ /* overlaid ip structure */
+ struct ipovly ti_i __attribute__ ((aligned(1), packed));
+ struct tcphdr ti_t; /* tcp header */
+};
+#define ti_x1 ti_i.ih_x1
+#define ti_pr ti_i.ih_pr
+#define ti_len ti_i.ih_len
+#define ti_src ti_i.ih_src
+#define ti_dst ti_i.ih_dst
+#define ti_sport ti_t.th_sport
+#define ti_dport ti_t.th_dport
+#define ti_seq ti_t.th_seq
+#define ti_ack ti_t.th_ack
+#define ti_x2 ti_t.th_x2
+#define ti_off ti_t.th_off
+#define ti_flags ti_t.th_flags
+#define ti_win ti_t.th_win
+#define ti_sum ti_t.th_sum
+#define ti_urp ti_t.th_urp
+
+#endif // _NETINET_TCPIP_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/udp.h b/ecos/packages/net/tcpip/current/include/netinet/udp.h
new file mode 100644
index 0000000..644497d
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/udp.h
@@ -0,0 +1,82 @@
+//==========================================================================
+//
+// include/netinet/udp.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: udp.h,v 1.3 1997/02/24 14:06:47 niklas Exp $ */
+/* $NetBSD: udp.h,v 1.6 1995/04/13 06:37:10 cgd Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * 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.
+ *
+ * @(#)udp.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_UDP_H_
+#define _NETINET_UDP_H_
+
+/*
+ * Udp protocol header.
+ * Per RFC 768, September, 1981.
+ */
+struct udphdr {
+ u_int16_t uh_sport; /* source port */
+ u_int16_t uh_dport; /* destination port */
+ u_int16_t uh_ulen; /* udp length */
+ u_int16_t uh_sum; /* udp checksum */
+} __attribute__ ((aligned(1), packed));
+
+#endif // _NETINET_UDP_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet/udp_var.h b/ecos/packages/net/tcpip/current/include/netinet/udp_var.h
new file mode 100644
index 0000000..62949db
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet/udp_var.h
@@ -0,0 +1,141 @@
+//==========================================================================
+//
+// include/netinet/udp_var.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: udp_var.h,v 1.9 1999/12/08 06:50:20 itojun Exp $ */
+/* $NetBSD: udp_var.h,v 1.12 1996/02/13 23:44:41 christos Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1993
+ * 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.
+ *
+ * @(#)udp_var.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_UDP_VAR_H_
+#define _NETINET_UDP_VAR_H_
+
+/*
+ * UDP kernel structures and variables.
+ */
+struct udpiphdr {
+ /* overlaid ip structure */
+ struct ipovly ui_i __attribute__ ((aligned(1), packed));
+ struct udphdr ui_u; /* udp header */
+};
+#define ui_x1 ui_i.ih_x1
+#define ui_pr ui_i.ih_pr
+#define ui_len ui_i.ih_len
+#define ui_src ui_i.ih_src
+#define ui_dst ui_i.ih_dst
+#define ui_sport ui_u.uh_sport
+#define ui_dport ui_u.uh_dport
+#define ui_ulen ui_u.uh_ulen
+#define ui_sum ui_u.uh_sum
+
+struct udpstat {
+ /* input statistics: */
+ u_long udps_ipackets; /* total input packets */
+ u_long udps_hdrops; /* packet shorter than header */
+ u_long udps_badsum; /* checksum error */
+ u_long udps_nosum; /* no checksum */
+ u_long udps_badlen; /* data length larger than packet */
+ u_long udps_noport; /* no socket on port */
+ u_long udps_noportbcast; /* of above, arrived as broadcast */
+ u_long udps_nosec; /* dropped for lack of ipsec */
+ u_long udps_fullsock; /* not delivered, input socket full */
+ u_long udps_pcbhashmiss; /* input packets missing pcb hash */
+ /* output statistics: */
+ u_long udps_opackets; /* total output packets */
+};
+
+/*
+ * Names for UDP sysctl objects
+ */
+#define UDPCTL_CHECKSUM 1 /* checksum UDP packets */
+#define UDPCTL_BADDYNAMIC 2 /* return bad dynamic port bitmap */
+#define UDPCTL_RECVSPACE 3 /* receive buffer space */
+#define UDPCTL_SENDSPACE 4 /* send buffer space */
+#define UDPCTL_MAXID 5
+
+#define UDPCTL_NAMES { \
+ { 0, 0 }, \
+ { "checksum", CTLTYPE_INT }, \
+ { "baddynamic", CTLTYPE_STRUCT }, \
+ { "recvspace", CTLTYPE_INT }, \
+ { "sendspace", CTLTYPE_INT }, \
+}
+
+#ifdef _KERNEL
+struct inpcbtable udbtable;
+struct udpstat udpstat;
+
+#if defined(INET6) && !defined(TCP6)
+void udp6_ctlinput __P((int, struct sockaddr *, void *));
+int udp6_input __P((struct mbuf **, int *, int));
+int udp6_usrreq __P((struct socket *,
+ int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *));
+#endif
+void *udp_ctlinput __P((int, struct sockaddr *, void *));
+void udp_init __P((void));
+void udp_input __P((struct mbuf *, ...));
+int udp_output __P((struct mbuf *, ...));
+int udp_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
+int udp_usrreq __P((struct socket *,
+ int, struct mbuf *, struct mbuf *, struct mbuf *));
+#endif
+
+#endif // _NETINET_UDP_VAR_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/debug.h b/ecos/packages/net/tcpip/current/include/netinet6/debug.h
new file mode 100644
index 0000000..6ea57f7
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/debug.h
@@ -0,0 +1,244 @@
+//==========================================================================
+//
+// include/netinet6_sys_debug.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/*
+%%% portions-copyright-nrl-95
+Portions of this software are Copyright 1995-1998 by Randall Atkinson,
+Ronald Lee, Daniel McDonald, Bao Phan, and Chris Winters. All Rights
+Reserved. All rights under this copyright have been assigned to the US
+Naval Research Laboratory (NRL). The NRL Copyright Notice and License
+Agreement Version 1.1 (January 17, 1995) applies to these portions of the
+software.
+You should have received a copy of the license with this software. If you
+didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
+
+*/
+
+#ifndef _NETINET6_SYS_DEBUG_H
+#define _NETINET6_SYS_DEBUG_H 1
+
+#ifdef DEBUG_NRL
+#include <sys/osdep.h>
+#else /* DEBUG_NRL */
+#if __OpenBSD__
+#include <netinet6/osdep.h>
+#else /* __OpenBSD__ */
+#include <sys/osdep.h>
+#endif /* __OpenBSD__ */
+#endif /* DEBUG_NRL */
+
+/* Non-ANSI compilers don't stand a chance. You PROBABLY need GNU C. */
+#ifndef __STDC__
+#error An ANSI C compiler is required here.
+#endif /* __STDC__ */
+
+#ifndef _KERN_DEBUG_GENERIC_C
+extern int debug_level;
+#endif /* _KERN_DEBUG_GENERIC_DEBUG_C */
+
+/* Debugging levels */
+
+#define __DEBUG_LEVEL_ALL (INT_MAX-1) /* Report all messages. */
+#define __DEBUG_LEVEL_NONE 0 /* Report no messages. */
+
+#define __DEBUG_LEVEL_CRITICAL 3
+#define __DEBUG_LEVEL_ERROR 7
+#define __DEBUG_LEVEL_MAJOREVENT 10
+#define __DEBUG_LEVEL_EVENT 15
+#define __DEBUG_LEVEL_GROSSEVENT 20
+#define __DEBUG_LEVEL_FINISHED 1000
+
+/* Compatibility macros */
+
+#define __DEBUG_LEVEL_MAJOR_EVENT __DEBUG_LEVEL_MAJOREVENT
+#define __DEBUG_LEVEL_GROSS_EVENT __DEBUG_LEVEL_GROSSEVENT
+#define __DEBUG_LEVEL_IDL_CRITICAL __DEBUG_LEVEL_CRITICAL
+#define __DEBUG_LEVEL_IDL_ERROR __DEBUG_LEVEL_ERROR
+#define __DEBUG_LEVEL_IDL_MAJOR_EVENT __DEBUG_LEVEL_MAJOREVENT
+#define __DEBUG_LEVEL_IDL_EVENT __DEBUG_LEVEL_EVENT
+#define __DEBUG_LEVEL_IDL_GROSS_EVENT __DEBUG_LEVEL_GROSSEVENT
+#define __DEBUG_LEVEL_IDL_FINISHED __DEBUG_LEVEL_FINISHED
+
+/* Unless you have optimization turned off and your compiler is drain bamaged,
+ this will turn in to a syntactically inert no-op - cmetz */
+#define __DEBUG_NOP do { } while (0)
+
+#ifdef DEBUG_NRL
+/*
+ * Make sure argument for DPRINTF is in parentheses.
+ *
+ * For both DPRINTF and DDO, and attempt was made to make both macros
+ * be usable as normal C statments. There is a small amount of compiler
+ * trickery (if-else clauses with effectively null statements), which may
+ * cause a few compilers to complain.
+ */
+
+#ifndef __GENERIC_DEBUG_LEVEL
+#define __GENERIC_DEBUG_LEVEL debug_level
+#endif /* __GENERIC_DEBUG_LEVEL */
+
+/*
+ * DPRINTF() is a general printf statement. The "arg" is literally what
+ * would follow the function name printf, which means it has to be in
+ * parenthesis. Unlimited arguments can be used this way.
+ *
+ * EXAMPLE:
+ * DPRINTF(IDL_MAJOR_EVENT,("Hello, world. IP version %d.\n",vers));
+ */
+#undef DPRINTF
+#define DPRINTF(lev,arg) \
+ if (__DEBUG_LEVEL_ ## lev <= __GENERIC_DEBUG_LEVEL) { \
+ printf arg; \
+ } else \
+ __DEBUG_NOP
+
+/*
+ * DDO() executes a series of statements at a certain debug level. The
+ * "stmt" argument is a statement in the sense of a "statement list" in a
+ * C grammar. "stmt" does not have to end with a semicolon.
+ *
+ * EXAMPLE:
+ * DDO(IDL_CRITICAL,dump_ipv6(header), dump_inpcb(inp));
+ */
+#undef DDO
+#define DDO(lev,stmt) \
+ if (__DEBUG_LEVEL_ ## lev <= __GENERIC_DEBUG_LEVEL) { \
+ stmt ; \
+ } else \
+ __DEBUG_NOP
+
+/*
+ * DP() is a shortcut for DPRINTF(). Basically:
+ *
+ * DP(lev, var, fmt) == DPRINTF(IDL_lev, ("var = %fmt\n", var))
+ *
+ * It is handy for printing single variables without a lot of typing.
+ *
+ * EXAMPLE:
+ *
+ * DP(CRITICAL,length,d);
+ * same as DPRINTF(IDL_CRITICAL, ("length = %d\n", length))
+ */
+#undef DP
+#define DP(lev, var, fmt) \
+ DPRINTF(lev, (#var " = %" #fmt "\n", var))
+
+#undef DEBUG_STATUS
+#if defined(__GNUC__) && (__GNUC__ >= 2)
+#define DEBUG_STATUS debug_status(__FILE__ ":" __FUNCTION__, __LINE__, __builtin_return_address(0))
+#else /* defined(__GNUC__) && (__GNUC__ >= 2) */
+#define DEBUG_STATUS debug_status(__FILE__, __LINE__, (void *)0)
+#endif /* defined(__GNUC__) && (__GNUC__ >= 2) */
+
+/* Call as:
+
+ DS();
+*/
+#undef DS
+#define DS() DPRINTF(IDL_CRITICAL, ("%s\n", DEBUG_STATUS))
+#else /* DEBUG_NRL */
+#undef DPRINTF
+#define DPRINTF(lev,arg) __DEBUG_NOP
+#undef DDO
+#define DDO(lev, stmt) __DEBUG_NOP
+#undef DP
+#define DP(x, y, z) __DEBUG_NOP
+#undef DS
+#define DS() __DEBUG_NOP
+#endif /* DEBUG_NRL */
+
+#ifdef DEBUG_MALLOC
+void *debug_malloc_malloc(unsigned int n, char *creator);
+void debug_malloc_free(void *p);
+void debug_malloc_dump(void);
+void debug_malloc_flush(void);
+#endif /* DEBUG_MALLOC */
+
+#ifdef DEBUG_NRL
+char *debug_status(char *filefunction, unsigned int line, void *returnaddress);
+void dump_buf_small(void *, int);
+void debug_dump_buf(void *, int);
+void dump_packet(void *buf, int len);
+
+struct dump_flags {
+ int val;
+ char *name;
+};
+void dump_flags(struct dump_flags *, int);
+
+struct sockaddr;
+void dump_sockaddr(struct sockaddr *);
+void dump_smart_sockaddr(void *);
+
+#ifdef __linux__
+struct sk_buff;
+void dump_skb(struct sk_buff *);
+#endif /* __linux__ */
+
+#ifdef OSDEP_BSD
+struct sockaddr_dl;
+void dump_sockaddr_dl(struct sockaddr_dl *);
+struct mbuf;
+void dump_mbuf_flags(struct mbuf *);
+void dump_mbuf_hdr(struct mbuf *);
+void dump_mbuf(struct mbuf *);
+void dump_mchain_hdr(struct mbuf *);
+void dump_mchain(struct mbuf *);
+void dump_mbuf_tcpdump(struct mbuf *);
+struct ifaddr;
+void dump_ifa(struct ifaddr *);
+struct ifnet;
+void dump_ifp(struct ifnet *);
+struct route;
+void dump_route(struct route *);
+struct rtentry;
+void dump_rtentry(struct rtentry *);
+struct inpcb;
+void dump_inpcb(struct inpcb *);
+#if __NetBSD__ || __OpenBSD__
+struct inpcbtable;
+void dump_inpcbs(struct inpcbtable *);
+#else /* __NetBSD__ || __OpenBSD__ */
+void dump_inpcbs(struct inpcb *);
+#endif /* __NetBSD__ || __OpenBSD__ */
+#endif /* OSDEP_BSD */
+
+#ifdef INET
+struct in_addr;
+void dump_in_addr(struct in_addr *);
+struct sockaddr_in;
+void dump_sockaddr_in(struct sockaddr_in *);
+#endif /* INET */
+
+#ifdef INET6
+#include <netinet6/debug_inet6.h>
+#endif /* INET6 */
+#endif /* DEBUG_NRL */
+
+#endif /* _NETINET6_SYS_DEBUG_H */
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/debug_inet6.h b/ecos/packages/net/tcpip/current/include/netinet6/debug_inet6.h
new file mode 100644
index 0000000..6e6dc95
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/debug_inet6.h
@@ -0,0 +1,55 @@
+//==========================================================================
+//
+// include/netinet6_debug_inet6.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/*
+%%% copyright-nrl-95
+This software is Copyright 1995-1998 by Randall Atkinson, Ronald Lee,
+Daniel McDonald, Bao Phan, and Chris Winters. All Rights Reserved. All
+rights under this copyright have been assigned to the US Naval Research
+Laboratory (NRL). The NRL Copyright Notice and License Agreement Version
+1.1 (January 17, 1995) applies to this software.
+You should have received a copy of the license with this software. If you
+didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
+
+*/
+
+#ifndef _NETINET6_DEBUG_INET6_H
+#define _NETINET6_DEBUG_INET6_H 1
+
+struct in6_addr;
+void dump_in6_addr(struct in6_addr *);
+struct sockaddr_in6;
+void dump_sockaddr_in6(struct sockaddr_in6 *);
+struct ipv6;
+void dump_ipv6(struct ipv6 *ipv6);
+struct ipv6_icmp;
+void dump_ipv6_icmp(struct ipv6_icmp *icp);
+struct discq;
+void dump_discq(struct discq *dq);
+#endif /* _NETINET6_DEBUG_INET6_H */
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/icmp6.h b/ecos/packages/net/tcpip/current/include/netinet6/icmp6.h
new file mode 100644
index 0000000..bf3076d
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/icmp6.h
@@ -0,0 +1,680 @@
+//==========================================================================
+//
+// include/netinet6_icmpv6.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: icmp6.h,v 1.2 1999/12/10 10:04:27 angelos Exp $ */
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * 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.
+ *
+ * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET6_ICMPV6_H_
+#define _NETINET6_ICMPV6_H_
+
+#define ICMPV6_PLD_MAXLEN 1232 /* IPV6_MMTU - sizeof(struct ip6_hdr)
+ - sizeof(struct icmp6_hdr) */
+
+struct icmp6_hdr {
+ u_int8_t icmp6_type; /* type field */
+ u_int8_t icmp6_code; /* code field */
+ u_int16_t icmp6_cksum; /* checksum field */
+ union {
+ u_int32_t icmp6_un_data32[1]; /* type-specific field */
+ u_int16_t icmp6_un_data16[2]; /* type-specific field */
+ u_int8_t icmp6_un_data8[4]; /* type-specific field */
+ } icmp6_dataun;
+};
+
+#define icmp6_data32 icmp6_dataun.icmp6_un_data32
+#define icmp6_data16 icmp6_dataun.icmp6_un_data16
+#define icmp6_data8 icmp6_dataun.icmp6_un_data8
+#define icmp6_pptr icmp6_data32[0] /* parameter prob */
+#define icmp6_mtu icmp6_data32[0] /* packet too big */
+#define icmp6_id icmp6_data16[0] /* echo request/reply */
+#define icmp6_seq icmp6_data16[1] /* echo request/reply */
+#define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */
+
+#define ICMP6_DST_UNREACH 1 /* dest unreachable, codes: */
+#define ICMP6_PACKET_TOO_BIG 2 /* packet too big */
+#define ICMP6_TIME_EXCEEDED 3 /* time exceeded, code: */
+#define ICMP6_PARAM_PROB 4 /* ip6 header bad */
+
+#define ICMP6_ECHO_REQUEST 128 /* echo service */
+#define ICMP6_ECHO_REPLY 129 /* echo reply */
+#define ICMP6_MEMBERSHIP_QUERY 130 /* group membership query */
+#define MLD6_LISTENER_QUERY 130 /* multicast listener query */
+#define ICMP6_MEMBERSHIP_REPORT 131 /* group membership report */
+#define MLD6_LISTENER_REPORT 131 /* multicast listener report */
+#define ICMP6_MEMBERSHIP_REDUCTION 132 /* group membership termination */
+#define MLD6_LISTENER_DONE 132 /* multicast listener done */
+
+#define ND_ROUTER_SOLICIT 133 /* router solicitation */
+#define ND_ROUTER_ADVERT 134 /* router advertisment */
+#define ND_NEIGHBOR_SOLICIT 135 /* neighbor solicitation */
+#define ND_NEIGHBOR_ADVERT 136 /* neighbor advertisment */
+#define ND_REDIRECT 137 /* redirect */
+
+#define ICMP6_ROUTER_RENUMBERING 138 /* router renumbering */
+
+#define ICMP6_WRUREQUEST 139 /* who are you request */
+#define ICMP6_WRUREPLY 140 /* who are you reply */
+#define ICMP6_FQDN_QUERY 139 /* FQDN query */
+#define ICMP6_FQDN_REPLY 140 /* FQDN reply */
+#define ICMP6_NI_QUERY 139 /* node information request */
+#define ICMP6_NI_REPLY 140 /* node information reply */
+
+/* The definitions below are experimental. TBA */
+#define MLD6_MTRACE_RESP 141 /* mtrace response(to sender) */
+#define MLD6_MTRACE 142 /* mtrace messages */
+
+#define ICMP6_MAXTYPE 142
+
+#define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */
+#define ICMP6_DST_UNREACH_ADMIN 1 /* administratively prohibited */
+#define ICMP6_DST_UNREACH_NOTNEIGHBOR 2 /* not a neighbor(obsolete) */
+#define ICMP6_DST_UNREACH_BEYONDSCOPE 2 /* beyond scope of source address */
+#define ICMP6_DST_UNREACH_ADDR 3 /* address unreachable */
+#define ICMP6_DST_UNREACH_NOPORT 4 /* port unreachable */
+
+#define ICMP6_TIME_EXCEED_TRANSIT 0 /* ttl==0 in transit */
+#define ICMP6_TIME_EXCEED_REASSEMBLY 1 /* ttl==0 in reass */
+
+#define ICMP6_PARAMPROB_HEADER 0 /* erroneous header field */
+#define ICMP6_PARAMPROB_NEXTHEADER 1 /* unrecognized next header */
+#define ICMP6_PARAMPROB_OPTION 2 /* unrecognized option */
+
+#define ICMP6_INFOMSG_MASK 0x80 /* all informational messages */
+
+#define ICMP6_NI_SUCESS 0 /* node information successful reply */
+#define ICMP6_NI_REFUSED 1 /* node information request is refused */
+#define ICMP6_NI_UNKNOWN 2 /* unknown Qtype */
+
+#define ICMP6_ROUTER_RENUMBERING_COMMAND 0 /* rr command */
+#define ICMP6_ROUTER_RENUMBERING_RESULT 1 /* rr result */
+#define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET 255 /* rr seq num reset */
+
+/* Used in kernel only */
+#define ND_REDIRECT_ONLINK 0 /* redirect to an on-link node */
+#define ND_REDIRECT_ROUTER 1 /* redirect to a better router */
+
+/*
+ * Multicast Listener Discovery
+ */
+struct mld6_hdr {
+ struct icmp6_hdr mld6_hdr;
+ struct in6_addr mld6_addr; /* multicast address */
+};
+
+#define mld6_type mld6_hdr.icmp6_type
+#define mld6_code mld6_hdr.icmp6_code
+#define mld6_cksum mld6_hdr.icmp6_cksum
+#define mld6_maxdelay mld6_hdr.icmp6_data16[0]
+#define mld6_reserved mld6_hdr.icmp6_data16[1]
+
+/*
+ * Neighbor Discovery
+ */
+
+struct nd_router_solicit { /* router solicitation */
+ struct icmp6_hdr nd_rs_hdr;
+ /* could be followed by options */
+};
+
+#define nd_rs_type nd_rs_hdr.icmp6_type
+#define nd_rs_code nd_rs_hdr.icmp6_code
+#define nd_rs_cksum nd_rs_hdr.icmp6_cksum
+#define nd_rs_reserved nd_rs_hdr.icmp6_data32[0]
+
+struct nd_router_advert { /* router advertisement */
+ struct icmp6_hdr nd_ra_hdr;
+ u_int32_t nd_ra_reachable; /* reachable time */
+ u_int32_t nd_ra_retransmit; /* retransmit timer */
+ /* could be followed by options */
+};
+
+#define nd_ra_type nd_ra_hdr.icmp6_type
+#define nd_ra_code nd_ra_hdr.icmp6_code
+#define nd_ra_cksum nd_ra_hdr.icmp6_cksum
+#define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0]
+#define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1]
+#define ND_RA_FLAG_MANAGED 0x80
+#define ND_RA_FLAG_OTHER 0x40
+#define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1]
+
+struct nd_neighbor_solicit { /* neighbor solicitation */
+ struct icmp6_hdr nd_ns_hdr;
+ struct in6_addr nd_ns_target; /*target address */
+ /* could be followed by options */
+};
+
+#define nd_ns_type nd_ns_hdr.icmp6_type
+#define nd_ns_code nd_ns_hdr.icmp6_code
+#define nd_ns_cksum nd_ns_hdr.icmp6_cksum
+#define nd_ns_reserved nd_ns_hdr.icmp6_data32[0]
+
+struct nd_neighbor_advert { /* neighbor advertisement */
+ struct icmp6_hdr nd_na_hdr;
+ struct in6_addr nd_na_target; /* target address */
+ /* could be followed by options */
+};
+
+#define nd_na_type nd_na_hdr.icmp6_type
+#define nd_na_code nd_na_hdr.icmp6_code
+#define nd_na_cksum nd_na_hdr.icmp6_cksum
+#define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0]
+#if BYTE_ORDER == BIG_ENDIAN
+#define ND_NA_FLAG_ROUTER 0x80000000
+#define ND_NA_FLAG_SOLICITED 0x40000000
+#define ND_NA_FLAG_OVERRIDE 0x20000000
+#else
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define ND_NA_FLAG_ROUTER 0x80
+#define ND_NA_FLAG_SOLICITED 0x40
+#define ND_NA_FLAG_OVERRIDE 0x20
+#endif
+#endif
+
+struct nd_redirect { /* redirect */
+ struct icmp6_hdr nd_rd_hdr;
+ struct in6_addr nd_rd_target; /* target address */
+ struct in6_addr nd_rd_dst; /* destination address */
+ /* could be followed by options */
+};
+
+#define nd_rd_type nd_rd_hdr.icmp6_type
+#define nd_rd_code nd_rd_hdr.icmp6_code
+#define nd_rd_cksum nd_rd_hdr.icmp6_cksum
+#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0]
+
+struct nd_opt_hdr { /* Neighbor discovery option header */
+ u_int8_t nd_opt_type;
+ u_int8_t nd_opt_len;
+ /* followed by option specific data*/
+};
+
+#define ND_OPT_SOURCE_LINKADDR 1
+#define ND_OPT_TARGET_LINKADDR 2
+#define ND_OPT_PREFIX_INFORMATION 3
+#define ND_OPT_REDIRECTED_HEADER 4
+#define ND_OPT_MTU 5
+
+struct nd_opt_prefix_info { /* prefix information */
+ u_int8_t nd_opt_pi_type;
+ u_int8_t nd_opt_pi_len;
+ u_int8_t nd_opt_pi_prefix_len;
+ u_int8_t nd_opt_pi_flags_reserved;
+ u_int32_t nd_opt_pi_valid_time;
+ u_int32_t nd_opt_pi_preferred_time;
+ u_int32_t nd_opt_pi_reserved2;
+ struct in6_addr nd_opt_pi_prefix;
+};
+
+#define ND_OPT_PI_FLAG_ONLINK 0x80
+#define ND_OPT_PI_FLAG_AUTO 0x40
+
+struct nd_opt_rd_hdr { /* redirected header */
+ u_int8_t nd_opt_rh_type;
+ u_int8_t nd_opt_rh_len;
+ u_int16_t nd_opt_rh_reserved1;
+ u_int32_t nd_opt_rh_reserved2;
+ /* followed by IP header and data */
+};
+
+struct nd_opt_mtu { /* MTU option */
+ u_int8_t nd_opt_mtu_type;
+ u_int8_t nd_opt_mtu_len;
+ u_int16_t nd_opt_mtu_reserved;
+ u_int32_t nd_opt_mtu_mtu;
+};
+
+/*
+ * icmp6 namelookup
+ */
+
+struct icmp6_namelookup {
+ struct icmp6_hdr icmp6_nl_hdr;
+ u_int64_t icmp6_nl_nonce;
+ u_int32_t icmp6_nl_ttl;
+#if 0
+ u_int8_t icmp6_nl_len;
+ u_int8_t icmp6_nl_name[3];
+#endif
+ /* could be followed by options */
+};
+
+/*
+ * icmp6 node information
+ */
+struct icmp6_nodeinfo {
+ struct icmp6_hdr icmp6_ni_hdr;
+ u_int64_t icmp6_ni_nonce;
+ /* could be followed by reply data */
+};
+
+#define ni_type icmp6_ni_hdr.icmp6_type
+#define ni_code icmp6_ni_hdr.icmp6_code
+#define ni_cksum icmp6_ni_hdr.icmp6_cksum
+#define ni_qtype icmp6_ni_hdr.icmp6_data16[0]
+#define ni_flags icmp6_ni_hdr.icmp6_data16[1]
+
+
+#define NI_QTYPE_NOOP 0 /* NOOP */
+#define NI_QTYPE_SUPTYPES 1 /* Supported Qtypes */
+#define NI_QTYPE_FQDN 2 /* FQDN */
+#define NI_QTYPE_NODEADDR 3 /* Node Addresses. XXX: spec says 2, but it may be a typo... */
+
+#if BYTE_ORDER == BIG_ENDIAN
+#define NI_SUPTYPE_FLAG_COMPRESS 0x1
+#define NI_FQDN_FLAG_VALIDTTL 0x1
+#define NI_NODEADDR_FLAG_LINKLOCAL 0x1
+#define NI_NODEADDR_FLAG_SITELOCAL 0x2
+#define NI_NODEADDR_FLAG_GLOBAL 0x4
+#define NI_NODEADDR_FLAG_ALL 0x8
+#define NI_NODEADDR_FLAG_TRUNCATE 0x10
+#define NI_NODEADDR_FLAG_ANYCAST 0x20 /* just experimental. not in spec */
+#elif BYTE_ORDER == LITTLE_ENDIAN
+#define NI_SUPTYPE_FLAG_COMPRESS 0x0100
+#define NI_FQDN_FLAG_VALIDTTL 0x0100
+#define NI_NODEADDR_FLAG_LINKLOCAL 0x0100
+#define NI_NODEADDR_FLAG_SITELOCAL 0x0200
+#define NI_NODEADDR_FLAG_GLOBAL 0x0400
+#define NI_NODEADDR_FLAG_ALL 0x0800
+#define NI_NODEADDR_FLAG_TRUNCATE 0x1000
+#define NI_NODEADDR_FLAG_ANYCAST 0x2000 /* just experimental. not in spec */
+#endif
+
+struct ni_reply_fqdn {
+ u_int32_t ni_fqdn_ttl; /* TTL */
+ u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */
+ u_int8_t ni_fqdn_name[3]; /* XXX: alignment */
+};
+
+/*
+ * Router Renumbering. as router-renum-08.txt
+ */
+#if BYTE_ORDER == BIG_ENDIAN /* net byte order */
+struct icmp6_router_renum { /* router renumbering header */
+ struct icmp6_hdr rr_hdr;
+ u_int8_t rr_segnum;
+ u_int8_t rr_test : 1;
+ u_int8_t rr_reqresult : 1;
+ u_int8_t rr_forceapply : 1;
+ u_int8_t rr_specsite : 1;
+ u_int8_t rr_prevdone : 1;
+ u_int8_t rr_flags_reserved : 3;
+ u_int16_t rr_maxdelay;
+ u_int32_t rr_reserved;
+};
+#elif BYTE_ORDER == LITTLE_ENDIAN
+struct icmp6_router_renum { /* router renumbering header */
+ struct icmp6_hdr rr_hdr;
+ u_int8_t rr_segnum;
+ u_int8_t rr_flags_reserved : 3;
+ u_int8_t rr_prevdone : 1;
+ u_int8_t rr_specsite : 1;
+ u_int8_t rr_forceapply : 1;
+ u_int8_t rr_reqresult : 1;
+ u_int8_t rr_test : 1;
+ u_int16_t rr_maxdelay;
+ u_int32_t rr_reserved;
+};
+#endif /* BYTE_ORDER */
+
+#define rr_type rr_hdr.icmp6_type
+#define rr_code rr_hdr.icmp6_code
+#define rr_cksum rr_hdr.icmp6_cksum
+#define rr_seqnum rr_hdr.icmp6_data32[0]
+
+struct rr_pco_match { /* match prefix part */
+ u_int8_t rpm_code;
+ u_int8_t rpm_len;
+ u_int8_t rpm_ordinal;
+ u_int8_t rpm_matchlen;
+ u_int8_t rpm_minlen;
+ u_int8_t rpm_maxlen;
+ u_int16_t rpm_reserved;
+ struct in6_addr rpm_prefix;
+};
+
+#define RPM_PCO_ADD 1
+#define RPM_PCO_CHANGE 2
+#define RPM_PCO_SETGLOBAL 3
+#define RPM_PCO_MAX 4
+
+#if BYTE_ORDER == BIG_ENDIAN /* net byte order */
+struct rr_pco_use { /* use prefix part */
+ u_int8_t rpu_uselen;
+ u_int8_t rpu_keeplen;
+ u_int8_t rpu_mask_onlink : 1;
+ u_int8_t rpu_mask_autonomous : 1;
+ u_int8_t rpu_mask_reserved : 6;
+ u_int8_t rpu_onlink : 1;
+ u_int8_t rpu_autonomous : 1;
+ u_int8_t rpu_raflags_reserved : 6;
+ u_int32_t rpu_vltime;
+ u_int32_t rpu_pltime;
+ u_int32_t rpu_decr_vltime : 1;
+ u_int32_t rpu_decr_pltime : 1;
+ u_int32_t rpu_flags_reserved : 6;
+ u_int32_t rpu_reserved : 24;
+ struct in6_addr rpu_prefix;
+};
+#elif BYTE_ORDER == LITTLE_ENDIAN
+struct rr_pco_use { /* use prefix part */
+ u_int8_t rpu_uselen;
+ u_int8_t rpu_keeplen;
+ u_int8_t rpu_mask_reserved : 6;
+ u_int8_t rpu_mask_autonomous : 1;
+ u_int8_t rpu_mask_onlink : 1;
+ u_int8_t rpu_raflags_reserved : 6;
+ u_int8_t rpu_autonomous : 1;
+ u_int8_t rpu_onlink : 1;
+ u_int32_t rpu_vltime;
+ u_int32_t rpu_pltime;
+ u_int32_t rpu_flags_reserved : 6;
+ u_int32_t rpu_decr_pltime : 1;
+ u_int32_t rpu_decr_vltime : 1;
+ u_int32_t rpu_reserved : 24;
+ struct in6_addr rpu_prefix;
+};
+#endif /* BYTE_ORDER */
+
+#if BYTE_ORDER == BIG_ENDIAN /* net byte order */
+struct rr_result { /* router renumbering result message */
+ u_int8_t rrr_reserved;
+ u_int8_t rrr_flags_reserved : 6;
+ u_int8_t rrr_outofbound : 1;
+ u_int8_t rrr_forbidden : 1;
+ u_int8_t rrr_ordinal;
+ u_int8_t rrr_matchedlen;
+ u_int32_t rrr_ifid;
+ struct in6_addr rrr_prefix;
+};
+#elif BYTE_ORDER == LITTLE_ENDIAN
+struct rr_result { /* router renumbering result message */
+ u_int8_t rrr_reserved;
+ u_int8_t rrr_forbidden : 1;
+ u_int8_t rrr_outofbound : 1;
+ u_int8_t rrr_flags_reserved : 6;
+ u_int8_t rrr_ordinal;
+ u_int8_t rrr_matchedlen;
+ u_int32_t rrr_ifid;
+ struct in6_addr rrr_prefix;
+};
+#endif /* BYTE_ORDER */
+
+/*
+ * icmp6 filter structures.
+ */
+
+struct icmp6_filter {
+ u_int32_t icmp6_filter[8];
+};
+
+#ifdef _KERNEL
+#define ICMP6_FILTER_SETPASSALL(filterp) \
+ { \
+ int i; u_char *p; \
+ p = (u_char *)filterp; \
+ for (i = 0; i < sizeof(struct icmp6_filter); i++) \
+ p[i] = 0xff; \
+ }
+#define ICMP6_FILTER_SETBLOCKALL(filterp) \
+ bzero(filterp, sizeof(struct icmp6_filter))
+#else /* _KERNEL */
+#define ICMP6_FILTER_SETPASSALL(filterp) \
+ memset(filterp, 0xff, sizeof(struct icmp6_filter))
+#define ICMP6_FILTER_SETBLOCKALL(filterp) \
+ memset(filterp, 0x00, sizeof(struct icmp6_filter))
+#endif /* _KERNEL */
+
+#define ICMP6_FILTER_SETPASS(type, filterp) \
+ (((filterp)->icmp6_filter[(type) >> 5]) |= (1 << ((type) & 31)))
+#define ICMP6_FILTER_SETBLOCK(type, filterp) \
+ (((filterp)->icmp6_filter[(type) >> 5]) &= ~(1 << ((type) & 31)))
+#define ICMP6_FILTER_WILLPASS(type, filterp) \
+ ((((filterp)->icmp6_filter[(type) >> 5]) & (1 << ((type) & 31))) != 0)
+#define ICMP6_FILTER_WILLBLOCK(type, filterp) \
+ ((((filterp)->icmp6_filter[(type) >> 5]) & (1 << ((type) & 31))) == 0)
+
+/*
+ * Variables related to this implementation
+ * of the internet control message protocol version 6.
+ */
+struct icmp6stat {
+/* statistics related to icmp6 packets generated */
+ u_quad_t icp6s_error; /* # of calls to icmp6_error */
+ u_quad_t icp6s_canterror; /* no error 'cuz old was icmp */
+ u_quad_t icp6s_toofreq; /* no error 'cuz rate limitation */
+ u_quad_t icp6s_outhist[256];
+/* statistics related to input message processed */
+ u_quad_t icp6s_badcode; /* icmp6_code out of range */
+ u_quad_t icp6s_tooshort; /* packet < sizeof(struct icmp6_hdr) */
+ u_quad_t icp6s_checksum; /* bad checksum */
+ u_quad_t icp6s_badlen; /* calculated bound mismatch */
+ u_quad_t icp6s_reflect; /* number of responses */
+ u_quad_t icp6s_inhist[256];
+ u_quad_t icp6s_nd_toomanyopt; /* too many ND options */
+};
+
+/*
+ * Names for ICMP sysctl objects
+ */
+#define ICMPV6CTL_STATS 1
+#define ICMPV6CTL_REDIRACCEPT 2 /* accept/process redirects */
+#define ICMPV6CTL_REDIRTIMEOUT 3 /* redirect cache time */
+#define ICMPV6CTL_ERRRATELIMIT 5 /* ICMPv6 error rate limitation */
+#define ICMPV6CTL_ND6_PRUNE 6
+#define ICMPV6CTL_ND6_DELAY 8
+#define ICMPV6CTL_ND6_UMAXTRIES 9
+#define ICMPV6CTL_ND6_MMAXTRIES 10
+#define ICMPV6CTL_ND6_USELOOPBACK 11
+#define ICMPV6CTL_ND6_PROXYALL 12
+#define ICMPV6CTL_MAXID 13
+
+#define ICMPV6CTL_NAMES { \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { "rediraccept", CTLTYPE_INT }, \
+ { "redirtimeout", CTLTYPE_INT }, \
+ { 0, 0 }, \
+ { "errratelimit", CTLTYPE_INT }, \
+ { "nd6_prune", CTLTYPE_INT }, \
+ { 0, 0 }, \
+ { "nd6_delay", CTLTYPE_INT }, \
+ { "nd6_umaxtries", CTLTYPE_INT }, \
+ { "nd6_mmaxtries", CTLTYPE_INT }, \
+ { "nd6_useloopback", CTLTYPE_INT }, \
+ { "nd6_proxyall", CTLTYPE_INT }, \
+}
+
+#define ICMPV6CTL_VARS { \
+ 0, \
+ 0, \
+ &icmp6_rediraccept, \
+ &icmp6_redirtimeout, \
+ 0, \
+ 0, \
+ &icmp6errratelim, \
+ &nd6_prune, \
+ 0, \
+ &nd6_delay, \
+ &nd6_umaxtries, \
+ &nd6_mmaxtries, \
+ &nd6_useloopback, \
+ &nd6_proxyall, \
+}
+
+#define RTF_PROBEMTU RTF_PROTO1
+
+#ifdef _KERNEL
+# ifdef __STDC__
+struct rtentry;
+struct rttimer;
+struct in6_multi;
+# endif
+void icmp6_init __P((void));
+void icmp6_paramerror __P((struct mbuf *, int));
+void icmp6_error __P((struct mbuf *, int, int, int));
+int icmp6_input __P((struct mbuf **, int *, int));
+void icmp6_fasttimo __P((void));
+void icmp6_reflect __P((struct mbuf *, size_t));
+void icmp6_prepare __P((struct mbuf *));
+void icmp6_redirect_input __P((struct mbuf *, int));
+void icmp6_redirect_output __P((struct mbuf *, struct rtentry *));
+int icmp6_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
+
+/* XXX: is this the right place for these macros? */
+#define icmp6_ifstat_inc(ifp, tag) \
+do { \
+ if ((ifp) && (ifp)->if_index <= if_index \
+ && (ifp)->if_index < icmp6_ifstatmax \
+ && icmp6_ifstat && icmp6_ifstat[(ifp)->if_index]) { \
+ icmp6_ifstat[(ifp)->if_index]->tag++; \
+ } \
+} while (0)
+
+#define icmp6_ifoutstat_inc(ifp, type, code) \
+do { \
+ icmp6_ifstat_inc(ifp, ifs6_out_msg); \
+ if (type < ICMP6_INFOMSG_MASK) \
+ icmp6_ifstat_inc(ifp, ifs6_out_error); \
+ switch(type) { \
+ case ICMP6_DST_UNREACH: \
+ icmp6_ifstat_inc(ifp, ifs6_out_dstunreach); \
+ if (code == ICMP6_DST_UNREACH_ADMIN) \
+ icmp6_ifstat_inc(ifp, ifs6_out_adminprohib); \
+ break; \
+ case ICMP6_PACKET_TOO_BIG: \
+ icmp6_ifstat_inc(ifp, ifs6_out_pkttoobig); \
+ break; \
+ case ICMP6_TIME_EXCEEDED: \
+ icmp6_ifstat_inc(ifp, ifs6_out_timeexceed); \
+ break; \
+ case ICMP6_PARAM_PROB: \
+ icmp6_ifstat_inc(ifp, ifs6_out_paramprob); \
+ break; \
+ case ICMP6_ECHO_REQUEST: \
+ icmp6_ifstat_inc(ifp, ifs6_out_echo); \
+ break; \
+ case ICMP6_ECHO_REPLY: \
+ icmp6_ifstat_inc(ifp, ifs6_out_echoreply); \
+ break; \
+ case MLD6_LISTENER_QUERY: \
+ icmp6_ifstat_inc(ifp, ifs6_out_mldquery); \
+ break; \
+ case MLD6_LISTENER_REPORT: \
+ icmp6_ifstat_inc(ifp, ifs6_out_mldreport); \
+ break; \
+ case MLD6_LISTENER_DONE: \
+ icmp6_ifstat_inc(ifp, ifs6_out_mlddone); \
+ break; \
+ case ND_ROUTER_SOLICIT: \
+ icmp6_ifstat_inc(ifp, ifs6_out_routersolicit); \
+ break; \
+ case ND_ROUTER_ADVERT: \
+ icmp6_ifstat_inc(ifp, ifs6_out_routeradvert); \
+ break; \
+ case ND_NEIGHBOR_SOLICIT: \
+ icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); \
+ break; \
+ case ND_NEIGHBOR_ADVERT: \
+ icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); \
+ break; \
+ case ND_REDIRECT: \
+ icmp6_ifstat_inc(ifp, ifs6_out_redirect); \
+ break; \
+ } \
+} while (0)
+
+extern int icmp6_rediraccept; /* accept/process redirects */
+extern int icmp6_redirtimeout; /* cache time for redirect routes */
+#endif /* _KERNEL */
+
+#endif /* not _NETINET6_ICMPV6_H_ */
+
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/icmpv6.h b/ecos/packages/net/tcpip/current/include/netinet6/icmpv6.h
new file mode 100644
index 0000000..0bc4903
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/icmpv6.h
@@ -0,0 +1,110 @@
+//==========================================================================
+//
+// include/netinet6_icmpv6.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/*
+%%% portions-copyright-nrl-97
+Portions of this software are Copyright 1997-1998 by Randall Atkinson,
+Ronald Lee, Daniel McDonald, Bao Phan, and Chris Winters. All Rights
+Reserved. All rights under this copyright have been assigned to the US
+Naval Research Laboratory (NRL). The NRL Copyright Notice and License
+Agreement Version 1.1 (January 17, 1995) applies to these portions of the
+software.
+You should have received a copy of the license with this software. If you
+didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
+
+*/
+
+#ifndef _NETINET6_ICMPV6_H
+#define _NETINET6_ICMPV6_H 1
+
+#include <netinet6/ipv6.h>
+
+struct icmpv6hdr {
+ uint8_t icmpv6_type; /* type field */
+ uint8_t icmpv6_code; /* code field */
+ uint16_t icmpv6_cksum; /* checksum field */
+ union {
+ uint32_t un_data32[1]; /* type-specific field */
+ uint16_t un_data16[2]; /* type-specific field */
+ uint8_t un_data8[4]; /* type-specific field */
+ } icmpv6_dataun;
+};
+
+#define icmpv6_data32 icmpv6_dataun.un_data32
+#define icmpv6_data16 icmpv6_dataun.un_data16
+#define icmpv6_data8 icmpv6_dataun.un_data8
+#define icmpv6_pptr icmpv6_data32[0] /* parameter prob */
+#define icmpv6_mtu icmpv6_data32[0] /* packet too big */
+#define icmpv6_id icmpv6_data16[0] /* echo request/reply */
+#define icmpv6_seq icmpv6_data16[1] /* echo request/reply */
+#define icmpv6_maxdelay icmpv6_data16[0] /* mcast group membership */
+
+#define ICMPV6_DST_UNREACH 1
+#define ICMPV6_PACKET_TOOBIG 2
+#define ICMPV6_TIME_EXCEEDED 3
+#define ICMPV6_PARAMETER_PROBLEM 4
+
+#define ICMPV6_INFOMSG_MASK 128 /* all informational messages */
+#define ICMPV6_ECHO_REQUEST 128
+#define ICMPV6_ECHO_REPLY 129
+#define ICMPV6_MEMBERSHIP_QUERY 130
+#define ICMPV6_MEMBERSHIP_REPORT 131
+#define ICMPV6_MEMBERSHIP_REDUCTION 132
+
+#define ICMPV6_UNREACH_NOROUTE 0
+#define ICMPV6_UNREACH_ADMIN 1 /* administratively prohibited */
+#define ICMPV6_UNREACH_NOTNEIGHBOR 2 /* not a neighbor (and must be) */
+#define ICMPV6_UNREACH_ADDRESS 3
+#define ICMPV6_UNREACH_PORT 4
+
+#define ICMPV6_EXCEEDED_HOPS 0 /* Hop Limit == 0 in transit */
+#define ICMPV6_EXCEEDED_REASSEMBLY 1 /* Reassembly time out */
+
+#define ICMPV6_PARAMPROB_HDR 0 /* erroneous header field */
+#define ICMPV6_PARAMPROB_NEXTHDR 1 /* unrecognized Next Header */
+#define ICMPV6_PARAMPROB_OPTION 2 /* unrecognized option */
+
+struct icmpv6_filter {
+ uint32_t data[8]; /* 8*32 = 256 bits */
+};
+
+#define ICMPV6_FILTER_WILLPASS(type, filterp) \
+ ((((filterp)->data[(type) >> 5]) & (1 << ((type) & 31))) == 0)
+#define ICMPV6_FILTER_WILLBLOCK(type, filterp) \
+ ((((filterp)->data[(type) >> 5]) & (1 << ((type) & 31))) != 0)
+#define ICMPV6_FILTER_SETPASS(type, filterp) \
+ ((((filterp)->data[(type) >> 5]) &= ~(1 << ((type) & 31))))
+#define ICMPV6_FILTER_SETBLOCK(type, filterp) \
+ ((((filterp)->data[(type) >> 5]) |= (1 << ((type) & 31))))
+#define ICMPV6_FILTER_SETPASSALL(filterp) \
+ memset((filterp), 0, sizeof(struct icmpv6_filter))
+#define ICMPV6_FILTER_SETBLOCKALL(filterp) \
+ memset((filterp), 0xff, sizeof(struct icmpv6_filter))
+
+#endif /* _NETINET6_ICMPV6_H */
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/icmpv6_var.h b/ecos/packages/net/tcpip/current/include/netinet6/icmpv6_var.h
new file mode 100644
index 0000000..2c29a76
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/icmpv6_var.h
@@ -0,0 +1,82 @@
+//==========================================================================
+//
+// include/netinet6_icmpv6_var.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/*
+%%% copyright-nrl-95
+This software is Copyright 1995-1998 by Randall Atkinson, Ronald Lee,
+Daniel McDonald, Bao Phan, and Chris Winters. All Rights Reserved. All
+rights under this copyright have been assigned to the US Naval Research
+Laboratory (NRL). The NRL Copyright Notice and License Agreement Version
+1.1 (January 17, 1995) applies to this software.
+You should have received a copy of the license with this software. If you
+didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
+
+*/
+
+#ifndef _NETINET6_ICMPV6_VAR_H
+#define _NETINET6_ICMPV6_VAR_H 1
+
+#if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199802
+#define _ICMPV6STAT_TYPE u_quad_t
+#else /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199802 */
+#define _ICMPV6STAT_TYPE u_long
+#endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199802 */
+
+struct icmpv6stat
+{
+ _ICMPV6STAT_TYPE icps_error;
+ _ICMPV6STAT_TYPE icps_tooshort;
+ _ICMPV6STAT_TYPE icps_checksum;
+ _ICMPV6STAT_TYPE icps_outhist[ICMPV6_MAXTYPE+1];
+ _ICMPV6STAT_TYPE icps_badlen;
+ _ICMPV6STAT_TYPE icps_badcode;
+ _ICMPV6STAT_TYPE icps_reflect; /* Number of in-kernel responses */
+ _ICMPV6STAT_TYPE icps_inhist[ICMPV6_MAXTYPE+1];
+};
+
+/*
+ * Names for ICMPV6 sysctl objects
+ */
+#define ICMPV6CTL_STATS 1 /* statistics */
+#define ICMPV6CTL_MAXID 2
+
+#define ICMPV6CTL_NAMES { \
+ { 0, 0 }, \
+ { "stats", CTLTYPE_STRUCT }, \
+}
+
+#define ICMPV6CTL_VARS { \
+ 0, \
+ 0, \
+}
+
+#if defined(_KERNEL) || defined(KERNEL)
+struct icmpv6stat icmpv6stat;
+#endif /* defined(_KERNEL) || defined(KERNEL) */
+#endif /* _NETINET6_ICMPV6_VAR_H */
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/in6.h b/ecos/packages/net/tcpip/current/include/netinet6/in6.h
new file mode 100644
index 0000000..e5b572e
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/in6.h
@@ -0,0 +1,682 @@
+//==========================================================================
+//
+// include/netinet6_in6.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: in6.h,v 1.9 1999/12/10 08:53:17 angelos Exp $ */
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1990, 1993
+ * 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.
+ *
+ * @(#)in.h 8.3 (Berkeley) 1/3/94
+ */
+
+#ifndef _NETINET6_IN6_H_
+#define _NETINET6_IN6_H_
+
+#if !defined(_XOPEN_SOURCE)
+#include <sys/queue.h>
+#endif
+
+/*
+ * Identification of the network protocol stack
+ */
+#define __KAME__
+#define __KAME_VERSION "19991208/OpenBSD-current"
+
+/*
+ * Local port number conventions:
+ *
+ * Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root),
+ * unless a kernel is compiled with IPNOPRIVPORTS defined.
+ *
+ * When a user does a bind(2) or connect(2) with a port number of zero,
+ * a non-conflicting local port address is chosen.
+ *
+ * The default range is IPPORT_ANONMIX to IPPORT_ANONMAX, although
+ * that is settable by sysctl(3); net.inet.ip.anonportmin and
+ * net.inet.ip.anonportmax respectively.
+ *
+ * A user may set the IPPROTO_IP option IP_PORTRANGE to change this
+ * default assignment range.
+ *
+ * The value IP_PORTRANGE_DEFAULT causes the default behavior.
+ *
+ * The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT,
+ * and exists only for FreeBSD compatibility purposes.
+ *
+ * The value IP_PORTRANGE_LOW changes the range to the "low" are
+ * that is (by convention) restricted to privileged processes.
+ * This convention is based on "vouchsafe" principles only.
+ * It is only secure if you trust the remote host to restrict these ports.
+ * The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX.
+ */
+
+#define IPV6PORT_RESERVED 1024
+#define IPV6PORT_ANONMIN 49152
+#define IPV6PORT_ANONMAX 65535
+#define IPV6PORT_RESERVEDMIN 600
+#define IPV6PORT_RESERVEDMAX (IPV6PORT_RESERVED-1)
+
+/*
+ * IPv6 address
+ */
+struct in6_addr {
+ union {
+ u_int8_t __u6_addr8[16];
+ u_int16_t __u6_addr16[8];
+ u_int32_t __u6_addr32[4];
+ } __u6_addr; /* 128-bit IP6 address */
+};
+
+#define s6_addr __u6_addr.__u6_addr8
+#ifdef _KERNEL /*XXX nonstandard*/
+#define s6_addr8 __u6_addr.__u6_addr8
+#define s6_addr16 __u6_addr.__u6_addr16
+#define s6_addr32 __u6_addr.__u6_addr32
+#endif
+
+#define INET6_ADDRSTRLEN 46
+
+/*
+ * Socket address for IPv6
+ */
+#if !defined(_XOPEN_SOURCE)
+#define SIN6_LEN
+#endif
+struct sockaddr_in6 {
+ u_char sin6_len; /* length of this struct(sa_family_t)*/
+ u_char sin6_family; /* AF_INET6 (sa_family_t) */
+ u_int16_t sin6_port; /* Transport layer port # (in_port_t)*/
+ u_int32_t sin6_flowinfo; /* IP6 flow information */
+ struct in6_addr sin6_addr; /* IP6 address */
+ u_int32_t sin6_scope_id; /* intface scope id */
+};
+
+/*
+ * Local definition for masks
+ */
+#ifdef _KERNEL /*XXX nonstandard*/
+#define IN6MASK0 {{{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }}}
+#define IN6MASK32 {{{ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, \
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
+#define IN6MASK64 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
+#define IN6MASK96 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
+ 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 }}}
+#define IN6MASK128 {{{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, \
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}}
+#endif
+
+#ifdef _KERNEL
+extern const struct in6_addr in6mask0;
+extern const struct in6_addr in6mask32;
+extern const struct in6_addr in6mask64;
+extern const struct in6_addr in6mask96;
+extern const struct in6_addr in6mask128;
+#endif /* _KERNEL */
+
+/*
+ * Macros started with IPV6_ADDR is KAME local
+ */
+#ifdef _KERNEL /*XXX nonstandard*/
+#if BYTE_ORDER == BIG_ENDIAN
+#define IPV6_ADDR_INT32_ONE 1
+#define IPV6_ADDR_INT32_TWO 2
+#define IPV6_ADDR_INT32_MNL 0xff010000
+#define IPV6_ADDR_INT32_MLL 0xff020000
+#define IPV6_ADDR_INT32_SMP 0x0000ffff
+#define IPV6_ADDR_INT16_ULL 0xfe80
+#define IPV6_ADDR_INT16_USL 0xfec0
+#define IPV6_ADDR_INT16_MLL 0xff02
+#elif BYTE_ORDER == LITTLE_ENDIAN
+#define IPV6_ADDR_INT32_ONE 0x01000000
+#define IPV6_ADDR_INT32_TWO 0x02000000
+#define IPV6_ADDR_INT32_MNL 0x000001ff
+#define IPV6_ADDR_INT32_MLL 0x000002ff
+#define IPV6_ADDR_INT32_SMP 0xffff0000
+#define IPV6_ADDR_INT16_ULL 0x80fe
+#define IPV6_ADDR_INT16_USL 0xc0fe
+#define IPV6_ADDR_INT16_MLL 0x02ff
+#endif
+#endif
+
+/*
+ * Definition of some useful macros to handle IP6 addresses
+ */
+#define IN6ADDR_ANY_INIT \
+ {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
+#define IN6ADDR_LOOPBACK_INIT \
+ {{{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
+#define IN6ADDR_NODELOCAL_ALLNODES_INIT \
+ {{{ 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
+#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \
+ {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
+#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
+ {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}
+
+extern const struct in6_addr in6addr_any;
+extern const struct in6_addr in6addr_loopback;
+extern const struct in6_addr in6addr_nodelocal_allnodes;
+extern const struct in6_addr in6addr_linklocal_allnodes;
+extern const struct in6_addr in6addr_linklocal_allrouters;
+
+/*
+ * Equality
+ * NOTE: Some of kernel programming environment (for example, openbsd/sparc)
+ * does not supply memcmp(). For userland memcmp() is preferred as it is
+ * in ANSI standard.
+ */
+#ifdef _KERNEL
+#define IN6_ARE_ADDR_EQUAL(a, b) \
+ (bcmp((a), (b), sizeof(struct in6_addr)) == 0)
+#else
+#define IN6_ARE_ADDR_EQUAL(a, b) \
+ (memcmp((a), (b), sizeof(struct in6_addr)) == 0)
+#endif
+
+/*
+ * Unspecified
+ */
+#define IN6_IS_ADDR_UNSPECIFIED(a) \
+ ((*(u_int32_t *)(&(a)->s6_addr[0]) == 0) && \
+ (*(u_int32_t *)(&(a)->s6_addr[4]) == 0) && \
+ (*(u_int32_t *)(&(a)->s6_addr[8]) == 0) && \
+ (*(u_int32_t *)(&(a)->s6_addr[12]) == 0))
+
+/*
+ * Loopback
+ */
+#define IN6_IS_ADDR_LOOPBACK(a) \
+ ((*(u_int32_t *)(&(a)->s6_addr[0]) == 0) && \
+ (*(u_int32_t *)(&(a)->s6_addr[4]) == 0) && \
+ (*(u_int32_t *)(&(a)->s6_addr[8]) == 0) && \
+ (*(u_int32_t *)(&(a)->s6_addr[12]) == ntohl(1)))
+
+/*
+ * IPv4 compatible
+ */
+#define IN6_IS_ADDR_V4COMPAT(a) \
+ ((*(u_int32_t *)(&(a)->s6_addr[0]) == 0) && \
+ (*(u_int32_t *)(&(a)->s6_addr[4]) == 0) && \
+ (*(u_int32_t *)(&(a)->s6_addr[8]) == 0) && \
+ (*(u_int32_t *)(&(a)->s6_addr[12]) != 0) && \
+ (*(u_int32_t *)(&(a)->s6_addr[12]) != ntohl(1)))
+
+/*
+ * Mapped
+ */
+#define IN6_IS_ADDR_V4MAPPED(a) \
+ ((*(u_int32_t *)(&(a)->s6_addr[0]) == 0) && \
+ (*(u_int32_t *)(&(a)->s6_addr[4]) == 0) && \
+ (*(u_int32_t *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff)))
+
+/*
+ * KAME Scope Values
+ */
+
+#ifdef _KERNEL /*XXX nonstandard*/
+#define IPV6_ADDR_SCOPE_NODELOCAL 0x01
+#define IPV6_ADDR_SCOPE_LINKLOCAL 0x02
+#define IPV6_ADDR_SCOPE_SITELOCAL 0x05
+#define IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */
+#define IPV6_ADDR_SCOPE_GLOBAL 0x0e
+#else
+#define __IPV6_ADDR_SCOPE_NODELOCAL 0x01
+#define __IPV6_ADDR_SCOPE_LINKLOCAL 0x02
+#define __IPV6_ADDR_SCOPE_SITELOCAL 0x05
+#define __IPV6_ADDR_SCOPE_ORGLOCAL 0x08 /* just used in this file */
+#define __IPV6_ADDR_SCOPE_GLOBAL 0x0e
+#endif
+
+/*
+ * Unicast Scope
+ * Note that we must check topmost 10 bits only, not 16 bits (see RFC2373).
+ */
+#define IN6_IS_ADDR_LINKLOCAL(a) \
+ (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0x80))
+#define IN6_IS_ADDR_SITELOCAL(a) \
+ (((a)->s6_addr[0] == 0xfe) && (((a)->s6_addr[1] & 0xc0) == 0xc0))
+
+/*
+ * Multicast
+ */
+#define IN6_IS_ADDR_MULTICAST(a) ((a)->s6_addr[0] == 0xff)
+
+#ifdef _KERNEL /*XXX nonstandard*/
+#define IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f)
+#else
+#define __IPV6_ADDR_MC_SCOPE(a) ((a)->s6_addr[1] & 0x0f)
+#endif
+
+/*
+ * Multicast Scope
+ */
+#ifdef _KERNEL /*refers nonstandard items */
+#define IN6_IS_ADDR_MC_NODELOCAL(a) \
+ (IN6_IS_ADDR_MULTICAST(a) && \
+ (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_NODELOCAL))
+#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
+ (IN6_IS_ADDR_MULTICAST(a) && \
+ (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_LINKLOCAL))
+#define IN6_IS_ADDR_MC_SITELOCAL(a) \
+ (IN6_IS_ADDR_MULTICAST(a) && \
+ (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_SITELOCAL))
+#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
+ (IN6_IS_ADDR_MULTICAST(a) && \
+ (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_ORGLOCAL))
+#define IN6_IS_ADDR_MC_GLOBAL(a) \
+ (IN6_IS_ADDR_MULTICAST(a) && \
+ (IPV6_ADDR_MC_SCOPE(a) == IPV6_ADDR_SCOPE_GLOBAL))
+#else
+#define IN6_IS_ADDR_MC_NODELOCAL(a) \
+ (IN6_IS_ADDR_MULTICAST(a) && \
+ (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_NODELOCAL))
+#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
+ (IN6_IS_ADDR_MULTICAST(a) && \
+ (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_LINKLOCAL))
+#define IN6_IS_ADDR_MC_SITELOCAL(a) \
+ (IN6_IS_ADDR_MULTICAST(a) && \
+ (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_SITELOCAL))
+#define IN6_IS_ADDR_MC_ORGLOCAL(a) \
+ (IN6_IS_ADDR_MULTICAST(a) && \
+ (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_ORGLOCAL))
+#define IN6_IS_ADDR_MC_GLOBAL(a) \
+ (IN6_IS_ADDR_MULTICAST(a) && \
+ (__IPV6_ADDR_MC_SCOPE(a) == __IPV6_ADDR_SCOPE_GLOBAL))
+#endif
+
+/*
+ * Wildcard Socket
+ */
+#if 0 /*pre-RFC2553*/
+#define IN6_IS_ADDR_ANY(a) IN6_IS_ADDR_UNSPECIFIED(a)
+#endif
+
+/*
+ * KAME Scope
+ */
+#ifdef _KERNEL /*nonstandard*/
+#define IN6_IS_SCOPE_LINKLOCAL(a) \
+ ((IN6_IS_ADDR_LINKLOCAL(a)) || \
+ (IN6_IS_ADDR_MC_LINKLOCAL(a)))
+#endif
+
+/*
+ * IP6 route structure
+ */
+#if !defined(_XOPEN_SOURCE)
+struct route_in6 {
+ struct rtentry *ro_rt;
+ struct sockaddr_in6 ro_dst;
+};
+#endif
+
+/*
+ * Options for use with [gs]etsockopt at the IPV6 level.
+ * First word of comment is data type; bool is stored in int.
+ */
+#define IPV6_OPTIONS 1 /* buf/ip6_opts; set/get IP6 options */
+/* no hdrincl */
+#define IPV6_SOCKOPT_RESERVED1 3 /* reserved for future use */
+#define IPV6_UNICAST_HOPS 4 /* int; IP6 hops */
+#define IPV6_RECVOPTS 5 /* bool; receive all IP6 opts w/dgram */
+#define IPV6_RECVRETOPTS 6 /* bool; receive IP6 opts for response */
+#define IPV6_RECVDSTADDR 7 /* bool; receive IP6 dst addr w/dgram */
+#define IPV6_RETOPTS 8 /* ip6_opts; set/get IP6 options */
+#define IPV6_MULTICAST_IF 9 /* u_char; set/get IP6 multicast i/f */
+#define IPV6_MULTICAST_HOPS 10 /* u_char; set/get IP6 multicast hops */
+#define IPV6_MULTICAST_LOOP 11 /* u_char; set/get IP6 multicast loopback */
+#define IPV6_JOIN_GROUP 12 /* ip6_mreq; join a group membership */
+#define IPV6_LEAVE_GROUP 13 /* ip6_mreq; leave a group membership */
+#define IPV6_PORTRANGE 14 /* int; range to choose for unspec port */
+#define ICMP6_FILTER 18 /* icmp6_filter; icmp6 filter */
+#define IPV6_PKTINFO 19 /* bool; send/rcv if, src/dst addr */
+#define IPV6_HOPLIMIT 20 /* bool; hop limit */
+#define IPV6_NEXTHOP 21 /* bool; next hop addr */
+#define IPV6_HOPOPTS 22 /* bool; hop-by-hop option */
+#define IPV6_DSTOPTS 23 /* bool; destination option */
+#define IPV6_RTHDR 24 /* bool; routing header */
+#define IPV6_PKTOPTIONS 25 /* buf/cmsghdr; set/get IPv6 options */
+#define IPV6_CHECKSUM 26 /* int; checksum offset for raw socket */
+#define IPV6_BINDV6ONLY 27 /* bool; only bind INET6 at null bind */
+
+#if 1 /*IPSEC*/
+#define IPV6_IPSEC_POLICY 28 /* struct; get/set security policy */
+#endif
+#define IPV6_FAITH 29 /* bool; accept FAITH'ed connections */
+
+#if 1 /*IPV6FIREWALL*/
+#define IPV6_FW_ADD 30 /* add a firewall rule to chain */
+#define IPV6_FW_DEL 31 /* delete a firewall rule from chain */
+#define IPV6_FW_FLUSH 32 /* flush firewall rule chain */
+#define IPV6_FW_ZERO 33 /* clear single/all firewall counter(s) */
+#define IPV6_FW_GET 34 /* get entire firewall rule chain */
+#endif
+
+#define IPV6_RTHDR_LOOSE 0 /* this hop need not be a neighbor. XXX old spec */
+#define IPV6_RTHDR_STRICT 1 /* this hop must be a neighbor. XXX old spec */
+#define IPV6_RTHDR_TYPE_0 0 /* IPv6 routing header type 0 */
+
+/*
+ * Defaults and limits for options
+ */
+#define IPV6_DEFAULT_MULTICAST_HOPS 1 /* normally limit m'casts to 1 hop */
+#define IPV6_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */
+
+/*
+ * Argument structure for IPV6_JOIN_GROUP and IPV6_LEAVE_GROUP.
+ */
+struct ipv6_mreq {
+ struct in6_addr ipv6mr_multiaddr;
+ u_int ipv6mr_interface;
+};
+
+/*
+ * IPV6_PKTINFO: Packet information(RFC2292 sec 5)
+ */
+struct in6_pktinfo {
+ struct in6_addr ipi6_addr; /* src/dst IPv6 address */
+ u_int ipi6_ifindex; /* send/recv interface index */
+};
+
+/*
+ * Argument for IPV6_PORTRANGE:
+ * - which range to search when port is unspecified at bind() or connect()
+ */
+#define IPV6_PORTRANGE_DEFAULT 0 /* default range */
+#define IPV6_PORTRANGE_HIGH 1 /* "high" - request firewall bypass */
+#define IPV6_PORTRANGE_LOW 2 /* "low" - vouchsafe security */
+
+#if !defined(_XOPEN_SOURCE)
+/*
+ * Definitions for inet6 sysctl operations.
+ *
+ * Third level is protocol number.
+ * Fourth level is desired variable within that protocol.
+ */
+#define IPV6PROTO_MAXID (IPPROTO_PIM + 1) /* don't list to IPV6PROTO_MAX */
+
+#define CTL_IPV6PROTO_NAMES { \
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+ { 0, 0 }, \
+ { "tcp6", CTLTYPE_NODE }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { "udp6", CTLTYPE_NODE }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+ { 0, 0 }, \
+ { "ip6", CTLTYPE_NODE }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+ { 0, 0 }, \
+ { "ipsec6", CTLTYPE_NODE }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { "icmp6", CTLTYPE_NODE }, \
+ { 0, 0 }, \
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+ { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { "pim6", CTLTYPE_NODE }, \
+}
+
+/*
+ * Names for IP sysctl objects
+ */
+#define IPV6CTL_FORWARDING 1 /* act as router */
+#define IPV6CTL_SENDREDIRECTS 2 /* may send redirects when forwarding*/
+#define IPV6CTL_DEFHLIM 3 /* default Hop-Limit */
+#ifdef notyet
+#define IPV6CTL_DEFMTU 4 /* default MTU */
+#endif
+#define IPV6CTL_FORWSRCRT 5 /* forward source-routed dgrams */
+#define IPV6CTL_STATS 6 /* stats */
+#define IPV6CTL_MRTSTATS 7 /* multicast forwarding stats */
+#define IPV6CTL_MRTPROTO 8 /* multicast routing protocol */
+#define IPV6CTL_MAXFRAGPACKETS 9 /* max packets reassembly queue */
+#define IPV6CTL_SOURCECHECK 10 /* verify source route and intf */
+#define IPV6CTL_SOURCECHECK_LOGINT 11 /* minimume logging interval */
+#define IPV6CTL_ACCEPT_RTADV 12
+#define IPV6CTL_KEEPFAITH 13
+#define IPV6CTL_LOG_INTERVAL 14
+#define IPV6CTL_HDRNESTLIMIT 15
+#define IPV6CTL_DAD_COUNT 16
+#define IPV6CTL_AUTO_FLOWLABEL 17
+#define IPV6CTL_DEFMCASTHLIM 18
+#define IPV6CTL_GIF_HLIM 19 /* default HLIM for gif encap packet */
+#define IPV6CTL_KAME_VERSION 20
+#define IPV6CTL_USE_DEPRECATED 21 /* use deprecated addr (RFC2462 5.5.4) */
+#define IPV6CTL_RR_PRUNE 22 /* walk timer for router renumbering */
+#ifdef MAPPED_ADDR_ENABLED
+#define IPV6CTL_MAPPED_ADDR 23
+#endif /* MAPPED_ADDR_ENABLED */
+/* New entries should be added here from current IPV6CTL_MAXID value. */
+#define IPV6CTL_MAXID 24
+
+#ifdef MAPPED_ADDR_ENABLED
+#define IPV6CTL_NAMES_MAPPED_ADDR "mapped_addr"
+#define IPV6CTL_TYPE_MAPPED_ADDR CTLTYPE_INT
+#define IPV6CTL_VARS_MAPPED_ADDR &ip6_mapped_addr_on
+#else /* MAPPED_ADDR_ENABLED */
+#define IPV6CTL_NAMES_MAPPED_ADDR 0
+#define IPV6CTL_TYPE_MAPPED_ADDR 0
+#define IPV6CTL_VARS_MAPPED_ADDR 0
+#endif /* MAPPED_ADDR_ENABLED */
+
+#define IPV6CTL_NAMES { \
+ { 0, 0 }, \
+ { "forwarding", CTLTYPE_INT }, \
+ { "redirect", CTLTYPE_INT }, \
+ { "hlim", CTLTYPE_INT }, \
+ { "mtu", CTLTYPE_INT }, \
+ { "forwsrcrt", CTLTYPE_INT }, \
+ { 0, 0 }, \
+ { 0, 0 }, \
+ { "mrtproto", CTLTYPE_INT }, \
+ { "maxfragpackets", CTLTYPE_INT }, \
+ { "sourcecheck", CTLTYPE_INT }, \
+ { "sourcecheck_logint", CTLTYPE_INT }, \
+ { "accept_rtadv", CTLTYPE_INT }, \
+ { "keepfaith", CTLTYPE_INT }, \
+ { "log_interval", CTLTYPE_INT }, \
+ { "hdrnestlimit", CTLTYPE_INT }, \
+ { "dad_count", CTLTYPE_INT }, \
+ { "auto_flowlabel", CTLTYPE_INT }, \
+ { "defmcasthlim", CTLTYPE_INT }, \
+ { "gifhlim", CTLTYPE_INT }, \
+ { "kame_version", CTLTYPE_STRING }, \
+ { "use_deprecated", CTLTYPE_INT }, \
+ { "rr_prune", CTLTYPE_INT }, \
+ { IPV6CTL_NAMES_MAPPED_ADDR, IPV6CTL_TYPE_MAPPED_ADDR }, \
+}
+
+#define IPV6CTL_VARS { \
+ 0, \
+ &ip6_forwarding, \
+ &ip6_sendredirects, \
+ &ip6_defhlim, \
+ 0, \
+ &ip6_forward_srcrt, \
+ 0, \
+ 0, \
+ 0, \
+ &ip6_maxfragpackets, \
+ &ip6_sourcecheck, \
+ &ip6_sourcecheck_interval, \
+ &ip6_accept_rtadv, \
+ &ip6_keepfaith, \
+ &ip6_log_interval, \
+ &ip6_hdrnestlimit, \
+ &ip6_dad_count, \
+ &ip6_auto_flowlabel, \
+ &ip6_defmcasthlim, \
+ &ip6_gif_hlim, \
+ 0, \
+ &ip6_use_deprecated, \
+ &ip6_rr_prune, \
+ IPV6CTL_VARS_MAPPED_ADDR, \
+}
+#endif /* !_XOPEN_SOURCE */
+
+#ifdef _KERNEL
+struct cmsghdr;
+struct mbuf;
+struct ifnet;
+
+int in6_canforward __P((struct in6_addr *, struct in6_addr *));
+int in6_cksum __P((struct mbuf *, u_int8_t, u_int32_t, u_int32_t));
+int in6_localaddr __P((struct in6_addr *));
+int in6_addrscope __P((struct in6_addr *));
+struct in6_ifaddr *in6_ifawithscope __P((struct ifnet *, struct in6_addr *));
+struct in6_ifaddr *in6_ifawithifp __P((struct ifnet *, struct in6_addr *));
+extern void in6_if_up __P((struct ifnet *));
+#ifdef MAPPED_ADDR_ENABLED
+struct sockaddr;
+
+void in6_sin6_2_sin __P((struct sockaddr_in *sin,
+ struct sockaddr_in6 *sin6));
+void in6_sin_2_v4mapsin6 __P((struct sockaddr_in *sin,
+ struct sockaddr_in6 *sin6));
+void in6_sin6_2_sin_in_sock __P((struct sockaddr *nam));
+void in6_sin_2_v4mapsin6_in_sock __P((struct sockaddr **nam));
+#endif /* MAPPED_ADDR_ENABLED */
+
+#define satosin6(sa) ((struct sockaddr_in6 *)(sa))
+#define sin6tosa(sin6) ((struct sockaddr *)(sin6))
+#define ifatoia6(ifa) ((struct in6_ifaddr *)(ifa))
+#endif /* _KERNEL */
+
+__BEGIN_DECLS
+struct cmsghdr;
+
+extern int inet6_option_space(int);
+extern int inet6_option_init(void *, struct cmsghdr **, int);
+extern int inet6_option_append(struct cmsghdr *, const u_int8_t *, int, int);
+extern u_int8_t *inet6_option_alloc(struct cmsghdr *, int, int, int);
+extern int inet6_option_next(const struct cmsghdr *, u_int8_t **);
+extern int inet6_option_find(const struct cmsghdr *, u_int8_t **, int);
+
+extern size_t inet6_rthdr_space __P((int, int));
+extern struct cmsghdr *inet6_rthdr_init __P((void *, int));
+extern int inet6_rthdr_add __P((struct cmsghdr *, const struct in6_addr *,
+ unsigned int));
+extern int inet6_rthdr_lasthop __P((struct cmsghdr *, unsigned int));
+#if 0 /* not implemented yet */
+extern int inet6_rthdr_reverse __P((const struct cmsghdr *, struct cmsghdr *));
+#endif
+extern int inet6_rthdr_segments __P((const struct cmsghdr *));
+extern struct in6_addr *inet6_rthdr_getaddr __P((struct cmsghdr *, int));
+extern int inet6_rthdr_getflags __P((const struct cmsghdr *, int));
+__END_DECLS
+
+#endif /* !_NETINET6_IN6_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/in6_gif.h b/ecos/packages/net/tcpip/current/include/netinet6/in6_gif.h
new file mode 100644
index 0000000..ff3caf9
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/in6_gif.h
@@ -0,0 +1,69 @@
+//==========================================================================
+//
+// include/netinet6_in6_gif.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: in6_gif.h,v 1.1 1999/12/08 06:50:21 itojun Exp $ */
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+
+#ifndef _NETINET6_IN6_GIF_H_
+#define _NETINET6_IN6_GIF_H_
+
+#define GIF_HLIM 30
+
+int in6_gif_input __P((struct mbuf **, int *, int));
+int in6_gif_output __P((struct ifnet *, int, struct mbuf *, struct rtentry *));
+
+#endif /*_NETINET6_IN6_GIF_H_*/
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/in6_ifattach.h b/ecos/packages/net/tcpip/current/include/netinet6/in6_ifattach.h
new file mode 100644
index 0000000..45d96a1
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/in6_ifattach.h
@@ -0,0 +1,79 @@
+//==========================================================================
+//
+// include/netinet6_in6_ifattach.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: in6_ifattach.h,v 1.1 1999/12/08 06:50:21 itojun Exp $ */
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+
+#ifndef _NETINET6_IN6_IFATTACH_H_
+#define _NETINET6_IN6_IFATTACH_H_
+
+#ifdef _KERNEL
+extern int found_first_ifid;
+
+int in6_ifattach_getifid __P((struct ifnet *));
+void in6_ifattach_p2p __P((void));
+void in6_ifattach __P((struct ifnet *, u_int, caddr_t, int));
+void in6_ifdetach __P((struct ifnet *));
+#endif /* _KERNEL */
+
+#define IN6_IFT_LOOP 1
+#define IN6_IFT_P2P 2
+#define IN6_IFT_802 3
+#define IN6_IFT_P2P802 4
+#define IN6_IFT_ARCNET 5
+
+#endif /* _NETINET6_IN6_IFATTACH_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/in6_pcb.h b/ecos/packages/net/tcpip/current/include/netinet6/in6_pcb.h
new file mode 100644
index 0000000..29cca2e
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/in6_pcb.h
@@ -0,0 +1,207 @@
+//==========================================================================
+//
+// include/netinet6_in6_pcb.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: in6_pcb.h,v 1.1 1999/12/08 06:50:21 itojun Exp $ */
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1990, 1993
+ * 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.
+ *
+ * @(#)in_pcb.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET6_IN6_PCB_H_
+#define _NETINET6_IN6_PCB_H_
+
+#include <sys/queue.h>
+
+/*
+ * Common structure pcb for internet protocol implementation.
+ * Here are stored pointers to local and foreign host table
+ * entries, local and foreign socket numbers, and pointers
+ * up (to a socket structure) and down (to a protocol-specific)
+ * control block.
+ */
+struct icmp6_filter;
+struct inpcbpolicy;
+
+struct in6pcb {
+ struct in6pcb *in6p_next, *in6p_prev;
+ /* pointers to other pcb's */
+ struct in6pcb *in6p_head; /* pointer back to chain of
+ in6pcb's for this protocol */
+ struct in6_addr in6p_faddr; /* foreign host table entry */
+ u_short in6p_fport; /* foreign port */
+ struct in6_addr in6p_laddr; /* local host table entry */
+ u_short in6p_lport; /* local port */
+ u_int32_t in6p_flowinfo; /* priority and flowlabel */
+ struct socket *in6p_socket; /* back pointer to socket */
+ caddr_t in6p_ppcb; /* pointer to per-protocol pcb */
+ struct route_in6 in6p_route; /* placeholder for routing entry */
+ int in6p_flags; /* generic IP6/datagram flags */
+ int in6p_hops; /* default hop limit */
+ struct ip6_hdr in6p_ip6; /* header prototype */
+ struct mbuf *in6p_options; /* IP6 options */
+ struct ip6_pktopts *in6p_outputopts; /* IP6 options for outgoing packets */
+ struct ip6_moptions *in6p_moptions; /* IP6 multicast options */
+ u_short in6p_ifindex;
+ /* should move the following just after next/prev */
+ LIST_ENTRY(in6pcb) in6p_hlist; /* hash chain */
+ u_long in6p_hash; /* hash value */
+#if 1 /*IPSEC*/
+ struct inpcbpolicy *in6p_sp; /* security policy. */
+#endif
+ struct icmp6_filter *in6p_icmp6filt;
+ int in6p_cksum; /* IPV6_CHECKSUM setsockopt */
+};
+
+#define in6p_ip6_nxt in6p_ip6.ip6_nxt /* for KAME src sync over BSD*'s */
+
+/* flags in in6p_flags */
+#define IN6P_RECVOPTS 0x01 /* receive incoming IP6 options */
+#define IN6P_RECVRETOPTS 0x02 /* receive IP6 options for reply */
+#define IN6P_RECVDSTADDR 0x04 /* receive IP6 dst address */
+#define IN6P_HIGHPORT 0x10 /* user wants "high" port binding */
+#define IN6P_LOWPORT 0x20 /* user wants "low" port binding */
+#define IN6P_ANONPORT 0x40 /* port chosen for user */
+#define IN6P_FAITH 0x80 /* accept FAITH'ed connections */
+#define IN6P_PKTINFO 0x010000
+#define IN6P_HOPLIMIT 0x020000
+#define IN6P_NEXTHOP 0x040000
+#define IN6P_HOPOPTS 0x080000
+#define IN6P_DSTOPTS 0x100000
+#define IN6P_RTHDR 0x200000
+#define IN6P_CONTROLOPTS (0x3f0000 | IN6P_RECVOPTS | IN6P_RECVRETOPTS | IN6P_RECVDSTADDR)
+
+#define IN6PLOOKUP_WILDCARD 1
+#define IN6PLOOKUP_SETLOCAL 2
+
+/* compute hash value for foreign and local in6_addr and port */
+#define IN6_HASH(faddr, fport, laddr, lport) \
+ (((faddr)->s6_addr32[0] ^ (faddr)->s6_addr32[1] ^ \
+ (faddr)->s6_addr32[2] ^ (faddr)->s6_addr32[3] ^ \
+ (laddr)->s6_addr32[0] ^ (laddr)->s6_addr32[1] ^ \
+ (laddr)->s6_addr32[2] ^ (laddr)->s6_addr32[3]) \
+ + (fport) + (lport))
+
+#define sotoin6pcb(so) ((struct in6pcb *)(so)->so_pcb)
+
+#ifdef _KERNEL
+void in6_losing __P((struct in6pcb *));
+int in6_pcballoc __P((struct socket *, struct in6pcb *));
+int in6_pcbbind __P((struct in6pcb *, struct mbuf *));
+int in6_pcbconnect __P((struct in6pcb *, struct mbuf *));
+void in6_pcbdetach __P((struct in6pcb *));
+void in6_pcbdisconnect __P((struct in6pcb *));
+struct in6pcb *
+ in6_pcblookup __P((struct in6pcb *,
+ struct in6_addr *, u_int, struct in6_addr *,
+ u_int, int));
+int in6_pcbnotify __P((struct in6pcb *, struct sockaddr *,
+ u_int, struct in6_addr *, u_int, int,
+ void (*)(struct in6pcb *, int)));
+int in6_pcbsetport __P((struct in6_addr *, struct in6pcb *));
+void in6_rtchange __P((struct in6pcb *, int));
+void in6_setpeeraddr __P((struct in6pcb *, struct mbuf *));
+void in6_setsockaddr __P((struct in6pcb *, struct mbuf *));
+struct in6_addr *in6_selectsrc __P((struct sockaddr_in6 *,
+ struct ip6_pktopts *,
+ struct ip6_moptions *,
+ struct route_in6 *,
+ struct in6_addr *, int *));
+int in6_selecthlim __P((struct in6pcb *, struct ifnet *));
+
+#ifndef TCP6
+extern struct rtentry *
+ in6_pcbrtentry __P((struct in6pcb *));
+extern struct in6pcb *in6_pcblookup_connect __P((struct in6pcb *,
+ struct in6_addr *, u_int, struct in6_addr *, u_int, int));
+extern struct in6pcb *in6_pcblookup_bind __P((struct in6pcb *,
+ struct in6_addr *, u_int, int));
+#endif
+#endif /* _KERNEL */
+
+#endif /* !_NETINET6_IN6_PCB_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/in6_prefix.h b/ecos/packages/net/tcpip/current/include/netinet6/in6_prefix.h
new file mode 100644
index 0000000..1b3781a
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/in6_prefix.h
@@ -0,0 +1,121 @@
+//==========================================================================
+//
+// include/netinet6_in6_prefix.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: in6_prefix.h,v 1.1 1999/12/08 06:50:21 itojun Exp $ */
+
+/*
+ * Copyright (C) 1995, 1996, 1997, 1998 and 1999 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+
+#ifndef _NETINET6_IN6_PREFIX_H_
+#define _NETINET6_IN6_PREFIX_H_
+
+struct rr_prefix {
+ struct ifprefix rp_ifpr;
+ LIST_ENTRY(rr_prefix) rp_entry;
+ LIST_HEAD(rp_addrhead, rp_addr) rp_addrhead;
+ struct sockaddr_in6 rp_prefix; /* prefix */
+ u_int32_t rp_vltime; /* advertised valid lifetime */
+ u_int32_t rp_pltime; /* advertised preferred lifetime */
+ time_t rp_expire; /* expiration time of the prefix */
+ time_t rp_preferred; /* preferred time of the prefix */
+ struct in6_prflags rp_flags;
+ u_char rp_origin; /* from where this prefix info is obtained */
+ struct rp_stateflags {
+ /* if some prefix should be added to this prefix */
+ u_char addmark : 1;
+ u_char delmark : 1; /* if this prefix will be deleted */
+ } rp_stateflags;
+};
+
+#define rp_type rp_ifpr.ifpr_type
+#define rp_ifp rp_ifpr.ifpr_ifp
+#define rp_plen rp_ifpr.ifpr_plen
+
+#define rp_raf rp_flags.prf_ra
+#define rp_raf_onlink rp_flags.prf_ra.onlink
+#define rp_raf_auto rp_flags.prf_ra.autonomous
+
+#define rp_statef_addmark rp_stateflags.addmark
+#define rp_statef_delmark rp_stateflags.delmark
+
+#define rp_rrf rp_flags.prf_rr
+#define rp_rrf_decrvalid rp_flags.prf_rr.decrvalid
+#define rp_rrf_decrprefd rp_flags.prf_rr.decrprefd
+
+struct rp_addr {
+ LIST_ENTRY(rp_addr) ra_entry;
+ struct in6_addr ra_ifid;
+ struct in6_ifaddr *ra_addr;
+ struct ra_flags {
+ u_char anycast : 1;
+ } ra_flags;
+};
+
+#define ifpr2rp(ifpr) ((struct rr_prefix *)(ifpr))
+#define rp2ifpr(rp) ((struct ifprefix *)(rp))
+
+#define RP_IN6(rp) (&(rp)->rp_prefix.sin6_addr)
+
+#define RR_INFINITE_LIFETIME 0xffffffff
+
+
+LIST_HEAD(rr_prhead, rr_prefix);
+
+extern struct rr_prhead rr_prefix;
+
+void in6_rr_timer __P((void *));
+int delete_each_prefix __P((struct socket *so, struct rr_prefix *rpp,
+ u_char origin));
+#endif // _NETINET6_IN6_PREFIX_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/in6_var.h b/ecos/packages/net/tcpip/current/include/netinet6/in6_var.h
new file mode 100644
index 0000000..5858346
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/in6_var.h
@@ -0,0 +1,593 @@
+//==========================================================================
+//
+// include/netinet6_in6_var.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: in6_var.h,v 1.6 1999/12/10 10:04:28 angelos Exp $ */
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+
+/*
+ * Copyright (c) 1985, 1986, 1993
+ * 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.
+ *
+ * @(#)in_var.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET6_IN6_VAR_H_
+#define _NETINET6_IN6_VAR_H_
+
+/*
+ * Interface address, Internet version. One of these structures
+ * is allocated for each interface with an Internet address.
+ * The ifaddr structure contains the protocol-independent part
+ * of the structure and is assumed to be first.
+ */
+
+/*
+ * pltime/vltime are just for future reference (required to implements 2
+ * hour rule for hosts). they should never be modified by nd6_timeout or
+ * anywhere else.
+ * userland -> kernel: accept pltime/vltime
+ * kernel -> userland: throuw up everything
+ * in kernel: modify preferred/expire only
+ */
+struct in6_addrlifetime {
+ time_t ia6t_expire; /* valid lifetime expiration time */
+ time_t ia6t_preferred; /* preferred lifetime expiration time */
+ u_int32_t ia6t_vltime; /* valid lifetime */
+ u_int32_t ia6t_pltime; /* prefix lifetime */
+};
+
+struct in6_ifaddr {
+ struct ifaddr ia_ifa; /* protocol-independent info */
+#define ia_ifp ia_ifa.ifa_ifp
+#define ia_flags ia_ifa.ifa_flags
+ struct sockaddr_in6 ia_addr; /* interface address */
+ struct sockaddr_in6 ia_net; /* network number of interface */
+ struct sockaddr_in6 ia_dstaddr; /* space for destination addr */
+ struct sockaddr_in6 ia_prefixmask; /* prefix mask */
+ u_int32_t ia_plen; /* prefix length */
+ struct in6_ifaddr *ia_next; /* next in6 list of IP6 addresses */
+ LIST_HEAD(in6_multihead, in6_multi) ia6_multiaddrs;
+ /* list of multicast addresses */
+ int ia6_flags;
+
+ struct in6_addrlifetime ia6_lifetime; /* NULL = infty */
+ struct ifprefix *ia6_ifpr; /* back pointer to ifprefix */
+};
+
+/*
+ * IPv6 interface statistics, as defined in RFC2465 Ipv6IfStatsEntry (p12).
+ */
+struct in6_ifstat {
+ u_quad_t ifs6_in_receive; /* # of total input datagram */
+ u_quad_t ifs6_in_hdrerr; /* # of datagrams with invalid hdr */
+ u_quad_t ifs6_in_toobig; /* # of datagrams exceeded MTU */
+ u_quad_t ifs6_in_noroute; /* # of datagrams with no route */
+ u_quad_t ifs6_in_addrerr; /* # of datagrams with invalid dst */
+ u_quad_t ifs6_in_protounknown; /* # of datagrams with unknown proto */
+ /* NOTE: increment on final dst if */
+ u_quad_t ifs6_in_truncated; /* # of truncated datagrams */
+ u_quad_t ifs6_in_discard; /* # of discarded datagrams */
+ /* NOTE: fragment timeout is not here */
+ u_quad_t ifs6_in_deliver; /* # of datagrams delivered to ULP */
+ /* NOTE: increment on final dst if */
+ u_quad_t ifs6_out_forward; /* # of datagrams forwarded */
+ /* NOTE: increment on outgoing if */
+ u_quad_t ifs6_out_request; /* # of outgoing datagrams from ULP */
+ /* NOTE: does not include forwrads */
+ u_quad_t ifs6_out_discard; /* # of discarded datagrams */
+ u_quad_t ifs6_out_fragok; /* # of datagrams fragmented */
+ u_quad_t ifs6_out_fragfail; /* # of datagrams failed on fragment */
+ u_quad_t ifs6_out_fragcreat; /* # of fragment datagrams */
+ /* NOTE: this is # after fragment */
+ u_quad_t ifs6_reass_reqd; /* # of incoming fragmented packets */
+ /* NOTE: increment on final dst if */
+ u_quad_t ifs6_reass_ok; /* # of reassembled packets */
+ /* NOTE: this is # after reass */
+ /* NOTE: increment on final dst if */
+ u_quad_t ifs6_reass_fail; /* # of reass failures */
+ /* NOTE: may not be packet count */
+ /* NOTE: increment on final dst if */
+ u_quad_t ifs6_in_mcast; /* # of inbound multicast datagrams */
+ u_quad_t ifs6_out_mcast; /* # of outbound multicast datagrams */
+};
+
+/*
+ * ICMPv6 interface statistics, as defined in RFC2466 Ipv6IfIcmpEntry.
+ * XXX: I'm not sure if this file is the right place for this structure...
+ */
+struct icmp6_ifstat {
+ /*
+ * Input statistics
+ */
+ /* ipv6IfIcmpInMsgs, total # of input messages */
+ u_quad_t ifs6_in_msg;
+ /* ipv6IfIcmpInErrors, # of input error messages */
+ u_quad_t ifs6_in_error;
+ /* ipv6IfIcmpInDestUnreachs, # of input dest unreach errors */
+ u_quad_t ifs6_in_dstunreach;
+ /* ipv6IfIcmpInAdminProhibs, # of input administratively prohibited errs */
+ u_quad_t ifs6_in_adminprohib;
+ /* ipv6IfIcmpInTimeExcds, # of input time exceeded errors */
+ u_quad_t ifs6_in_timeexceed;
+ /* ipv6IfIcmpInParmProblems, # of input parameter problem errors */
+ u_quad_t ifs6_in_paramprob;
+ /* ipv6IfIcmpInPktTooBigs, # of input packet too big errors */
+ u_quad_t ifs6_in_pkttoobig;
+ /* ipv6IfIcmpInEchos, # of input echo requests */
+ u_quad_t ifs6_in_echo;
+ /* ipv6IfIcmpInEchoReplies, # of input echo replies */
+ u_quad_t ifs6_in_echoreply;
+ /* ipv6IfIcmpInRouterSolicits, # of input router solicitations */
+ u_quad_t ifs6_in_routersolicit;
+ /* ipv6IfIcmpInRouterAdvertisements, # of input router advertisements */
+ u_quad_t ifs6_in_routeradvert;
+ /* ipv6IfIcmpInNeighborSolicits, # of input neighbor solicitations */
+ u_quad_t ifs6_in_neighborsolicit;
+ /* ipv6IfIcmpInNeighborAdvertisements, # of input neighbor advertisements */
+ u_quad_t ifs6_in_neighboradvert;
+ /* ipv6IfIcmpInRedirects, # of input redirects */
+ u_quad_t ifs6_in_redirect;
+ /* ipv6IfIcmpInGroupMembQueries, # of input MLD queries */
+ u_quad_t ifs6_in_mldquery;
+ /* ipv6IfIcmpInGroupMembResponses, # of input MLD reports */
+ u_quad_t ifs6_in_mldreport;
+ /* ipv6IfIcmpInGroupMembReductions, # of input MLD done */
+ u_quad_t ifs6_in_mlddone;
+
+ /*
+ * Output statistics. We should solve unresolved routing problem...
+ */
+ /* ipv6IfIcmpOutMsgs, total # of output messages */
+ u_quad_t ifs6_out_msg;
+ /* ipv6IfIcmpOutErrors, # of output error messages */
+ u_quad_t ifs6_out_error;
+ /* ipv6IfIcmpOutDestUnreachs, # of output dest unreach errors */
+ u_quad_t ifs6_out_dstunreach;
+ /* ipv6IfIcmpOutAdminProhibs, # of output administratively prohibited errs */
+ u_quad_t ifs6_out_adminprohib;
+ /* ipv6IfIcmpOutTimeExcds, # of output time exceeded errors */
+ u_quad_t ifs6_out_timeexceed;
+ /* ipv6IfIcmpOutParmProblems, # of output parameter problem errors */
+ u_quad_t ifs6_out_paramprob;
+ /* ipv6IfIcmpOutPktTooBigs, # of output packet too big errors */
+ u_quad_t ifs6_out_pkttoobig;
+ /* ipv6IfIcmpOutEchos, # of output echo requests */
+ u_quad_t ifs6_out_echo;
+ /* ipv6IfIcmpOutEchoReplies, # of output echo replies */
+ u_quad_t ifs6_out_echoreply;
+ /* ipv6IfIcmpOutRouterSolicits, # of output router solicitations */
+ u_quad_t ifs6_out_routersolicit;
+ /* ipv6IfIcmpOutRouterAdvertisements, # of output router advertisements */
+ u_quad_t ifs6_out_routeradvert;
+ /* ipv6IfIcmpOutNeighborSolicits, # of output neighbor solicitations */
+ u_quad_t ifs6_out_neighborsolicit;
+ /* ipv6IfIcmpOutNeighborAdvertisements, # of output neighbor advertisements */
+ u_quad_t ifs6_out_neighboradvert;
+ /* ipv6IfIcmpOutRedirects, # of output redirects */
+ u_quad_t ifs6_out_redirect;
+ /* ipv6IfIcmpOutGroupMembQueries, # of output MLD queries */
+ u_quad_t ifs6_out_mldquery;
+ /* ipv6IfIcmpOutGroupMembResponses, # of output MLD reports */
+ u_quad_t ifs6_out_mldreport;
+ /* ipv6IfIcmpOutGroupMembReductions, # of output MLD done */
+ u_quad_t ifs6_out_mlddone;
+};
+
+struct in6_ifreq {
+ char ifr_name[IFNAMSIZ];
+ union {
+ struct sockaddr_in6 ifru_addr;
+ struct sockaddr_in6 ifru_dstaddr;
+ short ifru_flags;
+ int ifru_flags6;
+ int ifru_metric;
+ caddr_t ifru_data;
+ struct in6_addrlifetime ifru_lifetime;
+ struct in6_ifstat ifru_stat;
+ struct icmp6_ifstat ifru_icmp6stat;
+ } ifr_ifru;
+};
+
+struct in6_aliasreq {
+ char ifra_name[IFNAMSIZ];
+ struct sockaddr_in6 ifra_addr;
+ struct sockaddr_in6 ifra_dstaddr;
+ struct sockaddr_in6 ifra_prefixmask;
+ int ifra_flags;
+ struct in6_addrlifetime ifra_lifetime;
+};
+
+/* prefix type macro */
+#define IN6_PREFIX_ND 1
+#define IN6_PREFIX_RR 2
+
+/*
+ * prefix related flags passed between kernel(NDP related part) and
+ * user land command(ifconfig) and daemon(rtadvd).
+ */
+struct in6_prflags {
+ struct prf_ra {
+ u_char onlink : 1;
+ u_char autonomous : 1;
+ u_char reserved : 6;
+ } prf_ra;
+ u_char prf_reserved1;
+ u_short prf_reserved2;
+ /* want to put this on 4byte offset */
+ struct prf_rr {
+ u_char decrvalid : 1;
+ u_char decrprefd : 1;
+ u_char reserved : 6;
+ } prf_rr;
+ u_char prf_reserved3;
+ u_short prf_reserved4;
+};
+
+struct in6_prefixreq {
+ char ipr_name[IFNAMSIZ];
+ u_char ipr_origin;
+ u_char ipr_plen;
+ u_int32_t ipr_vltime;
+ u_int32_t ipr_pltime;
+ struct in6_prflags ipr_flags;
+ struct sockaddr_in6 ipr_prefix;
+};
+
+#define PR_ORIG_RA 0
+#define PR_ORIG_RR 1
+#define PR_ORIG_STATIC 2
+#define PR_ORIG_KERNEL 3
+
+#define ipr_raf_onlink ipr_flags.prf_ra.onlink
+#define ipr_raf_auto ipr_flags.prf_ra.autonomous
+
+#define ipr_statef_onlink ipr_flags.prf_state.onlink
+
+#define ipr_rrf_decrvalid ipr_flags.prf_rr.decrvalid
+#define ipr_rrf_decrprefd ipr_flags.prf_rr.decrprefd
+
+struct in6_rrenumreq {
+ char irr_name[IFNAMSIZ];
+ u_char irr_origin;
+ u_char irr_m_len; /* match len for matchprefix */
+ u_char irr_m_minlen; /* minlen for matching prefix */
+ u_char irr_m_maxlen; /* maxlen for matching prefix */
+ u_char irr_u_uselen; /* uselen for adding prefix */
+ u_char irr_u_keeplen; /* keeplen from matching prefix */
+ struct irr_raflagmask {
+ u_char onlink : 1;
+ u_char autonomous : 1;
+ u_char reserved : 6;
+ } irr_raflagmask;
+ u_int32_t irr_vltime;
+ u_int32_t irr_pltime;
+ struct in6_prflags irr_flags;
+ struct sockaddr_in6 irr_matchprefix;
+ struct sockaddr_in6 irr_useprefix;
+};
+
+#define irr_raf_mask_onlink irr_raflagmask.onlink
+#define irr_raf_mask_auto irr_raflagmask.autonomous
+#define irr_raf_mask_reserved irr_raflagmask.reserved
+
+#define irr_raf_onlink irr_flags.prf_ra.onlink
+#define irr_raf_auto irr_flags.prf_ra.autonomous
+
+#define irr_statef_onlink irr_flags.prf_state.onlink
+
+#define irr_rrf irr_flags.prf_rr
+#define irr_rrf_decrvalid irr_flags.prf_rr.decrvalid
+#define irr_rrf_decrprefd irr_flags.prf_rr.decrprefd
+
+/*
+ * Given a pointer to an in6_ifaddr (ifaddr),
+ * return a pointer to the addr as a sockaddr_in6
+ */
+#define IA6_IN6(ia) (&((ia)->ia_addr.sin6_addr))
+#define IA6_DSTIN6(ia) (&((ia)->ia_dstaddr.sin6_addr))
+#define IA6_MASKIN6(ia) (&((ia)->ia_prefixmask.sin6_addr))
+#define IA6_SIN6(ia) (&((ia)->ia_addr))
+#define IA6_DSTSIN6(ia) (&((ia)->ia_dstaddr))
+#define IFA_IN6(x) (&((struct sockaddr_in6 *)((x)->ifa_addr))->sin6_addr)
+#define IFA_DSTIN6(x) (&((struct sockaddr_in6 *)((x)->ifa_dstaddr))->sin6_addr)
+
+#define IFPR_IN6(x) (&((struct sockaddr_in6 *)((x)->ifpr_prefix))->sin6_addr)
+
+#ifdef _KERNEL
+#define IN6_ARE_MASKED_ADDR_EQUAL(d, a, m) ( \
+ (((d)->s6_addr32[0] ^ (a)->s6_addr32[0]) & (m)->s6_addr32[0]) == 0 && \
+ (((d)->s6_addr32[1] ^ (a)->s6_addr32[1]) & (m)->s6_addr32[1]) == 0 && \
+ (((d)->s6_addr32[2] ^ (a)->s6_addr32[2]) & (m)->s6_addr32[2]) == 0 && \
+ (((d)->s6_addr32[3] ^ (a)->s6_addr32[3]) & (m)->s6_addr32[3]) == 0 )
+#endif
+
+#define SIOCSIFADDR_IN6 _IOW('i', 12, struct in6_ifreq)
+#define SIOCGIFADDR_IN6 _IOWR('i', 33, struct in6_ifreq)
+#define SIOCSIFDSTADDR_IN6 _IOW('i', 14, struct in6_ifreq)
+#define SIOCGIFDSTADDR_IN6 _IOWR('i', 34, struct in6_ifreq)
+#define SIOCSIFNETMASK_IN6 _IOW('i', 22, struct in6_ifreq)
+#define SIOCGIFNETMASK_IN6 _IOWR('i', 37, struct in6_ifreq)
+
+#define SIOCDIFADDR_IN6 _IOW('i', 25, struct in6_ifreq)
+#define SIOCAIFADDR_IN6 _IOW('i', 26, struct in6_aliasreq)
+
+#define SIOCSIFPHYADDR_IN6 _IOW('i', 70, struct in6_aliasreq)
+#define SIOCGIFPSRCADDR_IN6 _IOWR('i', 71, struct in6_ifreq)
+#define SIOCGIFPDSTADDR_IN6 _IOWR('i', 72, struct in6_ifreq)
+
+#define SIOCGIFAFLAG_IN6 _IOWR('i', 73, struct in6_ifreq)
+
+#define SIOCGDRLST_IN6 _IOWR('i', 74, struct in6_drlist)
+#define SIOCGPRLST_IN6 _IOWR('i', 75, struct in6_prlist)
+#define SIOCGIFINFO_IN6 _IOWR('i', 76, struct in6_ndireq)
+#define SIOCSNDFLUSH_IN6 _IOWR('i', 77, struct in6_ifreq)
+#define SIOCGNBRINFO_IN6 _IOWR('i', 78, struct in6_nbrinfo)
+#define SIOCSPFXFLUSH_IN6 _IOWR('i', 79, struct in6_ifreq)
+#define SIOCSRTRFLUSH_IN6 _IOWR('i', 80, struct in6_ifreq)
+
+#define SIOCGIFALIFETIME_IN6 _IOWR('i', 81, struct in6_ifreq)
+#define SIOCSIFALIFETIME_IN6 _IOWR('i', 82, struct in6_ifreq)
+#define SIOCGIFSTAT_IN6 _IOWR('i', 83, struct in6_ifreq)
+#define SIOCGIFSTAT_ICMP6 _IOWR('i', 84, struct in6_ifreq)
+
+#define SIOCSIFPREFIX_IN6 _IOW('i', 100, struct in6_prefixreq) /* set */
+#define SIOCGIFPREFIX_IN6 _IOWR('i', 101, struct in6_prefixreq) /* get */
+#define SIOCDIFPREFIX_IN6 _IOW('i', 102, struct in6_prefixreq) /* del */
+#define SIOCAIFPREFIX_IN6 _IOW('i', 103, struct in6_rrenumreq) /* add */
+#define SIOCCIFPREFIX_IN6 _IOW('i', 104, \
+ struct in6_rrenumreq) /* change */
+#define SIOCSGIFPREFIX_IN6 _IOW('i', 105, \
+ struct in6_rrenumreq) /* set global */
+
+#define SIOCGETSGCNT_IN6 _IOWR('u', 106, \
+ struct sioc_sg_req6) /* get s,g pkt cnt */
+#define SIOCGETMIFCNT_IN6 _IOWR('u', 107, \
+ struct sioc_mif_req6) /* get pkt cnt per if */
+
+#define IN6_IFF_ANYCAST 0x01 /* anycast address */
+#define IN6_IFF_TENTATIVE 0x02 /* tentative address */
+#define IN6_IFF_DUPLICATED 0x04 /* DAD detected duplicate */
+#define IN6_IFF_DETACHED 0x08 /* may be detached from the link */
+#define IN6_IFF_DEPRECATED 0x10 /* deprecated address */
+
+/* do not input/output */
+#define IN6_IFF_NOTREADY (IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED)
+
+#ifdef _KERNEL
+extern struct in6_ifaddr *in6_ifaddr;
+
+extern struct in6_ifstat **in6_ifstat;
+extern size_t in6_ifstatmax;
+extern struct icmp6stat icmp6stat;
+extern struct icmp6_ifstat **icmp6_ifstat;
+extern size_t icmp6_ifstatmax;
+#define in6_ifstat_inc(ifp, tag) \
+do { \
+ if ((ifp) && (ifp)->if_index <= if_index \
+ && (ifp)->if_index < in6_ifstatmax \
+ && in6_ifstat && in6_ifstat[(ifp)->if_index]) { \
+ in6_ifstat[(ifp)->if_index]->tag++; \
+ } \
+} while (0)
+
+extern struct ifqueue ip6intrq; /* IP6 packet input queue */
+extern struct in6_addr zeroin6_addr;
+extern u_char inet6ctlerrmap[];
+extern unsigned long in6_maxmtu;
+
+/*
+ * Macro for finding the internet address structure (in6_ifaddr) corresponding
+ * to a given interface (ifnet structure).
+ */
+#define IFP_TO_IA6(ifp, ia) \
+/* struct ifnet *ifp; */ \
+/* struct in6_ifaddr *ia; */ \
+do { \
+ struct ifaddr *ifa; \
+ for (ifa = (ifp)->if_addrlist.tqh_first; ifa; ifa = ifa->ifa_list.tqe_next) { \
+ if (!ifa->ifa_addr) \
+ continue; \
+ if (ifa->ifa_addr->sa_family == AF_INET6) \
+ break; \
+ } \
+ (ia) = (struct in6_ifaddr *)ifa; \
+} while (0)
+#endif /* _KERNEL */
+
+/*
+ * Multi-cast membership entry. One for each group/ifp that a PCB
+ * belongs to.
+ */
+struct in6_multi_mship {
+ struct in6_multi *i6mm_maddr; /* Multicast address pointer */
+ LIST_ENTRY(in6_multi_mship) i6mm_chain; /* multicast options chain */
+};
+
+struct in6_multi {
+ LIST_ENTRY(in6_multi) in6m_entry; /* list glue */
+ struct in6_addr in6m_addr; /* IP6 multicast address */
+ struct ifnet *in6m_ifp; /* back pointer to ifnet */
+ struct in6_ifaddr *in6m_ia; /* back pointer to in6_ifaddr */
+ u_int in6m_refcount; /* # membership claims by sockets */
+ u_int in6m_state; /* state of the membership */
+ u_int in6m_timer; /* MLD6 listener report timer */
+};
+
+#ifdef _KERNEL
+/*
+ * Structure used by macros below to remember position when stepping through
+ * all of eht in6_multi records.
+ */
+struct in6_multistep {
+ struct in6_ifaddr *i_ia;
+ struct in6_multi *i_in6m;
+};
+
+/*
+ * Macros for looking up the in6_multi record for a given IP6 multicast
+ * address on a given interface. If no matching record is found, "in6m"
+ * returns NLL.
+ */
+
+#define IN6_LOOKUP_MULTI(addr, ifp, in6m) \
+/* struct in6_addr addr; */ \
+/* struct ifnet *ifp; */ \
+/* struct in6_multi *in6m; */ \
+do { \
+ register struct in6_ifaddr *ia; \
+ \
+ IFP_TO_IA6((ifp), ia); \
+ if (ia == NULL) \
+ (in6m) = NULL; \
+ else \
+ for ((in6m) = ia->ia6_multiaddrs.lh_first; \
+ (in6m) != NULL && \
+ !IN6_ARE_ADDR_EQUAL(&(in6m)->in6m_addr, &(addr)); \
+ (in6m) = in6m->in6m_entry.le_next) \
+ continue; \
+} while (0)
+
+/*
+ * Macro to step through all of the in6_multi records, one at a time.
+ * The current position is remembered in "step", which the caller must
+ * provide. IN6_FIRST_MULTI(), below, must be called to initialize "step"
+ * and get the first record. Both macros return a NULL "in6m" when there
+ * are no remaining records.
+ */
+#define IN6_NEXT_MULTI(step, in6m) \
+/* struct in6_multistep step; */ \
+/* struct in6_multi *in6m; */ \
+do { \
+ if (((in6m) = (step).i_in6m) != NULL) \
+ (step).i_in6m = (in6m)->in6m_entry.le_next; \
+ else \
+ while ((step).i_ia != NULL) { \
+ (in6m) = (step).i_ia->ia6_multiaddrs.lh_first; \
+ (step).i_ia = (step).i_ia->ia_next; \
+ if ((in6m) != NULL) { \
+ (step).i_in6m = (in6m)->in6m_entry.le_next; \
+ break; \
+ } \
+ } \
+} while (0)
+
+#define IN6_FIRST_MULTI(step, in6m) \
+/* struct in6_multistep step; */ \
+/* struct in6_multi *in6m */ \
+do { \
+ (step).i_ia = in6_ifaddr; \
+ (step).i_in6m = NULL; \
+ IN6_NEXT_MULTI((step), (in6m)); \
+} while (0)
+
+int in6_ifinit __P((struct ifnet *,
+ struct in6_ifaddr *, struct sockaddr_in6 *, int));
+struct in6_multi *in6_addmulti __P((struct in6_addr *, struct ifnet *,
+ int *));
+void in6_delmulti __P((struct in6_multi *));
+void in6_ifscrub __P((struct ifnet *, struct in6_ifaddr *));
+extern int in6_ifindex2scopeid __P((int));
+extern int in6_mask2len __P((struct in6_addr *));
+extern void in6_len2mask __P((struct in6_addr *, int));
+int in6_control __P((struct socket *,
+ u_long, caddr_t, struct ifnet *, struct proc *));
+void in6_savemkludge __P((struct in6_ifaddr *));
+void in6_setmaxmtu __P((void));
+void in6_restoremkludge __P((struct in6_ifaddr *, struct ifnet *));
+struct in6_ifaddr *in6ifa_ifpforlinklocal __P((struct ifnet *));
+struct in6_ifaddr *in6ifa_ifpwithaddr __P((struct ifnet *,
+ struct in6_addr *));
+char *ip6_sprintf __P((struct in6_addr *));
+int in6_matchlen __P((struct in6_addr *, struct in6_addr *));
+int in6_are_prefix_equal __P((struct in6_addr *p1, struct in6_addr *p2,
+ int len));
+void in6_prefixlen2mask __P((struct in6_addr *maskp, int len));
+int in6_prefix_ioctl __P((struct socket *so, u_long cmd, caddr_t data,
+ struct ifnet *ifp));
+int in6_prefix_add_ifid __P((int iilen, struct in6_ifaddr *ia));
+void in6_prefix_remove_ifid __P((int iilen, struct in6_ifaddr *ia));
+#endif /* _KERNEL */
+
+#endif /* _NETINET6_IN6_VAR_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/ip6.h b/ecos/packages/net/tcpip/current/include/netinet6/ip6.h
new file mode 100644
index 0000000..7c923cc
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/ip6.h
@@ -0,0 +1,316 @@
+//==========================================================================
+//
+// include/netinet6_ipv6.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ip6.h,v 1.1 1999/12/08 06:50:21 itojun Exp $ */
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * 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.
+ *
+ * @(#)ip.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET6_IPV6_H_
+#define _NETINET6_IPV6_H_
+
+/*
+ * Definition for internet protocol version 6.
+ * RFC 2460
+ */
+
+struct ip6_hdr {
+ union {
+ struct ip6_hdrctl {
+ u_int32_t ip6_un1_flow; /* 20 bits of flow-ID */
+ u_int16_t ip6_un1_plen; /* payload length */
+ u_int8_t ip6_un1_nxt; /* next header */
+ u_int8_t ip6_un1_hlim; /* hop limit */
+ } ip6_un1;
+ u_int8_t ip6_un2_vfc; /* 4 bits version, 4 bits class */
+ } ip6_ctlun;
+ struct in6_addr ip6_src; /* source address */
+ struct in6_addr ip6_dst; /* destination address */
+};
+
+#define ip6_vfc ip6_ctlun.ip6_un2_vfc
+#define ip6_flow ip6_ctlun.ip6_un1.ip6_un1_flow
+#define ip6_plen ip6_ctlun.ip6_un1.ip6_un1_plen
+#define ip6_nxt ip6_ctlun.ip6_un1.ip6_un1_nxt
+#define ip6_hlim ip6_ctlun.ip6_un1.ip6_un1_hlim
+#define ip6_hops ip6_ctlun.ip6_un1.ip6_un1_hlim
+
+#define IPV6_VERSION 0x60
+#define IPV6_VERSION_MASK 0xf0
+
+#if BYTE_ORDER == BIG_ENDIAN
+#define IPV6_FLOWINFO_MASK 0x0fffffff /* flow info (28 bits) */
+#define IPV6_FLOWLABEL_MASK 0x000fffff /* flow label (20 bits) */
+#else
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define IPV6_FLOWINFO_MASK 0xffffff0f /* flow info (28 bits) */
+#define IPV6_FLOWLABEL_MASK 0xffff0f00 /* flow label (20 bits) */
+#endif /* LITTLE_ENDIAN */
+#endif
+#if 1
+/* ECN bits proposed by Sally Floyd */
+#define IP6TOS_CE 0x01 /* congestion experienced */
+#define IP6TOS_ECT 0x02 /* ECN-capable transport */
+#endif
+
+/*
+ * Extension Headers
+ */
+
+struct ip6_ext {
+ u_char ip6e_nxt;
+ u_char ip6e_len;
+};
+
+/* Hop-by-Hop options header */
+/* XXX should we pad it to force alignment on an 8-byte boundary? */
+struct ip6_hbh {
+ u_int8_t ip6h_nxt; /* next header */
+ u_int8_t ip6h_len; /* length in units of 8 octets */
+ /* followed by options */
+};
+
+/* Destination options header */
+/* XXX should we pad it to force alignment on an 8-byte boundary? */
+struct ip6_dest {
+ u_int8_t ip6d_nxt; /* next header */
+ u_int8_t ip6d_len; /* length in units of 8 octets */
+ /* followed by options */
+};
+
+/* Option types and related macros */
+#define IP6OPT_PAD1 0x00 /* 00 0 00000 */
+#define IP6OPT_PADN 0x01 /* 00 0 00001 */
+#define IP6OPT_JUMBO 0xC2 /* 11 0 00010 = 194 */
+#define IP6OPT_JUMBO_LEN 6
+#define IP6OPT_RTALERT 0x05 /* 00 0 00101 */
+#define IP6OPT_RTALERT_LEN 4
+#define IP6OPT_RTALERT_MLD 0 /* Datagram contains an MLD message */
+#define IP6OPT_RTALERT_RSVP 1 /* Datagram contains an RSVP message */
+#define IP6OPT_RTALERT_ACTNET 2 /* contains an Active Networks msg */
+#define IP6OPT_MINLEN 2
+
+#define IP6OPT_TYPE(o) ((o) & 0xC0)
+#define IP6OPT_TYPE_SKIP 0x00
+#define IP6OPT_TYPE_DISCARD 0x40
+#define IP6OPT_TYPE_FORCEICMP 0x80
+#define IP6OPT_TYPE_ICMP 0xC0
+
+#define IP6OPT_MUTABLE 0x20
+
+/* Routing header */
+struct ip6_rthdr {
+ u_int8_t ip6r_nxt; /* next header */
+ u_int8_t ip6r_len; /* length in units of 8 octets */
+ u_int8_t ip6r_type; /* routing type */
+ u_int8_t ip6r_segleft; /* segments left */
+ /* followed by routing type specific data */
+};
+
+/* Type 0 Routing header */
+struct ip6_rthdr0 {
+ u_int8_t ip6r0_nxt; /* next header */
+ u_int8_t ip6r0_len; /* length in units of 8 octets */
+ u_int8_t ip6r0_type; /* always zero */
+ u_int8_t ip6r0_segleft; /* segments left */
+ u_int8_t ip6r0_reserved; /* reserved field */
+ u_int8_t ip6r0_slmap[3]; /* strict/loose bit map */
+ struct in6_addr ip6r0_addr[1]; /* up to 23 addresses */
+};
+
+/* Fragment header */
+struct ip6_frag {
+ u_int8_t ip6f_nxt; /* next header */
+ u_int8_t ip6f_reserved; /* reserved field */
+ u_int16_t ip6f_offlg; /* offset, reserved, and flag */
+ u_int32_t ip6f_ident; /* identification */
+};
+
+#if BYTE_ORDER == BIG_ENDIAN
+#define IP6F_OFF_MASK 0xfff8 /* mask out offset from _offlg */
+#define IP6F_RESERVED_MASK 0x0006 /* reserved bits in ip6f_offlg */
+#define IP6F_MORE_FRAG 0x0001 /* more-fragments flag */
+#else /* BYTE_ORDER == LITTLE_ENDIAN */
+#define IP6F_OFF_MASK 0xf8ff /* mask out offset from _offlg */
+#define IP6F_RESERVED_MASK 0x0600 /* reserved bits in ip6f_offlg */
+#define IP6F_MORE_FRAG 0x0100 /* more-fragments flag */
+#endif /* BYTE_ORDER == LITTLE_ENDIAN */
+
+/*
+ * Internet implementation parameters.
+ */
+#define IPV6_MAXHLIM 255 /* maximun hoplimit */
+#define IPV6_DEFHLIM 64 /* default hlim */
+#define IPV6_FRAGTTL 120 /* ttl for fragment packets, in slowtimo tick */
+#define IPV6_HLIMDEC 1 /* subtracted when forwaeding */
+
+#define IPV6_MMTU 1280 /* minimal MTU and reassembly. 1024 + 256 */
+#define IPV6_MAXPACKET 65535 /* ip6 max packet size without Jumbo payload*/
+
+/*
+ * IP6_EXTHDR_CHECK ensures that region between the IP6 header and the
+ * target header (including IPv6 itself, extension headers and
+ * TCP/UDP/ICMP6 headers) are continuous. KAME requires drivers
+ * to store incoming data into one internal mbuf or one or more external
+ * mbufs(never into two or more internal mbufs). Thus, the third case is
+ * supposed to never be matched but is prepared just in case.
+ */
+
+#define IP6_EXTHDR_CHECK(m, off, hlen, ret) \
+do { \
+ if ((m)->m_next != NULL) { \
+ if (((m)->m_flags & M_LOOP) && \
+ ((m)->m_len < (off) + (hlen)) && \
+ (((m) = m_pullup((m), (off) + (hlen))) == NULL)) { \
+ ip6stat.ip6s_exthdrtoolong++; \
+ return ret; \
+ } else if ((m)->m_flags & M_EXT) { \
+ if ((m)->m_len < (off) + (hlen)) { \
+ ip6stat.ip6s_exthdrtoolong++; \
+ m_freem(m); \
+ return ret; \
+ } \
+ } else { \
+ if ((m)->m_len < (off) + (hlen)) { \
+ ip6stat.ip6s_exthdrtoolong++; \
+ m_freem(m); \
+ return ret; \
+ } \
+ } \
+ } \
+ else { \
+ if ((m)->m_len < (off) + (hlen)) { \
+ ip6stat.ip6s_tooshort++; \
+ in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_truncated); \
+ m_freem(m); \
+ return ret; \
+ } \
+ } \
+} while (0)
+
+#ifdef __NetBSD__
+/*
+ * IP6_EXTHDR_GET ensures that intermediate protocol header (from "off" to
+ * "len") is located in single mbuf, on contiguous memory region.
+ * The pointer to the region will be returned to pointer variable "val",
+ * with type "typ".
+ * IP6_EXTHDR_GET0 does the same, except that it aligns the structure at the
+ * very top of mbuf. GET0 is likely to make memory copy than GET.
+ *
+ * XXX we're now testing this, needs m_pulldown()
+ */
+#define IP6_EXTHDR_GET(val, typ, m, off, len) \
+do { \
+ struct mbuf *t; \
+ int tmp; \
+ t = m_pulldown((m), (off), (len), &tmp); \
+ if (t) { \
+ if (t->m_len < tmp + (len)) \
+ panic("m_pulldown malfunction"); \
+ (val) = (typ)(mtod(t, caddr_t) + tmp); \
+ } else \
+ (val) = (typ)NULL; \
+} while (0)
+
+#define IP6_EXTHDR_GET0(val, typ, m, off, len) \
+do { \
+ struct mbuf *t; \
+ t = m_pulldown((m), (off), (len), NULL); \
+ if (t) { \
+ if (t->m_len < (len)) \
+ panic("m_pulldown malfunction"); \
+ (val) = (typ)mtod(t, caddr_t); \
+ } else \
+ (val) = (typ)NULL; \
+} while (0)
+
+#endif /*NetBSD*/
+
+#endif /* not _NETINET_IPV6_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/ip6_mroute.h b/ecos/packages/net/tcpip/current/include/netinet6/ip6_mroute.h
new file mode 100644
index 0000000..b50f1a1
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/ip6_mroute.h
@@ -0,0 +1,277 @@
+//==========================================================================
+//
+// include/netinet6_ip6_mroute.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+/* $OpenBSD: ip6_mroute.h,v 1.2 1999/12/10 10:04:28 angelos Exp $ */
+
+/*
+ * Copyright (C) 1998 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+
+/* BSDI ip_mroute.h,v 2.5 1996/10/11 16:01:48 pjd Exp */
+
+/*
+ * Definitions for IP multicast forwarding.
+ *
+ * Written by David Waitzman, BBN Labs, August 1988.
+ * Modified by Steve Deering, Stanford, February 1989.
+ * Modified by Ajit Thyagarajan, PARC, August 1993.
+ * Modified by Ajit Thyagarajan, PARC, August 1994.
+ * Modified by Ahmed Helmy, USC, September 1996.
+ *
+ * MROUTING Revision: 1.2
+ */
+
+#ifndef _NETINET6_IP6_MROUTE_H_
+#define _NETINET6_IP6_MROUTE_H_
+
+/*
+ * Multicast Routing set/getsockopt commands.
+ */
+#define MRT6_INIT 100 /* initialize forwarder */
+#define MRT6_DONE 101 /* shut down forwarder */
+#define MRT6_ADD_MIF 102 /* add multicast interface */
+#define MRT6_DEL_MIF 103 /* delete multicast interface */
+#define MRT6_ADD_MFC 104 /* insert forwarding cache entry */
+#define MRT6_DEL_MFC 105 /* delete forwarding cache entry */
+#define MRT6_PIM 107 /* enable pim code */
+
+#if BSD >= 199103
+#define GET_TIME(t) microtime(&t)
+#elif defined(sun)
+#define GET_TIME(t) uniqtime(&t)
+#else
+#define GET_TIME(t) ((t) = time)
+#endif
+
+/*
+ * Types and macros for handling bitmaps with one bit per multicast interface.
+ */
+typedef u_short mifi_t; /* type of a mif index */
+#define MAXMIFS 64
+
+#ifndef IF_SETSIZE
+#define IF_SETSIZE 256
+#endif
+
+typedef long if_mask;
+#define NIFBITS (sizeof(if_mask) * NBBY) /* bits per mask */
+
+#ifndef howmany
+#define howmany(x, y) (((x) + ((y) - 1)) / (y))
+#endif
+
+typedef struct if_set {
+ fd_mask ifs_bits[howmany(IF_SETSIZE, NIFBITS)];
+} if_set;
+
+#define IF_SET(n, p) ((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS)))
+#define IF_CLR(n, p) ((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS)))
+#define IF_ISSET(n, p) ((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS)))
+#define IF_COPY(f, t) bcopy(f, t, sizeof(*(f)))
+#define IF_ZERO(p) bzero(p, sizeof(*(p)))
+
+/*
+ * Argument structure for MRT6_ADD_IF.
+ */
+struct mif6ctl {
+ mifi_t mif6c_mifi; /* the index of the mif to be added */
+ u_char mif6c_flags; /* MIFF_ flags defined below */
+ u_short mif6c_pifi; /* the index of the physical IF */
+#ifdef notyet
+ u_int mif6c_rate_limit; /* max rate */
+#endif
+};
+
+#define MIFF_REGISTER 0x1 /* mif represents a register end-point */
+
+/*
+ * Argument structure for MRT6_ADD_MFC and MRT6_DEL_MFC
+ */
+struct mf6cctl {
+ struct sockaddr_in6 mf6cc_origin; /* IPv6 origin of mcasts */
+ struct sockaddr_in6 mf6cc_mcastgrp; /* multicast group associated */
+ mifi_t mf6cc_parent; /* incoming ifindex */
+ struct if_set mf6cc_ifset; /* set of forwarding ifs */
+};
+
+/*
+ * The kernel's multicast routing statistics.
+ */
+struct mrt6stat {
+ u_quad_t mrt6s_mfc_lookups; /* # forw. cache hash table hits */
+ u_quad_t mrt6s_mfc_misses; /* # forw. cache hash table misses */
+ u_quad_t mrt6s_upcalls; /* # calls to mrouted */
+ u_quad_t mrt6s_no_route; /* no route for packet's origin */
+ u_quad_t mrt6s_bad_tunnel; /* malformed tunnel options */
+ u_quad_t mrt6s_cant_tunnel; /* no room for tunnel options */
+ u_quad_t mrt6s_wrong_if; /* arrived on wrong interface */
+ u_quad_t mrt6s_upq_ovflw; /* upcall Q overflow */
+ u_quad_t mrt6s_cache_cleanups; /* # entries with no upcalls */
+ u_quad_t mrt6s_drop_sel; /* pkts dropped selectively */
+ u_quad_t mrt6s_q_overflow; /* pkts dropped - Q overflow */
+ u_quad_t mrt6s_pkt2large; /* pkts dropped - size > BKT SIZE */
+ u_quad_t mrt6s_upq_sockfull; /* upcalls dropped - socket full */
+};
+
+/*
+ * Struct used to communicate from kernel to multicast router
+ * note the convenient similarity to an IPv6 header.
+ */
+struct mrt6msg {
+ u_long unused1;
+ u_char im6_msgtype; /* what type of message */
+#define MRT6MSG_NOCACHE 1
+#define MRT6MSG_WRONGMIF 2
+#define MRT6MSG_WHOLEPKT 3 /* used for user level encap*/
+ u_char im6_mbz; /* must be zero */
+ u_char im6_mif; /* mif rec'd on */
+ u_char unused2;
+ struct in6_addr im6_src, im6_dst;
+};
+
+/*
+ * Argument structure used by multicast routing daemon to get src-grp
+ * packet counts
+ */
+struct sioc_sg_req6 {
+ struct sockaddr_in6 src;
+ struct sockaddr_in6 grp;
+ u_quad_t pktcnt;
+ u_quad_t bytecnt;
+ u_quad_t wrong_if;
+};
+
+/*
+ * Argument structure used by mrouted to get mif pkt counts
+ */
+struct sioc_mif_req6 {
+ mifi_t mifi; /* mif number */
+ u_quad_t icount; /* Input packet count on mif */
+ u_quad_t ocount; /* Output packet count on mif */
+ u_quad_t ibytes; /* Input byte count on mif */
+ u_quad_t obytes; /* Output byte count on mif */
+};
+
+#if defined(_KERNEL) || defined(KERNEL)
+/*
+ * The kernel's multicast-interface structure.
+ */
+struct mif6 {
+ u_char m6_flags; /* MIFF_ flags defined above */
+ u_int m6_rate_limit; /* max rate */
+#ifdef notyet
+ struct tbf *m6_tbf; /* token bucket structure at intf. */
+#endif
+ struct in6_addr m6_lcl_addr; /* local interface address */
+ struct ifnet *m6_ifp; /* pointer to interface */
+ u_quad_t m6_pkt_in; /* # pkts in on interface */
+ u_quad_t m6_pkt_out; /* # pkts out on interface */
+ u_quad_t m6_bytes_in; /* # bytes in on interface */
+ u_quad_t m6_bytes_out; /* # bytes out on interface */
+ struct route_in6 m6_route;/* cached route if this is a tunnel */
+#ifdef notyet
+ u_int m6_rsvp_on; /* RSVP listening on this vif */
+ struct socket *m6_rsvpd; /* RSVP daemon socket */
+#endif
+};
+
+/*
+ * The kernel's multicast forwarding cache entry structure
+ */
+struct mf6c {
+ struct sockaddr_in6 mf6c_origin; /* IPv6 origin of mcasts */
+ struct sockaddr_in6 mf6c_mcastgrp; /* multicast group associated*/
+ mifi_t mf6c_parent; /* incoming IF */
+ struct if_set mf6c_ifset; /* set of outgoing IFs */
+
+ u_quad_t mf6c_pkt_cnt; /* pkt count for src-grp */
+ u_quad_t mf6c_byte_cnt; /* byte count for src-grp */
+ u_quad_t mf6c_wrong_if; /* wrong if for src-grp */
+ int mf6c_expire; /* time to clean entry up */
+ struct timeval mf6c_last_assert; /* last time I sent an assert*/
+ struct rtdetq *mf6c_stall; /* pkts waiting for route */
+ struct mf6c *mf6c_next; /* hash table linkage */
+};
+
+#define MF6C_INCOMPLETE_PARENT ((mifi_t)-1)
+
+/*
+ * Argument structure used for pkt info. while upcall is made
+ */
+#ifndef _NETINET_IP_MROUTE_H_
+struct rtdetq { /* XXX: rtdetq is also defined in ip_mroute.h */
+ struct mbuf *m; /* A copy of the packet */
+ struct ifnet *ifp; /* Interface pkt came in on */
+#ifdef UPCALL_TIMING
+ struct timeval t; /* Timestamp */
+#endif /* UPCALL_TIMING */
+ struct rtdetq *next;
+};
+#endif /* _NETINET_IP_MROUTE_H_ */
+
+#define MF6CTBLSIZ 256
+#if (MF6CTBLSIZ & (MF6CTBLSIZ - 1)) == 0 /* from sys:route.h */
+#define MF6CHASHMOD(h) ((h) & (MF6CTBLSIZ - 1))
+#else
+#define MF6CHASHMOD(h) ((h) % MF6CTBLSIZ)
+#endif
+
+#define MAX_UPQ6 4 /* max. no of pkts in upcall Q */
+
+int ip6_mrouter_set __P((int, struct socket *, struct mbuf *));
+int ip6_mrouter_get __P((int, struct socket *, struct mbuf **));
+int ip6_mrouter_done __P((void));
+int mrt6_ioctl __P((int, caddr_t));
+#endif /* _KERNEL */
+
+#endif /* !_NETINET6_IP6_MROUTE_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/ip6_var.h b/ecos/packages/net/tcpip/current/include/netinet6/ip6_var.h
new file mode 100644
index 0000000..4496c60
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/ip6_var.h
@@ -0,0 +1,287 @@
+//==========================================================================
+//
+// include/netinet6_ip6_var.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+/* $OpenBSD: ip6_var.h,v 1.2 1999/12/10 10:04:28 angelos Exp $ */
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * 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.
+ *
+ * @(#)ip_var.h 8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET6_IP6_VAR_H_
+#define _NETINET6_IP6_VAR_H_
+
+/*
+ * IP6 reassembly queue structure. Each fragment
+ * being reassembled is attached to one of these structures.
+ */
+struct ip6q {
+ u_long ip6q_head;
+ u_short ip6q_len;
+ u_char ip6q_nxt;
+ u_char ip6q_hlim;
+ struct ip6asfrag *ip6q_down;
+ struct ip6asfrag *ip6q_up;
+ u_long ip6q_ident;
+ u_char ip6q_arrive;
+ u_char ip6q_ttl;
+ struct in6_addr ip6q_src, ip6q_dst;
+ struct ip6q *ip6q_next;
+ struct ip6q *ip6q_prev;
+ int ip6q_unfrglen;
+#ifdef notyet
+ u_char *ip6q_nxtp;
+#endif
+};
+
+struct ip6asfrag {
+ u_long ip6af_head;
+ u_short ip6af_len;
+ u_char ip6af_nxt;
+ u_char ip6af_hlim;
+ /* must not override the above members during reassembling */
+ struct ip6asfrag *ip6af_down;
+ struct ip6asfrag *ip6af_up;
+ u_short ip6af_mff;
+ u_short ip6af_off;
+ struct mbuf *ip6af_m;
+ u_long ip6af_offset; /* offset where next header starts */
+ u_short ip6af_frglen; /* fragmentable part length */
+ u_char ip6af_x1[10];
+};
+
+#define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m))
+
+struct ip6_moptions {
+ struct ifnet *im6o_multicast_ifp; /* ifp for outgoing multicasts */
+ u_char im6o_multicast_hlim; /* hoplimit for outgoing multicasts */
+ u_char im6o_multicast_loop; /* 1 >= hear sends if a member */
+ LIST_HEAD(, in6_multi_mship) im6o_memberships;
+};
+
+/*
+ * Control options for outgoing packets
+ */
+
+/* Routing header related info */
+struct ip6po_rhinfo {
+ struct ip6_rthdr *ip6po_rhi_rthdr; /* Routing header */
+ struct route_in6 ip6po_rhi_route; /* Route to the 1st hop */
+};
+#define ip6po_rthdr ip6po_rhinfo.ip6po_rhi_rthdr
+#define ip6po_route ip6po_rhinfo.ip6po_rhi_route
+
+struct ip6_pktopts {
+ struct mbuf *ip6po_m; /* Pointer to mbuf storing the data */
+ int ip6po_hlim; /* Hoplimit for outgoing packets */
+ struct in6_pktinfo *ip6po_pktinfo; /* Outgoing IF/address information */
+ struct sockaddr *ip6po_nexthop; /* Next-hop address */
+ struct ip6_hbh *ip6po_hbh; /* Hop-by-Hop options header */
+ struct ip6_dest *ip6po_dest1; /* Destination options header(1st part) */
+ struct ip6po_rhinfo ip6po_rhinfo; /* Routing header related info. */
+ struct ip6_dest *ip6po_dest2; /* Destination options header(2nd part) */
+};
+
+struct ip6stat {
+ u_quad_t ip6s_total; /* total packets received */
+ u_quad_t ip6s_tooshort; /* packet too short */
+ u_quad_t ip6s_toosmall; /* not enough data */
+ u_quad_t ip6s_fragments; /* fragments received */
+ u_quad_t ip6s_fragdropped; /* frags dropped(dups, out of space) */
+ u_quad_t ip6s_fragtimeout; /* fragments timed out */
+ u_quad_t ip6s_fragoverflow; /* fragments that exceeded limit */
+ u_quad_t ip6s_forward; /* packets forwarded */
+ u_quad_t ip6s_cantforward; /* packets rcvd for unreachable dest */
+ u_quad_t ip6s_redirectsent; /* packets forwarded on same net */
+ u_quad_t ip6s_delivered; /* datagrams delivered to upper level*/
+ u_quad_t ip6s_localout; /* total ip packets generated here */
+ u_quad_t ip6s_odropped; /* lost packets due to nobufs, etc. */
+ u_quad_t ip6s_reassembled; /* total packets reassembled ok */
+ u_quad_t ip6s_fragmented; /* datagrams sucessfully fragmented */
+ u_quad_t ip6s_ofragments; /* output fragments created */
+ u_quad_t ip6s_cantfrag; /* don't fragment flag was set, etc. */
+ u_quad_t ip6s_badoptions; /* error in option processing */
+ u_quad_t ip6s_noroute; /* packets discarded due to no route */
+ u_quad_t ip6s_badvers; /* ip6 version != 6 */
+ u_quad_t ip6s_rawout; /* total raw ip packets generated */
+ u_quad_t ip6s_badscope; /* scope error */
+ u_quad_t ip6s_notmember; /* don't join this multicast group */
+ u_quad_t ip6s_nxthist[256]; /* next header history */
+ u_quad_t ip6s_m1; /* one mbuf */
+ u_quad_t ip6s_m2m[32]; /* two or more mbuf */
+ u_quad_t ip6s_mext1; /* one ext mbuf */
+ u_quad_t ip6s_mext2m; /* two or more ext mbuf */
+ u_quad_t ip6s_exthdrtoolong; /* ext hdr are not continuous */
+ u_quad_t ip6s_nogif; /* no match gif found */
+ u_quad_t ip6s_toomanyhdr; /* discarded due to too many headers */
+ /* XXX the following two items are not really AF_INET6 thing */
+ u_quad_t ip6s_pulldown; /* # of calls to m_pulldown */
+ u_quad_t ip6s_pulldown_copy; /* # of mbuf copies in m_pulldown */
+ u_quad_t ip6s_pulldown_alloc; /* # of mbuf allocs in m_pulldown */
+};
+
+#ifdef _KERNEL
+/* flags passed to ip6_output as last parameter */
+#define IPV6_DADOUTPUT 0x01 /* DAD */
+#define IPV6_FORWARDING 0x02 /* most of IPv6 header exists */
+
+extern struct ip6stat ip6stat; /* statistics */
+extern u_int32_t ip6_id; /* fragment identifier */
+extern int ip6_defhlim; /* default hop limit */
+extern int ip6_defmcasthlim; /* default multicast hop limit */
+extern int ip6_forwarding; /* act as router? */
+extern int ip6_forward_srcrt; /* forward src-routed? */
+extern int ip6_gif_hlim; /* Hop limit for gif encap packet */
+extern int ip6_use_deprecated; /* allow deprecated addr as source */
+extern int ip6_rr_prune; /* router renumbering prefix
+ * walk list every 5 sec. */
+#ifdef MAPPED_ADDR_ENABLED
+extern int ip6_mapped_addr_on;
+#endif /* MAPPED_ADDR_ENABLED */
+
+extern struct socket *ip6_mrouter; /* multicast routing daemon */
+extern int ip6_sendredirects; /* send IP redirects when forwarding? */
+extern int ip6_maxfragpackets; /* Maximum packets in reassembly queue */
+extern int ip6_sourcecheck; /* Verify source interface */
+extern int ip6_sourcecheck_interval; /* Interval between log messages */
+extern int ip6_accept_rtadv; /* Acts as a host not a router */
+extern int ip6_keepfaith; /* Firewall Aided Internet Translator */
+extern int ip6_log_interval;
+extern time_t ip6_log_time;
+extern int ip6_hdrnestlimit; /* upper limit of # of extension headers */
+extern int ip6_dad_count; /* DupAddrDetectionTransmits */
+
+extern u_int32_t ip6_flow_seq;
+extern int ip6_auto_flowlabel;
+
+struct in6pcb;
+struct inpcb;
+
+int icmp6_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
+
+void ip6_init __P((void));
+void ip6intr __P((void));
+void ip6_input __P((struct mbuf *));
+void ip6_freemoptions __P((struct ip6_moptions *));
+int ip6_unknown_opt __P((u_int8_t *, struct mbuf *, int));
+char * ip6_get_prevhdr __P((struct mbuf *, int));
+int ip6_mforward __P((struct ip6_hdr *, struct ifnet *, struct mbuf *));
+int ip6_process_hopopts __P((struct mbuf *, u_int8_t *, int, u_int32_t *,
+ u_int32_t *));
+void ip6_savecontrol __P((struct inpcb *, struct mbuf **, struct ip6_hdr *,
+ struct mbuf *));
+int ip6_sysctl __P((int *, u_int, void *, size_t *, void *, size_t));
+
+void ip6_forward __P((struct mbuf *, int));
+
+void ip6_mloopback __P((struct ifnet *, struct mbuf *, struct sockaddr_in6 *));
+int ip6_output __P((struct mbuf *, struct ip6_pktopts *,
+ struct route_in6 *, int,
+ struct ip6_moptions *, struct ifnet **));
+int ip6_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
+int ip6_setpktoptions __P((struct mbuf *, struct ip6_pktopts *, int));
+int ip6_optlen __P((struct inpcb *));
+
+int route6_input __P((struct mbuf **, int *, int));
+
+void frag6_init __P((void));
+int frag6_input __P((struct mbuf **, int *, int));
+void frag6_slowtimo __P((void));
+void frag6_drain __P((void));
+
+void rip6_init __P((void));
+int rip6_input __P((struct mbuf **mp, int *offp, int proto));
+int rip6_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
+int rip6_output __P((struct mbuf *, ...));
+int rip6_usrreq __P((struct socket *,
+ int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *));
+
+int dest6_input __P((struct mbuf **, int *, int));
+int none_input __P((struct mbuf **, int *, int));
+#endif /* _KERNEL */
+
+#endif /* !_NETINET6_IP6_VAR_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/ip6protosw.h b/ecos/packages/net/tcpip/current/include/netinet6/ip6protosw.h
new file mode 100644
index 0000000..17e9644
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/ip6protosw.h
@@ -0,0 +1,158 @@
+//==========================================================================
+//
+// include/netinet6_ip6protosw.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+/* $OpenBSD: ip6protosw.h,v 1.2 1999/12/10 10:04:28 angelos Exp $ */
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ *
+ */
+
+/* BSDI protosw.h,v 2.3 1996/10/11 16:02:40 pjd Exp */
+
+/*-
+ * Copyright (c) 1982, 1986, 1993
+ * 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.
+ *
+ * @(#)protosw.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _NETINET6_IP6PROTOSW_H_
+#define _NETINET6_IP6PROTOSW_H_
+
+/*
+ * Protocol switch table for IPv6.
+ * All other definitions should refer to sys/protosw.h
+ */
+
+struct mbuf;
+struct sockaddr;
+struct socket;
+struct domain;
+struct proc;
+struct ip6_hdr;
+
+/*
+ * argument type for the last arg of pr_ctlinput().
+ * should be consulted only with AF_INET6 family.
+ */
+struct ip6ctlparam {
+ struct mbuf *ip6c_m; /* start of mbuf chain */
+ struct ip6_hdr *ip6c_ip6; /* ip6 header of target packet */
+ int ip6c_off; /* offset of the target proto header */
+};
+
+struct ip6protosw {
+ short pr_type; /* socket type used for */
+ struct domain *pr_domain; /* domain protocol a member of */
+ short pr_protocol; /* protocol number */
+ short pr_flags; /* see below */
+
+/* protocol-protocol hooks */
+ int (*pr_input) /* input to protocol (from below) */
+ __P((struct mbuf **, int *, int));
+ int (*pr_output) /* output to protocol (from above) */
+ __P((struct mbuf *, ...));
+ void (*pr_ctlinput) /* control input (from below) */
+ __P((int, struct sockaddr *, void *));
+ int (*pr_ctloutput) /* control output (from above) */
+ __P((int, struct socket *, int, int, struct mbuf **));
+
+/* user-protocol hook */
+ int (*pr_usrreq) /* user request: see list below */
+ __P((struct socket *, int, struct mbuf *,
+ struct mbuf *, struct mbuf *, struct proc *));
+
+/* utility hooks */
+ void (*pr_init) /* initialization hook */
+ __P((void));
+
+ void (*pr_fasttimo) /* fast timeout (200ms) */
+ __P((void));
+ void (*pr_slowtimo) /* slow timeout (500ms) */
+ __P((void));
+ void (*pr_drain) /* flush any excess space possible */
+ __P((void));
+ int (*pr_sysctl) /* sysctl for protocol */
+ __P((int *, u_int, void *, size_t *, void *, size_t));
+};
+
+#endif /* !_NETINET6_IP6PROTOSW_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/ipv6.h b/ecos/packages/net/tcpip/current/include/netinet6/ipv6.h
new file mode 100644
index 0000000..4926182
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/ipv6.h
@@ -0,0 +1,153 @@
+//==========================================================================
+//
+// include/netinet6_ipv6.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/*
+%%% copyright-nrl-95
+This software is Copyright 1995-1998 by Randall Atkinson, Ronald Lee,
+Daniel McDonald, Bao Phan, and Chris Winters. All Rights Reserved. All
+rights under this copyright have been assigned to the US Naval Research
+Laboratory (NRL). The NRL Copyright Notice and License Agreement Version
+1.1 (January 17, 1995) applies to this software.
+You should have received a copy of the license with this software. If you
+didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
+
+*/
+
+#ifndef _NETINET6_IPV6_H
+#define _NETINET6_IPV6_H 1
+
+#define IPV6VERSION 6
+
+/*
+ * Header structures.
+ */
+
+struct ipv6
+{
+ uint32_t ipv6_versfl; /* Version and flow label word. */
+
+ uint16_t ipv6_length; /* Datagram length (not including the length
+ of this header). */
+ uint8_t ipv6_nexthdr; /* Next header type. */
+ uint8_t ipv6_hoplimit; /* Hop limit. */
+
+ struct in6_addr ipv6_src; /* Source address. */
+ struct in6_addr ipv6_dst; /* Destination address. */
+};
+
+#if __linux__
+#include <endian.h>
+#else /* __linux__ */
+#include <machine/endian.h>
+#endif /* __linux__ */
+
+struct ipv6hdr {
+#if BYTE_ORDER == LITTLE_ENDIAN
+ uint8_t ipv6_priority:4; /* going away? */
+ uint8_t ipv6_version:4;
+ uint32_t ipv6_flowid:24;
+#elif BYTE_ORDER == BIG_ENDIAN
+ uint32_t ipv6_flowid:24;
+ uint8_t ipv6_priority:4; /* going away? */
+ uint8_t ipv6_version:4;
+#else
+#error "Don't know what endian to use."
+#endif
+ uint16_t ipv6_len;
+ uint8_t ipv6_nextheader;
+ uint8_t ipv6_hoplimit;
+ struct in6_addr ipv6_src; /* source address */
+ struct in6_addr ipv6_dst; /* destination address */
+};
+
+/*
+ * Macros and defines for header fields, and values thereof.
+ * Assume things are in host order for these three macros.
+ */
+
+#define IPV6_VERSION(h) ((h)->ipv6_versfl >> 28)
+#define IPV6_PRIORITY(h) (((h)->ipv6_versfl & 0x0f000000) >> 24)
+#define IPV6_FLOWID(h) ((h)->ipv6_versfl & 0x00ffffff)
+
+#define MAXHOPLIMIT 64
+#define IPV6_MINMTU 576
+
+/*
+ * Other IPv6 header definitions.
+ */
+
+/* Fragmentation header & macros for it. NOTE: Host order assumption. */
+
+struct ipv6_fraghdr
+{
+ uint8_t frag_nexthdr; /* Next header type. */
+ uint8_t frag_reserved;
+ uint16_t frag_bitsoffset; /* More bit and fragment offset. */
+ uint32_t frag_id; /* Fragment identifier. */
+};
+
+#define FRAG_MOREMASK 0x1
+#define FRAG_OFFMASK 0xFFF8
+#define FRAG_MORE_BIT(fh) ((fh)->frag_bitsoffset & FRAG_MOREMASK)
+#define FRAG_OFFSET(fh) ((fh)->frag_bitsoffset & FRAG_OFFMASK)
+
+/* Source routing header. Host order assumption for macros. */
+
+struct ipv6_srcroute0
+{
+ uint8_t i6sr_nexthdr; /* Next header type. */
+ uint8_t i6sr_len; /* RH len in 8-byte addrs, !incl this structure */
+ uint8_t i6sr_type; /* Routing type, should be 0 */
+ uint8_t i6sr_left; /* Segments left */
+ uint32_t i6sr_reserved; /* 8 bits of reserved padding. */
+};
+
+#define I6SR_BITMASK(i6sr) ((i6sr)->i6sr_reserved & 0xffffff)
+
+/* Options header. For "ignoreable" options. */
+
+struct ipv6_opthdr
+{
+ uint8_t oh_nexthdr; /* Next header type. */
+ uint8_t oh_extlen; /* Header extension length. */
+ uint8_t oh_data[6]; /* Option data, may be reserved for
+ alignment purposes. */
+};
+
+#define OPT_PAD1 0
+#define OPT_PADN 1
+#define OPT_JUMBO 194
+
+struct ipv6_option
+{
+ uint8_t opt_type; /* Option type. */
+ uint8_t opt_datalen; /* Option data length. */
+ uint8_t opt_data[1]; /* Option data. */
+};
+#endif /* _NETINET6_IPV6_H */
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/ipv6_addrconf.h b/ecos/packages/net/tcpip/current/include/netinet6/ipv6_addrconf.h
new file mode 100644
index 0000000..7764eb4
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/ipv6_addrconf.h
@@ -0,0 +1,52 @@
+//==========================================================================
+//
+// include/netinet6_ipv6_addrconf.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/*
+%%% copyright-nrl-95
+This software is Copyright 1995-1998 by Randall Atkinson, Ronald Lee,
+Daniel McDonald, Bao Phan, and Chris Winters. All Rights Reserved. All
+rights under this copyright have been assigned to the US Naval Research
+Laboratory (NRL). The NRL Copyright Notice and License Agreement Version
+1.1 (January 17, 1995) applies to this software.
+You should have received a copy of the license with this software. If you
+didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
+
+*/
+
+#ifndef _NETINET6_IPV6_ADDRCONF_H
+#define _NETINET6_IPV6_ADDRCONF_H 1
+
+/*
+ * Function definitions.
+ */
+void addrconf_init __P((void));
+void addrconf_timer __P((void *));
+void addrconf_dad __P((struct in6_ifaddr *));
+
+#endif /* _NETINET6_IPV6_ADDRCONF_H */
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/ipv6_icmp.h b/ecos/packages/net/tcpip/current/include/netinet6/ipv6_icmp.h
new file mode 100644
index 0000000..856f65b
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/ipv6_icmp.h
@@ -0,0 +1,287 @@
+//==========================================================================
+//
+// include/netinet6_ipv6_icmp.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/*
+%%% copyright-nrl-95
+This software is Copyright 1995-1998 by Randall Atkinson, Ronald Lee,
+Daniel McDonald, Bao Phan, and Chris Winters. All Rights Reserved. All
+rights under this copyright have been assigned to the US Naval Research
+Laboratory (NRL). The NRL Copyright Notice and License Agreement Version
+1.1 (January 17, 1995) applies to this software.
+You should have received a copy of the license with this software. If you
+didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
+
+*/
+
+#ifndef _NETINET6_IPV6_ICMP_H
+#define _NETINET6_IPV6_ICMP_H 1
+
+/*
+ * ICMPv6 header.
+ */
+
+struct ipv6_icmp
+{
+ uint8_t icmp_type;
+ uint8_t icmp_code;
+ uint16_t icmp_cksum;
+ union
+ {
+ uint32_t ih_reserved;
+ struct
+ {
+ uint16_t ihs_id;
+ uint16_t ihs_seq;
+ } ih_idseq;
+ struct
+ {
+ uint8_t ihr_hoplimit;
+ uint8_t ihr_bits;
+ uint16_t ihr_lifetime;
+ } ih_radv;
+ } icmp_hun;
+#define icmp_unused icmp_hun.ih_reserved
+#define icmp_nexthopmtu icmp_hun.ih_reserved
+#define icmp_paramptr icmp_hun.ih_reserved
+#define icmp_echoid icmp_hun.ih_idseq.ihs_id
+#define icmp_echoseq icmp_hun.ih_idseq.ihs_seq
+#define icmp_grpdelay icmp_hun.ih_idseq.ihs_id
+#define icmp_grpunused icmp_hun.ih_idseq.ihs_seq
+#define icmp_nadvbits icmp_hun.ih_reserved
+#define icmp_radvhop icmp_hun.ih_radv.ihr_hoplimit
+#define icmp_radvbits icmp_hun.ih_radv.ihr_bits
+#define icmp_radvlifetime icmp_hun.ih_radv.ihr_lifetime
+ union
+ {
+ struct
+ {
+ struct ipv6 ido_ipv6;
+ uint8_t ido_remaining[1];
+ } id_offending;
+ uint8_t id_data[1];
+ struct
+ {
+ struct in6_addr idn_addr;
+ uint8_t idn_ext[1];
+ } id_neighbor;
+ struct
+ {
+ struct in6_addr idr_addr1;
+ struct in6_addr idr_addr2;
+ uint8_t idr_ext[1];
+ } id_redirect;
+ struct
+ {
+ uint32_t ida_reachable;
+ uint32_t ida_retrans;
+ uint8_t ida_opt[1];
+ } id_radv;
+ } icmp_dun;
+#define icmp_offending icmp_dun.id_offending
+#define icmp_ipv6 icmp_dun.id_offending.ido_ipv6
+
+#define icmp_echodata icmp_dun.id_data
+
+#define icmp_grpaddr icmp_dun.id_neighbor.idn_addr
+
+#define icmp_radvreach icmp_dun.id_radv.ida_reachable
+#define icmp_radvretrans icmp_dun.id_radv.ida_retrans
+#define icmp_radvext icmp_dun.id_radv.ida_opt
+
+#define icmp_nsoltarg icmp_dun.id_neighbor.idn_addr
+#define icmp_nsolext icmp_dun.id_neighbor.idn_ext
+#define icmp_nadvaddr icmp_dun.id_neighbor.idn_addr
+#define icmp_nadvext icmp_dun.id_neighbor.idn_ext
+
+#define icmp_redirtarg icmp_dun.id_redirect.idr_addr1
+#define icmp_redirdest icmp_dun.id_redirect.idr_addr2
+#define icmp_redirext icmp_dun.id_redirect.idr_ext
+};
+
+/*
+ * ICMPv6 extension constants.
+ */
+
+#define EXT_SOURCELINK 1
+#define EXT_TARGETLINK 2
+#define EXT_PREFIX 3
+#define EXT_REDIR 4
+#define EXT_MTU 5
+
+/*
+ * Extension structures for IPv6 discovery messages.
+ */
+
+struct icmp_exthdr /* Generic extension */
+{
+ uint8_t ext_id;
+ uint8_t ext_length; /* Length is 8 * this field, 0 is invalid. */
+ uint8_t ext_data[6]; /* Padded to 8 bytes. */
+};
+
+struct ext_prefinfo /* Prefix information */
+{
+ uint8_t pre_extid;
+ uint8_t pre_length;
+
+ uint8_t pre_prefixsize;
+ uint8_t pre_bits;
+
+ uint32_t pre_valid;
+ uint32_t pre_preferred;
+ uint32_t pre_reserved;
+
+ struct in6_addr pre_prefix;
+};
+
+/*
+ * Values for pre_bits
+ */
+#define ICMPV6_PREFIX_ONLINK 0x80
+#define ICMPV6_PREFIX_AUTO 0x40
+
+struct ext_redir /* Redirected header */
+{
+ uint8_t rd_extid;
+ uint8_t rd_length;
+ uint8_t rd_reserved[6];
+ struct ipv6 rd_header;
+};
+
+struct ext_mtu /* Recommended link MTU. */
+{
+ uint8_t mtu_extid;
+ uint8_t mtu_length;
+ uint16_t mtu_reserved;
+ uint32_t mtu_mtu;
+};
+
+/*
+ * Constants
+ */
+
+/*
+ * Lower bounds on packet lengths for various types.
+ * For the error advice packets must first insure that the
+ * packet is large enought to contain the returned ip header.
+ * Only then can we do the check to see if enough bits of packet
+ * data have been returned, since we need to check the returned
+ * ipv6 header length.
+ */
+#define ICMPV6_MINLEN 8 /* abs minimum */
+#define ICMPV6_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */
+#define ICMPV6_NADVMINLEN 24 /* min neighbor advertisement */
+#define ICMPV6_NSOLMINLEN 24 /* min neighbor solicit */
+#define ICMPV6_RADVMINLEN 16 /* min router advertisement */
+#define ICMPV6_RSOLMINLEN 8 /* min router solicit */
+#define ICMPV6_REDIRMINLEN 40 /* min redirect */
+#define ICMPV6_HLPMINLEN (8 + sizeof(struct ipv6) + 8) /* HLP demux len. */
+#define ICMPV6_MAXLEN 576 /* This should be whatever IPV6_MINMTU
+ will be. I take this to be the WHOLE
+ packet, including IPv6 header, and any
+ IPv6 options before the ICMP message. */
+
+/*
+ * Definition of type and code field values.
+ * ICMPv6 fixes things so that info messages are >= 128.
+ */
+
+/* Error messages and codes. */
+
+#define ICMPV6_UNREACH 1 /* dest unreachable, codes: */
+#define ICMPV6_UNREACH_NOROUTE 0 /* No route to dest. */
+#define ICMPV6_UNREACH_ADMIN 1 /* Admin. prohibited */
+#define ICMPV6_UNREACH_NOTNEIGHBOR 2 /* For strict source
+ routing. */
+#define ICMPV6_UNREACH_ADDRESS 3 /* Address unreach. */
+#define ICMPV6_UNREACH_PORT 4 /* Port unreachable */
+#define ICMPV6_TOOBIG 2 /* Packet too big. */
+#define ICMPV6_TIMXCEED 3 /* time exceeded, code: */
+#define ICMPV6_TIMXCEED_INTRANS 0 /* ttl==0 in transit */
+#define ICMPV6_TIMXCEED_REASS 1 /* Reassembly t.o. */
+#define ICMPV6_PARAMPROB 4 /* ip header bad */
+#define ICMPV6_PARAMPROB_PROB 0 /* Actual incorrect
+ parameter. */
+#define ICMPV6_PARAMPROB_NEXTHDR 1 /* Bad next hdr. */
+#define ICMPV6_PARAMPROB_BADOPT 2 /* Unrec. option */
+
+/* Info messages. */
+
+#define ICMPV6_ECHO 128 /* echo service */
+#define ICMPV6_ECHOREPLY 129 /* echo reply */
+#define ICMPV6_GRPQUERY 130 /* Query group membership. */
+#define ICMPV6_GRPREPORT 131 /* Join mcast group. */
+#define ICMPV6_GRPTERM 132 /* Leave mcast group. */
+
+#define ICMPV6_ROUTERSOL 133 /* Router solicit. */
+#define ICMPV6_ROUTERADV 134 /* Router advertisement. */
+#define ICMPV6_NEIGHBORSOL 135 /* Neighbor solicit. */
+#define ICMPV6_NEIGHBORADV 136 /* Neighbor advertisement. */
+
+#define ICMPV6_REDIRECT 137 /* ICMPv6 redirect. */
+
+/* Defined this way to save some HTONL cycles on little-endian boxes. */
+#if BYTE_ORDER == BIG_ENDIAN
+#define ICMPV6_NEIGHBORADV_RTR 0x80000000 /* Router flag. */
+#define ICMPV6_NEIGHBORADV_SOL 0x40000000 /* Solicited flag. */
+#define ICMPV6_NEIGHBORADV_OVERRIDE 0x20000000 /* Override flag. */
+#else /* BYTE_ORDER == LITTLE_ENDIAN */
+#define ICMPV6_NEIGHBORADV_RTR 0x80 /* Router flag. */
+#define ICMPV6_NEIGHBORADV_SOL 0x40 /* Solicited flag. */
+#define ICMPV6_NEIGHBORADV_OVERRIDE 0x20 /* Override flag. */
+#endif
+
+#define ICMPV6_MAXTYPE 137
+
+#define ICMPV6_INFOTYPE(type) ((type) >= 128)
+
+#if defined(_KERNEL) || defined(KERNEL)
+#include <netinet6/ipv6_var.h>
+
+/* Function prototypes */
+void ipv6_icmp_error(struct mbuf *, int, int, uint32_t);
+void ipv6_icmp_input(struct mbuf *, int);
+void ipv6_gsolicit(struct ifnet *, struct mbuf *, struct rtentry *);
+void ipv6_rtrequest(int, struct rtentry *, struct sockaddr *);
+int ipv6_icmp_output(struct mbuf *,struct socket *, struct in6_addr *);
+int ipv6_icmp_sysctl(int *, u_int, void *, size_t *, void *, size_t);
+#if __NetBSD__ || __FreeBSD__
+int ipv6_icmp_usrreq(struct socket *,int, struct mbuf *,struct mbuf *, struct mbuf *, struct proc *);
+#else /* __NetBSD__ || __FreeBSD__ */
+int ipv6_icmp_usrreq(struct socket *,int, struct mbuf *,struct mbuf *, struct mbuf *);
+#endif /* __NetBSD__ || __FreeBSD__ */
+
+void ipv6_routersol_input(struct mbuf *, int);
+void ipv6_routeradv_input(struct mbuf *, int);
+void ipv6_neighborsol_input(struct mbuf *, int);
+void ipv6_neighboradv_input(struct mbuf *, int);
+void ipv6_redirect_input(struct mbuf *, int);
+#endif /* defined(_KERNEL) || defined(KERNEL) */
+
+#endif /* _NETINET6_IPV6_ICMP_H */
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/ipv6_trans.h b/ecos/packages/net/tcpip/current/include/netinet6/ipv6_trans.h
new file mode 100644
index 0000000..69fd520
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/ipv6_trans.h
@@ -0,0 +1,56 @@
+//==========================================================================
+//
+// include/netinet6_ipv6_trans.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/*
+%%% copyright-nrl-95
+This software is Copyright 1995-1998 by Randall Atkinson, Ronald Lee,
+Daniel McDonald, Bao Phan, and Chris Winters. All Rights Reserved. All
+rights under this copyright have been assigned to the US Naval Research
+Laboratory (NRL). The NRL Copyright Notice and License Agreement Version
+1.1 (January 17, 1995) applies to this software.
+You should have received a copy of the license with this software. If you
+didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
+
+*/
+
+#ifndef _NETINET6_IPV6_TRANS_H
+#define _NETINET6_IPV6_TRANS_H 1
+
+/* I don't include any #includes, as I'm using this for our (NRL)
+ * modified netinet/ip_output() function; thus, this #include should be
+ * used/stuck-in after all the other necessary includes.
+ *
+ * And yes, I only put one declaration here. There's no real need
+ * to stick the other prototypes in here and have ip_output() fluffed
+ * during preprocessing time.
+ */
+
+int ipv4_tunnel_output __P((struct mbuf *, struct sockaddr_in *, struct rtentry *));
+
+#endif /* _NETINET6_IPV6_TRANS_H */
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/ipv6_var.h b/ecos/packages/net/tcpip/current/include/netinet6/ipv6_var.h
new file mode 100644
index 0000000..ba48ed8
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/ipv6_var.h
@@ -0,0 +1,385 @@
+//==========================================================================
+//
+// include/netinet6_ipv6_var.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/*
+%%% copyright-nrl-95
+This software is Copyright 1995-1998 by Randall Atkinson, Ronald Lee,
+Daniel McDonald, Bao Phan, and Chris Winters. All Rights Reserved. All
+rights under this copyright have been assigned to the US Naval Research
+Laboratory (NRL). The NRL Copyright Notice and License Agreement Version
+1.1 (January 17, 1995) applies to this software.
+You should have received a copy of the license with this software. If you
+didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
+
+*/
+#ifndef _NETINET6_IPV6_VAR_H
+#define _NETINET6_IPV6_VAR_H 1
+
+#include <netinet6/in6.h>
+
+/*
+ * IPv6 multicast "options". Session state for multicast, including
+ * weird per-session multicast things.
+ */
+
+struct ipv6_moptions
+{
+ struct ifnet *i6mo_multicast_ifp; /* ifp for outgoing multicasts */
+ u_char i6mo_multicast_ttl; /* TTL for outgoing multicasts.
+ Does this matter in IPv6? */
+ u_char i6mo_multicast_loop; /* 1 => hear sends if a member */
+ u_short i6mo_num_memberships; /* no. memberships this socket */
+ struct in6_multi *i6mo_membership[IN6_MAX_MEMBERSHIPS];
+};
+
+/*
+ * IPv6 stats.
+ */
+
+#if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199802
+#define _IPV6STAT_TYPE u_quad_t
+#else /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199802 */
+#define _IPV6STAT_TYPE u_long
+#endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199802 */
+
+struct ipv6stat {
+ _IPV6STAT_TYPE ips_total; /* total packets received */
+ _IPV6STAT_TYPE ips_tooshort; /* packet too short */
+ _IPV6STAT_TYPE ips_toosmall; /* not enough data */
+ _IPV6STAT_TYPE ips_fragments; /* fragments received */
+ _IPV6STAT_TYPE ips_fragdropped; /* frags dropped (dups, out of space) */
+ _IPV6STAT_TYPE ips_fragtimeout; /* fragments timed out */
+ _IPV6STAT_TYPE ips_forward; /* packets forwarded */
+ _IPV6STAT_TYPE ips_cantforward; /* packets rcvd for unreachable dest */
+ _IPV6STAT_TYPE ips_redirectsent; /* packets forwarded on same net */
+ _IPV6STAT_TYPE ips_noproto; /* unknown or unsupported protocol */
+ _IPV6STAT_TYPE ips_delivered; /* datagrams delivered to upper level*/
+ _IPV6STAT_TYPE ips_localout; /* total ip packets generated here */
+ _IPV6STAT_TYPE ips_odropped; /* lost packets due to nobufs, etc. */
+ _IPV6STAT_TYPE ips_reassembled; /* total packets reassembled ok */
+ _IPV6STAT_TYPE ips_fragmented; /* datagrams sucessfully fragmented */
+ _IPV6STAT_TYPE ips_ofragments; /* output fragments created */
+ _IPV6STAT_TYPE ips_cantfrag; /* don't fragment flag was set, etc. */
+ _IPV6STAT_TYPE ips_badoptions; /* error in option processing */
+ _IPV6STAT_TYPE ips_noroute; /* packets discarded due to no route */
+ _IPV6STAT_TYPE ips_badvers; /* IPv6 version != 6 */
+ _IPV6STAT_TYPE ips_rawout; /* total raw ip packets generated */
+};
+
+#if defined(_KERNEL) || defined(KERNEL)
+/*
+ * The IPv6 fragment queue entry structure.
+ * Notes:
+ * Nodes are stored in ttl order.
+ * prefix comes from whichever packet gets here first.
+ * data contains a chain of chains of mbufs (m_next down a chain, m_nextpkt
+ * chaining chains together) where the chains are ordered by assembly
+ * position. When two chains are contiguous for reassembly, they are
+ * combined and the frag header disappears.
+ * The structure is deliberately sized so MALLOC will round up on the order
+ * of much less than the total size instead of doubling the size.
+ */
+
+struct ipv6_fragment
+{
+ struct ipv6_fragment *next; /* Next fragment chain */
+ struct mbuf *prefix; /* Headers before frag header(s) */
+ struct mbuf *data; /* Frag headers + whatever data */
+ u_char ttl; /* Fragment chain TTL. */
+ u_char flags; /* Bit 0 indicates got end of chain */
+};
+
+/*
+ * Structures and definitions for discovery mechanisms in IPv6.
+ */
+
+/*
+ * Neighbor cache:
+ *
+ * Number of unanswered probes is in discq.
+ * "Time of next event" will be in rt->rt_rmx.rmx_expire
+ * (rmx_expire will actually be quite overloaded, actually.)
+ * Status REACHABLE will be dq_unanswered < 0
+ * Status PROBE will be dq_unanswered >= 0
+ * Status INCOMPLETE will be link addr length of 0 if held,
+ * or deleted if not held.
+ *
+ * If held, but INCOMPLETE fails set RTF_REJECT and make sure
+ * IPv6 and HLP's know how to deal with RTF_REJECT being set.
+ */
+
+struct discq /* Similar to v4's llinfo_arp, discovery's "neighbor entry". */
+{
+ struct discq *dq_next,*dq_prev; /* For {ins,rem}que(). */
+ struct rtentry *dq_rt; /* Back pointer to routing entry for
+ an address that may be dead. */
+ struct mbuf *dq_queue; /* Queue of outgoing messages. */
+ int dq_unanswered; /* Number of unanswered probes. */
+};
+
+#if !defined(_BSDI_VERSION) || (_BSDI_VERSION < 199802)
+/* Routing flag redefinitions */
+#define RTF_ISAROUTER RTF_PROTO2 /* Neighbor is a router. */
+#define RTF_DEFAULT RTF_PROTO1 /* Default route. */
+#endif /* !defined(_BSDI_VERSION) || (_BSDI_VERSION < 199802) */
+
+/*
+ * These should be configurable parameters, see ipv6_discovery.c.
+ * All units are in comments besides constants.
+ */
+
+#define MAX_INITIAL_RTR_ADVERT_INTERVAL 16 /* seconds */
+#define MAX_INITIAL_RTR_ADVERTISEMENTS 3 /* transmissions */
+#define MAX_RTR_RESPONSE_DELAY 2 /* seconds */
+
+#define MAX_RTR_SOLICITATION_DELAY 1 /* second */
+#define RTR_SOLICITATION_INTERVAL 3 /* seconds */
+#define MAX_RTR_SOLICITATIONS 3 /* transmissions */
+
+#define MAX_MULTICAST_SOLICIT 3 /* transmissions */
+#define MAX_UNICAST_SOLICIT 3 /* transmissions */
+#define MAX_ANYCAST_DELAY_TIME 1 /* seconds */
+#define MAX_NEIGHBOR_ADVERTISEMENTS 3 /* transmissions */
+#define MIN_NEIGHBOR_ADVERT_INTERVAL 16 /* seconds */
+#define REACHABLE_TIME 30 /* seconds */
+#define RETRANS_TIMER 3 /* seconds */
+#define DELAY_FIRST_PROBE_TIME 3 /* seconds */
+/* Need to somehow define random factors. */
+
+#define NEXTHOP_CLEAN_INTERVAL 600 /* seconds */
+#define REJECT_TIMER 20 /* seconds */
+
+/*
+ * Child of a router or tunnel. Is a "meta-entry" for garbage collection.
+ */
+
+struct v6child
+{
+ struct v6child *v6c_next,*v6c_prev; /* For {ins,rem}que() */
+ struct v6router *v6c_parent; /* Parent router. I'm null if
+ I'm the router, or a tunnel
+ child. */
+ struct rtentry *v6c_route; /* Next-hop cache entry. I won't
+ be holding it, but I'm attached
+ to it, like discq is to neighbor
+ cache entries. */
+};
+
+/*
+ * Default router list entry. Should be inserted
+ * in priority order. Will also have entries for non-
+ * default routers, because I may be a router myself.
+ */
+
+struct v6router
+{
+ struct v6router *v6r_next,*v6r_prev; /* For {ins,rem}que() */
+ struct rtentry *v6r_rt; /* Route for this. Could be neighbor,
+ could be tunnel. */
+ struct v6child v6r_children; /* Children of this router. */
+
+ /* Metric information? */
+ uint32_t v6r_expire; /* Expiration time. */
+};
+#define V6R_SIN6(v6r) ((struct sockaddr_in6 *)rt_key((v6r)->v6r_rt))
+
+/*
+ * Flags for "flags" argument in ipv6_output().
+ */
+
+#define IPV6_FORWARDING 0x1 /* Most of IPv6 header exists? */
+#define IPV6_RAWOUTPUT 0x2 /* Raw IPv6 packet! */
+#define IPV6_ROUTETOIF SO_DONTROUTE /* Include sys/socket.h... */
+
+void ipv6_init __P((void));
+void ipv6_drain __P((void));
+void ipv6_slowtimo __P((void));
+int ipv6_sysctl __P((int *, uint, void *, size_t *, void *, size_t));
+struct route6;
+
+#if __FreeBSD__
+int ipv6_ctloutput __P((struct socket *, struct sockopt *));
+int ripv6_ctloutput __P((struct socket *, struct sockopt *));
+#else /* __FreeBSD__ */
+int ipv6_ctloutput __P((int, struct socket *,int,int, struct mbuf **));
+int ripv6_ctloutput __P((int, struct socket *, int, int, struct mbuf **));
+#endif /* __FreeBSD__ */
+void ripv6_init __P((void));
+#if __OpenBSD__
+void ripv6_input __P((struct mbuf *, ...));
+int ripv6_output __P((struct mbuf *, ...));
+#else /* __OpenBSD__ */
+void ripv6_input __P((struct mbuf *, int));
+int ripv6_output __P((struct mbuf *, struct socket *, struct in6_addr *, struct mbuf *));
+#endif /* __OpenBSD__ */
+
+#if __NetBSD__ || __FreeBSD__
+int ripv6_usrreq_send(struct socket *, int, struct mbuf *, struct sockaddr *,
+ struct mbuf *, struct proc *);
+#else /* __NetBSD__ || __FreeBSD__ */
+int ripv6_usrreq_send(struct socket *, int, struct mbuf *, struct sockaddr *,
+ struct mbuf *);
+#endif /* __NetBSD__ || __FreeBSD__ */
+
+#if __FreeBSD__
+int ripv6_usrreq_abort(struct socket *);
+int ripv6_usrreq_attach(struct socket *, int , struct proc *);
+int ripv6_usrreq_bind(struct socket *, struct sockaddr *, struct proc *);
+int ripv6_usrreq_connect(struct socket *, struct sockaddr *, struct proc *);
+int ripv6_usrreq_control(struct socket *, u_long, caddr_t, struct ifnet *,
+ struct proc *);
+int ripv6_usrreq_detach(struct socket *);
+int ripv6_usrreq_peeraddr(struct socket *, struct sockaddr **);
+int ripv6_usrreq_sense(struct socket *, struct stat *);
+int ripv6_usrreq_shutdown(struct socket *);
+int ripv6_usrreq_sockaddr(struct socket *, struct sockaddr **);
+#else /* __FreeBSD__ */
+#if __NetBSD__
+int ripv6_usrreq __P((struct socket *, int, struct mbuf *, struct mbuf *,
+ struct mbuf *, struct proc *));
+#else /* __NetBSD__ */
+int ripv6_usrreq __P((struct socket *, int, struct mbuf *, struct mbuf *,
+ struct mbuf *));
+#endif /* __NetBSD__ */
+#endif /* __FreeBSD__ */
+
+#if __OpenBSD__
+void ipv6_input __P((struct mbuf *, ...));
+int ipv6_output __P((struct mbuf *, ...));
+#else /* __OpenBSD__ */
+void ipv6_input __P((struct mbuf *, int));
+int ipv6_output __P((struct mbuf *, struct route6 *, int, struct ipv6_moptions *, struct ifnet *, struct socket *));
+#endif /* __OpenBSD__ */
+void ipv6_reasm __P((struct mbuf *, int));
+void ipv6_hop __P((struct mbuf *, int));
+
+#if __FreeBSD__
+int in6_control __P((struct socket *,int, caddr_t, struct ifnet *,int, struct proc *));
+#else /* __FreeBSD__ */
+#if __NetBSD__
+int in6_control __P((struct socket *,u_long, caddr_t, struct ifnet *,int, struct proc *));
+#else /* __NetBSD__ */
+int in6_control __P((struct socket *,int, caddr_t, struct ifnet *,int));
+#endif /* __NetBSD__ */
+#endif /* __FreeBSD__ */
+void ipv6_stripoptions __P((struct mbuf *, int));
+struct in6_multi *in6_addmulti __P((struct in6_addr *,struct ifnet *));
+void in6_delmulti __P((struct in6_multi *));
+
+#if __FreeBSD__
+/* ripv6_usrreq and ipv6_icmp_usrreq functions */
+extern struct pr_usrreqs ripv6_usrreqs;
+extern struct pr_usrreqs ipv6_icmp_usrreqs;
+
+extern int ripv6_usr_attach(struct socket *, int , struct proc *);
+extern int ripv6_usr_disconnect(struct socket *);
+extern int ripv6_usr_abort(struct socket *);
+extern int ripv6_usr_detach(struct socket *);
+extern int ripv6_usr_bind(struct socket *, struct sockaddr *, struct proc *);
+extern int ripv6_usr_connect(struct socket *, struct sockaddr *, struct proc *);
+extern int ripv6_usr_shutdown(struct socket *);
+extern int ripv6_usr_send(struct socket *, int, struct mbuf *,
+ struct sockaddr *, struct mbuf *, struct proc *);
+extern int ripv6_usr_control(struct socket *, int, caddr_t,
+ struct ifnet *, struct proc *);
+extern int ripv6_usr_sense(struct socket *, struct stat *);
+extern int ripv6_usr_sockaddr(struct socket *, struct sockaddr **);
+extern int ripv6_usr_peeraddr(struct socket *, struct sockaddr **);
+#endif /* __FreeBSD__ */
+
+extern int ipv6_icmp_send(struct socket *, int, struct mbuf *,
+ struct sockaddr *, struct mbuf *, struct proc *);
+
+#if __OpenBSD__
+#ifdef NRL_IPSEC
+void *ipv6_trans_ctlinput __P((int, struct sockaddr *, void *, struct mbuf *));
+#else /* NRL_IPSEC */
+void *ipv6_trans_ctlinput __P((int, struct sockaddr *, void *));
+#endif /* NRL_IPSEC */
+#else /* __OpenBSD__ */
+struct ip;
+#ifdef NRL_IPSEC
+void ipv6_trans_ctlinput __P((int, struct sockaddr *, struct ip *, struct mbuf *));
+#else /* NRL_IPSEC */
+void ipv6_trans_ctlinput __P((int, struct sockaddr *, struct ip *));
+#endif /* NRL_IPSEC */
+#endif /* __OpenBSD__ */
+
+/* These might belong in in_pcb.h */
+struct inpcb;
+#if __FreeBSD__
+/*
+ * FreeBSD, having done away with the *_usrreq() functions no longer needs to
+ * pass mbufs to these functions. Thus they pass in sockaddrs instead.
+ */
+int in6_pcbbind(struct inpcb *, struct sockaddr *);
+int in6_pcbconnect(struct inpcb *, struct sockaddr *);
+int in6_setsockaddr(struct inpcb *, struct sockaddr **);
+int in6_setpeeraddr(struct inpcb *, struct sockaddr **);
+#else /* __FreeBSD__ */
+int in6_pcbbind(struct inpcb *, struct mbuf *);
+int in6_pcbconnect(struct inpcb *, struct mbuf *);
+int in6_setsockaddr(struct inpcb *, struct mbuf *);
+int in6_setpeeraddr(struct inpcb *, struct mbuf *);
+#endif /* __FreeBSD__ */
+void ipv6_onlink_query(struct sockaddr_in6 *);
+int ipv6_verify_onlink(struct sockaddr_in6 *);
+
+#if __FreeBSD__
+struct inpcbhead; /* XXX? Forward declaration needed. */
+#define __IN6_PCBNOTIFY_FIRSTARG struct inpcbhead *
+#endif /* __FreeBSD__ */
+#if __NetBSD__ || __OpenBSD__
+struct inpcbtable;
+#define __IN6_PCBNOTIFY_FIRSTARG struct inpcbtable *
+#endif /* __NetBSD__ || __OpenBSD__ */
+#if __bsdi__
+struct inpcb;
+#define __IN6_PCBNOTIFY_FIRSTARG struct inpcb *
+#endif /* __bsdi__ */
+
+#if (!__OpenBSD__ && defined(IPSEC)) || (__OpenBSD__ && defined(NRL_IPSEC))
+int in6_pcbnotify __P((__IN6_PCBNOTIFY_FIRSTARG, struct sockaddr *, uint,
+ struct in6_addr *, uint, int, void (*)(struct inpcb *,
+ int), struct mbuf *, int));
+#else /* (!__OpenBSD__ && defined(IPSEC)) || (__OpenBSD__ && defined(NRL_IPSEC)) */
+int in6_pcbnotify __P((__IN6_PCBNOTIFY_FIRSTARG, struct sockaddr *, uint,
+ struct in6_addr *, uint, int, void (*)(struct inpcb *,
+ int)));
+#endif /* (!__OpenBSD__ && defined(IPSEC)) || (__OpenBSD__ && defined(NRL_IPSEC)) */
+
+#undef __IN6_PCBNOTIFY_FIRSTARG
+
+void ipv6_freemoptions __P((struct ipv6_moptions *));
+
+int ipv6_controltoheader(struct mbuf **m, struct mbuf *control, struct ifnet **forceifp, int *);
+struct mbuf *ipv6_headertocontrol(struct mbuf *m, int extra, int inp_flags);
+#endif /* defined(_KERNEL) || defined(KERNEL) */
+
+#endif /* _NETINET6_IPV6_VAR_H */
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/mld6_var.h b/ecos/packages/net/tcpip/current/include/netinet6/mld6_var.h
new file mode 100644
index 0000000..655e104
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/mld6_var.h
@@ -0,0 +1,80 @@
+//==========================================================================
+//
+// include/netinet6_mld6_var.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+/* $OpenBSD: mld6_var.h,v 1.1 1999/12/08 06:50:23 itojun Exp $ */
+
+/*
+ * Copyright (C) 1998 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+
+#ifndef _NETINET6_MLD6_VAR_H_
+#define _NETINET6_MLD6_VAR_H_
+
+#ifdef _KERNEL
+
+#define MLD6_RANDOM_DELAY(X) (random() % (X) + 1)
+
+/*
+ * States for MLD stop-listening processing
+ */
+#define MLD6_OTHERLISTENER 0
+#define MLD6_IREPORTEDLAST 1
+
+void mld6_init __P((void));
+void mld6_input __P((struct mbuf *, int));
+void mld6_start_listening __P((struct in6_multi *));
+void mld6_stop_listening __P((struct in6_multi *));
+void mld6_fasttimeo __P((void));
+#endif /* _KERNEL */
+
+#endif /* _NETINET6_MLD6_VAR_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/nd6.h b/ecos/packages/net/tcpip/current/include/netinet6/nd6.h
new file mode 100644
index 0000000..5e5e70c
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/nd6.h
@@ -0,0 +1,335 @@
+//==========================================================================
+//
+// include/netinet6.nd6.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+/* $OpenBSD: nd6.h,v 1.1 1999/12/08 06:50:23 itojun Exp $ */
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+
+#ifndef _NETINET6_ND6_H_
+#define _NETINET6_ND6_H_
+
+#include <sys/queue.h>
+
+struct llinfo_nd6 {
+ struct llinfo_nd6 *ln_next;
+ struct llinfo_nd6 *ln_prev;
+ struct rtentry *ln_rt;
+ struct mbuf *ln_hold; /* last packet until resolved/timeout */
+ long ln_asked; /* number of queries already sent for this addr */
+ u_long ln_expire; /* lifetime for NDP state transition */
+ short ln_state; /* reachability state */
+ short ln_router; /* 2^0: ND6 router bit */
+};
+
+#define ND6_LLINFO_NOSTATE -2
+#define ND6_LLINFO_WAITDELETE -1
+#define ND6_LLINFO_INCOMPLETE 0
+#define ND6_LLINFO_REACHABLE 1
+#define ND6_LLINFO_STALE 2
+#define ND6_LLINFO_DELAY 3
+#define ND6_LLINFO_PROBE 4
+
+struct nd_ifinfo {
+ u_int32_t linkmtu; /* LinkMTU */
+ u_int32_t maxmtu; /* Upper bound of LinkMTU */
+ u_int32_t basereachable; /* BaseReachableTime */
+ u_int32_t reachable; /* Reachable Time */
+ u_int32_t retrans; /* Retrans Timer */
+ int recalctm; /* BaseReacable re-calculation timer */
+ u_int8_t chlim; /* CurHopLimit */
+ u_int8_t receivedra;
+};
+
+struct in6_nbrinfo {
+ char ifname[IFNAMSIZ]; /* if name, e.g. "en0" */
+ struct in6_addr addr; /* IPv6 address of the neighbor */
+ long asked; /* number of queries already sent for this addr */
+ int isrouter; /* if it acts as a router */
+ int state; /* reachability state */
+ int expire; /* lifetime for NDP state transition */
+};
+
+#define DRLSTSIZ 10
+#define PRLSTSIZ 10
+struct in6_drlist {
+ char ifname[IFNAMSIZ];
+ struct {
+ struct in6_addr rtaddr;
+ u_char flags;
+ u_short rtlifetime;
+ u_long expire;
+ u_short if_index;
+ } defrouter[DRLSTSIZ];
+};
+
+struct in6_prlist {
+ char ifname[IFNAMSIZ];
+ struct {
+ struct in6_addr prefix;
+ struct prf_ra raflags;
+ u_char prefixlen;
+ u_long vltime;
+ u_long pltime;
+ u_long expire;
+ u_short if_index;
+ u_short advrtrs; /* number of advertisement routers */
+ struct in6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */
+ } prefix[PRLSTSIZ];
+};
+
+struct in6_ndireq {
+ char ifname[IFNAMSIZ];
+ struct nd_ifinfo ndi;
+};
+
+/* protocol constants */
+#define MAX_RTR_SOLICITATION_DELAY 1 /*1sec*/
+#define RTR_SOLICITATION_INTERVAL 4 /*4sec*/
+#define MAX_RTR_SOLICITATIONS 3
+
+#define ND6_INFINITE_LIFETIME 0xffffffff
+
+#ifdef _KERNEL
+/* node constants */
+#define MAX_REACHABLE_TIME 3600000 /* msec */
+#define REACHABLE_TIME 30000 /* msec */
+#define RETRANS_TIMER 1000 /* msec */
+#define MIN_RANDOM_FACTOR 512 /* 1024 * 0.5 */
+#define MAX_RANDOM_FACTOR 1536 /* 1024 * 1.5 */
+#define ND_COMPUTE_RTIME(x) \
+ (((MIN_RANDOM_FACTOR * (x >> 10)) + (random() & \
+ ((MAX_RANDOM_FACTOR - MIN_RANDOM_FACTOR) * (x >> 10)))) /1000)
+
+struct nd_defrouter {
+ LIST_ENTRY(nd_defrouter) dr_entry;
+#define dr_next dr_entry.le_next
+ struct in6_addr rtaddr;
+ u_char flags;
+ u_short rtlifetime;
+ u_long expire;
+ struct ifnet *ifp;
+};
+
+struct nd_prefix {
+ struct ifnet *ndpr_ifp;
+ LIST_ENTRY(nd_prefix) ndpr_entry;
+ struct sockaddr_in6 ndpr_prefix; /* prefix */
+ struct in6_addr ndpr_mask; /* netmask derived from the prefix */
+ struct in6_addr ndpr_addr; /* address that is derived from the prefix */
+ u_int32_t ndpr_vltime; /* advertised valid lifetime */
+ u_int32_t ndpr_pltime; /* advertised preferred lifetime */
+ time_t ndpr_expire; /* expiration time of the prefix */
+ time_t ndpr_preferred; /* preferred time of the prefix */
+ struct prf_ra ndpr_flags;
+ /* list of routers that advertise the prefix: */
+ LIST_HEAD(pr_rtrhead, nd_pfxrouter) ndpr_advrtrs;
+ u_char ndpr_plen;
+ struct ndpr_stateflags {
+ /* if this prefix can be regarded as on-link */
+ u_char onlink : 1;
+ } ndpr_stateflags;
+};
+
+#define ndpr_next ndpr_entry.le_next
+
+#define ndpr_raf ndpr_flags
+#define ndpr_raf_onlink ndpr_flags.onlink
+#define ndpr_raf_auto ndpr_flags.autonomous
+
+#define ndpr_statef_onlink ndpr_stateflags.onlink
+#define ndpr_statef_addmark ndpr_stateflags.addmark
+
+/*
+ * We keep expired prefix for certain amount of time, for validation purposes.
+ * 1800s = MaxRtrAdvInterval
+ */
+#define NDPR_KEEP_EXPIRED (1800 * 2)
+
+/*
+ * Message format for use in obtaining information about prefixes
+ * from inet6 sysctl function
+ */
+struct inet6_ndpr_msghdr {
+ u_short inpm_msglen; /* to skip over non-understood messages */
+ u_char inpm_version; /* future binary compatability */
+ u_char inpm_type; /* message type */
+ struct in6_addr inpm_prefix;
+ u_long prm_vltim;
+ u_long prm_pltime;
+ u_long prm_expire;
+ u_long prm_preferred;
+ struct in6_prflags prm_flags;
+ u_short prm_index; /* index for associated ifp */
+ u_char prm_plen; /* length of prefix in bits */
+};
+
+#define prm_raf_onlink prm_flags.prf_ra.onlink
+#define prm_raf_auto prm_flags.prf_ra.autonomous
+
+#define prm_statef_onlink prm_flags.prf_state.onlink
+
+#define prm_rrf_decrvalid prm_flags.prf_rr.decrvalid
+#define prm_rrf_decrprefd prm_flags.prf_rr.decrprefd
+
+#define ifpr2ndpr(ifpr) ((struct nd_prefix *)(ifpr))
+#define ndpr2ifpr(ndpr) ((struct ifprefix *)(ndpr))
+
+struct nd_pfxrouter {
+ LIST_ENTRY(nd_pfxrouter) pfr_entry;
+#define pfr_next pfr_entry.le_next
+ struct nd_defrouter *router;
+};
+
+LIST_HEAD(nd_drhead, nd_defrouter);
+LIST_HEAD(nd_prhead, nd_prefix);
+
+/* nd6.c */
+extern int nd6_prune;
+extern int nd6_delay;
+extern int nd6_umaxtries;
+extern int nd6_mmaxtries;
+extern int nd6_useloopback;
+extern int nd6_proxyall;
+extern struct llinfo_nd6 llinfo_nd6;
+extern struct nd_ifinfo *nd_ifinfo;
+extern struct nd_drhead nd_defrouter;
+extern struct nd_prhead nd_prefix;
+
+union nd_opts {
+ struct nd_opt_hdr *nd_opt_array[9];
+ struct {
+ struct nd_opt_hdr *zero;
+ struct nd_opt_hdr *src_lladdr;
+ struct nd_opt_hdr *tgt_lladdr;
+ struct nd_opt_prefix_info *pi_beg;/* multiple opts, start */
+ struct nd_opt_rd_hdr *rh;
+ struct nd_opt_mtu *mtu;
+ struct nd_opt_hdr *search; /* multiple opts */
+ struct nd_opt_hdr *last; /* multiple opts */
+ int done;
+ struct nd_opt_prefix_info *pi_end;/* multiple opts, end */
+ } nd_opt_each;
+};
+#define nd_opts_src_lladdr nd_opt_each.src_lladdr
+#define nd_opts_tgt_lladdr nd_opt_each.tgt_lladdr
+#define nd_opts_pi nd_opt_each.pi_beg
+#define nd_opts_pi_end nd_opt_each.pi_end
+#define nd_opts_rh nd_opt_each.rh
+#define nd_opts_mtu nd_opt_each.mtu
+#define nd_opts_search nd_opt_each.search
+#define nd_opts_last nd_opt_each.last
+#define nd_opts_done nd_opt_each.done
+
+/* XXX: need nd6_var.h?? */
+/* nd6.c */
+void nd6_init __P((void));
+void nd6_ifattach __P((struct ifnet *));
+int nd6_is_addr_neighbor __P((struct in6_addr *, struct ifnet *));
+void nd6_option_init __P((void *, int, union nd_opts *));
+struct nd_opt_hdr *nd6_option __P((union nd_opts *));
+int nd6_options __P((union nd_opts *));
+struct rtentry *nd6_lookup __P((struct in6_addr *, int, struct ifnet *));
+void nd6_setmtu __P((struct ifnet *));
+void nd6_timer __P((void *));
+void nd6_free __P((struct rtentry *));
+void nd6_nud_hint __P((struct rtentry *, struct in6_addr *));
+int nd6_resolve __P((struct ifnet *, struct rtentry *,
+ struct mbuf *, struct sockaddr *, u_char *));
+#if defined(__bsdi__) && _BSDI_VERSION >= 199802
+void nd6_rtrequest __P((int, struct rtentry *, struct rt_addrinfo *));
+void nd6_p2p_rtrequest __P((int, struct rtentry *, struct rt_addrinfo *));
+#else
+void nd6_rtrequest __P((int, struct rtentry *, struct sockaddr *));
+void nd6_p2p_rtrequest __P((int, struct rtentry *, struct sockaddr *));
+#endif
+int nd6_ioctl __P((u_long, caddr_t, struct ifnet *));
+struct rtentry *nd6_cache_lladdr __P((struct ifnet *, struct in6_addr *,
+ char *, int, int, int));
+/* for test */
+int nd6_output __P((struct ifnet *, struct mbuf *, struct sockaddr_in6 *,
+ struct rtentry *));
+int nd6_storelladdr __P((struct ifnet *, struct rtentry *, struct mbuf *,
+ struct sockaddr *, u_char *));
+
+/* nd6_nbr.c */
+void nd6_na_input __P((struct mbuf *, int, int));
+void nd6_na_output __P((struct ifnet *, struct in6_addr *,
+ struct in6_addr *, u_long, int));
+void nd6_ns_input __P((struct mbuf *, int, int));
+void nd6_ns_output __P((struct ifnet *, struct in6_addr *,
+ struct in6_addr *, struct llinfo_nd6 *, int));
+caddr_t nd6_ifptomac __P((struct ifnet *));
+void nd6_dad_start __P((struct ifaddr *, int *));
+void nd6_dad_duplicated __P((struct ifaddr *));
+
+/* nd6_rtr.c */
+void nd6_rs_input __P((struct mbuf *, int, int));
+void nd6_ra_input __P((struct mbuf *, int, int));
+void prelist_del __P((struct nd_prefix *));
+void defrouter_addreq __P((struct nd_defrouter *));
+void defrouter_delreq __P((struct nd_defrouter *, int));
+void defrtrlist_del __P((struct nd_defrouter *));
+void prelist_remove __P((struct nd_prefix *));
+int prelist_update __P((struct nd_prefix *, struct nd_defrouter *,
+ struct mbuf *));
+struct nd_defrouter *defrouter_lookup __P((struct in6_addr *,
+ struct ifnet *));
+int in6_ifdel __P((struct ifnet *, struct in6_addr *));
+int in6_init_prefix_ltimes __P((struct nd_prefix *ndpr));
+void rt6_flush __P((struct in6_addr *, struct ifnet *));
+
+#endif /* _KERNEL */
+
+#endif /* _NETINET6_ND6_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/nd6_protocol.h b/ecos/packages/net/tcpip/current/include/netinet6/nd6_protocol.h
new file mode 100644
index 0000000..be22293
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/nd6_protocol.h
@@ -0,0 +1,129 @@
+//==========================================================================
+//
+// include/netinet6_nd6_protocol.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/*
+%%% portions-copyright-nrl-97
+Portions of this software are Copyright 1997-1998 by Randall Atkinson,
+Ronald Lee, Daniel McDonald, Bao Phan, and Chris Winters. All Rights
+Reserved. All rights under this copyright have been assigned to the US
+Naval Research Laboratory (NRL). The NRL Copyright Notice and License
+Agreement Version 1.1 (January 17, 1995) applies to these portions of the
+software.
+You should have received a copy of the license with this software. If you
+didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
+
+*/
+
+#ifndef _NETINET6_ND6_PROTOCOL_H
+#define _NETINET6_ND6_PROTOCOL_H 1
+
+#include <netinet6/icmpv6.h>
+
+#define ND6_ROUTER_SOLICITATION 133
+#define ND6_ROUTER_ADVERTISEMENT 134
+#define ND6_NEIGHBOR_SOLICITATION 135
+#define ND6_NEIGHBOR_ADVERTISEMENT 136
+#define ND6_REDIRECT 137
+
+enum nd6_option {
+ ND6_OPT_SOURCE_LINKADDR=1,
+ ND6_OPT_TARGET_LINKADDR=2,
+ ND6_OPT_PREFIX_INFORMATION=3,
+ ND6_OPT_REDIRECTED_HEADER=4,
+ ND6_OPT_MTU=5,
+ ND6_OPT_ENDOFLIST=256
+};
+
+struct nd_router_solicit { /* router solicitation */
+ struct icmpv6hdr rsol_hdr;
+};
+
+#define rsol_type rsol_hdr.icmpv6_type
+#define rsol_code rsol_hdr.icmpv6_code
+#define rsol_cksum rsol_hdr.icmpv6_cksum
+#define rsol_reserved rsol_hdr.icmpv6_data32[0]
+
+struct nd_router_advert { /* router advertisement */
+ struct icmpv6hdr radv_hdr;
+ uint32_t radv_reachable; /* reachable time */
+ uint32_t radv_retransmit; /* reachable retransmit time */
+};
+
+#define radv_type radv_hdr.icmpv6_type
+#define radv_code radv_hdr.icmpv6_code
+#define radv_cksum radv_hdr.icmpv6_cksum
+#define radv_maxhoplimit radv_hdr.icmpv6_data8[0]
+#define radv_m_o_res radv_hdr.icmpv6_data8[1]
+#define ND6_RADV_M_BIT 0x80
+#define ND6_RADV_O_BIT 0x40
+#define radv_router_lifetime radv_hdr.icmpv6_data16[1]
+
+struct nd6_nsolicitation { /* neighbor solicitation */
+ struct icmpv6hdr nsol6_hdr;
+ struct in6_addr nsol6_target;
+};
+
+struct nd6_nadvertisement { /* neighbor advertisement */
+ struct icmpv6hdr nadv6_hdr;
+ struct in6_addr nadv6_target;
+};
+
+#define nadv6_flags nadv6_hdr.icmpv6_data32[0]
+#define ND6_NADVERFLAG_ISROUTER 0x80
+#define ND6_NADVERFLAG_SOLICITED 0x40
+#define ND6_NADVERFLAG_OVERRIDE 0x20
+
+struct nd6_redirect { /* redirect */
+ struct icmpv6hdr redirect_hdr;
+ struct in6_addr redirect_target;
+ struct in6_addr redirect_destination;
+};
+
+struct nd6_opt_prefix_info { /* prefix information */
+ uint8_t opt_type;
+ uint8_t opt_length;
+ uint8_t opt_prefix_length;
+ uint8_t opt_l_a_res;
+ uint32_t opt_valid_life;
+ uint32_t opt_preferred_life;
+ uint32_t opt_reserved2;
+ struct in6_addr opt_prefix;
+};
+
+#define ND6_OPT_PI_L_BIT 0x80
+#define ND6_OPT_PI_A_BIT 0x40
+
+struct nd6_opt_mtu { /* MTU option */
+ uint8_t opt_type;
+ uint8_t opt_length;
+ uint16_t opt_reserved;
+ uint32_t opt_mtu;
+};
+
+#endif /* _NETINET6_ND6_PROTOCOL_H */
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/osdep.h b/ecos/packages/net/tcpip/current/include/netinet6/osdep.h
new file mode 100644
index 0000000..b61a997
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/osdep.h
@@ -0,0 +1,147 @@
+//==========================================================================
+//
+// include/netinet6_osdep.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: osdep.h,v 1.3 1999/12/10 08:53:18 angelos Exp $ */
+/*
+%%% copyright-nrl-97
+This software is Copyright 1997-1998 by Randall Atkinson, Ronald Lee,
+Daniel McDonald, Bao Phan, and Chris Winters. All Rights Reserved. All
+rights under this copyright have been assigned to the US Naval Research
+Laboratory (NRL). The NRL Copyright Notice and License Agreement Version
+1.1 (January 17, 1995) applies to this software.
+You should have received a copy of the license with this software. If you
+didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
+
+%%% copyright-cmetz-97
+This software is Copyright 1997-1998 by Craig Metz, All Rights Reserved.
+The Inner Net License Version 2 applies to this software.
+You should have received a copy of the license with this software. If
+you didn't get a copy, you may request one from <license@inner.net>.
+
+*/
+#ifndef _NETINET6_OSDEP_H_
+#define _NETINET6_OSDEP_H_
+
+#define OSDEP_BSD 1
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#ifdef KERNEL
+#ifndef ATSH_ADD
+#include <sys/systm.h>
+#endif /* ATSH_ADD */
+#ifndef MLEN
+#include <sys/mbuf.h>
+#endif /* MLEN */
+#include <sys/kernel.h>
+#include <sys/malloc.h>
+#ifndef SB_MAX
+#include <sys/socketvar.h>
+#endif /* SB_MAX */
+#include <sys/proc.h>
+#ifndef RTM_RTTUNIT
+#include <net/route.h>
+#endif /* RTM_RTTUNIT */
+#endif /* KERNEL */
+struct ifnet;
+struct mbuf;
+#include <netinet/in.h>
+struct route6;
+
+#ifdef KERNEL
+/* XXX */
+#define OSDEP_CRITICALDCL int __s;
+#define OSDEP_CRITICALSTART __s = splnet()
+#define OSDEP_CRITICALEND splx(__s)
+#define OSDEP_TIMESECONDS (time.tv_sec)
+#define OSDEP_PROCESS struct proc
+#define OSDEP_PROCESSCURRENT (curproc)
+#define OSDEP_PROCESSPARENT(x) ((x)->p_pptr)
+#define OSDEP_PROCESSPID(x) ((x)->p_pid)
+
+#ifdef SS_PRIV
+#define OSDEP_SOCKETPRIVELEGED(socket) (socket->so_state & SS_PRIV)
+#else /* SS_PRIV */
+/* XXX? */
+#define OSDEP_SOCKETPRIVELEGED(socket) (!curproc || !curproc->p_ucred || !curproc->p_ucred->cr_uid)
+#endif /* SS_PRIV */
+#define OSDEP_PCAST(x) ((unsigned int)(x) & 0xffffffff)
+#define OSDEP_SOCKET struct socket
+#define OSDEP_PACKET struct mbuf
+struct mbuf;
+
+#define OSDEP_REAL_MALLOC(n) malloc((unsigned long)(n), M_TEMP, M_DONTWAIT)
+#define OSDEP_REAL_FREE(p) free((void *)p, M_TEMP)
+#define OSDEP_FAMILY(socket) (socket->so_proto->pr_domain->dom_family)
+#define OSDEP_PSEUDORANDOM (uint32_t)random()
+
+struct ifnet;
+struct mbuf *m_devget(char *, int, int, struct ifnet *, void (*)(const void *, void *, size_t));
+
+static __inline__ int __osdep_datatopacket(void *data, int len, OSDEP_PACKET **packet)
+{
+ if (!(*packet = m_devget(data, len, 0, NULL, NULL)))
+ return -ENOMEM;
+
+ return 0;
+};
+
+#define OSDEP_DATATOPACKET(data, len, packet) __osdep_datatopacket(data, len, packet)
+
+#define OSDEP_ZEROPACKET(packet) m_zero(packet)
+#define OSDEP_FREEPACKET(packet) m_freem(packet)
+
+#define memcpy(dst, src, len) bcopy(src, dst, len)
+#define memmove(dst, src, len) bcopy(src, dst, len)
+#define memset(p, zero, len) bzero(p, len) /* XXX */
+#define memcmp(p1, p2, len) bcmp(p1, p2, len)
+
+#define OSDEP_COPYFROMUSER(dst, src, len) copyin(src, dst, len)
+#define OSDEP_COPYTOUSER(dst, src, len) copyout(src, dst, len)
+
+#endif /* KERNEL */
+#define OSDEP_SALEN 1
+#define OSDEP_ERROR(x) (x)
+
+#define ENETSECURITYPOLICY -ECOMM
+
+#ifdef DEBUG_MALLOC
+#undef OSDEP_MALLOC
+#undef OSDEP_FREE
+#define OSDEP_MALLOC(n) debug_malloc_malloc(n, DEBUG_STATUS)
+#define OSDEP_FREE(p) debug_malloc_free(p)
+#else /* DEBUG_MALLOC */
+#undef OSDEP_MALLOC
+#define OSDEP_MALLOC(n) OSDEP_REAL_MALLOC(n)
+#undef OSDEP_FREE
+#define OSDEP_FREE(p) OSDEP_REAL_FREE(p)
+#endif /* DEBUG_MALLOC */
+
+#endif // _NETINET6_OSDEP_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/pim6.h b/ecos/packages/net/tcpip/current/include/netinet6/pim6.h
new file mode 100644
index 0000000..21e5932
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/pim6.h
@@ -0,0 +1,102 @@
+//==========================================================================
+//
+// include/netinet/pim6.h
+//
+// IPv6 protocol independent multicast
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+/* $OpenBSD: pim6.h,v 1.1 1999/12/08 06:50:23 itojun Exp $ */
+
+/*
+ * Copyright (C) 1998 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+
+#ifndef _NETINET_PIM6_H_
+#define _NETINET_PIM6_H_
+
+/*
+ * Protocol Independent Multicast (PIM) definitions
+ *
+ * Written by Ahmed Helmy, SGI, July 1996
+ *
+ * MULTICAST
+ */
+
+/*
+ * PIM packet header
+ */
+#define PIM_VERSION 2
+struct pim {
+#if defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN)
+ u_char pim_type:4, /* the PIM message type, currently they are:
+ * Hello, Register, Register-Stop, Join/Prune,
+ * Bootstrap, Assert, Graft (PIM-DM only),
+ * Graft-Ack (PIM-DM only), C-RP-Adv
+ */
+ pim_ver:4; /* PIM version number; 2 for PIMv2 */
+#else
+ u_char pim_ver:4, /* PIM version */
+ pim_type:4; /* PIM type */
+#endif
+ u_char pim_rsv; /* Reserved */
+ u_short pim_cksum; /* IP style check sum */
+};
+
+#define PIM_MINLEN 8 /* The header min. length is 8 */
+#define PIM6_REG_MINLEN (PIM_MINLEN+40) /* Register message + inner IP6 header */
+
+/*
+ * Message types
+ */
+#define PIM_REGISTER 1 /* PIM Register type is 1 */
+
+/* second bit in reg_head is the null bit */
+#define PIM_NULL_REGISTER 0x40000000
+
+#endif // _NETINET_PIM6_H_
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/pim6_var.h b/ecos/packages/net/tcpip/current/include/netinet6/pim6_var.h
new file mode 100644
index 0000000..fdc705a
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/pim6_var.h
@@ -0,0 +1,99 @@
+//==========================================================================
+//
+// include/netinet/pim6_var.h
+//
+// IPv6 protocol independent multicast
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+/* $OpenBSD: pim6_var.h,v 1.1 1999/12/08 06:50:23 itojun Exp $ */
+
+/*
+ * Copyright (C) 1998 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+/* KAME Id: pim6_var.h,v 1.2 1999/08/01 15:58:13 itojun Exp */
+
+#ifndef _NETINET6_PIM6_VAR_H_
+#define _NETINET6_PIM6_VAR_H_
+
+/*
+ * Protocol Independent Multicast (PIM),
+ * implementation-specific definitions.
+ *
+ * Written by George Edmond Eddy (Rusty), ISI, February 1998
+ * Modified by Pavlin Ivanov Radoslavov, USC/ISI, May 1998
+ */
+
+struct pim6stat {
+ u_quad_t pim6s_rcv_total; /* total PIM messages received */
+ u_quad_t pim6s_rcv_tooshort; /* received with too few bytes */
+ u_quad_t pim6s_rcv_badsum; /* received with bad checksum */
+ u_quad_t pim6s_rcv_badversion; /* received bad PIM version */
+ u_quad_t pim6s_rcv_registers; /* received registers */
+ u_quad_t pim6s_rcv_badregisters; /* received invalid registers */
+ u_quad_t pim6s_snd_registers; /* sent registers */
+};
+
+#if (defined(KERNEL)) || (defined(_KERNEL))
+extern struct pim6stat pim6stat;
+
+int pim6_input __P((struct mbuf **, int*, int));
+#endif /* KERNEL */
+
+/*
+ * Names for PIM sysctl objects
+ */
+#define PIMCTL_STATS 1 /* statistics (read-only) */
+#define PIMCTL_MAXID 2
+
+#define PIMCTL_NAMES { \
+ { 0, 0 }, \
+ { 0, 0 }, \
+}
+
+#endif /* _NETINET6_PIM6_VAR_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/netinet6/tcpipv6.h b/ecos/packages/net/tcpip/current/include/netinet6/tcpipv6.h
new file mode 100644
index 0000000..4446032
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/netinet6/tcpipv6.h
@@ -0,0 +1,68 @@
+//==========================================================================
+//
+// include/netinet6_tcpipv6.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: tcpipv6.h,v 1.4 1999/12/10 08:53:18 angelos Exp $ */
+
+/*
+%%% copyright-nrl-95
+This software is Copyright 1995-1998 by Randall Atkinson, Ronald Lee,
+Daniel McDonald, Bao Phan, and Chris Winters. All Rights Reserved. All
+rights under this copyright have been assigned to the US Naval Research
+Laboratory (NRL). The NRL Copyright Notice and License Agreement Version
+1.1 (January 17, 1995) applies to this software.
+You should have received a copy of the license with this software. If you
+didn't get a copy, you may request one from <license@ipv6.nrl.navy.mil>.
+
+*/
+
+#ifndef _NETINET6_TCPIPV6_H
+#define _NETINET6_TCPIPV6_H 1
+
+#include <netinet6/ip6.h>
+#include <netinet/tcp.h>
+
+struct tcpipv6hdr {
+ struct ip6_hdr ti6_i;
+ struct tcphdr ti6_t;
+};
+
+#define ti6_src ti6_i.ipv6_src
+#define ti6_dst ti6_i.ipv6_dst
+#define ti6_sport ti6_t.th_sport
+#define ti6_dport ti6_t.th_dport
+#define ti6_seq ti6_t.th_seq
+#define ti6_ack ti6_t.th_ack
+#define ti6_x2 ti6_t.th_x2
+#define ti6_off ti6_t.th_off
+#define ti6_flags ti6_t.th_flags
+#define ti6_win ti6_t.th_win
+#define ti6_sum ti6_t.th_sum
+#define ti6_urp ti6_t.th_urp
+
+#endif /* _NETINET6_TCPIPV6_H */
diff --git a/ecos/packages/net/tcpip/current/include/sys/bsdselect.h b/ecos/packages/net/tcpip/current/include/sys/bsdselect.h
new file mode 100644
index 0000000..127f07c
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/sys/bsdselect.h
@@ -0,0 +1,55 @@
+//==========================================================================
+//
+// include/sys/select.h
+//
+// Support for 'select()' system call
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#ifndef _SYS_SELECT_H_
+#define _SYS_SELECT_H_
+
+#include <pkgconf/system.h>
+
+#ifdef CYGPKG_IO_FILEIO
+
+#include <cyg/io/file.h>
+
+void selwakeup __P((struct selinfo *));
+
+#else
+
+/*
+ * Used to maintain information about processes that wish to be
+ * notified when I/O becomes possible.
+ */
+struct selinfo {
+ void *unused;
+};
+
+void selrecord __P((void *selector, struct selinfo *));
+void selwakeup __P((struct selinfo *));
+
+#endif
+
+#endif /* !_SYS_SELECT_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/sys/bsdtypes.h b/ecos/packages/net/tcpip/current/include/sys/bsdtypes.h
new file mode 100644
index 0000000..2a5d597
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/sys/bsdtypes.h
@@ -0,0 +1,194 @@
+//==========================================================================
+//
+// include/sys/types.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: types.h,v 1.15 1999/02/15 18:53:57 millert Exp $ */
+/* $NetBSD: types.h,v 1.29 1996/11/15 22:48:25 jtc Exp $ */
+
+/*-
+ * Copyright (c) 1982, 1986, 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * 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.
+ *
+ * @(#)types.h 8.4 (Berkeley) 1/21/94
+ */
+
+#ifndef _SYS_TYPES_H_
+#define _SYS_TYPES_H_
+
+/* Machine type dependent parameters. */
+#include <machine/types.h>
+
+#include <machine/ansi.h>
+#include <machine/endian.h>
+
+#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
+typedef unsigned char u_char;
+typedef unsigned short u_short;
+typedef unsigned int u_int;
+typedef unsigned long u_long;
+
+typedef unsigned char unchar; /* Sys V compatibility */
+typedef unsigned short ushort; /* Sys V compatibility */
+typedef unsigned int uint; /* Sys V compatibility */
+typedef unsigned long ulong; /* Sys V compatibility */
+#endif
+
+typedef u_int64_t u_quad_t; /* quads */
+typedef int64_t quad_t;
+typedef quad_t * qaddr_t;
+
+typedef char * caddr_t; /* core address */
+typedef int32_t daddr_t; /* disk address */
+typedef u_int32_t fixpt_t; /* fixed point number */
+typedef long key_t; /* IPC key (for Sys V IPC) */
+typedef quad_t rlim_t; /* resource limit */
+typedef int32_t segsz_t; /* segment size */
+typedef int32_t swblk_t; /* swap offset */
+typedef u_int32_t useconds_t; /* microseconds */
+typedef int32_t suseconds_t; /* microseconds (signed) */
+
+/*
+ * XPG4.2 states that inclusion of <netinet/in.h> must pull these
+ * in and that inclusion of <sys/socket.h> must pull in sa_family_t.
+ * We put there here because there are other headers that require
+ * these types and <sys/socket.h> and <netinet/in.h> will indirectly
+ * include <sys/types.h>. Thus we are compliant without too many hoops.
+ */
+typedef u_int32_t in_addr_t; /* base type for internet address */
+typedef u_int16_t in_port_t; /* IP port type */
+typedef u_int8_t sa_family_t; /* sockaddr address family type */
+typedef u_int32_t socklen_t; /* length type for network syscalls */
+
+/*
+ * These belong in unistd.h, but are placed here too to ensure that
+ * long arguments will be promoted to off_t if the program fails to
+ * include that header or explicitly cast them to off_t.
+ */
+#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
+#ifndef _KERNEL
+#include <sys/cdefs.h>
+__BEGIN_DECLS
+off_t lseek __P((int, off_t, int));
+int ftruncate __P((int, off_t));
+int truncate __P((const char *, off_t));
+__END_DECLS
+#endif /* !_KERNEL */
+#endif /* !defined(_POSIX_SOURCE) ... */
+
+#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
+/* Major, minor numbers, dev_t's. */
+#define major(x) ((int32_t)(((u_int32_t)(x) >> 8) & 0xff))
+#define minor(x) ((int32_t)((x) & 0xff))
+#define makedev(x,y) ((dev_t)(((x) << 8) | (y)))
+#endif
+
+#if 0 //def _BSD_CLOCK_T_
+typedef _BSD_CLOCK_T_ clock_t;
+#undef _BSD_CLOCK_T_
+#endif
+
+#ifndef __ECOS
+#if 0 //def _BSD_SIZE_T_
+typedef _BSD_SIZE_T_ size_t;
+#undef _BSD_SIZE_T_
+#endif
+#endif
+
+#if 0 //def _BSD_SSIZE_T_
+typedef _BSD_SSIZE_T_ ssize_t;
+#undef _BSD_SSIZE_T_
+#endif
+
+#if 0 //def _BSD_TIME_T_
+typedef _BSD_TIME_T_ time_t;
+#undef _BSD_TIME_T_
+#endif
+
+#if 0 //def _BSD_CLOCKID_T_
+typedef _BSD_CLOCKID_T_ clockid_t;
+#undef _BSD_CLOCKID_T_
+#endif
+
+#if 0 //def _BSD_TIMER_T_
+typedef _BSD_TIMER_T_ timer_t;
+#undef _BSD_TIMER_T_
+#endif
+
+#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
+
+#if defined(__STDC__) && defined(_KERNEL)
+/*
+ * Forward structure declarations for function prototypes. We include the
+ * common structures that cross subsystem boundaries here; others are mostly
+ * used in the same place that the structure is defined.
+ */
+struct proc;
+struct pgrp;
+struct ucred;
+struct rusage;
+struct file;
+struct buf;
+struct tty;
+struct uio;
+#endif
+
+#endif /* !defined(_POSIX_SOURCE) ... */
+#endif /* !_SYS_TYPES_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/sys/cdefs.h b/ecos/packages/net/tcpip/current/include/sys/cdefs.h
new file mode 100644
index 0000000..c26bb31
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/sys/cdefs.h
@@ -0,0 +1,170 @@
+//==========================================================================
+//
+// include/sys/cdefs.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: cdefs.h,v 1.5 1996/09/27 17:34:44 maja Exp $ */
+/* $NetBSD: cdefs.h,v 1.16 1996/04/03 20:46:39 christos Exp $ */
+
+/*
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Berkeley Software Design, Inc.
+ *
+ * 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.
+ *
+ * @(#)cdefs.h 8.7 (Berkeley) 1/21/94
+ */
+
+#ifndef _SYS_CDEFS_H_
+#define _SYS_CDEFS_H_
+
+/*
+ * Gratuitous NetBSD gcc extensions we can do without.
+ */
+
+#ifdef __KPRINTF_ATTRIBUTE__
+#undef __KPRINTF_ATTRIBUTE__
+#endif
+
+#include <machine/cdefs.h>
+
+#if defined(__cplusplus)
+#define __BEGIN_DECLS extern "C" {
+#define __END_DECLS };
+#else
+#define __BEGIN_DECLS
+#define __END_DECLS
+#endif
+
+/*
+ * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
+ * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
+ * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
+ * in between its arguments. __CONCAT can also concatenate double-quoted
+ * strings produced by the __STRING macro, but this only works with ANSI C.
+ */
+#if defined(__STDC__) || defined(__cplusplus)
+#define __P(protos) protos /* full-blown ANSI C */
+#define __CONCAT(x,y) x ## y
+#define __STRING(x) #x
+
+#define __const const /* define reserved names to standard */
+#define __signed signed
+#define __volatile volatile
+#if defined(__cplusplus)
+#define __inline inline /* convert to C++ keyword */
+#else
+#if !defined(__GNUC__) && !defined(lint)
+#define __inline /* delete GCC keyword */
+#endif /* !__GNUC__ && !lint */
+#endif /* !__cplusplus */
+
+#else /* !(__STDC__ || __cplusplus) */
+#define __P(protos) () /* traditional C preprocessor */
+#define __CONCAT(x,y) x/**/y
+#define __STRING(x) "x"
+
+#if !defined(__GNUC__) && !defined(lint)
+#define __const /* delete pseudo-ANSI C keywords */
+#define __inline
+#define __signed
+#define __volatile
+#endif /* !__GNUC__ && !lint */
+
+/*
+ * In non-ANSI C environments, new programs will want ANSI-only C keywords
+ * deleted from the program and old programs will want them left alone.
+ * Programs using the ANSI C keywords const, inline etc. as normal
+ * identifiers should define -DNO_ANSI_KEYWORDS.
+ */
+#ifndef NO_ANSI_KEYWORDS
+#define const __const /* convert ANSI C keywords */
+#define inline __inline
+#define signed __signed
+#define volatile __volatile
+#endif /* !NO_ANSI_KEYWORDS */
+#endif /* !(__STDC__ || __cplusplus) */
+
+/*
+ * GCC1 and some versions of GCC2 declare dead (non-returning) and
+ * pure (no side effects) functions using "volatile" and "const";
+ * unfortunately, these then cause warnings under "-ansi -pedantic".
+ * GCC2 uses a new, peculiar __attribute__((attrs)) style. All of
+ * these work for GNU C++ (modulo a slight glitch in the C++ grammar
+ * in the distribution version of 2.5.5).
+ */
+#if !defined(__GNUC__) || __GNUC__ < 2 || \
+ (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
+#define __attribute__(x) /* delete __attribute__ if non-gcc or gcc1 */
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+#define __dead __volatile
+#define __pure __const
+#endif
+#endif
+
+#ifdef __KPRINTF_ATTRIBUTE__
+#define __kprintf_attribute__(a) __attribute__(a)
+#else
+#define __kprintf_attribute__(a)
+#endif
+
+/* Delete pseudo-keywords wherever they are not available or needed. */
+#ifndef __dead
+#define __dead
+#define __pure
+#endif
+
+#endif /* !_SYS_CDEFS_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/sys/domain.h b/ecos/packages/net/tcpip/current/include/sys/domain.h
new file mode 100644
index 0000000..e4062a4
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/sys/domain.h
@@ -0,0 +1,102 @@
+//==========================================================================
+//
+// include/sys/domain.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: domain.h,v 1.2 1996/03/03 12:11:38 niklas Exp $ */
+/* $NetBSD: domain.h,v 1.10 1996/02/09 18:25:07 christos Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * 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.
+ *
+ * @(#)domain.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _SYS_DOMAIN_H_
+#define _SYS_DOMAIN_H_
+
+/*
+ * Structure per communications domain.
+ */
+
+/*
+ * Forward structure declarations for function prototypes [sic].
+ */
+struct mbuf;
+
+struct domain {
+ int dom_family; /* AF_xxx */
+ char *dom_name;
+ void (*dom_init) /* initialize domain data structures */
+ __P((void));
+ int (*dom_externalize) /* externalize access rights */
+ __P((struct mbuf *));
+ void (*dom_dispose) /* dispose of internalized rights */
+ __P((struct mbuf *));
+ struct protosw *dom_protosw, *dom_protoswNPROTOSW;
+ struct domain *dom_next;
+ int (*dom_rtattach) /* initialize routing table */
+ __P((void **, int));
+ int dom_rtoffset; /* an arg to rtattach, in bits */
+ int dom_maxrtkey; /* for routing layer */
+};
+
+#ifdef _KERNEL
+struct domain *domains;
+void domaininit __P((void));
+#endif
+
+#endif // _SYS_DOMAIN_H_
diff --git a/ecos/packages/net/tcpip/current/include/sys/endian.h b/ecos/packages/net/tcpip/current/include/sys/endian.h
new file mode 100644
index 0000000..f11fd32
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/sys/endian.h
@@ -0,0 +1,222 @@
+//==========================================================================
+//
+// include/sys/endian.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: endian.h,v 1.4 1999/07/21 05:58:25 csapuntz Exp $ */
+
+/*-
+ * Copyright (c) 1997 Niklas Hallqvist. 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 Niklas Hallqvist.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+
+/*
+ * Generic definitions for little- and big-endian systems. Other endianesses
+ * has to be dealt with in the specific machine/endian.h file for that port.
+ *
+ * This file is meant to be included from a little- or big-endian port's
+ * machine/endian.h after setting BYTE_ORDER to either 1234 for little endian
+ * or 4321 for big..
+ */
+
+#ifndef _SYS_ENDIAN_H_
+#define _SYS_ENDIAN_H_
+
+#ifndef _POSIX_SOURCE
+
+#include <sys/cdefs.h>
+
+#define LITTLE_ENDIAN 1234
+
+
+#define BIG_ENDIAN 4321
+#define PDP_ENDIAN 3412
+
+#ifdef __GNUC__
+
+#define __swap16gen(x) ({ \
+ u_int16_t __swap16gen_x = (x); \
+ \
+ (u_int16_t)((__swap16gen_x & 0xff) << 8 | \
+ (__swap16gen_x & 0xff00) >> 8); \
+})
+
+#define __swap32gen(x) ({ \
+ u_int32_t __swap32gen_x = (x); \
+ \
+ (u_int32_t)((__swap32gen_x & 0xff) << 24 | \
+ (__swap32gen_x & 0xff00) << 8 | \
+ (__swap32gen_x & 0xff0000) >> 8 | \
+ (__swap32gen_x & 0xff000000) >> 24); \
+})
+
+#else /* __GNUC__ */
+
+/* Note that these macros evaluate their arguments several times. */
+#define __swap16gen(x) \
+ (u_int16_t)(((u_int16_t)(x) & 0xff) << 8 | ((u_int16_t)(x) & 0xff00) >> 8)
+
+#define __swap32gen(x) \
+ (u_int32_t)(((u_int32_t)(x) & 0xff) << 24 | \
+ ((u_int32_t)(x) & 0xff00) << 8 | ((u_int32_t)(x) & 0xff0000) >> 8 | \
+ ((u_int32_t)(x) & 0xff000000) >> 24)
+
+#endif /* __GNUC__ */
+
+/*
+ * Define MD_SWAP if you provide swap{16,32}md functions/macros that are
+ * optimized for your architecture, These will be used for swap{16,32}
+ * unless the argument is a constant and we are using GCC, where we can
+ * take advantage of the CSE phase much better by using the generic version.
+ */
+#ifdef MD_SWAP
+#if __GNUC__
+
+#define swap16(x) ({ \
+ u_int16_t __swap16_x = (x); \
+ \
+ __builtin_constant_p(x) ? __swap16gen(__swap16_x) : \
+ __swap16md(__swap16_x); \
+})
+
+#define swap32(x) ({ \
+ u_int32_t __swap32_x = (x); \
+ \
+ __builtin_constant_p(x) ? __swap32gen(__swap32_x) : \
+ __swap32md(__swap32_x); \
+})
+
+#endif /* __GNUC__ */
+
+#else /* MD_SWAP */
+#define swap16 __swap16gen
+#define swap32 __swap32gen
+#endif /* MD_SWAP */
+
+#define swap16_multi(v, n) do { \
+ size_t __swap16_multi_n = (n); \
+ u_int16_t *__swap16_multi_v = (v); \
+ \
+ while (__swap16_multi_n) { \
+ *__swap16_multi_v = swap16(*__swap16_multi_v); \
+ __swap16_multi_v++; \
+ __swap16_multi_n--; \
+ } \
+} while (0)
+
+__BEGIN_DECLS
+u_int32_t htobe32 __P((u_int32_t));
+u_int16_t htobe16 __P((u_int16_t));
+u_int32_t betoh32 __P((u_int32_t));
+u_int16_t betoh16 __P((u_int16_t));
+
+u_int32_t htole32 __P((u_int32_t));
+u_int16_t htole16 __P((u_int16_t));
+u_int32_t letoh32 __P((u_int32_t));
+u_int16_t letoh16 __P((u_int16_t));
+__END_DECLS
+
+#if BYTE_ORDER == LITTLE_ENDIAN
+
+/* Can be overridden by machine/endian.h before inclusion of this file. */
+#ifndef _QUAD_HIGHWORD
+#define _QUAD_HIGHWORD 1
+#endif
+#ifndef _QUAD_LOWWORD
+#define _QUAD_LOWWORD 0
+#endif
+
+#define htobe16 swap16
+#define htobe32 swap32
+#define betoh16 swap16
+#define betoh32 swap32
+
+#define htole16(x) (x)
+#define htole32(x) (x)
+#define letoh16(x) (x)
+#define letoh32(x) (x)
+
+#endif /* BYTE_ORDER */
+
+#if BYTE_ORDER == BIG_ENDIAN
+
+/* Can be overridden by machine/endian.h before inclusion of this file. */
+#ifndef _QUAD_HIGHWORD
+#define _QUAD_HIGHWORD 0
+#endif
+#ifndef _QUAD_LOWWORD
+#define _QUAD_LOWWORD 1
+#endif
+
+#define htole16 swap16
+#define htole32 swap32
+#define letoh16 swap16
+#define letoh32 swap32
+
+#define htobe16(x) (x)
+#define htobe32(x) (x)
+#define betoh16(x) (x)
+#define betoh32(x) (x)
+
+#endif /* BYTE_ORDER */
+
+#define htons htobe16
+#define htonl htobe32
+#define ntohs betoh16
+#define ntohl betoh32
+
+#define NTOHL(x) (x) = ntohl((u_int32_t)(x))
+#define NTOHS(x) (x) = ntohs((u_int16_t)(x))
+#define HTONL(x) (x) = htonl((u_int32_t)(x))
+#define HTONS(x) (x) = htons((u_int16_t)(x))
+
+#endif /* _POSIX_SOURCE */
+#endif /* _SYS_ENDIAN_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/sys/errno.h b/ecos/packages/net/tcpip/current/include/sys/errno.h
new file mode 100644
index 0000000..3c15f86
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/sys/errno.h
@@ -0,0 +1,30 @@
+//==========================================================================
+//
+// include/sys/errno.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+// Just another name for the standard file
+#include <errno.h>
diff --git a/ecos/packages/net/tcpip/current/include/sys/ioccom.h b/ecos/packages/net/tcpip/current/include/sys/ioccom.h
new file mode 100644
index 0000000..76f8eb6
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/sys/ioccom.h
@@ -0,0 +1,103 @@
+//==========================================================================
+//
+// include/sys/ioccom.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ioccom.h,v 1.2 1996/03/03 12:11:49 niklas Exp $ */
+/* $NetBSD: ioccom.h,v 1.4 1994/10/30 21:49:56 cgd Exp $ */
+
+/*-
+ * Copyright (c) 1982, 1986, 1990, 1993, 1994
+ * 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.
+ *
+ * @(#)ioccom.h 8.2 (Berkeley) 3/28/94
+ */
+
+#ifndef _SYS_IOCCOM_H_
+#define _SYS_IOCCOM_H_
+
+/*
+ * Ioctl's have the command encoded in the lower word, and the size of
+ * any in or out parameters in the upper word. The high 3 bits of the
+ * upper word are used to encode the in/out status of the parameter.
+ */
+#define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */
+#define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK)
+#define IOCBASECMD(x) ((x) & ~(IOCPARM_MASK << 16))
+#define IOCGROUP(x) (((x) >> 8) & 0xff)
+
+#ifndef __ECOS
+#define IOCPARM_MAX NBPG /* max size of ioctl args, mult. of NBPG */
+#endif
+ /* no parameters */
+#define IOC_VOID (unsigned long)0x20000000
+ /* copy parameters out */
+#define IOC_OUT (unsigned long)0x40000000
+ /* copy parameters in */
+#define IOC_IN (unsigned long)0x80000000
+ /* copy paramters in and out */
+#define IOC_INOUT (IOC_IN|IOC_OUT)
+ /* mask for IN/OUT/VOID */
+#define IOC_DIRMASK (unsigned long)0xe0000000
+
+#define _IOC(inout,group,num,len) \
+ (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))
+#define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0)
+#define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t))
+#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t))
+/* this should be _IORW, but stdio got there first */
+#define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t))
+
+#endif /* !_SYS_IOCCOM_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/sys/ioctl.h b/ecos/packages/net/tcpip/current/include/sys/ioctl.h
new file mode 100644
index 0000000..15ee2f8
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/sys/ioctl.h
@@ -0,0 +1,122 @@
+//==========================================================================
+//
+// include/sys/ioctl.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: ioctl.h,v 1.3 1996/03/03 12:11:50 niklas Exp $ */
+/* $NetBSD: ioctl.h,v 1.20 1996/01/30 18:21:47 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 1982, 1986, 1990, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * 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.
+ *
+ * @(#)ioctl.h 8.6 (Berkeley) 3/28/94
+ */
+
+#ifndef _SYS_IOCTL_H_
+#define _SYS_IOCTL_H_
+
+#ifndef __ECOS
+#include <sys/ttycom.h>
+
+/*
+ * Pun for SunOS prior to 3.2. SunOS 3.2 and later support TIOCGWINSZ
+ * and TIOCSWINSZ (yes, even 3.2-3.5, the fact that it wasn't documented
+ * nonwithstanding).
+ */
+struct ttysize {
+ unsigned short ts_lines;
+ unsigned short ts_cols;
+ unsigned short ts_xxx;
+ unsigned short ts_yyy;
+};
+#define TIOCGSIZE TIOCGWINSZ
+#define TIOCSSIZE TIOCSWINSZ
+#endif
+
+#include <sys/ioccom.h>
+
+#ifndef __ECOS
+#include <sys/dkio.h>
+#include <sys/filio.h>
+#endif
+#include <sys/sockio.h>
+
+#ifndef _KERNEL
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int ioctl __P((int, unsigned long, ...));
+__END_DECLS
+#endif /* !_KERNEL */
+#endif /* !_SYS_IOCTL_H_ */
+
+/*
+ * Keep outside _SYS_IOCTL_H_
+ * Compatability with old terminal driver
+ *
+ * Source level -> #define USE_OLD_TTY
+ * Kernel level -> options COMPAT_43 or COMPAT_SUNOS or ...
+ */
+#if defined(USE_OLD_TTY) || defined(COMPAT_43) || defined(COMPAT_SUNOS) || \
+ defined(COMPAT_SVR4) || defined(COMPAT_FREEBSD)
+#include <sys/ioctl_compat.h>
+#endif
diff --git a/ecos/packages/net/tcpip/current/include/sys/kernel.h b/ecos/packages/net/tcpip/current/include/sys/kernel.h
new file mode 100644
index 0000000..ef28665
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/sys/kernel.h
@@ -0,0 +1,101 @@
+//==========================================================================
+//
+// include/sys/kernel.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: kernel.h,v 1.5 1996/08/11 20:39:07 niklas Exp $ */
+/* $NetBSD: kernel.h,v 1.11 1995/03/03 01:24:16 cgd Exp $ */
+
+/*-
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * 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.
+ *
+ * @(#)kernel.h 8.3 (Berkeley) 1/21/94
+ */
+
+/* Global variables for the kernel. */
+
+/* 1.1 */
+extern long hostid;
+extern char hostname[MAXHOSTNAMELEN];
+extern int hostnamelen;
+extern char domainname[MAXHOSTNAMELEN];
+extern int domainnamelen;
+
+/* 1.2 */
+extern volatile struct timeval mono_time;
+extern struct timeval boottime;
+extern struct timeval runtime;
+extern volatile struct timeval ktime;
+#define time ktime
+extern struct timezone tz; /* XXX */
+
+extern int tick; /* usec per tick (1000000 / hz) */
+extern int tickfix; /* periodic tick adj. tick not integral */
+extern int tickfixinterval; /* interval at which to apply adjustment */
+extern int tickadj; /* "standard" clock skew, us./tick */
+extern int hz; /* system clock's frequency */
+extern int stathz; /* statistics clock's frequency */
+extern int profhz; /* profiling clock's frequency */
+extern int lbolt; /* once a second sleep address */
+extern int tickdelta;
+extern long timedelta;
+
+
diff --git a/ecos/packages/net/tcpip/current/include/sys/malloc.h b/ecos/packages/net/tcpip/current/include/sys/malloc.h
new file mode 100644
index 0000000..98054bd
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/sys/malloc.h
@@ -0,0 +1,469 @@
+//==========================================================================
+//
+// include/sys/malloc.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: malloc.h,v 1.27 1999/12/08 06:50:24 itojun Exp $ */
+/* $NetBSD: malloc.h,v 1.39 1998/07/12 19:52:01 augustss Exp $ */
+
+/*
+ * Copyright (c) 1987, 1993
+ * 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.
+ *
+ * @(#)malloc.h 8.5 (Berkeley) 5/3/95
+ */
+
+#ifndef _SYS_MALLOC_H_
+#define _SYS_MALLOC_H_
+
+/*
+ * flags to malloc
+ */
+#define M_WAITOK 0x0000
+#define M_NOWAIT 0x0001
+
+/*
+ * Types of memory to be allocated
+ */
+#define M_FREE 0 /* should be on free list */
+#define M_MBUF 1 /* mbuf */
+#define M_DEVBUF 2 /* device driver memory */
+#define M_SOCKET 3 /* socket structure */
+#define M_PCB 4 /* protocol control block */
+#define M_RTABLE 5 /* routing tables */
+#define M_HTABLE 6 /* IMP host tables */
+#define M_FTABLE 7 /* fragment reassembly header */
+#define M_ZOMBIE 8 /* zombie proc status */
+#define M_IFADDR 9 /* interface address */
+#define M_SOOPTS 10 /* socket options */
+#define M_SONAME 11 /* socket name */
+#define M_NAMEI 12 /* namei path name buffer */
+#define M_GPROF 13 /* kernel profiling buffer */
+#define M_IOCTLOPS 14 /* ioctl data buffer */
+#define M_MAPMEM 15 /* mapped memory descriptors */
+#define M_CRED 16 /* credentials */
+#define M_PGRP 17 /* process group header */
+#define M_SESSION 18 /* session header */
+#define M_IOV 19 /* large iov's */
+#define M_MOUNT 20 /* vfs mount struct */
+#define M_FHANDLE 21 /* network file handle */
+#define M_NFSREQ 22 /* NFS request header */
+#define M_NFSMNT 23 /* NFS mount structure */
+#define M_NFSNODE 24 /* NFS vnode private part */
+#define M_VNODE 25 /* Dynamically allocated vnodes */
+#define M_CACHE 26 /* Dynamically allocated cache entries */
+#define M_DQUOT 27 /* UFS quota entries */
+#define M_UFSMNT 28 /* UFS mount structure */
+#define M_SHM 29 /* SVID compatible shared memory segments */
+#define M_VMMAP 30 /* VM map structures */
+#define M_VMMAPENT 31 /* VM map entry structures */
+#define M_VMOBJ 32 /* VM object structure */
+#define M_VMOBJHASH 33 /* VM object hash structure */
+#define M_VMPMAP 34 /* VM pmap */
+#define M_VMPVENT 35 /* VM phys-virt mapping entry */
+#define M_VMPAGER 36 /* XXX: VM pager struct */
+#define M_VMPGDATA 37 /* XXX: VM pager private data */
+#define M_FILE 38 /* Open file structure */
+#define M_FILEDESC 39 /* Open file descriptor table */
+#define M_LOCKF 40 /* Byte-range locking structures */
+#define M_PROC 41 /* Proc structures */
+#define M_SUBPROC 42 /* Proc sub-structures */
+#define M_SEGMENT 43 /* Segment for LFS */
+#define M_LFSNODE 44 /* LFS vnode private part */
+#define M_FFSNODE 45 /* FFS vnode private part */
+#define M_MFSNODE 46 /* MFS vnode private part */
+#define M_NQLEASE 47 /* Nqnfs lease */
+#define M_NQMHOST 48 /* Nqnfs host address table */
+#define M_NETADDR 49 /* Export host address structure */
+#define M_NFSSVC 50 /* Nfs server structure */
+#define M_NFSUID 51 /* Nfs uid mapping structure */
+#define M_NFSD 52 /* Nfs server daemon structure */
+#define M_IPMOPTS 53 /* internet multicast options */
+#define M_IPMADDR 54 /* internet multicast address */
+#define M_IFMADDR 55 /* link-level multicast address */
+#define M_MRTABLE 56 /* multicast routing tables */
+#define M_ISOFSMNT 57 /* ISOFS mount structure */
+#define M_ISOFSNODE 58 /* ISOFS vnode private part */
+#define M_MSDOSFSMNT 59 /* MSDOS FS mount structure */
+#define M_MSDOSFSFAT 60 /* MSDOS FS fat table */
+#define M_MSDOSFSNODE 61 /* MSDOS FS vnode private part */
+#define M_TTYS 62 /* allocated tty structures */
+#define M_EXEC 63 /* argument lists & other mem used by exec */
+#define M_MISCFSMNT 64 /* miscfs mount structures */
+#define M_MISCFSNODE 65 /* miscfs vnode private part */
+#define M_ADOSFSMNT 66 /* adosfs mount structures */
+#define M_ADOSFSNODE 67 /* adosfs vnode private part */
+#define M_ANODE 68 /* adosfs anode structures and tables. */
+#define M_IPQ 69 /* IP packet queue entry */
+#define M_AFS 70 /* Andrew File System */
+#define M_ADOSFSBITMAP 71 /* adosfs bitmap */
+#define M_EXT2FSNODE 72 /* EXT2FS vnode private part */
+#define M_PFIL 73 /* packer filter */
+#define M_PFKEY 74 /* pfkey data */
+#define M_TDB 75 /* Transforms database */
+#define M_XDATA 76 /* IPsec data */
+#define M_VFS 77 /* VFS file systems */
+
+#define M_PAGEDEP 78 /* File page dependencies */
+#define M_INODEDEP 79 /* Inode dependencies */
+#define M_NEWBLK 80 /* New block allocation */
+#define M_BMSAFEMAP 81 /* Block or frag allocated from cyl group map */
+#define M_ALLOCDIRECT 82 /* Block or frag dependency for an inode */
+#define M_INDIRDEP 83 /* Indirect block dependencies */
+#define M_ALLOCINDIR 84 /* Block dependency for an indirect block */
+#define M_FREEFRAG 85 /* Previously used frag for an inode */
+#define M_FREEBLKS 86 /* Blocks freed from an inode */
+#define M_FREEFILE 87 /* Inode deallocated */
+#define M_DIRADD 88 /* New directory entry */
+#define M_MKDIR 89 /* New directory */
+#define M_DIRREM 90 /* Directory entry deleted */
+#define M_VMPBUCKET 91 /* VM page buckets */
+#define M_VMSWAP 92 /* VM swap structures */
+
+#define M_DISCQ 93 /* IPv6 discq */
+#define M_FRAGQ 94 /* IPv6 fragq */
+#define M_SECA 95 /* Sec Assoc */
+#if 0 /* NRL IPv6 */
+#define M_I6IFP 96 /* IPv6 if info */
+#endif
+
+#define M_RAIDFRAME 97 /* Raidframe data */
+
+#define M_UVMAMAP 98 /* UVM amap and realted */
+#define M_UVMAOBJ 99 /* UVM aobj and realted */
+#define M_POOL 100 /* Pool memory */
+
+#define M_USB 101 /* USB general */
+#define M_USBDEV 102 /* USB device driver */
+#define M_USBHC 103 /* USB host controller */
+
+
+/* KAME IPv6 */
+#define M_IP6OPT 123 /* IPv6 options */
+#define M_IP6NDP 124 /* IPv6 Neighbour Discovery */
+#define M_IP6RR 125 /* IPv6 Router Renumbering Prefix */
+#define M_RR_ADDR 126 /* IPv6 Router Renumbering Ifid */
+
+#define M_PIPE 104 /* Pipe structures */
+
+#define M_MEMDESC 105 /* Memory range */
+
+#define M_TEMP 127 /* misc temporary data buffers */
+#define M_LAST 128 /* Must be last type + 1 */
+
+
+#define INITKMEMNAMES { \
+ "free", /* 0 M_FREE */ \
+ "mbuf", /* 1 M_MBUF */ \
+ "devbuf", /* 2 M_DEVBUF */ \
+ "socket", /* 3 M_SOCKET */ \
+ "pcb", /* 4 M_PCB */ \
+ "routetbl", /* 5 M_RTABLE */ \
+ "hosttbl", /* 6 M_HTABLE */ \
+ "fragtbl", /* 7 M_FTABLE */ \
+ "zombie", /* 8 M_ZOMBIE */ \
+ "ifaddr", /* 9 M_IFADDR */ \
+ "soopts", /* 10 M_SOOPTS */ \
+ "soname", /* 11 M_SONAME */ \
+ "namei", /* 12 M_NAMEI */ \
+ "gprof", /* 13 M_GPROF */ \
+ "ioctlops", /* 14 M_IOCTLOPS */ \
+ "mapmem", /* 15 M_MAPMEM */ \
+ "cred", /* 16 M_CRED */ \
+ "pgrp", /* 17 M_PGRP */ \
+ "session", /* 18 M_SESSION */ \
+ "iov", /* 19 M_IOV */ \
+ "mount", /* 20 M_MOUNT */ \
+ "fhandle", /* 21 M_FHANDLE */ \
+ "NFS req", /* 22 M_NFSREQ */ \
+ "NFS mount", /* 23 M_NFSMNT */ \
+ "NFS node", /* 24 M_NFSNODE */ \
+ "vnodes", /* 25 M_VNODE */ \
+ "namecache", /* 26 M_CACHE */ \
+ "UFS quota", /* 27 M_DQUOT */ \
+ "UFS mount", /* 28 M_UFSMNT */ \
+ "shm", /* 29 M_SHM */ \
+ "VM map", /* 30 M_VMMAP */ \
+ "VM mapent", /* 31 M_VMMAPENT */ \
+ "VM object", /* 32 M_VMOBJ */ \
+ "VM objhash", /* 33 M_VMOBJHASH */ \
+ "VM pmap", /* 34 M_VMPMAP */ \
+ "VM pvmap", /* 35 M_VMPVENT */ \
+ "VM pager", /* 36 M_VMPAGER */ \
+ "VM pgdata", /* 37 M_VMPGDATA */ \
+ "file", /* 38 M_FILE */ \
+ "file desc", /* 39 M_FILEDESC */ \
+ "lockf", /* 40 M_LOCKF */ \
+ "proc", /* 41 M_PROC */ \
+ "subproc", /* 42 M_SUBPROC */ \
+ "LFS segment", /* 43 M_SEGMENT */ \
+ "LFS node", /* 44 M_LFSNODE */ \
+ "FFS node", /* 45 M_FFSNODE */ \
+ "MFS node", /* 46 M_MFSNODE */ \
+ "NQNFS Lease", /* 47 M_NQLEASE */ \
+ "NQNFS Host", /* 48 M_NQMHOST */ \
+ "Export Host", /* 49 M_NETADDR */ \
+ "NFS srvsock", /* 50 M_NFSSVC */ \
+ "NFS uid", /* 51 M_NFSUID */ \
+ "NFS daemon", /* 52 M_NFSD */ \
+ "ip_moptions", /* 53 M_IPMOPTS */ \
+ "in_multi", /* 54 M_IPMADDR */ \
+ "ether_multi", /* 55 M_IFMADDR */ \
+ "mrt", /* 56 M_MRTABLE */ \
+ "ISOFS mount", /* 57 M_ISOFSMNT */ \
+ "ISOFS node", /* 58 M_ISOFSNODE */ \
+ "MSDOSFS mount", /* 59 M_MSDOSFSMNT */ \
+ "MSDOSFS fat", /* 60 M_MSDOSFSFAT */ \
+ "MSDOSFS node", /* 61 M_MSDOSFSNODE */ \
+ "ttys", /* 62 M_TTYS */ \
+ "exec", /* 63 M_EXEC */ \
+ "miscfs mount", /* 64 M_MISCFSMNT */ \
+ "miscfs node", /* 65 M_MISCFSNODE */ \
+ "adosfs mount", /* 66 M_ADOSFSMNT */ \
+ "adosfs node", /* 67 M_ADOSFSNODE */ \
+ "adosfs anode", /* 68 M_ANODE */ \
+ "IP queue ent", /* 69 M_IPQ */ \
+ "afs", /* 70 M_AFS */ \
+ "adosfs bitmap", /* 71 M_ADOSFSBITMAP */ \
+ "EXT2FS node", /* 72 M_EXT2FSNODE */ \
+ "pfil", /* 73 M_PFIL */ \
+ "pfkey data", /* 74 M_PFKEY */ \
+ "tdb", /* 75 M_TDB */ \
+ "xform_data", /* 76 M_XDATA */ \
+ "vfs", /* 77 M_VFS */ \
+ "pagedep", /* 78 M_PAGEDEP */ \
+ "inodedep", /* 79 M_INODEDEP */ \
+ "newblk", /* 80 M_NEWBLK */ \
+ "bmsafemap", /* 81 M_BMSAFEMAP */ \
+ "allocdirect", /* 82 M_ALLOCDIRECT */ \
+ "indirdep", /* 83 M_INDIRDEP */ \
+ "allocindir", /* 84 M_ALLOCINDIR */ \
+ "freefrag", /* 85 M_FREEFRAG */ \
+ "freeblks", /* 86 M_FREEBLKS */ \
+ "freefile", /* 87 M_FREEFILE */ \
+ "diradd", /* 88 M_DIRADD */ \
+ "mkdir", /* 89 M_MKDIR */ \
+ "dirrem", /* 90 M_DIRREM */ \
+ "VM page bucket", /* 91 M_VMPBUCKET */ \
+ "VM swap", /* 92 M_VMSWAP */ \
+ "IPv6 discq", /* 93 M_DISCQ */ \
+ "IPv6 fragq", /* 94 M_FRAGQ */ \
+ "Sec Assoc", /* 95 M_SECA */ \
+ "IPv6 if info", /* 96 M_I6IFP */ \
+ "RaidFrame data", /* 97 M_RAIDFRAME */ \
+ "UVM amap", /* 98 M_UVMAMAP */ \
+ "UVM aobj", /* 99 M_UVMAOBJ */ \
+ "pool", /* 100 M_POOL */ \
+ "USB", /* 101 M_USB */ \
+ "USB device", /* 102 M_USBDEV */ \
+ "USB HC", /* 103 M_USBHC */ \
+ "pipe", /* 104 M_PIPE */ \
+ "memdesc", /* 105 M_MEMDESC */ \
+ NULL, \
+ NULL, NULL, NULL, NULL, NULL, \
+ NULL, NULL, NULL, NULL, NULL, \
+ NULL, NULL, NULL, NULL, NULL, \
+ NULL, \
+ "ip6_options", /* 123 M_IP6OPT */ \
+ "NDP", /* 124 M_IP6NDP */ \
+ "ip6rr", /* 125 M_IP6RR */ \
+ "rp_addr", /* 126 M_RR_ADDR */ \
+ "temp", /* 127 M_TEMP */ \
+}
+
+#ifndef __ECOS
+struct kmemstats {
+ long ks_inuse; /* # of packets of this type currently in use */
+ long ks_calls; /* total packets of this type ever allocated */
+ long ks_memuse; /* total memory held in bytes */
+ u_short ks_limblocks; /* number of times blocked for hitting limit */
+ u_short ks_mapblocks; /* number of times blocked for kernel map */
+ long ks_maxused; /* maximum number ever used */
+ long ks_limit; /* most that are allowed to exist */
+ long ks_size; /* sizes of this thing that are allocated */
+ long ks_spare;
+};
+
+/*
+ * Array of descriptors that describe the contents of each page
+ */
+struct kmemusage {
+ short ku_indx; /* bucket index */
+ union {
+ u_short freecnt;/* for small allocations, free pieces in page */
+ u_short pagecnt;/* for large allocations, pages alloced */
+ } ku_un;
+};
+#define ku_freecnt ku_un.freecnt
+#define ku_pagecnt ku_un.pagecnt
+
+/*
+ * Set of buckets for each size of memory block that is retained
+ */
+struct kmembuckets {
+ caddr_t kb_next; /* list of free blocks */
+ caddr_t kb_last; /* last free block */
+ long kb_calls; /* total calls to allocate this size */
+ long kb_total; /* total number of blocks allocated */
+ long kb_totalfree; /* # of free elements in this bucket */
+ long kb_elmpercl; /* # of elements in this sized allocation */
+ long kb_highwat; /* high water mark */
+ long kb_couldfree; /* over high water mark and could free */
+};
+
+#ifdef _KERNEL
+#define MINALLOCSIZE (1 << MINBUCKET)
+#define BUCKETINDX(size) \
+ ((size) <= (MINALLOCSIZE * 128) \
+ ? (size) <= (MINALLOCSIZE * 8) \
+ ? (size) <= (MINALLOCSIZE * 2) \
+ ? (size) <= (MINALLOCSIZE * 1) \
+ ? (MINBUCKET + 0) \
+ : (MINBUCKET + 1) \
+ : (size) <= (MINALLOCSIZE * 4) \
+ ? (MINBUCKET + 2) \
+ : (MINBUCKET + 3) \
+ : (size) <= (MINALLOCSIZE* 32) \
+ ? (size) <= (MINALLOCSIZE * 16) \
+ ? (MINBUCKET + 4) \
+ : (MINBUCKET + 5) \
+ : (size) <= (MINALLOCSIZE * 64) \
+ ? (MINBUCKET + 6) \
+ : (MINBUCKET + 7) \
+ : (size) <= (MINALLOCSIZE * 2048) \
+ ? (size) <= (MINALLOCSIZE * 512) \
+ ? (size) <= (MINALLOCSIZE * 256) \
+ ? (MINBUCKET + 8) \
+ : (MINBUCKET + 9) \
+ : (size) <= (MINALLOCSIZE * 1024) \
+ ? (MINBUCKET + 10) \
+ : (MINBUCKET + 11) \
+ : (size) <= (MINALLOCSIZE * 8192) \
+ ? (size) <= (MINALLOCSIZE * 4096) \
+ ? (MINBUCKET + 12) \
+ : (MINBUCKET + 13) \
+ : (size) <= (MINALLOCSIZE * 16384) \
+ ? (MINBUCKET + 14) \
+ : (MINBUCKET + 15))
+
+/*
+ * Turn virtual addresses into kmem map indicies
+ */
+#define kmemxtob(alloc) (kmembase + (alloc) * NBPG)
+#define btokmemx(addr) (((caddr_t)(addr) - kmembase) / NBPG)
+#define btokup(addr) (&kmemusage[((caddr_t)(addr) - kmembase) >> CLSHIFT])
+
+/*
+ * Macro versions for the usual cases of malloc/free
+ */
+#if defined(KMEMSTATS) || defined(DIAGNOSTIC) || defined(_LKM)
+#define MALLOC(space, cast, size, type, flags) \
+ (space) = (cast)malloc((u_long)(size), type, flags)
+#define FREE(addr, type) free((caddr_t)(addr), type)
+
+#else /* do not collect statistics */
+#define MALLOC(space, cast, size, type, flags) do { \
+ register struct kmembuckets *kbp = &bucket[BUCKETINDX(size)]; \
+ long s = splimp(); \
+ if (kbp->kb_next == NULL) { \
+ (space) = (cast)malloc((u_long)(size), type, flags); \
+ } else { \
+ (space) = (cast)kbp->kb_next; \
+ kbp->kb_next = *(caddr_t *)(space); \
+ } \
+ splx(s); \
+} while (0)
+
+#define FREE(addr, type) do { \
+ register struct kmembuckets *kbp; \
+ register struct kmemusage *kup = btokup(addr); \
+ long s = splimp(); \
+ if (1 << kup->ku_indx > MAXALLOCSAVE) { \
+ free((caddr_t)(addr), type); \
+ } else { \
+ kbp = &bucket[kup->ku_indx]; \
+ if (kbp->kb_next == NULL) \
+ kbp->kb_next = (caddr_t)(addr); \
+ else \
+ *(caddr_t *)(kbp->kb_last) = (caddr_t)(addr); \
+ *(caddr_t *)(addr) = NULL; \
+ kbp->kb_last = (caddr_t)(addr); \
+ } \
+ splx(s); \
+} while(0)
+#endif /* do not collect statistics */
+
+extern struct kmemstats kmemstats[];
+extern struct kmemusage *kmemusage;
+extern char *kmembase;
+extern struct kmembuckets bucket[];
+
+extern void *malloc __P((unsigned long size, int type, int flags));
+extern void free __P((void *addr, int type));
+
+#endif /* _KERNEL */
+#endif // __ECOS
+
+#if defined(__ECOS) && defined(_KERNEL)
+extern void *cyg_net_malloc(u_long size, int type, int flags);
+extern void cyg_net_free(caddr_t addr, int type);
+#define MALLOC(space, cast, size, type, flags) \
+ (space) = (cast)cyg_net_malloc((u_long)(size), type, flags)
+#define malloc(size, type, flags) cyg_net_malloc((u_long)size, type, flags)
+#define FREE(addr, type) cyg_net_free((caddr_t)(addr), type)
+#define free(addr, type) FREE(addr, type)
+#endif
+
+#endif /* !_SYS_MALLOC_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/sys/mbuf.h b/ecos/packages/net/tcpip/current/include/sys/mbuf.h
new file mode 100644
index 0000000..2ca6bee
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/sys/mbuf.h
@@ -0,0 +1,473 @@
+//==========================================================================
+//
+// include/sys/mbuf.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: mbuf.h,v 1.14 1999/12/08 06:50:24 itojun Exp $ */
+/* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1988, 1993
+ * 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.
+ *
+ * @(#)mbuf.h 8.5 (Berkeley) 2/19/95
+ */
+
+#ifndef _SYS_MBUF_H_
+#define _SYS_MBUF_H_
+
+#ifndef M_WAITOK
+#include <sys/malloc.h>
+#endif
+
+/*
+ * Mbufs are of a single size, MSIZE (machine/param.h), which
+ * includes overhead. An mbuf may add a single "mbuf cluster" of size
+ * MCLBYTES (also in machine/param.h), which has no additional overhead
+ * and is used instead of the internal data area; this is done when
+ * at least MINCLSIZE of data must be stored.
+ */
+
+#define MLEN (MSIZE - sizeof(struct m_hdr)) /* normal data len */
+#define MHLEN (MLEN - sizeof(struct pkthdr)) /* data len w/pkthdr */
+
+#define MINCLSIZE (MHLEN + 1) /* smallest amount to put in cluster */
+#define M_MAXCOMPRESS (MHLEN / 2) /* max amount to copy for compression */
+
+/*
+ * Macros for type conversion
+ * mtod(m,t) - convert mbuf pointer to data pointer of correct type
+ * dtom(x) - convert data pointer within mbuf to mbuf pointer (XXX)
+ * mtocl(x) - convert pointer within cluster to cluster index #
+ * cltom(x) - convert cluster # to ptr to beginning of cluster
+ */
+#define mtod(m,t) ((t)((m)->m_data))
+#define dtom(x) ((struct mbuf *)((long)(x) & ~(MSIZE-1)))
+#ifdef __ECOS
+extern int cyg_mtocl(u_long);
+extern struct mbuf *cyg_cltom(u_long);
+#define mtocl(x) cyg_mtocl((u_long)x)
+#define cltom(x) cyg_cltom((u_long)x)
+#else
+#define mtocl(x) (((u_long)(x) - (u_long)mbutl) >> MCLSHIFT)
+#define cltom(x) ((caddr_t)((u_long)mbutl + ((u_long)(x) << MCLSHIFT)))
+#endif
+
+/* header at beginning of each mbuf: */
+struct m_hdr {
+ struct mbuf *mh_next; /* next buffer in chain */
+ struct mbuf *mh_nextpkt; /* next chain in queue/record */
+ caddr_t mh_data; /* location of data */
+ u_int mh_len; /* amount of data in this mbuf */
+ short mh_type; /* type of data in this mbuf */
+ short mh_flags; /* flags; see below */
+};
+
+/* record/packet header in first mbuf of chain; valid if M_PKTHDR set */
+struct pkthdr {
+ struct ifnet *rcvif; /* rcv interface */
+ int len; /* total packet length */
+ void *tdbi; /* pointer to struct tdb_ident */
+ /* XXX - pull in ip_ipsp.h */
+};
+
+/* description of external storage mapped into mbuf, valid if M_EXT set */
+struct m_ext {
+ caddr_t ext_buf; /* start of buffer */
+ void (*ext_free) /* free routine if not the usual */
+ __P((struct mbuf *));
+ u_int ext_size; /* size of buffer, for ext_free */
+ void (*ext_ref) /* add a reference to the ext object */
+ __P((struct mbuf *));
+ void *ext_handle; /* handle for storage manager */
+};
+
+struct mbuf {
+ struct m_hdr m_hdr;
+ union {
+ struct {
+ struct pkthdr MH_pkthdr; /* M_PKTHDR set */
+ union {
+ struct m_ext MH_ext; /* M_EXT set */
+ char MH_databuf[MHLEN];
+ } MH_dat;
+ } MH;
+ char M_databuf[MLEN]; /* !M_PKTHDR, !M_EXT */
+ } M_dat;
+};
+#define m_next m_hdr.mh_next
+#define m_len m_hdr.mh_len
+#define m_data m_hdr.mh_data
+#define m_type m_hdr.mh_type
+#define m_flags m_hdr.mh_flags
+#define m_nextpkt m_hdr.mh_nextpkt
+#define m_act m_nextpkt
+#define m_pkthdr M_dat.MH.MH_pkthdr
+#define m_ext M_dat.MH.MH_dat.MH_ext
+#define m_pktdat M_dat.MH.MH_dat.MH_databuf
+#define m_dat M_dat.M_databuf
+
+/* mbuf flags */
+#define M_EXT 0x0001 /* has associated external storage */
+#define M_PKTHDR 0x0002 /* start of record */
+#define M_EOR 0x0004 /* end of record */
+
+/* mbuf pkthdr flags, also in m_flags */
+#define M_BCAST 0x0100 /* send/received as link-level broadcast */
+#define M_MCAST 0x0200 /* send/received as link-level multicast */
+#define M_CONF 0x0400 /* packet was encrypted (ESP-transport) */
+#define M_AUTH 0x0800 /* packet was authenticated (AH) */
+#if 0 /* NRL IPv6 */
+#define M_TUNNEL 0x1000 /* packet was tunneled */
+#define M_DAD 0x2000 /* Used on outbound packets to indicate that
+ * this is for duplicate address detection */
+#endif
+
+/* KAME IPv6 */
+#define M_ANYCAST6 0x4000 /* received as IPv6 anycast */
+#if 0 /*KAME IPSEC*/
+#define M_AUTHIPHDR 0x0010 /* data origin authentication for IP header */
+#define M_DECRYPTED 0x0020 /* confidentiality */
+#endif
+#define M_LOOP 0x0040 /* for Mbuf statistics */
+#if 0 /*KAME IPSEC*/
+#define M_AUTHIPDGM 0x0080 /* data origin authentication */
+#endif
+
+/* flags copied when copying m_pkthdr */
+#define M_COPYFLAGS (M_PKTHDR|M_EOR|M_BCAST|M_MCAST|M_CONF|M_AUTH|M_ANYCAST6|M_LOOP)
+
+/* mbuf types */
+#define MT_FREE 0 /* should be on free list */
+#define MT_DATA 1 /* dynamic (data) allocation */
+#define MT_HEADER 2 /* packet header */
+#define MT_SOCKET 3 /* socket structure */
+#define MT_PCB 4 /* protocol control block */
+#define MT_RTABLE 5 /* routing tables */
+#define MT_HTABLE 6 /* IMP host tables */
+#define MT_ATABLE 7 /* address resolution tables */
+#define MT_SONAME 8 /* socket name */
+#define MT_SOOPTS 10 /* socket options */
+#define MT_FTABLE 11 /* fragment reassembly header */
+#define MT_RIGHTS 12 /* access rights */
+#define MT_IFADDR 13 /* interface address */
+#define MT_CONTROL 14 /* extra-data protocol message */
+#define MT_OOBDATA 15 /* expedited data */
+
+/* flags to m_get/MGET */
+#define M_DONTWAIT M_NOWAIT
+#define M_WAIT M_WAITOK
+
+#ifdef __ECOS
+extern void *cyg_net_mbuf_alloc(int type, int flags);
+extern void cyg_net_mbuf_free(caddr_t addr, int type);
+#define MBUF_ALLOC(space, cast, size, type, flags) \
+ (space) = (cast)cyg_net_mbuf_alloc(type, flags)
+#define MBUF_FREE(addr, type) cyg_net_mbuf_free((caddr_t)(addr), type)
+#else
+#define MBUF_ALLOC(space, cast, size, type, flags) \
+ MALLOC(space, cast, size, type, flags)
+#define MBUF_FREE(addr, type) \
+ MFREE(addr, type)
+#endif
+
+/*
+ * mbuf utility macros:
+ *
+ * MBUFLOCK(code)
+ * prevents a section of code from from being interrupted by network
+ * drivers.
+ */
+#define MBUFLOCK(code) \
+ { int ms = splimp(); \
+ { code } \
+ splx(ms); \
+ }
+
+/*
+ * mbuf allocation/deallocation macros:
+ *
+ * MGET(struct mbuf *m, int how, int type)
+ * allocates an mbuf and initializes it to contain internal data.
+ *
+ * MGETHDR(struct mbuf *m, int how, int type)
+ * allocates an mbuf and initializes it to contain a packet header
+ * and internal data.
+ */
+#define MGET(m, how, type) { \
+ MBUF_ALLOC((m), struct mbuf *, MSIZE, mbtypes[type], (how)); \
+ if (m) { \
+ (m)->m_type = (type); \
+ MBUFLOCK(mbstat.m_mtypes[type]++;) \
+ (m)->m_next = (struct mbuf *)NULL; \
+ (m)->m_nextpkt = (struct mbuf *)NULL; \
+ (m)->m_data = (m)->m_dat; \
+ (m)->m_flags = 0; \
+ } else \
+ (m) = m_retry((how), (type)); \
+}
+
+#define MGETHDR(m, how, type) { \
+ MBUF_ALLOC((m), struct mbuf *, MSIZE, mbtypes[type], (how)); \
+ if (m) { \
+ (m)->m_type = (type); \
+ MBUFLOCK(mbstat.m_mtypes[type]++;) \
+ (m)->m_next = (struct mbuf *)NULL; \
+ (m)->m_nextpkt = (struct mbuf *)NULL; \
+ (m)->m_data = (m)->m_pktdat; \
+ (m)->m_flags = M_PKTHDR; \
+ } else \
+ (m) = m_retryhdr((how), (type)); \
+}
+
+/*
+ * Mbuf cluster macros.
+ * MCLALLOC(caddr_t p, int how) allocates an mbuf cluster.
+ * MCLGET adds such clusters to a normal mbuf;
+ * the flag M_EXT is set upon success.
+ * MCLFREE releases a reference to a cluster allocated by MCLALLOC,
+ * freeing the cluster if the reference count has reached 0.
+ *
+ * Normal mbuf clusters are normally treated as character arrays
+ * after allocation, but use the first word of the buffer as a free list
+ * pointer while on the free list.
+ */
+union mcluster {
+ union mcluster *mcl_next;
+ char mcl_buf[MCLBYTES];
+};
+
+#define MCLALLOC(p, how) \
+ MBUFLOCK( \
+ if (mclfree == 0) \
+ (void)m_clalloc(1, (how)); \
+ if (((p) = (caddr_t)mclfree) != 0) { \
+ ++mclrefcnt[mtocl(p)]; \
+ mbstat.m_clfree--; \
+ mclfree = ((union mcluster *)(p))->mcl_next; \
+ } \
+ )
+
+#define MCLGET(m, how) \
+ { MCLALLOC((m)->m_ext.ext_buf, (how)); \
+ if ((m)->m_ext.ext_buf != NULL) { \
+ (m)->m_data = (m)->m_ext.ext_buf; \
+ (m)->m_flags |= M_EXT; \
+ (m)->m_ext.ext_size = MCLBYTES; \
+ (m)->m_ext.ext_free = NULL; \
+ (m)->m_ext.ext_ref = NULL; \
+ (m)->m_ext.ext_handle = NULL; \
+ } \
+ }
+
+#define MCLFREE(p) \
+ MBUFLOCK ( \
+ if (--mclrefcnt[mtocl(p)] == 0) { \
+ ((union mcluster *)(p))->mcl_next = mclfree; \
+ mclfree = (union mcluster *)(p); \
+ mbstat.m_clfree++; \
+ } \
+ )
+
+/*
+ * For cluster mbufs (regardless of header or not).
+ */
+#define MCL_ALIGN(m, len) \
+ { (m)->m_data += (MCLBYTES - (len)) &~ (sizeof(long) -1); }
+
+/*
+ * MFREE(struct mbuf *m, struct mbuf *n)
+ * Free a single mbuf and associated external storage.
+ * Place the successor, if any, in n.
+ */
+#define MFREE(m, n) \
+ { MBUFLOCK(mbstat.m_mtypes[(m)->m_type]--;) \
+ if ((m)->m_flags & M_EXT) { \
+ if ((m)->m_ext.ext_free) \
+ (*((m)->m_ext.ext_free))(m); \
+ else \
+ MCLFREE((m)->m_ext.ext_buf); \
+ } \
+ (n) = (m)->m_next; \
+ MBUF_FREE((m), mbtypes[(m)->m_type]); \
+ }
+
+/*
+ * Copy mbuf pkthdr from from to to.
+ * from must have M_PKTHDR set, and to must be empty.
+ */
+#define M_COPY_PKTHDR(to, from) { \
+ (to)->m_pkthdr = (from)->m_pkthdr; \
+ (to)->m_flags = (from)->m_flags & M_COPYFLAGS; \
+ (to)->m_data = (to)->m_pktdat; \
+}
+
+/*
+ * Set the m_data pointer of a newly-allocated mbuf (m_get/MGET) to place
+ * an object of the specified size at the end of the mbuf, longword aligned.
+ */
+#define M_ALIGN(m, len) \
+ { (m)->m_data += (MLEN - (len)) &~ (sizeof(long) - 1); }
+/*
+ * As above, for mbufs allocated with m_gethdr/MGETHDR
+ * or initialized by M_COPY_PKTHDR.
+ */
+#define MH_ALIGN(m, len) \
+ { (m)->m_data += (MHLEN - (len)) &~ (sizeof(long) - 1); }
+
+/*
+ * Compute the amount of space available
+ * before the current start of data in an mbuf.
+ */
+#define M_LEADINGSPACE(m) \
+ ((m)->m_flags & M_EXT ? /* (m)->m_data - (m)->m_ext.ext_buf */ 0 : \
+ (m)->m_flags & M_PKTHDR ? (m)->m_data - (m)->m_pktdat : \
+ (m)->m_data - (m)->m_dat)
+
+/*
+ * Compute the amount of space available
+ * after the end of data in an mbuf.
+ */
+#define M_TRAILINGSPACE(m) \
+ ((m)->m_flags & M_EXT ? (m)->m_ext.ext_buf + (m)->m_ext.ext_size - \
+ ((m)->m_data + (m)->m_len) : \
+ &(m)->m_dat[MLEN] - ((m)->m_data + (m)->m_len))
+
+/*
+ * Arrange to prepend space of size plen to mbuf m.
+ * If a new mbuf must be allocated, how specifies whether to wait.
+ * If how is M_DONTWAIT and allocation fails, the original mbuf chain
+ * is freed and m is set to NULL.
+ */
+#define M_PREPEND(m, plen, how) { \
+ if (M_LEADINGSPACE(m) >= (plen)) { \
+ (m)->m_data -= (plen); \
+ (m)->m_len += (plen); \
+ } else \
+ (m) = m_prepend((m), (plen), (how)); \
+ if ((m) && (m)->m_flags & M_PKTHDR) \
+ (m)->m_pkthdr.len += (plen); \
+}
+
+/* change mbuf to new type */
+#define MCHTYPE(m, t) { \
+ MBUFLOCK(mbstat.m_mtypes[(m)->m_type]--; mbstat.m_mtypes[t]++;) \
+ (m)->m_type = t;\
+}
+
+/* length to m_copy to copy all */
+#define M_COPYALL 1000000000
+
+/* compatiblity with 4.3 */
+#define m_copy(m, o, l) m_copym((m), (o), (l), M_DONTWAIT)
+
+/*
+ * Mbuf statistics.
+ */
+struct mbstat {
+ u_long m_mbufs; /* mbufs obtained from page pool */
+ u_long m_clusters; /* clusters obtained from page pool */
+ u_long m_spare; /* spare field */
+ u_long m_clfree; /* free clusters */
+ u_long m_drops; /* times failed to find space */
+ u_long m_wait; /* times waited for space */
+ u_long m_drain; /* times drained protocols for space */
+ u_short m_mtypes[256]; /* type specific mbuf allocations */
+};
+
+#ifdef _KERNEL
+extern struct mbuf *mbutl; /* virtual address of mclusters */
+extern char *mclrefcnt; /* cluster reference counts */
+extern struct mbstat mbstat;
+extern int nmbclusters;
+union mcluster *mclfree;
+extern int max_linkhdr; /* largest link-level header */
+extern int max_protohdr; /* largest protocol header */
+extern int max_hdr; /* largest link+protocol header */
+extern int max_datalen; /* MHLEN - max_hdr */
+extern int mbtypes[]; /* XXX */
+extern int needqueuedrain; /* True if allocation failed at */
+ /* interrupt level */
+
+void mbinit __P((void));
+struct mbuf *m_copym2 __P((struct mbuf *, int, int, int));
+struct mbuf *m_copym __P((struct mbuf *, int, int, int));
+struct mbuf *m_free __P((struct mbuf *));
+struct mbuf *m_get __P((int, int));
+struct mbuf *m_getclr __P((int, int));
+struct mbuf *m_gethdr __P((int, int));
+struct mbuf *m_prepend __P((struct mbuf *, int, int));
+struct mbuf *m_pullup __P((struct mbuf *, int));
+struct mbuf *m_pullup2 __P((struct mbuf *, int));
+struct mbuf *m_retry __P((int, int));
+struct mbuf *m_retryhdr __P((int, int));
+struct mbuf *m_split __P((struct mbuf *, int, int));
+struct mbuf *m_inject __P((struct mbuf *, int, int, int));
+void m_adj __P((struct mbuf *, int));
+int m_clalloc __P((int, int));
+void m_copyback __P((struct mbuf *, int, int, caddr_t));
+void m_freem __P((struct mbuf *));
+void m_reclaim __P((void));
+void m_copydata __P((struct mbuf *, int, int, caddr_t));
+void m_cat __P((struct mbuf *, struct mbuf *));
+struct mbuf *m_devget __P((char *, int, int, struct ifnet *,
+ void (*) __P((const void *, void *, size_t))));
+void m_zero __P((struct mbuf *));
+int m_apply __P((struct mbuf *, int, int,
+ int (*)(caddr_t, caddr_t, unsigned int), caddr_t));
+
+#endif
+
+#endif // _SYS_MBUF_H_
diff --git a/ecos/packages/net/tcpip/current/include/sys/param.h b/ecos/packages/net/tcpip/current/include/sys/param.h
new file mode 100644
index 0000000..89952cf
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/sys/param.h
@@ -0,0 +1,344 @@
+//==========================================================================
+//
+// include/sys/param.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: param.h,v 1.25 1999/09/23 08:25:01 deraadt Exp $ */
+/* $NetBSD: param.h,v 1.23 1996/03/17 01:02:29 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 1982, 1986, 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * 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.
+ *
+ * @(#)param.h 8.2 (Berkeley) 1/21/94
+ */
+
+#ifndef _SYS_PARAM_H_
+#define _SYS_PARAM_H_
+
+#define BSD 199306 /* System version (year & month). */
+#define BSD4_3 1
+#define BSD4_4 1
+
+#define OpenBSD 199912 /* OpenBSD version (year & month). */
+#define OpenBSD2_6 1 /* OpenBSD 2.6 */
+
+#ifndef NULL
+#ifdef __GNUG__
+#define NULL __null
+#else
+#define NULL 0
+#endif
+#endif
+
+#ifndef _LOCORE
+#include <sys/types.h>
+#ifndef __ECOS
+#include <sys/simplelock.h>
+#endif
+#endif
+
+#ifndef __ECOS
+/*
+ * Machine-independent constants (some used in following include files).
+ * Redefined constants are from POSIX 1003.1 limits file.
+ *
+ * MAXCOMLEN should be >= sizeof(ac_comm) (see <acct.h>)
+ * MAXLOGNAME should be >= UT_NAMESIZE (see <utmp.h>)
+ */
+#include <sys/syslimits.h>
+
+#define MAXCOMLEN 16 /* max command name remembered */
+#define MAXINTERP 64 /* max interpreter file name length */
+#define MAXLOGNAME 12 /* max login name length */
+#define MAXUPRC CHILD_MAX /* max simultaneous processes */
+#define NCARGS ARG_MAX /* max bytes for an exec function */
+#define NGROUPS NGROUPS_MAX /* max number groups */
+#define NOFILE OPEN_MAX /* max open files per process (soft) */
+#define NOFILE_MAX 1024 /* max open files per process (hard) */
+#define NOGROUP 65535 /* marker for empty group set member */
+#endif
+#define MAXHOSTNAMELEN 256 /* max hostname size */
+
+/* More types and definitions used throughout the kernel. */
+#ifdef _KERNEL
+#include <sys/cdefs.h>
+#include <sys/errno.h>
+#include <sys/time.h>
+#ifdef __ECOS
+#include <cyg/io/file.h>
+#else
+#include <sys/resource.h>
+#include <sys/ucred.h>
+#include <sys/uio.h>
+#endif
+#endif
+
+#ifndef __ECOS
+/* Signals. */
+#include <sys/signal.h>
+#endif
+
+#ifndef __ECOS
+/*
+ * Priorities. Note that with 32 run queues, differences less than 4 are
+ * insignificant.
+ */
+#define PSWP 0
+#define PVM 4
+#define PINOD 8
+#define PRIBIO 16
+#define PVFS 20
+#define PZERO 22 /* No longer magic, shouldn't be here. XXX */
+#define PSOCK 24
+#define PWAIT 32
+#define PLOCK 36
+#define PPAUSE 40
+#define PUSER 50
+#define MAXPRI 127 /* Priorities range from 0 through MAXPRI. */
+
+#define PRIMASK 0x0ff
+#define PCATCH 0x100 /* OR'd with pri for tsleep to check signals */
+#endif
+
+#define NBPW sizeof(int) /* number of bytes per word (integer) */
+
+#ifndef __ECOS
+#define CMASK 022 /* default file mask: S_IWGRP|S_IWOTH */
+#define NODEV (dev_t)(-1) /* non-existent device */
+
+/*
+ * Clustering of hardware pages on machines with ridiculously small
+ * page sizes is done here. The paging subsystem deals with units of
+ * CLSIZE pte's describing NBPG (from machine/machparam.h) pages each.
+ */
+#define CLBYTES (CLSIZE*NBPG)
+#define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */
+#define claligned(x) ((((int)(x))&CLOFSET)==0)
+#define CLOFF CLOFSET
+#define CLSHIFT (PGSHIFT+CLSIZELOG2)
+
+#if CLSIZE==1
+#define clbase(i) (i)
+#define clrnd(i) (i)
+#else
+/* Give the base virtual address (first of CLSIZE). */
+#define clbase(i) ((i) &~ (CLSIZE-1))
+/* Round a number of clicks up to a whole cluster. */
+#define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1))
+#endif
+
+#define CBLOCK 64 /* Clist block size, must be a power of 2. */
+#define CBQSIZE (CBLOCK/NBBY) /* Quote bytes/cblock - can do better. */
+ /* Data chars/clist. */
+#define CBSIZE (CBLOCK - sizeof(struct cblock *) - CBQSIZE)
+#define CROUND (CBLOCK - 1) /* Clist rounding. */
+
+/*
+ * File system parameters and macros.
+ *
+ * The file system is made out of blocks of at most MAXBSIZE units, with
+ * smaller units (fragments) only in the last direct block. MAXBSIZE
+ * primarily determines the size of buffers in the buffer pool. It may be
+ * made larger without any effect on existing file systems; however making
+ * it smaller makes some file systems unmountable.
+ */
+#ifndef MAXBSIZE /* XXX temp until sun3 DMA chaining */
+#define MAXBSIZE MAXPHYS
+#endif
+#define MAXFRAG 8
+
+/*
+ * MAXPATHLEN defines the longest permissable path length after expanding
+ * symbolic links. It is used to allocate a temporary buffer from the buffer
+ * pool in which to do the name expansion, hence should be a power of two,
+ * and must be less than or equal to MAXBSIZE. MAXSYMLINKS defines the
+ * maximum number of symbolic links that may be expanded in a path name.
+ * It should be set high enough to allow all legitimate uses, but halt
+ * infinite loops reasonably quickly.
+ */
+#define MAXPATHLEN PATH_MAX
+#define MAXSYMLINKS 32
+
+#endif // __ECOS
+
+/* Bit map related macros. */
+#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
+#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
+#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
+#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
+
+/* Macros for counting and rounding. */
+#ifndef howmany
+#define howmany(x, y) (((x)+((y)-1))/(y))
+#endif
+#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
+#define powerof2(x) ((((x)-1)&(x))==0)
+
+/* Macros for min/max. */
+#ifndef _KERNEL
+# ifndef MIN
+# define MIN(a,b) (((a)<(b))?(a):(b))
+# endif
+# ifndef MAX
+# define MAX(a,b) (((a)>(b))?(a):(b))
+# endif
+#endif
+
+#ifndef __ECOS
+/*
+ * Constants for setting the parameters of the kernel memory allocator.
+ *
+ * 2 ** MINBUCKET is the smallest unit of memory that will be
+ * allocated. It must be at least large enough to hold a pointer.
+ *
+ * Units of memory less or equal to MAXALLOCSAVE will permanently
+ * allocate physical memory; requests for these size pieces of
+ * memory are quite fast. Allocations greater than MAXALLOCSAVE must
+ * always allocate and free physical memory; requests for these
+ * size allocations should be done infrequently as they will be slow.
+ *
+ * Constraints: CLBYTES <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14), and
+ * MAXALLOCSIZE must be a power of two.
+ */
+#define MINBUCKET 4 /* 4 => min allocation of 16 bytes */
+#define MAXALLOCSAVE (2 * CLBYTES)
+
+/*
+ * Scale factor for scaled integers used to count %cpu time and load avgs.
+ *
+ * The number of CPU `tick's that map to a unique `%age' can be expressed
+ * by the formula (1 / (2 ^ (FSHIFT - 11))). The maximum load average that
+ * can be calculated (assuming 32 bits) can be closely approximated using
+ * the formula (2 ^ (2 * (16 - FSHIFT))) for (FSHIFT < 15).
+ *
+ * For the scheduler to maintain a 1:1 mapping of CPU `tick' to `%age',
+ * FSHIFT must be at least 11; this gives us a maximum load avg of ~1024.
+ */
+#define FSHIFT 11 /* bits to right of fixed binary point */
+#define FSCALE (1<<FSHIFT)
+
+/*
+ * rfork() options.
+ *
+ * XXX currently, operations without RFPROC set are not supported.
+ */
+#define RFNAMEG (1<<0) /* UNIMPL new plan9 `name space' */
+#define RFENVG (1<<1) /* UNIMPL copy plan9 `env space' */
+#define RFFDG (1<<2) /* copy fd table */
+#define RFNOTEG (1<<3) /* UNIMPL create new plan9 `note group' */
+#define RFPROC (1<<4) /* change child (else changes curproc) */
+#define RFMEM (1<<5) /* share `address space' */
+#define RFNOWAIT (1<<6) /* parent need not wait() on child */
+#define RFCNAMEG (1<<10) /* UNIMPL zero plan9 `name space' */
+#define RFCENVG (1<<11) /* UNIMPL zero plan9 `env space' */
+#define RFCFDG (1<<12) /* zero fd table */
+#endif // __ECOS
+
+#ifdef __ECOS
+// Function mappings
+
+extern int cyg_tsleep(void *, int, char *, int);
+extern void cyg_wakeup(void *);
+#define tsleep(e,p,w,t) cyg_tsleep(e,0,w,t)
+#define wakeup(e) cyg_wakeup(e)
+
+#ifdef CYGIMPL_TRACE_SPLX
+extern cyg_uint32 cyg_splimp(const char *file, const int line);
+extern cyg_uint32 cyg_splnet(const char *file, const int line);
+extern cyg_uint32 cyg_splclock(const char *file, const int line);
+extern cyg_uint32 cyg_splsoftnet(const char *file, const int line);
+extern void cyg_splx(cyg_uint32, const char *file, const int line);
+#define splimp() cyg_splimp(__FUNCTION__, __LINE__)
+#define splnet() cyg_splnet(__FUNCTION__, __LINE__)
+#define splclock() cyg_splclock(__FUNCTION__, __LINE__)
+#define splsoftnet() cyg_splsoftnet(__FUNCTION__, __LINE__)
+#define splx(x) cyg_splx(x, __FUNCTION__, __LINE__)
+#define cyg_scheduler_lock() _cyg_scheduler_lock(__FUNCTION__, __LINE__)
+#define cyg_scheduler_safe_lock() _cyg_scheduler_safe_lock(__FUNCTION__, __LINE__)
+#define cyg_scheduler_unlock() _cyg_scheduler_unlock(__FUNCTION__, __LINE__)
+#else
+extern cyg_uint32 cyg_splimp(void);
+extern cyg_uint32 cyg_splnet(void);
+extern cyg_uint32 cyg_splclock(void);
+extern cyg_uint32 cyg_splsoftnet(void);
+extern cyg_uint32 cyg_splhigh(void);
+extern void cyg_splx(cyg_uint32);
+#define splimp cyg_splimp
+#define splnet cyg_splnet
+#define splclock cyg_splclock
+#define splsoftnet cyg_splsoftnet
+#define splhigh cyg_splhigh
+#define splx cyg_splx
+#endif
+
+extern void cyg_panic(const char *msg, ...);
+#define panic cyg_panic
+
+// Namespace changes
+#define route_reinit cyg_route_reinit
+#define arc4random cyg_arc4random
+#endif
+
+/* Machine type dependent parameters. */
+#include <machine/param.h>
+#include <machine/limits.h>
+
+#endif // __SYS_PARAM_H_
diff --git a/ecos/packages/net/tcpip/current/include/sys/protosw.h b/ecos/packages/net/tcpip/current/include/sys/protosw.h
new file mode 100644
index 0000000..9afe2b4
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/sys/protosw.h
@@ -0,0 +1,271 @@
+//==========================================================================
+//
+// include/sys/protosw.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: protosw.h,v 1.3 1996/04/21 22:31:54 deraadt Exp $ */
+/* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */
+
+/*-
+ * Copyright (c) 1982, 1986, 1993
+ * 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.
+ *
+ * @(#)protosw.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _SYS_PROTOSW_H_
+#define _SYS_PROTOSW_H_
+
+/*
+ * Protocol switch table.
+ *
+ * Each protocol has a handle initializing one of these structures,
+ * which is used for protocol-protocol and system-protocol communication.
+ *
+ * A protocol is called through the pr_init entry before any other.
+ * Thereafter it is called every 200ms through the pr_fasttimo entry and
+ * every 500ms through the pr_slowtimo for timer based actions.
+ * The system will call the pr_drain entry if it is low on space and
+ * this should throw away any non-critical data.
+ *
+ * Protocols pass data between themselves as chains of mbufs using
+ * the pr_input and pr_output hooks. Pr_input passes data up (towards
+ * UNIX) and pr_output passes it down (towards the imps); control
+ * information passes up and down on pr_ctlinput and pr_ctloutput.
+ * The protocol is responsible for the space occupied by any the
+ * arguments to these entries and must dispose it.
+ *
+ * The userreq routine interfaces protocols to the system and is
+ * described below.
+ */
+
+struct mbuf;
+struct sockaddr;
+struct socket;
+struct domain;
+
+struct protosw {
+ short pr_type; /* socket type used for */
+ struct domain *pr_domain; /* domain protocol a member of */
+ short pr_protocol; /* protocol number */
+ short pr_flags; /* see below */
+
+/* protocol-protocol hooks */
+ void (*pr_input) /* input to protocol (from below) */
+ __P((struct mbuf *, ...));
+ int (*pr_output) /* output to protocol (from above) */
+ __P((struct mbuf *, ...));
+ void *(*pr_ctlinput) /* control input (from below) */
+ __P((int, struct sockaddr *, void *));
+ int (*pr_ctloutput) /* control output (from above) */
+ __P((int, struct socket *, int, int, struct mbuf **));
+
+/* user-protocol hook */
+ int (*pr_usrreq) /* user request: see list below */
+ __P((struct socket *, int, struct mbuf *,
+ struct mbuf *, struct mbuf *));
+
+/* utility hooks */
+ void (*pr_init) /* initialization hook */
+ __P((void));
+
+ void (*pr_fasttimo) /* fast timeout (200ms) */
+ __P((void));
+ void (*pr_slowtimo) /* slow timeout (500ms) */
+ __P((void));
+ void (*pr_drain) /* flush any excess space possible */
+ __P((void));
+ int (*pr_sysctl) /* sysctl for protocol */
+ __P((int *, u_int, void *, size_t *, void *, size_t));
+};
+
+#define PR_SLOWHZ 2 /* 2 slow timeouts per second */
+#define PR_FASTHZ 5 /* 5 fast timeouts per second */
+
+/*
+ * Values for pr_flags.
+ * PR_ADDR requires PR_ATOMIC;
+ * PR_ADDR and PR_CONNREQUIRED are mutually exclusive.
+ */
+#define PR_ATOMIC 0x01 /* exchange atomic messages only */
+#define PR_ADDR 0x02 /* addresses given with messages */
+#define PR_CONNREQUIRED 0x04 /* connection required by protocol */
+#define PR_WANTRCVD 0x08 /* want PRU_RCVD calls */
+#define PR_RIGHTS 0x10 /* passes capabilities */
+
+/*
+ * The arguments to usrreq are:
+ * (*protosw[].pr_usrreq)(up, req, m, nam, opt);
+ * where up is a (struct socket *), req is one of these requests,
+ * m is a optional mbuf chain containing a message,
+ * nam is an optional mbuf chain containing an address,
+ * and opt is a pointer to a socketopt structure or nil.
+ * The protocol is responsible for disposal of the mbuf chain m,
+ * the caller is responsible for any space held by nam and opt.
+ * A non-zero return from usrreq gives an
+ * UNIX error number which should be passed to higher level software.
+ */
+#define PRU_ATTACH 0 /* attach protocol to up */
+#define PRU_DETACH 1 /* detach protocol from up */
+#define PRU_BIND 2 /* bind socket to address */
+#define PRU_LISTEN 3 /* listen for connection */
+#define PRU_CONNECT 4 /* establish connection to peer */
+#define PRU_ACCEPT 5 /* accept connection from peer */
+#define PRU_DISCONNECT 6 /* disconnect from peer */
+#define PRU_SHUTDOWN 7 /* won't send any more data */
+#define PRU_RCVD 8 /* have taken data; more room now */
+#define PRU_SEND 9 /* send this data */
+#define PRU_ABORT 10 /* abort (fast DISCONNECT, DETATCH) */
+#define PRU_CONTROL 11 /* control operations on protocol */
+#define PRU_SENSE 12 /* return status into m */
+#define PRU_RCVOOB 13 /* retrieve out of band data */
+#define PRU_SENDOOB 14 /* send out of band data */
+#define PRU_SOCKADDR 15 /* fetch socket's address */
+#define PRU_PEERADDR 16 /* fetch peer's address */
+#define PRU_CONNECT2 17 /* connect two sockets */
+/* begin for protocols internal use */
+#define PRU_FASTTIMO 18 /* 200ms timeout */
+#define PRU_SLOWTIMO 19 /* 500ms timeout */
+#define PRU_PROTORCV 20 /* receive from below */
+#define PRU_PROTOSEND 21 /* send to below */
+
+#define PRU_NREQ 21
+
+#ifdef PRUREQUESTS
+char *prurequests[] = {
+ "ATTACH", "DETACH", "BIND", "LISTEN",
+ "CONNECT", "ACCEPT", "DISCONNECT", "SHUTDOWN",
+ "RCVD", "SEND", "ABORT", "CONTROL",
+ "SENSE", "RCVOOB", "SENDOOB", "SOCKADDR",
+ "PEERADDR", "CONNECT2", "FASTTIMO", "SLOWTIMO",
+ "PROTORCV", "PROTOSEND",
+};
+#endif
+
+/*
+ * The arguments to the ctlinput routine are
+ * (*protosw[].pr_ctlinput)(cmd, sa, arg);
+ * where cmd is one of the commands below, sa is a pointer to a sockaddr,
+ * and arg is an optional caddr_t argument used within a protocol family.
+ */
+#define PRC_IFDOWN 0 /* interface transition */
+#define PRC_ROUTEDEAD 1 /* select new route if possible ??? */
+#define PRC_QUENCH2 3 /* DEC congestion bit says slow down */
+#define PRC_QUENCH 4 /* some one said to slow down */
+#define PRC_MSGSIZE 5 /* message size forced drop */
+#define PRC_HOSTDEAD 6 /* host appears to be down */
+#define PRC_HOSTUNREACH 7 /* deprecated (use PRC_UNREACH_HOST) */
+#define PRC_UNREACH_NET 8 /* no route to network */
+#define PRC_UNREACH_HOST 9 /* no route to host */
+#define PRC_UNREACH_PROTOCOL 10 /* dst says bad protocol */
+#define PRC_UNREACH_PORT 11 /* bad port # */
+/* was PRC_UNREACH_NEEDFRAG 12 (use PRC_MSGSIZE) */
+#define PRC_UNREACH_SRCFAIL 13 /* source route failed */
+#define PRC_REDIRECT_NET 14 /* net routing redirect */
+#define PRC_REDIRECT_HOST 15 /* host routing redirect */
+#define PRC_REDIRECT_TOSNET 16 /* redirect for type of service & net */
+#define PRC_REDIRECT_TOSHOST 17 /* redirect for tos & host */
+#define PRC_TIMXCEED_INTRANS 18 /* packet lifetime expired in transit */
+#define PRC_TIMXCEED_REASS 19 /* lifetime expired on reass q */
+#define PRC_PARAMPROB 20 /* header incorrect */
+
+#define PRC_NCMDS 21
+
+#define PRC_IS_REDIRECT(cmd) \
+ ((cmd) >= PRC_REDIRECT_NET && (cmd) <= PRC_REDIRECT_TOSHOST)
+
+#ifdef PRCREQUESTS
+char *prcrequests[] = {
+ "IFDOWN", "ROUTEDEAD", "#2", "DEC-BIT-QUENCH2",
+ "QUENCH", "MSGSIZE", "HOSTDEAD", "#7",
+ "NET-UNREACH", "HOST-UNREACH", "PROTO-UNREACH", "PORT-UNREACH",
+ "#12", "SRCFAIL-UNREACH", "NET-REDIRECT", "HOST-REDIRECT",
+ "TOSNET-REDIRECT", "TOSHOST-REDIRECT", "TX-INTRANS", "TX-REASS",
+ "PARAMPROB"
+};
+#endif
+
+/*
+ * The arguments to ctloutput are:
+ * (*protosw[].pr_ctloutput)(req, so, level, optname, optval);
+ * req is one of the actions listed below, so is a (struct socket *),
+ * level is an indication of which protocol layer the option is intended.
+ * optname is a protocol dependent socket option request,
+ * optval is a pointer to a mbuf-chain pointer, for value-return results.
+ * The protocol is responsible for disposal of the mbuf chain *optval
+ * if supplied,
+ * the caller is responsible for any space held by *optval, when returned.
+ * A non-zero return from usrreq gives an
+ * UNIX error number which should be passed to higher level software.
+ */
+#define PRCO_GETOPT 0
+#define PRCO_SETOPT 1
+
+#define PRCO_NCMDS 2
+
+#ifdef PRCOREQUESTS
+char *prcorequests[] = {
+ "GETOPT", "SETOPT",
+};
+#endif
+
+#ifdef _KERNEL
+struct sockaddr;
+struct protosw *pffindproto __P((int, int, int));
+struct protosw *pffindtype __P((int, int));
+void pfctlinput __P((int, struct sockaddr *));
+#endif
+
+#endif // _SYS_PROTOSW_H_
diff --git a/ecos/packages/net/tcpip/current/include/sys/queue.h b/ecos/packages/net/tcpip/current/include/sys/queue.h
new file mode 100644
index 0000000..2358b86
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/sys/queue.h
@@ -0,0 +1,514 @@
+//==========================================================================
+//
+// include/sys/queue.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: queue.h,v 1.14 1999/09/08 08:20:04 espie Exp $ */
+/* $NetBSD: queue.h,v 1.11 1996/05/16 05:17:14 mycroft Exp $ */
+
+/*
+ * Copyright (c) 1991, 1993
+ * 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.
+ *
+ * @(#)queue.h 8.5 (Berkeley) 8/20/94
+ */
+
+#ifndef _SYS_QUEUE_H_
+#define _SYS_QUEUE_H_
+
+/*
+ * This file defines five types of data structures: singly-linked lists,
+ * lists, simple queues, tail queues, and circular queues.
+ *
+ *
+ * A singly-linked list is headed by a single forward pointer. The elements
+ * are singly linked for minimum space and pointer manipulation overhead at
+ * the expense of O(n) removal for arbitrary elements. New elements can be
+ * added to the list after an existing element or at the head of the list.
+ * Elements being removed from the head of the list should use the explicit
+ * macro for this purpose for optimum efficiency. A singly-linked list may
+ * only be traversed in the forward direction. Singly-linked lists are ideal
+ * for applications with large datasets and few or no removals or for
+ * implementing a LIFO queue.
+ *
+ * A list is headed by a single forward pointer (or an array of forward
+ * pointers for a hash table header). The elements are doubly linked
+ * so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before
+ * or after an existing element or at the head of the list. A list
+ * may only be traversed in the forward direction.
+ *
+ * A simple queue is headed by a pair of pointers, one the head of the
+ * list and the other to the tail of the list. The elements are singly
+ * linked to save space, so elements can only be removed from the
+ * head of the list. New elements can be added to the list before or after
+ * an existing element, at the head of the list, or at the end of the
+ * list. A simple queue may only be traversed in the forward direction.
+ *
+ * A tail queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or
+ * after an existing element, at the head of the list, or at the end of
+ * the list. A tail queue may be traversed in either direction.
+ *
+ * A circle queue is headed by a pair of pointers, one to the head of the
+ * list and the other to the tail of the list. The elements are doubly
+ * linked so that an arbitrary element can be removed without a need to
+ * traverse the list. New elements can be added to the list before or after
+ * an existing element, at the head of the list, or at the end of the list.
+ * A circle queue may be traversed in either direction, but has a more
+ * complex end of list detection.
+ *
+ * For details on the use of these macros, see the queue(3) manual page.
+ */
+
+/*
+ * Singly-linked List definitions.
+ */
+#define SLIST_HEAD(name, type) \
+struct name { \
+ struct type *slh_first; /* first element */ \
+}
+
+#define SLIST_HEAD_INITIALIZER(head) \
+ { NULL }
+
+#define SLIST_ENTRY(type) \
+struct { \
+ struct type *sle_next; /* next element */ \
+}
+
+/*
+ * Singly-linked List access methods.
+ */
+#define SLIST_FIRST(head) ((head)->slh_first)
+#define SLIST_END(head) NULL
+#define SLIST_EMPTY(head) (SLIST_FIRST(head) == SLIST_END(head))
+#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
+
+#define SLIST_FOREACH(var, head, field) \
+ for((var) = SLIST_FIRST(head); \
+ (var) != SLIST_END(head); \
+ (var) = SLIST_NEXT(var, field))
+
+/*
+ * Singly-linked List functions.
+ */
+#define SLIST_INIT(head) { \
+ SLIST_FIRST(head) = SLIST_END(head); \
+}
+
+#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
+ (elm)->field.sle_next = (slistelm)->field.sle_next; \
+ (slistelm)->field.sle_next = (elm); \
+} while (0)
+
+#define SLIST_INSERT_HEAD(head, elm, field) do { \
+ (elm)->field.sle_next = (head)->slh_first; \
+ (head)->slh_first = (elm); \
+} while (0)
+
+#define SLIST_REMOVE_HEAD(head, field) do { \
+ (head)->slh_first = (head)->slh_first->field.sle_next; \
+} while (0)
+
+/*
+ * List definitions.
+ */
+#define LIST_HEAD(name, type) \
+struct name { \
+ struct type *lh_first; /* first element */ \
+}
+
+#define LIST_HEAD_INITIALIZER(head) \
+ { NULL }
+
+#define LIST_ENTRY(type) \
+struct { \
+ struct type *le_next; /* next element */ \
+ struct type **le_prev; /* address of previous next element */ \
+}
+
+/*
+ * List access methods
+ */
+#define LIST_FIRST(head) ((head)->lh_first)
+#define LIST_END(head) NULL
+#define LIST_EMPTY(head) (LIST_FIRST(head) == LIST_END(head))
+#define LIST_NEXT(elm, field) ((elm)->field.le_next)
+
+#define LIST_FOREACH(var, head, field) \
+ for((var) = LIST_FIRST(head); \
+ (var)!= LIST_END(head); \
+ (var) = LIST_NEXT(var, field))
+
+/*
+ * List functions.
+ */
+#define LIST_INIT(head) do { \
+ LIST_FIRST(head) = LIST_END(head); \
+} while (0)
+
+#define LIST_INSERT_AFTER(listelm, elm, field) do { \
+ if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \
+ (listelm)->field.le_next->field.le_prev = \
+ &(elm)->field.le_next; \
+ (listelm)->field.le_next = (elm); \
+ (elm)->field.le_prev = &(listelm)->field.le_next; \
+} while (0)
+
+#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
+ (elm)->field.le_prev = (listelm)->field.le_prev; \
+ (elm)->field.le_next = (listelm); \
+ *(listelm)->field.le_prev = (elm); \
+ (listelm)->field.le_prev = &(elm)->field.le_next; \
+} while (0)
+
+#define LIST_INSERT_HEAD(head, elm, field) do { \
+ if (((elm)->field.le_next = (head)->lh_first) != NULL) \
+ (head)->lh_first->field.le_prev = &(elm)->field.le_next;\
+ (head)->lh_first = (elm); \
+ (elm)->field.le_prev = &(head)->lh_first; \
+} while (0)
+
+#define LIST_REMOVE(elm, field) do { \
+ if ((elm)->field.le_next != NULL) \
+ (elm)->field.le_next->field.le_prev = \
+ (elm)->field.le_prev; \
+ *(elm)->field.le_prev = (elm)->field.le_next; \
+} while (0)
+
+#define LIST_REPLACE(elm, elm2, field) do { \
+ if (((elm2)->field.le_next = (elm)->field.le_next) != NULL) \
+ (elm2)->field.le_next->field.le_prev = \
+ &(elm2)->field.le_next; \
+ (elm2)->field.le_prev = (elm)->field.le_prev; \
+ *(elm2)->field.le_prev = (elm2); \
+} while (0)
+
+/*
+ * Simple queue definitions.
+ */
+#define SIMPLEQ_HEAD(name, type) \
+struct name { \
+ struct type *sqh_first; /* first element */ \
+ struct type **sqh_last; /* addr of last next element */ \
+}
+
+#define SIMPLEQ_HEAD_INITIALIZER(head) \
+ { NULL, &(head).sqh_first }
+
+#define SIMPLEQ_ENTRY(type) \
+struct { \
+ struct type *sqe_next; /* next element */ \
+}
+
+/*
+ * Simple queue access methods.
+ */
+#define SIMPLEQ_FIRST(head) ((head)->sqh_first)
+#define SIMPLEQ_END(head) NULL
+#define SIMPLEQ_EMPTY(head) (SIMPLEQ_FIRST(head) == SIMPLEQ_END(head))
+#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next)
+
+#define SIMPLEQ_FOREACH(var, head, field) \
+ for((var) = SIMPLEQ_FIRST(head); \
+ (var) != SIMPLEQ_END(head); \
+ (var) = SIMPLEQ_NEXT(var, field))
+
+/*
+ * Simple queue functions.
+ */
+#define SIMPLEQ_INIT(head) do { \
+ (head)->sqh_first = NULL; \
+ (head)->sqh_last = &(head)->sqh_first; \
+} while (0)
+
+#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \
+ if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \
+ (head)->sqh_last = &(elm)->field.sqe_next; \
+ (head)->sqh_first = (elm); \
+} while (0)
+
+#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \
+ (elm)->field.sqe_next = NULL; \
+ *(head)->sqh_last = (elm); \
+ (head)->sqh_last = &(elm)->field.sqe_next; \
+} while (0)
+
+#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
+ (head)->sqh_last = &(elm)->field.sqe_next; \
+ (listelm)->field.sqe_next = (elm); \
+} while (0)
+
+#define SIMPLEQ_REMOVE_HEAD(head, elm, field) do { \
+ if (((head)->sqh_first = (elm)->field.sqe_next) == NULL) \
+ (head)->sqh_last = &(head)->sqh_first; \
+} while (0)
+
+/*
+ * Tail queue definitions.
+ */
+#define TAILQ_HEAD(name, type) \
+struct name { \
+ struct type *tqh_first; /* first element */ \
+ struct type **tqh_last; /* addr of last next element */ \
+}
+
+#define TAILQ_HEAD_INITIALIZER(head) \
+ { NULL, &(head).tqh_first }
+
+#define TAILQ_ENTRY(type) \
+struct { \
+ struct type *tqe_next; /* next element */ \
+ struct type **tqe_prev; /* address of previous next element */ \
+}
+
+/*
+ * tail queue access methods
+ */
+#define TAILQ_FIRST(head) ((head)->tqh_first)
+#define TAILQ_END(head) NULL
+#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
+#define TAILQ_LAST(head, headname) \
+ (*(((struct headname *)((head)->tqh_last))->tqh_last))
+/* XXX */
+#define TAILQ_PREV(elm, headname, field) \
+ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
+#define TAILQ_EMPTY(head) \
+ (TAILQ_FIRST(head) == TAILQ_END(head))
+
+#define TAILQ_FOREACH(var, head, field) \
+ for((var) = TAILQ_FIRST(head); \
+ (var) != TAILQ_END(head); \
+ (var) = TAILQ_NEXT(var, field))
+
+/*
+ * Tail queue functions.
+ */
+#define TAILQ_INIT(head) do { \
+ (head)->tqh_first = NULL; \
+ (head)->tqh_last = &(head)->tqh_first; \
+} while (0)
+
+#define TAILQ_INSERT_HEAD(head, elm, field) do { \
+ if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
+ (head)->tqh_first->field.tqe_prev = \
+ &(elm)->field.tqe_next; \
+ else \
+ (head)->tqh_last = &(elm)->field.tqe_next; \
+ (head)->tqh_first = (elm); \
+ (elm)->field.tqe_prev = &(head)->tqh_first; \
+} while (0)
+
+#define TAILQ_INSERT_TAIL(head, elm, field) do { \
+ (elm)->field.tqe_next = NULL; \
+ (elm)->field.tqe_prev = (head)->tqh_last; \
+ *(head)->tqh_last = (elm); \
+ (head)->tqh_last = &(elm)->field.tqe_next; \
+} while (0)
+
+#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
+ (elm)->field.tqe_next->field.tqe_prev = \
+ &(elm)->field.tqe_next; \
+ else \
+ (head)->tqh_last = &(elm)->field.tqe_next; \
+ (listelm)->field.tqe_next = (elm); \
+ (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \
+} while (0)
+
+#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
+ (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
+ (elm)->field.tqe_next = (listelm); \
+ *(listelm)->field.tqe_prev = (elm); \
+ (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \
+} while (0)
+
+#define TAILQ_REMOVE(head, elm, field) do { \
+ if (((elm)->field.tqe_next) != NULL) \
+ (elm)->field.tqe_next->field.tqe_prev = \
+ (elm)->field.tqe_prev; \
+ else \
+ (head)->tqh_last = (elm)->field.tqe_prev; \
+ *(elm)->field.tqe_prev = (elm)->field.tqe_next; \
+} while (0)
+
+#define TAILQ_REPLACE(head, elm, elm2, field) do { \
+ if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != NULL) \
+ (elm2)->field.tqe_next->field.tqe_prev = \
+ &(elm2)->field.le_next; \
+ else \
+ (head).tqh_last = &(elm2)->field.tqe_next; \
+ (elm2)->field.tqe_prev = (elm)->field.tqe_prev; \
+ *(elm2)->field.tqe_prev = (elm2); \
+} while (0)
+
+/*
+ * Circular queue definitions.
+ */
+#define CIRCLEQ_HEAD(name, type) \
+struct name { \
+ struct type *cqh_first; /* first element */ \
+ struct type *cqh_last; /* last element */ \
+}
+
+#define CIRCLEQ_HEAD_INITIALIZER(head) \
+ { CIRCLEQ_END(&head), CIRCLEQ_END(&head) }
+
+#define CIRCLEQ_ENTRY(type) \
+struct { \
+ struct type *cqe_next; /* next element */ \
+ struct type *cqe_prev; /* previous element */ \
+}
+
+/*
+ * Circular queue access methods
+ */
+#define CIRCLEQ_FIRST(head) ((head)->cqh_first)
+#define CIRCLEQ_LAST(head) ((head)->cqh_last)
+#define CIRCLEQ_END(head) ((void *)(head))
+#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next)
+#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev)
+#define CIRCLEQ_EMPTY(head) \
+ (CIRCLEQ_FIRST(head) == CIRCLEQ_END(head))
+
+#define CIRCLEQ_FOREACH(var, head, field) \
+ for((var) = CIRCLEQ_FIRST(head); \
+ (var) != CIRCLEQ_END(head); \
+ (var) = CIRCLEQ_NEXT(var, field))
+
+#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \
+ for((var) = CIRCLEQ_LAST(head); \
+ (var) != CIRCLEQ_END(head); \
+ (var) = CIRCLEQ_PREV(var, field))
+
+/*
+ * Circular queue functions.
+ */
+#define CIRCLEQ_INIT(head) do { \
+ (head)->cqh_first = CIRCLEQ_END(head); \
+ (head)->cqh_last = CIRCLEQ_END(head); \
+} while (0)
+
+#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \
+ (elm)->field.cqe_next = (listelm)->field.cqe_next; \
+ (elm)->field.cqe_prev = (listelm); \
+ if ((listelm)->field.cqe_next == CIRCLEQ_END(head)) \
+ (head)->cqh_last = (elm); \
+ else \
+ (listelm)->field.cqe_next->field.cqe_prev = (elm); \
+ (listelm)->field.cqe_next = (elm); \
+} while (0)
+
+#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \
+ (elm)->field.cqe_next = (listelm); \
+ (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \
+ if ((listelm)->field.cqe_prev == CIRCLEQ_END(head)) \
+ (head)->cqh_first = (elm); \
+ else \
+ (listelm)->field.cqe_prev->field.cqe_next = (elm); \
+ (listelm)->field.cqe_prev = (elm); \
+} while (0)
+
+#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \
+ (elm)->field.cqe_next = (head)->cqh_first; \
+ (elm)->field.cqe_prev = CIRCLEQ_END(head); \
+ if ((head)->cqh_last == CIRCLEQ_END(head)) \
+ (head)->cqh_last = (elm); \
+ else \
+ (head)->cqh_first->field.cqe_prev = (elm); \
+ (head)->cqh_first = (elm); \
+} while (0)
+
+#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \
+ (elm)->field.cqe_next = CIRCLEQ_END(head); \
+ (elm)->field.cqe_prev = (head)->cqh_last; \
+ if ((head)->cqh_first == CIRCLEQ_END(head)) \
+ (head)->cqh_first = (elm); \
+ else \
+ (head)->cqh_last->field.cqe_next = (elm); \
+ (head)->cqh_last = (elm); \
+} while (0)
+
+#define CIRCLEQ_REMOVE(head, elm, field) do { \
+ if ((elm)->field.cqe_next == CIRCLEQ_END(head)) \
+ (head)->cqh_last = (elm)->field.cqe_prev; \
+ else \
+ (elm)->field.cqe_next->field.cqe_prev = \
+ (elm)->field.cqe_prev; \
+ if ((elm)->field.cqe_prev == CIRCLEQ_END(head)) \
+ (head)->cqh_first = (elm)->field.cqe_next; \
+ else \
+ (elm)->field.cqe_prev->field.cqe_next = \
+ (elm)->field.cqe_next; \
+} while (0)
+
+#define CIRCLEQ_REPLACE(head, elm, elm2, field) do { \
+ if (((elm2)->field.cqe_next = (elm)->field.cqe_next) == \
+ CIRCLEQ_END(head)) \
+ (head).cqh_last = (elm2); \
+ else \
+ (elm2)->field.cqe_next->field.cqe_prev = (elm2); \
+ if (((elm2)->field.cqe_prev = (elm)->field.cqe_prev) == \
+ CIRCLEQ_END(head)) \
+ (head).cqh_first = (elm2); \
+ else \
+ (elm2)->field.cqe_prev->field.cqe_next = (elm2); \
+} while (0)
+
+#endif /* !_SYS_QUEUE_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/sys/socket.h b/ecos/packages/net/tcpip/current/include/sys/socket.h
new file mode 100644
index 0000000..fe9fb38
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/sys/socket.h
@@ -0,0 +1,454 @@
+//==========================================================================
+//
+// include/sys/socket.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: socket.h,v 1.30 1999/12/08 06:50:24 itojun Exp $ */
+/* $NetBSD: socket.h,v 1.14 1996/02/09 18:25:36 christos Exp $ */
+
+/*
+ * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994
+ * 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.
+ *
+ * @(#)socket.h 8.4 (Berkeley) 2/21/94
+ */
+
+#ifndef _SYS_SOCKET_H_
+#define _SYS_SOCKET_H_
+
+/*
+ * Definitions related to sockets: types, address families, options.
+ */
+
+/*
+ * Types
+ */
+#define SOCK_STREAM 1 /* stream socket */
+#define SOCK_DGRAM 2 /* datagram socket */
+#define SOCK_RAW 3 /* raw-protocol interface */
+#define SOCK_RDM 4 /* reliably-delivered message */
+#define SOCK_SEQPACKET 5 /* sequenced packet stream */
+
+/*
+ * Option flags per-socket.
+ */
+#define SO_DEBUG 0x0001 /* turn on debugging info recording */
+#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */
+#define SO_REUSEADDR 0x0004 /* allow local address reuse */
+#define SO_KEEPALIVE 0x0008 /* keep connections alive */
+#define SO_DONTROUTE 0x0010 /* just use interface addresses */
+#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */
+#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */
+#define SO_LINGER 0x0080 /* linger on close if data present */
+#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */
+#define SO_REUSEPORT 0x0200 /* allow local address & port reuse */
+
+/*
+ * Additional options, not kept in so_options.
+ */
+#define SO_SNDBUF 0x1001 /* send buffer size */
+#define SO_RCVBUF 0x1002 /* receive buffer size */
+#define SO_SNDLOWAT 0x1003 /* send low-water mark */
+#define SO_RCVLOWAT 0x1004 /* receive low-water mark */
+#define SO_SNDTIMEO 0x1005 /* send timeout */
+#define SO_RCVTIMEO 0x1006 /* receive timeout */
+#define SO_ERROR 0x1007 /* get error status and clear */
+#define SO_TYPE 0x1008 /* get socket type */
+#define SO_NETPROC 0x1020 /* multiplex; network processing */
+
+/*
+ * Structure used for manipulating linger option.
+ */
+struct linger {
+ int l_onoff; /* option on/off */
+ int l_linger; /* linger time */
+};
+
+/*
+ * Level number for (get/set)sockopt() to apply to socket itself.
+ */
+#define SOL_SOCKET 0xffff /* options for socket level */
+
+/*
+ * Address families.
+ */
+#define AF_UNSPEC 0 /* unspecified */
+#define AF_LOCAL 1 /* local to host (pipes, portals) */
+#define AF_UNIX AF_LOCAL /* backward compatibility */
+#define AF_INET 2 /* internetwork: UDP, TCP, etc. */
+#define AF_IMPLINK 3 /* arpanet imp addresses */
+#define AF_PUP 4 /* pup protocols: e.g. BSP */
+#define AF_CHAOS 5 /* mit CHAOS protocols */
+#define AF_NS 6 /* XEROX NS protocols */
+#define AF_ISO 7 /* ISO protocols */
+#define AF_OSI AF_ISO
+#define AF_ECMA 8 /* european computer manufacturers */
+#define AF_DATAKIT 9 /* datakit protocols */
+#define AF_CCITT 10 /* CCITT protocols, X.25 etc */
+#define AF_SNA 11 /* IBM SNA */
+#define AF_DECnet 12 /* DECnet */
+#define AF_DLI 13 /* DEC Direct data link interface */
+#define AF_LAT 14 /* LAT */
+#define AF_HYLINK 15 /* NSC Hyperchannel */
+#define AF_APPLETALK 16 /* Apple Talk */
+#define AF_ROUTE 17 /* Internal Routing Protocol */
+#define AF_LINK 18 /* Link layer interface */
+#define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */
+#define AF_COIP 20 /* connection-oriented IP, aka ST II */
+#define AF_CNT 21 /* Computer Network Technology */
+#define pseudo_AF_RTIP 22 /* Help Identify RTIP packets */
+#define AF_IPX 23 /* Novell Internet Protocol */
+#define AF_INET6 24 /* IPv6 */
+#define pseudo_AF_PIP 25 /* Help Identify PIP packets */
+#define AF_ISDN 26 /* Integrated Services Digital Network*/
+#define AF_E164 AF_ISDN /* CCITT E.164 recommendation */
+#define AF_NATM 27 /* native ATM access */
+#define AF_ENCAP 28
+#define AF_SIP 29 /* Simple Internet Protocol */
+#define AF_KEY 30
+#define AF_MAX 31
+
+/*
+ * Structure used by kernel to store most
+ * addresses.
+ */
+struct sockaddr {
+ u_int8_t sa_len; /* total length */
+ sa_family_t sa_family; /* address family */
+ char sa_data[14]; /* actually longer; address value */
+};
+
+/*
+ * Sockaddr type which can hold any sockaddr type available
+ * in the system.
+ *
+ * Note: __ss_{len,family} is defined in RFC2553. During RFC2553 discussion
+ * the field name went back and forth between ss_len and __ss_len,
+ * and RFC2553 specifies it to be __ss_len. openbsd picked ss_len.
+ * For maximum portability, userland programmer would need to
+ * (1) make the code never touch ss_len portion (cast it into sockaddr and
+ * touch sa_len), or (2) add "-Dss_len=__ss_len" into CFLAGS to unify all
+ * occurences (including header file) to __ss_len.
+ */
+struct sockaddr_storage {
+ u_int8_t ss_len; /* total length */
+ sa_family_t ss_family; /* address family */
+ u_char __ss_pad1[6]; /* align to quad */
+ u_int64_t __ss_pad2; /* force alignment for stupid compilers */
+ u_char __ss_pad3[240]; /* pad to a total of 256 bytes */
+};
+
+/*
+ * Structure used by kernel to pass protocol
+ * information in raw sockets.
+ */
+struct sockproto {
+ u_short sp_family; /* address family */
+ u_short sp_protocol; /* protocol */
+};
+
+/*
+ * Protocol families, same as address families for now.
+ */
+#define PF_UNSPEC AF_UNSPEC
+#define PF_LOCAL AF_LOCAL
+#define PF_UNIX PF_LOCAL /* backward compatibility */
+#define PF_INET AF_INET
+#define PF_INET6 AF_INET6
+#define PF_IMPLINK AF_IMPLINK
+#define PF_PUP AF_PUP
+#define PF_CHAOS AF_CHAOS
+#define PF_NS AF_NS
+#define PF_ISO AF_ISO
+#define PF_OSI AF_ISO
+#define PF_ECMA AF_ECMA
+#define PF_DATAKIT AF_DATAKIT
+#define PF_CCITT AF_CCITT
+#define PF_SNA AF_SNA
+#define PF_DECnet AF_DECnet
+#define PF_DLI AF_DLI
+#define PF_LAT AF_LAT
+#define PF_HYLINK AF_HYLINK
+#define PF_APPLETALK AF_APPLETALK
+#define PF_ROUTE AF_ROUTE
+#define PF_LINK AF_LINK
+#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */
+#define PF_COIP AF_COIP
+#define PF_CNT AF_CNT
+#define PF_IPX AF_IPX /* same format as AF_NS */
+#define PF_INET6 AF_INET6
+#define PF_RTIP pseudo_AF_FTIP /* same format as AF_INET */
+#define PF_PIP pseudo_AF_PIP
+#define PF_ISDN AF_ISDN
+#define PF_NATM AF_NATM
+#define PF_ENCAP AF_ENCAP
+#define PF_SIP AF_SIP
+#define PF_KEY AF_KEY
+#define PF_MAX AF_MAX
+
+/*
+ * These are the valid values for the "how" field used by shutdown(2).
+ */
+#define SHUT_RD 0
+#define SHUT_WR 1
+#define SHUT_RDWR 2
+
+/*
+ * Socket credentials.
+ */
+struct sockcred {
+ uid_t sc_uid; /* real user id */
+ uid_t sc_euid; /* effective user id */
+ gid_t sc_gid; /* real group id */
+ gid_t sc_egid; /* effective group id */
+ int sc_ngroups; /* number of supplemental groups */
+ gid_t sc_groups[1]; /* variable length */
+};
+
+/*
+ * Compute size of a sockcred structure with groups.
+ */
+#define SOCKCREDSIZE(ngrps) \
+ (sizeof(struct sockcred) + (sizeof(gid_t) * ((ngrps) - 1)))
+
+/*
+ * Definitions for network related sysctl, CTL_NET.
+ *
+ * Second level is protocol family.
+ * Third level is protocol number.
+ *
+ * Further levels are defined by the individual families below.
+ */
+#define NET_MAXID AF_MAX
+
+#define CTL_NET_NAMES { \
+ { 0, 0 }, \
+ { "unix", CTLTYPE_NODE }, \
+ { "inet", CTLTYPE_NODE }, \
+ { "implink", CTLTYPE_NODE }, \
+ { "pup", CTLTYPE_NODE }, \
+ { "chaos", CTLTYPE_NODE }, \
+ { "xerox_ns", CTLTYPE_NODE }, \
+ { "iso", CTLTYPE_NODE }, \
+ { "emca", CTLTYPE_NODE }, \
+ { "datakit", CTLTYPE_NODE }, \
+ { "ccitt", CTLTYPE_NODE }, \
+ { "ibm_sna", CTLTYPE_NODE }, \
+ { "decnet", CTLTYPE_NODE }, \
+ { "dec_dli", CTLTYPE_NODE }, \
+ { "lat", CTLTYPE_NODE }, \
+ { "hylink", CTLTYPE_NODE }, \
+ { "appletalk", CTLTYPE_NODE }, \
+ { "route", CTLTYPE_NODE }, \
+ { "link_layer", CTLTYPE_NODE }, \
+ { "xtp", CTLTYPE_NODE }, \
+ { "coip", CTLTYPE_NODE }, \
+ { "cnt", CTLTYPE_NODE }, \
+ { "rtip", CTLTYPE_NODE }, \
+ { "ipx", CTLTYPE_NODE }, \
+ { "inet6", CTLTYPE_NODE }, \
+ { "pip", CTLTYPE_NODE }, \
+ { "isdn", CTLTYPE_NODE }, \
+ { "natm", CTLTYPE_NODE }, \
+ { "encap", CTLTYPE_NODE }, \
+ { "sip", CTLTYPE_NODE }, \
+ { "key", CTLTYPE_NODE }, \
+}
+
+/*
+ * PF_ROUTE - Routing table
+ *
+ * Three additional levels are defined:
+ * Fourth: address family, 0 is wildcard
+ * Fifth: type of info, defined below
+ * Sixth: flag(s) to mask with for NET_RT_FLAGS
+ */
+#define NET_RT_DUMP 1 /* dump; may limit to a.f. */
+#define NET_RT_FLAGS 2 /* by flags, e.g. RESOLVING */
+#define NET_RT_IFLIST 3 /* survey interface list */
+#define NET_RT_MAXID 4
+
+#define CTL_NET_RT_NAMES { \
+ { 0, 0 }, \
+ { "dump", CTLTYPE_STRUCT }, \
+ { "flags", CTLTYPE_STRUCT }, \
+ { "iflist", CTLTYPE_STRUCT }, \
+}
+
+/*
+ * Maximum queue length specifiable by listen(2).
+ */
+#define SOMAXCONN 128
+
+/*
+ * Message header for recvmsg and sendmsg calls.
+ * Used value-result for recvmsg, value only for sendmsg.
+ */
+struct msghdr {
+ caddr_t msg_name; /* optional address */
+ socklen_t msg_namelen; /* size of address */
+ struct iovec *msg_iov; /* scatter/gather array */
+ u_int msg_iovlen; /* # elements in msg_iov */
+ caddr_t msg_control; /* ancillary data, see below */
+ socklen_t msg_controllen; /* ancillary data buffer len */
+ int msg_flags; /* flags on received message */
+};
+
+#define MSG_OOB 0x1 /* process out-of-band data */
+#define MSG_PEEK 0x2 /* peek at incoming message */
+#define MSG_DONTROUTE 0x4 /* send without using routing tables */
+#define MSG_EOR 0x8 /* data completes record */
+#define MSG_TRUNC 0x10 /* data discarded before delivery */
+#define MSG_CTRUNC 0x20 /* control data lost before delivery */
+#define MSG_WAITALL 0x40 /* wait for full request or error */
+#define MSG_DONTWAIT 0x80 /* this message should be nonblocking */
+#define MSG_BCAST 0x100 /* this message rec'd as broadcast */
+#define MSG_MCAST 0x200 /* this message rec'd as multicast */
+
+/*
+ * Header for ancillary data objects in msg_control buffer.
+ * Used for additional information with/about a datagram
+ * not expressible by flags. The format is a sequence
+ * of message elements headed by cmsghdr structures.
+ */
+struct cmsghdr {
+ socklen_t cmsg_len; /* data byte count, including hdr */
+ int cmsg_level; /* originating protocol */
+ int cmsg_type; /* protocol-specific type */
+/* followed by u_char cmsg_data[]; */
+};
+
+/* given pointer to struct cmsghdr, return pointer to data */
+#define CMSG_DATA(cmsg) ((u_char *)((cmsg) + 1))
+
+/* given pointer to struct cmsghdr, return pointer to next cmsghdr */
+#define CMSG_NXTHDR(mhdr, cmsg) \
+ (((caddr_t)(cmsg) + (cmsg)->cmsg_len + sizeof(struct cmsghdr) > \
+ (mhdr)->msg_control + (mhdr)->msg_controllen) ? \
+ (struct cmsghdr *)NULL : \
+ (struct cmsghdr *)((caddr_t)(cmsg) + CMSG_ALIGN((cmsg)->cmsg_len)))
+
+#define CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control)
+
+/* Round len up to next alignment boundary */
+#define CMSG_ALIGN(len) (((len)+sizeof(long)-1) & ~(sizeof(long)-1))
+
+/* Length of the contents of a control message of length len */
+#define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
+
+/* Length of the space taken up by a padded control message of length len */
+#define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len))
+
+/* "Socket"-level control message types: */
+#define SCM_RIGHTS 0x01 /* access rights (array of int) */
+#define SCM_CREDS 0x02 /* credientials (struct sockcred) */
+
+/*
+ * 4.3 compat sockaddr, move to compat file later
+ */
+struct osockaddr {
+ u_short sa_family; /* address family */
+ char sa_data[14]; /* up to 14 bytes of direct address */
+};
+
+/*
+ * 4.3-compat message header (move to compat file later).
+ */
+struct omsghdr {
+ caddr_t msg_name; /* optional address */
+ int msg_namelen; /* size of address */
+ struct iovec *msg_iov; /* scatter/gather array */
+ int msg_iovlen; /* # elements in msg_iov */
+ caddr_t msg_accrights; /* access rights sent/received */
+ int msg_accrightslen;
+};
+
+#define SA_LEN(x) ((x)->sa_len)
+
+#ifndef _KERNEL
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int accept __P((int, struct sockaddr *, socklen_t *));
+int bind __P((int, const struct sockaddr *, socklen_t));
+int connect __P((int, const struct sockaddr *, socklen_t));
+int getpeername __P((int, struct sockaddr *, socklen_t *));
+int getsockname __P((int, struct sockaddr *, socklen_t *));
+int getsockopt __P((int, int, int, void *, socklen_t *));
+int listen __P((int, int));
+ssize_t recv __P((int, void *, size_t, int));
+ssize_t recvfrom __P((int, void *, size_t, int, struct sockaddr *, socklen_t *));
+ssize_t recvmsg __P((int, struct msghdr *, int));
+ssize_t send __P((int, const void *, size_t, int));
+ssize_t sendto __P((int, const void *,
+ size_t, int, const struct sockaddr *, socklen_t));
+ssize_t sendmsg __P((int, const struct msghdr *, int));
+int setsockopt __P((int, int, int, const void *, socklen_t));
+int shutdown __P((int, int));
+int socket __P((int, int, int));
+int socketpair __P((int, int, int, int *));
+__END_DECLS
+#else
+# if defined(COMPAT_43) || defined(COMPAT_SUNOS) || defined(COMPAT_LINUX) || \
+ defined(COMPAT_HPUX) || defined(COMPAT_FREEBSD)
+# define COMPAT_OLDSOCK
+# define MSG_COMPAT 0x8000
+# endif
+
+void pfctlinput __P((int, struct sockaddr *));
+#endif /* !_KERNEL */
+
+#endif /* !_SYS_SOCKET_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/sys/socketvar.h b/ecos/packages/net/tcpip/current/include/sys/socketvar.h
new file mode 100644
index 0000000..4f63689
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/sys/socketvar.h
@@ -0,0 +1,338 @@
+//==========================================================================
+//
+// include/sys/socketvar.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: socketvar.h,v 1.17 1999/12/08 06:50:24 itojun Exp $ */
+/* $NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $ */
+
+/*-
+ * Copyright (c) 1982, 1986, 1990, 1993
+ * 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.
+ *
+ * @(#)socketvar.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _SYS_SOCKETVAR_H_
+#define _SYS_SOCKETVAR_H_
+
+#include <sys/bsdselect.h> /* for struct selinfo */
+
+/*
+ * Kernel structure per socket.
+ * Contains send and receive buffer queues,
+ * handle on protocol and pointer to protocol
+ * private data and error information.
+ */
+struct socket {
+ short so_type; /* generic type, see socket.h */
+ short so_options; /* from socket call, see socket.h */
+ short so_linger; /* time to linger while closing */
+ short so_state; /* internal state flags SS_*, below */
+ void *so_pcb; /* protocol control block */
+ struct protosw *so_proto; /* protocol handle */
+/*
+ * Variables for connection queueing.
+ * Socket where accepts occur is so_head in all subsidiary sockets.
+ * If so_head is 0, socket is not related to an accept.
+ * For head socket so_q0 queues partially completed connections,
+ * while so_q is a queue of connections ready to be accepted.
+ * If a connection is aborted and it has so_head set, then
+ * it has to be pulled out of either so_q0 or so_q.
+ * We allow connections to queue up based on current queue lengths
+ * and limit on number of queued connections for this socket.
+ */
+ struct socket *so_head; /* back pointer to accept socket */
+ struct socket *so_q0; /* queue of partial connections */
+ struct socket *so_q; /* queue of incoming connections */
+ short so_q0len; /* partials on so_q0 */
+ short so_qlen; /* number of connections on so_q */
+ short so_qlimit; /* max number queued connections */
+ short so_timeo; /* connection timeout */
+ u_short so_error; /* error affecting connection */
+ pid_t so_pgid; /* pgid for signals */
+ uid_t so_siguid; /* uid of process who set so_pgid */
+ uid_t so_sigeuid; /* euid of process who set so_pgid */
+ u_long so_oobmark; /* chars to oob mark */
+/*
+ * Variables for socket buffering.
+ */
+ struct sockbuf {
+ u_long sb_cc; /* actual chars in buffer */
+ u_long sb_hiwat; /* max actual char count */
+ u_long sb_mbcnt; /* chars of mbufs used */
+ u_long sb_mbmax; /* max chars of mbufs to use */
+ long sb_lowat; /* low water mark */
+ struct mbuf *sb_mb; /* the mbuf chain */
+ struct selinfo sb_sel; /* process selecting read/write */
+ short sb_flags; /* flags, see below */
+ short sb_timeo; /* timeout for read/write */
+ } so_rcv, so_snd;
+#define SB_MAX (256*1024) /* default for max chars in sockbuf */
+#define SB_LOCK 0x01 /* lock on data queue */
+#define SB_WANT 0x02 /* someone is waiting to lock */
+#define SB_WAIT 0x04 /* someone is waiting for data/space */
+#define SB_SEL 0x08 /* someone is selecting */
+#define SB_ASYNC 0x10 /* ASYNC I/O, need signals */
+#define SB_NOINTR 0x40 /* operations not interruptible */
+
+ void *so_internal; /* Space for svr4 stream data */
+ void (*so_upcall) __P((struct socket *so, caddr_t arg, int waitf));
+ caddr_t so_upcallarg; /* Arg for above */
+ uid_t so_euid; /* who opened the socket */
+ uid_t so_ruid; /* who opened the socket */
+};
+
+/*
+ * Socket state bits.
+ */
+#define SS_NOFDREF 0x001 /* no file table ref any more */
+#define SS_ISCONNECTED 0x002 /* socket connected to a peer */
+#define SS_ISCONNECTING 0x004 /* in process of connecting to peer */
+#define SS_ISDISCONNECTING 0x008 /* in process of disconnecting */
+#define SS_CANTSENDMORE 0x010 /* can't send more data to peer */
+#define SS_CANTRCVMORE 0x020 /* can't receive more data from peer */
+#define SS_RCVATMARK 0x040 /* at mark on input */
+#define SS_ISDISCONNECTED 0x800 /* socket disconnected from peer */
+
+#define SS_PRIV 0x080 /* privileged for broadcast, raw... */
+#define SS_NBIO 0x100 /* non-blocking ops */
+#define SS_ASYNC 0x200 /* async i/o notify */
+#define SS_ISCONFIRMING 0x400 /* deciding to accept connection req */
+#define SS_CONNECTOUT 0x1000 /* connect, not accept, at this end */
+
+/*
+ * Macros for sockets and socket buffering.
+ */
+
+/*
+ * Do we need to notify the other side when I/O is possible?
+ */
+#define sb_notify(sb) (((sb)->sb_flags & (SB_WAIT|SB_SEL|SB_ASYNC)) != 0)
+
+/*
+ * How much space is there in a socket buffer (so->so_snd or so->so_rcv)?
+ * This is problematical if the fields are unsigned, as the space might
+ * still be negative (cc > hiwat or mbcnt > mbmax). Should detect
+ * overflow and return 0. Should use "lmin" but it doesn't exist now.
+ */
+#define sbspace(sb) \
+ ((long) imin((int)((sb)->sb_hiwat - (sb)->sb_cc), \
+ (int)((sb)->sb_mbmax - (sb)->sb_mbcnt)))
+
+/* do we have to send all at once on a socket? */
+#define sosendallatonce(so) \
+ ((so)->so_proto->pr_flags & PR_ATOMIC)
+
+/* can we read something from so? */
+#define soreadable(so) \
+ ((so)->so_rcv.sb_cc >= (so)->so_rcv.sb_lowat || \
+ ((so)->so_state & SS_CANTRCVMORE) || \
+ (so)->so_qlen || (so)->so_error)
+
+/* can we write something to so? */
+#define sowriteable(so) \
+ ((sbspace(&(so)->so_snd) >= (so)->so_snd.sb_lowat && \
+ (((so)->so_state&SS_ISCONNECTED) || \
+ ((so)->so_proto->pr_flags&PR_CONNREQUIRED)==0)) || \
+ ((so)->so_state & SS_CANTSENDMORE) || \
+ (so)->so_error)
+
+/* adjust counters in sb reflecting allocation of m */
+#define sballoc(sb, m) { \
+ (sb)->sb_cc += (m)->m_len; \
+ (sb)->sb_mbcnt += MSIZE; \
+ if ((m)->m_flags & M_EXT) \
+ (sb)->sb_mbcnt += (m)->m_ext.ext_size; \
+}
+
+/* adjust counters in sb reflecting freeing of m */
+#define sbfree(sb, m) { \
+ (sb)->sb_cc -= (m)->m_len; \
+ (sb)->sb_mbcnt -= MSIZE; \
+ if ((m)->m_flags & M_EXT) \
+ (sb)->sb_mbcnt -= (m)->m_ext.ext_size; \
+}
+
+/*
+ * Set lock on sockbuf sb; sleep if lock is already held.
+ * Unless SB_NOINTR is set on sockbuf, sleep is interruptible.
+ * Returns error without lock if sleep is interrupted.
+ */
+#ifdef __ECOS
+extern int sblock(struct sockbuf *sb, int wf);
+extern void sbunlock(struct sockbuf *sb);
+#else
+#define sblock(sb, wf) ((sb)->sb_flags & SB_LOCK ? \
+ (((wf) == M_WAITOK) ? sb_lock(sb) : EWOULDBLOCK) : \
+ ((sb)->sb_flags |= SB_LOCK), 0)
+
+/* release lock on sockbuf sb */
+#define sbunlock(sb) { \
+ (sb)->sb_flags &= ~SB_LOCK; \
+ if ((sb)->sb_flags & SB_WANT) { \
+ (sb)->sb_flags &= ~SB_WANT; \
+ wakeup((caddr_t)&(sb)->sb_flags); \
+ } \
+}
+#endif
+
+#define sorwakeup(so) { sowakeup((so), &(so)->so_rcv); \
+ if ((so)->so_upcall) \
+ (*((so)->so_upcall))((so), (so)->so_upcallarg, M_DONTWAIT); \
+ }
+
+#define sowwakeup(so) sowakeup((so), &(so)->so_snd)
+
+#ifdef _KERNEL
+u_long sb_max;
+/* to catch callers missing new second argument to sonewconn: */
+#define sonewconn(head, connstatus) sonewconn1((head), (connstatus))
+struct socket *sonewconn1 __P((struct socket *head, int connstatus));
+
+/* strings for sleep message: */
+extern char netio[], netcon[], netcls[];
+
+struct mbuf;
+struct sockaddr;
+struct proc;
+struct msghdr;
+struct stat;
+
+/*
+ * File operations on sockets.
+ */
+#ifdef __ECOS
+int soo_read __P((struct file *fp, struct uio *uio));
+int soo_write __P((struct file *fp, struct uio *uio));
+int soo_ioctl __P((struct file *fp, CYG_ADDRWORD cmd, CYG_ADDRWORD data));
+int soo_select __P((struct file *fp, int which));
+int soo_close __P((struct file *fp));
+#else
+int soo_read __P((struct file *fp, struct uio *uio, struct ucred *cred));
+int soo_write __P((struct file *fp, struct uio *uio, struct ucred *cred));
+int soo_ioctl __P((struct file *fp, u_long cmd, caddr_t data,
+ struct proc *p));
+int soo_select __P((struct file *fp, int which, struct proc *p));
+int soo_close __P((struct file *fp, struct proc *p));
+#endif
+
+int soo_stat __P((struct socket *, struct stat *));
+int uipc_usrreq __P((struct socket *, int , struct mbuf *,
+ struct mbuf *, struct mbuf *));
+void sbappend __P((struct sockbuf *sb, struct mbuf *m));
+int sbappendaddr __P((struct sockbuf *sb, struct sockaddr *asa,
+ struct mbuf *m0, struct mbuf *control));
+int sbappendcontrol __P((struct sockbuf *sb, struct mbuf *m0,
+ struct mbuf *control));
+void sbappendrecord __P((struct sockbuf *sb, struct mbuf *m0));
+void sbcheck __P((struct sockbuf *sb));
+void sbcompress __P((struct sockbuf *sb, struct mbuf *m, struct mbuf *n));
+struct mbuf *
+ sbcreatecontrol __P((caddr_t p, int size, int type, int level));
+void sbdrop __P((struct sockbuf *sb, int len));
+void sbdroprecord __P((struct sockbuf *sb));
+void sbflush __P((struct sockbuf *sb));
+void sbinsertoob __P((struct sockbuf *sb, struct mbuf *m0));
+void sbrelease __P((struct sockbuf *sb));
+int sbreserve __P((struct sockbuf *sb, u_long cc));
+int sbwait __P((struct sockbuf *sb));
+int sb_lock __P((struct sockbuf *sb));
+int soabort __P((struct socket *so));
+int soaccept __P((struct socket *so, struct mbuf *nam));
+int sobind __P((struct socket *so, struct mbuf *nam));
+void socantrcvmore __P((struct socket *so));
+void socantsendmore __P((struct socket *so));
+int soclose __P((struct socket *so));
+int soconnect __P((struct socket *so, struct mbuf *nam));
+int soconnect2 __P((struct socket *so1, struct socket *so2));
+int socreate __P((int dom, struct socket **aso, int type, int proto));
+int sodisconnect __P((struct socket *so));
+void sofree __P((struct socket *so));
+int sogetopt __P((struct socket *so, int level, int optname,
+ struct mbuf **mp));
+void sohasoutofband __P((struct socket *so));
+void soisconnected __P((struct socket *so));
+void soisconnecting __P((struct socket *so));
+void soisdisconnected __P((struct socket *so));
+void soisdisconnecting __P((struct socket *so));
+int solisten __P((struct socket *so, int backlog));
+struct socket *
+ sonewconn1 __P((struct socket *head, int connstatus));
+void soqinsque __P((struct socket *head, struct socket *so, int q));
+int soqremque __P((struct socket *so, int q));
+int soreceive __P((struct socket *so, struct mbuf **paddr, struct uio *uio,
+ struct mbuf **mp0, struct mbuf **controlp, int *flagsp));
+int soreserve __P((struct socket *so, u_long sndcc, u_long rcvcc));
+void sorflush __P((struct socket *so));
+int sosend __P((struct socket *so, struct mbuf *addr, struct uio *uio,
+ struct mbuf *top, struct mbuf *control, int flags));
+int sosetopt __P((struct socket *so, int level, int optname,
+ struct mbuf *m0));
+int soshutdown __P((struct socket *so, int how));
+void sowakeup __P((struct socket *so, struct sockbuf *sb));
+int sockargs __P((struct mbuf **, caddr_t, socklen_t, int));
+
+#ifdef __ECOS
+int sendit __P((int, struct msghdr *, int, register_t *));
+int recvit __P((int, struct msghdr *, caddr_t, register_t *));
+#else
+int sendit __P((struct proc *, int, struct msghdr *, int, register_t *));
+int recvit __P((struct proc *, int, struct msghdr *, caddr_t,
+ register_t *));
+#endif
+#endif /* _KERNEL */
+
+#endif // _SYS_SOCKETVAR_H_
diff --git a/ecos/packages/net/tcpip/current/include/sys/sockio.h b/ecos/packages/net/tcpip/current/include/sys/sockio.h
new file mode 100644
index 0000000..211e501
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/sys/sockio.h
@@ -0,0 +1,179 @@
+//==========================================================================
+//
+// include/sys/sockio.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: sockio.h,v 1.10 1999/12/08 06:50:24 itojun Exp $ */
+/* $NetBSD: sockio.h,v 1.5 1995/08/23 00:40:47 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 1982, 1986, 1990, 1993, 1994
+ * 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.
+ *
+ * @(#)sockio.h 8.1 (Berkeley) 3/28/94
+ */
+
+#ifndef _SYS_SOCKIO_H_
+#define _SYS_SOCKIO_H_
+
+#include <sys/ioccom.h>
+
+/* Socket ioctl's. */
+#define SIOCSHIWAT _IOW('s', 0, int) /* set high watermark */
+#define SIOCGHIWAT _IOR('s', 1, int) /* get high watermark */
+#define SIOCSLOWAT _IOW('s', 2, int) /* set low watermark */
+#define SIOCGLOWAT _IOR('s', 3, int) /* get low watermark */
+#define SIOCATMARK _IOR('s', 7, int) /* at oob mark? */
+#define SIOCSPGRP _IOW('s', 8, int) /* set process group */
+#define SIOCGPGRP _IOR('s', 9, int) /* get process group */
+
+#ifdef __ECOS
+#define SIOCADDRT _IOW('r', 10, struct ecos_rtentry) /* add route */
+#define SIOCDELRT _IOW('r', 11, struct ecos_rtentry) /* delete route */
+#else
+#define SIOCADDRT _IOW('r', 10, struct ortentry) /* add route */
+#define SIOCDELRT _IOW('r', 11, struct ortentry) /* delete route */
+#endif
+
+#define SIOCSIFADDR _IOW('i', 12, struct ifreq) /* set ifnet address */
+#define OSIOCGIFADDR _IOWR('i', 13, struct ifreq) /* get ifnet address */
+#define SIOCGIFADDR _IOWR('i', 33, struct ifreq) /* get ifnet address */
+#define SIOCGIFHWADDR _IOWR('i', 15, struct ifreq) /* get MAC address */
+#ifdef __ECOS
+#define SIOCSIFHWADDR _IOW('i',101, struct ifreq) /* set MAC address */
+/* NB these two take a struct ifreq followed by the useful data */
+#define SIOCGIFSTATSUD _IOWR('i',102, struct ifreq) /* get uptodate if stats */
+#define SIOCGIFSTATS _IOWR('i',103, struct ifreq) /* get interface stats */
+#endif
+#define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) /* set p-p address */
+#define OSIOCGIFDSTADDR _IOWR('i', 15, struct ifreq) /* get p-p address */
+#define SIOCGIFDSTADDR _IOWR('i', 34, struct ifreq) /* get p-p address */
+#define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) /* set ifnet flags */
+#define SIOCGIFFLAGS _IOWR('i', 17, struct ifreq) /* get ifnet flags */
+#define OSIOCGIFBRDADDR _IOWR('i', 18, struct ifreq) /* get broadcast addr */
+#define SIOCGIFBRDADDR _IOWR('i', 35, struct ifreq) /* get broadcast addr */
+#define SIOCSIFBRDADDR _IOW('i', 19, struct ifreq) /* set broadcast addr */
+#define OSIOCGIFCONF _IOWR('i', 20, struct ifconf) /* get ifnet list */
+#define SIOCGIFCONF _IOWR('i', 36, struct ifconf) /* get ifnet list */
+#define OSIOCGIFNETMASK _IOWR('i', 21, struct ifreq) /* get net addr mask */
+#define SIOCGIFNETMASK _IOWR('i', 37, struct ifreq) /* get net addr mask */
+#define SIOCSIFNETMASK _IOW('i', 22, struct ifreq) /* set net addr mask */
+#define SIOCGIFMETRIC _IOWR('i', 23, struct ifreq) /* get IF metric */
+#define SIOCSIFMETRIC _IOW('i', 24, struct ifreq) /* set IF metric */
+#define SIOCDIFADDR _IOW('i', 25, struct ifreq) /* delete IF addr */
+#define SIOCAIFADDR _IOW('i', 26, struct ifaliasreq)/* add/chg IF alias */
+#define SIOCGIFDATA _IOWR('i', 27, struct ifreq) /* get if_data */
+
+/* KAME IPv6 */
+/* SIOCAIFALIAS? */
+#define SIOCALIFADDR _IOW('i', 28, struct if_laddrreq) /* add IF addr */
+#define SIOCGLIFADDR _IOWR('i', 29, struct if_laddrreq) /* get IF addr */
+#define SIOCDLIFADDR _IOW('i', 30, struct if_laddrreq) /* delete IF addr */
+
+#define SIOCADDMULTI _IOW('i', 49, struct ifreq) /* add m'cast addr */
+#define SIOCDELMULTI _IOW('i', 50, struct ifreq) /* del m'cast addr */
+#define SIOCGETVIFCNT _IOWR('u', 51, struct sioc_vif_req)/* vif pkt cnt */
+#define SIOCGETSGCNT _IOWR('u', 52, struct sioc_sg_req) /* sg pkt cnt */
+
+#define SIOCSIFMEDIA _IOWR('i', 53, struct ifreq) /* set net media */
+#define SIOCGIFMEDIA _IOWR('i', 54, struct ifmediareq) /* get net media */
+
+#define SIOCSIFPHYADDR _IOW('i', 70, struct ifaliasreq) /* set gif addres */
+#define SIOCGIFPSRCADDR _IOWR('i', 71, struct ifreq) /* get gif psrc addr */
+#define SIOCGIFPDSTADDR _IOWR('i', 72, struct ifreq) /* get gif pdst addr */
+
+#define SIOCBRDGADD _IOWR('i', 60, struct ifbreq) /* add bridge ifs */
+#define SIOCBRDGDEL _IOWR('i', 61, struct ifbreq) /* del bridge ifs */
+#define SIOCBRDGGIFFLGS _IOWR('i', 62, struct ifbreq) /* get brdg if flags */
+#define SIOCBRDGSIFFLGS _IOWR('i', 63, struct ifbreq) /* set brdg if flags */
+#define SIOCBRDGSCACHE _IOWR('i', 64, struct ifbcachereq) /* set cache size */
+#define SIOCBRDGGCACHE _IOWR('i', 65, struct ifbcachereq) /* get cache size */
+#define SIOCBRDGADDS _IOW('i', 65, struct ifbreq) /* add span port */
+#define SIOCBRDGIFS _IOWR('i', 66, struct ifbreq) /* get member ifs */
+#define SIOCBRDGDELS _IOW('i', 66, struct ifbreq) /* del span port */
+#define SIOCBRDGRTS _IOWR('i', 67, struct ifbaconf) /* get addresses */
+#define SIOCBRDGSADDR _IOWR('i', 68, struct ifbareq) /* set addr flags */
+#define SIOCBRDGSTO _IOWR('i', 69, struct ifbcachetoreq) /* cache timeout */
+#define SIOCBRDGGTO _IOWR('i', 70, struct ifbcachetoreq) /* cache timeout */
+#define SIOCBRDGDADDR _IOWR('i', 71, struct ifbareq) /* delete addr */
+#define SIOCBRDGFLUSH _IOWR('i', 72, struct ifbreq) /* flush addr cache */
+
+#define SIOCBRDGARL _IOWR('i', 77, struct ifbrlreq) /* add bridge rule */
+#define SIOCBRDGFRL _IOWR('i', 78, struct ifbrlreq) /* flush brdg rules */
+#define SIOCBRDGGRL _IOWR('i', 79, struct ifbrlconf)/* get bridge rules */
+
+#define SIOCBRDGGPRI _IOWR('i', 80, struct ifbrparam) /* get priority */
+#define SIOCBRDGSPRI _IOW('i', 80, struct ifbrparam) /* set priority */
+#define SIOCBRDGGHT _IOWR('i', 81, struct ifbrparam) /* get hello time */
+#define SIOCBRDGSHT _IOW('i', 81, struct ifbrparam) /* set hello time */
+#define SIOCBRDGGFD _IOWR('i', 82, struct ifbrparam) /* get forward delay */
+#define SIOCBRDGSFD _IOW('i', 82, struct ifbrparam) /* set forward delay */
+#define SIOCBRDGGMA _IOWR('i', 83, struct ifbrparam) /* get max age */
+#define SIOCBRDGSMA _IOW('i', 83, struct ifbrparam) /* set max age */
+#define SIOCBRDGSIFPRIO _IOWR('i', 84, struct ifbreq) /* set if priority */
+#define SIOCBRDGSIFCOST _IOWR('i', 85, struct ifbreq) /* set if cost */
+
+#define SIOCSIFMTU _IOW('i', 127, struct ifreq) /* set ifnet mtu */
+#define SIOCGIFMTU _IOWR('i', 126, struct ifreq) /* get ifnet mtu */
+#define SIOCSIFASYNCMAP _IOW('i', 125, struct ifreq) /* set ppp asyncmap */
+#define SIOCGIFASYNCMAP _IOWR('i', 124, struct ifreq) /* get ppp asyncmap */
+
+#ifdef __ECOS
+#define FIONBIO _IOW('s', 80, int) /* set non-blocking I/O */
+#define FIOASYNC _IOW('s', 81, int) /* set async I/O */
+#define FIONREAD _IOR('s', 82, int) /* get number of avail chars */
+#endif
+
+#endif /* !_SYS_SOCKIO_H_ */
diff --git a/ecos/packages/net/tcpip/current/include/sys/syscallargs.h b/ecos/packages/net/tcpip/current/include/sys/syscallargs.h
new file mode 100644
index 0000000..b1a3872
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/sys/syscallargs.h
@@ -0,0 +1,1411 @@
+//==========================================================================
+//
+// include/sys/syscallargs.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: syscallargs.h,v 1.41 1999/08/08 00:32:22 niklas Exp $ */
+
+/*
+ * System call argument lists.
+ *
+ * DO NOT EDIT-- this file is automatically generated.
+ * created from; OpenBSD: syscalls.master,v 1.37 1999/06/07 07:17:42 deraadt Exp
+ */
+
+#ifndef _SYS_SYSCALLARGS_H_
+#define _SYS_SYSCALLARGS_H_
+
+#define syscallarg(x) union { x datum; register_t pad; }
+
+#ifdef __ECOS
+#define SYSCALLARG(a,t) a.t.datum
+#endif
+
+#ifndef __ECOS
+struct sys_exit_args {
+ syscallarg(int) rval;
+};
+#endif
+
+struct sys_read_args {
+ syscallarg(int) fd;
+ syscallarg(void *) buf;
+ syscallarg(size_t) nbyte;
+};
+extern int sys_read(struct sys_read_args *, register_t *);
+
+struct sys_write_args {
+ syscallarg(int) fd;
+ syscallarg(const void *) buf;
+ syscallarg(size_t) nbyte;
+};
+extern int sys_write(struct sys_write_args *, register_t *);
+
+struct sys_open_args {
+ syscallarg(const char *) path;
+ syscallarg(int) flags;
+ syscallarg(int) mode;
+};
+
+struct sys_close_args {
+ syscallarg(int) fd;
+};
+
+#ifndef __ECOS
+struct sys_wait4_args {
+ syscallarg(int) pid;
+ syscallarg(int *) status;
+ syscallarg(int) options;
+ syscallarg(struct rusage *) rusage;
+};
+
+struct compat_43_sys_creat_args {
+ syscallarg(const char *) path;
+ syscallarg(int) mode;
+};
+
+struct sys_link_args {
+ syscallarg(const char *) path;
+ syscallarg(const char *) link;
+};
+
+struct sys_unlink_args {
+ syscallarg(const char *) path;
+};
+
+struct sys_chdir_args {
+ syscallarg(const char *) path;
+};
+
+struct sys_fchdir_args {
+ syscallarg(int) fd;
+};
+
+struct sys_mknod_args {
+ syscallarg(const char *) path;
+ syscallarg(int) mode;
+ syscallarg(dev_t) dev;
+};
+
+struct sys_chmod_args {
+ syscallarg(const char *) path;
+ syscallarg(int) mode;
+};
+
+struct sys_chown_args {
+ syscallarg(const char *) path;
+ syscallarg(uid_t) uid;
+ syscallarg(gid_t) gid;
+};
+
+struct sys_obreak_args {
+ syscallarg(char *) nsize;
+};
+
+struct sys_ogetfsstat_args {
+ syscallarg(struct statfs *) buf;
+ syscallarg(long) bufsize;
+ syscallarg(int) flags;
+};
+
+struct compat_43_sys_lseek_args {
+ syscallarg(int) fd;
+ syscallarg(long) offset;
+ syscallarg(int) whence;
+};
+
+struct sys_mount_args {
+ syscallarg(const char *) type;
+ syscallarg(const char *) path;
+ syscallarg(int) flags;
+ syscallarg(void *) data;
+};
+
+struct sys_unmount_args {
+ syscallarg(const char *) path;
+ syscallarg(int) flags;
+};
+
+struct sys_setuid_args {
+ syscallarg(uid_t) uid;
+};
+
+struct sys_ptrace_args {
+ syscallarg(int) req;
+ syscallarg(pid_t) pid;
+ syscallarg(caddr_t) addr;
+ syscallarg(int) data;
+};
+
+struct sys_recvmsg_args {
+ syscallarg(int) s;
+ syscallarg(struct msghdr *) msg;
+ syscallarg(int) flags;
+};
+
+struct sys_sendmsg_args {
+ syscallarg(int) s;
+ syscallarg(const struct msghdr *) msg;
+ syscallarg(int) flags;
+};
+#endif
+
+struct sys_recvfrom_args {
+ syscallarg(int) s;
+ syscallarg(void *) buf;
+ syscallarg(size_t) len;
+ syscallarg(int) flags;
+ syscallarg(struct sockaddr *) from;
+ syscallarg(socklen_t *) fromlenaddr;
+};
+extern int sys_recvfrom(struct sys_recvfrom_args *, register_t *);
+
+struct sys_accept_args {
+ syscallarg(int) s;
+ syscallarg(struct sockaddr *) name;
+ syscallarg(socklen_t *) anamelen;
+};
+extern int sys_accept(struct sys_accept_args *, register_t *);
+
+struct sys_getpeername_args {
+ syscallarg(int) fdes;
+ syscallarg(struct sockaddr *) asa;
+ syscallarg(int *) alen;
+};
+extern int sys_getpeername(struct sys_getpeername_args *, register_t *);
+
+struct sys_getsockname_args {
+ syscallarg(int) fdes;
+ syscallarg(struct sockaddr *) asa;
+ syscallarg(socklen_t *) alen;
+};
+extern int sys_getsockname(struct sys_getsockname_args *, register_t *);
+
+struct sys_access_args {
+ syscallarg(const char *) path;
+ syscallarg(int) flags;
+};
+
+#ifndef __ECOS
+struct sys_chflags_args {
+ syscallarg(const char *) path;
+ syscallarg(u_int) flags;
+};
+
+struct sys_fchflags_args {
+ syscallarg(int) fd;
+ syscallarg(u_int) flags;
+};
+
+struct sys_kill_args {
+ syscallarg(int) pid;
+ syscallarg(int) signum;
+};
+
+struct compat_43_sys_stat_args {
+ syscallarg(const char *) path;
+ syscallarg(struct ostat *) ub;
+};
+
+struct compat_43_sys_lstat_args {
+ syscallarg(char *) path;
+ syscallarg(struct ostat *) ub;
+};
+
+struct sys_dup_args {
+ syscallarg(int) fd;
+};
+
+struct sys_profil_args {
+ syscallarg(caddr_t) samples;
+ syscallarg(size_t) size;
+ syscallarg(u_long) offset;
+ syscallarg(u_int) scale;
+};
+
+struct sys_ktrace_args {
+ syscallarg(const char *) fname;
+ syscallarg(int) ops;
+ syscallarg(int) facs;
+ syscallarg(pid_t) pid;
+};
+
+struct sys_sigaction_args {
+ syscallarg(int) signum;
+ syscallarg(const struct sigaction *) nsa;
+ syscallarg(struct sigaction *) osa;
+};
+
+struct sys_sigprocmask_args {
+ syscallarg(int) how;
+ syscallarg(sigset_t) mask;
+};
+
+struct sys_getlogin_args {
+ syscallarg(char *) namebuf;
+ syscallarg(u_int) namelen;
+};
+
+struct sys_setlogin_args {
+ syscallarg(const char *) namebuf;
+};
+
+struct sys_acct_args {
+ syscallarg(const char *) path;
+};
+
+struct sys_sigaltstack_args {
+ syscallarg(const struct sigaltstack *) nss;
+ syscallarg(struct sigaltstack *) oss;
+};
+#endif
+
+struct sys_ioctl_args {
+ syscallarg(int) fd;
+ syscallarg(u_long) com;
+ syscallarg(void *) data;
+};
+extern int sys_ioctl(struct sys_ioctl_args *, register_t *);
+
+#ifndef __ECOS
+struct sys_reboot_args {
+ syscallarg(int) opt;
+};
+
+struct sys_revoke_args {
+ syscallarg(const char *) path;
+};
+
+struct sys_symlink_args {
+ syscallarg(const char *) path;
+ syscallarg(const char *) link;
+};
+
+struct sys_readlink_args {
+ syscallarg(const char *) path;
+ syscallarg(char *) buf;
+ syscallarg(size_t) count;
+};
+
+struct sys_execve_args {
+ syscallarg(const char *) path;
+ syscallarg(char *const *) argp;
+ syscallarg(char *const *) envp;
+};
+
+struct sys_umask_args {
+ syscallarg(int) newmask;
+};
+
+struct sys_chroot_args {
+ syscallarg(const char *) path;
+};
+
+struct compat_43_sys_fstat_args {
+ syscallarg(int) fd;
+ syscallarg(struct ostat *) sb;
+};
+
+struct compat_43_sys_getkerninfo_args {
+ syscallarg(int) op;
+ syscallarg(char *) where;
+ syscallarg(int *) size;
+ syscallarg(int) arg;
+};
+
+struct sys_omsync_args {
+ syscallarg(caddr_t) addr;
+ syscallarg(size_t) len;
+};
+
+struct sys_sbrk_args {
+ syscallarg(int) incr;
+};
+
+struct sys_sstk_args {
+ syscallarg(int) incr;
+};
+
+struct compat_43_sys_mmap_args {
+ syscallarg(caddr_t) addr;
+ syscallarg(size_t) len;
+ syscallarg(int) prot;
+ syscallarg(int) flags;
+ syscallarg(int) fd;
+ syscallarg(long) pos;
+};
+
+struct sys_ovadvise_args {
+ syscallarg(int) anom;
+};
+
+struct sys_munmap_args {
+ syscallarg(void *) addr;
+ syscallarg(size_t) len;
+};
+
+struct sys_mprotect_args {
+ syscallarg(void *) addr;
+ syscallarg(size_t) len;
+ syscallarg(int) prot;
+};
+
+struct sys_madvise_args {
+ syscallarg(void *) addr;
+ syscallarg(size_t) len;
+ syscallarg(int) behav;
+};
+
+struct sys_mincore_args {
+ syscallarg(void *) addr;
+ syscallarg(size_t) len;
+ syscallarg(char *) vec;
+};
+
+struct sys_getgroups_args {
+ syscallarg(int) gidsetsize;
+ syscallarg(gid_t *) gidset;
+};
+
+struct sys_setgroups_args {
+ syscallarg(int) gidsetsize;
+ syscallarg(const gid_t *) gidset;
+};
+
+struct sys_setpgid_args {
+ syscallarg(pid_t) pid;
+ syscallarg(int) pgid;
+};
+
+struct sys_setitimer_args {
+ syscallarg(int) which;
+ syscallarg(const struct itimerval *) itv;
+ syscallarg(struct itimerval *) oitv;
+};
+
+struct sys_swapon_args {
+ syscallarg(const char *) name;
+};
+
+struct sys_getitimer_args {
+ syscallarg(int) which;
+ syscallarg(struct itimerval *) itv;
+};
+
+struct compat_43_sys_gethostname_args {
+ syscallarg(char *) hostname;
+ syscallarg(u_int) len;
+};
+
+struct compat_43_sys_sethostname_args {
+ syscallarg(char *) hostname;
+ syscallarg(u_int) len;
+};
+
+struct sys_dup2_args {
+ syscallarg(int) from;
+ syscallarg(int) to;
+};
+
+struct sys_fcntl_args {
+ syscallarg(int) fd;
+ syscallarg(int) cmd;
+ syscallarg(void *) arg;
+};
+#endif
+
+struct sys_select_args {
+ syscallarg(int) nd;
+ syscallarg(fd_set *) in;
+ syscallarg(fd_set *) ou;
+ syscallarg(fd_set *) ex;
+ syscallarg(struct timeval *) tv;
+};
+extern int sys_select(struct sys_select_args *, register_t *);
+
+#ifndef __ECOS
+struct sys_fsync_args {
+ syscallarg(int) fd;
+};
+
+struct sys_setpriority_args {
+ syscallarg(int) which;
+ syscallarg(int) who;
+ syscallarg(int) prio;
+};
+#endif
+
+struct sys_socket_args {
+ syscallarg(int) domain;
+ syscallarg(int) type;
+ syscallarg(int) protocol;
+};
+extern int sys_socket(struct sys_socket_args *, register_t *);
+
+struct sys_connect_args {
+ syscallarg(int) s;
+ syscallarg(const struct sockaddr *) name;
+ syscallarg(socklen_t) namelen;
+};
+extern int sys_connect(struct sys_connect_args *, register_t *);
+
+#ifndef __ECOS
+struct compat_43_sys_accept_args {
+ syscallarg(int) s;
+ syscallarg(caddr_t) name;
+ syscallarg(int *) anamelen;
+};
+
+struct sys_getpriority_args {
+ syscallarg(int) which;
+ syscallarg(int) who;
+};
+
+struct compat_43_sys_send_args {
+ syscallarg(int) s;
+ syscallarg(caddr_t) buf;
+ syscallarg(int) len;
+ syscallarg(int) flags;
+};
+
+struct compat_43_sys_recv_args {
+ syscallarg(int) s;
+ syscallarg(caddr_t) buf;
+ syscallarg(int) len;
+ syscallarg(int) flags;
+};
+
+struct sys_sigreturn_args {
+ syscallarg(struct sigcontext *) sigcntxp;
+};
+#endif
+
+struct sys_bind_args {
+ syscallarg(int) s;
+ syscallarg(const struct sockaddr *) name;
+ syscallarg(socklen_t) namelen;
+};
+extern int sys_bind(struct sys_bind_args *, register_t *);
+
+struct sys_setsockopt_args {
+ syscallarg(int) s;
+ syscallarg(int) level;
+ syscallarg(int) name;
+ syscallarg(const void *) val;
+ syscallarg(socklen_t) valsize;
+};
+extern int sys_setsockopt(struct sys_setsockopt_args *, register_t *);
+
+struct sys_listen_args {
+ syscallarg(int) s;
+ syscallarg(int) backlog;
+};
+extern int sys_listen(struct sys_listen_args *, register_t *);
+
+#ifndef __ECOS
+struct compat_43_sys_sigvec_args {
+ syscallarg(int) signum;
+ syscallarg(struct sigvec *) nsv;
+ syscallarg(struct sigvec *) osv;
+};
+
+struct compat_43_sys_sigblock_args {
+ syscallarg(int) mask;
+};
+
+struct compat_43_sys_sigsetmask_args {
+ syscallarg(int) mask;
+};
+
+struct sys_sigsuspend_args {
+ syscallarg(int) mask;
+};
+
+struct compat_43_sys_sigstack_args {
+ syscallarg(struct sigstack *) nss;
+ syscallarg(struct sigstack *) oss;
+};
+
+struct compat_43_sys_recvmsg_args {
+ syscallarg(int) s;
+ syscallarg(struct omsghdr *) msg;
+ syscallarg(int) flags;
+};
+
+struct compat_43_sys_sendmsg_args {
+ syscallarg(int) s;
+ syscallarg(caddr_t) msg;
+ syscallarg(int) flags;
+};
+
+struct sys_vtrace_args {
+ syscallarg(int) request;
+ syscallarg(int) value;
+};
+
+struct sys_gettimeofday_args {
+ syscallarg(struct timeval *) tp;
+ syscallarg(struct timezone *) tzp;
+};
+
+struct sys_getrusage_args {
+ syscallarg(int) who;
+ syscallarg(struct rusage *) rusage;
+};
+#endif
+
+struct sys_getsockopt_args {
+ syscallarg(int) s;
+ syscallarg(int) level;
+ syscallarg(int) name;
+ syscallarg(void *) val;
+ syscallarg(socklen_t *) avalsize;
+};
+extern int sys_getsockopt(struct sys_getsockopt_args *, register_t *);
+
+struct sys_readv_args {
+ syscallarg(int) fd;
+ syscallarg(const struct iovec *) iovp;
+ syscallarg(int) iovcnt;
+};
+
+struct sys_writev_args {
+ syscallarg(int) fd;
+ syscallarg(const struct iovec *) iovp;
+ syscallarg(int) iovcnt;
+};
+
+#ifndef __ECOS
+struct sys_settimeofday_args {
+ syscallarg(const struct timeval *) tv;
+ syscallarg(const struct timezone *) tzp;
+};
+
+struct sys_fchown_args {
+ syscallarg(int) fd;
+ syscallarg(uid_t) uid;
+ syscallarg(gid_t) gid;
+};
+
+struct sys_fchmod_args {
+ syscallarg(int) fd;
+ syscallarg(int) mode;
+};
+
+struct compat_43_sys_recvfrom_args {
+ syscallarg(int) s;
+ syscallarg(caddr_t) buf;
+ syscallarg(size_t) len;
+ syscallarg(int) flags;
+ syscallarg(caddr_t) from;
+ syscallarg(int *) fromlenaddr;
+};
+
+struct compat_43_sys_setreuid_args {
+ syscallarg(int) ruid;
+ syscallarg(int) euid;
+};
+
+struct compat_43_sys_setregid_args {
+ syscallarg(int) rgid;
+ syscallarg(int) egid;
+};
+
+struct sys_rename_args {
+ syscallarg(const char *) from;
+ syscallarg(const char *) to;
+};
+
+struct compat_43_sys_truncate_args {
+ syscallarg(const char *) path;
+ syscallarg(long) length;
+};
+
+struct compat_43_sys_ftruncate_args {
+ syscallarg(int) fd;
+ syscallarg(long) length;
+};
+
+struct sys_flock_args {
+ syscallarg(int) fd;
+ syscallarg(int) how;
+};
+
+struct sys_mkfifo_args {
+ syscallarg(const char *) path;
+ syscallarg(int) mode;
+};
+#endif
+
+struct sys_sendto_args {
+ syscallarg(int) s;
+ syscallarg(const void *) buf;
+ syscallarg(size_t) len;
+ syscallarg(int) flags;
+ syscallarg(const struct sockaddr *) to;
+ syscallarg(socklen_t) tolen;
+};
+extern int sys_sendto(struct sys_sendto_args *, register_t *);
+
+struct sys_shutdown_args {
+ syscallarg(int) s;
+ syscallarg(int) how;
+};
+extern int sys_shutdown(struct sys_shutdown_args *, register_t *);
+
+struct sys_socketpair_args {
+ syscallarg(int) domain;
+ syscallarg(int) type;
+ syscallarg(int) protocol;
+ syscallarg(int *) rsv;
+};
+
+#ifndef __ECOS
+struct sys_mkdir_args {
+ syscallarg(const char *) path;
+ syscallarg(int) mode;
+};
+
+struct sys_rmdir_args {
+ syscallarg(const char *) path;
+};
+
+struct sys_utimes_args {
+ syscallarg(const char *) path;
+ syscallarg(const struct timeval *) tptr;
+};
+
+struct sys_adjtime_args {
+ syscallarg(const struct timeval *) delta;
+ syscallarg(struct timeval *) olddelta;
+};
+
+struct compat_43_sys_getpeername_args {
+ syscallarg(int) fdes;
+ syscallarg(caddr_t) asa;
+ syscallarg(socklen_t *) alen;
+};
+
+struct compat_43_sys_sethostid_args {
+ syscallarg(int32_t) hostid;
+};
+
+struct compat_43_sys_getrlimit_args {
+ syscallarg(int) which;
+ syscallarg(struct ogetrlimit *) rlp;
+};
+
+struct compat_43_sys_setrlimit_args {
+ syscallarg(int) which;
+ syscallarg(struct ogetrlimit *) rlp;
+};
+
+struct compat_43_sys_killpg_args {
+ syscallarg(int) pgid;
+ syscallarg(int) signum;
+};
+
+struct sys_quotactl_args {
+ syscallarg(const char *) path;
+ syscallarg(int) cmd;
+ syscallarg(int) uid;
+ syscallarg(char *) arg;
+};
+
+struct compat_43_sys_getsockname_args {
+ syscallarg(int) fdec;
+ syscallarg(caddr_t) asa;
+ syscallarg(int *) alen;
+};
+
+struct sys_nfssvc_args {
+ syscallarg(int) flag;
+ syscallarg(void *) argp;
+};
+
+struct compat_43_sys_getdirentries_args {
+ syscallarg(int) fd;
+ syscallarg(char *) buf;
+ syscallarg(int) count;
+ syscallarg(long *) basep;
+};
+
+struct sys_ostatfs_args {
+ syscallarg(const char *) path;
+ syscallarg(struct ostatfs *) buf;
+};
+
+struct sys_ofstatfs_args {
+ syscallarg(int) fd;
+ syscallarg(struct ostatfs *) buf;
+};
+
+struct sys_getfh_args {
+ syscallarg(const char *) fname;
+ syscallarg(fhandle_t *) fhp;
+};
+
+struct compat_09_sys_getdomainname_args {
+ syscallarg(char *) domainname;
+ syscallarg(int) len;
+};
+
+struct compat_09_sys_setdomainname_args {
+ syscallarg(char *) domainname;
+ syscallarg(int) len;
+};
+
+struct compat_09_sys_uname_args {
+ syscallarg(struct outsname *) name;
+};
+
+struct sys_sysarch_args {
+ syscallarg(int) op;
+ syscallarg(char *) parms;
+};
+
+struct compat_10_sys_semsys_args {
+ syscallarg(int) which;
+ syscallarg(int) a2;
+ syscallarg(int) a3;
+ syscallarg(int) a4;
+ syscallarg(int) a5;
+};
+
+struct compat_10_sys_msgsys_args {
+ syscallarg(int) which;
+ syscallarg(int) a2;
+ syscallarg(int) a3;
+ syscallarg(int) a4;
+ syscallarg(int) a5;
+ syscallarg(int) a6;
+};
+
+struct compat_10_sys_shmsys_args {
+ syscallarg(int) which;
+ syscallarg(int) a2;
+ syscallarg(int) a3;
+ syscallarg(int) a4;
+};
+
+struct sys_ntp_gettime_args {
+ syscallarg(struct ntptimeval *) ntvp;
+};
+
+struct sys_ntp_adjtime_args {
+ syscallarg(struct timex *) tp;
+};
+
+struct sys_setgid_args {
+ syscallarg(gid_t) gid;
+};
+
+struct sys_setegid_args {
+ syscallarg(gid_t) egid;
+};
+
+struct sys_seteuid_args {
+ syscallarg(uid_t) euid;
+};
+
+struct lfs_bmapv_args {
+ syscallarg(fsid_t *) fsidp;
+ syscallarg(struct block_info *) blkiov;
+ syscallarg(int) blkcnt;
+};
+
+struct lfs_markv_args {
+ syscallarg(fsid_t *) fsidp;
+ syscallarg(struct block_info *) blkiov;
+ syscallarg(int) blkcnt;
+};
+
+struct lfs_segclean_args {
+ syscallarg(fsid_t *) fsidp;
+ syscallarg(u_long) segment;
+};
+
+struct lfs_segwait_args {
+ syscallarg(fsid_t *) fsidp;
+ syscallarg(struct timeval *) tv;
+};
+
+struct sys_stat_args {
+ syscallarg(const char *) path;
+ syscallarg(struct stat *) ub;
+};
+
+struct sys_fstat_args {
+ syscallarg(int) fd;
+ syscallarg(struct stat *) sb;
+};
+
+struct sys_lstat_args {
+ syscallarg(const char *) path;
+ syscallarg(struct stat *) ub;
+};
+
+struct sys_pathconf_args {
+ syscallarg(const char *) path;
+ syscallarg(int) name;
+};
+
+struct sys_fpathconf_args {
+ syscallarg(int) fd;
+ syscallarg(int) name;
+};
+
+struct sys_swapctl_args {
+ syscallarg(int) cmd;
+ syscallarg(const void *) arg;
+ syscallarg(int) misc;
+};
+
+struct sys_getrlimit_args {
+ syscallarg(int) which;
+ syscallarg(struct rlimit *) rlp;
+};
+
+struct sys_setrlimit_args {
+ syscallarg(int) which;
+ syscallarg(const struct rlimit *) rlp;
+};
+
+struct sys_getdirentries_args {
+ syscallarg(int) fd;
+ syscallarg(char *) buf;
+ syscallarg(int) count;
+ syscallarg(long *) basep;
+};
+
+struct sys_mmap_args {
+ syscallarg(void *) addr;
+ syscallarg(size_t) len;
+ syscallarg(int) prot;
+ syscallarg(int) flags;
+ syscallarg(int) fd;
+ syscallarg(long) pad;
+ syscallarg(off_t) pos;
+};
+
+struct sys_lseek_args {
+ syscallarg(int) fd;
+ syscallarg(int) pad;
+ syscallarg(off_t) offset;
+ syscallarg(int) whence;
+};
+
+struct sys_truncate_args {
+ syscallarg(const char *) path;
+ syscallarg(int) pad;
+ syscallarg(off_t) length;
+};
+
+struct sys_ftruncate_args {
+ syscallarg(int) fd;
+ syscallarg(int) pad;
+ syscallarg(off_t) length;
+};
+
+struct sys___sysctl_args {
+ syscallarg(int *) name;
+ syscallarg(u_int) namelen;
+ syscallarg(void *) old;
+ syscallarg(size_t *) oldlenp;
+ syscallarg(void *) new;
+ syscallarg(size_t) newlen;
+};
+
+struct sys_mlock_args {
+ syscallarg(const void *) addr;
+ syscallarg(size_t) len;
+};
+
+struct sys_munlock_args {
+ syscallarg(const void *) addr;
+ syscallarg(size_t) len;
+};
+
+struct sys_undelete_args {
+ syscallarg(const char *) path;
+};
+
+struct sys_futimes_args {
+ syscallarg(int) fd;
+ syscallarg(const struct timeval *) tptr;
+};
+
+struct sys_getpgid_args {
+ syscallarg(pid_t) pid;
+};
+
+struct sys_xfspioctl_args {
+ syscallarg(int) operation;
+ syscallarg(char *) a_pathP;
+ syscallarg(int) a_opcode;
+ syscallarg(struct ViceIoctl *) a_paramsP;
+ syscallarg(int) a_followSymlinks;
+};
+
+struct sys___osemctl_args {
+ syscallarg(int) semid;
+ syscallarg(int) semnum;
+ syscallarg(int) cmd;
+ syscallarg(union semun *) arg;
+};
+
+struct sys_semget_args {
+ syscallarg(key_t) key;
+ syscallarg(int) nsems;
+ syscallarg(int) semflg;
+};
+
+struct sys_semop_args {
+ syscallarg(int) semid;
+ syscallarg(struct sembuf *) sops;
+ syscallarg(u_int) nsops;
+};
+
+struct sys_semconfig_args {
+ syscallarg(int) flag;
+};
+
+struct sys_omsgctl_args {
+ syscallarg(int) msqid;
+ syscallarg(int) cmd;
+ syscallarg(struct omsqid_ds *) buf;
+};
+
+struct sys_msgget_args {
+ syscallarg(key_t) key;
+ syscallarg(int) msgflg;
+};
+
+struct sys_msgsnd_args {
+ syscallarg(int) msqid;
+ syscallarg(const void *) msgp;
+ syscallarg(size_t) msgsz;
+ syscallarg(int) msgflg;
+};
+
+struct sys_msgrcv_args {
+ syscallarg(int) msqid;
+ syscallarg(void *) msgp;
+ syscallarg(size_t) msgsz;
+ syscallarg(long) msgtyp;
+ syscallarg(int) msgflg;
+};
+
+struct sys_shmat_args {
+ syscallarg(int) shmid;
+ syscallarg(const void *) shmaddr;
+ syscallarg(int) shmflg;
+};
+
+struct sys_oshmctl_args {
+ syscallarg(int) shmid;
+ syscallarg(int) cmd;
+ syscallarg(struct oshmid_ds *) buf;
+};
+
+struct sys_shmdt_args {
+ syscallarg(const void *) shmaddr;
+};
+
+struct sys_shmget_args {
+ syscallarg(key_t) key;
+ syscallarg(int) size;
+ syscallarg(int) shmflg;
+};
+
+struct sys_clock_gettime_args {
+ syscallarg(clockid_t) clock_id;
+ syscallarg(struct timespec *) tp;
+};
+
+struct sys_clock_settime_args {
+ syscallarg(clockid_t) clock_id;
+ syscallarg(const struct timespec *) tp;
+};
+
+struct sys_clock_getres_args {
+ syscallarg(clockid_t) clock_id;
+ syscallarg(struct timespec *) tp;
+};
+
+struct sys_nanosleep_args {
+ syscallarg(const struct timespec *) rqtp;
+ syscallarg(struct timespec *) rmtp;
+};
+
+struct sys_minherit_args {
+ syscallarg(void *) addr;
+ syscallarg(size_t) len;
+ syscallarg(int) inherit;
+};
+
+struct sys_rfork_args {
+ syscallarg(int) flags;
+};
+
+struct sys_poll_args {
+ syscallarg(struct pollfd *) fds;
+ syscallarg(unsigned long) nfds;
+ syscallarg(int) timeout;
+};
+
+struct sys_lchown_args {
+ syscallarg(const char *) path;
+ syscallarg(uid_t) uid;
+ syscallarg(gid_t) gid;
+};
+
+struct sys_getsid_args {
+ syscallarg(pid_t) pid;
+};
+
+struct sys_msync_args {
+ syscallarg(void *) addr;
+ syscallarg(size_t) len;
+ syscallarg(int) flags;
+};
+
+struct sys___semctl_args {
+ syscallarg(int) semid;
+ syscallarg(int) semnum;
+ syscallarg(int) cmd;
+ syscallarg(union semun *) arg;
+};
+
+struct sys_shmctl_args {
+ syscallarg(int) shmid;
+ syscallarg(int) cmd;
+ syscallarg(struct shmid_ds *) buf;
+};
+
+struct sys_msgctl_args {
+ syscallarg(int) msqid;
+ syscallarg(int) cmd;
+ syscallarg(struct msqid_ds *) buf;
+};
+
+struct sys_getfsstat_args {
+ syscallarg(struct statfs *) buf;
+ syscallarg(size_t) bufsize;
+ syscallarg(int) flags;
+};
+
+struct sys_statfs_args {
+ syscallarg(const char *) path;
+ syscallarg(struct statfs *) buf;
+};
+
+struct sys_fstatfs_args {
+ syscallarg(int) fd;
+ syscallarg(struct statfs *) buf;
+};
+
+struct sys_pipe_args {
+ syscallarg(int *) fdp;
+};
+
+/*
+ * System call prototypes.
+ */
+
+int sys_exit __P((struct proc *, void *, register_t *));
+int sys_fork __P((struct proc *, void *, register_t *));
+int sys_read __P((struct proc *, void *, register_t *));
+int sys_write __P((struct proc *, void *, register_t *));
+int sys_open __P((struct proc *, void *, register_t *));
+int sys_close __P((struct proc *, void *, register_t *));
+int sys_wait4 __P((struct proc *, void *, register_t *));
+int compat_43_sys_creat __P((struct proc *, void *, register_t *));
+int sys_link __P((struct proc *, void *, register_t *));
+int sys_unlink __P((struct proc *, void *, register_t *));
+int sys_chdir __P((struct proc *, void *, register_t *));
+int sys_fchdir __P((struct proc *, void *, register_t *));
+int sys_mknod __P((struct proc *, void *, register_t *));
+int sys_chmod __P((struct proc *, void *, register_t *));
+int sys_chown __P((struct proc *, void *, register_t *));
+int sys_obreak __P((struct proc *, void *, register_t *));
+int sys_ogetfsstat __P((struct proc *, void *, register_t *));
+int compat_43_sys_lseek __P((struct proc *, void *, register_t *));
+int sys_getpid __P((struct proc *, void *, register_t *));
+int sys_mount __P((struct proc *, void *, register_t *));
+int sys_unmount __P((struct proc *, void *, register_t *));
+int sys_setuid __P((struct proc *, void *, register_t *));
+int sys_getuid __P((struct proc *, void *, register_t *));
+int sys_geteuid __P((struct proc *, void *, register_t *));
+int sys_ptrace __P((struct proc *, void *, register_t *));
+int sys_recvmsg __P((struct proc *, void *, register_t *));
+int sys_sendmsg __P((struct proc *, void *, register_t *));
+int sys_recvfrom __P((struct proc *, void *, register_t *));
+int sys_accept __P((struct proc *, void *, register_t *));
+int sys_getpeername __P((struct proc *, void *, register_t *));
+int sys_getsockname __P((struct proc *, void *, register_t *));
+int sys_access __P((struct proc *, void *, register_t *));
+int sys_chflags __P((struct proc *, void *, register_t *));
+int sys_fchflags __P((struct proc *, void *, register_t *));
+int sys_sync __P((struct proc *, void *, register_t *));
+int sys_kill __P((struct proc *, void *, register_t *));
+int compat_43_sys_stat __P((struct proc *, void *, register_t *));
+int sys_getppid __P((struct proc *, void *, register_t *));
+int compat_43_sys_lstat __P((struct proc *, void *, register_t *));
+int sys_dup __P((struct proc *, void *, register_t *));
+int sys_opipe __P((struct proc *, void *, register_t *));
+int sys_getegid __P((struct proc *, void *, register_t *));
+int sys_profil __P((struct proc *, void *, register_t *));
+#ifdef KTRACE
+int sys_ktrace __P((struct proc *, void *, register_t *));
+#else
+#endif
+int sys_sigaction __P((struct proc *, void *, register_t *));
+int sys_getgid __P((struct proc *, void *, register_t *));
+int sys_sigprocmask __P((struct proc *, void *, register_t *));
+int sys_getlogin __P((struct proc *, void *, register_t *));
+int sys_setlogin __P((struct proc *, void *, register_t *));
+int sys_acct __P((struct proc *, void *, register_t *));
+int sys_sigpending __P((struct proc *, void *, register_t *));
+int sys_sigaltstack __P((struct proc *, void *, register_t *));
+int sys_ioctl __P((struct proc *, void *, register_t *));
+int sys_reboot __P((struct proc *, void *, register_t *));
+int sys_revoke __P((struct proc *, void *, register_t *));
+int sys_symlink __P((struct proc *, void *, register_t *));
+int sys_readlink __P((struct proc *, void *, register_t *));
+int sys_execve __P((struct proc *, void *, register_t *));
+int sys_umask __P((struct proc *, void *, register_t *));
+int sys_chroot __P((struct proc *, void *, register_t *));
+int compat_43_sys_fstat __P((struct proc *, void *, register_t *));
+int compat_43_sys_getkerninfo __P((struct proc *, void *, register_t *));
+int compat_43_sys_getpagesize __P((struct proc *, void *, register_t *));
+int sys_omsync __P((struct proc *, void *, register_t *));
+int sys_vfork __P((struct proc *, void *, register_t *));
+int sys_sbrk __P((struct proc *, void *, register_t *));
+int sys_sstk __P((struct proc *, void *, register_t *));
+int compat_43_sys_mmap __P((struct proc *, void *, register_t *));
+int sys_ovadvise __P((struct proc *, void *, register_t *));
+int sys_munmap __P((struct proc *, void *, register_t *));
+int sys_mprotect __P((struct proc *, void *, register_t *));
+int sys_madvise __P((struct proc *, void *, register_t *));
+int sys_mincore __P((struct proc *, void *, register_t *));
+int sys_getgroups __P((struct proc *, void *, register_t *));
+int sys_setgroups __P((struct proc *, void *, register_t *));
+int sys_getpgrp __P((struct proc *, void *, register_t *));
+int sys_setpgid __P((struct proc *, void *, register_t *));
+int sys_setitimer __P((struct proc *, void *, register_t *));
+int compat_43_sys_wait __P((struct proc *, void *, register_t *));
+int sys_swapon __P((struct proc *, void *, register_t *));
+int sys_getitimer __P((struct proc *, void *, register_t *));
+int compat_43_sys_gethostname __P((struct proc *, void *, register_t *));
+int compat_43_sys_sethostname __P((struct proc *, void *, register_t *));
+int compat_43_sys_getdtablesize __P((struct proc *, void *, register_t *));
+int sys_dup2 __P((struct proc *, void *, register_t *));
+int sys_fcntl __P((struct proc *, void *, register_t *));
+int sys_select __P((struct proc *, void *, register_t *));
+int sys_fsync __P((struct proc *, void *, register_t *));
+int sys_setpriority __P((struct proc *, void *, register_t *));
+int sys_socket __P((struct proc *, void *, register_t *));
+int sys_connect __P((struct proc *, void *, register_t *));
+int compat_43_sys_accept __P((struct proc *, void *, register_t *));
+int sys_getpriority __P((struct proc *, void *, register_t *));
+int compat_43_sys_send __P((struct proc *, void *, register_t *));
+int compat_43_sys_recv __P((struct proc *, void *, register_t *));
+int sys_sigreturn __P((struct proc *, void *, register_t *));
+int sys_bind __P((struct proc *, void *, register_t *));
+int sys_setsockopt __P((struct proc *, void *, register_t *));
+int sys_listen __P((struct proc *, void *, register_t *));
+int compat_43_sys_sigvec __P((struct proc *, void *, register_t *));
+int compat_43_sys_sigblock __P((struct proc *, void *, register_t *));
+int compat_43_sys_sigsetmask __P((struct proc *, void *, register_t *));
+int sys_sigsuspend __P((struct proc *, void *, register_t *));
+int compat_43_sys_sigstack __P((struct proc *, void *, register_t *));
+int compat_43_sys_recvmsg __P((struct proc *, void *, register_t *));
+int compat_43_sys_sendmsg __P((struct proc *, void *, register_t *));
+#ifdef TRACE
+int sys_vtrace __P((struct proc *, void *, register_t *));
+#else
+#endif
+int sys_gettimeofday __P((struct proc *, void *, register_t *));
+int sys_getrusage __P((struct proc *, void *, register_t *));
+int sys_getsockopt __P((struct proc *, void *, register_t *));
+int sys_readv __P((struct proc *, void *, register_t *));
+int sys_writev __P((struct proc *, void *, register_t *));
+int sys_settimeofday __P((struct proc *, void *, register_t *));
+int sys_fchown __P((struct proc *, void *, register_t *));
+int sys_fchmod __P((struct proc *, void *, register_t *));
+int compat_43_sys_recvfrom __P((struct proc *, void *, register_t *));
+int compat_43_sys_setreuid __P((struct proc *, void *, register_t *));
+int compat_43_sys_setregid __P((struct proc *, void *, register_t *));
+int sys_rename __P((struct proc *, void *, register_t *));
+int compat_43_sys_truncate __P((struct proc *, void *, register_t *));
+int compat_43_sys_ftruncate __P((struct proc *, void *, register_t *));
+int sys_flock __P((struct proc *, void *, register_t *));
+int sys_mkfifo __P((struct proc *, void *, register_t *));
+int sys_sendto __P((struct proc *, void *, register_t *));
+int sys_shutdown __P((struct proc *, void *, register_t *));
+int sys_socketpair __P((struct proc *, void *, register_t *));
+int sys_mkdir __P((struct proc *, void *, register_t *));
+int sys_rmdir __P((struct proc *, void *, register_t *));
+int sys_utimes __P((struct proc *, void *, register_t *));
+int sys_adjtime __P((struct proc *, void *, register_t *));
+int compat_43_sys_getpeername __P((struct proc *, void *, register_t *));
+int compat_43_sys_gethostid __P((struct proc *, void *, register_t *));
+int compat_43_sys_sethostid __P((struct proc *, void *, register_t *));
+int compat_43_sys_getrlimit __P((struct proc *, void *, register_t *));
+int compat_43_sys_setrlimit __P((struct proc *, void *, register_t *));
+int compat_43_sys_killpg __P((struct proc *, void *, register_t *));
+int sys_setsid __P((struct proc *, void *, register_t *));
+int sys_quotactl __P((struct proc *, void *, register_t *));
+int compat_43_sys_quota __P((struct proc *, void *, register_t *));
+int compat_43_sys_getsockname __P((struct proc *, void *, register_t *));
+#if defined(NFSCLIENT) || defined(NFSSERVER)
+int sys_nfssvc __P((struct proc *, void *, register_t *));
+#else
+#endif
+int compat_43_sys_getdirentries __P((struct proc *, void *, register_t *));
+int sys_ostatfs __P((struct proc *, void *, register_t *));
+int sys_ofstatfs __P((struct proc *, void *, register_t *));
+#if defined(NFSCLIENT) || defined(NFSSERVER)
+int sys_getfh __P((struct proc *, void *, register_t *));
+#else
+#endif
+int compat_09_sys_getdomainname __P((struct proc *, void *, register_t *));
+int compat_09_sys_setdomainname __P((struct proc *, void *, register_t *));
+int compat_09_sys_uname __P((struct proc *, void *, register_t *));
+int sys_sysarch __P((struct proc *, void *, register_t *));
+#if defined(SYSVSEM) && !defined(alpha)
+int compat_10_sys_semsys __P((struct proc *, void *, register_t *));
+#else
+#endif
+#if defined(SYSVMSG) && !defined(alpha)
+int compat_10_sys_msgsys __P((struct proc *, void *, register_t *));
+#else
+#endif
+#if defined(SYSVSHM) && !defined(alpha)
+int compat_10_sys_shmsys __P((struct proc *, void *, register_t *));
+#else
+#endif
+#ifdef NTP
+int sys_ntp_gettime __P((struct proc *, void *, register_t *));
+int sys_ntp_adjtime __P((struct proc *, void *, register_t *));
+#else
+#endif
+int sys_setgid __P((struct proc *, void *, register_t *));
+int sys_setegid __P((struct proc *, void *, register_t *));
+int sys_seteuid __P((struct proc *, void *, register_t *));
+#ifdef LFS
+int lfs_bmapv __P((struct proc *, void *, register_t *));
+int lfs_markv __P((struct proc *, void *, register_t *));
+int lfs_segclean __P((struct proc *, void *, register_t *));
+int lfs_segwait __P((struct proc *, void *, register_t *));
+#else
+#endif
+int sys_stat __P((struct proc *, void *, register_t *));
+int sys_fstat __P((struct proc *, void *, register_t *));
+int sys_lstat __P((struct proc *, void *, register_t *));
+int sys_pathconf __P((struct proc *, void *, register_t *));
+int sys_fpathconf __P((struct proc *, void *, register_t *));
+int sys_swapctl __P((struct proc *, void *, register_t *));
+int sys_getrlimit __P((struct proc *, void *, register_t *));
+int sys_setrlimit __P((struct proc *, void *, register_t *));
+int sys_getdirentries __P((struct proc *, void *, register_t *));
+int sys_mmap __P((struct proc *, void *, register_t *));
+int sys_lseek __P((struct proc *, void *, register_t *));
+int sys_truncate __P((struct proc *, void *, register_t *));
+int sys_ftruncate __P((struct proc *, void *, register_t *));
+int sys___sysctl __P((struct proc *, void *, register_t *));
+int sys_mlock __P((struct proc *, void *, register_t *));
+int sys_munlock __P((struct proc *, void *, register_t *));
+int sys_undelete __P((struct proc *, void *, register_t *));
+int sys_futimes __P((struct proc *, void *, register_t *));
+int sys_getpgid __P((struct proc *, void *, register_t *));
+int sys_xfspioctl __P((struct proc *, void *, register_t *));
+#ifdef LKM
+int sys_lkmnosys __P((struct proc *, void *, register_t *));
+int sys_lkmnosys __P((struct proc *, void *, register_t *));
+int sys_lkmnosys __P((struct proc *, void *, register_t *));
+int sys_lkmnosys __P((struct proc *, void *, register_t *));
+int sys_lkmnosys __P((struct proc *, void *, register_t *));
+int sys_lkmnosys __P((struct proc *, void *, register_t *));
+int sys_lkmnosys __P((struct proc *, void *, register_t *));
+int sys_lkmnosys __P((struct proc *, void *, register_t *));
+int sys_lkmnosys __P((struct proc *, void *, register_t *));
+int sys_lkmnosys __P((struct proc *, void *, register_t *));
+#else /* !LKM */
+#endif /* !LKM */
+#ifdef SYSVSEM
+int sys___osemctl __P((struct proc *, void *, register_t *));
+int sys_semget __P((struct proc *, void *, register_t *));
+int sys_semop __P((struct proc *, void *, register_t *));
+int sys_semconfig __P((struct proc *, void *, register_t *));
+#else
+#endif
+#ifdef SYSVMSG
+int sys_omsgctl __P((struct proc *, void *, register_t *));
+int sys_msgget __P((struct proc *, void *, register_t *));
+int sys_msgsnd __P((struct proc *, void *, register_t *));
+int sys_msgrcv __P((struct proc *, void *, register_t *));
+#else
+#endif
+#ifdef SYSVSHM
+int sys_shmat __P((struct proc *, void *, register_t *));
+int sys_oshmctl __P((struct proc *, void *, register_t *));
+int sys_shmdt __P((struct proc *, void *, register_t *));
+int sys_shmget __P((struct proc *, void *, register_t *));
+#else
+#endif
+int sys_clock_gettime __P((struct proc *, void *, register_t *));
+int sys_clock_settime __P((struct proc *, void *, register_t *));
+int sys_clock_getres __P((struct proc *, void *, register_t *));
+int sys_nanosleep __P((struct proc *, void *, register_t *));
+int sys_minherit __P((struct proc *, void *, register_t *));
+int sys_rfork __P((struct proc *, void *, register_t *));
+int sys_poll __P((struct proc *, void *, register_t *));
+int sys_issetugid __P((struct proc *, void *, register_t *));
+int sys_lchown __P((struct proc *, void *, register_t *));
+int sys_getsid __P((struct proc *, void *, register_t *));
+int sys_msync __P((struct proc *, void *, register_t *));
+#ifdef SYSVSEM
+int sys___semctl __P((struct proc *, void *, register_t *));
+#else
+#endif
+#ifdef SYSVSHM
+int sys_shmctl __P((struct proc *, void *, register_t *));
+#else
+#endif
+#ifdef SYSVMSG
+int sys_msgctl __P((struct proc *, void *, register_t *));
+#else
+#endif
+int sys_getfsstat __P((struct proc *, void *, register_t *));
+int sys_statfs __P((struct proc *, void *, register_t *));
+int sys_fstatfs __P((struct proc *, void *, register_t *));
+int sys_pipe __P((struct proc *, void *, register_t *));
+#endif
+
+#endif // _SYS_SYSCALLARGS_H_
diff --git a/ecos/packages/net/tcpip/current/include/sys/time.h b/ecos/packages/net/tcpip/current/include/sys/time.h
new file mode 100644
index 0000000..775817a
--- /dev/null
+++ b/ecos/packages/net/tcpip/current/include/sys/time.h
@@ -0,0 +1,239 @@
+//==========================================================================
+//
+// include/sys/time.h
+//
+//
+//
+//==========================================================================
+// ####BSDALTCOPYRIGHTBEGIN####
+// -------------------------------------------
+// Portions of this software may have been derived from OpenBSD
+// or other sources, and if so are covered by the appropriate copyright
+// and license included herein.
+// -------------------------------------------
+// ####BSDALTCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): gthomas
+// Contributors: gthomas
+// Date: 2000-01-10
+// Purpose:
+// Description:
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+/* $OpenBSD: time.h,v 1.9 1999/12/06 19:36:42 aaron Exp $ */
+/* $NetBSD: time.h,v 1.18 1996/04/23 10:29:33 mycroft Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1993
+ * 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.
+ *
+ * @(#)time.h 8.2 (Berkeley) 7/10/94
+ */
+
+#ifndef _SYS_TIME_H_
+#define _SYS_TIME_H_
+
+#include <sys/types.h>
+#include <time.h>
+
+#if 0 //ndef __time_t_defined
+typedef int time_t;
+# define __time_t_defined
+#endif
+
+#if 0
+
+/*
+ * Structure returned by gettimeofday(2) system call,
+ * and used in other calls.
+ */
+struct timeval {
+ long tv_sec; /* seconds */
+ long tv_usec; /* and microseconds */
+};
+
+#endif
+
+#if 0
+/*
+ * Structure defined by POSIX.1b to be like a timeval.
+ */
+struct timespec {
+ time_t tv_sec; /* seconds */
+ long tv_nsec; /* and nanoseconds */
+};
+#endif
+
+#define TIMEVAL_TO_TIMESPEC(tv, ts) { \
+ (ts)->tv_sec = (tv)->tv_sec; \
+ (ts)->tv_nsec = (tv)->tv_usec * 1000; \
+}
+#define TIMESPEC_TO_TIMEVAL(tv, ts) { \
+ (tv)->tv_sec = (ts)->tv_sec; \
+ (tv)->tv_usec = (ts)->tv_nsec / 1000; \
+}
+
+struct timezone {
+ int tz_minuteswest; /* minutes west of Greenwich */
+ int tz_dsttime; /* type of dst correction */
+};
+#define DST_NONE 0 /* not on dst */
+#define DST_USA 1 /* USA style dst */
+#define DST_AUST 2 /* Australian style dst */
+#define DST_WET 3 /* Western European dst */
+#define DST_MET 4 /* Middle European dst */
+#define DST_EET 5 /* Eastern European dst */
+#define DST_CAN 6 /* Canada */
+
+/* Operations on timevals. */
+#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
+#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
+#define timercmp(tvp, uvp, cmp) \
+ (((tvp)->tv_sec == (uvp)->tv_sec) ? \
+ ((tvp)->tv_usec cmp (uvp)->tv_usec) : \
+ ((tvp)->tv_sec cmp (uvp)->tv_sec))
+#define timeradd(tvp, uvp, vvp) \
+ do { \
+ (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
+ (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
+ if ((vvp)->tv_usec >= 1000000) { \
+ (vvp)->tv_sec++; \
+ (vvp)->tv_usec -= 1000000; \
+ } \
+ } while (0)
+#define timersub(tvp, uvp, vvp) \
+ do { \
+ (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
+ (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
+ if ((vvp)->tv_usec < 0) { \
+ (vvp)->tv_sec--; \
+ (vvp)->tv_usec += 1000000; \
+ } \
+ } while (0)
+
+/* Operations on timespecs. */
+#define timespecclear(tsp) (tsp)->tv_sec = (tsp)->tv_nsec = 0
+#define timespecisset(tsp) ((tsp)->tv_sec || (tsp)->tv_nsec)
+#define timespeccmp(tsp, usp, cmp) \
+ (((tsp)->tv_sec == (usp)->tv_sec) ? \
+ ((tsp)->tv_nsec cmp (usp)->tv_nsec) : \
+ ((tsp)->tv_sec cmp (usp)->tv_sec))
+#define timespecadd(tsp, usp, vsp) \
+ do { \
+ (vsp)->tv_sec = (tsp)->tv_sec + (usp)->tv_sec; \
+ (vsp)->tv_nsec = (tsp)->tv_nsec + (usp)->tv_nsec; \
+ if ((vsp)->tv_nsec >= 1000000000L) { \
+ (vsp)->tv_sec++; \
+ (vsp)->tv_nsec -= 1000000000L; \
+ } \
+ } while (0)
+#define timespecsub(tsp, usp, vsp) \
+ do { \
+ (vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \
+ (vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec; \
+ if ((vsp)->tv_nsec < 0) { \
+ (vsp)->tv_sec--; \
+ (vsp)->tv_nsec += 1000000000L; \
+ } \
+ } while (0)
+
+/*
+ * Names of the interval timers, and structure
+ * defining a timer setting.
+ */
+#define ITIMER_REAL 0
+#define ITIMER_VIRTUAL 1
+#define ITIMER_PROF 2
+
+struct itimerval {
+ struct timeval it_interval; /* timer interval */
+ struct timeval it_value; /* current value */
+};
+
+/*
+ * Getkerninfo clock information structure
+ */
+struct clockinfo {
+ int hz; /* clock frequency */
+ int tick; /* micro-seconds per hz tick */
+ int tickadj; /* clock skew rate for adjtime() */
+ int stathz; /* statistics clock frequency */
+ int profhz; /* profiling clock frequency */
+};
+
+#define CLOCK_REALTIME 0
+#define CLOCK_VIRTUAL 1
+#define CLOCK_PROF 2
+
+#define TIMER_RELTIME 0x0 /* relative timer */
+#ifndef TIMER_ABSTIME
+#define TIMER_ABSTIME 0x1 /* absolute timer */
+#endif
+
+#if defined(_KERNEL) || defined(_STANDALONE)
+int itimerfix __P((struct timeval *tv));
+int itimerdecr __P((struct itimerval *itp, int usec));
+void microtime __P((struct timeval *tv));
+void settime __P((struct timeval *tv));
+#else /* !_KERNEL */
+
+#ifndef __ECOS
+#include <time.h>
+#endif
+
+#if 0 //ndef _POSIX_SOURCE
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int adjtime __P((const struct timeval *, struct timeval *));
+int clock_getres __P((clockid_t, struct timespec *));
+int clock_gettime __P((clockid_t, struct timespec *));
+int clock_settime __P((clockid_t, const struct timespec *));
+int futimes __P((int, const struct timeval *));
+int getitimer __P((int, struct itimerval *));
+int gettimeofday __P((struct timeval *, struct timezone *));
+int nanosleep __P((const struct timespec *, struct timespec *));
+int setitimer __P((int, const struct itimerval *, struct itimerval *));
+int settimeofday __P((const struct timeval *, const struct timezone *));
+int utimes __P((const char *, const struct timeval *));
+__END_DECLS
+#endif /* !POSIX */
+
+#endif /* !_KERNEL */
+
+#endif /* !_SYS_TIME_H_ */