changeset 3054:9af84e9efbe5

* Removed files left behind by cvs conversion in changeset d6c0c0e0431c
author alexs
date Tue, 20 Sep 2011 11:23:46 +0100
parents f2704f782643
children d72e3f7ef586
files packages/io/eth/current/src/lwip/README packages/net/lwip_tcpip/current/src/core/inet.c packages/net/lwip_tcpip/current/src/ecos/init.c packages/net/lwip_tcpip/current/src/netif/ppp/ppp.h packages/net/lwip_tcpip/current/tests/httpd.c
diffstat 5 files changed, 0 insertions(+), 1602 deletions(-) [+]
line wrap: on
line diff
deleted file mode 100644
--- a/packages/io/eth/current/src/lwip/README
+++ /dev/null
@@ -1,10 +0,0 @@
-An EPK of lwip is available from http://humans.iv.ro/jani which has the most
-up-to-date package (at least until it all gets integrated).
-
-It has just been tested on another ARM similar to the EB40 with CS89000
-and it works there too (that board has 128K of RAM).
-
-Alternatively, lw.diff is the diff against the lwip-0.5.3 tree. It contains
-eCos support + an eCos project sample based on unixsim. Look at
-lwip-0.5.3/proj/ecos to see how to use it. Modify the Makefile to suit
-your needs and to reflect your eCos project dir.
deleted file mode 100644
--- a/packages/net/lwip_tcpip/current/src/core/inet.c
+++ /dev/null
@@ -1,525 +0,0 @@
-/*
- * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
- * 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. 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.
- *
- * This file is part of the lwIP TCP/IP stack.
- *
- * Author: Adam Dunkels <adam@sics.se>
- *
- */
-
-
-/* inet.c
- *
- * Functions common to all TCP/IP modules, such as the Internet checksum and the
- * byte order functions.
- *
- */
-
-
-#include "lwip/opt.h"
-
-#include "lwip/arch.h"
-
-#include "lwip/def.h"
-#include "lwip/inet.h"
-
-#include "lwip/sys.h"
-
-/* This is a reference implementation of the checksum algorithm, with the
- * aim of being simple, correct and fully portable. Checksumming is the
- * first thing you would want to optimize for your platform. You will
- * need to port it to your architecture and in your sys_arch.h:
- * 
- * #define LWIP_CHKSUM <your_checksum_routine> 
-*/
-#ifndef LWIP_CHKSUM
-#define LWIP_CHKSUM lwip_standard_chksum
-
-/**
- * lwip checksum
- *
- * @param dataptr points to start of data to be summed at any boundary
- * @param len length of data to be summed
- * @return host order (!) lwip checksum (non-inverted Internet sum) 
- *
- * @note accumulator size limits summable lenght to 64k
- * @note host endianess is irrelevant (p3 RFC1071)
- */
-static u16_t
-lwip_standard_chksum(void *dataptr, u16_t len)
-{
-  u32_t acc;
-  u16_t src;
-  u8_t *octetptr;
-
-  acc = 0;
-  /* dataptr may be at odd or even addresses */
-  octetptr = (u8_t*)dataptr;
-  while (len > 1)
-  {
-    /* declare first octet as most significant
-       thus assume network order, ignoring host order */
-    src = (*octetptr) << 8;
-    octetptr++;
-    /* declare second octet as least significant */
-    src |= (*octetptr);
-    octetptr++;
-    acc += src;
-    len -= 2;
-  }
-  if (len > 0)
-  {
-    /* accumulate remaining octet */
-    src = (*octetptr) << 8;
-    acc += src;
-  }
-  /* add deferred carry bits */
-  acc = (acc >> 16) + (acc & 0x0000ffffUL);
-  if ((acc & 0xffff0000) != 0) {
-    acc = (acc >> 16) + (acc & 0x0000ffffUL);
-  }
-  /* This maybe a little confusing: reorder sum using htons()
-     instead of ntohs() since it has a little less call overhead.
-     The caller must invert bits for Internet sum ! */
-  return htons((u16_t)acc);
-}
-
-#endif
-
-#if 0
-/*
- * Curt McDowell
- * Broadcom Corp.
- * csm@broadcom.com
- *
- * IP checksum two bytes at a time with support for
- * unaligned buffer.
- * Works for len up to and including 0x20000.
- * by Curt McDowell, Broadcom Corp. 12/08/2005
- */
-
-static u16_t
-lwip_standard_chksum2(void *dataptr, int len)
-{
-  u8_t *pb = dataptr;
-  u16_t *ps, t = 0;
-  u32_t sum = 0;
-  int odd = ((u32_t)pb & 1);
-
-  /* Get aligned to u16_t */
-  if (odd && len > 0) {
-    ((u8_t *)&t)[1] = *pb++;
-    len--;
-  }
-
-  /* Add the bulk of the data */
-  ps = (u16_t *)pb;
-  while (len > 1) {
-    sum += *ps++;
-    len -= 2;
-  }
-
-  /* Consume left-over byte, if any */
-  if (len > 0)
-    ((u8_t *)&t)[0] = *(u8_t *)ps;;
-
-  /* Add end bytes */
-  sum += t;
-
-  /*  Fold 32-bit sum to 16 bits */
-  while (sum >> 16)
-    sum = (sum & 0xffff) + (sum >> 16);
-
-  /* Swap if alignment was odd */
-  if (odd)
-    sum = ((sum & 0xff) << 8) | ((sum & 0xff00) >> 8);
-
-  return sum;
-}
-
-/**
- * An optimized checksum routine. Basically, it uses loop-unrolling on
- * the checksum loop, treating the head and tail bytes specially, whereas
- * the inner loop acts on 8 bytes at a time. 
- *
- * @arg start of buffer to be checksummed. May be an odd byte address.
- * @len number of bytes in the buffer to be checksummed.
- * 
- * @todo First argument type conflicts with generic checksum routine.
- * 
- * by Curt McDowell, Broadcom Corp. December 8th, 2005
- */
-
-static u16_t
-lwip_standard_chksum4(u8_t *pb, int len)
-{
-  u16_t *ps, t = 0;
-  u32_t *pl;
-  u32_t sum = 0, tmp;
-  /* starts at odd byte address? */
-  int odd = ((u32_t)pb & 1);
-
-  if (odd && len > 0) {
-    ((u8_t *)&t)[1] = *pb++;
-    len--;
-  }
-
-  ps = (u16_t *)pb;
-
-  if (((u32_t)ps & 3) && len > 1) {
-    sum += *ps++;
-    len -= 2;
-  }
-
-  pl = (u32_t *)ps;
-
-  while (len > 7)  {
-    tmp = sum + *pl++;          /* ping */
-    if (tmp < sum)
-      tmp++;                    /* add back carry */
-
-    sum = tmp + *pl++;          /* pong */
-    if (sum < tmp)
-      sum++;                    /* add back carry */
-
-    len -= 8;
-  }
-
-  /* make room in upper bits */
-  sum = (sum >> 16) + (sum & 0xffff);
-
-  ps = (u16_t *)pl;
-
-  /* 16-bit aligned word remaining? */
-  while (len > 1) {
-    sum += *ps++;
-    len -= 2;
-  }
-
-  /* dangling tail byte remaining? */
-  if (len > 0)                  /* include odd byte */
-    ((u8_t *)&t)[0] = *(u8_t *)ps;
-
-  sum += t;                     /* add end bytes */
-
-  while (sum >> 16)             /* combine halves */
-    sum = (sum >> 16) + (sum & 0xffff);
-
-  if (odd)
-    sum = ((sum & 0xff) << 8) | ((sum & 0xff00) >> 8);
-
-  return sum;
-}
-#endif
-
-/* inet_chksum_pseudo:
- *
- * Calculates the pseudo Internet checksum used by TCP and UDP for a pbuf chain.
- */
-
-u16_t
-inet_chksum_pseudo(struct pbuf *p,
-       struct ip_addr *src, struct ip_addr *dest,
-       u8_t proto, u16_t proto_len)
-{
-  u32_t acc;
-  struct pbuf *q;
-  u8_t swapped;
-
-  acc = 0;
-  swapped = 0;
-  /* iterate through all pbuf in chain */
-  for(q = p; q != NULL; q = q->next) {
-    LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): checksumming pbuf %p (has next %p) \n",
-      (void *)q, (void *)q->next));
-    acc += LWIP_CHKSUM(q->payload, q->len);
-    /*LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): unwrapped lwip_chksum()=%"X32_F" \n", acc));*/
-    while (acc >> 16) {
-      acc = (acc & 0xffffUL) + (acc >> 16);
-    }
-    if (q->len % 2 != 0) {
-      swapped = 1 - swapped;
-      acc = ((acc & 0xff) << 8) | ((acc & 0xff00UL) >> 8);
-    }
-    /*LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): wrapped lwip_chksum()=%"X32_F" \n", acc));*/
-  }
-
-  if (swapped) {
-    acc = ((acc & 0xff) << 8) | ((acc & 0xff00UL) >> 8);
-  }
-  acc += (src->addr & 0xffffUL);
-  acc += ((src->addr >> 16) & 0xffffUL);
-  acc += (dest->addr & 0xffffUL);
-  acc += ((dest->addr >> 16) & 0xffffUL);
-  acc += (u32_t)htons((u16_t)proto);
-  acc += (u32_t)htons(proto_len);
-
-  while (acc >> 16) {
-    acc = (acc & 0xffffUL) + (acc >> 16);
-  }
-  LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): pbuf chain lwip_chksum()=%"X32_F"\n", acc));
-  return (u16_t)~(acc & 0xffffUL);
-}
-
-/* inet_chksum:
- *
- * Calculates the Internet checksum over a portion of memory. Used primarely for IP
- * and ICMP.
- */
-
-u16_t
-inet_chksum(void *dataptr, u16_t len)
-{
-  u32_t acc;
-
-  acc = LWIP_CHKSUM(dataptr, len);
-  while (acc >> 16) {
-    acc = (acc & 0xffff) + (acc >> 16);
-  }
-  return (u16_t)~(acc & 0xffff);
-}
-
-u16_t
-inet_chksum_pbuf(struct pbuf *p)
-{
-  u32_t acc;
-  struct pbuf *q;
-  u8_t swapped;
-
-  acc = 0;
-  swapped = 0;
-  for(q = p; q != NULL; q = q->next) {
-    acc += LWIP_CHKSUM(q->payload, q->len);
-    while (acc >> 16) {
-      acc = (acc & 0xffffUL) + (acc >> 16);
-    }
-    if (q->len % 2 != 0) {
-      swapped = 1 - swapped;
-      acc = (acc & 0x00ffUL << 8) | (acc & 0xff00UL >> 8);
-    }
-  }
-
-  if (swapped) {
-    acc = ((acc & 0x00ffUL) << 8) | ((acc & 0xff00UL) >> 8);
-  }
-  return (u16_t)~(acc & 0xffffUL);
-}
-
-/* Here for now until needed in other places in lwIP */
-#ifndef isascii
-#define in_range(c, lo, up)  ((u8_t)c >= lo && (u8_t)c <= up)
-#define isascii(c)           in_range(c, 0x20, 0x7f)
-#define isdigit(c)           in_range(c, '0', '9')
-#define isxdigit(c)          (isdigit(c) || in_range(c, 'a', 'f') || in_range(c, 'A', 'F'))
-#define islower(c)           in_range(c, 'a', 'z')
-#define isspace(c)           (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v')
-#endif		
-		
-
- /*
-  * Ascii internet address interpretation routine.
-  * The value returned is in network order.
-  */
-
- /*  */
- /* inet_addr */
- u32_t inet_addr(const char *cp)
- {
-     struct in_addr val;
-
-     if (inet_aton(cp, &val)) {
-         return (val.s_addr);
-     }
-     return (INADDR_NONE);
- }
-
- /*
-  * Check whether "cp" is a valid ascii representation
-  * of an Internet address and convert to a binary address.
-  * Returns 1 if the address is valid, 0 if not.
-  * This replaces inet_addr, the return value from which
-  * cannot distinguish between failure and a local broadcast address.
-  */
- /*  */
- /* inet_aton */
- s8_t
- inet_aton(const char *cp, struct in_addr *addr)
- {
-     u32_t val;
-     s32_t base, n;
-     char c;
-     u32_t parts[4];
-     u32_t* pp = parts;
-
-     c = *cp;
-     for (;;) {
-         /*
-          * Collect number up to ``.''.
-          * Values are specified as for C:
-          * 0x=hex, 0=octal, isdigit=decimal.
-          */
-         if (!isdigit(c))
-             return (0);
-         val = 0; base = 10;
-         if (c == '0') {
-             c = *++cp;
-             if (c == 'x' || c == 'X')
-                 base = 16, c = *++cp;
-             else
-                 base = 8;
-         }
-         for (;;) {
-             if (isdigit(c)) {
-                 val = (val * base) + (s16_t)(c - '0');
-                 c = *++cp;
-             } else if (base == 16 && isxdigit(c)) {
-                 val = (val << 4) |
-                     (s16_t)(c + 10 - (islower(c) ? 'a' : 'A'));
-                 c = *++cp;
-             } else
-             break;
-         }
-         if (c == '.') {
-             /*
-              * Internet format:
-              *  a.b.c.d
-              *  a.b.c   (with c treated as 16 bits)
-              *  a.b (with b treated as 24 bits)
-              */
-             if (pp >= parts + 3)
-                 return (0);
-             *pp++ = val;
-             c = *++cp;
-         } else
-             break;
-     }
-     /*
-      * Check for trailing characters.
-      */
-     if (c != '\0' && (!isascii(c) || !isspace(c)))
-         return (0);
-     /*
-      * Concoct the address according to
-      * the number of parts specified.
-      */
-     n = pp - parts + 1;
-     switch (n) {
-
-     case 0:
-         return (0);     /* initial nondigit */
-
-     case 1:             /* a -- 32 bits */
-         break;
-
-     case 2:             /* a.b -- 8.24 bits */
-         if (val > 0xffffff)
-             return (0);
-         val |= parts[0] << 24;
-         break;
-
-     case 3:             /* a.b.c -- 8.8.16 bits */
-         if (val > 0xffff)
-             return (0);
-         val |= (parts[0] << 24) | (parts[1] << 16);
-         break;
-
-     case 4:             /* a.b.c.d -- 8.8.8.8 bits */
-         if (val > 0xff)
-             return (0);
-         val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
-         break;
-     }
-     if (addr)
-         addr->s_addr = htonl(val);
-     return (1);
- }
-
-/* Convert numeric IP address into decimal dotted ASCII representation.
- * returns ptr to static buffer; not reentrant!
- */
-char *inet_ntoa(struct in_addr addr)
-{
-  static char str[16];
-  u32_t s_addr = addr.s_addr;
-  char inv[3];
-  char *rp;
-  u8_t *ap;
-  u8_t rem;
-  u8_t n;
-  u8_t i;
-
-  rp = str;
-  ap = (u8_t *)&s_addr;
-  for(n = 0; n < 4; n++) {
-    i = 0;
-    do {
-      rem = *ap % (u8_t)10;
-      *ap /= (u8_t)10;
-      inv[i++] = '0' + rem;
-    } while(*ap);
-    while(i--)
-      *rp++ = inv[i];
-    *rp++ = '.';
-    ap++;
-  }
-  *--rp = 0;
-  return str;
-}
-
-
-#ifndef BYTE_ORDER
-#error BYTE_ORDER is not defined
-#endif
-#if BYTE_ORDER == LITTLE_ENDIAN
-
-u16_t
-htons(u16_t n)
-{
-  return ((n & 0xff) << 8) | ((n & 0xff00) >> 8);
-}
-
-u16_t
-ntohs(u16_t n)
-{
-  return htons(n);
-}
-
-u32_t
-htonl(u32_t n)
-{
-  return ((n & 0xff) << 24) |
-    ((n & 0xff00) << 8) |
-    ((n & 0xff0000) >> 8) |
-    ((n & 0xff000000) >> 24);
-}
-
-u32_t
-ntohl(u32_t n)
-{
-  return htonl(n);
-}
-
-#endif /* BYTE_ORDER == LITTLE_ENDIAN */
deleted file mode 100644
--- a/packages/net/lwip_tcpip/current/src/ecos/init.c
+++ /dev/null
@@ -1,325 +0,0 @@
-//==========================================================================
-// ####ECOSGPLCOPYRIGHTBEGIN####                                            
-// -------------------------------------------                              
-// This file is part of eCos, the Embedded Configurable Operating System.   
-// Copyright (C) 2004 Free Software Foundation, Inc.                        
-//
-// eCos is free software; you can redistribute it and/or modify it under    
-// the terms of the GNU General Public License as published by the Free     
-// Software Foundation; either version 2 or (at your option) any later      
-// version.                                                                 
-//
-// eCos is distributed in the hope that it will be useful, but WITHOUT      
-// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
-// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
-// for more details.                                                        
-//
-// You should have received a copy of the GNU General Public License        
-// along with eCos; if not, write to the Free Software Foundation, Inc.,    
-// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
-//
-// As a special exception, if other files instantiate templates or use      
-// macros or inline functions from this file, or you compile this file      
-// and link it with other works to produce a work based on this file,       
-// this file does not by itself cause the resulting work to be covered by   
-// the GNU General Public License. However the source code for this file    
-// must still be made available in accordance with section (3) of the GNU   
-// General Public License v2.                                               
-//
-// This exception does not invalidate any other reasons why a work based    
-// on this file might be covered by the GNU General Public License.         
-// -------------------------------------------                              
-// ####ECOSGPLCOPYRIGHTEND####                                              
-//==========================================================================
-
-/*
- * init.c - misc lwip ecos glue functions 
- */
-#include <pkgconf/system.h>
-#include <pkgconf/net_lwip.h>
-#include "lwip/opt.h"
-#include "lwip/sys.h"
-#include "lwip/memp.h"
-#include "lwip/tcpip.h"
-#include "lwip/ip_addr.h"
-
-#if LWIP_DHCP
-#include "lwip/dhcp.h"
-#endif
-
-#if LWIP_SLIP
-#include "netif/slipif.h"
-#endif
-
-#if PPP_SUPPORT
-#include "netif/ppp/ppp.h"
-#endif
-
-#include "netif/loopif.h"
-#include <cyg/hal/hal_if.h>
-#include <cyg/infra/diag.h>
-
-#ifdef CYGPKG_LWIP_ETH
-#include "netif/etharp.h"
-
-#include <cyg/io/eth/eth_drv.h>
-#include <cyg/io/eth/netdev.h>
-
-
-// Define table boundaries
-CYG_HAL_TABLE_BEGIN(__NETDEVTAB__, netdev);
-CYG_HAL_TABLE_END(__NETDEVTAB_END__, netdev);
-static void ecosglue_init(void);
-#endif
-
-void inline IP_ADDR(struct ip_addr *ipaddr, char a, char b, char c, char d)
-{
-	IP4_ADDR(ipaddr,a,b,c,d);
-}
-
-
-struct netif mynetif, loopif;
-void lwip_set_addr(struct netif *netif);
-#if PPP_SUPPORT
-#define PPP_USER "pppuser"
-#define PPP_PASS "ppppass"
-
-void 
-pppMyCallback(void *a , int e, void * arg)
-{
-	diag_printf("callback %d \n",e);
-}
-
-/* These temporarily here */
-unsigned long
-sys_jiffies(void)
-{
-   return cyg_current_time();
-}
-
-void 
-ppp_trace(int level, const char *format,...)
-{
-    va_list args;
-
-    (void)level;
-    va_start(args, format);
-    diag_vprintf(format, args);
-    va_end(args);
-}	
-#endif
-
-#if LWIP_HAVE_LOOPIF
-struct netif ecos_loopif;
-#endif
-
-#ifdef CYGPKG_LWIP_ETH
-static void
-arp_timer(void *arg)
-{
-  etharp_tmr();
-  sys_timeout(ARP_TMR_INTERVAL, (sys_timeout_handler) arp_timer, NULL);
-}
-#endif
-
-#if LWIP_DHCP
-static void lwip_dhcp_fine_tmr(void *arg)
-{
-    dhcp_fine_tmr();
-    sys_timeout(500, (sys_timeout_handler) lwip_dhcp_fine_tmr, NULL);
-}
-
-static void lwip_dhcp_coarse_tmr(void *arg)
-{
-    dhcp_coarse_tmr();
-    sys_timeout(60000, (sys_timeout_handler) lwip_dhcp_coarse_tmr, NULL);
-}
-#endif
-
-
-//
-// This function is called when tcpip thread finished initialisation.
-// We start several timers here - these timers are all handled in the
-// tcpip thread. That means that also the DHCP stuff is handled in the
-// TCPIP thread. If this causes any trouble than it may be necessaray to
-// use an own DHCP thread insted.
-//
-void tcpip_init_done(void * arg)
-{
-#ifdef CYGPKG_LWIP_ETH
-    sys_timeout(ARP_TMR_INTERVAL, (sys_timeout_handler) arp_timer, NULL);
-#endif
-#ifdef CYGOPT_LWIP_DHCP_MANAGEMENT
-	sys_timeout(500, (sys_timeout_handler) lwip_dhcp_fine_tmr, NULL);
-	sys_timeout(60000, (sys_timeout_handler) lwip_dhcp_coarse_tmr, NULL);
-#endif
-	sys_sem_t *sem = arg;
-	sys_sem_signal(*sem);
-}
-
-
-/*
- * Called by the eCos application at startup
- * wraps various init calls
- */
-int
-lwip_init(void)
-{
-#if LWIP_HAVE_LOOPIF
-	struct ip_addr ipaddr, netmask, gw;
-#endif
-	static int inited = 0;
-	sys_sem_t sem;
-	if (inited)
-		return 1;
-	inited++;
-	
-	sys_init();	/* eCos specific initialization */
-	mem_init();	/* heap based memory allocator */
-	memp_init();	/* pool based memory allocator */
-	pbuf_init();	/* packet buffer allocator */
-	netif_init();	/* netif layer */
-	
-	/* Start the stack.It will spawn a new dedicated thread */
-	sem = sys_sem_new(0);
-	tcpip_init(tcpip_init_done,&sem);
-	sys_sem_wait(sem);
-	sys_sem_free(sem);
-
-#if LWIP_HAVE_LOOPIF
-	IP4_ADDR(&gw, 127,0,0,1);
-	IP4_ADDR(&ipaddr, 127,0,0,1);
-	IP4_ADDR(&netmask, 255,0,0,0);
-  
-	netif_add(&ecos_loopif, &ipaddr, &netmask, &gw, NULL, loopif_init,
-	    tcpip_input);
-#endif
-	
-#if LWIP_SLIP	
-	lwip_set_addr(&mynetif);
-	slipif_init(&mynetif);
-	netif_set_default(&mynetif);
-#elif PPP_SUPPORT
-	pppInit();
-#if PAP_SUPPORT || CHAP_SUPPORT
-	pppSetAuth(PPPAUTHTYPE_PAP, PPP_USER, PPP_PASS);
-#endif
-	pppOpen(sio_open(2), pppMyCallback, NULL);
-#else	
-	ecosglue_init();		
-#endif	
-	return 0;
-}
-
-
-err_t lwip_dummy_netif_init(struct netif *netif)
-{
-    return ERR_OK; 
-}
-
-
-void
-lwip_set_addr(struct netif *netif)
-{
-	struct ip_addr ipaddr, netmask, gw;
-  
-#if LWIP_DHCP
-    IP4_ADDR(&gw, 0,0,0,0);
-    IP4_ADDR(&ipaddr, 0,0,0,0);
-    IP4_ADDR(&netmask, 0,0,0,0);
-
-    netif_add(netif, &ipaddr, &netmask, &gw, netif->state, lwip_dummy_netif_init, tcpip_input);
-    netif_set_default(netif);
-    netif_set_up(netif);        // new step from lwip 1.0.0
-#else
-	IP_ADDR(&gw, CYGDAT_LWIP_SERV_ADDR);
-	IP_ADDR(&ipaddr, CYGDAT_LWIP_MY_ADDR);
-	IP_ADDR(&netmask, CYGDAT_LWIP_NETMASK);
-
-	netif_add(netif, &ipaddr, &netmask, &gw, netif->state, lwip_dummy_netif_init, tcpip_input);
-    netif_set_default(netif); 
-    netif_set_up(netif);        // new step from lwip 1.0.0
-#endif 
-}
-
-void lwip_dhcp_init(struct netif *netif)
-{
-#ifdef CYGOPT_LWIP_DHCP_MANAGEMENT
-    dhcp_start(netif);
-#endif
-}
-
-
-#ifdef CYGPKG_LWIP_ETH
-//io eth stuff
-
-cyg_sem_t delivery;
-
-void
-lwip_dsr_stuff(void)
-{
-  cyg_semaphore_post(&delivery);
-}
-
-//Input thread signalled by DSR calls deliver() on low level drivers
-static void
-input_thread(void *arg)
-{
-  cyg_netdevtab_entry_t *t;
-
-  for (;;) {
-    cyg_semaphore_wait(&delivery);
-
-    for (t = &__NETDEVTAB__[0]; t != &__NETDEVTAB_END__; t++) {
-      struct eth_drv_sc *sc = (struct eth_drv_sc *)t->device_instance;
-      if (sc->state & ETH_DRV_NEEDS_DELIVERY) {
-#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT)
-        cyg_bool was_ctrlc_int;
-#endif
-	sc->state &= ~ETH_DRV_NEEDS_DELIVERY;
-#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT)
-        was_ctrlc_int = HAL_CTRLC_CHECK((*sc->funs->int_vector)(sc), (int)sc);
-          if (!was_ctrlc_int) // Fall through and run normal code
-		  
-#endif
-	(sc->funs->deliver) (sc);
-      }
-    }
-  }
-
-}
-
-
-// Initialize all network devices
-static void
-init_hw_drivers(void)
-{
-  cyg_netdevtab_entry_t *t;
-
-  for (t = &__NETDEVTAB__[0]; t != &__NETDEVTAB_END__; t++) {
-    if (t->init(t)) {
-      t->status = CYG_NETDEVTAB_STATUS_AVAIL;
-    } else {
-      // What to do if device init fails?
-      t->status = 0;		// Device not [currently] available
-    }
-  }
-}
-
-extern struct netif *netif_default;
-
-static void
-ecosglue_init(void)
-{
-    etharp_init();
-    cyg_semaphore_init(&delivery, 0);
-    //
-    // start input thread before hardware drivers are initialized because
-    // init_hw_drivers() calls dhcp_init() if DHCP support is configured 
-    // and dhcp_init() requires a running input thread
-    //
-    sys_thread_new(input_thread, (void*)0, CYGNUM_LWIP_ETH_THREAD_PRIORITY);
-    init_hw_drivers();
-}
-
-#endif //CYGPKG_LWIP_ETH
deleted file mode 100644
--- a/packages/net/lwip_tcpip/current/src/netif/ppp/ppp.h
+++ /dev/null
@@ -1,446 +0,0 @@
-/*****************************************************************************
-* ppp.h - Network Point to Point Protocol header file.
-*
-* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
-* portions Copyright (c) 1997 Global Election Systems Inc.
-*
-* The authors hereby grant permission to use, copy, modify, distribute,
-* and license this software and its documentation for any purpose, provided
-* that existing copyright notices are retained in all copies and that this
-* notice and the following disclaimer are included verbatim in any 
-* distributions. No written agreement, license, or royalty fee is required
-* for any of the authorized uses.
-*
-* THIS SOFTWARE IS PROVIDED BY THE 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 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.
-*
-******************************************************************************
-* REVISION HISTORY
-*
-* 03-01-01 Marc Boucher <marc@mbsi.ca>
-*   Ported to lwIP.
-* 97-11-05 Guy Lancaster <glanca@gesn.com>, Global Election Systems Inc.
-*	Original derived from BSD codes.
-*****************************************************************************/
-
-#ifndef PPP_H
-#define PPP_H
-
-#include "lwip/opt.h"
-
-#if PPP_SUPPORT > 0
-#include "lwip/sio.h"
-#include "lwip/api.h"
-#include "lwip/sockets.h"
-#include "lwip/stats.h"
-#include "lwip/mem.h"
-#include "lwip/tcpip.h"
-#include "lwip/netif.h"
-
-/*
- * pppd.h - PPP daemon global declarations.
- *
- * Copyright (c) 1989 Carnegie Mellon University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by Carnegie Mellon University.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- */
-/*
- * ppp_defs.h - PPP definitions.
- *
- * Copyright (c) 1994 The Australian National University.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation is hereby granted, provided that the above copyright
- * notice appears in all copies.  This software is provided without any
- * warranty, express or implied. The Australian National University
- * makes no representations about the suitability of this software for
- * any purpose.
- *
- * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
- * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
- * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- *
- * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
- * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
- * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
- * OR MODIFICATIONS.
- */
-
-#define TIMEOUT(f, a, t)    sys_untimeout((f), (a)), sys_timeout((t)*1000, (f), (a))
-#define UNTIMEOUT(f, a)     sys_untimeout((f), (a))
-
-
-# ifndef __u_char_defined
-
-/* Type definitions for BSD code. */
-typedef unsigned long u_long;
-typedef unsigned int u_int;
-typedef unsigned short u_short;
-typedef unsigned char u_char;
-
-#endif
-
-/*
- * Constants and structures defined by the internet system,
- * Per RFC 790, September 1981, and numerous additions.
- */
-
-/*
- * The basic PPP frame.
- */
-#define PPP_HDRLEN  4       /* octets for standard ppp header */
-#define PPP_FCSLEN  2       /* octets for FCS */
-
-
-/*
- * Significant octet values.
- */
-#define PPP_ALLSTATIONS 0xff    /* All-Stations broadcast address */
-#define PPP_UI          0x03    /* Unnumbered Information */
-#define PPP_FLAG        0x7e    /* Flag Sequence */
-#define PPP_ESCAPE      0x7d    /* Asynchronous Control Escape */
-#define PPP_TRANS       0x20    /* Asynchronous transparency modifier */
-
-/*
- * Protocol field values.
- */
-#define PPP_IP          0x21    /* Internet Protocol */
-#define PPP_AT          0x29    /* AppleTalk Protocol */
-#define PPP_VJC_COMP    0x2d    /* VJ compressed TCP */
-#define PPP_VJC_UNCOMP  0x2f    /* VJ uncompressed TCP */
-#define PPP_COMP        0xfd    /* compressed packet */
-#define PPP_IPCP        0x8021  /* IP Control Protocol */
-#define PPP_ATCP        0x8029  /* AppleTalk Control Protocol */
-#define PPP_CCP         0x80fd  /* Compression Control Protocol */
-#define PPP_LCP         0xc021  /* Link Control Protocol */
-#define PPP_PAP         0xc023  /* Password Authentication Protocol */
-#define PPP_LQR         0xc025  /* Link Quality Report protocol */
-#define PPP_CHAP        0xc223  /* Cryptographic Handshake Auth. Protocol */
-#define PPP_CBCP        0xc029  /* Callback Control Protocol */
-
-/*
- * Values for FCS calculations.
- */
-#define PPP_INITFCS 0xffff  /* Initial FCS value */
-#define PPP_GOODFCS 0xf0b8  /* Good final FCS value */
-#define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff])
-
-/*
- * Extended asyncmap - allows any character to be escaped.
- */
-typedef u_char  ext_accm[32];
-
-/*
- * What to do with network protocol (NP) packets.
- */
-enum NPmode {
-    NPMODE_PASS,        /* pass the packet through */
-    NPMODE_DROP,        /* silently drop the packet */
-    NPMODE_ERROR,       /* return an error */
-    NPMODE_QUEUE        /* save it up for later. */
-};
-
-/*
- * Inline versions of get/put char/short/long.
- * Pointer is advanced; we assume that both arguments
- * are lvalues and will already be in registers.
- * cp MUST be u_char *.
- */
-#define GETCHAR(c, cp) { \
-    (c) = *(cp)++; \
-}
-#define PUTCHAR(c, cp) { \
-    *(cp)++ = (u_char) (c); \
-}
-
-
-#define GETSHORT(s, cp) { \
-    (s) = *(cp)++ << 8; \
-    (s) |= *(cp)++; \
-}
-#define PUTSHORT(s, cp) { \
-    *(cp)++ = (u_char) ((s) >> 8); \
-    *(cp)++ = (u_char) (s); \
-}
-
-#define GETLONG(l, cp) { \
-    (l) = *(cp)++ << 8; \
-    (l) |= *(cp)++; (l) <<= 8; \
-    (l) |= *(cp)++; (l) <<= 8; \
-    (l) |= *(cp)++; \
-}
-#define PUTLONG(l, cp) { \
-    *(cp)++ = (u_char) ((l) >> 24); \
-    *(cp)++ = (u_char) ((l) >> 16); \
-    *(cp)++ = (u_char) ((l) >> 8); \
-    *(cp)++ = (u_char) (l); \
-}
-
-
-#define INCPTR(n, cp)   ((cp) += (n))
-#define DECPTR(n, cp)   ((cp) -= (n))
-
-#define BCMP(s0, s1, l)     memcmp((u_char *)(s0), (u_char *)(s1), (l))
-#define BCOPY(s, d, l)      memcpy((d), (s), (l))
-#define BZERO(s, n)         memset(s, 0, n)
-#if PPP_DEBUG
-#define PRINTMSG(m, l)  { m[l] = '\0'; ppp_trace(LOG_INFO, "Remote message: %s\n", m); }
-#else
-#define PRINTMSG(m, l)
-#endif
-
-/*
- * MAKEHEADER - Add PPP Header fields to a packet.
- */
-#define MAKEHEADER(p, t) { \
-    PUTCHAR(PPP_ALLSTATIONS, p); \
-    PUTCHAR(PPP_UI, p); \
-    PUTSHORT(t, p); }
-
-/*************************
-*** PUBLIC DEFINITIONS ***
-*************************/
-
-/* Error codes. */
-#define PPPERR_NONE 0				/* No error. */
-#define PPPERR_PARAM -1				/* Invalid parameter. */
-#define PPPERR_OPEN -2				/* Unable to open PPP session. */
-#define PPPERR_DEVICE -3			/* Invalid I/O device for PPP. */
-#define PPPERR_ALLOC -4				/* Unable to allocate resources. */
-#define PPPERR_USER -5				/* User interrupt. */
-#define PPPERR_CONNECT -6			/* Connection lost. */
-#define PPPERR_AUTHFAIL -7			/* Failed authentication challenge. */
-#define PPPERR_PROTOCOL -8			/* Failed to meet protocol. */
-
-/*
- * PPP IOCTL commands.
- */
-/*
- * Get the up status - 0 for down, non-zero for up.  The argument must
- * point to an int.
- */
-#define PPPCTLG_UPSTATUS 100	/* Get the up status - 0 down else up */
-#define PPPCTLS_ERRCODE 101		/* Set the error code */
-#define PPPCTLG_ERRCODE 102		/* Get the error code */
-#define	PPPCTLG_FD		103		/* Get the fd associated with the ppp */
-
-/************************
-*** PUBLIC DATA TYPES ***
-************************/
-
-/*
- * The following struct gives the addresses of procedures to call
- * for a particular protocol.
- */
-struct protent {
-    u_short protocol;       /* PPP protocol number */
-    /* Initialization procedure */
-    void (*init) (int unit);
-    /* Process a received packet */
-    void (*input) (int unit, u_char *pkt, int len);
-    /* Process a received protocol-reject */
-    void (*protrej) (int unit);
-    /* Lower layer has come up */
-    void (*lowerup) (int unit);
-    /* Lower layer has gone down */
-    void (*lowerdown) (int unit);
-    /* Open the protocol */
-    void (*open) (int unit);
-    /* Close the protocol */
-    void (*close) (int unit, char *reason);
-#if 0
-    /* Print a packet in readable form */
-    int  (*printpkt) (u_char *pkt, int len,
-              void (*printer) (void *, char *, ...),
-              void *arg);
-    /* Process a received data packet */
-    void (*datainput) (int unit, u_char *pkt, int len);
-#endif
-    int  enabled_flag;      /* 0 iff protocol is disabled */
-    char *name;         /* Text name of protocol */
-#if 0
-    /* Check requested options, assign defaults */
-    void (*check_options) (u_long);
-    /* Configure interface for demand-dial */
-    int  (*demand_conf) (int unit);
-    /* Say whether to bring up link for this pkt */
-    int  (*active_pkt) (u_char *pkt, int len);
-#endif
-};
-
-/*
- * The following structure records the time in seconds since
- * the last NP packet was sent or received.
- */
-struct ppp_idle {
-    u_short xmit_idle;      /* seconds since last NP packet sent */
-    u_short recv_idle;      /* seconds since last NP packet received */
-};
-
-struct ppp_settings {
-
-	u_int  disable_defaultip : 1;   /* Don't use hostname for default IP addrs */
-	u_int  auth_required : 1;      /* Peer is required to authenticate */
-	u_int  explicit_remote : 1;    /* remote_name specified with remotename opt */
-	u_int  refuse_pap : 1;         /* Don't wanna auth. ourselves with PAP */
-	u_int  refuse_chap : 1;        /* Don't wanna auth. ourselves with CHAP */
-	u_int  usehostname : 1;        /* Use hostname for our_name */
-	u_int  usepeerdns : 1;         /* Ask peer for DNS adds */
-
-	u_short idle_time_limit; /* Shut down link if idle for this long */
-	int  maxconnect;         /* Maximum connect time (seconds) */
-
-	char user[MAXNAMELEN + 1];/* Username for PAP */
-	char passwd[MAXSECRETLEN + 1];           /* Password for PAP, secret for CHAP */
-	char our_name[MAXNAMELEN + 1];         /* Our name for authentication purposes */
-	char remote_name[MAXNAMELEN + 1];      /* Peer's name for authentication */
-};
-
-struct ppp_addrs {
-    struct ip_addr our_ipaddr, his_ipaddr, netmask, dns1, dns2;
-};
-
-/*****************************
-*** PUBLIC DATA STRUCTURES ***
-*****************************/
-/* Buffers for outgoing packets. */
-extern u_char outpacket_buf[NUM_PPP][PPP_MRU+PPP_HDRLEN];
-
-extern struct ppp_settings ppp_settings;
-
-extern struct protent *ppp_protocols[];/* Table of pointers to supported protocols */
-
-
-/***********************
-*** PUBLIC FUNCTIONS ***
-***********************/
-
-/* Initialize the PPP subsystem. */
-void pppInit(void);
-
-/* Warning: Using PPPAUTHTYPE_ANY might have security consequences.
- * RFC 1994 says:
- *
- * In practice, within or associated with each PPP server, there is a
- * database which associates "user" names with authentication
- * information ("secrets").  It is not anticipated that a particular
- * named user would be authenticated by multiple methods.  This would
- * make the user vulnerable to attacks which negotiate the least secure
- * method from among a set (such as PAP rather than CHAP).  If the same
- * secret was used, PAP would reveal the secret to be used later with
- * CHAP.
- *
- * Instead, for each user name there should be an indication of exactly
- * one method used to authenticate that user name.  If a user needs to
- * make use of different authentication methods under different
- * circumstances, then distinct user names SHOULD be employed, each of
- * which identifies exactly one authentication method.
- *
- */
-enum pppAuthType {
-    PPPAUTHTYPE_NONE,
-    PPPAUTHTYPE_ANY,
-    PPPAUTHTYPE_PAP,
-    PPPAUTHTYPE_CHAP
-};
-
-void pppSetAuth(enum pppAuthType authType, const char *user, const char *passwd);
-
-/*
- * Open a new PPP connection using the given I/O device.
- * This initializes the PPP control block but does not
- * attempt to negotiate the LCP session.
- * Return a new PPP connection descriptor on success or
- * an error code (negative) on failure. 
- */
-int pppOpen(sio_fd_t fd, void (*linkStatusCB)(void *ctx, int errCode, void *arg), void *linkStatusCtx);
-
-/*
- * Close a PPP connection and release the descriptor. 
- * Any outstanding packets in the queues are dropped.
- * Return 0 on success, an error code on failure. 
- */
-int pppClose(int pd);
-
-/*
- * Indicate to the PPP process that the line has disconnected.
- */
-void pppSigHUP(int pd);
-
-/*
- * Get and set parameters for the given connection.
- * Return 0 on success, an error code on failure. 
- */
-int  pppIOCtl(int pd, int cmd, void *arg);
-
-/*
- * Return the Maximum Transmission Unit for the given PPP connection.
- */
-u_int pppMTU(int pd);
-
-/*
- * Write n characters to a ppp link.
- *	RETURN: >= 0 Number of characters written
- *		 	 -1 Failed to write to device
- */
-int pppWrite(int pd, const u_char *s, int n);
-
-void pppMainWakeup(int pd);
-
-/* Configure i/f transmit parameters */
-void ppp_send_config (int, int, u32_t, int, int);
-/* Set extended transmit ACCM */
-void ppp_set_xaccm (int, ext_accm *);
-/* Configure i/f receive parameters */
-void ppp_recv_config (int, int, u32_t, int, int);
-/* Find out how long link has been idle */
-int  get_idle_time (int, struct ppp_idle *);
-
-/* Configure VJ TCP header compression */
-int  sifvjcomp (int, int, int, int);
-/* Configure i/f down (for IP) */
-int  sifup (int);		
-/* Set mode for handling packets for proto */
-int  sifnpmode (int u, int proto, enum NPmode mode);
-/* Configure i/f down (for IP) */
-int  sifdown (int);	
-/* Configure IP addresses for i/f */
-int  sifaddr (int, u32_t, u32_t, u32_t, u32_t, u32_t);
-/* Reset i/f IP addresses */
-int  cifaddr (int, u32_t, u32_t);
-/* Create default route through i/f */
-int  sifdefaultroute (int, u32_t, u32_t);
-/* Delete default route through i/f */
-int  cifdefaultroute (int, u32_t, u32_t);
-
-/* Get appropriate netmask for address */
-u32_t GetMask (u32_t); 
-
-#endif /* PPP_SUPPORT */
-
-#endif /* PPP_H */
deleted file mode 100644
--- a/packages/net/lwip_tcpip/current/tests/httpd.c
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * Copyright (c) 2001, Swedish Institute of Computer Science.
- * 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 Institute 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 INSTITUTE 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 INSTITUTE 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. 
- *
- * This file is part of the lwIP TCP/IP stack.
- * 
- * Author: Adam Dunkels <adam@sics.se>
- *
- */
-
-#include "lwip/debug.h"
-#include "lwip/stats.h"
-#include "lwip/tcp.h"
-#include <cyg/infra/testcase.h>
-
-#ifdef CYGPKG_LWIP_TCP
-
-struct http_state {
-  const char *file;
-  u32_t left;
-  u8_t retries;
-};
-
-/* Stack smashing arch-independent shellcode: will brick your target :-) */
-static const char sdata[] __attribute__ ((aligned)) = {
-	0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x32, 
-	0x30, 0x30, 0x20, 0x4f, 0x4b, 0xd, 0xa, 0x43, 0x6f, 0x6e, 
-	0x74, 0x65, 0x6e, 0x74, 0x2d, 0x54, 0x79, 0x70, 0x65, 0x3a, 
-	0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, 
-	0xd, 0xa, 0xd, 0xa, 0x49, 0x74, 0x20, 0x77, 0x6f, 0x72, 
-	0x6b, 0x65, 0x64, 0x2e, 0xa, };
-
-
-
-
-/*-----------------------------------------------------------------------------------*/
-static void
-conn_err(void *arg, err_t err)
-{
-  struct http_state *hs;
-
-  hs = arg;
-  mem_free(hs);
-}
-/*-----------------------------------------------------------------------------------*/
-static void
-close_conn(struct tcp_pcb *pcb, struct http_state *hs)
-{
-  tcp_arg(pcb, NULL);
-  tcp_sent(pcb, NULL);
-  tcp_recv(pcb, NULL);
-  mem_free(hs);
-  tcp_close(pcb);
-}
-/*-----------------------------------------------------------------------------------*/
-static void
-send_data(struct tcp_pcb *pcb, struct http_state *hs)
-{
-  err_t err;
-  u16_t len;
-
-  /* We cannot send more data than space available in the send
-     buffer. */     
-  if(tcp_sndbuf(pcb) < hs->left) {
-    len = tcp_sndbuf(pcb);
-  } else {
-    len = hs->left;
-  }
-
-  do {
-    err = tcp_write(pcb, hs->file, len, 0);
-    if(err == ERR_MEM) {
-      len /= 2;
-    }
-  } while(err == ERR_MEM && len > 1);  
-  
-  if(err == ERR_OK) {
-    hs->file += len;
-    hs->left -= len;
-  }
-}
-/*-----------------------------------------------------------------------------------*/
-static err_t
-http_poll(void *arg, struct tcp_pcb *pcb)
-{
-  struct http_state *hs;
-
-  hs = arg;
-  
-  /*  printf("Polll\n");*/
-  if(hs == NULL) {
-    /*    printf("Null, close\n");*/
-    tcp_abort(pcb);
-    return ERR_ABRT;
-  } else {
-    ++hs->retries;
-    if(hs->retries == 4) {
-      tcp_abort(pcb);
-      return ERR_ABRT;
-    }
-    send_data(pcb, hs);
-  }
-
-  return ERR_OK;
-}
-/*-----------------------------------------------------------------------------------*/
-static err_t
-http_sent(void *arg, struct tcp_pcb *pcb, u16_t len)
-{
-  struct http_state *hs;
-
-  hs = arg;
-
-  hs->retries = 0;
-  
-  if(hs->left > 0) {    
-    send_data(pcb, hs);
-  } else {
-    close_conn(pcb, hs);
-  }
-
-  return ERR_OK;
-}
-/*-----------------------------------------------------------------------------------*/
-static err_t
-http_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
-{
-  int i;
-  char *data;
-  struct http_state *hs;
-
-  hs = arg;
-
-  if(err == ERR_OK && p != NULL) {
-
-    /* Inform TCP that we have taken the data. */
-    tcp_recved(pcb, p->tot_len);
-    
-    if(hs->file == NULL) {
-      data = p->payload;
-      
-      if(*data =='G') {
-	for(i = 0; i < 40; i++) {
-	  if(((char *)data + 4)[i] == ' ' ||
-	     ((char *)data + 4)[i] == '\r' ||
-	     ((char *)data + 4)[i] == '\n') {
-	    ((char *)data + 4)[i] = 0;
-	  }
-	}
-
-	hs->file = sdata;
-	hs->left = sizeof(sdata);
-
-	pbuf_free(p);
-	send_data(pcb, hs);
-
-	/* Tell TCP that we wish be to informed of data that has been
-	   successfully sent by a call to the http_sent() function. */
-	tcp_sent(pcb, http_sent);
-      } else {
-	pbuf_free(p);
-	close_conn(pcb, hs);
-      }
-    } else {
-      pbuf_free(p);
-    }
-  }
-
-  if(err == ERR_OK && p == NULL) {
-    close_conn(pcb, hs);
-  }
-  return ERR_OK;
-}
-/*-----------------------------------------------------------------------------------*/
-static err_t
-http_accept(void *arg, struct tcp_pcb *pcb, err_t err)
-{
-  struct http_state *hs;
-
-  tcp_setprio(pcb, TCP_PRIO_MIN);
-  
-  /* Allocate memory for the structure that holds the state of the
-     connection. */
-  hs = mem_malloc(sizeof(struct http_state));
-
-  if(hs == NULL) {
-    return ERR_MEM;
-  }
-  
-  /* Initialize the structure. */
-  hs->file = NULL;
-  hs->left = 0;
-  hs->retries = 0;
-  
-  /* Tell TCP that this is the structure we wish to be passed for our
-     callbacks. */
-  tcp_arg(pcb, hs);
-
-  /* Tell TCP that we wish to be informed of incoming data by a call
-     to the http_recv() function. */
-  tcp_recv(pcb, http_recv);
-
-  tcp_err(pcb, conn_err);
-  
-  tcp_poll(pcb, http_poll, 4);
-  return ERR_OK;
-}
-
-/*-----------------------------------------------------------------------------------*/
-void
-httpd_init(void *arg)
-{
-  struct tcp_pcb *pcb;
-
-  pcb = tcp_new();
-  tcp_bind(pcb, IP_ADDR_ANY, 80);
-  pcb = tcp_listen(pcb);
-  tcp_accept(pcb, http_accept);
-  while(1)
-	  cyg_thread_delay(1000);
-}
-
-void
-tmain(cyg_addrword_t p)
-{
-  lwip_init();	
-  sys_thread_new(httpd_init, (void*)"httpd",7);  
-}
-
-#define STACK_SIZE 0x1000
-static char stack[STACK_SIZE];
-static cyg_thread thread_data;
-static cyg_handle_t thread_handle;
-
-void
-httpd_main(void)
-{
-    CYG_TEST_INIT();
-    // Create a main thread, so we can run the scheduler and have time 'pass'
-    cyg_thread_create(10,                // Priority - just a number
-                      tmain,          // entry
-                      0,                 // entry parameter
-                      "thread",        // Name
-                      &stack[0],         // Stack
-                      STACK_SIZE,        // Size
-                      &thread_handle,    // Handle
-                      &thread_data       // Thread data structure
-            );
-    cyg_thread_resume(thread_handle);  // Start it
-    cyg_scheduler_start();
-    CYG_TEST_FAIL_FINISH("Not reached");
-}
-
-externC void
-cyg_start( void )
-{
-    httpd_main();
-}
-
-#else // def CYGPKG_LWIP_TCP
-#define N_A_MSG "TCP support disabled"
-#endif // def CYGFUN_KERNEL_API_C
-
-#ifdef N_A_MSG
-externC void
-cyg_start( void )
-{
-    CYG_TEST_INIT();
-    CYG_TEST_NA(N_A_MSG);
-}
-#endif // N_A_MSG
-