Compare commits

...

148 Commits

Author SHA1 Message Date
jani
07af438a38 fix printing of recved packet.Discovered by Ed Sutter 2003-01-16 13:09:19 +00:00
likewise
fa8f6cb204 Free incoming pbuf's in the TCP event macro if the recv callback is NULL. Fixes bug #2156. 2003-01-14 12:54:02 +00:00
jani
049853362a ack duplicate segments too to prevent connection hanging when a single transmitted ACK gets lost 2003-01-14 09:38:10 +00:00
jani
3e6202f614 do not set rtime too many times to 0.it's enough to do it in tcp_output_segment 2003-01-14 08:37:01 +00:00
jani
a993e962f5 fix compiler warnings in DEBUGF 2003-01-14 08:22:05 +00:00
likewise
1ad5537c9b Fixed some typo's in the comments. 2003-01-13 13:22:09 +00:00
likewise
ea0dc429a7 Added #include <string.h> for memset()/memcpy(). 2003-01-13 13:14:45 +00:00
jani
8d7f09fa92 remove global ctime.Each entry's ctime is now absolute.This avoids wrapping and also solves naming clash reported on the list 2003-01-13 09:38:21 +00:00
jani
02a6a8a809 etharp_output_sent no longer exists 2003-01-11 15:10:12 +00:00
jani
2bba9bcd9f make rtime field u16_t like rto otherwise it won't catch rto if that goes beyond 255.When that happens there's trouble already since 255 ticks is over 2 minutes but still... 2003-01-10 15:46:58 +00:00
jani
4eebbdea0d print correct pcb->rtime value in debug statament.it does not directly depend on tcp_ticks 2003-01-10 15:41:02 +00:00
jani
4a2d03a517 seqno is u32_t so use %lu instead of %ld when printing it 2003-01-10 15:36:47 +00:00
jani
5212afdd8f remove already commented out function : memp_realloc 2003-01-10 09:42:27 +00:00
jani
e196108931 fix debug messages in tcp_slowtmr to reflect the correct name of this function 2003-01-10 09:41:24 +00:00
likewise
a5e9b73703 Made hardware address length definable (was 6 bytes for Ethernet). 2003-01-08 16:06:02 +00:00
likewise
5e13d495f0 Merged patch #927 which fixes "needs modifiable lvalue" compile error in TCP_REG. 2003-01-08 15:37:20 +00:00
likewise
a528a2323e More debugging in checksum routines. 2003-01-08 15:36:25 +00:00
likewise
c786f238ef Output snd_buf size in debug message in tcp_enqueue(). 2003-01-08 14:35:02 +00:00
adamdunkels
d04f7aa4bc Added comments to the tcp_enqueue() function. 2003-01-08 14:11:24 +00:00
likewise
ced453a72b Moved ETHARP_ALWAYS_INSERT switch to lwipopts.h 2003-01-08 11:03:54 +00:00
likewise
0f3e8c19e8 Added check if ARP_QUEUEING is 1 for a queueing related debug statement. 2003-01-08 10:49:16 +00:00
likewise
cc4df7100d Updated lwIP module copyright years to include 2003. Committers must check theirs. 2003-01-08 10:09:39 +00:00
likewise
0bd02a5f7a Removed etharp_output_sent() as etharp.c no longer returns ARP packets to the driver. 2003-01-08 09:24:06 +00:00
likewise
b311ab0d53 Allocate PBUF_RAW instead of PBUF_LINK type pbufs. Fixes bug #1890 for this driver. 2003-01-08 09:09:35 +00:00
jani
b6b905412e Patch #928 from Marc 2003-01-07 12:50:34 +00:00
jani
2c2fec1b0e remove bcopy & bzero from archs 2002-12-19 10:37:07 +00:00
jani
f946abd86b Simplify pbuf allocation for TCP packets in two places by replacing pbuf_alloc + pbuf_header
with an equivalent pbuf_alloc.When we know we'll have to adjust the payload for the TCP header
just alloc it like that from the start.
2002-12-19 09:50:53 +00:00
jani
156d2c866f sizeof(u8_t) is 1 at temperatures > 0 K 2002-12-19 09:04:58 +00:00
jani
ef68392388 renamed (hopefully everywhere) stats to lwip_stats.closes bug #1901 2002-12-18 12:49:01 +00:00
jani
51006824f9 remove tcpdump.c 2002-12-18 12:26:14 +00:00
kieranm
9eebc135ce Removed dummy variable from "struct mem" and handled all MEM_ALIGNMENT cases
Fixes bug #1912
2002-12-18 12:01:24 +00:00
kieranm
af0d6bc881 Removed tcpdump.c from Makefile - it seems to have disappeared 2002-12-18 12:00:14 +00:00
kieranm
771fb0f2cd Removed "static" from declaration of netif in ip_forward and ip_output
(Bug #1909)
2002-12-18 11:53:26 +00:00
jani
3984e521ad Move tcpdump.h to unix arch.BTW: as with tcpdump.c no CVS history is lost here. 2002-12-18 10:51:33 +00:00
jani
95c1bca3f1 Moved tcpdump to unix arch since it's specific to that. 2002-12-18 10:48:51 +00:00
jani
4c1069c38b use memset and memcpy instead of bzero and bcopy throughout lwIP core code.Archs need to update.Bug #1899 2002-12-18 10:40:01 +00:00
jani
219266b7de replace bcopy and bzero with memcpy memset in tapif.Alloc PBUF_RAW instead of PBUF_LINK on input now that the meaning of PBUF_LINK has changed. 2002-12-18 10:36:43 +00:00
jani
f037bfad1e check for NO_SYS consistently using #if.Closes bug #1910 2002-12-18 10:03:33 +00:00
jani
c0a8ef6f6f Use C style comments.In debug stataments cast various struct pointers to void* to
avoid printf warnings.misc warnings in etharp.
2002-12-17 09:41:16 +00:00
jani
a071cbf86c Allocate PBUF_POOL_BUFSIZE at once not harcoded 128.Init MTU for slip - 1500 for
now needs a SLIP_MTU in opts (later).Add prototypes for low level sio callbacks.
2002-12-17 09:39:10 +00:00
jani
6dd350348d fix 'conflicting type for strncmp' warning on linux by including string.h 2002-12-17 09:36:50 +00:00
likewise
5472d94b73 Added comment to ip_input() packet filter. 2002-12-11 00:21:12 +00:00
kieranm
40abd14884 Make tmr in tcp_pcb u32_t to ensure it wraps at the same time as tcp_ticks (Bug #1838) 2002-12-05 09:52:59 +00:00
kieranm
cac01f7a89 Fixed compiler warnings when ARP_QUEUEING is not defined. 2002-12-05 09:41:52 +00:00
kieranm
7ea512e7fa Added #include <stdlib.h> to ensure abort() is known 2002-12-05 09:41:04 +00:00
kieranm
8bd53b5be8 Added netbuf_copy_partial declaration 2002-12-05 09:40:19 +00:00
kieranm
96610c9c20 Fixed compiler warning - DEBUGF statement with too many arguments 2002-12-05 09:38:25 +00:00
kieranm
6972e81ac0 Zero pcb->acked if ack does not acknowledge new data
- prevents the sent function being called multiple times when no new data has been acknowledged
2002-12-03 10:45:47 +00:00
likewise
ac46dbacfa Fixed wrong assertion condition. 2002-12-02 16:08:09 +00:00
likewise
ea3b0fc477 Fixed missing end-of-comment. 2002-12-02 13:11:04 +00:00
likewise
99dfbfeef0 Clarified debug messages where the timers are set. 2002-12-02 12:23:37 +00:00
likewise
dcce504ade First attempt to stylize and document DHCP sources. 2002-12-01 19:49:45 +00:00
likewise
dfa0369678 More complete ARP protocol implementation. 2002-11-29 16:02:11 +00:00
likewise
1d341bae31 Initial commit of C16x/ST10 arch files and CS8900a Ethernet driver. 2002-11-29 10:59:34 +00:00
likewise
0ed4fd6741 Documented ( *output)() and ( *linkoutput)() better for upcoming ARP changes. 2002-11-28 15:03:07 +00:00
likewise
6fc6acf295 Fixed typo: ETHARP_DEGUG 2002-11-28 14:55:10 +00:00
likewise
bda378bb9f All ARP queueing code is now conditionally compiled-in. 2002-11-28 09:26:18 +00:00
likewise
4619bbc3ea Changed dhcp_init() to NULL the client_list (on re-inits). 2002-11-25 22:36:25 +00:00
likewise
c73606309f Fixed argument type compiler warnings of the bcopy() call using type casting. 2002-11-24 22:27:10 +00:00
jani
0442c1e228 new file ip_frag for IP SAR.reassembly code moved from ip.c and fixed 2002-11-22 15:46:50 +00:00
jani
b0500b7b5a add ip frag switches defaulting to on and increase pbuf pool size for unix demo 2002-11-22 15:35:33 +00:00
jani
38581aad65 include slipif in the objects and widlcard ipv4 so it will include everything in there 2002-11-22 15:24:34 +00:00
jani
53148943bd add new header file 2002-11-22 13:18:01 +00:00
jani
cfab6dc28b initialize tapif's mtu to 1500 2002-11-22 12:53:05 +00:00
jani
a57c91404f add MTU (maximum transmission unit) field to struct netif 2002-11-22 12:52:04 +00:00
jani
8210edfeea fix pbuf_alloc for layer PBUF_LINK 2002-11-22 08:32:31 +00:00
likewise
c9bd32d12b Added SNMP call-outs for monitoring of default SNMP status items for TCP/IP. 2002-11-21 10:32:19 +00:00
likewise
dfe1ab7438 Added debug messages for corner cases of TCP states. 2002-11-21 10:29:51 +00:00
jani
e26a3e347b change tapif 'MTU' to be 1500 just like the linux tap's MTU 2002-11-19 10:20:19 +00:00
likewise
29f5968c23 Conditionally have ARP queue outgoing pbufs. 2002-11-18 10:30:02 +00:00
likewise
1b798ed6d3 Added PBUF_REF (payload external, copied on queueing). 2002-11-18 09:51:48 +00:00
jani
dbac2ff0b3 Move etharp packed structures to the header file. 2002-11-18 08:41:31 +00:00
jani
f2fbcdf00a typo fixes.The unterminated comment already got two bugreports so it was time. 2002-11-18 07:36:29 +00:00
jani
b8972f5701 forgot to delete 'return' in the last commit 2002-11-18 06:51:53 +00:00
jani
8b9a303e21 pack the fields in dhcp_msg.This way DHCP works on non-byte aligned archs too. 2002-11-15 15:12:49 +00:00
jani
6ef24c4e48 make it call etharp_output_sent() in tapif_output.This is to prevent the recently
discovered memory leak.
2002-11-15 15:08:21 +00:00
jani
428293a69b make lwip_write() use lwip_send() and avoid code duplication.return copylen
in lwip_recvfrom since it has already been chosen as the minimum
of len and buflen.
2002-11-15 15:05:06 +00:00
likewise
1dd7e81df7 DHCP cleanup redux (patch #654). 2002-11-15 12:44:50 +00:00
likewise
4beff6c2cf ETHARP_SNOOP_UPDATES made externally configurable. 2002-11-15 12:41:59 +00:00
jani
58d748a8ad take out the msvc pragmas that cancel each other.leave only one pair around 3 structs. 2002-11-15 12:32:47 +00:00
adamdunkels
43a06e8e37 The code that increased the retransmission time was commented out for some reason. This has been fixed. Also removed some old, out-commented, code. 2002-11-15 09:40:05 +00:00
jani
8f2284d5c7 reclaimed fields have been unused for a while.remove them. 2002-11-14 12:21:55 +00:00
jani
131eed412a Fix function names in DEBUGF stataments.Remove reference to "reclaimed" field in stat. 2002-11-14 12:20:37 +00:00
jani
330647dad8 Add SLIP_DEBUG 2002-11-14 10:52:03 +00:00
jani
ecf0f56d33 Fix bug which eats pbufs if SLIP_END comes at a pbuf boundary.Also cleaned up and commented the code. 2002-11-14 08:03:25 +00:00
kieranm
05a91a4725 Change type of members of struct stats_mem to "mem_size_t" (Bug #1694) 2002-11-13 21:55:38 +00:00
kieranm
4b9e035a9f Initialize err in tcp_slowtmr to prevent compiler warning. 2002-11-13 21:54:22 +00:00
kieranm
f975754ad9 Initialize err in do_close to prevent compiler warning. 2002-11-13 21:53:36 +00:00
likewise
d31ef42acf ARP entries can now be updated (but not added) on any ARP traffic. Set #define ETHARP_SNOOP_UPDATES 1 to enable. 2002-11-13 09:10:19 +00:00
likewise
f9129c4dcd Implemented conditional insertion of ARP entries to update_arp_entry using ARP_INSERT_FLAG. 2002-11-13 08:56:11 +00:00
adamdunkels
1f1e6eb5a1 Fixed a few C style issues to make it compatible with the rest of lwIP. 2002-11-13 08:11:52 +00:00
likewise
2382792792 Fixes all issues that showed up after the first commit. 2002-11-11 15:36:31 +00:00
likewise
8cdeaa5148 Hardware address bytes made unsigned char instead of char, consistent with other sources. 2002-11-11 15:35:18 +00:00
likewise
10bf9ef2ef ip_output() no longer frees pbuf in case no route could be found. 2002-11-11 14:49:17 +00:00
likewise
bca526b634 Workaround for compile error on TCP_REG. This workaround is disabled by default. 2002-11-11 14:47:26 +00:00
likewise
9b76f5bf53 Fixes all issues that showed up after the first commit. 2002-11-11 14:40:03 +00:00
likewise
e41134bbbe Note about ethernetif.c not up-to-date with etharp.c API. Fixed typo. 2002-11-11 14:37:30 +00:00
likewise
b9353eaf12 Changed static etharp_query() to support queueing packets. This fix missed in last commit. 2002-11-11 14:34:12 +00:00
likewise
3e62b75529 memp_alloc() now zeroes allocated memory (for robustness). Callers must NOT assume this. 2002-11-11 14:31:00 +00:00
likewise
ad55cb6733 Added pbuf_ref_chain() which increases ref count of all pbufs in a chain. 2002-11-11 11:22:49 +00:00
likewise
6c977ad6ed Surrounded all #include's for packed structs with #ifdef's. 2002-11-08 22:50:49 +00:00
likewise
2b53babf99 Fixed numerous bugs. Re-used etharp_query() in etharp_output(). Added comments and JavaDoc documentation. 2002-11-08 22:14:24 +00:00
likewise
8077dd838c Added DHCP client by Leon Woestenberg 2002-11-08 15:57:23 +00:00
proff_fs
c22eaf5f52 Added MSVC6 port. 2002-11-08 12:57:58 +00:00
proff_fs
f1c0bbc62b Added includeds for bpstruct and epstruct.
Ports should update from using PACK_STRUCT_BEGIN and PACK_STRUCT_END to use these includes.
Maybe there should be an PACK_STRUCT_USE_INCLUDES ifdef around these, for ports for which PACK_STRUCT_BEGIN and PACK_STRUCT_END works nicely.
2002-11-08 12:54:43 +00:00
likewise
e988d2ee0b find_arp_entry() returned 0 instead of ARP_TABLE_SIZE if full pending cache (bug #1625). 2002-11-06 11:43:21 +00:00
likewise
72e3d22271 To prevent compiler warnings, added UL to some bit mask constants. 2002-11-06 10:00:32 +00:00
cborrelli
585b250540 added v2pro description; added include/ dir description 2002-11-05 23:27:08 +00:00
cborrelli
a582ccfce8 initial version for Xilinx Virtex-II Pro port 2002-11-05 23:14:33 +00:00
cborrelli
6c979fed40 added ifndef around the TCP_TMR defines so that the user can define these values in the lwipopts.h file if needed; this change will not be seen outside the stack unless the user wants to change the default values. 2002-11-05 18:36:32 +00:00
likewise
bb06293b30 Fixed NULL pointer bug (#1493). Fix for memory leak bug (#1601), etharp_output_sent(). Added etharp_query for DHCP. 2002-11-04 14:56:24 +00:00
adamdunkels
50111c8689 Added #ifdefs around each debug output switch so that those can be defined in lwipopts.h instead. 2002-11-03 13:08:23 +00:00
adamdunkels
6028e2c420 Added a 404 error page. 2002-11-03 13:02:35 +00:00
adamdunkels
d6986a757a Added a 404 error page. The web server crashed without it. 2002-11-03 13:02:12 +00:00
adamdunkels
01cccf4aee Reformatted the code to make it consistent with the rest of lwIP. 2002-11-02 20:40:06 +00:00
adamdunkels
4e4da8e019 Added short descriptions of the generic network interface code. 2002-11-02 20:38:49 +00:00
kieranm
2a3d00f1ed New example project demonstrates how to use lwIP as a shared library 2002-10-25 15:31:01 +00:00
kieranm
8b5fcad039 Added check on entire sequence number of received packet being less than the rcv_nxt variable.
(see http://www.sics.se/mailing-lists/lwip.html/msg01409.html)
2002-10-24 13:34:36 +00:00
adamdunkels
aa69784495 Replaced a += (combined addition and assignment) with an explicit assignment and addition to avoid compiler warnings. 2002-10-24 13:20:42 +00:00
kieranm
4933bfaaa0 Fixed bug in duplicate ack handling
(see http://www.sics.se/mailing-lists/lwip.html/msg01460.html)
Solution adds check on right window edge when duplicate ack received, if it is different it is not a duplicate.
2002-10-24 13:14:52 +00:00
adamdunkels
ef6b7099ba Removed the old lwIP homepage from the example web server filesystem and replaced it with a simple web page with short information about the lwIP project. Previously the web pages in the example web server was a large portion of the final .tar.gz file. 2002-10-24 13:11:51 +00:00
adamdunkels
1be416fe0e Added unsigned qualifier to the struct members to avoid compiler warnings. 2002-10-24 13:09:45 +00:00
adamdunkels
524bab33ba Added unsigned qualifier to the output to avoid compiler warnings for the produced fsdata.c file. Added a final newline to the output to avoid warnings. 2002-10-24 13:09:11 +00:00
adamdunkels
2a3e3b984d Added typecasts to avoid compiler warnings 2002-10-24 13:04:51 +00:00
adamdunkels
fc242e107d Removed #inclusion of "netif/sioslipif.h" since the file has been removed and split into two, "netif/sio.h" and "netif/slipif.h". 2002-10-24 12:45:27 +00:00
adamdunkels
a7db4e4347 Rewrote the COREFILES to reflect the changes from tcp_input.c and tcp_output.c to tcp_in.c and tcp_out.c. Removed simrouter and simnode from the all: target. 2002-10-24 12:44:27 +00:00
kieranm
8fe9e007c9 Fixed congestion window bug where the pcb->cwnd variable overflowed when increased. 2002-10-24 10:57:44 +00:00
adamdunkels
05b8bf216c Added SIO_FIFO_DEBUG and PPP_DEBUG to make -DDEBUG work with arch/unix/netif/sio.c 2002-10-23 20:20:29 +00:00
adamdunkels
faf18b7f9a Added Author: comment, #ifdef'ed linux specific stuff, added typecast for strlen 2002-10-23 20:18:27 +00:00
adamdunkels
62b78bebe1 Added Author: comment 2002-10-23 20:14:27 +00:00
adamdunkels
27dff9af70 Added typecasts and #includes to keep compiler from issuing warnings 2002-10-23 20:12:18 +00:00
adamdunkels
43c6a550b2 Added #undefs for htonl and friends to keep compiler from issuing "doubly defined" warnings 2002-10-23 20:00:21 +00:00
adamdunkels
814f8c505e Updated TCP out-of-sequence handling to use recv_data variable instead of old pcb->recv_data. 2002-10-23 19:58:16 +00:00
adamdunkels
fbd9fa5d94 Fixed COREFILES to reflect the tcp_input.c -> tcp_in.c and tcp_output.c -> tcp_out.c filename changes 2002-10-23 19:45:33 +00:00
adamdunkels
28832ba9c2 Added #if LWIP_UDP around udp_init() body, fixed bug where un-connected UDP PCBs did not always receive correct datagram 2002-10-23 19:44:32 +00:00
likewise
6cb3ae7d7f Mention the search feature mailing list archive. Commited to test CVS email notification. 2002-10-22 23:42:17 +00:00
likewise
bcb2600107 New file structure towards SLIP/PPP. Renamed tcp_*.c for 8.3 sake.
See lwip@sics.se Mon, 21 Oct 2002 magnus.ivarsson
2002-10-22 12:32:58 +00:00
likewise
18ee2d90c9 Added URL to web-browsable CVS tree. 2002-10-20 15:24:36 +00:00
likewise
fecc7424e4 Added redundant brackets in an if statement to keep a flaky compiler happy. 2002-10-20 15:20:30 +00:00
likewise
9ede36a386 Allocate struct tcp_seg *prev, *cseg only if TCP_QUEUE_OOSEQ is defined. 2002-10-20 15:19:20 +00:00
likewise
950f2d0f2f Re-added without vendor tag. 2002-10-20 15:13:14 +00:00
likewise
89bc334515 Removed to get rid of vendor tag. 2002-10-20 15:11:10 +00:00
likewise
67e47cac49 Added explanation on move to Savannah and URLs to its project pages. 2002-10-20 14:58:05 +00:00
likewise
58cb89d261 Removed old Id: tags in 4 non-source-code files. 2002-10-19 19:48:06 +00:00
likewise
fea27fd743 Added FILES without old vendor Id: tag. 2002-10-19 19:41:10 +00:00
likewise
d5ae18e468 Removed FILES to remove the old vendor Id: tag. 2002-10-19 19:39:57 +00:00
likewise
129c4d20c7 Updated texts to reflect move to http://savannah.nongnu.org/projects/lwip/ 2002-10-19 16:07:55 +00:00
likewise
76e851fc56 Fixed typo. Testing CVS add as a test. 2002-10-19 13:16:22 +00:00
189 changed files with 9204 additions and 6803 deletions

View File

@@ -1,3 +1,5 @@
Changelog that precedes the move to Savannah:
(0.5.3) Changes since version 0.5.2
++ Bugfixes:

58
COPYING
View File

@@ -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
View File

@@ -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
View 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>

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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,

View File

@@ -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

View File

@@ -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,

View File

@@ -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;

View File

@@ -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
View 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
View 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
View 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,&ethaddr,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(&ethaddr,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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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){
}

View File

@@ -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:

View File

@@ -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;
}

View File

@@ -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,

View 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>
&nbsp;
</td></tr>
</table>
</body>
</html>

View File

@@ -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">
&nbsp;
</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
&lt;adam@sics.se&gt;</a>.
</p>
<p align="right">
<font size="-1"><i>
$Date: 2002/10/19 13:00:01 $
</i></font>
</p>
</td>
<td width="50">
&nbsp;
</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>

View File

@@ -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">
&nbsp;
</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">
&nbsp;
</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>

View 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>
&nbsp;
</td></tr>
</table>
</body>
</html>

View File

@@ -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">
&nbsp;
</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">
&nbsp;
</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>

View File

@@ -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">
&nbsp;
</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">
&nbsp;
</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>

View File

@@ -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">
&nbsp;
</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">
&nbsp;
</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>

View File

@@ -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">
&nbsp;
</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">
&nbsp;
</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

View File

@@ -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;
};

View File

@@ -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,

View File

@@ -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,

View File

@@ -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");

View File

@@ -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] == '\\') {

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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);
}

View File

@@ -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,

View File

@@ -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

View File

@@ -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,

View File

@@ -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"

View File

@@ -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"

View File

@@ -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;

View File

@@ -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

View File

@@ -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,

View File

@@ -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);
}
/*-----------------------------------------------------------------------------------*/

View File

@@ -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:

View File

@@ -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,

View File

@@ -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,

View File

@@ -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__ */

View File

@@ -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,

View File

@@ -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,

View File

@@ -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;
}
}
/*-----------------------------------------------------------------------------------*/

View File

@@ -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,

View File

@@ -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
View 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>

View 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__ */

View File

@@ -0,0 +1,6 @@
#ifndef __CPU_H__
#define __CPU_H__
#define BYTE_ORDER LITTLE_ENDIAN
#endif /* __CPU_H__ */

View 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__ */

View 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__ */

View 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__ */

View 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
View 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 */

View 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
View 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
View 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)
{
}
/*-----------------------------------------------------------------------------------*/

View File

@@ -0,0 +1 @@
#pragma pack(push,1)

View 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__ */

View 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__ */

View File

@@ -0,0 +1 @@
#pragma pack(pop)

View File

@@ -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__ */

View 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__ */

View 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__ */

View 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__ */

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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__ */

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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 */

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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