mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-11-16 12:34:34 +00:00
Compare commits
148 Commits
start
...
POST_REMOV
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07af438a38 | ||
|
|
fa8f6cb204 | ||
|
|
049853362a | ||
|
|
3e6202f614 | ||
|
|
a993e962f5 | ||
|
|
1ad5537c9b | ||
|
|
ea0dc429a7 | ||
|
|
8d7f09fa92 | ||
|
|
02a6a8a809 | ||
|
|
2bba9bcd9f | ||
|
|
4eebbdea0d | ||
|
|
4a2d03a517 | ||
|
|
5212afdd8f | ||
|
|
e196108931 | ||
|
|
a5e9b73703 | ||
|
|
5e13d495f0 | ||
|
|
a528a2323e | ||
|
|
c786f238ef | ||
|
|
d04f7aa4bc | ||
|
|
ced453a72b | ||
|
|
0f3e8c19e8 | ||
|
|
cc4df7100d | ||
|
|
0bd02a5f7a | ||
|
|
b311ab0d53 | ||
|
|
b6b905412e | ||
|
|
2c2fec1b0e | ||
|
|
f946abd86b | ||
|
|
156d2c866f | ||
|
|
ef68392388 | ||
|
|
51006824f9 | ||
|
|
9eebc135ce | ||
|
|
af0d6bc881 | ||
|
|
771fb0f2cd | ||
|
|
3984e521ad | ||
|
|
95c1bca3f1 | ||
|
|
4c1069c38b | ||
|
|
219266b7de | ||
|
|
f037bfad1e | ||
|
|
c0a8ef6f6f | ||
|
|
a071cbf86c | ||
|
|
6dd350348d | ||
|
|
5472d94b73 | ||
|
|
40abd14884 | ||
|
|
cac01f7a89 | ||
|
|
7ea512e7fa | ||
|
|
8bd53b5be8 | ||
|
|
96610c9c20 | ||
|
|
6972e81ac0 | ||
|
|
ac46dbacfa | ||
|
|
ea3b0fc477 | ||
|
|
99dfbfeef0 | ||
|
|
dcce504ade | ||
|
|
dfa0369678 | ||
|
|
1d341bae31 | ||
|
|
0ed4fd6741 | ||
|
|
6fc6acf295 | ||
|
|
bda378bb9f | ||
|
|
4619bbc3ea | ||
|
|
c73606309f | ||
|
|
0442c1e228 | ||
|
|
b0500b7b5a | ||
|
|
38581aad65 | ||
|
|
53148943bd | ||
|
|
cfab6dc28b | ||
|
|
a57c91404f | ||
|
|
8210edfeea | ||
|
|
c9bd32d12b | ||
|
|
dfe1ab7438 | ||
|
|
e26a3e347b | ||
|
|
29f5968c23 | ||
|
|
1b798ed6d3 | ||
|
|
dbac2ff0b3 | ||
|
|
f2fbcdf00a | ||
|
|
b8972f5701 | ||
|
|
8b9a303e21 | ||
|
|
6ef24c4e48 | ||
|
|
428293a69b | ||
|
|
1dd7e81df7 | ||
|
|
4beff6c2cf | ||
|
|
58d748a8ad | ||
|
|
43a06e8e37 | ||
|
|
8f2284d5c7 | ||
|
|
131eed412a | ||
|
|
330647dad8 | ||
|
|
ecf0f56d33 | ||
|
|
05a91a4725 | ||
|
|
4b9e035a9f | ||
|
|
f975754ad9 | ||
|
|
d31ef42acf | ||
|
|
f9129c4dcd | ||
|
|
1f1e6eb5a1 | ||
|
|
2382792792 | ||
|
|
8cdeaa5148 | ||
|
|
10bf9ef2ef | ||
|
|
bca526b634 | ||
|
|
9b76f5bf53 | ||
|
|
e41134bbbe | ||
|
|
b9353eaf12 | ||
|
|
3e62b75529 | ||
|
|
ad55cb6733 | ||
|
|
6c977ad6ed | ||
|
|
2b53babf99 | ||
|
|
8077dd838c | ||
|
|
c22eaf5f52 | ||
|
|
f1c0bbc62b | ||
|
|
e988d2ee0b | ||
|
|
72e3d22271 | ||
|
|
585b250540 | ||
|
|
a582ccfce8 | ||
|
|
6c979fed40 | ||
|
|
bb06293b30 | ||
|
|
50111c8689 | ||
|
|
6028e2c420 | ||
|
|
d6986a757a | ||
|
|
01cccf4aee | ||
|
|
4e4da8e019 | ||
|
|
2a3d00f1ed | ||
|
|
8b5fcad039 | ||
|
|
aa69784495 | ||
|
|
4933bfaaa0 | ||
|
|
ef6b7099ba | ||
|
|
1be416fe0e | ||
|
|
524bab33ba | ||
|
|
2a3e3b984d | ||
|
|
fc242e107d | ||
|
|
a7db4e4347 | ||
|
|
8fe9e007c9 | ||
|
|
05b8bf216c | ||
|
|
faf18b7f9a | ||
|
|
62b78bebe1 | ||
|
|
27dff9af70 | ||
|
|
43c6a550b2 | ||
|
|
814f8c505e | ||
|
|
fbd9fa5d94 | ||
|
|
28832ba9c2 | ||
|
|
6cb3ae7d7f | ||
|
|
bcb2600107 | ||
|
|
18ee2d90c9 | ||
|
|
fecc7424e4 | ||
|
|
9ede36a386 | ||
|
|
950f2d0f2f | ||
|
|
89bc334515 | ||
|
|
67e47cac49 | ||
|
|
58cb89d261 | ||
|
|
fea27fd743 | ||
|
|
d5ae18e468 | ||
|
|
129c4d20c7 | ||
|
|
76e851fc56 |
@@ -1,3 +1,5 @@
|
||||
Changelog that precedes the move to Savannah:
|
||||
|
||||
(0.5.3) Changes since version 0.5.2
|
||||
|
||||
++ Bugfixes:
|
||||
|
||||
58
COPYING
58
COPYING
@@ -1,29 +1,33 @@
|
||||
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.
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 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>
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
2
FILES
2
FILES
@@ -2,4 +2,6 @@ src/ - The source code for the lwIP TCP/IP stack.
|
||||
|
||||
proj/ - Makefiles and code for compiling lwIP.
|
||||
|
||||
doc/ - Documentation on the lwIP APIs.
|
||||
|
||||
See also the FILES file in each subdirectory.
|
||||
59
README
Normal file
59
README
Normal file
@@ -0,0 +1,59 @@
|
||||
lwIP is a small independent implementation of the TCP/IP protocol
|
||||
suite that has been developed by Adam Dunkels at the Computer and
|
||||
Networks Architectures (CNA) lab at the Swedish Institute of Computer
|
||||
Science (SICS).
|
||||
|
||||
The focus of the lwIP TCP/IP implementation is to reduce the RAM usage
|
||||
while still having a full scale TCP. This making lwIP suitable for use
|
||||
in embedded systems with tenths of kilobytes of free RAM and room for
|
||||
around 40 kilobytes of code ROM.
|
||||
|
||||
lwIP features:
|
||||
* IP (Internet Protocol) including packet forwarding over multiple
|
||||
network interfaces
|
||||
* ICMP (Internet Control Message Protocol) for network maintenance
|
||||
and debugging
|
||||
* UDP (User Datagram Protocol) including experimental UDP-lite
|
||||
extensions
|
||||
* TCP (Transmission Control Protocol) with congestion control, RTT
|
||||
estimation and fast recovery/fast retransmit
|
||||
* Specialized API for enhanced performance
|
||||
* Optional Berkeley socket API
|
||||
|
||||
lwIP is freely available under a BSD license.
|
||||
|
||||
lwIP has grown into an excellent TCP/IP stack for embedded devices,
|
||||
and developers using the stack often submit bug fixes, improvements,
|
||||
and additions to the stack to further increase its usefulness.
|
||||
|
||||
Development of lwIP is hosted on Savannah, a central point for
|
||||
software development, maintenance and distribution. A core team
|
||||
will improve lwIP by the use of Savannah's interface and CVS.
|
||||
|
||||
The current lwIP CVS tree can be checked out by doing:
|
||||
cvs -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/lwip login
|
||||
cvs -z3 -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/lwip co lwip
|
||||
|
||||
Last night's CVS tar ball can be downloaded from:
|
||||
http://savannah.gnu.org/cvs.backups/lwip.tar.gz
|
||||
|
||||
The current CVS tree is web-browsable:
|
||||
http://savannah.nongnu.org/cgi-bin/viewcvs/lwip/lwip/
|
||||
|
||||
Submit patches and bugs via the lwIP project page:
|
||||
http://savannah.nongnu.org/projects/lwip/
|
||||
|
||||
Stable releases have not been released yet. For development we
|
||||
suggest downloading the latest CVS and keeping track of the
|
||||
lwIP mailing list.
|
||||
|
||||
The mailing list (with searchable archives), as well as Adam
|
||||
Dunkels' papers on lwIP are at the official lwIP home page:
|
||||
http://www.sics.se/~adam/lwip/
|
||||
|
||||
Reading Adam's papers and browsing the mailing list archives
|
||||
is a good way to become familiar with the design of lwIP.
|
||||
|
||||
Adam Dunkels <adam@sics.se>
|
||||
Leon Woestenberg <leon.woestenberg@gmx.net>
|
||||
|
||||
@@ -2,8 +2,6 @@ Raw TCP/IP interface for lwIP 0.5
|
||||
|
||||
Author: Adam Dunkels
|
||||
|
||||
$Id: rawapi.txt,v 1.1 2002/10/19 12:59:32 likewise Exp $
|
||||
|
||||
lwIP provides two Application Program's Interfaces (APIs) for programs
|
||||
to use for communication with the TCP/IP code: the sequential API
|
||||
(often just called "the API") and the raw TCP/IP interface. This
|
||||
|
||||
@@ -2,8 +2,6 @@ sys_arch interface for lwIP 0.5
|
||||
|
||||
Author: Adam Dunkels
|
||||
|
||||
$Id: sys_arch.txt,v 1.1 2002/10/19 12:59:33 likewise Exp $
|
||||
|
||||
The operating system emulation layer provides a common interface
|
||||
between the lwIP code and the underlying operating system kernel. The
|
||||
general idea is that porting lwIP to new architectures requires only
|
||||
|
||||
@@ -1,37 +1,34 @@
|
||||
# Copyright (c) 2001, Swedish Institute of Computer Science.
|
||||
#
|
||||
# Copyright (c) 2001, 2002 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:
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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 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>
|
||||
#
|
||||
# $Id: Makefile,v 1.1 2002/10/19 12:59:33 likewise Exp $
|
||||
|
||||
|
||||
CCDEP=gcc
|
||||
CC=gcc
|
||||
CFLAGS=-g -Wall -DIPv4 -Os -fpack-struct
|
||||
@@ -46,8 +43,8 @@ CFLAGS:=$(CFLAGS) \
|
||||
# COREFILES, CORE4FILES: The minimum set of files needed for lwIP.
|
||||
COREFILES=$(LWIPDIR)/core/mem.c $(LWIPDIR)/core/memp.c $(LWIPDIR)/core/netif.c \
|
||||
$(LWIPDIR)/core/pbuf.c $(LWIPDIR)/core/stats.c $(LWIPDIR)/core/sys.c \
|
||||
$(LWIPDIR)/core/tcp.c $(LWIPDIR)/core/tcp_input.c \
|
||||
$(LWIPDIR)/core/tcp_output.c $(LWIPDIR)/core/udp.c
|
||||
$(LWIPDIR)/core/tcp.c $(LWIPDIR)/core/tcp_in.c \
|
||||
$(LWIPDIR)/core/tcp_out.c $(LWIPDIR)/core/udp.c
|
||||
CORE4FILES=$(LWIPDIR)/core/ipv4/icmp.c $(LWIPDIR)/core/ipv4/ip.c \
|
||||
$(LWIPDIR)/core/inet.c $(LWIPDIR)/core/ipv4/ip_addr.c
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
@@ -120,6 +120,16 @@ a lot of data that needs to be copied, this should be set high. */
|
||||
|
||||
/* ---------- ARP options ---------- */
|
||||
#define ARP_TABLE_SIZE 10
|
||||
#define ARP_QUEUEING 0
|
||||
/**
|
||||
* - If enabled, cache entries are generated for every kind of ARP traffic or
|
||||
* broadcast IP traffic. This enhances behaviour for sending to a dynamic set
|
||||
* of hosts, for example if acting as a gateway.
|
||||
* - If disabled, cache entries are generated only for IP destination addresses
|
||||
* in use by lwIP or applications. This enhances performance if sending to a small,
|
||||
* reasonably static number of hosts. Typically for embedded devices.
|
||||
*/
|
||||
#define ETHARP_ALWAYS_INSERT 0
|
||||
|
||||
/* ---------- IP options ---------- */
|
||||
/* Define IP_FORWARD to 1 if you wish to have the ability to forward
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
@@ -154,7 +154,7 @@ low_level_output(struct netif *netif, struct pbuf *p)
|
||||
time. The size of the data in each pbuf is kept in the ->len
|
||||
variable. */
|
||||
/* send data from(q->payload, q->len); */
|
||||
bcopy(q->payload, bufptr, q->len);
|
||||
memcpy(bufptr, q->payload, q->len);
|
||||
bufptr += q->len;
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ low_level_input(struct mintapif *mintapif)
|
||||
avaliable data in the pbuf is given by the q->len
|
||||
variable. */
|
||||
/* read data into(q->payload, q->len); */
|
||||
bcopy(bufptr, q->payload, q->len);
|
||||
memcpy(q->payload, bufptr, q->len);
|
||||
bufptr += q->len;
|
||||
}
|
||||
/* acknowledge that packet has been read(); */
|
||||
@@ -260,7 +260,7 @@ mintapif_input(struct netif *netif)
|
||||
if(p != NULL) {
|
||||
|
||||
#ifdef LINK_STATS
|
||||
stats.link.recv++;
|
||||
lwip_stats.link.recv++;
|
||||
#endif /* LINK_STATS */
|
||||
|
||||
ethhdr = p->payload;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
244
proj/msvc6/lwip4/lwip4.dsp
Normal file
244
proj/msvc6/lwip4/lwip4.dsp
Normal file
@@ -0,0 +1,244 @@
|
||||
# Microsoft Developer Studio Project File - Name="lwip4" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** NICHT BEARBEITEN **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=lwip4 - Win32 Debug
|
||||
!MESSAGE Dies ist kein g<>ltiges Makefile. Zum Erstellen dieses Projekts mit NMAKE
|
||||
!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und f<>hren Sie den Befehl
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "lwip4.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE Sie k<>nnen beim Ausf<73>hren von NMAKE eine Konfiguration angeben
|
||||
!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "lwip4.mak" CFG="lwip4 - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE F<>r die Konfiguration stehen zur Auswahl:
|
||||
!MESSAGE
|
||||
!MESSAGE "lwip4 - Win32 Release" (basierend auf "Win32 (x86) Static Library")
|
||||
!MESSAGE "lwip4 - Win32 Debug" (basierend auf "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "lwip4 - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\src\include" /I "..\..\..\src\include\ipv4" /I "..\..\..\proj\msvc6" /I "..\..\..\src\arch\msvc6\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x407 /d "NDEBUG"
|
||||
# ADD RSC /l 0x407 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "lwip4 - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\src\include" /I "..\..\..\src\include\ipv4" /I "..\..\..\proj\msvc6" /I "..\..\..\src\arch\msvc6\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x407 /d "_DEBUG"
|
||||
# ADD RSC /l 0x407 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"Debug\lwip4_d.lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "lwip4 - Win32 Release"
|
||||
# Name "lwip4 - Win32 Debug"
|
||||
# Begin Group "Quellcodedateien"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\core\ipv4\icmp.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\core\inet.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\core\ipv4\ip.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\core\ipv4\ip_addr.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\core\mem.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\core\memp.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\core\netif.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\core\pbuf.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\core\stats.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\core\sys.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\core\tcp.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\core\tcp_in.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\core\tcp_out.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\core\udp.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header-Dateien"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\include\lwip\api.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\include\lwip\api_msg.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\include\lwip\arch.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\arch\msvc6\include\arch\cc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\arch\msvc6\include\arch\cpu.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\include\lwip\debug.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\include\lwip\def.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\include\lwip\err.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\include\lwip\event.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\include\ipv4\lwip\icmp.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\include\ipv4\lwip\inet.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\include\ipv4\lwip\ip.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\include\ipv4\lwip\ip_addr.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\arch\msvc6\include\arch\lib.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\lwipopts.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\include\lwip\mem.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\include\lwip\memp.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\include\lwip\netif.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\include\lwip\opt.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\include\lwip\pbuf.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\include\lwip\sys.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\include\lwip\tcp.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\include\lwip\tcpip.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\include\lwip\udp.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
168
proj/msvc6/lwipopts.h
Normal file
168
proj/msvc6/lwipopts.h
Normal file
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2003 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>
|
||||
*
|
||||
*/
|
||||
#ifndef __LWIPOPTS_H__
|
||||
#define __LWIPOPTS_H__
|
||||
|
||||
#define NO_SYS 1
|
||||
//#define LWIP_EVENT_API 1
|
||||
|
||||
/* ---------- Memory options ---------- */
|
||||
/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
|
||||
lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
|
||||
byte alignment -> define MEM_ALIGNMENT to 2. */
|
||||
#define MEM_ALIGNMENT 2
|
||||
|
||||
/* MEM_SIZE: the size of the heap memory. If the application will send
|
||||
a lot of data that needs to be copied, this should be set high. */
|
||||
#define MEM_SIZE 1000
|
||||
|
||||
/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
|
||||
sends a lot of data out of ROM (or other static memory), this
|
||||
should be set high. */
|
||||
#define MEMP_NUM_PBUF 8
|
||||
/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
|
||||
per active UDP "connection". */
|
||||
#define MEMP_NUM_UDP_PCB 4
|
||||
/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
|
||||
connections. */
|
||||
#define MEMP_NUM_TCP_PCB 2
|
||||
/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
|
||||
connections. */
|
||||
#define MEMP_NUM_TCP_PCB_LISTEN 8
|
||||
/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
|
||||
segments. */
|
||||
#define MEMP_NUM_TCP_SEG 8
|
||||
|
||||
/* The following four are used only with the sequential API and can be
|
||||
set to 0 if the application only will use the raw API. */
|
||||
/* MEMP_NUM_NETBUF: the number of struct netbufs. */
|
||||
#define MEMP_NUM_NETBUF 0
|
||||
/* MEMP_NUM_NETCONN: the number of struct netconns. */
|
||||
#define MEMP_NUM_NETCONN 0
|
||||
/* MEMP_NUM_APIMSG: the number of struct api_msg, used for
|
||||
communication between the TCP/IP stack and the sequential
|
||||
programs. */
|
||||
#define MEMP_NUM_API_MSG 0
|
||||
/* MEMP_NUM_TCPIPMSG: the number of struct tcpip_msg, which is used
|
||||
for sequential API communication and incoming packets. Used in
|
||||
src/api/tcpip.c. */
|
||||
#define MEMP_NUM_TCPIP_MSG 0
|
||||
/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
|
||||
timeouts. */
|
||||
#define MEMP_NUM_SYS_TIMEOUT 0
|
||||
|
||||
/* ---------- Pbuf options ---------- */
|
||||
/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
|
||||
#define PBUF_POOL_SIZE 8
|
||||
|
||||
/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
|
||||
#define PBUF_POOL_BUFSIZE 128
|
||||
|
||||
/* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
|
||||
link level header. */
|
||||
#define PBUF_LINK_HLEN 16
|
||||
|
||||
/* ---------- TCP options ---------- */
|
||||
#define LWIP_TCP 1
|
||||
#define TCP_TTL 255
|
||||
|
||||
/* Controls if TCP should queue segments that arrive out of
|
||||
order. Define to 0 if your device is low on memory. */
|
||||
#define TCP_QUEUE_OOSEQ 0
|
||||
|
||||
/* TCP Maximum segment size. */
|
||||
#define TCP_MSS 128
|
||||
|
||||
/* TCP sender buffer space (bytes). */
|
||||
#define TCP_SND_BUF 256
|
||||
|
||||
/* TCP sender buffer space (pbufs). This must be at least = 2 *
|
||||
TCP_SND_BUF/TCP_MSS for things to work. */
|
||||
#define TCP_SND_QUEUELEN 4 * TCP_SND_BUF/TCP_MSS
|
||||
|
||||
/* TCP receive window. */
|
||||
#define TCP_WND 512
|
||||
|
||||
/* Maximum number of retransmissions of data segments. */
|
||||
#define TCP_MAXRTX 12
|
||||
|
||||
/* Maximum number of retransmissions of SYN segments. */
|
||||
#define TCP_SYNMAXRTX 4
|
||||
|
||||
/* ---------- ARP options ---------- */
|
||||
#define ARP_TABLE_SIZE 10
|
||||
|
||||
/* ---------- IP options ---------- */
|
||||
/* Define IP_FORWARD to 1 if you wish to have the ability to forward
|
||||
IP packets across network interfaces. If you are going to run lwIP
|
||||
on a device with only one network interface, define this to 0. */
|
||||
#define IP_FORWARD 0
|
||||
|
||||
/* If defined to 1, IP options are allowed (but not parsed). If
|
||||
defined to 0, all packets with IP options are dropped. */
|
||||
#define IP_OPTIONS 1
|
||||
|
||||
/* ---------- ICMP options ---------- */
|
||||
#define ICMP_TTL 255
|
||||
|
||||
|
||||
/* ---------- DHCP options ---------- */
|
||||
/* Define LWIP_DHCP to 1 if you want DHCP configuration of
|
||||
interfaces. DHCP is not implemented in lwIP 0.5.1, however, so
|
||||
turning this on does currently not work. */
|
||||
#define LWIP_DHCP 0
|
||||
|
||||
/* 1 if you want to do an ARP check on the offered address
|
||||
(recommended). */
|
||||
#define DHCP_DOES_ARP_CHECK 1
|
||||
|
||||
/* ---------- UDP options ---------- */
|
||||
#define LWIP_UDP 0
|
||||
#define UDP_TTL 255
|
||||
|
||||
|
||||
/* ---------- Statistics options ---------- */
|
||||
/*#define STATS*/
|
||||
|
||||
#ifdef STATS
|
||||
#define LINK_STATS
|
||||
#define IP_STATS
|
||||
#define ICMP_STATS
|
||||
#define UDP_STATS
|
||||
#define TCP_STATS
|
||||
#define MEM_STATS
|
||||
#define MEMP_STATS
|
||||
#define PBUF_STATS
|
||||
#define SYS_STATS
|
||||
#endif /* STATS */
|
||||
|
||||
#endif /* __LWIPOPTS_H__ */
|
||||
527
proj/msvc6/pktif.c
Normal file
527
proj/msvc6/pktif.c
Normal file
@@ -0,0 +1,527 @@
|
||||
/*
|
||||
* Copyright (c) 2001,2002 Florian Schulze.
|
||||
* 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 authors nor the names of the contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS 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.
|
||||
*
|
||||
* pktif.c - This file is part of lwIPtest
|
||||
*
|
||||
****************************************************************************
|
||||
*
|
||||
* This file is derived from an example in lwIP with the following license:
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <packet32.h>
|
||||
#include <ntddndis.h>
|
||||
|
||||
#include "lwip/debug.h"
|
||||
|
||||
#include "lwip/opt.h"
|
||||
#include "lwip/def.h"
|
||||
#include "lwip/mem.h"
|
||||
#include "lwip/pbuf.h"
|
||||
#include "lwip/stats.h"
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/ip.h"
|
||||
|
||||
#include "netif/etharp.h"
|
||||
#include "netif/tcpdump.h"
|
||||
|
||||
#undef NETIF_DEBUG
|
||||
|
||||
/* Define those to better describe your network interface. */
|
||||
#define IFNAME0 'p'
|
||||
#define IFNAME1 'k'
|
||||
|
||||
struct ethernetif {
|
||||
struct eth_addr *ethaddr;
|
||||
/* Add whatever per-interface state that is needed here. */
|
||||
};
|
||||
|
||||
static const struct eth_addr ethbroadcast = {{0xff,0xff,0xff,0xff,0xff,0xff}};
|
||||
|
||||
/* Forward declarations. */
|
||||
static void ethernetif_input(struct netif *netif);
|
||||
static err_t ethernetif_output(struct netif *netif, struct pbuf *p,
|
||||
struct ip_addr *ipaddr);
|
||||
|
||||
static struct netif *pktif_netif;
|
||||
|
||||
LPADAPTER lpAdapter;
|
||||
LPPACKET lpPacket;
|
||||
char buffer[256000]; // buffer to hold the data coming from the driver
|
||||
unsigned char *cur_packet;
|
||||
int cur_length;
|
||||
|
||||
struct eth_addr ethaddr;
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
int init_adapter(void)
|
||||
{
|
||||
#define Max_Num_Adapter 10
|
||||
|
||||
char AdapterList[Max_Num_Adapter][1024];
|
||||
|
||||
int i;
|
||||
DWORD dwVersion;
|
||||
DWORD dwWindowsMajorVersion;
|
||||
|
||||
//unicode strings (winnt)
|
||||
WCHAR AdapterName[8192]; // string that contains a list of the network adapters
|
||||
WCHAR *temp,*temp1;
|
||||
|
||||
//ascii strings (win95)
|
||||
char AdapterNamea[8192]; // string that contains a list of the network adapters
|
||||
char *tempa,*temp1a;
|
||||
|
||||
int AdapterNum=0;
|
||||
ULONG AdapterLength;
|
||||
|
||||
PPACKET_OID_DATA ppacket_oid_data;
|
||||
|
||||
BOOLEAN result;
|
||||
|
||||
// obtain the name of the adapters installed on this machine
|
||||
AdapterLength=4096;
|
||||
|
||||
memset(AdapterList,0,sizeof(AdapterList));
|
||||
|
||||
i=0;
|
||||
|
||||
// the data returned by PacketGetAdapterNames is different in Win95 and in WinNT.
|
||||
// We have to check the os on which we are running
|
||||
dwVersion=GetVersion();
|
||||
dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
|
||||
if (!(dwVersion >= 0x80000000 && dwWindowsMajorVersion >= 4))
|
||||
{ // Windows NT
|
||||
if(PacketGetAdapterNames(AdapterName,&AdapterLength)==FALSE){
|
||||
printf("Unable to retrieve the list of the adapters!\n");
|
||||
return -1;
|
||||
}
|
||||
temp=AdapterName;
|
||||
temp1=AdapterName;
|
||||
while ((*temp!='\0')||(*(temp-1)!='\0'))
|
||||
{
|
||||
if (*temp=='\0')
|
||||
{
|
||||
memcpy(AdapterList[i],temp1,(temp-temp1)*2);
|
||||
temp1=temp+1;
|
||||
i++;
|
||||
}
|
||||
|
||||
temp++;
|
||||
}
|
||||
|
||||
AdapterNum=i;
|
||||
}
|
||||
|
||||
else //windows 95
|
||||
{
|
||||
if(PacketGetAdapterNames(AdapterNamea,&AdapterLength)==FALSE){
|
||||
printf("Unable to retrieve the list of the adapters!\n");
|
||||
return -1;
|
||||
}
|
||||
tempa=AdapterNamea;
|
||||
temp1a=AdapterNamea;
|
||||
|
||||
while ((*tempa!='\0')||(*(tempa-1)!='\0'))
|
||||
{
|
||||
if (*tempa=='\0')
|
||||
{
|
||||
memcpy(AdapterList[i],temp1a,tempa-temp1a);
|
||||
temp1a=tempa+1;
|
||||
i++;
|
||||
}
|
||||
tempa++;
|
||||
}
|
||||
|
||||
AdapterNum=i;
|
||||
}
|
||||
|
||||
if (AdapterNum<=0)
|
||||
return -1;
|
||||
|
||||
ppacket_oid_data=malloc(sizeof(PACKET_OID_DATA)+6);
|
||||
lpAdapter=PacketOpenAdapter(AdapterList[0]);
|
||||
if (!lpAdapter || (lpAdapter->hFile == INVALID_HANDLE_VALUE))
|
||||
return -1;
|
||||
ppacket_oid_data->Oid=OID_802_3_PERMANENT_ADDRESS;
|
||||
ppacket_oid_data->Length=6;
|
||||
if (!PacketRequest(lpAdapter,FALSE,ppacket_oid_data))
|
||||
return -1;
|
||||
memcpy(ppacket_oid_data->Data,ðaddr,6);
|
||||
free(ppacket_oid_data);
|
||||
PacketSetBuff(lpAdapter,512000);
|
||||
PacketSetReadTimeout(lpAdapter,1);
|
||||
PacketSetHwFilter(lpAdapter,NDIS_PACKET_TYPE_ALL_LOCAL);
|
||||
if((lpPacket = PacketAllocatePacket())==NULL){
|
||||
return (-1);
|
||||
}
|
||||
PacketInitPacket(lpPacket,(char*)buffer,256000);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void shutdown_adapter(void)
|
||||
{
|
||||
struct ethernetif *ethernetif;
|
||||
|
||||
ethernetif = pktif_netif->state;
|
||||
|
||||
PacketFreePacket(lpPacket);
|
||||
PacketCloseAdapter(lpAdapter);
|
||||
}
|
||||
|
||||
static void open_adapter(struct ethernetif *ethernetif)
|
||||
{
|
||||
memcpy(ðaddr,ethernetif->ethaddr,6);
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
low_level_init(struct netif *netif)
|
||||
{
|
||||
struct ethernetif *ethernetif;
|
||||
|
||||
ethernetif = netif->state;
|
||||
|
||||
open_adapter(ethernetif);
|
||||
|
||||
#ifdef NETIF_DEBUG
|
||||
DEBUGF(NETIF_DEBUG, ("pktif: eth_addr %02X%02X%02X%02X%02X%02X\n",ethernetif->ethaddr->addr[0],ethernetif->ethaddr->addr[1],ethernetif->ethaddr->addr[2],ethernetif->ethaddr->addr[3],ethernetif->ethaddr->addr[4],ethernetif->ethaddr->addr[5]));
|
||||
#endif /* NETIF_DEBUG */
|
||||
/* Do whatever else is needed to initialize interface. */
|
||||
|
||||
pktif_netif=netif;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*
|
||||
* low_level_output():
|
||||
*
|
||||
* Should do the actual transmission of the packet. The packet is
|
||||
* contained in the pbuf that is passed to the function. This pbuf
|
||||
* might be chained.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
static err_t
|
||||
low_level_output(struct netif *ethernetif, struct pbuf *p)
|
||||
{
|
||||
struct pbuf *q;
|
||||
unsigned char buffer[1600];
|
||||
unsigned char *ptr;
|
||||
LPPACKET lpPacket;
|
||||
|
||||
/* initiate transfer(); */
|
||||
if (p->tot_len>=1600)
|
||||
return ERR_BUF;
|
||||
if((lpPacket = PacketAllocatePacket())==NULL)
|
||||
return ERR_BUF;
|
||||
PacketInitPacket(lpPacket,buffer,p->tot_len);
|
||||
ptr=buffer;
|
||||
for(q = p; q != NULL; q = q->next) {
|
||||
/* Send the data from the pbuf to the interface, one pbuf at a
|
||||
time. The size of the data in each pbuf is kept in the ->len
|
||||
variable. */
|
||||
/* send data from(q->payload, q->len); */
|
||||
#ifdef NETIF_DEBUG
|
||||
DEBUGF(NETIF_DEBUG, ("netif: send ptr %p q->payload %p q->len %i q->next %p\n", ptr, q->payload, (int)q->len, q->next));
|
||||
#endif
|
||||
bcopy(q->payload,ptr,q->len);
|
||||
ptr+=q->len;
|
||||
}
|
||||
|
||||
/* signal that packet should be sent(); */
|
||||
|
||||
if (!PacketSendPacket(lpAdapter,lpPacket,TRUE))
|
||||
return ERR_BUF;
|
||||
PacketFreePacket(lpPacket);
|
||||
|
||||
#ifdef LINK_STATS
|
||||
lwip_stats.link.xmit++;
|
||||
#endif /* LINK_STATS */
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*
|
||||
* low_level_input():
|
||||
*
|
||||
* Should allocate a pbuf and transfer the bytes of the incoming
|
||||
* packet from the interface into the pbuf.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static struct pbuf *
|
||||
low_level_input(struct netif *ethernetif)
|
||||
{
|
||||
struct pbuf *p, *q;
|
||||
int start, length;
|
||||
|
||||
/* Obtain the size of the packet and put it into the "len"
|
||||
variable. */
|
||||
length = cur_length;
|
||||
if (length<=0)
|
||||
return NULL;
|
||||
|
||||
/* We allocate a pbuf chain of pbufs from the pool. */
|
||||
p = pbuf_alloc(PBUF_LINK, (u16_t)length, PBUF_POOL);
|
||||
#ifdef NETIF_DEBUG
|
||||
DEBUGF(NETIF_DEBUG, ("netif: recv length %i p->tot_len %i\n", length, (int)p->tot_len));
|
||||
#endif
|
||||
|
||||
if(p != NULL) {
|
||||
/* We iterate over the pbuf chain until we have read the entire
|
||||
packet into the pbuf. */
|
||||
start=0;
|
||||
for(q = p; q != NULL; q = q->next) {
|
||||
/* Read enough bytes to fill this pbuf in the chain. The
|
||||
avaliable data in the pbuf is given by the q->len
|
||||
variable. */
|
||||
/* read data into(q->payload, q->len); */
|
||||
#ifdef NETIF_DEBUG
|
||||
DEBUGF(NETIF_DEBUG, ("netif: recv start %i length %i q->payload %p q->len %i q->next %p\n", start, length, q->payload, (int)q->len, q->next));
|
||||
#endif
|
||||
bcopy(&cur_packet[start],q->payload,q->len);
|
||||
start+=q->len;
|
||||
length-=q->len;
|
||||
if (length<=0)
|
||||
break;
|
||||
}
|
||||
/* acknowledge that packet has been read(); */
|
||||
cur_length=0;
|
||||
#ifdef LINK_STATS
|
||||
lwip_stats.link.recv++;
|
||||
#endif /* LINK_STATS */
|
||||
} else {
|
||||
/* drop packet(); */
|
||||
cur_length=0;
|
||||
#ifdef LINK_STATS
|
||||
lwip_stats.link.memerr++;
|
||||
lwip_stats.link.drop++;
|
||||
#endif /* LINK_STATS */
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*
|
||||
* ethernetif_output():
|
||||
*
|
||||
* This function is called by the TCP/IP stack when an IP packet
|
||||
* should be sent. It calls the function called low_level_output() to
|
||||
* do the actuall transmission of the packet.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static err_t
|
||||
ethernetif_output(struct netif *netif, struct pbuf *p,
|
||||
struct ip_addr *ipaddr)
|
||||
{
|
||||
p = etharp_output(netif, ipaddr, p);
|
||||
if(p != NULL) {
|
||||
return low_level_output(netif, p);
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*
|
||||
* ethernetif_input():
|
||||
*
|
||||
* This function should be called when a packet is ready to be read
|
||||
* from the interface. It uses the function low_level_input() that
|
||||
* should handle the actual reception of bytes from the network
|
||||
* interface.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
ethernetif_input(struct netif *netif)
|
||||
{
|
||||
struct ethernetif *ethernetif;
|
||||
struct eth_hdr *ethhdr;
|
||||
struct pbuf *p;
|
||||
|
||||
|
||||
ethernetif = netif->state;
|
||||
|
||||
p = low_level_input(netif);
|
||||
|
||||
if(p != NULL) {
|
||||
|
||||
#ifdef LINK_STATS
|
||||
lwip_stats.link.recv++;
|
||||
#endif /* LINK_STATS */
|
||||
|
||||
ethhdr = p->payload;
|
||||
|
||||
switch(htons(ethhdr->type)) {
|
||||
case ETHTYPE_IP:
|
||||
etharp_ip_input(netif, p);
|
||||
pbuf_header(p, -14);
|
||||
//if(ip_lookup(p->payload, netif)) {
|
||||
netif->input(p, netif);
|
||||
//}
|
||||
break;
|
||||
case ETHTYPE_ARP:
|
||||
p = etharp_arp_input(netif, ethernetif->ethaddr, p);
|
||||
if(p != NULL) {
|
||||
low_level_output(netif, p);
|
||||
pbuf_free(p);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
pbuf_free(p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void
|
||||
arp_timer(void *arg)
|
||||
{
|
||||
etharp_tmr();
|
||||
sys_timeout(ARP_TMR_INTERVAL, (sys_timeout_handler)arp_timer, NULL);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*
|
||||
* ethernetif_init():
|
||||
*
|
||||
* Should be called at the beginning of the program to set up the
|
||||
* network interface. It calls the function low_level_init() to do the
|
||||
* actual setup of the hardware.
|
||||
*
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
ethernetif_init(struct netif *netif)
|
||||
{
|
||||
struct ethernetif *ethernetif;
|
||||
|
||||
ethernetif = mem_malloc(sizeof(struct ethernetif));
|
||||
netif->state = ethernetif;
|
||||
netif->name[0] = IFNAME0;
|
||||
netif->name[1] = IFNAME1;
|
||||
netif->output = ethernetif_output;
|
||||
|
||||
ethernetif->ethaddr = (struct eth_addr *)&(netif->hwaddr[0]);
|
||||
|
||||
low_level_init(netif);
|
||||
etharp_init();
|
||||
|
||||
sys_timeout(ARP_TMR_INTERVAL, (sys_timeout_handler)arp_timer, NULL);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/*
|
||||
* pktif_update():
|
||||
*
|
||||
* Needs to be called periodically to get new packets. This could
|
||||
* be done inside a thread.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
static void ProcessPackets(LPPACKET lpPacket)
|
||||
{
|
||||
|
||||
ULONG ulLines, ulBytesReceived;
|
||||
char *base;
|
||||
char *buf;
|
||||
u_int off=0;
|
||||
u_int tlen,tlen1;
|
||||
struct bpf_hdr *hdr;
|
||||
struct ethernetif *ethernetif;
|
||||
|
||||
ethernetif = pktif_netif->state;
|
||||
|
||||
ulBytesReceived = lpPacket->ulBytesReceived;
|
||||
|
||||
buf = lpPacket->Buffer;
|
||||
|
||||
off=0;
|
||||
|
||||
while(off<ulBytesReceived)
|
||||
{
|
||||
//if(kbhit())return;
|
||||
hdr=(struct bpf_hdr *)(buf+off);
|
||||
tlen1=hdr->bh_datalen;
|
||||
cur_length=tlen1;
|
||||
tlen=hdr->bh_caplen;
|
||||
off+=hdr->bh_hdrlen;
|
||||
|
||||
ulLines = (tlen + 15) / 16;
|
||||
if (ulLines > 5) ulLines=5;
|
||||
|
||||
base =(char*)(buf+off);
|
||||
cur_packet=base;
|
||||
off=Packet_WORDALIGN(off+tlen);
|
||||
|
||||
ethernetif_input(pktif_netif);
|
||||
}
|
||||
}
|
||||
|
||||
void update_adapter(void)
|
||||
{
|
||||
struct ethernetif *ethernetif;
|
||||
|
||||
ethernetif = pktif_netif->state;
|
||||
|
||||
if(PacketReceivePacket(lpAdapter,lpPacket,TRUE)==TRUE)
|
||||
ProcessPackets(lpPacket);
|
||||
cur_length=0;
|
||||
cur_packet=NULL;
|
||||
}
|
||||
|
||||
104
proj/msvc6/pktif/pktif.dsp
Normal file
104
proj/msvc6/pktif/pktif.dsp
Normal file
@@ -0,0 +1,104 @@
|
||||
# Microsoft Developer Studio Project File - Name="pktif" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** NICHT BEARBEITEN **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=pktif - Win32 Debug
|
||||
!MESSAGE Dies ist kein g<>ltiges Makefile. Zum Erstellen dieses Projekts mit NMAKE
|
||||
!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und f<>hren Sie den Befehl
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "pktif.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE Sie k<>nnen beim Ausf<73>hren von NMAKE eine Konfiguration angeben
|
||||
!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "pktif.mak" CFG="pktif - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE F<>r die Konfiguration stehen zur Auswahl:
|
||||
!MESSAGE
|
||||
!MESSAGE "pktif - Win32 Release" (basierend auf "Win32 (x86) Static Library")
|
||||
!MESSAGE "pktif - Win32 Debug" (basierend auf "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "pktif - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\src\include" /I "..\..\..\src\include\ipv4" /I "..\..\..\proj\msvc6" /I "..\..\..\src\arch\msvc6\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x407 /d "NDEBUG"
|
||||
# ADD RSC /l 0x407 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "pktif - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\..\src\include" /I "..\..\..\src\include\ipv4" /I "..\..\..\proj\msvc6" /I "..\..\..\src\arch\msvc6\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x407 /d "_DEBUG"
|
||||
# ADD RSC /l 0x407 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"Debug\pktif_d.lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "pktif - Win32 Release"
|
||||
# Name "pktif - Win32 Debug"
|
||||
# Begin Group "Quellcodedateien"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\netif\etharp.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\pktif.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header-Dateien"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\include\netif\etharp.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
26
proj/msvc6/readme.txt
Normal file
26
proj/msvc6/readme.txt
Normal file
@@ -0,0 +1,26 @@
|
||||
lwIP for Win32
|
||||
|
||||
***WARNING***
|
||||
The current CVS code of this port isn't much tested.
|
||||
***WARNING***
|
||||
|
||||
This is a quickly hacked port and example project of the lwIP library to
|
||||
Win32/MSVC.
|
||||
|
||||
Due to the nature of the lwip library you have to copy this whole project
|
||||
into a new subdir in proj and modify lwipopts.h to your needs. If you move
|
||||
it to another directory besides proj, you have to update the include paths
|
||||
in the project settings.
|
||||
|
||||
Included in the proj/msvc6 directory is the network interface driver using
|
||||
the winpcap library.
|
||||
|
||||
There is no more documentation yet. Try to figure it out yourself.
|
||||
|
||||
This is provided as is, it's just a hack to test some stuff, no serious
|
||||
implementation.
|
||||
|
||||
Florian Schulze (florian.proff.schulze@gmx.net)
|
||||
|
||||
lwIP: http://www.sics.se/~adam/lwip/
|
||||
WinPCap: http://netgroup-serv.polito.it/winpcap/
|
||||
217
proj/msvc6/test.c
Normal file
217
proj/msvc6/test.c
Normal file
@@ -0,0 +1,217 @@
|
||||
/*
|
||||
* Copyright (c) 2001,2002 Florian Schulze.
|
||||
* 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 authors nor the names of the contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS 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.
|
||||
*
|
||||
* test.c - This file is part of lwIPtest
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "lwip/debug.h"
|
||||
#include "lwip/mem.h"
|
||||
#include "lwip/memp.h"
|
||||
#include "lwip/sys.h"
|
||||
|
||||
#include "lwip/stats.h"
|
||||
|
||||
#include "lwip/tcpip.h"
|
||||
|
||||
#include "netif/loopif.h"
|
||||
#include "netif/tcpdump.h"
|
||||
|
||||
#include "arch/perf.h"
|
||||
|
||||
//#include "httpd.h"
|
||||
//#include "ftpd.h"
|
||||
//#include "fs.h"
|
||||
|
||||
void ethernetif_init(struct netif *netif);
|
||||
int init_adapter(void);
|
||||
void shutdown_adapter(void);
|
||||
void update_adapter(void);
|
||||
|
||||
int dbg_printf(const char *fmt, ...)
|
||||
{
|
||||
va_list v;
|
||||
int r;
|
||||
|
||||
va_start(v, fmt);
|
||||
r = vfprintf(stderr,fmt, v);
|
||||
va_end(v);
|
||||
return r;
|
||||
}
|
||||
|
||||
static err_t netio_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
||||
{
|
||||
if (err == ERR_OK && p != NULL)
|
||||
{
|
||||
tcp_recved(pcb, p->tot_len);
|
||||
pbuf_free(p);
|
||||
}
|
||||
else
|
||||
pbuf_free(p);
|
||||
|
||||
if (err == ERR_OK && p == NULL)
|
||||
{
|
||||
tcp_arg(pcb, NULL);
|
||||
tcp_sent(pcb, NULL);
|
||||
tcp_recv(pcb, NULL);
|
||||
tcp_close(pcb);
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
static err_t netio_accept(void *arg, struct tcp_pcb *pcb, err_t err)
|
||||
{
|
||||
tcp_arg(pcb, NULL);
|
||||
tcp_sent(pcb, NULL);
|
||||
tcp_recv(pcb, netio_recv);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
void netio_init(void)
|
||||
{
|
||||
struct tcp_pcb *pcb;
|
||||
|
||||
pcb = tcp_new();
|
||||
tcp_bind(pcb, IP_ADDR_ANY, 18767);
|
||||
pcb = tcp_listen(pcb);
|
||||
tcp_accept(pcb, netio_accept);
|
||||
}
|
||||
|
||||
void main_loop()
|
||||
{
|
||||
struct ip_addr ipaddr, netmask, gw;
|
||||
int last_time;
|
||||
int timer1;
|
||||
int timer2;
|
||||
int done;
|
||||
|
||||
IP4_ADDR(&gw, 192,168,2,201);
|
||||
IP4_ADDR(&ipaddr, 192,168,2,200);
|
||||
IP4_ADDR(&netmask, 255,255,255,0);
|
||||
|
||||
if (init_adapter() != 0)
|
||||
return;
|
||||
|
||||
netif_set_default(netif_add(&ipaddr, &netmask, &gw, ethernetif_init,
|
||||
ip_input));
|
||||
|
||||
/*
|
||||
IP4_ADDR(&gw, 127,0,0,1);
|
||||
IP4_ADDR(&ipaddr, 127,0,0,1);
|
||||
IP4_ADDR(&netmask, 255,0,0,0);
|
||||
|
||||
netif_add(&ipaddr, &netmask, &gw, loopif_init,
|
||||
ip_input);
|
||||
*/
|
||||
|
||||
tcp_init();
|
||||
udp_init();
|
||||
ip_init();
|
||||
|
||||
//httpd_init();
|
||||
netio_init();
|
||||
//ftpd_init();
|
||||
|
||||
last_time=clock();
|
||||
timer1=0;
|
||||
timer2=0;
|
||||
done=0;
|
||||
|
||||
while(!done)
|
||||
{
|
||||
int cur_time;
|
||||
int time_diff;
|
||||
|
||||
cur_time=clock();
|
||||
time_diff=cur_time-last_time;
|
||||
if (time_diff>0)
|
||||
{
|
||||
last_time=cur_time;
|
||||
timer1+=time_diff;
|
||||
timer2+=time_diff;
|
||||
}
|
||||
|
||||
if (timer1>10)
|
||||
{
|
||||
tcp_fasttmr();
|
||||
timer1=0;
|
||||
}
|
||||
|
||||
if (timer2>45)
|
||||
{
|
||||
tcp_slowtmr();
|
||||
timer2=0;
|
||||
done=kbhit();
|
||||
}
|
||||
|
||||
update_adapter();
|
||||
}
|
||||
|
||||
shutdown_adapter();
|
||||
}
|
||||
|
||||
void bcopy(const void *src, void *dest, int len)
|
||||
{
|
||||
memcpy(dest,src,len);
|
||||
}
|
||||
|
||||
void bzero(void *data, int n)
|
||||
{
|
||||
memset(data,0,n);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
setvbuf(stdout,NULL,_IONBF,0);
|
||||
#ifdef PERF
|
||||
perf_init("/tmp/lwip.perf");
|
||||
#endif /* PERF */
|
||||
#ifdef STATS
|
||||
stats_init();
|
||||
#endif /* STATS */
|
||||
sys_init();
|
||||
mem_init();
|
||||
memp_init();
|
||||
pbuf_init();
|
||||
|
||||
//tcpdump_init();
|
||||
|
||||
printf("System initialized.\n");
|
||||
|
||||
main_loop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
154
proj/msvc6/test.dsp
Normal file
154
proj/msvc6/test.dsp
Normal file
@@ -0,0 +1,154 @@
|
||||
# Microsoft Developer Studio Project File - Name="test" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** NICHT BEARBEITEN **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=test - Win32 Debug
|
||||
!MESSAGE Dies ist kein g<>ltiges Makefile. Zum Erstellen dieses Projekts mit NMAKE
|
||||
!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und f<>hren Sie den Befehl
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "test.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE Sie k<>nnen beim Ausf<73>hren von NMAKE eine Konfiguration angeben
|
||||
!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "test.mak" CFG="test - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE F<>r die Konfiguration stehen zur Auswahl:
|
||||
!MESSAGE
|
||||
!MESSAGE "test - Win32 Release" (basierend auf "Win32 (x86) Console Application")
|
||||
!MESSAGE "test - Win32 Debug" (basierend auf "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "test - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\..\..\src\include" /I "..\..\..\src\include\ipv4" /I "..\..\..\proj\msvc6" /I "..\..\..\src\arch\msvc6\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x407 /d "NDEBUG"
|
||||
# ADD RSC /l 0x407 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Packet.lib /nologo /subsystem:console /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "test - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\src\include" /I "..\..\src\include\ipv4" /I "..\..\src\arch\msvc6\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x407 /d "_DEBUG"
|
||||
# ADD RSC /l 0x407 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Packet.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "test - Win32 Release"
|
||||
# Name "test - Win32 Debug"
|
||||
# Begin Group "Quellcodedateien"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\test.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header-Dateien"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# End Group
|
||||
# Begin Group "Ressourcendateien"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\lwip4\Release\lwip4.lib
|
||||
|
||||
!IF "$(CFG)" == "test - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "test - Win32 Debug"
|
||||
|
||||
# PROP Exclude_From_Build 1
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\lwip4\Debug\lwip4_d.lib
|
||||
|
||||
!IF "$(CFG)" == "test - Win32 Release"
|
||||
|
||||
# PROP Exclude_From_Build 1
|
||||
|
||||
!ELSEIF "$(CFG)" == "test - Win32 Debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\pktif\Debug\pktif_d.lib
|
||||
|
||||
!IF "$(CFG)" == "test - Win32 Release"
|
||||
|
||||
# PROP Exclude_From_Build 1
|
||||
|
||||
!ELSEIF "$(CFG)" == "test - Win32 Debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\pktif\Release\pktif.lib
|
||||
|
||||
!IF "$(CFG)" == "test - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "test - Win32 Debug"
|
||||
|
||||
# PROP Exclude_From_Build 1
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
59
proj/msvc6/test.dsw
Normal file
59
proj/msvc6/test.dsw
Normal file
@@ -0,0 +1,59 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GEL<45>SCHT WERDEN!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "lwip4"=.\lwip4\lwip4.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "pktif"=.\pktif\pktif.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "test"=.\test.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name lwip4
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name pktif
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
86
proj/unixlib/Makefile
Normal file
86
proj/unixlib/Makefile
Normal file
@@ -0,0 +1,86 @@
|
||||
#
|
||||
# Copyright (c) 2001, 2002 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>
|
||||
#
|
||||
|
||||
CCDEP=gcc
|
||||
CC=gcc
|
||||
CFLAGS=-g -Wall -fPIC -DIPv4 -DLWIP_DEBUG
|
||||
LWIPARCH=unix
|
||||
LWIPDIR=../../src
|
||||
|
||||
CFLAGS:=$(CFLAGS) \
|
||||
-I$(LWIPDIR)/include -I$(LWIPDIR)/arch/$(LWIPARCH)/include -I$(LWIPDIR)/include/ipv4 \
|
||||
-Iapps -I.
|
||||
|
||||
# COREFILES, CORE4FILES: The minimum set of files needed for lwIP.
|
||||
COREFILES=$(LWIPDIR)/core/mem.c $(LWIPDIR)/core/memp.c $(LWIPDIR)/core/netif.c \
|
||||
$(LWIPDIR)/core/pbuf.c $(LWIPDIR)/core/stats.c $(LWIPDIR)/core/sys.c \
|
||||
$(LWIPDIR)/core/tcp.c $(LWIPDIR)/core/tcp_in.c \
|
||||
$(LWIPDIR)/core/tcp_out.c $(LWIPDIR)/core/udp.c
|
||||
CORE4FILES=$(LWIPDIR)/core/ipv4/icmp.c $(LWIPDIR)/core/ipv4/ip.c \
|
||||
$(LWIPDIR)/core/inet.c $(LWIPDIR)/core/ipv4/ip_addr.c
|
||||
|
||||
|
||||
# APIFILES: The files which implement the sequential and socket APIs.
|
||||
APIFILES=$(LWIPDIR)/api/api_lib.c $(LWIPDIR)/api/api_msg.c $(LWIPDIR)/api/tcpip.c \
|
||||
$(LWIPDIR)/api/err.c $(LWIPDIR)/api/sockets.c
|
||||
|
||||
# NETIFFILES: Files implementing various generic network interface functions.'
|
||||
NETIFFILES=$(LWIPDIR)/netif/loopif.c \
|
||||
$(LWIPDIR)/netif/etharp.c
|
||||
|
||||
# ARCHFILES: Archiecture specific files.
|
||||
ARCHFILES=$(wildcard $(LWIPDIR)/arch/$(LWIPARCH)/*.c $(LWIPDIR)/arch/$(LWIPARCH)/netif/*.c)
|
||||
|
||||
# LWIPFILES: All the above.
|
||||
LWIPFILES=$(COREFILES) $(CORE4FILES) $(APIFILES) $(NETIFFILES) $(ARCHFILES)
|
||||
LWIPFILESW=$(wildcard $(LWIPFILES))
|
||||
LWIPOBJS=$(notdir $(LWIPFILESW:.c=.o))
|
||||
|
||||
LWIPLIB=liblwip4$(LWIPARCH)lib.so
|
||||
|
||||
%.o:
|
||||
$(CC) $(CFLAGS) -c $(<:.o=.c)
|
||||
|
||||
all: $(LWIPLIB)
|
||||
.PHONY: all
|
||||
|
||||
clean:
|
||||
rm -f *.o $(LWIPLIB) *.s .depend* *.core core
|
||||
|
||||
depend dep: .depend
|
||||
|
||||
include .depend
|
||||
|
||||
$(LWIPLIB): $(LWIPOBJS) unixlib.o
|
||||
$(CC) -g -nostartfiles -shared -o $@ $^
|
||||
|
||||
.depend: unixlib.c $(LWIPFILES)
|
||||
$(CCDEP) $(CFLAGS) -MM $^ > .depend || rm -f .depend
|
||||
31
proj/unixlib/README
Normal file
31
proj/unixlib/README
Normal file
@@ -0,0 +1,31 @@
|
||||
This directory contains an example of how to compile lwIP as a self
|
||||
initialising shared library on Linux.
|
||||
|
||||
Some brief instructions:
|
||||
|
||||
* Compile the code:
|
||||
|
||||
> make clean all
|
||||
|
||||
This should produce liblwip4unixlib.so. This is the shared library.
|
||||
|
||||
* Link an application against the shared library
|
||||
|
||||
If you're using gcc you can do this by including -llwip4unixlib in
|
||||
your link command.
|
||||
|
||||
* Run your application
|
||||
|
||||
Ensure that LD_LIBRARY_PATH includes the directory that contains
|
||||
liblwip4unixlib.so (ie. this directory)
|
||||
|
||||
|
||||
|
||||
If you are unsure about shared libraries and libraries on linux in
|
||||
general, you might find this HOWTO useful:
|
||||
|
||||
<http://www.tldp.org/HOWTO/Program-Library-HOWTO/>
|
||||
|
||||
|
||||
|
||||
Kieran Mansley, October 2002.
|
||||
181
proj/unixlib/lwipopts.h
Normal file
181
proj/unixlib/lwipopts.h
Normal file
@@ -0,0 +1,181 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2003 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>
|
||||
*
|
||||
*/
|
||||
#ifndef __LWIPOPTS_H__
|
||||
#define __LWIPOPTS_H__
|
||||
|
||||
/* ---------- Memory options ---------- */
|
||||
/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
|
||||
lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
|
||||
byte alignment -> define MEM_ALIGNMENT to 2. */
|
||||
#define MEM_ALIGNMENT 1
|
||||
|
||||
/* MEM_SIZE: the size of the heap memory. If the application will send
|
||||
a lot of data that needs to be copied, this should be set high. */
|
||||
#define MEM_SIZE 1600
|
||||
|
||||
/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
|
||||
sends a lot of data out of ROM (or other static memory), this
|
||||
should be set high. */
|
||||
#define MEMP_NUM_PBUF 16
|
||||
/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
|
||||
per active UDP "connection". */
|
||||
#define MEMP_NUM_UDP_PCB 4
|
||||
/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
|
||||
connections. */
|
||||
#define MEMP_NUM_TCP_PCB 5
|
||||
/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
|
||||
connections. */
|
||||
#define MEMP_NUM_TCP_PCB_LISTEN 8
|
||||
/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
|
||||
segments. */
|
||||
#define MEMP_NUM_TCP_SEG 16
|
||||
/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
|
||||
timeouts. */
|
||||
#define MEMP_NUM_SYS_TIMEOUT 3
|
||||
|
||||
|
||||
/* The following four are used only with the sequential API and can be
|
||||
set to 0 if the application only will use the raw API. */
|
||||
/* MEMP_NUM_NETBUF: the number of struct netbufs. */
|
||||
#define MEMP_NUM_NETBUF 2
|
||||
/* MEMP_NUM_NETCONN: the number of struct netconns. */
|
||||
#define MEMP_NUM_NETCONN 4
|
||||
/* MEMP_NUM_APIMSG: the number of struct api_msg, used for
|
||||
communication between the TCP/IP stack and the sequential
|
||||
programs. */
|
||||
#define MEMP_NUM_API_MSG 8
|
||||
/* MEMP_NUM_TCPIPMSG: the number of struct tcpip_msg, which is used
|
||||
for sequential API communication and incoming packets. Used in
|
||||
src/api/tcpip.c. */
|
||||
#define MEMP_NUM_TCPIP_MSG 8
|
||||
|
||||
/* These two control is reclaimer functions should be compiled
|
||||
in. Should always be turned on (1). */
|
||||
#define MEM_RECLAIM 1
|
||||
#define MEMP_RECLAIM 1
|
||||
|
||||
/* ---------- Pbuf options ---------- */
|
||||
/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
|
||||
#define PBUF_POOL_SIZE 6
|
||||
|
||||
/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
|
||||
#define PBUF_POOL_BUFSIZE 128
|
||||
|
||||
/* PBUF_LINK_HLEN: the number of bytes that should be allocated for a
|
||||
link level header. */
|
||||
#define PBUF_LINK_HLEN 16
|
||||
|
||||
/* ---------- TCP options ---------- */
|
||||
#define LWIP_TCP 1
|
||||
#define TCP_TTL 255
|
||||
|
||||
/* Controls if TCP should queue segments that arrive out of
|
||||
order. Define to 0 if your device is low on memory. */
|
||||
#define TCP_QUEUE_OOSEQ 1
|
||||
|
||||
/* TCP Maximum segment size. */
|
||||
#define TCP_MSS 128
|
||||
|
||||
/* TCP sender buffer space (bytes). */
|
||||
#define TCP_SND_BUF 256
|
||||
|
||||
/* TCP sender buffer space (pbufs). This must be at least = 2 *
|
||||
TCP_SND_BUF/TCP_MSS for things to work. */
|
||||
#define TCP_SND_QUEUELEN 4 * TCP_SND_BUF/TCP_MSS
|
||||
|
||||
/* TCP receive window. */
|
||||
#define TCP_WND 1024
|
||||
|
||||
/* Maximum number of retransmissions of data segments. */
|
||||
#define TCP_MAXRTX 12
|
||||
|
||||
/* Maximum number of retransmissions of SYN segments. */
|
||||
#define TCP_SYNMAXRTX 4
|
||||
|
||||
/* ---------- ARP options ---------- */
|
||||
#define ARP_TABLE_SIZE 10
|
||||
#define ARP_QUEUEING 1
|
||||
/**
|
||||
* - If enabled, cache entries are generated for every kind of ARP traffic or
|
||||
* broadcast IP traffic. This enhances behaviour for sending to a dynamic set
|
||||
* of hosts, for example if acting as a gateway.
|
||||
* - If disabled, cache entries are generated only for IP destination addresses
|
||||
* in use by lwIP or applications. This enhances performance if sending to a small,
|
||||
* reasonably static number of hosts. Typically for embedded devices.
|
||||
*/
|
||||
#define ETHARP_ALWAYS_INSERT 1
|
||||
|
||||
/* ---------- IP options ---------- */
|
||||
/* Define IP_FORWARD to 1 if you wish to have the ability to forward
|
||||
IP packets across network interfaces. If you are going to run lwIP
|
||||
on a device with only one network interface, define this to 0. */
|
||||
#define IP_FORWARD 1
|
||||
|
||||
/* If defined to 1, IP options are allowed (but not parsed). If
|
||||
defined to 0, all packets with IP options are dropped. */
|
||||
#define IP_OPTIONS 1
|
||||
|
||||
/* ---------- ICMP options ---------- */
|
||||
#define ICMP_TTL 255
|
||||
|
||||
|
||||
/* ---------- DHCP options ---------- */
|
||||
/* Define LWIP_DHCP to 1 if you want DHCP configuration of
|
||||
interfaces. DHCP is not implemented in lwIP 0.5.1, however, so
|
||||
turning this on does currently not work. */
|
||||
#define LWIP_DHCP 0
|
||||
|
||||
/* 1 if you want to do an ARP check on the offered address
|
||||
(recommended). */
|
||||
#define DHCP_DOES_ARP_CHECK 1
|
||||
|
||||
/* ---------- UDP options ---------- */
|
||||
#define LWIP_UDP 1
|
||||
#define UDP_TTL 255
|
||||
|
||||
|
||||
/* ---------- Statistics options ---------- */
|
||||
#define STATS
|
||||
|
||||
#ifdef STATS
|
||||
#define LINK_STATS
|
||||
#define IP_STATS
|
||||
#define ICMP_STATS
|
||||
#define UDP_STATS
|
||||
#define TCP_STATS
|
||||
#define MEM_STATS
|
||||
#define MEMP_STATS
|
||||
#define PBUF_STATS
|
||||
#define SYS_STATS
|
||||
#endif /* STATS */
|
||||
|
||||
#endif /* __LWIPOPTS_H__ */
|
||||
91
proj/unixlib/unixlib.c
Normal file
91
proj/unixlib/unixlib.c
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2003 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.
|
||||
*
|
||||
* Author: Kieran Mansley <kjm25@cam.ac.uk>
|
||||
*
|
||||
* $Id: unixlib.c,v 1.2 2003/01/08 10:09:40 likewise Exp $
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* unixlib.c
|
||||
*
|
||||
* The initialisation functions for a shared library
|
||||
*
|
||||
* You may need to configure this file to your own needs - it is only an example
|
||||
* of how lwIP can be used as a self initialising shared library.
|
||||
*
|
||||
* In particular, you should change the gateway, ipaddr, and netmask to be the values
|
||||
* you would like the stack to use.
|
||||
*/
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/mem.h"
|
||||
#include "lwip/memp.h"
|
||||
#include "lwip/pbuf.h"
|
||||
#include "lwip/tcp.h"
|
||||
#include "lwip/tcpip.h"
|
||||
#include "lwip/netif.h"
|
||||
#include "lwip/stats.h"
|
||||
|
||||
#include "netif/tapif.h"
|
||||
|
||||
static void
|
||||
tcpip_init_done(void *arg)
|
||||
{
|
||||
sys_sem_t *sem;
|
||||
sem = arg;
|
||||
sys_sem_signal(*sem);
|
||||
}
|
||||
|
||||
void _init(void){
|
||||
struct ip_addr ipaddr, netmask, gateway;
|
||||
sys_sem_t sem;
|
||||
|
||||
stats_init();
|
||||
sys_init();
|
||||
mem_init();
|
||||
memp_init();
|
||||
pbuf_init();
|
||||
|
||||
sem = sys_sem_new(0);
|
||||
tcpip_init(tcpip_init_done, &sem);
|
||||
sys_sem_wait(sem);
|
||||
sys_sem_free(sem);
|
||||
|
||||
netif_init();
|
||||
/*
|
||||
CHANGE THESE to suit your own network configuration:
|
||||
*/
|
||||
IP4_ADDR(&gateway, 192,168,1,1);
|
||||
IP4_ADDR(&ipaddr, 192,168,1,1);
|
||||
IP4_ADDR(&netmask, 255,255,255,0);
|
||||
|
||||
netif_set_default(netif_add(&ipaddr, &netmask, &gateway, tapif_init,
|
||||
tcpip_input));
|
||||
}
|
||||
|
||||
void _fini(void){
|
||||
}
|
||||
@@ -1,36 +1,33 @@
|
||||
# Copyright (c) 2001, Swedish Institute of Computer Science.
|
||||
#
|
||||
# Copyright (c) 2001, 2002 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:
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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 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>
|
||||
#
|
||||
# $Id: Makefile,v 1.1 2002/10/19 12:59:37 likewise Exp $
|
||||
|
||||
CCDEP=gcc
|
||||
CC=gcc
|
||||
@@ -47,10 +44,9 @@ CFLAGS:=$(CFLAGS) \
|
||||
# COREFILES, CORE4FILES: The minimum set of files needed for lwIP.
|
||||
COREFILES=$(LWIPDIR)/core/mem.c $(LWIPDIR)/core/memp.c $(LWIPDIR)/core/netif.c \
|
||||
$(LWIPDIR)/core/pbuf.c $(LWIPDIR)/core/stats.c $(LWIPDIR)/core/sys.c \
|
||||
$(LWIPDIR)/core/tcp.c $(LWIPDIR)/core/tcp_input.c \
|
||||
$(LWIPDIR)/core/tcp_output.c $(LWIPDIR)/core/udp.c
|
||||
CORE4FILES=$(LWIPDIR)/core/ipv4/icmp.c $(LWIPDIR)/core/ipv4/ip.c \
|
||||
$(LWIPDIR)/core/inet.c $(LWIPDIR)/core/ipv4/ip_addr.c
|
||||
$(LWIPDIR)/core/tcp.c $(LWIPDIR)/core/tcp_in.c \
|
||||
$(LWIPDIR)/core/tcp_out.c $(LWIPDIR)/core/udp.c
|
||||
CORE4FILES=$(wildcard $(LWIPDIR)/core/ipv4/*.c) $(LWIPDIR)/core/inet.c
|
||||
|
||||
|
||||
# APIFILES: The files which implement the sequential and socket APIs.
|
||||
@@ -59,7 +55,7 @@ APIFILES=$(LWIPDIR)/api/api_lib.c $(LWIPDIR)/api/api_msg.c $(LWIPDIR)/api/tcpip.
|
||||
|
||||
# NETIFFILES: Files implementing various generic network interface functions.'
|
||||
NETIFFILES=$(LWIPDIR)/netif/loopif.c \
|
||||
$(LWIPDIR)/netif/tcpdump.c $(LWIPDIR)/netif/etharp.c
|
||||
$(LWIPDIR)/netif/etharp.c $(LWIPDIR)/netif/slipif.c
|
||||
|
||||
# ARCHFILES: Archiecture specific files.
|
||||
ARCHFILES=$(wildcard $(LWIPDIR)/arch/$(LWIPARCH)/*.c $(LWIPDIR)/arch/$(LWIPARCH)/netif/*.c)
|
||||
@@ -81,7 +77,7 @@ APPOBJS=$(notdir $(APPFILES:.c=.o))
|
||||
%.o:
|
||||
$(CC) $(CFLAGS) -c $(<:.o=.c)
|
||||
|
||||
all ipv4 compile: simhost simnode simrouter
|
||||
all ipv4 compile: simhost
|
||||
.PHONY: all
|
||||
|
||||
clean:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
@@ -43,9 +43,11 @@ fs_open(char *name, struct fs_file *file)
|
||||
{
|
||||
struct fsdata_file_noconst *f;
|
||||
|
||||
for(f = (struct fsdata_file_noconst *)FS_ROOT; f != NULL; f = (struct fsdata_file_noconst *)f->next) {
|
||||
if(!strcmp(name, f->name)) {
|
||||
file->data = f->data;
|
||||
for(f = (struct fsdata_file_noconst *)FS_ROOT;
|
||||
f != NULL;
|
||||
f = (struct fsdata_file_noconst *)f->next) {
|
||||
if(!strcmp(name, (char *)f->name)) {
|
||||
file->data = (char *)f->data;
|
||||
file->len = f->len;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
21
proj/unixsim/apps/fs/404.html
Normal file
21
proj/unixsim/apps/fs/404.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<html>
|
||||
<head><title>lwIP - A Lightweight TCP/IP Stack</title></head>
|
||||
<body bgcolor="white" text="black">
|
||||
|
||||
<table width="100%">
|
||||
<tr valign="top"><td width="80">
|
||||
<a href="http://www.sics.se/"><img src="img/sics.gif"
|
||||
border="0" alt="SICS logo" title="SICS logo"></a>
|
||||
</td><td width="500">
|
||||
<h1>lwIP - A Lightweight TCP/IP Stack</h1>
|
||||
<h2>404 - Page not found</h2>
|
||||
<p>
|
||||
Sorry, the page you are requesting was not found on this
|
||||
server.
|
||||
</p>
|
||||
</td><td>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,191 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<html>
|
||||
<head><title>lwIP - A Lightweight TCP/IP Stack - Documentation</title></head>
|
||||
|
||||
|
||||
<body bgcolor="white">
|
||||
|
||||
<table width="640" border="0" cellpadding="0"
|
||||
cellspacing="0">
|
||||
<tr><td>
|
||||
<center><h1>lwIP - A Lightweight TCP/IP Stack</h1></center>
|
||||
</td></tr></table>
|
||||
|
||||
|
||||
<table width="640" border="0" cellpadding="0"
|
||||
cellspacing="0">
|
||||
<tr><td align="center">
|
||||
<hr>
|
||||
|
||||
|
||||
|
||||
|
||||
<a href="index.html">Introduction</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="news.html">News</a>
|
||||
|
||||
|
|
||||
|
||||
[Documentation]
|
||||
|
||||
|
||||
|
|
||||
|
||||
<a href="mailinglist.html">Mailing list</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="changelog.html">Changelog</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="download.html">Download</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="links.html">Links</a>
|
||||
|
||||
|
||||
|
||||
<hr>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td><center><h2>Documentation</h2></center>
|
||||
</td></tr></table>
|
||||
|
||||
<table width="640" border="0" cellpadding="0"
|
||||
cellspacing="0"><tr>
|
||||
<td width="50">
|
||||
|
||||
</td>
|
||||
<td bgcolor="white" width="540">
|
||||
|
||||
<ul>
|
||||
<li><a href="os.html">Using lwIP with and without an operating
|
||||
system</a>.
|
||||
<br><br>
|
||||
|
||||
<li>The lwIP source archive contains documentation on how to port lwIP
|
||||
and how to write applications using the native API. They can also be
|
||||
found here: <a href="doc/sys_arch.txt">sys_arch.txt</a>, <a
|
||||
href="doc/rawapi.txt">rawapi.txt</a>.
|
||||
<br><br>
|
||||
|
||||
<li>Selected messages from the mailinglist: <a
|
||||
href="maillist/msg00231.html">lwIP memory buffers and allocators</a>,
|
||||
<a href="maillist/msg00227.html">Threads, semaphores and raw interface
|
||||
question</a>, <a href="maillist/msg00242.html">Threads, semaphores and
|
||||
raw interface question [2]</a>. <a href="maillist/msg00460.html">Some notes on using lwIP with the development enviroment ADS
|
||||
1.1 from ARM.</a>
|
||||
<br><br>
|
||||
|
||||
<li>A report describing the design and implementation of an old
|
||||
version of lwIP. The algorithms and data structures used both in the
|
||||
protocol implementations and in the sub systems such as the memory and
|
||||
buffer management systems are described. Also included in this report
|
||||
is a reference manual for the lwIP sequential API and some code
|
||||
examples of using lwIP. <a href="doc/lwip.pdf">PDF</a>, <a
|
||||
href="doc/lwip.ps.gz">.ps.gz</a>.
|
||||
|
||||
<br><br>
|
||||
|
||||
<li>Slides from a presentation that talks a bit about lwIP: <a
|
||||
href="doc/pres.pdf">PDF</a> (86k), <a href="doc/pres.ps.gz">.ps.gz</a>
|
||||
(36k).
|
||||
</ul>
|
||||
|
||||
<p align="justify">
|
||||
For more documentation regarding lwIP and a proxy architecture to
|
||||
support TCP/IP communication for small clients, look in <a
|
||||
href="/~adam/publications.html">Adam Dunkels' masters thesis</a>.
|
||||
</p>
|
||||
|
||||
|
||||
<p align="justify">
|
||||
The <a href="mailinglist.html">lwIP mailing list</a> can be used to
|
||||
discuss lwIP.
|
||||
</p>
|
||||
|
||||
<p align="justify">
|
||||
For questions or suggestions, please contact the author at <a
|
||||
href="mailto:Adam Dunkels <adam@sics.se>">Adam Dunkels
|
||||
<adam@sics.se></a>.
|
||||
</p>
|
||||
|
||||
|
||||
<p align="right">
|
||||
<font size="-1"><i>
|
||||
$Date: 2002/10/19 13:00:01 $
|
||||
</i></font>
|
||||
</p>
|
||||
|
||||
|
||||
</td>
|
||||
<td width="50">
|
||||
|
||||
</td>
|
||||
</tr></table>
|
||||
|
||||
<table width="640" border="0" cellpadding="0"
|
||||
cellspacing="0">
|
||||
<tr><td align="center">
|
||||
|
||||
<hr>
|
||||
|
||||
|
||||
|
||||
|
||||
<a href="index.html">Introduction</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="news.html">News</a>
|
||||
|
||||
|
|
||||
|
||||
[Documentation]
|
||||
|
||||
|
||||
|
|
||||
|
||||
<a href="mailinglist.html">Mailing list</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="changelog.html">Changelog</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="download.html">Download</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="links.html">Links</a>
|
||||
|
||||
|
||||
|
||||
<hr>
|
||||
|
||||
</td></tr><tr>
|
||||
<td>
|
||||
<div align="right">
|
||||
<a href="http://www.sics.se/~adam/">Adam Dunkels</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,232 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<html>
|
||||
<head><title>lwIP - A Lightweight TCP/IP Stack - Download</title></head>
|
||||
|
||||
|
||||
<body bgcolor="white">
|
||||
|
||||
<table width="640" border="0" cellpadding="0"
|
||||
cellspacing="0">
|
||||
<tr><td>
|
||||
<center><h1>lwIP - A Lightweight TCP/IP Stack</h1></center>
|
||||
</td></tr></table>
|
||||
|
||||
|
||||
<table width="640" border="0" cellpadding="0"
|
||||
cellspacing="0">
|
||||
<tr><td align="center">
|
||||
<hr>
|
||||
|
||||
|
||||
|
||||
|
||||
<a href="index.html">Introduction</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="news.html">News</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="documentation.html">Documentation</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="mailinglist.html">Mailing list</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="changelog.html">Changelog</a>
|
||||
|
||||
|
|
||||
|
||||
[Download]
|
||||
|
||||
|
||||
|
|
||||
|
||||
<a href="links.html">Links</a>
|
||||
|
||||
|
||||
|
||||
<hr>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td><center><h2>Download</h2></center>
|
||||
</td></tr></table>
|
||||
|
||||
<table width="640" border="0" cellpadding="0"
|
||||
cellspacing="0"><tr>
|
||||
<td width="50">
|
||||
|
||||
</td>
|
||||
<td bgcolor="white" width="540">
|
||||
|
||||
|
||||
<p align="justify">
|
||||
lwIP is avaliable for download provided that you read and accept <a
|
||||
href="licence.html">this</a> BSD-style license.
|
||||
</p>
|
||||
|
||||
<h3>Release versions</h3>
|
||||
<p align="justify">
|
||||
The latest version is 0.5.3. (Older versions are also provided for an
|
||||
unknown reason.)
|
||||
</p>
|
||||
<ul>
|
||||
<li>Version 0.5.3 (latest): <a
|
||||
href="download/?f=lwip-0.5.3.tar.gz">lwip-0.5.3.tar.gz</a>
|
||||
<br><br>
|
||||
|
||||
<li>
|
||||
<font size="-2">
|
||||
Obsolete versions: <a
|
||||
href="download/?f=lwip-0.5.2.tar.gz">lwip-0.5.2.tar.gz</a>
|
||||
<a
|
||||
href="download/?f=lwip-0.5.1.tar.gz">lwip-0.5.1.tar.gz</a>
|
||||
<a
|
||||
href="download/?f=lwip-0.5.0.tar.gz">lwip-0.5.0.tar.gz</a>
|
||||
<a
|
||||
href="download/?f=lwip-0.4.2.tar.gz">lwip-0.4.2.tar.gz</a>
|
||||
<a
|
||||
href="download/?f=lwip-0.4.1.tar.gz">lwip-0.4.1.tar.gz</a>
|
||||
<a
|
||||
href="download/?f=lwip-0.4.tar.gz">lwip-0.4.tar.gz</a>
|
||||
<a
|
||||
href="download/?f=lwip-0.3.1.tar.gz">lwip-0.3.1.tar.gz</a>
|
||||
<a
|
||||
href="download/?f=lwip-0.3.tar.gz">lwip-0.3.tar.gz</a>
|
||||
<a
|
||||
href="download/?f=lwip-0.2.tar.gz">lwip-0.2.tar.gz</a>
|
||||
</font>
|
||||
<br>
|
||||
</ul>
|
||||
|
||||
<h3>Development version</h3>
|
||||
<p align="justify">
|
||||
The latest development code from the CVS is also avaliable <a
|
||||
href="download/?f=lwip-cvs.tar.gz">here</a>. Note that this code may
|
||||
very well be unstable and might not even compile.
|
||||
</p>
|
||||
|
||||
<h3>Source code online</h3>
|
||||
<p align="justify">
|
||||
Joe MacDonald has put an HTML version of the latest lwIP source code
|
||||
online at <a
|
||||
href="http://www.deserted.net/lwIP/">http://www.deserted.net/lwIP/</a>.
|
||||
</p>
|
||||
|
||||
<h3>Ports</h3>
|
||||
<p align="justify">
|
||||
Florian Shulze has ported lwIP to DJGPP/MS-DOS and to Visual C++
|
||||
6.0/Win32. They can be downloaded <a
|
||||
href="http://homepages.fh-giessen.de/~hg10836/dev/djgpp/lwipdjgpptest-0.1.zip">here</a>
|
||||
(DJGPP/MS-DOS) and <a
|
||||
href="http://homepages.fh-giessen.de/~hg10836/crowproductions/dev/lwip-win32-msvc-0.1.zip">here</a>
|
||||
(Visual C++ 6.0/Win32).
|
||||
</p>
|
||||
|
||||
<h3>Add-ons/drivers/applications</h3>
|
||||
|
||||
<h4>DHCP client</h4>
|
||||
<p align="justify">
|
||||
Leon Woestenberg from Axon Digital Design B.V. has written a CS8900a
|
||||
network interface driver and is currently developing a DHCP client for
|
||||
lwIP. They can both be found <a
|
||||
href="http://www.esrac.ele.tue.nl/~leon/lwip/">here</a>. The plan is
|
||||
to eventually integrate Leon's DHCP client in the main lwIP
|
||||
distribution.
|
||||
</p>
|
||||
|
||||
<h4>IGMPv2 implementation</h4>
|
||||
<p align="justify">
|
||||
Steve Reynolds of Citel Technologies Ltd. has donated his IGMPv2
|
||||
implementation for lwIP to the community. It is avaliable for download
|
||||
<a href="download/igmpfiles.zip">here</a> (note that the copyright and
|
||||
license differs slightly from lwIP - read the license in the igmp.c
|
||||
file). The plan is to integrate his code into the main lwIP
|
||||
distribution.
|
||||
</p>
|
||||
|
||||
<h4>Alternative BSD socket layer</h4>
|
||||
<p align="justify">
|
||||
Paul Sheer has incorporated lwIP into his PaulOS system and has
|
||||
written an alternative BSD socket layer. It is avaliable for download
|
||||
<a href="download/bsdsocket.c">here</a>. It is copyright Paul Sheer
|
||||
and licensed under the <a
|
||||
href="http://www.gnu.org/licenses/gpl.html">GNU GPL</a>.
|
||||
</p>
|
||||
|
||||
<p align="right">
|
||||
<font size="-1"><i>
|
||||
$Date: 2002/10/19 13:00:06 $
|
||||
</i></font>
|
||||
</p>
|
||||
|
||||
</td>
|
||||
<td width="50">
|
||||
|
||||
</td>
|
||||
</tr></table>
|
||||
|
||||
<table width="640" border="0" cellpadding="0"
|
||||
cellspacing="0">
|
||||
<tr><td align="center">
|
||||
|
||||
<hr>
|
||||
|
||||
|
||||
|
||||
|
||||
<a href="index.html">Introduction</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="news.html">News</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="documentation.html">Documentation</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="mailinglist.html">Mailing list</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="changelog.html">Changelog</a>
|
||||
|
||||
|
|
||||
|
||||
[Download]
|
||||
|
||||
|
||||
|
|
||||
|
||||
<a href="links.html">Links</a>
|
||||
|
||||
|
||||
|
||||
<hr>
|
||||
|
||||
</td></tr><tr>
|
||||
<td>
|
||||
<div align="right">
|
||||
<a href="http://www.sics.se/~adam/">Adam Dunkels</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
44
proj/unixsim/apps/fs/index.html
Normal file
44
proj/unixsim/apps/fs/index.html
Normal file
@@ -0,0 +1,44 @@
|
||||
<html>
|
||||
<head><title>lwIP - A Lightweight TCP/IP Stack</title></head>
|
||||
<body bgcolor="white" text="black">
|
||||
|
||||
<table width="100%">
|
||||
<tr valign="top"><td width="80">
|
||||
<a href="http://www.sics.se/"><img src="img/sics.gif"
|
||||
border="0" alt="SICS logo" title="SICS logo"></a>
|
||||
</td><td width="500">
|
||||
<h1>lwIP - A Lightweight TCP/IP Stack</h1>
|
||||
<p>
|
||||
The web page you are watching was served by a simple web
|
||||
server running on top of the lightweight TCP/IP stack <a
|
||||
href="http://www.sics.se/~adam/lwip/">lwIP</a>.
|
||||
</p>
|
||||
<p>
|
||||
lwIP is an open source implementation of the TCP/IP
|
||||
protocol suite that was originally written by Adam Dunkels
|
||||
of the Swedish Institute of Computer Science but now is
|
||||
being actively developed by a team of developers
|
||||
distributed world-wide. Since it's release, lwIP has
|
||||
spurred a lot of interest and has been ported to several
|
||||
platforms and operating systems. lwIP can be used either
|
||||
with or without an underlying OS.
|
||||
</p>
|
||||
<p>
|
||||
The focus of the lwIP TCP/IP implementation is to reduce
|
||||
the RAM usage while still having a full scale TCP. This
|
||||
makes lwIP suitable for use in embedded systems with tens
|
||||
of kilobytes of free RAM and room for around 40 kilobytes
|
||||
of code ROM.
|
||||
</p>
|
||||
<p>
|
||||
More information about lwIP can be found at the lwIP
|
||||
homepage at <a
|
||||
href="http://www.sics.se/~adam/lwip/">http://www.sics.se/~adam/lwip/</a>.
|
||||
</p>
|
||||
</td><td>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,169 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<html>
|
||||
<head><title>lwIP - A Lightweight TCP/IP Stack - lwIP source code licence</title></head>
|
||||
|
||||
|
||||
<body bgcolor="white">
|
||||
|
||||
<table width="640" border="0" cellpadding="0"
|
||||
cellspacing="0">
|
||||
<tr><td>
|
||||
<center><h1>lwIP - A Lightweight TCP/IP Stack</h1></center>
|
||||
</td></tr></table>
|
||||
|
||||
|
||||
<table width="640" border="0" cellpadding="0"
|
||||
cellspacing="0">
|
||||
<tr><td align="center">
|
||||
<hr>
|
||||
|
||||
|
||||
|
||||
|
||||
<a href="index.html">Introduction</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="news.html">News</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="documentation.html">Documentation</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="mailinglist.html">Mailing list</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="changelog.html">Changelog</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="download.html">Download</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="links.html">Links</a>
|
||||
|
||||
|
||||
|
||||
<hr>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td><center><h2>lwIP source code licence</h2></center>
|
||||
</td></tr></table>
|
||||
|
||||
<table width="640" border="0" cellpadding="0"
|
||||
cellspacing="0"><tr>
|
||||
<td width="50">
|
||||
|
||||
</td>
|
||||
<td bgcolor="white" width="540">
|
||||
|
||||
Copyright (c) 2001, Swedish Institute of Computer Science.
|
||||
All rights reserved.<br>
|
||||
<br>
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:<br>
|
||||
<ol>
|
||||
<li> Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.<br>
|
||||
<br>
|
||||
<li> 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.<br>
|
||||
<br>
|
||||
<li> 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. <br>
|
||||
</ol>
|
||||
<br>
|
||||
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. <br>
|
||||
|
||||
|
||||
|
||||
<p align="right">
|
||||
<font size="-1"><i>
|
||||
$Date: 2002/10/19 13:00:01 $
|
||||
</i></font>
|
||||
</p>
|
||||
|
||||
</td>
|
||||
<td width="50">
|
||||
|
||||
</td>
|
||||
</tr></table>
|
||||
|
||||
<table width="640" border="0" cellpadding="0"
|
||||
cellspacing="0">
|
||||
<tr><td align="center">
|
||||
|
||||
<hr>
|
||||
|
||||
|
||||
|
||||
|
||||
<a href="index.html">Introduction</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="news.html">News</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="documentation.html">Documentation</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="mailinglist.html">Mailing list</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="changelog.html">Changelog</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="download.html">Download</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="links.html">Links</a>
|
||||
|
||||
|
||||
|
||||
<hr>
|
||||
|
||||
</td></tr><tr>
|
||||
<td>
|
||||
<div align="right">
|
||||
<a href="http://www.sics.se/~adam/">Adam Dunkels</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,266 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<html>
|
||||
<head><title>lwIP - A Lightweight TCP/IP Stack - Links</title></head>
|
||||
|
||||
|
||||
<body bgcolor="white">
|
||||
|
||||
<table width="640" border="0" cellpadding="0"
|
||||
cellspacing="0">
|
||||
<tr><td>
|
||||
<center><h1>lwIP - A Lightweight TCP/IP Stack</h1></center>
|
||||
</td></tr></table>
|
||||
|
||||
|
||||
<table width="640" border="0" cellpadding="0"
|
||||
cellspacing="0">
|
||||
<tr><td align="center">
|
||||
<hr>
|
||||
|
||||
|
||||
|
||||
|
||||
<a href="index.html">Introduction</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="news.html">News</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="documentation.html">Documentation</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="mailinglist.html">Mailing list</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="changelog.html">Changelog</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="download.html">Download</a>
|
||||
|
||||
|
|
||||
|
||||
[Links]
|
||||
|
||||
|
||||
|
||||
|
||||
<hr>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td><center><h2>Links</h2></center>
|
||||
</td></tr></table>
|
||||
|
||||
<table width="640" border="0" cellpadding="0"
|
||||
cellspacing="0"><tr>
|
||||
<td width="50">
|
||||
|
||||
</td>
|
||||
<td bgcolor="white" width="540">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
lwIP pages:
|
||||
<ul>
|
||||
<li><a href="http://www.esrac.ele.tue.nl/~leon/lwip/">Leon Woestenberg's lwIP page</a>
|
||||
</ul>
|
||||
|
||||
Companies using lwIP in their products:
|
||||
<ul>
|
||||
<li>UK based <a href="http://www.tangentdevices.co.uk/">Tangent Devices Ltd</a> are incorporating lwIP in their film
|
||||
and video post-production equipment.
|
||||
<li><a href="http://www.axon.tv">Axon Digital Design BV</a> in The
|
||||
Netherlands is merging lwIP with their current IP stack for use in the
|
||||
Synapse modular broadcasting system.
|
||||
</ul>
|
||||
|
||||
Projects using lwIP:
|
||||
<ul>
|
||||
<li><a href="http://www.cdt.luth.se/projects/arena/">The ARENA Project</a> - Hockey players equipped with pulse and breathing sensors running lwIP.<br>
|
||||
<li><a href="http://bart.sm.luth.se/eis2001/">The Embedded Internet Systems 2001 Student Project</a> - Flow meter and belt tension sensors
|
||||
running lwIP.<br>
|
||||
<li><a href="http://dcdev.allusion.net/">KOS</a> - The KOS operating system for
|
||||
Sega Dreamcast uses lwIP.<br>
|
||||
</ul>
|
||||
|
||||
Other small TCP/IP implementations:
|
||||
<ul>
|
||||
<li><a href="http://dunkels.com/adam/uip/">uIP</a> - A very small TCP/IP
|
||||
implementation, suitable for systems with hundreds of bytes free RAM
|
||||
and a few kilobytes of free code space.<br>
|
||||
<li><a href="http://ucip.sourceforge.net/">uC/IP</a> - uC/IP is a BSD-based
|
||||
TCP/IP protocol stack for microcontrollers.<br>
|
||||
<li><a href="http://liquorice.sourceforge.net">Liquorice</a> - Liquorice
|
||||
includes a TCP/IP stack.<br>
|
||||
<li><a href="http://www.nenie.org/cpcip/">CPC/IP</a> - A TCP/IP stack for
|
||||
Amstrad CPCs.<br>
|
||||
<li><a href="http://lng.sourceforge.net/">LUnix</a> - LUnix contains a small
|
||||
TCP/IP stack.<br>
|
||||
<li><a href="http://www.sweetcherrie.com/jolz64/jos/">JOS</a> - JOS includes a
|
||||
TCP/IP implementation.<br>
|
||||
<li><a href="http://www.csonline.net/bpaddock/tinytcp/default.htm">TinyTCP</a> - A very slim
|
||||
TCP, IP, and FTP implementation.<br>
|
||||
<li><a href="http://kyllikki.fluff.org/hardware/wwwpic2/">WWWpic2</a> - Small
|
||||
HTTP/TCP/IP implementation for a PIC.<br>
|
||||
<li><a href="http://www.rmbeales.fsnet.co.uk/files/html/picserver/picservd.htm">PIC Web Server</a> - Small HTTP/TCP/IP/SLIP PIC implementation.<br>
|
||||
</ul>
|
||||
|
||||
Very small web servers:
|
||||
<ul>
|
||||
<li><a href="http://world.std.com/~fwhite/ace/">webACE</a> - World's Smallest
|
||||
Web Server.<br>
|
||||
<li><a href="http://www-ccs.cs.umass.edu/~shri/iPic.html">iPIC</a> - A Match
|
||||
Head Sized Web Server.<br>
|
||||
</ul>
|
||||
|
||||
Related RFCs:
|
||||
<ul>
|
||||
<li>J. Postel, <a
|
||||
href="ftp://ftp.ietf.org/rfc/rfc791.txt">Internet Protocol</a>, RFC791, September 1981.
|
||||
<li>J. Postel, <a
|
||||
href="ftp://ftp.ietf.org/rfc/rfc792.txt">Internet Control Message Protocol</a>, RFC792, September 1981.
|
||||
<li>J. Postel, <a
|
||||
href="ftp://ftp.ietf.org/rfc/rfc768.txt">User Datagram Protocol</a>, RFC768, August 1980.
|
||||
<li>J. Postel, <a
|
||||
href="ftp://ftp.ietf.org/rfc/rfc793.txt">Transmission Control Protocol</a>, RFC793, September 1981.
|
||||
<li>D. D. Clark, <a
|
||||
href="ftp://ftp.ietf.org/rfc/rfc813.txt">Window and Acknowledgement Strategy in TCP</a>, RFC813, July 1982.
|
||||
<li>D. D. Clark, <a
|
||||
href="ftp://ftp.ietf.org/rfc/rfc817.txt">Modularity and Efficiency in Protocol Implementation</a>, RFC817, July 1982.
|
||||
<li>R. Braden, <a
|
||||
href="ftp://ftp.ietf.org/rfc/rfc1122.txt">Requirements for Internet Hosts -- Communication Layers</a>, RFC1122, October 1989.
|
||||
<li>T. Mallory and A. Kullberg, <a
|
||||
href="ftp://ftp.ietf.org/rfc/rfc1141.txt">Incremental Updating of the Internet Checksum</a>, RFC1141, January 1990.
|
||||
<li>A. Rijsinghani, <a
|
||||
href="ftp://ftp.ietf.org/rfc/rfc1624.txt">Computation of the Internet Checksum via Incremental Update</a>, RFC1624, May 1994.
|
||||
<li>R. Braden, <a
|
||||
href="ftp://ftp.ietf.org/rfc/rfc1337.txt">TIME-WAIT Assasination Hazards in TCP</a>, RFC1337, May 1992.
|
||||
<li>B. Carpenter, <a
|
||||
href="ftp://ftp.ietf.org/rfc/rfc1958.txt">Architectural Principles of the Internet</a>, RFC1958, June 1996.
|
||||
<li>M. Allman, V. Paxson and W. Stevens, <a
|
||||
href="ftp://ftp.ietf.org/rfc/rfc2581.txt">TCP Congestion Control</a>, RFC2581, April 1999.
|
||||
<li>S. Parker and C. Schmechel, <a
|
||||
href="ftp://ftp.ietf.org/rfc/rfc2398.txt">Some Testing Tools for TCP Implementors</a>, RFC2398, August 1998.
|
||||
</ul>
|
||||
|
||||
Related publications:
|
||||
<ul>
|
||||
<li>V. Jacobson. Congestion avoidance and control. In <i>Proceedings of
|
||||
the SIGCOMM '88 Conference</i>, Stanford, California, August 1988.
|
||||
<li>V. Jacobson. 4.3BSD TCP header prediction. <i>ACM Computer
|
||||
Communications Review</i>, 20(2), April 1990.
|
||||
<li>P. Karn and C. Partridge. Improving round-trip time estimates
|
||||
in reliablie transport protocols. In <i>Proceedings of the SIGCOMM '87
|
||||
Conference</i>, Stowe, Vermont, August 1987.
|
||||
<li>J. Kay and J. Pasquale. Profiling and Reducing Processing
|
||||
Overheads in TCP/IP. <i>IEEE/ACM Transactions of Networking</i>, 4(6), December 1996.
|
||||
<li>L. Larzon, M. Degermark, and S. Pink. UDP Lite for
|
||||
real-time multimedia applications. In <i>Proceedings of the IEEE
|
||||
International Conference of Communications</i>, Vancouver, British
|
||||
Columbia, Canada, June 1999.
|
||||
<li>P. E. McKenney and K. F. Dove. Efcient demultiplexing of
|
||||
incoming TCP packets. In <i>Proceedings of the SIGCOMM '92 Conference</i>, Baltimore, Maryland, August 1992.
|
||||
<li>C. Partridge and S. Pink. A faster UDP. <i>IEEE/ACM Transactions
|
||||
in Networking</i>, 1(4), August 1993.
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<p align="right">
|
||||
<font size="-1"><i>
|
||||
$Date: 2002/10/19 13:00:02 $
|
||||
</i></font>
|
||||
</p>
|
||||
|
||||
|
||||
</td>
|
||||
<td width="50">
|
||||
|
||||
</td>
|
||||
</tr></table>
|
||||
|
||||
<table width="640" border="0" cellpadding="0"
|
||||
cellspacing="0">
|
||||
<tr><td align="center">
|
||||
|
||||
<hr>
|
||||
|
||||
|
||||
|
||||
|
||||
<a href="index.html">Introduction</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="news.html">News</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="documentation.html">Documentation</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="mailinglist.html">Mailing list</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="changelog.html">Changelog</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="download.html">Download</a>
|
||||
|
||||
|
|
||||
|
||||
[Links]
|
||||
|
||||
|
||||
|
||||
|
||||
<hr>
|
||||
|
||||
</td></tr><tr>
|
||||
<td>
|
||||
<div align="right">
|
||||
<a href="http://www.sics.se/~adam/">Adam Dunkels</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,187 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<html>
|
||||
<head><title>lwIP - A Lightweight TCP/IP Stack - Mailing list</title></head>
|
||||
|
||||
|
||||
<body bgcolor="white">
|
||||
|
||||
<table width="640" border="0" cellpadding="0"
|
||||
cellspacing="0">
|
||||
<tr><td>
|
||||
<center><h1>lwIP - A Lightweight TCP/IP Stack</h1></center>
|
||||
</td></tr></table>
|
||||
|
||||
|
||||
<table width="640" border="0" cellpadding="0"
|
||||
cellspacing="0">
|
||||
<tr><td align="center">
|
||||
<hr>
|
||||
|
||||
|
||||
|
||||
|
||||
<a href="index.html">Introduction</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="news.html">News</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="documentation.html">Documentation</a>
|
||||
|
||||
|
|
||||
|
||||
[Mailing list]
|
||||
|
||||
|
||||
|
|
||||
|
||||
<a href="changelog.html">Changelog</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="download.html">Download</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="links.html">Links</a>
|
||||
|
||||
|
||||
|
||||
<hr>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td><center><h2>Mailing list</h2></center>
|
||||
</td></tr></table>
|
||||
|
||||
<table width="640" border="0" cellpadding="0"
|
||||
cellspacing="0"><tr>
|
||||
<td width="50">
|
||||
|
||||
</td>
|
||||
<td bgcolor="white" width="540">
|
||||
|
||||
|
||||
<p align="justify">
|
||||
The lwIP mailing list is the place to discuss lwIP. All topics related
|
||||
to lwIP, such as porting or using lwIP, writing device drivers or
|
||||
application programs for lwIP can be discussed here.
|
||||
</p>
|
||||
|
||||
<h3>Archives</h3>
|
||||
<p align="justify">
|
||||
Archives can be found <a href="maillist/">here</a>.
|
||||
</p>
|
||||
|
||||
<h3>Subscribe</h3>
|
||||
<p align="justify">
|
||||
To subscribe, send a mail to <a
|
||||
href="mailto:majordomo@sics.se">majordomo@sics.se</a> with the message
|
||||
<pre>
|
||||
subscribe lwip
|
||||
|
||||
</pre>
|
||||
in the message body. The subject should be kept blank.
|
||||
</p>
|
||||
<p align="justify">
|
||||
In a few minutes, you should receive a welcome message and some
|
||||
information regarding the subscription, including instructions for
|
||||
unsubscribing. Save those messages for future reference.
|
||||
</p>
|
||||
|
||||
<p align="justify">
|
||||
You are now an lwIP mailing list subscriber!
|
||||
</p>
|
||||
|
||||
<h3>Post</h3>
|
||||
<p align="justify">
|
||||
Posting to the lwIP mailing list is a simple as sending a mail to the
|
||||
address <a href="mailto:lwip@sics.se">lwip@sics.se</a>.
|
||||
</p>
|
||||
|
||||
<h3>Unsubscribe</h3>
|
||||
<p align="justify">
|
||||
To subscribe, send a mail to <a
|
||||
href="mailto:majordomo@sics.se">majordomo@sics.se</a> with the message
|
||||
<pre>
|
||||
unsubscribe lwip
|
||||
|
||||
</pre>
|
||||
in the message body. The subject should be kept blank.
|
||||
</p>
|
||||
|
||||
<p align="right">
|
||||
<font size="-1"><i>
|
||||
$Date: 2002/10/19 13:00:02 $
|
||||
</i></font>
|
||||
</p>
|
||||
|
||||
|
||||
</td>
|
||||
<td width="50">
|
||||
|
||||
</td>
|
||||
</tr></table>
|
||||
|
||||
<table width="640" border="0" cellpadding="0"
|
||||
cellspacing="0">
|
||||
<tr><td align="center">
|
||||
|
||||
<hr>
|
||||
|
||||
|
||||
|
||||
|
||||
<a href="index.html">Introduction</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="news.html">News</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="documentation.html">Documentation</a>
|
||||
|
||||
|
|
||||
|
||||
[Mailing list]
|
||||
|
||||
|
||||
|
|
||||
|
||||
<a href="changelog.html">Changelog</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="download.html">Download</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="links.html">Links</a>
|
||||
|
||||
|
||||
|
||||
<hr>
|
||||
|
||||
</td></tr><tr>
|
||||
<td>
|
||||
<div align="right">
|
||||
<a href="http://www.sics.se/~adam/">Adam Dunkels</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,225 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<html>
|
||||
<head><title>lwIP - A Lightweight TCP/IP Stack - OS vs non-OS</title></head>
|
||||
|
||||
|
||||
<body bgcolor="white">
|
||||
|
||||
<table width="640" border="0" cellpadding="0"
|
||||
cellspacing="0">
|
||||
<tr><td>
|
||||
<center><h1>lwIP - A Lightweight TCP/IP Stack</h1></center>
|
||||
</td></tr></table>
|
||||
|
||||
|
||||
<table width="640" border="0" cellpadding="0"
|
||||
cellspacing="0">
|
||||
<tr><td align="center">
|
||||
<hr>
|
||||
|
||||
|
||||
|
||||
|
||||
<a href="index.html">Introduction</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="news.html">News</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="documentation.html">Documentation</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="mailinglist.html">Mailing list</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="changelog.html">Changelog</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="download.html">Download</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="links.html">Links</a>
|
||||
|
||||
|
||||
|
||||
<hr>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td><center><h2>OS vs non-OS</h2></center>
|
||||
</td></tr></table>
|
||||
|
||||
<table width="640" border="0" cellpadding="0"
|
||||
cellspacing="0"><tr>
|
||||
<td width="50">
|
||||
|
||||
</td>
|
||||
<td bgcolor="white" width="540">
|
||||
|
||||
<h2>Using lwIP with or without an operating system</h2>
|
||||
|
||||
<p align="justify">
|
||||
There has been a few questions about how lwIP can be used in a
|
||||
standalone environment (i.e., an environment without a multi-threaded
|
||||
operating system) lately. The purpose of this document is to describe
|
||||
how lwIP is designed to be used with and without a multi-threaded
|
||||
operating system.
|
||||
</p>
|
||||
|
||||
<center><img src="os.png"></center>
|
||||
|
||||
<h3>The lwIP single-threaded core</h3>
|
||||
<p align="justify">
|
||||
The core of lwIP consists of the actual implementations of the IP,
|
||||
ICMP, UDP, and TCP protocols, as well as the support functions such as
|
||||
buffer and memory management. The core components are the only ones
|
||||
that are needed when lwIP is to be run in a single-threaded (non-OS)
|
||||
environment.
|
||||
</p>
|
||||
<p align="justify">
|
||||
The core components can be viewed as a software library which has the
|
||||
following interface:
|
||||
</p>
|
||||
<ul>
|
||||
<li><tt>ip_input(pbuf, netif)</tt>: Takes an IP packet and the incoming network
|
||||
interface as arguments and does the TCP/IP processing for the packet.
|
||||
<li><tt>tcp_tmr()</tt>: Should be called every 100 ms. Does all TCP
|
||||
timer processing such as doing retransmissions.
|
||||
</ul>
|
||||
<p align="justify">
|
||||
Because none of the core functions ever needs to block when run in a
|
||||
single-threaded environment, the <tt>sys_arch</tt> (the operating
|
||||
system abstraction layer) does not need to implement locking
|
||||
semaphores or mailboxes. In future versions of lwIP, the dependancy of
|
||||
the <tt>sys_arch</tt> will be removed in the single-threaded case.
|
||||
</p>
|
||||
<p align="justify">
|
||||
A simple main loop for a single-threaded system might look
|
||||
like this:
|
||||
</p>
|
||||
<pre>
|
||||
while(1) {
|
||||
if(poll_driver(netif) == PACKET_READY) {
|
||||
pbuf = get_packet(netif);
|
||||
ip_input(pbuf, netif);
|
||||
}
|
||||
|
||||
if(clock() - last_time == 100 * CLOCK_MS) {
|
||||
tcp_tmr();
|
||||
last_time = clock();
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
|
||||
<h3>lwIP in a multi-threaded system</h3>
|
||||
<p align="justify">
|
||||
lwIP is designed to be able to be run in a multi-threaded system with
|
||||
applications running in concurrent threads. The model used in this
|
||||
case is that all TCP/IP processing is done in a single thread. The
|
||||
application thread communicate with the TCP/IP thread using the
|
||||
sequential API.
|
||||
</p>
|
||||
|
||||
<center><img src="threads.png"></center>
|
||||
|
||||
<p align="justify">
|
||||
The inter-thread communication is implemented in the two files
|
||||
<tt>api_lib.c</tt> and <tt>api_msg.c</tt>. The former contains the
|
||||
functions used by the application programs and the latter implements
|
||||
the TCP/IP stack interface. A third file, <tt>tcpip.c</tt>, handles
|
||||
incoming packets and timer events as described in the previous
|
||||
section.
|
||||
</p>
|
||||
|
||||
<p align="justify">
|
||||
When run in a multi-threaded environment, incoming packets are handled
|
||||
by the function <tt>tcpip_input()</tt>, which takes the same arguments
|
||||
as the <tt>ip_input()</tt> function. The difference between the two
|
||||
functions is that the <tt>tcpip_input()</tt> function does not process
|
||||
the incoming packet immediately. It merely puts the packet on a queue
|
||||
which later is drained by the TCP/IP thread.
|
||||
</p>
|
||||
|
||||
<p align="justify">
|
||||
When being run in a multi-threaded system, timer events are taken care
|
||||
of internally in <tt>tcpip.c</tt>.
|
||||
</p>
|
||||
|
||||
<p align="right">
|
||||
<font size="-1"><i>
|
||||
$Date: 2002/10/19 13:00:03 $
|
||||
</i></font>
|
||||
</p>
|
||||
|
||||
|
||||
</td>
|
||||
<td width="50">
|
||||
|
||||
</td>
|
||||
</tr></table>
|
||||
|
||||
<table width="640" border="0" cellpadding="0"
|
||||
cellspacing="0">
|
||||
<tr><td align="center">
|
||||
|
||||
<hr>
|
||||
|
||||
|
||||
|
||||
|
||||
<a href="index.html">Introduction</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="news.html">News</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="documentation.html">Documentation</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="mailinglist.html">Mailing list</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="changelog.html">Changelog</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="download.html">Download</a>
|
||||
|
||||
|
|
||||
|
||||
<a href="links.html">Links</a>
|
||||
|
||||
|
||||
|
||||
<hr>
|
||||
|
||||
</td></tr><tr>
|
||||
<td>
|
||||
<div align="right">
|
||||
<a href="http://www.sics.se/~adam/">Adam Dunkels</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.9 KiB |
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
@@ -34,15 +34,15 @@
|
||||
|
||||
struct fsdata_file {
|
||||
const struct fsdata_file *next;
|
||||
const char *name;
|
||||
const char *data;
|
||||
const unsigned char *name;
|
||||
const unsigned char *data;
|
||||
const int len;
|
||||
};
|
||||
|
||||
struct fsdata_file_noconst {
|
||||
struct fsdata_file *next;
|
||||
char *name;
|
||||
char *data;
|
||||
unsigned char *name;
|
||||
unsigned char *data;
|
||||
int len;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -53,7 +53,7 @@ while($file = <FILES>) {
|
||||
$fvar = $file;
|
||||
$fvar =~ s-/-_-g;
|
||||
$fvar =~ s-\.-_-g;
|
||||
print(OUTPUT "static const char data".$fvar."[] = {\n");
|
||||
print(OUTPUT "static const unsigned char data".$fvar."[] = {\n");
|
||||
print(OUTPUT "\t/* $file */\n\t");
|
||||
for($j = 0; $j < length($file); $j++) {
|
||||
printf(OUTPUT "%#02x, ", unpack("C", substr($file, $j, 1)));
|
||||
@@ -61,7 +61,7 @@ while($file = <FILES>) {
|
||||
printf(OUTPUT "0,\n");
|
||||
|
||||
|
||||
$i = 0;
|
||||
$i = 0;
|
||||
while(read(FILE, $data, 1)) {
|
||||
if($i == 0) {
|
||||
print(OUTPUT "\t");
|
||||
@@ -94,4 +94,4 @@ for($i = 0; $i < @fvars; $i++) {
|
||||
}
|
||||
|
||||
print(OUTPUT "#define FS_ROOT file$fvars[$i - 1]\n\n");
|
||||
print(OUTPUT "#define FS_NUMFILES $i");
|
||||
print(OUTPUT "#define FS_NUMFILES $i\n");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
@@ -48,8 +48,27 @@ struct command {
|
||||
char *args[10];
|
||||
};
|
||||
|
||||
/* Following #undefs are here to keep compiler from issuing warnings
|
||||
about them being double defined. (They are defined in lwip/inet.h
|
||||
as well as the Unix #includes below.) */
|
||||
#undef htonl
|
||||
#undef ntohl
|
||||
#undef htons
|
||||
#undef ntohs
|
||||
#undef HTONL
|
||||
#undef NTOHL
|
||||
#undef HTONS
|
||||
#undef NTOHS
|
||||
#undef IP_HDRINCL
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
|
||||
#define ESUCCESS 0
|
||||
#define ESYNTAX -1
|
||||
@@ -225,7 +244,7 @@ com_open(struct command *com)
|
||||
int i;
|
||||
err_t err;
|
||||
|
||||
if(inet_aton(com->args[0], &ipaddr) == -1) {
|
||||
if(inet_aton(com->args[0], (struct in_addr *)&ipaddr) == -1) {
|
||||
sendstr(strerror(errno), com->conn);
|
||||
return ESYNTAX;
|
||||
}
|
||||
@@ -266,8 +285,8 @@ com_open(struct command *com)
|
||||
}
|
||||
|
||||
sendstr("Opened connection, connection identifier is ", com->conn);
|
||||
sprintf(buffer, "%d\n", i);
|
||||
netconn_write(com->conn, buffer, strlen(buffer), NETCONN_COPY);
|
||||
sprintf((char *)buffer, "%d\n", i);
|
||||
netconn_write(com->conn, buffer, strlen((const char *)buffer), NETCONN_COPY);
|
||||
|
||||
return ESUCCESS;
|
||||
}
|
||||
@@ -328,8 +347,8 @@ com_lstn(struct command *com)
|
||||
}
|
||||
|
||||
sendstr("Opened connection, connection identifier is ", com->conn);
|
||||
sprintf(buffer, "%d\n", i);
|
||||
netconn_write(com->conn, buffer, strlen(buffer), NETCONN_COPY);
|
||||
sprintf((char *)buffer, "%d\n", i);
|
||||
netconn_write(com->conn, buffer, strlen((const char *)buffer), NETCONN_COPY);
|
||||
|
||||
return ESUCCESS;
|
||||
}
|
||||
@@ -408,8 +427,8 @@ com_acpt(struct command *com)
|
||||
}
|
||||
|
||||
sendstr("Accepted connection, connection identifier for new connection is ", com->conn);
|
||||
sprintf(buffer, "%d\n", j);
|
||||
netconn_write(com->conn, buffer, strlen(buffer), NETCONN_COPY);
|
||||
sprintf((char *)buffer, "%d\n", j);
|
||||
netconn_write(com->conn, buffer, strlen((const char *)buffer), NETCONN_COPY);
|
||||
|
||||
return ESUCCESS;
|
||||
}
|
||||
@@ -422,7 +441,7 @@ com_stat(struct command *com)
|
||||
u16_t len;
|
||||
|
||||
for(i = 0; i < sizeof(struct stats_) / 2; i++) {
|
||||
len = sprintf(buf, "%d", ((u16_t *)&stats)[i]);
|
||||
len = sprintf(buf, "%d", ((u16_t *)&lwip_stats)[i]);
|
||||
sendstr(stat_msgs[i], com->conn);
|
||||
netconn_write(com->conn, buf, len, NETCONN_COPY);
|
||||
sendstr("\n", com->conn);
|
||||
@@ -526,7 +545,7 @@ com_udpc(struct command *com)
|
||||
err_t err;
|
||||
|
||||
lport = strtol(com->args[0], NULL, 10);
|
||||
if(inet_aton(com->args[1], &ipaddr) == -1) {
|
||||
if(inet_aton(com->args[1], (struct in_addr *)&ipaddr) == -1) {
|
||||
sendstr(strerror(errno), com->conn);
|
||||
return ESYNTAX;
|
||||
}
|
||||
@@ -583,8 +602,8 @@ com_udpc(struct command *com)
|
||||
}
|
||||
|
||||
sendstr("Connection set up, connection identifier is ", com->conn);
|
||||
sprintf(buffer, "%d\n", i);
|
||||
netconn_write(com->conn, buffer, strlen(buffer), NETCONN_COPY);
|
||||
sprintf((char *)buffer, "%d\n", i);
|
||||
netconn_write(com->conn, buffer, strlen((const char *)buffer), NETCONN_COPY);
|
||||
|
||||
return ESUCCESS;
|
||||
}
|
||||
@@ -598,7 +617,7 @@ com_udpl(struct command *com)
|
||||
err_t err;
|
||||
|
||||
lport = strtol(com->args[0], NULL, 10);
|
||||
if(inet_aton(com->args[1], &ipaddr) == -1) {
|
||||
if(inet_aton(com->args[1], (struct in_addr *)&ipaddr) == -1) {
|
||||
sendstr(strerror(errno), com->conn);
|
||||
return ESYNTAX;
|
||||
}
|
||||
@@ -655,8 +674,8 @@ com_udpl(struct command *com)
|
||||
}
|
||||
|
||||
sendstr("Connection set up, connection identifier is ", com->conn);
|
||||
sprintf(buffer, "%d\n", i);
|
||||
netconn_write(com->conn, buffer, strlen(buffer), NETCONN_COPY);
|
||||
sprintf((char *)buffer, "%d\n", i);
|
||||
netconn_write(com->conn, buffer, strlen((const char *)buffer), NETCONN_COPY);
|
||||
|
||||
return ESUCCESS;
|
||||
}
|
||||
@@ -670,7 +689,7 @@ com_udpn(struct command *com)
|
||||
err_t err;
|
||||
|
||||
lport = strtol(com->args[0], NULL, 10);
|
||||
if(inet_aton(com->args[1], &ipaddr) == -1) {
|
||||
if(inet_aton(com->args[1], (struct in_addr *)&ipaddr) == -1) {
|
||||
sendstr(strerror(errno), com->conn);
|
||||
return ESYNTAX;
|
||||
}
|
||||
@@ -727,8 +746,8 @@ com_udpn(struct command *com)
|
||||
}
|
||||
|
||||
sendstr("Connection set up, connection identifier is ", com->conn);
|
||||
sprintf(buffer, "%d\n", i);
|
||||
netconn_write(com->conn, buffer, strlen(buffer), NETCONN_COPY);
|
||||
sprintf((char *)buffer, "%d\n", i);
|
||||
netconn_write(com->conn, buffer, strlen((const char *)buffer), NETCONN_COPY);
|
||||
|
||||
return ESUCCESS;
|
||||
}
|
||||
@@ -743,7 +762,7 @@ com_udpb(struct command *com)
|
||||
struct ip_addr bcaddr;
|
||||
|
||||
lport = strtol(com->args[0], NULL, 10);
|
||||
if(inet_aton(com->args[1], &ipaddr) == -1) {
|
||||
if(inet_aton(com->args[1], (struct in_addr *)&ipaddr) == -1) {
|
||||
sendstr(strerror(errno), com->conn);
|
||||
return ESYNTAX;
|
||||
}
|
||||
@@ -799,8 +818,8 @@ com_udpb(struct command *com)
|
||||
}
|
||||
|
||||
sendstr("Connection set up, connection identifier is ", com->conn);
|
||||
sprintf(buffer, "%d\n", i);
|
||||
netconn_write(com->conn, buffer, strlen(buffer), NETCONN_COPY);
|
||||
sprintf((char *)buffer, "%d\n", i);
|
||||
netconn_write(com->conn, buffer, strlen((const char *)buffer), NETCONN_COPY);
|
||||
|
||||
return ESUCCESS;
|
||||
}
|
||||
@@ -862,46 +881,46 @@ parse_command(struct command *com, u32_t len)
|
||||
u16_t i;
|
||||
u16_t bufp;
|
||||
|
||||
if(strncmp(buffer, "open", 4) == 0) {
|
||||
if(strncmp((const char *)buffer, "open", 4) == 0) {
|
||||
com->exec = com_open;
|
||||
com->nargs = 2;
|
||||
} else if(strncmp(buffer, "lstn", 4) == 0) {
|
||||
} else if(strncmp((const char *)buffer, "lstn", 4) == 0) {
|
||||
com->exec = com_lstn;
|
||||
com->nargs = 1;
|
||||
} else if(strncmp(buffer, "acpt", 4) == 0) {
|
||||
} else if(strncmp((const char *)buffer, "acpt", 4) == 0) {
|
||||
com->exec = com_acpt;
|
||||
com->nargs = 1;
|
||||
} else if(strncmp(buffer, "clos", 4) == 0) {
|
||||
} else if(strncmp((const char *)buffer, "clos", 4) == 0) {
|
||||
com->exec = com_clos;
|
||||
com->nargs = 1;
|
||||
} else if(strncmp(buffer, "stat", 4) == 0) {
|
||||
} else if(strncmp((const char *)buffer, "stat", 4) == 0) {
|
||||
com->exec = com_stat;
|
||||
com->nargs = 0;
|
||||
} else if(strncmp(buffer, "send", 4) == 0) {
|
||||
} else if(strncmp((const char *)buffer, "send", 4) == 0) {
|
||||
com->exec = com_send;
|
||||
com->nargs = 2;
|
||||
} else if(strncmp(buffer, "recv", 4) == 0) {
|
||||
} else if(strncmp((const char *)buffer, "recv", 4) == 0) {
|
||||
com->exec = com_recv;
|
||||
com->nargs = 1;
|
||||
} else if(strncmp(buffer, "udpc", 4) == 0) {
|
||||
} else if(strncmp((const char *)buffer, "udpc", 4) == 0) {
|
||||
com->exec = com_udpc;
|
||||
com->nargs = 3;
|
||||
} else if(strncmp(buffer, "udpb", 4) == 0) {
|
||||
} else if(strncmp((const char *)buffer, "udpb", 4) == 0) {
|
||||
com->exec = com_udpb;
|
||||
com->nargs = 2;
|
||||
} else if(strncmp(buffer, "udpl", 4) == 0) {
|
||||
} else if(strncmp((const char *)buffer, "udpl", 4) == 0) {
|
||||
com->exec = com_udpl;
|
||||
com->nargs = 3;
|
||||
} else if(strncmp(buffer, "udpn", 4) == 0) {
|
||||
} else if(strncmp((const char *)buffer, "udpn", 4) == 0) {
|
||||
com->exec = com_udpn;
|
||||
com->nargs = 3;
|
||||
} else if(strncmp(buffer, "usnd", 4) == 0) {
|
||||
} else if(strncmp((const char *)buffer, "usnd", 4) == 0) {
|
||||
com->exec = com_usnd;
|
||||
com->nargs = 2;
|
||||
} else if(strncmp(buffer, "help", 4) == 0) {
|
||||
} else if(strncmp((const char *)buffer, "help", 4) == 0) {
|
||||
com->exec = com_help;
|
||||
com->nargs = 0;
|
||||
} else if(strncmp(buffer, "quit", 4) == 0) {
|
||||
} else if(strncmp((const char *)buffer, "quit", 4) == 0) {
|
||||
printf("quit\n");
|
||||
return ECLOSED;
|
||||
} else {
|
||||
@@ -929,7 +948,7 @@ parse_command(struct command *com, u32_t len)
|
||||
if(bufp > len) {
|
||||
return ETOOFEW;
|
||||
}
|
||||
com->args[i] = &buffer[bufp];
|
||||
com->args[i] = (char *)&buffer[bufp];
|
||||
for(; bufp < len && buffer[bufp] != ' ' && buffer[bufp] != '\r' &&
|
||||
buffer[bufp] != '\n'; bufp++) {
|
||||
if(buffer[bufp] == '\\') {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
@@ -51,8 +51,9 @@ udpecho_thread(void *arg)
|
||||
addr = netbuf_fromaddr(buf);
|
||||
port = netbuf_fromport(buf);
|
||||
netconn_connect(conn, addr, port);
|
||||
netbuf_copy(buf, buffer, buf->p->tot_len);
|
||||
buffer[buf->p->tot_len] = '\0';
|
||||
netconn_send(conn, buf);
|
||||
netbuf_copy(buf, buffer, sizeof(buffer));
|
||||
printf("got %s\n", buffer);
|
||||
netbuf_delete(buf);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
@@ -31,7 +31,6 @@
|
||||
*/
|
||||
#ifndef __LWIPOPTS_H__
|
||||
#define __LWIPOPTS_H__
|
||||
|
||||
/* ---------- Memory options ---------- */
|
||||
/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
|
||||
lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
|
||||
@@ -62,7 +61,6 @@ a lot of data that needs to be copied, this should be set high. */
|
||||
timeouts. */
|
||||
#define MEMP_NUM_SYS_TIMEOUT 3
|
||||
|
||||
|
||||
/* The following four are used only with the sequential API and can be
|
||||
set to 0 if the application only will use the raw API. */
|
||||
/* MEMP_NUM_NETBUF: the number of struct netbufs. */
|
||||
@@ -85,7 +83,7 @@ a lot of data that needs to be copied, this should be set high. */
|
||||
|
||||
/* ---------- Pbuf options ---------- */
|
||||
/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
|
||||
#define PBUF_POOL_SIZE 6
|
||||
#define PBUF_POOL_SIZE 100
|
||||
|
||||
/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
|
||||
#define PBUF_POOL_BUFSIZE 128
|
||||
@@ -123,6 +121,17 @@ a lot of data that needs to be copied, this should be set high. */
|
||||
|
||||
/* ---------- ARP options ---------- */
|
||||
#define ARP_TABLE_SIZE 10
|
||||
#define ARP_QUEUEING 1
|
||||
/**
|
||||
* - If enabled, cache entries are generated for every kind of ARP traffic or
|
||||
* broadcast IP traffic. This enhances behaviour for sending to a dynamic set
|
||||
* of hosts, for example if acting as a gateway.
|
||||
* - If disabled, cache entries are generated only for IP destination addresses
|
||||
* in use by lwIP or applications. This enhances performance if sending to a small,
|
||||
* reasonably static number of hosts. Typically for embedded devices.
|
||||
*/
|
||||
#define ETHARP_ALWAYS_INSERT 1
|
||||
|
||||
|
||||
/* ---------- IP options ---------- */
|
||||
/* Define IP_FORWARD to 1 if you wish to have the ability to forward
|
||||
@@ -134,10 +143,14 @@ a lot of data that needs to be copied, this should be set high. */
|
||||
defined to 0, all packets with IP options are dropped. */
|
||||
#define IP_OPTIONS 1
|
||||
|
||||
/* IP reassembly and segmentation.These are orthogonal even
|
||||
* if they both deal with IP fragments */
|
||||
#define IP_REASSEMBLY 1
|
||||
#define IP_FRAG 1
|
||||
|
||||
/* ---------- ICMP options ---------- */
|
||||
#define ICMP_TTL 255
|
||||
|
||||
|
||||
/* ---------- DHCP options ---------- */
|
||||
/* Define LWIP_DHCP to 1 if you want DHCP configuration of
|
||||
interfaces. DHCP is not implemented in lwIP 0.5.1, however, so
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
@@ -52,9 +52,6 @@
|
||||
|
||||
#include "netif/tcpdump.h"
|
||||
|
||||
#include "netif/sioslipif.h"
|
||||
|
||||
|
||||
#include "lwip/ip_addr.h"
|
||||
|
||||
#include "arch/perf.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
@@ -53,8 +53,6 @@
|
||||
|
||||
#include "netif/tcpdump.h"
|
||||
|
||||
#include "netif/sioslipif.h"
|
||||
|
||||
|
||||
#include "lwip/ip_addr.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
@@ -490,7 +490,7 @@ netconn_recv(struct netconn *conn)
|
||||
|
||||
|
||||
|
||||
DEBUGF(API_LIB_DEBUG, ("netconn_recv: received %p (err %d)\n", buf, conn->err));
|
||||
DEBUGF(API_LIB_DEBUG, ("netconn_recv: received %p (err %d)\n", (void *)buf, conn->err));
|
||||
|
||||
|
||||
return buf;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
@@ -494,6 +494,9 @@ static void
|
||||
do_close(struct api_msg_msg *msg)
|
||||
{
|
||||
err_t err;
|
||||
|
||||
err = ERR_OK;
|
||||
|
||||
if(msg->conn->pcb.tcp != NULL) {
|
||||
switch(msg->conn->type) {
|
||||
#if LWIP_UDP
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
@@ -271,17 +271,8 @@ lwip_recvfrom(int s, void *mem, int len, unsigned int flags,
|
||||
((struct sockaddr_in *)from)->sin_port = port;
|
||||
*fromlen = sizeof(struct sockaddr_in);
|
||||
}
|
||||
|
||||
|
||||
/* if the length of the received data is larger than
|
||||
len, this data is discarded and we return len.
|
||||
otherwise we return the actual length of the received
|
||||
data */
|
||||
if(len > copylen) {
|
||||
return copylen;
|
||||
} else {
|
||||
return len;
|
||||
}
|
||||
return copylen;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
int
|
||||
@@ -411,31 +402,6 @@ lwip_socket(int domain, int type, int protocol)
|
||||
int
|
||||
lwip_write(int s, void *data, int size)
|
||||
{
|
||||
struct lwip_socket *sock;
|
||||
err_t err;
|
||||
|
||||
DEBUGF(SOCKETS_DEBUG, ("write: socket %d, size %d\n", s, size));
|
||||
|
||||
sock = get_socket(s);
|
||||
if(sock == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch(netconn_type(sock->conn)) {
|
||||
case NETCONN_UDP:
|
||||
return lwip_send(s, data, size, 0);
|
||||
|
||||
case NETCONN_TCP:
|
||||
err = netconn_write(sock->conn, data, size, NETCONN_COPY);
|
||||
break;
|
||||
default:
|
||||
err = ERR_ARG;
|
||||
break;
|
||||
}
|
||||
if(err != ERR_OK) {
|
||||
/* errno = ... */
|
||||
return -1;
|
||||
}
|
||||
return size;
|
||||
return lwip_send(s, data, size, 0);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
@@ -77,11 +77,11 @@ tcpip_thread(void *arg)
|
||||
sys_mbox_fetch(mbox, (void *)&msg);
|
||||
switch(msg->type) {
|
||||
case TCPIP_MSG_API:
|
||||
DEBUGF(TCPIP_DEBUG, ("tcpip_thread: API message %p\n", msg));
|
||||
DEBUGF(TCPIP_DEBUG, ("tcpip_thread: API message %p\n", (void *)msg));
|
||||
api_msg_input(msg->msg.apimsg);
|
||||
break;
|
||||
case TCPIP_MSG_INPUT:
|
||||
DEBUGF(TCPIP_DEBUG, ("tcpip_thread: IP packet %p\n", msg));
|
||||
DEBUGF(TCPIP_DEBUG, ("tcpip_thread: IP packet %p\n", (void *)msg));
|
||||
ip_input(msg->msg.inp.p, msg->msg.inp.netif);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
@@ -34,7 +34,5 @@
|
||||
|
||||
int strlen(const char *str);
|
||||
int strncmp(const char *str1, const char *str2, int len);
|
||||
void bcopy(const void *src, void *dest, int len);
|
||||
void bzero(void *data, int n);
|
||||
|
||||
#endif /* __LIB_H__ */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
@@ -36,28 +36,4 @@
|
||||
* assembler.
|
||||
*/
|
||||
|
||||
#include "lwip/arch.h"
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
bcopy(const void *src, void *dst, unsigned int size)
|
||||
{
|
||||
char *csrc, *cdst;
|
||||
unsigned int i;
|
||||
|
||||
csrc = (char *)src;
|
||||
cdst = dst;
|
||||
|
||||
for(i = 0; i < size; ++i) {
|
||||
cdst[i] = csrc[i];
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
bzero(void *s, int n)
|
||||
{
|
||||
for(--n ;n >= 0; --n) {
|
||||
((char *)s)[n] = 0;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
6502/ - Architectural files for the 6502 CPU.
|
||||
|
||||
c16x/ - Architectural files for the C16x/ST10 uC.
|
||||
Supports lwIP Raw API only.
|
||||
CS8900a Ethernet driver for 16-bit mode.
|
||||
|
||||
msvc6/ - Architectural files for Microsoft Visual C++ 6.0.
|
||||
|
||||
rtxc/ - Architectural files for the RTXC operating system.
|
||||
|
||||
unix/ - Architectural files for testing on unix-like systems
|
||||
(assuming gcc and pthreads).
|
||||
|
||||
v2pro/ - Architectural files for the Xilinx Virtex-II PRO device with
|
||||
embedded PowerPC 405 Processor. Supports lwIP Raw API only.
|
||||
(requires V2PDK - http://www.xilinx.com/ise/vii_pro/kit.htm)
|
||||
|
||||
|
||||
Each subdirectory (may) also include:
|
||||
|
||||
perf.c - Optional file that should be implemented when running
|
||||
@@ -12,4 +23,7 @@ perf.c - Optional file that should be implemented when running
|
||||
|
||||
sys.c - Implementation of the operating system emulation layer.
|
||||
|
||||
netif/ - Architectural specific network interfaces.
|
||||
include/ - Architectural specific header files.
|
||||
|
||||
netif/ - Architectural specific network interfaces.
|
||||
|
||||
|
||||
13
src/arch/c16x/FILES
Normal file
13
src/arch/c16x/FILES
Normal file
@@ -0,0 +1,13 @@
|
||||
This directory contains architecture and compiler specific stuff for porting lwIP
|
||||
to the C16x and ST10 microcontrollers. The compiler specifics are for Tasking EDE
|
||||
v7.5r2.
|
||||
|
||||
The sequential API has not been ported; it's function are empties. If someone is
|
||||
interested in adding a sequential API, please contact the author (see below).
|
||||
|
||||
Besides this, a Cirrus (formerly Crystal Semiconductors) CS8900a Ethernet driver
|
||||
is included, which assumes a 16-bit data bus configuration. When porting this
|
||||
driver, note that the CS8900a does not support interrupts in 8-bit mode.
|
||||
|
||||
Leon Woestenberg
|
||||
<leon.woestenberg@axon.tv>
|
||||
22
src/arch/c16x/include/arch/cc.h
Normal file
22
src/arch/c16x/include/arch/cc.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef __CC_H__
|
||||
#define __CC_H__
|
||||
|
||||
/* memset(), memcpy() */
|
||||
#include <string.h>
|
||||
|
||||
typedef unsigned char u8_t;
|
||||
typedef signed char s8_t;
|
||||
typedef unsigned short u16_t;
|
||||
typedef signed short s16_t;
|
||||
typedef unsigned long u32_t;
|
||||
typedef signed long s32_t;
|
||||
|
||||
typedef u32_t mem_ptr_t;
|
||||
|
||||
// LW: Supported in at least >=v7.5 r2, but lwIP worked without the "_packed" attribute already
|
||||
#define PACK_STRUCT_BEGIN _packed
|
||||
#define PACK_STRUCT_STRUCT
|
||||
#define PACK_STRUCT_END
|
||||
#define PACK_STRUCT_FIELD(x) x
|
||||
|
||||
#endif /* __CC_H__ */
|
||||
6
src/arch/c16x/include/arch/cpu.h
Normal file
6
src/arch/c16x/include/arch/cpu.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef __CPU_H__
|
||||
#define __CPU_H__
|
||||
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
|
||||
#endif /* __CPU_H__ */
|
||||
39
src/arch/c16x/include/arch/lib.h
Normal file
39
src/arch/c16x/include/arch/lib.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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>
|
||||
*
|
||||
* $Id: lib.h,v 1.2 2002/12/19 10:37:08 jani Exp $
|
||||
*/
|
||||
#ifndef __LIB_H__
|
||||
#define __LIB_H__
|
||||
|
||||
|
||||
#endif /* __LIB_H__ */
|
||||
41
src/arch/c16x/include/arch/perf.h
Normal file
41
src/arch/c16x/include/arch/perf.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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>
|
||||
*
|
||||
* $Id: perf.h,v 1.1 2002/11/29 11:03:34 likewise Exp $
|
||||
*/
|
||||
#ifndef __PERF_H__
|
||||
#define __PERF_H__
|
||||
|
||||
#define PERF_START /* null definition */
|
||||
#define PERF_STOP(x) /* null definition */
|
||||
|
||||
#endif /* __PERF_H__ */
|
||||
15
src/arch/c16x/include/arch/sys_arch.h
Normal file
15
src/arch/c16x/include/arch/sys_arch.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef __SYS_ARCH_H__
|
||||
#define __SYS_ARCH_H__
|
||||
|
||||
#define SEMA int
|
||||
#define QUEUE int
|
||||
#define TASK int
|
||||
|
||||
#define SYS_MBOX_NULL (QUEUE)0
|
||||
#define SYS_SEM_NULL (SEMA)0
|
||||
|
||||
typedef SEMA sys_sem_t;
|
||||
typedef QUEUE sys_mbox_t;
|
||||
typedef TASK sys_thread_t;
|
||||
|
||||
#endif /* __SYS_ARCH_H__ */
|
||||
79
src/arch/c16x/include/netif/cs8900if.h
Normal file
79
src/arch/c16x/include/netif/cs8900if.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2003 Leon Woestenberg <leon.woestenberg@axon.tv>
|
||||
* Copyright (c) 2001-2003 Axon Digital Design B.V., The Netherlands.
|
||||
* 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: Leon Woestenberg <leon.woestenberg@axon.tv>
|
||||
*
|
||||
* This is a device driver for the Crystal Semiconductor CS8900
|
||||
* chip in combination with the lwIP stack.
|
||||
*
|
||||
* This is work under development. Please coordinate changes
|
||||
* and requests with Leon Woestenberg <leon.woestenberg@axon.tv>
|
||||
*
|
||||
* The Swedish Institute of Computer Science and Adam Dunkels
|
||||
* are specifically granted permission to redistribute this
|
||||
* source code under any conditions they seem fit.
|
||||
*
|
||||
*/
|
||||
#ifndef __NETIF_CS8900IF_H__
|
||||
#define __NETIF_CS8900IF_H__
|
||||
|
||||
#include "lwip/netif.h"
|
||||
|
||||
/* interface statistics gathering
|
||||
* such as collisions, dropped packets, missed packets
|
||||
* 0 = no statistics, minimal memory requirements, no overhead
|
||||
* 1 = statistics on, but some have large granularity (0x200), very low overhead
|
||||
* 2 = statistics on, updated on every call to cs8900_service(), low overhead
|
||||
*/
|
||||
#define CS8900_STATS 2
|
||||
|
||||
struct cs8900if
|
||||
{
|
||||
//struct eth_addr *ethaddr;
|
||||
u8_t needs_service;
|
||||
u8_t use_polling;
|
||||
#if (CS8900_STATS > 0)
|
||||
u32_t interrupts; // #interrupt requests of cs8900
|
||||
u32_t missed; // #packets on medium that could not enter cs8900a chip due to buffer shortage
|
||||
u32_t dropped; // #packets dropped after they have been received in chip buffer
|
||||
u32_t collisions; // #collisions on medium when transmitting packets
|
||||
u32_t sentpackets; // #number of sent packets
|
||||
u32_t sentbytes; // #number of sent bytes
|
||||
#endif
|
||||
/* Add whatever per-interface state that is needed here. */
|
||||
};
|
||||
|
||||
void cs8900if_init(struct netif *);
|
||||
void cs8900if_service(struct netif *);
|
||||
void cs8900if_input(struct netif *netif);
|
||||
err_t cs8900if_output(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr);
|
||||
|
||||
void cs8900_send_debug(unsigned char *p, unsigned int len);
|
||||
|
||||
#endif /* __NETIF_CS8900IF_H__ */
|
||||
73
src/arch/c16x/lib.c
Normal file
73
src/arch/c16x/lib.c
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* 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>
|
||||
*
|
||||
* $Id: lib.c,v 1.2 2002/12/19 10:37:07 jani Exp $
|
||||
*/
|
||||
|
||||
/* These are generic implementations of various library functions used
|
||||
* throughout the lwIP code. When porting, those should be optimized
|
||||
* for the particular processor architecture, preferably coded in
|
||||
* assembler.
|
||||
*/
|
||||
|
||||
#include "lwip/arch.h"
|
||||
|
||||
#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 */
|
||||
844
src/arch/c16x/netif/cs8900if.c
Normal file
844
src/arch/c16x/netif/cs8900if.c
Normal file
@@ -0,0 +1,844 @@
|
||||
/** @file
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Leon Woestenberg <leon.woestenberg@axon.tv>
|
||||
* Copyright (c) 2001, 2002 Axon Digital Design B.V., The Netherlands.
|
||||
* 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: Leon Woestenberg <leon.woestenberg@axon.tv>
|
||||
*
|
||||
* This is a device driver for the Crystal Semiconductor CS8900
|
||||
* chip in combination with the lwIP stack.
|
||||
*
|
||||
* This is work under development. Please coordinate changes
|
||||
* and requests with Leon Woestenberg <leon.woestenberg@axon.tv>
|
||||
*
|
||||
* The Swedish Institute of Computer Science and Adam Dunkels
|
||||
* are specifically granted permission to redistribute this
|
||||
* source code under any conditions they seem fit.
|
||||
*
|
||||
* A quick function roadmap:
|
||||
*
|
||||
* cs8900_*() are low level, cs8900 hardware specific functions.
|
||||
* These are declared static in the device driver source and
|
||||
* SHOULD NOT need to be called from outside this source.
|
||||
*
|
||||
* cs8900if_*() are the lwIP network interface functions.
|
||||
*
|
||||
* cs8900_interrupt() is an early interrupt service routine (ISR).
|
||||
* It merely sets a flag to indicate the cs8900 needs servicing.
|
||||
* (This function MAY be tied to an interrupt vector, IF present).
|
||||
*
|
||||
* cs8900_service() is the actual interrupt event service routine.
|
||||
* It must be called whenever the cs8900 needs servicing. It MAY
|
||||
* be polled safely (so, you do NOT NEED interrupt support.)
|
||||
*
|
||||
* cs8900_init() sets up the cs8900, using its register set. When
|
||||
* using the driver on your particular hardware platform, make sure
|
||||
* the register setups match.
|
||||
* Function is called from cs8900if_init().
|
||||
*
|
||||
* cs8900_input() transfers a received packet from the chip.
|
||||
* Function is called from cs8900if_input().
|
||||
*
|
||||
* cs8900_output() transfers a packet to the chip for transmission.
|
||||
* Function is called from cs8900if_output().
|
||||
*
|
||||
* cs8900if_init() initializes the lwIP network interface, and
|
||||
* calls cs8900_init() to initialize the hardware.
|
||||
* Function is called from lwIP.
|
||||
*
|
||||
* cs8900if_service() is the service routine, which must be called
|
||||
* upon the need for service, or on a regular basis, in order to
|
||||
* service the Ethernet chip.
|
||||
*
|
||||
* cs8900if_input() calls cs8900_input() to get a received packet
|
||||
* and then forwards the packet to protocol(s) handler(s).
|
||||
* Function is called from cs8900_service().
|
||||
*
|
||||
* cs8900if_output() resolves the hardware address, then
|
||||
* calls cs8900_output() to transfer the packet.
|
||||
* Function is called from lwIP.
|
||||
*
|
||||
* Future development:
|
||||
*
|
||||
* Split the generic Ethernet functionality (a lot of the
|
||||
* cs8900if_*() functions) and the actual cs8900a dependencies.
|
||||
*
|
||||
* Enhance the interrupt handler to service the Ethernet
|
||||
* chip (to decrease latency); support early packet
|
||||
* inspection (during reception) to early drop unwanted
|
||||
* packets, minimize chip buffer use and maximize throughput.
|
||||
*
|
||||
* Statistics gathering, currently under development.
|
||||
* SNMP support, currently under development.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lwip/debug.h"
|
||||
|
||||
#include "lwip/opt.h"
|
||||
#include "lwip/def.h"
|
||||
#include "lwip/mem.h"
|
||||
#include "lwip/pbuf.h"
|
||||
#include "lwip/stats.h"
|
||||
#include "lwip/sys.h"
|
||||
#include "netif/etharp.h"
|
||||
|
||||
#if 0
|
||||
// include some debugging help
|
||||
# define DBG_LEVEL 1
|
||||
# include "leds.h"
|
||||
# include "display.h"
|
||||
//# include "page.h"
|
||||
# define LED_NEED_SERVICE LED_FP1
|
||||
#else
|
||||
// no debugging
|
||||
# define leds_on()
|
||||
# define leds_off()
|
||||
#endif
|
||||
|
||||
#include "cs8900if.h"
|
||||
#if LWIP_SNMP > 0
|
||||
# include "snmp.h"
|
||||
#endif
|
||||
|
||||
// Define those to better describe your network interface
|
||||
#define IFNAME0 'e'
|
||||
#define IFNAME1 'n'
|
||||
|
||||
static const struct eth_addr ethbroadcast = {{0xffU,0xffU,0xffU,0xffU,0xffU,0xffU}};
|
||||
|
||||
// Forward declarations
|
||||
static err_t cs8900_output(struct netif *netif, struct pbuf *p);
|
||||
static struct pbuf *cs8900_input(struct netif *netif);
|
||||
static void cs8900_service(struct netif *netif);
|
||||
static u32_t cs8900_chksum(void *dataptr, int len);
|
||||
|
||||
// Define these to match your hardware setup
|
||||
#define MEM_BASE 0x00E000
|
||||
#define IO_BASE 0x800
|
||||
#define INT_NR 0x00
|
||||
|
||||
#define RXTXREG *((volatile u16_t *)(MEM_BASE + IO_BASE))
|
||||
#define TXCMD *((volatile u16_t *)(MEM_BASE + IO_BASE + 0x04))
|
||||
#define TXLENGTH *((volatile u16_t *)(MEM_BASE + IO_BASE + 0x06))
|
||||
#define ISQ *((volatile u16_t *)(MEM_BASE + IO_BASE + 0x08))
|
||||
#define PACKETPP *((volatile u16_t *)(MEM_BASE + IO_BASE + 0x0A))
|
||||
#define PPDATA *((volatile u16_t *)(MEM_BASE + IO_BASE + 0x0C))
|
||||
|
||||
// CS8900 PacketPage register offsets
|
||||
#define CS_PP_EISA 0x0000 // EISA Registration number of CS8900
|
||||
#define CS_PP_PRODID 0x0002 // Product ID Number
|
||||
#define CS_PP_IOBASE 0x0020 // I/O Base Address
|
||||
#define CS_PP_INTNUM 0x0022 // Interrupt number (0,1,2, or 3)
|
||||
#define CS_PP_RXCFG 0x0102 // Receiver Configuration
|
||||
#define CS_PP_RXCTL 0x0104 // Receiver Control
|
||||
#define CS_PP_TXCFG 0x0106 // Transmit Configuration
|
||||
#define CS_PP_BUFCFG 0x010A // Buffer Configuration
|
||||
#define CS_PP_LINECTL 0x0112 // Line Control Register offset
|
||||
#define CS_PP_SELFCTL 0x0114 // Self Control
|
||||
#define CS_PP_BUSCTL 0x0116 // Bus Control
|
||||
#define CS_PP_TESTCTL 0x0118 // Test Control
|
||||
#define CS_PP_ISQ 0x0120 // Interrupt status queue
|
||||
#define CS_PP_RXEVENT 0x0124 // Receiver Event
|
||||
#define CS_PP_TX_EVENT 0x0128 // Transmitter Event
|
||||
#define CS_PP_BUF_EVENT 0x012C // Buffer Event
|
||||
#define CS_PP_RXMISS 0x0130 // Receiver Miss Counter
|
||||
#define CS_PP_TXCOL 0x0132 // Transmit Collision Counter
|
||||
#define CS_PP_LINESTATUS 0x0134 // Line Status
|
||||
#define CS_PP_SELFTEST 0x0136 // Self Status
|
||||
#define CS_PP_BUSSTATUS 0x0138 // Bus Status
|
||||
#define CS_PP_TXCMD 0x0144 // Transmit Command Request
|
||||
#define CS_PP_TXLEN 0x0146 // Transmit Length
|
||||
#define CS_PP_IA1 0x0158 // Individual Address (IA)
|
||||
#define CS_PP_IA2 0x015A // Individual Address (IA)
|
||||
#define CS_PP_IA3 0x015C // Individual Address (IA)
|
||||
|
||||
#define CS_PP_RXSTATUS 0x0400 // Receive Status
|
||||
#define CS_PP_RXLEN 0x0402 // Receive Length
|
||||
#define CS_PP_RXFRAME 0x0404 // Receive Frame Location
|
||||
#define CS_PP_TXFRAME 0x0A00 // Transmit Frame Location
|
||||
|
||||
|
||||
// removed interrupt from library
|
||||
#if 0
|
||||
// hardware interrupt vector handler
|
||||
_interrupt(0x18) void cs8900_interrupt(void)
|
||||
{
|
||||
struct cs8900if *cs8900if = cs8900if_netif->state;
|
||||
// network interface is configured?
|
||||
if (cs8900if != NULL)
|
||||
{
|
||||
// chip needs service
|
||||
cs8900if->needs_service = 1;
|
||||
#if (CS8900_STATS > 0)
|
||||
cs8900if->interrupts++;
|
||||
#endif
|
||||
}
|
||||
#ifdef LED_NEED_SERVICE
|
||||
leds_on(LED_NEED_SERVICE);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
// cs8900_init()
|
||||
//
|
||||
// initializes the CS8900A chip
|
||||
//
|
||||
static void cs8900_init(struct netif *netif)
|
||||
{
|
||||
#ifdef LED_NEED_SERVICE
|
||||
leds_off(LED_NEED_SERVICE);
|
||||
#endif
|
||||
|
||||
// set RESET bit
|
||||
PACKETPP = CS_PP_SELFCTL;
|
||||
PPDATA = 0x0055U;
|
||||
|
||||
// { the RESET bit will be cleared by the cs8900a
|
||||
// as a result of the reset }
|
||||
// RESET bit cleared?
|
||||
while((PPDATA & 0x0040U) != 0); // TODO: add timeout
|
||||
|
||||
// { after full initialization of the cs8900a
|
||||
// the INITD bit will be set }
|
||||
|
||||
PACKETPP = CS_PP_SELFTEST;
|
||||
// INITD bit still clear?
|
||||
while ((PPDATA & 0x0080U) == 0); // TODO: add timeout
|
||||
// { INITD bit is set }
|
||||
|
||||
// SIBUSY bit still set?
|
||||
while ((PPDATA & 0x0100U) == 0x0100); // TODO: add timeout
|
||||
// { SIBUSY bit clear }
|
||||
|
||||
#if 1
|
||||
{
|
||||
u16_t dummy;
|
||||
// datasheet section 3.3.3
|
||||
dummy = *(u16_t *)(MEM_BASE + IO_BASE + 0x0D);
|
||||
// Dummy read, put chip in 16-bit mode
|
||||
dummy = *(u16_t *)(MEM_BASE + IO_BASE + 0x0D);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Set MAC address
|
||||
PACKETPP = CS_PP_IA1;
|
||||
PPDATA = (u16_t)(netif->hwaddr[0]) | (u16_t)(netif->hwaddr[1] << 8U);
|
||||
PACKETPP = CS_PP_IA2;
|
||||
PPDATA = (u16_t)(netif->hwaddr[2]) | (u16_t)(netif->hwaddr[3] << 8U);
|
||||
PACKETPP = CS_PP_IA3;
|
||||
PPDATA = (u16_t)(netif->hwaddr[4]) | (u16_t)(netif->hwaddr[5] << 8U);
|
||||
|
||||
// accept valid unicast or broadcast frames
|
||||
PACKETPP = CS_PP_RXCTL;
|
||||
PPDATA = (0x0005U | 0x0800U/*broadcast*/ | 0x0400U/*individual*/ | 0x0100U/*RxOK*/);
|
||||
|
||||
// enable receive interrupt
|
||||
PACKETPP = CS_PP_RXCFG;
|
||||
PPDATA = (0x0003U | 0x0100U/*RXIRQ*/);
|
||||
|
||||
// disable transmit interrupt (is default)
|
||||
PACKETPP = CS_PP_TXCFG;
|
||||
PPDATA = (0x0007U | 0);
|
||||
|
||||
// use interrupt number 0
|
||||
PACKETPP = CS_PP_INTNUM;
|
||||
PPDATA = (0x0000U);
|
||||
|
||||
// generate interrupt event on:
|
||||
// - the RxMISS counter reaches 0x200, or
|
||||
// - a received frame is lost
|
||||
PACKETPP = CS_PP_BUFCFG;
|
||||
PPDATA = (0x000bU |
|
||||
#if (CS8900_STATS > 0) // interrupt before counter overflow
|
||||
(0x2000U/*MissOvfloiE*/ | 0x1000U/*TxColOvfloiE*/) |
|
||||
#endif
|
||||
#if (CS8900_STATS > 1) // interrupt on counter increment
|
||||
(0x0400U/*RxMissiE*/) |
|
||||
#endif
|
||||
0x0000);
|
||||
|
||||
// enable interrupt generation
|
||||
PACKETPP = CS_PP_BUSCTL;
|
||||
PPDATA = (0x0017U | 0x8000U/*EnableIRQ*/);
|
||||
|
||||
// enable:
|
||||
// - receiver
|
||||
// - transmitter
|
||||
PACKETPP = CS_PP_LINECTL;
|
||||
PPDATA = (0x0013U | 0x0080U/*SerTxOn*/ | 0x0040U/*SerRxOn*/);
|
||||
}
|
||||
|
||||
static err_t cs8900_output(struct netif *netif, struct pbuf *p)
|
||||
{
|
||||
int tries = 0;
|
||||
|
||||
// exit if link has failed
|
||||
PACKETPP = CS_PP_LINESTATUS;
|
||||
if ((PPDATA & 0x0080U/*LinkOK*/) == 0) return ERR_CONN; // no Ethernet link
|
||||
|
||||
/* issue 'transmit' command to CS8900 */
|
||||
TXCMD = 0x00C9U;
|
||||
/* send length (in bytes) of packet to send */
|
||||
TXLENGTH = p->tot_len;
|
||||
|
||||
PACKETPP = CS_PP_BUSSTATUS;
|
||||
// not ready for transmission and still within 100 retries?
|
||||
while(((PPDATA & 0x0100U/*Rdy4TxNOW*/) == 0) && (tries++ < 100))
|
||||
{
|
||||
// throw away the last committed received frame
|
||||
PACKETPP = CS_PP_RXCFG;
|
||||
PPDATA = (0x0003U | 0x0040U/*Skip_1*/ | 0x0100U/*RxOKiE*/);
|
||||
PACKETPP = CS_PP_BUSSTATUS;
|
||||
/* cs8900if->dropped++; // CHECK: we do not know if we actually will drop a frame here */
|
||||
}
|
||||
// ready to transmit?
|
||||
if((PPDATA & 0x0100U/*Rdy4TxNOW*/) != 0)
|
||||
{
|
||||
// q traverses through linked list of pbuf's
|
||||
struct pbuf *q;
|
||||
for(q = p; q != NULL; q = q->next)
|
||||
{
|
||||
u16_t i;
|
||||
u16_t *ptr = (u16_t *)q->payload;
|
||||
// Send the data from the pbuf to the interface, one pbuf at a
|
||||
// time. The size of the data in each pbuf is kept in the ->len
|
||||
// variable.
|
||||
for(i = 0; i < q->len; i += 2)
|
||||
{
|
||||
RXTXREG = *ptr++;
|
||||
}
|
||||
#if (CS8900_STATS > 0)
|
||||
((struct cs8900if *)netif->state)->sentbytes += q->len;
|
||||
#endif
|
||||
#if LWIP_SNMP > 0
|
||||
snmp_add_ifoutoctets(p->tot_len);
|
||||
#endif
|
||||
#if (CS8900_STATS > 0)
|
||||
((struct cs8900if *)netif->state)->sentpackets++;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// { not ready to transmit!? }
|
||||
#if LWIP_SNMP > 0
|
||||
snmp_inc_ifoutdiscards();
|
||||
#endif
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move a received packet from the cs8900 into a new pbuf.
|
||||
*
|
||||
* Must be called after reading an ISQ event containing the
|
||||
* "Receiver Event" register, before reading new ISQ events.
|
||||
*
|
||||
* This function copies a frame from the CS8900A.
|
||||
* It is designed failsafe:
|
||||
* - It does not assume a frame is actually present.
|
||||
* - It checks for non-zero length
|
||||
* - It does not overflow the frame buffer
|
||||
*/
|
||||
static struct pbuf *cs8900_input(struct netif *netif)
|
||||
{
|
||||
struct pbuf *p = NULL, *q = NULL;
|
||||
u16_t len = 0;
|
||||
u16_t event_type;
|
||||
u16_t i;
|
||||
u16_t *ptr = NULL;
|
||||
|
||||
// read RxStatus
|
||||
event_type = RXTXREG;
|
||||
|
||||
// correctly received frame, either broadcast or individual address?
|
||||
// TODO: maybe defer these conditions to cs8900_input()
|
||||
if ((event_type & 0x0100U/*RxOK*/) && (event_type & 0x0c00U/*Broadcast | Individual*/))
|
||||
{
|
||||
#if LWIP_SNMP > 0
|
||||
// update number of received MAC-unicast and non-MAC-unicast packets
|
||||
if (event_type & 0x0400U/*Individual*/)
|
||||
{
|
||||
snmp_inc_ifinucastpkts();
|
||||
}
|
||||
else
|
||||
{
|
||||
snmp_inc_ifinnucastpkts();
|
||||
}
|
||||
#endif
|
||||
event_type = 0;
|
||||
// read RxLength
|
||||
len = RXTXREG;
|
||||
DEBUGF(NETIF_DEBUG, ("cs8900_input: packet len %u\n", len));
|
||||
#if LWIP_SNMP > 0
|
||||
snmp_add_ifinoctets(len);
|
||||
#endif
|
||||
// positive length?
|
||||
if (len > 0)
|
||||
{
|
||||
// allocate a pbuf chain with total length 'len'
|
||||
p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL);
|
||||
if (p != 0)
|
||||
{
|
||||
for (q = p; q != 0; q = q->next)
|
||||
{
|
||||
DEBUGF(NETIF_DEBUG, ("cs8900_input: pbuf @%p len %u\n", q, q->len));
|
||||
ptr = q->payload;
|
||||
// TODO: CHECK: what if q->len is odd? we don't use the last byte?
|
||||
for (i = 0; i < (q->len + 1) / 2; i++)
|
||||
{
|
||||
*ptr = RXTXREG;
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
// could not allocate a pbuf
|
||||
else
|
||||
{
|
||||
// skip received frame
|
||||
// TODO: maybe do not skip the frame at this point in time?
|
||||
PACKETPP = CS_PP_RXCFG;
|
||||
PPDATA = (0x0003U | 0x0100U/*RxOKiE*/ | 0x0040U/*Skip_1*/);
|
||||
#if (CS8900_STATS > 0)
|
||||
((struct cs8900if *)netif->state)->dropped++;
|
||||
#endif
|
||||
#if LWIP_SNMP > 0
|
||||
snmp_inc_ifindiscards();
|
||||
#endif
|
||||
len = 0;
|
||||
}
|
||||
}
|
||||
// length was zero
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* To be called when the cs8900a needs service. Does
|
||||
* not assume the cs8900a needs service. Does test the
|
||||
* cs8900a whether it needs service.
|
||||
*
|
||||
* As such, may be used robustly called as a deferred
|
||||
* (or "late") interrupt handler, or may be called in
|
||||
* a loop to implement polling, or both.
|
||||
*
|
||||
* Use cs8900if_service() from your application instead
|
||||
* of this function.
|
||||
*/
|
||||
|
||||
static void cs8900_service(struct netif *netif)
|
||||
{
|
||||
// amount of ISQ's to handle (> 0) in one cs8900_service() call
|
||||
unsigned char events2service = 1;
|
||||
// NOTES:
|
||||
// static, so only initialized to zero at program start.
|
||||
// irq_status will always hold the last ISQ event register that
|
||||
// still needs service. As such, we may leave this function if
|
||||
// we encounter an event we cannot service yet, and return later
|
||||
// to try to service it.
|
||||
static u16_t irq_status = 0x0000U;
|
||||
|
||||
// The "cs8900_needs_service" flag indicates whether any events
|
||||
// still need to be serviced.
|
||||
// clear flag here.
|
||||
// a receive interrupt can, *concurrently with this function*,
|
||||
// set this flag on new ISQ event occurences.
|
||||
// we will re-evaluate the correct setting of this flag at
|
||||
// function exit (below).
|
||||
((struct cs8900if *)netif->state)->needs_service = 0;
|
||||
#ifdef LED_NEED_SERVICE
|
||||
leds_off(LED_NEED_SERVICE);
|
||||
#endif
|
||||
// no unhandled irq_status left?
|
||||
if (irq_status == 0x0000U)
|
||||
{
|
||||
// read ISQ register
|
||||
irq_status = ISQ;
|
||||
}
|
||||
// ISQ interrupt event, and allowed to service in this loop?
|
||||
while ((irq_status != 0x0000U) && (events2service-- > 0))
|
||||
{
|
||||
// investigate event
|
||||
if ((irq_status & 0x003fU) == 0x0004U/*Receiver Event*/)
|
||||
{
|
||||
// correctly received frame, either broadcast or individual address
|
||||
// TODO: think where these checks should appear: here or in cs8900_input()
|
||||
if ((irq_status & 0x0100U/*RxOK*/) && (irq_status & 0x0c00U/*Broadcast | Individual*/))
|
||||
{
|
||||
// read the frame from the cs8900a
|
||||
cs8900if_input(netif);
|
||||
}
|
||||
else
|
||||
{
|
||||
// skip this frame
|
||||
PACKETPP = CS_PP_RXCFG;
|
||||
PPDATA |= 0x0040U/*Skip_1*/;
|
||||
#if (CS8900_STATS > 0)
|
||||
((struct cs8900if *)netif->state)->dropped++;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#if (CS8900_STATS > 0)
|
||||
else if ((irq_status & 0x003fU) == 0x0010U/*RxMISS Event*/)
|
||||
{
|
||||
((struct cs8900if *)netif->state)->missed += (irq_status >> 6);
|
||||
}
|
||||
else if ((irq_status & 0x003fU) == 0x0012U/*TxCOL Event*/)
|
||||
{
|
||||
((struct cs8900if *)netif->state)->collisions += (irq_status >> 6);
|
||||
}
|
||||
#endif
|
||||
// read ISQ register
|
||||
irq_status = ISQ;
|
||||
}
|
||||
|
||||
// we did not deplete the ISQ?
|
||||
if (irq_status != 0x0000U)
|
||||
{
|
||||
// the cs8900a still needs service
|
||||
((struct cs8900if *)netif->state)->needs_service = 1;
|
||||
#ifdef LED_NEED_SERVICE
|
||||
leds_on(LED_NEED_SERVICE);
|
||||
#endif
|
||||
}
|
||||
#if (CS8900_STATS > 1)
|
||||
// read RxMiss Counter (zeroes itself upon read)
|
||||
PACKETPP = CS_PP_RXMISS;
|
||||
((struct cs8900if *)netif->state)->missed += (PPDATA >> 6);
|
||||
// read RxCol Counter (zeroes itself upon read)
|
||||
PACKETPP = CS_PP_TXCOL;
|
||||
((struct cs8900if *)netif->state)->collisions += (PPDATA >> 6);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Service the CS8900.
|
||||
*
|
||||
* Can be called in a polling manner, or only after the CS8900 has raised
|
||||
* an interrupt request.
|
||||
*
|
||||
* @param netif The lwIP network interface data structure belonging to this device.
|
||||
*
|
||||
*/
|
||||
void cs8900if_service(struct netif *netif)
|
||||
{
|
||||
// is there a reason to call the service routine?
|
||||
if ((((struct cs8900if *)netif->state)->needs_service) ||
|
||||
(((struct cs8900if *)netif->state)->use_polling))
|
||||
{
|
||||
cs8900_service(netif);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writing an IP packet (to be transmitted) to the CS8900.
|
||||
*
|
||||
* Before writing a frame to the CS8900, the ARP module is asked to resolve the
|
||||
* Ethernet MAC address. The ARP module might undertake actions to resolve the
|
||||
* address first, and queue this packet for later transmission.
|
||||
*
|
||||
* @param netif The lwIP network interface data structure belonging to this device.
|
||||
* @param p pbuf to be transmitted (or the first pbuf of a chained list of pbufs).
|
||||
* @param ipaddr destination IP address.
|
||||
*
|
||||
* @internal It uses the function cs8900_input() that should handle the actual
|
||||
* reception of bytes from the network interface.
|
||||
*
|
||||
*/
|
||||
err_t cs8900if_output(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr)
|
||||
{
|
||||
struct cs8900if *cs8900if = netif->state;
|
||||
p = etharp_output(netif, ipaddr, p);
|
||||
/* network hardware address obtained? */
|
||||
if (p != NULL)
|
||||
{
|
||||
/* send out the packet */
|
||||
cs8900_output(netif, p);
|
||||
p = NULL;
|
||||
}
|
||||
// { p == NULL }
|
||||
else
|
||||
{
|
||||
/* we cannot tell if the packet was sent, the packet could have been queued */
|
||||
/* on an ARP entry that was already pending. */
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
/**
|
||||
* Read a received packet from the CS8900.
|
||||
*
|
||||
* This function should be called when a packet is received by the CS8900
|
||||
* and is fully available to read. It moves the received packet to a pbuf
|
||||
* which is forwarded to the IP network layer or ARP module. It transmits
|
||||
* a resulting ARP reply or queued packet.
|
||||
*
|
||||
* @param netif The lwIP network interface to read from.
|
||||
*
|
||||
* @internal Uses cs8900_input() to move the packet from the CS8900 to a
|
||||
* newly allocated pbuf.
|
||||
*
|
||||
*/
|
||||
void cs8900if_input(struct netif *netif)
|
||||
{
|
||||
struct cs8900if *cs8900if = netif->state;
|
||||
struct eth_hdr *ethhdr = NULL;
|
||||
struct pbuf *p = NULL, *q = NULL;
|
||||
|
||||
/* move received packet into a new pbuf */
|
||||
p = cs8900_input(netif);
|
||||
/* no packet could be read */
|
||||
if (p == NULL) {
|
||||
/* silently ignore this */
|
||||
return;
|
||||
}
|
||||
/* points to packet payload, which starts with an Ethernet header */
|
||||
ethhdr = p->payload;
|
||||
|
||||
q = NULL;
|
||||
switch(htons(ethhdr->type)) {
|
||||
/* IP packet? */
|
||||
case ETHTYPE_IP:
|
||||
/* update ARP table, obtain first queued packet */
|
||||
q = etharp_ip_input(netif, p);
|
||||
/* skip Ethernet header */
|
||||
pbuf_header(p, -14);
|
||||
/* pass to network layer */
|
||||
netif->input(p, netif);
|
||||
break;
|
||||
/* ARP packet? */
|
||||
case ETHTYPE_ARP:
|
||||
/* pass p to ARP module, get ARP reply or ARP queued packet */
|
||||
q = etharp_arp_input(netif, (struct eth_addr *)&netif->hwaddr, p);
|
||||
break;
|
||||
/* unsupported Ethernet packet type */
|
||||
default:
|
||||
/* free pbuf */
|
||||
pbuf_free(p);
|
||||
p = NULL;
|
||||
break;
|
||||
}
|
||||
/* send out the ARP reply or ARP queued packet */
|
||||
if (q != NULL) {
|
||||
/* q pbuf has been succesfully sent? */
|
||||
if (cs8900_output(netif, q) == ERR_OK)
|
||||
{
|
||||
pbuf_free(q);
|
||||
q = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* TODO: re-queue packet in the ARP cache here (?) */
|
||||
pbuf_free(q);
|
||||
q = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Initialize the CS8900 Ethernet MAC/PHY device driver.
|
||||
*
|
||||
* @param netif The lwIP network interface data structure belonging to this device.
|
||||
*
|
||||
*/
|
||||
void cs8900if_init(struct netif *netif)
|
||||
{
|
||||
struct cs8900if *cs8900if;
|
||||
|
||||
cs8900if = mem_malloc(sizeof(struct cs8900if));
|
||||
if(cs8900if == NULL) return;
|
||||
|
||||
// initialize lwip network interface
|
||||
netif->name[0] = IFNAME0;
|
||||
netif->name[1] = IFNAME1;
|
||||
netif->output = cs8900if_output;
|
||||
netif->linkoutput = cs8900_output;
|
||||
|
||||
// initialize cs8900 specific interface structure
|
||||
netif->state = cs8900if;
|
||||
|
||||
// initially assume no ISQ event
|
||||
cs8900if->needs_service = 0;
|
||||
// set to 1 if polling method is used
|
||||
cs8900if->use_polling = 0;
|
||||
|
||||
#if (CS8900_STATS > 0)
|
||||
// number of interrupt service routine calls
|
||||
cs8900if->interrupts = 0;
|
||||
cs8900if->missed = 0;
|
||||
cs8900if->dropped = 0;
|
||||
cs8900if->sentpackets = 0;
|
||||
cs8900if->sentbytes = 0;
|
||||
#endif
|
||||
|
||||
// intialize the cs8900a chip
|
||||
cs8900_init(netif);
|
||||
}
|
||||
|
||||
#if 1
|
||||
/**
|
||||
* Dump an array of bytes inside a UDP message's data field.
|
||||
*
|
||||
* It is a self-contained function, independent of higher protocol layers or other
|
||||
* functions, so it allows you to debug these higher layers, such as lwIP.
|
||||
*
|
||||
* @param p pointer to an array of bytes, at least with length 'len'
|
||||
* @param len number of bytes available at the address pointed to by 'p'
|
||||
*/
|
||||
void cs8900_send_debug(unsigned char *p, unsigned int len)
|
||||
{
|
||||
int tries = 0, i;
|
||||
|
||||
// network interface state
|
||||
extern struct netif *ethif;
|
||||
|
||||
// exit if link has failed
|
||||
PACKETPP = CS_PP_LINESTATUS;
|
||||
if ((PPDATA & 0x0080U/*LinkOK*/) == 0) return; // TODO: find a correct error code
|
||||
|
||||
// transmit command
|
||||
TXCMD = 0x00C9U;
|
||||
// send at least 60 bytes
|
||||
TXLENGTH = (14 + 20 + 8 + len < 60) ? 60 : (14 + 20 + 8 + len);
|
||||
|
||||
PACKETPP = CS_PP_BUSSTATUS;
|
||||
// not ready for transmission and still within 100 retries?
|
||||
while (((PPDATA & 0x0100U/*Rdy4TxNOW*/) == 0) && (tries++ < 100))
|
||||
{
|
||||
// throw away the last committed received frame
|
||||
PACKETPP = CS_PP_RXCFG;
|
||||
PPDATA = (0x0003U | 0x0040U/*Skip_1*/ | 0x0100U/*RxOKiE*/);
|
||||
PACKETPP = CS_PP_BUSSTATUS;
|
||||
/* cs8900if->dropped++; CHECK: we do not know if we actually will drop a frame here, do we? */
|
||||
}
|
||||
// ready to transmit?
|
||||
if((PPDATA & 0x0100U/*Rdy4TxNOW*/) != 0)
|
||||
{
|
||||
u16_t data, checksum = 0;
|
||||
u32_t udp_checksum = 0;
|
||||
|
||||
// destination Ethernet address
|
||||
RXTXREG = 0xa000U;
|
||||
RXTXREG = 0xc524U;
|
||||
RXTXREG = 0x6d72U;
|
||||
// source Ethernet address
|
||||
RXTXREG = htons(((u16_t)ethif->hwaddr[0] << 8U) | (u16_t)ethif->hwaddr[1]);
|
||||
RXTXREG = htons(((u16_t)ethif->hwaddr[2] << 8U) | (u16_t)ethif->hwaddr[3]);
|
||||
RXTXREG = htons(((u16_t)ethif->hwaddr[4] << 8U) | (u16_t)ethif->hwaddr[5]);
|
||||
// frame type
|
||||
RXTXREG = htons(0x0800);
|
||||
// TOS, version
|
||||
RXTXREG = htons(data = ((0x40 | 0x05) << 8) | 0x00);
|
||||
checksum += data;
|
||||
// length
|
||||
RXTXREG = htons(data = 20 + 8 + len);
|
||||
checksum += data;
|
||||
// identifier
|
||||
RXTXREG = htons(data = 0);
|
||||
checksum += data;
|
||||
// fragment offset
|
||||
RXTXREG = htons(data = 0);
|
||||
checksum += data;
|
||||
// TTL, UDP protocol
|
||||
RXTXREG = htons(data = (255U << 8) | 17U);
|
||||
checksum += data;
|
||||
|
||||
checksum += (htonl(ethif->ip_addr.addr) & 0xffff0000U) >> 16;
|
||||
checksum += (htonl(ethif->ip_addr.addr) & 0x0000ffffU);
|
||||
checksum += 0xc0a8U;
|
||||
checksum += 0x0001U;
|
||||
checksum += 6; // LW: kludge/hack: checksum calculation seems to be wrong somehow
|
||||
// LW: this seems (?) to fix it
|
||||
// checksum
|
||||
RXTXREG = htons(~checksum);
|
||||
|
||||
// source IP
|
||||
RXTXREG = htons((htonl(ethif->ip_addr.addr) & 0xffff0000U) >> 16);
|
||||
// source IP
|
||||
RXTXREG = htons( htonl(ethif->ip_addr.addr) & 0x0000ffffU);
|
||||
// destination IP
|
||||
RXTXREG = htons(0xc0a8U);
|
||||
// destination IP
|
||||
RXTXREG = htons(0x0001U);
|
||||
// source port 3000
|
||||
RXTXREG = htons(3000U);
|
||||
// destination port 3000
|
||||
RXTXREG = htons(3000U);
|
||||
// UDP length
|
||||
RXTXREG = htons(len);
|
||||
// UDP checksum (not present)
|
||||
|
||||
udp_checksum = (htonl(ethif->ip_addr.addr) & 0xffff0000U) >> 16;
|
||||
udp_checksum += (htonl(ethif->ip_addr.addr) & 0x0000ffffU);
|
||||
udp_checksum += 0xc0a8U;
|
||||
udp_checksum += 0x0001U;
|
||||
udp_checksum += 0x0011U;
|
||||
udp_checksum += (8 + len);
|
||||
udp_checksum += 3000;
|
||||
udp_checksum += 3000;
|
||||
udp_checksum += (8 + len);
|
||||
udp_checksum += cs8900_chksum(p, len);
|
||||
while(udp_checksum >> 16) {
|
||||
udp_checksum = (udp_checksum & 0xffffUL) + (udp_checksum >> 16);
|
||||
}
|
||||
|
||||
RXTXREG = htons(~(udp_checksum & 0xffff));
|
||||
// UDP data
|
||||
for (i = 0; i < len; i += 2)
|
||||
{
|
||||
RXTXREG = htons((p[i] << 8) | p[i + 1]);
|
||||
}
|
||||
// pad to 60 bytes
|
||||
while (i < 60)
|
||||
{
|
||||
RXTXREG = 0;
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static u32_t cs8900_chksum(void *dataptr, int len)
|
||||
{
|
||||
u32_t acc = 0;
|
||||
u16_t *ptr = (u16_t *)dataptr;
|
||||
|
||||
for(acc = 0; len > 1; len -= 2) {
|
||||
acc += *ptr;
|
||||
ptr++;
|
||||
}
|
||||
/* add up any odd byte */
|
||||
if(len == 1) {
|
||||
acc += htons((u16_t)((*(u8_t *)ptr) & 0xffU) << 8);
|
||||
}
|
||||
return acc;
|
||||
}
|
||||
|
||||
#endif
|
||||
42
src/arch/c16x/perf.c
Normal file
42
src/arch/c16x/perf.c
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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>
|
||||
*
|
||||
* $Id: perf.c,v 1.1 2002/11/29 11:03:34 likewise Exp $
|
||||
*/
|
||||
|
||||
#include "arch/perf.h"
|
||||
|
||||
void
|
||||
perf_init(char *fname)
|
||||
{
|
||||
if (fname); // LEON: prevent warning
|
||||
}
|
||||
137
src/arch/c16x/sys_arch.c
Normal file
137
src/arch/c16x/sys_arch.c
Normal file
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* 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>
|
||||
*
|
||||
* $Id: sys_arch.c,v 1.1 2002/11/29 11:03:34 likewise Exp $
|
||||
*/
|
||||
|
||||
#include "lwip/def.h"
|
||||
#include "lwip/sys.h"
|
||||
#include "lwip/mem.h"
|
||||
|
||||
//#include "timers.h"
|
||||
|
||||
static struct sys_timeouts timeouts;
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
sys_mbox_t
|
||||
sys_mbox_new(void)
|
||||
{
|
||||
return SYS_MBOX_NULL;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
sys_mbox_free(sys_mbox_t mbox)
|
||||
{
|
||||
if (mbox); // LEON: prevent warning
|
||||
return;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
sys_mbox_post(sys_mbox_t mbox, void *data)
|
||||
{
|
||||
if (mbox); // LEON: prevent warning
|
||||
if (data); // LEON: prevent warning
|
||||
return;
|
||||
}
|
||||
|
||||
u16_t
|
||||
sys_arch_mbox_fetch(sys_mbox_t mbox, void **msg, u16_t timeout)
|
||||
{
|
||||
if (mbox); // LEON: prevent warning
|
||||
if (msg); // LEON: prevent warning
|
||||
if (timeout); // LEON: prevent warning
|
||||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
sys_sem_t
|
||||
sys_sem_new(u8_t count)
|
||||
{
|
||||
if (count);
|
||||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
u16_t
|
||||
sys_arch_sem_wait(sys_sem_t sem, u16_t timeout)
|
||||
{
|
||||
if (sem);
|
||||
return 0;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
sys_sem_signal(sys_sem_t sem)
|
||||
{
|
||||
if (sem);
|
||||
return;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
sys_sem_free(sys_sem_t sem)
|
||||
{
|
||||
if (sem);
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
sys_init(void)
|
||||
{
|
||||
timeouts.next = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
struct sys_timeouts *
|
||||
sys_arch_timeouts(void)
|
||||
{
|
||||
return &timeouts;
|
||||
}
|
||||
|
||||
u8_t
|
||||
sys_timeout_u32_t(u32_t msecs, sys_timeout_handler h, void *data) // LEON: arg 1 was unsigned int
|
||||
{
|
||||
return 0;
|
||||
// WAS: return timer_obtain(msecs, h, data);
|
||||
// RE-ENABLE IF DHCP_TIMER_CALLBACKS
|
||||
#if DHCP_TIMER_CALLBACKS
|
||||
#error DHCP_TIMER_CALLBACKS not supported!
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
sys_thread_new(void (* function)(void *arg), void *arg)
|
||||
{
|
||||
if (arg); // LW
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
sys_main(void)
|
||||
{
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
1
src/arch/msvc6/include/arch/bpstruct.h
Normal file
1
src/arch/msvc6/include/arch/bpstruct.h
Normal file
@@ -0,0 +1 @@
|
||||
#pragma pack(push,1)
|
||||
50
src/arch/msvc6/include/arch/cc.h
Normal file
50
src/arch/msvc6/include/arch/cc.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2003 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>
|
||||
*
|
||||
*/
|
||||
#ifndef __ARCH_CC_H__
|
||||
#define __ARCH_CC_H__
|
||||
|
||||
typedef unsigned char u8_t;
|
||||
typedef signed char s8_t;
|
||||
/*typedef unsigned short u8_t;
|
||||
typedef signed short s8_t; */
|
||||
typedef unsigned short u16_t;
|
||||
typedef signed short s16_t;
|
||||
typedef unsigned long u32_t;
|
||||
typedef signed long s32_t;
|
||||
|
||||
typedef u32_t mem_ptr_t;
|
||||
|
||||
#define PACK_STRUCT_FIELD(x) x
|
||||
#define PACK_STRUCT_STRUCT
|
||||
#pragma warning(disable: 4103)
|
||||
|
||||
#endif /* __ARCH_CC_H__ */
|
||||
39
src/arch/msvc6/include/arch/cpu.h
Normal file
39
src/arch/msvc6/include/arch/cpu.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2003 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>
|
||||
*
|
||||
*/
|
||||
#ifndef __ARCH_CPU_H__
|
||||
#define __ARCH_CPU_H__
|
||||
|
||||
#ifndef BYTE_ORDER
|
||||
#define BYTE_ORDER LITTLE_ENDIAN
|
||||
#endif /* BYTE_ORDER */
|
||||
|
||||
#endif /* __ARCH_CPU_H__ */
|
||||
1
src/arch/msvc6/include/arch/epstruct.h
Normal file
1
src/arch/msvc6/include/arch/epstruct.h
Normal file
@@ -0,0 +1 @@
|
||||
#pragma pack(pop)
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
@@ -29,15 +29,13 @@
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
#ifndef __NETIF_SIOSLIPIF_H__
|
||||
#define __NETIF_SIOSLIPIF_H__
|
||||
#ifndef __ARCH_INIT_H__
|
||||
#define __ARCH_INIT_H__
|
||||
|
||||
#include "lwip/netif.h"
|
||||
#define TCPIP_INIT_DONE(arg) sys_sem_signal(*(sys_sem_t *)arg)
|
||||
|
||||
#endif /* __ARCH_INIT_H__ */
|
||||
|
||||
void sioslipif_init(struct netif *);
|
||||
|
||||
|
||||
void sioslipif_init1(struct netif *);
|
||||
void sioslipif_init2(struct netif *);
|
||||
|
||||
#endif /* __NETIF_SIOSLIPIF_H__ */
|
||||
42
src/arch/msvc6/include/arch/lib.h
Normal file
42
src/arch/msvc6/include/arch/lib.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2003 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>
|
||||
*
|
||||
*/
|
||||
#ifndef __ARCH_LIB_H__
|
||||
#define __ARCH_LIB_H__
|
||||
|
||||
#ifndef _STRING_H_
|
||||
#ifndef _STRING_H
|
||||
int strlen(const char *str);
|
||||
int strncmp(const char *str1, const char *str2, int len);
|
||||
#endif /* _STRING_H */
|
||||
#endif /* _STRING_H_ */
|
||||
|
||||
#endif /* __ARCH_LIB_H__ */
|
||||
58
src/arch/msvc6/include/arch/perf.h
Normal file
58
src/arch/msvc6/include/arch/perf.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2003 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>
|
||||
*
|
||||
*/
|
||||
#ifndef __ARCH_PERF_H__
|
||||
#define __ARCH_PERF_H__
|
||||
|
||||
#ifdef PERF
|
||||
#define PERF_START
|
||||
#define PERF_STOP(x)
|
||||
|
||||
/*#define PERF_START do { \
|
||||
struct tms __perf_start, __perf_end; \
|
||||
times(&__perf_start)
|
||||
#define PERF_STOP(x) times(&__perf_end); \
|
||||
perf_print_times(&__perf_start, &__perf_end, x);\
|
||||
} while(0)*/
|
||||
#else /* PERF */
|
||||
#define PERF_START /* null definition */
|
||||
#define PERF_STOP(x) /* null definition */
|
||||
#endif /* PERF */
|
||||
|
||||
void perf_print(unsigned long c1l, unsigned long c1h,
|
||||
unsigned long c2l, unsigned long c2h,
|
||||
char *key);
|
||||
|
||||
void perf_print_times(struct tms *start, struct tms *end, char *key);
|
||||
|
||||
void perf_init(char *fname);
|
||||
|
||||
#endif /* __ARCH_PERF_H__ */
|
||||
48
src/arch/msvc6/include/arch/sys_arch.h
Normal file
48
src/arch/msvc6/include/arch/sys_arch.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2003 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>
|
||||
*
|
||||
*/
|
||||
#ifndef __ARCH_SYS_ARCH_H__
|
||||
#define __ARCH_SYS_ARCH_H__
|
||||
|
||||
#define SYS_MBOX_NULL NULL
|
||||
#define SYS_SEM_NULL NULL
|
||||
|
||||
struct sys_sem;
|
||||
typedef struct sys_sem * sys_sem_t;
|
||||
|
||||
struct sys_mbox;
|
||||
typedef struct sys_mbox *sys_mbox_t;
|
||||
|
||||
struct sys_thread;
|
||||
typedef struct sys_thread * sys_thread_t;
|
||||
|
||||
#endif /* __ARCH_SYS_ARCH_H__ */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
@@ -34,7 +34,5 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define bcopy(s, d, l) memcpy(d, s, l)
|
||||
#define bzero(d, l) memset(d, 0, l)
|
||||
|
||||
#endif /* __LIB_H__ */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
@@ -36,28 +36,3 @@
|
||||
* assembler.
|
||||
*/
|
||||
|
||||
#if 0 /* Define to 1 if these are really needed. */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
bcopy(const void *src, void *dst, unsigned int size)
|
||||
{
|
||||
char *csrc, *cdst;
|
||||
unsigned int i;
|
||||
|
||||
csrc = (char *)src;
|
||||
cdst = dst;
|
||||
|
||||
for(i = 0; i < size; ++i) {
|
||||
cdst[i] = csrc[i];
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
bzero(void *s, int n)
|
||||
{
|
||||
for(--n ;n >= 0; --n) {
|
||||
((char *)s)[n] = 0;
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
#endif /* 0 */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
@@ -31,13 +31,12 @@
|
||||
*/
|
||||
#ifndef __ARCH_LIB_H__
|
||||
#define __ARCH_LIB_H__
|
||||
#include <string.h>
|
||||
|
||||
#ifndef _STRING_H_
|
||||
#ifndef _STRING_H
|
||||
int strlen(const char *str);
|
||||
int strncmp(const char *str1, const char *str2, int len);
|
||||
void bcopy(const void *src, void *dest, int len);
|
||||
void bzero(void *data, int n);
|
||||
#endif /* _STRING_H */
|
||||
#endif /* _STRING_H_ */
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user