diff --git a/Makefile.am b/Makefile.am index 9a9ee9b..ea53f7c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,9 +3,6 @@ AUTOMAKE_OPTIONS = foreign subdir-objects AM_CFLAGS = @WFLAGS@ -Dunix -DIPv4 \ -I$(srcdir)/lwip/src \ -I$(srcdir)/lwip/src/include \ - -I$(srcdir)/lwip/src/include/ipv4 \ - -I$(srcdir)/lwip/src/include/ipv6 \ - -I$(srcdir)/contrib/ports/unix/include \ -I$(srcdir)/src LWIP_SOURCES := \ @@ -43,7 +40,6 @@ LWIP_SOURCES := \ lwip/src/include/lwip/tcp.h \ lwip/src/include/lwip/tcp_impl.h \ lwip/src/include/lwip/tcpip.h \ - lwip/src/include/lwip/timers.h \ lwip/src/include/lwip/udp.h \ lwip/src/include/netif/etharp.h \ lwip/src/include/netif/slipif.h \ @@ -54,6 +50,7 @@ LWIP_SOURCES := \ lwip/src/core/dns.c \ lwip/src/core/inet_chksum.c \ lwip/src/core/init.c \ + lwip/src/core/ip.c \ lwip/src/core/mem.c \ lwip/src/core/memp.c \ lwip/src/core/netif.c \ @@ -63,7 +60,7 @@ LWIP_SOURCES := \ lwip/src/core/tcp.c \ lwip/src/core/tcp_in.c \ lwip/src/core/tcp_out.c \ - lwip/src/core/timers.c \ + lwip/src/core/timeouts.c \ lwip/src/core/udp.c \ lwip/src/include/ipv4/lwip/autoip.h \ lwip/src/include/ipv4/lwip/icmp.h \ @@ -71,7 +68,7 @@ LWIP_SOURCES := \ lwip/src/include/ipv4/lwip/inet.h \ lwip/src/include/ipv4/lwip/ip4_addr.h \ lwip/src/include/ipv4/lwip/ip4.h \ - lwip/src/include/ipv4/lwip/ip_frag.h \ + lwip/src/include/ipv4/lwip/ip4_frag.h \ lwip/src/include/ipv6/lwip/icmp6.h \ lwip/src/include/ipv6/lwip/ip6_addr.h \ lwip/src/include/ipv6/lwip/ip6.h \ @@ -81,7 +78,7 @@ LWIP_SOURCES := \ lwip/src/core/ipv4/icmp.c \ lwip/src/core/ipv4/ip4.c \ lwip/src/core/ipv4/ip4_addr.c \ - lwip/src/core/ipv4/ip_frag.c \ + lwip/src/core/ipv4/ip4_frag.c \ lwip/src/api/api_lib.c \ lwip/src/api/api_msg.c \ lwip/src/api/err.c \ @@ -100,11 +97,7 @@ LWIP_SOURCES := \ contrib/ports/unix/include/netif/tcpdump.h \ contrib/ports/unix/include/netif/tunif.h \ contrib/ports/unix/include/netif/unixif.h \ - contrib/ports/unix/lwip_chksum.c \ - contrib/ports/unix/perf.c \ - contrib/ports/unix/sys_arch.c \ - contrib/ports/unix/netif/list.c \ - contrib/ports/unix/netif/tcpdump.c + lwip/contrib/ports/unix/port/sys_arch.c APP_SOURCES := src/ocproxy.c src/lwipopts.h diff --git a/arch/cc.h b/arch/cc.h new file mode 100644 index 0000000..997b940 --- /dev/null +++ b/arch/cc.h @@ -0,0 +1,87 @@ +/* + * 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 + * + */ +#ifndef LWIP_ARCH_CC_H +#define LWIP_ARCH_CC_H + +/* see https://sourceforge.net/p/predef/wiki/OperatingSystems/ */ +#if defined __ANDROID__ +#define LWIP_UNIX_ANDROID +#elif defined __linux__ +#define LWIP_UNIX_LINUX +#elif defined __APPLE__ +#define LWIP_UNIX_MACH +#elif defined __OpenBSD__ +#define LWIP_UNIX_OPENBSD +#elif defined __CYGWIN__ +#define LWIP_UNIX_CYGWIN +#elif defined __GNU__ +#define LWIP_UNIX_HURD +#endif + +#define LWIP_TIMEVAL_PRIVATE 0 +#include + +#define LWIP_ERRNO_INCLUDE + +#if defined(LWIP_UNIX_LINUX) || defined(LWIP_UNIX_HURD) +#define LWIP_ERRNO_STDINCLUDE 1 +#endif + +extern unsigned int lwip_port_rand(void); +#define LWIP_RAND() (lwip_port_rand()) + +/* different handling for unit test, normally not needed */ +#ifdef LWIP_NOASSERT_ON_ERROR +#define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \ + handler;}} while(0) +#endif + +#if defined(LWIP_UNIX_ANDROID) && defined(FD_SET) +typedef __kernel_fd_set fd_set; +#endif + +#if defined(LWIP_UNIX_LINUX) +/* sys/types.h and signal.h bring in Darwin byte order macros. pull the + header here and disable LwIP's version so that apps still can get + the macros via LwIP headers and use system headers */ +#include +#define LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS +#endif + +struct sio_status_s; +typedef struct sio_status_s sio_status_t; +#define sio_fd_t sio_status_t* +#define __sio_fd_t_defined + +typedef unsigned int sys_prot_t; + +#endif /* LWIP_ARCH_CC_H */ diff --git a/contrib/ports/unix/include/arch/perf.h b/arch/perf.h similarity index 91% rename from contrib/ports/unix/include/arch/perf.h rename to arch/perf.h index 326ac9e..364f316 100644 --- a/contrib/ports/unix/include/arch/perf.h +++ b/arch/perf.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * 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, @@ -11,21 +11,21 @@ * 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. + * 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 + * 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 * */ diff --git a/contrib/ports/unix/include/arch/sys_arch.h b/arch/sys_arch.h similarity index 60% rename from contrib/ports/unix/include/arch/sys_arch.h rename to arch/sys_arch.h index c69e8f9..416b716 100644 --- a/contrib/ports/unix/include/arch/sys_arch.h +++ b/arch/sys_arch.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * 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, @@ -11,49 +11,55 @@ * 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. + * 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 + * 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 * */ #ifndef LWIP_ARCH_SYS_ARCH_H #define LWIP_ARCH_SYS_ARCH_H -#include - #define SYS_MBOX_NULL NULL #define SYS_SEM_NULL NULL -typedef u32_t sys_prot_t; +/*typedef u32_t sys_prot_t;*/ struct sys_sem; typedef struct sys_sem * sys_sem_t; -#define sys_sem_valid(sem) (((sem) != NULL) && (*(sem) != NULL)) -#define sys_sem_set_invalid(sem) do { if((sem) != NULL) { *(sem) = NULL; }}while(0) +#define sys_sem_valid(sem) (((sem) != NULL) && (*(sem) != NULL)) +#define sys_sem_valid_val(sem) ((sem) != NULL) +#define sys_sem_set_invalid(sem) do { if((sem) != NULL) { *(sem) = NULL; }}while(0) +#define sys_sem_set_invalid_val(sem) do { (sem) = NULL; }while(0) -/* let sys.h use binary semaphores for mutexes */ -#define LWIP_COMPAT_MUTEX 1 +struct sys_mutex; +typedef struct sys_mutex * sys_mutex_t; +#define sys_mutex_valid(mutex) sys_sem_valid(mutex) +#define sys_mutex_set_invalid(mutex) sys_sem_set_invalid(mutex) struct sys_mbox; -typedef struct sys_mbox *sys_mbox_t; -#define sys_mbox_valid(mbox) (((mbox) != NULL) && (*(mbox) != NULL)) -#define sys_mbox_set_invalid(mbox) do { if((mbox) != NULL) { *(mbox) = NULL; }}while(0) +typedef struct sys_mbox * sys_mbox_t; +#define sys_mbox_valid(mbox) sys_sem_valid(mbox) +#define sys_mbox_valid_val(mbox) sys_sem_valid_val(mbox) +#define sys_mbox_set_invalid(mbox) sys_sem_set_invalid(mbox) +#define sys_mbox_set_invalid_val(mbox) sys_sem_set_invalid_val(mbox) struct sys_thread; typedef struct sys_thread * sys_thread_t; -#endif /* LWIP_ARCH_SYS_ARCH_H */ +#define LWIP_EXAMPLE_APP_ABORT() lwip_unix_keypressed() +int lwip_unix_keypressed(void); +#endif /* LWIP_ARCH_SYS_ARCH_H */ diff --git a/contrib/VERSION b/contrib/VERSION deleted file mode 100644 index 2048a76..0000000 --- a/contrib/VERSION +++ /dev/null @@ -1 +0,0 @@ -36eab8918473ab575ed11c87cee33954a52e6a1d diff --git a/contrib/apps/chargen/README b/contrib/apps/chargen/README deleted file mode 100644 index 7dc2ee5..0000000 --- a/contrib/apps/chargen/README +++ /dev/null @@ -1,52 +0,0 @@ - - CHARGEN - -This file implements a nice example of handling multiple tcp sockets in a -server environment. Just call chargen_init() from your application after -you have initialized lwip and added your network interfaces. Change the -MAX_SERV option to increase or decrease the number of sessions supported. - -chargen will jam as much data as possible into the output socket, so it -will take up a lot of CPU time. Therefore it will be a good idea to run it -as the lowest possible priority (just ahead of any idle task). - -This is also a good example of how to support multiple sessions in an -embedded system where you might not have fork(). The multiple sessions are -all handled by the same thread and select() is used for demultiplexing. - -No makefile is provided, just add chargen to the makefile for your -application. It is OS and HW independent. - -Once the chargen server is running in your application, go to another system -and open a telnet session to your lwip platform at port 19. You should see an -ASCII pattern start to stream on you screen. - -As an example, lets say that your system running lwip is at IP address -192.168.10.244 and you have a linux system connected to it at IP address -192.168.10.59. Issue the following command at a terminal prompt on the linux system: - -telnet 192.168.10.244 19 - -You will see a pattern similar to the following on streaming by on your -screen: - -ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{ -BCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{| -CDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|} -DEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ -EFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~! -FGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!" -GHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"# -HIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$ -IJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$% -JKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%& -KLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&' -LMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~!"#$%&'( - -It even works from windows: At a dos prompt you can also issue the same -telnet command and you will get a similar (but much slower, at least on W98) -data stream. - -David Haas - - diff --git a/contrib/apps/chargen/chargen.c b/contrib/apps/chargen/chargen.c deleted file mode 100644 index c6ea83e..0000000 --- a/contrib/apps/chargen/chargen.c +++ /dev/null @@ -1,269 +0,0 @@ -/** @file - * - * chargen server for lwip - */ -/* - * Copyright (c) 2003 NBS Card Technology, Paramus, NJ. - * 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: David Haas - * - * Purpose: chargen server for testing and demonstration purposes - * - * This file implements a nice example of handling multiple tcp sockets in a - * server environment. Just call chargen_init() from your application after - * you have initialized lwip and added your network interfaces. Change the - * MAX_SERV option to increase or decrease the number of sessions supported. - * - * chargen will jam as much data as possible into the output socket, so it - * will take up a lot of CPU time. Therefore it will be a good idea to run it - * as the lowest possible priority (just ahead of any idle task). - * - * This is also a good example of how to support multiple sessions in an - * embedded system where you might not have fork(). - */ - -#include "lwip/opt.h" -#include "lwip/sys.h" -#include "lwip/sockets.h" -#include "lwip/mem.h" - -#include - -#include "chargen.h" - -#if LWIP_SOCKET - -#define MAX_SERV 5 /* Maximum number of chargen services. Don't need too many */ -#define CHARGEN_THREAD_NAME "chargen" -#define CHARGEN_PRIORITY 254 /* Really low priority */ -#define CHARGEN_THREAD_STACKSIZE 0 -#define SEND_SIZE TCP_SNDLOWAT /* If we only send this much, then when select - says we can send, we know we won't block */ -struct charcb -{ - struct charcb *next; - int socket; - struct sockaddr_in cliaddr; - socklen_t clilen; - char nextchar; -}; - -static struct charcb *charcb_list = 0; -static int do_read(struct charcb *p_charcb); -static void close_chargen(struct charcb *p_charcb); - -/************************************************************** - * void chargen_thread(void *arg) - * - * chargen task. This server will wait for connections on well - * known TCP port number: 19. For every connection, the server will - * write as much data as possible to the tcp port. - **************************************************************/ -static void chargen_thread(void *arg) -{ - int listenfd; - struct sockaddr_in chargen_saddr; - fd_set readset; - fd_set writeset; - int i, maxfdp1; - struct charcb *p_charcb; - LWIP_UNUSED_ARG(arg); - - /* First acquire our socket for listening for connections */ - listenfd = socket(AF_INET, SOCK_STREAM, 0); - - LWIP_ASSERT("chargen_thread(): Socket create failed.", listenfd >= 0); - memset(&chargen_saddr, 0, sizeof(chargen_saddr)); - chargen_saddr.sin_family = AF_INET; - chargen_saddr.sin_addr.s_addr = PP_HTONL(INADDR_ANY); - chargen_saddr.sin_port = htons(19); /* Chargen server port */ - - if (bind(listenfd, (struct sockaddr *) &chargen_saddr, sizeof(chargen_saddr)) == -1) - LWIP_ASSERT("chargen_thread(): Socket bind failed.", 0); - - /* Put socket into listening mode */ - if (listen(listenfd, MAX_SERV) == -1) - LWIP_ASSERT("chargen_thread(): Listen failed.", 0); - - - /* Wait forever for network input: This could be connections or data */ - for (;;) - { - maxfdp1 = listenfd+1; - - /* Determine what sockets need to be in readset */ - FD_ZERO(&readset); - FD_ZERO(&writeset); - FD_SET(listenfd, &readset); - for (p_charcb = charcb_list; p_charcb; p_charcb = p_charcb->next) - { - if (maxfdp1 < p_charcb->socket + 1) - maxfdp1 = p_charcb->socket + 1; - FD_SET(p_charcb->socket, &readset); - FD_SET(p_charcb->socket, &writeset); - } - - /* Wait for data or a new connection */ - i = select(maxfdp1, &readset, &writeset, 0, 0); - - if (i == 0) - continue; - /* At least one descriptor is ready */ - if (FD_ISSET(listenfd, &readset)) - { - /* We have a new connection request!!! */ - /* Lets create a new control block */ - p_charcb = (struct charcb *)mem_malloc(sizeof(struct charcb)); - if (p_charcb) - { - p_charcb->socket = accept(listenfd, - (struct sockaddr *) &p_charcb->cliaddr, - &p_charcb->clilen); - if (p_charcb->socket < 0) - mem_free(p_charcb); - else - { - /* Keep this tecb in our list */ - p_charcb->next = charcb_list; - charcb_list = p_charcb; - p_charcb->nextchar = 0x21; - } - } else { - /* No memory to accept connection. Just accept and then close */ - int sock; - struct sockaddr cliaddr; - socklen_t clilen; - - sock = accept(listenfd, &cliaddr, &clilen); - if (sock >= 0) - close(sock); - } - } - /* Go through list of connected clients and process data */ - for (p_charcb = charcb_list; p_charcb; p_charcb = p_charcb->next) - { - if (FD_ISSET(p_charcb->socket, &readset)) - { - /* This socket is ready for reading. This could be because someone typed - * some characters or it could be because the socket is now closed. Try reading - * some data to see. */ - if (do_read(p_charcb) < 0) - break; - } - if (FD_ISSET(p_charcb->socket, &writeset)) - { - char line[80]; - char setchar = p_charcb->nextchar; - - for( i = 0; i < 59; i++) - { - line[i] = setchar; - if (++setchar == 0x7f) - setchar = 0x21; - } - line[i] = 0; - strcat(line, "\n\r"); - if (write(p_charcb->socket, line, strlen(line)) < 0) - { - close_chargen(p_charcb); - break; - } - if (++p_charcb->nextchar == 0x7f) - p_charcb->nextchar = 0x21; - } - - } - } - - -} - -/************************************************************** - * void close_chargen(struct charcb *p_charcb) - * - * Close the socket and remove this charcb from the list. - **************************************************************/ -static void close_chargen(struct charcb *p_charcb) -{ - struct charcb *p_search_charcb; - - /* Either an error or tcp connection closed on other - * end. Close here */ - close(p_charcb->socket); - /* Free charcb */ - if (charcb_list == p_charcb) - charcb_list = p_charcb->next; - else - for (p_search_charcb = charcb_list; p_search_charcb; p_search_charcb = p_search_charcb->next) - { - if (p_search_charcb->next == p_charcb) - { - p_search_charcb->next = p_charcb->next; - break; - } - } - mem_free(p_charcb); -} - - -/************************************************************** - * void do_read(struct charcb *p_charcb) - * - * Socket definitely is ready for reading. Read a buffer from the socket and - * discard the data. If no data is read, then the socket is closed and the - * charcb is removed from the list and freed. - **************************************************************/ -static int do_read(struct charcb *p_charcb) -{ - char buffer[80]; - int readcount; - - /* Read some data */ - readcount = read(p_charcb->socket, &buffer, 80); - if (readcount <= 0) - { - close_chargen(p_charcb); - return -1; - } - return 0; -} - - -/************************************************************** - * void chargen_init(void) - * - * This function initializes the chargen service. This function - * may only be called either before or after tasking has started. - **************************************************************/ -void chargen_init(void) -{ - sys_thread_new( CHARGEN_THREAD_NAME, chargen_thread, 0, CHARGEN_THREAD_STACKSIZE, CHARGEN_PRIORITY); - -} - -#endif /* LWIP_SOCKET */ diff --git a/contrib/apps/chargen/chargen.h b/contrib/apps/chargen/chargen.h deleted file mode 100644 index bea97d0..0000000 --- a/contrib/apps/chargen/chargen.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef LWIP_CHARGEN_H -#define LWIP_CHARGEN_H - -#include "lwip/opt.h" - -#if LWIP_SOCKET - -void chargen_init(void); - -#endif /* LWIP_SOCKET */ - - -#endif /* LWIP_CHARGEN_H */ diff --git a/contrib/apps/httpserver/README b/contrib/apps/httpserver/README deleted file mode 100644 index 1f18bb8..0000000 --- a/contrib/apps/httpserver/README +++ /dev/null @@ -1,12 +0,0 @@ -HTTPSERVER - -This is a demonstration of how to make the most basic kind -of server using lWIP. - -* httpserver-raw.c - uses raw TCP calls (coming soon!) - -* httpserver-netconn.c - uses netconn and netbuf API - -This code updates the examples in Adam Dunkel's original -lwIP documentation to match changes in the code since that -PDF release. diff --git a/contrib/apps/httpserver/httpserver-netconn.c b/contrib/apps/httpserver/httpserver-netconn.c deleted file mode 100644 index 6ffcc5c..0000000 --- a/contrib/apps/httpserver/httpserver-netconn.c +++ /dev/null @@ -1,99 +0,0 @@ - -#include "lwip/opt.h" -#include "lwip/arch.h" -#include "lwip/api.h" - -#include "httpserver-netconn.h" - -#if LWIP_NETCONN - -#ifndef HTTPD_DEBUG -#define HTTPD_DEBUG LWIP_DBG_OFF -#endif - -const static char http_html_hdr[] = "HTTP/1.1 200 OK\r\nContent-type: text/html\r\n\r\n"; -const static char http_index_html[] = "Congrats!

Welcome to our lwIP HTTP server!

This is a small test page, served by httpserver-netconn."; - -/** Serve one HTTP connection accepted in the http thread */ -static void -http_server_netconn_serve(struct netconn *conn) -{ - struct netbuf *inbuf; - char *buf; - u16_t buflen; - err_t err; - - /* Read the data from the port, blocking if nothing yet there. - We assume the request (the part we care about) is in one netbuf */ - err = netconn_recv(conn, &inbuf); - - if (err == ERR_OK) { - netbuf_data(inbuf, (void**)&buf, &buflen); - - /* Is this an HTTP GET command? (only check the first 5 chars, since - there are other formats for GET, and we're keeping it very simple )*/ - if (buflen>=5 && - buf[0]=='G' && - buf[1]=='E' && - buf[2]=='T' && - buf[3]==' ' && - buf[4]=='/' ) { - - /* Send the HTML header - * subtract 1 from the size, since we dont send the \0 in the string - * NETCONN_NOCOPY: our data is const static, so no need to copy it - */ - netconn_write(conn, http_html_hdr, sizeof(http_html_hdr)-1, NETCONN_NOCOPY); - - /* Send our HTML page */ - netconn_write(conn, http_index_html, sizeof(http_index_html)-1, NETCONN_NOCOPY); - } - } - /* Close the connection (server closes in HTTP) */ - netconn_close(conn); - - /* Delete the buffer (netconn_recv gives us ownership, - so we have to make sure to deallocate the buffer) */ - netbuf_delete(inbuf); -} - -/** The main function, never returns! */ -static void -http_server_netconn_thread(void *arg) -{ - struct netconn *conn, *newconn; - err_t err; - LWIP_UNUSED_ARG(arg); - - /* Create a new TCP connection handle */ - conn = netconn_new(NETCONN_TCP); - LWIP_ERROR("http_server: invalid conn", (conn != NULL), return;); - - /* Bind to port 80 (HTTP) with default IP address */ - netconn_bind(conn, NULL, 80); - - /* Put the connection into LISTEN state */ - netconn_listen(conn); - - do { - err = netconn_accept(conn, &newconn); - if (err == ERR_OK) { - http_server_netconn_serve(newconn); - netconn_delete(newconn); - } - } while(err == ERR_OK); - LWIP_DEBUGF(HTTPD_DEBUG, - ("http_server_netconn_thread: netconn_accept received error %d, shutting down", - err)); - netconn_close(conn); - netconn_delete(conn); -} - -/** Initialize the HTTP server (start its thread) */ -void -http_server_netconn_init() -{ - sys_thread_new("http_server_netconn", http_server_netconn_thread, NULL, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO); -} - -#endif /* LWIP_NETCONN*/ diff --git a/contrib/apps/httpserver/httpserver-netconn.h b/contrib/apps/httpserver/httpserver-netconn.h deleted file mode 100644 index 8c44a04..0000000 --- a/contrib/apps/httpserver/httpserver-netconn.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef LWIP_HTTPSERVER_NETCONN_H -#define LWIP_HTTPSERVER_NETCONN_H - -void http_server_netconn_init(); - -#endif /* LWIP_HTTPSERVER_NETCONN_H */ diff --git a/contrib/apps/httpserver_raw/httpd_structs.h b/contrib/apps/httpserver_raw/httpd_structs.h deleted file mode 100644 index cfd1e55..0000000 --- a/contrib/apps/httpserver_raw/httpd_structs.h +++ /dev/null @@ -1,125 +0,0 @@ -#ifndef LWIP_HTTPD_STRUCTS_H -#define LWIP_HTTPD_STRUCTS_H - -#include "httpd.h" - -/** This string is passed in the HTTP header as "Server: " */ -#ifndef HTTPD_SERVER_AGENT -#define HTTPD_SERVER_AGENT "lwIP/1.3.1 (http://savannah.nongnu.org/projects/lwip)" -#endif - -/** Set this to 1 if you want to include code that creates HTTP headers - * at runtime. Default is off: HTTP headers are then created statically - * by the makefsdata tool. Static headers mean smaller code size, but - * the (readonly) fsdata will grow a bit as every file includes the HTTP - * header. */ -#ifndef LWIP_HTTPD_DYNAMIC_HEADERS -#define LWIP_HTTPD_DYNAMIC_HEADERS 0 -#endif - - -#if LWIP_HTTPD_DYNAMIC_HEADERS -/** This struct is used for a list of HTTP header strings for various - * filename extensions. */ -typedef struct -{ - const char *extension; - int headerIndex; -} tHTTPHeader; - -/** A list of strings used in HTTP headers */ -static const char * const g_psHTTPHeaderStrings[] = -{ - "Content-type: text/html\r\n\r\n", - "Content-type: text/html\r\nExpires: Fri, 10 Apr 2008 14:00:00 GMT\r\nPragma: no-cache\r\n\r\n", - "Content-type: image/gif\r\n\r\n", - "Content-type: image/png\r\n\r\n", - "Content-type: image/jpeg\r\n\r\n", - "Content-type: image/bmp\r\n\r\n", - "Content-type: image/x-icon\r\n\r\n", - "Content-type: application/octet-stream\r\n\r\n", - "Content-type: application/x-javascript\r\n\r\n", - "Content-type: application/x-javascript\r\n\r\n", - "Content-type: text/css\r\n\r\n", - "Content-type: application/x-shockwave-flash\r\n\r\n", - "Content-type: text/xml\r\n\r\n", - "Content-type: text/plain\r\n\r\n", - "HTTP/1.0 200 OK\r\n", - "HTTP/1.0 404 File not found\r\n", - "HTTP/1.0 400 Bad Request\r\n", - "HTTP/1.0 501 Not Implemented\r\n", - "HTTP/1.1 200 OK\r\n", - "HTTP/1.1 404 File not found\r\n", - "HTTP/1.1 400 Bad Request\r\n", - "HTTP/1.1 501 Not Implemented\r\n", - "Content-Length: ", - "Connection: Close\r\n", - "Connection: keep-alive\r\n", - "Server: "HTTPD_SERVER_AGENT"\r\n", - "\r\n

404: The requested file cannot be found.

\r\n" -}; - -/* Indexes into the g_psHTTPHeaderStrings array */ -#define HTTP_HDR_HTML 0 /* text/html */ -#define HTTP_HDR_SSI 1 /* text/html Expires... */ -#define HTTP_HDR_GIF 2 /* image/gif */ -#define HTTP_HDR_PNG 3 /* image/png */ -#define HTTP_HDR_JPG 4 /* image/jpeg */ -#define HTTP_HDR_BMP 5 /* image/bmp */ -#define HTTP_HDR_ICO 6 /* image/x-icon */ -#define HTTP_HDR_APP 7 /* application/octet-stream */ -#define HTTP_HDR_JS 8 /* application/x-javascript */ -#define HTTP_HDR_RA 9 /* application/x-javascript */ -#define HTTP_HDR_CSS 10 /* text/css */ -#define HTTP_HDR_SWF 11 /* application/x-shockwave-flash */ -#define HTTP_HDR_XML 12 /* text/xml */ -#define HTTP_HDR_DEFAULT_TYPE 13 /* text/plain */ -#define HTTP_HDR_OK 14 /* 200 OK */ -#define HTTP_HDR_NOT_FOUND 15 /* 404 File not found */ -#define HTTP_HDR_BAD_REQUEST 16 /* 400 Bad request */ -#define HTTP_HDR_NOT_IMPL 17 /* 501 Not Implemented */ -#define HTTP_HDR_OK_11 18 /* 200 OK */ -#define HTTP_HDR_NOT_FOUND_11 19 /* 404 File not found */ -#define HTTP_HDR_BAD_REQUEST_11 20 /* 400 Bad request */ -#define HTTP_HDR_NOT_IMPL_11 21 /* 501 Not Implemented */ -#define HTTP_HDR_CONTENT_LENGTH 22 /* Content-Length: (HTTP 1.1)*/ -#define HTTP_HDR_CONN_CLOSE 23 /* Connection: Close (HTTP 1.1) */ -#define HTTP_HDR_CONN_KEEPALIVE 24 /* Connection: keep-alive (HTTP 1.1) */ -#define HTTP_HDR_SERVER 25 /* Server: HTTPD_SERVER_AGENT */ -#define DEFAULT_404_HTML 26 /* default 404 body */ - -/** A list of extension-to-HTTP header strings */ -const static tHTTPHeader g_psHTTPHeaders[] = -{ - { "html", HTTP_HDR_HTML}, - { "htm", HTTP_HDR_HTML}, - { "shtml",HTTP_HDR_SSI}, - { "shtm", HTTP_HDR_SSI}, - { "ssi", HTTP_HDR_SSI}, - { "gif", HTTP_HDR_GIF}, - { "png", HTTP_HDR_PNG}, - { "jpg", HTTP_HDR_JPG}, - { "bmp", HTTP_HDR_BMP}, - { "ico", HTTP_HDR_ICO}, - { "class",HTTP_HDR_APP}, - { "cls", HTTP_HDR_APP}, - { "js", HTTP_HDR_JS}, - { "ram", HTTP_HDR_RA}, - { "css", HTTP_HDR_CSS}, - { "swf", HTTP_HDR_SWF}, - { "xml", HTTP_HDR_XML}, - { "xsl", HTTP_HDR_XML} -}; - -#define NUM_HTTP_HEADERS (sizeof(g_psHTTPHeaders) / sizeof(tHTTPHeader)) - -#endif /* LWIP_HTTPD_DYNAMIC_HEADERS */ - -#if LWIP_HTTPD_SSI -static const char * const g_pcSSIExtensions[] = { - ".shtml", ".shtm", ".ssi", ".xml" -}; -#define NUM_SHTML_EXTENSIONS (sizeof(g_pcSSIExtensions) / sizeof(const char *)) -#endif /* LWIP_HTTPD_SSI */ - -#endif /* LWIP_HTTPD_STRUCTS_H */ diff --git a/contrib/apps/httpserver_raw/makefsdata/makefsdata.c b/contrib/apps/httpserver_raw/makefsdata/makefsdata.c deleted file mode 100644 index 8e5c551..0000000 --- a/contrib/apps/httpserver_raw/makefsdata/makefsdata.c +++ /dev/null @@ -1,762 +0,0 @@ -/** - * makefsdata: Converts a directory structure for use with the lwIP httpd. - * - * This file is part of the lwIP TCP/IP stack. - * - * Author: Jim Pettinato - * Simon Goldschmidt - * - * @todo: - * - take TCP_MSS, LWIP_TCP_TIMESTAMPS and - * PAYLOAD_ALIGN_TYPE/PAYLOAD_ALIGNMENT as arguments - */ - -#include -#include -#ifdef WIN32 -#define WIN32_LEAN_AND_MEAN -#include "windows.h" -#else -#include -#endif -#include -#include - -/* Compatibility defines Win32 vs. DOS */ -#ifdef WIN32 - -#define FIND_T WIN32_FIND_DATAA -#define FIND_T_FILENAME(fInfo) (fInfo.cFileName) -#define FIND_T_IS_DIR(fInfo) ((fInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0) -#define FIND_T_IS_FILE(fInfo) ((fInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) -#define FIND_RET_T HANDLE -#define FINDFIRST_FILE(path, result) FindFirstFileA(path, result) -#define FINDFIRST_DIR(path, result) FindFirstFileA(path, result) -#define FINDNEXT(ff_res, result) FindNextFileA(ff_res, result) -#define FINDFIRST_SUCCEEDED(ret) (ret != INVALID_HANDLE_VALUE) -#define FINDNEXT_SUCCEEDED(ret) (ret == TRUE) - -#define GETCWD(path, len) GetCurrentDirectoryA(len, path) -#define CHDIR(path) SetCurrentDirectoryA(path) -#define CHDIR_SUCCEEDED(ret) (ret == TRUE) - -#else - -#define FIND_T struct ffblk -#define FIND_T_FILENAME(fInfo) (fInfo.ff_name) -#define FIND_T_IS_DIR(fInfo) ((fInfo.ff_attrib & FA_DIREC) == FA_DIREC) -#define FIND_T_IS_FILE(fInfo) (1) -#define FIND_RET_T int -#define FINDFIRST_FILE(path, result) findfirst(path, result, FA_ARCH) -#define FINDFIRST_DIR(path, result) findfirst(path, result, FA_DIREC) -#define FINDNEXT(ff_res, result) FindNextFileA(ff_res, result) -#define FINDFIRST_SUCCEEDED(ret) (ret == 0) -#define FINDNEXT_SUCCEEDED(ret) (ret == 0) - -#define GETCWD(path, len) getcwd(path, len) -#define CHDIR(path) chdir(path) -#define CHDIR_SUCCEEDED(ret) (ret == 0) - -#endif - -#define NEWLINE "\r\n" -#define NEWLINE_LEN 2 - -/* define this to get the header variables we use to build HTTP headers */ -#define LWIP_HTTPD_DYNAMIC_HEADERS 1 -#define LWIP_HTTPD_SSI 1 -#include "../httpd_structs.h" - -#include "../core/inet_chksum.c" -#include "../core/def.c" - -/** (Your server name here) */ -const char *serverID = "Server: "HTTPD_SERVER_AGENT"\r\n"; - -/* change this to suit your MEM_ALIGNMENT */ -#define PAYLOAD_ALIGNMENT 4 -/* set this to 0 to prevent aligning payload */ -#define ALIGN_PAYLOAD 1 -/* define this to a type that has the required alignment */ -#define PAYLOAD_ALIGN_TYPE "unsigned int" -static int payload_alingment_dummy_counter = 0; - -#define HEX_BYTES_PER_LINE 16 - -#define MAX_PATH_LEN 256 - -#define COPY_BUFSIZE 10240 - -struct file_entry -{ - struct file_entry* next; - const char* filename_c; -}; - -int process_sub(FILE *data_file, FILE *struct_file); -int process_file(FILE *data_file, FILE *struct_file, const char *filename); -int file_write_http_header(FILE *data_file, const char *filename, int file_size, - u16_t *http_hdr_len, u16_t *http_hdr_chksum); -int file_put_ascii(FILE *file, const char *ascii_string, int len, int *i); -int s_put_ascii(char *buf, const char *ascii_string, int len, int *i); -void concat_files(const char *file1, const char *file2, const char *targetfile); -int check_path(char* path, size_t size); - -static unsigned char file_buffer_raw[COPY_BUFSIZE]; -/* 5 bytes per char + 3 bytes per line */ -static char file_buffer_c[COPY_BUFSIZE * 5 + ((COPY_BUFSIZE / HEX_BYTES_PER_LINE) * 3)]; - -char curSubdir[MAX_PATH_LEN]; -char lastFileVar[MAX_PATH_LEN]; -char hdr_buf[4096]; - -unsigned char processSubs = 1; -unsigned char includeHttpHeader = 1; -unsigned char useHttp11 = 0; -unsigned char supportSsi = 1; -unsigned char precalcChksum = 0; - -struct file_entry* first_file = NULL; -struct file_entry* last_file = NULL; - -int main(int argc, char *argv[]) -{ - char path[MAX_PATH_LEN]; - char appPath[MAX_PATH_LEN]; - FILE *data_file; - FILE *struct_file; - int filesProcessed; - int i; - char targetfile[MAX_PATH_LEN]; - strcpy(targetfile, "fsdata.c"); - - memset(path, 0, sizeof(path)); - memset(appPath, 0, sizeof(appPath)); - - printf(NEWLINE " makefsdata - HTML to C source converter" NEWLINE); - printf(" by Jim Pettinato - circa 2003 " NEWLINE); - printf(" extended by Simon Goldschmidt - 2009 " NEWLINE NEWLINE); - - strcpy(path, "fs"); - for(i = 1; i < argc; i++) { - if (argv[i][0] == '-') { - if (strstr(argv[i], "-s")) { - processSubs = 0; - } else if (strstr(argv[i], "-e")) { - includeHttpHeader = 0; - } else if (strstr(argv[i], "-11")) { - useHttp11 = 1; - } else if (strstr(argv[i], "-nossi")) { - supportSsi = 0; - } else if (strstr(argv[i], "-c")) { - precalcChksum = 1; - } else if((argv[i][1] == 'f') && (argv[i][2] == ':')) { - strncpy(targetfile, &argv[i][3], sizeof(targetfile) - 1); - targetfile[sizeof(targetfile) - 1] = 0; - printf("Writing to file \"%s\"\n", targetfile); - } - } else { - strncpy(path, argv[i], sizeof(path)-1); - path[sizeof(path)-1] = 0; - } - } - - if(!check_path(path, sizeof(path))) { - printf("Invalid path: \"%s\"." NEWLINE, path); - exit(-1); - } - - GETCWD(appPath, MAX_PATH_LEN); - /* if command line param or subdir named 'fs' not found spout usage verbiage */ - if (!CHDIR_SUCCEEDED(CHDIR(path))) { - /* if no subdir named 'fs' (or the one which was given) exists, spout usage verbiage */ - printf(" Failed to open directory \"%s\"." NEWLINE NEWLINE, path); - printf(" Usage: htmlgen [targetdir] [-s] [-i] [-f:]" NEWLINE NEWLINE); - printf(" targetdir: relative or absolute path to files to convert" NEWLINE); - printf(" switch -s: toggle processing of subdirectories (default is on)" NEWLINE); - printf(" switch -e: exclude HTTP header from file (header is created at runtime, default is off)" NEWLINE); - printf(" switch -11: include HTTP 1.1 header (1.0 is default)" NEWLINE); - printf(" switch -nossi: no support for SSI (cannot calculate Content-Length for SSI)" NEWLINE); - printf(" switch -c: precalculate checksums for all pages (default is off)" NEWLINE); - printf(" switch -f: target filename (default is \"fsdata.c\")" NEWLINE); - printf(" if targetdir not specified, htmlgen will attempt to" NEWLINE); - printf(" process files in subdirectory 'fs'" NEWLINE); - exit(-1); - } - CHDIR(appPath); - - printf("HTTP %sheader will %s statically included." NEWLINE, - (includeHttpHeader ? (useHttp11 ? "1.1 " : "1.0 ") : ""), - (includeHttpHeader ? "be" : "not be")); - - sprintf(curSubdir, ""); /* start off in web page's root directory - relative paths */ - printf(" Processing all files in directory %s", path); - if (processSubs) { - printf(" and subdirectories..." NEWLINE NEWLINE); - } else { - printf("..." NEWLINE NEWLINE); - } - - data_file = fopen("fsdata.tmp", "wb"); - if (data_file == NULL) { - printf("Failed to create file \"fsdata.tmp\"\n"); - exit(-1); - } - struct_file = fopen("fshdr.tmp", "wb"); - if (struct_file == NULL) { - printf("Failed to create file \"fshdr.tmp\"\n"); - fclose(data_file); - exit(-1); - } - - CHDIR(path); - - fprintf(data_file, "#include \"fs.h\"" NEWLINE); - fprintf(data_file, "#include \"lwip/def.h\"" NEWLINE); - fprintf(data_file, "#include \"fsdata.h\"" NEWLINE NEWLINE NEWLINE); - - fprintf(data_file, "#define file_NULL (struct fsdata_file *) NULL" NEWLINE NEWLINE NEWLINE); - - sprintf(lastFileVar, "NULL"); - - filesProcessed = process_sub(data_file, struct_file); - - /* data_file now contains all of the raw data.. now append linked list of - * file header structs to allow embedded app to search for a file name */ - fprintf(data_file, NEWLINE NEWLINE); - fprintf(struct_file, "#define FS_ROOT file_%s" NEWLINE, lastFileVar); - fprintf(struct_file, "#define FS_NUMFILES %d" NEWLINE NEWLINE, filesProcessed); - - fclose(data_file); - fclose(struct_file); - - CHDIR(appPath); - /* append struct_file to data_file */ - printf(NEWLINE "Creating target file..." NEWLINE NEWLINE); - concat_files("fsdata.tmp", "fshdr.tmp", targetfile); - - /* if succeeded, delete the temporary files */ - if (remove("fsdata.tmp") != 0) { - printf("Warning: failed to delete fsdata.tmp\n"); - } - if (remove("fshdr.tmp") != 0) { - printf("Warning: failed to delete fshdr.tmp\n"); - } - - printf(NEWLINE "Processed %d files - done." NEWLINE NEWLINE, filesProcessed); - - while (first_file != NULL) { - struct file_entry* fe = first_file; - first_file = fe->next; - free(fe); - } - - return 0; -} - -int check_path(char* path, size_t size) -{ - size_t slen; - if (path[0] == 0) { - /* empty */ - return 0; - } - slen = strlen(path); - if (slen >= size) { - /* not NULL-terminated */ - return 0; - } - while ((slen > 0) && ((path[slen] == '\\') || (path[slen] == '/'))) { - /* path should not end with trailing backslash */ - path[slen] = 0; - slen--; - } - if (slen == 0) { - return 0; - } - return 1; -} - -static void copy_file(const char *filename_in, FILE *fout) -{ - FILE *fin; - size_t len; - fin = fopen(filename_in, "rb"); - if (fin == NULL) { - printf("Failed to open file \"%s\"\n", filename_in); - exit(-1); - } - - while((len = fread(file_buffer_raw, 1, COPY_BUFSIZE, fin)) > 0) - { - fwrite(file_buffer_raw, 1, len, fout); - } - fclose(fin); -} - -void concat_files(const char *file1, const char *file2, const char *targetfile) -{ - FILE *fout; - fout = fopen(targetfile, "wb"); - if (fout == NULL) { - printf("Failed to open file \"%s\"\n", targetfile); - exit(-1); - } - copy_file(file1, fout); - copy_file(file2, fout); - fclose(fout); -} - -int process_sub(FILE *data_file, FILE *struct_file) -{ - FIND_T fInfo; - FIND_RET_T fret; - int filesProcessed = 0; - - if (processSubs) { - /* process subs recursively */ - size_t sublen = strlen(curSubdir); - size_t freelen = sizeof(curSubdir) - sublen - 1; - LWIP_ASSERT("sublen < sizeof(curSubdir)", sublen < sizeof(curSubdir)); - fret = FINDFIRST_DIR("*", &fInfo); - if (FINDFIRST_SUCCEEDED(fret)) { - do { - const char *curName = FIND_T_FILENAME(fInfo); - if ((curName[0] == '.') || (strcmp(curName, "CVS") == 0)) { - continue; - } - if (!FIND_T_IS_DIR(fInfo)) { - continue; - } - if (freelen > 0) { - CHDIR(curName); - strncat(curSubdir, "/", freelen); - strncat(curSubdir, curName, freelen - 1); - curSubdir[sizeof(curSubdir) - 1] = 0; - printf(NEWLINE "processing subdirectory %s/..." NEWLINE, curSubdir); - filesProcessed += process_sub(data_file, struct_file); - CHDIR(".."); - curSubdir[sublen] = 0; - } else { - printf("WARNING: cannot process sub due to path length restrictions: \"%s/%s\"\n", curSubdir, curName); - } - } while (FINDNEXT_SUCCEEDED(FINDNEXT(fret, &fInfo))); - } - } - - fret = FINDFIRST_FILE("*.*", &fInfo); - if (FINDFIRST_SUCCEEDED(fret)) { - /* at least one file in directory */ - do { - if (FIND_T_IS_FILE(fInfo)) { - const char *curName = FIND_T_FILENAME(fInfo); - printf("processing %s/%s..." NEWLINE, curSubdir, curName); - if (process_file(data_file, struct_file, curName) < 0) { - printf(NEWLINE "Error... aborting" NEWLINE); - return -1; - } - filesProcessed++; - } - } while (FINDNEXT_SUCCEEDED(FINDNEXT(fret, &fInfo))); - } - return filesProcessed; -} - -int get_file_size(const char* filename) -{ - FILE *inFile; - int file_size = -1; - inFile = fopen(filename, "rb"); - if (inFile == NULL) { - printf("Failed to open file \"%s\"\n", filename); - exit(-1); - } - fseek(inFile, 0, SEEK_END); - file_size = ftell(inFile); - fclose(inFile); - return file_size; -} - -void process_file_data(const char *filename, FILE *data_file) -{ - FILE *source_file; - size_t len, written, i, src_off=0; - - source_file = fopen(filename, "rb"); - if (source_file == NULL) { - printf("Failed to open file \"%s\"\n", filename); - exit(-1); - } - - do { - size_t off = 0; - len = fread(file_buffer_raw, 1, COPY_BUFSIZE, source_file); - if (len > 0) { - for (i = 0; i < len; i++) { - sprintf(&file_buffer_c[off], "0x%02.2x,", file_buffer_raw[i]); - off += 5; - if ((++src_off % HEX_BYTES_PER_LINE) == 0) { - memcpy(&file_buffer_c[off], NEWLINE, NEWLINE_LEN); - off += NEWLINE_LEN; - } - } - written = fwrite(file_buffer_c, 1, off, data_file); - } - } while(len > 0); - fclose(source_file); -} - -int write_checksums(FILE *struct_file, const char *filename, const char *varname, - u16_t hdr_len, u16_t hdr_chksum) -{ - int chunk_size = TCP_MSS; - int offset; - size_t len; - int i = 0; - FILE *f; -#if LWIP_TCP_TIMESTAMPS - /* when timestamps are used, usable space is 12 bytes less per segment */ - chunk_size -= 12; -#endif - - fprintf(struct_file, "#if HTTPD_PRECALCULATED_CHECKSUM" NEWLINE); - fprintf(struct_file, "const struct fsdata_chksum chksums_%s[] = {" NEWLINE, varname); - - memset(file_buffer_raw, 0xab, sizeof(file_buffer_raw)); - f = fopen(filename, "rb"); - if (f == NULL) { - printf("Failed to open file \"%s\"\n", filename); - exit(-1); - } - if (hdr_len > 0) { - /* add checksum for HTTP header */ - fprintf(struct_file, "{%d, 0x%04x, %d}," NEWLINE, 0, hdr_chksum, hdr_len); - i++; - } - for (offset = hdr_len; ; offset += len) { - unsigned short chksum; - len = fread(file_buffer_raw, 1, chunk_size, f); - if (len == 0) { - break; - } - chksum = ~inet_chksum(file_buffer_raw, (u16_t)len); - /* add checksum for data */ - fprintf(struct_file, "{%d, 0x%04x, %d}," NEWLINE, offset, chksum, len); - i++; - } - fclose(f); - fprintf(struct_file, "};" NEWLINE); - fprintf(struct_file, "#endif /* HTTPD_PRECALCULATED_CHECKSUM */" NEWLINE); - return i; -} - -static int is_valid_char_for_c_var(char x) -{ - if (((x >= 'A') && (x <= 'Z')) || - ((x >= 'a') && (x <= 'z')) || - ((x >= '0') && (x <= '9')) || - (x == '_')) - { - return 1; - } - return 0; -} - -static void fix_filename_for_c(char* qualifiedName, size_t max_len) -{ - struct file_entry* f; - size_t len = strlen(qualifiedName); - char *new_name = malloc(len + 2); - int filename_ok; - int cnt = 0; - size_t i; - if (len + 3 == max_len) { - printf("File name too long: \"%s\"\n", qualifiedName); - exit(-1); - } - strcpy(new_name, qualifiedName); - for (i = 0; i < len; i++) { - if (!is_valid_char_for_c_var(new_name[i])) { - new_name[i] = '_'; - } - } - do { - filename_ok = 1; - for (f = first_file; f != NULL; f = f->next) { - if (!strcmp(f->filename_c, new_name)) { - filename_ok = 0; - cnt++; - // try next unique file name - sprintf(&new_name[len], "%d", cnt); - break; - } - } - } while (!filename_ok && (cnt < 999)); - if (!filename_ok) { - printf("Failed to get unique file name: \"%s\"\n", qualifiedName); - exit(-1); - } - strcpy(qualifiedName, new_name); - free(new_name); -} - -static void register_filename(const char* qualifiedName) -{ - struct file_entry* fe = malloc(sizeof(struct file_entry)); - fe->filename_c = strdup(qualifiedName); - fe->next = NULL; - if (first_file == NULL) { - first_file = last_file = fe; - } else { - last_file->next = fe; - last_file = fe; - } -} - -int process_file(FILE *data_file, FILE *struct_file, const char *filename) -{ - char varname[MAX_PATH_LEN]; - int i = 0; - char qualifiedName[MAX_PATH_LEN]; - int file_size; - u16_t http_hdr_chksum = 0; - u16_t http_hdr_len = 0; - int chksum_count = 0; - - /* create qualified name (TODO: prepend slash or not?) */ - sprintf(qualifiedName,"%s/%s", curSubdir, filename); - /* create C variable name */ - strcpy(varname, qualifiedName); - /* convert slashes & dots to underscores */ - fix_filename_for_c(varname, MAX_PATH_LEN); - register_filename(varname); -#if ALIGN_PAYLOAD - /* to force even alignment of array */ - fprintf(data_file, "static const " PAYLOAD_ALIGN_TYPE " dummy_align_%s = %d;" NEWLINE, varname, payload_alingment_dummy_counter++); -#endif /* ALIGN_PAYLOAD */ - fprintf(data_file, "static const unsigned char data_%s[] = {" NEWLINE, varname); - /* encode source file name (used by file system, not returned to browser) */ - fprintf(data_file, "/* %s (%d chars) */" NEWLINE, qualifiedName, strlen(qualifiedName)+1); - file_put_ascii(data_file, qualifiedName, strlen(qualifiedName)+1, &i); -#if ALIGN_PAYLOAD - /* pad to even number of bytes to assure payload is on aligned boundary */ - while(i % PAYLOAD_ALIGNMENT != 0) { - fprintf(data_file, "0x%02.2x,", 0); - i++; - } -#endif /* ALIGN_PAYLOAD */ - fprintf(data_file, NEWLINE); - - file_size = get_file_size(filename); - if (includeHttpHeader) { - file_write_http_header(data_file, filename, file_size, &http_hdr_len, &http_hdr_chksum); - } - if (precalcChksum) { - chksum_count = write_checksums(struct_file, filename, varname, http_hdr_len, http_hdr_chksum); - } - - /* build declaration of struct fsdata_file in temp file */ - fprintf(struct_file, "const struct fsdata_file file_%s[] = { {" NEWLINE, varname); - fprintf(struct_file, "file_%s," NEWLINE, lastFileVar); - fprintf(struct_file, "data_%s," NEWLINE, varname); - fprintf(struct_file, "data_%s + %d," NEWLINE, varname, i); - fprintf(struct_file, "sizeof(data_%s) - %d," NEWLINE, varname, i); - fprintf(struct_file, "%d," NEWLINE, includeHttpHeader); - if (precalcChksum) { - fprintf(struct_file, "#if HTTPD_PRECALCULATED_CHECKSUM" NEWLINE); - fprintf(struct_file, "%d, chksums_%s," NEWLINE, chksum_count, varname); - fprintf(struct_file, "#endif /* HTTPD_PRECALCULATED_CHECKSUM */" NEWLINE); - } - fprintf(struct_file, "}};" NEWLINE NEWLINE); - strcpy(lastFileVar, varname); - - /* write actual file contents */ - i = 0; - fprintf(data_file, NEWLINE "/* raw file data (%d bytes) */" NEWLINE, file_size); - process_file_data(filename, data_file); - fprintf(data_file, "};" NEWLINE NEWLINE); - - return 0; -} - -int file_write_http_header(FILE *data_file, const char *filename, int file_size, - u16_t *http_hdr_len, u16_t *http_hdr_chksum) -{ - int i = 0; - int response_type = HTTP_HDR_OK; - int file_type = HTTP_HDR_DEFAULT_TYPE; - const char *cur_string; - size_t cur_len; - int written = 0; - size_t hdr_len = 0; - u16_t acc; - const char *file_ext; - int j; - u8_t keepalive = useHttp11; - - if (keepalive) { - size_t loop; - for (loop = 0; loop < NUM_SHTML_EXTENSIONS; loop++) { - if (strstr(filename, g_pcSSIExtensions[loop])) { - /* no keepalive connection for SSI files */ - keepalive = 0; - } - } - } - - memset(hdr_buf, 0, sizeof(hdr_buf)); - - if (useHttp11) { - response_type = HTTP_HDR_OK_11; - } - - fprintf(data_file, NEWLINE "/* HTTP header */"); - if (strstr(filename, "404") == filename) { - response_type = HTTP_HDR_NOT_FOUND; - if (useHttp11) { - response_type = HTTP_HDR_NOT_FOUND_11; - } - } else if (strstr(filename, "400") == filename) { - response_type = HTTP_HDR_BAD_REQUEST; - if (useHttp11) { - response_type = HTTP_HDR_BAD_REQUEST_11; - } - } else if (strstr(filename, "501") == filename) { - response_type = HTTP_HDR_NOT_IMPL; - if (useHttp11) { - response_type = HTTP_HDR_NOT_IMPL_11; - } - } - cur_string = g_psHTTPHeaderStrings[response_type]; - cur_len = strlen(cur_string); - fprintf(data_file, NEWLINE "/* \"%s\" (%d bytes) */" NEWLINE, cur_string, cur_len); - written += file_put_ascii(data_file, cur_string, cur_len, &i); - i = 0; - if (precalcChksum) { - memcpy(&hdr_buf[hdr_len], cur_string, cur_len); - hdr_len += cur_len; - } - - cur_string = serverID; - cur_len = strlen(cur_string); - fprintf(data_file, NEWLINE "/* \"%s\" (%d bytes) */" NEWLINE, cur_string, cur_len); - written += file_put_ascii(data_file, cur_string, cur_len, &i); - i = 0; - if (precalcChksum) { - memcpy(&hdr_buf[hdr_len], cur_string, cur_len); - hdr_len += cur_len; - } - - file_ext = filename; - if (file_ext != NULL) { - while(strstr(file_ext, ".") != NULL) { - file_ext = strstr(file_ext, "."); - file_ext++; - } - } - if((file_ext == NULL) || (*file_ext == 0)) { - printf("failed to get extension for file \"%s\", using default.\n", filename); - } else { - for(j = 0; j < NUM_HTTP_HEADERS; j++) { - if(!strcmp(file_ext, g_psHTTPHeaders[j].extension)) { - file_type = g_psHTTPHeaders[j].headerIndex; - break; - } - } - if (j >= NUM_HTTP_HEADERS) { - printf("failed to get file type for extension \"%s\", using default.\n", file_ext); - file_type = HTTP_HDR_DEFAULT_TYPE; - } - } - - if (useHttp11) { - char intbuf[MAX_PATH_LEN]; - int content_len = file_size; - memset(intbuf, 0, sizeof(intbuf)); - - if (!keepalive) { - content_len *= 2; - } - { - cur_string = g_psHTTPHeaderStrings[HTTP_HDR_CONTENT_LENGTH]; - cur_len = strlen(cur_string); - fprintf(data_file, NEWLINE "/* \"%s%d\r\n\" (%d+ bytes) */" NEWLINE, cur_string, content_len, cur_len+2); - written += file_put_ascii(data_file, cur_string, cur_len, &i); - if (precalcChksum) { - memcpy(&hdr_buf[hdr_len], cur_string, cur_len); - hdr_len += cur_len; - } - - _itoa(content_len, intbuf, 10); - strcat(intbuf, "\r\n"); - cur_len = strlen(intbuf); - written += file_put_ascii(data_file, intbuf, cur_len, &i); - i = 0; - if (precalcChksum) { - memcpy(&hdr_buf[hdr_len], intbuf, cur_len); - hdr_len += cur_len; - } - } - - if (keepalive) { - cur_string = g_psHTTPHeaderStrings[HTTP_HDR_CONN_KEEPALIVE]; - } else { - cur_string = g_psHTTPHeaderStrings[HTTP_HDR_CONN_CLOSE]; - } - cur_len = strlen(cur_string); - fprintf(data_file, NEWLINE "/* \"%s\" (%d bytes) */" NEWLINE, cur_string, cur_len); - written += file_put_ascii(data_file, cur_string, cur_len, &i); - i = 0; - if (precalcChksum) { - memcpy(&hdr_buf[hdr_len], cur_string, cur_len); - hdr_len += cur_len; - } - } - - cur_string = g_psHTTPHeaderStrings[file_type]; - cur_len = strlen(cur_string); - fprintf(data_file, NEWLINE "/* \"%s\" (%d bytes) */" NEWLINE, cur_string, cur_len); - written += file_put_ascii(data_file, cur_string, cur_len, &i); - i = 0; - if (precalcChksum) { - memcpy(&hdr_buf[hdr_len], cur_string, cur_len); - hdr_len += cur_len; - - LWIP_ASSERT("hdr_len <= 0xffff", hdr_len <= 0xffff); - LWIP_ASSERT("strlen(hdr_buf) == hdr_len", strlen(hdr_buf) == hdr_len); - acc = ~inet_chksum(hdr_buf, (u16_t)hdr_len); - *http_hdr_len = (u16_t)hdr_len; - *http_hdr_chksum = acc; - } - - return written; -} - -int file_put_ascii(FILE *file, const char* ascii_string, int len, int *i) -{ - int x; - for(x = 0; x < len; x++) { - unsigned char cur = ascii_string[x]; - fprintf(file, "0x%02.2x,", cur); - if ((++(*i) % HEX_BYTES_PER_LINE) == 0) { - fprintf(file, NEWLINE); - } - } - return len; -} - -int s_put_ascii(char *buf, const char *ascii_string, int len, int *i) -{ - int x; - int idx = 0; - for(x = 0; x < len; x++) { - unsigned char cur = ascii_string[x]; - sprintf(&buf[idx], "0x%02.2x,", cur); - idx += 5; - if ((++(*i) % HEX_BYTES_PER_LINE) == 0) { - sprintf(&buf[idx], NEWLINE); - idx += NEWLINE_LEN; - } - } - return len; -} diff --git a/contrib/apps/netbios/netbios.c b/contrib/apps/netbios/netbios.c deleted file mode 100644 index 54547b5..0000000 --- a/contrib/apps/netbios/netbios.c +++ /dev/null @@ -1,337 +0,0 @@ -/** - * @file - * NetBIOS name service sample - * - */ - -/* - * 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. - * - */ - -#include "lwip/opt.h" - -#if LWIP_UDP /* don't build if not configured for use in lwipopts.h */ - -#include "lwip/udp.h" -#include "lwip/netif.h" - -#include - -/** This is an example implementation of a NetBIOS name server. - * It responds to name queries for a configurable name. - * Name resolving is not supported. - * - * Note that the device doesn't broadcast it's own name so can't - * detect duplicate names! - */ - -/** NetBIOS name of LWIP device - * This must be uppercase until NETBIOS_STRCMP() is defined to a string - * comparision function that is case insensitive. - * If you want to use the netif's hostname, use this (with LWIP_NETIF_HOSTNAME): - * (ip_current_netif() != NULL ? ip_current_netif()->hostname != NULL ? ip_current_netif()->hostname : "" : "") - */ -#ifndef NETBIOS_LWIP_NAME -#define NETBIOS_LWIP_NAME "NETBIOSLWIPDEV" -#endif - -/** Since there's no standard function for case-insensitive string comparision, - * we need another define here: - * define this to stricmp() for windows or strcasecmp() for linux. - * If not defined, comparision is case sensitive and NETBIOS_LWIP_NAME must be - * uppercase - */ -#ifndef NETBIOS_STRCMP -#define NETBIOS_STRCMP(str1, str2) strcmp(str1, str2) -#endif - -/** default port number for "NetBIOS Name service */ -#define NETBIOS_PORT 137 - -/** size of a NetBIOS name */ -#define NETBIOS_NAME_LEN 16 - -/** The Time-To-Live for NetBIOS name responds (in seconds) - * Default is 300000 seconds (3 days, 11 hours, 20 minutes) */ -#define NETBIOS_NAME_TTL 300000 - -/** NetBIOS header flags */ -#define NETB_HFLAG_RESPONSE 0x8000U -#define NETB_HFLAG_OPCODE 0x7800U -#define NETB_HFLAG_OPCODE_NAME_QUERY 0x0000U -#define NETB_HFLAG_AUTHORATIVE 0x0400U -#define NETB_HFLAG_TRUNCATED 0x0200U -#define NETB_HFLAG_RECURS_DESIRED 0x0100U -#define NETB_HFLAG_RECURS_AVAILABLE 0x0080U -#define NETB_HFLAG_BROADCAST 0x0010U -#define NETB_HFLAG_REPLYCODE 0x0008U -#define NETB_HFLAG_REPLYCODE_NOERROR 0x0000U - -/** NetBIOS name flags */ -#define NETB_NFLAG_UNIQUE 0x8000U -#define NETB_NFLAG_NODETYPE 0x6000U -#define NETB_NFLAG_NODETYPE_HNODE 0x6000U -#define NETB_NFLAG_NODETYPE_MNODE 0x4000U -#define NETB_NFLAG_NODETYPE_PNODE 0x2000U -#define NETB_NFLAG_NODETYPE_BNODE 0x0000U - -/** NetBIOS message header */ -#ifdef PACK_STRUCT_USE_INCLUDES -# include "arch/bpstruct.h" -#endif -PACK_STRUCT_BEGIN -struct netbios_hdr { - PACK_STRUCT_FIELD(u16_t trans_id); - PACK_STRUCT_FIELD(u16_t flags); - PACK_STRUCT_FIELD(u16_t questions); - PACK_STRUCT_FIELD(u16_t answerRRs); - PACK_STRUCT_FIELD(u16_t authorityRRs); - PACK_STRUCT_FIELD(u16_t additionalRRs); -} PACK_STRUCT_STRUCT; -PACK_STRUCT_END -#ifdef PACK_STRUCT_USE_INCLUDES -# include "arch/epstruct.h" -#endif - -/** NetBIOS message name part */ -#ifdef PACK_STRUCT_USE_INCLUDES -# include "arch/bpstruct.h" -#endif -PACK_STRUCT_BEGIN -struct netbios_name_hdr { - PACK_STRUCT_FIELD(u8_t nametype); - PACK_STRUCT_FIELD(u8_t encname[(NETBIOS_NAME_LEN*2)+1]); - PACK_STRUCT_FIELD(u16_t type); - PACK_STRUCT_FIELD(u16_t cls); - PACK_STRUCT_FIELD(u32_t ttl); - PACK_STRUCT_FIELD(u16_t datalen); - PACK_STRUCT_FIELD(u16_t flags); - PACK_STRUCT_FIELD(ip_addr_p_t addr); -} PACK_STRUCT_STRUCT; -PACK_STRUCT_END -#ifdef PACK_STRUCT_USE_INCLUDES -# include "arch/epstruct.h" -#endif - -/** NetBIOS message */ -#ifdef PACK_STRUCT_USE_INCLUDES -# include "arch/bpstruct.h" -#endif -PACK_STRUCT_BEGIN -struct netbios_resp -{ - struct netbios_hdr resp_hdr; - struct netbios_name_hdr resp_name; -} PACK_STRUCT_STRUCT; -PACK_STRUCT_END -#ifdef PACK_STRUCT_USE_INCLUDES -# include "arch/epstruct.h" -#endif - -/** NetBIOS decoding name */ -static int -netbios_name_decoding( char *name_enc, char *name_dec, int name_dec_len) -{ - char *pname; - char cname; - char cnbname; - int index = 0; - - LWIP_UNUSED_ARG(name_dec_len); - - /* Start decoding netbios name. */ - pname = name_enc; - for (;;) { - /* Every two characters of the first level-encoded name - * turn into one character in the decoded name. */ - cname = *pname; - if (cname == '\0') - break; /* no more characters */ - if (cname == '.') - break; /* scope ID follows */ - if (cname < 'A' || cname > 'Z') { - /* Not legal. */ - return -1; - } - cname -= 'A'; - cnbname = cname << 4; - pname++; - - cname = *pname; - if (cname == '\0' || cname == '.') { - /* No more characters in the name - but we're in - * the middle of a pair. Not legal. */ - return -1; - } - if (cname < 'A' || cname > 'Z') { - /* Not legal. */ - return -1; - } - cname -= 'A'; - cnbname |= cname; - pname++; - - /* Do we have room to store the character? */ - if (index < NETBIOS_NAME_LEN) { - /* Yes - store the character. */ - name_dec[index++] = (cnbname!=' '?cnbname:'\0'); - } - } - - return 0; -} - -#if 0 /* function currently unused */ -/** NetBIOS encoding name */ -static int -netbios_name_encoding(char *name_enc, char *name_dec, int name_dec_len) -{ - char *pname; - char cname; - unsigned char ucname; - int index = 0; - - /* Start encoding netbios name. */ - pname = name_enc; - - for (;;) { - /* Every two characters of the first level-encoded name - * turn into one character in the decoded name. */ - cname = *pname; - if (cname == '\0') - break; /* no more characters */ - if (cname == '.') - break; /* scope ID follows */ - if ((cname < 'A' || cname > 'Z') && (cname < '0' || cname > '9')) { - /* Not legal. */ - return -1; - } - - /* Do we have room to store the character? */ - if (index >= name_dec_len) { - return -1; - } - - /* Yes - store the character. */ - ucname = cname; - name_dec[index++] = ('A'+((ucname>>4) & 0x0F)); - name_dec[index++] = ('A'+( ucname & 0x0F)); - pname++; - } - - /* Fill with "space" coding */ - for (;indexpayload; - struct netbios_name_hdr* netbios_name_hdr = (struct netbios_name_hdr*)(netbios_hdr+1); - - /* we only answer if we got a default interface */ - if (netif_default != NULL) { - /* @todo: do we need to check answerRRs/authorityRRs/additionalRRs? */ - /* if the packet is a NetBIOS name query question */ - if (((netbios_hdr->flags & PP_NTOHS(NETB_HFLAG_OPCODE)) == PP_NTOHS(NETB_HFLAG_OPCODE_NAME_QUERY)) && - ((netbios_hdr->flags & PP_NTOHS(NETB_HFLAG_RESPONSE)) == 0) && - (netbios_hdr->questions == PP_NTOHS(1))) { - /* decode the NetBIOS name */ - netbios_name_decoding( (char*)(netbios_name_hdr->encname), netbios_name, sizeof(netbios_name)); - /* if the packet is for us */ - if (NETBIOS_STRCMP(netbios_name, NETBIOS_LWIP_NAME) == 0) { - struct pbuf *q; - struct netbios_resp *resp; - - q = pbuf_alloc(PBUF_TRANSPORT, sizeof(struct netbios_resp), PBUF_RAM); - if (q != NULL) { - resp = (struct netbios_resp*)q->payload; - - /* prepare NetBIOS header response */ - resp->resp_hdr.trans_id = netbios_hdr->trans_id; - resp->resp_hdr.flags = PP_HTONS(NETB_HFLAG_RESPONSE | - NETB_HFLAG_OPCODE_NAME_QUERY | - NETB_HFLAG_AUTHORATIVE | - NETB_HFLAG_RECURS_DESIRED); - resp->resp_hdr.questions = 0; - resp->resp_hdr.answerRRs = PP_HTONS(1); - resp->resp_hdr.authorityRRs = 0; - resp->resp_hdr.additionalRRs = 0; - - /* prepare NetBIOS header datas */ - MEMCPY( resp->resp_name.encname, netbios_name_hdr->encname, sizeof(netbios_name_hdr->encname)); - resp->resp_name.nametype = netbios_name_hdr->nametype; - resp->resp_name.type = netbios_name_hdr->type; - resp->resp_name.cls = netbios_name_hdr->cls; - resp->resp_name.ttl = PP_HTONL(NETBIOS_NAME_TTL); - resp->resp_name.datalen = PP_HTONS(sizeof(resp->resp_name.flags)+sizeof(resp->resp_name.addr)); - resp->resp_name.flags = PP_HTONS(NETB_NFLAG_NODETYPE_BNODE); - ip_addr_copy(resp->resp_name.addr, netif_default->ip_addr); - - /* send the NetBIOS response */ - udp_sendto(upcb, q, addr, port); - - /* free the "reference" pbuf */ - pbuf_free(q); - } - } - } - } - /* free the pbuf */ - pbuf_free(p); - } -} - -void netbios_init(void) -{ - struct udp_pcb *pcb; - - LWIP_ASSERT("NetBIOS name is too long!", strlen(NETBIOS_LWIP_NAME) < NETBIOS_NAME_LEN); - - pcb = udp_new(); - if (pcb != NULL) { - /* we have to be allowed to send broadcast packets! */ - pcb->so_options |= SOF_BROADCAST; - udp_bind(pcb, IP_ADDR_ANY, NETBIOS_PORT); - udp_recv(pcb, netbios_recv, pcb); - } -} -#endif /* LWIP_UDP */ diff --git a/contrib/apps/netbios/netbios.h b/contrib/apps/netbios/netbios.h deleted file mode 100644 index 878cd03..0000000 --- a/contrib/apps/netbios/netbios.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef LWIP_NETBIOS_H -#define LWIP_NETBIOS_H - -void netbios_init(void); - -#endif /* LWIP_NETBIOS_H */ diff --git a/contrib/apps/netio/netio.c b/contrib/apps/netio/netio.c deleted file mode 100644 index 3879e40..0000000 --- a/contrib/apps/netio/netio.c +++ /dev/null @@ -1,51 +0,0 @@ -#include "netio.h" - -#include "lwip/opt.h" -#include "lwip/tcp.h" - -/* See http://www.nwlab.net/art/netio/netio.html to get the netio tool */ - -#if LWIP_TCP -static err_t netio_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err) -{ - - LWIP_UNUSED_ARG(arg); - - 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) -{ - LWIP_UNUSED_ARG(arg); - LWIP_UNUSED_ARG(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); -} -#endif /* LWIP_TCP */ diff --git a/contrib/apps/netio/netio.h b/contrib/apps/netio/netio.h deleted file mode 100644 index 11d7730..0000000 --- a/contrib/apps/netio/netio.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef LWIP_NETIO_H -#define LWIP_NETIO_H - -void netio_init(void); - -#endif /* LWIP_NETIO_H */ diff --git a/contrib/apps/ping/ping.c b/contrib/apps/ping/ping.c deleted file mode 100644 index 20f16b0..0000000 --- a/contrib/apps/ping/ping.c +++ /dev/null @@ -1,331 +0,0 @@ -/** - * @file - * Ping sender module - * - */ - -/* - * 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. - * - */ - -/** - * This is an example of a "ping" sender (with raw API and socket API). - * It can be used as a start point to maintain opened a network connection, or - * like a network "watchdog" for your device. - * - */ - -#include "lwip/opt.h" - -#if LWIP_RAW /* don't build if not configured for use in lwipopts.h */ - -#include "ping.h" - -#include "lwip/mem.h" -#include "lwip/raw.h" -#include "lwip/icmp.h" -#include "lwip/netif.h" -#include "lwip/sys.h" -#include "lwip/timers.h" -#include "lwip/inet_chksum.h" - -#if PING_USE_SOCKETS -#include "lwip/sockets.h" -#include "lwip/inet.h" -#endif /* PING_USE_SOCKETS */ - - -/** - * PING_DEBUG: Enable debugging for PING. - */ -#ifndef PING_DEBUG -#define PING_DEBUG LWIP_DBG_ON -#endif - -/** ping target - should be a "ip_addr_t" */ -#ifndef PING_TARGET -#define PING_TARGET (netif_default?netif_default->gw:ip_addr_any) -#endif - -/** ping receive timeout - in milliseconds */ -#ifndef PING_RCV_TIMEO -#define PING_RCV_TIMEO 1000 -#endif - -/** ping delay - in milliseconds */ -#ifndef PING_DELAY -#define PING_DELAY 1000 -#endif - -/** ping identifier - must fit on a u16_t */ -#ifndef PING_ID -#define PING_ID 0xAFAF -#endif - -/** ping additional data size to include in the packet */ -#ifndef PING_DATA_SIZE -#define PING_DATA_SIZE 32 -#endif - -/** ping result action - no default action */ -#ifndef PING_RESULT -#define PING_RESULT(ping_ok) -#endif - -/* ping variables */ -static u16_t ping_seq_num; -static u32_t ping_time; -#if !PING_USE_SOCKETS -static struct raw_pcb *ping_pcb; -#endif /* PING_USE_SOCKETS */ - -/** Prepare a echo ICMP request */ -static void -ping_prepare_echo( struct icmp_echo_hdr *iecho, u16_t len) -{ - size_t i; - size_t data_len = len - sizeof(struct icmp_echo_hdr); - - ICMPH_TYPE_SET(iecho, ICMP_ECHO); - ICMPH_CODE_SET(iecho, 0); - iecho->chksum = 0; - iecho->id = PING_ID; - iecho->seqno = htons(++ping_seq_num); - - /* fill the additional data buffer with some data */ - for(i = 0; i < data_len; i++) { - ((char*)iecho)[sizeof(struct icmp_echo_hdr) + i] = (char)i; - } - - iecho->chksum = inet_chksum(iecho, len); -} - -#if PING_USE_SOCKETS - -/* Ping using the socket ip */ -static err_t -ping_send(int s, ip_addr_t *addr) -{ - int err; - struct icmp_echo_hdr *iecho; - struct sockaddr_in to; - size_t ping_size = sizeof(struct icmp_echo_hdr) + PING_DATA_SIZE; - LWIP_ASSERT("ping_size is too big", ping_size <= 0xffff); - - iecho = (struct icmp_echo_hdr *)mem_malloc((mem_size_t)ping_size); - if (!iecho) { - return ERR_MEM; - } - - ping_prepare_echo(iecho, (u16_t)ping_size); - - to.sin_len = sizeof(to); - to.sin_family = AF_INET; - inet_addr_from_ipaddr(&to.sin_addr, addr); - - err = lwip_sendto(s, iecho, ping_size, 0, (struct sockaddr*)&to, sizeof(to)); - - mem_free(iecho); - - return (err ? ERR_OK : ERR_VAL); -} - -static void -ping_recv(int s) -{ - char buf[64]; - int fromlen, len; - struct sockaddr_in from; - struct ip_hdr *iphdr; - struct icmp_echo_hdr *iecho; - - while((len = lwip_recvfrom(s, buf, sizeof(buf), 0, (struct sockaddr*)&from, (socklen_t*)&fromlen)) > 0) { - if (len >= (int)(sizeof(struct ip_hdr)+sizeof(struct icmp_echo_hdr))) { - ip_addr_t fromaddr; - inet_addr_to_ipaddr(&fromaddr, &from.sin_addr); - LWIP_DEBUGF( PING_DEBUG, ("ping: recv ")); - ip_addr_debug_print(PING_DEBUG, &fromaddr); - LWIP_DEBUGF( PING_DEBUG, (" %"U32_F" ms\n", (sys_now() - ping_time))); - - iphdr = (struct ip_hdr *)buf; - iecho = (struct icmp_echo_hdr *)(buf + (IPH_HL(iphdr) * 4)); - if ((iecho->id == PING_ID) && (iecho->seqno == htons(ping_seq_num))) { - /* do some ping result processing */ - PING_RESULT((ICMPH_TYPE(iecho) == ICMP_ER)); - return; - } else { - LWIP_DEBUGF( PING_DEBUG, ("ping: drop\n")); - } - } - } - - if (len == 0) { - LWIP_DEBUGF( PING_DEBUG, ("ping: recv - %"U32_F" ms - timeout\n", (sys_now()-ping_time))); - } - - /* do some ping result processing */ - PING_RESULT(0); -} - -static void -ping_thread(void *arg) -{ - int s; - int timeout = PING_RCV_TIMEO; - ip_addr_t ping_target; - - LWIP_UNUSED_ARG(arg); - - if ((s = lwip_socket(AF_INET, SOCK_RAW, IP_PROTO_ICMP)) < 0) { - return; - } - - lwip_setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)); - - while (1) { - ping_target = PING_TARGET; - - if (ping_send(s, &ping_target) == ERR_OK) { - LWIP_DEBUGF( PING_DEBUG, ("ping: send ")); - ip_addr_debug_print(PING_DEBUG, &ping_target); - LWIP_DEBUGF( PING_DEBUG, ("\n")); - - ping_time = sys_now(); - ping_recv(s); - } else { - LWIP_DEBUGF( PING_DEBUG, ("ping: send ")); - ip_addr_debug_print(PING_DEBUG, &ping_target); - LWIP_DEBUGF( PING_DEBUG, (" - error\n")); - } - sys_msleep(PING_DELAY); - } -} - -#else /* PING_USE_SOCKETS */ - -/* Ping using the raw ip */ -static u8_t -ping_recv(void *arg, struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *addr) -{ - struct icmp_echo_hdr *iecho; - LWIP_UNUSED_ARG(arg); - LWIP_UNUSED_ARG(pcb); - LWIP_UNUSED_ARG(addr); - LWIP_ASSERT("p != NULL", p != NULL); - - if ((p->tot_len >= (PBUF_IP_HLEN + sizeof(struct icmp_echo_hdr))) && - pbuf_header(p, -PBUF_IP_HLEN) == 0) { - iecho = (struct icmp_echo_hdr *)p->payload; - - if ((iecho->id == PING_ID) && (iecho->seqno == htons(ping_seq_num))) { - LWIP_DEBUGF( PING_DEBUG, ("ping: recv ")); - ip_addr_debug_print(PING_DEBUG, addr); - LWIP_DEBUGF( PING_DEBUG, (" %"U32_F" ms\n", (sys_now()-ping_time))); - - /* do some ping result processing */ - PING_RESULT(1); - pbuf_free(p); - return 1; /* eat the packet */ - } - /* not eaten, restore original packet */ - pbuf_header(p, PBUF_IP_HLEN); - } - - return 0; /* don't eat the packet */ -} - -static void -ping_send(struct raw_pcb *raw, ip_addr_t *addr) -{ - struct pbuf *p; - struct icmp_echo_hdr *iecho; - size_t ping_size = sizeof(struct icmp_echo_hdr) + PING_DATA_SIZE; - - LWIP_DEBUGF( PING_DEBUG, ("ping: send ")); - ip_addr_debug_print(PING_DEBUG, addr); - LWIP_DEBUGF( PING_DEBUG, ("\n")); - LWIP_ASSERT("ping_size <= 0xffff", ping_size <= 0xffff); - - p = pbuf_alloc(PBUF_IP, (u16_t)ping_size, PBUF_RAM); - if (!p) { - return; - } - if ((p->len == p->tot_len) && (p->next == NULL)) { - iecho = (struct icmp_echo_hdr *)p->payload; - - ping_prepare_echo(iecho, (u16_t)ping_size); - - raw_sendto(raw, p, addr); - ping_time = sys_now(); - } - pbuf_free(p); -} - -static void -ping_timeout(void *arg) -{ - struct raw_pcb *pcb = (struct raw_pcb*)arg; - ip_addr_t ping_target = PING_TARGET; - - LWIP_ASSERT("ping_timeout: no pcb given!", pcb != NULL); - - ping_send(pcb, &ping_target); - - sys_timeout(PING_DELAY, ping_timeout, pcb); -} - -static void -ping_raw_init(void) -{ - ping_pcb = raw_new(IP_PROTO_ICMP); - LWIP_ASSERT("ping_pcb != NULL", ping_pcb != NULL); - - raw_recv(ping_pcb, ping_recv, NULL); - raw_bind(ping_pcb, IP_ADDR_ANY); - sys_timeout(PING_DELAY, ping_timeout, ping_pcb); -} - -void -ping_send_now() -{ - ip_addr_t ping_target = PING_TARGET; - LWIP_ASSERT("ping_pcb != NULL", ping_pcb != NULL); - ping_send(ping_pcb, &ping_target); -} - -#endif /* PING_USE_SOCKETS */ - -void -ping_init(void) -{ -#if PING_USE_SOCKETS - sys_thread_new("ping_thread", ping_thread, NULL, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO); -#else /* PING_USE_SOCKETS */ - ping_raw_init(); -#endif /* PING_USE_SOCKETS */ -} - -#endif /* LWIP_RAW */ diff --git a/contrib/apps/ping/ping.h b/contrib/apps/ping/ping.h deleted file mode 100644 index f657f8e..0000000 --- a/contrib/apps/ping/ping.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef LWIP_PING_H -#define LWIP_PING_H - -/** - * PING_USE_SOCKETS: Set to 1 to use sockets, otherwise the raw api is used - */ -#ifndef PING_USE_SOCKETS -#define PING_USE_SOCKETS LWIP_SOCKET -#endif - - -void ping_init(void); - -#if !PING_USE_SOCKETS -void ping_send_now(void); -#endif /* !PING_USE_SOCKETS */ - -#endif /* LWIP_PING_H */ diff --git a/contrib/apps/rtp/rtp.c b/contrib/apps/rtp/rtp.c deleted file mode 100644 index 3f44e8e..0000000 --- a/contrib/apps/rtp/rtp.c +++ /dev/null @@ -1,294 +0,0 @@ -/** - * @file - * RTP client/server module - * - */ - -/* - * 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. - * - */ - -#include "lwip/opt.h" - -#if LWIP_SOCKET && LWIP_IGMP /* don't build if not configured for use in lwipopts.h */ - -#include "lwip/sys.h" -#include "lwip/sockets.h" - -#include "rtpdata.h" - -#include - -/** This is an example of a "RTP" client/server based on a MPEG4 bitstream (with socket API). - */ - -/** - * RTP_DEBUG: Enable debugging for RTP. - */ -#ifndef RTP_DEBUG -#define RTP_DEBUG LWIP_DBG_ON -#endif - -/** RTP stream port */ -#ifndef RTP_STREAM_PORT -#define RTP_STREAM_PORT 4000 -#endif - -/** RTP stream multicast address as IPv4 address in "u32_t" format */ -#ifndef RTP_STREAM_ADDRESS -#define RTP_STREAM_ADDRESS inet_addr("232.0.0.0") -#endif - -/** RTP send delay - in milliseconds */ -#ifndef RTP_SEND_DELAY -#define RTP_SEND_DELAY 40 -#endif - -/** RTP receive timeout - in milliseconds */ -#ifndef RTP_RECV_TIMEOUT -#define RTP_RECV_TIMEOUT 2000 -#endif - -/** RTP stats display period - in received packets */ -#ifndef RTP_RECV_STATS -#define RTP_RECV_STATS 50 -#endif - -/** RTP macro to let the application process the data */ -#ifndef RTP_RECV_PROCESSING -#define RTP_RECV_PROCESSING(p,s) -#endif - -/** RTP packet/payload size */ -#define RTP_PACKET_SIZE 1500 -#define RTP_PAYLOAD_SIZE 1024 - -/** RTP header constants */ -#define RTP_VERSION 0x80 -#define RTP_TIMESTAMP_INCREMENT 3600 -#define RTP_SSRC 0 -#define RTP_PAYLOADTYPE 96 -#define RTP_MARKER_MASK 0x80 - -/** RTP message header */ -#ifdef PACK_STRUCT_USE_INCLUDES -# include "arch/bpstruct.h" -#endif -PACK_STRUCT_BEGIN -struct rtp_hdr { - PACK_STRUCT_FIELD(u8_t version); - PACK_STRUCT_FIELD(u8_t payloadtype); - PACK_STRUCT_FIELD(u16_t seqNum); - PACK_STRUCT_FIELD(u32_t timestamp); - PACK_STRUCT_FIELD(u32_t ssrc); -} PACK_STRUCT_STRUCT; -PACK_STRUCT_END -#ifdef PACK_STRUCT_USE_INCLUDES -# include "arch/epstruct.h" -#endif - -/** RTP packets */ -static u8_t rtp_send_packet[RTP_PACKET_SIZE]; -static u8_t rtp_recv_packet[RTP_PACKET_SIZE]; - -/** - * RTP send packets - */ -static void -rtp_send_packets( int sock, struct sockaddr_in* to) -{ - struct rtp_hdr* rtphdr; - u8_t* rtp_payload; - int rtp_payload_size; - int rtp_data_index; - - /* prepare RTP packet */ - rtphdr = (struct rtp_hdr*)rtp_send_packet; - rtphdr->version = RTP_VERSION; - rtphdr->payloadtype = 0; - rtphdr->ssrc = PP_HTONL(RTP_SSRC); - rtphdr->timestamp = htonl(ntohl(rtphdr->timestamp) + RTP_TIMESTAMP_INCREMENT); - - /* send RTP stream packets */ - rtp_data_index = 0; - do { - rtp_payload = rtp_send_packet+sizeof(struct rtp_hdr); - rtp_payload_size = min(RTP_PAYLOAD_SIZE, (sizeof(rtp_data) - rtp_data_index)); - - memcpy(rtp_payload, rtp_data + rtp_data_index, rtp_payload_size); - - /* set MARKER bit in RTP header on the last packet of an image */ - rtphdr->payloadtype = RTP_PAYLOADTYPE | (((rtp_data_index + rtp_payload_size) - >= sizeof(rtp_data)) ? RTP_MARKER_MASK : 0); - - /* send RTP stream packet */ - if (sendto(sock, rtp_send_packet, sizeof(struct rtp_hdr) + rtp_payload_size, - 0, (struct sockaddr *)to, sizeof(struct sockaddr)) >= 0) { - rtphdr->seqNum = htons(ntohs(rtphdr->seqNum) + 1); - rtp_data_index += rtp_payload_size; - } else { - LWIP_DEBUGF(RTP_DEBUG, ("rtp_sender: not sendto==%i\n", errno)); - } - }while (rtp_data_index < sizeof(rtp_data)); -} - -/** - * RTP send thread - */ -static void -rtp_send_thread(void *arg) -{ - int sock; - struct sockaddr_in local; - struct sockaddr_in to; - u32_t rtp_stream_address; - - LWIP_UNUSED_ARG(arg); - - /* initialize RTP stream address */ - rtp_stream_address = RTP_STREAM_ADDRESS; - - /* if we got a valid RTP stream address... */ - if (rtp_stream_address != 0) { - /* create new socket */ - sock = socket(AF_INET, SOCK_DGRAM, 0); - if (sock >= 0) { - /* prepare local address */ - memset(&local, 0, sizeof(local)); - local.sin_family = AF_INET; - local.sin_port = PP_HTONS(INADDR_ANY); - local.sin_addr.s_addr = PP_HTONL(INADDR_ANY); - - /* bind to local address */ - if (bind(sock, (struct sockaddr *)&local, sizeof(local)) == 0) { - /* prepare RTP stream address */ - memset(&to, 0, sizeof(to)); - to.sin_family = AF_INET; - to.sin_port = PP_HTONS(RTP_STREAM_PORT); - to.sin_addr.s_addr = rtp_stream_address; - - /* send RTP packets */ - memset(rtp_send_packet, 0, sizeof(rtp_send_packet)); - while (1) { - rtp_send_packets( sock, &to); - sys_msleep(RTP_SEND_DELAY); - } - } - - /* close the socket */ - closesocket(sock); - } - } -} - -/** - * RTP recv thread - */ -static void -rtp_recv_thread(void *arg) -{ - int sock; - struct sockaddr_in local; - struct sockaddr_in from; - int fromlen; - struct ip_mreq ipmreq; - struct rtp_hdr* rtphdr; - u32_t rtp_stream_address; - int timeout; - int result; - int recvrtppackets = 0; - int lostrtppackets = 0; - u16_t lastrtpseq = 0; - - LWIP_UNUSED_ARG(arg); - - /* initialize RTP stream address */ - rtp_stream_address = RTP_STREAM_ADDRESS; - - /* if we got a valid RTP stream address... */ - if (rtp_stream_address != 0) { - /* create new socket */ - sock = socket(AF_INET, SOCK_DGRAM, 0); - if (sock >= 0) { - /* prepare local address */ - memset(&local, 0, sizeof(local)); - local.sin_family = AF_INET; - local.sin_port = PP_HTONS(RTP_STREAM_PORT); - local.sin_addr.s_addr = PP_HTONL(INADDR_ANY); - - /* bind to local address */ - if (bind(sock, (struct sockaddr *)&local, sizeof(local)) == 0) { - /* set recv timeout */ - timeout = RTP_RECV_TIMEOUT; - setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout, sizeof(timeout)); - - /* prepare multicast "ip_mreq" struct */ - ipmreq.imr_multiaddr.s_addr = rtp_stream_address; - ipmreq.imr_interface.s_addr = PP_HTONL(INADDR_ANY); - - /* join multicast group */ - if (setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &ipmreq, sizeof(ipmreq)) == 0) { - /* receive RTP packets */ - while(1) { - fromlen = sizeof(from); - result = recvfrom(sock, rtp_recv_packet, sizeof(rtp_recv_packet), 0, - (struct sockaddr *)&from, (socklen_t *)&fromlen); - if (result >= sizeof(struct rtp_hdr)) { - rtphdr = (struct rtp_hdr *)rtp_recv_packet; - recvrtppackets++; - if ((lastrtpseq == 0) || ((lastrtpseq + 1) == ntohs(rtphdr->seqNum))) { - RTP_RECV_PROCESSING((rtp_recv_packet + sizeof(rtp_hdr)),(result-sizeof(rtp_hdr))); - } else { - lostrtppackets++; - } - lastrtpseq = ntohs(rtphdr->seqNum); - if ((recvrtppackets % RTP_RECV_STATS) == 0) { - LWIP_DEBUGF(RTP_DEBUG, ("rtp_recv_thread: recv %6i packet(s) / lost %4i packet(s) (%.4f%%)...\n", recvrtppackets, lostrtppackets, (lostrtppackets*100.0)/recvrtppackets)); - } - } else { - LWIP_DEBUGF(RTP_DEBUG, ("rtp_recv_thread: recv timeout...\n")); - } - } - - /* leave multicast group */ - setsockopt(sock, IPPROTO_IP, IP_DROP_MEMBERSHIP, &ipmreq, sizeof(ipmreq)); - } - } - - /* close the socket */ - closesocket(sock); - } - } -} - -void -rtp_init(void) -{ - sys_thread_new("rtp_send_thread", rtp_send_thread, NULL, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO); - sys_thread_new("rtp_recv_thread", rtp_recv_thread, NULL, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO); -} - -#endif /* LWIP_SOCKET && LWIP_IGMP */ diff --git a/contrib/apps/rtp/rtp.h b/contrib/apps/rtp/rtp.h deleted file mode 100644 index c53d89b..0000000 --- a/contrib/apps/rtp/rtp.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef LWIP_RTP_H -#define LWIP_RTP_H - -#if LWIP_SOCKET && LWIP_IGMP -void rtp_init(void); -#endif /* LWIP_SOCKET && LWIP_IGMP */ - -#endif /* LWIP_RTP_H */ diff --git a/contrib/apps/rtp/rtpdata.h b/contrib/apps/rtp/rtpdata.h deleted file mode 100644 index 655a1fe..0000000 --- a/contrib/apps/rtp/rtpdata.h +++ /dev/null @@ -1,2040 +0,0 @@ -const char rtp_data[] = { - 0x00, 0x00, 0x01, 0xb0, 0xf5, 0x00, 0x00, 0x01, - 0xb5, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x20, 0x00, 0x86, 0x84, 0x00, 0x67, 0x0c, - 0x2c, 0x10, 0x90, 0x51, 0x8f, 0x00, 0x00, 0x01, - 0xb2, 0x44, 0x69, 0x76, 0x58, 0x35, 0x30, 0x33, - 0x62, 0x31, 0x33, 0x39, 0x33, 0x70, 0x00, 0x00, - 0x01, 0xb2, 0x58, 0x76, 0x69, 0x44, 0x30, 0x30, - 0x33, 0x39, 0x00, 0x00, 0x01, 0xb6, 0x18, 0x60, - 0xab, 0x94, 0x03, 0xc0, 0xca, 0xc0, 0x3e, 0xd0, - 0x78, 0x4f, 0xf9, 0x44, 0x91, 0xe9, 0xfa, 0xc9, - 0xfe, 0xa1, 0xa4, 0xc1, 0x66, 0x03, 0x2e, 0x39, - 0x0c, 0x7e, 0x0e, 0xaa, 0x02, 0x92, 0xf8, 0xd5, - 0xec, 0xe2, 0x35, 0xb9, 0x35, 0x0c, 0xb3, 0x82, - 0xa6, 0xad, 0xd0, 0xd1, 0xca, 0xb8, 0xe8, 0x10, - 0x55, 0x78, 0x03, 0xc0, 0x38, 0x15, 0xba, 0xce, - 0xe2, 0xea, 0x00, 0xc3, 0x60, 0xb1, 0x70, 0xf4, - 0x14, 0x6c, 0x35, 0x4d, 0xe8, 0x5a, 0x1e, 0x58, - 0xdf, 0x03, 0x01, 0xfd, 0x2a, 0x45, 0x54, 0xca, - 0x0f, 0x05, 0x00, 0xbd, 0xd0, 0xcc, 0xb4, 0x90, - 0x4c, 0x24, 0x6b, 0x20, 0x30, 0x95, 0xf1, 0x2f, - 0xb4, 0xa7, 0x83, 0xdc, 0xce, 0x03, 0x05, 0x02, - 0x1a, 0x5d, 0x1a, 0x2c, 0xbf, 0x51, 0x28, 0x8b, - 0xd7, 0x6b, 0xdd, 0xf9, 0x44, 0xbb, 0x0e, 0x91, - 0x64, 0xb9, 0xa6, 0x33, 0xd3, 0x6e, 0x34, 0xa4, - 0xac, 0xac, 0x53, 0x0d, 0x79, 0xbe, 0xae, 0x5b, - 0x47, 0x2e, 0xde, 0x62, 0xa1, 0x53, 0xcd, 0x7d, - 0xfe, 0x66, 0xa1, 0x2b, 0x9c, 0xe1, 0xca, 0xbc, - 0xea, 0x84, 0x1c, 0x68, 0xff, 0xbb, 0x28, 0xa1, - 0x26, 0x18, 0x99, 0xb1, 0x4f, 0x68, 0x80, 0x28, - 0x0e, 0x20, 0xc3, 0xbf, 0x0f, 0x80, 0xf8, 0x90, - 0x3b, 0x1f, 0x16, 0xe4, 0xb0, 0x6f, 0x44, 0x16, - 0x38, 0xb8, 0xc3, 0x81, 0x22, 0xfa, 0xe3, 0x09, - 0xf6, 0x61, 0x6d, 0xef, 0x67, 0x56, 0x3b, 0x57, - 0xb5, 0x23, 0x03, 0x1f, 0x6d, 0x0d, 0xb9, 0x08, - 0xc6, 0x43, 0xba, 0xd1, 0x40, 0x5a, 0xe8, 0xca, - 0x9e, 0x17, 0x1f, 0x6d, 0x5d, 0x16, 0x98, 0xab, - 0xe6, 0x99, 0xf6, 0x37, 0xc6, 0x1b, 0xdc, 0xb9, - 0xb3, 0xfe, 0x9a, 0x4b, 0x1e, 0xec, 0xf9, 0x5f, - 0xb8, 0xc7, 0xfc, 0xbe, 0x6c, 0xd5, 0xf3, 0x9b, - 0x17, 0x8b, 0x89, 0x82, 0xff, 0x30, 0x19, 0x20, - 0x30, 0xe6, 0x29, 0x96, 0x75, 0x75, 0xeb, 0x00, - 0x3f, 0xa1, 0x20, 0x5b, 0x06, 0x11, 0x98, 0x1f, - 0xb2, 0xad, 0x3a, 0x59, 0xe6, 0x7d, 0x38, 0xa4, - 0xb1, 0x4f, 0xfe, 0xdf, 0x3a, 0x4b, 0xdb, 0x69, - 0xc3, 0x93, 0xcc, 0xdf, 0x5e, 0xf7, 0x2a, 0x38, - 0x2a, 0x89, 0x84, 0x80, 0x6c, 0x12, 0x44, 0x95, - 0x78, 0xd8, 0x7e, 0x3f, 0x4e, 0xcf, 0x3f, 0x39, - 0xba, 0x9f, 0xfa, 0x8f, 0x2f, 0x62, 0xfa, 0xf0, - 0xb6, 0x20, 0xa7, 0x06, 0x02, 0x3f, 0x28, 0x96, - 0x80, 0xf0, 0x99, 0x8e, 0x82, 0x15, 0x11, 0x87, - 0x35, 0xa4, 0xfd, 0x53, 0xcb, 0xcd, 0x68, 0x38, - 0xe8, 0xdb, 0x8d, 0xc2, 0x71, 0xbc, 0x65, 0x3e, - 0xac, 0x5b, 0x0d, 0xae, 0xc0, 0x3c, 0x77, 0xfe, - 0xe8, 0xde, 0x3c, 0xbd, 0xdb, 0xb3, 0x39, 0x09, - 0x56, 0x0a, 0xa2, 0xfe, 0x40, 0xd7, 0x6f, 0x56, - 0x07, 0x02, 0xec, 0xd6, 0xed, 0x06, 0x5e, 0x2f, - 0xb6, 0xce, 0xf1, 0x4f, 0x16, 0x88, 0x04, 0x41, - 0x79, 0x0e, 0x98, 0xbe, 0x54, 0x75, 0x1a, 0xd6, - 0x50, 0xcf, 0x82, 0x6a, 0xf7, 0xaf, 0x7f, 0xfb, - 0x6d, 0x88, 0x97, 0x24, 0x40, 0x68, 0xa0, 0x57, - 0x79, 0x57, 0xe9, 0x6b, 0xaa, 0xe5, 0xe4, 0x2b, - 0xaa, 0x14, 0x64, 0x90, 0x6c, 0x50, 0x4a, 0xe3, - 0x97, 0x43, 0xf6, 0x81, 0x90, 0xa9, 0xa6, 0xba, - 0xb1, 0x21, 0x12, 0x5f, 0xe0, 0xdf, 0x88, 0x86, - 0x03, 0x30, 0x94, 0xb2, 0x6d, 0xd2, 0xdc, 0x45, - 0x14, 0x54, 0x1d, 0xe8, 0x38, 0x8d, 0xbe, 0x8a, - 0xaf, 0x20, 0xa2, 0x3e, 0xa2, 0x5c, 0xc6, 0xae, - 0xe6, 0xc4, 0x48, 0xec, 0xea, 0xc7, 0x4e, 0x17, - 0xb2, 0x91, 0x52, 0xb4, 0xe9, 0x8b, 0x15, 0xfb, - 0x99, 0x7c, 0xda, 0xb8, 0xad, 0x57, 0x31, 0x5b, - 0x5b, 0x67, 0xaa, 0x1e, 0x93, 0x76, 0xa5, 0x25, - 0xd9, 0x0d, 0x70, 0xd8, 0xb9, 0x11, 0x34, 0xfd, - 0xaf, 0x0e, 0x0d, 0x42, 0x57, 0x97, 0x26, 0x06, - 0xdf, 0x29, 0x7e, 0x79, 0x72, 0x22, 0x36, 0xa5, - 0x9f, 0x6a, 0x16, 0x24, 0x6f, 0x10, 0x56, 0xec, - 0x5b, 0x46, 0x50, 0x94, 0x88, 0xc4, 0xfa, 0x9e, - 0xd8, 0x5b, 0xb7, 0x50, 0x72, 0x62, 0x25, 0xaa, - 0x39, 0x84, 0x69, 0xaa, 0xfc, 0xbf, 0x9b, 0x45, - 0xf7, 0xc5, 0x41, 0x97, 0x41, 0xc7, 0xac, 0x7f, - 0x68, 0x92, 0xab, 0x64, 0xaa, 0x46, 0x32, 0x84, - 0x77, 0x1b, 0xfc, 0xbc, 0x5a, 0x42, 0x28, 0xfa, - 0x3e, 0x55, 0xf4, 0xe9, 0x44, 0xac, 0xc5, 0x4a, - 0x6c, 0x93, 0xde, 0x03, 0x6d, 0xdc, 0xb8, 0x5b, - 0xb7, 0x83, 0x7e, 0xc2, 0xaa, 0x33, 0x70, 0x34, - 0x41, 0x46, 0x25, 0xa5, 0x6f, 0xdb, 0x96, 0x0f, - 0xd3, 0xab, 0xd4, 0x17, 0x65, 0x96, 0x0c, 0x1e, - 0x39, 0x4c, 0x9d, 0x90, 0x3f, 0x5b, 0x8d, 0xaa, - 0xce, 0xac, 0xa6, 0x50, 0xf0, 0x66, 0xb2, 0x30, - 0xce, 0x42, 0x61, 0xaa, 0xb6, 0x7e, 0xca, 0xbf, - 0xfd, 0xbf, 0xef, 0x51, 0xed, 0xdf, 0x95, 0x0b, - 0xa7, 0x34, 0x24, 0x13, 0x62, 0x44, 0x81, 0xdf, - 0x3a, 0x8e, 0x95, 0x91, 0x67, 0xd7, 0x57, 0x54, - 0x92, 0x1d, 0x79, 0xa3, 0x2a, 0xf3, 0x0c, 0x7a, - 0x12, 0xa8, 0x33, 0xf9, 0x05, 0x02, 0x7b, 0xef, - 0x12, 0x18, 0xab, 0x8b, 0x40, 0x38, 0x7e, 0x0c, - 0x1f, 0x04, 0x30, 0x62, 0xa8, 0xd5, 0xd9, 0x78, - 0xdd, 0x1c, 0xb4, 0x57, 0xc1, 0x83, 0xc4, 0x41, - 0x08, 0x72, 0x5c, 0xc2, 0xb6, 0xd3, 0xd4, 0x85, - 0x4a, 0x7e, 0x58, 0xc3, 0x19, 0xfa, 0xdd, 0x51, - 0x03, 0x85, 0x1d, 0xe9, 0x10, 0x5e, 0x8c, 0x8f, - 0x41, 0x03, 0xe9, 0xbc, 0xa8, 0xba, 0xeb, 0x73, - 0x7d, 0x85, 0x69, 0xc7, 0x3b, 0xd9, 0x49, 0x0b, - 0x39, 0x03, 0x12, 0x11, 0x8b, 0x72, 0x97, 0x62, - 0x5f, 0xfe, 0x59, 0x4d, 0xc0, 0x3a, 0xdf, 0xcb, - 0x3e, 0x80, 0x39, 0xd5, 0x7a, 0xb1, 0x45, 0x86, - 0x06, 0xf6, 0xb6, 0xda, 0x98, 0xa1, 0x41, 0xae, - 0x12, 0xd3, 0xd1, 0x71, 0x5a, 0xa5, 0x40, 0xc0, - 0x8a, 0x3f, 0x4e, 0xac, 0x78, 0x93, 0x55, 0x31, - 0xfc, 0xcf, 0x67, 0x93, 0x52, 0xc4, 0x53, 0x0d, - 0xdf, 0x49, 0xd7, 0x83, 0x00, 0x18, 0x4b, 0xcd, - 0x65, 0xaf, 0xb5, 0xd5, 0x6c, 0xc4, 0x14, 0xb7, - 0xdb, 0x9d, 0x06, 0x17, 0xca, 0xe1, 0x60, 0x07, - 0x6d, 0x57, 0xd0, 0xfb, 0x1a, 0xf5, 0xb2, 0x56, - 0xca, 0xea, 0x21, 0x77, 0x41, 0xc0, 0x46, 0xc8, - 0x85, 0xe3, 0x15, 0x6a, 0xdb, 0x80, 0x47, 0x6d, - 0x05, 0x44, 0x06, 0x04, 0xf6, 0x92, 0x24, 0xdb, - 0x9b, 0x6f, 0xfa, 0x8d, 0x72, 0x2d, 0x75, 0x7e, - 0x33, 0x9c, 0xe7, 0x06, 0xbb, 0x3d, 0xa4, 0xb7, - 0xee, 0x31, 0x46, 0x4b, 0x91, 0xe2, 0xb0, 0x54, - 0x5c, 0x78, 0x9e, 0x45, 0x90, 0xe4, 0x76, 0xbe, - 0xe1, 0x4c, 0xae, 0x89, 0x20, 0x6e, 0x77, 0x76, - 0x94, 0x63, 0x93, 0xaa, 0x62, 0x0e, 0x28, 0x7b, - 0xec, 0xc9, 0xc5, 0x25, 0x64, 0x5a, 0xe9, 0xcc, - 0x91, 0x1a, 0x9c, 0xcf, 0x91, 0x47, 0x32, 0x12, - 0x9f, 0x8b, 0x36, 0x07, 0x33, 0x4c, 0x45, 0x06, - 0x19, 0xdb, 0x61, 0xc5, 0x68, 0xb7, 0xab, 0x2e, - 0x7b, 0x5c, 0xa6, 0x4c, 0x6e, 0x08, 0x5f, 0xc1, - 0xc4, 0x99, 0x64, 0xef, 0xd8, 0x05, 0x5c, 0x0f, - 0x76, 0xdd, 0xab, 0x4f, 0x8e, 0x29, 0x54, 0x59, - 0x1d, 0x30, 0x33, 0xfb, 0x3b, 0x43, 0x96, 0xf4, - 0x52, 0x47, 0x2c, 0x66, 0x81, 0xca, 0xa6, 0x73, - 0x51, 0xc1, 0xc0, 0x32, 0x98, 0xa3, 0x41, 0x1c, - 0x40, 0x5e, 0x22, 0x05, 0xa0, 0xdb, 0xb0, 0x88, - 0xdf, 0xee, 0x2f, 0x3a, 0xbb, 0xe2, 0xef, 0x79, - 0x09, 0xa6, 0x0c, 0x0f, 0x4c, 0xdc, 0x81, 0xcc, - 0x3d, 0x36, 0x52, 0x4e, 0xbd, 0x44, 0x0d, 0x0d, - 0x84, 0xf5, 0x74, 0x33, 0x14, 0x1a, 0x87, 0xcb, - 0xcc, 0x93, 0xa3, 0x69, 0x21, 0x20, 0x26, 0x23, - 0xd9, 0x95, 0x0c, 0x22, 0x2b, 0x2f, 0x0d, 0xf4, - 0x34, 0x74, 0x53, 0x16, 0x5d, 0x60, 0x96, 0x3e, - 0x53, 0xd3, 0xcc, 0xc5, 0x72, 0x49, 0xc2, 0x4d, - 0xea, 0x02, 0x21, 0x7f, 0xbd, 0x80, 0x1d, 0xf0, - 0x87, 0xe6, 0xdb, 0xcc, 0x92, 0xdd, 0xfe, 0x78, - 0x4a, 0xd2, 0xf9, 0x77, 0x24, 0xed, 0x5a, 0x31, - 0x6c, 0xec, 0x71, 0x5d, 0x85, 0xad, 0xb3, 0xb9, - 0x6f, 0x11, 0x2d, 0xfa, 0x42, 0x2b, 0xcb, 0x01, - 0x08, 0x18, 0x11, 0x56, 0xcb, 0x01, 0xe1, 0xe0, - 0x1f, 0x06, 0xe8, 0x3c, 0x6c, 0x01, 0xaa, 0x49, - 0x86, 0xbf, 0x63, 0x79, 0x03, 0xbe, 0xd8, 0x47, - 0x4f, 0x26, 0x0d, 0x11, 0xe3, 0x76, 0x27, 0x0e, - 0xf1, 0x79, 0x44, 0x46, 0xc3, 0x3b, 0x4f, 0x05, - 0x20, 0x40, 0xff, 0x59, 0x6f, 0xaa, 0x17, 0xf4, - 0x40, 0xa1, 0x15, 0x0a, 0x4c, 0x0f, 0x94, 0x81, - 0xb8, 0x0c, 0x8e, 0x8d, 0xc3, 0x80, 0xc1, 0xeb, - 0x02, 0x16, 0xf4, 0xbe, 0xca, 0xa4, 0x3a, 0xa8, - 0xec, 0x0c, 0x89, 0xc4, 0x59, 0xe4, 0x8b, 0x9a, - 0x40, 0x7e, 0xae, 0xea, 0xa0, 0xeb, 0x6a, 0x99, - 0x95, 0x73, 0x79, 0x62, 0x18, 0xb8, 0x38, 0x64, - 0x73, 0x97, 0xb7, 0x58, 0xd1, 0x2d, 0x8d, 0xbe, - 0xf3, 0x13, 0x2f, 0x7c, 0xc0, 0x1d, 0x61, 0x4e, - 0x4c, 0xe6, 0x95, 0xce, 0x97, 0xf9, 0xbc, 0xf4, - 0x5a, 0xce, 0xa1, 0x3b, 0x39, 0xef, 0xc5, 0x39, - 0x4b, 0x72, 0x1b, 0xa5, 0x41, 0x92, 0x27, 0xda, - 0x72, 0xc2, 0xbb, 0xd4, 0x8d, 0x34, 0x97, 0x9d, - 0xb7, 0xde, 0xe7, 0xb0, 0x64, 0x8a, 0x0a, 0x0c, - 0x0e, 0x60, 0x30, 0x62, 0xb8, 0xbb, 0x9f, 0x96, - 0x05, 0x31, 0x33, 0xfa, 0x3c, 0x1f, 0xf4, 0x3d, - 0x04, 0x3c, 0x5c, 0x1e, 0x1b, 0xfe, 0xf1, 0xfe, - 0xa1, 0xb1, 0x03, 0x54, 0x99, 0x50, 0x61, 0xc5, - 0xbc, 0x2d, 0x00, 0xfe, 0xaf, 0x01, 0xe1, 0x7f, - 0xeb, 0xd4, 0x77, 0x0d, 0xb4, 0x0a, 0x9c, 0x18, - 0x92, 0x3d, 0x5a, 0xbf, 0xc0, 0x98, 0x66, 0xcc, - 0x06, 0x09, 0x6a, 0x50, 0xe9, 0x18, 0x32, 0x00, - 0x78, 0xc8, 0x06, 0x68, 0xac, 0x8b, 0x3f, 0x38, - 0xbf, 0x4a, 0x33, 0x30, 0x1c, 0x4f, 0xae, 0x16, - 0x44, 0x98, 0x24, 0x08, 0xc9, 0x07, 0xed, 0x62, - 0xbb, 0x89, 0x15, 0xca, 0x0f, 0x09, 0x00, 0x7a, - 0x51, 0xc5, 0x93, 0x54, 0x45, 0xfb, 0x73, 0xdf, - 0xe9, 0x42, 0x07, 0x90, 0x10, 0xcb, 0xdb, 0x2b, - 0x47, 0x20, 0x2b, 0xaa, 0xf4, 0x5c, 0xa4, 0x28, - 0x38, 0x9d, 0x5a, 0x44, 0x22, 0x0d, 0x54, 0x81, - 0x1d, 0x07, 0x0a, 0x37, 0xee, 0x49, 0x8b, 0xfb, - 0x3a, 0x8d, 0x7e, 0x83, 0x84, 0xfd, 0xf7, 0x98, - 0xad, 0xac, 0xa7, 0x46, 0x07, 0x62, 0x72, 0x56, - 0x1c, 0x03, 0x05, 0x4d, 0x70, 0xd8, 0x60, 0x62, - 0x8a, 0x8d, 0xe8, 0x23, 0x03, 0x04, 0x6d, 0x60, - 0xdc, 0x2a, 0x27, 0x92, 0x08, 0x8f, 0x65, 0xed, - 0xbd, 0xca, 0xa5, 0x1d, 0x80, 0x8d, 0x11, 0x03, - 0x83, 0xc7, 0x05, 0x04, 0x85, 0xcd, 0x2f, 0x3a, - 0xd4, 0x83, 0x02, 0x91, 0x91, 0xc5, 0x76, 0xb5, - 0x79, 0xcb, 0xfb, 0x29, 0x22, 0x90, 0x1e, 0x09, - 0x9f, 0x2c, 0x07, 0x77, 0xa0, 0x38, 0xf8, 0x63, - 0xf5, 0x2a, 0xd4, 0xc5, 0x0f, 0xd7, 0x43, 0x38, - 0xb5, 0xe8, 0x38, 0x94, 0x29, 0x71, 0x68, 0xb4, - 0x99, 0x0a, 0x4d, 0xf6, 0x94, 0x9d, 0x8e, 0x96, - 0x58, 0x88, 0x63, 0x46, 0x02, 0x9d, 0x64, 0x83, - 0x70, 0x72, 0x32, 0x6f, 0x90, 0x1d, 0x0e, 0xd5, - 0xf5, 0xd9, 0x0d, 0xe8, 0x0f, 0xa3, 0x20, 0x5f, - 0x26, 0x59, 0xc3, 0x50, 0x33, 0x04, 0xc9, 0x0c, - 0xc8, 0xa2, 0xce, 0x12, 0x43, 0x44, 0xa3, 0x55, - 0xe5, 0x07, 0x05, 0x1a, 0x69, 0xa8, 0xc4, 0x39, - 0x92, 0xa2, 0x44, 0x0e, 0x08, 0xe0, 0xa2, 0x4a, - 0x28, 0xd7, 0x80, 0xe1, 0x37, 0x96, 0x0c, 0x49, - 0x28, 0x0f, 0x3c, 0xc8, 0xe2, 0xc1, 0x5d, 0x4f, - 0xd4, 0x48, 0xa2, 0x21, 0x59, 0xf1, 0x0d, 0x9f, - 0xaa, 0xc6, 0x77, 0xc8, 0xe5, 0xce, 0x0d, 0xca, - 0x02, 0x87, 0x4a, 0x49, 0x01, 0xc8, 0x48, 0xc8, - 0xf3, 0x1b, 0x2f, 0xdf, 0x6c, 0xcb, 0x88, 0x66, - 0xf1, 0x40, 0xbd, 0x6a, 0x34, 0xfc, 0xb0, 0x89, - 0xde, 0x11, 0xc5, 0xc6, 0xa2, 0x44, 0xc6, 0xdb, - 0x67, 0xff, 0xd1, 0x79, 0x01, 0xa4, 0x9e, 0xf0, - 0x1f, 0x10, 0x57, 0x2b, 0x24, 0xc5, 0x1c, 0x09, - 0x45, 0x7e, 0xcc, 0x55, 0xe5, 0x0d, 0x64, 0xe2, - 0x2c, 0xe4, 0xea, 0xe4, 0x81, 0x31, 0xfd, 0x61, - 0x38, 0x8f, 0xba, 0x1f, 0xb4, 0xd9, 0x6c, 0xa8, - 0xac, 0xe4, 0xe8, 0xca, 0x9e, 0xee, 0xa9, 0x51, - 0xd7, 0xe9, 0x9d, 0xcc, 0xb0, 0x7c, 0x24, 0xc5, - 0x13, 0xa0, 0x89, 0x78, 0x0b, 0x15, 0xd1, 0x09, - 0xe4, 0xbf, 0x34, 0x6f, 0xcf, 0x0b, 0x82, 0x51, - 0xb3, 0x70, 0x7d, 0x83, 0xe1, 0x24, 0x0d, 0x33, - 0xad, 0xda, 0x5d, 0xfe, 0xe7, 0x38, 0x54, 0x52, - 0x0e, 0x3d, 0xd5, 0xec, 0xef, 0x0b, 0x05, 0xe1, - 0x16, 0xa9, 0x45, 0xec, 0x5f, 0x81, 0xb9, 0xc8, - 0xff, 0x36, 0x0e, 0x0e, 0x01, 0x81, 0x31, 0xae, - 0x4b, 0x35, 0xd8, 0x18, 0x17, 0x8c, 0x33, 0x7a, - 0xa2, 0xee, 0x06, 0x5b, 0xd8, 0x0b, 0x07, 0xb0, - 0x52, 0xbe, 0xf6, 0xf4, 0x38, 0xec, 0x35, 0x6e, - 0x45, 0xc1, 0x5e, 0x51, 0xd3, 0x67, 0x93, 0x6d, - 0xaf, 0xd0, 0xe0, 0x2a, 0xea, 0x6a, 0x1e, 0x03, - 0x0c, 0x38, 0xa4, 0x38, 0xea, 0x34, 0x41, 0x99, - 0xcb, 0xe0, 0xcd, 0xda, 0xf2, 0xee, 0x86, 0x28, - 0x83, 0x38, 0x0b, 0x13, 0xd1, 0x73, 0x1e, 0x4f, - 0xb5, 0x18, 0x7d, 0xef, 0xed, 0x09, 0xdf, 0xf7, - 0x4a, 0x91, 0xdb, 0x41, 0x84, 0xf7, 0x07, 0x14, - 0x15, 0x3b, 0x01, 0xc5, 0x28, 0x41, 0x78, 0x9f, - 0xf6, 0x92, 0xce, 0x06, 0xe0, 0xb9, 0x9d, 0xa0, - 0xee, 0xf0, 0x25, 0xa9, 0xd4, 0xe0, 0x71, 0xb4, - 0x66, 0x0c, 0x11, 0x47, 0x01, 0x89, 0x34, 0x62, - 0x11, 0x60, 0x27, 0xa0, 0xfb, 0x1f, 0xfe, 0xd1, - 0x50, 0x6e, 0x0e, 0x23, 0xc3, 0xd8, 0x0e, 0xe8, - 0x53, 0xa7, 0x94, 0x03, 0x12, 0x41, 0x9a, 0x90, - 0x97, 0xce, 0x87, 0x0d, 0x42, 0x9d, 0x07, 0xce, - 0xff, 0xef, 0x4e, 0x07, 0x1a, 0x31, 0x08, 0x92, - 0x98, 0x0c, 0x49, 0x46, 0x74, 0x22, 0x2a, 0xf1, - 0x01, 0x51, 0x48, 0x26, 0xe9, 0xf5, 0xcd, 0xb0, - 0x0c, 0x2e, 0xa1, 0x3d, 0x29, 0x05, 0x4f, 0xa0, - 0x12, 0x06, 0x08, 0x9c, 0x94, 0x08, 0x60, 0xce, - 0xd0, 0x96, 0x81, 0x81, 0x18, 0x62, 0x03, 0xcc, - 0xba, 0x15, 0xd6, 0x91, 0x11, 0x14, 0x7e, 0xb2, - 0x7e, 0xd4, 0x56, 0x74, 0x37, 0xdc, 0x82, 0xfb, - 0x21, 0xa1, 0x93, 0x91, 0x60, 0x3d, 0xcb, 0x28, - 0x4b, 0x52, 0xe9, 0x26, 0x4a, 0x0c, 0x32, 0xca, - 0x31, 0xab, 0x10, 0x19, 0x6e, 0x76, 0x50, 0x1e, - 0x7c, 0x89, 0x2f, 0x42, 0x4a, 0x46, 0xf8, 0xb1, - 0x5e, 0xdc, 0xbe, 0x81, 0x4a, 0x0c, 0x4e, 0x6a, - 0x31, 0x70, 0xd4, 0x17, 0x62, 0x30, 0xf8, 0xbb, - 0xaa, 0xba, 0x06, 0x98, 0xf4, 0x05, 0x40, 0x7c, - 0x8e, 0x81, 0x22, 0xc7, 0x8b, 0xf2, 0x67, 0x49, - 0x64, 0x58, 0x1c, 0xb8, 0xa0, 0x6d, 0xb9, 0xea, - 0x5b, 0x11, 0x47, 0x18, 0xe7, 0xd0, 0xbc, 0xce, - 0xf3, 0x9d, 0x19, 0x10, 0x92, 0x95, 0x45, 0x47, - 0x78, 0x87, 0x81, 0x32, 0x6b, 0xc0, 0xe5, 0x7a, - 0x79, 0x25, 0x37, 0x0d, 0x05, 0x06, 0x73, 0x39, - 0x50, 0x9f, 0x8f, 0x5d, 0x09, 0x24, 0x34, 0x32, - 0x18, 0x04, 0x62, 0x9c, 0xe8, 0x1e, 0x06, 0x52, - 0x88, 0x1e, 0x26, 0x01, 0x30, 0x36, 0x81, 0x60, - 0x63, 0x41, 0x6a, 0x77, 0xa8, 0x42, 0xd4, 0xba, - 0x1f, 0x0e, 0x79, 0x06, 0x2d, 0x16, 0x83, 0x00, - 0xe3, 0xe6, 0xcb, 0xba, 0x82, 0x4a, 0x27, 0xd7, - 0x5e, 0xdc, 0x58, 0x44, 0x19, 0x28, 0x0c, 0xc7, - 0x2f, 0x57, 0xb2, 0x83, 0x83, 0x40, 0xcc, 0x1c, - 0xb8, 0x99, 0x41, 0xb9, 0xb0, 0xc8, 0x1f, 0x36, - 0x00, 0x75, 0x14, 0xa9, 0x25, 0x34, 0x87, 0x83, - 0x05, 0x13, 0x16, 0x7d, 0x91, 0x40, 0x3b, 0x9c, - 0xe8, 0x38, 0x57, 0x17, 0xd2, 0x03, 0xc0, 0xff, - 0x4e, 0x0c, 0x1f, 0x16, 0x96, 0xc0, 0xe3, 0x8d, - 0x62, 0x75, 0xb8, 0x04, 0xae, 0x03, 0x80, 0x88, - 0xa1, 0x56, 0x31, 0x57, 0x66, 0x2d, 0x8a, 0xef, - 0x11, 0x6f, 0xca, 0xe9, 0x47, 0x79, 0xd0, 0x9d, - 0x0c, 0xb0, 0x18, 0x47, 0x06, 0x03, 0x57, 0x2c, - 0xda, 0x8f, 0x4a, 0x80, 0xd9, 0xa0, 0x62, 0x80, - 0x60, 0x4d, 0x95, 0x18, 0x8c, 0x18, 0x45, 0xcb, - 0x17, 0xad, 0x34, 0xa3, 0xd2, 0xa1, 0xb5, 0xd3, - 0x32, 0xd9, 0xdb, 0xd1, 0x82, 0x98, 0x18, 0x83, - 0xa9, 0xcd, 0xb5, 0x20, 0x77, 0x03, 0x5c, 0x5f, - 0xa6, 0xdb, 0x48, 0x12, 0xd7, 0x46, 0xc8, 0xd1, - 0x78, 0x1c, 0x1d, 0x17, 0x04, 0x91, 0xe8, 0xbc, - 0x2a, 0xa0, 0x53, 0x83, 0x11, 0x29, 0xff, 0x18, - 0xfe, 0x8d, 0x98, 0x6e, 0xad, 0x11, 0x65, 0xa0, - 0xc8, 0x3c, 0x48, 0x48, 0x13, 0x55, 0x28, 0xf5, - 0x61, 0x9d, 0xe0, 0x38, 0x5e, 0x12, 0xc0, 0x70, - 0x44, 0xbf, 0x6f, 0x25, 0x9d, 0x2b, 0xcf, 0xb6, - 0x79, 0x3d, 0xcf, 0x45, 0x32, 0xa8, 0x19, 0x67, - 0x3a, 0x14, 0x43, 0x6d, 0x7d, 0xa1, 0x04, 0xb7, - 0x3e, 0xd3, 0x75, 0x45, 0x2a, 0x6a, 0x6d, 0xb2, - 0x12, 0x87, 0x90, 0xa0, 0x6b, 0xbf, 0x1a, 0x5b, - 0xb7, 0x14, 0xd0, 0x26, 0x88, 0x5e, 0xb8, 0x4d, - 0x70, 0x19, 0x65, 0x36, 0xdd, 0x9c, 0x40, 0x7a, - 0xbf, 0x21, 0xc8, 0x38, 0x38, 0x01, 0xca, 0x1e, - 0xc5, 0xee, 0xb3, 0x40, 0xc0, 0x9a, 0xd6, 0x24, - 0xa7, 0xb4, 0x6b, 0x06, 0x18, 0xfc, 0x1c, 0x11, - 0xaf, 0x6d, 0xcc, 0xbd, 0x5e, 0xc8, 0x8e, 0x07, - 0xbc, 0xe0, 0x52, 0x8f, 0x9a, 0xb1, 0x74, 0x40, - 0xe4, 0x63, 0x20, 0x99, 0x4f, 0xa8, 0xbc, 0x0e, - 0xf2, 0x86, 0x80, 0xea, 0x09, 0x8a, 0xec, 0xdd, - 0xe7, 0x39, 0x49, 0x6e, 0xc4, 0x5c, 0x5d, 0x0d, - 0x45, 0xd1, 0x7b, 0x8b, 0xd5, 0xaf, 0x43, 0x17, - 0xe9, 0x49, 0xac, 0x6d, 0x10, 0xa6, 0x4e, 0x5e, - 0xa8, 0xc8, 0x20, 0xca, 0x54, 0x8e, 0xa1, 0x15, - 0xb5, 0x0d, 0xa0, 0x66, 0x70, 0x93, 0x6f, 0x01, - 0xc4, 0x2b, 0xc1, 0x46, 0xbd, 0x74, 0x96, 0x05, - 0x75, 0x50, 0xc0, 0xc3, 0x8b, 0x22, 0x25, 0x07, - 0x1d, 0xf6, 0x70, 0x92, 0x2d, 0x17, 0x09, 0xcb, - 0xef, 0xbd, 0x88, 0xd6, 0x46, 0x7b, 0xbd, 0xa0, - 0xe7, 0xe9, 0xc7, 0x09, 0x01, 0xc0, 0xb1, 0x29, - 0x3a, 0xc1, 0xdd, 0x05, 0xd2, 0x6a, 0x60, 0x73, - 0x06, 0x54, 0x26, 0x84, 0x0b, 0x22, 0x42, 0x7e, - 0x0d, 0x62, 0xfe, 0xc5, 0xb8, 0x30, 0x3a, 0xa2, - 0x5f, 0x5b, 0xee, 0x6c, 0xc2, 0x50, 0x7a, 0x18, - 0x00, 0xdf, 0x86, 0x41, 0x97, 0x16, 0x3d, 0xd9, - 0xcb, 0x09, 0x46, 0x40, 0xb0, 0x04, 0xe5, 0xa0, - 0xbb, 0xa9, 0x8d, 0x84, 0xa6, 0xd4, 0xb7, 0x53, - 0xb2, 0xdf, 0x33, 0x16, 0x41, 0x38, 0x2f, 0x3c, - 0xa8, 0x21, 0xef, 0x3e, 0xd6, 0xcd, 0x8b, 0xf9, - 0x1f, 0x03, 0x7a, 0x29, 0x18, 0x84, 0x26, 0x7f, - 0xe1, 0xdf, 0x98, 0x1c, 0x36, 0x58, 0xdc, 0x51, - 0xde, 0x2d, 0x35, 0x1f, 0x69, 0xa7, 0x0a, 0x82, - 0x08, 0xe9, 0x59, 0x7f, 0x2b, 0x4a, 0x39, 0x25, - 0x96, 0x5f, 0xf1, 0x08, 0xa6, 0x5b, 0x4b, 0x67, - 0x51, 0x12, 0xf0, 0xf2, 0xae, 0x68, 0xbb, 0x72, - 0xef, 0x0a, 0xb6, 0x02, 0xbd, 0x14, 0x42, 0x37, - 0x1b, 0x80, 0xe2, 0x3a, 0xb7, 0xb4, 0x1c, 0x0a, - 0x9b, 0xa0, 0xea, 0x11, 0x21, 0x4b, 0x07, 0xc9, - 0x93, 0xb7, 0x7b, 0xd1, 0x13, 0x8d, 0x62, 0xfd, - 0x28, 0xbd, 0x44, 0x0e, 0x0f, 0x4e, 0x49, 0xb4, - 0x43, 0x11, 0xc0, 0x38, 0x38, 0x08, 0xd2, 0xd9, - 0x2e, 0x2c, 0x03, 0x9f, 0xa7, 0xd6, 0x37, 0x46, - 0x01, 0x1f, 0x58, 0x56, 0xc0, 0x9c, 0x07, 0x0c, - 0x9d, 0xba, 0x0a, 0x9a, 0x15, 0xd4, 0x63, 0x6a, - 0x13, 0x69, 0xe0, 0x6f, 0x4c, 0xd0, 0x53, 0xc0, - 0xf6, 0x6f, 0x3c, 0xb7, 0x7d, 0xcb, 0x3b, 0x40, - 0x8e, 0xfa, 0x04, 0x48, 0x16, 0x35, 0x8b, 0x7d, - 0xbc, 0x81, 0xaa, 0xb2, 0xe8, 0xbf, 0x7a, 0x0c, - 0x1c, 0xfe, 0x86, 0x26, 0x8e, 0x86, 0x25, 0x83, - 0x9d, 0x07, 0x11, 0xcf, 0xb8, 0x5b, 0x88, 0xe9, - 0x5e, 0x12, 0x21, 0x13, 0xed, 0xb1, 0xfa, 0x0c, - 0x87, 0xf0, 0xa3, 0x96, 0x05, 0x75, 0x33, 0x7a, - 0x3d, 0x1f, 0x09, 0x49, 0x58, 0x56, 0x9d, 0x95, - 0x5e, 0x52, 0x9b, 0x30, 0x3d, 0x64, 0x3d, 0xe4, - 0xde, 0xcb, 0x3c, 0x59, 0x56, 0x0d, 0xd4, 0x94, - 0x43, 0xf6, 0x24, 0xb7, 0x19, 0x1f, 0xa5, 0x6f, - 0xd7, 0xc5, 0x9f, 0x56, 0xde, 0xe7, 0x38, 0x8a, - 0xed, 0x3c, 0x15, 0xc1, 0x9b, 0x6b, 0x55, 0xab, - 0x11, 0xa4, 0xce, 0xef, 0xd2, 0x4c, 0x88, 0x00, - 0xad, 0x15, 0x18, 0xff, 0xb5, 0xad, 0xdf, 0x6f, - 0xa4, 0xdc, 0xbc, 0xab, 0x84, 0x65, 0x30, 0xab, - 0x09, 0x6b, 0xf4, 0xff, 0x43, 0x78, 0x30, 0x08, - 0xa7, 0xa0, 0xa9, 0xa2, 0xf0, 0x8b, 0x72, 0x82, - 0xa0, 0x5c, 0x12, 0xb0, 0x27, 0xe1, 0x84, 0x09, - 0x27, 0x6e, 0x2d, 0x62, 0xc6, 0xd1, 0x85, 0x1a, - 0x72, 0xb1, 0xbf, 0x83, 0xcc, 0x7f, 0xfa, 0x13, - 0x54, 0xe0, 0x71, 0xfa, 0x0e, 0x23, 0x7d, 0x06, - 0x25, 0x18, 0x4a, 0x11, 0x69, 0x43, 0x76, 0xe8, - 0xc8, 0x18, 0x23, 0x96, 0x15, 0x2c, 0x7f, 0x4e, - 0x8b, 0x01, 0x83, 0x6d, 0x18, 0x83, 0x04, 0x5b, - 0x80, 0xa8, 0xc1, 0x9d, 0x01, 0xfa, 0xe2, 0xa3, - 0x8d, 0x4f, 0xe9, 0x63, 0x0d, 0xfe, 0xe7, 0x7b, - 0xcc, 0x5e, 0x86, 0xf5, 0x1b, 0xae, 0x0e, 0x93, - 0xa0, 0x1f, 0x36, 0x33, 0xe8, 0x0e, 0x74, 0xcf, - 0xa0, 0x43, 0x11, 0x82, 0x6d, 0x5a, 0xa8, 0xa6, - 0x1a, 0xcb, 0xa1, 0xb4, 0x99, 0x6a, 0x08, 0x8f, - 0x68, 0x30, 0x2c, 0x5f, 0x51, 0xfd, 0x10, 0x1a, - 0xff, 0xd6, 0xec, 0xe7, 0x7a, 0xc7, 0xaf, 0x49, - 0x16, 0xbb, 0x51, 0x50, 0xad, 0xbf, 0x8b, 0x76, - 0x86, 0x20, 0x9b, 0x11, 0x81, 0xc5, 0x1b, 0x6f, - 0x06, 0xdf, 0xfc, 0x28, 0xda, 0xe9, 0x03, 0x6a, - 0xc1, 0x83, 0x96, 0xc1, 0x86, 0x3a, 0x12, 0xd2, - 0x8a, 0x8c, 0x83, 0x85, 0xd0, 0xa0, 0xf3, 0x2e, - 0x86, 0xee, 0xe1, 0xb7, 0xa1, 0x6d, 0x16, 0x2e, - 0xf4, 0x46, 0xc1, 0x45, 0x99, 0xd2, 0x6d, 0x72, - 0xd2, 0xe6, 0x52, 0x84, 0x07, 0x84, 0xf3, 0xc0, - 0xe0, 0x0e, 0xa2, 0x1f, 0x6c, 0xce, 0xf6, 0x83, - 0xc1, 0xc0, 0x3f, 0x47, 0xb9, 0x68, 0xc8, 0x11, - 0x04, 0x14, 0x40, 0xc3, 0x43, 0x13, 0xa0, 0xf3, - 0xff, 0xff, 0xbe, 0xfe, 0x58, 0xd4, 0x51, 0x7b, - 0x0a, 0x01, 0x62, 0x48, 0xe1, 0x9b, 0x6b, 0x65, - 0x8b, 0x54, 0x41, 0xc8, 0x9d, 0x57, 0x57, 0x64, - 0xf7, 0x51, 0x83, 0x0c, 0x47, 0x25, 0x01, 0xc8, - 0xad, 0x4a, 0x58, 0x4b, 0x05, 0xe0, 0xc0, 0x3d, - 0x10, 0x4e, 0xb5, 0x85, 0xb8, 0xbc, 0xb0, 0x1e, - 0x2a, 0x00, 0xb0, 0x58, 0xbd, 0x5e, 0xca, 0x4a, - 0x0c, 0x2e, 0x19, 0x82, 0xe5, 0x3e, 0x8b, 0xa0, - 0xe0, 0xc8, 0x8a, 0xae, 0xe7, 0xbe, 0x55, 0xbc, - 0x45, 0x4a, 0x60, 0x60, 0x09, 0xcb, 0x89, 0x4c, - 0x32, 0x08, 0x6d, 0x09, 0x0d, 0xb4, 0xd2, 0x54, - 0xf8, 0xa8, 0xab, 0xca, 0x6f, 0xc4, 0xbf, 0x00, - 0xe6, 0xb6, 0x8c, 0x4f, 0xc6, 0x16, 0xf7, 0x67, - 0x1a, 0x9b, 0x2a, 0x1c, 0xe0, 0x0e, 0x44, 0x80, - 0x80, 0x34, 0xb2, 0x9d, 0x59, 0x58, 0x17, 0xd1, - 0x87, 0x81, 0x60, 0x2c, 0xf8, 0x0a, 0xad, 0x69, - 0x49, 0x5d, 0x40, 0x43, 0x1b, 0x4e, 0x83, 0x7c, - 0x48, 0x88, 0x92, 0x09, 0x3f, 0x05, 0x78, 0xf6, - 0xc0, 0x60, 0xc9, 0xea, 0xd0, 0x66, 0xd3, 0x20, - 0x08, 0x5b, 0xa0, 0xaf, 0x1d, 0xb3, 0xa1, 0x35, - 0x2e, 0x1c, 0xc8, 0x33, 0x09, 0x1a, 0x34, 0x6d, - 0x83, 0x06, 0x61, 0x21, 0x5a, 0x99, 0x57, 0xd1, - 0xcc, 0xa2, 0x96, 0xed, 0x05, 0xc3, 0x61, 0x84, - 0x1e, 0x07, 0xfc, 0x3e, 0x55, 0x2d, 0x01, 0xe4, - 0x92, 0xc4, 0x56, 0xd6, 0xff, 0xc0, 0xa0, 0x6a, - 0x23, 0x89, 0x29, 0xc4, 0x76, 0x43, 0xf6, 0x7c, - 0xd6, 0x55, 0x0a, 0x0a, 0xb1, 0x00, 0x13, 0xaf, - 0xa2, 0xa0, 0xe4, 0x5c, 0x11, 0xb2, 0xa2, 0x51, - 0x80, 0x46, 0x98, 0xc3, 0x1e, 0x1b, 0x35, 0xc2, - 0x5c, 0xb5, 0xf4, 0xfb, 0xf2, 0x1c, 0x83, 0x83, - 0x80, 0x7c, 0xf8, 0x01, 0xfd, 0x9a, 0x85, 0x49, - 0x69, 0xc7, 0xd8, 0x1a, 0xc3, 0x0f, 0xa3, 0x27, - 0xb5, 0xa6, 0xc5, 0xdb, 0x3a, 0x15, 0x6e, 0x5e, - 0xdb, 0x93, 0x60, 0x8b, 0x28, 0x31, 0x48, 0xc0, - 0x35, 0x09, 0x3b, 0x5f, 0x28, 0x18, 0x54, 0x01, - 0x80, 0x66, 0x8c, 0x8e, 0x7e, 0xd6, 0xaa, 0x8d, - 0xa9, 0x9c, 0xa6, 0xe3, 0x10, 0xb6, 0x8c, 0x16, - 0xd0, 0x97, 0x4f, 0x78, 0x15, 0x21, 0x88, 0xb8, - 0x85, 0xb9, 0x01, 0xd1, 0x67, 0x69, 0xfd, 0xbe, - 0xe4, 0x52, 0xd6, 0xc4, 0x6a, 0x24, 0x07, 0x54, - 0x28, 0x08, 0xa6, 0x6f, 0x94, 0x03, 0x22, 0xf8, - 0x67, 0x46, 0x20, 0x9a, 0x4c, 0x93, 0x90, 0x1c, - 0x09, 0x90, 0x32, 0x46, 0x32, 0x0a, 0x2d, 0xe8, - 0x27, 0xc5, 0xdc, 0xf6, 0xc9, 0xde, 0x4e, 0x1a, - 0x45, 0x02, 0x5b, 0xab, 0xeb, 0x4a, 0x2f, 0x4d, - 0x95, 0x29, 0xe8, 0x0f, 0x04, 0xcc, 0xb8, 0xbc, - 0x6b, 0x32, 0x06, 0x08, 0x0d, 0xc0, 0x5f, 0xdb, - 0x24, 0x46, 0xb1, 0xbe, 0x85, 0x5a, 0xeb, 0x4a, - 0xa0, 0x40, 0x42, 0x48, 0x59, 0x37, 0xbd, 0x18, - 0x82, 0x72, 0x63, 0xfd, 0xa5, 0x12, 0x83, 0x90, - 0x85, 0x1e, 0xd5, 0x83, 0x35, 0xe0, 0xb9, 0x02, - 0xc7, 0xcd, 0x88, 0x23, 0x86, 0xe7, 0xc7, 0x12, - 0x4b, 0xcd, 0x1c, 0x59, 0x51, 0x29, 0x0c, 0x3b, - 0xc9, 0xd0, 0x4d, 0xf9, 0x6a, 0x33, 0xba, 0xef, - 0x2e, 0xe5, 0xd8, 0x69, 0x1a, 0x14, 0x44, 0x29, - 0xe6, 0xcb, 0xee, 0x7f, 0xd6, 0x9b, 0x25, 0x0c, - 0x51, 0x05, 0x48, 0xe4, 0xf9, 0x6a, 0xfd, 0xc9, - 0x9d, 0x8b, 0xd9, 0xd1, 0x3a, 0x14, 0x7d, 0xa9, - 0x38, 0x5a, 0x55, 0xd4, 0x57, 0x7f, 0xfb, 0x62, - 0x11, 0x80, 0x30, 0x61, 0x1d, 0x6a, 0x00, 0x92, - 0x2e, 0x9a, 0x7b, 0x82, 0x4a, 0x75, 0x77, 0x3b, - 0x61, 0xb6, 0xbe, 0x36, 0xa1, 0x87, 0x67, 0x46, - 0x0f, 0x30, 0xaf, 0x70, 0xbd, 0x8d, 0xc8, 0x31, - 0x53, 0x37, 0xc0, 0xc1, 0x8c, 0x15, 0x1d, 0x4d, - 0x38, 0xb5, 0x5c, 0x1c, 0x0b, 0xc1, 0x53, 0x17, - 0xe0, 0x75, 0xb6, 0x68, 0x19, 0x9d, 0x2b, 0xf4, - 0xe2, 0x09, 0x41, 0x30, 0xbe, 0xd0, 0xf7, 0xb2, - 0x2c, 0x69, 0xd1, 0x33, 0x83, 0xa6, 0x59, 0x66, - 0x17, 0xcb, 0x59, 0x6c, 0x18, 0x0c, 0x27, 0x1b, - 0xfe, 0xd4, 0x72, 0xac, 0x75, 0x25, 0x65, 0xca, - 0xfa, 0x0c, 0x05, 0xac, 0x29, 0x06, 0x04, 0xe1, - 0x78, 0xe8, 0x79, 0x4a, 0xf2, 0xa9, 0xe6, 0xfb, - 0xf1, 0x0e, 0x7e, 0xcd, 0x95, 0x6c, 0xed, 0x5a, - 0x9a, 0xa6, 0xc5, 0x01, 0x4d, 0x38, 0x36, 0x24, - 0x6b, 0xac, 0xe8, 0xf0, 0x77, 0xb9, 0xe9, 0x6f, - 0x55, 0x8f, 0x52, 0x48, 0xb2, 0xeb, 0xe6, 0x29, - 0xb7, 0xa6, 0xa5, 0x71, 0xbe, 0x57, 0x9e, 0xd0, - 0xda, 0xa1, 0xe5, 0x08, 0xaa, 0x65, 0xc1, 0x13, - 0xe8, 0x43, 0xef, 0x06, 0xac, 0xf8, 0x1f, 0x37, - 0xff, 0xb7, 0x53, 0x7e, 0x65, 0xd9, 0xf4, 0xdf, - 0x99, 0xc5, 0x25, 0x9b, 0x9b, 0x5c, 0x71, 0x90, - 0x6c, 0x49, 0xbe, 0x55, 0xff, 0x69, 0x70, 0xfa, - 0xff, 0xca, 0x7f, 0xe4, 0xe2, 0x4c, 0x42, 0x84, - 0x3a, 0x7d, 0xb0, 0x07, 0x07, 0x8c, 0x29, 0x80, - 0xc5, 0xa3, 0xc6, 0xee, 0xe1, 0x66, 0xe3, 0x1f, - 0xdf, 0xd5, 0x15, 0x08, 0x89, 0x16, 0x3c, 0x30, - 0x39, 0xcf, 0xaf, 0x35, 0x10, 0x2a, 0x38, 0x19, - 0xbe, 0x26, 0xb8, 0x13, 0x83, 0x00, 0x1c, 0xe4, - 0xda, 0xc5, 0x2b, 0xcf, 0xd2, 0xad, 0xc2, 0xa9, - 0x37, 0xb7, 0xb5, 0x01, 0x41, 0x0d, 0x40, 0x38, - 0x01, 0x9d, 0xe5, 0x12, 0x7f, 0xb4, 0x38, 0x54, - 0x5c, 0xdb, 0x7c, 0x02, 0x73, 0x7e, 0x2c, 0x17, - 0x2a, 0x1e, 0x09, 0x0a, 0xb3, 0x7c, 0x5d, 0x07, - 0xbb, 0xf5, 0xfb, 0xff, 0xa6, 0x9e, 0xef, 0x29, - 0xb5, 0x0b, 0x70, 0x6a, 0xa0, 0x6d, 0x01, 0x67, - 0xe9, 0x2d, 0x98, 0x72, 0xa6, 0x44, 0x47, 0x12, - 0xa2, 0x58, 0x25, 0x2b, 0xdc, 0x67, 0x71, 0xa5, - 0x57, 0x0b, 0x15, 0x65, 0xba, 0xa6, 0x07, 0xb3, - 0xb6, 0x22, 0x35, 0xde, 0x13, 0x09, 0xda, 0x08, - 0x0d, 0xb3, 0xad, 0x83, 0xc1, 0x40, 0x42, 0x3b, - 0xb7, 0x22, 0x90, 0xf5, 0xbe, 0x5d, 0xea, 0xcb, - 0x01, 0x88, 0xa5, 0x72, 0x60, 0xbe, 0x23, 0x64, - 0x6d, 0x57, 0xbb, 0x10, 0x7f, 0x94, 0x41, 0xac, - 0x73, 0x84, 0xb1, 0x75, 0xc1, 0x38, 0xeb, 0x25, - 0xbe, 0x6e, 0xf4, 0xb9, 0x8f, 0xa9, 0xd5, 0x84, - 0x14, 0xad, 0xfe, 0xc3, 0x48, 0x11, 0x52, 0x99, - 0x3a, 0x4e, 0x70, 0xe7, 0x65, 0x5a, 0x29, 0x85, - 0x2a, 0x02, 0x68, 0x99, 0xaf, 0xaa, 0xfa, 0xad, - 0x2c, 0xd1, 0x09, 0x46, 0xc4, 0x0d, 0xfd, 0xba, - 0x0c, 0x18, 0x98, 0x6d, 0x97, 0x5a, 0xd3, 0x0d, - 0xf9, 0x57, 0xbd, 0x75, 0x4e, 0x7f, 0x3b, 0xd5, - 0xf2, 0xa3, 0x9d, 0xde, 0xaf, 0x10, 0x13, 0x97, - 0xd5, 0x1c, 0xdb, 0xa3, 0xa2, 0xe9, 0x50, 0x7d, - 0x44, 0xdd, 0xe4, 0x0d, 0xea, 0x08, 0x27, 0x33, - 0x41, 0xba, 0xd5, 0xda, 0xc4, 0x2c, 0xec, 0xe7, - 0x66, 0x35, 0xc9, 0x3b, 0xd9, 0x27, 0x73, 0x83, - 0x17, 0x0d, 0x08, 0x3d, 0x35, 0x34, 0xa6, 0x9e, - 0xd7, 0xea, 0x84, 0xb2, 0xcf, 0x87, 0x95, 0x94, - 0xd5, 0x8b, 0x2e, 0x11, 0x89, 0x02, 0x06, 0x25, - 0x6a, 0x46, 0xd5, 0xe5, 0xa5, 0xb9, 0x54, 0x67, - 0x22, 0x9d, 0x2b, 0x92, 0xa0, 0x3c, 0x5e, 0xc5, - 0x78, 0x38, 0xac, 0xc2, 0xff, 0xe1, 0x57, 0xbc, - 0xb2, 0xd5, 0x48, 0xc7, 0x85, 0x10, 0x81, 0x54, - 0x89, 0x3d, 0xbb, 0xdc, 0xb8, 0xd8, 0xf5, 0x9c, - 0x8c, 0xa7, 0xe9, 0x46, 0x45, 0xd7, 0x40, 0x88, - 0x8c, 0xdc, 0x56, 0xdc, 0x46, 0xa3, 0x06, 0xfc, - 0xce, 0x91, 0x69, 0x8a, 0x55, 0x02, 0x8b, 0x72, - 0xe7, 0xdb, 0x1f, 0xa5, 0x2b, 0x06, 0x40, 0x55, - 0x31, 0x45, 0x9d, 0x40, 0xdd, 0x90, 0x54, 0x9a, - 0x70, 0x64, 0x89, 0x15, 0xc9, 0xbe, 0x4f, 0xb3, - 0x6d, 0xe5, 0x1c, 0xab, 0xc2, 0xc8, 0x30, 0x94, - 0xea, 0x5e, 0x54, 0xab, 0x14, 0x7b, 0xfe, 0xce, - 0x9b, 0xe6, 0xae, 0x50, 0xa6, 0xe9, 0x18, 0xb6, - 0xb1, 0x95, 0x44, 0x53, 0xcf, 0x7b, 0x96, 0x7b, - 0x98, 0x59, 0x43, 0x8e, 0x95, 0x0c, 0x21, 0x3b, - 0x95, 0xc2, 0xb5, 0xe1, 0x42, 0x80, 0xc0, 0xf6, - 0x99, 0xa4, 0xe0, 0x19, 0x83, 0xe1, 0x29, 0x28, - 0xf3, 0xd4, 0x72, 0xdb, 0x77, 0xd4, 0x3c, 0xaa, - 0x70, 0x3c, 0x45, 0xbd, 0x1b, 0x76, 0xf4, 0x80, - 0x30, 0x60, 0x34, 0x12, 0x6f, 0xe2, 0x84, 0x96, - 0xaf, 0x36, 0x29, 0xfb, 0x52, 0x73, 0xa8, 0xff, - 0x2d, 0xe9, 0xe3, 0x3f, 0xf4, 0xa8, 0xb2, 0xf7, - 0x4d, 0x15, 0x45, 0x83, 0x9b, 0x38, 0x33, 0x8b, - 0x8a, 0xf0, 0x80, 0xd4, 0x5e, 0x79, 0x7e, 0xf2, - 0xd1, 0xb8, 0xbe, 0x2f, 0xb2, 0x94, 0x9e, 0x24, - 0x73, 0xfe, 0x02, 0x63, 0x26, 0x79, 0xa4, 0xdd, - 0x4a, 0xda, 0x4a, 0xb5, 0xbb, 0x7c, 0x55, 0xdb, - 0xee, 0xca, 0x1b, 0x4b, 0xd9, 0xd8, 0x02, 0x0e, - 0xfd, 0xaa, 0xd7, 0xee, 0x6c, 0xb3, 0x86, 0xfb, - 0x28, 0x56, 0x0c, 0x1a, 0xab, 0xf8, 0x24, 0xb3, - 0xf5, 0x51, 0x46, 0xc6, 0x5b, 0xbd, 0x5a, 0xc9, - 0x26, 0xd9, 0xb5, 0x75, 0xb9, 0xc3, 0x7c, 0x3c, - 0x48, 0x43, 0x08, 0x5a, 0x3f, 0x6f, 0x4b, 0xfb, - 0x41, 0x86, 0xc5, 0xad, 0xf1, 0x78, 0xa7, 0x24, - 0xce, 0x45, 0xe8, 0xa4, 0x5e, 0x33, 0xcb, 0x3b, - 0x39, 0xd4, 0x67, 0x55, 0x72, 0x63, 0xc2, 0xd6, - 0x1b, 0x45, 0x29, 0xbb, 0xd8, 0x81, 0x00, 0xcc, - 0x63, 0xd3, 0xc5, 0x12, 0x73, 0xfe, 0xf6, 0xde, - 0x6e, 0x41, 0x89, 0x5f, 0xaf, 0x65, 0x5a, 0x9b, - 0x21, 0x59, 0x5c, 0xc1, 0x0b, 0xc5, 0x7a, 0xbe, - 0x28, 0xdf, 0x40, 0xf6, 0x2c, 0x8a, 0xc2, 0xa5, - 0x2b, 0x74, 0xf9, 0x3d, 0x63, 0x13, 0xd8, 0x98, - 0x71, 0x6f, 0x73, 0xb6, 0x88, 0x0d, 0xb3, 0x66, - 0x5a, 0x56, 0x22, 0x77, 0x9b, 0x88, 0x08, 0x64, - 0x2d, 0xff, 0x50, 0x42, 0x0d, 0x35, 0x47, 0x1b, - 0x93, 0x2d, 0x42, 0x88, 0x50, 0x2f, 0x06, 0xcf, - 0x29, 0x4a, 0x3e, 0xa5, 0x5d, 0xc4, 0xea, 0xbb, - 0x03, 0xde, 0xf0, 0x73, 0x2f, 0x51, 0xa8, 0x13, - 0x11, 0x64, 0x03, 0x14, 0xfb, 0xb3, 0xe1, 0xe2, - 0x65, 0x18, 0xcd, 0xd9, 0x51, 0x72, 0xf3, 0x72, - 0xd1, 0x12, 0xa3, 0x42, 0x8c, 0x4d, 0x00, 0x79, - 0x9f, 0x36, 0x24, 0x8e, 0x95, 0x2a, 0xcc, 0x06, - 0x02, 0xea, 0xad, 0x2b, 0xaa, 0x43, 0xcf, 0xe5, - 0xd3, 0x4b, 0x2c, 0x4a, 0x34, 0x76, 0xdb, 0x9b, - 0x97, 0x80, 0xe1, 0x56, 0xba, 0x6d, 0xe5, 0xf7, - 0x40, 0x70, 0x3a, 0x05, 0x91, 0xca, 0x8f, 0x9b, - 0xc1, 0x88, 0x2c, 0x0f, 0x0b, 0xb2, 0x50, 0x42, - 0x06, 0x2d, 0xbb, 0x98, 0x4b, 0xc6, 0x22, 0x90, - 0x78, 0xcf, 0xfd, 0xe6, 0x50, 0x60, 0x9d, 0x16, - 0xda, 0xd1, 0xd2, 0x6f, 0xb3, 0xf9, 0x21, 0xab, - 0x38, 0xc2, 0x30, 0xd4, 0xb7, 0xea, 0x1d, 0xfa, - 0xf6, 0xe7, 0x01, 0xc1, 0xde, 0xc0, 0xb3, 0x4f, - 0x03, 0x0f, 0xe7, 0x40, 0x39, 0x3a, 0x3a, 0xbb, - 0x08, 0x81, 0x5f, 0x10, 0x10, 0x94, 0x4c, 0x5d, - 0x3f, 0x9f, 0xd0, 0x34, 0x9d, 0x3e, 0xad, 0x31, - 0x8f, 0x66, 0xf6, 0xf4, 0x45, 0x2a, 0x9b, 0x78, - 0xe2, 0x02, 0x3f, 0xbc, 0x3f, 0x2e, 0xfb, 0x01, - 0xf8, 0x1a, 0x9b, 0xc0, 0xf6, 0xe5, 0xb5, 0x65, - 0xf8, 0xa2, 0xce, 0x3c, 0x23, 0xb4, 0x25, 0x17, - 0x2a, 0xb5, 0xa0, 0x60, 0xfd, 0x5f, 0x2f, 0xa5, - 0x0f, 0xd5, 0x28, 0x6b, 0xf6, 0xf4, 0x3a, 0xe4, - 0xf2, 0x28, 0x8c, 0xd8, 0xac, 0xe4, 0xdf, 0x51, - 0x0b, 0x14, 0x6a, 0x32, 0x5e, 0x0b, 0x9d, 0x5f, - 0xf8, 0x9d, 0x27, 0xfd, 0x36, 0xfb, 0xfa, 0x59, - 0xe0, 0x33, 0xce, 0xf1, 0x63, 0xb6, 0xd9, 0x6f, - 0x41, 0xe1, 0x20, 0x15, 0xba, 0x5e, 0x42, 0x57, - 0xed, 0x09, 0x1a, 0x59, 0xed, 0x1e, 0x8f, 0x4b, - 0xea, 0x56, 0x94, 0x6f, 0x33, 0xba, 0x2f, 0x14, - 0x74, 0x9e, 0x08, 0x51, 0x08, 0x8d, 0xbf, 0xf3, - 0x7d, 0x57, 0x2a, 0xf1, 0x01, 0xf2, 0x59, 0xd2, - 0xd9, 0xce, 0xe4, 0x97, 0xa4, 0xf8, 0x3f, 0x9c, - 0x00, 0x6b, 0xa3, 0x1a, 0xfe, 0x82, 0x26, 0xd6, - 0x26, 0x67, 0xb6, 0xf2, 0xab, 0xad, 0x7c, 0x3d, - 0x9c, 0x06, 0x34, 0xa3, 0x61, 0x55, 0x29, 0x42, - 0xe3, 0xac, 0xea, 0x52, 0x4a, 0xc6, 0x1c, 0x32, - 0x21, 0xa5, 0x69, 0xbf, 0x7f, 0x1a, 0xc6, 0x04, - 0xaa, 0x92, 0x0e, 0x54, 0x79, 0xac, 0xa5, 0xbb, - 0xe4, 0x32, 0xc5, 0x2a, 0x38, 0x69, 0x67, 0x91, - 0x57, 0xf1, 0xfa, 0xa0, 0xe9, 0xa5, 0x43, 0xea, - 0x9e, 0x6c, 0xe4, 0x1b, 0x72, 0xef, 0x1c, 0x5a, - 0xac, 0xcc, 0xf7, 0xae, 0x41, 0xcc, 0xa6, 0xcf, - 0xaa, 0xe5, 0xd5, 0x77, 0xc1, 0xdc, 0x6e, 0x7f, - 0xb9, 0xad, 0x62, 0xe5, 0x56, 0xf0, 0xd3, 0xca, - 0x35, 0x1a, 0x55, 0x3f, 0xa0, 0xc1, 0xef, 0x9b, - 0x6a, 0x59, 0xba, 0x59, 0x35, 0x6f, 0x72, 0xd3, - 0x48, 0x86, 0xa5, 0x41, 0x4e, 0x25, 0xa3, 0x06, - 0x0f, 0x55, 0xa6, 0x9b, 0xb3, 0x26, 0x03, 0x8e, - 0x2d, 0xe6, 0x75, 0x3b, 0x38, 0xd4, 0xe7, 0xfe, - 0xa3, 0xdd, 0xe5, 0xd9, 0x2a, 0x20, 0x71, 0x29, - 0x39, 0xec, 0xab, 0xdc, 0xda, 0xa5, 0x47, 0xae, - 0x59, 0x05, 0xb5, 0x71, 0x2b, 0x0a, 0x84, 0x25, - 0x51, 0x9f, 0xa9, 0x6d, 0x2f, 0x9b, 0x8a, 0x1b, - 0x4f, 0xc9, 0xfd, 0xe6, 0x4e, 0x74, 0x3b, 0x5c, - 0x8b, 0xf3, 0x6e, 0x4a, 0x18, 0xc0, 0x74, 0x3f, - 0x72, 0xee, 0x48, 0xa7, 0x75, 0xb6, 0x7f, 0x6a, - 0x2e, 0x49, 0x6a, 0xd3, 0xa1, 0x40, 0xd4, 0x47, - 0xd8, 0xce, 0x59, 0x2c, 0x43, 0xc5, 0xe5, 0x5d, - 0xfa, 0x66, 0x3f, 0xfa, 0x86, 0xf5, 0x7c, 0x3d, - 0x17, 0x32, 0xa2, 0x0f, 0xf1, 0xa5, 0x3d, 0xb4, - 0x11, 0xf8, 0x6c, 0x96, 0x22, 0x18, 0xb9, 0xe9, - 0x56, 0xee, 0x15, 0x28, 0x44, 0x84, 0x91, 0x11, - 0x09, 0xab, 0x75, 0xb6, 0x3d, 0xd9, 0x38, 0xb9, - 0x6a, 0x10, 0x1c, 0x35, 0x19, 0xb3, 0x89, 0xd9, - 0x95, 0x16, 0xfa, 0x92, 0x2f, 0x45, 0xdc, 0x3f, - 0x25, 0x2c, 0xd0, 0x74, 0xd0, 0xc8, 0xf6, 0x9a, - 0x31, 0x3f, 0xb8, 0x5a, 0x80, 0xd2, 0xc8, 0x39, - 0x10, 0x04, 0xb1, 0x12, 0xf9, 0x19, 0x5a, 0xe6, - 0xa0, 0xd1, 0x7d, 0x00, 0xdd, 0xed, 0x2b, 0x49, - 0xa0, 0x48, 0x07, 0x3c, 0x69, 0x00, 0x34, 0x43, - 0x5e, 0xc6, 0xf1, 0xa4, 0x12, 0x73, 0x06, 0xc8, - 0x0e, 0x97, 0x18, 0xdb, 0xd5, 0x82, 0xbd, 0x78, - 0xf2, 0x3f, 0x5e, 0xa1, 0x5f, 0x88, 0x88, 0x92, - 0xfe, 0x5f, 0x5b, 0xe9, 0xda, 0x04, 0xe5, 0x04, - 0xc2, 0x23, 0xf6, 0x95, 0x49, 0x92, 0x40, 0xfd, - 0x58, 0x31, 0xbd, 0xc8, 0x83, 0xd2, 0xd4, 0x76, - 0x21, 0x0a, 0x82, 0x40, 0xf0, 0x21, 0x26, 0x69, - 0x40, 0x19, 0x12, 0xcb, 0x95, 0x37, 0xd1, 0xc6, - 0x82, 0xbb, 0x56, 0xab, 0x8d, 0x86, 0xcf, 0xb2, - 0x83, 0xba, 0x43, 0x53, 0xa6, 0x95, 0x7e, 0x52, - 0xb6, 0x6e, 0xac, 0x8a, 0xa1, 0x29, 0x38, 0x58, - 0x77, 0xbe, 0xf2, 0x46, 0x77, 0x65, 0x2c, 0xc8, - 0xa6, 0xac, 0xba, 0x88, 0x8e, 0xc3, 0x74, 0x5c, - 0x41, 0x70, 0x20, 0x8f, 0xf6, 0x16, 0x87, 0xc3, - 0xa4, 0xc6, 0xe1, 0x78, 0x97, 0xef, 0x51, 0x87, - 0x17, 0xea, 0xc8, 0xe9, 0xc5, 0x04, 0x31, 0xe9, - 0x68, 0x84, 0xde, 0x26, 0x56, 0x3a, 0xf8, 0xfc, - 0xb3, 0x8a, 0x12, 0x33, 0xe6, 0x57, 0x43, 0x32, - 0x6f, 0xd1, 0x0d, 0x6a, 0x8d, 0x83, 0x7e, 0x70, - 0x1c, 0x7a, 0x26, 0xbe, 0x02, 0x94, 0x03, 0x98, - 0x6e, 0x6b, 0x0c, 0x0e, 0xdb, 0xdc, 0x44, 0x55, - 0x80, 0xc0, 0x3c, 0x26, 0x33, 0xf0, 0x41, 0xd6, - 0xdb, 0x97, 0xc3, 0xa5, 0x77, 0xd7, 0x26, 0xf7, - 0x6e, 0x79, 0x47, 0x67, 0x78, 0xbe, 0x55, 0xc5, - 0x41, 0x9d, 0x5a, 0xb0, 0x65, 0x6a, 0x0a, 0xd2, - 0x0f, 0xfd, 0xe0, 0xe7, 0xc3, 0xa5, 0x00, 0xf1, - 0x5f, 0xfb, 0xb4, 0xc0, 0x30, 0x4e, 0x3d, 0x6d, - 0x94, 0xb6, 0x83, 0x2f, 0xf6, 0xed, 0x06, 0x25, - 0xbb, 0xd0, 0x60, 0xaf, 0xea, 0x64, 0x2b, 0x86, - 0x9b, 0x68, 0x66, 0x79, 0x91, 0x8f, 0x7c, 0x10, - 0xd5, 0x8e, 0x73, 0xaa, 0x8b, 0x95, 0x67, 0x54, - 0x52, 0xd1, 0xeb, 0x5d, 0x9e, 0x42, 0x22, 0xf9, - 0x73, 0xd0, 0x3d, 0x11, 0xc1, 0x09, 0xa1, 0x15, - 0x33, 0x7f, 0x99, 0x54, 0x28, 0xdf, 0xb7, 0xcb, - 0x50, 0x8d, 0xff, 0x0f, 0xad, 0xd7, 0xf3, 0x37, - 0xed, 0x20, 0xf6, 0x82, 0x3a, 0x80, 0xc8, 0xfe, - 0x91, 0x1a, 0x0d, 0xa0, 0xa0, 0xc9, 0x20, 0x2a, - 0xa3, 0x76, 0x64, 0x9d, 0x04, 0x4f, 0x5e, 0x83, - 0x0c, 0x78, 0xf1, 0x82, 0x70, 0x66, 0x47, 0xd6, - 0x71, 0x50, 0x8d, 0x06, 0x31, 0x89, 0xd4, 0x05, - 0x4d, 0x4b, 0xde, 0x03, 0x0a, 0x59, 0x46, 0x04, - 0x81, 0x2d, 0x38, 0x30, 0xd8, 0x74, 0x3f, 0x64, - 0x18, 0xa1, 0x33, 0x3f, 0x83, 0x1c, 0xc7, 0x8f, - 0xd6, 0xf8, 0x49, 0x09, 0x7f, 0xfa, 0x19, 0x99, - 0xd7, 0x30, 0xd8, 0x41, 0x4a, 0xc2, 0x6e, 0x35, - 0x3d, 0xac, 0xfe, 0xd2, 0xa6, 0xa1, 0xbb, 0x33, - 0x3c, 0xe3, 0x7c, 0xc0, 0x60, 0x3f, 0x3c, 0xdc, - 0x5a, 0x02, 0xa5, 0x26, 0x37, 0x94, 0x11, 0xbb, - 0xf6, 0xb4, 0x91, 0x1c, 0xc8, 0xe1, 0x60, 0x28, - 0x04, 0x36, 0x15, 0x2b, 0x0f, 0x23, 0x05, 0xe5, - 0xcc, 0xe3, 0x6c, 0x36, 0x15, 0x98, 0xbf, 0x07, - 0x81, 0x81, 0xcd, 0xb0, 0x51, 0xe8, 0x3c, 0x6c, - 0x01, 0x63, 0xcf, 0xc1, 0x88, 0x7f, 0x75, 0xa1, - 0x70, 0xe3, 0xe6, 0x4c, 0xb1, 0x4d, 0xaa, 0x4b, - 0x1a, 0x6b, 0x39, 0x02, 0x9d, 0x31, 0xe8, 0x8c, - 0x08, 0x21, 0x09, 0x9c, 0xf7, 0x9b, 0x1e, 0xb4, - 0xab, 0x85, 0xb7, 0xf1, 0x9c, 0xe7, 0x50, 0xe4, - 0xee, 0xf2, 0x0c, 0x00, 0x58, 0xb9, 0xa4, 0xf1, - 0xbf, 0xcd, 0x62, 0x2a, 0xf8, 0xe6, 0x8e, 0x65, - 0x94, 0xb5, 0x4e, 0xcb, 0xcc, 0x2c, 0x34, 0x6c, - 0x44, 0x88, 0x09, 0xd4, 0x68, 0x1e, 0x02, 0x08, - 0x32, 0xfe, 0x75, 0x58, 0x43, 0x63, 0xc4, 0x9e, - 0x4d, 0xbf, 0x17, 0xeb, 0x6c, 0x0c, 0x78, 0x78, - 0xd2, 0x40, 0x60, 0x0e, 0x2e, 0x4d, 0xfb, 0xa0, - 0xc1, 0xf8, 0xee, 0x56, 0x8a, 0xee, 0xaa, 0x6f, - 0xc9, 0x29, 0x4e, 0x07, 0x8d, 0xac, 0x1b, 0x96, - 0x9c, 0x2b, 0x13, 0xe7, 0x78, 0xba, 0xe8, 0x79, - 0xb6, 0x40, 0x71, 0xdd, 0x34, 0x1b, 0x4c, 0x9e, - 0x5e, 0xa9, 0x53, 0xba, 0xba, 0xc1, 0xd4, 0x81, - 0xc0, 0x15, 0x51, 0x50, 0xed, 0xbc, 0xef, 0x24, - 0x3c, 0x2b, 0xba, 0x39, 0x2a, 0xef, 0x27, 0xa7, - 0x2f, 0x27, 0x7b, 0x62, 0x3a, 0x6d, 0x70, 0xdf, - 0x86, 0xcf, 0x16, 0xf0, 0x18, 0x63, 0xf8, 0xd6, - 0x37, 0xb6, 0x4b, 0x23, 0x6a, 0xdb, 0x6d, 0xbb, - 0x7f, 0x9c, 0x5b, 0x79, 0x24, 0xe5, 0xe9, 0xae, - 0x22, 0xa7, 0x6c, 0x3e, 0x4b, 0x36, 0x58, 0xa3, - 0xd8, 0xcb, 0x15, 0x49, 0x6e, 0xef, 0x3b, 0x11, - 0xac, 0xb4, 0xd5, 0x8d, 0xd0, 0xa5, 0x56, 0x0e, - 0x65, 0x07, 0x13, 0x54, 0xff, 0xb3, 0x7f, 0x3e, - 0xa2, 0xee, 0xf0, 0xac, 0xd0, 0xc9, 0x79, 0x87, - 0xd5, 0x52, 0xa5, 0x49, 0x65, 0x44, 0x55, 0xaa, - 0x2c, 0x96, 0x1b, 0xe9, 0x36, 0x1f, 0x5c, 0x54, - 0xdb, 0x7e, 0x6e, 0x8e, 0x7f, 0x99, 0xd9, 0x24, - 0x51, 0x67, 0xaf, 0x64, 0x2a, 0xbc, 0xbc, 0xff, - 0x16, 0xe4, 0x40, 0x42, 0x4f, 0x5a, 0x92, 0x29, - 0x69, 0x15, 0x6f, 0xbb, 0x16, 0xe1, 0xbb, 0xd5, - 0x39, 0x38, 0xa0, 0x97, 0xa2, 0x65, 0x15, 0xe9, - 0xa6, 0x59, 0xec, 0x92, 0xed, 0xd5, 0x1b, 0x79, - 0x2d, 0x51, 0x2f, 0x56, 0x37, 0xbd, 0x24, 0x36, - 0x52, 0x43, 0x76, 0x28, 0xeb, 0x6a, 0x24, 0x6f, - 0x79, 0xd0, 0xe4, 0xaa, 0xf3, 0x27, 0x6a, 0xc8, - 0x91, 0xa2, 0xa6, 0x8e, 0xab, 0x92, 0xb3, 0xed, - 0xd0, 0xef, 0x11, 0xb4, 0xa0, 0xab, 0x60, 0xcb, - 0x3a, 0x52, 0xbd, 0x1a, 0xae, 0xc8, 0xe7, 0x56, - 0x9c, 0x53, 0x85, 0x8a, 0x77, 0x57, 0xcd, 0xa2, - 0xe5, 0xe1, 0xb3, 0x67, 0xa0, 0x9f, 0x4c, 0xbc, - 0xda, 0x39, 0xc2, 0xb9, 0x27, 0x11, 0xc3, 0x7a, - 0xb7, 0x17, 0xec, 0x1a, 0xc7, 0xf7, 0x3c, 0xd4, - 0xdf, 0xe6, 0x95, 0xf3, 0x25, 0x37, 0xb5, 0x04, - 0x50, 0xb7, 0x45, 0xc2, 0x72, 0x49, 0xb9, 0xbe, - 0xb3, 0xeb, 0x6e, 0x64, 0x8a, 0x6d, 0x80, 0xc1, - 0x9d, 0xe0, 0xc5, 0xf4, 0xad, 0x86, 0xdb, 0x51, - 0x2d, 0xbf, 0x68, 0xa9, 0x78, 0x83, 0x22, 0x1b, - 0xab, 0x9b, 0x28, 0x26, 0x36, 0xac, 0x84, 0xe6, - 0x98, 0x56, 0xf8, 0x84, 0x05, 0xdb, 0x94, 0x71, - 0x9d, 0xba, 0xdc, 0x5f, 0xcb, 0x2f, 0xbc, 0xd8, - 0x8e, 0xed, 0x24, 0x51, 0xd5, 0xfa, 0x4e, 0x2f, - 0x08, 0x5a, 0xc8, 0x96, 0x5c, 0xad, 0x86, 0x36, - 0xcd, 0x80, 0x60, 0xb7, 0x67, 0x3f, 0xc5, 0x25, - 0x45, 0x9d, 0x11, 0x26, 0x20, 0xed, 0xe7, 0x7a, - 0x7c, 0x4e, 0x3d, 0x51, 0x07, 0x29, 0x33, 0xfd, - 0xad, 0xa3, 0xc5, 0x02, 0x09, 0x62, 0xd9, 0x3a, - 0x55, 0x66, 0xd9, 0x16, 0x5e, 0x45, 0xad, 0x5d, - 0xe6, 0xc7, 0x43, 0xcd, 0x1e, 0x36, 0xdf, 0xcb, - 0x51, 0x4c, 0xf6, 0x60, 0x7b, 0x3b, 0x14, 0xa3, - 0x8b, 0xf1, 0x4a, 0x0b, 0x3a, 0x54, 0x46, 0x38, - 0xa7, 0x14, 0x1a, 0xe1, 0x3a, 0xa6, 0xa4, 0x08, - 0x5f, 0xf3, 0x3d, 0x6b, 0xf6, 0x5c, 0xc2, 0xc5, - 0x16, 0xdb, 0x69, 0xb5, 0x30, 0xac, 0x0b, 0xaf, - 0x56, 0xe1, 0x24, 0x3c, 0x2f, 0x69, 0x33, 0x3b, - 0xbd, 0xd6, 0x14, 0x28, 0x5b, 0x24, 0x9d, 0x46, - 0xb5, 0x5e, 0xa0, 0xb2, 0x73, 0x51, 0x0d, 0x04, - 0x6c, 0x0f, 0x38, 0x97, 0xed, 0xcd, 0xaa, 0x55, - 0xa3, 0xb5, 0x7e, 0x96, 0x22, 0xc1, 0x16, 0x2d, - 0xd4, 0x7c, 0xe9, 0xd4, 0xd9, 0xf3, 0x63, 0x86, - 0xfc, 0xd2, 0x82, 0xdd, 0x44, 0x86, 0xf5, 0x05, - 0xe5, 0x5f, 0x82, 0xe2, 0x47, 0xb9, 0x69, 0xb5, - 0x03, 0x4d, 0x31, 0xc0, 0x43, 0xa3, 0xb0, 0xfa, - 0xcb, 0x6b, 0x09, 0x23, 0x3f, 0x6b, 0x72, 0x28, - 0x97, 0xf2, 0xaf, 0x9c, 0x9c, 0x1b, 0x48, 0xb4, - 0x8b, 0x1f, 0x3a, 0x0d, 0x15, 0x2b, 0x82, 0x18, - 0xf9, 0x96, 0x0a, 0xfc, 0x06, 0xf3, 0x3e, 0x89, - 0x4c, 0x8a, 0x64, 0xaa, 0x43, 0x84, 0x7d, 0x82, - 0xe3, 0xa2, 0xc5, 0x62, 0x32, 0x51, 0xda, 0xa1, - 0xc0, 0xe0, 0xac, 0x73, 0x91, 0x9b, 0xfe, 0x49, - 0x9a, 0xc7, 0x43, 0xd9, 0x32, 0xd0, 0x2f, 0x2a, - 0x25, 0xa8, 0x99, 0x22, 0xe5, 0x4d, 0x08, 0xcc, - 0xa4, 0xf4, 0x6a, 0x34, 0x1f, 0x8f, 0xd8, 0x5f, - 0x8a, 0x57, 0xad, 0xc8, 0x8d, 0x4f, 0x27, 0x50, - 0x05, 0x12, 0xb6, 0x83, 0x83, 0x35, 0x82, 0x2d, - 0x30, 0x89, 0x78, 0x68, 0x5c, 0x09, 0x95, 0xd1, - 0x90, 0x38, 0x17, 0xb6, 0x88, 0xa0, 0x1c, 0x30, - 0x0a, 0x6c, 0x94, 0x16, 0x20, 0xb0, 0x0a, 0x8f, - 0x0c, 0xc9, 0xaa, 0xe6, 0x84, 0x82, 0xff, 0x6a, - 0x25, 0xc1, 0x1c, 0x1c, 0xbc, 0x05, 0xc1, 0x61, - 0xeb, 0x63, 0xce, 0x2b, 0x1e, 0x2a, 0x4b, 0x04, - 0x7c, 0x61, 0x9f, 0x8e, 0x99, 0xfd, 0x49, 0xa0, - 0x78, 0x43, 0xff, 0xb2, 0xe1, 0x5f, 0x3d, 0xec, - 0x06, 0xe8, 0x94, 0xbf, 0x67, 0x43, 0xdb, 0xfc, - 0xf3, 0x7c, 0xed, 0xc3, 0xf8, 0xa5, 0x11, 0xa0, - 0x58, 0x04, 0x5e, 0xab, 0x54, 0x99, 0x29, 0x53, - 0x0a, 0x87, 0xf1, 0x20, 0x78, 0xac, 0x18, 0x3d, - 0x2e, 0x12, 0xc4, 0x86, 0xd1, 0x28, 0xfc, 0x03, - 0x71, 0x38, 0xf8, 0x15, 0xb1, 0xad, 0x47, 0x03, - 0xa6, 0xcc, 0x7d, 0x53, 0x16, 0x94, 0x1d, 0x17, - 0x22, 0xdf, 0xe3, 0xef, 0x89, 0x77, 0xa3, 0xd6, - 0x87, 0x98, 0x9b, 0xf7, 0x1a, 0x1f, 0xb3, 0xad, - 0xb0, 0x5c, 0x23, 0x24, 0x4e, 0xca, 0x46, 0x13, - 0xeb, 0x71, 0xaa, 0x23, 0x46, 0x5a, 0xf8, 0x93, - 0xf6, 0x37, 0xf7, 0x26, 0x82, 0xb5, 0x3b, 0x7d, - 0xf4, 0xf5, 0xc9, 0x98, 0x01, 0x65, 0xb5, 0x50, - 0xf5, 0x4d, 0xcf, 0x36, 0xad, 0xb1, 0xd4, 0xff, - 0x9b, 0x4c, 0xc7, 0xef, 0x80, 0xcb, 0x0a, 0xd3, - 0x2b, 0xf3, 0x6c, 0x7f, 0x22, 0xd7, 0x2e, 0x01, - 0x5f, 0x59, 0xb9, 0x2c, 0xbf, 0xf6, 0xc8, 0xf3, - 0xd1, 0x85, 0x40, 0x7d, 0x30, 0x06, 0x08, 0x0c, - 0xb5, 0x78, 0xc0, 0x2a, 0xc4, 0xb4, 0xad, 0x80, - 0x69, 0x7a, 0x95, 0x69, 0xc7, 0xa9, 0xd4, 0x33, - 0x57, 0xf1, 0x74, 0x12, 0xfc, 0xd3, 0x4d, 0x62, - 0x96, 0x94, 0xef, 0x44, 0x81, 0xbd, 0x1b, 0x78, - 0xc0, 0xb9, 0x20, 0xf8, 0x79, 0x07, 0x89, 0xc4, - 0x06, 0x87, 0xc9, 0x32, 0xf1, 0xa6, 0x1b, 0xd4, - 0x81, 0x01, 0x5c, 0x54, 0xad, 0x9f, 0xd0, 0x61, - 0x04, 0x77, 0xf9, 0x32, 0xcd, 0x69, 0xb4, 0xac, - 0x78, 0x72, 0x94, 0x40, 0x4d, 0xee, 0xa9, 0xb3, - 0xc9, 0x98, 0xda, 0xd9, 0x91, 0x8f, 0x2e, 0xa4, - 0x18, 0x07, 0xd9, 0xc8, 0x03, 0xc9, 0x45, 0x38, - 0x38, 0x89, 0xff, 0xb3, 0x57, 0x69, 0x46, 0x37, - 0x37, 0xcd, 0xb5, 0xf5, 0x4c, 0xf7, 0x92, 0xa7, - 0x48, 0xad, 0xa9, 0x57, 0x93, 0x7b, 0xef, 0xae, - 0x59, 0xf6, 0xb6, 0x15, 0xca, 0x22, 0x3e, 0x58, - 0x65, 0x26, 0x4a, 0x39, 0xf0, 0xf4, 0x4a, 0x4a, - 0xd4, 0xff, 0x8a, 0x94, 0x75, 0x9f, 0x29, 0xf5, - 0xdf, 0x36, 0xa3, 0x6e, 0x07, 0xbe, 0xec, 0x2d, - 0xcf, 0xc9, 0xb7, 0xb1, 0x6e, 0xf5, 0xc1, 0x88, - 0x43, 0xf1, 0x7f, 0x81, 0xc0, 0xa4, 0x04, 0x50, - 0x6e, 0x16, 0x7c, 0x3f, 0x05, 0x58, 0x30, 0xe4, - 0x7a, 0x0e, 0x05, 0x58, 0x30, 0x29, 0xc1, 0x8b, - 0x4b, 0x01, 0x4c, 0x0c, 0xa4, 0x18, 0x41, 0x10, - 0x41, 0x10, 0x18, 0x6c, 0xa4, 0x3f, 0x02, 0xe0, - 0xaa, 0x06, 0x0e, 0x41, 0xf0, 0x7f, 0xed, 0x0b, - 0x69, 0x44, 0xb4, 0xe5, 0xcd, 0x5c, 0x1f, 0xb4, - 0x3f, 0xd5, 0x7c, 0x6d, 0xa2, 0xf6, 0x8b, 0xc4, - 0x88, 0x24, 0x2b, 0x4f, 0xac, 0xec, 0xff, 0xc7, - 0x20, 0x64, 0x78, 0xa9, 0x20, 0x32, 0x96, 0x1b, - 0x8a, 0xfc, 0xac, 0xaf, 0xf5, 0xac, 0x6f, 0x14, - 0xe5, 0x6d, 0xa6, 0xcc, 0x45, 0x19, 0x2a, 0xe8, - 0xd0, 0x12, 0x9f, 0xc1, 0xe9, 0xa0, 0x03, 0xe0, - 0x52, 0x9a, 0x82, 0x27, 0xb7, 0x7e, 0x3e, 0xbd, - 0x60, 0xb5, 0xb5, 0x65, 0xcc, 0xf4, 0x42, 0xec, - 0xbb, 0x3f, 0xf4, 0x89, 0x55, 0xef, 0x41, 0x55, - 0x14, 0x03, 0x23, 0x65, 0xb5, 0xae, 0x33, 0xdd, - 0xe1, 0x87, 0x9b, 0xe6, 0xfa, 0x20, 0x27, 0x1f, - 0x27, 0x98, 0xa2, 0x6d, 0x2e, 0x2f, 0x48, 0x3f, - 0x51, 0xde, 0xdc, 0x8d, 0xd4, 0xcd, 0xb6, 0x58, - 0xa5, 0x46, 0xdc, 0x2d, 0xe1, 0x69, 0x67, 0xf8, - 0x36, 0xa7, 0x87, 0x23, 0xf9, 0x41, 0xe0, 0x60, - 0x43, 0x05, 0x14, 0x03, 0x05, 0x9d, 0x08, 0x00, - 0x8a, 0x08, 0xb5, 0x38, 0x2a, 0x80, 0xd6, 0xab, - 0x10, 0xe8, 0x3c, 0x17, 0xfd, 0x34, 0xb8, 0x15, - 0xa0, 0xaa, 0x8a, 0xc0, 0xd4, 0x6d, 0x42, 0xea, - 0x47, 0x0a, 0x03, 0xd0, 0xb1, 0x29, 0xed, 0x06, - 0xe9, 0x7b, 0x6a, 0x9b, 0x06, 0x62, 0x27, 0xf0, - 0x28, 0x84, 0x3c, 0x10, 0x01, 0x84, 0xa0, 0x62, - 0xd5, 0x0d, 0xeb, 0x2c, 0x37, 0x07, 0x9f, 0x57, - 0x73, 0xc0, 0xc2, 0x00, 0x7e, 0xc0, 0xec, 0x71, - 0x55, 0x4c, 0x67, 0xc3, 0xfa, 0xcd, 0x4c, 0x38, - 0xf3, 0x3f, 0x85, 0xd0, 0xc5, 0xba, 0x80, 0xf4, - 0x4d, 0x3f, 0x56, 0x9b, 0x64, 0x40, 0xc2, 0xf1, - 0xd6, 0xab, 0xed, 0xca, 0x93, 0x04, 0xb1, 0xf6, - 0x97, 0xf7, 0x03, 0xbf, 0x52, 0xec, 0x57, 0x53, - 0xcd, 0xf2, 0x8a, 0x5b, 0xea, 0xd2, 0x9c, 0x51, - 0xaa, 0x64, 0xe3, 0xd4, 0x08, 0x25, 0xe5, 0xc2, - 0x56, 0x84, 0x2c, 0x6f, 0xe5, 0xdd, 0x56, 0x24, - 0x97, 0x24, 0x6f, 0x13, 0xa7, 0x9e, 0xd6, 0x07, - 0xca, 0xc3, 0xf1, 0xc8, 0xef, 0x32, 0x2b, 0xf5, - 0x98, 0xab, 0x5a, 0xcc, 0x0f, 0xd9, 0x9f, 0x1f, - 0x78, 0xae, 0x7f, 0x2e, 0xf0, 0x2c, 0x61, 0x08, - 0x1e, 0x06, 0x04, 0x10, 0x53, 0x01, 0xe0, 0xfc, - 0x18, 0xb0, 0x6c, 0x5c, 0xa0, 0x3e, 0x1c, 0xd0, - 0x3b, 0x40, 0xf9, 0x65, 0x53, 0xd0, 0x61, 0x00, - 0x1e, 0x0b, 0xfc, 0xf9, 0x41, 0x56, 0x20, 0x88, - 0x0a, 0x41, 0x80, 0xc7, 0x40, 0xd0, 0xe0, 0x3c, - 0x07, 0xc1, 0x80, 0x54, 0x46, 0x0c, 0xad, 0x30, - 0xf0, 0x1e, 0x0a, 0x02, 0xf4, 0xe3, 0xf6, 0x87, - 0xdc, 0x07, 0x81, 0xff, 0x1c, 0x48, 0x61, 0x5a, - 0xb4, 0xbe, 0x63, 0x80, 0xaa, 0x50, 0x3f, 0xfb, - 0x2d, 0x7d, 0x96, 0x67, 0x01, 0x55, 0xd0, 0xf7, - 0xed, 0x6e, 0x87, 0xd6, 0x95, 0xeb, 0x9e, 0xda, - 0xb2, 0x0e, 0x1a, 0x0c, 0x6c, 0xa7, 0xaa, 0xe1, - 0x79, 0x84, 0xd9, 0x98, 0x23, 0x09, 0x6d, 0xf2, - 0x08, 0xbd, 0x68, 0x70, 0x3c, 0x1f, 0xb2, 0x1e, - 0x71, 0x48, 0x18, 0xef, 0x95, 0x32, 0xc8, 0x79, - 0xc5, 0x25, 0x43, 0x72, 0xa4, 0x6f, 0x7a, 0x3a, - 0xb9, 0x55, 0x27, 0xca, 0x5d, 0x55, 0x5b, 0x2c, - 0x2f, 0x2e, 0xdf, 0x5c, 0xff, 0x92, 0x25, 0x63, - 0x7f, 0x35, 0x4e, 0x76, 0x8d, 0xf2, 0x9b, 0x99, - 0xff, 0x7e, 0xf4, 0xb3, 0xe6, 0x03, 0x10, 0x32, - 0x70, 0x86, 0x0d, 0x85, 0x6a, 0x3a, 0x24, 0xb0, - 0x99, 0x6a, 0x06, 0xb8, 0x21, 0x02, 0x18, 0x32, - 0xe9, 0x18, 0xd0, 0x78, 0x48, 0x0a, 0xd2, 0x83, - 0x15, 0xb0, 0xba, 0x49, 0x67, 0x0b, 0x19, 0x06, - 0x41, 0xa1, 0x70, 0xe9, 0x57, 0x52, 0xe8, 0x85, - 0xf6, 0x1b, 0x55, 0x8a, 0xda, 0x10, 0x68, 0x33, - 0x09, 0x81, 0xe0, 0x7f, 0xb5, 0x04, 0x49, 0xff, - 0x08, 0x40, 0xaa, 0x6f, 0xa3, 0xcf, 0xb6, 0xac, - 0x21, 0x2a, 0x1d, 0xab, 0xf9, 0x6d, 0x2c, 0x6f, - 0xcd, 0xb4, 0x3e, 0xd4, 0x93, 0xfe, 0xf7, 0xd4, - 0xb2, 0x20, 0x99, 0xbb, 0xd3, 0x4a, 0x78, 0x88, - 0x1c, 0x41, 0xa6, 0x83, 0x65, 0xc0, 0x7b, 0xc3, - 0x81, 0xca, 0x41, 0x21, 0x50, 0x82, 0xde, 0x2a, - 0x68, 0xb7, 0xc9, 0xbc, 0x1f, 0xab, 0xfa, 0xde, - 0x55, 0xe2, 0xde, 0x0e, 0x59, 0xff, 0x2a, 0x86, - 0xb3, 0xbf, 0xd5, 0x15, 0x44, 0x59, 0xe6, 0x6d, - 0x06, 0x60, 0xab, 0x07, 0x20, 0xa0, 0x95, 0xb0, - 0x2d, 0x04, 0x11, 0x28, 0xb5, 0x92, 0xbd, 0x68, - 0x0c, 0x42, 0xde, 0xb6, 0x06, 0x73, 0x5a, 0x2a, - 0x5c, 0x73, 0x9b, 0xe0, 0xee, 0x58, 0xe0, 0xb8, - 0x07, 0x40, 0xf8, 0x42, 0x1d, 0xb2, 0x0c, 0x5c, - 0xc0, 0xf8, 0x7a, 0x98, 0xbd, 0xbf, 0x83, 0x2b, - 0x03, 0xc5, 0xf1, 0xa5, 0x5f, 0x9f, 0xdc, 0x63, - 0x2f, 0xfb, 0xac, 0xe6, 0x2e, 0x9b, 0x65, 0x4e, - 0xd0, 0x18, 0x4e, 0x58, 0xdd, 0xa5, 0xb2, 0x67, - 0x5a, 0x6c, 0x05, 0x1e, 0x06, 0x60, 0x1b, 0x00, - 0xf0, 0xec, 0x14, 0x1f, 0x4e, 0x9d, 0x24, 0x56, - 0xc8, 0x43, 0x64, 0x7e, 0x5a, 0xaf, 0x66, 0x6b, - 0x6a, 0xb1, 0x84, 0xec, 0xb1, 0xe0, 0x55, 0x6d, - 0xf5, 0x03, 0x56, 0x70, 0x73, 0x77, 0x3b, 0x7f, - 0xf5, 0x9b, 0x2d, 0x62, 0x40, 0x18, 0x6a, 0xf5, - 0x1f, 0xc5, 0xf7, 0xa3, 0x2e, 0x3f, 0x5c, 0x98, - 0x42, 0x08, 0x21, 0x09, 0x60, 0x78, 0x3f, 0xf8, - 0x47, 0x43, 0xf6, 0xa9, 0x27, 0x0a, 0x1e, 0x33, - 0x03, 0xea, 0xfc, 0x08, 0x61, 0x08, 0x7d, 0xa5, - 0xc9, 0xe6, 0xcd, 0xce, 0x7d, 0x81, 0xfb, 0x43, - 0xd1, 0xf8, 0x90, 0x3c, 0xaa, 0xaf, 0x53, 0x96, - 0x42, 0xfa, 0x98, 0xbc, 0x3c, 0x8c, 0x2f, 0xd2, - 0xc8, 0xa5, 0xaf, 0xa9, 0x93, 0xf9, 0x6b, 0x82, - 0x58, 0x28, 0xc0, 0xf8, 0xfd, 0x85, 0x4a, 0x95, - 0x0e, 0x59, 0xfe, 0xee, 0x16, 0xab, 0x6e, 0x30, - 0xc3, 0x4c, 0x4f, 0xb3, 0xfe, 0x37, 0xfe, 0x4d, - 0xcf, 0x66, 0x4d, 0x6f, 0x79, 0xfb, 0xc9, 0xc8, - 0xbf, 0x21, 0xc3, 0x03, 0xdf, 0x84, 0x0a, 0xc0, - 0xe5, 0x28, 0xf8, 0x0e, 0x8e, 0x83, 0xff, 0xcf, - 0x27, 0x2f, 0x54, 0xb8, 0xe5, 0x52, 0xae, 0xf9, - 0xb9, 0x37, 0x1b, 0x97, 0x62, 0x8f, 0x29, 0x96, - 0xe6, 0xac, 0x6e, 0x1c, 0xb6, 0xde, 0x21, 0xe4, - 0x34, 0xed, 0x71, 0x9b, 0x69, 0xfe, 0xac, 0x4a, - 0x4a, 0x07, 0x55, 0x2b, 0x08, 0x42, 0x1a, 0x46, - 0xe2, 0x51, 0x08, 0x7a, 0x21, 0x7c, 0x0e, 0x68, - 0x34, 0x11, 0x92, 0xd5, 0x6c, 0xf9, 0xa5, 0x4a, - 0x75, 0x52, 0x56, 0x04, 0x11, 0xfb, 0x55, 0x16, - 0xa8, 0xd5, 0x7e, 0xb8, 0x38, 0x93, 0x7f, 0xbb, - 0xa0, 0xb2, 0x28, 0xd0, 0x33, 0x62, 0x58, 0x94, - 0x9c, 0x78, 0x3f, 0x48, 0xa8, 0x4a, 0xa2, 0x1a, - 0x96, 0xb0, 0xb1, 0x52, 0x42, 0xf5, 0x49, 0xfd, - 0x36, 0x66, 0xea, 0xfe, 0x9e, 0x6f, 0xdb, 0x93, - 0x79, 0x6a, 0x25, 0xd7, 0xe3, 0xec, 0x03, 0x5b, - 0x1f, 0x0f, 0x47, 0x63, 0xe1, 0xf4, 0x1d, 0x0f, - 0x00, 0xe8, 0xf9, 0xaf, 0x26, 0x4e, 0xca, 0x7a, - 0x94, 0x7a, 0xc1, 0x77, 0xd5, 0x07, 0xdf, 0xd2, - 0xdf, 0x56, 0x9b, 0xfa, 0x5c, 0x61, 0x99, 0x65, - 0x6b, 0xc0, 0x65, 0x82, 0xbf, 0xa9, 0xa3, 0x89, - 0x02, 0xd4, 0xc2, 0x06, 0x0e, 0x80, 0x31, 0xa0, - 0x78, 0x2f, 0xf9, 0x44, 0x06, 0x18, 0x9b, 0x7e, - 0xac, 0x1e, 0x0b, 0xfd, 0x9f, 0x82, 0x85, 0x91, - 0x28, 0x18, 0x38, 0xf7, 0x04, 0x28, 0x23, 0xe8, - 0x30, 0x18, 0x10, 0x18, 0x51, 0xec, 0xe0, 0x2b, - 0x27, 0xc5, 0x7d, 0x51, 0xde, 0x75, 0x74, 0x27, - 0xb5, 0xc1, 0x66, 0xc0, 0x8e, 0x10, 0xcb, 0xd2, - 0x83, 0x32, 0x21, 0x26, 0x12, 0x07, 0xf1, 0x37, - 0xbe, 0xaf, 0x52, 0x44, 0xcd, 0x40, 0x6c, 0x12, - 0xfb, 0xcc, 0xef, 0x03, 0xfb, 0x90, 0x21, 0xa4, - 0xef, 0x74, 0x18, 0xd2, 0x9b, 0x3c, 0x22, 0x1f, - 0x14, 0x01, 0xe0, 0x51, 0x62, 0x66, 0x52, 0x40, - 0x3b, 0xa2, 0x4e, 0x09, 0x5e, 0x05, 0x3f, 0xc7, - 0xc0, 0xa7, 0xcb, 0x47, 0x20, 0xaa, 0x8c, 0x8e, - 0x14, 0xf0, 0xb7, 0xa3, 0x80, 0x23, 0xc2, 0xc0, - 0xe7, 0x87, 0xcd, 0x24, 0x6c, 0x49, 0x03, 0x82, - 0x18, 0x31, 0x5e, 0x17, 0xc6, 0x9a, 0xbc, 0x60, - 0x1e, 0x0b, 0xfd, 0xb1, 0x28, 0x10, 0xc2, 0x13, - 0x5f, 0xa3, 0x75, 0x05, 0x8d, 0x89, 0x25, 0xc5, - 0x5b, 0xf5, 0x0a, 0x78, 0x05, 0xbe, 0xf2, 0x1a, - 0xca, 0x86, 0x80, 0xc7, 0x9a, 0x55, 0xe9, 0x33, - 0xde, 0x2b, 0xfe, 0xff, 0x74, 0x45, 0xdb, 0x77, - 0x76, 0x95, 0xdf, 0xff, 0x6d, 0xaf, 0x35, 0x8f, - 0x79, 0x01, 0x64, 0x91, 0x10, 0xcc, 0x55, 0xae, - 0x68, 0x14, 0x00, 0xcd, 0x0f, 0x19, 0x56, 0x56, - 0x39, 0xc6, 0x2e, 0x79, 0xa6, 0xb5, 0x70, 0xe6, - 0x90, 0x6a, 0x0c, 0xb2, 0xa9, 0x3d, 0xde, 0x16, - 0xb6, 0xdf, 0xf5, 0x44, 0x59, 0x4d, 0xdb, 0xd7, - 0xc7, 0xd4, 0x06, 0xd0, 0x07, 0x03, 0x97, 0x3f, - 0xa1, 0xa4, 0x48, 0x81, 0xc7, 0x5a, 0x1b, 0x0f, - 0x6d, 0x33, 0xa6, 0x2d, 0xf0, 0xe8, 0xb9, 0x8e, - 0x0e, 0x13, 0x30, 0xd4, 0x35, 0xe6, 0xbd, 0x81, - 0x91, 0x84, 0x0b, 0x32, 0x2c, 0x2f, 0x09, 0x9d, - 0x9d, 0x3f, 0xe5, 0x34, 0x11, 0xce, 0x62, 0x19, - 0xd2, 0x9e, 0x3f, 0x4e, 0x78, 0x0e, 0x25, 0x19, - 0x11, 0xf5, 0x00, 0x3c, 0x94, 0x23, 0xdc, 0x07, - 0x23, 0x39, 0x91, 0xa3, 0xe1, 0xe5, 0x02, 0x43, - 0x4d, 0x3f, 0x51, 0x82, 0xc4, 0x1c, 0x2e, 0xeb, - 0xcf, 0xc1, 0xf3, 0x0d, 0x27, 0xb9, 0x93, 0x74, - 0x73, 0x37, 0x6d, 0xd0, 0x33, 0x9e, 0xea, 0x39, - 0x14, 0xa2, 0xea, 0x22, 0xce, 0x73, 0x88, 0x88, - 0x54, 0xa8, 0xc4, 0xc2, 0xd5, 0x0b, 0x2c, 0x37, - 0xe2, 0xdd, 0x88, 0x44, 0xc6, 0xc1, 0x5d, 0x5c, - 0xae, 0xec, 0xa8, 0xd4, 0x44, 0x1c, 0xaa, 0x3b, - 0xd5, 0x90, 0x20, 0x9d, 0x43, 0xc3, 0x83, 0x71, - 0xea, 0x82, 0xf6, 0xc4, 0x0b, 0x1a, 0xff, 0x40, - 0x87, 0xd8, 0x0f, 0x66, 0xf3, 0xf2, 0x72, 0x6a, - 0xd6, 0x11, 0xad, 0xef, 0xd9, 0xa0, 0xc1, 0xef, - 0xe1, 0x59, 0x56, 0x77, 0x95, 0x44, 0x88, 0x44, - 0x5e, 0xf2, 0x22, 0xea, 0xce, 0x15, 0x26, 0xf6, - 0x24, 0x9b, 0xb9, 0xb7, 0xa8, 0x54, 0xd6, 0x65, - 0xbc, 0xe2, 0xd1, 0x6f, 0x4e, 0x45, 0x90, 0x8c, - 0xce, 0xf6, 0x23, 0x8b, 0xc3, 0x43, 0x5a, 0x9a, - 0xde, 0xe2, 0x82, 0xd0, 0xfb, 0xed, 0xb2, 0x1e, - 0x41, 0xc2, 0x05, 0x08, 0x06, 0xd7, 0x54, 0xf1, - 0x1c, 0x95, 0x71, 0x41, 0x4a, 0xd3, 0x72, 0xc5, - 0xb9, 0x93, 0x6d, 0xd6, 0xb3, 0xa8, 0xaa, 0xc8, - 0xed, 0x8b, 0xc5, 0xd6, 0x97, 0x49, 0xd7, 0x9d, - 0x89, 0xe4, 0x91, 0x69, 0x2c, 0xda, 0xba, 0xd6, - 0x0d, 0x83, 0xde, 0xc5, 0xc6, 0x26, 0xfa, 0x81, - 0xe9, 0x56, 0xea, 0x9b, 0x27, 0x36, 0xa3, 0xe7, - 0x2a, 0xcb, 0x2c, 0x8b, 0xa3, 0x71, 0x99, 0xe5, - 0x9b, 0xc4, 0x10, 0x33, 0xa1, 0x5c, 0x4d, 0x45, - 0x62, 0x02, 0xab, 0x93, 0x9f, 0x51, 0x20, 0x77, - 0xe5, 0x37, 0x72, 0xa0, 0x95, 0x74, 0x5c, 0x5e, - 0xa9, 0x58, 0x6a, 0x33, 0xfa, 0xbf, 0x0f, 0xf9, - 0xa9, 0x8b, 0x75, 0xaf, 0x58, 0x5b, 0xcc, 0xfb, - 0x17, 0x43, 0xd2, 0xae, 0xf9, 0x47, 0xb6, 0x1b, - 0xde, 0xc5, 0xd1, 0xae, 0x8d, 0xeb, 0x37, 0xe5, - 0xf3, 0x3e, 0xc2, 0x9f, 0x69, 0x6e, 0xb7, 0xf0, - 0x21, 0x22, 0x2e, 0x76, 0x49, 0x57, 0x45, 0x56, - 0x40, 0x8d, 0xe2, 0x54, 0x8a, 0x8b, 0x4b, 0x6c, - 0x68, 0x70, 0xc2, 0x2f, 0x7b, 0x99, 0x16, 0xef, - 0x54, 0xc8, 0xa3, 0xa1, 0xea, 0x3e, 0xda, 0xb8, - 0x56, 0xa5, 0xbc, 0x20, 0xab, 0xa2, 0xaf, 0x27, - 0xa2, 0xeb, 0xa1, 0x9b, 0x32, 0x4d, 0xa6, 0xf8, - 0x1c, 0x68, 0x61, 0x45, 0x7a, 0xb3, 0x6b, 0x4d, - 0x0e, 0x3f, 0xfb, 0xb8, 0x8e, 0x7e, 0xf7, 0x85, - 0x8b, 0x55, 0x1c, 0xe6, 0x4e, 0x73, 0xbc, 0x8b, - 0x09, 0x88, 0xfe, 0x37, 0xa5, 0x9d, 0xb6, 0x5b, - 0x67, 0x38, 0x80, 0xd7, 0x7b, 0xc2, 0x53, 0xae, - 0x58, 0xb2, 0xd9, 0xb6, 0xae, 0x4b, 0x0d, 0xaf, - 0x4d, 0x94, 0x3b, 0x5c, 0xfe, 0x9a, 0xb8, 0x90, - 0x15, 0xbf, 0x56, 0xb6, 0xb7, 0x72, 0x2d, 0x7d, - 0x65, 0x96, 0x08, 0x90, 0xab, 0xba, 0xa4, 0xd1, - 0x11, 0x5a, 0x3c, 0xcd, 0x62, 0x59, 0x3e, 0xc4, - 0xe6, 0xf6, 0xac, 0xa4, 0xae, 0x59, 0xb3, 0xba, - 0xa7, 0x88, 0xfb, 0x28, 0xde, 0x72, 0x11, 0xd8, - 0xe3, 0xb2, 0x23, 0x95, 0x05, 0x5a, 0x8c, 0x16, - 0xea, 0xf0, 0xdc, 0x59, 0x01, 0x3c, 0xff, 0x54, - 0xe1, 0x65, 0xf5, 0xe5, 0x0f, 0x2d, 0x58, 0x63, - 0x7b, 0x9c, 0xe3, 0xd9, 0x7a, 0xb1, 0x2f, 0x7b, - 0x28, 0x4b, 0x13, 0x4d, 0x33, 0x03, 0x86, 0x2f, - 0xbc, 0x1e, 0xdc, 0x91, 0x1f, 0x7b, 0x79, 0x00, - 0xae, 0xad, 0xde, 0xf1, 0x18, 0x50, 0x4d, 0x80, - 0x33, 0x9d, 0xb9, 0xca, 0x50, 0x8f, 0x84, 0xab, - 0xf0, 0x99, 0x55, 0x73, 0x73, 0xdc, 0x6b, 0x2e, - 0x7f, 0x9c, 0x9f, 0x11, 0x20, 0x2b, 0xe2, 0x95, - 0xc9, 0xa1, 0xab, 0x24, 0x93, 0xb0, 0xd1, 0x51, - 0x52, 0x05, 0xd6, 0x0c, 0x5f, 0x78, 0x4b, 0x4f, - 0xd4, 0xc4, 0x6a, 0x92, 0xfa, 0x6b, 0x6a, 0x76, - 0xf4, 0x73, 0x62, 0x8e, 0x6a, 0xca, 0x16, 0x43, - 0x06, 0xd3, 0xa8, 0xc2, 0x9b, 0xb0, 0x72, 0xca, - 0xa9, 0xf8, 0xb4, 0x1f, 0xb0, 0xdf, 0xba, 0x49, - 0xb3, 0x96, 0x0d, 0xd1, 0x2e, 0x68, 0x4e, 0x83, - 0x10, 0x41, 0xad, 0xb7, 0x36, 0xde, 0xb7, 0xce, - 0xf0, 0xb7, 0x16, 0x5a, 0xe2, 0xd7, 0x96, 0x0a, - 0xcb, 0xe2, 0xac, 0xeb, 0x05, 0x57, 0x91, 0x99, - 0x78, 0x8f, 0x8b, 0xf7, 0x16, 0x5f, 0x90, 0x28, - 0x5b, 0x6b, 0xa2, 0xee, 0xf7, 0xa0, 0xf5, 0x30, - 0x01, 0x84, 0xbd, 0x05, 0xe0, 0x3a, 0x1b, 0x04, - 0xd5, 0x56, 0xd3, 0x61, 0x8c, 0xa0, 0xe0, 0x1e, - 0x72, 0xa9, 0xf9, 0x10, 0x1f, 0xd3, 0xa3, 0x68, - 0xca, 0x11, 0x1d, 0x2c, 0xa6, 0x9a, 0x88, 0xae, - 0x29, 0xe7, 0xaf, 0xfd, 0x3f, 0xc1, 0xce, 0x7b, - 0xfc, 0x53, 0xec, 0x6f, 0x90, 0x41, 0xcc, 0xb3, - 0x19, 0xe6, 0x0e, 0x66, 0xa8, 0x73, 0x52, 0xb1, - 0xa4, 0x20, 0xe4, 0x47, 0x0c, 0xb4, 0xad, 0x9b, - 0xf6, 0x73, 0xe9, 0xae, 0x7b, 0x2c, 0x2c, 0xf9, - 0x6c, 0x05, 0x6c, 0x0e, 0x54, 0x41, 0xb5, 0xe8, - 0xc5, 0x18, 0xa9, 0x4a, 0x81, 0xc2, 0x8a, 0x98, - 0xaa, 0xf2, 0xce, 0x7f, 0xde, 0xff, 0xaa, 0x36, - 0x99, 0xf7, 0x99, 0x6b, 0x79, 0x7a, 0x56, 0xc3, - 0x33, 0x5a, 0xde, 0x6c, 0x9b, 0x14, 0xe5, 0xe6, - 0xe6, 0x68, 0xdf, 0x23, 0xde, 0xef, 0x57, 0xed, - 0xb6, 0xdb, 0xd4, 0x3d, 0xb4, 0x96, 0xa1, 0xb4, - 0x8d, 0x05, 0x24, 0x80, 0xe2, 0x51, 0xaf, 0xe8, - 0x3f, 0x7c, 0x00, 0x72, 0x13, 0xc6, 0xc2, 0xd0, - 0x2b, 0x26, 0x8e, 0x74, 0x7c, 0x3c, 0xd6, 0x62, - 0x8b, 0x15, 0xfc, 0x74, 0x3c, 0xfa, 0x59, 0x73, - 0x85, 0x97, 0x13, 0xfd, 0x35, 0x57, 0x2b, 0x53, - 0x24, 0x6a, 0x96, 0xf5, 0xa5, 0x12, 0x7a, 0xe2, - 0x88, 0x79, 0x54, 0xe9, 0x07, 0x83, 0xf5, 0x10, - 0x7e, 0x93, 0xc9, 0x7d, 0x2a, 0x9e, 0x37, 0xaa, - 0xfd, 0x4b, 0x78, 0x37, 0x2d, 0x61, 0xb6, 0x1b, - 0x29, 0x0f, 0x54, 0x7d, 0x6b, 0xf9, 0xa5, 0x98, - 0x7a, 0xaf, 0x41, 0x63, 0xd0, 0xc0, 0xeb, 0x19, - 0x83, 0x81, 0x3a, 0xd9, 0x06, 0x24, 0xaf, 0xa3, - 0x44, 0xc4, 0x9b, 0xca, 0x37, 0xcc, 0x2c, 0x51, - 0x22, 0x8a, 0xd6, 0x56, 0x0b, 0x24, 0x92, 0x35, - 0x58, 0xb0, 0x70, 0x20, 0x4c, 0xc9, 0xe8, 0xc1, - 0x60, 0xe0, 0xb2, 0x4f, 0x28, 0x51, 0x0f, 0x29, - 0x31, 0xa9, 0xd8, 0xa9, 0xa4, 0xc9, 0xa6, 0xf3, - 0xb8, 0x3e, 0x1e, 0x24, 0x2e, 0x9b, 0x73, 0xaa, - 0x2b, 0x70, 0xb9, 0x86, 0x87, 0x3b, 0x93, 0x7f, - 0x30, 0xb5, 0x4a, 0x82, 0xdf, 0xa8, 0xe2, 0x9a, - 0x7c, 0xcf, 0x4f, 0x7e, 0x9b, 0x2b, 0x19, 0x05, - 0x5a, 0x8c, 0x24, 0x07, 0x12, 0x91, 0xe9, 0x8b, - 0x44, 0x84, 0x93, 0x47, 0x29, 0xd8, 0x1f, 0x09, - 0x54, 0x77, 0x36, 0x96, 0x27, 0x06, 0x50, 0x3e, - 0xf2, 0x59, 0xff, 0x87, 0x6c, 0xfd, 0x2e, 0x35, - 0x89, 0xef, 0xea, 0x9d, 0x2d, 0xbb, 0xf5, 0x2d, - 0xaf, 0x2d, 0xbd, 0x78, 0x95, 0x38, 0xe1, 0xb4, - 0xda, 0xc7, 0xd3, 0x34, 0x3f, 0x53, 0x24, 0xaa, - 0x93, 0xe3, 0x4c, 0xb1, 0xbf, 0xc1, 0xb5, 0xfb, - 0x5a, 0xa7, 0x0a, 0xbf, 0x26, 0xaf, 0x2f, 0x2a, - 0x24, 0x4e, 0x44, 0x4a, 0x49, 0x93, 0x1a, 0xf9, - 0x6b, 0x79, 0xac, 0xaf, 0xc5, 0x3c, 0xcb, 0xca, - 0x6e, 0x50, 0x60, 0xa5, 0x3d, 0xf3, 0x78, 0xb3, - 0x5c, 0x44, 0xa6, 0xfc, 0xd6, 0x8c, 0xba, 0x8c, - 0x1d, 0x48, 0x06, 0x10, 0x9a, 0x88, 0x10, 0x1e, - 0xd7, 0xb2, 0xe6, 0xf5, 0xa4, 0xe9, 0x15, 0x09, - 0x25, 0xed, 0x35, 0x93, 0x75, 0xb6, 0x5a, 0x92, - 0x22, 0x54, 0xd6, 0x78, 0x93, 0x39, 0xef, 0x01, - 0x49, 0x92, 0x39, 0x3d, 0x4d, 0xe6, 0x8b, 0xa7, - 0x8b, 0x92, 0x5b, 0xb3, 0x1a, 0x48, 0x93, 0xcd, - 0x5e, 0xed, 0xad, 0x7b, 0x22, 0x3d, 0xde, 0xcc, - 0xdb, 0xb7, 0x7b, 0x6f, 0x24, 0x99, 0x88, 0x0f, - 0x6f, 0xe1, 0x66, 0x45, 0x3d, 0x02, 0x74, 0xd2, - 0xc4, 0xa1, 0x57, 0x50, 0x8c, 0x95, 0x11, 0x40, - 0x2c, 0x45, 0x3c, 0x52, 0x85, 0xfa, 0x6a, 0xb4, - 0x21, 0x09, 0x0d, 0x72, 0xaa, 0x10, 0x84, 0x85, - 0x56, 0x7f, 0xcc, 0xe0, 0x80, 0x3a, 0x2e, 0x6a, - 0xc6, 0x58, 0xe8, 0xe1, 0x9c, 0xbe, 0x6b, 0x38, - 0xdb, 0x4a, 0x74, 0x70, 0xdc, 0x0f, 0x5a, 0x2d, - 0xd5, 0x16, 0x29, 0xd3, 0xe5, 0xfc, 0xc3, 0x49, - 0xb2, 0x34, 0xc3, 0x4d, 0x30, 0xd6, 0x5b, 0x71, - 0x86, 0x3d, 0x15, 0x7a, 0x5d, 0xbd, 0xfd, 0x9e, - 0xc9, 0x99, 0x3b, 0x7b, 0xbb, 0x79, 0xdb, 0xb6, - 0xed, 0x5e, 0x9f, 0x2a, 0x63, 0x5a, 0x2f, 0x25, - 0x42, 0x14, 0x42, 0x4a, 0x45, 0x13, 0x74, 0xa3, - 0x87, 0xc4, 0x7b, 0x99, 0xfc, 0xdf, 0x6f, 0xa3, - 0x7e, 0xfc, 0xb1, 0xbf, 0x7f, 0x33, 0xfe, 0xdf, - 0x55, 0xae, 0x7f, 0xdf, 0x53, 0x9b, 0x95, 0x0e, - 0x6f, 0x65, 0x21, 0xba, 0x88, 0x1d, 0xc0, 0x58, - 0x03, 0x9f, 0x81, 0xcb, 0xd4, 0x60, 0xe2, 0x17, - 0x18, 0xbe, 0xa6, 0xa2, 0x41, 0x28, 0x74, 0xd1, - 0x6b, 0x4d, 0x09, 0x43, 0xc5, 0x5e, 0x67, 0x2e, - 0x2b, 0xf2, 0xa1, 0xe2, 0x65, 0x58, 0xaf, 0x39, - 0xb1, 0x43, 0x38, 0xc3, 0x59, 0x8c, 0xe7, 0x3f, - 0xfc, 0xe7, 0xe6, 0xad, 0xfd, 0x82, 0x2b, 0xc5, - 0xad, 0x7b, 0xde, 0x6a, 0x34, 0xd7, 0xa3, 0x5e, - 0xcc, 0x99, 0xef, 0x35, 0x26, 0x67, 0xbd, 0x88, - 0xb3, 0x3d, 0xee, 0x66, 0x64, 0x85, 0x53, 0x24, - 0xe6, 0x49, 0xc8, 0x79, 0x0f, 0x55, 0xc6, 0x43, - 0x20, 0x1f, 0x0a, 0x02, 0xad, 0x88, 0x90, 0x84, - 0x56, 0x94, 0x85, 0x55, 0x1b, 0xe3, 0x0c, 0x7a, - 0xb7, 0xbe, 0x6b, 0x33, 0x59, 0xd2, 0xd6, 0x77, - 0xd9, 0x26, 0xb3, 0xfe, 0x70, 0xb5, 0xbb, 0xc9, - 0x5b, 0xff, 0x39, 0x85, 0xbb, 0xdd, 0x51, 0xc9, - 0xde, 0x3a, 0x38, 0xb0, 0xcc, 0x1d, 0xc0, 0x4e, - 0x4c, 0xe3, 0x5b, 0x62, 0x11, 0xae, 0xbe, 0xa8, - 0x86, 0x2f, 0xce, 0xdd, 0x19, 0x02, 0xc5, 0xee, - 0xc2, 0x9a, 0x0b, 0x96, 0x95, 0x63, 0x9a, 0xfa, - 0x83, 0x88, 0x74, 0x07, 0x1f, 0xd1, 0x02, 0x22, - 0x2a, 0x0c, 0x45, 0xcb, 0x42, 0x64, 0x42, 0x41, - 0xa7, 0x45, 0x21, 0x44, 0x83, 0x86, 0x03, 0x56, - 0x80, 0x31, 0x21, 0x7d, 0x59, 0x10, 0x64, 0x19, - 0x39, 0xd6, 0xe9, 0x1e, 0x9c, 0x5c, 0x44, 0xb1, - 0x28, 0x39, 0x71, 0x5a, 0x62, 0x78, 0x91, 0x60, - 0x7f, 0x2f, 0xff, 0xf0, 0x3d, 0x1c, 0x00, 0x60, - 0xe7, 0x67, 0x74, 0xcb, 0x8c, 0x21, 0x40, 0x2c, - 0x51, 0x0d, 0x75, 0x88, 0x40, 0x70, 0x38, 0x82, - 0x01, 0xc6, 0xba, 0x0e, 0x26, 0x68, 0x56, 0x44, - 0x0e, 0x34, 0xe6, 0x2b, 0x13, 0x69, 0x9a, 0x65, - 0x85, 0x28, 0x79, 0x10, 0xf0, 0x31, 0x91, 0x61, - 0x88, 0x54, 0xa2, 0xaf, 0x41, 0xcf, 0xef, 0x7b, - 0xcb, 0xcb, 0xd9, 0x54, 0xca, 0x22, 0x21, 0x40, - 0xe2, 0xfa, 0x8a, 0xf2, 0x03, 0x81, 0x72, 0x70, - 0x41, 0x9a, 0xd5, 0xdc, 0x8d, 0xf2, 0x76, 0x2e, - 0x55, 0xfb, 0xa8, 0x38, 0x6d, 0x70, 0x74, 0x7a, - 0x10, 0x54, 0xc5, 0xaa, 0x26, 0xa3, 0x44, 0x0b, - 0x00, 0x5f, 0x2c, 0xdc, 0xe0, 0x75, 0x11, 0xde, - 0x44, 0x7c, 0xec, 0x44, 0x75, 0x75, 0x43, 0x9a, - 0xc5, 0x0f, 0xed, 0xde, 0xed, 0x24, 0xd9, 0x10, - 0x62, 0xc8, 0xf8, 0x04, 0x56, 0xec, 0x46, 0x42, - 0x96, 0x15, 0xcb, 0x17, 0x5a, 0xc4, 0x38, 0xb1, - 0x22, 0xe8, 0xa1, 0x48, 0xc8, 0xe1, 0x92, 0xae, - 0x09, 0xd1, 0x34, 0xf3, 0x03, 0x9b, 0xd1, 0xb7, - 0x22, 0x05, 0x89, 0x29, 0x0e, 0xb9, 0x11, 0xf1, - 0x12, 0x14, 0x01, 0x8c, 0x0c, 0xa9, 0x3c, 0xcc, - 0x5e, 0x23, 0xec, 0x28, 0x0a, 0x67, 0x57, 0x36, - 0x0e, 0x28, 0x39, 0x22, 0x11, 0x71, 0xda, 0xbf, - 0x91, 0x7d, 0xd2, 0x85, 0xd7, 0x0c, 0xc6, 0x01, - 0x3d, 0x2b, 0xda, 0xcb, 0x52, 0x23, 0x88, 0x56, - 0xec, 0xe8, 0xc6, 0x20, 0x44, 0x4f, 0x8a, 0x14, - 0x12, 0x50, 0xc5, 0x12, 0xe4, 0x4c, 0xa4, 0xe7, - 0x46, 0x9a, 0x66, 0x72, 0x36, 0xde, 0x8e, 0x7e, - 0xc9, 0x50, 0x14, 0xf4, 0x5a, 0x12, 0x55, 0xa1, - 0x5d, 0x24, 0x22, 0x82, 0xc9, 0x51, 0xcb, 0xde, - 0x02, 0xc0, 0xa7, 0xa2, 0x92, 0x35, 0x44, 0x46, - 0x85, 0x11, 0x28, 0x30, 0x51, 0xa4, 0x43, 0x41, - 0x85, 0xe0, 0xe0, 0xae, 0xf5, 0x09, 0x06, 0x99, - 0x2f, 0x31, 0x99, 0x16, 0xc2, 0xc9, 0xc0, 0xd3, - 0xa3, 0x28, 0x43, 0xda, 0xbf, 0x9b, 0xe8, 0x1d, - 0xdb, 0xf5, 0xd0, 0x16, 0x60, 0x67, 0x49, 0x10, - 0xde, 0x9d, 0x9e, 0x14, 0x8c, 0x51, 0x82, 0xc0, - 0xd0, 0xa9, 0x55, 0x18, 0x5a, 0xd5, 0xb2, 0xd2, - 0xb9, 0xcd, 0x59, 0x65, 0xcd, 0xd4, 0x08, 0x14, - 0x41, 0x83, 0x9c, 0xdd, 0x5d, 0xfa, 0x6b, 0x29, - 0x05, 0xcb, 0x52, 0x32, 0x07, 0x06, 0x24, 0xe6, - 0xaf, 0xe9, 0x48, 0xa5, 0x45, 0x3a, 0x48, 0x0e, - 0x20, 0x5e, 0x70, 0x17, 0xba, 0x75, 0x69, 0x48, - 0x47, 0x1d, 0x36, 0x0e, 0x17, 0x11, 0x6e, 0xea, - 0x34, 0x63, 0x35, 0x86, 0x92, 0x5b, 0xa6, 0xa9, - 0x2c, 0xe8, 0x38, 0x16, 0x02, 0xa5, 0x59, 0xd1, - 0x75, 0x7b, 0xde, 0x70, 0x1f, 0xbe, 0x00, 0x3f, - 0xfa, 0xfa, 0xce, 0x9a, 0x90, 0x51, 0xe4, 0xea, - 0x0c, 0x22, 0x99, 0x57, 0x34, 0x4d, 0x57, 0xa3, - 0x8f, 0x86, 0xca, 0x0f, 0xdb, 0x6d, 0x37, 0x50, - 0x4a, 0xe5, 0x5b, 0x6a, 0xd8, 0xbf, 0x65, 0xec, - 0xd7, 0x2b, 0xb5, 0xff, 0x61, 0xc7, 0xe9, 0x7b, - 0xd3, 0x96, 0xcc, 0x9c, 0x5a, 0xb7, 0xed, 0x41, - 0x38, 0x73, 0x46, 0x53, 0x75, 0x6b, 0xfd, 0x30, - 0xd7, 0x84, 0xaf, 0xd3, 0x32, 0x07, 0x95, 0xfc, - 0x73, 0x5a, 0x1b, 0xf9, 0x42, 0x99, 0x03, 0x8e, - 0x10, 0xcc, 0xa0, 0xe1, 0xa0, 0xc4, 0x10, 0x8b, - 0xf7, 0xe3, 0xdc, 0xf0, 0x7d, 0x71, 0x4e, 0x7e, - 0x5d, 0xb4, 0x36, 0x14, 0x28, 0x83, 0x03, 0x00, - 0x58, 0x82, 0xc0, 0xfa, 0x7f, 0x39, 0x51, 0x9e, - 0x89, 0xbb, 0x20, 0xcd, 0x12, 0x01, 0x3d, 0xaf, - 0x50, 0x83, 0x85, 0xe8, 0x8a, 0x05, 0x29, 0xaf, - 0x4e, 0xe8, 0x84, 0x31, 0x08, 0x8c, 0x3f, 0xa7, - 0x22, 0xf5, 0x88, 0xea, 0x83, 0xba, 0x18, 0x0a, - 0xf4, 0x92, 0xa1, 0x44, 0x0e, 0x44, 0x12, 0x6a, - 0x0e, 0x90, 0x1c, 0x7a, 0xa0, 0x21, 0xa9, 0xb5, - 0xd1, 0x83, 0xba, 0x6d, 0x08, 0x4d, 0xdf, 0x97, - 0x35, 0x22, 0x30, 0x72, 0x03, 0xbf, 0x88, 0xc0, - 0x72, 0xe0, 0x38, 0x29, 0x9d, 0x34, 0xbd, 0x0a, - 0x34, 0xdf, 0x91, 0xf0, 0xa4, 0x53, 0x39, 0x09, - 0x2a, 0x30, 0x73, 0xdf, 0x91, 0xc4, 0x00, 0xe5, - 0xa7, 0x01, 0x39, 0xf9, 0x11, 0xa0, 0x8a, 0xbe, - 0x2f, 0xaa, 0x31, 0x90, 0xcc, 0x31, 0x27, 0xfd, - 0x34, 0xb1, 0xcf, 0x01, 0xfd, 0x7f, 0xff, 0xd2, - 0x74, 0xa0, 0x1d, 0x4a, 0x4e, 0x59, 0x0e, 0xe9, - 0xb4, 0x05, 0x00, 0xe3, 0x44, 0xf8, 0x31, 0x05, - 0xd3, 0x8b, 0x21, 0x7e, 0x5c, 0x1c, 0x03, 0xc1, - 0x3d, 0x51, 0x14, 0x0a, 0xea, 0x78, 0xa0, 0x31, - 0x09, 0x64, 0x1c, 0x12, 0xbe, 0x1b, 0x80, 0xe2, - 0x0c, 0x8b, 0x84, 0x85, 0x20, 0xb0, 0x09, 0x18, - 0x28, 0xd3, 0xe0, 0xe4, 0x20, 0xe0, 0x4d, 0xf6, - 0x9a, 0x07, 0x06, 0x4f, 0x60, 0xe4, 0x46, 0xdf, - 0xc6, 0x22, 0xe0, 0xc0, 0x28, 0xe2, 0x32, 0x0d, - 0x3f, 0xde, 0x00, 0xe0, 0x92, 0x01, 0x79, 0x54, - 0x6e, 0xec, 0xba, 0x02, 0x1a, 0x6c, 0xfc, 0x5f, - 0x8b, 0xc0, 0x77, 0x4f, 0x4a, 0x03, 0x61, 0x1b, - 0x50, 0x83, 0x84, 0x5f, 0xa3, 0x31, 0x45, 0xc5, - 0x81, 0xd4, 0xee, 0x9c, 0xda, 0x48, 0x31, 0xe2, - 0x32, 0x8a, 0xe2, 0xd2, 0x5b, 0xb7, 0x68, 0xcb, - 0x0d, 0x12, 0xa2, 0x42, 0x14, 0x65, 0xcd, 0x03, - 0x83, 0x20, 0x9d, 0x0e, 0x0b, 0x82, 0x96, 0xb4, - 0x64, 0xed, 0x34, 0xf9, 0xb5, 0x0d, 0x80, 0xfd, - 0xb0, 0x01, 0xd6, 0x62, 0x8d, 0x5d, 0x1d, 0x29, - 0xa1, 0x80, 0x66, 0x32, 0x7f, 0xe9, 0xb1, 0x33, - 0x17, 0x1a, 0x87, 0x59, 0x72, 0x0a, 0xba, 0x7a, - 0x88, 0x92, 0xf1, 0xf8, 0x31, 0x07, 0x40, 0x8f, - 0x12, 0xa0, 0x45, 0x3a, 0x88, 0x1c, 0x11, 0x30, - 0x72, 0xe4, 0x5a, 0x83, 0x61, 0x3c, 0x4e, 0xaa, - 0x00, 0xc9, 0x19, 0xf6, 0xb0, 0x38, 0x07, 0x04, - 0x93, 0x46, 0x62, 0x66, 0xb0, 0x2c, 0x08, 0xea, - 0x95, 0xc1, 0x3f, 0x48, 0x99, 0x3a, 0x8e, 0xf4, - 0xd2, 0xc0, 0xe0, 0xc4, 0x69, 0x34, 0x1e, 0x82, - 0x00, 0x30, 0x71, 0x4b, 0xdb, 0x0c, 0x45, 0x29, - 0xda, 0x4d, 0xa7, 0xf9, 0xde, 0x74, 0x5c, 0x0b, - 0xa4, 0xfc, 0xa6, 0xfc, 0x3d, 0x51, 0xc9, 0xf0, - 0xf3, 0x88, 0xcd, 0x4e, 0xd3, 0x60, 0xbb, 0xf3, - 0xaa, 0x17, 0xe4, 0xa2, 0xe0, 0x71, 0xf8, 0x8b, - 0x5c, 0x86, 0xa8, 0x3b, 0xa7, 0x64, 0x1a, 0x69, - 0x8e, 0x01, 0x14, 0x49, 0x41, 0x3c, 0x08, 0xd0, - 0x18, 0x07, 0xb9, 0x1c, 0x4e, 0x25, 0xd4, 0x71, - 0x80, 0x7d, 0x8f, 0xff, 0x52, 0xdd, 0x36, 0x14, - 0xd7, 0x4d, 0x38, 0xba, 0x36, 0x5a, 0x18, 0xa9, - 0xd2, 0x91, 0xda, 0x1f, 0xb5, 0x90, 0xa1, 0x71, - 0x7f, 0x48, 0x28, 0x19, 0x7a, 0x8c, 0xbc, 0x61, - 0xc8, 0x12, 0x7e, 0xae, 0x15, 0x60, 0xc8, 0x4d, - 0xe6, 0xea, 0x20, 0xc0, 0x13, 0x75, 0xe9, 0x52, - 0xaf, 0x74, 0x3d, 0xd6, 0x6d, 0xa2, 0xba, 0x69, - 0x32, 0xa4, 0x77, 0x65, 0x3d, 0x2b, 0x50, 0x75, - 0x05, 0xd5, 0xee, 0x1f, 0x55, 0xca, 0xd1, 0xbf, - 0x5e, 0x59, 0xbe, 0x06, 0x24, 0xc3, 0xe9, 0xff, - 0xeb, 0x20, 0x39, 0x41, 0xda, 0x80, 0x75, 0x07, - 0x0d, 0x56, 0x02, 0xe7, 0xaf, 0xa0, 0xcc, 0x8b, - 0x4e, 0x65, 0x91, 0x12, 0xc3, 0x49, 0x52, 0xe7, - 0x59, 0xa5, 0x01, 0x47, 0x2d, 0x06, 0x14, 0x4e, - 0x6a, 0x3a, 0x76, 0x2e, 0xbf, 0xfe, 0xd7, 0xc1, - 0x8d, 0xfa, 0xd4, 0x44, 0x27, 0x3e, 0x5a, 0x25, - 0xb0, 0xc5, 0x51, 0xd3, 0x54, 0xb2, 0xab, 0xf0, - 0x3c, 0x64, 0x01, 0xad, 0xb7, 0x8b, 0x85, 0x63, - 0x16, 0x67, 0x95, 0xc0, 0x64, 0x3e, 0xd9, 0x62, - 0x14, 0x41, 0x29, 0x6f, 0x5b, 0xc5, 0xba, 0x84, - 0xd0, 0xc4, 0x2b, 0x4d, 0x8a, 0x01, 0xd2, 0xe0, - 0x0f, 0x76, 0x9a, 0x02, 0x40, 0xed, 0xa1, 0x2e, - 0x37, 0x7d, 0x8c, 0xe4, 0xf5, 0x90, 0x15, 0xad, - 0x6b, 0x48, 0x10, 0x29, 0x40, 0xb1, 0x01, 0x1d, - 0xc3, 0x5c, 0x07, 0x1f, 0x24, 0xab, 0x4a, 0x90, - 0x14, 0x82, 0xc0, 0x27, 0x8d, 0x44, 0x18, 0x12, - 0x05, 0x1a, 0x24, 0x1c, 0x34, 0xbf, 0x42, 0xbd, - 0x3b, 0x15, 0x6d, 0x07, 0x12, 0x0b, 0x9e, 0xac, - 0x0c, 0x81, 0xcf, 0xf6, 0x03, 0xd0, 0x40, 0x06, - 0x30, 0x20, 0x61, 0x4e, 0x9d, 0x8c, 0xf8, 0x26, - 0x84, 0x43, 0x33, 0x74, 0x1c, 0x0b, 0xec, 0xb9, - 0x36, 0x41, 0x45, 0x5a, 0x28, 0xb9, 0xcd, 0x3f, - 0x9d, 0x2d, 0x80, 0xe9, 0x01, 0xc2, 0xfa, 0x34, - 0xde, 0x07, 0x1b, 0x73, 0xc1, 0xb8, 0xcf, 0xa5, - 0x23, 0x56, 0xd7, 0x41, 0xc8, 0xf8, 0x14, 0xe7, - 0x2a, 0xf0, 0x52, 0x0e, 0x0a, 0x3c, 0x43, 0x7a, - 0x8c, 0x4f, 0x89, 0x41, 0xd4, 0x13, 0x7d, 0xa0, - 0xe0, 0xc8, 0x89, 0xaa, 0x03, 0xd1, 0x3f, 0x3b, - 0xd2, 0x40, 0x71, 0xd6, 0x37, 0x01, 0xfc, 0x05, - 0xd3, 0x84, 0x39, 0x09, 0x03, 0x23, 0xa1, 0x1e, - 0x9e, 0x19, 0x83, 0x06, 0x41, 0x57, 0x07, 0x0c, - 0x09, 0x4f, 0x63, 0xfc, 0x66, 0xb8, 0x38, 0xf2, - 0xf0, 0x17, 0x71, 0x3c, 0x32, 0x0a, 0xba, 0x28, - 0x81, 0x72, 0x40, 0x5c, 0x35, 0xa9, 0x0b, 0x07, - 0x02, 0x6a, 0x12, 0x11, 0xe9, 0xea, 0x0e, 0x01, - 0xe0, 0xb8, 0xe8, 0x81, 0xc2, 0x8d, 0x46, 0x42, - 0x9c, 0x0f, 0x43, 0xff, 0xff, 0x02, 0x76, 0x22, - 0xa9, 0xcd, 0x07, 0x52, 0x3e, 0x0e, 0x04, 0xea, - 0xa0, 0xf3, 0xd0, 0x01, 0x83, 0x88, 0x9a, 0xe8, - 0xd1, 0x92, 0x03, 0x81, 0x3e, 0xf6, 0x54, 0x5d, - 0x58, 0x4d, 0x17, 0x66, 0xc3, 0x10, 0x5c, 0xf0, - 0xcc, 0x1c, 0x12, 0x3a, 0xe9, 0x05, 0x80, 0x54, - 0xc8, 0xc1, 0xd7, 0xa7, 0xaa, 0xf5, 0xd8, 0x6d, - 0x68, 0x8a, 0xba, 0x39, 0xc4, 0x08, 0xc8, 0x2c, - 0x07, 0x83, 0x84, 0xf5, 0x79, 0xa8, 0x45, 0xcb, - 0x82, 0xc3, 0x83, 0x17, 0xa6, 0x48, 0x48, 0x27, - 0xd3, 0xc2, 0xe1, 0x3f, 0x07, 0x04, 0xcc, 0x65, - 0xd0, 0xc8, 0x28, 0xc0, 0xe2, 0x40, 0x5c, 0x5b, - 0x38, 0x0b, 0xba, 0xbf, 0xa5, 0x72, 0x72, 0xca, - 0x8d, 0x1a, 0x21, 0x75, 0x8b, 0x13, 0xf2, 0x99, - 0x67, 0x10, 0x51, 0x81, 0x07, 0x15, 0x60, 0x75, - 0x58, 0x2a, 0xb6, 0x9e, 0xd3, 0xca, 0x54, 0xc5, - 0x8a, 0x41, 0xce, 0x65, 0x24, 0x4d, 0x15, 0x45, - 0xd0, 0xc0, 0x5c, 0x0b, 0xcc, 0xb1, 0xb1, 0x8f, - 0x20, 0x60, 0x13, 0x34, 0xee, 0x14, 0xbf, 0x5e, - 0x77, 0x4d, 0x03, 0xa0, 0x2c, 0x42, 0x6d, 0x2d, - 0xa7, 0x97, 0x2f, 0x98, 0xdb, 0x5c, 0x2d, 0xd5, - 0xd1, 0x77, 0xa8, 0x2e, 0x5e, 0x73, 0x81, 0x2d, - 0xef, 0xb1, 0xa5, 0x38, 0x38, 0xb9, 0x56, 0xec, - 0xd6, 0xb7, 0x64, 0x24, 0x41, 0x6a, 0x2a, 0x71, - 0x3d, 0x04, 0x5a, 0x28, 0xa9, 0x99, 0xd6, 0x49, - 0x01, 0xc4, 0x16, 0x20, 0xe8, 0xa0, 0xe5, 0x63, - 0xe8, 0x53, 0xe9, 0x2f, 0x14, 0x03, 0xb8, 0x35, - 0xa0, 0x44, 0x82, 0x2f, 0xdb, 0xd8, 0x1b, 0xeb, - 0xd0, 0x3c, 0x58, 0x3d, 0x19, 0x16, 0x1d, 0xd7, - 0xb5, 0x1b, 0x60, 0x54, 0xaf, 0xfd, 0xb4, 0x38, - 0xd7, 0x7a, 0xc2, 0xa0, 0x62, 0x49, 0x2a, 0xf5, - 0x61, 0x33, 0xfa, 0x25, 0xa7, 0xbc, 0x16, 0x27, - 0x7d, 0xd4, 0x3f, 0x76, 0xba, 0xbf, 0xcc, 0xb3, - 0x9d, 0xdc, 0xd9, 0xc3, 0xd5, 0x3e, 0xd2, 0x0b, - 0xfc, 0xb6, 0x58, 0xe8, 0x80, 0x52, 0x06, 0x07, - 0xb5, 0xfd, 0x15, 0xb1, 0x6e, 0x5e, 0xf4, 0xb3, - 0x76, 0x0a, 0xb5, 0xea, 0xfe, 0x4f, 0xd9, 0xe1, - 0xc2, 0x76, 0xbb, 0x02, 0xd9, 0x1e, 0x0f, 0x77, - 0xab, 0x4f, 0x79, 0xb5, 0x8c, 0xd2, 0xdc, 0x42, - 0x27, 0xef, 0xf5, 0x4e, 0x60, 0x31, 0xa9, 0x4d, - 0x54, 0x47, 0xf5, 0xdb, 0x4d, 0x25, 0xec, 0xee, - 0x7d, 0x56, 0x5b, 0x78, 0x2b, 0xd1, 0x25, 0xc4, - 0x75, 0x96, 0xf9, 0xc8, 0x08, 0xce, 0xfb, 0x9f, - 0xe2, 0xf3, 0x1f, 0x6d, 0xb5, 0xb6, 0x21, 0x95, - 0x01, 0xf4, 0xca, 0x8a, 0x87, 0xbb, 0x20, 0x49, - 0x53, 0x2e, 0x5c, 0xa9, 0xa8, 0x5e, 0xc3, 0x74, - 0xb4, 0xa9, 0x96, 0xb4, 0x3b, 0xf8, 0x73, 0x05, - 0x6b, 0x37, 0x79, 0x4a, 0x78, 0x2f, 0x82, 0x75, - 0xd3, 0x2b, 0x03, 0x6a, 0xda, 0x54, 0xc4, 0xfd, - 0xd6, 0xff, 0xef, 0x65, 0xe7, 0x17, 0xba, 0xb5, - 0x5c, 0xc9, 0xa8, 0x9a, 0x8f, 0x9a, 0x61, 0x8a, - 0xce, 0xa7, 0xdc, 0xc0, 0x2f, 0xf4, 0x21, 0x9a, - 0xc6, 0x85, 0x43, 0x2c, 0xe0, 0xca, 0x93, 0x69, - 0xae, 0x5d, 0x7b, 0xe3, 0x6b, 0x82, 0x71, 0x4a, - 0x8a, 0x91, 0xf1, 0x28, 0x3a, 0xbd, 0x05, 0xac, - 0x15, 0x22, 0xea, 0x04, 0x0e, 0xc8, 0xa2, 0xee, - 0xf4, 0x1c, 0x52, 0x0e, 0x40, 0x15, 0x4d, 0x8b, - 0x03, 0xa0, 0x0f, 0xe9, 0x1a, 0x0b, 0x43, 0x61, - 0x85, 0x39, 0xa6, 0x41, 0x78, 0x4b, 0x78, 0x88, - 0xf6, 0x9c, 0xf5, 0x70, 0x77, 0x02, 0x2c, 0x0f, - 0x4f, 0x00, 0x18, 0xd2, 0xc7, 0x08, 0x41, 0xc1, - 0x88, 0x4d, 0x40, 0xc7, 0x99, 0x19, 0x1e, 0x9e, - 0xf2, 0xd6, 0x02, 0xc7, 0x80, 0xe1, 0x93, 0xf7, - 0x91, 0x8c, 0x85, 0x73, 0x1a, 0x5c, 0xfc, 0x22, - 0x74, 0xa7, 0xb4, 0xd8, 0x39, 0x18, 0x4b, 0x97, - 0x01, 0xe8, 0xc1, 0x3f, 0xa2, 0x07, 0xf5, 0x80, - 0x0f, 0xf4, 0x13, 0x35, 0x02, 0xad, 0x7d, 0x20, - 0xc0, 0x1c, 0x14, 0xfa, 0x32, 0xef, 0x41, 0xc3, - 0x56, 0x19, 0x23, 0x21, 0x62, 0xe7, 0xf2, 0x02, - 0xeb, 0x4d, 0x83, 0x8a, 0x41, 0xc3, 0x07, 0x30, - 0x73, 0xf4, 0xea, 0x23, 0x40, 0xe0, 0x9d, 0xae, - 0x4a, 0x32, 0x05, 0xc4, 0xe9, 0x2f, 0x5d, 0xae, - 0xc1, 0xc5, 0x34, 0x51, 0x22, 0xad, 0xc0, 0x75, - 0xbc, 0x07, 0x1e, 0xb3, 0x47, 0xb7, 0x54, 0xf8, - 0x39, 0xcd, 0x08, 0x3a, 0x80, 0xea, 0x13, 0xb5, - 0xc1, 0xcb, 0x84, 0xac, 0x9b, 0x29, 0x0a, 0x34, - 0xfa, 0xe4, 0x83, 0x1a, 0x0e, 0x26, 0x90, 0x72, - 0xeb, 0x03, 0xa0, 0xd7, 0x23, 0xa1, 0x92, 0xc0, - 0xb1, 0x39, 0xd1, 0x03, 0x83, 0x32, 0x78, 0x09, - 0xf5, 0x7f, 0x17, 0x37, 0xd5, 0xa2, 0x31, 0xad, - 0xa2, 0xe8, 0x48, 0xa3, 0x3e, 0x6f, 0xec, 0x75, - 0xb6, 0xb3, 0xf2, 0xcb, 0x9a, 0x0e, 0xe0, 0x48, - 0x36, 0x08, 0x23, 0xe4, 0xa9, 0xd8, 0x5b, 0x6b, - 0x1b, 0x38, 0xdf, 0xbb, 0xc4, 0x7d, 0x86, 0x53, - 0x14, 0x44, 0x47, 0xf5, 0xf5, 0xca, 0x32, 0x17, - 0x86, 0x63, 0x43, 0x09, 0xeb, 0x06, 0x93, 0xfa, - 0xde, 0x08, 0xb1, 0x0c, 0x5a, 0xf4, 0x26, 0x1b, - 0xab, 0x12, 0xd5, 0x6e, 0xd2, 0xcc, 0x56, 0xc3, - 0x1f, 0xa6, 0xcd, 0x10, 0x18, 0x1e, 0x25, 0x65, - 0xb6, 0xf7, 0x7d, 0x1a, 0x56, 0x95, 0x8b, 0x22, - 0xdd, 0x18, 0x74, 0xe1, 0x53, 0xb0, 0x6f, 0xc1, - 0x5e, 0xb9, 0xe1, 0x1e, 0x17, 0x37, 0xe5, 0xbe, - 0x9f, 0x06, 0xf8, 0xb9, 0x49, 0x09, 0x94, 0xf7, - 0xfa, 0x88, 0x40, 0xde, 0x0d, 0xe5, 0xa4, 0xab, - 0x82, 0x4f, 0x48, 0x97, 0x8b, 0x45, 0x17, 0x31, - 0x4c, 0xd2, 0x81, 0x5a, 0x7b, 0x7d, 0x3a, 0xbb, - 0x02, 0x07, 0xfa, 0xf3, 0x1b, 0xcb, 0x56, 0xc5, - 0x0a, 0x62, 0x37, 0x6b, 0xab, 0xff, 0xde, 0x61, - 0x68, 0x1a, 0x6e, 0xf6, 0xc2, 0xb5, 0x91, 0x20, - 0x07, 0x05, 0x6a, 0x6e, 0x6e, 0xd8, 0xa3, 0x9c, - 0x80, 0x3c, 0x4e, 0x8c, 0xc6, 0x96, 0xef, 0x73, - 0x35, 0x08, 0x26, 0x2a, 0xdb, 0x0c, 0x2f, 0xdb, - 0x3d, 0xb3, 0x94, 0xf9, 0x72, 0xe4, 0x25, 0xca, - 0x41, 0xa6, 0x66, 0x83, 0x51, 0xfe, 0xf0, 0xb3, - 0xd7, 0x0a, 0x40, 0x77, 0x02, 0x7a, 0xa2, 0x18, - 0x43, 0x66, 0x22, 0xcb, 0x3a, 0x1c, 0x40, 0x70, - 0x26, 0xa7, 0x02, 0x09, 0x7d, 0x46, 0xd2, 0xab, - 0x41, 0x83, 0x41, 0x79, 0x1a, 0x30, 0x0f, 0xab, - 0x06, 0x0e, 0x18, 0xa0, 0xc0, 0x48, 0x23, 0xf2, - 0x06, 0xd0, 0x64, 0xfd, 0xfe, 0x5c, 0xd7, 0xed, - 0x2b, 0x53, 0xbb, 0x79, 0x0c, 0x49, 0x71, 0x70, - 0x37, 0x34, 0x7b, 0x77, 0xab, 0xa3, 0x80, 0xa6, - 0x89, 0xd7, 0x07, 0x8a, 0x80, 0x24, 0x2d, 0x4f, - 0x3c, 0xba, 0xe7, 0x4a, 0x35, 0x22, 0x4d, 0x4f, - 0x8b, 0xef, 0x10, 0x87, 0xda, 0xdc, 0xe2, 0x00, - 0x21, 0x5f, 0xdb, 0xb4, 0xdc, 0x19, 0xba, 0x11, - 0x26, 0x9d, 0x53, 0x50, 0x41, 0xad, 0x73, 0x50, - 0x85, 0x2f, 0x77, 0x50, 0x65, 0xa3, 0x20, 0x71, - 0x35, 0x71, 0x2e, 0xad, 0x8d, 0x6c, 0x17, 0x06, - 0x67, 0xaa, 0xdc, 0x5d, 0x6a, 0x6d, 0x49, 0xdd, - 0x7f, 0x32, 0xae, 0x8e, 0x04, 0x95, 0xb2, 0x71, - 0x7e, 0x2d, 0x0e, 0xc1, 0x70, 0x7f, 0x35, 0x7f, - 0x60, 0x73, 0x06, 0x11, 0xf0, 0xa8, 0x7d, 0xb2, - 0x87, 0xbf, 0x6d, 0x07, 0xa4, 0x0d, 0x0f, 0x99, - 0xc5, 0x3c, 0xe0, 0x66, 0x0e, 0x9d, 0x3f, 0xa6, - 0xae, 0xa7, 0x6b, 0x16, 0x47, 0x43, 0x87, 0x3e, - 0x17, 0xb6, 0x36, 0x68, 0x71, 0x00, 0x8b, 0x37, - 0x83, 0x08, 0x8c, 0x29, 0x2c, 0xd2, 0x46, 0x98, - 0x1b, 0x2a, 0xe1, 0x2c, 0x46, 0x31, 0xe0, 0x5b, - 0x1c, 0x86, 0xb0, 0x67, 0xd1, 0x7b, 0xe5, 0xe1, - 0xa0, 0xa3, 0x5d, 0x04, 0xc3, 0xe1, 0xeb, 0x50, - 0x15, 0xbf, 0xfc, 0x8b, 0x66, 0x4a, 0x85, 0x47, - 0x69, 0x16, 0x62, 0x2a, 0xff, 0xff, 0x7c, 0xa1, - 0x49, 0x5d, 0xde, 0x44, 0x60, 0xe2, 0x0b, 0xba, - 0x1a, 0xf2, 0x11, 0x56, 0x36, 0x85, 0x03, 0xe2, - 0x9f, 0xe4, 0x24, 0x14, 0xeb, 0xdd, 0xd6, 0x2b, - 0x5c, 0x9b, 0x9c, 0x85, 0x72, 0xae, 0x86, 0x74, - 0x89, 0x74, 0xfb, 0x6a, 0x0b, 0xee, 0xa3, 0x18, - 0xae, 0x47, 0x1c, 0xb0, 0xa6, 0x93, 0x44, 0xcb, - 0xd2, 0x51, 0x33, 0xf5, 0x4a, 0x90, 0x58, 0xba, - 0xa6, 0x50, 0x48, 0x60, 0xb1, 0x95, 0x4a, 0xc7, - 0x3c, 0xd6, 0x99, 0x9f, 0x51, 0xec, 0x61, 0x42, - 0xc8, 0x3b, 0xf6, 0xda, 0xc4, 0x4b, 0x53, 0x4b, - 0x1c, 0x44, 0x3f, 0x69, 0x2e, 0x79, 0xb6, 0xb6, - 0x55, 0xa7, 0x62, 0x9c, 0xd5, 0x14, 0xd5, 0xad, - 0x7f, 0x72, 0x89, 0xa0, 0x0c, 0xa2, 0xea, 0xc2, - 0x80, 0xd8, 0x3e, 0x11, 0xc4, 0x94, 0x9e, 0x1c, - 0x31, 0x18, 0x51, 0xde, 0xf0, 0x70, 0x7e, 0xee, - 0x16, 0x95, 0xa9, 0x2b, 0x0a, 0xa2, 0xeb, 0x25, - 0xa5, 0x55, 0x11, 0xb1, 0x49, 0xa6, 0xba, 0x4a, - 0x48, 0x1c, 0x00, 0xf0, 0xa0, 0x88, 0xf5, 0xbc, - 0xc9, 0x6f, 0x70, 0x3d, 0x93, 0xa7, 0x91, 0xd6, - 0x3d, 0x03, 0x8f, 0xfe, 0x8b, 0xd6, 0x05, 0xc1, - 0x76, 0x96, 0x6e, 0x83, 0xce, 0xff, 0xfb, 0xc3, - 0xda, 0xf0, 0xa1, 0x65, 0x97, 0xa2, 0x8b, 0xbf, - 0xa5, 0x10, 0x89, 0x02, 0xce, 0x23, 0x2d, 0xb2, - 0x55, 0x0e, 0x4f, 0x53, 0x78, 0xdf, 0xf7, 0x3d, - 0xab, 0x14, 0xbf, 0xc8, 0x0a, 0xe8, 0xfd, 0x79, - 0xb0, 0xa4, 0xa4, 0x1c, 0x41, 0x13, 0x64, 0x46, - 0x28, 0x4c, 0xb3, 0x24, 0x02, 0xba, 0x58, 0x50, - 0x14, 0xa7, 0x67, 0x35, 0x7e, 0xf2, 0xa2, 0x7b, - 0xb6, 0x0c, 0x33, 0xa8, 0x4e, 0xeb, 0xee, 0x74, - 0xb6, 0x03, 0xb8, 0x0b, 0x01, 0x71, 0x0d, 0x65, - 0x91, 0x7a, 0x0e, 0x05, 0x8f, 0x68, 0x48, 0x96, - 0x31, 0xb0, 0x39, 0xcc, 0xd4, 0x41, 0x4c, 0xec, - 0xfa, 0x22, 0xbc, 0xb5, 0x09, 0x07, 0x36, 0x77, - 0x8b, 0xe0, 0xaf, 0x5f, 0x58, 0xb1, 0xb9, 0x49, - 0x4d, 0x3b, 0xca, 0x87, 0xb6, 0x70, 0x92, 0x82, - 0xf1, 0xe5, 0xe8, 0xdb, 0x7b, 0x65, 0x2c, 0xd8, - 0xf1, 0x84, 0x08, 0x7f, 0x67, 0xf0, 0x40, 0x69, - 0x24, 0xd4, 0x6b, 0x53, 0x7c, 0x74, 0x9d, 0xe8, - 0x88, 0x2b, 0xab, 0xba, 0x49, 0xc4, 0x34, 0x55, - 0x81, 0x60, 0x0b, 0xb3, 0xc2, 0x30, 0x22, 0xa9, - 0xee, 0x82, 0x2b, 0x3a, 0x0b, 0x00, 0x5c, 0x6c, - 0x95, 0x04, 0xe5, 0xef, 0x46, 0x22, 0x74, 0x98, - 0x52, 0x2a, 0xd7, 0x6f, 0x68, 0x11, 0x85, 0x29, - 0xfd, 0xbd, 0x28, 0xc8, 0x4f, 0xb6, 0xde, 0x41, - 0x13, 0x17, 0x46, 0x46, 0xca, 0x3e, 0x69, 0xd5, - 0x3f, 0xde, 0x02, 0x69, 0x86, 0x47, 0xe3, 0xe6, - 0x03, 0xb6, 0x7d, 0x00, 0x9f, 0x68, 0xc1, 0x1b, - 0xd4, 0xd2, 0xf5, 0x7b, 0x2d, 0x6d, 0xb6, 0x74, - 0x09, 0xff, 0x46, 0x5c, 0x87, 0x15, 0x53, 0xd4, - 0x1a, 0x30, 0xe0, 0x60, 0x31, 0x0a, 0xf5, 0x03, - 0x38, 0x49, 0x0e, 0x6b, 0x9d, 0x12, 0x62, 0xaf, - 0xe1, 0x57, 0xd2, 0xb0, 0xb5, 0x86, 0x0f, 0x36, - 0x3b, 0x4c, 0xda, 0xcd, 0x46, 0x1b, 0xef, 0x0b, - 0x46, 0x07, 0xf6, 0x23, 0x41, 0x42, 0x69, 0xcb, - 0x91, 0x07, 0xaf, 0x78, 0xb9, 0x21, 0x20, 0x9c, - 0xb5, 0x00, 0x4c, 0x13, 0x35, 0xcf, 0x17, 0x08, - 0x62, 0x5e, 0xb6, 0x05, 0xb3, 0xd9, 0x28, 0x78, - 0x0c, 0x2f, 0x21, 0x32, 0x21, 0x30, 0xad, 0x4c, - 0xb6, 0xa5, 0x56, 0xda, 0xdc, 0x46, 0x4d, 0x3a, - 0xa6, 0x2d, 0xcb, 0x94, 0x16, 0x26, 0xc1, 0x75, - 0x0b, 0x8a, 0x6f, 0xf4, 0xaa, 0x0d, 0x9d, 0xae, - 0xb8, 0xf8, 0x78, 0x3c, 0x5d, 0x4f, 0xd5, 0x35, - 0x3a, 0x57, 0xd2, 0x97, 0xce, 0x79, 0x80, 0x24, - 0x0e, 0xed, 0x3e, 0x58, 0x39, 0x90, 0x16, 0x00, - 0x9d, 0x45, 0x74, 0x65, 0xc0, 0x1c, 0x48, 0x43, - 0xc4, 0x7d, 0xe6, 0xf4, 0x9b, 0x5e, 0x61, 0x6a, - 0xeb, 0x74, 0xd2, 0xc0, 0x9a, 0x9b, 0x3b, 0xb3, - 0x0d, 0x5b, 0xc0, 0x5d, 0x65, 0xba, 0x4a, 0x32, - 0x19, 0x02, 0xea, 0x7b, 0x21, 0xbb, 0x1f, 0x8c, - 0xce, 0x77, 0x0a, 0x25, 0x8b, 0x83, 0x81, 0x73, - 0x41, 0xf7, 0xa1, 0xb1, 0x9b, 0xfe, 0x4f, 0xc1, - 0x17, 0x51, 0x9b, 0xe1, 0x28, 0x2d, 0xa2, 0x4a, - 0x4b, 0x4d, 0xbc, 0xad, 0x33, 0x4a, 0x27, 0x10, - 0xd2, 0x50, 0x1c, 0xb1, 0x36, 0x50, 0x48, 0x65, - 0x35, 0xf8, 0x88, 0x28, 0x6b, 0x82, 0xc0, 0x1c, - 0x80, 0xa0, 0xfd, 0x5d, 0x17, 0x78, 0x13, 0xeb, - 0xcb, 0x5d, 0x85, 0x08, 0x51, 0x92, 0xf4, 0x1c, - 0xf4, 0xa4, 0xe2, 0x35, 0x9f, 0x08, 0xa9, 0xa4, - 0x08, 0x05, 0x32, 0x6d, 0x16, 0xf1, 0x7b, 0xc1, - 0x92, 0xc7, 0xd7, 0x8b, 0x2c, 0x27, 0xdf, 0x4e, - 0x9a, 0xe6, 0x54, 0x40, 0xe4, 0x21, 0x5a, 0xf9, - 0xc6, 0x24, 0xef, 0x65, 0x07, 0x2e, 0x2b, 0x4d, - 0x4f, 0x2a, 0x09, 0x6c, 0xe8, 0xc7, 0x88, 0x05, - 0xc7, 0x50, 0xb2, 0xde, 0xa2, 0xa1, 0x80, 0x64, - 0x0b, 0xb3, 0x36, 0xcd, 0x26, 0xde, 0x98, 0x8a, - 0xe4, 0x84, 0x17, 0x54, 0x2c, 0x54, 0x0e, 0x18, - 0x38, 0xa6, 0xb5, 0x0a, 0x46, 0x41, 0x2f, 0x1c, - 0x74, 0x80, 0xee, 0xf1, 0x7e, 0x74, 0x29, 0x8b, - 0xd4, 0xdd, 0xb5, 0x64, 0x74, 0x17, 0xcf, 0xcf, - 0xd8, 0x32, 0x34, 0xf9, 0xfc, 0x58, 0x64, 0xb5, - 0x44, 0x0e, 0x34, 0x41, 0x17, 0x15, 0xeb, 0xe0, - 0xa3, 0x49, 0x08, 0x3f, 0xe8, 0xc8, 0x8d, 0x5e, - 0xde, 0xa2, 0xb5, 0x00, 0x3a, 0x05, 0x78, 0xca, - 0x0a, 0xf5, 0xe5, 0x09, 0xb0, 0x5f, 0xea, 0x33, - 0x73, 0xce, 0x12, 0xde, 0x89, 0xa2, 0x49, 0x17, - 0x5a, 0x70, 0x07, 0xc1, 0x3b, 0xf5, 0x4c, 0x58, - 0xf6, 0xbe, 0x51, 0x49, 0x0f, 0xee, 0x8c, 0x11, - 0x03, 0x85, 0x5a, 0x29, 0x35, 0xd3, 0x44, 0x4c, - 0x63, 0x24, 0x0c, 0xc5, 0x2b, 0x2d, 0x9c, 0x46, - 0x50, 0x28, 0xd3, 0x88, 0xc4, 0x34, 0xbb, 0xb0, - 0x81, 0x41, 0x3d, 0xcf, 0x22, 0x58, 0x63, 0x43, - 0x13, 0xd3, 0x70, 0x64, 0x28, 0xc6, 0xcb, 0x90, - 0x6b, 0x9d, 0xd8, 0x38, 0x74, 0xfe, 0xf8, 0xa5, - 0x18, 0x0f, 0x08, 0xa3, 0x76, 0x8c, 0xa0, 0xbc, - 0x85, 0xc8, 0x2f, 0x0a, 0x16, 0x41, 0xc8, 0x3a, - 0x02, 0xe7, 0x5e, 0x03, 0xd2, 0x49, 0xde, 0x53, - 0x5c, 0x5c, 0x85, 0xf0, 0xa5, 0x69, 0x10, 0xf4, - 0x28, 0x65, 0x48, 0x38, 0x52, 0x11, 0x7b, 0x78, - 0x8b, 0x9d, 0x07, 0x04, 0x53, 0x3b, 0xd4, 0x75, - 0x41, 0xdd, 0x7c, 0xb1, 0xb4, 0x43, 0x21, 0x33, - 0xa0, 0xfd, 0xf0, 0x01, 0xee, 0x5e, 0x23, 0xd0, - 0x1e, 0x4c, 0xef, 0x05, 0xe2, 0xe1, 0x47, 0x8b, - 0x21, 0x84, 0x1a, 0x7b, 0xa8, 0x14, 0x03, 0x8e, - 0xb1, 0x5c, 0xf4, 0x92, 0x42, 0x55, 0x86, 0x92, - 0x69, 0x69, 0x42, 0x5b, 0x6a, 0xf1, 0x01, 0x20, - 0x4b, 0xa7, 0x0b, 0x03, 0x82, 0x36, 0x8b, 0xa8, - 0x0d, 0x10, 0xe1, 0x88, 0x38, 0x62, 0x2e, 0x13, - 0xe0, 0x7a, 0x48, 0x00, 0xc6, 0xb3, 0xbd, 0xe8, - 0x49, 0xaf, 0xb8, 0xed, 0x3b, 0x10, 0xa2, 0x15, - 0x4a, 0xd4, 0x30, 0x7e, 0x9c, 0xe9, 0xb0, 0x58, - 0x92, 0x04, 0x8d, 0x2a, 0xc8, 0xcf, 0xe9, 0xcc, - 0x8b, 0xa3, 0x0c, 0x89, 0xf5, 0x9c, 0xe5, 0xc5, - 0x08, 0xca, 0xd4, 0x95, 0x15, 0x21, 0xe2, 0xc8, - 0xc6, 0x93, 0xc2, 0x40, 0x70, 0x62, 0xf7, 0x20, - 0x39, 0x60, 0xaa, 0x5a, 0x48, 0x2e, 0x22, 0xd3, - 0x47, 0x26, 0x2c, 0xb8, 0xc8, 0x88, 0xaf, 0x11, - 0xf0, 0x32, 0x07, 0x02, 0x6c, 0xf1, 0x0f, 0x38, - 0x84, 0x1d, 0x5d, 0x96, 0x07, 0x70, 0x1c, 0x2b, - 0xb9, 0xc2, 0x50, 0x9b, 0x4e, 0x45, 0xe3, 0x25, - 0x8f, 0xee, 0x14, 0x72, 0x2c, 0x68, 0x29, 0x80, - 0x46, 0x58, 0xa1, 0x11, 0x20, 0x38, 0x9b, 0x70, - 0x90, 0x1c, 0x2e, 0x0c, 0x84, 0xcc, 0x7e, 0x27, - 0x2a, 0x16, 0x07, 0x0a, 0x1a, 0x88, 0x0f, 0x41, - 0xff, 0xf8, 0x61, 0x44, 0xd8, 0x60, 0x18, 0x85, - 0x53, 0x03, 0x20, 0x73, 0xa2, 0x07, 0x6b, 0xee, - 0x92, 0xc7, 0x4f, 0x0d, 0xf6, 0xf0, 0x17, 0x1a, - 0x59, 0xde, 0x9b, 0x28, 0x07, 0x04, 0xda, 0xca, - 0x2b, 0x6a, 0x37, 0x58, 0x6b, 0xaf, 0x83, 0x13, - 0x60, 0xe7, 0x6e, 0xc4, 0x48, 0x21, 0x0e, 0x58, - 0x92, 0x83, 0x82, 0x78, 0x8b, 0x23, 0x58, 0xd9, - 0x0d, 0x24, 0x7d, 0xb9, 0x2c, 0x07, 0x2c, 0x0e, - 0x42, 0x09, 0x98, 0xb0, 0xd8, 0x4d, 0x23, 0x10, - 0x70, 0xa7, 0x73, 0x86, 0xc6, 0x0b, 0x04, 0x9f, - 0xfb, 0x56, 0x29, 0x07, 0x23, 0x8f, 0x98, 0x0e, - 0x8f, 0x63, 0x0a, 0x50, 0x76, 0x29, 0x28, 0x26, - 0x3c, 0x5f, 0x02, 0xfb, 0x51, 0x9b, 0xb0, 0x61, - 0xc0, 0x70, 0xbc, 0x17, 0x29, 0xc0, 0xcc, 0x1d, - 0x08, 0x62, 0xca, 0x72, 0xf0, 0xa4, 0xfd, 0x5d, - 0x2c, 0x58, 0xd5, 0x5c, 0x1c, 0x2a, 0x4e, 0xf7, - 0x0a, 0x01, 0xfa, 0xff, 0xff, 0xd5, 0x09, 0xa8, - 0x8c, 0x1c, 0x30, 0x25, 0x09, 0xd3, 0xd9, 0x30, - 0xd3, 0xdb, 0x94, 0x13, 0x74, 0xc8, 0x71, 0x1a, - 0x21, 0x87, 0x43, 0x10, 0x89, 0x5a, 0x6b, 0x91, - 0xd5, 0x66, 0xa0, 0xb0, 0x1c, 0x30, 0x58, 0x64, - 0x15, 0xfe, 0x36, 0x04, 0x7b, 0x4d, 0x23, 0x07, - 0x3a, 0xf1, 0x0a, 0xc2, 0x7d, 0x3b, 0xa1, 0x91, - 0xa4, 0x62, 0x96, 0xb1, 0xae, 0x83, 0xf6, 0xc0, - 0x07, 0xae, 0x6c, 0x11, 0x45, 0xf4, 0x1c, 0x35, - 0x6a, 0x28, 0x39, 0x60, 0x71, 0x1b, 0xf4, 0x39, - 0x44, 0x41, 0xae, 0xf1, 0x07, 0x01, 0xd4, 0x89, - 0xf6, 0x94, 0x1f, 0x7d, 0xab, 0x1b, 0x20, 0xdb, - 0x22, 0x1e, 0xa2, 0x07, 0x09, 0x8b, 0xe3, 0xf4, - 0xda, 0x82, 0x8c, 0x25, 0x01, 0xc0, 0xe2, 0x36, - 0x59, 0xa0, 0xe2, 0x42, 0x82, 0x64, 0x78, 0xb0, - 0x66, 0x0e, 0x59, 0xdd, 0x63, 0x65, 0x0b, 0x02, - 0x6a, 0x8c, 0xc2, 0xad, 0x7a, 0x90, 0xa3, 0xa0, - 0xbd, 0xda, 0x53, 0xd9, 0xd5, 0x82, 0x4f, 0x2c, - 0x37, 0xd8, 0x50, 0x8c, 0xa0, 0x2a, 0x70, 0x5e, - 0x47, 0x4a, 0xa9, 0x28, 0xaf, 0x4f, 0x58, 0x88, - 0x31, 0x29, 0x19, 0x76, 0x8c, 0xc8, 0xbf, 0x0d, - 0xc1, 0x56, 0xe7, 0x0a, 0x05, 0xe5, 0x20, 0xe8, - 0xe6, 0xb0, 0x3b, 0xb7, 0xa0, 0xe1, 0x80, 0xaa, - 0xa0, 0x23, 0xd7, 0x74, 0xd5, 0x01, 0xfc, 0x19, - 0x85, 0x13, 0x01, 0xc1, 0x91, 0x1b, 0xec, 0x28, - 0x80, 0xb1, 0xe2, 0xc7, 0x6a, 0x74, 0x07, 0x2c, - 0x31, 0x15, 0xd8, 0xbd, 0xb7, 0x82, 0xe2, 0x1d, - 0x3c, 0xa2, 0x83, 0x97, 0x09, 0x3a, 0xc0, 0xb1, - 0x34, 0x50, 0x0b, 0x87, 0x6c, 0xc8, 0xa7, 0x6e, - 0x64, 0x37, 0xb7, 0x91, 0x1f, 0x09, 0x0a, 0x38, - 0x34, 0x8c, 0x97, 0x80, 0xe5, 0x8d, 0x94, 0x0a, - 0xd6, 0xe9, 0x24, 0x18, 0xae, 0x34, 0xd7, 0xd2, - 0x94, 0x20, 0x36, 0x34, 0x7c, 0x29, 0xe9, 0xb0, - 0x71, 0x3e, 0xe2, 0x08, 0x69, 0xde, 0x14, 0x8b, - 0xca, 0x01, 0x32, 0x67, 0x64, 0x43, 0x85, 0x07, - 0xf4, 0xdf, 0x04, 0xdb, 0x88, 0x38, 0xb0, 0xbc, - 0x32, 0x44, 0x14, 0x4f, 0x10, 0xa8, 0x34, 0x89, - 0x10, 0x38, 0x28, 0x7c, 0xe2, 0x0a, 0x0e, 0x17, - 0x04, 0xae, 0xfd, 0x78, 0x5d, 0x12, 0xdc, 0xde, - 0x73, 0x9c, 0x17, 0x85, 0x2f, 0x79, 0xc5, 0xbb, - 0x2c, 0x21, 0x6b, 0x92, 0x14, 0x92, 0x9f, 0x9e, - 0x0c, 0xd6, 0x20, 0x99, 0x28, 0xae, 0x27, 0x22, - 0x6d, 0xd9, 0xc4, 0x41, 0x99, 0xfd, 0x71, 0x42, - 0x25, 0x8a, 0x41, 0xd2, 0x1c, 0x60, 0xe3, 0xfa, - 0x14, 0x70, 0xa4, 0x8a, 0xaf, 0xa5, 0xd1, 0x90, - 0x26, 0x42, 0x2e, 0x53, 0x42, 0xe8, 0x0e, 0x0a, - 0x37, 0x27, 0x69, 0x29, 0x21, 0x41, 0x3c, 0xf6, - 0xf2, 0x21, 0xe5, 0x07, 0x48, 0x7a, 0x49, 0xd0, - 0x5c, 0xe9, 0xc9, 0x25, 0x0c, 0xa7, 0x02, 0xa9, - 0x9d, 0x17, 0x8c, 0x85, 0xdd, 0x05, 0xf6, 0x83, - 0x31, 0x8f, 0x41, 0xc2, 0xa8, 0x46, 0x0e, 0xa0, - 0xe0, 0x5f, 0x3c, 0x19, 0xd1, 0x4e, 0x9e, 0x40, - 0x89, 0x60, 0x5e, 0xcf, 0x60, 0x38, 0x07, 0xd4, - 0x20, 0xba, 0x7c, 0x28, 0xe8, 0x38, 0x62, 0xe9, - 0x25, 0xe1, 0xa1, 0x90, 0x38, 0x9a, 0xac, 0x45, - 0xaf, 0xa5, 0x8b, 0x21, 0xea, 0x23, 0x60, 0xe7, - 0x68, 0x8c, 0xa3, 0x81, 0x4c, 0xc3, 0x74, 0xd7, - 0x03, 0x22, 0x3e, 0xb8, 0xb8, 0x26, 0x64, 0x24, - 0xa4, 0xa7, 0xb4, 0xe6, 0x14, 0x12, 0x05, 0x52, - 0x0f, 0x45, 0x00, 0x19, 0xfc, 0x0e, 0x0a, 0x34, - 0x19, 0x03, 0x81, 0x7f, 0x8d, 0x34, 0xf7, 0x02, - 0x39, 0x8b, 0x8b, 0x90, 0x04, 0x52, 0x14, 0xb8, - 0xb8, 0x2c, 0x42, 0x58, 0x0b, 0x98, 0x9e, 0x51, - 0xc0, 0xc5, 0x68, 0x11, 0xe8, 0x03, 0x81, 0xc0, - 0xbf, 0x66, 0x81, 0xd5, 0xd2, 0xb9, 0x41, 0x27, - 0x02, 0x63, 0x11, 0xa3, 0x3f, 0x57, 0x9e, 0x73, - 0xbc, 0xb1, 0x09, 0x4f, 0x08, 0x37, 0x30, 0x94, - 0xe6, 0x93, 0x8b, 0xa3, 0x36, 0x6e, 0x00, 0xe1, - 0xae, 0xa8, 0x91, 0x83, 0x8d, 0x12, 0x85, 0x4a, - 0x8a, 0x1b, 0x27, 0xd3, 0xd3, 0x88, 0xc3, 0x07, - 0xcc, 0x80, 0xe0, 0x5c, 0xcc, 0xea, 0xc1, 0x90, - 0x2c, 0x5d, 0x3c, 0xa0, 0xe0, 0x9e, 0xad, 0x62, - 0x37, 0xc5, 0xe2, 0xa1, 0x40, 0x84, 0x2b, 0x82, - 0xb0, 0x5d, 0x3e, 0x73, 0xbd, 0x07, 0x0b, 0xc2, - 0x77, 0x16, 0x25, 0x17, 0x70, 0xd8, 0x38, 0x69, - 0x08, 0xb4, 0xcb, 0x0e, 0x05, 0x14, 0x38, 0x27, - 0x48, 0xaa, 0xa1, 0x85, 0x10, 0x07, 0xa3, 0x3d, - 0x54, 0x66, 0x18, 0x03, 0x8f, 0x1b, 0x3a, 0x4a, - 0x27, 0xd7, 0xbb, 0x01, 0xd0, 0xfe, 0xea, 0xf3, - 0xa6, 0xf8, 0x43, 0x86, 0x10, 0x1c, 0x76, 0x86, - 0x34, 0x62, 0x4a, 0x0b, 0xc4, 0xb9, 0xd3, 0x4e, - 0xd7, 0xf9, 0xa0, 0xb1, 0x24, 0x14, 0x50, 0xcf, - 0x86, 0x81, 0x3d, 0xe5, 0x42, 0xb7, 0x68, 0x2e, - 0xf4, 0x92, 0x14, 0x44, 0x63, 0x2e, 0x1d, 0x7e, - 0xaf, 0x42, 0x6d, 0x7f, 0x64, 0x29, 0x0a, 0xb5, - 0xec, 0x40, 0x0e, 0x04, 0xef, 0xbd, 0xe7, 0x56, - 0x40, 0x0b, 0x0a, 0x79, 0x8c, 0x7b, 0xc0, 0xa7, - 0x3d, 0xaf, 0x94, 0xde, 0x21, 0x45, 0xc0, 0xc0, - 0x17, 0x33, 0x31, 0x0a, 0xcb, 0x92, 0x03, 0x8f, - 0xb5, 0xd0, 0xf7, 0x9d, 0x3b, 0x56, 0x61, 0x21, - 0x25, 0x19, 0x82, 0xee, 0xf3, 0x92, 0xa3, 0x76, - 0xbd, 0xe7, 0xf6, 0x76, 0xf6, 0xe4, 0xc0, 0x29, - 0x81, 0xb5, 0xd0, 0x70, 0xad, 0xff, 0x3c, 0xba, - 0xd3, 0x6d, 0x96, 0xf5, 0x10, 0x2f, 0xe3, 0xb3, - 0x05, 0xc4, 0x53, 0xdb, 0x61, 0x20, 0x3a, 0x9f, - 0x9d, 0x35, 0xca, 0x4f, 0xa6, 0xe2, 0x90, 0x72, - 0xdd, 0x09, 0x21, 0x70, 0x7e, 0xe8, 0x00, 0xf2, - 0xe0, 0x3d, 0x60, 0x1d, 0x42, 0x5d, 0x20, 0x6d, - 0x82, 0xb6, 0xea, 0xe8, 0x04, 0xda, 0xfa, 0x48, - 0x8b, 0xb0, 0x96, 0xa0, 0x07, 0x2c, 0x4f, 0xed, - 0xbc, 0x5b, 0xa0, 0xe9, 0x05, 0x0f, 0x3a, 0x4a, - 0x82, 0x0a, 0xfe, 0x62, 0x13, 0xb1, 0x79, 0xde, - 0x8b, 0x88, 0x34, 0xe5, 0x1a, 0x01, 0x70, 0x57, - 0x2b, 0x82, 0xc3, 0x91, 0x72, 0x1a, 0xad, 0x62, - 0x0e, 0x83, 0x89, 0x57, 0x81, 0x27, 0x50, 0x2f, - 0x07, 0x3f, 0x07, 0x23, 0x3f, 0x17, 0xfc, 0xc4, - 0x1d, 0xda, 0x18, 0x11, 0x3b, 0x6f, 0x50, 0x62, - 0xc2, 0xf4, 0x40, 0x9d, 0xbc, 0x52, 0x88, 0x5c, - 0x2b, 0x77, 0x28, 0x6e, 0xb9, 0x20, 0x2e, 0xad, - 0x42, 0x68, 0x9f, 0x5e, 0x64, 0xbd, 0x36, 0x53, - 0x0a, 0x4a, 0x46, 0x8d, 0x64, 0x2b, 0x22, 0x3b, - 0xa6, 0xf5, 0x06, 0x76, 0x12, 0x89, 0xba, 0xc3, - 0x24, 0x23, 0x10, 0xc0, 0x87, 0x92, 0xf0, 0xe6, - 0xbe, 0x2b, 0x88, 0x6d, 0x34, 0x18, 0x1f, 0x95, - 0x89, 0x01, 0x7b, 0xed, 0x07, 0x20, 0x0c, 0x44, - 0xdb, 0x69, 0xae, 0x12, 0x20, 0x20, 0x8b, 0x40, - 0x9e, 0x2c, 0x4f, 0x10, 0x9b, 0x5c, 0x24, 0x79, - 0x78, 0x85, 0x12, 0x31, 0x98, 0x56, 0xf6, 0xde, - 0xa2, 0xb4, 0x66, 0x43, 0x54, 0xa9, 0x76, 0xbc, - 0xf0, 0x1c, 0x45, 0xba, 0x1a, 0x21, 0x28, 0x07, - 0x3f, 0x81, 0x1e, 0x83, 0x06, 0x5d, 0x0c, 0x89, - 0xa7, 0x94, 0x93, 0x80, 0xbd, 0xe9, 0xa0, 0xc3, - 0xa0, 0x3c, 0xee, 0x9c, 0xf2, 0x12, 0x03, 0x85, - 0x4f, 0x80, 0xea, 0x7a, 0xa2, 0xc8, 0x10, 0xae, - 0x8c, 0x82, 0x46, 0x28, 0xc1, 0xc2, 0xf0, 0x77, - 0x48, 0x69, 0xae, 0x48, 0x2b, 0xab, 0xe4, 0x0b, - 0x5e, 0xa3, 0x91, 0x61, 0x5e, 0x5c, 0xda, 0x34, - 0x44, 0xbd, 0xa4, 0x0d, 0x7e, 0x50, 0x73, 0xba, - 0xf4, 0x1f, 0xbf, 0xff, 0xff, 0x6a, 0x20, 0xa6, - 0x27, 0xf9, 0xc0, 0x7a, 0x0f, 0xff, 0xcf, 0xf5, - 0xd1, 0xae, 0x15, 0x65, 0x28, 0x90, 0x84, 0xd3, - 0x0a, 0x2f, 0x06, 0x00, 0xe2, 0x3f, 0x83, 0x4d, - 0x3f, 0x10, 0xac, 0x52, 0x0e, 0x3b, 0x81, 0xd1, - 0x7e, 0x06, 0x01, 0x14, 0x82, 0x3a, 0x04, 0x02, - 0xe4, 0x76, 0x1e, 0xe0, 0xe0, 0x5d, 0x52, 0x95, - 0xdd, 0xa7, 0xb8, 0x0b, 0x14, 0x00, 0xe0, 0xc8, - 0xeb, 0x58, 0xd8, 0xc4, 0x30, 0x21, 0xe0, 0xf4, - 0x30, 0x01, 0x84, 0xf4, 0x31, 0x18, 0x02, 0x7a, - 0x94, 0x2c, 0x15, 0xc4, 0xda, 0xc4, 0x78, 0x62, - 0x32, 0x8b, 0x42, 0x45, 0x81, 0xc5, 0x24, 0x71, - 0x01, 0x74, 0xe0, 0xc8, 0x90, 0x1c, 0x6c, 0x94, - 0x4d, 0x48, 0xb4, 0xf4, 0x37, 0x0d, 0x03, 0x89, - 0x0f, 0x38, 0x67, 0x60, 0x3f, 0xbc, 0x00, 0x6c, - 0x5e, 0x0e, 0x41, 0x4d, 0x85, 0x76, 0x02, 0xef, - 0x5e, 0x41, 0xcb, 0xd0, 0x70, 0x64, 0x85, 0x62, - 0x79, 0xd1, 0x80, 0xb8, 0x1c, 0x27, 0x70, 0x1f, - 0xdf, 0xff, 0xf7, 0x20, 0xa3, 0x25, 0x22, 0xd3, - 0x8b, 0x9e, 0x02, 0x1e, 0x5c, 0x1c, 0x11, 0xae, - 0xa3, 0x3a, 0xb7, 0xb2, 0x8b, 0xab, 0xe0, 0xb1, - 0x12, 0xf0, 0x1c, 0x2e, 0x0a, 0x12, 0xbc, 0x95, - 0x0f, 0x6a, 0x09, 0x2f, 0x45, 0xeb, 0x40, 0x1c, - 0x43, 0xcd, 0x59, 0x0b, 0xe2, 0x6a, 0x5f, 0x43, - 0x4a, 0x09, 0x54, 0xd3, 0x62, 0x9f, 0x65, 0x88, - 0x94, 0x8c, 0xaa, 0xc2, 0xfa, 0xfe, 0x55, 0x2c, - 0xe7, 0x82, 0xad, 0x6d, 0x41, 0xcc, 0x19, 0x22, - 0xe0, 0xa7, 0x31, 0x53, 0x91, 0x03, 0xf5, 0x17, - 0xfe, 0x2e, 0x29, 0x26, 0x4c, 0xb1, 0xb9, 0x2f, - 0x5b, 0x80, 0x8c, 0xb8, 0x61, 0x41, 0x77, 0x41, - 0xef, 0x11, 0xd4, 0x06, 0x86, 0x24, 0x5e, 0x44, - 0x2b, 0x8c, 0xd1, 0x14, 0x93, 0x32, 0xfc, 0x5b, - 0x51, 0x0a, 0xb4, 0xe5, 0x64, 0x3c, 0xb4, 0xd8, - 0x39, 0x18, 0x51, 0x48, 0x41, 0xcb, 0x70, 0x9f, - 0x70, 0x32, 0x40, 0x15, 0x4a, 0x88, 0x0e, 0x46, - 0x19, 0x84, 0x70, 0xd2, 0xe7, 0xf5, 0xe7, 0x81, - 0xaa, 0xe7, 0xdf, 0xe8, 0x69, 0x25, 0x36, 0x48, - 0x0e, 0x42, 0x14, 0x4d, 0xa6, 0xf2, 0x92, 0xac, - 0x49, 0xd2, 0x66, 0x85, 0x01, 0x28, 0xb8, 0x13, - 0x19, 0x6b, 0x78, 0x2e, 0x7e, 0xbf, 0xf8, 0x13, - 0xee, 0x50, 0x71, 0xcf, 0x20, 0x7f, 0x20, 0x30, - 0x2c, 0x34, 0x13, 0x5b, 0xb2, 0x31, 0x8a, 0xe2, - 0xf7, 0x34, 0x83, 0x31, 0xa6, 0xbe, 0x99, 0x56, - 0x1b, 0x6b, 0xb4, 0xa8, 0xf9, 0xca, 0x31, 0x1a, - 0x39, 0x50, 0x2c, 0x0e, 0x90, 0x1c, 0x73, 0xdc, - 0x9d, 0x5d, 0x6e, 0x22, 0xa6, 0x90, 0x9e, 0x5a, - 0xb2, 0x0e, 0x13, 0x45, 0xe7, 0xb3, 0xa0, 0xc4, - 0xcf, 0xbd, 0x43, 0x4d, 0x83, 0x06, 0x50, 0xe5, - 0x81, 0x6e, 0x00, 0xee, 0x00, 0xe8, 0xe9, 0xb8, - 0x52, 0x41, 0xec, 0x1b, 0x51, 0x75, 0x80, 0x99, - 0x57, 0xd1, 0x75, 0xd0, 0x94, 0x12, 0x0b, 0x89, - 0xfc, 0x17, 0x44, 0x25, 0x20, 0xb9, 0x53, 0x79, - 0x67, 0x3b, 0xf5, 0x22, 0x26, 0x69, 0x25, 0x42, - 0xe5, 0x71, 0x9c, 0xa1, 0xd0, 0x31, 0x5f, 0x6c, - 0x9b, 0x56, 0x35, 0x41, 0x71, 0x0b, 0x64, 0xe0, - 0x8a, 0x2b, 0xd3, 0xd7, 0x41, 0x63, 0x00, 0x79, - 0xdd, 0xd9, 0x2a, 0xe8, 0x51, 0x10, 0x40, 0x22, - 0x7d, 0x0b, 0x3b, 0xe2, 0x45, 0xe8, 0xbf, 0x54, - 0xf4, 0x60, 0xb0, 0xa5, 0x29, 0xe5, 0x11, 0x0d, - 0x29, 0xab, 0xde, 0xa2, 0x45, 0x20, 0x2f, 0xea, - 0xc8, 0xfa, 0x2e, 0x7e, 0x9c, 0x95, 0x12, 0x84, - 0xae, 0x23, 0x07, 0x09, 0x93, 0x24, 0x09, 0x38, - 0x3b, 0x86, 0x81, 0x35, 0x84, 0xda, 0xfb, 0x92, - 0x2f, 0x10, 0x83, 0x82, 0x2e, 0xba, 0x10, 0xc8, - 0xa4, 0x22, 0xdd, 0x07, 0x0d, 0x1f, 0x0d, 0xd9, - 0xd0, 0x4d, 0xd7, 0x21, 0xd7, 0x98, 0x03, 0x81, - 0x60, 0x7d, 0xd5, 0xe7, 0x21, 0x42, 0xe7, 0xe6, - 0xa0, 0xab, 0x83, 0x82, 0x7d, 0xc8, 0x32, 0xe5, - 0x07, 0x3e, 0x14, 0x9d, 0xd3, 0xf3, 0xa4, 0xa3, - 0x10, 0xca, 0x83, 0x8e, 0xa6, 0xb1, 0x4a, 0xc4, - 0xed, 0x74, 0x7d, 0x07, 0x02, 0xeb, 0xc3, 0x17, - 0x9c, 0xa8, 0xc2, 0x4a, 0x9f, 0x5c, 0x5c, 0x69, - 0x01, 0x36, 0x9d, 0xa4, 0xa0, 0xf3, 0xff, 0xff, - 0xa0, 0x39, 0x32, 0x52, 0x45, 0x91, 0x2f, 0xc0, - 0x9f, 0x06, 0x60, 0xe2, 0x5a, 0x77, 0x0a, 0x3f, - 0x89, 0x24, 0x28, 0x5c, 0x22, 0xac, 0xc5, 0xf8, - 0xb7, 0x6c, 0x40, 0x33, 0x7d, 0x58, 0x89, 0x72, - 0x69, 0xea, 0xc0, 0xe1, 0x91, 0x1f, 0x57, 0xd9, - 0x99, 0x27, 0x17, 0x47, 0x7a, 0x88, 0x26, 0xdb, - 0xa6, 0xe5, 0xe4, 0x01, 0xe2, 0xa9, 0x0c, 0x05, - 0x3b, 0x90, 0xda, 0x3e, 0x2c, 0x2b, 0x7e, 0x77, - 0xa4, 0x7a, 0x73, 0xc8, 0x1c, 0x59, 0x0a, 0x41, - 0x3f, 0x16, 0x61, 0x47, 0x01, 0xc4, 0xb3, 0x80, - 0xba, 0xd3, 0x4d, 0x86, 0x21, 0x80, 0x52, 0xfa, - 0x48, 0x8d, 0x10, 0xc4, 0x17, 0xd2, 0xf5, 0x14, - 0x0a, 0xe2, 0x7d, 0x46, 0x54, 0x4b, 0x0c, 0x0d, - 0x05, 0x58, 0xb0, 0x95, 0x4f, 0x50, 0x83, 0x91, - 0x05, 0x39, 0x10, 0x39, 0x10, 0x38, 0x8f, 0x1b, - 0xbc, 0x85, 0x01, 0x88, 0xd3, 0xb4, 0x13, 0xb5, - 0xe5, 0x74, 0x4b, 0x03, 0x91, 0x10, 0x31, 0x8c, - 0x0a, 0x25, 0x72, 0x5b, 0x06, 0x70, 0x9e, 0x51, - 0x53, 0x55, 0x19, 0x28, 0x38, 0xa0, 0x8f, 0x83, - 0x64, 0x21, 0x5e, 0xbb, 0x19, 0xcd, 0x18, 0x06, - 0x20, 0xe3, 0xf3, 0x16, 0xe8, 0x38, 0x22, 0xd0, - 0x12, 0x62, 0xac, 0x6c, 0x1d, 0x11, 0x9d, 0xbd, - 0x28, 0x84, 0xfa, 0xfa, 0x95, 0x77, 0xa0, 0x3a, - 0x86, 0x48, 0xa9, 0xa0, 0x8e, 0x2c, 0x50, 0x8f, - 0xbc, 0x01, 0xc0, 0xb0, 0x05, 0xcc, 0xd5, 0x90, - 0x41, 0x70, 0x4e, 0x9a, 0xeb, 0x22, 0x07, 0x14, - 0x82, 0xeb, 0xe0, 0x9f, 0x4e, 0x2c, 0x07, 0xea, - 0x80, 0x0d, 0x12, 0xc2, 0x81, 0x98, 0x38, 0x56, - 0x99, 0x60, 0x38, 0x27, 0xa5, 0x00, 0xf3, 0xff, - 0xff, 0x91, 0x99, 0x54, 0x8c, 0x4d, 0x9f, 0xab, - 0xdd, 0x51, 0x57, 0x5c, 0x90, 0x60, 0xb1, 0xef, - 0xca, 0x2b, 0xc0, 0xe2, 0x2a, 0x58, 0x94, 0xf1, - 0x4a, 0x22, 0xc8, 0x5d, 0xdf, 0x50, 0x49, 0x46, - 0x68, 0xc6, 0x51, 0xd1, 0x7b, 0x03, 0x00, 0x4d, - 0xa5, 0x14, 0x1d, 0x51, 0x05, 0x4f, 0x8b, 0x76, - 0x86, 0x6b, 0x03, 0x81, 0x3b, 0xd3, 0xb5, 0x1a, - 0xa7, 0xb6, 0xce, 0x20, 0x9c, 0x5e, 0x2c, 0x6c, - 0x86, 0x79, 0xc3, 0x64, 0x9d, 0x3f, 0xb8, 0x6c, - 0x1c, 0x42, 0xd6, 0x5a, 0x76, 0x0a, 0x2a, 0x32, - 0x3d, 0x77, 0x79, 0xc4, 0x16, 0x12, 0xd0, 0xa7, - 0x41, 0x80, 0xaf, 0x76, 0x20, 0xec, 0x07, 0x05, - 0x1f, 0x11, 0x85, 0x1c, 0xa8, 0x02, 0x8d, 0x7c, - 0x0e, 0x21, 0x75, 0x4f, 0x60, 0x3a, 0xa2, 0x27, - 0x9d, 0x06, 0x0c, 0x8d, 0x0a, 0xd9, 0x22, 0xf5, - 0x4d, 0x07, 0x50, 0x4c, 0xed, 0xe2, 0x30, 0xcc, - 0x07, 0xbb, 0x4f, 0x0c, 0xd1, 0x14, 0x83, 0x83, - 0x3e, 0x0d, 0x67, 0x94, 0x62, 0x0e, 0x17, 0xf5, - 0x00, 0xd1, 0xf0, 0x1c, 0xfd, 0x62, 0x04, 0x24, - 0x18, 0x51, 0x53, 0xfc, 0x28, 0x07, 0x0d, 0x77, - 0x03, 0x31, 0x5e, 0x51, 0xc8, 0x0e, 0x0a, 0xda, - 0xd5, 0x0f, 0x16, 0x58, 0x1d, 0xc0, 0x71, 0xc6, - 0x8b, 0x22, 0xc4, 0x66, 0xc2, 0x3d, 0x77, 0x6c, - 0xd2, 0x47, 0x65, 0x15, 0x0f, 0x41, 0xc3, 0x31, - 0x3f, 0xec, 0x36, 0x0b, 0xc7, 0x3b, 0x57, 0x44, - 0x52, 0x6e, 0x8a, 0xa7, 0x37, 0x95, 0x6a, 0x09, - 0x95, 0x37, 0xc4, 0x3c, 0x81, 0x98, 0x3a, 0x04, - 0x9f, 0x8b, 0x1a, 0x19, 0x83, 0x83, 0x11, 0x35, - 0x03, 0x90, 0x50, 0x72, 0x12, 0x39, 0xb0, 0xdf, - 0x41, 0xc4, 0x71, 0x4a, 0x12, 0x6d, 0x3e, 0x58, - 0xb8, 0xc9, 0x08, 0x2c, 0x20, 0x38, 0xf7, 0x58, - 0xd7, 0x41, 0xc1, 0x3d, 0x70, 0x33, 0x05, 0xd4, - 0xa8, 0x58, 0x1c, 0x18, 0xc8, 0x14, 0x77, 0xa2, - 0xa8, 0xbf, 0xcb, 0x51, 0x83, 0x8e, 0xc5, 0x29, - 0x5c, 0x17, 0x9e, 0xa0, 0x25, 0x44, 0x28, 0x9a, - 0x2f, 0xa8, 0x43, 0x0a, 0x7a, 0xd8, 0x8f, 0xb6, - 0x82, 0x66, 0x9f, 0x5e, 0x0c, 0x0d, 0x03, 0x97, - 0x42, 0x8c, 0xf4, 0xf0, 0xda, 0x21, 0x3e, 0x47, - 0xc3, 0x64, 0xcc, 0x66, 0x0e, 0x1a, 0x51, 0x5d, - 0x5d, 0x3b, 0x8a, 0x0a, 0x0a, 0x62, 0x3e, 0x72, - 0x3d, 0xdf, 0x83, 0x90, 0xa0, 0x05, 0xf7, 0xde, - 0x45, 0xb8, 0x33, 0xe2, 0xc0, 0xb0, 0x19, 0x91, - 0x3c, 0xef, 0x43, 0x75, 0xa2, 0x33, 0x6b, 0xf0, - 0x33, 0x7e, 0x56, 0x28, 0xd3, 0xab, 0xd4, 0x52, - 0x90, 0xfe, 0x21, 0x40, 0x52, 0xe8, 0x9e, 0xe7, - 0x22, 0x00, 0xd5, 0x4d, 0x06, 0x09, 0xe7, 0x90, - 0x16, 0x3c, 0xe1, 0x42, 0x10, 0xc0, 0x69, 0x10, - 0x71, 0xd1, 0x3d, 0x27, 0x79, 0x08, 0xda, 0x81, - 0x9a, 0x30, 0x72, 0x30, 0x4d, 0x72, 0x2e, 0x83, - 0x9c, 0x07, 0x06, 0x42, 0xbd, 0xcb, 0xd2, 0x2e, - 0x74, 0x51, 0xa7, 0xd4, 0x53, 0x70, 0x63, 0xc0, - 0x70, 0x49, 0xb9, 0x06, 0x66, 0xd0, 0x02, 0xc4, - 0x17, 0x9b, 0x84, 0x88, 0xc3, 0x30, 0x70, 0x55, - 0xb8, 0x0e, 0x5c, 0x1c, 0x32, 0x09, 0x90, 0xe5, - 0x5e, 0x6d, 0x01, 0xc4, 0x7d, 0x0a, 0xfd, 0x46, - 0x48, 0x48, 0xb3, 0xb7, 0x06, 0x4b, 0x8c, 0x10, - 0x03, 0x9f, 0xba, 0x2e, 0x46, 0x19, 0xbe, 0xf5, - 0x1a, 0xc7, 0xb4, 0xe0, 0x65, 0x02, 0x7c, 0x30, - 0x0c, 0x4d, 0x8a, 0x5f, 0x0d, 0x45, 0xca, 0x28, - 0x4b, 0x2b, 0x03, 0xa0, 0x30, 0x2c, 0x42, 0x5c, - 0xe6, 0x9e, 0x28, 0x82, 0xe0, 0x5c, 0xbe, 0xa3, - 0x96, 0x06, 0x61, 0x2c, 0x40, 0x1d, 0xd2, 0x17, - 0xc5, 0xc1, 0xc3, 0x5e, 0xce, 0x1a, 0xe0, 0xaf, - 0x4f, 0x0c, 0xba, 0x19, 0x06, 0x40, 0x3c, 0x6b, - 0xe7, 0x57, 0x58, 0xd4, 0x07, 0x1b, 0x14, 0x27, - 0xce, 0x92, 0xc2, 0x94, 0x60, 0xbe, 0x60, 0xe0, - 0x9f, 0x44, 0x85, 0xfa, 0xf8, 0xd8, 0x64, 0xa3, - 0x80, 0x39, 0x10, 0x55, 0xed, 0x18, 0x9b, 0x0b, - 0x32, 0x20, 0x58, 0x02, 0xe7, 0x1b, 0x21, 0xbd, - 0x9d, 0xe9, 0x50, 0x26, 0xe9, 0xba, 0x1f, 0xa2, - 0xee, 0x14, 0x2e, 0x03, 0xc8, 0xdd, 0x10, 0x4d, - 0x66, 0x8c, 0xe9, 0x48, 0x2e, 0x51, 0xe0, 0x26, - 0xa9, 0xc6, 0x43, 0x9c, 0x92, 0x20, 0x04, 0xd2, - 0xd7, 0x43, 0x27, 0x01, 0x7d, 0xa7, 0x65, 0x7c, - 0x0e, 0xb0, 0x11, 0xc2, 0x5b, 0xbf, 0x51, 0x57, - 0xc0, 0x46, 0xb1, 0x71, 0x97, 0x5d, 0x62, 0x06, - 0x68, 0xdf, 0xba, 0x6c, 0xad, 0x18, 0xc8, 0xe4, - 0x28, 0xcc, 0x1b, 0x7b, 0x85, 0x10, 0x31, 0x3f, - 0x41, 0xc8, 0x88, 0xb4, 0xde, 0x7f, 0x7e, 0x0c, - 0x05, 0x3e, 0xb9, 0xb5, 0x10, 0x6b, 0x2a, 0x1b, - 0xe7, 0x54, 0xe6, 0x12, 0x8d, 0xe8, 0x38, 0x62, - 0x7b, 0xd2, 0x45, 0xe8, 0x51, 0xf8, 0x8d, 0x71, - 0x78, 0x38, 0x62, 0x13, 0xb2, 0xfd, 0x09, 0x62, - 0x6c, 0x0d, 0x60, 0x32, 0x1f, 0xb7, 0xfa, 0x53, - 0xc8, 0x50, 0xb7, 0x06, 0x92, 0xa3, 0x32, 0xad, - 0x38, 0x0e, 0x28, 0x3d, 0x27, 0x9f, 0x20, 0x63, - 0xd7, 0xcb, 0xd4, 0x72, 0xf0, 0x90, 0x83, 0x5f, - 0x5d, 0x18, 0x92, 0xa3, 0x0d, 0xd7, 0x3d, 0xaa, - 0x91, 0x95, 0xe9, 0x48, 0xd1, 0xf4, 0x1f, 0xc2, - 0x00, 0x3f, 0x6c, 0x44, 0xba, 0x00, 0x70, 0x72, - 0x7e, 0x70, 0x57, 0x53, 0x64, 0x92, 0x0c, 0xcd, - 0x92, 0x02, 0xeb, 0xae, 0x50, 0x2a, 0xca, 0x0a, - 0x45, 0xc0, 0x3c, 0x1c, 0xee, 0x18, 0x03, 0x90, - 0x84, 0x54, 0x35, 0xe8, 0x49, 0xa7, 0x35, 0x12, - 0x00, 0x1c, 0x2e, 0x07, 0x3b, 0x49, 0x01, 0xdd, - 0x19, 0x83, 0x90, 0x89, 0xa7, 0x85, 0x05, 0x01, - 0x1b, 0x17, 0x14, 0x03, 0xb8, 0x0b, 0xe6, 0xc2, - 0x9e, 0x94, 0x9c, 0xd3, 0xa0, 0x70, 0x66, 0x43, - 0x3c, 0x07, 0x05, 0x49, 0x74, 0xd5, 0xe0, 0xc0, - 0x07, 0xae, 0xea, 0x5f, 0xa6, 0xc1, 0xc3, 0x05, - 0x85, 0xc2, 0xb8, 0xa4, 0x90, 0x2b, 0x89, 0xb8, - 0x0e, 0x42, 0x12, 0x34, 0x46, 0x81, 0xc4, 0xa2, - 0x96, 0xb8, 0x64, 0x6e, 0x02, 0xe7, 0xa3, 0x40, - 0x32, 0x07, 0x40, 0x5c, 0x3d, 0xed, 0x5f, 0xa1, - 0x55, 0x4b, 0xf9, 0x60, 0x70, 0xa2, 0x11, 0xf4, - 0x32, 0x73, 0xe5, 0x29, 0x0c, 0x01, 0xc5, 0x03, - 0x5b, 0x57, 0x20, 0x89, 0xd8, 0x39, 0x00, 0x39, - 0x71, 0x80, 0xd1, 0x8c, 0x49, 0x3a, 0x09, 0xf0, - 0xa2, 0x23, 0x07, 0x02, 0xfa, 0x54, 0x78, 0x94, - 0x31, 0x13, 0xac, 0x2a, 0x15, 0xd5, 0xe1, 0x17, - 0x51, 0x03, 0xa5, 0x3b, 0xa1, 0x2a, 0x37, 0xed, - 0xd2, 0xa2, 0x52, 0x42, 0x8a, 0xb1, 0xa2, 0x83, - 0xb2, 0xa4, 0xa2, 0x4a, 0x50, 0x8f, 0xa1, 0x80, - 0x55, 0x29, 0xd8, 0x9e, 0x50, 0x87, 0xa7, 0x31, - 0x50, 0x3b, 0x92, 0x0c, 0x0f, 0xf1, 0x99, 0x48, - 0x38, 0x07, 0x22, 0x24, 0x3f, 0xc1, 0xcb, 0x83, - 0x81, 0x60, 0x35, 0xc1, 0x75, 0x13, 0xf1, 0x74, - 0x43, 0x12, 0x51, 0x98, 0x47, 0x84, 0x52, 0x81, - 0x82, 0xc0, 0xe1, 0xac, 0x74, 0x16, 0x04, 0xa1, - 0x81, 0xe6, 0x04, 0x83, 0x20, 0x89, 0xd6, 0x42, - 0x7f, 0x4d, 0xd1, 0x81, 0x48, 0xa1, 0x46, 0x3f, - 0x8c, 0xc5, 0x33, 0x9b, 0xe4, 0x1b, 0x9d, 0x5c, - 0x63, 0x90, 0x1c, 0x83, 0xae, 0xc8, 0x51, 0x06, - 0x50, 0x32, 0xa0, 0xbf, 0x2d, 0xc0, 0x71, 0x20, - 0x38, 0x5c, 0x4a, 0xef, 0xa7, 0xb4, 0xd0, 0xb8, - 0x4b, 0x45, 0xc2, 0xf0, 0x4e, 0x65, 0x21, 0x3f, - 0x34, 0x8c, 0x1c, 0x4a, 0x0e, 0xeb, 0xe4, 0xa0, - 0x1d, 0x46, 0x01, 0x5c, 0xe8, 0x9f, 0x5f, 0x14, - 0xa2, 0x37, 0x49, 0x44, 0xcf, 0x9c, 0x18, 0x92, - 0xa3, 0x07, 0x09, 0xe6, 0x1b, 0x09, 0x2b, 0x83, - 0x10, 0x4c, 0xe2, 0x35, 0x9d, 0x13, 0x92, 0x80, - 0x70, 0x66, 0x35, 0x6b, 0x77, 0x84, 0x6c, 0x64, - 0xb9, 0xa5, 0x96, 0x13, 0xee, 0x0c, 0x41, 0xc8, - 0xfa, 0x13, 0xb5, 0x9d, 0x25, 0x0a, 0x75, 0xde, - 0x50, 0x70, 0x2f, 0xa7, 0x56, 0x37, 0x61, 0xb2, - 0x42, 0x40, 0xae, 0x68, 0xcc, 0xa5, 0x07, 0x42, - 0x4d, 0x0d, 0xad, 0xca, 0x0b, 0xd5, 0xa3, 0x21, - 0x36, 0x9e, 0x8a, 0x22, 0xfd, 0x05, 0x88, 0x38, - 0x82, 0x4a, 0x28, 0xc1, 0x6e, 0x92, 0xad, 0x43, - 0x17, 0x4a, 0x34, 0x60, 0xfe, 0x10, 0x01, 0xe3, - 0x75, 0x6e, 0x03, 0x82, 0x4b, 0xdc, 0xa2, 0xbd, - 0x77, 0x28, 0x3b, 0xab, 0x77, 0x85, 0x21, 0x3c, - 0xc1, 0x9b, 0x9c, 0xb6, 0x76, 0xdb, 0x67, 0x78, - 0xb6, 0x5e, 0x21, 0x92, 0xde, 0x11, 0x4a, 0x20, - 0x74, 0x08, 0xa4, 0xa1, 0xb8, 0xd3, 0x5e, 0x68, - 0xd6, 0x57, 0x85, 0x01, 0x89, 0x0c, 0x5e, 0xa0, - 0x07, 0x1a, 0x07, 0x09, 0xf7, 0x11, 0x02, 0xeb, - 0x07, 0x1e, 0xd3, 0x46, 0xad, 0x11, 0x94, 0x74, - 0x1d, 0xd7, 0x29, 0xc3, 0x62, 0xf7, 0x24, 0x1f, - 0x7c, 0x18, 0x38, 0xf8, 0x30, 0xc2, 0x86, 0x12, - 0x03, 0x9f, 0xea, 0x66, 0xc1, 0x83, 0x86, 0xc6, - 0x5e, 0xa0, 0x39, 0xce, 0x51, 0x44, 0xda, 0xf8, - 0x5f, 0x01, 0xc3, 0x4f, 0x61, 0xb5, 0xe8, 0x62, - 0x8c, 0xa0, 0x17, 0x57, 0x75, 0x0f, 0x36, 0xf1, - 0x65, 0xc8, 0x1c, 0x02, 0x53, 0xab, 0xd0, 0x58, - 0xba, 0xf6, 0x44, 0x00, 0x9d, 0xaf, 0x48, 0x22, - 0x38, 0x85, 0x09, 0x48, 0x45, 0xe5, 0x28, 0x1a, - 0xfb, 0x20, 0x6f, 0x38, 0x32, 0x14, 0x54, 0xb4, - 0x63, 0xd0, 0x70, 0xd6, 0x82, 0xef, 0x5d, 0xd1, - 0x9f, 0x56, 0x3d, 0xc6, 0x1c, 0xe2, 0x11, 0x5b, - 0x46, 0x6a, 0xfd, 0x6e, 0x04, 0xad, 0x62, 0x8c, - 0x07, 0x00, 0xe2, 0x32, 0xf8, 0x1c, 0xf0, 0x51, - 0x57, 0xc0, 0xe0, 0x1c, 0x2a, 0xf1, 0x07, 0x09, - 0xb0, 0xbe, 0x03, 0xb8, 0x09, 0xfd, 0x62, 0x8b, - 0x45, 0xe1, 0x5d, 0x07, 0x2c, 0xb0, 0x4f, 0x17, - 0xf4, 0x95, 0x00, 0x26, 0xc9, 0x4a, 0x18, 0x13, - 0xe2, 0xb4, 0x6b, 0xd0, 0xb1, 0xd4, 0x11, 0x69, - 0x69, 0xc2, 0xc8, 0x75, 0xf2, 0xc0, 0xe4, 0x64, - 0x1d, 0x71, 0x80, 0xb8, 0x4c, 0xc6, 0x36, 0x3b, - 0x64, 0x90, 0x38, 0xb3, 0x56, 0x18, 0x65, 0x08, - 0x8c, 0x46, 0xb9, 0xfa, 0xbf, 0x0c, 0xaa, 0xc1, - 0x26, 0x90, 0x1e, 0x8f, 0xff, 0xf2, 0x36, 0xba, - 0x34, 0x56, 0x54, 0x2b, 0x03, 0x90, 0x9e, 0x9a, - 0x31, 0x44, 0x18, 0x11, 0xfb, 0xc8, 0x13, 0x6b, - 0xe9, 0x61, 0x24, 0xc4, 0x68, 0x85, 0x33, 0x25, - 0x29, 0xa1, 0x15, 0x5d, 0xa4, 0xb2, 0xda, 0x15, - 0x7e, 0x62, 0x35, 0x96, 0x20, 0xf3, 0xa4, 0x51, - 0x79, 0xb0, 0xa5, 0x1f, 0x20, 0xc7, 0x80, 0x9b, - 0xed, 0x24, 0xe2, 0x11, 0xab, 0xe8, 0xcb, 0xa1, - 0x54, 0xcc, 0x44, 0x8b, 0x66, 0x76, 0x3a, 0x62, - 0x20, 0x4f, 0xd7, 0xe2, 0x29, 0xbe, 0x92, 0x93, - 0xb5, 0x90, 0x03, 0xba, 0x27, 0x7d, 0xb0, 0x39, - 0x2b, 0xea, 0x31, 0x9f, 0x02, 0x7f, 0x78, 0x50, - 0x80, 0x30, 0x3f, 0x68, 0x38, 0x90, 0x5e, 0x73, - 0x5f, 0x4e, 0xc5, 0x83, 0x80, 0x58, 0x53, 0x64, - 0x0e, 0xf5, 0x75, 0xea, 0xfd, 0x28, 0x01, 0xc2, - 0x7d, 0x25, 0x24, 0x18, 0x21, 0x26, 0x63, 0x2e, - 0x14, 0x03, 0x89, 0xb0, 0x4b, 0xd7, 0xcb, 0x40, - 0x1c, 0x0e, 0x27, 0xf1, 0x0a, 0x25, 0x08, 0xf8, - 0x0b, 0x00, 0x96, 0x57, 0x24, 0xb4, 0x1c, 0xbb, - 0xf2, 0xc8, 0x90, 0x13, 0xdb, 0xc5, 0xf8, 0x0b, - 0x8d, 0x77, 0x68, 0xc5, 0x12, 0x15, 0xd6, 0x58, - 0x1c, 0x41, 0x0a, 0x24, 0x17, 0x74, 0x99, 0x86, - 0x6e, 0x7b, 0x56, 0x5b, 0x8a, 0x1e, 0xb3, 0xa8, - 0xcf, 0x6b, 0xb5, 0x34, 0x66, 0x18, 0x0c, 0x90, - 0x0c, 0x0f, 0x6e, 0x12, 0x2e, 0x50, 0x30, 0x15, - 0xb8, 0xa5, 0x61, 0xbd, 0xe7, 0x21, 0x0b, 0x51, - 0x94, 0xd4, 0xe7, 0x03, 0x00, 0x75, 0x0a, 0xfb, - 0xce, 0x9c, 0xab, 0xb2, 0x94, 0x48, 0x17, 0x0c, - 0x02, 0x67, 0xc1, 0x91, 0x45, 0xa6, 0xc1, 0x3e, - 0x49, 0x62, 0x34, 0x41, 0x33, 0xb4, 0x67, 0xd1, - 0x5c, 0x9d, 0xe2, 0xe7, 0x62, 0xee, 0x55, 0x08, - 0x81, 0xdc, 0x42, 0x0e, 0x21, 0x85, 0xe4, 0xef, - 0x00, 0x78, 0x39, 0x18, 0x55, 0x2b, 0x92, 0xde, - 0xf4, 0xd1, 0x48, 0x2e, 0x7c, 0x90, 0x91, 0x6e, - 0x83, 0x84, 0xee, 0x4b, 0x16, 0x14, 0x55, 0xf5, - 0x45, 0x10, 0x03, 0x9c, 0xe7, 0x0d, 0xf4, 0x90, - 0x64, 0x0b, 0x17, 0xcd, 0x84, 0x96, 0x4a, 0xbc, - 0x09, 0x37, 0x4a, 0x3a, 0x0f, 0x3d, 0x00, 0x19, - 0x34, 0x74, 0x5f, 0x59, 0x41, 0x18, 0x17, 0x33, - 0x95, 0x75, 0xe7, 0x14, 0x80, 0xee, 0x84, 0xcc, - 0xae, 0x12, 0x80, 0xf2, 0x0d, 0xa4, 0x9d, 0xc9, - 0x00, 0x79, 0x03, 0x3b, 0x5f, 0x5b, 0xc4, 0x3d, - 0x82, 0xf0, 0x71, 0xf9, 0xb3, 0x88, 0xfb, 0xd0, - 0x72, 0x09, 0xd1, 0xa4, 0xe2, 0xc8, 0x33, 0x7a, - 0x8d, 0x00, 0x39, 0x08, 0x2e, 0xb5, 0xc0, 0xd4, - 0xd7, 0x68, 0x38, 0x17, 0x5a, 0x33, 0xfa, 0xf3, - 0x38, 0x83, 0x8b, 0x12, 0x21, 0x39, 0x2b, 0x94, - 0xf5, 0x18, 0x38, 0x33, 0x21, 0x9b, 0x41, 0xf1, - 0xe0, 0x07, 0xd2, 0x52, 0x59, 0x11, 0x92, 0x92, - 0x2f, 0x41, 0xc4, 0x3d, 0x5e, 0x1e, 0xd3, 0x95, - 0xc0, 0x71, 0x0c, 0x7a, 0xc5, 0x38, 0x8c, 0x6e, - 0xed, 0x31, 0xb0, 0xe2, 0x82, 0x35, 0x09, 0x27, - 0x3d, 0xaa, 0x72, 0xdc, 0x43, 0x04, 0x47, 0xc5, - 0xa9, 0xb0, 0x9b, 0x7f -}; diff --git a/contrib/apps/shell/shell.c b/contrib/apps/shell/shell.c deleted file mode 100644 index d028905..0000000 --- a/contrib/apps/shell/shell.c +++ /dev/null @@ -1,1183 +0,0 @@ -/* - * 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 - * - */ - -#include "shell.h" - -#include "lwip/opt.h" - -#if LWIP_NETCONN - -#include -#include - -#include "lwip/mem.h" -#include "lwip/debug.h" -#include "lwip/def.h" -#include "lwip/api.h" -#include "lwip/stats.h" - -#ifdef WIN32 -#define NEWLINE "\r\n" -#else /* WIN32 */ -#define NEWLINE "\n" -#endif /* WIN32 */ - -/** Define this to 1 if you want to echo back all received characters - * (e.g. so they are displayed on a remote telnet) - */ -#ifndef SHELL_ECHO -#define SHELL_ECHO 0 -#endif - -#define BUFSIZE 1024 -static unsigned char buffer[BUFSIZE]; - -struct command { - struct netconn *conn; - s8_t (* exec)(struct command *); - u8_t nargs; - char *args[10]; -}; - -#undef IP_HDRINCL - -#include -#include -#include - -#define ESUCCESS 0 -#define ESYNTAX -1 -#define ETOOFEW -2 -#define ETOOMANY -3 -#define ECLOSED -4 - -#define NCONNS 10 -static struct netconn *conns[NCONNS]; - -/* help_msg is split into 2 strings to prevent exceeding the C89 maximum length of 509 per string */ -static char help_msg1[] = "Available commands:"NEWLINE"\ -open [IP address] [TCP port]: opens a TCP connection to the specified address."NEWLINE"\ -lstn [TCP port]: sets up a server on the specified port."NEWLINE"\ -acpt [connection #]: waits for an incoming connection request."NEWLINE"\ -send [connection #] [message]: sends a message on a TCP connection."NEWLINE"\ -udpc [local UDP port] [IP address] [remote port]: opens a UDP \"connection\"."NEWLINE"\ -udpl [local UDP port] [IP address] [remote port]: opens a UDP-Lite \"connection\"."NEWLINE""; -static char help_msg2[] = "udpn [local UDP port] [IP address] [remote port]: opens a UDP \"connection\" without checksums."NEWLINE"\ -udpb [local port] [remote port]: opens a UDP broadcast \"connection\"."NEWLINE"\ -usnd [connection #] [message]: sends a message on a UDP connection."NEWLINE"\ -recv [connection #]: recieves data on a TCP or UDP connection."NEWLINE"\ -clos [connection #]: closes a TCP or UDP connection."NEWLINE"\ -stat: prints out lwIP statistics."NEWLINE"\ -quit: quits."NEWLINE""; - -#if LWIP_STATS -static char padding_10spaces[] = " "; - -#define PROTOCOL_STATS (LINK_STATS && ETHARP_STATS && IPFRAG_STATS && IP_STATS && ICMP_STATS && UDP_STATS && TCP_STATS) - -#if PROTOCOL_STATS -static const char* shell_stat_proto_names[] = { -#if LINK_STATS - "LINK ", -#endif -#if ETHARP_STATS - "ETHARP ", -#endif -#if IPFRAG_STATS - "IP_FRAG ", -#endif -#if IP_STATS - "IP ", -#endif -#if ICMP_STATS - "ICMP ", -#endif -#if UDP_STATS - "UDP ", -#endif -#if TCP_STATS - "TCP ", -#endif - "last" -}; - -static struct stats_proto* shell_stat_proto_stats[] = { -#if LINK_STATS - &lwip_stats.link, -#endif -#if ETHARP_STATS - &lwip_stats.etharp, -#endif -#if IPFRAG_STATS - &lwip_stats.ip_frag, -#endif -#if IP_STATS - &lwip_stats.ip, -#endif -#if ICMP_STATS - &lwip_stats.icmp, -#endif -#if UDP_STATS - &lwip_stats.udp, -#endif -#if TCP_STATS - &lwip_stats.tcp, -#endif -}; -const size_t num_protostats = sizeof(shell_stat_proto_stats)/sizeof(struct stats_proto*); - -static const char *stat_msgs_proto[] = { - " * transmitted ", - " * received ", - " forwarded ", - " * dropped ", - " * checksum errors ", - " * length errors ", - " * memory errors ", - " routing errors ", - " protocol errors ", - " option errors ", - " * misc errors ", - " cache hits " -}; -#endif /* PROTOCOL_STATS */ -#endif /* LWIP_STATS */ - -/*-----------------------------------------------------------------------------------*/ -static void -sendstr(const char *str, struct netconn *conn) -{ - netconn_write(conn, (void *)str, strlen(str), NETCONN_NOCOPY); -} -/*-----------------------------------------------------------------------------------*/ -static s8_t -com_open(struct command *com) -{ - ip_addr_t ipaddr; - u16_t port; - int i; - err_t err; - long tmp; - - if (ipaddr_aton(com->args[0], &ipaddr) == -1) { - sendstr(strerror(errno), com->conn); - return ESYNTAX; - } - tmp = strtol(com->args[1], NULL, 10); - if((tmp < 0) || (tmp > 0xffff)) { - sendstr("Invalid port number."NEWLINE, com->conn); - return ESUCCESS; - } - port = (u16_t)tmp; - - /* Find the first unused connection in conns. */ - for(i = 0; i < NCONNS && conns[i] != NULL; i++); - - if (i == NCONNS) { - sendstr("No more connections available, sorry."NEWLINE, com->conn); - return ESUCCESS; - } - - sendstr("Opening connection to ", com->conn); - netconn_write(com->conn, com->args[0], strlen(com->args[0]), NETCONN_COPY); - sendstr(":", com->conn); - netconn_write(com->conn, com->args[1], strlen(com->args[1]), NETCONN_COPY); - sendstr(NEWLINE, com->conn); - - conns[i] = netconn_new(NETCONN_TCP); - if (conns[i] == NULL) { - sendstr("Could not create connection identifier (out of memory)."NEWLINE, com->conn); - return ESUCCESS; - } - err = netconn_connect(conns[i], &ipaddr, port); - if (err != ERR_OK) { - fprintf(stderr, "error %s"NEWLINE, lwip_strerr(err)); - sendstr("Could not connect to remote host: ", com->conn); -#ifdef LWIP_DEBUG - sendstr(lwip_strerr(err), com->conn); -#else - sendstr("(debugging must be turned on for error message to appear)", com->conn); -#endif /* LWIP_DEBUG */ - sendstr(NEWLINE, com->conn); - netconn_delete(conns[i]); - conns[i] = NULL; - return ESUCCESS; - } - - sendstr("Opened connection, connection identifier is ", com->conn); - snprintf((char *)buffer, sizeof(buffer), "%d"NEWLINE, i); - netconn_write(com->conn, buffer, strlen((const char *)buffer), NETCONN_COPY); - - return ESUCCESS; -} -/*-----------------------------------------------------------------------------------*/ -static s8_t -com_lstn(struct command *com) -{ - u16_t port; - int i; - err_t err; - long tmp; - - tmp = strtol(com->args[0], NULL, 10); - if((tmp < 0) || (tmp > 0xffff)) { - sendstr("Invalid port number."NEWLINE, com->conn); - return ESUCCESS; - } - port = (u16_t)tmp; - - /* Find the first unused connection in conns. */ - for(i = 0; i < NCONNS && conns[i] != NULL; i++); - - if (i == NCONNS) { - sendstr("No more connections available, sorry."NEWLINE, com->conn); - return ESUCCESS; - } - - sendstr("Opening a listening connection on port ", com->conn); - netconn_write(com->conn, com->args[0], strlen(com->args[0]), NETCONN_COPY); - sendstr(NEWLINE, com->conn); - - conns[i] = netconn_new(NETCONN_TCP); - if (conns[i] == NULL) { - sendstr("Could not create connection identifier (out of memory)."NEWLINE, com->conn); - return ESUCCESS; - } - - err = netconn_bind(conns[i], IP_ADDR_ANY, port); - if (err != ERR_OK) { - netconn_delete(conns[i]); - conns[i] = NULL; - sendstr("Could not bind: ", com->conn); -#ifdef LWIP_DEBUG - sendstr(lwip_strerr(err), com->conn); -#else - sendstr("(debugging must be turned on for error message to appear)", com->conn); -#endif /* LWIP_DEBUG */ - sendstr(NEWLINE, com->conn); - return ESUCCESS; - } - - err = netconn_listen(conns[i]); - if (err != ERR_OK) { - netconn_delete(conns[i]); - conns[i] = NULL; - sendstr("Could not listen: ", com->conn); -#ifdef LWIP_DEBUG - sendstr(lwip_strerr(err), com->conn); -#else - sendstr("(debugging must be turned on for error message to appear)", com->conn); -#endif /* LWIP_DEBUG */ - sendstr(NEWLINE, com->conn); - return ESUCCESS; - } - - sendstr("Opened connection, connection identifier is ", com->conn); - snprintf((char *)buffer, sizeof(buffer), "%d"NEWLINE, i); - netconn_write(com->conn, buffer, strlen((const char *)buffer), NETCONN_COPY); - - return ESUCCESS; -} -/*-----------------------------------------------------------------------------------*/ -/*-----------------------------------------------------------------------------------*/ -static s8_t -com_clos(struct command *com) -{ - int i; - err_t err; - - i = strtol(com->args[0], NULL, 10); - - if (i > NCONNS) { - sendstr("Connection identifier too high."NEWLINE, com->conn); - return ESUCCESS; - } - if (conns[i] == NULL) { - sendstr("Connection identifier not in use."NEWLINE, com->conn); - return ESUCCESS; - } - - err = netconn_close(conns[i]); - if (err != ERR_OK) { - sendstr("Could not close connection: ", com->conn); -#ifdef LWIP_DEBUG - sendstr(lwip_strerr(err), com->conn); -#else - sendstr("(debugging must be turned on for error message to appear)", com->conn); -#endif /* LWIP_DEBUG */ - sendstr(NEWLINE, com->conn); - return ESUCCESS; - } - - sendstr("Connection closed."NEWLINE, com->conn); - netconn_delete(conns[i]); - conns[i] = NULL; - return ESUCCESS; -} -/*-----------------------------------------------------------------------------------*/ -static s8_t -com_acpt(struct command *com) -{ - int i, j; - err_t err; - - /* Find the first unused connection in conns. */ - for(j = 0; j < NCONNS && conns[j] != NULL; j++); - - if (j == NCONNS) { - sendstr("No more connections available, sorry."NEWLINE, com->conn); - return ESUCCESS; - } - - i = strtol(com->args[0], NULL, 10); - - if (i > NCONNS) { - sendstr("Connection identifier too high."NEWLINE, com->conn); - return ESUCCESS; - } - if (conns[i] == NULL) { - sendstr("Connection identifier not in use."NEWLINE, com->conn); - return ESUCCESS; - } - - err = netconn_accept(conns[i], &conns[j]); - - if (err != ERR_OK) { - sendstr("Could not accept connection: ", com->conn); -#ifdef LWIP_DEBUG - sendstr(lwip_strerr(err), com->conn); -#else - sendstr("(debugging must be turned on for error message to appear)", com->conn); -#endif /* LWIP_DEBUG */ - sendstr(NEWLINE, com->conn); - return ESUCCESS; - } - - sendstr("Accepted connection, connection identifier for new connection is ", com->conn); - snprintf((char *)buffer, sizeof(buffer), "%d"NEWLINE, j); - netconn_write(com->conn, buffer, strlen((const char *)buffer), NETCONN_COPY); - - return ESUCCESS; -} -/*-----------------------------------------------------------------------------------*/ -#if LWIP_STATS -static void -com_stat_write_mem(struct netconn *conn, struct stats_mem *elem, int i) -{ - u16_t len; - char buf[100]; - size_t slen; - -#ifdef LWIP_DEBUG - LWIP_UNUSED_ARG(i); - slen = strlen(elem->name); - netconn_write(conn, elem->name, slen, NETCONN_COPY); -#else /* LWIP_DEBUG */ - len = (u16_t)sprintf(buf, "%d", i); - slen = strlen(buf); - netconn_write(conn, buf, slen, NETCONN_COPY); -#endif /* LWIP_DEBUG */ - if(slen < 10) { - netconn_write(conn, padding_10spaces, 10-slen, NETCONN_COPY); - } - - len = (u16_t)sprintf(buf, " * available %"MEM_SIZE_F NEWLINE, elem->avail); - netconn_write(conn, buf, len, NETCONN_COPY); - len = (u16_t)sprintf(buf, " * used %"MEM_SIZE_F NEWLINE, elem->used); - netconn_write(conn, buf, len, NETCONN_COPY); - len = (u16_t)sprintf(buf, " * high water mark %"MEM_SIZE_F NEWLINE, elem->max); - netconn_write(conn, buf, len, NETCONN_COPY); - len = (u16_t)sprintf(buf, " * errors %"STAT_COUNTER_F NEWLINE, elem->err); - netconn_write(conn, buf, len, NETCONN_COPY); - len = (u16_t)sprintf(buf, " * illegal %"STAT_COUNTER_F NEWLINE, elem->illegal); - netconn_write(conn, buf, len, NETCONN_COPY); -} -static void -com_stat_write_sys(struct netconn *conn, struct stats_syselem *elem, const char *name) -{ - u16_t len; - char buf[100]; - size_t slen = strlen(name); - - netconn_write(conn, name, slen, NETCONN_COPY); - if(slen < 10) { - netconn_write(conn, padding_10spaces, 10-slen, NETCONN_COPY); - } - - len = (u16_t)sprintf(buf, " * used %"STAT_COUNTER_F NEWLINE, elem->used); - netconn_write(conn, buf, len, NETCONN_COPY); - len = (u16_t)sprintf(buf, " * high water mark %"STAT_COUNTER_F NEWLINE, elem->max); - netconn_write(conn, buf, len, NETCONN_COPY); - len = (u16_t)sprintf(buf, " * errors %"STAT_COUNTER_F NEWLINE, elem->err); - netconn_write(conn, buf, len, NETCONN_COPY); -} -static s8_t -com_stat(struct command *com) -{ -#if PROTOCOL_STATS || MEMP_STATS - size_t i; -#endif /* PROTOCOL_STATS || MEMP_STATS */ -#if PROTOCOL_STATS - size_t k; - char buf[100]; - u16_t len; - - /* protocol stats, @todo: add IGMP */ - for(i = 0; i < num_protostats; i++) { - size_t s = sizeof(struct stats_proto)/sizeof(STAT_COUNTER); - STAT_COUNTER *c = &shell_stat_proto_stats[i]->xmit; - LWIP_ASSERT("stats not in sync", s == sizeof(stat_msgs_proto)/sizeof(char*)); - netconn_write(com->conn, shell_stat_proto_names[i], strlen(shell_stat_proto_names[i]), NETCONN_COPY); - for(k = 0; k < s; k++) { - len = (u16_t)sprintf(buf, "%s%"STAT_COUNTER_F NEWLINE, stat_msgs_proto[k], c[k]); - netconn_write(com->conn, buf, len, NETCONN_COPY); - } - } -#endif /* PROTOCOL_STATS */ -#if MEM_STATS - com_stat_write_mem(com->conn, &lwip_stats.mem, -1); -#endif /* MEM_STATS */ -#if MEMP_STATS - for(i = 0; i < MEMP_MAX; i++) { - com_stat_write_mem(com->conn, &lwip_stats.memp[i], -1); - } -#endif /* MEMP_STATS */ -#if SYS_STATS - com_stat_write_sys(com->conn, &lwip_stats.sys.sem, "SEM "); - com_stat_write_sys(com->conn, &lwip_stats.sys.mutex, "MUTEX "); - com_stat_write_sys(com->conn, &lwip_stats.sys.sem, "MBOX "); -#endif /* SYS_STATS */ - - return ESUCCESS; -} -#endif -/*-----------------------------------------------------------------------------------*/ -static s8_t -com_send(struct command *com) -{ - int i; - err_t err; - size_t len; - - i = strtol(com->args[0], NULL, 10); - - if (i > NCONNS) { - sendstr("Connection identifier too high."NEWLINE, com->conn); - return ESUCCESS; - } - - if (conns[i] == NULL) { - sendstr("Connection identifier not in use."NEWLINE, com->conn); - return ESUCCESS; - } - - len = strlen(com->args[1]); - com->args[1][len] = '\r'; - com->args[1][len + 1] = '\n'; - com->args[1][len + 2] = 0; - - err = netconn_write(conns[i], com->args[1], len + 3, NETCONN_COPY); - if (err != ERR_OK) { - sendstr("Could not send data: ", com->conn); -#ifdef LWIP_DEBUG - sendstr(lwip_strerr(err), com->conn); -#else - sendstr("(debugging must be turned on for error message to appear)", com->conn); -#endif /* LWIP_DEBUG */ - sendstr(NEWLINE, com->conn); - return ESUCCESS; - } - - sendstr("Data enqueued for sending."NEWLINE, com->conn); - return ESUCCESS; -} -/*-----------------------------------------------------------------------------------*/ -static s8_t -com_recv(struct command *com) -{ - int i; - err_t err; - struct netbuf *buf; - u16_t len; - - i = strtol(com->args[0], NULL, 10); - - if (i > NCONNS) { - sendstr("Connection identifier too high."NEWLINE, com->conn); - return ESUCCESS; - } - - if (conns[i] == NULL) { - sendstr("Connection identifier not in use."NEWLINE, com->conn); - return ESUCCESS; - } - - err = netconn_recv(conns[i], &buf); - if (err == ERR_OK) { - - netbuf_copy(buf, buffer, BUFSIZE); - len = netbuf_len(buf); - sendstr("Reading from connection:"NEWLINE, com->conn); - netconn_write(com->conn, buffer, len, NETCONN_COPY); - netbuf_delete(buf); - } else { - sendstr("EOF."NEWLINE, com->conn); - } - err = netconn_err(conns[i]); - if (err != ERR_OK) { - sendstr("Could not receive data: ", com->conn); -#ifdef LWIP_DEBUG - sendstr(lwip_strerr(err), com->conn); -#else - sendstr("(debugging must be turned on for error message to appear)", com->conn); -#endif /* LWIP_DEBUG */ - sendstr(NEWLINE, com->conn); - return ESUCCESS; - } - return ESUCCESS; -} -/*-----------------------------------------------------------------------------------*/ -static s8_t -com_udpc(struct command *com) -{ - ip_addr_t ipaddr; - u16_t lport, rport; - int i; - err_t err; - long tmp; - - tmp = strtol(com->args[0], NULL, 10); - if((tmp < 0) || (tmp > 0xffff)) { - sendstr("Invalid port number."NEWLINE, com->conn); - return ESUCCESS; - } - lport = (u16_t)tmp; - if (ipaddr_aton(com->args[1], &ipaddr) == -1) { - sendstr(strerror(errno), com->conn); - return ESYNTAX; - } - tmp = strtol(com->args[2], NULL, 10); - if((tmp < 0) || (tmp > 0xffff)) { - sendstr("Invalid port number."NEWLINE, com->conn); - return ESUCCESS; - } - rport = (u16_t)tmp; - - /* Find the first unused connection in conns. */ - for(i = 0; i < NCONNS && conns[i] != NULL; i++); - - if (i == NCONNS) { - sendstr("No more connections available, sorry."NEWLINE, com->conn); - return ESUCCESS; - } - - sendstr("Setting up UDP connection from port ", com->conn); - netconn_write(com->conn, com->args[0], strlen(com->args[0]), NETCONN_COPY); - sendstr(" to ", com->conn); - netconn_write(com->conn, com->args[1], strlen(com->args[1]), NETCONN_COPY); - sendstr(":", com->conn); - netconn_write(com->conn, com->args[2], strlen(com->args[2]), NETCONN_COPY); - sendstr(NEWLINE, com->conn); - - conns[i] = netconn_new(NETCONN_UDP); - if (conns[i] == NULL) { - sendstr("Could not create connection identifier (out of memory)."NEWLINE, com->conn); - return ESUCCESS; - } - - err = netconn_connect(conns[i], &ipaddr, rport); - if (err != ERR_OK) { - netconn_delete(conns[i]); - conns[i] = NULL; - sendstr("Could not connect to remote host: ", com->conn); -#ifdef LWIP_DEBUG - sendstr(lwip_strerr(err), com->conn); -#else - sendstr("(debugging must be turned on for error message to appear)", com->conn); -#endif /* LWIP_DEBUG */ - sendstr(NEWLINE, com->conn); - return ESUCCESS; - } - - err = netconn_bind(conns[i], IP_ADDR_ANY, lport); - if (err != ERR_OK) { - netconn_delete(conns[i]); - conns[i] = NULL; - sendstr("Could not bind: ", com->conn); -#ifdef LWIP_DEBUG - sendstr(lwip_strerr(err), com->conn); -#else - sendstr("(debugging must be turned on for error message to appear)", com->conn); -#endif /* LWIP_DEBUG */ - sendstr(NEWLINE, com->conn); - return ESUCCESS; - } - - sendstr("Connection set up, connection identifier is ", com->conn); - snprintf((char *)buffer, sizeof(buffer), "%d"NEWLINE, i); - netconn_write(com->conn, buffer, strlen((const char *)buffer), NETCONN_COPY); - - return ESUCCESS; -} -/*-----------------------------------------------------------------------------------*/ -static s8_t -com_udpl(struct command *com) -{ - ip_addr_t ipaddr; - u16_t lport, rport; - int i; - err_t err; - long tmp; - - tmp = strtol(com->args[0], NULL, 10); - if((tmp < 0) || (tmp > 0xffff)) { - sendstr("Invalid port number."NEWLINE, com->conn); - return ESUCCESS; - } - lport = (u16_t)tmp; - if (ipaddr_aton(com->args[1], &ipaddr) == -1) { - sendstr(strerror(errno), com->conn); - return ESYNTAX; - } - tmp = strtol(com->args[2], NULL, 10); - if((tmp < 0) || (tmp > 0xffff)) { - sendstr("Invalid port number."NEWLINE, com->conn); - return ESUCCESS; - } - rport = (u16_t)tmp; - - /* Find the first unused connection in conns. */ - for(i = 0; i < NCONNS && conns[i] != NULL; i++); - - if (i == NCONNS) { - sendstr("No more connections available, sorry."NEWLINE, com->conn); - return ESUCCESS; - } - - sendstr("Setting up UDP-Lite connection from port ", com->conn); - netconn_write(com->conn, com->args[0], strlen(com->args[0]), NETCONN_COPY); - sendstr(" to ", com->conn); - netconn_write(com->conn, com->args[1], strlen(com->args[1]), NETCONN_COPY); - sendstr(":", com->conn); - netconn_write(com->conn, com->args[2], strlen(com->args[2]), NETCONN_COPY); - sendstr(NEWLINE, com->conn); - - conns[i] = netconn_new(NETCONN_UDPLITE); - if (conns[i] == NULL) { - sendstr("Could not create connection identifier (out of memory)."NEWLINE, com->conn); - return ESUCCESS; - } - - err = netconn_connect(conns[i], &ipaddr, rport); - if (err != ERR_OK) { - netconn_delete(conns[i]); - conns[i] = NULL; - sendstr("Could not connect to remote host: ", com->conn); -#ifdef LWIP_DEBUG - sendstr(lwip_strerr(err), com->conn); -#else - sendstr("(debugging must be turned on for error message to appear)", com->conn); -#endif /* LWIP_DEBUG */ - sendstr(NEWLINE, com->conn); - return ESUCCESS; - } - - err = netconn_bind(conns[i], IP_ADDR_ANY, lport); - if (err != ERR_OK) { - netconn_delete(conns[i]); - conns[i] = NULL; - sendstr("Could not bind: ", com->conn); -#ifdef LWIP_DEBUG - sendstr(lwip_strerr(err), com->conn); -#else - sendstr("(debugging must be turned on for error message to appear)", com->conn); -#endif /* LWIP_DEBUG */ - sendstr(NEWLINE, com->conn); - return ESUCCESS; - } - - sendstr("Connection set up, connection identifier is ", com->conn); - snprintf((char *)buffer, sizeof(buffer), "%d"NEWLINE, i); - netconn_write(com->conn, buffer, strlen((const char *)buffer), NETCONN_COPY); - - return ESUCCESS; -} -/*-----------------------------------------------------------------------------------*/ -static s8_t -com_udpn(struct command *com) -{ - ip_addr_t ipaddr; - u16_t lport, rport; - int i; - err_t err; - long tmp; - - tmp = strtol(com->args[0], NULL, 10); - if((tmp < 0) || (tmp > 0xffff)) { - sendstr("Invalid port number."NEWLINE, com->conn); - return ESUCCESS; - } - lport = (u16_t)tmp; - if (ipaddr_aton(com->args[1], &ipaddr) == -1) { - sendstr(strerror(errno), com->conn); - return ESYNTAX; - } - tmp = strtol(com->args[2], NULL, 10); - if((tmp < 0) || (tmp > 0xffff)) { - sendstr("Invalid port number."NEWLINE, com->conn); - return ESUCCESS; - } - rport = (u16_t)tmp; - - /* Find the first unused connection in conns. */ - for(i = 0; i < NCONNS && conns[i] != NULL; i++); - - if (i == NCONNS) { - sendstr("No more connections available, sorry."NEWLINE, com->conn); - return ESUCCESS; - } - - sendstr("Setting up UDP connection without checksums from port ", com->conn); - netconn_write(com->conn, com->args[0], strlen(com->args[0]), NETCONN_COPY); - sendstr(" to ", com->conn); - netconn_write(com->conn, com->args[1], strlen(com->args[1]), NETCONN_COPY); - sendstr(":", com->conn); - netconn_write(com->conn, com->args[2], strlen(com->args[2]), NETCONN_COPY); - sendstr(NEWLINE, com->conn); - - conns[i] = netconn_new(NETCONN_UDPNOCHKSUM); - if (conns[i] == NULL) { - sendstr("Could not create connection identifier (out of memory)."NEWLINE, com->conn); - return ESUCCESS; - } - - err = netconn_connect(conns[i], &ipaddr, rport); - if (err != ERR_OK) { - netconn_delete(conns[i]); - conns[i] = NULL; - sendstr("Could not connect to remote host: ", com->conn); -#ifdef LWIP_DEBUG - sendstr(lwip_strerr(err), com->conn); -#else - sendstr("(debugging must be turned on for error message to appear)", com->conn); -#endif /* LWIP_DEBUG */ - sendstr(NEWLINE, com->conn); - return ESUCCESS; - } - - err = netconn_bind(conns[i], IP_ADDR_ANY, lport); - if (err != ERR_OK) { - netconn_delete(conns[i]); - conns[i] = NULL; - sendstr("Could not bind: ", com->conn); -#ifdef LWIP_DEBUG - sendstr(lwip_strerr(err), com->conn); -#else - sendstr("(debugging must be turned on for error message to appear)", com->conn); -#endif /* LWIP_DEBUG */ - sendstr(NEWLINE, com->conn); - return ESUCCESS; - } - - sendstr("Connection set up, connection identifier is ", com->conn); - snprintf((char *)buffer, sizeof(buffer), "%d"NEWLINE, i); - netconn_write(com->conn, buffer, strlen((const char *)buffer), NETCONN_COPY); - - return ESUCCESS; -} -/*-----------------------------------------------------------------------------------*/ -static s8_t -com_udpb(struct command *com) -{ - ip_addr_t ipaddr; - u16_t lport, rport; - int i; - err_t err; - ip_addr_t bcaddr; - long tmp; - - tmp = strtol(com->args[0], NULL, 10); - if((tmp < 0) || (tmp > 0xffff)) { - sendstr("Invalid port number."NEWLINE, com->conn); - return ESUCCESS; - } - lport = (u16_t)tmp; - if (ipaddr_aton(com->args[1], &ipaddr) == -1) { - sendstr(strerror(errno), com->conn); - return ESYNTAX; - } - tmp = strtol(com->args[2], NULL, 10); - if((tmp < 0) || (tmp > 0xffff)) { - sendstr("Invalid port number."NEWLINE, com->conn); - return ESUCCESS; - } - rport = (u16_t)tmp; - - /* Find the first unused connection in conns. */ - for(i = 0; i < NCONNS && conns[i] != NULL; i++); - - if (i == NCONNS) { - sendstr("No more connections available, sorry."NEWLINE, com->conn); - return ESUCCESS; - } - - sendstr("Setting up UDP broadcast connection from port ", com->conn); - netconn_write(com->conn, com->args[0], strlen(com->args[0]), NETCONN_COPY); - sendstr(" to ", com->conn); - netconn_write(com->conn, com->args[1], strlen(com->args[1]), NETCONN_COPY); - sendstr(NEWLINE, com->conn); - - conns[i] = netconn_new(NETCONN_UDP); - if (conns[i] == NULL) { - sendstr("Could not create connection identifier (out of memory)."NEWLINE, com->conn); - return ESUCCESS; - } - - err = netconn_connect(conns[i], &ipaddr, rport); - if (err != ERR_OK) { - netconn_delete(conns[i]); - conns[i] = NULL; - sendstr("Could not connect to remote host: ", com->conn); -#ifdef LWIP_DEBUG - sendstr(lwip_strerr(err), com->conn); -#else - sendstr("(debugging must be turned on for error message to appear)", com->conn); -#endif /* LWIP_DEBUG */ - sendstr(NEWLINE, com->conn); - return ESUCCESS; - } - - IP4_ADDR(&bcaddr, 255,255,255,255); - err = netconn_bind(conns[i], &bcaddr, lport); - if (err != ERR_OK) { - netconn_delete(conns[i]); - conns[i] = NULL; - sendstr("Could not bind: ", com->conn); -#ifdef LWIP_DEBUG - sendstr(lwip_strerr(err), com->conn); -#else - sendstr("(debugging must be turned on for error message to appear)", com->conn); -#endif /* LWIP_DEBUG */ - sendstr(NEWLINE, com->conn); - return ESUCCESS; - } - - sendstr("Connection set up, connection identifier is ", com->conn); - snprintf((char *)buffer, sizeof(buffer), "%d"NEWLINE, i); - netconn_write(com->conn, buffer, strlen((const char *)buffer), NETCONN_COPY); - - return ESUCCESS; -} -/*-----------------------------------------------------------------------------------*/ -static s8_t -com_usnd(struct command *com) -{ - long i; - err_t err; - struct netbuf *buf; - char *mem; - u16_t len; - size_t tmp; - - i = strtol(com->args[0], NULL, 10); - - if (i > NCONNS) { - sendstr("Connection identifier too high."NEWLINE, com->conn); - return ESUCCESS; - } - - if (conns[i] == NULL) { - sendstr("Connection identifier not in use."NEWLINE, com->conn); - return ESUCCESS; - } - tmp = strlen(com->args[1]) + 1; - if (tmp > 0xffff) { - sendstr("Invalid length."NEWLINE, com->conn); - return ESUCCESS; - } - len = (u16_t)tmp; - - buf = netbuf_new(); - mem = (char *)netbuf_alloc(buf, len); - if (mem == NULL) { - sendstr("Could not allocate memory for sending."NEWLINE, com->conn); - return ESUCCESS; - } - strncpy(mem, com->args[1], len); - err = netconn_send(conns[i], buf); - netbuf_delete(buf); - if (err != ERR_OK) { - sendstr("Could not send data: ", com->conn); -#ifdef LWIP_DEBUG - sendstr(lwip_strerr(err), com->conn); -#else - sendstr("(debugging must be turned on for error message to appear)", com->conn); -#endif /* LWIP_DEBUG */ - sendstr(NEWLINE, com->conn); - return ESUCCESS; - } - - sendstr("Data sent."NEWLINE, com->conn); - return ESUCCESS; -} -/*-----------------------------------------------------------------------------------*/ -static s8_t -com_help(struct command *com) -{ - sendstr(help_msg1, com->conn); - sendstr(help_msg2, com->conn); - return ESUCCESS; -} -/*-----------------------------------------------------------------------------------*/ -static s8_t -parse_command(struct command *com, u32_t len) -{ - u16_t i; - u16_t bufp; - - if (strncmp((const char *)buffer, "open", 4) == 0) { - com->exec = com_open; - com->nargs = 2; - } else if (strncmp((const char *)buffer, "lstn", 4) == 0) { - com->exec = com_lstn; - com->nargs = 1; - } else if (strncmp((const char *)buffer, "acpt", 4) == 0) { - com->exec = com_acpt; - com->nargs = 1; - } else if (strncmp((const char *)buffer, "clos", 4) == 0) { - com->exec = com_clos; - com->nargs = 1; -#if LWIP_STATS - } else if (strncmp((const char *)buffer, "stat", 4) == 0) { - com->exec = com_stat; - com->nargs = 0; -#endif - } else if (strncmp((const char *)buffer, "send", 4) == 0) { - com->exec = com_send; - com->nargs = 2; - } else if (strncmp((const char *)buffer, "recv", 4) == 0) { - com->exec = com_recv; - com->nargs = 1; - } else if (strncmp((const char *)buffer, "udpc", 4) == 0) { - com->exec = com_udpc; - com->nargs = 3; - } else if (strncmp((const char *)buffer, "udpb", 4) == 0) { - com->exec = com_udpb; - com->nargs = 2; - } else if (strncmp((const char *)buffer, "udpl", 4) == 0) { - com->exec = com_udpl; - com->nargs = 3; - } else if (strncmp((const char *)buffer, "udpn", 4) == 0) { - com->exec = com_udpn; - com->nargs = 3; - } else if (strncmp((const char *)buffer, "usnd", 4) == 0) { - com->exec = com_usnd; - com->nargs = 2; - } else if (strncmp((const char *)buffer, "help", 4) == 0) { - com->exec = com_help; - com->nargs = 0; - } else if (strncmp((const char *)buffer, "quit", 4) == 0) { - printf("quit"NEWLINE); - return ECLOSED; - } else { - return ESYNTAX; - } - - if (com->nargs == 0) { - return ESUCCESS; - } - bufp = 0; - for(; bufp < len && buffer[bufp] != ' '; bufp++); - for(i = 0; i < 10; i++) { - for(; bufp < len && buffer[bufp] == ' '; bufp++); - if (buffer[bufp] == '\r' || - buffer[bufp] == '\n') { - buffer[bufp] = 0; - if (i < com->nargs - 1) { - return ETOOFEW; - } - if (i > com->nargs - 1) { - return ETOOMANY; - } - break; - } - if (bufp > len) { - return ETOOFEW; - } - com->args[i] = (char *)&buffer[bufp]; - for(; bufp < len && buffer[bufp] != ' ' && buffer[bufp] != '\r' && - buffer[bufp] != '\n'; bufp++) { - if (buffer[bufp] == '\\') { - buffer[bufp] = ' '; - } - } - if (bufp > len) { - return ESYNTAX; - } - buffer[bufp] = 0; - bufp++; - if (i == com->nargs - 1) { - break; - } - - } - - return ESUCCESS; -} -/*-----------------------------------------------------------------------------------*/ -static void -shell_error(s8_t err, struct netconn *conn) -{ - switch (err) { - case ESYNTAX: - sendstr("## Syntax error"NEWLINE, conn); - break; - case ETOOFEW: - sendstr("## Too few arguments to command given"NEWLINE, conn); - break; - case ETOOMANY: - sendstr("## Too many arguments to command given"NEWLINE, conn); - break; - case ECLOSED: - sendstr("## Connection closed"NEWLINE, conn); - break; - default: - /* unknown error, don't assert here */ - break; - } -} -/*-----------------------------------------------------------------------------------*/ -static void -prompt(struct netconn *conn) -{ - sendstr("> ", conn); -} -/*-----------------------------------------------------------------------------------*/ -static void -shell_main(struct netconn *conn) -{ - struct pbuf *p; - u16_t len = 0, cur_len; - struct command com; - s8_t err; - int i; - err_t ret; -#if SHELL_ECHO - void *echomem; -#endif /* SHELL_ECHO */ - - do { - ret = netconn_recv_tcp_pbuf(conn, &p); - if (ret == ERR_OK) { - pbuf_copy_partial(p, &buffer[len], BUFSIZE - len, 0); - cur_len = p->tot_len; - len += cur_len; -#if SHELL_ECHO - echomem = mem_malloc(cur_len); - if (echomem != NULL) { - pbuf_copy_partial(p, echomem, cur_len, 0); - netconn_write(conn, echomem, cur_len, NETCONN_COPY); - mem_free(echomem); - } -#endif /* SHELL_ECHO */ - pbuf_free(p); - if (((len > 0) && ((buffer[len-1] == '\r') || (buffer[len-1] == '\n'))) || - (len >= BUFSIZE)) { - if (buffer[0] != 0xff && - buffer[1] != 0xfe) { - err = parse_command(&com, len); - if (err == ESUCCESS) { - com.conn = conn; - err = com.exec(&com); - } - if (err == ECLOSED) { - printf("Closed"NEWLINE); - shell_error(err, conn); - goto close; - } - if (err != ESUCCESS) { - shell_error(err, conn); - } - } else { - sendstr(NEWLINE NEWLINE - "lwIP simple interactive shell."NEWLINE - "(c) Copyright 2001, Swedish Institute of Computer Science."NEWLINE - "Written by Adam Dunkels."NEWLINE - "For help, try the \"help\" command."NEWLINE, conn); - } - if (ret == ERR_OK) { - prompt(conn); - } - len = 0; - } - } - } while (ret == ERR_OK); - printf("err %s"NEWLINE, lwip_strerr(ret)); - -close: - netconn_close(conn); - - for(i = 0; i < NCONNS; i++) { - if (conns[i] != NULL) { - netconn_delete(conns[i]); - } - conns[i] = NULL; - } -} -/*-----------------------------------------------------------------------------------*/ -static void -shell_thread(void *arg) -{ - struct netconn *conn, *newconn; - err_t err; - LWIP_UNUSED_ARG(arg); - - conn = netconn_new(NETCONN_TCP); - netconn_bind(conn, NULL, 23); - netconn_listen(conn); - - while (1) { - err = netconn_accept(conn, &newconn); - if (err == ERR_OK) { - shell_main(newconn); - netconn_delete(newconn); - } - } -} -/*-----------------------------------------------------------------------------------*/ -void -shell_init(void) -{ - sys_thread_new("shell_thread", shell_thread, NULL, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO); -} - -#endif /* LWIP_NETCONN */ diff --git a/contrib/apps/shell/shell.h b/contrib/apps/shell/shell.h deleted file mode 100644 index 118cd2c..0000000 --- a/contrib/apps/shell/shell.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 - * - */ -#ifndef LWIP_SHELL_H -#define LWIP_SHELL_H - -void shell_init(void); - -#endif /* LWIP_SHELL_H */ diff --git a/contrib/apps/snmp_private_mib/lwip_prvmib.c b/contrib/apps/snmp_private_mib/lwip_prvmib.c deleted file mode 100644 index 9318402..0000000 --- a/contrib/apps/snmp_private_mib/lwip_prvmib.c +++ /dev/null @@ -1,604 +0,0 @@ -/** - * @file - * lwip Private MIB - * - * @todo create MIB file for this example - * @note the lwip enterprise tree root (26381) is owned by the lwIP project. - * It is NOT allowed to allocate new objects under this ID (26381) without our, - * the lwip developers, permission! - * - * Please apply for your own ID with IANA: http://www.iana.org/numbers.html - * - * lwip OBJECT IDENTIFIER ::= { enterprises 26381 } - * example OBJECT IDENTIFIER ::= { lwip 1 } - */ - -/* - * Copyright (c) 2006 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. - * - * Author: Christiaan Simons - */ - -#include "private_mib.h" - -#if LWIP_SNMP - -/** Directory where the sensor files are */ -#define SENSORS_DIR "w:\\sensors" -/** Set to 1 to read sensor values from files (in directory defined by SENSORS_DIR) */ -#define SENSORS_USE_FILES 0 -/** Set to 1 to search sensor files at startup (in directory defined by SENSORS_DIR) */ -#define SENSORS_SEARCH_FILES 0 - -#if SENSORS_SEARCH_FILES -#include -#include -#include -#include -#include -#include -#endif /* SENSORS_SEARCH_FILES */ - -#include -#include - -#include "lwip/snmp_msg.h" -#include "lwip/snmp_asn1.h" - -#if !SENSORS_USE_FILES || !SENSORS_SEARCH_FILES -/** When not using & searching files, defines the number of sensors */ -#define SENSOR_COUNT 2 -#endif /* !SENSORS_USE_FILES || !SENSORS_SEARCH_FILES */ -#if !SENSORS_USE_FILES -/** When not using files, contains the values of the sensors */ -s32_t sensor_values[SENSOR_COUNT]; -#endif /* !SENSORS_USE_FILES */ - -/* - This example presents a table for a few (at most 10) sensors. - Sensor detection takes place at initialization (once only). - Sensors may and can not be added or removed after agent - has started. Note this is only a limitation of this crude example, - the agent does support dynamic object insertions and removals. - - You'll need to manually create a directory called "sensors" and - a few single line text files with an integer temperature value. - The files must be called [0..9].txt. - - ./sensors/0.txt [content: 20] - ./sensors/3.txt [content: 75] - - The sensor values may be changed in runtime by editing the - text files in the "sensors" directory. -*/ - - -#define SENSOR_MAX 10 -#define SENSOR_NAME_LEN 20 - -struct sensor_inf -{ - char sensor_files[SENSOR_MAX][SENSOR_NAME_LEN + 1]; - /* (Sparse) list of sensors (table index), - the actual "hot insertion" is done in lwip_privmib_init() */ - struct mib_list_rootnode sensor_list_rn; -}; - -struct sensor_inf sensor_addr_inf = -{ - {{0}}, - { - NULL, - NULL, - NULL, - NULL, - MIB_NODE_LR, - 0, - NULL, - NULL, - 0 - } -}; - - -static u16_t sensorentry_length(void* addr_inf, u8_t level); -static s32_t sensorentry_idcmp(void* addr_inf, u8_t level, u16_t idx, s32_t sub_id); -static void sensorentry_get_subid(void* addr_inf, u8_t level, u16_t idx, s32_t *sub_id); - -static void sensorentry_get_object_def_q(void* addr_inf, u8_t rid, u8_t ident_len, s32_t *ident); -static void sensorentry_get_object_def_a(u8_t rid, u8_t ident_len, s32_t *ident, struct obj_def *od); -static void sensorentry_get_object_def_pc(u8_t rid, u8_t ident_len, s32_t *ident); -static void sensorentry_get_value_q(u8_t rid, struct obj_def *od); -static void sensorentry_get_value_a(u8_t rid, struct obj_def *od, u16_t len, void *value); -static void sensorentry_get_value_pc(u8_t rid, struct obj_def *od); -static void sensorentry_set_test_q(u8_t rid, struct obj_def *od); -static u8_t sensorentry_set_test_a(u8_t rid, struct obj_def *od, u16_t len, void *value); -static void sensorentry_set_test_pc(u8_t rid, struct obj_def *od); -static void sensorentry_set_value_q(u8_t rid, struct obj_def *od, u16_t len, void *value); -static void sensorentry_set_value_a(u8_t rid, struct obj_def *od, u16_t len, void *value); -static void sensorentry_set_value_pc(u8_t rid, struct obj_def *od); - -/* sensorentry .1.3.6.1.4.1.26381.1.1.1 (.level0.level1) - where level 0 is the object identifier (temperature) and level 1 the index */ -static struct mib_external_node sensorentry = { - &noleafs_get_object_def, - &noleafs_get_value, - &noleafs_set_test, - &noleafs_set_value, - MIB_NODE_EX, - 0, - &sensor_addr_inf, - /* 0 tree_levels (empty table) at power-up, - 2 when one or more sensors are detected */ - 0, - &sensorentry_length, - &sensorentry_idcmp, - &sensorentry_get_subid, - - &sensorentry_get_object_def_q, - &sensorentry_get_value_q, - &sensorentry_set_test_q, - &sensorentry_set_value_q, - - &sensorentry_get_object_def_a, - &sensorentry_get_value_a, - &sensorentry_set_test_a, - &sensorentry_set_value_a, - - &sensorentry_get_object_def_pc, - &sensorentry_get_value_pc, - &sensorentry_set_test_pc, - &sensorentry_set_value_pc -}; - -/* sensortable .1.3.6.1.4.1.26381.1.1 */ -static const s32_t sensortable_ids[1] = { 1 }; -static struct mib_node* const sensortable_nodes[1] = { - (struct mib_node* const)&sensorentry -}; -static const struct mib_array_node sensortable = { - &noleafs_get_object_def, - &noleafs_get_value, - &noleafs_set_test, - &noleafs_set_value, - MIB_NODE_AR, - 1, - sensortable_ids, - sensortable_nodes -}; - -/* example .1.3.6.1.4.1.26381.1 */ -static const s32_t example_ids[1] = { 1 }; -static struct mib_node* const example_nodes[1] = { - (struct mib_node* const)&sensortable -}; -static const struct mib_array_node example = { - &noleafs_get_object_def, - &noleafs_get_value, - &noleafs_set_test, - &noleafs_set_value, - MIB_NODE_AR, - 1, - example_ids, - example_nodes -}; - -/* lwip .1.3.6.1.4.1.26381 */ -static const s32_t lwip_ids[1] = { 1 }; -static struct mib_node* const lwip_nodes[1] = { (struct mib_node* const)&example }; -static const struct mib_array_node lwip = { - &noleafs_get_object_def, - &noleafs_get_value, - &noleafs_set_test, - &noleafs_set_value, - MIB_NODE_AR, - 1, - lwip_ids, - lwip_nodes -}; - -/* enterprises .1.3.6.1.4.1 */ -static const s32_t enterprises_ids[1] = { 26381 }; -static struct mib_node* const enterprises_nodes[1] = { (struct mib_node* const)&lwip }; -static const struct mib_array_node enterprises = { - &noleafs_get_object_def, - &noleafs_get_value, - &noleafs_set_test, - &noleafs_set_value, - MIB_NODE_AR, - 1, - enterprises_ids, - enterprises_nodes -}; - -/* private .1.3.6.1.4 */ -static const s32_t private_ids[1] = { 1 }; -static struct mib_node* const private_nodes[1] = { (struct mib_node* const)&enterprises }; -const struct mib_array_node mib_private = { - &noleafs_get_object_def, - &noleafs_get_value, - &noleafs_set_test, - &noleafs_set_value, - MIB_NODE_AR, - 1, - private_ids, - private_nodes -}; - - -/** - * Initialises this private MIB before use. - * @see main.c - */ -void -lwip_privmib_init(void) -{ -#if SENSORS_USE_FILES && SENSORS_SEARCH_FILES - char *buf, *ebuf, *cp; - size_t bufsize; - int nbytes; - struct stat sb; - struct dirent *dp; - int fd; -#else /* SENSORS_USE_FILES && SENSORS_SEARCH_FILES */ - int i; -#endif /* SENSORS_USE_FILES && SENSORS_SEARCH_FILES */ - - printf("SNMP private MIB start, detecting sensors.\n"); - -#if SENSORS_USE_FILES && SENSORS_SEARCH_FILES - /* look for sensors in sensors directory */ - fd = open(SENSORS_DIR, O_RDONLY); - if (fd > -1) - { - fstat(fd, &sb); - bufsize = sb.st_size; - if (bufsize < sb.st_blksize) - { - bufsize = sb.st_blksize; - } - buf = malloc(bufsize); - if (buf != NULL) - { - do - { - long base; - - nbytes = getdirentries(fd, buf, bufsize, &base); - if (nbytes > 0) - { - ebuf = buf + nbytes; - cp = buf; - while (cp < ebuf) - { - dp = (struct dirent *)cp; - if (isdigit(dp->d_name[0])) - { - struct mib_list_node *dummy; - unsigned char idx; - - idx = dp->d_name[0] - '0'; - snmp_mib_node_insert(&sensor_addr_inf.sensor_list_rn,idx,&dummy); - - strncpy(&sensor_addr_inf.sensor_files[idx][0],dp->d_name,SENSOR_NAME_LEN); - printf("%s\n", sensor_addr_inf.sensor_files[idx]); - } - cp += dp->d_reclen; - } - } - } - while (nbytes > 0); - - free(buf); - } - close(fd); - } -#else /* SENSORS_USE_FILES && SENSORS_SEARCH_FILES */ - for (i = 0; i < SENSOR_COUNT; i++) { - struct mib_list_node *dummy; - s32_t idx = i; - char name[256]; - sprintf(name, "%d.txt", i); - - snmp_mib_node_insert(&sensor_addr_inf.sensor_list_rn, idx, &dummy); - - strncpy(&sensor_addr_inf.sensor_files[idx][0], name, SENSOR_NAME_LEN); - printf("%s\n", sensor_addr_inf.sensor_files[idx]); -#if !SENSORS_USE_FILES - /* initialize sensor value to != zero */ - sensor_values[i] = 11 * (i+1); -#endif /* !SENSORS_USE_FILES */ - } -#endif /* SENSORS_USE_FILE && SENSORS_SEARCH_FILES */ - if (sensor_addr_inf.sensor_list_rn.count != 0) - { - /* enable sensor table, 2 tree_levels under this node - one for the registers and one for the index */ - sensorentry.tree_levels = 2; - } -} - - -static u16_t -sensorentry_length(void* addr_inf, u8_t level) -{ - struct sensor_inf *sensors = (struct sensor_inf *)addr_inf; - - if (level == 0) - { - /* one object (temperature) */ - return 1; - } - else if (level == 1) - { - /* number of sensor indexes */ - return sensors->sensor_list_rn.count; - } - else - { - return 0; - } -} - -static s32_t -sensorentry_idcmp(void* addr_inf, u8_t level, u16_t idx, s32_t sub_id) -{ - struct sensor_inf *sensors = (struct sensor_inf *)addr_inf; - - if (level == 0) - { - return ((s32_t)(idx + 1) - sub_id); - } - else if (level == 1) - { - struct mib_list_node *ln; - u16_t i; - - i = 0; - ln = sensors->sensor_list_rn.head; - while (i < idx) - { - i++; - ln = ln->next; - } - LWIP_ASSERT("ln != NULL", ln != NULL); - return (ln->objid - sub_id); - } - else - { - return -1; - } -} - -static void -sensorentry_get_subid(void* addr_inf, u8_t level, u16_t idx, s32_t *sub_id) -{ - struct sensor_inf *sensors = (struct sensor_inf *)addr_inf; - - if (level == 0) - { - *sub_id = idx + 1; - } - else if (level == 1) - { - struct mib_list_node *ln; - u16_t i; - - i = 0; - ln = sensors->sensor_list_rn.head; - while (i < idx) - { - i++; - ln = ln->next; - } - LWIP_ASSERT("ln != NULL", ln != NULL); - *sub_id = ln->objid; - } -} - -/** - * Async question for object definition - */ -static void -sensorentry_get_object_def_q(void* addr_inf, u8_t rid, u8_t ident_len, s32_t *ident) -{ - s32_t sensor_register, sensor_address; - - LWIP_UNUSED_ARG(addr_inf); - LWIP_UNUSED_ARG(rid); - - ident_len += 1; - ident -= 1; - - /* send request */ - sensor_register = ident[0]; - sensor_address = ident[1]; - LWIP_DEBUGF(SNMP_MIB_DEBUG,("sensor_request reg=%"S32_F" addr=%"S32_F"\n", - sensor_register, sensor_address)); - /* fake async quesion/answer */ - snmp_msg_event(rid); -} - -static void -sensorentry_get_object_def_a(u8_t rid, u8_t ident_len, s32_t *ident, struct obj_def *od) -{ - LWIP_UNUSED_ARG(rid); - - /* return to object name, adding index depth (1) */ - ident_len += 1; - ident -= 1; - if (ident_len == 2) - { - od->id_inst_len = ident_len; - od->id_inst_ptr = ident; - - od->instance = MIB_OBJECT_TAB; - od->access = MIB_OBJECT_READ_WRITE; - od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG); - od->v_len = sizeof(s32_t); - } - else - { - LWIP_DEBUGF(SNMP_MIB_DEBUG,("sensorentry_get_object_def_a: no scalar\n")); - od->instance = MIB_OBJECT_NONE; - } -} - -static void -sensorentry_get_object_def_pc(u8_t rid, u8_t ident_len, s32_t *ident) -{ - LWIP_UNUSED_ARG(rid); - LWIP_UNUSED_ARG(ident_len); - LWIP_UNUSED_ARG(ident); - /* nop */ -} - -static void -sensorentry_get_value_q(u8_t rid, struct obj_def *od) -{ - LWIP_UNUSED_ARG(od); - - /* fake async quesion/answer */ - snmp_msg_event(rid); -} - -static void -sensorentry_get_value_a(u8_t rid, struct obj_def *od, u16_t len, void *value) -{ - s32_t i; - s32_t *temperature = (s32_t *)value; -#if SENSORS_USE_FILES - FILE* sensf; - char senspath[sizeof(SENSORS_DIR)+1+SENSOR_NAME_LEN+1] = SENSORS_DIR"/"; -#endif /* SENSORS_USE_FILES */ - - LWIP_UNUSED_ARG(rid); - LWIP_UNUSED_ARG(len); - - i = od->id_inst_ptr[1]; -#if SENSORS_USE_FILES - strncpy(&senspath[sizeof(SENSORS_DIR)], - sensor_addr_inf.sensor_files[i], - SENSOR_NAME_LEN); - sensf = fopen(senspath,"r"); - if (sensf != NULL) - { - fscanf(sensf,"%"S32_F,temperature); - fclose(sensf); - } -#else /* SENSORS_USE_FILES */ - if (i < SENSOR_COUNT) { - *temperature = sensor_values[i]; - } -#endif /* SENSORS_USE_FILES */ -} - -static void -sensorentry_get_value_pc(u8_t rid, struct obj_def *od) -{ - LWIP_UNUSED_ARG(rid); - LWIP_UNUSED_ARG(od); - /* nop */ -} - -static void -sensorentry_set_test_q(u8_t rid, struct obj_def *od) -{ - LWIP_UNUSED_ARG(od); - /* fake async quesion/answer */ - snmp_msg_event(rid); -} - -static u8_t -sensorentry_set_test_a(u8_t rid, struct obj_def *od, u16_t len, void *value) -{ - LWIP_UNUSED_ARG(rid); - LWIP_UNUSED_ARG(od); - LWIP_UNUSED_ARG(len); - LWIP_UNUSED_ARG(value); - /* sensors are read-only */ - return 1; /* 0 -> read only, != 0 -> read/write */ -} - -static void -sensorentry_set_test_pc(u8_t rid, struct obj_def *od) -{ - LWIP_UNUSED_ARG(rid); - LWIP_UNUSED_ARG(od); - /* nop */ -} - -static void -sensorentry_set_value_q(u8_t rid, struct obj_def *od, u16_t len, void *value) -{ - LWIP_UNUSED_ARG(rid); - LWIP_UNUSED_ARG(od); - LWIP_UNUSED_ARG(len); - LWIP_UNUSED_ARG(value); - /* fake async quesion/answer */ - snmp_msg_event(rid); -} - -static void -sensorentry_set_value_a(u8_t rid, struct obj_def *od, u16_t len, void *value) -{ - s32_t i; - s32_t *temperature = (s32_t *)value; -#if SENSORS_USE_FILES - FILE* sensf; - char senspath[sizeof(SENSORS_DIR)+1+SENSOR_NAME_LEN+1] = SENSORS_DIR"/"; -#endif /* SENSORS_USE_FILES */ - - LWIP_UNUSED_ARG(rid); - LWIP_UNUSED_ARG(len); - - i = od->id_inst_ptr[1]; -#if SENSORS_USE_FILES - strncpy(&senspath[sizeof(SENSORS_DIR)], - sensor_addr_inf.sensor_files[i], - SENSOR_NAME_LEN); - sensf = fopen(senspath, "w"); - if (sensf != NULL) - { - fprintf(sensf, "%"S32_F, temperature); - fclose(sensf); - } -#else /* SENSORS_USE_FILES */ - if (i < SENSOR_COUNT) { - sensor_values[i] = *temperature; - } -#endif /* SENSORS_USE_FILES */ -} - -static void -sensorentry_set_value_pc(u8_t rid, struct obj_def *od) -{ - LWIP_UNUSED_ARG(rid); - LWIP_UNUSED_ARG(od); - /* nop */ -} - -#endif /* LWIP_SNMP */ diff --git a/contrib/apps/snmp_private_mib/private_mib.h b/contrib/apps/snmp_private_mib/private_mib.h deleted file mode 100644 index 6e0db9f..0000000 --- a/contrib/apps/snmp_private_mib/private_mib.h +++ /dev/null @@ -1,28 +0,0 @@ -/** - * @file - * Exports Private lwIP MIB - */ - -#ifndef LWIP_HDR_PRIVATE_MIB_H -#define LWIP_HDR_PRIVATE_MIB_H - -#include "arch/cc.h" -#include "lwip/opt.h" - -#if LWIP_SNMP -#include "lwip/snmp_structs.h" -extern const struct mib_array_node mib_private; - -/** @todo remove this?? */ -struct private_msg -{ - u8_t dummy; -}; - -void lwip_privmib_init(void); - -#define SNMP_PRIVATE_MIB_INIT() lwip_privmib_init() - -#endif - -#endif diff --git a/contrib/apps/sntp/sntp.c b/contrib/apps/sntp/sntp.c deleted file mode 100644 index 4769f38..0000000 --- a/contrib/apps/sntp/sntp.c +++ /dev/null @@ -1,613 +0,0 @@ -/** - * @file - * SNTP client module - * - * This is simple "SNTP" client for the lwIP raw API. - * It is a minimal implementation of SNTPv4 as specified in RFC 4330. - * - * For a list of some public NTP servers, see this link : - * http://support.ntp.org/bin/view/Servers/NTPPoolServers - * - * @todo: - * - set/change servers at runtime - * - complete SNTP_CHECK_RESPONSE checks 3 and 4 - * - support broadcast/multicast mode? - */ - -/* - * 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: Simon Goldschmidt (lwIP raw API part) - */ - -#include "lwip/opt.h" - -#include "sntp.h" - -#include "lwip/timers.h" -#include "lwip/udp.h" -#include "lwip/dns.h" -#include "lwip/ip_addr.h" -#include "lwip/pbuf.h" - -#include -#include - -#if LWIP_UDP - -/** - * SNTP_DEBUG: Enable debugging for SNTP. - */ -#ifndef SNTP_DEBUG -#define SNTP_DEBUG LWIP_DBG_OFF -#endif - -/** SNTP server port */ -#ifndef SNTP_PORT -#define SNTP_PORT 123 -#endif - -/** Set this to 1 to allow SNTP_SERVER_ADDRESS to be a DNS name */ -#ifndef SNTP_SERVER_DNS -#define SNTP_SERVER_DNS 0 -#endif - -/** Set this to 1 to support more than one server */ -#ifndef SNTP_SUPPORT_MULTIPLE_SERVERS -#define SNTP_SUPPORT_MULTIPLE_SERVERS 0 -#endif - -/** \def SNTP_SERVER_ADDRESS - * \brief SNTP server address: - * - as IPv4 address in "u32_t" format - * - as a DNS name if SNTP_SERVER_DNS is set to 1 - * May contain multiple server names (e.g. "pool.ntp.org","second.time.server") - */ -#ifndef SNTP_SERVER_ADDRESS -#if SNTP_SERVER_DNS -#define SNTP_SERVER_ADDRESS "pool.ntp.org" -#else -#define SNTP_SERVER_ADDRESS "213.161.194.93" /* pool.ntp.org */ -#endif -#endif - -/** Sanity check: - * Define this to - * - 0 to turn off sanity checks (default; smaller code) - * - >= 1 to check address and port of the response packet to ensure the - * response comes from the server we sent the request to. - * - >= 2 to check returned Originate Timestamp against Transmit Timestamp - * sent to the server (to ensure response to older request). - * - >= 3 @todo: discard reply if any of the LI, Stratum, or Transmit Timestamp - * fields is 0 or the Mode field is not 4 (unicast) or 5 (broadcast). - * - >= 4 @todo: to check that the Root Delay and Root Dispersion fields are each - * greater than or equal to 0 and less than infinity, where infinity is - * currently a cozy number like one second. This check avoids using a - * server whose synchronization source has expired for a very long time. - */ -#ifndef SNTP_CHECK_RESPONSE -#define SNTP_CHECK_RESPONSE 0 -#endif - -/** According to the RFC, this shall be a random delay - * between 1 and 5 minutes (in milliseconds) to prevent load peaks. - * This can be defined to a random generation function, - * which must return the delay in milliseconds as u32_t. - * Turned off by default. - */ -#ifndef SNTP_STARTUP_DELAY -#define SNTP_STARTUP_DELAY 0 -#endif - -/** If you want the startup delay to be a function, define this - * to a function (including the brackets) and define SNTP_STARTUP_DELAY to 1. - */ -#ifndef SNTP_STARTUP_DELAY_FUNC -#define SNTP_STARTUP_DELAY_FUNC SNTP_STARTUP_DELAY -#endif - -/** SNTP receive timeout - in milliseconds - * Also used as retry timeout - this shouldn't be too low. - * Default is 3 seconds. - */ -#ifndef SNTP_RECV_TIMEOUT -#define SNTP_RECV_TIMEOUT 3000 -#endif - -/** SNTP update delay - in milliseconds - * Default is 1 hour. - */ -#ifndef SNTP_UPDATE_DELAY -#define SNTP_UPDATE_DELAY 3600000 -#endif -#if (SNTP_UPDATE_DELAY < 15000) && !SNTP_SUPPRESS_DELAY_CHECK -#error "SNTPv4 RFC 4330 enforces a minimum update time of 15 seconds!" -#endif - -/** SNTP macro to change system time and/or the update the RTC clock */ -#ifndef SNTP_SET_SYSTEM_TIME -#define SNTP_SET_SYSTEM_TIME(sec) ((void)sec) -#endif - -/** SNTP macro to change system time including microseconds */ -#ifdef SNTP_SET_SYSTEM_TIME_US -#define SNTP_CALC_TIME_US 1 -#define SNTP_RECEIVE_TIME_SIZE 2 -#else -#define SNTP_SET_SYSTEM_TIME_US(sec, us) -#define SNTP_CALC_TIME_US 0 -#define SNTP_RECEIVE_TIME_SIZE 1 -#endif - -/** SNTP macro to get system time, used with SNTP_CHECK_RESPONSE >= 2 - * to send in request and compare in response. - */ -#ifndef SNTP_GET_SYSTEM_TIME -#define SNTP_GET_SYSTEM_TIME(sec, us) do { (sec) = 0; (us) = 0; } while(0) -#endif - -/** Default retry timeout (in milliseconds) if the response - * received is invalid. - * This is doubled with each retry until SNTP_RETRY_TIMEOUT_MAX is reached. - */ -#ifndef SNTP_RETRY_TIMEOUT -#define SNTP_RETRY_TIMEOUT SNTP_RECV_TIMEOUT -#endif - -/** Maximum retry timeout (in milliseconds). */ -#ifndef SNTP_RETRY_TIMEOUT_MAX -#define SNTP_RETRY_TIMEOUT_MAX (SNTP_RETRY_TIMEOUT * 10) -#endif - -/** Increase retry timeout with every retry sent - * Default is on to conform to RFC. - */ -#ifndef SNTP_RETRY_TIMEOUT_EXP -#define SNTP_RETRY_TIMEOUT_EXP 1 -#endif - -/* the various debug levels for this file */ -#define SNTP_DEBUG_TRACE (SNTP_DEBUG | LWIP_DBG_TRACE) -#define SNTP_DEBUG_STATE (SNTP_DEBUG | LWIP_DBG_STATE) -#define SNTP_DEBUG_WARN (SNTP_DEBUG | LWIP_DBG_LEVEL_WARNING) -#define SNTP_DEBUG_WARN_STATE (SNTP_DEBUG | LWIP_DBG_LEVEL_WARNING | LWIP_DBG_STATE) -#define SNTP_DEBUG_SERIOUS (SNTP_DEBUG | LWIP_DBG_LEVEL_SERIOUS) - -#define SNTP_ERR_KOD 1 - -/* SNTP protocol defines */ -#define SNTP_MSG_LEN 48 - -#define SNTP_OFFSET_LI_VN_MODE 0 -#define SNTP_LI_MASK 0xC0 -#define SNTP_LI_NO_WARNING 0x00 -#define SNTP_LI_LAST_MINUTE_61_SEC 0x01 -#define SNTP_LI_LAST_MINUTE_59_SEC 0x02 -#define SNTP_LI_ALARM_CONDITION 0x03 /* (clock not synchronized) */ - -#define SNTP_VERSION_MASK 0x38 -#define SNTP_VERSION (4/* NTP Version 4*/<<3) - -#define SNTP_MODE_MASK 0x07 -#define SNTP_MODE_CLIENT 0x03 -#define SNTP_MODE_SERVER 0x04 -#define SNTP_MODE_BROADCAST 0x05 - -#define SNTP_OFFSET_STRATUM 1 -#define SNTP_STRATUM_KOD 0x00 - -#define SNTP_OFFSET_ORIGINATE_TIME 24 -#define SNTP_OFFSET_RECEIVE_TIME 32 -#define SNTP_OFFSET_TRANSMIT_TIME 40 - -/* number of seconds between 1900 and 1970 */ -#define DIFF_SEC_1900_1970 (2208988800UL) - -/** - * SNTP packet format (without optional fields) - * Timestamps are coded as 64 bits: - * - 32 bits seconds since Jan 01, 1970, 00:00 - * - 32 bits seconds fraction (0-padded) - * For future use, if the MSB in the seconds part is set, seconds are based - * on Feb 07, 2036, 06:28:16. - */ -#ifdef PACK_STRUCT_USE_INCLUDES -# include "arch/bpstruct.h" -#endif -PACK_STRUCT_BEGIN -struct sntp_msg { - PACK_STRUCT_FIELD(u8_t li_vn_mode); - PACK_STRUCT_FIELD(u8_t stratum); - PACK_STRUCT_FIELD(u8_t poll); - PACK_STRUCT_FIELD(u8_t precision); - PACK_STRUCT_FIELD(u32_t root_delay); - PACK_STRUCT_FIELD(u32_t root_dispersion); - PACK_STRUCT_FIELD(u32_t reference_identifier); - PACK_STRUCT_FIELD(u32_t reference_timestamp[2]); - PACK_STRUCT_FIELD(u32_t originate_timestamp[2]); - PACK_STRUCT_FIELD(u32_t receive_timestamp[2]); - PACK_STRUCT_FIELD(u32_t transmit_timestamp[2]); -} PACK_STRUCT_STRUCT; -PACK_STRUCT_END -#ifdef PACK_STRUCT_USE_INCLUDES -# include "arch/epstruct.h" -#endif - -/* function prototypes */ -static void sntp_request(void *arg); - -/** The UDP pcb used by the SNTP client */ -static struct udp_pcb* sntp_pcb; -/** Addresses of servers */ -static char* sntp_server_addresses[] = {SNTP_SERVER_ADDRESS}; -#if SNTP_SUPPORT_MULTIPLE_SERVERS -/** The currently used server (initialized to 0) */ -static u8_t sntp_current_server; -static u8_t sntp_num_servers = sizeof(sntp_server_addresses)/sizeof(char*); -#else /* SNTP_SUPPORT_MULTIPLE_SERVERS */ -#define sntp_current_server 0 -#endif /* SNTP_SUPPORT_MULTIPLE_SERVERS */ - -#if SNTP_RETRY_TIMEOUT_EXP -#define SNTP_RESET_RETRY_TIMEOUT() sntp_retry_timeout = SNTP_RETRY_TIMEOUT -/** Retry time, initialized with SNTP_RETRY_TIMEOUT and doubled with each retry. */ -static u32_t sntp_retry_timeout; -#else /* SNTP_RETRY_TIMEOUT_EXP */ -#define SNTP_RESET_RETRY_TIMEOUT() -#define sntp_retry_timeout SNTP_RETRY_TIMEOUT -#endif /* SNTP_RETRY_TIMEOUT_EXP */ - -#if SNTP_CHECK_RESPONSE >= 1 -/** Saves the last server address to compare with response */ -static ip_addr_t sntp_last_server_address; -#endif /* SNTP_CHECK_RESPONSE >= 1 */ - -#if SNTP_CHECK_RESPONSE >= 2 -/** Saves the last timestamp sent (which is sent back by the server) - * to compare against in response */ -static u32_t sntp_last_timestamp_sent[2]; -#endif /* SNTP_CHECK_RESPONSE >= 2 */ - -/** - * SNTP processing of received timestamp - */ -static void -sntp_process(u32_t *receive_timestamp) -{ - /* convert SNTP time (1900-based) to unix GMT time (1970-based) - * @todo: if MSB is 1, SNTP time is 2036-based! - */ - time_t t = (ntohl(receive_timestamp[0]) - DIFF_SEC_1900_1970); - -#if SNTP_CALC_TIME_US - u32_t us = ntohl(receive_timestamp[1]) / 4295; - SNTP_SET_SYSTEM_TIME_US(t, us); - /* display local time from GMT time */ - LWIP_DEBUGF(SNTP_DEBUG_TRACE, ("sntp_process: %s, %"U32_F" us", ctime(&t), us)); - -#else /* SNTP_CALC_TIME_US */ - - /* change system time and/or the update the RTC clock */ - SNTP_SET_SYSTEM_TIME(t); - /* display local time from GMT time */ - LWIP_DEBUGF(SNTP_DEBUG_TRACE, ("sntp_process: %s", ctime(&t))); -#endif /* SNTP_CALC_TIME_US */ -} - -/** - * Initialize request struct to be sent to server. - */ -static void -sntp_initialize_request(struct sntp_msg *req) -{ - memset(req, 0, SNTP_MSG_LEN); - req->li_vn_mode = SNTP_LI_NO_WARNING | SNTP_VERSION | SNTP_MODE_CLIENT; - -#if SNTP_CHECK_RESPONSE >= 2 - { - u32_t sntp_time_sec, sntp_time_us; - /* fill in transmit timestamp and save it in 'sntp_last_timestamp_sent' */ - SNTP_GET_SYSTEM_TIME(sntp_time_sec, sntp_time_us); - sntp_last_timestamp_sent[0] = htonl(sntp_time_sec + DIFF_SEC_1900_1970); - req->transmit_timestamp[0] = sntp_last_timestamp_sent[0]; - /* we send/save us instead of fraction to be faster... */ - sntp_last_timestamp_sent[1] = htonl(sntp_time_us); - req->transmit_timestamp[1] = sntp_last_timestamp_sent[1]; - } -#endif /* SNTP_CHECK_RESPONSE >= 2 */ -} - -/** - * Retry: send a new request (and increase retry timeout). - * - * @param arg is unused (only necessary to conform to sys_timeout) - */ -static void -sntp_retry(void* arg) -{ - LWIP_UNUSED_ARG(arg); - - LWIP_DEBUGF(SNTP_DEBUG_STATE, ("sntp_retry: Next request will be sent in %"U32_F" ms\n", - sntp_retry_timeout)); - - /* set up a timer to send a retry and increase the retry delay */ - sys_timeout(sntp_retry_timeout, sntp_request, NULL); - -#if SNTP_RETRY_TIMEOUT_EXP - { - u32_t new_retry_timeout; - /* increase the timeout for next retry */ - new_retry_timeout = sntp_retry_timeout << 1; - /* limit to maximum timeout and prevent overflow */ - if ((new_retry_timeout <= SNTP_RETRY_TIMEOUT_MAX) && - (new_retry_timeout > sntp_retry_timeout)) { - sntp_retry_timeout = new_retry_timeout; - } - } -#endif /* SNTP_RETRY_TIMEOUT_EXP */ -} - -#if SNTP_SUPPORT_MULTIPLE_SERVERS -/** - * If Kiss-of-Death is received (or another packet parsing error), - * try the next server or retry the current server and increase the retry - * timeout if only one server is available. - * - * @param arg is unused (only necessary to conform to sys_timeout) - */ -static void -sntp_try_next_server(void* arg) -{ - LWIP_UNUSED_ARG(arg); - - if (sntp_num_servers > 1) { - /* new server: reset retry timeout */ - SNTP_RESET_RETRY_TIMEOUT(); - sntp_current_server++; - if (sntp_current_server >= sntp_num_servers) { - sntp_current_server = 0; - } - LWIP_DEBUGF(SNTP_DEBUG_STATE, ("sntp_try_next_server: Sending request to server %"U16_F"\n", - (u16_t)sntp_current_server)); - /* instantly send a request to the next server */ - sntp_request(NULL); - } else { - sntp_retry(NULL); - } -} -#else /* SNTP_SUPPORT_MULTIPLE_SERVERS */ -/* Always retry on error if only one server is supported */ -#define sntp_try_next_server sntp_retry -#endif /* SNTP_SUPPORT_MULTIPLE_SERVERS */ - -/** UDP recv callback for the sntp pcb */ -static void -sntp_recv(void *arg, struct udp_pcb* pcb, struct pbuf *p, ip_addr_t *addr, u16_t port) -{ - u8_t mode; - u8_t stratum; - u32_t receive_timestamp[SNTP_RECEIVE_TIME_SIZE]; - err_t err; - - LWIP_UNUSED_ARG(arg); - LWIP_UNUSED_ARG(pcb); - - /* packet received: stop retry timeout */ - sys_untimeout(sntp_try_next_server, NULL); - sys_untimeout(sntp_request, NULL); - - err = ERR_ARG; -#if SNTP_CHECK_RESPONSE >= 1 - /* check server address and port */ - if (ip_addr_cmp(addr, &sntp_last_server_address) && - (port == SNTP_PORT)) -#else /* SNTP_CHECK_RESPONSE >= 1 */ - LWIP_UNUSED_ARG(addr); - LWIP_UNUSED_ARG(port); -#endif /* SNTP_CHECK_RESPONSE >= 1 */ - { - /* process the response */ - if (p->tot_len == SNTP_MSG_LEN) { - pbuf_copy_partial(p, &mode, 1, SNTP_OFFSET_LI_VN_MODE); - mode &= SNTP_MODE_MASK; - /* if this is a SNTP response... */ - if ((mode == SNTP_MODE_SERVER) || - (mode == SNTP_MODE_BROADCAST)) { - pbuf_copy_partial(p, &stratum, 1, SNTP_OFFSET_STRATUM); - if (stratum == SNTP_STRATUM_KOD) { - /* Kiss-of-death packet. Use another server or increase UPDATE_DELAY. */ - err = SNTP_ERR_KOD; - LWIP_DEBUGF(SNTP_DEBUG_STATE, ("sntp_recv: Received Kiss-of-Death\n")); - } else { -#if SNTP_CHECK_RESPONSE >= 2 - /* check originate_timetamp against sntp_last_timestamp_sent */ - u32_t originate_timestamp[2]; - pbuf_copy_partial(p, &originate_timestamp, 8, SNTP_OFFSET_ORIGINATE_TIME); - if ((originate_timestamp[0] != sntp_last_timestamp_sent[0]) || - (originate_timestamp[1] != sntp_last_timestamp_sent[1])) - { - LWIP_DEBUGF(SNTP_DEBUG_WARN, ("sntp_recv: Invalid originate timestamp in response\n")); - } else -#endif /* SNTP_CHECK_RESPONSE >= 2 */ - /* @todo: add code for SNTP_CHECK_RESPONSE >= 3 and >= 4 here */ - { - /* correct answer */ - err = ERR_OK; - pbuf_copy_partial(p, &receive_timestamp, SNTP_RECEIVE_TIME_SIZE * 4, SNTP_OFFSET_RECEIVE_TIME); - } - } - } else { - LWIP_DEBUGF(SNTP_DEBUG_WARN, ("sntp_recv: Invalid mode in response: %"U16_F"\n", (u16_t)mode)); - } - } else { - LWIP_DEBUGF(SNTP_DEBUG_WARN, ("sntp_recv: Invalid packet length: %"U16_F"\n", p->tot_len)); - } - } - pbuf_free(p); - if (err == ERR_OK) { - /* Correct response, reset retry timeout */ - SNTP_RESET_RETRY_TIMEOUT(); - - sntp_process(receive_timestamp); - - /* Set up timeout for next request */ - sys_timeout((u32_t)SNTP_UPDATE_DELAY, sntp_request, NULL); - LWIP_DEBUGF(SNTP_DEBUG_STATE, ("sntp_recv: Scheduled next time request: %"U32_F" ms\n", - (u32_t)SNTP_UPDATE_DELAY)); - } else if (err == SNTP_ERR_KOD) { - /* Kiss-of-death packet. Use another server or increase UPDATE_DELAY. */ - sntp_try_next_server(NULL); - } else { - /* another error, try the same server again */ - sntp_retry(NULL); - } -} - -/** Actually send an sntp request to a server. - * - * @param server_addr resolved IP address of the SNTP server - */ -static void -sntp_send_request(ip_addr_t *server_addr) -{ - struct pbuf* p; - p = pbuf_alloc(PBUF_TRANSPORT, SNTP_MSG_LEN, PBUF_RAM); - if (p != NULL) { - struct sntp_msg *sntpmsg = (struct sntp_msg *)p->payload; - LWIP_DEBUGF(SNTP_DEBUG_STATE, ("sntp_send_request: Sending request to server\n")); - /* initialize request message */ - sntp_initialize_request(sntpmsg); - /* send request */ - udp_sendto(sntp_pcb, p, server_addr, SNTP_PORT); - /* free the pbuf after sending it */ - pbuf_free(p); - /* set up receive timeout: try next server or retry on timeout */ - sys_timeout((u32_t)SNTP_RECV_TIMEOUT, sntp_try_next_server, NULL); -#if SNTP_CHECK_RESPONSE >= 1 - /* save server address to verify it in sntp_recv */ - ip_addr_set(&sntp_last_server_address, server_addr); -#endif /* SNTP_CHECK_RESPONSE >= 1 */ - } else { - LWIP_DEBUGF(SNTP_DEBUG_SERIOUS, ("sntp_send_request: Out of memory, trying again in %"U32_F" ms\n", - (u32_t)SNTP_RETRY_TIMEOUT)); - /* out of memory: set up a timer to send a retry */ - sys_timeout((u32_t)SNTP_RETRY_TIMEOUT, sntp_request, NULL); - } -} - -#if SNTP_SERVER_DNS -/** - * DNS found callback when using DNS names as server address. - */ -static void -sntp_dns_found(const char* hostname, ip_addr_t *ipaddr, void *arg) -{ - LWIP_UNUSED_ARG(hostname); - LWIP_UNUSED_ARG(arg); - - if (ipaddr != NULL) { - /* Address resolved, send request */ - LWIP_DEBUGF(SNTP_DEBUG_STATE, ("sntp_dns_found: Server address resolved, sending request\n")); - sntp_send_request(ipaddr); - } else { - /* DNS resolving failed -> try another server */ - LWIP_DEBUGF(SNTP_DEBUG_WARN_STATE, ("sntp_dns_found: Failed to resolve server address resolved, trying next server\n")); - sntp_try_next_server(NULL); - } -} -#endif /* SNTP_SERVER_DNS */ - -/** - * Send out an sntp request. - * - * @param arg is unused (only necessary to conform to sys_timeout) - */ -static void -sntp_request(void *arg) -{ - ip_addr_t sntp_server_address; - err_t err; - - LWIP_UNUSED_ARG(arg); - - /* initialize SNTP server address */ -#if SNTP_SERVER_DNS - err = dns_gethostbyname(sntp_server_addresses[sntp_current_server], &sntp_server_address, - sntp_dns_found, NULL); - if (err == ERR_INPROGRESS) { - /* DNS request sent, wait for sntp_dns_found being called */ - LWIP_DEBUGF(SNTP_DEBUG_STATE, ("sntp_request: Waiting for server address to be resolved.\n")); - return; - } -#else /* SNTP_SERVER_DNS */ - err = ipaddr_aton(sntp_server_addresses[sntp_current_server], &sntp_server_address) - ? ERR_OK : ERR_ARG; - -#endif /* SNTP_SERVER_DNS */ - - if (err == ERR_OK) { - sntp_send_request(&sntp_server_address); - } else { - /* address conversion failed, try another server */ - LWIP_DEBUGF(SNTP_DEBUG_WARN_STATE, ("sntp_request: Invalid server address, trying next server.\n")); - sys_timeout((u32_t)SNTP_RETRY_TIMEOUT, sntp_try_next_server, NULL); - } -} - -/** - * Initialize this module. - * Send out request instantly or after SNTP_STARTUP_DELAY(_FUNC). - */ -void -sntp_init(void) -{ - if (sntp_pcb == NULL) { - SNTP_RESET_RETRY_TIMEOUT(); - sntp_pcb = udp_new(); - LWIP_ASSERT("Failed to allocate udp pcb for sntp client", sntp_pcb != NULL); - if (sntp_pcb != NULL) { - udp_recv(sntp_pcb, sntp_recv, NULL); -#if SNTP_STARTUP_DELAY - sys_timeout((u32_t)SNTP_STARTUP_DELAY_FUNC, sntp_request, NULL); -#else - sntp_request(NULL); -#endif - } - } -} - -/** - * Stop this module. - */ -void -sntp_stop(void) -{ - if (sntp_pcb != NULL) { - sys_untimeout(sntp_request, NULL); - udp_remove(sntp_pcb); - sntp_pcb = NULL; - } -} -#endif /* LWIP_UDP */ diff --git a/contrib/apps/sntp/sntp.h b/contrib/apps/sntp/sntp.h deleted file mode 100644 index 071e514..0000000 --- a/contrib/apps/sntp/sntp.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef LWIP_SNTP_H -#define LWIP_SNTP_H - -#ifdef __cplusplus -extern "C" { -#endif - -void sntp_init(void); -void sntp_stop(void); - -#ifdef __cplusplus -} -#endif - -#endif /* LWIP_SNTP_H */ diff --git a/contrib/apps/socket_examples/socket_examples.c b/contrib/apps/socket_examples/socket_examples.c deleted file mode 100644 index d915da1..0000000 --- a/contrib/apps/socket_examples/socket_examples.c +++ /dev/null @@ -1,480 +0,0 @@ - -#include "socket_examples.h" - -#include "lwip/opt.h" - -#if LWIP_SOCKET - -#include "lwip/sockets.h" -#include "lwip/sys.h" - -#include -#include - -#ifndef SOCK_TARGET_HOST -#define SOCK_TARGET_HOST "192.168.1.1" -#endif - -#ifndef SOCK_TARGET_PORT -#define SOCK_TARGET_PORT 80 -#endif - -/** This is an example function that tests - blocking- and nonblocking connect. */ -static void -sockex_nonblocking_connect(void *arg) -{ - int s; - int ret; - u32_t opt; - struct sockaddr_in addr; - fd_set readset; - fd_set writeset; - fd_set errset; - struct timeval tv; - u32_t ticks_a, ticks_b; - int err; - - LWIP_UNUSED_ARG(arg); - /* set up address to connect to */ - memset(&addr, 0, sizeof(addr)); - addr.sin_len = sizeof(addr); - addr.sin_family = AF_INET; - addr.sin_port = PP_HTONS(SOCK_TARGET_PORT); - addr.sin_addr.s_addr = inet_addr(SOCK_TARGET_HOST); - - /* first try blocking: */ - - /* create the socket */ - s = lwip_socket(AF_INET, SOCK_STREAM, 0); - LWIP_ASSERT("s >= 0", s >= 0); - - /* connect */ - ret = lwip_connect(s, (struct sockaddr*)&addr, sizeof(addr)); - /* should succeed */ - LWIP_ASSERT("ret == 0", ret == 0); - - /* write something */ - ret = lwip_write(s, "test", 4); - LWIP_ASSERT("ret == 4", ret == 4); - - /* close */ - ret = lwip_close(s); - LWIP_ASSERT("ret == 0", ret == 0); - - /* now try nonblocking and close before being connected */ - - /* create the socket */ - s = lwip_socket(AF_INET, SOCK_STREAM, 0); - LWIP_ASSERT("s >= 0", s >= 0); - /* nonblocking */ - opt = lwip_fcntl(s, F_GETFL, 0); - LWIP_ASSERT("ret != -1", ret != -1); - opt |= O_NONBLOCK; - ret = lwip_fcntl(s, F_SETFL, opt); - LWIP_ASSERT("ret != -1", ret != -1); - /* connect */ - ret = lwip_connect(s, (struct sockaddr*)&addr, sizeof(addr)); - /* should have an error: "inprogress" */ - LWIP_ASSERT("ret == -1", ret == -1); - err = errno; - LWIP_ASSERT("errno == EINPROGRESS", err == EINPROGRESS); - /* close */ - ret = lwip_close(s); - LWIP_ASSERT("ret == 0", ret == 0); - /* try to close again, should fail with EBADF */ - ret = lwip_close(s); - LWIP_ASSERT("ret == -1", ret == -1); - err = errno; - LWIP_ASSERT("errno == EBADF", err == EBADF); - printf("closing socket in nonblocking connect succeeded\n"); - - /* now try nonblocking, connect should succeed: - this test only works if it is fast enough, i.e. no breakpoints, please! */ - - /* create the socket */ - s = lwip_socket(AF_INET, SOCK_STREAM, 0); - LWIP_ASSERT("s >= 0", s >= 0); - - /* nonblocking */ - opt = 1; - ret = lwip_ioctl(s, FIONBIO, &opt); - LWIP_ASSERT("ret == 0", ret == 0); - - /* connect */ - ret = lwip_connect(s, (struct sockaddr*)&addr, sizeof(addr)); - /* should have an error: "inprogress" */ - LWIP_ASSERT("ret == -1", ret == -1); - err = errno; - LWIP_ASSERT("errno == EINPROGRESS", err == EINPROGRESS); - - /* write should fail, too */ - ret = lwip_write(s, "test", 4); - LWIP_ASSERT("ret == -1", ret == -1); - err = errno; - LWIP_ASSERT("errno == EINPROGRESS", err == EINPROGRESS); - - FD_ZERO(&readset); - FD_SET(s, &readset); - FD_ZERO(&writeset); - FD_SET(s, &writeset); - FD_ZERO(&errset); - FD_SET(s, &errset); - tv.tv_sec = 0; - tv.tv_usec = 0; - /* select without waiting should fail */ - ret = lwip_select(s + 1, &readset, &writeset, &errset, &tv); - LWIP_ASSERT("ret == 0", ret == 0); - LWIP_ASSERT("!FD_ISSET(s, &writeset)", !FD_ISSET(s, &writeset)); - LWIP_ASSERT("!FD_ISSET(s, &readset)", !FD_ISSET(s, &readset)); - LWIP_ASSERT("!FD_ISSET(s, &errset)", !FD_ISSET(s, &errset)); - - FD_ZERO(&readset); - FD_SET(s, &readset); - FD_ZERO(&writeset); - FD_SET(s, &writeset); - FD_ZERO(&errset); - FD_SET(s, &errset); - ticks_a = sys_now(); - /* select with waiting should succeed */ - ret = lwip_select(s + 1, &readset, &writeset, &errset, NULL); - ticks_b = sys_now(); - LWIP_ASSERT("ret == 1", ret == 1); - LWIP_ASSERT("FD_ISSET(s, &writeset)", FD_ISSET(s, &writeset)); - LWIP_ASSERT("!FD_ISSET(s, &readset)", !FD_ISSET(s, &readset)); - LWIP_ASSERT("!FD_ISSET(s, &errset)", !FD_ISSET(s, &errset)); - - /* now write should succeed */ - ret = lwip_write(s, "test", 4); - LWIP_ASSERT("ret == 4", ret == 4); - - /* close */ - ret = lwip_close(s); - LWIP_ASSERT("ret == 0", ret == 0); - - printf("select() needed %d ticks to return writable\n", ticks_b - ticks_a); - - - /* now try nonblocking to invalid address: - this test only works if it is fast enough, i.e. no breakpoints, please! */ - - /* create the socket */ - s = lwip_socket(AF_INET, SOCK_STREAM, 0); - LWIP_ASSERT("s >= 0", s >= 0); - - /* nonblocking */ - opt = 1; - ret = lwip_ioctl(s, FIONBIO, &opt); - LWIP_ASSERT("ret == 0", ret == 0); - - addr.sin_addr.s_addr++; - - /* connect */ - ret = lwip_connect(s, (struct sockaddr*)&addr, sizeof(addr)); - /* should have an error: "inprogress" */ - LWIP_ASSERT("ret == -1", ret == -1); - err = errno; - LWIP_ASSERT("errno == EINPROGRESS", err == EINPROGRESS); - - /* write should fail, too */ - ret = lwip_write(s, "test", 4); - LWIP_ASSERT("ret == -1", ret == -1); - err = errno; - LWIP_ASSERT("errno == EINPROGRESS", err == EINPROGRESS); - - FD_ZERO(&readset); - FD_SET(s, &readset); - FD_ZERO(&writeset); - FD_SET(s, &writeset); - FD_ZERO(&errset); - FD_SET(s, &errset); - tv.tv_sec = 0; - tv.tv_usec = 0; - /* select without waiting should fail */ - ret = lwip_select(s + 1, &readset, &writeset, &errset, &tv); - LWIP_ASSERT("ret == 0", ret == 0); - - FD_ZERO(&readset); - FD_SET(s, &readset); - FD_ZERO(&writeset); - FD_SET(s, &writeset); - FD_ZERO(&errset); - FD_SET(s, &errset); - ticks_a = sys_now(); - /* select with waiting should eventually succeed and return errset! */ - ret = lwip_select(s + 1, &readset, &writeset, &errset, NULL); - ticks_b = sys_now(); - LWIP_ASSERT("ret > 0", ret > 0); - LWIP_ASSERT("FD_ISSET(s, &errset)", FD_ISSET(s, &errset)); - LWIP_ASSERT("!FD_ISSET(s, &readset)", !FD_ISSET(s, &readset)); - LWIP_ASSERT("!FD_ISSET(s, &writeset)", !FD_ISSET(s, &writeset)); - - /* close */ - ret = lwip_close(s); - LWIP_ASSERT("ret == 0", ret == 0); - - printf("select() needed %d ticks to return error\n", ticks_b - ticks_a); - printf("all tests done, thread ending\n"); -} - -/** This is an example function that tests - the recv function (timeout etc.). */ -static void -sockex_testrecv(void *arg) -{ - int s; - int ret; - int err; - int opt; - struct sockaddr_in addr; - size_t len; - char rxbuf[1024]; - fd_set readset; - fd_set errset; - struct timeval tv; - - LWIP_UNUSED_ARG(arg); - /* set up address to connect to */ - memset(&addr, 0, sizeof(addr)); - addr.sin_len = sizeof(addr); - addr.sin_family = AF_INET; - addr.sin_port = PP_HTONS(SOCK_TARGET_PORT); - addr.sin_addr.s_addr = inet_addr(SOCK_TARGET_HOST); - - /* first try blocking: */ - - /* create the socket */ - s = lwip_socket(AF_INET, SOCK_STREAM, 0); - LWIP_ASSERT("s >= 0", s >= 0); - - /* connect */ - ret = lwip_connect(s, (struct sockaddr*)&addr, sizeof(addr)); - /* should succeed */ - LWIP_ASSERT("ret == 0", ret == 0); - - /* set recv timeout (100 ms) */ - opt = 100; - ret = lwip_setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &opt, sizeof(int)); - LWIP_ASSERT("ret == 0", ret == 0); - - /* write the start of a GET request */ -#define SNDSTR1 "G" - len = strlen(SNDSTR1); - ret = lwip_write(s, SNDSTR1, len); - LWIP_ASSERT("ret == len", ret == (int)len); - - /* should time out if the other side is a good HTTP server */ - ret = lwip_read(s, rxbuf, 1); - LWIP_ASSERT("ret == -1", ret == -1); - err = errno; - LWIP_ASSERT("errno == EAGAIN", err == EAGAIN); - - /* write the rest of a GET request */ -#define SNDSTR2 "ET / HTTP_1.1\r\n\r\n" - len = strlen(SNDSTR2); - ret = lwip_write(s, SNDSTR2, len); - LWIP_ASSERT("ret == len", ret == (int)len); - - /* wait a while: should be enough for the server to send a response */ - sys_msleep(1000); - - /* should not time out but receive a response */ - ret = lwip_read(s, rxbuf, 1024); - LWIP_ASSERT("ret > 0", ret > 0); - - /* now select should directly return because the socket is readable */ - FD_ZERO(&readset); - FD_ZERO(&errset); - FD_SET(s, &readset); - FD_SET(s, &errset); - tv.tv_sec = 10; - tv.tv_usec = 0; - ret = lwip_select(s + 1, &readset, NULL, &errset, &tv); - LWIP_ASSERT("ret == 1", ret == 1); - LWIP_ASSERT("!FD_ISSET(s, &errset)", !FD_ISSET(s, &errset)); - LWIP_ASSERT("FD_ISSET(s, &readset)", FD_ISSET(s, &readset)); - - /* should not time out but receive a response */ - ret = lwip_read(s, rxbuf, 1024); - /* might receive a second packet for HTTP/1.1 servers */ - if (ret > 0) { - /* should return 0: closed */ - ret = lwip_read(s, rxbuf, 1024); - LWIP_ASSERT("ret == 0", ret == 0); - } - - /* close */ - ret = lwip_close(s); - LWIP_ASSERT("ret == 0", ret == 0); - - printf("sockex_testrecv finished successfully\n"); -} - -/** helper struct for the 2 functions below (multithreaded: thread-argument) */ -struct sockex_select_helper { - int socket; - int wait_read; - int expect_read; - int wait_write; - int expect_write; - int wait_err; - int expect_err; - int wait_ms; - sys_sem_t sem; -}; - -/** helper thread to wait for socket events using select */ -static void -sockex_select_waiter(void *arg) -{ - struct sockex_select_helper *helper = (struct sockex_select_helper *)arg; - int ret; - fd_set readset; - fd_set writeset; - fd_set errset; - struct timeval tv; - - LWIP_ASSERT("helper != NULL", helper != NULL); - - FD_ZERO(&readset); - FD_ZERO(&writeset); - FD_ZERO(&errset); - if (helper->wait_read) { - FD_SET(helper->socket, &readset); - } - if (helper->wait_write) { - FD_SET(helper->socket, &writeset); - } - if (helper->wait_err) { - FD_SET(helper->socket, &errset); - } - - tv.tv_sec = helper->wait_ms / 1000; - tv.tv_usec = (helper->wait_ms % 1000) * 1000; - - ret = lwip_select(helper->socket, &readset, &writeset, &errset, &tv); - if (helper->expect_read || helper->expect_write || helper->expect_err) { - LWIP_ASSERT("ret > 0", ret > 0); - } else { - LWIP_ASSERT("ret == 0", ret == 0); - } - if (helper->expect_read) { - LWIP_ASSERT("FD_ISSET(helper->socket, &readset)", FD_ISSET(helper->socket, &readset)); - } else { - LWIP_ASSERT("!FD_ISSET(helper->socket, &readset)", !FD_ISSET(helper->socket, &readset)); - } - if (helper->expect_write) { - LWIP_ASSERT("FD_ISSET(helper->socket, &writeset)", FD_ISSET(helper->socket, &writeset)); - } else { - LWIP_ASSERT("!FD_ISSET(helper->socket, &writeset)", !FD_ISSET(helper->socket, &writeset)); - } - if (helper->expect_err) { - LWIP_ASSERT("FD_ISSET(helper->socket, &errset)", FD_ISSET(helper->socket, &errset)); - } else { - LWIP_ASSERT("!FD_ISSET(helper->socket, &errset)", !FD_ISSET(helper->socket, &errset)); - } - sys_sem_signal(&helper->sem); -} - -/** This is an example function that tests - more than one thread being active in select. */ -static void -sockex_testtwoselects(void *arg) -{ - int s1; - int s2; - int ret; - struct sockaddr_in addr; - size_t len; - err_t lwiperr; - struct sockex_select_helper h1, h2, h3, h4; - - LWIP_UNUSED_ARG(arg); - /* set up address to connect to */ - memset(&addr, 0, sizeof(addr)); - addr.sin_len = sizeof(addr); - addr.sin_family = AF_INET; - addr.sin_port = PP_HTONS(SOCK_TARGET_PORT); - addr.sin_addr.s_addr = inet_addr(SOCK_TARGET_HOST); - - /* create the sockets */ - s1 = lwip_socket(AF_INET, SOCK_STREAM, 0); - LWIP_ASSERT("s1 >= 0", s1 >= 0); - s2 = lwip_socket(AF_INET, SOCK_STREAM, 0); - LWIP_ASSERT("s2 >= 0", s2 >= 0); - - /* connect, should succeed */ - ret = lwip_connect(s1, (struct sockaddr*)&addr, sizeof(addr)); - LWIP_ASSERT("ret == 0", ret == 0); - ret = lwip_connect(s2, (struct sockaddr*)&addr, sizeof(addr)); - LWIP_ASSERT("ret == 0", ret == 0); - - /* write the start of a GET request */ -#define SNDSTR1 "G" - len = strlen(SNDSTR1); - ret = lwip_write(s1, SNDSTR1, len); - LWIP_ASSERT("ret == len", ret == (int)len); - ret = lwip_write(s2, SNDSTR1, len); - LWIP_ASSERT("ret == len", ret == (int)len); - - h1.wait_read = 1; - h1.wait_write = 1; - h1.wait_err = 1; - h1.expect_read = 0; - h1.expect_write = 0; - h1.expect_err = 0; - lwiperr = sys_sem_new(&h1.sem, 0); - LWIP_ASSERT("lwiperr == ERR_OK", lwiperr == ERR_OK); - h1.socket = s1; - h1.wait_ms = 500; - - h2 = h1; - lwiperr = sys_sem_new(&h2.sem, 0); - LWIP_ASSERT("lwiperr == ERR_OK", lwiperr == ERR_OK); - h2.socket = s2; - h2.wait_ms = 1000; - - h3 = h1; - lwiperr = sys_sem_new(&h3.sem, 0); - LWIP_ASSERT("lwiperr == ERR_OK", lwiperr == ERR_OK); - h3.socket = s2; - h3.wait_ms = 1500; - - h4 = h1; - lwiperr = sys_sem_new(&h4.sem, 0); - LWIP_ASSERT("lwiperr == ERR_OK", lwiperr == ERR_OK); - h4.socket = s2; - h4.wait_ms = 2000; - - /* select: all sockets should time out if the other side is a good HTTP server */ - - sys_thread_new("sockex_select_waiter1", sockex_select_waiter, &h2, 0, 0); - sys_msleep(100); - sys_thread_new("sockex_select_waiter2", sockex_select_waiter, &h1, 0, 0); - sys_msleep(100); - sys_thread_new("sockex_select_waiter2", sockex_select_waiter, &h4, 0, 0); - sys_msleep(100); - sys_thread_new("sockex_select_waiter2", sockex_select_waiter, &h3, 0, 0); - - sys_sem_wait(&h1.sem); - sys_sem_wait(&h2.sem); - sys_sem_wait(&h3.sem); - sys_sem_wait(&h4.sem); - - /* close */ - ret = lwip_close(s1); - LWIP_ASSERT("ret == 0", ret == 0); - ret = lwip_close(s2); - LWIP_ASSERT("ret == 0", ret == 0); - - printf("sockex_testtwoselects finished successfully\n"); -} - -void socket_examples_init(void) -{ - sys_thread_new("sockex_nonblocking_connect", sockex_nonblocking_connect, NULL, 0, 0); - sys_thread_new("sockex_testrecv", sockex_testrecv, NULL, 0, 0); - /*sys_thread_new("sockex_testtwoselects", sockex_testtwoselects, NULL, 0, 0);*/ -} - -#endif /* LWIP_SOCKETS */ diff --git a/contrib/apps/socket_examples/socket_examples.h b/contrib/apps/socket_examples/socket_examples.h deleted file mode 100644 index 354d03a..0000000 --- a/contrib/apps/socket_examples/socket_examples.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef LWIP_SOCKET_EXAMPLES_H -#define LWIP_SOCKET_EXAMPLES_H - -void socket_examples_init(void); - -#endif /* LWIP_SOCKET_EXAMPLES_H */ diff --git a/contrib/apps/tcpecho/tcpecho.c b/contrib/apps/tcpecho/tcpecho.c deleted file mode 100644 index 19cc666..0000000 --- a/contrib/apps/tcpecho/tcpecho.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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 - * - */ -#include "tcpecho.h" - -#include "lwip/opt.h" - -#if LWIP_NETCONN - -#include "lwip/sys.h" -#include "lwip/api.h" -/*-----------------------------------------------------------------------------------*/ -static void -tcpecho_thread(void *arg) -{ - struct netconn *conn, *newconn; - err_t err; - LWIP_UNUSED_ARG(arg); - - /* Create a new connection identifier. */ - conn = netconn_new(NETCONN_TCP); - - /* Bind connection to well known port number 7. */ - netconn_bind(conn, NULL, 7); - - /* Tell connection to go into listening mode. */ - netconn_listen(conn); - - while (1) { - - /* Grab new connection. */ - err = netconn_accept(conn, &newconn); - /*printf("accepted new connection %p\n", newconn);*/ - /* Process the new connection. */ - if (err == ERR_OK) { - struct netbuf *buf; - void *data; - u16_t len; - - while ((err = netconn_recv(newconn, &buf)) == ERR_OK) { - /*printf("Recved\n");*/ - do { - netbuf_data(buf, &data, &len); - err = netconn_write(newconn, data, len, NETCONN_COPY); -#if 0 - if (err != ERR_OK) { - printf("tcpecho: netconn_write: error \"%s\"\n", lwip_strerr(err)); - } -#endif - } while (netbuf_next(buf) >= 0); - netbuf_delete(buf); - } - /*printf("Got EOF, looping\n");*/ - /* Close connection and discard connection identifier. */ - netconn_close(newconn); - netconn_delete(newconn); - } - } -} -/*-----------------------------------------------------------------------------------*/ -void -tcpecho_init(void) -{ - sys_thread_new("tcpecho_thread", tcpecho_thread, NULL, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO); -} -/*-----------------------------------------------------------------------------------*/ - -#endif /* LWIP_NETCONN */ diff --git a/contrib/apps/tcpecho/tcpecho.h b/contrib/apps/tcpecho/tcpecho.h deleted file mode 100644 index 5b4bcfd..0000000 --- a/contrib/apps/tcpecho/tcpecho.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 - * - */ - -#ifndef LWIP_TCPECHO_H -#define LWIP_TCPECHO_H - -void tcpecho_init(void); - -#endif /* LWIP_TCPECHO_H */ diff --git a/contrib/apps/tcpecho_raw/echo.c b/contrib/apps/tcpecho_raw/echo.c deleted file mode 100644 index c9ff0d7..0000000 --- a/contrib/apps/tcpecho_raw/echo.c +++ /dev/null @@ -1,364 +0,0 @@ -/* - * Copyright (c) 2001-2004 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY - * OF SUCH DAMAGE. - * - * This file is part of and a contribution to the lwIP TCP/IP stack. - * - * Credits go to Adam Dunkels (and the current maintainers) of this software. - * - * Christiaan Simons rewrote this file to get a more stable echo example. - */ - -/** - * @file - * TCP echo server example using raw API. - * - * Echos all bytes sent by connecting client, - * and passively closes when client is done. - * - */ - - -#include "lwip/opt.h" -#include "lwip/debug.h" -#include "lwip/stats.h" -#include "lwip/tcp.h" -#include "echo.h" - -#if LWIP_TCP - -static struct tcp_pcb *echo_pcb; - -enum echo_states -{ - ES_NONE = 0, - ES_ACCEPTED, - ES_RECEIVED, - ES_CLOSING -}; - -struct echo_state -{ - u8_t state; - u8_t retries; - struct tcp_pcb *pcb; - /* pbuf (chain) to recycle */ - struct pbuf *p; -}; - -err_t echo_accept(void *arg, struct tcp_pcb *newpcb, err_t err); -err_t echo_recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err); -void echo_error(void *arg, err_t err); -err_t echo_poll(void *arg, struct tcp_pcb *tpcb); -err_t echo_sent(void *arg, struct tcp_pcb *tpcb, u16_t len); -void echo_send(struct tcp_pcb *tpcb, struct echo_state *es); -void echo_close(struct tcp_pcb *tpcb, struct echo_state *es); - -void -echo_init(void) -{ - echo_pcb = tcp_new(); - if (echo_pcb != NULL) - { - err_t err; - - err = tcp_bind(echo_pcb, IP_ADDR_ANY, 7); - if (err == ERR_OK) - { - echo_pcb = tcp_listen(echo_pcb); - tcp_accept(echo_pcb, echo_accept); - } - else - { - /* abort? output diagnostic? */ - } - } - else - { - /* abort? output diagnostic? */ - } -} - - -err_t -echo_accept(void *arg, struct tcp_pcb *newpcb, err_t err) -{ - err_t ret_err; - struct echo_state *es; - - LWIP_UNUSED_ARG(arg); - LWIP_UNUSED_ARG(err); - - /* Unless this pcb should have NORMAL priority, set its priority now. - When running out of pcbs, low priority pcbs can be aborted to create - new pcbs of higher priority. */ - tcp_setprio(newpcb, TCP_PRIO_MIN); - - es = (struct echo_state *)mem_malloc(sizeof(struct echo_state)); - if (es != NULL) - { - es->state = ES_ACCEPTED; - es->pcb = newpcb; - es->retries = 0; - es->p = NULL; - /* pass newly allocated es to our callbacks */ - tcp_arg(newpcb, es); - tcp_recv(newpcb, echo_recv); - tcp_err(newpcb, echo_error); - tcp_poll(newpcb, echo_poll, 0); - ret_err = ERR_OK; - } - else - { - ret_err = ERR_MEM; - } - return ret_err; -} - -err_t -echo_recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err) -{ - struct echo_state *es; - err_t ret_err; - - LWIP_ASSERT("arg != NULL",arg != NULL); - es = (struct echo_state *)arg; - if (p == NULL) - { - /* remote host closed connection */ - es->state = ES_CLOSING; - if(es->p == NULL) - { - /* we're done sending, close it */ - echo_close(tpcb, es); - } - else - { - /* we're not done yet */ - tcp_sent(tpcb, echo_sent); - echo_send(tpcb, es); - } - ret_err = ERR_OK; - } - else if(err != ERR_OK) - { - /* cleanup, for unkown reason */ - if (p != NULL) - { - es->p = NULL; - pbuf_free(p); - } - ret_err = err; - } - else if(es->state == ES_ACCEPTED) - { - /* first data chunk in p->payload */ - es->state = ES_RECEIVED; - /* store reference to incoming pbuf (chain) */ - es->p = p; - /* install send completion notifier */ - tcp_sent(tpcb, echo_sent); - echo_send(tpcb, es); - ret_err = ERR_OK; - } - else if (es->state == ES_RECEIVED) - { - /* read some more data */ - if(es->p == NULL) - { - es->p = p; - tcp_sent(tpcb, echo_sent); - echo_send(tpcb, es); - } - else - { - struct pbuf *ptr; - - /* chain pbufs to the end of what we recv'ed previously */ - ptr = es->p; - pbuf_chain(ptr,p); - } - ret_err = ERR_OK; - } - else if(es->state == ES_CLOSING) - { - /* odd case, remote side closing twice, trash data */ - tcp_recved(tpcb, p->tot_len); - es->p = NULL; - pbuf_free(p); - ret_err = ERR_OK; - } - else - { - /* unkown es->state, trash data */ - tcp_recved(tpcb, p->tot_len); - es->p = NULL; - pbuf_free(p); - ret_err = ERR_OK; - } - return ret_err; -} - -void -echo_error(void *arg, err_t err) -{ - struct echo_state *es; - - LWIP_UNUSED_ARG(err); - - es = (struct echo_state *)arg; - if (es != NULL) - { - mem_free(es); - } -} - -err_t -echo_poll(void *arg, struct tcp_pcb *tpcb) -{ - err_t ret_err; - struct echo_state *es; - - es = (struct echo_state *)arg; - if (es != NULL) - { - if (es->p != NULL) - { - /* there is a remaining pbuf (chain) */ - tcp_sent(tpcb, echo_sent); - echo_send(tpcb, es); - } - else - { - /* no remaining pbuf (chain) */ - if(es->state == ES_CLOSING) - { - echo_close(tpcb, es); - } - } - ret_err = ERR_OK; - } - else - { - /* nothing to be done */ - tcp_abort(tpcb); - ret_err = ERR_ABRT; - } - return ret_err; -} - -err_t -echo_sent(void *arg, struct tcp_pcb *tpcb, u16_t len) -{ - struct echo_state *es; - - LWIP_UNUSED_ARG(len); - - es = (struct echo_state *)arg; - es->retries = 0; - - if(es->p != NULL) - { - /* still got pbufs to send */ - tcp_sent(tpcb, echo_sent); - echo_send(tpcb, es); - } - else - { - /* no more pbufs to send */ - if(es->state == ES_CLOSING) - { - echo_close(tpcb, es); - } - } - return ERR_OK; -} - -void -echo_send(struct tcp_pcb *tpcb, struct echo_state *es) -{ - struct pbuf *ptr; - err_t wr_err = ERR_OK; - - while ((wr_err == ERR_OK) && - (es->p != NULL) && - (es->p->len <= tcp_sndbuf(tpcb))) - { - ptr = es->p; - - /* enqueue data for transmission */ - wr_err = tcp_write(tpcb, ptr->payload, ptr->len, 1); - if (wr_err == ERR_OK) - { - u16_t plen; - u8_t freed; - - plen = ptr->len; - /* continue with next pbuf in chain (if any) */ - es->p = ptr->next; - if(es->p != NULL) - { - /* new reference! */ - pbuf_ref(es->p); - } - /* chop first pbuf from chain */ - do - { - /* try hard to free pbuf */ - freed = pbuf_free(ptr); - } - while(freed == 0); - /* we can read more data now */ - tcp_recved(tpcb, plen); - } - else if(wr_err == ERR_MEM) - { - /* we are low on memory, try later / harder, defer to poll */ - es->p = ptr; - } - else - { - /* other problem ?? */ - } - } -} - -void -echo_close(struct tcp_pcb *tpcb, struct echo_state *es) -{ - tcp_arg(tpcb, NULL); - tcp_sent(tpcb, NULL); - tcp_recv(tpcb, NULL); - tcp_err(tpcb, NULL); - tcp_poll(tpcb, NULL, 0); - - if (es != NULL) - { - mem_free(es); - } - tcp_close(tpcb); -} - -#endif /* LWIP_TCP */ diff --git a/contrib/apps/udpecho/udpecho.c b/contrib/apps/udpecho/udpecho.c deleted file mode 100644 index 9bf2de2..0000000 --- a/contrib/apps/udpecho/udpecho.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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 - * - */ - -#include "udpecho.h" - -#include "lwip/opt.h" - -#if LWIP_NETCONN - -#include "lwip/api.h" -#include "lwip/sys.h" - -/*-----------------------------------------------------------------------------------*/ -static void -udpecho_thread(void *arg) -{ - struct netconn *conn; - struct netbuf *buf; - char buffer[4096]; - err_t err; - LWIP_UNUSED_ARG(arg); - - conn = netconn_new(NETCONN_UDP); - LWIP_ASSERT("con != NULL", conn != NULL); - netconn_bind(conn, NULL, 7); - - while (1) { - err = netconn_recv(conn, &buf); - if (err == ERR_OK) { - /* no need netconn_connect here, since the netbuf contains the address */ - if(netbuf_copy(buf, buffer, buf->p->tot_len) != buf->p->tot_len) { - LWIP_DEBUGF(LWIP_DBG_ON, ("netbuf_copy failed\n")); - } else { - buffer[buf->p->tot_len] = '\0'; - err = netconn_send(conn, buf); - if(err != ERR_OK) { - LWIP_DEBUGF(LWIP_DBG_ON, ("netconn_send failed: %d\n", (int)err)); - } else { - LWIP_DEBUGF(LWIP_DBG_ON, ("got %s\n", buffer)); - } - } - netbuf_delete(buf); - } - } -} -/*-----------------------------------------------------------------------------------*/ -void -udpecho_init(void) -{ - sys_thread_new("udpecho_thread", udpecho_thread, NULL, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO); -} - -#endif /* LWIP_NETCONN */ diff --git a/contrib/apps/udpecho/udpecho.h b/contrib/apps/udpecho/udpecho.h deleted file mode 100644 index a3155b8..0000000 --- a/contrib/apps/udpecho/udpecho.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 - * - */ -#ifndef LWIP_UDPECHO_H -#define LWIP_UDPECHO_H - -void udpecho_init(void); - -#endif /* LWIP_UDPECHO_H */ diff --git a/contrib/ports/FILES b/contrib/ports/FILES deleted file mode 100644 index a8db240..0000000 --- a/contrib/ports/FILES +++ /dev/null @@ -1,8 +0,0 @@ -unix/ - Architectural files for testing on unix-like systems - (assuming gcc and pthreads). - - Maintained by Kieran Mansley - -msvc6/ - Architectural files for Microsoft Visual C++ 6.0. - - Maintained by Simon Goldschmidt - -old/ - Ports that are no longer actively maintained diff --git a/contrib/ports/old/6502/README b/contrib/ports/old/6502/README deleted file mode 100644 index 2e24900..0000000 --- a/contrib/ports/old/6502/README +++ /dev/null @@ -1 +0,0 @@ -The 6502 code is far from complete. diff --git a/contrib/ports/old/6502/include/arch/cc.h b/contrib/ports/old/6502/include/arch/cc.h deleted file mode 100644 index ac55609..0000000 --- a/contrib/ports/old/6502/include/arch/cc.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 - * - */ -#ifndef __CC_H__ -#define __CC_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; - -#define U16_F "hu" -#define S16_F "hd" -#define X16_F "hx" -#define U32_F "lu" -#define S32_F "ld" -#define X32_F "lx" - -#define PACK_STRUCT_BEGIN -#define PACK_STRUCT_STRUCT -#define PACK_STRUCT_END -#define PACK_STRUCT_FIELD(x) x - -#endif /* __CC_H__ */ diff --git a/contrib/ports/old/6502/include/arch/cpu.h b/contrib/ports/old/6502/include/arch/cpu.h deleted file mode 100644 index a02f86d..0000000 --- a/contrib/ports/old/6502/include/arch/cpu.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 - * - */ -#ifndef __CPU_H__ -#define __CPU_H__ - -#define BYTE_ORDER LITTLE_ENDIAN - -#endif /* __CPU_H__ */ diff --git a/contrib/ports/old/6502/include/arch/perf.h b/contrib/ports/old/6502/include/arch/perf.h deleted file mode 100644 index 334d42a..0000000 --- a/contrib/ports/old/6502/include/arch/perf.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 - * - */ -#ifndef __PERF_H__ -#define __PERF_H__ - -#define PERF_START /* null definition */ -#define PERF_STOP(x) /* null definition */ - -#endif /* __PERF_H__ */ diff --git a/contrib/ports/old/6502/sys_c64.c b/contrib/ports/old/6502/sys_c64.c deleted file mode 100644 index 995fdf1..0000000 --- a/contrib/ports/old/6502/sys_c64.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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 - * - */ - -#include -#include - -#include "lwip/sys.h" -#include "lwip/def.h" - -struct sys_timeouts timeouts; - -/*-----------------------------------------------------------------------------------*/ -void -sys_arch_block(u16_t time) -{ - u16_t ticks; - - ticks = time * (CLK_TCK / 1000) + clock(); - printf("ticks %d\n", ticks); - - while (clock() != ticks); -} -/*-----------------------------------------------------------------------------------*/ -sys_mbox_t -sys_mbox_new(void) -{ - return SYS_MBOX_NULL; -} -/*-----------------------------------------------------------------------------------*/ -void -sys_mbox_free(sys_mbox_t mbox) -{ - return; -} -/*-----------------------------------------------------------------------------------*/ -void -sys_mbox_post(sys_mbox_t mbox, void *data) -{ - return; -} -/*-----------------------------------------------------------------------------------*/ -u16_t -sys_arch_mbox_fetch(sys_mbox_t mbox, void **data, u16_t timeout) -{ - sys_arch_block(timeout); - return 0; -} -/*-----------------------------------------------------------------------------------*/ -sys_sem_t -sys_sem_new(u8_t count) -{ - return 0; -} -/*-----------------------------------------------------------------------------------*/ -u16_t -sys_arch_sem_wait(sys_sem_t sem, u16_t timeout) -{ - sys_arch_block(timeout); - return 0; -} -/*-----------------------------------------------------------------------------------*/ -void -sys_sem_signal(sys_sem_t sem) -{ - return; -} -/*-----------------------------------------------------------------------------------*/ -void -sys_sem_free(sys_sem_t sem) -{ - return; -} -/*-----------------------------------------------------------------------------------*/ -void -sys_init(void) -{ - timeouts.next = NULL; - return; -} -/*-----------------------------------------------------------------------------------*/ -struct sys_timeouts * -sys_arch_timeouts(void) -{ - return &timeouts; -} -/*-----------------------------------------------------------------------------------*/ -sys_thread_t -sys_thread_new(char *name, void (* function)(void *arg), void *arg, int stacksize, int prio) -{ - return 0; -} -/*-----------------------------------------------------------------------------------*/ diff --git a/contrib/ports/old/FILES b/contrib/ports/old/FILES deleted file mode 100644 index 3c0d93a..0000000 --- a/contrib/ports/old/FILES +++ /dev/null @@ -1,34 +0,0 @@ -This directory contains ports that are no longer actively maintained. - -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. - -rtxc/ - Architectural files for the RTXC operating system. - -v2pro/ - Architectural files for the Xilinx Virtex-II PRO device with - embedded PowerPC 405 Processor. Supports lwIP Raw API only. - (requires EDK - http://www.xilinx.com/ise/embedded/edk.htm) - -coldfire/ - Architectural files for Motorola Coldfire 5272 CPU running - under Nucleus OS. Supports DMA and ISRs in ethernet driver. - -ti_c6711/ - Architectural files for TI TMS320C6000 DSP running under uC/OS-II. - Supports lwIP Raw API only. - It's done with an 10/100M ethernet daughtercard. - [more info at https://sourceforge.net/projects/ucos-lwip-c6x/] - - -Each subdirectory (may) also include: - -perf.c - Optional file that should be implemented when running - performance tests of lwIP. - -sys.c - Implementation of the operating system emulation layer. - -include/ - Architectural specific header files. - -netif/ - Architectural specific network interfaces. - diff --git a/contrib/ports/old/c16x/FILES b/contrib/ports/old/c16x/FILES deleted file mode 100644 index 145572e..0000000 --- a/contrib/ports/old/c16x/FILES +++ /dev/null @@ -1,13 +0,0 @@ -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; its functions 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 - diff --git a/contrib/ports/old/c16x/include/arch/cc.h b/contrib/ports/old/c16x/include/arch/cc.h deleted file mode 100644 index 219c7d4..0000000 --- a/contrib/ports/old/c16x/include/arch/cc.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef __CC_H__ -#define __CC_H__ - -/* memset(), memcpy() */ -#include -/* printf() and abort() */ -#include -#include -/* isdigit() */ -#include - -#include "arch/cpu.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; - -/* Define (sn)printf formatters for these lwIP types */ -#define U16_F "hu" -#define S16_F "hd" -#define X16_F "hx" -#define U32_F "lu" -#define S32_F "ld" -#define X32_F "lx" - -/* 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 - -#define LWIP_PLATFORM_BYTESWAP 1 -#define LWIP_PLATFORM_HTONS(x) _ror(x,8) -#define LWIP_PLATFORM_HTONL(x) c16x_htonl(x) - -_inline u32_t c16x_htonl(u32_t n) -{ - u16_t msw, lsw; - - msw = n >> 16; - msw = _ror(msw,8); - lsw = n; - lsw = _ror(lsw,8); - n = ((u32_t)lsw << 16) | (u32_t)msw; - return n; -} - -#ifdef LWIP_DEBUG - -/* LW: forward declaration */ -void debug_printf(char *format, ...); -void page_printf(char *format, ...); - -/* Plaform specific diagnostic output */ -#define LWIP_PLATFORM_DIAG(x) { debug_printf x; } -#define LWIP_PLATFORM_ASSERT(x) { debug_printf("\fline %d in %s\n", __LINE__, __FILE__); while(1); } - -#endif/* LWIP_DEBUG */ - -#endif /* __CC_H__ */ diff --git a/contrib/ports/old/c16x/include/arch/cpu.h b/contrib/ports/old/c16x/include/arch/cpu.h deleted file mode 100644 index 627f5f3..0000000 --- a/contrib/ports/old/c16x/include/arch/cpu.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __CPU_H__ -#define __CPU_H__ - -#define BYTE_ORDER LITTLE_ENDIAN - -#endif /* __CPU_H__ */ diff --git a/contrib/ports/old/c16x/include/arch/lib.h b/contrib/ports/old/c16x/include/arch/lib.h deleted file mode 100644 index 94b9a32..0000000 --- a/contrib/ports/old/c16x/include/arch/lib.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2001, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the lwIP TCP/IP stack. - * - * Author: Adam Dunkels - * - * $Id: lib.h,v 1.1 2007/06/14 12:33:57 kieranm Exp $ - */ -#ifndef __LIB_H__ -#define __LIB_H__ - - -#endif /* __LIB_H__ */ diff --git a/contrib/ports/old/c16x/include/arch/perf.h b/contrib/ports/old/c16x/include/arch/perf.h deleted file mode 100644 index d500eae..0000000 --- a/contrib/ports/old/c16x/include/arch/perf.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2001, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the lwIP TCP/IP stack. - * - * Author: Adam Dunkels - * - * $Id: perf.h,v 1.1 2007/06/14 12:33:57 kieranm Exp $ - */ -#ifndef __PERF_H__ -#define __PERF_H__ - -#define PERF_START /* null definition */ -#define PERF_STOP(x) /* null definition */ - -#endif /* __PERF_H__ */ diff --git a/contrib/ports/old/c16x/include/netif/cs8900if.h b/contrib/ports/old/c16x/include/netif/cs8900if.h deleted file mode 100644 index 39d17d9..0000000 --- a/contrib/ports/old/c16x/include/netif/cs8900if.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2001-2003 Leon Woestenberg - * 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 - * - * 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 - * - * 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 - -/* Number of ISQ events that may be serviced by cs8900_service() (at least 1) */ -#define CS8900_EVTS2SRV 10 - -struct cs8900if -{ - //struct eth_addr *ethaddr; - volatile 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_reset(struct netif *netif); -err_t cs8900if_init(struct netif *); -void cs8900if_service(struct netif *); -void cs8900if_input(struct netif *netif); - -void cs8900_send_debug(u8_t *p, u16_t len); - -#endif /* __NETIF_CS8900IF_H__ */ diff --git a/contrib/ports/old/c16x/lib.c b/contrib/ports/old/c16x/lib.c deleted file mode 100644 index aabac70..0000000 --- a/contrib/ports/old/c16x/lib.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2001, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the lwIP TCP/IP stack. - * - * Author: Adam Dunkels - * - * $Id: lib.c,v 1.1 2007/06/14 12:33:57 kieranm 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 */ diff --git a/contrib/ports/old/c16x/netif/cs8900if.c b/contrib/ports/old/c16x/netif/cs8900if.c deleted file mode 100644 index e049088..0000000 --- a/contrib/ports/old/c16x/netif/cs8900if.c +++ /dev/null @@ -1,939 +0,0 @@ -/** @file - * - * Ethernet network driver for IP - */ -/* - * Copyright (c) 2001-2003 Leon Woestenberg - * 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 - * - * 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 - * - * 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 as netif->linkoutput from etharp_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(). - * - * netif->output() resolves the hardware address, then - * calls cs8900_output() (as netif->linkoutput()) 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/opt.h" -#include "lwip/def.h" -#include "lwip/err.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 LWIP_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 - -/** - * Dependend on physical layer. This is a safe minimum for 802.3 10base5/T. - * @sa RFC1042 - */ -#define ETH_MIN_FRAME_LEN 60 - -#include "cs8900if.h" -#include "lwip/snmp.h" - -// Define those to better describe your network interface -#define IFNAME0 'e' -#define IFNAME1 'n' - -// 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, s16_t len); -static void cs8900_reset(struct netif *netif); - -// 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 - } -} -#endif - -/** - * Reset the CS8900A chip-wide using a soft reset - * - * @note You MUST wait 30 ms before accessing the CS8900 - * after calling this function. - */ -static void cs8900_reset(struct netif *netif) -{ - (void)netif; - /* set RESET bit */ - PACKETPP = CS_PP_SELFCTL; - PPDATA = 0x0055U; -} - -// cs8900_init() -// -// initializes the CS8900A chip -// -static err_t cs8900_init(struct netif *netif) -{ -#ifdef LED_NEED_SERVICE - leds_off(LED_NEED_SERVICE); -#endif - - // { the RESET bit will be cleared by the cs8900a - // as a result of a hardware reset - wait for it} - // 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*/); - - return ERR_OK; -} - -/** - * - * - * @return error code - * - ERR_OK: packet transferred to hardware - * - ERR_CONN: no link or link failure - * - ERR_IF: could not transfer to link (hardware buffer full?) - */ -static err_t cs8900_output(struct netif *netif, struct pbuf *p) -{ - s16_t tries = 0; - err_t result; - - // exit if link has failed - PACKETPP = CS_PP_LINESTATUS; - if ((PPDATA & 0x0080U/*LinkOK*/) == 0) return ERR_CONN; // no Ethernet link - - result = ERR_OK; - /* TODO: should this occur AFTER setting TXLENGTH??? */ - /* drop the padding word */ -#if ETH_PAD_SIZE - pbuf_header(p, -ETH_PAD_SIZE); -#endif - - /* issue 'transmit' command to CS8900 */ - TXCMD = 0x00C9U; - /* send length (in bytes) of packet to send, but at least minimum frame length */ - TXLENGTH = (p->tot_len < ETH_MIN_FRAME_LEN? ETH_MIN_FRAME_LEN: 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) - { - u16_t sent_bytes = 0; - /* q traverses through linked list of pbuf's - * This list MUST consist of a single packet ONLY */ - struct pbuf *q; - u16_t pbuf_index = 0; - u8_t word_index = 0; - u8_t word[2]; - q = p; - /* Write data into CS8900, two bytes at a time - * Handling pbuf's with odd number of bytes correctly - * No attempt to optimize for speed has been made */ - while (q) - { - if (pbuf_index < q->len) - { - word[word_index++] = ((u8_t*)q->payload)[pbuf_index++]; - if (word_index == 2) - { - RXTXREG = (word[1] << 8) | word[0]; - word_index = 0; - sent_bytes += 2; - } - } - else - { - q = q->next; - pbuf_index = 0; - } - } - /* One byte could still be unsent */ - if (word_index == 1) - { - RXTXREG = word[0]; - sent_bytes += 2; - } - /* provide any additional padding to comply with minimum Ethernet - * frame length (RFC10242) */ - while (sent_bytes < ETH_MIN_FRAME_LEN) - { - RXTXREG = 0x0000; - sent_bytes += 2; - } - /* { the packet has been sent } */ -#if (CS8900_STATS > 0) - ((struct cs8900if *)netif->state)->sentpackets++; - ((struct cs8900if *)netif->state)->sentbytes += sent_bytes; -#endif - snmp_add_ifoutoctets(netif,sent_bytes); - } - else - { - // { not ready to transmit!? } - snmp_inc_ifoutdiscards(netif); - /* return not connected */ - result = ERR_IF; - } -#if ETH_PAD_SIZE - /* reclaim the padding word */ - pbuf_header(p, ETH_PAD_SIZE); -#endif - return result; -} - -/** - * 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) -{ - volatile u16_t* rxtx_reg; - volatile u32_t rxtx_num = (MEM_BASE + IO_BASE); - u16_t* ptr = NULL; - struct pbuf *p = NULL, *q = NULL; - u16_t len = 0; - u16_t event_type; - u16_t i; - - /* optimized register mapping for Tasking c166 7.5 (default optimalisation setting) - Using RXTXREG directly produces inefficient code with many const address loads. */ - rxtx_reg = ((volatile u16_t *)(rxtx_num)); - // read RxStatus - event_type = *rxtx_reg; - - // 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(netif); - } - else - { - snmp_inc_ifinnucastpkts(netif); - } -#endif - event_type = 0; - // read RxLength - len = *rxtx_reg; - LWIP_DEBUGF(NETIF_DEBUG, ("cs8900_input: packet len %"U16_F"\n", len)); - snmp_add_ifinoctets(netif,len); - // positive length? - if (len > 0) - { - // allocate a pbuf chain with total length 'len + ETH_PAD_SIZE' - p = pbuf_alloc(PBUF_RAW, len + ETH_PAD_SIZE, PBUF_POOL); - if (p != NULL) - { -#if ETH_PAD_SIZE - /* drop the padding word */ - pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */ -#endif - for (q = p; q != 0; q = q->next) - { - LWIP_DEBUGF(NETIF_DEBUG, ("cs8900_input: pbuf @%p tot_len %"U16_F" len %"U16_F"\n", q, q->tot_len, q->len)); - - /* read 8 bytes per iteration */ - ptr = q->payload; - i = q->len / 8; - while(i > 0) - { - *ptr = *rxtx_reg; - ptr++; - *ptr = *rxtx_reg; - ptr++; - *ptr = *rxtx_reg; - ptr++; - *ptr = *rxtx_reg; - ptr++; - i--; - } - /* read remainder */ - i = ((q->len % 8) + 1) / 2; - while(i > 0) - { - *ptr = *rxtx_reg; - ptr++; - i--; - } - } -#if ETH_PAD_SIZE - /* reclaim the padding word */ - pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */ -#endif - } - // 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 - snmp_inc_ifindiscards(netif); - 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) -{ - u8_t events2service = CS8900_EVTS2SRV; -#if (CS8900_STATS > 0) - u16_t miss_count = 0, coll_count = 0; -#endif - // 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*/) - { - miss_count += (irq_status >> 6); - } - else if ((irq_status & 0x003fU) == 0x0012U/*TxCOL Event*/) - { - coll_count += (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) /* follow misses and collisions on a per-packet basis? */ - /* read RxMiss Counter (zeroes itself upon read) */ - PACKETPP = CS_PP_RXMISS; - miss_count += (PPDATA >> 6); - /* read RxCol Counter (zeroes itself upon read) */ - PACKETPP = CS_PP_TXCOL; - coll_count += (PPDATA >> 6); -#endif -#if (CS8900_STATS > 0) - /* copy statistics counters into netif state fields */ - ((struct cs8900if *)netif->state)->missed += miss_count; - if (miss_count > 0) LWIP_DEBUGF(NETIF_DEBUG | 1, ("cs8900_input: %"U16_F" missed packets due to rx buffer overrun\n", miss_count)); - - ((struct cs8900if *)netif->state)->collisions += coll_count; - if (coll_count > 0) LWIP_DEBUGF(NETIF_DEBUG | 1, ("cs8900_input: %"U16_F" packet collisions\n", coll_count)); -#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); - } -} - -/** - * 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 eth_hdr *ethhdr = NULL; - struct pbuf *p = 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; - - switch (htons(ethhdr->type)) { - /* IP packet? */ - case ETHTYPE_IP: -#if 0 -/* CSi disabled ARP table update on ingress IP packets. - This seems to work but needs thorough testing. */ - /* update ARP table */ - etharp_ip_input(netif, p); -#endif - /* skip Ethernet header */ - pbuf_header(p, -(s16_t)sizeof(struct eth_hdr)); - LWIP_DEBUGF(NETIF_DEBUG, ("cs8900_input: passing packet up to IP\n")); - /* pass to network layer */ - netif->input(p, netif); - break; - /* ARP packet? */ - case ETHTYPE_ARP: - /* pass p to ARP module */ - etharp_arp_input(netif, (struct eth_addr *)&netif->hwaddr, p); - break; - /* unsupported Ethernet packet type */ - default: - /* free pbuf */ - pbuf_free(p); - p = NULL; - break; - } -} - -/** - * Reset the CS8900 Ethernet MAC/PHY chip. - * - * @param netif The lwIP network interface data structure belonging to this device. - * MAY be NULL as we do not support multiple devices yet. - * @note You SHOULD call cs8900if_init() afterwards to - * initialize and configure the chip. - */ -void cs8900if_reset(struct netif *netif) -{ - /* reset the cs8900a chip */ - cs8900_reset(netif); -} - -/** - * Initialize the CS8900 Ethernet MAC/PHY and its device driver. - * - * @param netif The lwIP network interface data structure belonging to this device. - * MAY be NULL as we do not support multiple devices yet. - * - */ -err_t cs8900if_init(struct netif *netif) -{ - struct cs8900if *cs8900if; - - cs8900if = mem_malloc(sizeof(struct cs8900if)); - if (cs8900if == NULL) - { - LWIP_DEBUGF(NETIF_DEBUG, ("cs8900_input: out of memory for cs8900if\n")); - return ERR_MEM; - } - /* initialize lwip network interface ... */ -#if LWIP_SNMP - /* ifType ethernetCsmacd(6) */ - netif->link_type = 6; - netif->link_speed = 10000000; - netif->ts = 0; - netif->ifinoctets = 0; - netif->ifinucastpkts = 0; - netif->ifinnucastpkts = 0; - netif->ifindiscards = 0; - netif->ifoutoctets = 0; - netif->ifoutucastpkts = 0; - netif->ifoutnucastpkts = 0; - netif->ifoutdiscards = 0; -#endif - - /* administrative details */ - netif->name[0] = IFNAME0; - netif->name[1] = IFNAME1; - - /* downward functions */ - netif->output = etharp_output; - netif->linkoutput = cs8900_output; - - /* initialize cs8900 specific interface state data pointer */ - netif->state = cs8900if; - - /* maximum transfer unit */ - netif->mtu = 1500; - - /* broadcast capability */ - netif->flags = NETIF_FLAG_BROADCAST; - - /* hardware address length */ - netif->hwaddr_len = 6; - - /* 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->collisions = 0; - cs8900if->sentpackets = 0; - cs8900if->sentbytes = 0; -#endif - - /* intialize the cs8900a chip */ - return 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(u8_t *p, u16_t len) -{ - s16_t 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)); - 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, s16_t 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 diff --git a/contrib/ports/old/c16x/perf.c b/contrib/ports/old/c16x/perf.c deleted file mode 100644 index 7fcafc6..0000000 --- a/contrib/ports/old/c16x/perf.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2001, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the lwIP TCP/IP stack. - * - * Author: Adam Dunkels - * - * $Id: perf.c,v 1.1 2007/06/14 12:33:57 kieranm Exp $ - */ - -#include "arch/perf.h" - -void -perf_init(char *fname) -{ - if (fname); // LEON: prevent warning -} diff --git a/contrib/ports/old/coldfire/README b/contrib/ports/old/coldfire/README deleted file mode 100644 index 87f4e7a..0000000 --- a/contrib/ports/old/coldfire/README +++ /dev/null @@ -1,20 +0,0 @@ -### README --- c:/cygwin/home/dhaas/work/cfimage/lwip/arch/coldfire/ - -## -## Author: dhaas@alum.rpi.edu - -These files are a port of lwip to coldfire (specifically the MCF5272 with -on-board FEC) under the Nucleus OS. Nucleus is pretty generic so it should be -fairly easy to port this to any other embedded OS. Nucleus memory managment -is not used. It is assumed you have a working malloc (which at least -long-word aligns memory). - -The compiler used was Diab 4.3b. You will almost certainly need to change -cc.h for your compiler. - -IMPORTANT NOTE: If you use the fec driver for a different processor which has -a data cache you will need to make sure the buffer descriptors and memory -used for pbufs are not in a cachable area. Otherwise the fec driver is -guarrenteed to malfunction. The 5272 which this was written for does not -support data cache so it did not matter and malloc was used. - diff --git a/contrib/ports/old/coldfire/include/arch/cc.h b/contrib/ports/old/coldfire/include/arch/cc.h deleted file mode 100644 index 94ae768..0000000 --- a/contrib/ports/old/coldfire/include/arch/cc.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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. 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 - * - * $Id: cc.h,v 1.1 2007/06/14 12:34:00 kieranm Exp $ - */ -#ifndef __CC_H__ -#define __CC_H__ - -#include -#include - -/* Specific code for NBS Card Technology */ -#ifdef CARDTECH -#include -#endif - -#define BYTE_ORDER BIG_ENDIAN -#define IMM_ADDRESS (0x10000000) -#define FEC_LEVEL 4 - -// 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; - -/* Compiler hints for packing structures */ -#define PACK_STRUCT_BEGIN #pragma pack(1,1,0) -#define PACK_STRUCT_STRUCT -#define ALIGN_STRUCT_8_BEGIN #pragma pack(1,8,0) -#define ALIGN_STRUCT_END #pragma pack() -#define PACK_STRUCT_END #pragma pack() -#define PACK_STRUCT_FIELD(x) x - - -#define _SYS_TYPES_FD_SET -#define NBBY 8 /* number of bits in a byte */ - -#ifndef FD_SETSIZE -#define FD_SETSIZE 64 -#endif /* FD_SETSIZE */ - -typedef long fd_mask; -#define NFDBITS (sizeof (fd_mask) * NBBY) /* bits per mask */ -#ifndef howmany -#define howmany(x,y) (((x)+((y)-1))/(y)) -#endif /* howmany */ - -typedef struct _types_fd_set { - fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; -} _types_fd_set; - -#define fd_set _types_fd_set - -#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS))) -#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS))) -#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS))) -#define FD_ZERO(p) do { \ - size_t __i; \ - char *__tmp = (char *)p; \ - for (__i = 0; __i < sizeof (*(p)); ++__i) \ - *__tmp++ = 0; \ -} while (0) - -/* prototypes for printf() and abort() */ -#include -#include -/* Plaform specific diagnostic output */ -#ifndef LWIP_PLATFORM_DIAG -#define LWIP_PLATFORM_DIAG(x) do {printf x;} while(0) -#endif - -#ifndef LWIP_PLATFORM_ASSERT -#define LWIP_PLATFORM_ASSERT(x) do {printf("Assertion \"%s\" failed at line %d in %s\n", \ - x, __LINE__, __FILE__); fflush(NULL); abort();} while(0) -#endif - -asm u32_t GET_CALLER_PC (void) -{ -! "d0" - move.l 4(a6),d0 -} - - -#endif /* __CC_H__ */ diff --git a/contrib/ports/old/coldfire/include/arch/errno.h b/contrib/ports/old/coldfire/include/arch/errno.h deleted file mode 100644 index d06a9be..0000000 --- a/contrib/ports/old/coldfire/include/arch/errno.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2001, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the lwIP TCP/IP stack. - * - * Author: David Haas - * - * $Id: - */ -#ifndef __ERRNO_H__ -#define __ERRNO_H__ - -/* This can be used to test whether errno is implemented */ -#define ERRNO - -#define errno (*sys_arch_errno()) - - -#endif diff --git a/contrib/ports/old/coldfire/include/arch/mcf5272.h b/contrib/ports/old/coldfire/include/arch/mcf5272.h deleted file mode 100644 index 70427ed..0000000 --- a/contrib/ports/old/coldfire/include/arch/mcf5272.h +++ /dev/null @@ -1,2005 +0,0 @@ -/* - * 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. 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. - * - * - * Notes: This file provided by Motorola as part of their example code. - */ - -#ifndef _CPU_MCF5272_H -#define _CPU_MCF5272_H - -/***********************************************************************/ -/* - * Misc. Defines - */ - -#ifdef FALSE -#undef FALSE -#endif -#define FALSE (0) - -#ifdef TRUE -#undef TRUE -#endif -#define TRUE (1) - -#ifdef NULL -#undef NULL -#endif -#define NULL (0) - -/***********************************************************************/ -/* - * The basic data types - */ - -typedef volatile unsigned char vuint8; /* 8 bits */ -typedef volatile unsigned short int vuint16; /* 16 bits */ -typedef volatile unsigned long int vuint32; /* 32 bits */ - -typedef unsigned char uint8; /* 8 bits */ -typedef unsigned short int uint16; /* 16 bits */ -typedef unsigned long int uint32; /* 32 bits */ - -typedef signed char int8; /* 8 bits */ -typedef signed short int int16; /* 16 bits */ -typedef signed long int int32; /* 32 bits */ - -/***********************************************************************/ -/* - * Common M68K & ColdFire definitions - */ - -#define ADDRESS uint32 -#define INSTRUCTION uint16 -#define ILLEGAL 0x4AFC -#define CPU_WORD_SIZE 16 - -/***********************************************************************/ - -/* - * Routines and macros for accessing Input/Output devices - */ - -#define cpu_iord_8(ADDR) *((volatile uint8 *)(ADDR)) -#define cpu_iord_16(ADDR) *((volatile uint16 *)(ADDR)) -#define cpu_iord_32(ADDR) *((volatile uint32 *)(ADDR)) - -#define cpu_iowr_8(ADDR,DATA) *((volatile uint8 *)(ADDR)) = (DATA) -#define cpu_iowr_16(ADDR,DATA) *((volatile uint16 *)(ADDR)) = (DATA) -#define cpu_iowr_32(ADDR,DATA) *((volatile uint32 *)(ADDR)) = (DATA) - -/***********************************************************************/ - -#define MCF5200_SR_T (0x8000) -#define MCF5200_SR_S (0x2000) -#define MCF5200_SR_M (0x1000) -#define MCF5200_SR_IPL (0x0700) -#define MCF5200_SR_IPL_0 (0x0000) -#define MCF5200_SR_IPL_1 (0x0100) -#define MCF5200_SR_IPL_2 (0x0200) -#define MCF5200_SR_IPL_3 (0x0300) -#define MCF5200_SR_IPL_4 (0x0400) -#define MCF5200_SR_IPL_5 (0x0500) -#define MCF5200_SR_IPL_6 (0x0600) -#define MCF5200_SR_IPL_7 (0x0700) -#define MCF5200_SR_X (0x0010) -#define MCF5200_SR_N (0x0008) -#define MCF5200_SR_Z (0x0004) -#define MCF5200_SR_V (0x0002) -#define MCF5200_SR_C (0x0001) - -/***********************************************************************/ - -/* - * The ColdFire family of processors has a simplified exception stack - * frame that looks like the following: - * - * 3322222222221111 111111 - * 1098765432109876 5432109876543210 - * 8 +----------------+----------------+ - * | Program Counter | - * 4 +----------------+----------------+ - * |FS/Fmt/Vector/FS| SR | - * SP --> 0 +----------------+----------------+ - * - * The stack self-aligns to a 4-byte boundary at an exception, with - * the FS/Fmt/Vector/FS field indicating the size of the adjustment - * (SP += 0,1,2,3 bytes). - */ - -#define MCF5200_RD_SF_FORMAT(PTR) \ - ((*((uint16 *)(PTR)) >> 12) & 0x00FF) - -#define MCF5200_RD_SF_VECTOR(PTR) \ - ((*((uint16 *)(PTR)) >> 2) & 0x00FF) - -#define MCF5200_RD_SF_FS(PTR) \ - ( ((*((uint16 *)(PTR)) & 0x0C00) >> 8) | (*((uint16 *)(PTR)) & 0x0003) ) - -#define MCF5200_SF_SR(PTR) *((uint16 *)(PTR)+1) -#define MCF5200_SF_PC(PTR) *((uint32 *)(PTR)+1) - -#if 0 -typedef struct -{ - uint16 SR; - uint16 FS_FMT_VECTOR_FS; - uint32 PC; -} MCF5200_STACK_FRAME; -#endif - - -/********************************************************************** -* -* Macro for computing address of on-chip peripheral registers -* -***********************************************************************/ - -#define Mcf5272_addr(IMMP,OFFSET) ((void *)&((uint8 *)IMMP)[OFFSET]) - -/* Macro that returns a pointer to the Internal Memory Map */ -#define mcf5272_get_immp() ((MCF5272_IMM *)(IMM_ADDRESS)) - -/********************************************************************** -* -* Macros for accessing the on-chip I/O resources -* -***********************************************************************/ - -#define Mcf5272_iord(IMMP,OFFSET,SIZE) \ - *(volatile uint ## SIZE *)(Mcf5272_addr(IMMP,OFFSET)) - -#define Mcf5272_iowr(IMMP,OFFSET,SIZE,DATA) \ - *(volatile uint ## SIZE *)(Mcf5272_addr(IMMP,OFFSET)) = (DATA) - -/********************************************************************** -* -* CPU Space Registers -* -***********************************************************************/ - -/* Bit level definitions and macros */ -#define MCF5272_CACR_CENB (0x80000000) -#define MCF5272_CACR_CFRZ (0x08000000) -#define MCF5272_CACR_CINV (0x01000000) -#define MCF5272_CACR_CMOD (0x00000200) -#define MCF5272_CACR_CWRP (0x00000020) -#define MCF5272_CACR_CLNF_00 (0x00000000) -#define MCF5272_CACR_CLNF_01 (0x00000001) -#define MCF5272_CACR_CLNF_10 (0x00000002) - -#define MCF5272_ACR_BASE(a) ((a)&0xFF000000) -#define MCF5272_ACR_MASK(a) (((a)&0xFF000000) >> 8) -#define MCF5272_ACR_EN (0x00008000) -#define MCF5272_ACR_S_USER (0x00000000) -#define MCF5272_ACR_S_SUPER (0x00002000) -#define MCF5272_ACR_S_IGNORE (0x00006000) -#define MCF5272_ACR_ENIB (0x00000080) -#define MCF5272_ACR_CM (0x00000040) -#define MCF5272_ACR_WP (0x00000004) - -#define MCF5272_SRAMBAR_BASE(a) ((a)&0xFFFFF000) -#define MCF5272_SRAMBAR_WP (0x00000100) -#define MCF5272_SRAMBAR_CI (0x00000020) -#define MCF5272_SRAMBAR_SC (0x00000010) -#define MCF5272_SRAMBAR_SD (0x00000008) -#define MCF5272_SRAMBAR_UC (0x00000004) -#define MCF5272_SRAMBAR_UD (0x00000002) -#define MCF5272_SRAMBAR_V (0x00000001) - -#define MCF5272_ROMBAR_BASE(a) ((a)&0xFFFFF000) -#define MCF5272_ROMBAR_WP (0x00000100) -#define MCF5272_ROMBAR_CI (0x00000080) -#define MCF5272_ROMBAR_SC (0x00000040) -#define MCF5272_ROMBAR_SD (0x00000020) -#define MCF5272_ROMBAR_UC (0x00000004) -#define MCF5272_ROMBAR_UD (0x00000002) -#define MCF5272_ROMBAR_V (0x00000001) - -#define MCF5272_MBAR_BASE(a) ((a)&0xFFFFFC00) -#define MCF5272_MBAR_SC (0x00000010) -#define MCF5272_MBAR_SD (0x00000008) -#define MCF5272_MBAR_UC (0x00000004) -#define MCF5272_MBAR_UD (0x00000002) -#define MCF5272_MBAR_V (0x00000001) - -/********************************************************************** -* -* System Configuration Registers -* -***********************************************************************/ - -/* Offsets of the registers from the MBAR */ -#define MCF5272_SIM_MBAR (0x0000) -#define MCF5272_SIM_SCR (0x0004) -#define MCF5272_SIM_SPR (0x0006) -#define MCF5272_SIM_PMR (0x0008) -#define MCF5272_SIM_ALPR (0x000E) -#define MCF5272_SIM_DIR (0x0010) - -/* Read access macros for general use */ -#define MCF5272_RD_SIM_MBAR(IMMP) Mcf5272_iord(IMMP,MCF5272_SIM_MBAR,32) -#define MCF5272_RD_SIM_SCR(IMMP) Mcf5272_iord(IMMP,MCF5272_SIM_SCR,16) -#define MCF5272_RD_SIM_SPR(IMMP) Mcf5272_iord(IMMP,MCF5272_SIM_SPR,16) -#define MCF5272_RD_SIM_PMR(IMMP) Mcf5272_iord(IMMP,MCF5272_SIM_PMR,32) -#define MCF5272_RD_SIM_DIR(IMMP) Mcf5272_iord(IMMP,MCF5272_SIM_DIR,32) - -/* Write access macros for general use */ -#define MCF5272_WR_SIM_SCR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_SIM_SCR,16,DATA) -#define MCF5272_WR_SIM_SPR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_SIM_SPR,16,DATA) -#define MCF5272_WR_SIM_PMR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_SIM_PMR,32,DATA) -#define MCF5272_WR_SIM_ALPR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_SIM_ALPR,16,DATA) - -/* Bit level definitions and macros */ -#define MCF5272_SIM_SCR_HRST 0x1000 -#define MCF5272_SIM_SCR_DRAMRST 0x3000 -#define MCF5272_SIM_SCR_SWTR 0x2000 -#define MCF5272_SIM_SCR_AR 0x0080 -#define MCF5272_SIM_SCR_SOFT_RES 0x0040 -#define MCF5272_SIM_SCR_HWWD_128 0x0000 -#define MCF5272_SIM_SCR_HWWD_256 0x0001 -#define MCF5272_SIM_SCR_HWWD_512 0x0002 -#define MCF5272_SIM_SCR_HWWD_1024 0x0003 -#define MCF5272_SIM_SCR_HWWD_2048 0x0004 -#define MCF5272_SIM_SCR_HWWD_4096 0x0005 -#define MCF5272_SIM_SCR_HWWD_8192 0x0006 -#define MCF5272_SIM_SCR_HWWD_16384 0x0007 - -#define MCF5272_SIM_SPR_ADC 0x8000 -#define MCF5272_SIM_SPR_ADCEN 0x0080 -#define MCF5272_SIM_SPR_WPV 0x4000 -#define MCF5272_SIM_SPR_WPVEN 0x0040 -#define MCF5272_SIM_SPR_SMV 0x2000 -#define MCF5272_SIM_SPR_SMVEN 0x0020 -#define MCF5272_SIM_SPR_SBE 0x1000 -#define MCF5272_SIM_SPR_SBEEN 0x0010 -#define MCF5272_SIM_SPR_HWT 0x0800 -#define MCF5272_SIM_SPR_HWTEN 0x0008 -#define MCF5272_SIM_SPR_RPV 0x0400 -#define MCF5272_SIM_SPR_RPVEN 0x0004 -#define MCF5272_SIM_SPR_EXT 0x0200 -#define MCF5272_SIM_SPR_EXTEN 0x0002 -#define MCF5272_SIM_SPR_SUV 0x0100 -#define MCF5272_SIM_SPR_SUVEN 0x0001 - -#define MCF5272_SIM_PMR_BDMPDN 0x80000000 -#define MCF5272_SIM_PMR_ENETPDN 0x04000000 -#define MCF5272_SIM_PMR_PLIPPDN 0x02000000 -#define MCF5272_SIM_PMR_DRAMPDN 0x01000000 -#define MCF5272_SIM_PMR_DMAPDN 0x00800000 -#define MCF5272_SIM_PMR_PWMPDN 0x00400000 -#define MCF5272_SIM_PMR_QSPIPDN 0x00200000 -#define MCF5272_SIM_PMR_TIMERPDN 0x00100000 -#define MCF5272_SIM_PMR_GPIOPDN 0x00080000 -#define MCF5272_SIM_PMR_USBPDN 0x00040000 -#define MCF5272_SIM_PMR_UART1PDN 0x00020000 -#define MCF5272_SIM_PMR_UART0PDN 0x00010000 -#define MCF5272_SIM_PMR_USBWK 0x00000400 -#define MCF5272_SIM_PMR_UART1WK 0x00000200 -#define MCF5272_SIM_PMR_UART0WK 0x00000100 -#define MCF5272_SIM_PMR_MOS 0x00000020 -#define MCF5272_SIM_PMR_SLPEN 0x00000010 - -/********************************************************************** -* -* Interrupt Controller Registers -* -***********************************************************************/ - -/* Offsets of the registers from the MBAR */ -#define MCF5272_SIM_ICR1 (0x0020) -#define MCF5272_SIM_ICR2 (0x0024) -#define MCF5272_SIM_ICR3 (0x0028) -#define MCF5272_SIM_ICR4 (0x002C) -#define MCF5272_SIM_ISR (0x0030) -#define MCF5272_SIM_PITR (0x0034) -#define MCF5272_SIM_PIWR (0x0038) -#define MCF5272_SIM_PIVR (0x003F) - -/* Read access macros for general use */ -#define MCF5272_RD_SIM_ICR1(IMMP) Mcf5272_iord(IMMP,MCF5272_SIM_ICR1,32) -#define MCF5272_RD_SIM_ICR2(IMMP) Mcf5272_iord(IMMP,MCF5272_SIM_ICR2,32) -#define MCF5272_RD_SIM_ICR3(IMMP) Mcf5272_iord(IMMP,MCF5272_SIM_ICR3,32) -#define MCF5272_RD_SIM_ICR4(IMMP) Mcf5272_iord(IMMP,MCF5272_SIM_ICR4,32) -#define MCF5272_RD_SIM_ISR(IMMP) Mcf5272_iord(IMMP,MCF5272_SIM_ISR,32) -#define MCF5272_RD_SIM_PITR(IMMP) Mcf5272_iord(IMMP,MCF5272_SIM_PITR,32) -#define MCF5272_RD_SIM_PIWR(IMMP) Mcf5272_iord(IMMP,MCF5272_SIM_PIWR,32) -#define MCF5272_RD_SIM_PIVR(IMMP) Mcf5272_iord(IMMP,MCF5272_SIM_PIVR,8) - -/* Write access macros for general use */ -#define MCF5272_WR_SIM_ICR1(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_SIM_ICR1,32,DATA) -#define MCF5272_WR_SIM_ICR2(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_SIM_ICR2,32,DATA) -#define MCF5272_WR_SIM_ICR3(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_SIM_ICR3,32,DATA) -#define MCF5272_WR_SIM_ICR4(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_SIM_ICR4,32,DATA) -#define MCF5272_WR_SIM_PITR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_SIM_PITR,32,DATA) -#define MCF5272_WR_SIM_PIWR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_SIM_PIWR,32,DATA) -#define MCF5272_WR_SIM_PIVR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_SIM_PIVR,8,DATA) - -/* Bit level definitions and macros */ -#define MCF5272_SIM_ICR_INT1_IL(a) ( 0x80000000 | (((a)&0x07)<<28) ) -#define MCF5272_SIM_ICR_INT2_IL(a) ( 0x08000000 | (((a)&0x07)<<24) ) -#define MCF5272_SIM_ICR_INT3_IL(a) ( 0x00800000 | (((a)&0x07)<<20) ) -#define MCF5272_SIM_ICR_INT4_IL(a) ( 0x00080000 | (((a)&0x07)<<16) ) -#define MCF5272_SIM_ICR_TMR0_IL(a) ( 0x00008000 | (((a)&0x07)<<12) ) -#define MCF5272_SIM_ICR_TMR1_IL(a) ( 0x00000800 | (((a)&0x07)<<8) ) -#define MCF5272_SIM_ICR_TMR2_IL(a) ( 0x00000080 | (((a)&0x07)<<4) ) -#define MCF5272_SIM_ICR_TMR3_IL(a) ( 0x00000008 | ((a)&0x07) ) -#define MCF5272_SIM_ICR_TMR_IL(a,x) ( (0x8 | ((a)&0x07)) << ((3-x)*4)) - -#define MCF5272_SIM_ICR_UART0_IL(a) ( 0x80000000 | (((a)&0x07)<<28) ) -#define MCF5272_SIM_ICR_UART1_IL(a) ( 0x08000000 | (((a)&0x07)<<24) ) -#define MCF5272_SIM_ICR_PLIP_IL(a) ( 0x00800000 | (((a)&0x07)<<20) ) -#define MCF5272_SIM_ICR_PLIA_IL(a) ( 0x00080000 | (((a)&0x07)<<16) ) -#define MCF5272_SIM_ICR_USB0_IL(a) ( 0x00008000 | (((a)&0x07)<<12) ) -#define MCF5272_SIM_ICR_USB1_IL(a) ( 0x00000800 | (((a)&0x07)<<8) ) -#define MCF5272_SIM_ICR_USB2_IL(a) ( 0x00000800 | (((a)&0x07)<<4) ) -#define MCF5272_SIM_ICR_USB3_IL(a) ( 0x00000800 | ((a)&0x07) ) - -#define MCF5272_SIM_ICR_USB4_IL(a) ( 0x80000000 | (((a)&0x07)<<28) ) -#define MCF5272_SIM_ICR_USB5_IL(a) ( 0x08000000 | (((a)&0x07)<<24) ) -#define MCF5272_SIM_ICR_USB6_IL(a) ( 0x00800000 | (((a)&0x07)<<20) ) -#define MCF5272_SIM_ICR_USB7_IL(a) ( 0x00080000 | (((a)&0x07)<<16) ) -#define MCF5272_SIM_ICR_DMA_IL(a) ( 0x00008000 | (((a)&0x07)<<12) ) -#define MCF5272_SIM_ICR_ERX_IL(a) ( 0x00000800 | (((a)&0x07)<<8) ) -#define MCF5272_SIM_ICR_ETX_IL(a) ( 0x00000080 | (((a)&0x07)<<4) ) -#define MCF5272_SIM_ICR_ENTC_IL(a) ( 0x00000008 | ((a)&0x07) ) - -#define MCF5272_SIM_ICR_QSPI_IL(a) ( 0x80000000 | (((a)&0x07)<<28) ) -#define MCF5272_SIM_ICR_INT5_IL(a) ( 0x08000000 | (((a)&0x07)<<24) ) -#define MCF5272_SIM_ICR_INT6_IL(a) ( 0x00800000 | (((a)&0x07)<<20) ) -#define MCF5272_SIM_ICR_SWTO_IL(a) ( 0x00080000 | (((a)&0x07)<<16) ) - -#define MCF5272_SIM_PITR_POS_EDGE (0xF0000060) -#define MCF5272_SIM_PITR_NEG_EDGE (0x00000000) - -#define MCF5272_SIM_PIWR_INT1 (0x80000000) -#define MCF5272_SIM_PIWR_INT2 (0x40000000) -#define MCF5272_SIM_PIWR_INT3 (0x20000000) -#define MCF5272_SIM_PIWR_INT4 (0x10000000) -#define MCF5272_SIM_PIWR_TMR0 (0x08000000) -#define MCF5272_SIM_PIWR_TMR1 (0x04000000) -#define MCF5272_SIM_PIWR_TMR2 (0x02000000) -#define MCF5272_SIM_PIWR_TMR3 (0x01000000) -#define MCF5272_SIM_PIWR_UART0 (0x00800000) -#define MCF5272_SIM_PIWR_UART1 (0x00400000) -#define MCF5272_SIM_PIWR_PLIP (0x00200000) -#define MCF5272_SIM_PIWR_PLIA (0x00100000) -#define MCF5272_SIM_PIWR_USB_0 (0x00080000) -#define MCF5272_SIM_PIWR_USB_1 (0x00040000) -#define MCF5272_SIM_PIWR_USB_2 (0x00020000) -#define MCF5272_SIM_PIWR_USB_3 (0x00010000) -#define MCF5272_SIM_PIWR_USB_4 (0x00008000) -#define MCF5272_SIM_PIWR_USB_5 (0x00004000) -#define MCF5272_SIM_PIWR_USB_6 (0x00002000) -#define MCF5272_SIM_PIWR_USB_7 (0x00001000) -#define MCF5272_SIM_PIWR_DMA (0x00000800) -#define MCF5272_SIM_PIWR_ERx (0x00000400) -#define MCF5272_SIM_PIWR_ETx (0x00000200) -#define MCF5272_SIM_PIWR_ENTC (0x00000100) -#define MCF5272_SIM_PIWR_QSPI (0x00000080) -#define MCF5272_SIM_PIWR_INT5 (0x00000040) -#define MCF5272_SIM_PIWR_INT6 (0x00000020) -#define MCF5272_SIM_PIWR_SWTO (0x00000010) - -#define MCF5272_SIM_PIVR_IL(a) (((a)&0x07)<<5) -#define MCF5272_SIM_PIVR_NORMAL (0x40) - -/********************************************************************** - * - * Interrupt Vectors - * - **********************************************************************/ -#define MCF5272_VECTOR_INT1 65 -#define MCF5272_VECTOR_INT2 66 -#define MCF5272_VECTOR_INT3 67 -#define MCF5272_VECTOR_INT4 68 -#define MCF5272_VECTOR_TMR1 69 -#define MCF5272_VECTOR_TMR2 70 -#define MCF5272_VECTOR_TMR3 71 -#define MCF5272_VECTOR_TMR4 72 -#define MCF5272_VECTOR_UART1 73 -#define MCF5272_VECTOR_UART2 74 -#define MCF5272_VECTOR_PLIP 75 -#define MCF5272_VECTOR_PLIA 76 -#define MCF5272_VECTOR_USB0 77 -#define MCF5272_VECTOR_USB1 78 -#define MCF5272_VECTOR_USB2 79 -#define MCF5272_VECTOR_USB3 80 -#define MCF5272_VECTOR_USB4 81 -#define MCF5272_VECTOR_USB5 82 -#define MCF5272_VECTOR_USB6 83 -#define MCF5272_VECTOR_USB7 84 -#define MCF5272_VECTOR_DMA 85 -#define MCF5272_VECTOR_ERx 86 -#define MCF5272_VECTOR_ETx 87 -#define MCF5272_VECTOR_ENTC 88 -#define MCF5272_VECTOR_QSPI 89 -#define MCF5272_VECTOR_INT5 90 -#define MCF5272_VECTOR_INT6 91 -#define MCF5272_VECTOR_SWTO 92 - -/********************************************************************** -* -* Chip Select Registers -* -***********************************************************************/ - -/* Offsets of the registers from the MBAR */ -#define MCF5272_CS_CSBR0 (0x0040) -#define MCF5272_CS_CSOR0 (0x0044) -#define MCF5272_CS_CSBR1 (0x0048) -#define MCF5272_CS_CSOR1 (0x004C) -#define MCF5272_CS_CSBR2 (0x0050) -#define MCF5272_CS_CSOR2 (0x0054) -#define MCF5272_CS_CSBR3 (0x0058) -#define MCF5272_CS_CSOR3 (0x005C) -#define MCF5272_CS_CSBR4 (0x0060) -#define MCF5272_CS_CSOR4 (0x0064) -#define MCF5272_CS_CSBR5 (0x0068) -#define MCF5272_CS_CSOR5 (0x006C) -#define MCF5272_CS_CSBR6 (0x0070) -#define MCF5272_CS_CSOR6 (0x0074) -#define MCF5272_CS_CSBR7 (0x0078) -#define MCF5272_CS_CSOR7 (0x007C) - -/* Read access macros for general use */ -#define MCF5272_RD_CS_CSBR0(IMMP) Mcf5272_iord(IMMP,MCF5272_CS_CSBR0,32) -#define MCF5272_RD_CS_CSOR0(IMMP) Mcf5272_iord(IMMP,MCF5272_CS_CSOR0,32) -#define MCF5272_RD_CS_CSBR1(IMMP) Mcf5272_iord(IMMP,MCF5272_CS_CSBR1,32) -#define MCF5272_RD_CS_CSOR1(IMMP) Mcf5272_iord(IMMP,MCF5272_CS_CSOR1,32) -#define MCF5272_RD_CS_CSBR2(IMMP) Mcf5272_iord(IMMP,MCF5272_CS_CSBR2,32) -#define MCF5272_RD_CS_CSOR2(IMMP) Mcf5272_iord(IMMP,MCF5272_CS_CSOR2,32) -#define MCF5272_RD_CS_CSBR3(IMMP) Mcf5272_iord(IMMP,MCF5272_CS_CSBR3,32) -#define MCF5272_RD_CS_CSOR3(IMMP) Mcf5272_iord(IMMP,MCF5272_CS_CSOR3,32) -#define MCF5272_RD_CS_CSBR4(IMMP) Mcf5272_iord(IMMP,MCF5272_CS_CSBR4,32) -#define MCF5272_RD_CS_CSOR4(IMMP) Mcf5272_iord(IMMP,MCF5272_CS_CSOR4,32) -#define MCF5272_RD_CS_CSBR5(IMMP) Mcf5272_iord(IMMP,MCF5272_CS_CSBR5,32) -#define MCF5272_RD_CS_CSOR5(IMMP) Mcf5272_iord(IMMP,MCF5272_CS_CSOR5,32) -#define MCF5272_RD_CS_CSBR6(IMMP) Mcf5272_iord(IMMP,MCF5272_CS_CSBR6,32) -#define MCF5272_RD_CS_CSOR6(IMMP) Mcf5272_iord(IMMP,MCF5272_CS_CSOR6,32) -#define MCF5272_RD_CS_CSBR7(IMMP) Mcf5272_iord(IMMP,MCF5272_CS_CSBR7,32) -#define MCF5272_RD_CS_CSOR7(IMMP) Mcf5272_iord(IMMP,MCF5272_CS_CSOR7,32) - -/* Write access macros for general use */ -#define MCF5272_WR_CS_CSBR0(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_CS_CSBR0,32,DATA) -#define MCF5272_WR_CS_CSOR0(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_CS_CSOR0,32,DATA) -#define MCF5272_WR_CS_CSBR1(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_CS_CSBR1,32,DATA) -#define MCF5272_WR_CS_CSOR1(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_CS_CSOR1,32,DATA) -#define MCF5272_WR_CS_CSBR2(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_CS_CSBR2,32,DATA) -#define MCF5272_WR_CS_CSOR2(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_CS_CSOR2,32,DATA) -#define MCF5272_WR_CS_CSBR3(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_CS_CSBR3,32,DATA) -#define MCF5272_WR_CS_CSOR3(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_CS_CSOR3,32,DATA) -#define MCF5272_WR_CS_CSBR4(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_CS_CSBR4,32,DATA) -#define MCF5272_WR_CS_CSOR4(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_CS_CSOR4,32,DATA) -#define MCF5272_WR_CS_CSBR5(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_CS_CSBR5,32,DATA) -#define MCF5272_WR_CS_CSOR5(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_CS_CSOR5,32,DATA) -#define MCF5272_WR_CS_CSBR6(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_CS_CSBR6,32,DATA) -#define MCF5272_WR_CS_CSOR6(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_CS_CSOR6,32,DATA) -#define MCF5272_WR_CS_CSBR7(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_CS_CSBR7,32,DATA) -#define MCF5272_WR_CS_CSOR7(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_CS_CSOR7,32,DATA) - -/* Bit level definitions and macros */ -#define MCF5272_CS_BR_BASE(a) ((a)&0xFFFFF000) - -#define MCF5272_CS_OR_MASK_32M (0xFE000000) -#define MCF5272_CS_OR_MASK_16M (0xFF000000) -#define MCF5272_CS_OR_MASK_8M (0xFF800000) -#define MCF5272_CS_OR_MASK_4M (0xFFC00000) -#define MCF5272_CS_OR_MASK_2M (0xFFE00000) -#define MCF5272_CS_OR_MASK_1M (0xFFF00000) -#define MCF5272_CS_OR_MASK_512K (0xFFF80000) -#define MCF5272_CS_OR_MASK_256K (0xFFFC0000) -#define MCF5272_CS_OR_MASK_128K (0xFFFE0000) -#define MCF5272_CS_OR_MASK_64K (0xFFFF0000) -#define MCF5272_CS_OR_MASK_32K (0xFFFF8000) -#define MCF5272_CS_OR_MASK_16K (0xFFFFC000) -#define MCF5272_CS_OR_MASK_8K (0xFFFFE000) -#define MCF5272_CS_OR_MASK_4K (0xFFFFF000) -#define MCF5272_CS_OR_WS_MASK (0x007C) -#define MCF5272_CS_OR_WS(a) (((a)&0x1F)<<2) -#define MCF5272_CS_OR_BRST (0x0100) -#define MCF5272_CS_OR_RD (0x0003) -#define MCF5272_CS_OR_WR (0x0001) - -#define MCF5272_CS_BR_PS_8 (0x0100) -#define MCF5272_CS_BR_PS_16 (0x0200) -#define MCF5272_CS_BR_PS_32 (0x0000) -#define MCF5272_CS_BR_PS_LINE (0x0300) -#define MCF5272_CS_BR_ROM (0x0000) -#define MCF5272_CS_BR_SRAM (0x0000) -#define MCF5272_CS_BR_SRAM_8 (0x0C00) -#define MCF5272_CS_BR_SDRAM (0x0400) -#define MCF5272_CS_BR_ISA (0x0800) -#define MCF5272_CS_BR_SV (0x0080) -#define MCF5272_CS_BR_EN (0x0001) - -/********************************************************************** -* -* Ports Registers Description -* -***********************************************************************/ - -/* Offsets of the registers from the MBAR */ -#define MCF5272_GPIO_PACNT (0x0080) -#define MCF5272_GPIO_PADDR (0x0084) -#define MCF5272_GPIO_PADAT (0x0086) -#define MCF5272_GPIO_PBCNT (0x0088) -#define MCF5272_GPIO_PBDDR (0x008C) -#define MCF5272_GPIO_PBDAT (0x008E) -#define MCF5272_GPIO_PCDDR (0x0094) -#define MCF5272_GPIO_PCDAT (0x0096) -#define MCF5272_GPIO_PDCNT (0x0098) - -/* Read access macros for general use */ -#define MCF5272_RD_GPIO_PACNT(IMMP) Mcf5272_iord(IMMP,MCF5272_GPIO_PACNT,32) -#define MCF5272_RD_GPIO_PADDR(IMMP) Mcf5272_iord(IMMP,MCF5272_GPIO_PADDR,16) -#define MCF5272_RD_GPIO_PADAT(IMMP) Mcf5272_iord(IMMP,MCF5272_GPIO_PADAT,16) -#define MCF5272_RD_GPIO_PBCNT(IMMP) Mcf5272_iord(IMMP,MCF5272_GPIO_PBCNT,32) -#define MCF5272_RD_GPIO_PBDDR(IMMP) Mcf5272_iord(IMMP,MCF5272_GPIO_PBDDR,16) -#define MCF5272_RD_GPIO_PBDAT(IMMP) Mcf5272_iord(IMMP,MCF5272_GPIO_PBDAT,16) -#define MCF5272_RD_GPIO_PCDDR(IMMP) Mcf5272_iord(IMMP,MCF5272_GPIO_PCDDR,16) -#define MCF5272_RD_GPIO_PCDAT(IMMP) Mcf5272_iord(IMMP,MCF5272_GPIO_PCDAT,16) -#define MCF5272_RD_GPIO_PDCNT(IMMP) Mcf5272_iord(IMMP,MCF5272_GPIO_PDCNT,32) - -/* Write access macros for general use */ -#define MCF5272_WR_GPIO_PACNT(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_GPIO_PACNT,32,DATA) -#define MCF5272_WR_GPIO_PADDR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_GPIO_PADDR,16,DATA) -#define MCF5272_WR_GPIO_PADAT(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_GPIO_PADAT,16,DATA) -#define MCF5272_WR_GPIO_PBCNT(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_GPIO_PBCNT,32,DATA) -#define MCF5272_WR_GPIO_PBDDR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_GPIO_PBDDR,16,DATA) -#define MCF5272_WR_GPIO_PBDAT(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_GPIO_PBDAT,16,DATA) -#define MCF5272_WR_GPIO_PCDDR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_GPIO_PCDDR,16,DATA) -#define MCF5272_WR_GPIO_PCDAT(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_GPIO_PCDAT,16,DATA) -#define MCF5272_WR_GPIO_PDCNT(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_GPIO_PDCNT,32,DATA) - -/* Bit level definitions and macros */ -#define MCF5272_GPIO_DDR15_INPUT (~0x80) -#define MCF5272_GPIO_DDR15_OUTPUT ( 0x80) -#define MCF5272_GPIO_DDR14_INPUT (~0x40) -#define MCF5272_GPIO_DDR14_OUTPUT ( 0x40) -#define MCF5272_GPIO_DDR13_INPUT (~0x20) -#define MCF5272_GPIO_DDR13_OUTPUT ( 0x20) -#define MCF5272_GPIO_DDR12_INPUT (~0x10) -#define MCF5272_GPIO_DDR12_OUTPUT ( 0x10) -#define MCF5272_GPIO_DDR11_INPUT (~0x08) -#define MCF5272_GPIO_DDR11_OUTPUT ( 0x08) -#define MCF5272_GPIO_DDR10_INPUT (~0x04) -#define MCF5272_GPIO_DDR10_OUTPUT ( 0x04) -#define MCF5272_GPIO_DDR9_INPUT (~0x02) -#define MCF5272_GPIO_DDR9_OUTPUT ( 0x02) -#define MCF5272_GPIO_DDR8_INPUT (~0x01) -#define MCF5272_GPIO_DDR8_OUTPUT ( 0x01) -#define MCF5272_GPIO_DDR7_INPUT (~0x80) -#define MCF5272_GPIO_DDR7_OUTPUT ( 0x80) -#define MCF5272_GPIO_DDR6_INPUT (~0x40) -#define MCF5272_GPIO_DDR6_OUTPUT ( 0x40) -#define MCF5272_GPIO_DDR5_INPUT (~0x20) -#define MCF5272_GPIO_DDR5_OUTPUT ( 0x20) -#define MCF5272_GPIO_DDR4_INPUT (~0x10) -#define MCF5272_GPIO_DDR4_OUTPUT ( 0x10) -#define MCF5272_GPIO_DDR3_INPUT (~0x08) -#define MCF5272_GPIO_DDR3_OUTPUT ( 0x08) -#define MCF5272_GPIO_DDR2_INPUT (~0x04) -#define MCF5272_GPIO_DDR2_OUTPUT ( 0x04) -#define MCF5272_GPIO_DDR1_INPUT (~0x02) -#define MCF5272_GPIO_DDR1_OUTPUT ( 0x02) -#define MCF5272_GPIO_DDR0_INPUT (~0x01) -#define MCF5272_GPIO_DDR0_OUTPUT ( 0x01) - -#define MCF5272_GPIO_DAT15 ( 0x80) -#define MCF5272_GPIO_DAT14 ( 0x40) -#define MCF5272_GPIO_DAT13 ( 0x20) -#define MCF5272_GPIO_DAT12 ( 0x10) -#define MCF5272_GPIO_DAT11 ( 0x08) -#define MCF5272_GPIO_DAT10 ( 0x04) -#define MCF5272_GPIO_DAT9 ( 0x02) -#define MCF5272_GPIO_DAT8 ( 0x01) -#define MCF5272_GPIO_DAT7 ( 0x80) -#define MCF5272_GPIO_DAT6 ( 0x40) -#define MCF5272_GPIO_DAT5 ( 0x20) -#define MCF5272_GPIO_DAT4 ( 0x10) -#define MCF5272_GPIO_DAT3 ( 0x08) -#define MCF5272_GPIO_DAT2 ( 0x04) -#define MCF5272_GPIO_DAT1 ( 0x02) -#define MCF5272_GPIO_DAT0 ( 0x01) - - -/********************************************************************** -* -* QSPI Module Registers Description -* -***********************************************************************/ - -/* Offsets of the registers from the MBAR */ -#define MCF5272_QSPI_QMR (0x00A0) -#define MCF5272_QSPI_QDLYR (0x00A4) -#define MCF5272_QSPI_QWR (0x00A8) -#define MCF5272_QSPI_QIR (0x00AC) -#define MCF5272_QSPI_QAR (0x00B0) -#define MCF5272_QSPI_QDR (0x00B4) - -/* Read access macros for general use */ -#define MCF5272_RD_QSPI_QMR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_QSPI_QMR,16) -#define MCF5272_RD_QSPI_QDLYR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_QSPI_QDLYR,16) -#define MCF5272_RD_QSPI_QWR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_QSPI_QWR,16) -#define MCF5272_RD_QSPI_QIR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_QSPI_QIR,16) -#define MCF5272_RD_QSPI_QAR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_QSPI_QAR,16) -#define MCF5272_RD_QSPI_QDR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_QSPI_QDR,16) - -/* Write access macros for general use */ -#define MCF5272_WR_QSPI_QMR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_QSPI_QMR,16,DATA) -#define MCF5272_WR_QSPI_QDLYR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_QSPI_QDLYR,16,DATA) -#define MCF5272_WR_QSPI_QWR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_QSPI_QWR,16,DATA) -#define MCF5272_WR_QSPI_QIR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_QSPI_QIR,16,DATA) -#define MCF5272_WR_QSPI_QAR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_QSPI_QAR,16,DATA) -#define MCF5272_WR_QSPI_QDR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_QSPI_QDR,16,DATA) - - -/********************************************************************** -* -* PWM Module Registers Description -* -***********************************************************************/ - -/* Offsets of the registers from the MBAR */ -#define MCF5272_PWM_PWMCR1 (0x00C0) -#define MCF5272_PWM_PWMCR2 (0x00C4) -#define MCF5272_PWM_PWMCR3 (0x00C8) -#define MCF5272_PWM_PWMWD1 (0x00D0) -#define MCF5272_PWM_PWMWD2 (0x00D4) -#define MCF5272_PWM_PWMWD3 (0x00D8) - -/* Read access macros for general use */ -#define MCF5272_RD_PWM_PWMCR1(IMMP) Mcf5272_iord(IMMP,MCF5272_PWM_PWMCR1,8) -#define MCF5272_RD_PWM_PWMCR2(IMMP) Mcf5272_iord(IMMP,MCF5272_PWM_PWMCR2,8) -#define MCF5272_RD_PWM_PWMCR3(IMMP) Mcf5272_iord(IMMP,MCF5272_PWM_PWMCR3,8) -#define MCF5272_RD_PWM_PWMWD1(IMMP) Mcf5272_iord(IMMP,MCF5272_PWM_PWMWD1,8) -#define MCF5272_RD_PWM_PWMWD2(IMMP) Mcf5272_iord(IMMP,MCF5272_PWM_PWMWD2,8) -#define MCF5272_RD_PWM_PWMWD3(IMMP) Mcf5272_iord(IMMP,MCF5272_PWM_PWMWD3,8) - -/* Write access macros for general use */ -#define MCF5272_WR_PWM_PWMCR1(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PWM_PWMCR1,8,DATA) -#define MCF5272_WR_PWM_PWMCR2(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PWM_PWMCR2,8,DATA) -#define MCF5272_WR_PWM_PWMCR3(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PWM_PWMCR3,8,DATA) -#define MCF5272_WR_PWM_PWMWD1(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PWM_PWMWD1,8,DATA) -#define MCF5272_WR_PWM_PWMWD2(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PWM_PWMWD2,8,DATA) -#define MCF5272_WR_PWM_PWMWD3(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PWM_PWMWD3,8,DATA) - -/********************************************************************** -* -* DMA Module Registers Description -* -***********************************************************************/ - -/* Offsets of the registers from the MBAR */ -#define MCF5272_DMA_DCMR (0x00E0) -#define MCF5272_DMA_DCIR (0x00E6) -#define MCF5272_DMA_DBCR (0x00E8) -#define MCF5272_DMA_DSAR (0x00EC) -#define MCF5272_DMA_DDAR (0x00F0) - -/* Read access macros for general use */ -#define MCF5272_RD_DMA_DCMR(IMMP) Mcf5272_iord(IMMP,MCF5272_DMA_DCMR,32) -#define MCF5272_RD_DMA_DCIR(IMMP) Mcf5272_iord(IMMP,MCF5272_DMA_DCIR,16) -#define MCF5272_RD_DMA_DBCR(IMMP) Mcf5272_iord(IMMP,MCF5272_DMA_DBCR,32) -#define MCF5272_RD_DMA_DSAR(IMMP) Mcf5272_iord(IMMP,MCF5272_DMA_DSAR,32) -#define MCF5272_RD_DMA_DDAR(IMMP) Mcf5272_iord(IMMP,MCF5272_DMA_DDAR,32) - -/* Write access macros for general use */ -#define MCF5272_WR_DMA_DCMR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_DMA_DCMR,32,DATA) -#define MCF5272_WR_DMA_DCIR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_DMA_DCIR,16,DATA) -#define MCF5272_WR_DMA_DBCR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_DMA_DBCR,32,DATA) -#define MCF5272_WR_DMA_DSAR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_DMA_DSAR,32,DATA) -#define MCF5272_WR_DMA_DDAR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_DMA_DDAR,32,DATA) - -/* Bit level definitions and macros */ -#define MCF5272_DMA_DCMR_RESET (0x80000000) -#define MCF5272_DMA_DCMR_EN (0x40000000) -#define MCF5272_DMA_DCMR_RQM (0x000C0000) -#define MCF5272_DMA_DCMR_DSTM_INC (0x00002000) -#define MCF5272_DMA_DCMR_DSTT_UD (0x00000400) -#define MCF5272_DMA_DCMR_DSTT_UC (0x00000800) -#define MCF5272_DMA_DCMR_DSTT_SD (0x00001400) -#define MCF5272_DMA_DCMR_DSTT_SC (0x00001800) -#define MCF5272_DMA_DCMR_DSTS_LW (0x00000000) -#define MCF5272_DMA_DCMR_DSTS_B (0x00000100) -#define MCF5272_DMA_DCMR_DSTS_W (0x00000200) -#define MCF5272_DMA_DCMR_DSTS_LINE (0x00000300) -#define MCF5272_DMA_DCMR_SRCM_INC (0x00000020) -#define MCF5272_DMA_DCMR_SRCT_UD (0x00000004) -#define MCF5272_DMA_DCMR_SRCT_UC (0x00000008) -#define MCF5272_DMA_DCMR_SRCT_SD (0x00000014) -#define MCF5272_DMA_DCMR_SRCT_SC (0x00000018) -#define MCF5272_DMA_DCMR_SRCS_LW (0x00000000) -#define MCF5272_DMA_DCMR_SRCS_B (0x00000001) -#define MCF5272_DMA_DCMR_SRCS_W (0x00000002) -#define MCF5272_DMA_DCMR_SRCS_LINE (0x00000003) -#define MCF5272_DMA_DCIR_INVEN (0x1000) -#define MCF5272_DMA_DCIR_ASCEN (0x0800) -#define MCF5272_DMA_DCIR_TEEN (0x0200) -#define MCF5272_DMA_DCIR_TCEN (0x0100) -#define MCF5272_DMA_DCIR_INV (0x0010) -#define MCF5272_DMA_DCIR_ASC (0x0008) -#define MCF5272_DMA_DCIR_TE (0x0002) -#define MCF5272_DMA_DCIR_TC (0x0001) - -/********************************************************************** -* -* USART Module Registers Description -* -***********************************************************************/ - -/* Offsets of the registers from the MBAR */ -#define MCF5272_UART0_UMR (0x0100) /* RW */ -#define MCF5272_UART0_USR (0x0104) /* USR RO, UCSR WO */ -#define MCF5272_UART0_UCR (0x0108) /* WO */ -#define MCF5272_UART0_UBUF (0x010C) /* URB RO, UTB WO */ -#define MCF5272_UART0_UCCR (0x0110) /* UCCR RO, UACR WO */ -#define MCF5272_UART0_UISR (0x0114) /* UISR RO, UIMR WO */ -#define MCF5272_UART0_UBG1 (0x0118) /* WO */ -#define MCF5272_UART0_UBG2 (0x011C) /* WO */ -#define MCF5272_UART0_UABR1 (0x0120) /* RO */ -#define MCF5272_UART0_UABR2 (0x0124) /* RO */ -#define MCF5272_UART0_UTFCSR (0x0128) /* RW */ -#define MCF5272_UART0_URFCSR (0x012C) /* RW */ -#define MCF5272_UART0_UIP (0x0134) /* RO */ -#define MCF5272_UART0_UOP1 (0x0138) /* WO */ -#define MCF5272_UART0_UOP0 (0x013C) /* WO */ - -#define MCF5272_UART1_UMR (0x0140) /* RW */ -#define MCF5272_UART1_USR (0x0144) /* USR RO, UCSR WO */ -#define MCF5272_UART1_UCR (0x0148) /* WO */ -#define MCF5272_UART1_UBUF (0x014C) /* URB RO, UTB WO */ -#define MCF5272_UART1_UCCR (0x0150) /* UCCR RO, UACR WO */ -#define MCF5272_UART1_UISR (0x0154) /* UISR RO, UIMR WO */ -#define MCF5272_UART1_UBG1 (0x0158) /* WO */ -#define MCF5272_UART1_UBG2 (0x015C) /* WO */ -#define MCF5272_UART1_UABR1 (0x0160) /* RO */ -#define MCF5272_UART1_UABR2 (0x0164) /* RO */ -#define MCF5272_UART1_UTFCSR (0x0168) /* RW */ -#define MCF5272_UART1_URFCSR (0x016C) /* RW */ -#define MCF5272_UART1_UIP (0x0174) /* RO */ -#define MCF5272_UART1_UOP1 (0x0178) /* WO */ -#define MCF5272_UART1_UOP0 (0x017C) /* WO */ - -/* Read access macros for general use */ -#define MCF5272_RD_UART0_UMR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_UART0_UMR,8) -#define MCF5272_RD_UART0_USR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_UART0_USR,8) -#define MCF5272_RD_UART0_URB(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_UART0_UBUF,8) -#define MCF5272_RD_UART0_UCCR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_UART0_UCCR,8) -#define MCF5272_RD_UART0_UISR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_UART0_UISR,8) -#define MCF5272_RD_UART0_UABR1(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_UART0_UABR1,8) -#define MCF5272_RD_UART0_UABR2(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_UART1_UABR2,8) -#define MCF5272_RD_UART0_UTFCSR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_UART0_UTFCSR,8) -#define MCF5272_RD_UART0_URFCSR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_UART0_URFCSR,8) -#define MCF5272_RD_UART0_UIP(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_UART0_UIP,8) - -#define MCF5272_RD_UART1_UMR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_UART1_UMR,8) -#define MCF5272_RD_UART1_USR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_UART1_USR,8) -#define MCF5272_RD_UART1_URB(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_UART1_UBUF,8) -#define MCF5272_RD_UART1_UCCR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_UART1_UCCR,8) -#define MCF5272_RD_UART1_UISR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_UART1_UISR,8) -#define MCF5272_RD_UART1_UABR1(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_UART1_UABR1,8) -#define MCF5272_RD_UART1_UABR2(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_UART1_UABR2,8) -#define MCF5272_RD_UART1_UTFCSR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_UART1_UTFCSR,8) -#define MCF5272_RD_UART1_URFCSR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_UART1_URFCSR,8) -#define MCF5272_RD_UART1_UIP(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_UART1_UIP,8) - -/* Write access macros for general use */ -#define MCF5272_WR_UART0_UMR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_UART0_UMR,8,DATA) -#define MCF5272_WR_UART0_UCSR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_UART0_USR,8,DATA) -#define MCF5272_WR_UART0_UCR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_UART0_UCR,8,DATA) -#define MCF5272_WR_UART0_UTB(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_UART0_UBUF,8,DATA) -#define MCF5272_WR_UART0_UACR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_UART0_UCCR,8,DATA) -#define MCF5272_WR_UART0_UIMR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_UART0_UISR,8,DATA) -#define MCF5272_WR_UART0_UBG1(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_UART0_UBG1,8,DATA) -#define MCF5272_WR_UART0_UBG2(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_UART0_UBG2,8,DATA) -#define MCF5272_WR_UART0_UTFCSR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_UART0_UTFCSR,8,DATA) -#define MCF5272_WR_UART0_URFCSR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_UART0_URFCSR,8,DATA) -#define MCF5272_WR_UART0_UOP1(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_UART0_UOP1,8,DATA) -#define MCF5272_WR_UART0_UOP0(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_UART0_UOP0,8,DATA) - -#define MCF5272_WR_UART1_UMR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_UART1_UMR,8,DATA) -#define MCF5272_WR_UART1_UCSR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_UART1_USR,8,DATA) -#define MCF5272_WR_UART1_UCR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_UART1_UCR,8,DATA) -#define MCF5272_WR_UART1_UTB(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_UART1_UBUF,8,DATA) -#define MCF5272_WR_UART1_UACR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_UART1_UCCR,8,DATA) -#define MCF5272_WR_UART1_UIMR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_UART1_UISR,8,DATA) -#define MCF5272_WR_UART1_UBG1(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_UART1_UBG1,8,DATA) -#define MCF5272_WR_UART1_UBG2(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_UART1_UBG2,8,DATA) -#define MCF5272_WR_UART1_UTFCSR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_UART1_UTFCSR,8,DATA) -#define MCF5272_WR_UART1_URFCSR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_UART1_URFCSR,8,DATA) -#define MCF5272_WR_UART1_UOP1(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_UART1_UOP1,8,DATA) -#define MCF5272_WR_UART1_UOP0(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_UART1_UOP0,8,DATA) - -/* Bit level definitions and macros */ -#define MCF5272_UART_UMR1_RXRTS (0x80) -#define MCF5272_UART_UMR1_RXIRQ (0x40) -#define MCF5272_UART_UMR1_ERR (0x20) -#define MCF5272_UART_UMR1_PM_MULTI_ADDR (0x1C) -#define MCF5272_UART_UMR1_PM_MULTI_DATA (0x18) -#define MCF5272_UART_UMR1_PM_NONE (0x10) -#define MCF5272_UART_UMR1_PM_FORCE_HI (0x0C) -#define MCF5272_UART_UMR1_PM_FORCE_LO (0x08) -#define MCF5272_UART_UMR1_PM_ODD (0x04) -#define MCF5272_UART_UMR1_PM_EVEN (0x00) -#define MCF5272_UART_UMR1_BC_5 (0x00) -#define MCF5272_UART_UMR1_BC_6 (0x01) -#define MCF5272_UART_UMR1_BC_7 (0x02) -#define MCF5272_UART_UMR1_BC_8 (0x03) - -#define MCF5272_UART_UMR2_CM_NORMAL (0x00) -#define MCF5272_UART_UMR2_CM_ECHO (0x40) -#define MCF5272_UART_UMR2_CM_LOCAL_LOOP (0x80) -#define MCF5272_UART_UMR2_CM_REMOTE_LOOP (0xC0) -#define MCF5272_UART_UMR2_TXRTS (0x20) -#define MCF5272_UART_UMR2_TXCTS (0x10) -#define MCF5272_UART_UMR2_STOP_BITS_1 (0x07) -#define MCF5272_UART_UMR2_STOP_BITS_15 (0x08) -#define MCF5272_UART_UMR2_STOP_BITS_2 (0x0F) -#define MCF5272_UART_UMR2_STOP_BITS(a) ((a)&0x0f) /* Stop Bit Length */ - -#define MCF5272_UART_USR_RB (0x80) -#define MCF5272_UART_USR_FE (0x40) -#define MCF5272_UART_USR_PE (0x20) -#define MCF5272_UART_USR_OE (0x10) -#define MCF5272_UART_USR_TXEMP (0x08) -#define MCF5272_UART_USR_TXRDY (0x04) -#define MCF5272_UART_USR_FFULL (0x02) -#define MCF5272_UART_USR_RXRDY (0x01) - -#define MCF5272_UART_UCSR_RCS(a) (((a)&0x0f)<<4) /* Rx Clk Select */ -#define MCF5272_UART_UCSR_TCS(a) ((a)&0x0f) /* Tx Clk Select */ - - -#define MCF5272_UART_UCR_NONE (0x00) -#define MCF5272_UART_UCR_STOP_BREAK (0x70) -#define MCF5272_UART_UCR_START_BREAK (0x60) -#define MCF5272_UART_UCR_RESET_BKCHGINT (0x50) -#define MCF5272_UART_UCR_RESET_ERROR (0x40) -#define MCF5272_UART_UCR_RESET_TX (0x30) -#define MCF5272_UART_UCR_RESET_RX (0x20) -#define MCF5272_UART_UCR_RESET_MR (0x10) -#define MCF5272_UART_UCR_TX_DISABLED (0x08) -#define MCF5272_UART_UCR_TX_ENABLED (0x04) -#define MCF5272_UART_UCR_RX_DISABLED (0x02) -#define MCF5272_UART_UCR_RX_ENABLED (0x01) - -#define MCF5272_UART_UCCR_COS (0x10) -#define MCF5272_UART_UCCR_CTS (0x01) - -#define MCF5272_UART_UACR_BRG (0x80) -#define MCF5272_UART_UACR_CTMS_TIMER (0x60) -#define MCF5272_UART_UACR_IEC (0x01) - -#define MCF5272_UART_UISR_COS (0x80) -#define MCF5272_UART_UISR_DB (0x04) -#define MCF5272_UART_UISR_RXRDY (0x02) -#define MCF5272_UART_UISR_TXRDY (0x01) - -#define MCF5272_UART_UIMR_COS (0x80) -#define MCF5272_UART_UIMR_DB (0x04) -#define MCF5272_UART_UIMR_FFULL (0x02) -#define MCF5272_UART_UIMR_TXRDY (0x01) - - -/********************************************************************** -* -* SDRAM Controller Module Registers Description -* -***********************************************************************/ - -/* Offsets of the registers from the MBAR */ -#define MCF5272_SDRAMC_SDCCR (0x0180) -#define MCF5272_SDRAMC_SDCTR (0x0184) - -/* Read access macros for general use */ -#define MCF5272_RD_SDRAMC_SDCCR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_SDRAMC_SDCCR,32) -#define MCF5272_RD_SDRAMC_SDCTR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_SDRAMC_SDCTR,32) - -/* Write access macros for general use */ -#define MCF5272_WR_SDRAMC_SDCCR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_SDRAMC_SDCCR,32,DATA) -#define MCF5272_WR_SDRAMC_SDCTR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_SDRAMC_SDCTR,32,DATA) - -/* Bit level definitions and macros */ -#define MCF5272_SDRAMC_SDCCR_MCAS_A7 (0x0 << 13) -#define MCF5272_SDRAMC_SDCCR_MCAS_A8 (0x1 << 13) -#define MCF5272_SDRAMC_SDCCR_MCAS_A9 (0x2 << 13) -#define MCF5272_SDRAMC_SDCCR_MCAS_A10 (0x3 << 13) -#define MCF5272_SDRAMC_SDCCR_BALOC_A19 (0x0 << 8) -#define MCF5272_SDRAMC_SDCCR_BALOC_A20 (0x1 << 8) -#define MCF5272_SDRAMC_SDCCR_BALOC_A21 (0x2 << 8) -#define MCF5272_SDRAMC_SDCCR_BALOC_A22 (0x3 << 8) -#define MCF5272_SDRAMC_SDCCR_BALOC_A23 (0x4 << 8) -#define MCF5272_SDRAMC_SDCCR_BALOC_A24 (0x5 << 8) -#define MCF5272_SDRAMC_SDCCR_BALOC_A25 (0x6 << 8) -#define MCF5272_SDRAMC_SDCCR_BALOC_A26 (0x7 << 8) -#define MCF5272_SDRAMC_SDCCR_GSL (0x00000080) -#define MCF5272_SDRAMC_SDCCR_REG (0x00000010) -#define MCF5272_SDRAMC_SDCCR_INV (0x00000008) -#define MCF5272_SDRAMC_SDCCR_SLEEP (0x00000004) -#define MCF5272_SDRAMC_SDCCR_ACT (0x00000002) -#define MCF5272_SDRAMC_SDCCR_INIT (0x00000001) - -#define MCF5272_SDRAMC_SDCTR_RTP_66MHz (0x3D << 10) -#define MCF5272_SDRAMC_SDCTR_RTP_48MHz (0x2B << 10) -#define MCF5272_SDRAMC_SDCTR_RTP_33MHz (0x1D << 10) -#define MCF5272_SDRAMC_SDCTR_RTP_25MHz (0x16 << 10) -#define MCF5272_SDRAMC_SDCTR_RC(x) ((x & 0x3) << 8) -#define MCF5272_SDRAMC_SDCTR_RP(x) ((x & 0x3) << 4) -#define MCF5272_SDRAMC_SDCTR_RCD(x) ((x & 0x3) << 2) -#define MCF5272_SDRAMC_SDCTR_CLT_2 (0x00000001) -#define MCF5272_SDRAMC_SDCTR_CLT_3 (0x00000002) -#define MCF5272_SDRAMC_SDCTR_CLT_4 (0x00000003) - -/********************************************************************** -* -* Timer Module Registers Description -* -***********************************************************************/ - -/* Offsets of the registers from the MBAR */ -#define MCF5272_TIMER0_TMR (0x0200) -#define MCF5272_TIMER0_TRR (0x0204) -#define MCF5272_TIMER0_TCR (0x0208) -#define MCF5272_TIMER0_TCN (0x020C) -#define MCF5272_TIMER0_TER (0x0210) -#define MCF5272_TIMER1_TMR (0x0220) -#define MCF5272_TIMER1_TRR (0x0224) -#define MCF5272_TIMER1_TCR (0x0228) -#define MCF5272_TIMER1_TCN (0x022C) -#define MCF5272_TIMER1_TER (0x0230) -#define MCF5272_TIMER2_TMR (0x0240) -#define MCF5272_TIMER2_TRR (0x0244) -#define MCF5272_TIMER2_TCR (0x0248) -#define MCF5272_TIMER2_TCN (0x024C) -#define MCF5272_TIMER2_TER (0x0250) -#define MCF5272_TIMER3_TMR (0x0260) -#define MCF5272_TIMER3_TRR (0x0264) -#define MCF5272_TIMER3_TCR (0x0268) -#define MCF5272_TIMER3_TCN (0x026C) -#define MCF5272_TIMER3_TER (0x0270) -#define MCF5272_TIMER_WRRR (0x0280) -#define MCF5272_TIMER_WIRR (0x0284) -#define MCF5272_TIMER_WCR (0x0288) -#define MCF5272_TIMER_WER (0x028C) - -/* Read access macros for general use */ -#define MCF5272_RD_TIMER0_TMR(IMMP) Mcf5272_iord(IMMP,MCF5272_TIMER0_TMR,16) -#define MCF5272_RD_TIMER0_TRR(IMMP) Mcf5272_iord(IMMP,MCF5272_TIMER0_TRR,16) -#define MCF5272_RD_TIMER0_TCR(IMMP) Mcf5272_iord(IMMP,MCF5272_TIMER0_TCR,16) -#define MCF5272_RD_TIMER0_TCN(IMMP) Mcf5272_iord(IMMP,MCF5272_TIMER0_TCN,16) -#define MCF5272_RD_TIMER0_TER(IMMP) Mcf5272_iord(IMMP,MCF5272_TIMER0_TER,16) - -#define MCF5272_RD_TIMER1_TMR(IMMP) Mcf5272_iord(IMMP,MCF5272_TIMER1_TMR,16) -#define MCF5272_RD_TIMER1_TRR(IMMP) Mcf5272_iord(IMMP,MCF5272_TIMER1_TRR,16) -#define MCF5272_RD_TIMER1_TCR(IMMP) Mcf5272_iord(IMMP,MCF5272_TIMER1_TCR,16) -#define MCF5272_RD_TIMER1_TCN(IMMP) Mcf5272_iord(IMMP,MCF5272_TIMER1_TCN,16) -#define MCF5272_RD_TIMER1_TER(IMMP) Mcf5272_iord(IMMP,MCF5272_TIMER1_TER,16) - -#define MCF5272_RD_TIMER2_TMR(IMMP) Mcf5272_iord(IMMP,MCF5272_TIMER2_TMR,16) -#define MCF5272_RD_TIMER2_TRR(IMMP) Mcf5272_iord(IMMP,MCF5272_TIMER2_TRR,16) -#define MCF5272_RD_TIMER2_TCR(IMMP) Mcf5272_iord(IMMP,MCF5272_TIMER2_TCR,16) -#define MCF5272_RD_TIMER2_TCN(IMMP) Mcf5272_iord(IMMP,MCF5272_TIMER2_TCN,16) -#define MCF5272_RD_TIMER2_TER(IMMP) Mcf5272_iord(IMMP,MCF5272_TIMER2_TER,16) - -#define MCF5272_RD_TIMER3_TMR(IMMP) Mcf5272_iord(IMMP,MCF5272_TIMER3_TMR,16) -#define MCF5272_RD_TIMER3_TRR(IMMP) Mcf5272_iord(IMMP,MCF5272_TIMER3_TRR,16) -#define MCF5272_RD_TIMER3_TCR(IMMP) Mcf5272_iord(IMMP,MCF5272_TIMER3_TCR,16) -#define MCF5272_RD_TIMER3_TCN(IMMP) Mcf5272_iord(IMMP,MCF5272_TIMER3_TCN,16) -#define MCF5272_RD_TIMER3_TER(IMMP) Mcf5272_iord(IMMP,MCF5272_TIMER3_TER,16) - -#define MCF5272_RD_TIMER_TMR(IMMP,NUM) \ -Mcf5272_iord(IMMP,MCF5272_TIMER0_TMR + (NUM * 0x20),16) -#define MCF5272_RD_TIMER_TRR(IMMP,NUM) \ -Mcf5272_iord(IMMP,MCF5272_TIMER0_TRR + (NUM * 0x20),16) -#define MCF5272_RD_TIMER_TCR(IMMP,NUM) \ -Mcf5272_iord(IMMP,MCF5272_TIMER0_TCR + (NUM * 0x20),16) -#define MCF5272_RD_TIMER_TCN(IMMP,NUM) \ -Mcf5272_iord(IMMP,MCF5272_TIMER0_TCN + (NUM * 0x20),16) -#define MCF5272_RD_TIMER_TER(IMMP,NUM) \ -Mcf5272_iord(IMMP,MCF5272_TIMER0_TER + (NUM * 0x20),16) - -#define MCF5272_RD_TIMER_WRRR(IMMP) Mcf5272_iord(IMMP,MCF5272_TIMER_WRRR,16) -#define MCF5272_RD_TIMER_WIRR(IMMP) Mcf5272_iord(IMMP,MCF5272_TIMER_WIRR,16) -#define MCF5272_RD_TIMER_WCR(IMMP) Mcf5272_iord(IMMP,MCF5272_TIMER_WCR,16) -#define MCF5272_RD_TIMER_WER(IMMP) Mcf5272_iord(IMMP,MCF5272_TIMER_WER,16) - -/* Write access macros for general use */ -#define MCF5272_WR_TIMER0_TMR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_TIMER0_TMR,16,DATA) -#define MCF5272_WR_TIMER0_TRR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_TIMER0_TRR,16,DATA) -#define MCF5272_WR_TIMER0_TCN(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_TIMER0_TCN,16,DATA) -#define MCF5272_WR_TIMER0_TER(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_TIMER0_TER,16,DATA) -#define MCF5272_WR_TIMER1_TMR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_TIMER1_TMR,16,DATA) -#define MCF5272_WR_TIMER1_TRR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_TIMER1_TRR,16,DATA) -#define MCF5272_WR_TIMER1_TCN(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_TIMER1_TCN,16,DATA) -#define MCF5272_WR_TIMER1_TER(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_TIMER1_TER,16,DATA) -#define MCF5272_WR_TIMER2_TMR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_TIMER2_TMR,16,DATA) -#define MCF5272_WR_TIMER2_TRR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_TIMER2_TRR,16,DATA) -#define MCF5272_WR_TIMER2_TCN(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_TIMER2_TCN,16,DATA) -#define MCF5272_WR_TIMER2_TER(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_TIMER2_TER,16,DATA) -#define MCF5272_WR_TIMER3_TMR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_TIMER3_TMR,16,DATA) -#define MCF5272_WR_TIMER3_TRR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_TIMER3_TRR,16,DATA) -#define MCF5272_WR_TIMER3_TCN(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_TIMER3_TCN,16,DATA) -#define MCF5272_WR_TIMER3_TER(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_TIMER3_TER,16,DATA) -#define MCF5272_WR_TIMER_WRRR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_TIMER_WRRR,16,DATA) -#define MCF5272_WR_TIMER_WIRR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_TIMER_WIRR,16,DATA) -#define MCF5272_WR_TIMER_WCR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_TIMER_WCR,16,DATA) -#define MCF5272_WR_TIMER_WER(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_TIMER_WER,16,DATA) - -#define MCF5272_WR_TIMER_TMR(IMMP,NUM,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_TIMER0_TMR + (NUM * 0x20),16,DATA) -#define MCF5272_WR_TIMER_TRR(IMMP,NUM,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_TIMER0_TRR + (NUM * 0x20),16,DATA) -#define MCF5272_WR_TIMER_TCN(IMMP,NUM,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_TIMER0_TCN + (NUM * 0x20),16,DATA) -#define MCF5272_WR_TIMER_TER(IMMP,NUM,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_TIMER0_TER + (NUM * 0x20),16,DATA) - -/* Bit level definitions and macros */ -#define MCF5272_TIMER_TMR_PS(a) (((a)&0x00FF)<<8) -#define MCF5272_TIMER_TMR_CE_ANY (0x00C0) -#define MCF5272_TIMER_TMR_CE_RISE (0x0080) -#define MCF5272_TIMER_TMR_CE_FALL (0x0040) -#define MCF5272_TIMER_TMR_CE_NONE (0x0000) -#define MCF5272_TIMER_TMR_OM (0x0020) -#define MCF5272_TIMER_TMR_ORI (0x0010) -#define MCF5272_TIMER_TMR_FRR (0x0008) -#define MCF5272_TIMER_TMR_CLK_TIN (0x0006) -#define MCF5272_TIMER_TMR_CLK_DIV16 (0x0004) -#define MCF5272_TIMER_TMR_CLK_MSCLK (0x0002) -#define MCF5272_TIMER_TMR_CLK_STOP (0x0000) -#define MCF5272_TIMER_TMR_RST (0x0001) - -#define MCF5272_TIMER_TER_REF (0x02) -#define MCF5272_TIMER_TER_CAP (0x01) - -/********************************************************************** -* -* PLI Module Registers Description -* -***********************************************************************/ - -/* Offsets of the registers from the MBAR */ -#define MCF5272_PLI_P0B1RR (0x0300) -#define MCF5272_PLI_P1B1RR (0x0304) -#define MCF5272_PLI_P2B1RR (0x0308) -#define MCF5272_PLI_P3B1RR (0x030C) -#define MCF5272_PLI_P0B2RR (0x0310) -#define MCF5272_PLI_P1B2RR (0x0314) -#define MCF5272_PLI_P2B2RR (0x0318) -#define MCF5272_PLI_P3B2RR (0x031C) -#define MCF5272_PLI_P0DRR (0x0320) -#define MCF5272_PLI_P1DRR (0x0321) -#define MCF5272_PLI_P2DRR (0x0322) -#define MCF5272_PLI_P3DRR (0x0323) -#define MCF5272_PLI_P0B1TR (0x0328) -#define MCF5272_PLI_P1B1TR (0x032C) -#define MCF5272_PLI_P2B1TR (0x0330) -#define MCF5272_PLI_P3B1TR (0x0334) -#define MCF5272_PLI_P0B2TR (0x0338) -#define MCF5272_PLI_P1B2TR (0x033C) -#define MCF5272_PLI_P2B2TR (0x0340) -#define MCF5272_PLI_P3B2TR (0x0344) -#define MCF5272_PLI_P0DTR (0x0348) -#define MCF5272_PLI_P1DTR (0x0349) -#define MCF5272_PLI_P2DTR (0x034A) -#define MCF5272_PLI_P3DTR (0x034B) -#define MCF5272_PLI_P0CR (0x0350) -#define MCF5272_PLI_P1CR (0x0352) -#define MCF5272_PLI_P2CR (0x0354) -#define MCF5272_PLI_P3CR (0x0356) -#define MCF5272_PLI_P0ICR (0x0358) -#define MCF5272_PLI_P1ICR (0x035A) -#define MCF5272_PLI_P2ICR (0x035C) -#define MCF5272_PLI_P3ICR (0x035E) -#define MCF5272_PLI_P0GMR (0x0360) -#define MCF5272_PLI_P1GMR (0x0362) -#define MCF5272_PLI_P2GMR (0x0364) -#define MCF5272_PLI_P3GMR (0x0366) -#define MCF5272_PLI_P0GMT (0x0368) -#define MCF5272_PLI_P1GMT (0x036A) -#define MCF5272_PLI_P2GMT (0x036C) -#define MCF5272_PLI_P3GMT (0x036E) -#define MCF5272_PLI_PGMTS (0x0371) -#define MCF5272_PLI_PGMTA (0x0372) -#define MCF5272_PLI_P0GCIR (0x0374) -#define MCF5272_PLI_P1GCIR (0x0375) -#define MCF5272_PLI_P2GCIR (0x0376) -#define MCF5272_PLI_P3GCIR (0x0377) -#define MCF5272_PLI_P0GCIT (0x0378) -#define MCF5272_PLI_P1GCIT (0x0379) -#define MCF5272_PLI_P2GCIT (0x037A) -#define MCF5272_PLI_P3GCIT (0x037E) -#define MCF5272_PLI_PGCITSR (0x037F) -#define MCF5272_PLI_PDSUSR (0x0382) -#define MCF5272_PLI_PDCSR (0x0383) -#define MCF5272_PLI_P0PSR (0x0384) -#define MCF5272_PLI_P1PSR (0x0386) -#define MCF5272_PLI_P2PSR (0x0388) -#define MCF5272_PLI_P3PSR (0x038A) -#define MCF5272_PLI_PASR (0x038C) -#define MCF5272_PLI_PLCR (0x038F) -#define MCF5272_PLI_PDRQR (0x0392) -#define MCF5272_PLI_P0SDR (0x0394) -#define MCF5272_PLI_P1SDR (0x0396) -#define MCF5272_PLI_P2SDR (0x0398) -#define MCF5272_PLI_P3SDR (0x039A) -#define MCF5272_PLI_PCKSELR (0x039E) - -/* Read access macros for general use */ -#define MCF5272_RD_PLI_P0B1RR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P0B1RR,32) -#define MCF5272_RD_PLI_P1B1RR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P1B1RR,32) -#define MCF5272_RD_PLI_P2B1RR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P2B1RR,32) -#define MCF5272_RD_PLI_P3B1RR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P3B1RR,32) -#define MCF5272_RD_PLI_P0B2RR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P0B2RR,32) -#define MCF5272_RD_PLI_P1B2RR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P1B2RR,32) -#define MCF5272_RD_PLI_P2B2RR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P2B2RR,32) -#define MCF5272_RD_PLI_P3B2RR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P3B2RR,32) -#define MCF5272_RD_PLI_P0DRR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P0DRR,8) -#define MCF5272_RD_PLI_P1DRR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P1DRR,8) -#define MCF5272_RD_PLI_P2DRR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P2DRR,8) -#define MCF5272_RD_PLI_P3DRR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P3DRR,8) -#define MCF5272_RD_PLI_P0B1TR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P0B1TR,32) -#define MCF5272_RD_PLI_P1B1TR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P1B1TR,32) -#define MCF5272_RD_PLI_P2B1TR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P2B1TR,32) -#define MCF5272_RD_PLI_P3B1TR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P3B1TR,32) -#define MCF5272_RD_PLI_P0B2TR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P0B2TR,32) -#define MCF5272_RD_PLI_P1B2TR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P1B2TR,32) -#define MCF5272_RD_PLI_P2B2TR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P2B2TR,32) -#define MCF5272_RD_PLI_P3B2TR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P3B2TR,32) -#define MCF5272_RD_PLI_P0DTR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P0DTR,8) -#define MCF5272_RD_PLI_P1DTR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P1DTR,8) -#define MCF5272_RD_PLI_P2DTR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P2DTR,8) -#define MCF5272_RD_PLI_P3DTR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P3DTR,8) -#define MCF5272_RD_PLI_P0CR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P0CR,16) -#define MCF5272_RD_PLI_P1CR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P1CR,16) -#define MCF5272_RD_PLI_P2CR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P2CR,16) -#define MCF5272_RD_PLI_P3CR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P3CR,16) -#define MCF5272_RD_PLI_P0ICR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P0ICR,16) -#define MCF5272_RD_PLI_P1ICR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P1ICR,16) -#define MCF5272_RD_PLI_P2ICR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P2ICR,16) -#define MCF5272_RD_PLI_P3ICR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P3ICR,16) -#define MCF5272_RD_PLI_P0GMR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P0GMR,16) -#define MCF5272_RD_PLI_P1GMR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P1GMR,16) -#define MCF5272_RD_PLI_P2GMR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P2GMR,16) -#define MCF5272_RD_PLI_P3GMR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P3GMR,16) -#define MCF5272_RD_PLI_P0GMT(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P0GMT,16) -#define MCF5272_RD_PLI_P1GMT(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P1GMT,16) -#define MCF5272_RD_PLI_P2GMT(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P2GMT,16) -#define MCF5272_RD_PLI_P3GMT(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P3GMT,16) -#define MCF5272_RD_PLI_PGMTS(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_PGMTS,8) -#define MCF5272_RD_PLI_PGMTA(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_PGMTA,8) -#define MCF5272_RD_PLI_P0GCIR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P0GCIR,8) -#define MCF5272_RD_PLI_P1GCIR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P1GCIR,8) -#define MCF5272_RD_PLI_P2GCIR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P2GCIR,8) -#define MCF5272_RD_PLI_P3GCIR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P3GCIR,8) -#define MCF5272_RD_PLI_P0GCIT(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P0GCIT,8) -#define MCF5272_RD_PLI_P1GCIT(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P1GCIT,8) -#define MCF5272_RD_PLI_P2GCIT(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P2GCIT,8) -#define MCF5272_RD_PLI_P3GCIT(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P3GCIT,8) -#define MCF5272_RD_PLI_PGCITSR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_PGCITSR,8) -#define MCF5272_RD_PLI_PDSUSR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_PDSUSR,8) -#define MCF5272_RD_PLI_PDCSR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_PDCSR,8) -#define MCF5272_RD_PLI_P0PSR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P0PSR,16) -#define MCF5272_RD_PLI_P1PSR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P1PSR,16) -#define MCF5272_RD_PLI_P2PSR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P2PSR,16) -#define MCF5272_RD_PLI_P3PSR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P3PSR,16) -#define MCF5272_RD_PLI_PASR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_PASR,16) -#define MCF5272_RD_PLI_PLCR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_PLCR,8) -#define MCF5272_RD_PLI_PDRQR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_PDRQR,16) -#define MCF5272_RD_PLI_P0SDR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P0SDR,16) -#define MCF5272_RD_PLI_P1SDR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P1SDR,16) -#define MCF5272_RD_PLI_P2SDR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P2SDR,16) -#define MCF5272_RD_PLI_P3SDR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_P3SDR,16) -#define MCF5272_RD_PLI_PCKSELR(IMMP) Mcf5272_iord(IMMP,MCF5272_PLI_PCKSELR,16) - -/* Write access macros for general use */ -#define MCF5272_WR_PLI_P0B1TR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P0B1TR,32,DATA) -#define MCF5272_WR_PLI_P1B1TR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P1B1TR,32,DATA) -#define MCF5272_WR_PLI_P2B1TR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P2B1TR,32,DATA) -#define MCF5272_WR_PLI_P3B1TR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P3B1TR,32,DATA) -#define MCF5272_WR_PLI_P0B2TR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P0B2TR,32,DATA) -#define MCF5272_WR_PLI_P1B2TR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P1B2TR,32,DATA) -#define MCF5272_WR_PLI_P2B2TR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P2B2TR,32,DATA) -#define MCF5272_WR_PLI_P3B2TR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P3B2TR,32,DATA) -#define MCF5272_WR_PLI_P0DTR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P0DTR,8,DATA) -#define MCF5272_WR_PLI_P1DTR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P1DTR,8,DATA) -#define MCF5272_WR_PLI_P2DTR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P2DTR,8,DATA) -#define MCF5272_WR_PLI_P3DTR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P3DTR,8,DATA) -#define MCF5272_WR_PLI_P0CR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P0CR,16,DATA) -#define MCF5272_WR_PLI_P1CR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P1CR,16,DATA) -#define MCF5272_WR_PLI_P2CR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P2CR,16,DATA) -#define MCF5272_WR_PLI_P3CR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P3CR,16,DATA) -#define MCF5272_WR_PLI_P0ICR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P0ICR,16,DATA) -#define MCF5272_WR_PLI_P1ICR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P1ICR,16,DATA) -#define MCF5272_WR_PLI_P2ICR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P2ICR,16,DATA) -#define MCF5272_WR_PLI_P3ICR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P3ICR,16,DATA) -#define MCF5272_WR_PLI_P0GMT(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P0GMR,16,DATA) -#define MCF5272_WR_PLI_P1GMT(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P1GMT,16,DATA) -#define MCF5272_WR_PLI_P2GMT(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P2GMT,16,DATA) -#define MCF5272_WR_PLI_P3GMT(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P3GMT,16,DATA) -#define MCF5272_WR_PLI_PGMTA(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_PGMTA,8,DATA) -#define MCF5272_WR_PLI_P0GCIT(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P0GCIT,8,DATA) -#define MCF5272_WR_PLI_P1GCIT(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P1GCIT,8,DATA) -#define MCF5272_WR_PLI_P2GCIT(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P2GCIT,8,DATA) -#define MCF5272_WR_PLI_P3GCIT(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P3GCIT,8,DATA) -#define MCF5272_WR_PLI_PLCR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_PLCR,8,DATA) -#define MCF5272_WR_PLI_PDRQR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_PDRQR,16,DATA) -#define MCF5272_WR_PLI_P0SDR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P0SDR,16,DATA) -#define MCF5272_WR_PLI_P1SDR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P1SDR,16,DATA) -#define MCF5272_WR_PLI_P2SDR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P2SDR,16,DATA) -#define MCF5272_WR_PLI_P3SDR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_P3SDR,16,DATA) -#define MCF5272_WR_PLI_PCKSELR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_PLI_PCKSELR,16,DATA) - - -/********************************************************************** -* -* Fast Ethernet Controller Module Register Descriptions -* -***********************************************************************/ - -/* Offsets of the registers from the MBAR */ -#define MCF5272_FEC_ECR (0x0840) -#define MCF5272_FEC_EIR (0x0844) -#define MCF5272_FEC_IMR (0x0848) -#define MCF5272_FEC_IVSR (0x084C) -#define MCF5272_FEC_RDAR (0x0850) -#define MCF5272_FEC_TDAR (0x0854) -#define MCF5272_FEC_MMFR (0x0880) -#define MCF5272_FEC_MSCR (0x0884) -#define MCF5272_FEC_FRBR (0x08CC) -#define MCF5272_FEC_FRSR (0x08D0) -#define MCF5272_FEC_TFWR (0x08E4) -#define MCF5272_FEC_FTSR (0x08EC) -#define MCF5272_FEC_RCR (0x0944) -#define MCF5272_FEC_MFLR (0x0948) -#define MCF5272_FEC_TCR (0x0984) -#define MCF5272_FEC_MALR (0x0C00) -#define MCF5272_FEC_MAUR (0x0C04) -#define MCF5272_FEC_HTUR (0x0C08) -#define MCF5272_FEC_HTLR (0x0C0C) -#define MCF5272_FEC_ERDSR (0x0C10) -#define MCF5272_FEC_ETDSR (0x0C14) -#define MCF5272_FEC_EMRBR (0x0C18) -#define MCF5272_FEC_EFIFO (0x0C40) /* 0x0C40 - 0x0DFF */ - -/* Read access macros for general use */ -#define MCF5272_RD_FEC_ECR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_FEC_ECR,32) -#define MCF5272_RD_FEC_EIR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_FEC_EIR,32) -#define MCF5272_RD_FEC_IMR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_FEC_IMR,32) -#define MCF5272_RD_FEC_IVSR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_FEC_IVSR,32) -#define MCF5272_RD_FEC_RDAR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_FEC_RDAR,32) -#define MCF5272_RD_FEC_TDAR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_FEC_TDAR,32) -#define MCF5272_RD_FEC_MMFR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_FEC_MMFR,32) -#define MCF5272_RD_FEC_MSCR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_FEC_MSCR,32) -#define MCF5272_RD_FEC_FRBR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_FEC_FRBR,32) -#define MCF5272_RD_FEC_FRSR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_FEC_FRSR,32) -#define MCF5272_RD_FEC_TFWR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_FEC_TFWR,32) -#define MCF5272_RD_FEC_FTSR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_FEC_FTSR,32) -#define MCF5272_RD_FEC_RCR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_FEC_RCR,32) -#define MCF5272_RD_FEC_MFLR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_FEC_MFLR,32) -#define MCF5272_RD_FEC_TCR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_FEC_TCR,32) -#define MCF5272_RD_FEC_MALR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_FEC_MALR,32) -#define MCF5272_RD_FEC_MAUR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_FEC_MAUR,32) -#define MCF5272_RD_FEC_HTUR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_FEC_HTUR,32) -#define MCF5272_RD_FEC_HTLR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_FEC_HTLR,32) -#define MCF5272_RD_FEC_ERDSR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_FEC_ERDSR,32) -#define MCF5272_RD_FEC_ETDSR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_FEC_ETDSR,32) -#define MCF5272_RD_FEC_EMRBR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_FEC_EMRBR,32) - -/* Write access macros for general use */ -#define MCF5272_WR_FEC_ECR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_FEC_ECR,32,DATA) -#define MCF5272_WR_FEC_EIR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_FEC_EIR,32,DATA) -#define MCF5272_WR_FEC_IMR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_FEC_IMR,32,DATA) -#define MCF5272_WR_FEC_RDAR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_FEC_RDAR,32,DATA) -#define MCF5272_WR_FEC_TDAR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_FEC_TDAR,32,DATA) -#define MCF5272_WR_FEC_MMFR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_FEC_MMFR,32,DATA) -#define MCF5272_WR_FEC_MSCR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_FEC_MSCR,32,DATA) -#define MCF5272_WR_FEC_FRSR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_FEC_FRSR,32,DATA) -#define MCF5272_WR_FEC_TFWR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_FEC_TFWR,32,DATA) -#define MCF5272_WR_FEC_FTSR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_FEC_FTSR,32,DATA) -#define MCF5272_WR_FEC_RCR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_FEC_RCR,32,DATA) -#define MCF5272_WR_FEC_MFLR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_FEC_MFLR,32,DATA) -#define MCF5272_WR_FEC_TCR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_FEC_TCR,32,DATA) -#define MCF5272_WR_FEC_MALR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_FEC_MALR,32,DATA) -#define MCF5272_WR_FEC_MAUR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_FEC_MAUR,32,DATA) -#define MCF5272_WR_FEC_HTUR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_FEC_HTUR,32,DATA) -#define MCF5272_WR_FEC_HTLR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_FEC_HTLR,32,DATA) -#define MCF5272_WR_FEC_ERDSR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_FEC_ERDSR,32,DATA) -#define MCF5272_WR_FEC_ETDSR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_FEC_ETDSR,32,DATA) -#define MCF5272_WR_FEC_EMRBR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_FEC_EMRBR,32,DATA) - - -/* Bit level definitions and macros */ -#define MCF5272_FEC_ECR_RESET (0x00000001) -#define MCF5272_FEC_ECR_ETHER_EN (0x00000002) -#define MCF5272_FEC_EIR_GRA (0x10000000) -#define MCF5272_FEC_EIR_RXF (0x02000000) -#define MCF5272_FEC_EIR_TXF (0x08000000) -#define MCF5272_FEC_IMR_HBEEN (0x80000000) -#define MCF5272_FEC_IMR_BREN (0x40000000) -#define MCF5272_FEC_IMR_BTEN (0x20000000) -#define MCF5272_FEC_IMR_GRAEN (0x10000000) -#define MCF5272_FEC_IMR_TXFEN (0x08000000) -#define MCF5272_FEC_IMR_TXBEN (0x04000000) -#define MCF5272_FEC_IMR_RXFEN (0x02000000) -#define MCF5272_FEC_IMR_RXBEN (0x01000000) -#define MCF5272_FEC_IMR_MIIEN (0x00800000) -#define MCF5272_FEC_IMR_EBERREN (0x00400000) -#define MCF5272_FEC_RCR_PROM (0x00000008) -#define MCF5272_FEC_RCR_MII_MODE (0x00000004) -#define MCF5272_FEC_RCR_DRT (0x00000002) -#define MCF5272_FEC_RCR_LOOP (0x00000001) -#define MCF5272_FEC_TCR_GTS (0x00000001) -#define MCF5272_FEC_TCR_HBC (0x00000002) -#define MCF5272_FEC_TCR_FDEN (0x00000004) -#define MCF5272_MMFR_MODE (0x00004000) -#define MCF5272_MMFR_DUPLEX (0x00000200) -#define MCF5272_MMFR_LOOP (0x00004000) -#define MCF5272_MMFR_NEGOTIATE (0x00001000) -#define MCF5272_MMFR_100 (0x00002000) - - -/* - * Bit level Buffer Descriptor definitions - */ - -#define MCF5272_FEC_TX_BD_R 0x8000 -#define MCF5272_FEC_TX_BD_INUSE 0x4000 -#define MCF5272_FEC_TX_BD_TO1 0x4000 -#define MCF5272_FEC_TX_BD_W 0x2000 -#define MCF5272_FEC_TX_BD_TO2 0x1000 -#define MCF5272_FEC_TX_BD_L 0x0800 -#define MCF5272_FEC_TX_BD_TC 0x0400 -#define MCF5272_FEC_TX_BD_DEF 0x0200 -#define MCF5272_FEC_TX_BD_HB 0x0100 -#define MCF5272_FEC_TX_BD_LC 0x0080 -#define MCF5272_FEC_TX_BD_RL 0x0040 -#define MCF5272_FEC_TX_BD_UN 0x0002 -#define MCF5272_FEC_TX_BD_CSL 0x0001 - -#define MCF5272_FEC_RX_BD_E 0x8000 -#define MCF5272_FEC_RX_BD_INUSE 0x4000 -#define MCF5272_FEC_RX_BD_R01 0x4000 -#define MCF5272_FEC_RX_BD_W 0x2000 -#define MCF5272_FEC_RX_BD_R02 0x1000 -#define MCF5272_FEC_RX_BD_L 0x0800 -#define MCF5272_FEC_RX_BD_M 0x0100 -#define MCF5272_FEC_RX_BD_BC 0x0080 -#define MCF5272_FEC_RX_BD_MC 0x0040 -#define MCF5272_FEC_RX_BD_LG 0x0020 -#define MCF5272_FEC_RX_BD_NO 0x0010 -#define MCF5272_FEC_RX_BD_SH 0x0008 -#define MCF5272_FEC_RX_BD_CR 0x0004 -#define MCF5272_FEC_RX_BD_OV 0x0002 -#define MCF5272_FEC_RX_BD_TR 0x0001 - - -/********************************************************************** -* -* USB_ Module Register Description -* -***********************************************************************/ - -/* Offsets of the registers from the MBAR */ -#define MCF5272_USB_FNR (0x1002) -#define MCF5272_USB_FNMR (0x1006) -#define MCF5272_USB_RFMR (0x100A) -#define MCF5272_USB_RFMMR (0x100E) -#define MCF5272_USB_FAR (0x1013) -#define MCF5272_USB_ASR (0x1014) -#define MCF5272_USB_DRR1 (0x1018) -#define MCF5272_USB_DRR2 (0x101C) -#define MCF5272_USB_SPECR (0x1022) -#define MCF5272_USB_EP0SR (0x1026) -#define MCF5272_USB_IEP0CFG (0x1028) -#define MCF5272_USB_OEP0CFG (0x102C) -#define MCF5272_USB_EP1CFG (0x1030) -#define MCF5272_USB_EP2CFG (0x1034) -#define MCF5272_USB_EP3CFG (0x1038) -#define MCF5272_USB_EP4CFG (0x103C) -#define MCF5272_USB_EP5CFG (0x1040) -#define MCF5272_USB_EP6CFG (0x1044) -#define MCF5272_USB_EP7CFG (0x1048) -#define MCF5272_USB_EP0CTL (0x104C) -#define MCF5272_USB_EP1CTL (0x1052) -#define MCF5272_USB_EP2CTL (0x1056) -#define MCF5272_USB_EP3CTL (0x105A) -#define MCF5272_USB_EP4CTL (0x105E) -#define MCF5272_USB_EP5CTL (0x1062) -#define MCF5272_USB_EP6CTL (0x1066) -#define MCF5272_USB_EP7CTL (0x106A) -#define MCF5272_USB_EP0ISR (0x106C) -#define MCF5272_USB_EP1ISR (0x1072) -#define MCF5272_USB_EP2ISR (0x1076) -#define MCF5272_USB_EP3ISR (0x107A) -#define MCF5272_USB_EP4ISR (0x107E) -#define MCF5272_USB_EP5ISR (0x1082) -#define MCF5272_USB_EP6ISR (0x1086) -#define MCF5272_USB_EP7ISR (0x108A) -#define MCF5272_USB_EP0IMR (0x108C) -#define MCF5272_USB_EP1IMR (0x1092) -#define MCF5272_USB_EP2IMR (0x1096) -#define MCF5272_USB_EP3IMR (0x109A) -#define MCF5272_USB_EP4IMR (0x109E) -#define MCF5272_USB_EP5IMR (0x10A2) -#define MCF5272_USB_EP6IMR (0x10A6) -#define MCF5272_USB_EP7IMR (0x10AA) -#define MCF5272_USB_EP0DR (0x10AC) -#define MCF5272_USB_EP1DR (0x10B0) -#define MCF5272_USB_EP2DR (0x10B4) -#define MCF5272_USB_EP3DR (0x10B8) -#define MCF5272_USB_EP4DR (0x10BC) -#define MCF5272_USB_EP5DR (0x10C0) -#define MCF5272_USB_EP6DR (0x10C4) -#define MCF5272_USB_EP7DR (0x10C8) -#define MCF5272_USB_EP0DPR (0x10CE) -#define MCF5272_USB_EP1DPR (0x10D2) -#define MCF5272_USB_EP2DPR (0x10D6) -#define MCF5272_USB_EP3DPR (0x10DA) -#define MCF5272_USB_EP4DPR (0x10DE) -#define MCF5272_USB_EP5DPR (0x10E2) -#define MCF5272_USB_EP6DPR (0x10E6) -#define MCF5272_USB_EP7DPR (0x10EA) -#define MCF5272_USB_CFG_RAM (0x1400) /* 0x1400 - 0x17FF */ - -/* Read access macros for general use */ -#define MCF5272_RD_USB_FNR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_FNR,16) -#define MCF5272_RD_USB_FNMR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_FNMR,16) -#define MCF5272_RD_USB_RFMR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_RFMR,16) -#define MCF5272_RD_USB_RFMMR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_RFMMR,16) -#define MCF5272_RD_USB_FAR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_FAR,8) -#define MCF5272_RD_USB_ASR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_ASR,32) -#define MCF5272_RD_USB_DRR1(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_DRR1,32) -#define MCF5272_RD_USB_DRR2(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_DRR2,32) -#define MCF5272_RD_USB_SPECR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_SPECR,16) -#define MCF5272_RD_USB_EP0SR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP0SR,16) -#define MCF5272_RD_USB_IEP0CFG(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_IEP0CFG,32) -#define MCF5272_RD_USB_OEP0CFG(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_OEP0CFG,32) -#define MCF5272_RD_USB_EPCFG(IMMP,EPN) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP1CFG + 4*(EPN-1),32) -#define MCF5272_RD_USB_EP1CFG(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP1CFG,32) -#define MCF5272_RD_USB_EP2CFG(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP2CFG,32) -#define MCF5272_RD_USB_EP3CFG(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP3CFG,32) -#define MCF5272_RD_USB_EP4CFG(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP4CFG,32) -#define MCF5272_RD_USB_EP5CFG(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP5CFG,32) -#define MCF5272_RD_USB_EP6CFG(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP6CFG,32) -#define MCF5272_RD_USB_EP7CFG(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP7CFG,32) -#define MCF5272_RD_USB_EPCTL(IMMP,EPN) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP0CTL + 4*EPN,32) -#define MCF5272_RD_USB_EP0CTL(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP0CTL,32) -#define MCF5272_RD_USB_EP1CTL(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP1CTL,16) -#define MCF5272_RD_USB_EP2CTL(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP2CTL,16) -#define MCF5272_RD_USB_EP3CTL(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP3CTL,16) -#define MCF5272_RD_USB_EP4CTL(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP4CTL,16) -#define MCF5272_RD_USB_EP5CTL(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP5CTL,16) -#define MCF5272_RD_USB_EP6CTL(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP6CTL,16) -#define MCF5272_RD_USB_EP7CTL(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP7CTL,16) -#define MCF5272_RD_USB_EPISR(IMMP,EPN) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP0ISR + 4*EPN,32) -#define MCF5272_RD_USB_EP0ISR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP0ISR,32) -#define MCF5272_RD_USB_EP1ISR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP1ISR,16) -#define MCF5272_RD_USB_EP2ISR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP2ISR,16) -#define MCF5272_RD_USB_EP3ISR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP3ISR,16) -#define MCF5272_RD_USB_EP4ISR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP4ISR,16) -#define MCF5272_RD_USB_EP5ISR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP5ISR,16) -#define MCF5272_RD_USB_EP6ISR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP6ISR,16) -#define MCF5272_RD_USB_EP7ISR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP7ISR,16) -#define MCF5272_RD_USB_EPIMR(IMMP,EPN) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP0IMR + 4*EPN,32) -#define MCF5272_RD_USB_EP0IMR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP0IMR,32) -#define MCF5272_RD_USB_EP1IMR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP1IMR,16) -#define MCF5272_RD_USB_EP2IMR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP2IMR,16) -#define MCF5272_RD_USB_EP3IMR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP3IMR,16) -#define MCF5272_RD_USB_EP4IMR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP4IMR,16) -#define MCF5272_RD_USB_EP5IMR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP5IMR,16) -#define MCF5272_RD_USB_EP6IMR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP6IMR,16) -#define MCF5272_RD_USB_EP7IMR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP7IMR,16) -#define MCF5272_RD_USB_EPDR(IMMP,EPN,SIZE) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP0DR + 4*EPN,SIZE) -#define MCF5272_RD_USB_EP0DR(IMMP,SIZE) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP0DR,SIZE) -#define MCF5272_RD_USB_EP1DR(IMMP,SIZE) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP1DR,SIZE) -#define MCF5272_RD_USB_EP2DR(IMMP,SIZE) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP2DR,SIZE) -#define MCF5272_RD_USB_EP3DR(IMMP,SIZE) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP3DR,SIZE) -#define MCF5272_RD_USB_EP4DR(IMMP,SIZE) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP4DR,SIZE) -#define MCF5272_RD_USB_EP5DR(IMMP,SIZE) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP5DR,SIZE) -#define MCF5272_RD_USB_EP6DR(IMMP,SIZE) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP6DR,SIZE) -#define MCF5272_RD_USB_EP7DR(IMMP,SIZE) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP7DR,SIZE) -#define MCF5272_RD_USB_EPDPR(IMMP,EPN) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP0DPR + 4*EPN,16) -#define MCF5272_RD_USB_EP0DPR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP0DPR,16) -#define MCF5272_RD_USB_EP1DPR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP1DPR,16) -#define MCF5272_RD_USB_EP2DPR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP2DPR,16) -#define MCF5272_RD_USB_EP3DPR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP3DPR,16) -#define MCF5272_RD_USB_EP4DPR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP4DPR,16) -#define MCF5272_RD_USB_EP5DPR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP5DPR,16) -#define MCF5272_RD_USB_EP6DPR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP6DPR,16) -#define MCF5272_RD_USB_EP7DPR(IMMP) \ - Mcf5272_iord(IMMP,MCF5272_USB_EP7DPR,16) - -/* Write access macros for general use */ -#define MCF5272_WR_USB_FNR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_FNR,16,DATA) -#define MCF5272_WR_USB_FNMR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_FNMR,16,DATA) -#define MCF5272_WR_USB_RFMMR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_RFMMR,16,DATA) -#define MCF5272_WR_USB_EP0SR(IMMP,DATA)\ - Mcf5272_iowr(IMMP,MCF5272_USB_EP0SR,32,DATA) -#define MCF5272_WR_USB_IEP0CFG(IMMP,DATA)\ - Mcf5272_iowr(IMMP,MCF5272_USB_IEP0CFG,32,DATA) -#define MCF5272_WR_USB_OEP0CFG(IMMP,DATA)\ - Mcf5272_iowr(IMMP,MCF5272_USB_OEP0CFG,32,DATA) -#define MCF5272_WR_USB_EPCFG(IMMP,EPN,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP1CFG + 4*(EPN-1),32,DATA) -#define MCF5272_WR_USB_EP1CFG(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP1CFG,32,DATA) -#define MCF5272_WR_USB_EP2CFG(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP2CFG,32,DATA) -#define MCF5272_WR_USB_EP3CFG(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP3CFG,32,DATA) -#define MCF5272_WR_USB_EP4CFG(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP4CFG,32,DATA) -#define MCF5272_WR_USB_EP5CFG(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP5CFG,32,DATA) -#define MCF5272_WR_USB_EP6CFG(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP6CFG,32,DATA) -#define MCF5272_WR_USB_EP7CFG(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP7CFG,32,DATA) -#define MCF5272_WR_USB_EPCTL(IMMP,EPN,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP0CTL + 4*EPN,32,DATA) -#define MCF5272_WR_USB_EP0CTL(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP0CTL,32,DATA) -#define MCF5272_WR_USB_EP1CTL(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP1CTL,16,DATA) -#define MCF5272_WR_USB_EP2CTL(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP2CTL,16,DATA) -#define MCF5272_WR_USB_EP3CTL(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP3CTL,16,DATA) -#define MCF5272_WR_USB_EP4CTL(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP4CTL,16,DATA) -#define MCF5272_WR_USB_EP5CTL(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP5CTL,16,DATA) -#define MCF5272_WR_USB_EP6CTL(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP6CTL,16,DATA) -#define MCF5272_WR_USB_EP7CTL(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP7CTL,16,DATA) -#define MCF5272_WR_USB_EPISR(IMMP,EPN,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP0ISR + 4*EPN,32,DATA) -#define MCF5272_WR_USB_EP0ISR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP0ISR,32,DATA) -#define MCF5272_WR_USB_EP1ISR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP1ISR,16,DATA) -#define MCF5272_WR_USB_EP2ISR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP2ISR,16,DATA) -#define MCF5272_WR_USB_EP3ISR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP3ISR,16,DATA) -#define MCF5272_WR_USB_EP4ISR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP4ISR,16,DATA) -#define MCF5272_WR_USB_EP5ISR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP5ISR,16,DATA) -#define MCF5272_WR_USB_EP6ISR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP6ISR,16,DATA) -#define MCF5272_WR_USB_EP7ISR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP7ISR,16,DATA) -#define MCF5272_WR_USB_EPIMR(IMMP,EPN,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP0IMR + 4*EPN,32,DATA) -#define MCF5272_WR_USB_EP0IMR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP0IMR,32,DATA) -#define MCF5272_WR_USB_EP1IMR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP1IMR,16,DATA) -#define MCF5272_WR_USB_EP2IMR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP2IMR,16,DATA) -#define MCF5272_WR_USB_EP3IMR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP3IMR,16,DATA) -#define MCF5272_WR_USB_EP4IMR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP4IMR,16,DATA) -#define MCF5272_WR_USB_EP5IMR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP5IMR,16,DATA) -#define MCF5272_WR_USB_EP6IMR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP6IMR,16,DATA) -#define MCF5272_WR_USB_EP7IMR(IMMP,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP7IMR,16,DATA) -#define MCF5272_WR_USB_EPDR(IMMP,EPN,SIZE,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP0DR + 4*EPN,SIZE,DATA) -#define MCF5272_WR_USB_EP0DR(IMMP,SIZE,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP0DR,SIZE,DATA) -#define MCF5272_WR_USB_EP1DR(IMMP,SIZE,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP1DR,SIZE,DATA) -#define MCF5272_WR_USB_EP2DR(IMMP,SIZE,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP2DR,SIZE,DATA) -#define MCF5272_WR_USB_EP3DR(IMMP,SIZE,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP3DR,SIZE,DATA) -#define MCF5272_WR_USB_EP4DR(IMMP,SIZE,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP4DR,SIZE,DATA) -#define MCF5272_WR_USB_EP5DR(IMMP,SIZE,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP5DR,SIZE,DATA) -#define MCF5272_WR_USB_EP6DR(IMMP,SIZE,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP6DR,SIZE,DATA) -#define MCF5272_WR_USB_EP7DR(IMMP,SIZE,DATA) \ - Mcf5272_iowr(IMMP,MCF5272_USB_EP7DR,SIZE,DATA) - -/* Macro to return current Alternate Setting for a given Interface */ -#define AltSetting(imm, i) (int8)((MCF5272_RD_USB_ASR(imm) >> (i << 1)) & 3) - -/* Bit level definitions and macros */ -#define MCF5272_USB_EP0SR_WAKE_ST 0x0800 -#define MCF5272_USB_EP0SR_HALT_ST 0x0004 -#define MCF5272_USB_EP0SR_DIR 0x0002 - -#define MCF5272_USB_EP0CTL_DEBUG 0x00040000 -#define MCF5272_USB_EP0CTL_WOR_LVL 0x00020000 -#define MCF5272_USB_EP0CTL_WOR_EN 0x00010000 -#define MCF5272_USB_EP0CTL_CLK_SEL 0x00008000 -#define MCF5272_USB_EP0CTL_RESUME 0x00004000 -#define MCF5272_USB_EP0CTL_AFE_EN 0x00002000 -#define MCF5272_USB_EP0CTL_BUS_PWR 0x00001000 -#define MCF5272_USB_EP0CTL_USB_EN 0x00000800 -#define MCF5272_USB_EP0CTL_CFG_RAM_VAL 0x00000400 -#define MCF5272_USB_EP0CTL_CMD_ERR 0x00000200 -#define MCF5272_USB_EP0CTL_CMD_OVER 0x00000100 -#define MCF5272_USB_EP0CTL_CRC_ERR 0x00000080 -#define MCF5272_USB_EP0CTL_OUT_LVL(x) ((x & 3) << 4) -#define MCF5272_USB_EP0CTL_IN_LVL(x) ((x & 3) << 2) -#define MCF5272_USB_EP0CTL_IN_BUSY 0x00000002 - -#define MCF5272_USB_EPNCTL_CRC_ERR 0x0080 -#define MCF5272_USB_EPNCTL_ISO_MODE 0x0040 -#define MCF5272_USB_EPNCTL_FIFO_LVL(x) ((x & 3) << 2) -#define MCF5272_USB_EPNCTL_IN_BUSY 0x0002 -#define MCF5272_USB_EPNCTL_STALL 0x0001 - -#define MCF5272_USB_EP0ISR_DEV_CFG 0x00010000 -#define MCF5272_USB_EP0ISR_VEND_REQ 0x00008000 -#define MCF5272_USB_EP0ISR_FRM_MAT 0x00004000 -#define MCF5272_USB_EP0ISR_ASOF 0x00002000 -#define MCF5272_USB_EP0ISR_SOF 0x00001000 -#define MCF5272_USB_EP0ISR_WAKE_CHG 0x00000800 -#define MCF5272_USB_EP0ISR_RESUME 0x00000400 -#define MCF5272_USB_EP0ISR_SUSPEND 0x00000200 -#define MCF5272_USB_EP0ISR_RESET 0x00000100 -#define MCF5272_USB_EP0ISR_OUT_EOT 0x00000080 -#define MCF5272_USB_EP0ISR_OUT_EOP 0x00000040 -#define MCF5272_USB_EP0ISR_OUT_LVL 0x00000020 -#define MCF5272_USB_EP0ISR_IN_EOT 0x00000010 -#define MCF5272_USB_EP0ISR_IN_EOP 0x00000008 -#define MCF5272_USB_EP0ISR_UNHALT 0x00000004 -#define MCF5272_USB_EP0ISR_HALT 0x00000002 -#define MCF5272_USB_EP0ISR_IN_LVL 0x00000001 - -#define MCF5272_USB_EPNISR_HALT_ST 0x8000 -#define MCF5272_USB_EPNISR_DIR 0x4000 -#define MCF5272_USB_EPNISR_PRES 0x2000 -#define MCF5272_USB_EPNISR_EOT 0x0010 -#define MCF5272_USB_EPNISR_EOP 0x0008 -#define MCF5272_USB_EPNISR_UNHALT 0x0004 -#define MCF5272_USB_EPNISR_HALT 0x0002 -#define MCF5272_USB_EPNISR_FIFO_LVL 0x0001 - -#define MCF5272_USB_EP0IMR_DEV_CFG_EN 0x00010000 -#define MCF5272_USB_EP0IMR_VEND_REQ_EN 0x00008000 -#define MCF5272_USB_EP0IMR_FRM_MAT_EN 0x00004000 -#define MCF5272_USB_EP0IMR_ASOF_EN 0x00002000 -#define MCF5272_USB_EP0IMR_SOF_EN 0x00001000 -#define MCF5272_USB_EP0IMR_WAKE_CHG_EN 0x00000800 -#define MCF5272_USB_EP0IMR_RESUME_EN 0x00000400 -#define MCF5272_USB_EP0IMR_SUSPEND_EN 0x00000200 -#define MCF5272_USB_EP0IMR_RESET_EN 0x00000100 -#define MCF5272_USB_EP0IMR_OUT_EOT_EN 0x00000080 -#define MCF5272_USB_EP0IMR_OUT_EOP_EN 0x00000040 -#define MCF5272_USB_EP0IMR_OUT_LVL_EN 0x00000020 -#define MCF5272_USB_EP0IMR_IN_EOT_EN 0x00000010 -#define MCF5272_USB_EP0IMR_IN_EOP_EN 0x00000008 -#define MCF5272_USB_EP0IMR_UNHALT_EN 0x00000004 -#define MCF5272_USB_EP0IMR_HALT_EN 0x00000002 -#define MCF5272_USB_EP0IMR_IN_LVL_EN 0x00000001 - -#define MCF5272_USB_EPNIMR_EOT_EN 0x0010 -#define MCF5272_USB_EPNIMR_EOP_EN 0x0008 -#define MCF5272_USB_EPNIMR_UNHALT_EN 0x0004 -#define MCF5272_USB_EPNIMR_HALT_EN 0x0002 -#define MCF5272_USB_EPNIMR_FIFO_LVL_EN 0x0001 - -/***********************************************************************/ - -/* - * Define a pointer to the MCF5272 Internal Memory Map - */ - -typedef uint8 MCF5272_IMM; - -/***********************************************************************/ - -#endif /* _CPU_MCF5272_H */ diff --git a/contrib/ports/old/coldfire/include/arch/perf.h b/contrib/ports/old/coldfire/include/arch/perf.h deleted file mode 100644 index 334d42a..0000000 --- a/contrib/ports/old/coldfire/include/arch/perf.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 - * - */ -#ifndef __PERF_H__ -#define __PERF_H__ - -#define PERF_START /* null definition */ -#define PERF_STOP(x) /* null definition */ - -#endif /* __PERF_H__ */ diff --git a/contrib/ports/old/coldfire/include/arch/sys_arch.h b/contrib/ports/old/coldfire/include/arch/sys_arch.h deleted file mode 100644 index b0a338d..0000000 --- a/contrib/ports/old/coldfire/include/arch/sys_arch.h +++ /dev/null @@ -1,66 +0,0 @@ -/* @(#)sys_arch.h - * 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: David Haas - * - */ - -#ifndef _SYS_ARCH_H -#define _SYS_ARCH_H 1 - -#include -#include -#include "netif/etharp.h" - -#define SYS_MBOX_NULL NULL -#define SYS_SEM_NULL NULL - -/* sockets needs this definition. include time.h if this is a unix system */ -struct timeval { - long tv_sec; - long tv_usec; -}; - -typedef NU_SEMAPHORE * sys_sem_t; -typedef NU_QUEUE * sys_mbox_t; -typedef NU_TASK * sys_thread_t; -typedef u32_t sys_prot_t; - -/* Functions specific to Coldfire/Nucleus */ -void -sys_setvect(u32_t vector, void (*isr_function)(void), void (*dis_funct)(void)); -void -sys_get_eth_addr(struct eth_addr *eth_addr); -int * -sys_arch_errno(void); - - -#include "arch/errno.h" - -#endif /* _SYS_ARCH_H */ - diff --git a/contrib/ports/old/coldfire/include/netif/5272fec.h b/contrib/ports/old/coldfire/include/netif/5272fec.h deleted file mode 100644 index 139af78..0000000 --- a/contrib/ports/old/coldfire/include/netif/5272fec.h +++ /dev/null @@ -1,44 +0,0 @@ -/* @(#)5272fec.h - * 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. - * - * Purpose: MCF5272 fec ethernet driver - * - * Author: David Haas - * - */ - -#ifndef _5272FEC_H -#define _5272FEC_H 1 - - -err_t -mcf5272fecif_init(struct netif *netif); - - -#endif /* _5272FEC_H */ - diff --git a/contrib/ports/old/coldfire/include/netif/tcpdump.h b/contrib/ports/old/coldfire/include/netif/tcpdump.h deleted file mode 100644 index 56c7834..0000000 --- a/contrib/ports/old/coldfire/include/netif/tcpdump.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 - * - */ -#ifndef __NETIF_TCPDUMP_H__ -#define __NETIF_TCPDUMP_H__ - -#include "lwip/pbuf.h" - -void tcpdump(struct pbuf *p); - -#endif /* __NETIF_TCPDUMP_H__ */ diff --git a/contrib/ports/old/coldfire/netif/5272fec.c b/contrib/ports/old/coldfire/netif/5272fec.c deleted file mode 100644 index 2893725..0000000 --- a/contrib/ports/old/coldfire/netif/5272fec.c +++ /dev/null @@ -1,778 +0,0 @@ -/* - * 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. 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: David Haas dhaas@alum.rpi.edu - * - */ - -/* This is an ethernet driver for the internal fec in the Coldfire MCF5272. - The driver has been written to use ISRs for Receive Frame and Transmit Frame - Complete. -*/ - -#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" - -#include "arch/mcf5272.h" - -/* Sizing the descriptor rings will depend upon how many pbufs you have available - * and how big they are. Also on how many frames you might want to input before dropping - * frames. Generally it is a good idea to buffer one tcp window. This means that - * you won't get a tcp retransmit and your tcp transmissions will be reasonably fast. - */ -#define NUM_RXBDS 64 // Number of receive descriptor rings -#define NUM_TXBDS 32 // Number of transmit descriptor rings - -/* Define those to better describe your network interface. */ -#define IFNAME0 'e' -#define IFNAME1 't' - -/* Define interface MTU size. We set this to 1518, since this is the max - Size of an ethernet frame without VLAN support. */ -#define MTU_FEC 1518 - -PACK_STRUCT_BEGIN -struct rxbd -{ - u16_t flags; - u16_t data_len; - u8_t *p_buf; -}; -PACK_STRUCT_END -typedef struct rxbd rxbd_t; - -PACK_STRUCT_BEGIN -struct txbd -{ - u16_t flags; - u16_t data_len; - u8_t *p_buf; -}; -PACK_STRUCT_END -typedef struct txbd txbd_t; - -ALIGN_STRUCT_8_BEGIN -struct mcf5272if -{ - rxbd_t rxbd_a[NUM_RXBDS]; // Rx descriptor ring. Must be aligned to double-word - txbd_t txbd_a[NUM_TXBDS]; // Tx descriptor ring. Must be aligned to double-word - struct pbuf *rx_pbuf_a[NUM_RXBDS]; // Array of pbufs corresponding to payloads in rx desc ring. - struct pbuf *tx_pbuf_a[NUM_TXBDS]; // Array of pbufs corresponding to payloads in tx desc ring. - unsigned int rx_remove; // Index that driver will remove next rx frame from. - unsigned int rx_insert; // Index that driver will insert next empty rx buffer. - unsigned int tx_insert; // Index that driver will insert next tx frame to. - unsigned int tx_remove; // Index that driver will clean up next tx buffer. - unsigned int tx_free; // Number of free transmit descriptors. - unsigned int rx_buf_len; // number of bytes in a rx buffer (that we can use). - MCF5272_IMM *imm; // imm address. All register accesses use this as base. - struct eth_addr *ethaddr; - struct netif *netif; -}; -ALIGN_STRUCT_END - -typedef struct mcf5272if mcf5272if_t; - -#define INC_RX_BD_INDEX(idx) do { if (++idx >= NUM_RXBDS) idx = 0; } while (0) -#define INC_TX_BD_INDEX(idx) do { if (++idx >= NUM_TXBDS) idx = 0; } while (0) -#define DEC_TX_BD_INDEX(idx) do { if (idx-- == 0) idx = NUM_TXBDS-1; } while (0) - -static mcf5272if_t *mcf5272if; -static sys_sem_t tx_sem; - -u32_t phy; - -typedef struct mcf5272if mcf5272if_t; - -/*-----------------------------------------------------------------------------------*/ -static void -fill_rx_ring(mcf5272if_t *mcf5272) -{ - struct pbuf *p; - struct rxbd *p_rxbd; - int i = mcf5272->rx_insert; - void *new_payload; - u32_t u_p_pay; - - /* Try and fill as many receive buffers as we can */ - while (mcf5272->rx_pbuf_a[i] == 0) - { - p = pbuf_alloc(PBUF_RAW, (u16_t) mcf5272->rx_buf_len, PBUF_POOL); - if (p == 0) - /* No pbufs, so can't refill ring */ - return; - /* Align payload start to be divisible by 16 as required by HW */ - u_p_pay = (u32_t) p->payload; - new_payload = p->payload = (void *) (((u_p_pay + 15) / 16) * 16); - - mcf5272->rx_pbuf_a[i] = p; - p_rxbd = &mcf5272->rxbd_a[i]; - p_rxbd->p_buf = (u8_t *) new_payload; - p_rxbd->flags = (p_rxbd->flags & MCF5272_FEC_RX_BD_W) | MCF5272_FEC_RX_BD_E; - INC_RX_BD_INDEX(mcf5272->rx_insert); - i = mcf5272->rx_insert; - } -} - -/*-----------------------------------------------------------------------------------*/ -static void -enable_fec(mcf5272if_t *mcf5272) -{ - MCF5272_IMM *imm = mcf5272->imm; - int i; - - /* Initialize empty tx descriptor ring */ - for(i = 0; i < NUM_TXBDS-1; i++) - mcf5272->txbd_a[i].flags = 0; - /* Set wrap bit for last descriptor */ - mcf5272->txbd_a[i].flags = MCF5272_FEC_TX_BD_W; - /* initialize tx indexes */ - mcf5272->tx_remove = mcf5272->tx_insert = 0; - mcf5272->tx_free = NUM_TXBDS; - - /* Initialize empty rx descriptor ring */ - for (i = 0; i < NUM_RXBDS-1; i++) - mcf5272->rxbd_a[i].flags = 0; - /* Set wrap bit for last descriptor */ - mcf5272->rxbd_a[i].flags = MCF5272_FEC_RX_BD_W; - /* Initialize rx indexes */ - mcf5272->rx_remove = mcf5272->rx_insert = 0; - - /* Fill receive descriptor ring */ - fill_rx_ring(mcf5272); - - /* Enable FEC */ - MCF5272_WR_FEC_ECR(imm, (MCF5272_FEC_ECR_ETHER_EN));// | 0x2000000)); - - /* Indicate that there have been empty receive buffers produced */ - MCF5272_WR_FEC_RDAR(imm,1); -} - - -/*-----------------------------------------------------------------------------------*/ -static void -disable_fec(mcf5272if_t *mcf5272) -{ - MCF5272_IMM *imm = mcf5272->imm; - int i; - u32_t value; - u32_t old_level; - - /* We need to disable interrupts here, It is important when dealing with shared - registers. */ - old_level = sys_arch_protect(); - - /* First disable the FEC interrupts. Do it in the appropriate ICR register. */ - value = MCF5272_RD_SIM_ICR3(imm); - MCF5272_WR_SIM_ICR3(imm, (value & ~(MCF5272_SIM_ICR_ERX_IL(7) | - MCF5272_SIM_ICR_ETX_IL(7) | - MCF5272_SIM_ICR_ENTC_IL(7)))); - - /* Now we can restore interrupts. This is because we can assume that - * we are single threaded here (only 1 thread will be calling disable_fec - * for THIS interface). */ - sys_arch_unprotect(old_level); - - /* Release all buffers attached to the descriptors. Since the driver - * ALWAYS zeros the pbuf array locations and descriptors when buffers are - * removed, we know we just have to free any non-zero descriptors */ - for (i = 0; i < NUM_RXBDS; i++) - if (mcf5272->rx_pbuf_a[i]) - { - pbuf_free(mcf5272->rx_pbuf_a[i]); - mcf5272->rx_pbuf_a[i] = 0; - mcf5272->rxbd_a->p_buf = 0; - } - for (i = 0; i < NUM_TXBDS; i++) - if (mcf5272->tx_pbuf_a[i]) - { - pbuf_free(mcf5272->tx_pbuf_a[i]); - mcf5272->tx_pbuf_a[i] = 0; - mcf5272->txbd_a->p_buf = 0; - } - - /* Reset the FEC - equivalent to a hard reset */ - MCF5272_WR_FEC_ECR(imm,MCF5272_FEC_ECR_RESET); - /* Wait for the reset sequence to complete, it should take about 16 clock cycles */ - i = 0; - while (MCF5272_RD_FEC_ECR(imm) & MCF5272_FEC_ECR_RESET) - { - if (++i > 100) - abort(); - } - - /* Disable all FEC interrupts by clearing the IMR register */ - MCF5272_WR_FEC_IMR(imm,0); - /* Clear any interrupts by setting all bits in the EIR register */ - MCF5272_WR_FEC_EIR(imm,0xFFFFFFFF); -} - -/*-----------------------------------------------------------------------------------* - * Function called by receive LISR to disable fec tx interrupt - *-----------------------------------------------------------------------------------*/ -static void -mcf5272_dis_tx_int(void) -{ - mcf5272if_t *mcf5272 = mcf5272if; - MCF5272_IMM *imm = mcf5272->imm; - u32_t value; - - value = MCF5272_RD_FEC_IMR(imm); - /* Clear rx interrupt bit */ - MCF5272_WR_FEC_IMR(imm, (value & ~MCF5272_FEC_IMR_TXFEN)); - return; -} - -/*-----------------------------------------------------------------------------------* - *-----------------------------------------------------------------------------------*/ -static void mcf5272fec_tx_hisr(void) -{ - /* Just signal task that it can run and cleanup */ - sys_sem_signal(tx_sem); -} - -/*-----------------------------------------------------------------------------------* - This function must be run as a task, since it ends up calling free() through pbuf_free() - *-----------------------------------------------------------------------------------*/ -static void -mcf5272fec_tx_cleanup(void) -{ - struct pbuf *p; - mcf5272if_t *mcf5272 = mcf5272if; - MCF5272_IMM *imm = mcf5272->imm; - u32_t value; - u32_t old_level; - unsigned int tx_remove_sof; - unsigned int tx_remove_eof; - unsigned int i; - u16_t flags; - - - tx_remove_sof = tx_remove_eof = mcf5272->tx_remove; - /* We must protect reading the flags and then reading the buffer pointer. They must - both be read together. */ - old_level = sys_arch_protect(); - /* Loop, looking for completed buffers at eof */ - while ((((flags = mcf5272->txbd_a[tx_remove_eof].flags) & MCF5272_FEC_TX_BD_R) == 0) && - (mcf5272->tx_pbuf_a[tx_remove_eof] != 0)) - { - /* See if this is last buffer in frame */ - if ((flags & MCF5272_FEC_TX_BD_L) != 0) - { - i = tx_remove_eof; - /* This frame is complete. Take the frame off backwards */ - do - { - p = mcf5272->tx_pbuf_a[i]; - mcf5272->tx_pbuf_a[i] = 0; - mcf5272->txbd_a[i].p_buf = 0; - mcf5272->tx_free++; - if (i != tx_remove_sof) - DEC_TX_BD_INDEX(i); - else - break; - } while (1); - - sys_arch_unprotect(old_level); - pbuf_free(p); // Will be head of chain - old_level = sys_arch_protect(); - /* Look at next descriptor */ - INC_TX_BD_INDEX(tx_remove_eof); - tx_remove_sof = tx_remove_eof; - } - else - INC_TX_BD_INDEX(tx_remove_eof); - } - mcf5272->tx_remove = tx_remove_sof; - - /* clear interrupt status for tx interrupt */ - MCF5272_WR_FEC_EIR(imm, MCF5272_FEC_EIR_TXF); - value = MCF5272_RD_FEC_IMR(imm); - /* Set tx interrupt bit again */ - MCF5272_WR_FEC_IMR(imm, (value | MCF5272_FEC_IMR_TXFEN)); - /* Now we can re-enable higher priority interrupts again */ - sys_arch_unprotect(old_level); -} - - -/*-----------------------------------------------------------------------------------* - void low_level_output(mcf5272if_t *mcf5272, struct pbuf *p) - - Output pbuf chain to hardware. It is assumed that there is a complete and correct - ethernet frame in p. The only buffering we have in this system is in the - hardware descriptor ring. If there is no room on the ring, then drop the frame. - *-----------------------------------------------------------------------------------*/ -static err_t -low_level_output(struct netif *netif, struct pbuf *p) -{ - struct pbuf *q; - mcf5272if_t *mcf5272 = netif->state; - MCF5272_IMM *imm = mcf5272->imm; - int num_desc; - int num_free; - unsigned int tx_insert_sof, tx_insert_eof; - unsigned int i; - u32_t old_level; - - /* Make sure that there are no PBUF_REF buffers in the chain. These buffers - have to be freed immediately and this ethernet driver puts the buffers on - the dma chain, so they get freed later */ - p = pbuf_take(p); - /* Interrupts are disabled through this whole thing to support multi-threading - * transmit calls. Also this function might be called from an ISR. */ - old_level = sys_arch_protect(); - - /* Determine number of descriptors needed */ - num_desc = pbuf_clen(p); - if (num_desc > mcf5272->tx_free) - { - /* Drop the frame, we have no place to put it */ -#ifdef LINK_STATS - lwip_stats.link.memerr++; -#endif - sys_arch_unprotect(old_level); - return ERR_MEM; - - } else { - /* Increment use count on pbuf */ - pbuf_ref(p); - - /* Put buffers on descriptor ring, but don't mark them as ready yet */ - tx_insert_eof = tx_insert_sof = mcf5272->tx_insert; - q = p; - do - { - mcf5272->tx_free--; - mcf5272->tx_pbuf_a[tx_insert_eof] = q; - mcf5272->txbd_a[tx_insert_eof].p_buf = q->payload; - mcf5272->txbd_a[tx_insert_eof].data_len = q->len; - q = q->next; - if (q) - INC_TX_BD_INDEX(tx_insert_eof); - } while (q); - - /* Go backwards through descriptor ring setting flags */ - i = tx_insert_eof; - do - { - mcf5272->txbd_a[i].flags = (u16_t) (MCF5272_FEC_TX_BD_R | - (mcf5272->txbd_a[i].flags & MCF5272_FEC_TX_BD_W) | - ((i == tx_insert_eof) ? (MCF5272_FEC_TX_BD_L | MCF5272_FEC_TX_BD_TC) : 0)); - if (i != tx_insert_sof) - DEC_TX_BD_INDEX(i); - else - break; - } while (1); - INC_TX_BD_INDEX(tx_insert_eof); - mcf5272->tx_insert = tx_insert_eof; -#ifdef LINK_STATS - lwip_stats.link.xmit++; -#endif - /* Indicate that there has been a transmit buffer produced */ - MCF5272_WR_FEC_TDAR(imm,1); - sys_arch_unprotect(old_level); - } - return ERR_OK; -} - -/*-----------------------------------------------------------------------------------*/ -static void -eth_input(struct pbuf *p, struct netif *netif) -{ - /* Ethernet protocol layer */ - struct eth_hdr *ethhdr; - mcf5272if_t *mcf5272 = netif->state; - - ethhdr = p->payload; - - switch (htons(ethhdr->type)) { - case ETHTYPE_IP: - etharp_ip_input(netif, p); - pbuf_header(p, -14); - netif->input(p, netif); - break; - case ETHTYPE_ARP: - etharp_arp_input(netif, mcf5272->ethaddr, 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); -} - -/*-----------------------------------------------------------------------------------* - * Function called by receive LISR to disable fec rx interrupt - *-----------------------------------------------------------------------------------*/ -static void -mcf5272_dis_rx_int(void) -{ - mcf5272if_t *mcf5272 = mcf5272if; - MCF5272_IMM *imm = mcf5272->imm; - u32_t value; - - value = MCF5272_RD_FEC_IMR(imm); - /* Clear rx interrupt bit */ - MCF5272_WR_FEC_IMR(imm, (value & ~MCF5272_FEC_IMR_RXFEN)); - return; -} - -/*-----------------------------------------------------------------------------------*/ -static void -mcf5272fec_rx(void) -{ - /* This is the receive ISR. It is written to be a high-level ISR. */ - u32_t old_level; - mcf5272if_t *mcf5272 = mcf5272if; - MCF5272_IMM *imm = mcf5272->imm; - u32_t value; - u16_t flags; - unsigned int rx_remove_sof; - unsigned int rx_remove_eof; - struct pbuf *p; - - - rx_remove_sof = rx_remove_eof = mcf5272->rx_remove; - - /* Loop, looking for filled buffers at eof */ - while ((((flags = mcf5272->rxbd_a[rx_remove_eof].flags) & MCF5272_FEC_RX_BD_E) == 0) && - (mcf5272->rx_pbuf_a[rx_remove_eof] != 0)) - { - /* See if this is last buffer in frame */ - if ((flags & MCF5272_FEC_RX_BD_L) != 0) - { - /* This frame is ready to go. Start at first descriptor in frame. */ - p = 0; - do - { - /* Adjust pbuf length if this is last buffer in frame */ - if (rx_remove_sof == rx_remove_eof) - { - mcf5272->rx_pbuf_a[rx_remove_sof]->tot_len = - mcf5272->rx_pbuf_a[rx_remove_sof]->len = (u16_t) - (mcf5272->rxbd_a[rx_remove_sof].data_len - (p ? p->tot_len : 0)); - } - else - mcf5272->rx_pbuf_a[rx_remove_sof]->len = - mcf5272->rx_pbuf_a[rx_remove_sof]->tot_len = mcf5272->rxbd_a[rx_remove_sof].data_len; - - /* Chain pbuf */ - if (p == 0) - { - p = mcf5272->rx_pbuf_a[rx_remove_sof]; // First in chain - p->tot_len = p->len; // Important since len might have changed - } else { - pbuf_chain(p, mcf5272->rx_pbuf_a[rx_remove_sof]); - pbuf_free(mcf5272->rx_pbuf_a[rx_remove_sof]); - } - - /* Clear pointer to mark descriptor as free */ - mcf5272->rx_pbuf_a[rx_remove_sof] = 0; - mcf5272->rxbd_a[rx_remove_sof].p_buf = 0; - - if (rx_remove_sof != rx_remove_eof) - INC_RX_BD_INDEX(rx_remove_sof); - else - break; - - } while (1); - INC_RX_BD_INDEX(rx_remove_sof); - - /* Check error status of frame */ - if (flags & (MCF5272_FEC_RX_BD_LG | - MCF5272_FEC_RX_BD_NO | - MCF5272_FEC_RX_BD_CR | - MCF5272_FEC_RX_BD_OV)) - { -#ifdef LINK_STATS - lwip_stats.link.drop++; - if (flags & MCF5272_FEC_RX_BD_LG) - lwip_stats.link.lenerr++; //Jumbo gram - else - if (flags & (MCF5272_FEC_RX_BD_NO | MCF5272_FEC_RX_BD_OV)) - lwip_stats.link.err++; - else - if (flags & MCF5272_FEC_RX_BD_CR) - lwip_stats.link.chkerr++; // CRC errors -#endif - /* Drop errored frame */ - pbuf_free(p); - } else { - /* Good frame. increment stat */ -#ifdef LINK_STATS - lwip_stats.link.recv++; -#endif - eth_input(p, mcf5272->netif); - } - } - INC_RX_BD_INDEX(rx_remove_eof); - } - mcf5272->rx_remove = rx_remove_sof; - - /* clear interrupt status for rx interrupt */ - old_level = sys_arch_protect(); - MCF5272_WR_FEC_EIR(imm, MCF5272_FEC_EIR_RXF); - value = MCF5272_RD_FEC_IMR(imm); - /* Set rx interrupt bit again */ - MCF5272_WR_FEC_IMR(imm, (value | MCF5272_FEC_IMR_RXFEN)); - /* Now we can re-enable higher priority interrupts again */ - sys_arch_unprotect(old_level); - - /* Fill up empty descriptor rings */ - fill_rx_ring(mcf5272); - /* Tell fec that we have filled up her ring */ - MCF5272_WR_FEC_RDAR(imm, 1); - - return; -} - - - -/*-----------------------------------------------------------------------------------*/ -static void -low_level_init(struct netif *netif) -{ - mcf5272if_t *mcf5272; - MCF5272_IMM *imm; - VOID (*old_lisr)(INT); /* old LISR */ - u32_t value; - u32_t old_level; - struct pbuf *p; - int i; - - mcf5272 = netif->state; - imm = mcf5272->imm; - - /* Initialize our ethernet address */ - sys_get_eth_addr(mcf5272->ethaddr); - - /* First disable fec */ - disable_fec(mcf5272); - - /* Plug appropriate low level interrupt vectors */ - sys_setvect(MCF5272_VECTOR_ERx, mcf5272fec_rx, mcf5272_dis_rx_int); - sys_setvect(MCF5272_VECTOR_ETx, mcf5272fec_tx_hisr, mcf5272_dis_tx_int); - //sys_setvect(MCF5272_VECTOR_ENTC, mcf5272fec_ntc); - - /* Set the I_MASK register to enable only rx & tx frame interrupts */ - MCF5272_WR_FEC_IMR(imm, MCF5272_FEC_IMR_TXFEN | MCF5272_FEC_IMR_RXFEN); - - /* Clear I_EVENT register */ - MCF5272_WR_FEC_EIR(imm,0xFFFFFFFF); - - /* Set up the appropriate interrupt levels */ - /* Disable interrupts, since this is a read/modify/write operation */ - old_level = sys_arch_protect(); - value = MCF5272_RD_SIM_ICR3(imm); - MCF5272_WR_SIM_ICR3(imm, value | MCF5272_SIM_ICR_ERX_IL(FEC_LEVEL) | - MCF5272_SIM_ICR_ETX_IL(FEC_LEVEL)); - sys_arch_unprotect(old_level); - - /* Set the source address for the controller */ - MCF5272_WR_FEC_MALR(imm,0 - | (mcf5272->ethaddr->addr[0] <<24) - | (mcf5272->ethaddr->addr[1] <<16) - | (mcf5272->ethaddr->addr[2] <<8) - | (mcf5272->ethaddr->addr[3] <<0)); - MCF5272_WR_FEC_MAUR(imm,0 - | (mcf5272->ethaddr->addr[4] <<24) - | (mcf5272->ethaddr->addr[5] <<16)); - - /* Initialize the hash table registers */ - /* We are not supporting multicast addresses */ - MCF5272_WR_FEC_HTUR(imm,0); - MCF5272_WR_FEC_HTLR(imm,0); - - /* Set Receive Buffer Size. We subtract 16 because the start of the receive - * buffer MUST be divisible by 16, so depending on where the payload really - * starts in the pbuf, we might be increasing the start point by up to 15 bytes. - * See the alignment code in fill_rx_ring() */ - /* There might be an offset to the payload address and we should subtract - * that offset */ - p = pbuf_alloc(PBUF_RAW, PBUF_POOL_BUFSIZE, PBUF_POOL); - i = 0; - if (p) - { - struct pbuf *q = p; - - while ((q = q->next) != 0) - i += q->len; - mcf5272->rx_buf_len = PBUF_POOL_BUFSIZE-16-i; - pbuf_free(p); - } - - - MCF5272_WR_FEC_EMRBR(imm, (u16_t) mcf5272->rx_buf_len); - - /* Point to the start of the circular Rx buffer descriptor queue */ - MCF5272_WR_FEC_ERDSR(imm, ((u32_t) &mcf5272->rxbd_a[0])); - - /* Point to the start of the circular Tx buffer descriptor queue */ - MCF5272_WR_FEC_ETDSR(imm, ((u32_t) &mcf5272->txbd_a[0])); - - /* Set the tranceiver interface to MII mode */ - MCF5272_WR_FEC_RCR(imm, 0 - | MCF5272_FEC_RCR_MII_MODE - | MCF5272_FEC_RCR_DRT); /* half duplex */ - - /* Only operate in half-duplex, no heart beat control */ - MCF5272_WR_FEC_TCR(imm, 0); - - /* Set the maximum frame length (MTU) */ - MCF5272_WR_FEC_MFLR(imm, MTU_FEC); - - /* Set MII bus speed */ - MCF5272_WR_FEC_MSCR(imm, 0x0a); - - /* Enable fec i/o pins */ - value = MCF5272_RD_GPIO_PBCNT(imm); - MCF5272_WR_GPIO_PBCNT(imm, ((value & 0x0000ffff) | 0x55550000)); - - /* Clear MII interrupt status */ - MCF5272_WR_FEC_EIR(imm, MCF5272_FEC_IMR_MIIEN); - -/* /\* Read phy ID *\/ */ -/* MCF5272_WR_FEC_MMFR(imm, 0x600a0000); */ -/* while (1) */ -/* { */ -/* value = MCF5272_RD_FEC_EIR(imm); */ -/* if ((value & MCF5272_FEC_IMR_MIIEN) != 0) */ -/* { */ -/* MCF5272_WR_FEC_EIR(imm, MCF5272_FEC_IMR_MIIEN); */ -/* break; */ -/* } */ -/* } */ -/* phy = MCF5272_RD_FEC_MMFR(imm); */ - - /* Enable FEC */ - enable_fec(mcf5272); - - /* THIS IS FOR LEVEL ONE/INTEL PHY ONLY!!! */ - /* Program Phy LED 3 to tell us transmit status */ - MCF5272_WR_FEC_MMFR(imm, 0x50520412); - -} - -/*-----------------------------------------------------------------------------------* - * etharp timer thread - * It's only job is to initialize the timer, create a semaphore and wait on it - * forever. We need a special task to handle the arp timer. - *-----------------------------------------------------------------------------------*/ -static void -etharp_timer_thread(void *arg) -{ - sys_sem_t *psem = (sys_sem_t *) arg; - - /* Create timeout timer */ - sys_timeout(ARP_TMR_INTERVAL, (sys_timeout_handler)arp_timer, NULL); - /* Signal previous task that it can go */ - sys_sem_signal(*psem); - - tx_sem = sys_sem_new(0); - - while (1) - { - sys_sem_wait(tx_sem); - mcf5272fec_tx_cleanup(); - } -} - - - -/*-----------------------------------------------------------------------------------*/ -static void -etharp_timer_init(void *arg) -{ - sys_thread_new(DEFAULT_THREAD_NAME, (void *)etharp_timer_thread, arg, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO); -} - - -/*-----------------------------------------------------------------------------------*/ -/* - * mcf5272fecif_init(struct netif *netif): - * - * 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. - * - * Note that there is only one fec in a 5272! - * - */ -err_t -mcf5272fecif_init(struct netif *netif) -{ - sys_sem_t sem; - - /* Allocate our interface control block */ - /* IMPORTANT NOTE: This works for 5272, but if you are using a cpu with data cache - * then you need to make sure you get this memory from non-cachable memory. */ - mcf5272if = (mcf5272if_t *) calloc(1, sizeof(mcf5272if_t)); - if (mcf5272if) - { - netif->state = mcf5272if; - mcf5272if->netif = netif; - netif->name[0] = IFNAME0; - netif->name[1] = IFNAME1; - netif->output = etharp_output; - netif->linkoutput = low_level_output; - netif->mtu = MTU_FEC - 18; // mtu without ethernet header and crc - mcf5272if->ethaddr = (struct eth_addr *)&(netif->hwaddr[0]); - netif->hwaddr_len = 6; /* Ethernet interface */ - mcf5272if->imm = mcf5272_get_immp(); - - low_level_init(netif); - - etharp_init(); - sem = sys_sem_new(0); - etharp_timer_init(&sem); - sys_sem_wait(sem); - sys_sem_free(sem); - - return ERR_OK; - } - else - return ERR_MEM; -} - -/*-----------------------------------------------------------------------------------*/ diff --git a/contrib/ports/old/coldfire/proj/lwipopts.h b/contrib/ports/old/coldfire/proj/lwipopts.h deleted file mode 100644 index abf11ec..0000000 --- a/contrib/ports/old/coldfire/proj/lwipopts.h +++ /dev/null @@ -1,204 +0,0 @@ -/* - * 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 - * - */ -#ifndef __LWIPOPTS_H__ -#define __LWIPOPTS_H__ - -#define NO_SYS 0 -/*#define LWIP_EVENT_API 0*/ - -/* ---------- 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 4 - -/* 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 65000 - -/* 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 - -/* 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 6 -/* MEMP_NUM_NETCONN: the number of struct netconns. */ -#define MEMP_NUM_NETCONN 10 -/* MEMP_NUM_TCPIP_MSG: 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_API 16 -#define MEMP_NUM_TCPIP_MSG_INPKT 16 -/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active - timeouts. */ -#define MEMP_NUM_SYS_TIMEOUT 3 - -/* 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 128 - -/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */ -#define PBUF_POOL_BUFSIZE 1024 - -/* PBUF_LINK_HLEN: the number of bytes that should be allocated for a - link level header. */ -#define PBUF_LINK_HLEN 16 - -/** SYS_LIGHTWEIGHT_PROT - * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection - * for certain critical regions during buffer allocation, deallocation and memory - * allocation and deallocation. - */ -#define SYS_LIGHTWEIGHT_PROT 1 - -/* ---------- 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 - -/* TCP writable space (bytes). This must be less than or equal - to TCP_SND_BUF. It is the amount of space which must be - available in the tcp snd_buf for select to return writable */ -#define TCP_SNDLOWAT TCP_SND_BUF/2 - -/* ---------- ARP options ---------- */ -#define ARP_TABLE_SIZE 10 -#define ARP_QUEUEING 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 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 - -/* 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 - 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 LWIP_STATS 1 - -#ifdef LWIP_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 */ - - -#define LWIP_COMPAT_SOCKETS 1 -#define LWIP_PROVIDE_ERRNO 1 - -/* People often make a mistake on the priority of their communications task. - The TCP/IP stack should be at a relatively low priority if it is an endpoint - (not a router) on a somewhat underpowered CPU. You are'nt going to keep up - with network traffic during a denial of service attack or misconfigured network - and you don't want an overburdened network task to cause other important tasks - (including your UI) to stop working. Drop packets! It forces flow control and - lets the rest of your system run. -*/ -#define TCPIP_THREAD_PRIO 220 // Relatively low priority - -#define DEFAULT_THREAD_PRIO 240 - -#endif /* __LWIPOPTS_H__ */ diff --git a/contrib/ports/old/coldfire/sys_arch.c b/contrib/ports/old/coldfire/sys_arch.c deleted file mode 100644 index 81677b6..0000000 --- a/contrib/ports/old/coldfire/sys_arch.c +++ /dev/null @@ -1,597 +0,0 @@ -/* @(#)sys_arch.c - * 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: David Haas - * - */ - -#include "lwip/debug.h" - -#include "lwip/sys.h" -#include "lwip/opt.h" -#include "lwip/stats.h" - -#include "nucleus.h" -#include "config.h" -#include -#include - -struct sys_thread { - struct sys_thread *next; - struct sys_timeouts timeouts; - int errno_i; - NU_TASK *pthread; - void (*function)(void *arg); - void *arg; -}; - -struct sys_hisr -{ - struct sys_hisr *next; - NU_HISR *hisr; - void (*disablefun) (void); - u32_t vector; -}; - -static int num_sem = 0; // Number of semaphores created -static int num_mbox = 0; // Number of mailboxes created -static int num_thread = 0; // Number of threads created -static int num_hisr = 0; // Number of hisrs created -static struct sys_thread *threads = NULL; -static struct sys_hisr *hisrs = NULL; - -#define TICKS_PER_SECOND 10000 -#define MS_TO_TICKS(MS) (MS * (TICKS_PER_SECOND / 1000)) -#define TICKS_TO_MS(TICKS) ((unsigned long)((1000ULL * TICKS) / TICKS_PER_SECOND)) -#define TICKS_TO_HUNDMICROSEC(TICKS) TICKS - -#define SYS_MBOX_SIZE 128 // Number of elements in mbox queue -#define SYS_STACK_SIZE 2048 // A minimum Nucleus stack for coldfire -#define SYS_HISR_STACK_SIZE 2048 // A minimum Nucleus stack for coldfire - -/*---------------------------------------------------------------------------------*/ -void -sys_init(void) -{ - return; -} - -/*---------------------------------------------------------------------------------*/ -static void -sys_thread_entry(UNSIGNED argc, VOID *argv) -{ - /* argv is passed as a pointer to our thread structure */ - struct sys_thread *p_thread = (struct sys_thread *)argv; - - p_thread->function(p_thread->arg); -} - -/*---------------------------------------------------------------------------------*/ -static struct sys_thread * -introduce_thread(NU_TASK *id, void (*function)(void *arg), void *arg) -{ - struct sys_thread *thread; - sys_prot_t old_level; - - thread = (struct sys_thread *) calloc(1,sizeof(struct sys_thread)); - - if (thread) { - old_level = sys_arch_protect(); - thread->next = threads; - thread->timeouts.next = NULL; - thread->pthread = id; - thread->function = function; - thread->arg = arg; - threads = thread; - sys_arch_unprotect(old_level); - } - - return thread; -} - -/*---------------------------------------------------------------------------------*/ -/* We use Nucleus task as thread. Create one with a standard size stack at a standard - * priority. */ -sys_thread_t -sys_thread_new(char *name, void (* function)(void *arg), void *arg, int stacksize, int prio) -{ - NU_TASK *p_thread; - u8_t *p_stack; - STATUS status; - char thread_name[8] = " "; - struct sys_thread *st; - - /** @todo Replace SYS_STACK_SIZE by "stacksize" parameter, perhaps use "name" if it is prefered */ - - p_stack = (u8_t *) malloc(SYS_STACK_SIZE); - if (p_stack) - { - p_thread = (NU_TASK *) calloc(1,sizeof(NU_TASK)); - if (p_thread) - { - /* get a new thread structure */ - st = introduce_thread(p_thread, function, arg); - if (st) - { - num_thread = (num_thread +1) % 100; // Only count to 99 - sprintf(thread_name, "lwip%02d", num_thread); - thread_name[strlen(thread_name)] = ' '; - - status = NU_Create_Task(p_thread, - thread_name, - sys_thread_entry, - 0, - st, - p_stack, - SYS_STACK_SIZE, - prio, - 0, //Disable timeslicing - NU_PREEMPT, - NU_START); - if (status == NU_SUCCESS) - return p_thread; - } - - } - } - abort(); -} - -/*-----------------------------------------------------------------------------------*/ -static struct sys_thread * -current_thread(void) -{ - struct sys_thread *st; - sys_prot_t old_level; - NU_TASK *pt; - - pt = NU_Current_Task_Pointer(); - old_level = sys_arch_protect(); - - for(st = threads; st != NULL; st = st->next) - { - if (st->pthread == pt) - { - sys_arch_unprotect(old_level); - return st; - } - } - - sys_arch_unprotect(old_level); - st = introduce_thread(pt, 0, 0); - - if (!st) { - abort(); - } - - return st; -} - - -/*---------------------------------------------------------------------------------*/ -struct sys_timeouts * -sys_arch_timeouts(void) -{ - struct sys_thread *thread; - - thread = current_thread(); - return &thread->timeouts; -} -/*---------------------------------------------------------------------------------*/ -int * -sys_arch_errno(void) -{ - struct sys_thread *thread; - - thread = current_thread(); - return &thread->errno_i; -} - -/*---------------------------------------------------------------------------------*/ -sys_sem_t -sys_sem_new(u8_t count) -{ - STATUS status; - NU_SEMAPHORE *sem; - char sem_name[8] = " "; - -#ifdef SYS_STATS - lwip_stats.sys.sem.used++; - if (lwip_stats.sys.sem.used > lwip_stats.sys.sem.max) - { - lwip_stats.sys.sem.max = lwip_stats.sys.sem.used; - } -#endif /* SYS_STATS */ - - /* Get memory for new semaphore */ - sem = (NU_SEMAPHORE *) calloc(1,sizeof(NU_SEMAPHORE)); - - if (sem) - { - /* Create a unique name for semaphore based on number created */ - num_sem = (num_sem + 1) % 100; // Only count to 99 - sprintf(sem_name, "lwip%02d", num_sem); - sem_name[strlen(sem_name)] = ' '; - - /* Ask nucleus to create semaphore */ - NU_Create_Semaphore(sem, - sem_name, - count, - NU_FIFO); - } - return sem; -} - -/*---------------------------------------------------------------------------------*/ -void -sys_sem_free(sys_sem_t sem) -{ - if (sem != SYS_SEM_NULL) - { -#ifdef SYS_STATS - lwip_stats.sys.sem.used--; -#endif /* SYS_STATS */ - NU_Delete_Semaphore(sem); - free(sem); - } -} - -/*---------------------------------------------------------------------------------*/ -void -sys_sem_signal(sys_sem_t sem) -{ - NU_Release_Semaphore(sem); -} - -/*---------------------------------------------------------------------------------*/ -u32_t -sys_arch_sem_wait(sys_sem_t sem, u32_t timeout) -{ - UNSIGNED timestart, timespent; - STATUS status; - - /* Get the current time */ - timestart = NU_Retrieve_Clock(); - /* Wait for the semaphore */ - status = NU_Obtain_Semaphore(sem, - timeout ? MS_TO_TICKS(timeout) : NU_SUSPEND); - /* This next statement takes wraparound into account. It works. Really! */ - timespent = TICKS_TO_HUNDMICROSEC(((s32_t) ((s32_t) NU_Retrieve_Clock() - (s32_t) timestart))); - - if (status == NU_TIMEOUT) - return SYS_ARCH_TIMEOUT; - else - /* Round off to milliseconds */ - return (timespent+5)/10; -} - -/*---------------------------------------------------------------------------------*/ -sys_mbox_t -sys_mbox_new(void) -{ - u32_t *p_queue_mem; - NU_QUEUE *p_queue; - char queue_name[8] = " "; - - /* Allocate memory for queue */ - p_queue_mem = (u32_t *) calloc(1,(SYS_MBOX_SIZE * sizeof(u32_t))); - if (p_queue_mem) - { - /* Allocate memory for queue control block */ - p_queue = (NU_QUEUE *) calloc(1,sizeof(NU_QUEUE)); - if (p_queue) - { - /* Create a unique name for mbox based on number created */ - num_mbox = (num_mbox + 1) % 100; - sprintf(queue_name, "lwip%02d", num_mbox); - queue_name[strlen(queue_name)] = ' '; - - NU_Create_Queue(p_queue, - queue_name, - p_queue_mem, - SYS_MBOX_SIZE, - NU_FIXED_SIZE, - 1, - NU_FIFO); -#ifdef SYS_STATS - lwip_stats.sys.mbox.used++; - if (lwip_stats.sys.mbox.used > lwip_stats.sys.mbox.max) { - lwip_stats.sys.mbox.max = lwip_stats.sys.mbox.used; - } -#endif /* SYS_STATS */ - return p_queue; - } - else - free(p_queue_mem); - } - return SYS_MBOX_NULL; -} - -/*---------------------------------------------------------------------------------*/ -void -sys_mbox_free(sys_mbox_t mbox) -{ - VOID *p_queue_mem; - CHAR name[8]; - UNSIGNED queue_size; - UNSIGNED available; - UNSIGNED messages; - OPTION message_type; - UNSIGNED message_size; - OPTION suspend_type; - UNSIGNED tasks_waiting; - NU_TASK *first_task; - STATUS status; - - if (mbox != SYS_MBOX_NULL) - { - /* First we need to get address of queue memory. Ask Nucleus - for information about the queue */ - status = NU_Queue_Information(mbox, - name, - &p_queue_mem, - &queue_size, - &available, - &messages, - &message_type, - &message_size, - &suspend_type, - &tasks_waiting, - &first_task); - if (status == NU_SUCCESS) - free(p_queue_mem); - NU_Delete_Queue(mbox); - free(mbox); -#ifdef SYS_STATS - lwip_stats.sys.mbox.used--; -#endif /* SYS_STATS */ - } - -} - -/*--------------------------------------------------------------------------------- - This function sends a message to a mailbox. It is unusual in that no error - return is made. This is because the caller is responsible for ensuring that - the mailbox queue will not fail. The caller does this by limiting the number - of msg structures which exist for a given mailbox. - ---------------------------------------------------------------------------------*/ -void -sys_mbox_post(sys_mbox_t mbox, void *msg) -{ - UNSIGNED status; - - LWIP_DEBUGF(SYS_DEBUG, ("sys_mbox_post: mbox %p msg %p\n", mbox, msg)); - status = NU_Send_To_Queue(mbox, - &msg, - 1, - NU_NO_SUSPEND); - LWIP_ASSERT("sys_mbox_post: mbx post failed", status == NU_SUCCESS); -} -/*---------------------------------------------------------------------------------*/ -u32_t -sys_arch_mbox_fetch(sys_mbox_t mbox, void **msg, u32_t timeout) -{ - UNSIGNED timestart, timespent; - STATUS status; - void *ret_msg; - UNSIGNED actual_size; - - /* Get the current time */ - timestart = NU_Retrieve_Clock(); - - /* Wait for message */ - status = NU_Receive_From_Queue(mbox, - &ret_msg, - 1, - &actual_size, - timeout ? MS_TO_TICKS(timeout) : NU_SUSPEND); - - if (status == NU_SUCCESS) - { - if (msg) - *msg = ret_msg; - LWIP_DEBUGF(SYS_DEBUG, ("sys_mbox_fetch: mbox %p msg %p\n", mbox, ret_msg)); - } else { - if (msg) - *msg = 0; - if (status == NU_TIMEOUT) - LWIP_DEBUGF(SYS_DEBUG, ("sys_mbox_fetch: timeout on mbox %p\n", mbox)); - else - LWIP_DEBUGF(SYS_DEBUG, ("sys_mbox_fetch: Queue Error %i on mbox %p\n", status, mbox)); - } - - - /* This next statement takes wraparound into account. It works. Really! */ - timespent = TICKS_TO_HUNDMICROSEC(((s32_t) ((s32_t) NU_Retrieve_Clock() - (s32_t) timestart))); - - if (status == NU_TIMEOUT) - return SYS_ARCH_TIMEOUT; - else - /* Round off to milliseconds */ - return (timespent+5)/10; -} - -/*---------------------------------------------------------------------------------*/ -static void -sys_arch_lisr(INT vector_number) -{ - struct sys_hisr *p_hisr = hisrs; - - /* Determine which HISR to activate */ - while (p_hisr != NULL) - { - if (vector_number == p_hisr->vector) - { - if (p_hisr->disablefun) - (*p_hisr->disablefun)(); - NU_Activate_HISR(p_hisr->hisr); - break; - } - p_hisr = p_hisr->next; - } - return; -} - - -/*---------------------------------------------------------------------------------*/ -void -sys_setvect(u32_t vector, void (*isr_function)(void), void (*dis_funct)(void)) -{ - /* The passed function is called as a high level ISR on the selected vector. - It is assumed that all the functions in this module can be called by the - isr_function. - */ - struct sys_hisr *p_hisr = hisrs; - INT old_level; - NU_HISR *nucleus_hisr; - u8_t *p_stack; - STATUS status; - char hisr_name[8] = " "; - void (*old_lisr)(INT); - - /* In this case a Nucleus HISR is created for the isr_function. This - * requires it's own stack. Also get memory for Nucleus HISR. */ - nucleus_hisr = (NU_HISR *) calloc(1,sizeof(NU_HISR)); - if (nucleus_hisr) - { - p_stack = (u8_t *) malloc(SYS_HISR_STACK_SIZE); - if (p_stack) - { - - /* It is most efficient to disable interrupts for Nucleus for a short - time. Chances are we are doing this while interrupts are disabled - already during system initialization. - */ - old_level = NU_Control_Interrupts(NU_DISABLE_INTERRUPTS); - - /* It is a simplification here that once an HISR is set up for a particular - * vector it will never be set up again. This way if the init code is called - * more than once it is harmless (no memory leaks) - */ - while (p_hisr != NULL) - { - if (vector == p_hisr->vector) - { - NU_Control_Interrupts(old_level); - free(p_stack); - free(nucleus_hisr); - return; - } - p_hisr = p_hisr->next; - } - - /* Get a sys_hisr structure */ - p_hisr = (struct sys_hisr *) calloc(1,sizeof(struct sys_hisr)); - if (p_hisr) - { - p_hisr->next = hisrs; - p_hisr->vector = vector; - p_hisr->hisr = nucleus_hisr; - p_hisr->disablefun = dis_funct; - hisrs = p_hisr; - - NU_Control_Interrupts(old_level); - - num_hisr = (num_hisr + 1) % 100; - sprintf(hisr_name, "lwip%02d", num_hisr); - hisr_name[strlen(hisr_name)] = ' '; - - /* Ask Nucleus to create the HISR */ - status = NU_Create_HISR(p_hisr->hisr, - hisr_name, - isr_function, - 1, //Priority 0-2 - p_stack, - SYS_HISR_STACK_SIZE); - if (status == NU_SUCCESS) - { - /* Plug vector with system lisr now */ - NU_Register_LISR(vector, sys_arch_lisr, &old_lisr); - return; //Success - } - } - NU_Control_Interrupts(old_level); - } - } - /* Errors should be logged here */ - abort(); -} - -/*---------------------------------------------------------------------------------*/ -/** sys_prot_t sys_arch_protect(void) - -This optional function does a "fast" critical region protection and returns -the previous protection level. This function is only called during very short -critical regions. An embedded system which supports ISR-based drivers might -want to implement this function by disabling interrupts. Task-based systems -might want to implement this by using a mutex or disabling tasking. This -function should support recursive calls from the same task or interrupt. In -other words, sys_arch_protect() could be called while already protected. In -that case the return value indicates that it is already protected. - -sys_arch_protect() is only required if your port is supporting an operating -system. -*/ -sys_prot_t -sys_arch_protect(void) -{ - return NU_Control_Interrupts(NU_DISABLE_INTERRUPTS); -} - -/*---------------------------------------------------------------------------------*/ -/** void sys_arch_unprotect(sys_prot_t pval) - -This optional function does a "fast" set of critical region protection to the -value specified by pval. See the documentation for sys_arch_protect() for -more information. This function is only required if your port is supporting -an operating system. -*/ -void -sys_arch_unprotect(sys_prot_t pval) -{ - NU_Control_Interrupts(pval); -} - -/********************************************************************* - * void sys_get_eth_addr(struct eth_addr *eth_addr) - * - * Get configured ethernet address from nvram and return it - * in a eth_addr structure. - *********************************************************************/ -void -sys_get_eth_addr(struct eth_addr *eth_addr) -{ - Cfg_lan *p_lan = config_get_lan_setup(); - - eth_addr->addr[0] = (u8_t) ((p_lan->etheraddrhi >> 16) & 0xff); - eth_addr->addr[1] = (u8_t) ((p_lan->etheraddrhi >> 8) & 0xff); - eth_addr->addr[2] = (u8_t) ((p_lan->etheraddrhi) & 0xff); - eth_addr->addr[3] = (u8_t) ((p_lan->etheraddrlo >> 16) & 0xff); - eth_addr->addr[4] = (u8_t) ((p_lan->etheraddrlo >> 8) & 0xff); - eth_addr->addr[5] = (u8_t) ((p_lan->etheraddrlo) & 0xff); -} diff --git a/contrib/ports/old/ecos/README b/contrib/ports/old/ecos/README deleted file mode 100644 index da9ccc9..0000000 --- a/contrib/ports/old/ecos/README +++ /dev/null @@ -1,43 +0,0 @@ -This part of the lwip-contrib section is the ecos glue - -Check out latest ecos from CVS (>= 19 Jan 2004) so it has the latest io/eth glue for lwip. - -You must have the current lwip sources checked out and the scripts here will hopefully generate -a correct EPK suitable for use with ecos. - - -To make an ecos package: - -Run the mkepk script something like this - -# EPK=/dir/of/epk LWIP_CVS=/dir/of/checked/out/lwip ./mkepk - -This will put the generated EPK in the dir you specify - - -then add that EPK to your package repository and use it - -Build example: -#ecosconfig new edb7xxx kernel -#ecosconfig add lwip -this will default to SLIP connection.If you also -#ecosconfig add net_drivers -you'll be able to configure for ethernet - -In both cases set LWIP_MY_ADDR and LWIP_SERV_ADDR (means host/gateway for eth or host/peer for slip) -#ecosconfig tree -#make tests -and you can try any of the five tests included - -Tests: -udpecho - echo service port 7 on UDP -tcpecho - ditto on TCP -sockets - as tcpecho but written with the socket API not the lwip specific API -https - http server on port 80 written with the raw API -nc_test_slave - a port of the test with the same name in net/common to lwip. Used to compare - lwIP throughput to that of the FreeBSD stack.In this matchup lwIP gets a well deserved - silver medal.Not bad for a newcomer ;) - - -Bugreports (or even better patches) at jani@iv.ro not the lwip or ecos mailing lists!! -Only if you peek into the lwip sources and think you found a bug post to lwip-users. diff --git a/contrib/ports/old/ecos/copy b/contrib/ports/old/ecos/copy deleted file mode 100755 index 887d82a..0000000 --- a/contrib/ports/old/ecos/copy +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -#make an ecos epk from CVS lwIP -CURRENT=$EPK/net/lwip_tcpip/current -mkdir -p `dirname $CURRENT/$2` - -#prepend eCos license text to all files but the ones -#in the ppp directory: those have the advertising clause -#type of BSD license which is not compatible with GPL -#or that's what I'be been told and IANAL -if [ "`dirname $1`" != "src/netif/ppp" ]; then - #cat header $LWIP_CVS/$1 > $CURRENT/$2 - cp -f $LWIP_CVS/$1 $CURRENT/$2 -else - cp -f $LWIP_CVS/$1 $CURRENT/$2 -fi diff --git a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/cdl/lwip_net.cdl b/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/cdl/lwip_net.cdl deleted file mode 100644 index 1fc292d..0000000 --- a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/cdl/lwip_net.cdl +++ /dev/null @@ -1,680 +0,0 @@ -#==================================================================== -# -# lwip_net.cdl -# -# lwIP network stack configuration data -# -# ==================================================================== -#####ECOSGPLCOPYRIGHTBEGIN#### -## ------------------------------------------- -## This file is part of eCos, the Embedded Configurable Operating System. -## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. -## Copyright (C) 2004 eCosCentric -## -## eCos is free software; you can redistribute it and/or modify it under -## the terms of the GNU General Public License as published by the Free -## Software Foundation; either version 2 or (at your option) any later version. -## -## eCos is distributed in the hope that it will be useful, but WITHOUT ANY -## WARRANTY; without even the implied warranty of MERCHANTABILITY or -## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -## for more details. -## -## You should have received a copy of the GNU General Public License along -## with eCos; if not, write to the Free Software Foundation, Inc., -## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -## -## As a special exception, if other files instantiate templates or use macros -## or inline functions from this file, or you compile this file and link it -## with other works to produce a work based on this file, this file does not -## by itself cause the resulting work to be covered by the GNU General Public -## License. However the source code for this file must still be made available -## in accordance with section (3) of the GNU General Public License. -## -## This exception does not invalidate any other reasons why a work based on -## this file might be covered by the GNU General Public License. -## -## ------------------------------------------- -#####ECOSGPLCOPYRIGHTEND#### -# ==================================================================== -######DESCRIPTIONBEGIN#### -# -# Author(s): cris@iv.ro, jani@iv.ro -# Original data: jani@iv.ro -# Contributors: -# Date: 2002-06-21 -# -#####DESCRIPTIONEND#### -# -# ==================================================================== - -cdl_package CYGPKG_NET_LWIP { - display "lwIP" - description "Lightweight TCP/IP stack" - requires {(CYGPKG_LWIP_ETH == 1) || (CYGPKG_LWIP_SLIP == 1) || (CYGPKG_LWIP_PPP == 1)} - - compile core/mem.c \ - core/memp.c \ - core/netif.c \ - core/pbuf.c \ - core/stats.c \ - core/sys.c \ - core/tcp.c \ - core/tcp_in.c \ - core/tcp_out.c \ - core/inet.c \ - core/ipv4/icmp.c \ - core/ipv4/ip.c \ - core/ipv4/ip_addr.c \ - core/ipv4/ip_frag.c \ - api/api_lib.c \ - api/api_msg.c \ - api/tcpip.c \ - api/err.c \ - api/sockets.c \ - ecos/sys_arch.c \ - ecos/init.c - - - cdl_component CYGPKG_LWIP_STATS { - display "Turn ON/OFF statistics" - flavor bool - default_value 0 - description " - Check this box to turn ON statistics options for lwIP." - } - - cdl_component CYGPKG_LWIP_DEBUG { - display "Turn ON/OFF debug options" - flavor bool - default_value 0 - description " - Check this box to turn ON debug options for lwIP." - - cdl_option CYGPKG_LWIP_DEBUG_TCP { - display "Control TCP debug" - flavor bool - default_value 0 - description " - Generic TCP debug switch." - - } - - } - - cdl_component CYGPKG_LWIP_ASSERTS { - display "Turn ON/OFF assertions" - flavor bool - default_value 0 - description " - Check this box to turn ON assertions for lwIP." - } - - cdl_component CYGPKG_LWIP_IPV4_CONF { - display "IPV4 netconf" - flavor none - no_define - description " - See suboptions to define gateway IP, local IP and netmask." - - cdl_option CYGPKG_LWIP_SERV_ADDR { - display "Gateway IP" - flavor data - default_value {"192,168,1,1"} - description " - Gateway's IP address." - - } - cdl_option CYGPKG_LWIP_MY_ADDR { - display "My IP" - flavor data - default_value {"192,168,1,222"} - description " - The IP address for this device." - - } - cdl_option CYGPKG_LWIP_NETMASK { - display "Netmask" - flavor data - default_value {"255,255,255,0"} - description " - Netmask of the local network." - - } - } - - cdl_component CYGPKG_LWIP_MEM_OPTIONS { - display "Memory options" - flavor none - no_define - description " - Tunables for various aspects of memory usage throughout the stack." - - - - cdl_option CYGPKG_LWIP_MEM_ALIGNMENT { - display "Memory alignment" - flavor data - default_value 4 - description " - 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." - } - cdl_option CYGPKG_LWIP_MEM_SIZE { - display "Memory size" - flavor data - default_value 4000 - description " - 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." - - } - cdl_option CYGPKG_LWIP_MEMP_NUM_PBUF { - display "Number of memp struct pbufs" - flavor data - default_value 8 - description " - 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." - - } - cdl_option CYGPKG_LWIP_MEMP_NUM_UDP_PCB { - display "Simultaneous UDP control blocks " - flavor data - default_value 4 - description " - MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One - per active UDP 'connection'." - - } - cdl_option CYGPKG_LWIP_MEMP_NUM_TCP_PCB { - display "Simultaneous active TCP connections " - flavor data - default_value 5 - description " - MEMP_NUM_TCP_PCB: the number of simulatenously active TCP - connections." - - } - cdl_option CYGPKG_LWIP_MEMP_NUM_TCP_PCB_LISTEN { - display "Listening TCP connections" - flavor data - default_value 8 - description " - MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP - connections." - - } - cdl_option CYGPKG_LWIP_MEMP_NUM_TCP_SEG { - display "Simultaneous TCP segments queued" - flavor data - default_value 8 - description " - MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP - segments." - - } - cdl_option CYGPKG_LWIP_MEMP_NUM_SYS_TIMEOUT { - display "Simultaneous active timeouts" - flavor data - default_value 3 - description " - MEMP_NUM_SYS_TIMEOUT: the number of simulateously active - timeouts." - - } - cdl_component CYGPKG_LWIP_CYGPKG_LWIP_MEM_SEQ_API { - display "Sequential API settings" - flavor none - no_define - description " - 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." - - - cdl_option CYGPKG_LWIP_MEMP_NUM_NETBUF { - display "Struct netbufs" - flavor data - default_value 2 - description " - MEMP_NUM_NETBUF: the number of struct netbufs." - - } - cdl_option CYGPKG_LWIP_MEMP_NUM_NETCONN { - display "Struct netconns" - flavor data - default_value 4 - description " - MEMP_NUM_NETCONN: the number of struct netconns." - - } - cdl_option CYGPKG_LWIP_MEMP_NUM_APIMSG { - display "Struct api_msgs" - flavor data - default_value 8 - description " - MEMP_NUM_APIMSG: the number of struct api_msg, used for - communication between the TCP/IP stack and the sequential - programs." - - } - cdl_option CYGPKG_LWIP_MEMP_NUM_TCPIP_MSG { - display "Struct tcpip_msgs" - flavor data - default_value 8 - description " - 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." - - } - } - - } - - cdl_component CYGPKG_LWIP_PBUF_OPTIONS { - display "PBUF" - flavor none - no_define - description " - Packet buffer related tunings." - - - cdl_option CYGPKG_LWIP_PBUF_POOL_SIZE { - display "PBUF pool size" - flavor data - default_value 60 - description " - PBUF_POOL_SIZE: the number of buffers in the pbuf pool." - - } - - cdl_option CYGPKG_LWIP_PBUF_POOL_BUFSIZE { - display "PBUF buffer size" - flavor data - default_value 1024 - description " - PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool." - - } - cdl_option CYGPKG_LWIP_PBUF_LINK_HLEN { - display "Allocation for a link level header" - flavor data - calculated {CYGPKG_LWIP_SLIP || CYGPKG_LWIP_PPP ? 0 : 16} - description " - PBUF_LINK_HLEN: the number of bytes that should be allocated for a - link level header." - } - } - - cdl_component CYGPKG_LWIP_TCP_OPTIONS { - display "TCP" - flavor none - no_define - description " - Tune the TCP protocol details" - - cdl_option CYGPKG_LWIP_TCP { - display "Activate TCP" - flavor bool - default_value 1 - description "" - - } - - cdl_option CYGPKG_LWIP_TCPIP_THREAD_PRIORITY { - display "tcpip thread priority" - flavor data - default_value 7 - description "Pririty of the lwIP network thread.This thread handles all API messages and - network packets." - } - - cdl_option CYGPKG_LWIP_TCP_TTL { - display "Time To Live" - flavor data - default_value 255 - description "" - - } - cdl_option CYGPKG_LWIP_TCP_QUEUE_OOSEQ { - display "Queue segments" - flavor bool - default_value 1 - description " - Controls if TCP should queue segments that arrive out of - order. Define to 0 if your device is low on memory." - - } - cdl_option CYGPKG_LWIP_TCP_MSS { - display "Maximum segment size" - flavor data - default_value 2048 - description " - TCP Maximum segment size." - } - cdl_option CYGPKG_LWIP_TCP_SND_BUF { - display "Sender buffer space" - flavor data - default_value 2048 - description " - TCP sender buffer space (bytes)." - - } - cdl_option CYGPKG_LWIP_TCP_SND_QUEUELEN { - display "Sender pbufs" - flavor data - calculated "4 * CYGPKG_LWIP_TCP_SND_BUF/CYGPKG_LWIP_TCP_MSS" - description " - TCP sender buffer space (pbufs). This must be at least = 2 * - TCP_SND_BUF/TCP_MSS for things to work." - - } - cdl_option CYGPKG_LWIP_TCP_WND { - display "Receive window" - flavor data - default_value 4096 - description " - TCP receive window." - - } - cdl_option CYGPKG_LWIP_TCP_MAXRTX { - display "Segment retransmissions" - flavor data - default_value 12 - description " - Maximum number of retransmissions of data segments." - - } - cdl_option CYGPKG_LWIP_TCP_SYNMAXRTX { - display "Syn retransmissions" - flavor data - default_value 4 - description " - Maximum number of retransmissions of SYN segments." - } - } - - cdl_component CYGPKG_LWIP_ARP_OPTIONS { - display "ARP" - flavor none - no_define - - cdl_option CYGPKG_LWIP_ARP_TABLE_SIZE { - display "ARP table size" - flavor data - default_value 10 - description "" - - } - } - - cdl_component CYGPKG_LWIP_IP { - display "IP" - flavor none - no_define - - cdl_option CYGPKG_LWIP_IP_FORWARD { - display "IP forwarding" - flavor bool - default_value 1 - description " - 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." - - } - cdl_option CYGPKG_LWIP_IP_OPTIONS { - display "Allow IP options" - flavor bool - default_value 1 - description " - If defined to 1, IP options are allowed (but not parsed). If - defined to 0, all packets with IP options are dropped." - - } - - cdl_option CYGPKG_LWIP_IP_FRAG { - display "Support IP fragmentation" - flavor bool - default_value 1 - description " - " - } - - cdl_option CYGPKG_LWIP_IP_REASS { - display "Support IP reassembly" - flavor bool - default_value 1 - description " - " - } - - } - - cdl_component CYGPKG_LWIP_ICMP_OPTIONS { - display "ICMP" - flavor none - no_define - - cdl_option CYGPKG_LWIP_ICMP_TTL { - display "ICMP Time To Live" - flavor data - default_value 255 - description "" - } - } - - cdl_component CYGPKG_LWIP_DHCP_OPTIONS { - display "DHCP" - flavor none - no_define - - - cdl_option CYGPKG_LWIP_DHCP { - display "Activate DHCP" - flavor bool - default_value 0 - description " - Define LWIP_DHCP to 1 if you want DHCP configuration of - interfaces." - compile core/dhcp.c - } - - - cdl_option CYGPKG_LWIP_DHCP_DOES_ARP_CHECK { - display "Check offered address" - flavor bool - default_value 0 - description " - 1 if you want to do an ARP check on the offered address - (recommended)." - } - } - - cdl_component CYGPKG_LWIP_LOOPIF { - display "Support loop interface (127.0.0.1)" - flavor bool - default_value 1 - compile netif/loopif.c - } - - cdl_component CYGPKG_LWIP_ETH { - display "Ethernet support" - flavor bool - requires CYGPKG_IO_ETH_DRIVERS - default_value 1 - description "Ethernet support" - compile netif/etharp.c - - cdl_option CYGPKG_LWIP_ETH_THREAD_PRIORITY { - display "ethernet input thread priority" - flavor data - default_value 6 - description "Priority of the ethernet input thread" - } - - } - - cdl_component CYGPKG_LWIP_SLIP { - display "SLIP" - flavor bool - requires CYGPKG_IO_SERIAL_DEVICES - default_value 0 - description "IP over Serial Line" - compile netif/slipif.c ecos/sio.c - - cdl_option CYGPKG_LWIP_SLIPIF_THREAD_PRIORITY { - display "SLIP thread priority" - flavor data - default_value 8 - description "Priority of the SLIP input thread" - } - - cdl_option CYGPKG_LWIP_SLIP_DEV { - display "Serial device" - flavor data - default_value {"\"/dev/ser0\""} - description " - Which serial port to use SLIP on." - } - } - - cdl_component CYGPKG_LWIP_PPP { - display "PPP" - flavor bool - requires CYGPKG_IO_SERIAL_DEVICES - default_value 0 - description "The Point-to-Point Protocol" - compile netif/ppp/ppp.c \ - netif/ppp/auth.c \ - netif/ppp/chpms.c \ - netif/ppp/fsm.c \ - netif/ppp/ipcp.c \ - netif/ppp/lcp.c \ - netif/ppp/magic.c \ - netif/ppp/md5.c \ - netif/ppp/randm.c \ - netif/ppp/vj.c \ - ecos/sio.c - - - cdl_option CYGPKG_LWIP_PPP_PAP_AUTH { - display "Support PAP authentication" - flavor bool - default_value 1 - compile netif/ppp/pap.c - } - - cdl_option CYGPKG_LWIP_PPP_CHAP_AUTH { - display "Support CHAP authentication" - flavor bool - default_value 1 - compile netif/ppp/chap.c - } - - cdl_option CYGPKG_LWIP_PPP_DEV { - display "Serial device for PPP" - flavor data - default_value {"\"/dev/ser0\""} - description " - Which serial port to use PPP on." - } - - cdl_option CYGPKG_LWIP_PPP_THREAD_PRIORITY { - display "PPP main thread priority" - flavor data - default_value 8 - description "Priority of the PPP input thread" - } - } - - cdl_component CYGPKG_LWIP_UDP_OPTIONS { - display "UDP" - flavor none - no_define - - cdl_option CYGPKG_LWIP_UDP { - display "Activate UDP" - flavor bool - default_value 1 - description "" - compile core/udp.c - } - - cdl_option CYGPKG_LWIP_UDP_TTL { - display "Time To Live" - flavor data - default_value 255 - description "" - } - } - - cdl_option CYGPKG_LWIP_RAW { - display "Enable RAW socket support" - flavor bool - default_value 1 - description "" - compile core/raw.c - } - - cdl_component CYGPKG_LWIP_APP_MEM_OPTIONS { - display "Memory options for apps" - flavor none - no_define - description "Memory options for applications." - - cdl_option CYGNUM_LWIP_VARMEMPOOL_SIZE { - display "Size of variable memory pool" - flavor data - default_value 2048 - description " - Memory required to hold semaphore, mbox and thread structures - are allocated from this memory pool. - " - } - - - - cdl_option CYGNUM_LWIP_APP_THREADS { - display "Number of network threads in application" - flavor data - default_value 1 - description " - At startup at least two lwIP threads are created:the polling(input) thread - and the TCP/IP (output) thread.Additionally your application creates one - or more threads. - Set this option to the maximum number of threads you will create through - sys_thread_new().Threads which you create through cyg_thread_create() - are not lwIP threads and don't count.This number is needed so that enough - static memory is reserved for stack space. - " - } - - cdl_option CYGNUM_LWIP_THREAD_STACK_SIZE { - display "Size of per thread stack in lwIP" - flavor data - default_value 4096 - description " - Since stack space for threads needs to be statically allocated you can - specify the amount of memory to use for each network thread. - " - } - } - - - cdl_option CYGPKG_NET_LWIP_TESTS { - display "Some lwIP tests" - flavor data - no_define - calculated { - "tests/tcpecho tests/udpecho tests/httpd tests/socket tests/nc_test_slave tests/sys_timeout" - } - description " - This option specifies the set of tests for lwIP.They show the usage of - the raw, the sequential and the BSD socket compatible APIs" - } - -} diff --git a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/include/arch/cc.h b/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/include/arch/cc.h deleted file mode 100644 index 004caeb..0000000 --- a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/include/arch/cc.h +++ /dev/null @@ -1,116 +0,0 @@ -//========================================================================== -//####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with eCos; if not, write to the Free Software Foundation, Inc., -// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -// -// As a special exception, if other files instantiate templates or use macros -// or inline functions from this file, or you compile this file and link it -// with other works to produce a work based on this file, this file does not -// by itself cause the resulting work to be covered by the GNU General Public -// License. However the source code for this file must still be made available -// in accordance with section (3) of the GNU General Public License. -// -// This exception does not invalidate any other reasons why a work based on -// this file might be covered by the GNU General Public License. -// ------------------------------------------- -//####ECOSGPLCOPYRIGHTEND#### -//========================================================================== - -/* - * 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 - * - */ -#ifndef __ARCH_CC_H__ -#define __ARCH_CC_H__ - -#include -#include -//while EFAULT should have no meaning in eCos since there are no address spaces -//it is defined here because set/getsockopt in lwIP use it. -#define EFAULT 14 - -//found no better place for this prototype -int lwip_init(void); - -//#define LWIP_PROVIDE_ERRNO -#include -#if (CYG_BYTEORDER == CYG_LSBFIRST) -#define BYTE_ORDER LITTLE_ENDIAN -#else -#define BYTE_ORDER BIG_ENDIAN -#endif - - -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 unsigned long mem_ptr_t; - -#define U16_F "hu" -#define S16_F "hd" -#define X16_F "hx" -#define U32_F "lu" -#define S32_F "ld" -#define X32_F "lx" - -#define PACK_STRUCT_FIELD(x) x __attribute__((packed)) -#define PACK_STRUCT_STRUCT __attribute__((packed)) -#define PACK_STRUCT_BEGIN -#define PACK_STRUCT_END - -#include -#include -#define LWIP_PLATFORM_DIAG(x) {diag_printf x;} -#define LWIP_PLATFORM_ASSERT(x) {CYG_FAIL(x);} - -#define SYS_ARCH_DECL_PROTECT(x) -#define SYS_ARCH_PROTECT(x) -#define SYS_ARCH_UNPROTECT(x) - -#endif /* __ARCH_CC_H__ */ diff --git a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/include/arch/perf.h b/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/include/arch/perf.h deleted file mode 100644 index c0f4114..0000000 --- a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/include/arch/perf.h +++ /dev/null @@ -1,72 +0,0 @@ -//========================================================================== -//####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with eCos; if not, write to the Free Software Foundation, Inc., -// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -// -// As a special exception, if other files instantiate templates or use macros -// or inline functions from this file, or you compile this file and link it -// with other works to produce a work based on this file, this file does not -// by itself cause the resulting work to be covered by the GNU General Public -// License. However the source code for this file must still be made available -// in accordance with section (3) of the GNU General Public License. -// -// This exception does not invalidate any other reasons why a work based on -// this file might be covered by the GNU General Public License. -// ------------------------------------------- -//####ECOSGPLCOPYRIGHTEND#### -//========================================================================== - -/* - * 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 - * - */ -#ifndef __PERF_H__ -#define __PERF_H__ - -#define PERF_START /* null definition */ -#define PERF_STOP(x) /* null definition */ - -#endif /* __PERF_H__ */ diff --git a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/include/arch/sys_arch.h b/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/include/arch/sys_arch.h deleted file mode 100644 index a8cf463..0000000 --- a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/include/arch/sys_arch.h +++ /dev/null @@ -1,45 +0,0 @@ -//========================================================================== -//####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with eCos; if not, write to the Free Software Foundation, Inc., -// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -// -// As a special exception, if other files instantiate templates or use macros -// or inline functions from this file, or you compile this file and link it -// with other works to produce a work based on this file, this file does not -// by itself cause the resulting work to be covered by the GNU General Public -// License. However the source code for this file must still be made available -// in accordance with section (3) of the GNU General Public License. -// -// This exception does not invalidate any other reasons why a work based on -// this file might be covered by the GNU General Public License. -// ------------------------------------------- -//####ECOSGPLCOPYRIGHTEND#### -//========================================================================== - -#ifndef __SYS_ECOS_H__ -#define __SYS_ECOS_H__ - -#include - -#define SYS_MBOX_NULL (sys_mbox_t)NULL -#define SYS_SEM_NULL (sys_sem_t)NULL - -typedef cyg_sem_t * sys_sem_t; -typedef cyg_handle_t sys_mbox_t; -typedef cyg_thread * sys_thread_t; -#endif /* __SYS_ECOS_H__ */ - diff --git a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/include/lwipopts.h b/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/include/lwipopts.h deleted file mode 100644 index de42801..0000000 --- a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/include/lwipopts.h +++ /dev/null @@ -1,254 +0,0 @@ -//========================================================================== -//####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with eCos; if not, write to the Free Software Foundation, Inc., -// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -// -// As a special exception, if other files instantiate templates or use macros -// or inline functions from this file, or you compile this file and link it -// with other works to produce a work based on this file, this file does not -// by itself cause the resulting work to be covered by the GNU General Public -// License. However the source code for this file must still be made available -// in accordance with section (3) of the GNU General Public License. -// -// This exception does not invalidate any other reasons why a work based on -// this file might be covered by the GNU General Public License. -// ------------------------------------------- -//####ECOSGPLCOPYRIGHTEND#### -//========================================================================== - -/* - * 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 - * - */ -#ifndef __LWIPOPTS_H__ -#define __LWIPOPTS_H__ -/*include the configuration made with configtool*/ -#include -/* ---------- 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 CYGPKG_LWIP_MEM_ALIGNMENT - -/* 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 CYGPKG_LWIP_MEM_SIZE - -/* 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 CYGPKG_LWIP_MEMP_NUM_PBUF -/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One - per active UDP "connection". */ -#define MEMP_NUM_UDP_PCB CYGPKG_LWIP_MEMP_NUM_UDP_PCB -/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP - connections. */ -#define MEMP_NUM_TCP_PCB CYGPKG_LWIP_MEMP_NUM_TCP_PCB -/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP - connections. */ -#define MEMP_NUM_TCP_PCB_LISTEN CYGPKG_LWIP_MEMP_NUM_TCP_PCB_LISTEN -/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP - segments. */ -#define MEMP_NUM_TCP_SEG CYGPKG_LWIP_MEMP_NUM_TCP_SEG -/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active - timeouts. */ -#define MEMP_NUM_SYS_TIMEOUT CYGPKG_LWIP_MEMP_NUM_SYS_TIMEOUT - - -/* 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 CYGPKG_LWIP_MEMP_NUM_NETBUF -/* MEMP_NUM_NETCONN: the number of struct netconns. */ -#define MEMP_NUM_NETCONN CYGPKG_LWIP_MEMP_NUM_NETCONN -/* MEMP_NUM_TCPIP_MSG: 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_API CYGPKG_LWIP_MEMP_NUM_TCPIP_MSG -#define MEMP_NUM_TCPIP_MSG_INPKT CYGPKG_LWIP_MEMP_NUM_TCPIP_MSG - -/* ---------- Pbuf options ---------- */ -/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */ -#define PBUF_POOL_SIZE CYGPKG_LWIP_PBUF_POOL_SIZE - -/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */ -#define PBUF_POOL_BUFSIZE CYGPKG_LWIP_PBUF_POOL_BUFSIZE - -/* PBUF_LINK_HLEN: the number of bytes that should be allocated for a - link level header. */ -#define PBUF_LINK_HLEN CYGPKG_LWIP_PBUF_LINK_HLEN - -/* ---------- TCP options ---------- */ -#define LWIP_TCP defined (CYGPKG_LWIP_TCP) -#define TCP_TTL CYGPKG_LWIP_TCP_TTL - -/* 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 CYGPKG_LWIP_TCP_QUEUE_OOSEQ - -/* TCP Maximum segment size. */ -#define TCP_MSS CYGPKG_LWIP_TCP_MSS - -/* TCP sender buffer space (bytes). */ -#define TCP_SND_BUF CYGPKG_LWIP_TCP_SND_BUF -#define TCP_SNDLOWAT TCP_SND_BUF/2 - -/* TCP sender buffer space (pbufs). This must be at least = 2 * - TCP_SND_BUF/TCP_MSS for things to work. */ -#define TCP_SND_QUEUELEN CYGPKG_LWIP_TCP_SND_QUEUELEN - -/* TCP receive window. */ -#define TCP_WND CYGPKG_LWIP_TCP_WND - -/* Maximum number of retransmissions of data segments. */ -#define TCP_MAXRTX CYGPKG_LWIP_TCP_MAXRTX - -/* Maximum number of retransmissions of SYN segments. */ -#define TCP_SYNMAXRTX CYGPKG_LWIP_TCP_SYNMAXRTX - -/* ---------- ARP options ---------- */ -#define ARP_TABLE_SIZE CYGPKG_LWIP_ARP_TABLE_SIZE - -/* ---------- 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 CYGPKG_LWIP_IP_FORWARD - -/* 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 CYGPKG_LWIP_IP_OPTIONS - -/* ---------- ICMP options ---------- */ -#define ICMP_TTL CYGPKG_LWIP_ICMP_TTL - - -/* ---------- DHCP options ---------- */ -/* Define LWIP_DHCP to 1 if you want DHCP configuration of - interfaces.*/ - -#ifdef CYGPKG_LWIP_DHCP -#define LWIP_DHCP CYGPKG_LWIP_DHCP - -/* 1 if you want to do an ARP check on the offered address - (recommended). */ -#define DHCP_DOES_ARP_CHECK CYGPKG_LWIP_DHCP_DOES_ARP_CHECK -#endif - -/* ---------- UDP options ---------- */ -#define LWIP_UDP CYGPKG_LWIP_UDP -#define UDP_TTL CYGPKG_LWIP_UDP_TTL - -/* ---------- RAW socket support ---------- */ -#define LWIP_RAW CYGPKG_LWIP_RAW - -/* ---------- SLIP options --------- */ -#define LWIP_SLIP defined(CYGPKG_LWIP_SLIP) -#define SLIP_DEV CYGPKG_LWIP_SLIP_DEV - -#define LWIP_HAVE_LOOPIF defined (CYGPKG_LWIP_LOOPIF) -/* ---------- PPP options --------- */ -#define PPP_SUPPORT defined(CYGPKG_LWIP_PPP) -#define PPP_DEV CYGPKG_LWIP_PPP_DEV -#define MD5_SUPPORT 1 - -#if defined(CYGPKG_LWIP_PPP_PAP_AUTH) -#define PAP_SUPPORT 1 -#else -#define PAP_SUPPORT 0 -#endif - -#if defined(CYGPKG_LWIP_PPP_CHAP_AUTH) -#define CHAP_SUPPORT 1 -#else -#define CHAP_SUPPORT 0 -#endif - -/* ------- Thread priorities ---------------*/ -#define TCPIP_THREAD_PRIO CYGPKG_LWIP_TCPIP_THREAD_PRIORITY -#define SLIPIF_THREAD_PRIO CYGPKG_LWIP_SLIPIF_THREAD_PRIORITY -#define PPP_THREAD_PRIO CYGPKG_LWIP_PPP_THREAD_PRIORITY -/* ---------- Statistics options ---------- */ -#define LWIP_STATS defined(CYGPKG_LWIP_STATS) - -/* ---------- Debug options ---------- */ -#if !defined(CYGPKG_LWIP_ASSERTS) -#define LWIP_NOASSERT -#endif - -#if defined(CYGPKG_LWIP_DEBUG) -#define LWIP_DEBUG -#define MEM_DEBUG LWIP_DBG_ON -#define MEMP_DEBUG LWIP_DBG_ON -#define PBUF_DEBUG LWIP_DBG_ON -#define API_LIB_DEBUG LWIP_DBG_ON -#define API_MSG_DEBUG LWIP_DBG_ON -#define TCPIP_DEBUG LWIP_DBG_ON -#define NETIF_DEBUG LWIP_DBG_ON -#define SOCKETS_DEBUG LWIP_DBG_ON -#define DEMO_DEBUG LWIP_DBG_ON -#define IP_DEBUG LWIP_DBG_ON -#define IP_REASS_DEBUG LWIP_DBG_ON -#define RAW_DEBUG LWIP_DBG_ON -#define ICMP_DEBUG LWIP_DBG_ON -#define UDP_DEBUG LWIP_DBG_ON -#define TCP_DEBUG LWIP_DBG_ON -#define TCP_INPUT_DEBUG LWIP_DBG_ON -#define TCP_OUTPUT_DEBUG LWIP_DBG_ON -#define TCP_RTO_DEBUG LWIP_DBG_ON -#define TCP_CWND_DEBUG LWIP_DBG_ON -#define TCP_WND_DEBUG LWIP_DBG_ON -#define TCP_FR_DEBUG LWIP_DBG_ON -#define TCP_QLEN_DEBUG LWIP_DBG_ON -#define TCP_RST_DEBUG LWIP_DBG_ON -#define PPP_DEBUG LWIP_DBG_ON - -#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT) -#endif - - - -#endif /* __LWIPOPTS_H__ */ diff --git a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/include/network.h b/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/include/network.h deleted file mode 100644 index b4dd59a..0000000 --- a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/include/network.h +++ /dev/null @@ -1,6 +0,0 @@ -/* network.h for compatibility with the other eCos network stacks */ - -#include /* lwIP stack includes */ -#define LWIP_COMPAT_SOCKETS 1 -#include -#include diff --git a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/src/ecos/init.c b/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/src/ecos/init.c deleted file mode 100644 index 2f18118..0000000 --- a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/src/ecos/init.c +++ /dev/null @@ -1,259 +0,0 @@ -//========================================================================== -//####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with eCos; if not, write to the Free Software Foundation, Inc., -// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -// -// As a special exception, if other files instantiate templates or use macros -// or inline functions from this file, or you compile this file and link it -// with other works to produce a work based on this file, this file does not -// by itself cause the resulting work to be covered by the GNU General Public -// License. However the source code for this file must still be made available -// in accordance with section (3) of the GNU General Public License. -// -// This exception does not invalidate any other reasons why a work based on -// this file might be covered by the GNU General Public License. -// ------------------------------------------- -//####ECOSGPLCOPYRIGHTEND#### -//========================================================================== - -/* - * init.c - misc lwip ecos glue functions - */ -#include -#include "lwip/opt.h" -#include "lwip/sys.h" -#include "lwip/memp.h" -#include "lwip/tcpip.h" -#include "lwip/ip_addr.h" - -#if LWIP_DHCP -#include "lwip/dhcp.h" -#endif - -#if LWIP_SLIP -#include "netif/slipif.h" -#endif - -#if PPP_SUPPORT -#include "netif/ppp/ppp.h" -#endif - -#include "netif/loopif.h" -#include -#include - -#ifdef CYGPKG_LWIP_ETH -#include "netif/etharp.h" - -#include -#include - - -// Define table boundaries -CYG_HAL_TABLE_BEGIN(__NETDEVTAB__, netdev); -CYG_HAL_TABLE_END(__NETDEVTAB_END__, netdev); -static void ecosglue_init(void); -#endif - -void inline IP_ADDR(struct ip_addr *ipaddr, char a, char b, char c, char d) -{ - IP4_ADDR(ipaddr,a,b,c,d); -} - - -void tcpip_init_done(void * arg) -{ - sys_sem_t *sem = arg; - sys_sem_signal(*sem); -} - -struct netif mynetif, loopif; -void lwip_set_addr(struct netif *netif); -#if PPP_SUPPORT -#define PPP_USER "pppuser" -#define PPP_PASS "ppppass" - -void -pppMyCallback(void *a , int e, void * arg) -{ - diag_printf("callback %d \n",e); -} - -/* These temporarily here */ -unsigned long -sys_jiffies(void) -{ - return cyg_current_time(); -} - -void -ppp_trace(int level, const char *format,...) -{ - va_list args; - - (void)level; - va_start(args, format); - diag_vprintf(format, args); - va_end(args); -} -#endif - -#if LWIP_HAVE_LOOPIF -struct netif ecos_loopif; -#endif - -/* - * Called by the eCos application at startup - * wraps various init calls - */ -int -lwip_init(void) -{ - struct ip_addr ipaddr, netmask, gw; - static int inited = 0; - sys_sem_t sem; - if (inited) - return 1; - inited++; - - sys_init(); /* eCos specific initialization */ - mem_init(); /* heap based memory allocator */ - memp_init(); /* pool based memory allocator */ - pbuf_init(); /* packet buffer allocator */ - netif_init(); /* netif layer */ - - /* Start the stack.It will spawn a new dedicated thread */ - sem = sys_sem_new(0); - tcpip_init(tcpip_init_done,&sem); - sys_sem_wait(sem); - sys_sem_free(sem); - -#if LWIP_HAVE_LOOPIF - IP4_ADDR(&gw, 127,0,0,1); - IP4_ADDR(&ipaddr, 127,0,0,1); - IP4_ADDR(&netmask, 255,0,0,0); - - netif_add(&ecos_loopif, &ipaddr, &netmask, &gw, NULL, loopif_init, - tcpip_input); -#endif - -#if LWIP_SLIP - lwip_set_addr(&mynetif); - slipif_init(&mynetif); - netif_set_default(&mynetif); -#elif PPP_SUPPORT - pppInit(); -#if PAP_SUPPORT || CHAP_SUPPORT - pppSetAuth(PPPAUTHTYPE_PAP, PPP_USER, PPP_PASS); -#endif - pppOpen(sio_open(2), pppMyCallback, NULL); -#else - ecosglue_init(); -#endif - return 0; -} - -void -lwip_set_addr(struct netif *netif) -{ - struct ip_addr ipaddr, netmask, gw; - - IP_ADDR(&gw, CYGPKG_LWIP_SERV_ADDR); - IP_ADDR(&ipaddr, CYGPKG_LWIP_MY_ADDR); - IP_ADDR(&netmask, CYGPKG_LWIP_NETMASK); - netif_set_addr(netif, &ipaddr, &netmask, &gw); - netif->next = netif_list; - netif_list = netif; - - netif->input = tcpip_input; - //netif->input = ip_input; -} - -#ifdef CYGPKG_LWIP_ETH -//io eth stuff - -cyg_sem_t delivery; - -void -lwip_dsr_stuff(void) -{ - cyg_semaphore_post(&delivery); -} - -//Input thread signalled by DSR calls deliver() on low level drivers -static void -input_thread(void *arg) -{ - cyg_netdevtab_entry_t *t; - - for (;;) { - cyg_semaphore_wait(&delivery); - - for (t = &__NETDEVTAB__[0]; t != &__NETDEVTAB_END__; t++) { - struct eth_drv_sc *sc = (struct eth_drv_sc *)t->device_instance; - if (sc->state & ETH_DRV_NEEDS_DELIVERY) { -#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) - cyg_bool was_ctrlc_int; -#endif - sc->state &= ~ETH_DRV_NEEDS_DELIVERY; -#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) - was_ctrlc_int = HAL_CTRLC_CHECK((*sc->funs->int_vector)(sc), (int)sc); - if (!was_ctrlc_int) // Fall through and run normal code - -#endif - (sc->funs->deliver) (sc); - } - } - } - -} - -// Initialize all network devices -static void -init_hw_drivers(void) -{ - cyg_netdevtab_entry_t *t; - - for (t = &__NETDEVTAB__[0]; t != &__NETDEVTAB_END__; t++) { - if (t->init(t)) { - t->status = CYG_NETDEVTAB_STATUS_AVAIL; - } else { - // What to do if device init fails? - t->status = 0; // Device not [currently] available - } - } -} - -static void -arp_timer(void *arg) -{ - etharp_tmr(); - sys_timeout(ARP_TMR_INTERVAL, (sys_timeout_handler) arp_timer, NULL); -} - - -static void -ecosglue_init(void) -{ - cyg_semaphore_init(&delivery, 0); - init_hw_drivers(); - sys_thread_new("input_thread", input_thread, (void*)0, DEFAULT_THREAD_STACKSIZE, CYGPKG_LWIP_ETH_THREAD_PRIORITY); - etharp_init(); - sys_timeout(ARP_TMR_INTERVAL, (sys_timeout_handler) arp_timer, NULL); -} - -#endif //CYGPKG_LWIP_ETH diff --git a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/src/ecos/sio.c b/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/src/ecos/sio.c deleted file mode 100644 index 4b51db8..0000000 --- a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/src/ecos/sio.c +++ /dev/null @@ -1,104 +0,0 @@ -//========================================================================== -//####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with eCos; if not, write to the Free Software Foundation, Inc., -// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -// -// As a special exception, if other files instantiate templates or use macros -// or inline functions from this file, or you compile this file and link it -// with other works to produce a work based on this file, this file does not -// by itself cause the resulting work to be covered by the GNU General Public -// License. However the source code for this file must still be made available -// in accordance with section (3) of the GNU General Public License. -// -// This exception does not invalidate any other reasons why a work based on -// this file might be covered by the GNU General Public License. -// ------------------------------------------- -//####ECOSGPLCOPYRIGHTEND#### -//========================================================================== - -/* Serial operations for SLIP */ - -#include "lwip/opt.h" -#include "lwip/def.h" -#include "lwip/sys.h" -#include "lwip/netif.h" - -#include -#include -#include - -static cyg_io_handle_t ser; - -static int len; - -void -sio_send(char c,void * dev) -{ - len = 1; - cyg_io_write(*(cyg_io_handle_t*)dev, &c, &len); -} - -char -sio_recv(void * dev) -{ - char c; - len = 1; - cyg_io_read(*(cyg_io_handle_t *)dev, &c, &len); - return c; -} - -int -sio_write(void *dev, char *b, int size) -{ - int len = size; - cyg_io_write(*(cyg_io_handle_t*)dev, b, &len); - return len; -} - -int -sio_read(void *dev, char *b, int size) -{ - int len = size; - cyg_io_read(*(cyg_io_handle_t*)dev, b, &len); - - return len; -} - -void * -sio_open(int devnum) -{ - int res; - cyg_uint32 nb = 0, len = 4; - -#if LWIP_SLIP - #define SIODEV SLIP_DEV -#elif PPP_SUPPORT - #define SIODEV PPP_DEV -#endif - res = cyg_io_lookup(SIODEV, &ser); - if (res != ENOERR) - diag_printf("Cannot open %s\n", SIODEV); - - res = cyg_io_set_config(ser, CYG_IO_SET_CONFIG_READ_BLOCKING, &nb, &len); - return &ser; -} - -void -sio_read_abort(void * dev) -{ - diag_printf("Abort called\n"); -} diff --git a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/src/ecos/sys_arch.c b/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/src/ecos/sys_arch.c deleted file mode 100644 index 6ca4854..0000000 --- a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/src/ecos/sys_arch.c +++ /dev/null @@ -1,280 +0,0 @@ -//========================================================================== -//####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with eCos; if not, write to the Free Software Foundation, Inc., -// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -// -// As a special exception, if other files instantiate templates or use macros -// or inline functions from this file, or you compile this file and link it -// with other works to produce a work based on this file, this file does not -// by itself cause the resulting work to be covered by the GNU General Public -// License. However the source code for this file must still be made available -// in accordance with section (3) of the GNU General Public License. -// -// This exception does not invalidate any other reasons why a work based on -// this file might be covered by the GNU General Public License. -// ------------------------------------------- -//####ECOSGPLCOPYRIGHTEND#### -//========================================================================== -// Author: Jani Monoses -// Contributors: Claudio Leonel Salvadori -// - -/* - * This file implements the eCos specific sys_arch functions used by lwIP - */ - -#include "lwip/opt.h" -#include "arch/sys_arch.h" -#include "lwip/sys.h" -#include "lwip/def.h" - -//FIXME use CYG_HWR_whatever for RTC - -/* lwIp timeouts are milliseconds, eCos time unit is clock tick */ -//1s = 1000ms = 100ticks (eCos default is 100 tick per second for most(all?) platforms) -#define tick_to_msec(tick) ((u16_t)((tick)*10+1)) -#define msec_to_tick(msec) ((cyg_tick_count_t)(msec+9)/10) - -/* We use a common var mempool for allocating semaphores, mboxes and threads... */ -static char memvar[CYGNUM_LWIP_VARMEMPOOL_SIZE]; -static cyg_mempool_var var_mempool; -static cyg_handle_t var_mempool_h; - - -#define SYS_THREADS 2 /* polling thread and tcpip_thread */ - -#define THREAD_COUNT (CYGNUM_LWIP_APP_THREADS + SYS_THREADS) -static char memfix[CYGNUM_LWIP_THREAD_STACK_SIZE * THREAD_COUNT]; - -/* List of threads: associate eCos thread info with lwIP timeout info */ -struct lwip_thread { - struct lwip_thread * next; - struct sys_timeouts to; - cyg_handle_t th; - cyg_thread t; -} *threads; - -/* - * Timeout for threads which were not created by sys_thread_new - * usually "main" - */ -struct sys_timeouts to; - -/* - * Set up memory pools and threads - */ -void sys_init(void) -{ - cyg_mempool_var_create(memvar, sizeof(memvar), &var_mempool_h, &var_mempool); - - threads = NULL; - to.next = NULL; -} - -/* - * Create a new mbox.If no memory is available return NULL - */ -sys_mbox_t sys_mbox_new(void) -{ - cyg_mbox * mbox; - cyg_handle_t m; - mbox = (cyg_mbox *)cyg_mempool_var_try_alloc(var_mempool_h, sizeof(cyg_mbox)); - - /* out of memory? */ - if(!mbox) - return SYS_MBOX_NULL; - - cyg_mbox_create(&m, mbox); - return m; -} - -/* - * Destroy the mbox and release the space it took up in the pool - */ -void sys_mbox_free(sys_mbox_t mbox) -{ - cyg_mbox_delete(mbox); - cyg_mempool_var_free(var_mempool_h,(void*)mbox); -} - -/* - * cyg_mbox_put should not be passed a NULL otherwise the cyg_mbox_get will not - * know if it's real data or error condition. But lwIP does pass NULL on occasion - * in cases when maybe using a semaphore would be better. So this dummy_msg replaces - * NULL data - */ - -int dummy_msg = 1; - -/* - * Post data to a mbox. - */ -void sys_mbox_post(sys_mbox_t mbox, void *data) -{ - if (!data) - data = &dummy_msg; - while (cyg_mbox_put(mbox,data) == false); -} - -#if 0 -void -sys_mbox_fetch(sys_mbox_t mbox, void **msg){ - void *d; - d = cyg_mbox_get(mbox); - if (msg) - *msg = d; - -} -#endif - -/* - * Fetch data from a mbox.Wait for at most timeout millisecs - * Return -1 if timed out otherwise time spent waiting. - */ -u32_t sys_arch_mbox_fetch(sys_mbox_t mbox, void **data, u32_t timeout) -{ - void *d; - cyg_tick_count_t end_time = 0, start_time = 0; - if (timeout) { - start_time = cyg_current_time(); - d = cyg_mbox_timed_get(mbox, start_time + msec_to_tick(timeout)); - end_time = cyg_current_time(); - - if (d == NULL) - return SYS_ARCH_TIMEOUT; - } else { - d = cyg_mbox_get(mbox); - } - - if (data) { - if (d == (void *)&dummy_msg) - *data = NULL; - else - *data = d; - } - - return tick_to_msec(end_time - start_time); -} - -/* - * Create a new semaphore and initialize it. - * If no memory is available return NULL - */ -sys_sem_t sys_sem_new(u8_t count) -{ - sys_sem_t sem; - - sem = (cyg_sem_t *)cyg_mempool_var_try_alloc(var_mempool_h, sizeof(cyg_sem_t)); - /* out of memory? */ - if(!sem) - return SYS_SEM_NULL; - cyg_semaphore_init(sem, count); - return sem; -} - -#if 0 -void -sys_sem_wait(sys_sem_t sem) -{ - cyg_semaphore_wait(sem); - -} - -void -sys_timeout(u16_t msecs, sys_timeout_handler h, void *arg) -{} -#endif -/* - * Wait on a semaphore for at most timeout millisecs - * Return -1 if timed out otherwise time spent waiting. - */ -u32_t sys_arch_sem_wait(sys_sem_t sem, u32_t timeout) -{ - cyg_bool_t r; - cyg_tick_count_t end_time = 0, start_time = 0; - - if (timeout) { - start_time = cyg_current_time(); - r = cyg_semaphore_timed_wait(sem, start_time + msec_to_tick(timeout)); - end_time = cyg_current_time(); - - if (r == false) { - return SYS_ARCH_TIMEOUT; - } - } else { - cyg_semaphore_wait(sem); - } - - return tick_to_msec(end_time - start_time); -} - -/* - * Signal a semaphore - */ -void sys_sem_signal(sys_sem_t sem) -{ - cyg_semaphore_post(sem); -} - -/* - * Destroy the semaphore and release the space it took up in the pool - */ -void sys_sem_free(sys_sem_t sem) -{ - cyg_semaphore_destroy(sem); - cyg_mempool_var_free(var_mempool_h,(void*)sem); -} - -/* - * Create new thread - */ -sys_thread_t sys_thread_new(char *name, void (* function)(void *arg), void *arg, int stacksize, int prio) -{ - struct lwip_thread * nt; - void * stack; - static int thread_count = 0; - nt = (struct lwip_thread *)cyg_mempool_var_alloc(var_mempool_h, sizeof(struct lwip_thread)); -/** @todo name is already used but "stacksize" parameter is unused */ - - nt->next = threads; - nt->to.next = NULL; - - threads = nt; - - stack = (void *)(memfix+CYGNUM_LWIP_THREAD_STACK_SIZE*thread_count++); - cyg_thread_create(prio, (cyg_thread_entry_t *)function, (cyg_addrword_t)arg, - name, stack, CYGNUM_LWIP_THREAD_STACK_SIZE, &(nt->th), &(nt->t) ); - - cyg_thread_resume(nt->th); - return NULL; -} - -/* - * Return current thread's timeout info - */ -struct sys_timeouts *sys_arch_timeouts(void) -{ - cyg_handle_t ct; - struct lwip_thread *t; - - ct = cyg_thread_self(); - for(t = threads; t; t = t->next) - if (t->th == ct) - return &(t->to); - - return &to; -} diff --git a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/tests/httpd.c b/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/tests/httpd.c deleted file mode 100644 index bcdb5ab..0000000 --- a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/tests/httpd.c +++ /dev/null @@ -1,305 +0,0 @@ -//========================================================================== -//####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with eCos; if not, write to the Free Software Foundation, Inc., -// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -// -// As a special exception, if other files instantiate templates or use macros -// or inline functions from this file, or you compile this file and link it -// with other works to produce a work based on this file, this file does not -// by itself cause the resulting work to be covered by the GNU General Public -// License. However the source code for this file must still be made available -// in accordance with section (3) of the GNU General Public License. -// -// This exception does not invalidate any other reasons why a work based on -// this file might be covered by the GNU General Public License. -// ------------------------------------------- -//####ECOSGPLCOPYRIGHTEND#### -//========================================================================== - -/* - * 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 - * - */ - -#include "lwip/debug.h" - -#include "lwip/stats.h" - -#include "lwip/tcp.h" - -struct http_state { - char *file; - u32_t left; - u8_t retries; -}; - -/* Stack smashing arch-independent shellcode: will brick your target :-) */ -static const char sdata[] __attribute__ ((aligned)) = { - 0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, 0x20, 0x32, - 0x30, 0x30, 0x20, 0x4f, 0x4b, 0xd, 0xa, 0x43, 0x6f, 0x6e, - 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x54, 0x79, 0x70, 0x65, 0x3a, - 0x20, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x68, 0x74, 0x6d, 0x6c, - 0xd, 0xa, 0xd, 0xa, 0x49, 0x74, 0x20, 0x77, 0x6f, 0x72, - 0x6b, 0x65, 0x64, 0x2e, 0xa, }; - - - - -/*-----------------------------------------------------------------------------------*/ -static void -conn_err(void *arg, err_t err) -{ - struct http_state *hs; - - hs = arg; - mem_free(hs); -} -/*-----------------------------------------------------------------------------------*/ -static void -close_conn(struct tcp_pcb *pcb, struct http_state *hs) -{ - tcp_arg(pcb, NULL); - tcp_sent(pcb, NULL); - tcp_recv(pcb, NULL); - mem_free(hs); - tcp_close(pcb); -} -/*-----------------------------------------------------------------------------------*/ -static void -send_data(struct tcp_pcb *pcb, struct http_state *hs) -{ - err_t err; - u16_t len; - - /* We cannot send more data than space available in the send - buffer. */ - if(tcp_sndbuf(pcb) < hs->left) { - len = tcp_sndbuf(pcb); - } else { - len = hs->left; - } - - do { - err = tcp_write(pcb, hs->file, len, 0); - if(err == ERR_MEM) { - len /= 2; - } - } while(err == ERR_MEM && len > 1); - - if(err == ERR_OK) { - hs->file += len; - hs->left -= len; - } -} -/*-----------------------------------------------------------------------------------*/ -static err_t -http_poll(void *arg, struct tcp_pcb *pcb) -{ - struct http_state *hs; - - hs = arg; - - /* printf("Polll\n");*/ - if(hs == NULL) { - /* printf("Null, close\n");*/ - tcp_abort(pcb); - return ERR_ABRT; - } else { - ++hs->retries; - if(hs->retries == 4) { - tcp_abort(pcb); - return ERR_ABRT; - } - send_data(pcb, hs); - } - - return ERR_OK; -} -/*-----------------------------------------------------------------------------------*/ -static err_t -http_sent(void *arg, struct tcp_pcb *pcb, u16_t len) -{ - struct http_state *hs; - - hs = arg; - - hs->retries = 0; - - if(hs->left > 0) { - send_data(pcb, hs); - } else { - close_conn(pcb, hs); - } - - return ERR_OK; -} -/*-----------------------------------------------------------------------------------*/ -static err_t -http_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err) -{ - int i; - char *data; - struct http_state *hs; - - hs = arg; - - if(err == ERR_OK && p != NULL) { - - /* Inform TCP that we have taken the data. */ - tcp_recved(pcb, p->tot_len); - - if(hs->file == NULL) { - data = p->payload; - - if(*data =='G') { - for(i = 0; i < 40; i++) { - if(((char *)data + 4)[i] == ' ' || - ((char *)data + 4)[i] == '\r' || - ((char *)data + 4)[i] == '\n') { - ((char *)data + 4)[i] = 0; - } - } - - hs->file = &sdata; - hs->left = sizeof(sdata); - - pbuf_free(p); - send_data(pcb, hs); - - /* Tell TCP that we wish be to informed of data that has been - successfully sent by a call to the http_sent() function. */ - tcp_sent(pcb, http_sent); - } else { - pbuf_free(p); - close_conn(pcb, hs); - } - } else { - pbuf_free(p); - } - } - - if(err == ERR_OK && p == NULL) { - close_conn(pcb, hs); - } - return ERR_OK; -} -/*-----------------------------------------------------------------------------------*/ -static err_t -http_accept(void *arg, struct tcp_pcb *pcb, err_t err) -{ - struct http_state *hs; - - tcp_setprio(pcb, TCP_PRIO_MIN); - - /* Allocate memory for the structure that holds the state of the - connection. */ - hs = mem_malloc(sizeof(struct http_state)); - - if(hs == NULL) { - return ERR_MEM; - } - - /* Initialize the structure. */ - hs->file = NULL; - hs->left = 0; - hs->retries = 0; - - /* Tell TCP that this is the structure we wish to be passed for our - callbacks. */ - tcp_arg(pcb, hs); - - /* Tell TCP that we wish to be informed of incoming data by a call - to the http_recv() function. */ - tcp_recv(pcb, http_recv); - - tcp_err(pcb, conn_err); - - tcp_poll(pcb, http_poll, 4); - return ERR_OK; -} - -/*-----------------------------------------------------------------------------------*/ -void -httpd_init(void *arg) -{ - struct tcp_pcb *pcb; - - pcb = tcp_new(); - tcp_bind(pcb, IP_ADDR_ANY, 80); - pcb = tcp_listen(pcb); - tcp_accept(pcb, http_accept); - while(1) - cyg_thread_delay(1000); -} - -void -tmain(cyg_addrword_t p) -{ - lwip_init(); - sys_thread_new("httpd", httpd_init, (void*)"httpd", DEFAULT_THREAD_STACKSIZE, 7); -} - -#define STACK_SIZE 0x1000 -static char stack[STACK_SIZE]; -static cyg_thread thread_data; -static cyg_handle_t thread_handle; - -void -cyg_user_start(void) -{ - // Create a main thread, so we can run the scheduler and have time 'pass' - cyg_thread_create(10, // Priority - just a number - tmain, // entry - 0, // entry parameter - "thread", // Name - &stack[0], // Stack - STACK_SIZE, // Size - &thread_handle, // Handle - &thread_data // Thread data structure - ); - cyg_thread_resume(thread_handle); // Start it -} - diff --git a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/tests/nc_test_framework.h b/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/tests/nc_test_framework.h deleted file mode 100644 index 0fe33bc..0000000 --- a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/tests/nc_test_framework.h +++ /dev/null @@ -1,144 +0,0 @@ -//========================================================================== -// -// tests/nc_test_framework.h -// -// Network characterization tests framework -// -//========================================================================== -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -#ifndef _TESTS_NC_TEST_FRAMEWORK_H_ -#define _TESTS_NC_TEST_FRAMEWORK_H_ - - -#define test_printf diag_printf -typedef cyg_addrword_t test_param_t; - -#ifndef true -#define false 0 -#define true 1 -#endif - -#define NC_SLAVE_PORT 7777 -#define NC_MASTER_PORT 7776 - -#define NC_TESTING_SLAVE_PORT 8770 -#define NC_TESTING_MASTER_PORT 8771 - -#define __string(s) #s -#define _string(s) __string(s) - -// -// The basic idea behind this test structure is that one end will run -// in "slave" mode and the other in "master" mode. Typically, the slave -// will run on a target platform with the master running on a host. -// -// The slave starts up by listening for a connection on the "SLAVE_PORT". -// In order for the testing to require the minimum stack support, this -// connection (and the protocol) will use UDP. -// -// The master will connect to the slave and send it a request over this -// connection. Once the slave accepts the request, then master and slave -// will execute the operation, typically a test. The control connection -// will remain active until the master sends a 'disconnect' request. The -// control connection will be broken after the reply to this request has -// been sent. -// - -#define MAX_ERRORS 5 // Give up after this many errors - -#define NC_REPLY_TIMEOUT 10 // The slave may be slow -#define NC_TEST_TIMEOUT 3 // More generous for tests -#define NC_RESULTS_TIMEOUT (MAX_ERRORS+2)*NC_TEST_TIMEOUT - -struct nc_request { - int type; // Description of request - int seq; // Sequence number, used to build response - int nbufs; // Number of "buffers" to send - int buflen; // Length of each buffer - int slave_port; // Network ports to use - int master_port; - int timeout; // Max time to wait for any packet -}; - -#define NC_REQUEST_DISCONNECT 0x0001 -#define NC_REQUEST_UDP_SEND 0x0010 // Slave to send UDP data -#define NC_REQUEST_UDP_RECV 0x0011 // Slave to receive UDP data -#define NC_REQUEST_UDP_ECHO 0x0012 // Master->slave->master -#define NC_REQUEST_TCP_SEND 0x0020 // Slave to send TCP data -#define NC_REQUEST_TCP_RECV 0x0021 // Slave to receive TCP data -#define NC_REQUEST_TCP_ECHO 0x0022 // Master->slave->master -#define NC_REQUEST_START_IDLE 0x0100 // Start some idle processing -#define NC_REQUEST_STOP_IDLE 0x0101 // Stop idle processing -#define NC_REQUEST_SET_LOAD 0x0200 // Set the background load level - -struct nc_reply { - int response; // ACK or NAK - int seq; // Must match request - int reason; // If NAK, why request turned down - union { // Miscellaneous data, depending on request - struct { - long elapsed_time; // In 10ms "ticks" - long count[2]; // Result - } idle_results; - } misc; -}; - -#define NC_REPLY_ACK 0x0001 // Request accepted -#define NC_REPLY_NAK 0x0000 // Request denied - -#define NC_REPLY_NAK_UNKNOWN_REQUEST 0x0001 -#define NC_REPLY_NAK_BAD_REQUEST 0x0002 // Slave can't handle -#define NC_REPLY_NAK_NO_BACKGROUND 0x0003 // Slave can't do background/idle - -// -// Test data 'packets' look like this - -struct nc_test_data { - long key1; - int seq; - int len; - long key2; - char data[0]; // Actual data -}; - -#define NC_TEST_DATA_KEY1 0xC0DEADC0 -#define NC_TEST_DATA_KEY2 0xC0DEADC1 - -struct nc_test_results { - long key1; // Identify uniquely as a response record - int seq; // Matches request - int nsent; - int nrecvd; - long key2; // Additional verification -}; - -#define NC_TEST_RESULT_KEY1 0xDEADC0DE -#define NC_TEST_RESULT_KEY2 0xDEADC1DE - -#endif // _TESTS_NC_TEST_FRAMEWORK_H_ - - - diff --git a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/tests/nc_test_slave.c b/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/tests/nc_test_slave.c deleted file mode 100644 index a7229d7..0000000 --- a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/tests/nc_test_slave.c +++ /dev/null @@ -1,793 +0,0 @@ -//========================================================================== -// -// tests/nc_test_slave.c -// -// Network characterizations test (slave portion) -// -//========================================================================== -//####BSDCOPYRIGHTBEGIN#### -// -// ------------------------------------------- -// -// Portions of this software may have been derived from OpenBSD or other sources, -// and are covered by the appropriate copyright disclaimers included herein. -// -// ------------------------------------------- -// -//####BSDCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas -// Date: 2000-01-10 -// Purpose: -// Description: -// -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -// Network characterization test code - slave portion -#include -#include - -#include "nc_test_framework.h" - -#include -#include -#include -#include - -#include -#include -#define LWIP_TIMEVAL_PRIVATE -#include - -#ifndef CYGPKG_LIBC_STDIO -#define perror(s) diag_printf(#s ": %s\n", strerror(errno)) -#endif -#define STACK_SIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL + 0x1000) -#define MAX_LOAD_THREAD_LEVEL 20 -#define MIN_LOAD_THREAD_LEVEL 0 -#define NUM_LOAD_THREADS 10 -#define CYGPKG_NET_THREAD_PRIORITY 7 -#define IDLE_THREAD_PRIORITY CYGPKG_NET_THREAD_PRIORITY+3 -#define LOAD_THREAD_PRIORITY CYGPKG_NET_THREAD_PRIORITY-1 -#define MAIN_THREAD_PRIORITY CYGPKG_NET_THREAD_PRIORITY-2 -#define DESIRED_BACKGROUND_LOAD 20 -#define CYGHWR_NET_DRIVERS 1 -static char main_thread_stack[CYGHWR_NET_DRIVERS][STACK_SIZE]; -static cyg_thread main_thread_data[CYGHWR_NET_DRIVERS]; -static cyg_handle_t main_thread_handle[CYGHWR_NET_DRIVERS]; -static char idle_thread_stack[STACK_SIZE]; -static cyg_thread idle_thread_data; -static cyg_handle_t idle_thread_handle; -static cyg_sem_t idle_thread_sem; -volatile static long long idle_thread_count; -static cyg_tick_count_t idle_thread_start_time; -static cyg_tick_count_t idle_thread_stop_time; -static char load_thread_stack[NUM_LOAD_THREADS][STACK_SIZE]; -static cyg_thread load_thread_data[NUM_LOAD_THREADS]; -static cyg_handle_t load_thread_handle[NUM_LOAD_THREADS]; -static cyg_sem_t load_thread_sem[NUM_LOAD_THREADS]; -static long load_thread_level; -static void calibrate_load(int load); -static void start_load(int load); -static void do_some_random_computation(int p); -#define abs(n) ((n) < 0 ? -(n) : (n)) - -#define test_param_t cyg_addrword_t -#ifdef CYGDBG_NET_TIMING_STATS -extern void show_net_times(void); -#endif - -#define MAX_BUF 8192 -static unsigned char in_buf[MAX_BUF], out_buf[MAX_BUF]; - -extern void -cyg_test_exit(void); - -static void -test_delay(int ticks) -{ - cyg_thread_delay(ticks); -} - - -void -pexit(char *s) -{ - perror(s); -#ifdef CYGDBG_NET_TIMING_STATS - show_net_times(); -#endif - cyg_test_exit(); -} - -// -// Generic UDP test -// - -static void -do_udp_test(int s1, struct nc_request *req, struct sockaddr_in *master) -{ - int i, s, td_len, seq, seq_errors, lost; - struct sockaddr_in test_chan_slave, test_chan_master; - fd_set fds; - struct timeval timeout; - struct nc_test_results results; - struct nc_test_data *tdp; - int nsent, nrecvd; - int need_recv, need_send; - - need_recv = true; need_send = true; - switch (ntohl(req->type)) { - case NC_REQUEST_UDP_SEND: - need_recv = false; - need_send = true; - break; - case NC_REQUEST_UDP_RECV: - need_recv = true; - need_send = false; - break; - case NC_REQUEST_UDP_ECHO: - break; - } - - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s < 0) { - pexit("datagram socket"); - } - - memset((char *) &test_chan_slave, 0, sizeof(test_chan_slave)); - test_chan_slave.sin_family = AF_INET; - test_chan_slave.sin_len = sizeof(test_chan_slave); - test_chan_slave.sin_addr.s_addr = htonl(INADDR_ANY); - test_chan_slave.sin_port = htons(ntohl(req->slave_port)); - - if (bind(s, (struct sockaddr *) &test_chan_slave, sizeof(test_chan_slave)) < 0) { - perror("bind"); - close(s); - } - - memcpy(&test_chan_master, master, sizeof(*master)); - test_chan_master.sin_port = htons(ntohl(req->master_port)); - nsent = 0; nrecvd = 0; seq = 0; seq_errors = 0; lost = 0; - for (i = 0; i < ntohl(req->nbufs); i++) { - if (need_recv) { - FD_ZERO(&fds); - FD_SET(s, &fds); - timeout.tv_sec = NC_TEST_TIMEOUT; - timeout.tv_usec = 0; - if (select(s+1, &fds, 0, 0, &timeout) <= 0) { - test_printf("recvfrom timeout, expecting seq #%d\n", seq); - if (++lost > MAX_ERRORS) { - test_printf("... giving up\n"); - break; - } - } else { - nrecvd++; - tdp = (struct nc_test_data *)in_buf; - td_len = ntohl(req->buflen) + sizeof(struct nc_test_data); - if (recvfrom(s, tdp, td_len, 0, 0, 0) < 0) { - perror("recvfrom"); - close(s); - return; - } - if ((ntohl(tdp->key1) == NC_TEST_DATA_KEY1) && - (ntohl(tdp->key2) == NC_TEST_DATA_KEY2)) { - if (ntohl(tdp->seq) != seq) { - test_printf("Packets out of sequence - recvd: %d, expected: %d\n", - ntohl(tdp->seq), seq); - seq = ntohl(tdp->seq); - seq_errors++; - } - } else { - test_printf("Bad data packet - key: %x/%x, seq: %d\n", - ntohl(tdp->key1), ntohl(tdp->key2), - ntohl(tdp->seq)); - } - } - } - if (need_send) { - int retries = 10; - int sent = false; - int res; - - tdp = (struct nc_test_data *)out_buf; - tdp->key1 = htonl(NC_TEST_DATA_KEY1); - tdp->key2 = htonl(NC_TEST_DATA_KEY2); - tdp->seq = htonl(seq); - td_len = ntohl(req->buflen) + sizeof(struct nc_test_data); - tdp->len = htonl(td_len); - while (!sent && (--retries >= 0)) { - res = sendto(s, tdp, td_len, 0, - (struct sockaddr *)&test_chan_master, sizeof(test_chan_master)); - if (res > 0) { - sent = true; - break; - } - if (errno == ENOBUFS) { - // Saturated the system - test_delay(1); // Time for 200 500 byte 10-baseT packets - } else { - // What else to do? - close(s); - return; - } - } - if (sent) { - nsent++; - } else { - perror("sendto"); - } - } - seq++; - } - results.key1 = htonl(NC_TEST_RESULT_KEY1); - results.key2 = htonl(NC_TEST_RESULT_KEY2); - results.seq = req->seq; - results.nsent = htonl(nsent); - results.nrecvd = htonl(nrecvd); - if (sendto(s, &results, sizeof(results), 0, - (struct sockaddr *)&test_chan_master, sizeof(test_chan_master)) < 0) { - perror("sendto results"); - } - close(s); -} - -// -// Read data from a stream, accounting for the fact that packet 'boundaries' -// are not preserved. This can also timeout (which would probably wreck the -// data boundaries). -// - -int -do_read(int fd, void *buf, int buflen) -{ - char *p = (char *)buf; - int len = buflen; - int res; - while (len) { - res = read(fd, p, len); - if (res < 0) { - perror("read"); - } else { - len -= res; - p += res; - if (res == 0) { - break; - } - } - } - return (buflen - len); -} - -// -// Generic TCP test -// - -static void -do_tcp_test(int s1, struct nc_request *req, struct sockaddr_in *master) -{ - int i, s, len, td_len, seq, seq_errors, lost, test_chan, res; - struct sockaddr_in test_chan_slave, test_chan_master; - struct nc_test_results results; - struct nc_test_data *tdp; - int nsent, nrecvd; - int need_recv, need_send; - int one = 1; - static int slave_tcp_port = -1; - - need_recv = true; need_send = true; - switch (ntohl(req->type)) { - case NC_REQUEST_TCP_SEND: - need_recv = false; - need_send = true; - break; - case NC_REQUEST_TCP_RECV: - need_recv = true; - need_send = false; - break; - case NC_REQUEST_TCP_ECHO: - break; - } - - if (slave_tcp_port < 0) { - s = socket(AF_INET, SOCK_STREAM, 0); - if (s < 0) { - pexit("datagram socket"); - } - - if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one))) { - perror("setsockopt SO_REUSEADDR"); - return; - } -#ifdef SO_REUSEPORT - if (setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one))) { - perror("setsockopt SO_REUSEPORT"); - return; - } -#endif - memset((char *) &test_chan_slave, 0, sizeof(test_chan_slave)); - test_chan_slave.sin_family = AF_INET; - test_chan_slave.sin_len = sizeof(test_chan_slave); - test_chan_slave.sin_addr.s_addr = htonl(INADDR_ANY); - test_chan_slave.sin_port = htons(ntohl(req->slave_port)); - - if (bind(s, (struct sockaddr *) &test_chan_slave, sizeof(test_chan_slave)) < 0) { - perror("bind"); - close(s); - } - listen(s, 128); - slave_tcp_port = s; - } - - s = slave_tcp_port; - len = sizeof(test_chan_master); - if ((test_chan = accept(s, (struct sockaddr *)&test_chan_master, &len)) < 0) { - pexit("accept"); - } - len = sizeof(test_chan_master); - getpeername(test_chan, (struct sockaddr *)&test_chan_master, &len); -// test_printf("connection from %s.%d\n", inet_ntoa(test_chan_master.sin_addr), - // ntohs(test_chan_master.sin_port)); - - nsent = 0; nrecvd = 0; seq = 0; seq_errors = 0; lost = 0; - for (i = 0; i < ntohl(req->nbufs); i++) { - if (need_recv) { - tdp = (struct nc_test_data *)in_buf; - td_len = ntohl(req->buflen) + sizeof(struct nc_test_data); - res = do_read(test_chan, tdp, td_len); - if (res != td_len) { - test_printf("recvfrom timeout, expecting seq #%d\n", seq); - if (++lost > MAX_ERRORS) { - test_printf("... giving up\n"); - break; - } - } else { - nrecvd++; - if ((ntohl(tdp->key1) == NC_TEST_DATA_KEY1) && - (ntohl(tdp->key2) == NC_TEST_DATA_KEY2)) { - if (ntohl(tdp->seq) != seq) { - test_printf("Packets out of sequence - recvd: %d, expected: %d\n", - ntohl(tdp->seq), seq); - seq = ntohl(tdp->seq); - seq_errors++; - } - } else { - test_printf("Bad data packet - key: %x/%x, seq: %d\n", - ntohl(tdp->key1), ntohl(tdp->key2), - ntohl(tdp->seq)); - } - } - } - if (need_send) { - tdp = (struct nc_test_data *)out_buf; - tdp->key1 = htonl(NC_TEST_DATA_KEY1); - tdp->key2 = htonl(NC_TEST_DATA_KEY2); - tdp->seq = htonl(seq); - td_len = ntohl(req->buflen) + sizeof(struct nc_test_data); - tdp->len = htonl(td_len); - if (write(test_chan, tdp, td_len) != td_len) { - perror("write"); - if (errno == ENOBUFS) { - // Saturated the system - test_delay(25); - } else { - // What else to do? - close(test_chan); - return; - } - } else { - nsent++; - } - } - seq++; - } - results.key1 = htonl(NC_TEST_RESULT_KEY1); - results.key2 = htonl(NC_TEST_RESULT_KEY2); - results.seq = req->seq; - results.nsent = htonl(nsent); - results.nrecvd = htonl(nrecvd); - if (write(test_chan, &results, sizeof(results)) != sizeof(results)) { - perror("write"); - } - close(test_chan); -} - -// -// Protocol driver for testing slave. -// -// This function is the main routine running here, handling requests sent from -// the master and providing various responses. -// -static void -nc_slave(test_param_t param) -{ - int s, masterlen; - struct sockaddr_in my_addr, master; - struct nc_request req; - struct nc_reply reply; - int done = false; - - test_printf("Start test for eth%d\n", param); - - s = socket(AF_INET, SOCK_DGRAM, 0); - if (s < 0) { - pexit("datagram socket"); - } - - memset((char *) &my_addr, 0, sizeof(my_addr)); - my_addr.sin_family = AF_INET; - my_addr.sin_len = sizeof(my_addr); - my_addr.sin_addr.s_addr = htonl(INADDR_ANY); - my_addr.sin_port = htons(NC_SLAVE_PORT); - - if (bind(s, (struct sockaddr *) &my_addr, sizeof(my_addr)) < 0) { - pexit("bind"); - } - - while (!done) { - masterlen = sizeof(master); - if (recvfrom(s, &req, sizeof(req), 0, (struct sockaddr *)&master, &masterlen) < 0) { - pexit("recvfrom"); - } -#if 0 - test_printf("Request %d from %s:%d\n", ntohl(req.type), - inet_ntoa(master.sin_addr), ntohs(master.sin_port)); -#endif - reply.response = htonl(NC_REPLY_ACK); - reply.seq = req.seq; - switch (ntohl(req.type)) { - case NC_REQUEST_DISCONNECT: - done = true; - break; - case NC_REQUEST_UDP_SEND: - test_printf("UDP send - %d buffers, %d bytes\n", ntohl(req.nbufs), ntohl(req.buflen)); - break; - case NC_REQUEST_UDP_RECV: - test_printf("UDP recv - %d buffers, %d bytes\n", ntohl(req.nbufs), ntohl(req.buflen)); - break; - case NC_REQUEST_UDP_ECHO: - test_printf("UDP echo - %d buffers, %d bytes\n", ntohl(req.nbufs), ntohl(req.buflen)); - break; - case NC_REQUEST_TCP_SEND: - test_printf("TCP send - %d buffers, %d bytes\n", ntohl(req.nbufs), ntohl(req.buflen)); - break; - case NC_REQUEST_TCP_RECV: - test_printf("TCP recv - %d buffers, %d bytes\n", ntohl(req.nbufs), ntohl(req.buflen)); - break; - case NC_REQUEST_TCP_ECHO: - test_printf("TCP echo - %d buffers, %d bytes\n", ntohl(req.nbufs), ntohl(req.buflen)); - break; - case NC_REQUEST_SET_LOAD: - start_load(ntohl(req.nbufs)); - break; - case NC_REQUEST_START_IDLE: - test_printf("Start IDLE thread\n"); - idle_thread_count = 0; - idle_thread_start_time = cyg_current_time(); - cyg_semaphore_post(&idle_thread_sem); - break; - case NC_REQUEST_STOP_IDLE: - cyg_semaphore_wait(&idle_thread_sem); - idle_thread_stop_time = cyg_current_time(); - test_printf("Stop IDLE thread\n"); - reply.misc.idle_results.elapsed_time = htonl(idle_thread_stop_time - idle_thread_start_time); - reply.misc.idle_results.count[0] = htonl(idle_thread_count >> 32); - reply.misc.idle_results.count[1] = htonl((long)idle_thread_count); - break; - default: - test_printf("Unrecognized request: %d\n", ntohl(req.type)); - reply.response = htonl(NC_REPLY_NAK); - reply.reason = htonl(NC_REPLY_NAK_UNKNOWN_REQUEST); - break; - } - if (sendto(s, &reply, sizeof(reply), 0, (struct sockaddr *)&master, masterlen) < 0) { - pexit("sendto"); - } - if (reply.response == ntohl(NC_REPLY_NAK)) { - continue; - } - switch (ntohl(req.type)) { - case NC_REQUEST_UDP_SEND: - case NC_REQUEST_UDP_RECV: - case NC_REQUEST_UDP_ECHO: - do_udp_test(s, &req, &master); - break; - case NC_REQUEST_TCP_SEND: - case NC_REQUEST_TCP_RECV: - case NC_REQUEST_TCP_ECHO: - do_tcp_test(s, &req, &master); - break; - case NC_REQUEST_START_IDLE: - case NC_REQUEST_STOP_IDLE: - case NC_REQUEST_SET_LOAD: - default: - break; - } - } - close(s); -} - -void -net_test(test_param_t param) -{ -// int i; - if (param == 0) { - test_printf("Start Network Characterization - SLAVE\n"); - calibrate_load(DESIRED_BACKGROUND_LOAD); - } - nc_slave(param); -#ifdef CYGDBG_NET_TIMING_STATS - show_net_times(); -#endif -#if LWIP_STATS_DISPLAY - stats_display(); -#endif - cyg_test_exit(); -} - - -// -// This function is called to calibrate the "background load" which can be -// applied during testing. It will be called before any commands from the -// host are managed. -// -static void -calibrate_load(int desired_load) -{ - long long no_load_idle, load_idle; - int percent_load; - int high, low; - - // Set limits - high = MAX_LOAD_THREAD_LEVEL; - low = MIN_LOAD_THREAD_LEVEL; - test_printf("Start Network Characterization - SLAVE\n"); - - // Compute the "no load" idle value - idle_thread_count = 0; - cyg_semaphore_post(&idle_thread_sem); // Start idle thread - test_printf("Start Network Characterization - SLAVE\n"); - cyg_thread_delay(1*100); // Pause for one second - test_printf("Start Network Characterization - SLAVE\n"); - cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread - test_printf("Start Network Characterization - SLAVE\n"); - no_load_idle = idle_thread_count; - diag_printf("No load = %d\n", (int)idle_thread_count); - - // First ensure that the HIGH level is indeed higher - while (true) { - load_thread_level = high; - start_load(desired_load); // Start up a given load - idle_thread_count = 0; - cyg_semaphore_post(&idle_thread_sem); // Start idle thread - cyg_thread_delay(1*100); // Pause for one second - cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread - load_idle = idle_thread_count; - start_load(0); // Shut down background load - percent_load = 100 - ((load_idle * 100) / no_load_idle); - diag_printf("High Load[%d] = %d => %d%%\n", load_thread_level, - (int)idle_thread_count, percent_load); - if ( percent_load > desired_load ) - break; // HIGH level is indeed higher - low = load_thread_level; // known to be lower - high *= 2; // else double it and try again - } - - // Now chop down to the level required - while (true) { - load_thread_level = (high + low) / 2; - start_load(desired_load); // Start up a given load - idle_thread_count = 0; - cyg_semaphore_post(&idle_thread_sem); // Start idle thread - cyg_thread_delay(1*100); // Pause for one second - cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread - load_idle = idle_thread_count; - start_load(0); // Shut down background load - percent_load = 100 - ((load_idle * 100) / no_load_idle); - diag_printf("Load[%d] = %d => %d%%\n", load_thread_level, - (int)idle_thread_count, percent_load); - if (((high-low) <= 1) || (abs(desired_load-percent_load) <= 2)) break; - if (percent_load < desired_load) { - low = load_thread_level; - } else { - high = load_thread_level; - } - } - - // Now we are within a few percent of the target; scale the load - // factor to get a better fit, and test it, print the answer. - load_thread_level *= desired_load; - load_thread_level /= percent_load; - start_load(desired_load); // Start up a given load - idle_thread_count = 0; - cyg_semaphore_post(&idle_thread_sem); // Start idle thread - cyg_thread_delay(1*100); // Pause for one second - cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread - load_idle = idle_thread_count; - start_load(0); // Shut down background load - percent_load = 100 - ((load_idle * 100) / no_load_idle); - diag_printf("Final load[%d] = %d => %d%%\n", load_thread_level, - (int)idle_thread_count, percent_load); -// no_load_idle_count_1_second = no_load_idle; -} - -// -// This function is called to set up a load level of 'load' percent (given -// as a whole number, e.g. start_load(20) would mean initiate a background -// load of 20%, leaving the cpu 80% idle). -// -static void -start_load(int load) -{ - static int prev_load = 0; - int i; - test_printf("Set background load = %d%%\n", load); - if (load == 0) { - if (prev_load == 0) return; // Nothing out there to stop - for (i = 0; i < prev_load/10; i++) { - cyg_semaphore_wait(&load_thread_sem[i]); - } - prev_load = 0; - } else { - for (i = 0; i < load/10; i++) { - cyg_semaphore_post(&load_thread_sem[i]); - } - prev_load = load; - } -} - -// -// These thread(s) do some amount of "background" computing. This is used -// to simulate a given load level. They need to be run at a higher priority -// than the network code itself. -// -// Like the "idle" thread, they run as long as their "switch" (aka semaphore) -// is enabled. -// -void -net_load(cyg_addrword_t who) -{ - int i; - while (true) { - cyg_semaphore_wait(&load_thread_sem[who]); - for (i = 0; i < load_thread_level; i++) { - do_some_random_computation(i); - } - cyg_thread_delay(1); // Wait until the next 'tick' - cyg_semaphore_post(&load_thread_sem[who]); - } -} - -// -// Some arbitrary computation, designed to use up the CPU and cause associated -// cache "thrash" behaviour - part of background load modelling. -// -static void -do_some_random_computation(int p) -{ - // Just something that might be "hard" - volatile double x; - x = ((p * 10) * 3.14159) / 180.0; // radians -} - -// -// This thread does nothing but count. It will be allowed to count -// as long as the semaphore is "free". -// -void -net_idle(cyg_addrword_t param) -{ - while (true) { - cyg_semaphore_wait(&idle_thread_sem); - idle_thread_count++; - cyg_semaphore_post(&idle_thread_sem); - } -} -#if 0 -void -cyg_start(void *n) -{ - int i; - // Create processing threads - for (i = 0; i < CYGHWR_NET_DRIVERS; i++) { - cyg_thread_create(MAIN_THREAD_PRIORITY, // Priority - net_test, // entry - i, // entry parameter - "Network test", // Name - &main_thread_stack[i][0], // Stack - STACK_SIZE, // Size - &main_thread_handle[i], // Handle - &main_thread_data[i] // Thread data structure - ); - } - cyg_thread_resume(main_thread_handle[0]); // Start first one - // Create the idle thread environment - cyg_semaphore_init(&idle_thread_sem, 0); - cyg_thread_create(IDLE_THREAD_PRIORITY, // Priority - net_idle, // entry - 0, // entry parameter - "Network idle", // Name - &idle_thread_stack[0], // Stack - STACK_SIZE, // Size - &idle_thread_handle, // Handle - &idle_thread_data // Thread data structure - ); - cyg_thread_resume(idle_thread_handle); // Start it - // Create the load threads and their environment(s) - for (i = 0; i < NUM_LOAD_THREADS; i++) { - cyg_semaphore_init(&load_thread_sem[i], 0); - cyg_thread_create(LOAD_THREAD_PRIORITY, // Priority - net_load, // entry - i, // entry parameter - "Background load", // Name - &load_thread_stack[i][0], // Stack - STACK_SIZE, // Size - &load_thread_handle[i], // Handle - &load_thread_data[i] // Thread data structure - ); - cyg_thread_resume(load_thread_handle[i]); // Start it - } - cyg_scheduler_start(); -} - -#endif - -void -tmain(cyg_addrword_t p) -{ - lwip_init(); - sys_thread_new("net_test", net_test, 0, DEFAULT_THREAD_STACKSIZE, MAIN_THREAD_PRIORITY); -} - -static char stack[STACK_SIZE]; -static cyg_thread thread_data; -static cyg_handle_t thread_handle; - -void -cyg_user_start(void) -{ - int i; - // Create the idle thread environment - cyg_semaphore_init(&idle_thread_sem, 0); - cyg_thread_create(IDLE_THREAD_PRIORITY, // Priority - net_idle, // entry - 0, // entry parameter - "Network idle", // Name - &idle_thread_stack[0], // Stack - STACK_SIZE, // Size - &idle_thread_handle, // Handle - &idle_thread_data // Thread data structure - ); - cyg_thread_resume(idle_thread_handle); // Start it - // Create the load threads and their environment(s) - for (i = 0; i < NUM_LOAD_THREADS; i++) { - cyg_semaphore_init(&load_thread_sem[i], 0); - cyg_thread_create(LOAD_THREAD_PRIORITY, // Priority - net_load, // entry - i, // entry parameter - "Background load", // Name - &load_thread_stack[i][0], // Stack - STACK_SIZE, // Size - &load_thread_handle[i], // Handle - &load_thread_data[i] // Thread data structure - ); - cyg_thread_resume(load_thread_handle[i]); // Start it - } - // Create a main thread, so we can run the scheduler and have time 'pass' - cyg_thread_create(10, // Priority - just a number - tmain, // entry - 0, // entry parameter - "socket echo test", // Name - &stack[0], // Stack - STACK_SIZE, // Size - &thread_handle, // Handle - &thread_data // Thread data structure - ); - cyg_thread_resume(thread_handle); // Start it -} diff --git a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/tests/socket.c b/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/tests/socket.c deleted file mode 100644 index 0c20bd2..0000000 --- a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/tests/socket.c +++ /dev/null @@ -1,90 +0,0 @@ -//========================================================================== -//####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with eCos; if not, write to the Free Software Foundation, Inc., -// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -// -// As a special exception, if other files instantiate templates or use macros -// or inline functions from this file, or you compile this file and link it -// with other works to produce a work based on this file, this file does not -// by itself cause the resulting work to be covered by the GNU General Public -// License. However the source code for this file must still be made available -// in accordance with section (3) of the GNU General Public License. -// -// This exception does not invalidate any other reasons why a work based on -// this file might be covered by the GNU General Public License. -// ------------------------------------------- -//####ECOSGPLCOPYRIGHTEND#### -//========================================================================== - -/* Simple test-case for the BSD socket API : echo on TCP port 7 */ - -#include "lwip/sys.h" -#define LWIP_COMPAT_SOCKETS 1 -#include "lwip/sockets.h" - -char buf[400]; -static void -socket_thread(void *arg) -{ - int sock,s; - int len; - struct sockaddr_in addr,rem; - sock = socket(AF_INET,SOCK_STREAM,0); - addr.sin_family = AF_INET; - addr.sin_port = htons(7); - addr.sin_addr.s_addr = INADDR_ANY; - - bind(sock,(struct sockaddr *)&addr,sizeof(addr)); - - listen(sock,5); - while(1) { - len = sizeof(rem); - s = accept(sock,(struct sockaddr*)&rem,&len); - while((len = read(s,buf,400)) > 0) - write(s,buf,len); - close(s); - } -} - -void -tmain(cyg_addrword_t p) -{ - lwip_init(); - sys_thread_new("socket", socket_thread, (void*)"socket", DEFAULT_THREAD_STACKSIZE, 7); -} - -#define STACK_SIZE 0x1000 -static char stack[STACK_SIZE]; -static cyg_thread thread_data; -static cyg_handle_t thread_handle; - -void -cyg_user_start(void) -{ - // Create a main thread, so we can run the scheduler and have time 'pass' - cyg_thread_create(10, // Priority - just a number - tmain, // entry - 0, // entry parameter - "socket echo test", // Name - &stack[0], // Stack - STACK_SIZE, // Size - &thread_handle, // Handle - &thread_data // Thread data structure - ); - cyg_thread_resume(thread_handle); // Start it -} - diff --git a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/tests/sys_timeout.c b/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/tests/sys_timeout.c deleted file mode 100644 index 00bb131..0000000 --- a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/tests/sys_timeout.c +++ /dev/null @@ -1,95 +0,0 @@ -//========================================================================== -//####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with eCos; if not, write to the Free Software Foundation, Inc., -// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -// -// As a special exception, if other files instantiate templates or use macros -// or inline functions from this file, or you compile this file and link it -// with other works to produce a work based on this file, this file does not -// by itself cause the resulting work to be covered by the GNU General Public -// License. However the source code for this file must still be made available -// in accordance with section (3) of the GNU General Public License. -// -// This exception does not invalidate any other reasons why a work based on -// this file might be covered by the GNU General Public License. -// ------------------------------------------- -//####ECOSGPLCOPYRIGHTEND#### -//========================================================================== - -/* Simple test-case for the lwip system timeout functionality */ - -#include "lwip/sys.h" - -#define TIMERS 100 -sys_timeout_handler timers[TIMERS]; -int intervals[TIMERS]; - -static void -timeout_fn ( void * arg) -{ - int i, j = (int)arg; -// diag_printf("Timeout #%d called\n", (int)arg); - for (i = 0; i < j; i++) - diag_printf(" "); - diag_printf("%d\n", j); -// sys_timeout( intervals[j], timers[j], arg); - sys_timeout( 1000, timers[j], arg); -} - -static void -timeout_thread(void *arg) -{ - int i; - - for (i = 0; i < TIMERS; i++) { - diag_printf("Adding timer #%d\n", i); - timers[i] = timeout_fn; - intervals[i] = (i+1)*1000; - sys_timeout(intervals[i], timers[i], (void *)i); - } - sys_msleep(0); - diag_printf("Done\n"); -} - -void -tmain(cyg_addrword_t p) -{ - lwip_init(); - sys_thread_new("timeout", timeout_thread, (void*)"timeout", DEFAULT_THREAD_STACKSIZE, 7); -} - -#define STACK_SIZE 0x1000 -static char stack[STACK_SIZE]; -static cyg_thread thread_data; -static cyg_handle_t thread_handle; - -void -cyg_user_start(void) -{ - // Create a main thread, so we can run the scheduler and have time 'pass' - cyg_thread_create(10, // Priority - just a number - tmain, // entry - 0, // entry parameter - "timeout test", // Name - &stack[0], // Stack - STACK_SIZE, // Size - &thread_handle, // Handle - &thread_data // Thread data structure - ); - cyg_thread_resume(thread_handle); // Start it -} - diff --git a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/tests/tcpecho.c b/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/tests/tcpecho.c deleted file mode 100644 index 797a88b..0000000 --- a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/tests/tcpecho.c +++ /dev/null @@ -1,137 +0,0 @@ -//========================================================================== -//####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with eCos; if not, write to the Free Software Foundation, Inc., -// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -// -// As a special exception, if other files instantiate templates or use macros -// or inline functions from this file, or you compile this file and link it -// with other works to produce a work based on this file, this file does not -// by itself cause the resulting work to be covered by the GNU General Public -// License. However the source code for this file must still be made available -// in accordance with section (3) of the GNU General Public License. -// -// This exception does not invalidate any other reasons why a work based on -// this file might be covered by the GNU General Public License. -// ------------------------------------------- -//####ECOSGPLCOPYRIGHTEND#### -//========================================================================== - -/* - * 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 - * - */ - -#include "lwip/sys.h" -#include "lwip/api.h" - -static void -tcpecho_thread(void *arg) -{ - struct netconn *conn, *newconn; - err_t err; - - /* Create a new connection identifier. */ - conn = netconn_new(NETCONN_TCP); - - /* Bind connection to well known port number 7. */ - netconn_bind(conn, NULL, 7); - - /* Tell connection to go into listening mode. */ - netconn_listen(conn); - - while(1) { - - /* Grab new connection. */ - newconn = netconn_accept(conn); - /* Process the new connection. */ - if(newconn != NULL) { - struct netbuf *buf; - void *data; - u16_t len; - - while((buf = netconn_recv(newconn)) != NULL) { - do { - netbuf_data(buf, &data, &len); - err = netconn_write(newconn, data, len, NETCONN_COPY); - if(err != ERR_OK) { - } - } while(netbuf_next(buf) >= 0); - netbuf_delete(buf); - } - /* Close connection and discard connection identifier. */ - netconn_delete(newconn); - } - } -} - -void -tmain(cyg_addrword_t p) -{ - lwip_init(); - sys_thread_new("tcpecho", tcpecho_thread, (void*)"tcpecho", DEFAULT_THREAD_STACKSIZE, 7); -} - -#define STACK_SIZE 0x1000 -static char stack[STACK_SIZE]; -static cyg_thread thread_data; -static cyg_handle_t thread_handle; - -void -cyg_user_start(void) -{ - // Create a main thread, so we can run the scheduler and have time 'pass' - cyg_thread_create(10, // Priority - just a number - tmain, // entry - 0, // entry parameter - "TCP echo test", // Name - &stack[0], // Stack - STACK_SIZE, // Size - &thread_handle, // Handle - &thread_data // Thread data structure - ); - cyg_thread_resume(thread_handle); // Start it -} - diff --git a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/tests/udpecho.c b/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/tests/udpecho.c deleted file mode 100644 index e13ee1e..0000000 --- a/contrib/ports/old/ecos/ecos/net/lwip_tcpip/current/tests/udpecho.c +++ /dev/null @@ -1,120 +0,0 @@ -//========================================================================== -//####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with eCos; if not, write to the Free Software Foundation, Inc., -// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -// -// As a special exception, if other files instantiate templates or use macros -// or inline functions from this file, or you compile this file and link it -// with other works to produce a work based on this file, this file does not -// by itself cause the resulting work to be covered by the GNU General Public -// License. However the source code for this file must still be made available -// in accordance with section (3) of the GNU General Public License. -// -// This exception does not invalidate any other reasons why a work based on -// this file might be covered by the GNU General Public License. -// ------------------------------------------- -//####ECOSGPLCOPYRIGHTEND#### -//========================================================================== - -/* - * 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 - * - */ - -#include "lwip/api.h" -#include "lwip/sys.h" - -/*-----------------------------------------------------------------------------------*/ -char buffer[100]; -void -udpecho_thread(void *arg) -{ - struct netconn *conn; - struct netbuf *buf; - struct ip_addr *addr; - unsigned short port; - - conn = netconn_new(NETCONN_UDP); - netconn_bind(conn, NULL, 7); - - while(1) { - buf = netconn_recv(conn); - addr = netbuf_fromaddr(buf); - port = netbuf_fromport(buf); - netconn_connect(conn, addr, port); - netconn_send(conn, buf); - netbuf_copy(buf, buffer, sizeof(buffer)); - netbuf_delete(buf); - } -} -/*-----------------------------------------------------------------------------------*/ -void tmain(cyg_addrword_t p) -{ - lwip_init(); - sys_thread_new("udp_echo", udpecho_thread, (void*)"udpecho", DEFAULT_THREAD_STACKSIZE, 7); -} - -#define STACK_SIZE 0x1000 -static char stack[STACK_SIZE]; -static cyg_thread thread_data; -static cyg_handle_t thread_handle; - -void -cyg_user_start(void) -{ - // Create a main thread, so we can run the scheduler and have time 'pass' - cyg_thread_create(10, // Priority - just a number - tmain, // entry - 0, // entry parameter - "UDP echo test", // Name - &stack[0], // Stack - STACK_SIZE, // Size - &thread_handle, // Handle - &thread_data // Thread data structure - ); - cyg_thread_resume(thread_handle); // Start it -} - diff --git a/contrib/ports/old/ecos/ecos/pkgadd.db b/contrib/ports/old/ecos/ecos/pkgadd.db deleted file mode 100644 index 8d2c820..0000000 --- a/contrib/ports/old/ecos/ecos/pkgadd.db +++ /dev/null @@ -1,7 +0,0 @@ -package CYGPKG_NET_LWIP { - alias {"lwIP" lwip} - directory net/lwip_tcpip - script cdl/lwip_net.cdl - description "lightweight TCP/IP stack: lwIP" -} - diff --git a/contrib/ports/old/ecos/files b/contrib/ports/old/ecos/files deleted file mode 100644 index 05dc36b..0000000 --- a/contrib/ports/old/ecos/files +++ /dev/null @@ -1,80 +0,0 @@ -src/api/api_lib.c src/api/api_lib.c -src/api/api_msg.c src/api/api_msg.c -src/api/err.c src/api/err.c -src/api/sockets.c src/api/sockets.c -src/api/tcpip.c src/api/tcpip.c -src/core/tcp_out.c src/core/tcp_out.c -src/core/inet.c src/core/inet.c -src/core/mem.c src/core/mem.c -src/core/memp.c src/core/memp.c -src/core/netif.c src/core/netif.c -src/core/pbuf.c src/core/pbuf.c -src/core/stats.c src/core/stats.c -src/core/sys.c src/core/sys.c -src/core/tcp.c src/core/tcp.c -src/core/ipv4/ip_addr.c src/core/ipv4/ip_addr.c -src/core/ipv4/icmp.c src/core/ipv4/icmp.c -src/core/ipv4/ip.c src/core/ipv4/ip.c -src/core/ipv4/ip_frag.c src/core/ipv4/ip_frag.c -src/core/udp.c src/core/udp.c -src/core/dhcp.c src/core/dhcp.c -src/core/tcp_in.c src/core/tcp_in.c -src/core/raw.c src/core/raw.c -src/include/ipv4/lwip/ip_addr.h include/lwip/ip_addr.h -src/include/ipv4/lwip/icmp.h include/lwip/icmp.h -src/include/ipv4/lwip/inet.h include/lwip/inet.h -src/include/ipv4/lwip/ip.h include/lwip/ip.h -src/include/ipv4/lwip/ip_frag.h include/lwip/ip_frag.h -src/include/lwip/api_msg.h include/lwip/api_msg.h -src/include/lwip/api.h include/lwip/api.h -src/include/lwip/arch.h include/lwip/arch.h -src/include/lwip/sockets.h include/lwip/sockets.h -src/include/lwip/debug.h include/lwip/debug.h -src/include/lwip/def.h include/lwip/def.h -src/include/lwip/err.h include/lwip/err.h -src/include/lwip/snmp.h include/lwip/snmp.h -src/include/lwip/mem.h include/lwip/mem.h -src/include/lwip/memp.h include/lwip/memp.h -src/include/lwip/netif.h include/lwip/netif.h -src/include/lwip/opt.h include/lwip/opt.h -src/include/lwip/pbuf.h include/lwip/pbuf.h -src/include/lwip/stats.h include/lwip/stats.h -src/include/lwip/sys.h include/lwip/sys.h -src/include/lwip/tcp.h include/lwip/tcp.h -src/include/lwip/raw.h include/lwip/raw.h -src/include/lwip/tcpip.h include/lwip/tcpip.h -src/include/lwip/udp.h include/lwip/udp.h -src/include/lwip/sio.h include/lwip/sio.h -src/include/lwip/dhcp.h include/lwip/dhcp.h -src/include/netif/etharp.h include/netif/etharp.h -src/include/netif/slipif.h include/netif/slipif.h -src/include/netif/loopif.h include/netif/loopif.h -src/netif/etharp.c src/netif/etharp.c -src/netif/slipif.c src/netif/slipif.c -src/netif/loopif.c src/netif/loopif.c -src/netif/ppp/ppp.c src/netif/ppp/ppp.c -src/netif/ppp/auth.c src/netif/ppp/auth.c -src/netif/ppp/chap.c src/netif/ppp/chap.c -src/netif/ppp/chpms.c src/netif/ppp/chpms.c -src/netif/ppp/pap.c src/netif/ppp/pap.c -src/netif/ppp/magic.c src/netif/ppp/magic.c -src/netif/ppp/md5.c src/netif/ppp/md5.c -src/netif/ppp/fsm.c src/netif/ppp/fsm.c -src/netif/ppp/ipcp.c src/netif/ppp/ipcp.c -src/netif/ppp/lcp.c src/netif/ppp/lcp.c -src/netif/ppp/randm.c src/netif/ppp/randm.c -src/netif/ppp/vj.c src/netif/ppp/vj.c -src/netif/ppp/ppp.h src/netif/ppp/ppp.h -src/netif/ppp/pppdebug.h src/netif/ppp/pppdebug.h -src/netif/ppp/auth.h src/netif/ppp/auth.h -src/netif/ppp/chap.h src/netif/ppp/chap.h -src/netif/ppp/chpms.h src/netif/ppp/chpms.h -src/netif/ppp/pap.h src/netif/ppp/pap.h -src/netif/ppp/magic.h src/netif/ppp/magic.h -src/netif/ppp/md5.h src/netif/ppp/md5.h -src/netif/ppp/fsm.h src/netif/ppp/fsm.h -src/netif/ppp/ipcp.h src/netif/ppp/ipcp.h -src/netif/ppp/lcp.h src/netif/ppp/lcp.h -src/netif/ppp/randm.h src/netif/ppp/randm.h -src/netif/ppp/vj.h src/netif/ppp/vj.h -src/netif/ppp/vjbsdhdr.h src/netif/ppp/vjbsdhdr.h diff --git a/contrib/ports/old/ecos/header b/contrib/ports/old/ecos/header deleted file mode 100644 index 6731c31..0000000 --- a/contrib/ports/old/ecos/header +++ /dev/null @@ -1,32 +0,0 @@ -//========================================================================== -//####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with eCos; if not, write to the Free Software Foundation, Inc., -// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -// -// As a special exception, if other files instantiate templates or use macros -// or inline functions from this file, or you compile this file and link it -// with other works to produce a work based on this file, this file does not -// by itself cause the resulting work to be covered by the GNU General Public -// License. However the source code for this file must still be made available -// in accordance with section (3) of the GNU General Public License. -// -// This exception does not invalidate any other reasons why a work based on -// this file might be covered by the GNU General Public License. -// ------------------------------------------- -//####ECOSGPLCOPYRIGHTEND#### -//========================================================================== - diff --git a/contrib/ports/old/ecos/mkepk b/contrib/ports/old/ecos/mkepk deleted file mode 100755 index d90f801..0000000 --- a/contrib/ports/old/ecos/mkepk +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh - -#make an ecos epk from CVS lwIP - -if test $EPK"" == "" ; then - echo you must set the EPK environment var to the dir you want the EPK in - exit; -fi - -if test $LWIP_CVS"" == "" ; then - echo you must set the LWIP_CVS environment var to the dir you checked out the lwip module - LWIP_CVS=../../../lwip; - exit; -fi -EPK=$EPK/lwip_epk - -#cleanup -rm -Rf $EPK - - -#copy files from CVS -xargs -n 2 ./copy < files - -#copy ecos specific files -cd ecos && find . ! -path '*CVS*' -a -type f -exec cp --parents {} $EPK \; -#make epk -cd $EPK && tar czf lwip.epk * - diff --git a/contrib/ports/old/rtxc/include/arch/cc.h b/contrib/ports/old/rtxc/include/arch/cc.h deleted file mode 100644 index ac55609..0000000 --- a/contrib/ports/old/rtxc/include/arch/cc.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 - * - */ -#ifndef __CC_H__ -#define __CC_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; - -#define U16_F "hu" -#define S16_F "hd" -#define X16_F "hx" -#define U32_F "lu" -#define S32_F "ld" -#define X32_F "lx" - -#define PACK_STRUCT_BEGIN -#define PACK_STRUCT_STRUCT -#define PACK_STRUCT_END -#define PACK_STRUCT_FIELD(x) x - -#endif /* __CC_H__ */ diff --git a/contrib/ports/old/rtxc/include/arch/cpu.h b/contrib/ports/old/rtxc/include/arch/cpu.h deleted file mode 100644 index a02f86d..0000000 --- a/contrib/ports/old/rtxc/include/arch/cpu.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 - * - */ -#ifndef __CPU_H__ -#define __CPU_H__ - -#define BYTE_ORDER LITTLE_ENDIAN - -#endif /* __CPU_H__ */ diff --git a/contrib/ports/old/rtxc/include/arch/lib.h b/contrib/ports/old/rtxc/include/arch/lib.h deleted file mode 100644 index 378f25b..0000000 --- a/contrib/ports/old/rtxc/include/arch/lib.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 - * - */ -#ifndef __LIB_H__ -#define __LIB_H__ - -#include - - -#endif /* __LIB_H__ */ diff --git a/contrib/ports/old/rtxc/include/arch/perf.h b/contrib/ports/old/rtxc/include/arch/perf.h deleted file mode 100644 index 334d42a..0000000 --- a/contrib/ports/old/rtxc/include/arch/perf.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 - * - */ -#ifndef __PERF_H__ -#define __PERF_H__ - -#define PERF_START /* null definition */ -#define PERF_STOP(x) /* null definition */ - -#endif /* __PERF_H__ */ diff --git a/contrib/ports/old/rtxc/include/arch/sys_arch.h b/contrib/ports/old/rtxc/include/arch/sys_arch.h deleted file mode 100644 index f423fb6..0000000 --- a/contrib/ports/old/rtxc/include/arch/sys_arch.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 - * - */ -#ifndef __SYS_RTXC_H__ -#define __SYS_RTXC_H__ - -#include "rtxcapi.h" - -#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_RTXC_H__ */ - diff --git a/contrib/ports/old/rtxc/include/netif/cs8900if.h b/contrib/ports/old/rtxc/include/netif/cs8900if.h deleted file mode 100644 index d0fad0e..0000000 --- a/contrib/ports/old/rtxc/include/netif/cs8900if.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 - * - */ -#ifndef __NETIF_CS8900IF_H__ -#define __NETIF_CS8900IF_H__ - -#include "lwip/netif.h" - -void cs8900if_init(struct netif *); -u8_t cs8900if_poll(struct netif *); -void cs8900if_input(struct netif *); - -#endif /* __NETIF_CS8900IF_H__ */ diff --git a/contrib/ports/old/rtxc/include/netif/sioslipif.h b/contrib/ports/old/rtxc/include/netif/sioslipif.h deleted file mode 100644 index 7b235e0..0000000 --- a/contrib/ports/old/rtxc/include/netif/sioslipif.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 - * - */ -#ifndef __NETIF_SIOSLIPIF_H__ -#define __NETIF_SIOSLIPIF_H__ - -#include "lwip/netif.h" - -void sioslipif_init(struct netif *); - -#endif /* __NETIF_SIOSLIPIF_H__ */ diff --git a/contrib/ports/old/rtxc/lib.c b/contrib/ports/old/rtxc/lib.c deleted file mode 100644 index d6386be..0000000 --- a/contrib/ports/old/rtxc/lib.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 - * - */ - -/* 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. - */ - diff --git a/contrib/ports/old/rtxc/netif/FILES b/contrib/ports/old/rtxc/netif/FILES deleted file mode 100644 index 1b009e8..0000000 --- a/contrib/ports/old/rtxc/netif/FILES +++ /dev/null @@ -1 +0,0 @@ -sioslipif.c - Implementation of the SLIP protocol on top of a serial line. diff --git a/contrib/ports/old/rtxc/netif/sioslipif.c b/contrib/ports/old/rtxc/netif/sioslipif.c deleted file mode 100644 index 3b4f170..0000000 --- a/contrib/ports/old/rtxc/netif/sioslipif.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * 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 - * - */ - -#include "lwip/debug.h" -#include "lwip/def.h" -#include "netif/sioslipif.h" -#include "lwip/pbuf.h" -#include "lwip/sys.h" - -#define SLIP_END 0300 -#define SLIP_ESC 0333 -#define SLIP_ESC_END 0334 -#define SLIP_ESC_ESC 0335 - -/* This variable is used for passing the netif pointer between the - threads. */ -static struct netif *netif_pass; - -static int infd, outfd; -/*-----------------------------------------------------------------------------------*/ -static void -sio_send(u8_t c) -{ - write(outfd, &c, 1); -} -/*-----------------------------------------------------------------------------------*/ -static u8_t -sio_recv(void) -{ - u8_t c; - read(infd, &c, 1); - return c; -} -/*-----------------------------------------------------------------------------------*/ -static int -sioslipif_output(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr) -{ - struct pbuf *q; - int i; - u8_t c; - - /* Send pbuf out on the serial I/O device. */ - sio_send(SLIP_END); - - for(q = p; q != NULL; q = q->next) { - for(i = 0; i < q->len; i++) { - c = ((u8_t *)q->payload)[i]; - switch (c) { - case SLIP_END: - sio_send(SLIP_ESC); - sio_send(SLIP_ESC_END); - break; - case SLIP_ESC: - sio_send(SLIP_ESC); - sio_send(SLIP_ESC_ESC); - break; - default: - sio_send(c); - break; - } - } - } - sio_send(SLIP_END); - return 0; -} -/*-----------------------------------------------------------------------------------*/ -static struct pbuf * -sioslipif_input(void) -{ - u8_t c; - struct pbuf *p, *q; - int recved; - int i; - - p = pbuf_alloc(PBUF_LINK, PBUF_MAX_SIZE, PBUF_POOL); - q = p; - recved = i = 0; - - while (1) { - c = sio_recv(); - switch (c) { - case SLIP_END: - if (recved > 0) { - /* Received whole packet. */ - pbuf_realloc(p, recved); - return p; - } - break; - case SLIP_ESC: - c = sio_recv(); - switch (c) { - case SLIP_ESC_END: - c = SLIP_END; - break; - case SLIP_ESC_ESC: - c = SLIP_ESC; - break; - } - /* FALLTHROUGH */ - default: - if (recved < p->tot_len && q != NULL) { - ((u8_t *)q->payload)[i] = c; - recved++; - i++; - if (i >= q->len) { - i = 0; - q = q->next; - } - } - break; - } - - } -} -/*-----------------------------------------------------------------------------------*/ -static void -sioslipif_loop(void) -{ - struct pbuf *p; - struct netif *netif; - - netif = netif_pass; - while (1) { - p = sioslipif_input(); - netif->input(p, netif); - } -} -/*-----------------------------------------------------------------------------------*/ -void -sioslipif_init(struct netif *netif) -{ - netif->state = NULL; - netif->name[0] = 's'; - netif->name[1] = 'l'; - netif->output = sioslipif_output; - - netif_pass = netif; - sys_thread_new("sioslipif_loop", (void *)sioslipif_loop, NULL, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO); - /* Do some magic to make it possible to receive data from the serial I/O device. */ -} -/*-----------------------------------------------------------------------------------*/ diff --git a/contrib/ports/old/rtxc/sys_arch.c b/contrib/ports/old/rtxc/sys_arch.c deleted file mode 100644 index d50bc0a..0000000 --- a/contrib/ports/old/rtxc/sys_arch.c +++ /dev/null @@ -1,273 +0,0 @@ -/* - * 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 - * - */ - -#include "lwip/debug.h" - -#include "lwip/def.h" -#include "lwip/sys.h" -#include "lwip/mem.h" - -#include "rtxcapi.h" -#include "csema.h" -#include "cclock.h" -#include "cqueue.h" -#include "cres.h" -#include "cpart.h" -#include "ctask.h" - -struct timeoutlist { - struct sys_timeouts timeouts; - TASK pid; -}; - -#define SYS_THREAD_MAX 2 - -static struct timeoutlist timeoutlist[SYS_THREAD_MAX]; -static u16_t nextthread = 0; - -/*-----------------------------------------------------------------------------------*/ -sys_mbox_t -sys_mbox_new(void) -{ - QUEUE mbox; - KS_dequeuew(IP_MBOXQ, &mbox); - KS_purgequeue(mbox); - return mbox; -} -/*-----------------------------------------------------------------------------------*/ -void -sys_mbox_free(sys_mbox_t mbox) -{ - KS_enqueue(IP_MBOXQ, &mbox); -} -/*-----------------------------------------------------------------------------------*/ -void -sys_mbox_post(sys_mbox_t mbox, void *data) -{ - if (KS_enqueue(mbox, &data) != RC_GOOD) { - } -} -/*-----------------------------------------------------------------------------------*/ -u16_t -sys_arch_mbox_fetch(sys_mbox_t mbox, void **data, u16_t timeout) -{ - KSRC ret; - u16_t wtime = 1; - - if (timeout == 0) { - LWIP_DEBUGF(SYS_DEBUG, ("PID: %d sys_mbox_fetch: without timeouts\n",KS_inqtask())); - KS_dequeuew(mbox, data); - - } else { - - ret = KS_dequeuet(mbox, data, (TICKS)timeout/CLKTICK); - if (ret == RC_TIMEOUT) { - /* The call timed out, so we return 0. */ - wtime = 0; - } else { - /* Calculate time we waited for the message to arrive. */ - - /* XXX: we cheat and just pretend that we waited for half the timeout value! */ - wtime = timeout / 2; - - /* Make sure we don't return 0 here. */ - if (wtime == 0) { - wtime = 1; - } - } - } - return wtime; -} -/*-----------------------------------------------------------------------------------*/ -sys_sem_t -sys_sem_new(u8_t count) -{ - SEMA sem; - KS_dequeuew(IP_SEMQ, &sem); - KS_pend(sem); - if (count > 0) { - KS_signal(sem); - } - return sem; -} -/*-----------------------------------------------------------------------------------*/ -u16_t -sys_arch_sem_wait(sys_sem_t sem, u16_t timeout) -{ - KSRC ret; - u16_t wtime = 1; - - if (timeout == 0) { - LWIP_DEBUGF(SYS_DEBUG, ("PID: %d sys_mbox_fetch: without timeouts\n",KS_inqtask())); - KS_wait(sem); - - } else { - ret = KS_waitt(sem, (TICKS)timeout/CLKTICK); - if (ret == RC_TIMEOUT) { - /* The call timed out, so we return 0. */ - wtime = 0; - } else { - /* Calculate time we waited for the message to arrive. */ - - /* XXX: we cheat and just pretend that we waited for half the timeout value! */ - wtime = timeout / 2; - - /* Make sure we don't return 0 here. */ - if (wtime == 0) { - wtime = 1; - } - } - } - return wtime; - -} -/*-----------------------------------------------------------------------------------*/ -void -sys_sem_signal(sys_sem_t sem) -{ - KS_signal(sem); -} -/*-----------------------------------------------------------------------------------*/ -void -sys_sem_free(sys_sem_t sem) -{ - KS_enqueue(IP_SEMQ, &sem); -} -/*-----------------------------------------------------------------------------------*/ -void -sys_init(void) -{ - /* posta in alla semaforer i IP_SEMQ, posta in alla mboxar i - IP_MBOXQ */ - QUEUE mbox; - SEMA sem; - - mbox = IP_Q_01; KS_enqueue(IP_MBOXQ, &mbox); - mbox = IP_Q_02; KS_enqueue(IP_MBOXQ, &mbox); - mbox = IP_Q_03; KS_enqueue(IP_MBOXQ, &mbox); - mbox = IP_Q_04; KS_enqueue(IP_MBOXQ, &mbox); - mbox = IP_Q_05; KS_enqueue(IP_MBOXQ, &mbox); - mbox = IP_Q_06; KS_enqueue(IP_MBOXQ, &mbox); - mbox = IP_Q_07; KS_enqueue(IP_MBOXQ, &mbox); - mbox = IP_Q_08; KS_enqueue(IP_MBOXQ, &mbox); - mbox = IP_Q_09; KS_enqueue(IP_MBOXQ, &mbox); - mbox = IP_Q_10; KS_enqueue(IP_MBOXQ, &mbox); - mbox = IP_Q_11; KS_enqueue(IP_MBOXQ, &mbox); - mbox = IP_Q_12; KS_enqueue(IP_MBOXQ, &mbox); - mbox = IP_Q_13; KS_enqueue(IP_MBOXQ, &mbox); - mbox = IP_Q_14; KS_enqueue(IP_MBOXQ, &mbox); - mbox = IP_Q_15; KS_enqueue(IP_MBOXQ, &mbox); - sem = IP_S_01; KS_enqueue(IP_SEMQ, &sem); - sem = IP_S_02; KS_enqueue(IP_SEMQ, &sem); - sem = IP_S_03; KS_enqueue(IP_SEMQ, &sem); -} -/*-----------------------------------------------------------------------------------*/ -struct sys_timeouts * -sys_arch_timeouts(void) -{ - int i; - TASK pid; - struct timeoutlist *tl; - - LWIP_DEBUGF(SYS_DEBUG, ("PID: %d sys_mbox_fetch: timeoutlist not empty\n",KS_inqtask())); - pid = KS_inqtask(); - for(i = 0; i < nextthread; i++) { - tl = &timeoutlist[i]; - if (tl->pid == pid) { - LWIP_DEBUGF(SYS_DEBUG, ("PID: %d sys_mbox_fetch: corresponding pid found!\n",KS_inqtask())); - return &(tl->timeouts); - } - } - - /* Error! */ - return NULL; -} -/*-----------------------------------------------------------------------------------*/ -struct sys_thread_arg { - void (* thread)(void *); - void *threadarg; - SEMA sem; -}; -/*-----------------------------------------------------------------------------------*/ -static void -sys_thread(void) -{ - struct sys_thread_arg *arg; - void (* thread)(void *); - void *threadarg; - - arg = KS_inqtask_arg(0); - if (arg != NULL) { - - timeoutlist[nextthread].timeouts.next = NULL; - timeoutlist[nextthread].pid = KS_inqtask(); - - ++nextthread; - - thread = arg->thread; - threadarg = arg->threadarg; - KS_signal(arg->sem); - thread(threadarg); - } - KS_terminate(0); -} -/*-----------------------------------------------------------------------------------*/ -sys_thread_t -sys_thread_new(char *name, void (* function)(void *arg), void *arg, int istacksize, int prio) -{ - TASK newtask; - PRIORITY pri = prio; /* This may have to be changed. */ - char *stack; - /** @todo Replace this local constant by the "istacksize" parameter */ - int stacksize = 512; /* This may have to be changed. */ - struct sys_thread_arg threadarg; - - - newtask = KS_alloc_task(); - stack = KS_allocw(MAP512); - - KS_deftask(newtask, pri, (char ks_stk *)stack, (size_t)stacksize, (void (*)(void))sys_thread); - - threadarg.thread = function; - threadarg.threadarg = arg; - threadarg.sem = THRDSYNC; - KS_deftask_arg(newtask, &threadarg); - KS_execute(newtask); - KS_wait(THRDSYNC); - return newtask; -} - - - - - - diff --git a/contrib/ports/old/ti_c6711/FILES b/contrib/ports/old/ti_c6711/FILES deleted file mode 100644 index 7a26c1b..0000000 --- a/contrib/ports/old/ti_c6711/FILES +++ /dev/null @@ -1,13 +0,0 @@ -This directory contains architecture and compiler specific stuff for porting lwIP -to the TI TMS320C6711 DSP. It's done on the official C6711 DSK board, in CCS v2.10. - -The sequential API has not been ported; its functions are empties. If someone is -interested in adding a sequential API, please contact the author (see below). - -The ethernet connection was based on an daughtercard design by the author. -Schematic files can be found as part of project "ucos-lwip-c6x" on SourceForge.net -The daughtercard is NE2000 compliant. And the driver supports interrupts. - - -Zeng, Ming - diff --git a/contrib/ports/old/ti_c6711/[Note] opt setting of lwIP .txt b/contrib/ports/old/ti_c6711/[Note] opt setting of lwIP .txt deleted file mode 100644 index f65f8e5..0000000 --- a/contrib/ports/old/ti_c6711/[Note] opt setting of lwIP .txt +++ /dev/null @@ -1,63 +0,0 @@ -[Note]: - -Special options setting of lwIP in this project (for using it with uC/OS-II on TI C6000 DSP) - -******************************************************************************************* -This port was for project ucos-lwip-c6x (http://gro.clinux.org/projects/ucos-lwip-c6x/). - -For the moment we were writing this note, lwIP v1.1.0 was used in this project. - -This note was written in Jan.22 2005 by zengming99@mails.tsinghua.edu.cn. -******************************************************************************************* - -Usually, options of lwIP can be set in file "lwipopts.h". - -It was included by "opt.h", amd all options would be set as default value in "opt.h" -if they were not defined in "lwipopts.h". - -Each project should have its own "lwiports.h", and keep "opt.h" as it was. - -In this project, for making lwIP work with uC/OS-II on a 32bits TI DSP, -following options should be set: ------------------------------------------------------------------------------------- - - 1. Define symbol "LWIP_PROVIDE_ERRNO" in compiler of CodeComposerStudio - - - 2. #define MEM_ALIGNMENT 4 (in "lwipopts.h" ) - #define ETH_PAD_SIZE 2 (in "lwipopts.h" ) - - For the struct align problem on 32bits DSP. - - - 3. #define ARP_QUEUEING 0 (in "lwipopts.h") - - ARP_QUEUEING has a bug in lwIP v1.0.0 with TCP - - - 4. #define LWIP_TASK_MAX 5 (in "sys_arch.h" ) - #define LWIP_START_PRIO 10 (in "sys_arch.h" ) - - #define TCPIP_THREAD_PRIO 5 (in "lwipopts.h" ) - - The default TCPIP_THREAD used priority 5. - - And, 5 lwIP threads were allowed, user defined lwIP thread should have its priority between 10 ~ 14. - - - 5. #define SYS_LIGHTWEIGHT_PROT 1 (in "lwipopts.h" ) - - #define SYS_ARCH_DECL_PROTECT(lev) (in "sys_arch.h" ) - #define SYS_ARCH_PROTECT(lev) OS_ENTER_CRITICAL() (in "sys_arch.h" ) - #define SYS_ARCH_UNPROTECT(lev) OS_EXIT_CRITICAL() (in "sys_arch.h" ) - - These were very important when ethernet driver used intrrupt to check packet - and pBuf function was called in ISR. Or else, uC/OS-II would run away. - - A much better and clean method is to set up a thread for the driver, in ISR - just check packet and post MailBox to the thread. - - -Zeng, Ming - -2005-01-18 \ No newline at end of file diff --git a/contrib/ports/old/ti_c6711/include/arch/cc.h b/contrib/ports/old/ti_c6711/include/arch/cc.h deleted file mode 100644 index 01a48f0..0000000 --- a/contrib/ports/old/ti_c6711/include/arch/cc.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2001, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the lwIP TCP/IP stack. - * - * Author: Adam Dunkels - * - * $Id: cc.h,v 1.1 2007/06/14 12:34:09 kieranm Exp $ - */ -#ifndef __CC_H__ -#define __CC_H__ - -typedef unsigned char u8_t; -typedef signed char s8_t; -typedef unsigned short u16_t; -typedef signed short s16_t; -typedef unsigned int u32_t; -typedef signed int s32_t; - -typedef u32_t mem_ptr_t; - -#define U16_F "hu" -#define S16_F "hd" -#define X16_F "hx" -#define U32_F "u" -#define S32_F "d" -#define X32_F "x" - -#define BYTE_ORDER LITTLE_ENDIAN - -#define PACK_STRUCT_FIELD(x) x//; #pragma STRUCT_ALIGN(x,1) -#define PACK_STRUCT_STRUCT -#define PACK_STRUCT_BEGIN -#define PACK_STRUCT_END - -#ifndef LWIP_PLATFORM_DIAG -#define LWIP_PLATFORM_DIAG(x) do {printf x;} while(0) -#endif - -#ifndef LWIP_PLATFORM_ASSERT -#define LWIP_PLATFORM_ASSERT(x) do {printf("Assertion \"%s\" failed at line %d in %s\n", x, __LINE__, __FILE__); fflush(NULL); abort();} while(0) -#endif - -#endif /* __CC_H__ */ - diff --git a/contrib/ports/old/ti_c6711/include/arch/init.h b/contrib/ports/old/ti_c6711/include/arch/init.h deleted file mode 100644 index 38dc6aa..0000000 --- a/contrib/ports/old/ti_c6711/include/arch/init.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2001, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the lwIP TCP/IP stack. - * - * Author: Adam Dunkels - * - * $Id: init.h,v 1.1 2007/06/14 12:34:09 kieranm Exp $ - */ -#ifndef __ARCH_INIT_H__ -#define __ARCH_INIT_H__ - -#define TCPIP_INIT_DONE(arg) sys_sem_signal(*(sys_sem_t *)arg) - -#endif /* __ARCH_INIT_H__ */ - - - - diff --git a/contrib/ports/old/ti_c6711/include/arch/lib.h b/contrib/ports/old/ti_c6711/include/arch/lib.h deleted file mode 100644 index e0e03be..0000000 --- a/contrib/ports/old/ti_c6711/include/arch/lib.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2001, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the lwIP TCP/IP stack. - * - * Author: Adam Dunkels - * - * $Id: lib.h,v 1.1 2007/06/14 12:34:09 kieranm Exp $ - */ -#ifndef __LIB_H__ -#define __LIB_H__ - -#include "arch/cc.h" - -u16_t htons(u16_t n); -u16_t ntohs(u16_t n); -u32_t htonl(u32_t n); -u32_t ntohl(u32_t n); - -#endif /* __LIB_H__ */ diff --git a/contrib/ports/old/ti_c6711/include/arch/perf.h b/contrib/ports/old/ti_c6711/include/arch/perf.h deleted file mode 100644 index 3ef0ce4..0000000 --- a/contrib/ports/old/ti_c6711/include/arch/perf.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2001, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the lwIP TCP/IP stack. - * - * Author: Adam Dunkels - * - * $Id: perf.h,v 1.1 2007/06/14 12:34:09 kieranm Exp $ - */ -#ifndef __PERF_H__ -#define __PERF_H__ - -#define PERF_START /* null definition */ -#define PERF_STOP(x) /* null definition */ - -#endif /* __PERF_H__ */ diff --git a/contrib/ports/old/ti_c6711/include/arch/sys_arch.h b/contrib/ports/old/ti_c6711/include/arch/sys_arch.h deleted file mode 100644 index 65b03fd..0000000 --- a/contrib/ports/old/ti_c6711/include/arch/sys_arch.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -********************************************************************************************************* -* lwIP TCP/IP Stack -* port for uC/OS-II RTOS on TIC6711 DSK -* -* File : sys_arch.h -* By : ZengMing @ DEP,Tsinghua University,Beijing,China -* Reference: YangYe's source code for SkyEye project -********************************************************************************************************* -*/ -#ifndef __SYS_ARCH_H__ -#define __SYS_ARCH_H__ - -#include "os_cpu.h" -#include "os_cfg.h" -#include "ucos_ii.h" - -#define LWIP_STK_SIZE 4096 - -#define LWIP_TASK_MAX 5 //max number of lwip tasks -#define LWIP_START_PRIO 5 //first prio of lwip tasks - //!!!! so priority of lwip tasks is from 5-9 - -#define SYS_MBOX_NULL (void*)0 -#define SYS_SEM_NULL (void*)0 - -#define MAX_QUEUES 20 -#define MAX_QUEUE_ENTRIES 20 - -typedef struct { - OS_EVENT* pQ; - void* pvQEntries[MAX_QUEUE_ENTRIES]; -} TQ_DESCR, *PQ_DESCR; - -typedef OS_EVENT* sys_sem_t; -typedef PQ_DESCR sys_mbox_t;//the structure defined above -typedef INT8U sys_thread_t; - - -/* Critical Region Protection */ -/* These functions must be implemented in the sys_arch.c file. - In some implementations they can provide a more light-weight protection - mechanism than using semaphores. Otherwise semaphores can be used for - implementation */ -/** SYS_ARCH_DECL_PROTECT - * declare a protection variable. This macro will default to defining a variable of - * type sys_prot_t. If a particular port needs a different implementation, then - * this macro may be defined in sys_arch.h. - */ -#define SYS_ARCH_DECL_PROTECT(lev) -/** SYS_ARCH_PROTECT - * Perform a "fast" protect. This could be implemented by - * disabling interrupts for an embedded system or by using a semaphore or - * mutex. The implementation should allow calling SYS_ARCH_PROTECT when - * already protected. The old protection level is returned in the variable - * "lev". This macro will default to calling the sys_arch_protect() function - * which should be implemented in sys_arch.c. If a particular port needs a - * different implementation, then this macro may be defined in sys_arch.h - */ -#define SYS_ARCH_PROTECT(lev) OS_ENTER_CRITICAL() -/** SYS_ARCH_UNPROTECT - * Perform a "fast" set of the protection level to "lev". This could be - * implemented by setting the interrupt level to "lev" within the MACRO or by - * using a semaphore or mutex. This macro will default to calling the - * sys_arch_unprotect() function which should be implemented in - * sys_arch.c. If a particular port needs a different implementation, then - * this macro may be defined in sys_arch.h - */ -#define SYS_ARCH_UNPROTECT(lev) OS_EXIT_CRITICAL() - - - -#endif diff --git a/contrib/ports/old/ti_c6711/include/netif/ne2kif.h b/contrib/ports/old/ti_c6711/include/netif/ne2kif.h deleted file mode 100644 index b78ef10..0000000 --- a/contrib/ports/old/ti_c6711/include/netif/ne2kif.h +++ /dev/null @@ -1,187 +0,0 @@ -/* -********************************************************************************************************* -* lwIP TCP/IP Stack -* port for uC/OS-II RTOS on TIC6711 DSK -* -* File : tcp_ip.c -* By : ZengMing @ DEP,Tsinghua University,Beijing,China -* Reference: YangYe's source code for SkyEye project -********************************************************************************************************* -*/ - -#ifndef _NE2K_H_ -#define _NE2K_H_ - -#include "lwip/netif.h" - - -#define MIN_PACKET_SIZE 60 /* smallest legal size packet, no fcs */ -#define MAX_PACKET_SIZE 1514 /* largest legal size packet, no fcs */ - - -#define DELAY 0x590b2 //0.5s test by ming -#define DELAY_2S 0xbf000 //2s test -#define DELAY_MS 0x38F4 //20ms test - - -/** - * Driver functions. - */ -err_t ne2k_init(struct netif *netif); -static void low_level_init(struct netif * netif); -static void arp_timer(void *arg); - -static err_t low_level_output(struct netif * netif,struct pbuf *p); -u16_t write_AX88796(u8_t * buf, u16_t remote_Addr, u16_t Count); - -static void ne2k_input(struct netif *netif); -static struct pbuf * low_level_input(struct netif *netif); -u16_t read_AX88796(u8_t * buf, u16_t remote_Addr, u16_t Count); - - - -/*---------------------------------------- -* Register header of C6x DSP -*----------------------------------------*/ -#define EMIF_CE2 0x01800010 - -/* Define QDMA Memory Mapped Registers */ -#define QDMA_OPT 0x02000000 /* Address of QDMA options register */ -#define QDMA_SRC 0x02000004 /* Address of QDMA SRC address register */ -#define QDMA_CNT 0x02000008 /* Address of QDMA counts register */ -#define QDMA_DST 0x0200000C /* Address of QDMA DST address register */ -#define QDMA_IDX 0x02000010 /* Address of QDMA index register */ - -/* Define QDMA Pseudo Registers */ -#define QDMA_S_OPT 0x02000020 /* Address of QDMA options register */ -#define QDMA_S_SRC 0x02000024 /* Address of QDMA SRC address register */ -#define QDMA_S_CNT 0x02000028 /* Address of QDMA counts register */ -#define QDMA_S_DST 0x0200002C /* Address of QDMA DST address register */ -#define QDMA_S_IDX 0x02000030 /* Address of QDMA index register */ - - - -/*---------------------------------------- -* Register header of NE2000 chip -*----------------------------------------*/ -#define Base_ADDR 0xA0000200 ///CE2 space of DSK is 0xA0000000 - // and ethernet chip is at 0x200 by default - -// actual address on DSK -#define EN_CMD *(unsigned char *)(Base_ADDR+0x00) /* The command register (for all pages) */ -#define EN_DATA *(unsigned short *)(Base_ADDR+0x10) /*by ming (change to 16bit) Remote DMA Port10~17h (for all pages)*/ -#define EN_RESET *(unsigned char *)(Base_ADDR+0x1F) /* Reset Port 1fh(for all pages) */ - -/* Page 0 register offsets */ -#define EN0_STARTPG *(unsigned char *)(Base_ADDR+0x01) /* WR Starting page of ring buffer */ -#define EN0_STOPPG *(unsigned char *)(Base_ADDR+0x02) /* WR Ending page +1 of ring buffer */ -#define EN0_BOUNDARY *(unsigned char *)(Base_ADDR+0x03) /* RD/WR Boundary page of ring buffer */ -#define EN0_TSR *(unsigned char *)(Base_ADDR+0x04) /* RD Transmit status reg */ -#define EN0_TPSR *(unsigned char *)(Base_ADDR+0x04) /* WR Transmit starting page */ -#define EN0_NCR *(unsigned char *)(Base_ADDR+0x05) /* RD Number of collision reg */ -#define EN0_TCNTLO *(unsigned char *)(Base_ADDR+0x05) /* WR Low byte of tx byte count */ -#define EN0_CRP *(unsigned char *)(Base_ADDR+0x06) /* Current Page Register */ -#define EN0_TCNTHI *(unsigned char *)(Base_ADDR+0x06) /* WR High byte of tx byte count */ -#define EN0_ISR *(unsigned char *)(Base_ADDR+0x07) /* RD/WR Interrupt status reg */ -#define EN0_CRDALO *(unsigned char *)(Base_ADDR+0x08) /* RD low byte of current remote dma add*/ -#define EN0_RSARLO *(unsigned char *)(Base_ADDR+0x08) /* WR Remote start address reg 0 */ -#define EN0_CRDAHI *(unsigned char *)(Base_ADDR+0x09) /* RD high byte, current remote dma add.*/ -#define EN0_RSARHI *(unsigned char *)(Base_ADDR+0x09) /* WR Remote start address reg 1 */ -#define EN0_RCNTLO *(unsigned char *)(Base_ADDR+0x0A) /* WR Remote byte count reg 0 */ -#define EN0_RCNTHI *(unsigned char *)(Base_ADDR+0x0B) /* WR Remote byte count reg 1 */ -#define EN0_RSR *(unsigned char *)(Base_ADDR+0x0C) /* RD RX status reg */ -#define EN0_RXCR *(unsigned char *)(Base_ADDR+0x0C) /* WR RX configuration reg */ -#define EN0_TXCR *(unsigned char *)(Base_ADDR+0x0D) /* WR TX configuration reg */ -#define EN0_DCFG *(unsigned char *)(Base_ADDR+0x0E) /* WR Data configuration reg */ -#define EN0_IMR *(unsigned char *)(Base_ADDR+0x0F) /* WR Interrupt mask reg */ - -/* Page 1 register offsets */ -#define EN1_PAR0 *(unsigned char *)(Base_ADDR+0x01) /* RD/WR This board's physical ethernet addr */ -#define EN1_PAR1 *(unsigned char *)(Base_ADDR+0x02) -#define EN1_PAR2 *(unsigned char *)(Base_ADDR+0x03) -#define EN1_PAR3 *(unsigned char *)(Base_ADDR+0x04) -#define EN1_PAR4 *(unsigned char *)(Base_ADDR+0x05) -#define EN1_PAR5 *(unsigned char *)(Base_ADDR+0x06) -#define EN1_CURR *(unsigned char *)(Base_ADDR+0x07) /* RD/WR current page reg */ -#define EN1_CURPAG EN1_CURR -#define EN1_MAR0 *(unsigned char *)(Base_ADDR+0x08) /* RD/WR Multicast filter mask array (8 bytes) */ -#define EN1_MAR1 *(unsigned char *)(Base_ADDR+0x09) -#define EN1_MAR2 *(unsigned char *)(Base_ADDR+0x0A) -#define EN1_MAR3 *(unsigned char *)(Base_ADDR+0x0B) -#define EN1_MAR4 *(unsigned char *)(Base_ADDR+0x0C) -#define EN1_MAR5 *(unsigned char *)(Base_ADDR+0x0D) -#define EN1_MAR6 *(unsigned char *)(Base_ADDR+0x0E) -#define EN1_MAR7 *(unsigned char *)(Base_ADDR+0x0F) - -/* Command Values at EN_CMD */ -#define EN_STOP 0x01 /* Stop and reset the chip */ -#define EN_START 0x02 /* Start the chip, clear reset */ -#define EN_TRANS 0x04 /* Transmit a frame */ -#define EN_RREAD 0x08 /* Remote read */ -#define EN_RWRITE 0x10 /* Remote write */ -#define EN_NODMA 0x20 /* Remote DMA */ -#define EN_PAGE0 0x00 /* Select page chip registers */ -#define EN_PAGE1 0x40 /* using the two high-order bits */ - - -//--------------------------------- -// Values for Ring-Buffer setting -//--------------------------------- - -#define NE_START_PG 0x40 /* First page of TX buffer */ -#define NE_STOP_PG 0x80 /* Last page + 1 of RX Ring */ - -#define TX_PAGES 6 -#define TX_START_PG NE_START_PG //0x40 - -#define RX_START_PG NE_START_PG + TX_PAGES //0x46 -#define RX_CURR_PG RX_START_PG + 1 //0x47 -#define RX_STOP_PG NE_STOP_PG //0x80 - - - - -/* Bits in EN0_ISR - Interrupt status register (RD WR) */ -#define ENISR_RX 0x01 /* Receiver, no error */ -#define ENISR_TX 0x02 /* Transceiver, no error */ -#define ENISR_RX_ERR 0x04 /* Receiver, with error */ - //½ÓÊÕÊý¾Ý°ü³ö´í¡£×öÖØÐÂÉèÖÃBNRY£½CURR´¦Àí¡£ -#define ENISR_TX_ERR 0x08 /* Transmitter, with error */ - //ÓÉÓÚ³åÍ»´ÎÊý¹ý¶à£¬·¢Ëͳö´í¡£×öÖØ·¢´¦Àí -#define ENISR_OVER 0x10 /* Receiver overwrote the ring */ - /* Gap area of receiver ring buffer was disappeared */ - //Íø¿¨ÄÚ´æÒç³ö¡£×öÈí¼þÖØÆôÍø¿¨´¦Àí¡£¼ûÊֲᡣ -#define ENISR_COUNTERS 0x20 /* Counters need emptying */ - /* MSB of network tally counter became 1 */ - //³ö´í¼ÆÊýÆ÷Öжϣ¬ÆÁ±Îµô£¨ÆÁ±ÎÓÃIMR¼Ä´æÆ÷£©¡£ -#define ENISR_RDC 0x40 /* remote dma complete */ - //ÆÁ±Îµô¡£ÂÖѯµÈ´ýDMA½áÊø¡£ -#define ENISR_RESET 0x80 /* Reset completed */ - //Íø¿¨Reset£¬ÆÁ±Îµô¡£ -#define ENISR_ALL 0x3f /* 3f Interrupts we will enable */ - /* RST RDC CNT OVW TXE RXE PTX PRX */ - - -/* Bits in EN0_RXCR - RX configuration reg */ -//#define ENRXCR_RXCONFIG 0x04 /* EN0_RXCR: broadcasts,no multicast,errors */ -#define ENRXCR_RXCONFIG 0x00 /* EN0_RXCR: only unicast */ -#define ENRXCR_CRC 0x01 /* Save error packets(admit) */ -#define ENRXCR_RUNT 0x02 /* Accept runt pckt(below 64bytes) */ -#define ENRXCR_BCST 0x04 /* Accept broadcasts when 1 */ -#define ENRXCR_MULTI 0x08 /* Multicast (if pass filter) when 0 */ -#define ENRXCR_PROMP 0x10 /* Promiscuous physical addresses when 1*/ - /* when 0,accept assigned PAR0~5 address */ -#define ENRXCR_MON 0x20 /* Monitor mode (no packets rcvd) */ - - -/* Bits in EN0_TXCR - TX configuration reg */ -#define ENTXCR_TXCONFIG 0x00 /* Normal transmit mode */ -#define ENTXCR_CRC 0x01 /* inhibit CRC,do not append crc when 1 */ -#define ENTXCR_LOOP 0x02 /* set internal loopback mode ? */ -#define ENTXCR_LB01 0x06 /* encoded loopback control ? */ -#define ENTXCR_ATD 0x08 /* auto tx disable */ -/* when 1, if specified multicast packet was received, disable transmit */ -#define ENTXCR_OFST 0x10 /* collision offset enable */ -/* selection of collision algorithm. When 0, gererally back-off algorithm select */ - -#endif /* _NE2K_H_ */ diff --git a/contrib/ports/old/ti_c6711/lib_arch.c b/contrib/ports/old/ti_c6711/lib_arch.c deleted file mode 100644 index f80628b..0000000 --- a/contrib/ports/old/ti_c6711/lib_arch.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2001, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the lwIP TCP/IP stack. - * - * Author: Adam Dunkels - * - * $Id: lib_arch.c,v 1.1 2007/06/14 12:34:09 kieranm 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. - */ - - -//yangye 2003-1-22 -#include "lwip/arch.h" - -/*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); -}*/ -/*-----------------------------------------------------------------------------------*/ diff --git a/contrib/ports/old/ti_c6711/netif/ne2kif.c b/contrib/ports/old/ti_c6711/netif/ne2kif.c deleted file mode 100644 index def26fd..0000000 --- a/contrib/ports/old/ti_c6711/netif/ne2kif.c +++ /dev/null @@ -1,636 +0,0 @@ -/* -********************************************************************************************************* -* lwIP TCP/IP Stack -* port for uC/OS-II RTOS on TIC6711 DSK -* -* File : tcp_ip.c -* By : ZengMing @ DEP,Tsinghua University,Beijing,China -* Reference: YangYe's source code for SkyEye project -********************************************************************************************************* -*/ -#include "lwip/opt.h" -#include "lwip/def.h" -#include "lwip/mem.h" -#include "lwip/pbuf.h" -#include "lwip/sys.h" -#include - -#include "netif/etharp.h" - -#include "netif/ne2kif.h" - -/* define this to use QDMA, which is much faster! */ -#define QDMA_Enabled - -/* Define those to better describe your network interface. */ -#define IFNAME0 'e' -#define IFNAME1 't' - -struct ne2k_if { - struct eth_addr *ethaddr; //MAC Address -}; - -struct netif *ne2k_if_netif; - - -/*---------------------------------------------------------------------------------------- - **************************************************************************************** - ----------------------------------------------------------------------------------------*/ - -/* - * 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. - * - */ -err_t ne2k_init(struct netif *netif) -{ - struct ne2k_if *ne2k_if; - - ne2k_if = mem_malloc(sizeof(struct ne2k_if));//MAC Address - - if (ne2k_if == NULL) - { - LWIP_DEBUGF(NETIF_DEBUG,("ne2k_init: out of memory!\n")); - return ERR_MEM; - } - - netif->state = ne2k_if; - netif->name[0] = IFNAME0; - netif->name[1] = IFNAME1; - netif->output = etharp_output; - netif->linkoutput = low_level_output; - - ne2k_if->ethaddr = (struct eth_addr *)&(netif->hwaddr[0]); - - low_level_init(netif); - - etharp_init(); - - sys_timeout(ARP_TMR_INTERVAL, arp_timer, NULL); - - return ERR_OK; -} - -/** - * arp_timer. - */ -static void arp_timer(void *arg) -{ - etharp_tmr(); - sys_timeout(ARP_TMR_INTERVAL, (sys_timeout_handler)arp_timer, NULL); -} - -/** - * Initialize the ne2k ethernet chip, resetting the interface and getting the ethernet - * address. - */ -static void low_level_init(struct netif * netif) -{ - u16_t i; - struct ne2k_if *ne2k_if; - - ne2k_if = netif->state; - // the meaning of "netif->state" can be defined in drivers, here for MAC address! - - netif->hwaddr_len=6; - netif->mtu = 1500; - netif->flags = NETIF_FLAG_BROADCAST; - - // ---------- start ------------- - *(u32_t *)EMIF_CE2 = 0x11D4C714; // Set CE2 to 16bits mode, - // AX88796 required no less than 160ns period - - i = EN_RESET; //this instruction let NE2K chip soft reset - - for (i=0;iethaddr->addr[0] = (u8_t) 0x12;//MAC_addr.addr[0]; - ne2k_if->ethaddr->addr[1] = (u8_t) 0x34;//MAC_addr.addr[1]; - ne2k_if->ethaddr->addr[2] = (u8_t) 0x56;//MAC_addr.addr[2]; - ne2k_if->ethaddr->addr[3] = (u8_t) 0x78;//MAC_addr.addr[3]; - ne2k_if->ethaddr->addr[4] = (u8_t) 0x9a;//MAC_addr.addr[4]; - ne2k_if->ethaddr->addr[5] = (u8_t) 0xe0;//MAC_addr.addr[5]; - - /* Initialize the multicast list to reject-all. - If we enable multicast the higher levels can do the filtering. - */ - EN1_MAR0 = (u8_t) 0x00; - EN1_MAR1 = (u8_t) 0x00; - EN1_MAR2 = (u8_t) 0x00; - EN1_MAR3 = (u8_t) 0x00; - EN1_MAR4 = (u8_t) 0x00; - EN1_MAR5 = (u8_t) 0x00; - EN1_MAR6 = (u8_t) 0x00; - EN1_MAR7 = (u8_t) 0x00; - - EN_CMD = (u8_t) (EN_PAGE0 + EN_NODMA + EN_STOP); - - EN0_IMR = (u8_t) (ENISR_OVER + ENISR_RX + ENISR_RX_ERR); - - EN0_TXCR = (u8_t) 0x00; //E0 //TCR - EN0_RXCR = (u8_t) 0x44; //CC //RCR - - EN_CMD = (u8_t) (EN_PAGE0 + EN_NODMA + EN_START); - - EN0_ISR = (u8_t) 0xff; // clear the all flag bits in EN0_ISR - - ne2k_if_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 * netif, struct pbuf *p) -{ - struct pbuf *q; - u16_t packetLength,remote_Addr,Count; - u8_t *buf; - - packetLength = p->tot_len - ETH_PAD_SIZE; //05 01 millin - - if ((packetLength) < 64) packetLength = 64; //add pad by the AX88796 automatically - - // turn off RX int - EN0_IMR = (u8_t) (ENISR_OVER); - - /* We should already be in page 0, but to be safe... */ - EN_CMD = (u8_t) (EN_PAGE0 + EN_START + EN_NODMA); - - // clear the RDC bit - EN0_ISR = (u8_t) ENISR_RDC; - - remote_Addr = (u16_t)(TX_START_PG<<8); - - /* - * Write packet to ring buffers. - */ - 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. */ - Count = q->len; - buf = q->payload; - - if (q == p){ - buf += ETH_PAD_SIZE; - Count -= ETH_PAD_SIZE;//Pad in Eth_hdr struct - } - - // Write data to AX88796 - remote_Addr = write_AX88796(buf, remote_Addr, Count); - } //for - - /* Just send it, and does not check */ - while (EN_CMD & EN_TRANS); - - EN0_TPSR = (u8_t) TX_START_PG; - EN0_TCNTLO = (u8_t) (packetLength & 0xff); - EN0_TCNTHI = (u8_t) (packetLength >> 8); - EN_CMD = (u8_t) (EN_PAGE0 + EN_NODMA + EN_TRANS + EN_START); - - EN0_IMR = (u8_t) (ENISR_OVER + ENISR_RX + ENISR_RX_ERR); - - #if LINK_STATS - lwip_stats.link.xmit++; - #endif /* LINK_STATS */ - - return ERR_OK; -} - -/** - * write_AX88796. - */ -u16_t write_AX88796(u8_t * buf, u16_t remote_Addr, u16_t Count) -{ - #ifndef QDMA_Enabled - u16_t loop; - #endif - - /* AX88796. */ - EN0_RCNTLO = (u8_t) ( Count & 0xff); - EN0_RCNTHI = (u8_t) ( Count >> 8); - EN0_RSARLO = (u8_t) ( remote_Addr & 0xff); - EN0_RSARHI = (u8_t) ( remote_Addr >> 8); - EN_CMD = (u8_t) (EN_RWRITE + EN_START + EN_PAGE0); - - // Add for next loop... - remote_Addr += Count; - - Count = (Count + 1) >> 1; // Turn to 16bits count. - - #ifdef QDMA_Enabled - *(u32_t *)QDMA_SRC = (u32_t) buf; - *(u32_t *)QDMA_DST = (u32_t) &EN_DATA; - *(u32_t *)QDMA_CNT = (u32_t) Count; - *(u32_t *)QDMA_IDX = 0x00000000; - *(u32_t *)QDMA_S_OPT = 0x29000001; - #else - for (loop=0;loop < Count ;loop++){ - EN_DATA = *(u16_t *)buf; - buf += 2; - } - #endif //QDMA_Enabled - - while ((EN0_ISR & ENISR_RDC) == 0); - - EN0_ISR = (u8_t) ENISR_RDC; - - return remote_Addr; -} - - -/*---------------------------------------------------------------------------------------- - **************************************************************************************** - ----------------------------------------------------------------------------------------*/ - -/* - * 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 -ne2k_input(struct netif *netif) -{ - struct ne2k_if *ne2k_if; - struct eth_hdr *ethhdr; - struct pbuf *p; - - ne2k_if = netif->state; - - /* move received packet into a new pbuf */ - p = low_level_input(netif); - /* no packet could be read, silently ignore this */ - if (p == NULL) return; - /* points to packet payload, which starts with an Ethernet header */ - ethhdr = p->payload; - -#if LINK_STATS - lwip_stats.link.recv++; -#endif /* LINK_STATS */ - - switch(htons(ethhdr->type)) { - /* IP packet? */ - case ETHTYPE_IP: - /* update ARP table */ - etharp_ip_input(netif, p); - /* skip Ethernet header */ - pbuf_header(p, -(14+ETH_PAD_SIZE)); - /* pass to network layer */ - netif->input(p, netif); - break; - case ETHTYPE_ARP: - /* pass p to ARP module */ - etharp_arp_input(netif, ne2k_if->ethaddr, p); - break; - default: - pbuf_free(p); - p = NULL; - break; - } -} - -/* - * 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 *netif) -{ - u16_t packetLength, Count, remote_Addr; - u8_t *buf, PDHeader[4]; - u8_t curr, this_frame, next_frame; - struct pbuf *p, *q, *r; - - EN_CMD = (u8_t) (EN_PAGE1 + EN_NODMA + EN_START); - curr = (u8_t) EN1_CURR; - EN_CMD = (u8_t) (EN_PAGE0 + EN_NODMA + EN_START); - this_frame = (u8_t) EN0_BOUNDARY + 1; - - if (this_frame >= RX_STOP_PG) - this_frame = RX_START_PG; - - //---------- get the first 4 bytes from AX88796 --------- - (void) read_AX88796(PDHeader, (u16_t)(this_frame<<8), 4); - - - //----- Store real length, set len to packet length - header --------- - packetLength = ((unsigned) PDHeader[2] | (PDHeader[3] << 8 )) - 4; // minus PDHeader[4] - next_frame = (u8_t) (this_frame + 1 + ((packetLength + 4) >> 8)); - - // Bad frame! - if ((PDHeader[1] != (u8_t)next_frame) && (PDHeader[1] != (u8_t)(next_frame + 1)) - && (PDHeader[1] != (u8_t)(next_frame - RX_STOP_PG + RX_START_PG)) - && (PDHeader[1] != (u8_t)(next_frame + 1 - RX_STOP_PG + RX_START_PG))) - { - EN0_BOUNDARY = (u8_t) (curr - 1); - return NULL; - } - - // Bogus Packet Size - if (packetLength > MAX_PACKET_SIZE || packetLength < MIN_PACKET_SIZE) - { - next_frame = PDHeader[1]; - EN0_BOUNDARY = (u8_t) (next_frame-1); - return NULL; - } - - - EN_CMD = (u8_t) (EN_PAGE0 + EN_NODMA + EN_START); - - EN0_ISR = (u8_t) ENISR_RDC; // clear the RDC bit - - - remote_Addr = (u16_t)((this_frame << 8) + 4); - - if ((remote_Addr + packetLength + ETH_PAD_SIZE) > (u16_t)(RX_STOP_PG<<8)) { - p = pbuf_alloc(PBUF_RAW, (u16_t)(RX_STOP_PG<<8) - remote_Addr, PBUF_POOL); /* length of buf */ - packetLength -= (u16_t)(RX_STOP_PG<<8) - remote_Addr - ETH_PAD_SIZE; - } else { - p = pbuf_alloc(PBUF_RAW, packetLength+ETH_PAD_SIZE, PBUF_POOL); /* length of buf */ - packetLength = 0; - } - - if(p != NULL) { /* We iterate over the pbuf chain until we have read the entire packet into the pbuf. */ - 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. */ - buf = q->payload; - Count = q->len; - if (q == p){ // if it's the first pbuf in chain... - buf += ETH_PAD_SIZE; - Count -= ETH_PAD_SIZE; // pad in Eth_hdr struct - } - remote_Addr = read_AX88796(buf, remote_Addr, Count); - - #if LINK_STATS - lwip_stats.link.recv++; - #endif /* LINK_STATS */ - } //for(q = p; q != NULL; q= q->next) - } //if(p != NULL) - else - { // p == NULL - #if LINK_STATS - lwip_stats.link.memerr++; - lwip_stats.link.drop++; - #endif /* LINK_STATS */ - } - - - if (packetLength) // ring buffer cycled - { - remote_Addr = (u16_t)(RX_START_PG << 8); - r = pbuf_alloc(PBUF_RAW, packetLength, PBUF_POOL); /* length of buf */ - - if(r != NULL) { /* We iterate over the pbuf chain until we have read the entire packet into the pbuf. */ - for(q = r; 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. */ - buf = q->payload; - Count = q->len; - remote_Addr = read_AX88796(buf, remote_Addr, Count); - } //for - // link pbuf p & r - pbuf_cat(p, r); - } - else // r == NULL - { - #if LINK_STATS - lwip_stats.link.memerr++; - lwip_stats.link.drop++; - #endif - } - } // if (packetLength) - - - next_frame = PDHeader[1]; - - EN0_BOUNDARY = (u8_t) (next_frame-1); - - return p; -} - -/** - * read_AX88796. - */ -u16_t read_AX88796(u8_t * buf, u16_t remote_Addr, u16_t Count) -{ - u8_t flagOdd=0; -#ifndef QDMA_Enabled - u16_t loop; -#endif - - flagOdd = (Count & 0x0001); // set Flag if Count is odd. - - Count -= flagOdd; - - EN0_RCNTLO = (u8_t) (Count & 0xff); - EN0_RCNTHI = (u8_t) (Count >> 8); - EN0_RSARLO = (u8_t) (remote_Addr & 0xff); - EN0_RSARHI = (u8_t) (remote_Addr >> 8); - EN_CMD = (u8_t) (EN_PAGE0 + EN_RREAD + EN_START); - - remote_Addr += Count; - - Count = Count>>1; - - #ifdef QDMA_Enabled - *(u32_t *)QDMA_SRC = (u32_t) &EN_DATA; - *(u32_t *)QDMA_DST = (u32_t) buf; - *(u32_t *)QDMA_CNT = (u32_t) Count; - *(u32_t *)QDMA_IDX = 0x00000000; - *(u32_t *)QDMA_S_OPT = 0x28200001; - buf += Count*2; - #else - for (loop=0;loop < Count ;loop++){ - *(u16_t *)buf = EN_DATA ; - buf += 2; - } - #endif //QDMA_Enabled - - while ((EN0_ISR & ENISR_RDC) == 0); - - EN0_ISR = (u8_t) ENISR_RDC; - - if (flagOdd) { - EN0_RCNTLO = 0x01; - EN0_RCNTHI = 0x00; - EN0_RSARLO = (u8_t) (remote_Addr & 0xff); - EN0_RSARHI = (u8_t) (remote_Addr >> 8); - EN_CMD = (u8_t) (EN_PAGE0 + EN_RREAD + EN_START); - - remote_Addr += 1; - - *(u8_t *)buf = *(u8_t *)(Base_ADDR+0x10) ; - - while ((EN0_ISR & ENISR_RDC) == 0); - - EN0_ISR = (u8_t) ENISR_RDC; - } - - return remote_Addr; -} - -/*---------------------------------------------------------------------------------------- - **************************************************************************************** - ----------------------------------------------------------------------------------------*/ - -/** - * ne2k_rx_err. - */ -void ne2k_rx_err(void) -{ - u8_t curr; - EN_CMD = (u8_t) (EN_PAGE1 + EN_NODMA + EN_STOP); - curr = (u8_t) EN1_CURR; - EN_CMD = (u8_t) (EN_PAGE0 + EN_NODMA + EN_STOP); - EN0_BOUNDARY = (u8_t) curr-1; -} - -/** - * ne2k_rx. - */ -void ne2k_rx(void) -{ - u8_t curr,bnry,loopCnt = 0; - - while(loopCnt < 10) { - - EN_CMD = (u8_t) (EN_PAGE1 + EN_NODMA + EN_STOP); - curr = (u8_t) EN1_CURR; - EN_CMD = (u8_t) (EN_PAGE0 + EN_NODMA + EN_STOP); - bnry = (u8_t) EN0_BOUNDARY + 1; - - if (bnry >= RX_STOP_PG) - bnry = RX_START_PG; - - if (curr == bnry) break; - - ne2k_input(ne2k_if_netif); - - loopCnt++; - } -} - -/*---*---*---*---*---*---*---* - * void ne2k_isr(void) - * can be int 4 5 6 or 7 - *---*---*---*---*---*---*---*/ -void ne2k_isr(void) -{ - DSP_C6x_Save(); - - OSIntEnter(); - - if (OSIntNesting == 1) - { - OSTCBCur->OSTCBStkPtr = (OS_STK *) DSP_C6x_GetCurrentSP(); - } - - /* You can enable Interrupt again here, - if want to use nested interrupt..... */ - //------------------------------------------------------------ - - EN_CMD = (u8_t) (EN_PAGE0 + EN_NODMA + EN_STOP); - //outb(CMD_PAGE0 | CMD_NODMA | CMD_STOP,NE_CR); - - EN0_IMR = (u8_t) 0x00;//close - - // ram overflow interrupt - if (EN0_ISR & ENISR_OVER) { - EN0_ISR = (u8_t) ENISR_OVER; // clear interrupt - } - - // error transfer interrupt ,NIC abort tx due to excessive collisions - if (EN0_ISR & ENISR_TX_ERR) { - EN0_ISR = (u8_t) ENISR_TX_ERR; // clear interrupt - //temporarily do nothing - } - - // Rx error , reset BNRY pointer to CURR (use SEND PACKET mode) - if (EN0_ISR & ENISR_RX_ERR) { - EN0_ISR = (u8_t) ENISR_RX_ERR; // clear interrupt - ne2k_rx_err(); - } - - //got packet with no errors - if (EN0_ISR & ENISR_RX) { - EN0_ISR = (u8_t) ENISR_RX; - ne2k_rx(); - } - - //Transfer complelte, do nothing here - if (EN0_ISR & ENISR_TX){ - EN0_ISR = (u8_t) ENISR_TX; // clear interrupt - } - - EN_CMD = (u8_t) (EN_PAGE0 + EN_NODMA + EN_STOP); - - EN0_ISR = (u8_t) 0xff; // clear ISR - - EN0_IMR = (u8_t) (ENISR_OVER + ENISR_RX + ENISR_RX_ERR); - - //open nic for next packet - EN_CMD = (u8_t) (EN_PAGE0 + EN_NODMA + EN_START); - - if (led_stat & 0x04) {LED3_on;} - else {LED3_off;} - - //-------------------------------------------------------- - - OSIntExit(); - - DSP_C6x_Resume(); - - asm (" nop 5"); //important! - // this can avoid a stack error when compile with the optimization! -} diff --git a/contrib/ports/old/ti_c6711/proj/lwIP.c b/contrib/ports/old/ti_c6711/proj/lwIP.c deleted file mode 100644 index 1934dac..0000000 --- a/contrib/ports/old/ti_c6711/proj/lwIP.c +++ /dev/null @@ -1,152 +0,0 @@ -/* -********************************************************************************************************* -* lwIP TCP/IP Stack -* port for uC/OS-II RTOS on TIC6711 DSK -* -* File : tcp_ip.c -* By : ZengMing @ DEP,Tsinghua University,Beijing,China -********************************************************************************************************* -*/ -#include -#include -#include -#include - -#include "..\uCOS-II\TI_C6711\DSP_C6x_Vectors\DSP_C6x_Vectors.H" - -// -- Architecture Files -- -#include "..\lwIP\arch\TI_C6711\sys_arch.c" -#include "..\lwIP\arch\TI_C6711\netif\ne2kif.c" -// -- Generic network interface -- -#include "..\lwIP\src\netif\loopif.c" -#include "..\lwIP\src\netif\etharp.c" - -// -- common file -#include "..\lwIP\src\core\mem.c" -#include "..\lwIP\src\core\memp.c" -#include "..\lwIP\src\core\netif.c" -#include "..\lwIP\src\core\pbuf.c" -#include "..\lwIP\src\core\stats.c" -#include "..\lwIP\src\core\sys.c" -#include "..\lwIP\src\core\tcp.c" -#include "..\lwIP\src\core\tcp_in.c" -#include "..\lwIP\src\core\tcp_out.c" -#include "..\lwIP\src\core\udp.c" -#include "..\lwIP\src\core\raw.c" -// -- target ipv4 -- -#include "..\lwIP\src\core\ipv4\icmp.c" -#include "..\lwIP\src\core\ipv4\ip.c" -#include "..\lwIP\src\core\inet.c" -#include "..\lwIP\src\core\ipv4\ip_addr.c" -#include "..\lwIP\src\core\ipv4\ip_frag.c" -// -- sequential and socket APIs -- -#include "..\lwIP\src\api\api_lib.c" -#include "..\lwIP\src\api\api_msg.c" -#include "..\lwIP\src\api\tcpip.c" -#include "..\lwIP\src\api\err.c" -#include "..\lwIP\src\api\sockets.c" - -// sample task code (http demo) -#include "sample_http.c" - -struct netif ne2kif_if; -//struct netif loop_if; - -void ethernet_hardreset(void); //These reset codes are built for C6711 DSP -void tcpip_init_done_ok(void * arg); - -void Task_lwip_init(void * pParam) -{ - struct ip_addr ipaddr, netmask, gw; - sys_sem_t sem; - - ethernet_hardreset();//hard reset of EthernetDaughterCard - - #if LWIP_STATS - stats_init(); - #endif - // initial lwIP stack - sys_init(); - mem_init(); - memp_init(); - pbuf_init(); - netif_init(); - lwip_socket_init(); - - printf("TCP/IP initializing...\n"); - sem = sys_sem_new(0); - tcpip_init(tcpip_init_done_ok, &sem); - sys_sem_wait(sem); - sys_sem_free(sem); - printf("TCP/IP initialized.\n"); - - //add loop interface //set local loop-interface 127.0.0.1 - /* - IP4_ADDR(&gw, 127,0,0,1); - IP4_ADDR(&ipaddr, 127,0,0,1); - IP4_ADDR(&netmask, 255,0,0,0); - netif_add(&loop_if, &ipaddr, &netmask, &gw, NULL, loopif_init, - tcpip_input);*/ - - //add ne2k interface - IP4_ADDR(&gw, 166,111,32,1); - IP4_ADDR(&ipaddr, 166,111,33,120); - IP4_ADDR(&netmask, 255,255,254,0); - - netif_add(&ne2kif_if, &ipaddr, &netmask, &gw, NULL, ne2k_init, tcpip_input); - netif_set_default(&ne2kif_if); - netif_set_up(&ne2kif_if); // new step from lwip 1.0.0 - - printf("Applications started.\n"); - - //------------------------------------------------------------ - //All thread(task) of lwIP must have their PRI between 10 and 14. - // sys_thread_new("httpd_init", httpd_init, (void*)"httpd", DEFAULT_THREAD_STACKSIZE, 10); - //------------------------------------------------------------ - httpd_init();//sample_http - - printf("lwIP threads created!\n"); - - DSP_C6x_TimerInit(); // Timer interrupt enabled - DSP_C6x_Int4Init(); // Int4(Ethernet Chip int) enabled - - /* Block for ever. */ - sem = sys_sem_new(0); - sys_sem_wait(sem); - printf(" never goes here, should not appear!\n"); -} - -//--------------------------------------------------------- -void tcpip_init_done_ok(void * arg) -{ - sys_sem_t *sem; - sem = arg; - sys_sem_signal(*sem); -} - - -/*-----------------------------------------------------------*/ -/* This function do the hard reset of EthernetDaughterCard * - * through the DaughterBoardControl0 signal in DB-IF */ -/*-----------------------------------------------------------*/ -void ethernet_hardreset(void) //These reset codes are built for C6711 DSK -{ - u32_t i; - - OS_ENTER_CRITICAL(); - -//SET LED1 ON AND /RST pin Low - *(unsigned char *)0x90080003 = 0x06; - for (i=0;i - * - * $Id: lwipopts.h,v 1.2 2007/09/07 23:28:54 fbernon Exp $ - */ -#ifndef __LWIPOPTS_H__ -#define __LWIPOPTS_H__ - -// for TI C6000 DSP target, struct align.... -//------------------------------------------------ -#define ETH_PAD_SIZE 2 -//------------------------------------------------ - -//------------------------------------------------ -/* Critical Region Protection */ -//------------------------------------------------ -/** SYS_LIGHTWEIGHT_PROT - * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection - * for certain critical regions during buffer allocation, deallocation and memory - * allocation and deallocation. - */ -#define SYS_LIGHTWEIGHT_PROT 1 //millin - -//---------------------------------------------------------------------- -/* ---------- 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 4 - -/* 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 65536 - -/* 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 32 - -/* Number of raw connection PCBs */ -#define MEMP_NUM_RAW_PCB 8 - -/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One - per active UDP "connection". */ -#define MEMP_NUM_UDP_PCB 8 - -/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP - connections. */ -#define MEMP_NUM_TCP_PCB 8 - -/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP - connections. */ -#define MEMP_NUM_TCP_PCB_LISTEN 2 - -/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP - segments. */ -#define MEMP_NUM_TCP_SEG 32 - -/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active - timeouts. */ -#define MEMP_NUM_SYS_TIMEOUT 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 32 - -/* MEMP_NUM_NETCONN: the number of struct netconns. */ -#define MEMP_NUM_NETCONN 32 - -/* MEMP_NUM_TCPIP_MSG: 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_API 32 -#define MEMP_NUM_TCPIP_MSG_INPKT 32 - -//---------------------------------------------------------------------- -/* ---------- Pbuf options ---------- */ -//---------------------------------------------------------------------- -/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */ -#define PBUF_POOL_SIZE 16 - -/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */ -#define PBUF_POOL_BUFSIZE 1536 - - - -//---------------------------------------------------------------------- -/* ---------- ARP options ---------- */ -//---------------------------------------------------------------------- -/** Number of active hardware address, IP address pairs cached */ -#define ARP_TABLE_SIZE 10//10 -/** - * If enabled, outgoing packets are queued during hardware address - * resolution. - * - * This feature has not stabilized yet. Single-packet queueing is - * believed to be stable, multi-packet queueing is believed to - * clash with the TCP segment queueing. - * - * As multi-packet-queueing is currently disabled, enabling this - * _should_ work, but we need your testing feedback on lwip-users. - * - */ -#define ARP_QUEUEING 0 -// if TCP was used, must disable this in v1.1.0 //millin - - -//---------------------------------------------------------------------- -/* ---------- 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 0 - -/** IP reassembly and segmentation. Even if they both deal with IP - * fragments, note that these are orthogonal, one dealing with incoming - * packets, the other with outgoing packets - */ - -/** Reassemble incoming fragmented IP packets */ -#define IP_REASSEMBLY 0 - -/** Fragment outgoing IP packets if their size exceeds MTU */ -#define IP_FRAG 0 - - -//---------------------------------------------------------------------- -/* ---------- 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 - - -//---------------------------------------------------------------------- -/* ---------- TCP options ---------- */ -//---------------------------------------------------------------------- -#define LWIP_TCP 1 - -/* TCP receive window. */ -#define TCP_WND 32768 - -/* Maximum number of retransmissions of data segments. */ -#define TCP_MAXRTX 4 - -/* Maximum number of retransmissions of SYN segments. */ -#define TCP_SYNMAXRTX 4 - -/* 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 1476 - -/* TCP sender buffer space (bytes). */ -#define TCP_SND_BUF 32768 - - -//---------------------------------------------------------------------- -/* ---------- Other options ---------- */ -//---------------------------------------------------------------------- - -/* Support loop interface (127.0.0.1) */ -#define LWIP_HAVE_LOOPIF 0 - -#define LWIP_COMPAT_SOCKETS 1 - -// for uC/OS-II port on TI DSP -#define TCPIP_THREAD_PRIO 5 //millin -//#define SLIPIF_THREAD_PRIO 1 -//#define PPP_THREAD_PRIO 1 - - -//---------------------------------------------------------------------- -/* ---------- Socket Options ---------- */ -//---------------------------------------------------------------------- - -/* Enable SO_REUSEADDR and SO_REUSEPORT options */ -#define SO_REUSE 0 - - -//---------------------------------------------------------------------- -/* ---------- Statistics options ---------- */ -//---------------------------------------------------------------------- - -#define STATS 0 - -#if LWIP_STATS - -#define LWIP_STATS_DISPLAY 1 -#define LINK_STATS 1 -#define IP_STATS 1 -#define IPFRAG_STATS 1 -#define ICMP_STATS 1 -#define UDP_STATS 1 -#define TCP_STATS 1 -#define MEM_STATS 1 -#define MEMP_STATS 1 -#define PBUF_STATS 1 -#define SYS_STATS 1 -#endif /* STATS */ - - -//---------------------------------------------------------------------- -/* ------------if you need to do debug-------------*/ -//---------------------------------------------------------------------- -/* -define LWIP_DEBUG in compiler and following... -*/ -#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_SERIOUS -//LWIP_DBG_LEVEL_WARNING LWIP_DBG_LEVEL_SERIOUS LWIP_DBG_LEVEL_SEVERE - -#define LWIP_DBG_TYPES_ON 0//LWIP_DBG_TRACE | LWIP_DBG_STATE |LWIP_DBG_FRESH | LWIP_DBG_HALT -/* -Then, define debug class in opt.h -* --------------------------------------------------*/ - -#define ETHARP_DEBUG LWIP_DBG_OFF -#define NETIF_DEBUG LWIP_DBG_OFF -#define PBUF_DEBUG LWIP_DBG_OFF -#define API_LIB_DEBUG LWIP_DBG_OFF -#define API_MSG_DEBUG LWIP_DBG_OFF -#define SOCKETS_DEBUG LWIP_DBG_OFF -#define ICMP_DEBUG LWIP_DBG_OFF -#define INET_DEBUG LWIP_DBG_OFF -#define IP_DEBUG LWIP_DBG_OFF -#define IP_REASS_DEBUG LWIP_DBG_OFF -#define RAW_DEBUG LWIP_DBG_OFF -#define MEM_DEBUG LWIP_DBG_OFF -#define MEMP_DEBUG LWIP_DBG_OFF -#define SYS_DEBUG LWIP_DBG_OFF -#define TCP_DEBUG LWIP_DBG_OFF -#define TCP_INPUT_DEBUG LWIP_DBG_OFF -#define TCP_FR_DEBUG LWIP_DBG_OFF -#define TCP_RTO_DEBUG LWIP_DBG_OFF -#define TCP_CWND_DEBUG LWIP_DBG_OFF -#define TCP_WND_DEBUG LWIP_DBG_OFF -#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF -#define TCP_RST_DEBUG LWIP_DBG_OFF -#define TCP_QLEN_DEBUG LWIP_DBG_OFF -#define UDP_DEBUG LWIP_DBG_OFF -#define TCPIP_DEBUG LWIP_DBG_OFF -#define PPP_DEBUG LWIP_DBG_OFF -#define SLIP_DEBUG LWIP_DBG_OFF -#define DHCP_DEBUG LWIP_DBG_OFF - - -#endif /* __LWIPOPTS_H__ */ diff --git a/contrib/ports/old/ti_c6711/sys_arch.c b/contrib/ports/old/ti_c6711/sys_arch.c deleted file mode 100644 index 4de4b6f..0000000 --- a/contrib/ports/old/ti_c6711/sys_arch.c +++ /dev/null @@ -1,223 +0,0 @@ -/* -********************************************************************************************************* -* lwIP TCP/IP Stack -* port for uC/OS-II RTOS on TIC6711 DSK -* -* File : sys_arch.c -* By : ZengMing @ DEP,Tsinghua University,Beijing,China -* Reference: YangYe's source code for SkyEye project -********************************************************************************************************* -*/ - -//#include "lwip/debug.h" - -#include "lwip/def.h" -#include "lwip/sys.h" -#include "lwip/mem.h" - -#include "arch/sys_arch.h" - -static OS_MEM *pQueueMem; - -const void * const pvNullPointer; - -static char pcQueueMemoryPool[MAX_QUEUES * sizeof(TQ_DESCR) ]; - -struct sys_timeouts lwip_timeouts[LWIP_TASK_MAX+1]; -struct sys_timeouts null_timeouts; - -OS_STK LWIP_TASK_STK[LWIP_TASK_MAX+1][LWIP_STK_SIZE]; - - -/*-----------------------------------------------------------------------------------*/ -/* This func should be called first in lwip task! - * ------------------------------------------------- */ -void sys_init(void) -{ - u8_t i; - u8_t ucErr; - //init mem used by sys_mbox_t //use ucosII functions - pQueueMem = OSMemCreate( (void*)pcQueueMemoryPool, MAX_QUEUES, sizeof(TQ_DESCR), &ucErr ); - //init lwip_timeouts for every lwip task - for(i=0;i 65535) //ucOS only support u16_t pend - ucos_timeout = 65535; - } - - OSSemPend ((OS_EVENT *)sem,(u16_t)ucos_timeout, (u8_t *)&err); - - if(err == OS_TIMEOUT) - return 0; // only when timeout! - else - return 1; -} - - -/*-----------------------------------------------------------------------------------*/ -sys_mbox_t sys_mbox_new(void) -{ - u8_t ucErr; - PQ_DESCR pQDesc; - - pQDesc = OSMemGet( pQueueMem, &ucErr ); - if( ucErr == OS_NO_ERR ) { - pQDesc->pQ = OSQCreate( &(pQDesc->pvQEntries[0]), MAX_QUEUE_ENTRIES ); - if( pQDesc->pQ != NULL ) { - return pQDesc; - } - } - return SYS_MBOX_NULL; -} - -/*-----------------------------------------------------------------------------------*/ -void -sys_mbox_free(sys_mbox_t mbox) -{ - u8_t ucErr; - - //clear OSQ EVENT - OSQFlush( mbox->pQ ); - //del OSQ EVENT - (void)OSQDel( mbox->pQ, OS_DEL_NO_PEND, &ucErr); - //put mem back to mem queue - ucErr = OSMemPut( pQueueMem, mbox ); -} - -/*-----------------------------------------------------------------------------------*/ -void -sys_mbox_post(sys_mbox_t mbox, void *msg) -{ - if( !msg ) - msg = (void*)&pvNullPointer; - (void)OSQPost( mbox->pQ, msg); -} - -/*-----------------------------------------------------------------------------------*/ -u32_t -sys_arch_mbox_fetch(sys_mbox_t mbox, void **msg, u32_t timeout) -{ - u8_t ucErr; - u32_t ucos_timeout; - - ucos_timeout = 0; - if(timeout != 0){ - ucos_timeout = (timeout * OS_TICKS_PER_SEC)/1000; - if(ucos_timeout < 1) - ucos_timeout = 1; - else if(ucos_timeout > 65535) //ucOS only support u16_t timeout - ucos_timeout = 65535; - } - - if(msg != NULL){ - *msg = OSQPend( mbox->pQ, (u16_t)ucos_timeout, &ucErr ); - }else{ - //just discard return value if msg==NULL - OSQPend(mbox->pQ,(u16_t)ucos_timeout,&ucErr); - } - - if( ucErr == OS_TIMEOUT ) { - timeout = 0; - } else { - if(*msg == (void*)&pvNullPointer ) - *msg = NULL; - timeout = 1; - } - - return timeout; -} - - - -/*----------------------------------------------------------------------*/ -struct -sys_timeouts * sys_arch_timeouts(void) -{ - u8_t curr_prio; - s16_t offset; - - OS_TCB curr_task_pcb; - - null_timeouts.next = NULL; - - OSTaskQuery(OS_PRIO_SELF,&curr_task_pcb); - curr_prio = curr_task_pcb.OSTCBPrio; - - offset = curr_prio - LWIP_START_PRIO; - - if(curr_prio == TCPIP_THREAD_PRIO) - return &lwip_timeouts[LWIP_TASK_MAX]; - else if(offset >= 0 && offset < LWIP_TASK_MAX) - return &lwip_timeouts[offset]; - else return &null_timeouts; - - //if not called by a lwip task ,return timeouts->NULL -} - - -/*------------------------------------------------------------------------*/ -sys_thread_t sys_thread_new(char *name, void (* thread)(void *arg), void *arg, int stacksize, int prio) -{ - /** @todo Replace LWIP_TASK_STK by the use of "stacksize" parameter */ - if(prio == TCPIP_THREAD_PRIO){ - OSTaskCreate(thread, (void *)0x1111, &LWIP_TASK_STK[LWIP_TASK_MAX][LWIP_STK_SIZE-1], prio); - return prio; - } - else if(prio - LWIP_START_PRIO < LWIP_TASK_MAX){ - OSTaskCreate(thread, (void *)0x1111, &LWIP_TASK_STK[prio - LWIP_START_PRIO][LWIP_STK_SIZE-1], prio); - return prio; - } - else { - printf(" lwip task prio out of range ! error! "); - return 0; - } -} - - - - - - - diff --git a/contrib/ports/old/v2pro/Makefile b/contrib/ports/old/v2pro/Makefile deleted file mode 100755 index 0bedcbe..0000000 --- a/contrib/ports/old/v2pro/Makefile +++ /dev/null @@ -1,181 +0,0 @@ -############################################################################### -# Copyright (c) 2001-2003 Swedish Institute of Computer Science. -# All rights reserved. -# -# Copyright (c) 2003 Xilinx, Inc. -# 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. -# -# XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS". -# BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS ONE POSSIBLE -# IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD, XILINX -# IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE FROM -# ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING -# ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. XILINX -# EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO THE -# ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY -# WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE -# FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS FOR A PARTICULAR PURPOSE. -# -# This file is part of the lwIP TCP/IP stack. -# -# Author: Chris Borrelli -# -############################################################################### - -COMPILER=powerpc-eabi-gcc -ARCHIVER=powerpc-eabi-ar -ARFLAGS=rs -CP=cp -COMPILERFLAGS=-Wall -gdwarf -#EXTRA_COMPILER_FLAGS = -DIPv4 -fpack-struct -msdata=eabi -mcpu=403 -EXTRA_COMPILER_FLAGS = -DIPv4 -msdata=eabi -mcpu=403 -LWIPDIR=../../../lwip/src -LIB=liblwip4.a -RELEASEDIR=../../../../../ppc405_i/lib -INCLUDEDIR=../../../../../ppc405_i/include -LEVEL=0 - -XLIBINCLUDEDIR=../../../../../ppc405_i/include - -INCLUDES= \ - -I$(LWIPDIR)/include \ - -I$(LWIPDIR)/include/ipv4 \ - -I$(XLIBINCLUDEDIR) \ - -I./include \ - -I. - -INCLUDEFILES=../../../lwip/src/include/ipv4/lwip \ - ../../../lwip/src/include/lwip \ - ../../../lwip/src/include/netif \ - ./include/netif \ - ./include/arch \ - ./lwipopts.h - -# 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 \ - $(LWIPDIR)/core/ipv4/ip_frag.c - -# NETIFFILES: Files implementing various generic network interface functions. -NETIFFILES=$(LWIPDIR)/netif/etharp.c - -# ARCHFILES: Archiecture specific files. -ARCHFILES=$(wildcard *.c \ - netif/*.c) - -# LWIPFILES: All the above. -LWIPFILES=$(COREFILES) $(CORE4FILES) $(NETIFFILES) $(ARCHFILES) -LWIPFILESW=$(wildcard $(LWIPFILES)) -LWIPOBJS=$(notdir $(LWIPFILESW:.c=.o)) - -help: - @echo "" - @echo "This Makefile generates a library for the v2pro port of lwIP." - @echo "" - @echo " Below are the targets:" - @echo "" - @echo " make libs" - @echo " This is the target that will compile all lwIP files, and" - @echo " build the library, $(LIB). The final library will be" - @echo " copied to $(RELEASEDIR)." - @echo "" - @echo " make include" - @echo " Copies the lwIP include files into the EDK directory," - @echo " $(INCLUDEDIR)" - @echo "" - @echo " make clean" - @echo " Removes all object files and the $(LIB) library from" - @echo " the local directory." - @echo "" - @echo " make depend" - @echo " Generates the .depend file, which contains the" - @echo " dependancies needed to compile each .c file. The" - @echo " .depend file will be generated automatically for" - @echo " other targets, so it is not nessessary to run" - @echo " make depend." - @echo "" - -%.o: - @echo "" - @echo "Building File: $@" - @echo "" - $(COMPILER) $(COMPILERFLAGS) $(EXTRA_COMPILER_FLAGS) $(INCLUDES) -c $(<:.o=.c) - -all ipv4 libs: include $(LIB) -.PHONY: all ipv4 libs include help - -include: - @for i in $(INCLUDEFILES); do \ - echo ${CP} -r $$i ${INCLUDEDIR}; \ - ${CP} -r $$i ${INCLUDEDIR}; \ - done - -clean: - @echo "" - @echo "Cleaning up..." - @echo "" - @rm -f *.o *.a .depend* core - -depend dep: .depend - @exit - -$(LIB): $(LWIPOBJS) - @echo "" - @echo "Building lwIP Library, $@" - $(ARCHIVER) $(ARFLAGS) $@ $? - @cp $@ $(RELEASEDIR)/ - -.depend: $(LWIPFILES) $(APPFILES) - @echo "" - @echo "Building dependancies..." - $(COMPILER) $(COMPILERFLAGS) $(EXTRA_COMPILER_FLAGS) $(INCLUDES) \ - -MM $^ > .depend || rm -f .depend - -ifneq ($(MAKECMDGOALS), clean) -ifneq ($(MAKECMDGOALS), depend) -ifneq ($(MAKECMDGOALS), dep) -ifneq ($(MAKECMDGOALS), ) -ifneq ($(MAKECMDGOALS), help) --include .depend -endif -endif -endif -endif -endif diff --git a/contrib/ports/old/v2pro/include/arch/cc.h b/contrib/ports/old/v2pro/include/arch/cc.h deleted file mode 100644 index 2799519..0000000 --- a/contrib/ports/old/v2pro/include/arch/cc.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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 - * - */ - -#ifndef __ARCH_CC_H__ -#define __ARCH_CC_H__ - -#define BYTE_ORDER BIG_ENDIAN - -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; - -#define U16_F "hu" -#define S16_F "hd" -#define X16_F "hx" -#define U32_F "lu" -#define S32_F "ld" -#define X32_F "lx" - -#define PACK_STRUCT_FIELD(x) x __attribute__((packed)) -#define PACK_STRUCT_STRUCT __attribute__((packed)) -#define PACK_STRUCT_BEGIN -#define PACK_STRUCT_END - -#endif /* __ARCH_CC_H__ */ diff --git a/contrib/ports/old/v2pro/include/arch/perf.h b/contrib/ports/old/v2pro/include/arch/perf.h deleted file mode 100644 index 9a16712..0000000 --- a/contrib/ports/old/v2pro/include/arch/perf.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 - * - */ - -#ifndef __ARCH_PERF_H__ -#define __ARCH_PERF_H__ - -#define PERF_START /* null definition */ -#define PERF_STOP(x) /* null definition */ - -void perf_init(char *fname); - -#endif /* __ARCH_PERF_H__ */ diff --git a/contrib/ports/old/v2pro/include/arch/sys_arch.h b/contrib/ports/old/v2pro/include/arch/sys_arch.h deleted file mode 100644 index e86834b..0000000 --- a/contrib/ports/old/v2pro/include/arch/sys_arch.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 - * - */ - -#ifndef __SYS_XILINX_V2P_H__ -#define __SYS_XILINX_V2P_H__ - -#define SYS_MBOX_NULL 0 - -#endif /* __SYS_XILINX_V2P_H__ */ diff --git a/contrib/ports/old/v2pro/include/netif/xemacif.h b/contrib/ports/old/v2pro/include/netif/xemacif.h deleted file mode 100644 index 64e0d99..0000000 --- a/contrib/ports/old/v2pro/include/netif/xemacif.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2001, 2002, 2003 Xilinx, Inc. - * 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: Chris Borrelli - * - */ - -#ifndef __NETIF_XEMACIF_H__ -#define __NETIF_XEMACIF_H__ - -#include "lwip/netif.h" -#include "netif/etharp.h" -#include "xemac.h" - -void xemacif_setmac(u32_t index, u8_t *addr); -u8_t * xemacif_getmac(u32_t index); -err_t xemacif_init(struct netif *netif); -err_t xemacif_input(void *CallBackRef); - -/** - * This typedef contains configuration information for an xemac instance. - */ -typedef struct -{ - Xuint32 DevId; - Xuint32 IntrId; - struct eth_addr ethaddr; - XEmac* instance_ptr; -} XEmacIf_Config; - -#endif /* __NETIF_XEMACIF_H__ */ diff --git a/contrib/ports/old/v2pro/lib_arch.c b/contrib/ports/old/v2pro/lib_arch.c deleted file mode 100644 index fcd6569..0000000 --- a/contrib/ports/old/v2pro/lib_arch.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 - * - */ - diff --git a/contrib/ports/old/v2pro/lwipopts.h b/contrib/ports/old/v2pro/lwipopts.h deleted file mode 100755 index 539be5b..0000000 --- a/contrib/ports/old/v2pro/lwipopts.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - * 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 - * - */ - -#ifndef __LWIPOPTS_H__ -#define __LWIPOPTS_H__ - -#define NO_SYS 1 -#define LWIP_CALLBACK_API 1 - -/* -------- TCP Timer Intervals ------- */ -#define TCP_TMR_INTERVAL 1 /* The TCP timer interval in - milliseconds. */ - -#define TCP_FAST_INTERVAL 2 /* the fine grained timeout in - milliseconds */ - -#define TCP_SLOW_INTERVAL 5 /* the coarse grained timeout in - milliseconds */ - -/* ---------- 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 4 - -/* 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 8 * 1024 * 1024 - -/* 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 64 -/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One - per active UDP "connection". */ -#define MEMP_NUM_UDP_PCB 1 -/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP - connections. */ -#define MEMP_NUM_TCP_PCB 8 -/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP - connections. */ -#define MEMP_NUM_TCP_PCB_LISTEN 16 -/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP - segments. */ -#define MEMP_NUM_TCP_SEG 255 - -/* 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_TCPIP_MSG: 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_API 0 -#define MEMP_NUM_TCPIP_MSG_INPKT 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 512 - -/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */ -#define PBUF_POOL_BUFSIZE 1536 - -/* 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 1476 - -/* TCP sender buffer space (bytes). */ -#define TCP_SND_BUF 32 * 1024 - -/* TCP sender buffer space (pbufs). This must be at least = 2 * - TCP_SND_BUF/TCP_MSS for things to work. */ -#define TCP_SND_QUEUELEN 2 * TCP_SND_BUF/TCP_MSS - -/* TCP receive window. */ -#define TCP_WND 16 * 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 - -/* ---------- 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__ */ diff --git a/contrib/ports/old/v2pro/netif/xemacif.c b/contrib/ports/old/v2pro/netif/xemacif.c deleted file mode 100755 index ee6ea70..0000000 --- a/contrib/ports/old/v2pro/netif/xemacif.c +++ /dev/null @@ -1,388 +0,0 @@ -/* - * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Copyright (c) 2001, 2002, 2003 Xilinx, Inc. - * 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. - * - * XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS". - * BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS ONE POSSIBLE - * IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD, XILINX - * IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE FROM - * ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING - * ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. XILINX - * EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO THE - * ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY - * WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE - * FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. - * - * This file is part of the lwIP TCP/IP stack. - * - * Author: Chris Borrelli - * - * Based on example ethernetif.c, Adam Dunkels - * - */ - -/*---------------------------------------------------------------------------*/ -/* EDK Include Files */ -/*---------------------------------------------------------------------------*/ -#include "xemac.h" -#include "xparameters.h" -#include "xstatus.h" -#include "xexception_l.h" - -/*---------------------------------------------------------------------------*/ -/* LWIP Include Files */ -/*---------------------------------------------------------------------------*/ -#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/netif.h" -#include "netif/etharp.h" -#include "netif/xemacif.h" - -/*---------------------------------------------------------------------------*/ -/* Describe network interface */ -/*---------------------------------------------------------------------------*/ -#define IFNAME0 'e' -#define IFNAME1 '0' - -/*---------------------------------------------------------------------------*/ -/* Constant Definitions */ -/*---------------------------------------------------------------------------*/ -#define XEM_MAX_FRAME_SIZE_IN_WORDS ((XEM_MAX_FRAME_SIZE/sizeof(Xuint32))+1) - -extern XEmacIf_Config XEmacIf_ConfigTable[]; - -/*---------------------------------------------------------------------------*/ -/* low_level_init function */ -/* - hooks up the data structures and sets the mac options and mac */ -/*---------------------------------------------------------------------------*/ -static err_t -low_level_init(struct netif *netif_ptr) -{ - XEmac *InstancePtr = mem_malloc(sizeof(XEmac)); - XEmacIf_Config *xemacif_ptr = (XEmacIf_Config *) netif_ptr->state; - Xuint16 DeviceId = xemacif_ptr->DevId; - XStatus Result; - Xuint32 Options; - - xemacif_ptr->instance_ptr = InstancePtr; - - /* Call Initialize Function of EMAC driver */ - Result = XEmac_Initialize(InstancePtr, DeviceId); - if (Result != XST_SUCCESS) return ERR_MEM; - - /* Stop the EMAC hardware */ - XEmac_Stop(InstancePtr); - - /* Set MAC Address of EMAC */ - Result = XEmac_SetMacAddress(InstancePtr, (Xuint8*) netif_ptr->hwaddr); - if (Result != XST_SUCCESS) return ERR_MEM; - - /* Set MAC Options */ - - Options = ( XEM_INSERT_FCS_OPTION | - XEM_INSERT_PAD_OPTION | - XEM_UNICAST_OPTION | - XEM_BROADCAST_OPTION | - XEM_POLLED_OPTION | - XEM_STRIP_PAD_FCS_OPTION); - - Result = XEmac_SetOptions(InstancePtr, Options); - if (Result != XST_SUCCESS) return ERR_MEM; - - /* Start the EMAC hardware */ - Result = XEmac_Start(InstancePtr); - if (Result != XST_SUCCESS) return ERR_MEM; - - /* Clear driver stats */ - XEmac_ClearStats(InstancePtr); - - return ERR_OK; -} - -/*---------------------------------------------------------------------------*/ -/* 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 *netif, struct pbuf *p) -{ - struct pbuf *q; - u32_t frame_buffer[XEM_MAX_FRAME_SIZE_IN_WORDS]; /* word aligned */ - Xuint8 *frame_ptr; - int payload_size = 0, i; - XStatus Result; - Xuint32 Options; - XEmacIf_Config *xemacif_ptr = netif->state; - - frame_ptr = (Xuint8 *) frame_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. - */ - for(i = 0 ; i < q->len ; i++) { - *(frame_ptr++) = (Xuint8) *(((u8_t *) q->payload) + i); - payload_size++; - } - } - - Result = XEmac_PollSend(xemacif_ptr->instance_ptr, - (Xuint8 *) frame_buffer, - payload_size); - - if (Result != XST_SUCCESS) - { - xil_printf("XEmac_PollSend: failed\r\n"); - if (Result == XST_FIFO_ERROR) - { - XEmac_Reset(xemacif_ptr->instance_ptr); - XEmac_SetMacAddress(xemacif_ptr->instance_ptr, - (Xuint8*) xemacif_ptr->ethaddr.addr); - Options = ( XEM_INSERT_FCS_OPTION | - XEM_INSERT_PAD_OPTION | - XEM_UNICAST_OPTION | - XEM_BROADCAST_OPTION | - XEM_POLLED_OPTION | - XEM_STRIP_PAD_FCS_OPTION); - XEmac_SetOptions(xemacif_ptr->instance_ptr, Options); - XEmac_Start(xemacif_ptr->instance_ptr); - xil_printf("XEmac_PollSend: returned XST_FIFO_ERROR\r\n"); - } - return ERR_MEM; - } - -#if 0 - xil_printf("\r\n\r\n TXFRAME:\r\n"); - for (i=0 ; i < payload_size ; i++) { - xil_printf("%2X", ((Xuint8 *) frame_buffer)[i]); - if (! (i%20) && i) xil_printf("\r\n"); - else xil_printf(" "); - } - xil_printf ("\r\n\r\n"); -#endif - -#ifdef LINK_STATS - lwip_stats.link.xmit++; -#endif /* LINK_STATS */ - - return ERR_OK; -} - -/*---------------------------------------------------------------------------*/ -/* low_level_input() */ -/* */ -/* Allocates a pbuf pool and transfers bytes of */ -/* incoming packet from the interface into the pbuf. */ -/*---------------------------------------------------------------------------*/ -static struct pbuf * low_level_input(XEmacIf_Config *xemacif_ptr) -{ - struct pbuf *p = NULL, *q = NULL; - XEmac *EmacPtr = (XEmac *) xemacif_ptr->instance_ptr; - - Xuint32 RecvBuffer[XEM_MAX_FRAME_SIZE_IN_WORDS]; - Xuint32 FrameLen = XEM_MAX_FRAME_SIZE; - Xuint32 i, Options; - u8_t * frame_bytes = (u8_t *) RecvBuffer; - XStatus Result; - - Result = XEmac_PollRecv(EmacPtr, (Xuint8 *)RecvBuffer, &FrameLen); - - if (Result != XST_SUCCESS) - { - if (!(Result == XST_NO_DATA || Result == XST_BUFFER_TOO_SMALL)) - { - XEmac_Reset(xemacif_ptr->instance_ptr); - XEmac_SetMacAddress(xemacif_ptr->instance_ptr, - (Xuint8*) xemacif_ptr->ethaddr.addr); - Options = ( XEM_INSERT_FCS_OPTION | - XEM_INSERT_PAD_OPTION | - XEM_UNICAST_OPTION | - XEM_BROADCAST_OPTION | - XEM_POLLED_OPTION | - XEM_STRIP_PAD_FCS_OPTION); - XEmac_SetOptions(xemacif_ptr->instance_ptr, Options); - XEmac_Start(xemacif_ptr->instance_ptr); - } - return p; - } - -#if 0 - xil_printf("\r\n"); - for (i=0 ; i < FrameLen ; i++) { - xil_printf("%2X", frame_bytes[i]); - if (! (i%20) && i) xil_printf("\r\n"); - else xil_printf(" "); - } - xil_printf ("\r\n"); -#endif - - /* Allocate a pbuf chain of pbufs from the pool. */ - p = pbuf_alloc(PBUF_RAW, FrameLen, PBUF_POOL); - - if (p != NULL) { - /* Iterate over the pbuf chain until we have - * read the entire packet into the pbuf. */ - for(q = p; q != NULL; q = q->next) { - /* Read enough bytes to fill this pbuf - * in the chain. The available data in - * the pbuf is given by the q->len variable. */ - for (i = 0 ; i < q->len ; i++) { - ((u8_t *)q->payload)[i] = *(frame_bytes++); - } - } - -#ifdef LINK_STATS - lwip_stats.link.recv++; -#endif /* LINK_STATS */ - - } else { - -#ifdef LINK_STATS - lwip_stats.link.memerr++; - lwip_stats.link.drop++; -#endif /* LINK_STATS */ - ; - } - return p; -} - -/*---------------------------------------------------------------------------*/ -/* xemacif_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. */ -/*---------------------------------------------------------------------------*/ -err_t xemacif_input(void *CallBackRef) -{ - struct netif * netif_ptr = (struct netif *) CallBackRef; - XEmacIf_Config * xemacif_ptr; - struct eth_hdr * ethernet_header; - struct pbuf *p; - - xemacif_ptr = netif_ptr->state; - - p = low_level_input(xemacif_ptr); - - if (p != NULL) { - ethernet_header = p->payload; - - q = NULL; - switch (htons(ethernet_header->type)) { - case ETHTYPE_IP: - etharp_ip_input(netif_ptr, p); - pbuf_header(p, -14); - netif_ptr->input(p, netif_ptr); - break; - case ETHTYPE_ARP: - etharp_arp_input(netif_ptr, &(xemacif_ptr->ethaddr), p); - break; - default: - pbuf_free(p); - break; - } - } - - return ERR_OK; -} - -/*---------------------------------------------------------------------------*/ -/* xemacif_setmac(): */ -/* */ -/* Sets the MAC address of the system. */ -/* Note: Should only be called before xemacif_init is called. */ -/* - the stack calls xemacif_init after the user calls netif_add */ -/*---------------------------------------------------------------------------*/ -void xemacif_setmac(u32_t index, u8_t *addr) -{ - XEmacIf_ConfigTable[index].ethaddr.addr[0] = addr[0]; - XEmacIf_ConfigTable[index].ethaddr.addr[1] = addr[1]; - XEmacIf_ConfigTable[index].ethaddr.addr[2] = addr[2]; - XEmacIf_ConfigTable[index].ethaddr.addr[3] = addr[3]; - XEmacIf_ConfigTable[index].ethaddr.addr[4] = addr[4]; - XEmacIf_ConfigTable[index].ethaddr.addr[5] = addr[5]; -} - -/*---------------------------------------------------------------------------*/ -/* xemacif_getmac(): */ -/* */ -/* Returns a pointer to the ethaddr variable in the ConfigTable */ -/* (6 bytes in length) */ -/*---------------------------------------------------------------------------*/ -u8_t * xemacif_getmac(u32_t index) { - return &(XEmacIf_ConfigTable[index].ethaddr.addr[0]); -} - -/*---------------------------------------------------------------------------*/ -/* xemacif_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. */ -/*---------------------------------------------------------------------------*/ -err_t xemacif_init(struct netif *netif_ptr) -{ - XEmacIf_Config *xemacif_ptr; - - xemacif_ptr = (XEmacIf_Config *) netif_ptr->state; - - netif_ptr->mtu = 1500; - netif_ptr->hwaddr_len = 6; - netif_ptr->hwaddr[0] = xemacif_ptr->ethaddr.addr[0]; - netif_ptr->hwaddr[1] = xemacif_ptr->ethaddr.addr[1]; - netif_ptr->hwaddr[2] = xemacif_ptr->ethaddr.addr[2]; - netif_ptr->hwaddr[3] = xemacif_ptr->ethaddr.addr[3]; - netif_ptr->hwaddr[4] = xemacif_ptr->ethaddr.addr[4]; - netif_ptr->hwaddr[5] = xemacif_ptr->ethaddr.addr[5]; - netif_ptr->name[0] = IFNAME0; - netif_ptr->name[1] = IFNAME1; - netif_ptr->output = etharp_output; - netif_ptr->linkoutput = low_level_output; - - /* removed this statement because the ethaddr in the XEmacIf_Config - * structure is now a struct not a pointer to a struct - */ - //xemacif_ptr->ethaddr = (struct eth_addr *)&(netif_ptr->hwaddr[0]); - - low_level_init(netif_ptr); - etharp_init(); - - return ERR_OK; -} diff --git a/contrib/ports/old/v2pro/perf.c b/contrib/ports/old/v2pro/perf.c deleted file mode 100644 index f0a2fe6..0000000 --- a/contrib/ports/old/v2pro/perf.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 - * - */ - -#include "arch/perf.h" - -void -perf_init(char *fname) -{ - return; -} - diff --git a/contrib/ports/old/v2pro/sw_services/lwip_v1_00_a/data/lwip_v2_1_0.mld b/contrib/ports/old/v2pro/sw_services/lwip_v1_00_a/data/lwip_v2_1_0.mld deleted file mode 100644 index f2d754e..0000000 --- a/contrib/ports/old/v2pro/sw_services/lwip_v1_00_a/data/lwip_v2_1_0.mld +++ /dev/null @@ -1,76 +0,0 @@ -############################################################################### -# Copyright (c) 2001-2003 Swedish Institute of Computer Science. -# All rights reserved. -# -# Copyright (c) 2003 Xilinx, Inc. -# 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. -# -# XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS". -# BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS ONE POSSIBLE -# IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD, XILINX -# IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE FROM -# ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING -# ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. XILINX -# EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO THE -# ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY -# WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE -# FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS FOR A PARTICULAR PURPOSE. -# -# This file is part of the lwIP TCP/IP stack. -# -# Author: Sathya Thammanur -# -############################################################################### - -OPTION psf_version = 2.1; - -BEGIN LIBRARY lwip - - OPTION drc = lwip_drc; - OPTION copyfiles = (Makefile); - - BEGIN ARRAY emac_instances - PROPERTY desc = "List of Ethernet instances to be used with lwip"; - PROPERTY size = 0; - PARAM name = emac_instname, desc = "Name of Emac instance", type = peripheral_instance; - PARAM name = eth_addr1, desc = "First byte of MAC address", type = int; - PARAM name = eth_addr2, desc = "Second byte of MAC address", type = int; - PARAM name = eth_addr3, desc = "Third byte of MAC address", type = int; - PARAM name = eth_addr4, desc = "Fourth byte of MAC address", type = int; - PARAM name = eth_addr5, desc = "Fifth byte of MAC address", type = int; - PARAM name = eth_addr6, desc = "Sixth byte of MAC address", type = int; - END ARRAY - - BEGIN ARRAY gemac_instances - PROPERTY desc = "List of Gigabit Ethernet instances to be used with lwip"; - PROPERTY size = 0; - PARAM name = gemac_instname, desc = "Name of GEmac instance", type = peripheral_instance; - END ARRAY - - PARAM name = lwip_srcdir, desc = "Source directory of lwip", type = string; - -END LIBRARY diff --git a/contrib/ports/old/v2pro/sw_services/lwip_v1_00_a/data/lwip_v2_1_0.tcl b/contrib/ports/old/v2pro/sw_services/lwip_v1_00_a/data/lwip_v2_1_0.tcl deleted file mode 100644 index 7865cbe..0000000 --- a/contrib/ports/old/v2pro/sw_services/lwip_v1_00_a/data/lwip_v2_1_0.tcl +++ /dev/null @@ -1,265 +0,0 @@ -############################################################################### -# Copyright (c) 2001-2003 Swedish Institute of Computer Science. -# All rights reserved. -# -# Copyright (c) 2003 Xilinx, Inc. -# 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. -# -# XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS". -# BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS ONE POSSIBLE -# IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD, XILINX -# IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE FROM -# ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING -# ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. XILINX -# EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO THE -# ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY -# WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE -# FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS FOR A PARTICULAR PURPOSE. -# -# This file is part of the lwIP TCP/IP stack. -# -# Author: Sathya Thammanur -# Author: Chris Borrelli -# -############################################################################### - -# Globals -lappend emac_list -lappend gemac_list - -############################################################################### -# lwip_drc - run drc checking (future work) -############################################################################### -proc lwip_drc {lib_handle} { - puts "LWIP DRC..." - puts " ...not implemented yet." -} - -############################################################################### -# generate - generates the .c file -############################################################################### -proc generate {libname} { - global emac_list - global gemac_list - - # generate emac_list of instances to be used with lwip - set emac_inst_array [xget_handle $libname "ARRAY" "emac_instances"] - if {[string compare -nocase $emac_inst_array ""] != 0} { - set emac_inst_array_elems [xget_handle $emac_inst_array "ELEMENTS" "*"] - puts "XEmac Instances : [llength $emac_inst_array_elems]" - if {[string compare -nocase $emac_inst_array_elems ""] != 0} { - set emac_list $emac_inst_array_elems - } - } - - # generate gemac_list of instances to be used with lwip - set gemac_inst_array [xget_handle $libname "ARRAY" "gemac_instances"] - if {[string compare -nocase $gemac_inst_array ""] != 0} { - set gemac_inst_array_elems [xget_handle $gemac_inst_array "ELEMENTS" "*"] - puts "XGEmac Instances : [llength $gemac_inst_array_elems]" - if {[string compare -nocase $gemac_inst_array_elems ""] != 0} { - set gemac_list $gemac_inst_array_elems - } - } - - # Generate XEmacIf_Config Table in xemacif_g.c file - if {[string compare -nocase $emac_list ""] != 0} { - xgen_config_file "xemacif_g.c" "XEmacIf" - } - - # Generate XGEmacIf_Config Table in xgemacif_g.c file - if {[string compare -nocase $gemac_list ""] != 0} { - xgen_config_file "xgemacif_g.c" "XGEmacIf" - } -} - -############################################################################### -# xgen_config_file - does the real work of generating a C header file -############################################################################### -proc xgen_config_file {file_name if_type} { - global emac_list - global gemac_list - - lappend list - - puts "Generating $file_name ..." - - set config_file [open [file join "src" $file_name] w] - xprint_generated_header $config_file "$if_type Configuration" - - puts $config_file "#include \"xparameters.h\"" - set if_file [file join "netif" [format "%s.h" [string tolower $if_type]]] - puts $config_file "#include \"$if_file\"" - - if {[string compare -nocase $if_type "XEmacIf"] == 0} { - puts $config_file "#include \"xemac.h\"" - set list $emac_list - } elseif {[string compare -nocase $if_type "XGEmacIf"] == 0} { - puts $config_file "#include \"xgemac.h\"" - set list $gemac_list - } - - #set list_size [llength $list] - #puts $config_file "\n/*" - #puts $config_file " * Number of $if_type Instances" - #puts $config_file " */\n" - #puts $config_file [format "#define %s_ConfigTableSize %s" $if_type $list_size] - - puts $config_file "\n/*" - puts $config_file " * The configuration table for devices" - puts $config_file " */\n" - puts $config_file [format "%s_Config %s_ConfigTable\[\] =" $if_type $if_type] - puts $config_file "\{" - - set start_comma "" - - foreach elem $list { - puts $config_file [format "%s\t\{" $start_comma] - set comma "" - - if {[string compare -nocase $if_type "XEmacIf"] == 0} { - set inst [xget_value $elem "PARAMETER" "emac_instname"] - set ethaddr1 [xget_value $elem "PARAMETER" "eth_addr1"] - set ethaddr2 [xget_value $elem "PARAMETER" "eth_addr2"] - set ethaddr3 [xget_value $elem "PARAMETER" "eth_addr3"] - set ethaddr4 [xget_value $elem "PARAMETER" "eth_addr4"] - set ethaddr5 [xget_value $elem "PARAMETER" "eth_addr5"] - set ethaddr6 [xget_value $elem "PARAMETER" "eth_addr6"] - } elseif {[string compare -nocase $if_type "XGEmacIf"] == 0} { - set inst [xget_value $elem "PARAMETER" "emac_instname"] - set ethaddr1 "" - set ethaddr2 "" - set ethaddr3 "" - set ethaddr4 "" - set ethaddr5 "" - set ethaddr6 "" - } - - # Get the instance handle - - # for example, get pointer to an instance named my_opb_ethernet - # Get the handle to the interrupt port -ip2intc_irpt - # (same name in emac and gemac) - set inst_handle [xget_hwhandle $inst] - set intr_port_name "IP2INTC_Irpt" - - ######################################################################## - # generate device id - ######################################################################## - puts -nonewline $config_file [format "%s\t\t%s" $comma [xget_name $inst_handle "DEVICE_ID"]] - set comma ",\n" - - ######################################################################## - # generate intr id - doesn't work in EDK 3.2.2 - ######################################################################## - - # START : CHRISB COMMENTED THIS OUT - #set intr_id [xget_intr_name $inst_handle $intr_port_name] - #puts -nonewline $config_file [format "%s\t\t%s" $comma $intr_id] - # END : CHRISB COMMENTED THIS OUT - - # START : CHRISB ADDED THIS - puts -nonewline $config_file [format "%s\t\t%s" $comma "0"] - # END : CHRISB ADDED THIS - - ######################################################################## - # generate ethaddr - ######################################################################## - puts -nonewline $config_file [format "%s\t\t{{%s,%s,%s,%s,%s,%s}}" $comma $ethaddr1 $ethaddr2 $ethaddr3 $ethaddr4 $ethaddr5 $ethaddr6] - - ######################################################################## - # generate instance ptr - always NULL because it is setup at runtime - ######################################################################## - puts -nonewline $config_file [format "%s\t\tNULL" $comma ] - - puts -nonewline $config_file [format "\n\t\}" ] - set start_comma ",\n" - } - - puts $config_file "\n\};" - close $config_file -} - -############################################################################### -# This procedure does not work under EDK 3.2.2 -############################################################################### -#proc xget_intr_name {periph_handle port_name} { -# -# set intr_port [xget_handle $periph_handle "PORT" $port_name] -# set intr_signal [xget_value $intr_port "VALUE"] -# #puts "intr_signal : $intr_signal" -# -# set mhs_handle [xget_handle $periph_handle "parent"] -# set source_port [xget_connected_ports_handle $mhs_handle $intr_signal "sink"] -# #puts "sourceport : $source_port" -# -# set intc_handle [xget_handle $source_port "parent"] -# set intc_name [xget_value $intc_handle "NAME"] -# -# set periph_name [xget_value $periph_handle "NAME"] -# -# set intc_drvhandle [xget_swhandle $intc_name] -# #puts "intcdrvname: [xget_value $intc_drvhandle "NAME"]" -# -# set level [xget_value $intc_drvhandle "PARAMETER" "level"] -# set intr_string "" -# if {$level == 0} { -# set intr_string "MASK" -# set retval [format "XPAR_%s_%s_%s" [string toupper $periph_name] [string toupper $port_name] [string toupper $intr_string]] -# } elseif {$level == 1} { -# set intr_string "INTR" -# set retval [format "XPAR_%s_%s_%s_%s" [string toupper $intc_name] [string toupper $periph_name] [string toupper $port_name] [string toupper $intr_string]] -# } -# -# return $retval -#} - -############################################################################### -# post_generate - doesn't do anything at the moment -############################################################################### -proc post_generate {libname} { - -} - -############################################################################### -# execs_generate -# This procedure builds the liblwipv4.a -# library. -############################################################################### -proc execs_generate {libname} { -global errorCode -global errorInfo - - set topdir [xget_value $libname "PARAMETER" "lwip_srcdir"] - puts "\n********************************" - puts " Building lwIP library" - puts "********************************\n" - puts "Using LWIP sources from directory $topdir " - - if { [catch {exec bash -c "cd src;make all \"TOPDIR=$topdir\" >& logs"} errmsg] } { - error $errmsg $errorInfo - } -} diff --git a/contrib/ports/old/v2pro/sw_services/lwip_v1_00_a/src/Makefile b/contrib/ports/old/v2pro/sw_services/lwip_v1_00_a/src/Makefile deleted file mode 100755 index d172ea3..0000000 --- a/contrib/ports/old/v2pro/sw_services/lwip_v1_00_a/src/Makefile +++ /dev/null @@ -1,193 +0,0 @@ -############################################################################### -# Copyright (c) 2001-2003 Swedish Institute of Computer Science. -# All rights reserved. -# -# Copyright (c) 2003 Xilinx, Inc. -# 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. -# -# XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS". -# BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS ONE POSSIBLE -# IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD, XILINX -# IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE FROM -# ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR OBTAINING -# ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. XILINX -# EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO THE -# ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY -# WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE -# FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS FOR A PARTICULAR PURPOSE. -# -# This file is part of the lwIP TCP/IP stack. -# -# Author: Chris Borrelli -# - -# -# This Makefile is meant to be run from EDK (libgen). Please do not try -# try using this Makefile stand-alone on the command line; it will not work -# - -COMPILER=powerpc-eabi-gcc -ARCHIVER=powerpc-eabi-ar -ARFLAGS=rs -CP=cp -COMPILERFLAGS=-Wall -gdwarf -#EXTRA_COMPILER_FLAGS = -DIPv4 -fpack-struct -msdata=eabi -mcpu=403 -EXTRA_COMPILER_FLAGS = -DIPv4 -msdata=eabi -mcpu=403 -LWIPDIR=$(TOPDIR)/lwip/src -ARCHDIR=$(TOPDIR)/contrib/ports/v2pro -LIB=liblwip4.a -RELEASEDIR=../../../lib -INCLUDEDIR=../../../include - -INCLUDES= \ - -I$(LWIPDIR)/include \ - -I$(LWIPDIR)/include/ipv4 \ - -I$(ARCHDIR) \ - -I$(ARCHDIR)/include \ - -I$(INCLUDEDIR) - -INCLUDEFILES=$(TOPDIR)/lwip/src/include/ipv4/lwip \ - $(TOPDIR)/lwip/src/include/lwip \ - $(TOPDIR)/lwip/src/include/netif \ - $(TOPDIR)/contrib/ports/v2pro/include/netif \ - $(TOPDIR)/contrib/ports/v2pro/include/arch \ - $(TOPDIR)/contrib/ports/v2pro/lwipopts.h - -# 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 \ - $(LWIPDIR)/core/ipv4/ip_frag.c - -# NETIFFILES: Files implementing various generic network interface functions. -NETIFFILES=$(LWIPDIR)/netif/etharp.c - -# ARCHFILES: Archiecture specific files. -ARCHFILES=$(ARCHDIR)/lib_arch.c \ - $(ARCHDIR)/perf.c \ - $(ARCHDIR)/netif/xemacif.c \ - xemacif_g.c - -# LWIPFILES: All the above. -LWIPFILES=$(COREFILES) $(CORE4FILES) $(NETIFFILES) $(ARCHFILES) -LWIPFILESW=$(wildcard $(LWIPFILES)) -LWIPOBJS=$(notdir $(LWIPFILESW:.c=.o)) - -help: - @echo "" - @echo "This Makefile generates a library for the v2pro port of lwIP." - @echo "" - @echo " Below are the targets:" - @echo "" - @echo " make lwiplibs" - @echo " This is the target that will compile all lwIP files, and" - @echo " build the library, $(LIB). The final library will be" - @echo " copied to $(RELEASEDIR)." - @echo "" - @echo " make lwipinclude" - @echo " Copies the lwIP include files into the EDK directory," - @echo " $(INCLUDEDIR)" - @echo "" - @echo " make clean" - @echo " Removes all object files and the $(LIB) library from" - @echo " the local directory." - @echo "" - @echo " make depend" - @echo " Generates the .depend file, which contains the" - @echo " dependancies needed to compile each .c file. The" - @echo " .depend file will be generated automatically for" - @echo " other targets, so it is not nessessary to run" - @echo " make depend." - @echo "" - -%.o: - @echo "" - @echo "Building File: $@" - @echo "" - $(COMPILER) $(COMPILERFLAGS) $(EXTRA_COMPILER_FLAGS) $(INCLUDES) -c $(<:.o=.c) - -all ipv4 lwiplibs: lwipinclude $(LIB) -.PHONY: all ipv4 lwiplibs lwip_include help - -lwipinclude: - @for i in $(INCLUDEFILES); do \ - echo ${CP} -r $$i ${INCLUDEDIR}; \ - ${CP} -r $$i ${INCLUDEDIR}; \ - done - -include: - @exit - -libs: - @exit - -clean: - @echo "" - @echo "Cleaning up..." - @echo "" - @rm -f *.o *.a .depend* core - -depend dep: .depend - @exit - -$(LIB): $(LWIPOBJS) - @echo "" - @echo "Building lwIP Library, $@" - $(ARCHIVER) $(ARFLAGS) $@ $? - @cp $@ $(RELEASEDIR)/ - -.depend: $(LWIPFILES) $(APPFILES) - @echo "" - @echo "Building dependancies..." - $(COMPILER) $(COMPILERFLAGS) $(EXTRA_COMPILER_FLAGS) $(INCLUDES) \ - -MM $^ > .depend || rm -f .depend - -ifneq ($(MAKECMDGOALS), clean) -ifneq ($(MAKECMDGOALS), depend) -ifneq ($(MAKECMDGOALS), dep) -ifneq ($(MAKECMDGOALS), libs) -ifneq ($(MAKECMDGOALS), include) -ifneq ($(MAKECMDGOALS), help) --include .depend -endif -endif -endif -endif -endif -endif diff --git a/contrib/ports/unix/check/sys_arch.c b/contrib/ports/unix/check/sys_arch.c deleted file mode 100644 index a64d651..0000000 --- a/contrib/ports/unix/check/sys_arch.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include "lwip/opt.h" - -u32_t -sys_now(void) -{ - struct timeval tv; - if (gettimeofday(&tv, NULL)) - return 0; - else - return tv.tv_sec * 1000 + tv.tv_usec / 1000; -} diff --git a/contrib/ports/unix/include/arch/cc.h b/contrib/ports/unix/include/arch/cc.h deleted file mode 100644 index 84b5cd1..0000000 --- a/contrib/ports/unix/include/arch/cc.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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 - * - */ -#ifndef LWIP_ARCH_CC_H -#define LWIP_ARCH_CC_H - -/* Include some files for defining library routines */ -#include -#include -#include - -#define LWIP_TIMEVAL_PRIVATE 0 - -/* Define platform endianness */ -#ifndef BYTE_ORDER -#define BYTE_ORDER LITTLE_ENDIAN -#endif /* BYTE_ORDER */ - -/* Define generic types used in lwIP */ -typedef unsigned char u8_t; -typedef signed char s8_t; -typedef unsigned short u16_t; -typedef signed short s16_t; -typedef unsigned int u32_t; -typedef signed int s32_t; - -typedef unsigned long mem_ptr_t; - -/* Define (sn)printf formatters for these lwIP types */ -#define X8_F "02x" -#define U16_F "hu" -#define S16_F "hd" -#define X16_F "hx" -#define U32_F "u" -#define S32_F "d" -#define X32_F "x" - -/* If only we could use C99 and get %zu */ -#if defined(__x86_64__) -#define SZT_F "lu" -#else -#define SZT_F "u" -#endif - -/* Compiler hints for packing structures */ -#define PACK_STRUCT_FIELD(x) x -#define PACK_STRUCT_STRUCT __attribute__((packed)) -#define PACK_STRUCT_BEGIN -#define PACK_STRUCT_END - -/* prototypes for printf() and abort() */ -#include -#include -/* Plaform specific diagnostic output */ -#define LWIP_PLATFORM_DIAG(x) do {printf x;} while(0) - -#ifdef LWIP_UNIX_EMPTY_ASSERT -#define LWIP_PLATFORM_ASSERT(x) -#else -#define LWIP_PLATFORM_ASSERT(x) do {printf("Assertion \"%s\" failed at line %d in %s\n", \ - x, __LINE__, __FILE__); fflush(NULL); abort();} while(0) -#endif - -#define LWIP_RAND() ((u32_t)rand()) - -#endif /* LWIP_ARCH_CC_H */ diff --git a/contrib/ports/unix/include/netif/delif.h b/contrib/ports/unix/include/netif/delif.h deleted file mode 100644 index 6672a73..0000000 --- a/contrib/ports/unix/include/netif/delif.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 - * - */ -#ifndef LWIP_DELIF_H -#define LWIP_DELIF_H - -#include "lwip/netif.h" - -#include "lwip/pbuf.h" - -err_t delif_init(struct netif *netif); -err_t delif_init_thread(struct netif *netif); - -#endif /* LWIP_DELIF_H */ diff --git a/contrib/ports/unix/include/netif/dropif.h b/contrib/ports/unix/include/netif/dropif.h deleted file mode 100644 index a173b5f..0000000 --- a/contrib/ports/unix/include/netif/dropif.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 - * - */ -#ifndef LWIP_DROPIF_H -#define LWIP_DROPIF_H - -#include "lwip/netif.h" - -#include "lwip/pbuf.h" - -err_t dropif_init(struct netif *netif); - -#endif /* LWIP_DROPIF_H */ diff --git a/contrib/ports/unix/include/netif/tcpdump.h b/contrib/ports/unix/include/netif/tcpdump.h deleted file mode 100644 index 0acd735..0000000 --- a/contrib/ports/unix/include/netif/tcpdump.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 - * - */ -#ifndef LWIP_NETIF_TCPDUMP_H -#define LWIP_NETIF_TCPDUMP_H - -#include "lwip/pbuf.h" - -void tcpdump_init(void); -void tcpdump(struct pbuf *p); - -#endif /* LWIP_NETIF_TCPDUMP_H */ diff --git a/contrib/ports/unix/include/netif/unixif.h b/contrib/ports/unix/include/netif/unixif.h deleted file mode 100644 index 10b782b..0000000 --- a/contrib/ports/unix/include/netif/unixif.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 - * - */ -#ifndef LWIP_UNIXIF_H -#define LWIP_UNIXIF_H - -#include "lwip/netif.h" - -err_t unixif_init_server(struct netif *netif); -err_t unixif_init_client(struct netif *netif); - -#endif /* LWIP_UNIXIF_H */ diff --git a/contrib/ports/unix/netif/delif.c b/contrib/ports/unix/netif/delif.c deleted file mode 100644 index 6371e84..0000000 --- a/contrib/ports/unix/netif/delif.c +++ /dev/null @@ -1,323 +0,0 @@ -/* - * 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 - * - */ - -#include "lwip/debug.h" - -#include - -#include "lwip/def.h" -#include "netif/delif.h" - -#ifdef linux -#include "netif/tapif.h" -#else /* linux */ -#include "netif/tunif.h" -#endif /* linux */ - -#include "lwip/sys.h" - - -#define DELIF_INPUT_DROPRATE 0.1 -#define DELIF_OUTPUT_DROPRATE 0.1 - -#define DELIF_INPUT_DELAY 500 /* Miliseconds. */ -#define DELIF_OUTPUT_DELAY 500 /* Miliseconds. */ - -#define DELIF_TIMEOUT 10 - -struct delif { - err_t (* input)(struct pbuf *p, struct netif *inp); - struct netif *netif; -}; - -struct delif_pbuf { - struct delif_pbuf *next; - struct pbuf *p; - ip_addr_t *ipaddr; - unsigned int time; -}; - -static struct delif_pbuf *input_list = NULL; -static struct delif_pbuf *output_list = NULL; -/*-----------------------------------------------------------------------------------*/ -static void -delif_input_timeout(void *arg) -{ - struct netif *netif; - struct delif *delif; - struct delif_pbuf *dp; - unsigned int timeout, now; - - timeout = DELIF_TIMEOUT; - - netif = arg; - delif = netif->state; - - - /* Check if there is anything on the input list. */ - dp = input_list; - while (dp != NULL) { - now = sys_now(); - - if (dp->time <= now) { - delif->input(dp->p, netif); - if (dp->next != NULL) { - if (dp->next->time > now) { - timeout = dp->next->time - now; - } else { - timeout = 0; - } - LWIP_DEBUGF(DELIF_DEBUG, ("delif_output_timeout: timeout %u.\n", timeout)); - - } - input_list = dp->next; - free(dp); - dp = input_list; - } else { - dp = dp->next; - } - } - - sys_timeout(timeout, delif_input_timeout, arg); -} -/*-----------------------------------------------------------------------------------*/ -static void -delif_output_timeout(void *arg) -{ - struct netif *netif; - struct delif *delif; - struct delif_pbuf *dp; - unsigned int timeout, now; - - timeout = DELIF_TIMEOUT; - - netif = arg; - delif = netif->state; - - /* Check if there is anything on the output list. */ - dp = output_list; - while (dp != NULL) { - now = sys_now(); - if (dp->time <= now) { - LWIP_DEBUGF(DELIF_DEBUG, ("delif_output_timeout: now %u dp->time %u\n", - now, dp->time)); - delif->netif->output(delif->netif, dp->p, dp->ipaddr); - if (dp->next != NULL) { - if (dp->next->time > now) { - timeout = dp->next->time - now; - } else { - timeout = 0; - } - LWIP_DEBUGF(DELIF_DEBUG, ("delif_output_timeout: timeout %u.\n", timeout)); - - } - pbuf_free(dp->p); - - output_list = dp->next; - free(dp); - dp = output_list; - } else { - dp = dp->next; - } - } - - - sys_timeout(timeout, delif_output_timeout, arg); -} -/*-----------------------------------------------------------------------------------*/ -static err_t -delif_output(struct netif *netif, struct pbuf *p, ip_addr_t *ipaddr) -{ - struct delif_pbuf *dp, *np; - struct pbuf *q; - int i, j; - char *data; - - LWIP_DEBUGF(DELIF_DEBUG, ("delif_output\n")); - -#ifdef DELIF_OUTPUT_DROPRATE - if (((double)rand()/(double)RAND_MAX) < DELIF_OUTPUT_DROPRATE) { - LWIP_DEBUGF(DELIF_DEBUG, ("delif_output: Packet dropped\n")); - return 0; - } -#endif /* DELIF_OUTPUT_DROPRATE */ - - - LWIP_DEBUGF(DELIF_DEBUG, ("delif_output\n")); - - - dp = malloc(sizeof(struct delif_pbuf)); - data = malloc(p->tot_len); - - i = 0; - for(q = p; q != NULL; q = q->next) { - for(j = 0; j < q->len; j++) { - data[i] = ((char *)q->payload)[j]; - i++; - } - } - - - dp->p = pbuf_alloc(PBUF_LINK, 0, PBUF_ROM); - dp->p->payload = data; - dp->p->len = p->tot_len; - dp->p->tot_len = p->tot_len; - dp->ipaddr = ipaddr; - dp->time = sys_now() + DELIF_OUTPUT_DELAY; - dp->next = NULL; - if (output_list == NULL) { - output_list = dp; - } else { - for(np = output_list; np->next != NULL; np = np->next); - np->next = dp; - } - - - return ERR_OK; - - -} -/*-----------------------------------------------------------------------------------*/ -static err_t -delif_input(struct pbuf *p, struct netif *inp) -{ - struct delif_pbuf *dp, *np; - - LWIP_DEBUGF(DELIF_DEBUG, ("delif_input\n")); -#ifdef DELIF_INPUT_DROPRATE - if (((double)rand()/(double)RAND_MAX) < DELIF_INPUT_DROPRATE) { - LWIP_DEBUGF(DELIF_DEBUG, ("delif_input: Packet dropped\n")); - pbuf_free(p); - return ERR_OK; - } -#endif /* DELIF_INPUT_DROPRATE */ - - - dp = malloc(sizeof(struct delif_pbuf)); - dp->p = p; - dp->time = sys_now() + DELIF_INPUT_DELAY; - dp->next = NULL; - if (input_list == NULL) { - input_list = dp; - } else { - for(np = input_list; np->next != NULL; np = np->next); - np->next = dp; - } - return ERR_OK; -} -/*-----------------------------------------------------------------------------------*/ -err_t -delif_init(struct netif *netif) -{ - struct delif *del; - - del = malloc(sizeof(struct delif)); - if (!del) - return ERR_MEM; - netif->state = del; - netif->name[0] = 'd'; - netif->name[1] = 'e'; - netif->output = delif_output; - - del->netif = malloc(sizeof(struct netif)); - if (!del->netif) { - free(del); - return ERR_MEM; - } -#ifdef linux - /* tapif_init(del->netif);*/ - tunif_init(del->netif); -#else /* linux */ - tunif_init(del->netif); -#endif /* linux */ - del->input = netif->input; - del->netif->input = delif_input; - sys_timeout(DELIF_TIMEOUT, delif_input_timeout, netif); - sys_timeout(DELIF_TIMEOUT, delif_output_timeout, netif); - return ERR_OK; -} - -/*-----------------------------------------------------------------------------------*/ -static void -delif_thread(void *arg) -{ - struct netif *netif = arg; - struct delif *del; - sys_sem_t sem; - - del = netif->state; -#ifdef linux - tapif_init(del->netif); -#else /* linux */ - tunif_init(del->netif); -#endif /* linux */ - - sys_timeout(DELIF_TIMEOUT, delif_input_timeout, netif); - sys_timeout(DELIF_TIMEOUT, delif_output_timeout, netif); - - if(sys_sem_new(&sem, 0) != ERR_OK) { - LWIP_ASSERT("Failed to create semaphore", 0); - } - sys_sem_wait(&sem); - -} -/*-----------------------------------------------------------------------------------*/ -err_t -delif_init_thread(struct netif *netif) -{ - struct delif *del; - - LWIP_DEBUGF(DELIF_DEBUG, ("delif_init_thread\n")); - - del = malloc(sizeof(struct delif)); - if (!del) - return ERR_MEM; - netif->state = del; - netif->name[0] = 'd'; - netif->name[1] = 'e'; - netif->output = delif_output; - - del->netif = malloc(sizeof(struct netif)); - if (!del->netif) { - free(del); - return ERR_MEM; - } - del->netif->ip_addr = netif->ip_addr; - del->netif->gw = netif->gw; - del->netif->netmask = netif->netmask; - del->input = netif->input; - del->netif->input = delif_input; - sys_thread_new("delif_thread", delif_thread, netif, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO); - return ERR_OK; -} - -/*-----------------------------------------------------------------------------------*/ diff --git a/contrib/ports/unix/netif/tcpdump.c b/contrib/ports/unix/netif/tcpdump.c deleted file mode 100644 index fe108bb..0000000 --- a/contrib/ports/unix/netif/tcpdump.c +++ /dev/null @@ -1,198 +0,0 @@ -/* - * 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 - * - */ - -#include - -#include "netif/tcpdump.h" -#include "lwip/ip.h" -#include "lwip/tcp_impl.h" -#include "lwip/udp.h" -#include "lwip/inet.h" -#include "lwip/inet_chksum.h" - -#ifndef TCPDUMP_DEBUG -#define TCPDUMP_DEBUG LWIP_DBG_OFF -#endif - -static FILE *file = NULL; - -/*-----------------------------------------------------------------------------------*/ -void -tcpdump_init(void) -{ -#define TCPDUMP_FNAME "/tmp/tcpdump" - file = fopen(TCPDUMP_FNAME, "w"); - if (file == NULL) { - perror("tcpdump_init: cannot open \""TCPDUMP_FNAME"\" for writing"); - } - LWIP_DEBUGF(TCPDUMP_DEBUG, ("tcpdump: file %s\n", TCPDUMP_FNAME)); -} -/*-----------------------------------------------------------------------------------*/ -void -tcpdump(struct pbuf *p) -{ - struct ip_hdr *iphdr; - struct tcp_hdr *tcphdr; -#if LWIP_UDP - struct udp_hdr *udphdr; -#endif - char flags[5]; - int i; - int len; - int offset; - - if (file == NULL) { - return; - } -#ifdef IPv4 - iphdr = (struct ip_hdr *)p->payload; - switch (IPH_PROTO(iphdr)) { -#if LWIP_TCP - case IP_PROTO_TCP: - tcphdr = (struct tcp_hdr *)((char *)iphdr + IP_HLEN); - - pbuf_header(p, -IP_HLEN); - if (inet_chksum_pseudo(p, IP_PROTO_TCP, p->tot_len, - (ip_addr_t *)&(iphdr->src), - (ip_addr_t *)&(iphdr->dest)) != 0) { - LWIP_DEBUGF(TCPDUMP_DEBUG, ("tcpdump: IP checksum failed!\n")); - /* fprintf(file, "chksum 0x%lx ", tcphdr->chksum); - tcphdr->chksum = 0; - fprintf(file, "should be 0x%lx ", inet_chksum_pseudo(p, (ip_addr_t *)&(iphdr->src), - (ip_addr_t *)&(iphdr->dest), - IP_PROTO_TCP, p->tot_len));*/ - fprintf(file, "!chksum "); - } - - i = 0; - if (TCPH_FLAGS(tcphdr) & TCP_SYN) { - flags[i++] = 'S'; - } - if (TCPH_FLAGS(tcphdr) & TCP_PSH) { - flags[i++] = 'P'; - } - if (TCPH_FLAGS(tcphdr) & TCP_FIN) { - flags[i++] = 'F'; - } - if (TCPH_FLAGS(tcphdr) & TCP_RST) { - flags[i++] = 'R'; - } - if (i == 0) { - flags[i++] = '.'; - } - flags[i++] = 0; - - - - fprintf(file, "%d.%d.%d.%d.%u > %d.%d.%d.%d.%u: ", - (int)(ntohl(iphdr->src.addr) >> 24) & 0xff, - (int)(ntohl(iphdr->src.addr) >> 16) & 0xff, - (int)(ntohl(iphdr->src.addr) >> 8) & 0xff, - (int)(ntohl(iphdr->src.addr) >> 0) & 0xff, - ntohs(tcphdr->src), - (int)(ntohl(iphdr->dest.addr) >> 24) & 0xff, - (int)(ntohl(iphdr->dest.addr) >> 16) & 0xff, - (int)(ntohl(iphdr->dest.addr) >> 8) & 0xff, - (int)(ntohl(iphdr->dest.addr) >> 0) & 0xff, - ntohs(tcphdr->dest)); - offset = TCPH_HDRLEN(tcphdr); - - len = ntohs(IPH_LEN(iphdr)) - offset * 4 - IP_HLEN; - if (len != 0 || flags[0] != '.') { - fprintf(file, "%s %u:%u(%u) ", - flags, - ntohl(tcphdr->seqno), - ntohl(tcphdr->seqno) + len, - len); - } - if (TCPH_FLAGS(tcphdr) & TCP_ACK) { - fprintf(file, "ack %u ", - ntohl(tcphdr->ackno)); - } - fprintf(file, "wnd %u\n", - ntohs(tcphdr->wnd)); - - fflush(file); - - pbuf_header(p, IP_HLEN); - break; -#endif /* LWIP_TCP */ - -#if LWIP_UDP - case IP_PROTO_UDP: - udphdr = (struct udp_hdr *)((char *)iphdr + IP_HLEN); - - pbuf_header(p, -IP_HLEN); - if (inet_chksum_pseudo(p, IP_PROTO_UDP, p->tot_len, - (ip_addr_t *)&(iphdr->src), - (ip_addr_t *)&(iphdr->dest)) != 0) { - LWIP_DEBUGF(TCPDUMP_DEBUG, ("tcpdump: IP checksum failed!\n")); - /* fprintf(file, "chksum 0x%lx ", tcphdr->chksum); - tcphdr->chksum = 0; - fprintf(file, "should be 0x%lx ", inet_chksum_pseudo(p, (ip_addr_t *)&(iphdr->src), - (ip_addr_t *)&(iphdr->dest), - IP_PROTO_TCP, p->tot_len));*/ - fprintf(file, "!chksum "); - } - - fprintf(file, "%d.%d.%d.%d.%u > %d.%d.%d.%d.%u: ", - (int)(ntohl(iphdr->src.addr) >> 24) & 0xff, - (int)(ntohl(iphdr->src.addr) >> 16) & 0xff, - (int)(ntohl(iphdr->src.addr) >> 8) & 0xff, - (int)(ntohl(iphdr->src.addr) >> 0) & 0xff, - ntohs(udphdr->src), - (int)(ntohl(iphdr->dest.addr) >> 24) & 0xff, - (int)(ntohl(iphdr->dest.addr) >> 16) & 0xff, - (int)(ntohl(iphdr->dest.addr) >> 8) & 0xff, - (int)(ntohl(iphdr->dest.addr) >> 0) & 0xff, - ntohs(udphdr->dest)); - fprintf(file, "U "); - len = ntohs(IPH_LEN(iphdr)) - sizeof(struct udp_hdr) - IP_HLEN; - fprintf(file, " %d\n", len); - - fflush(file); - - pbuf_header(p, IP_HLEN); - break; -#endif /* LWIP_UDP */ - default: - LWIP_DEBUGF(TCPDUMP_DEBUG, ("unhandled IP protocol: %d\n", (int)IPH_PROTO(iphdr))); - break; - - } -#endif /* IPv4 */ -} -/*-----------------------------------------------------------------------------------*/ - - - - diff --git a/contrib/ports/unix/netif/tunif.c b/contrib/ports/unix/netif/tunif.c deleted file mode 100644 index fd3f024..0000000 --- a/contrib/ports/unix/netif/tunif.c +++ /dev/null @@ -1,318 +0,0 @@ -/* - * 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 - * - */ - -#include "netif/tunif.h" - -#include -#include -#include -#include -#include -#include -#include -#include - - -#include "lwip/debug.h" - -#include "lwip/opt.h" -#include "lwip/def.h" -#include "lwip/ip.h" -#include "lwip/mem.h" -#include "lwip/netif.h" -#include "lwip/pbuf.h" -#include "lwip/sys.h" - - -#define IFNAME0 't' -#define IFNAME1 'n' - -#ifndef TUNIF_DEBUG -#define TUNIF_DEBUG LWIP_DBG_OFF -#endif - -#define IFCONFIG_CALL "/sbin/ifconfig tun0 inet %d.%d.%d.%d %d.%d.%d.%d" - -struct tunif { - /* Add whatever per-interface state that is needed here. */ - int fd; -}; - -/* Forward declarations. */ -static void tunif_input(struct netif *netif); -static err_t tunif_output(struct netif *netif, struct pbuf *p, - ip_addr_t *ipaddr); - -static void tunif_thread(void *data); - -/*-----------------------------------------------------------------------------------*/ -static void -low_level_init(struct netif *netif) -{ - struct tunif *tunif; - char buf[sizeof(IFCONFIG_CALL) + 50]; - - tunif = (struct tunif *)netif->state; - - /* Obtain MAC address from network interface. */ - - /* Do whatever else is needed to initialize interface. */ - - tunif->fd = open("/dev/tun0", O_RDWR); - LWIP_DEBUGF(TUNIF_DEBUG, ("tunif_init: fd %d\n", tunif->fd)); - if (tunif->fd == -1) { - perror("tunif_init"); - exit(1); - } - sprintf(buf, IFCONFIG_CALL, - ip4_addr1(&(netif->gw)), - ip4_addr2(&(netif->gw)), - ip4_addr3(&(netif->gw)), - ip4_addr4(&(netif->gw)), - ip4_addr1(&(netif->ip_addr)), - ip4_addr2(&(netif->ip_addr)), - ip4_addr3(&(netif->ip_addr)), - ip4_addr4(&(netif->ip_addr))); - - LWIP_DEBUGF(TUNIF_DEBUG, ("tunif_init: system(\"%s\");\n", buf)); - system(buf); - sys_thread_new("tunif_thread", tunif_thread, netif, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO); - -} -/*-----------------------------------------------------------------------------------*/ -/* - * 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 tunif *tunif, struct pbuf *p) -{ - struct pbuf *q; - char buf[1500]; - char *bufptr; - int rnd_val; - - /* initiate transfer(); */ - - rnd_val = rand(); - if (((double)rnd_val/(double)RAND_MAX) < 0.4) { - printf("drop\n"); - return ERR_OK; - } - - - bufptr = &buf[0]; - - 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); */ - memcpy(bufptr, q->payload, q->len); - bufptr += q->len; - } - - /* signal that packet should be sent(); */ - if (write(tunif->fd, buf, p->tot_len) == -1) { - perror("tunif: write"); - } - 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 tunif *tunif) -{ - struct pbuf *p, *q; - u16_t len; - char buf[1500]; - char *bufptr; - - /* Obtain the size of the packet and put it into the "len" - variable. */ - len = read(tunif->fd, buf, sizeof(buf)); - - /* if (((double)rand()/(double)RAND_MAX) < 0.1) { - printf("drop\n"); - return NULL; - }*/ - - - /* We allocate a pbuf chain of pbufs from the pool. */ - p = pbuf_alloc(PBUF_LINK, len, PBUF_POOL); - - if (p != NULL) { - /* We iterate over the pbuf chain until we have read the entire - packet into the pbuf. */ - bufptr = &buf[0]; - for(q = p; q != NULL; q = q->next) { - /* Read enough bytes to fill this pbuf in the chain. The - available data in the pbuf is given by the q->len - variable. */ - /* read data into(q->payload, q->len); */ - memcpy(q->payload, bufptr, q->len); - bufptr += q->len; - } - /* acknowledge that packet has been read(); */ - } else { - /* drop packet(); */ - } - - return p; -} -/*-----------------------------------------------------------------------------------*/ -static void -tunif_thread(void *arg) -{ - struct netif *netif; - struct tunif *tunif; - fd_set fdset; - int ret; - - netif = (struct netif *)arg; - tunif = (struct tunif *)netif->state; - - while (1) { - FD_ZERO(&fdset); - FD_SET(tunif->fd, &fdset); - - /* Wait for a packet to arrive. */ - ret = select(tunif->fd + 1, &fdset, NULL, NULL, NULL); - - if (ret == 1) { - /* Handle incoming packet. */ - tunif_input(netif); - } else if (ret == -1) { - perror("tunif_thread: select"); - } - } -} -/*-----------------------------------------------------------------------------------*/ -/* - * tunif_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 -tunif_output(struct netif *netif, struct pbuf *p, - ip_addr_t *ipaddr) -{ - struct tunif *tunif; - LWIP_UNUSED_ARG(ipaddr); - - tunif = (struct tunif *)netif->state; - - return low_level_output(tunif, p); - -} -/*-----------------------------------------------------------------------------------*/ -/* - * tunif_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 -tunif_input(struct netif *netif) -{ - struct tunif *tunif; - struct pbuf *p; - - - tunif = (struct tunif *)netif->state; - - p = low_level_input(tunif); - - if (p == NULL) { - LWIP_DEBUGF(TUNIF_DEBUG, ("tunif_input: low_level_input returned NULL\n")); - return; - } - -#if 0 -/* CS: ip_lookup() was removed */ - if (ip_lookup(p->payload, netif)) { -#endif - netif->input(p, netif); -#if 0 - } -#endif -} -/*-----------------------------------------------------------------------------------*/ -/* - * tunif_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. - * - */ -/*-----------------------------------------------------------------------------------*/ -err_t -tunif_init(struct netif *netif) -{ - struct tunif *tunif; - - tunif = (struct tunif *)mem_malloc(sizeof(struct tunif)); - if (!tunif) { - return ERR_MEM; - } - netif->state = tunif; - netif->name[0] = IFNAME0; - netif->name[1] = IFNAME1; - netif->output = tunif_output; - - - low_level_init(netif); - return ERR_OK; -} -/*-----------------------------------------------------------------------------------*/ diff --git a/contrib/ports/unix/netif/unixif.c b/contrib/ports/unix/netif/unixif.c deleted file mode 100644 index 960d309..0000000 --- a/contrib/ports/unix/netif/unixif.c +++ /dev/null @@ -1,491 +0,0 @@ -/* - * 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 - * - */ - -#include "lwip/debug.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -/*#include */ -/*#include */ - - -#include "lwip/stats.h" - -#include "lwip/def.h" -#include "lwip/mem.h" -#include "lwip/pbuf.h" -#include "netif/list.h" -#include "netif/unixif.h" -#include "lwip/sys.h" -#include "lwip/timers.h" - - -#include "netif/tcpdump.h" - -#define UNIXIF_BPS 512000 -#define UNIXIF_QUEUELEN 6 -/*#define UNIXIF_DROP_FIRST */ - -#ifndef UNIXIF_DEBUG -#define UNIXIF_DEBUG LWIP_DBG_OFF -#endif - -struct unixif_buf { - struct pbuf *p; - unsigned short len, tot_len; - void *payload; -}; - -struct unixif { - int fd; - sys_sem_t sem; - struct list *q; -}; - - -/*-----------------------------------------------------------------------------------*/ -static int -unix_socket_client(const char *name) -{ - int fd; -#if !defined(linux) && !defined(cygwin) && !defined(__CYGWIN__) - int len; -#endif - struct sockaddr_un unix_addr; - - /* create a Unix domain stream socket */ - if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { - perror("unixif: unix_socket_client: socket"); - return(-1); - } - - /* fill socket address structure w/our address */ - memset(&unix_addr, 0, sizeof(unix_addr)); - unix_addr.sun_family = AF_UNIX; - snprintf(unix_addr.sun_path, sizeof(unix_addr.sun_path), "%s%05d", "/var/tmp/", getpid()); -#if !defined(linux) && !defined(cygwin) && !defined(__CYGWIN__) - len = sizeof(unix_addr.sun_len) + sizeof(unix_addr.sun_family) + - strlen(unix_addr.sun_path) + 1; - unix_addr.sun_len = len; -#endif /* linux */ - - unlink(unix_addr.sun_path); /* in case it already exists */ - if (bind(fd, (struct sockaddr *) &unix_addr, - sizeof(struct sockaddr_un)) < 0) { - perror("unixif: unix_socket_client: socket"); - return(-1); - } - if (chmod(unix_addr.sun_path, S_IRWXU | S_IRWXO) < 0) { - perror("unixif: unix_socket_client: socket"); - return(-1); - } - - /* fill socket address structure w/server's addr */ - memset(&unix_addr, 0, sizeof(unix_addr)); - unix_addr.sun_family = AF_UNIX; - strcpy(unix_addr.sun_path, name); -#if !defined(linux) && !defined(cygwin) && !defined(__CYGWIN__) - len = sizeof(unix_addr.sun_len) + sizeof(unix_addr.sun_family) + - strlen(unix_addr.sun_path) + 1; - unix_addr.sun_len = len; -#endif /* linux */ - if (connect(fd, (struct sockaddr *) &unix_addr, - sizeof(struct sockaddr_un)) < 0) { - perror("unixif: unix_socket_client: socket"); - return(-1); - } - return(fd); -} - -/*-----------------------------------------------------------------------------------*/ -static int -unix_socket_server(const char *name) -{ - int fd; -#if !defined(linux) && !defined(cygwin) && !defined(__CYGWIN__) - int len; -#endif - struct sockaddr_un unix_addr; - - /* create a Unix domain stream socket */ - if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { - perror("unixif: unix_socket_server: socket"); - return(-1); - } - - unlink(name); /* in case it already exists */ - - /* fill in socket address structure */ - memset(&unix_addr, 0, sizeof(unix_addr)); - unix_addr.sun_family = AF_UNIX; - strcpy(unix_addr.sun_path, name); -#if !defined(linux) && !defined(cygwin) && !defined(__CYGWIN__) - len = sizeof(unix_addr.sun_len) + sizeof(unix_addr.sun_family) + - strlen(unix_addr.sun_path) + 1; - unix_addr.sun_len = len; -#endif /* linux */ - - /* bind the name to the descriptor */ - if (bind(fd, (struct sockaddr *) &unix_addr, - sizeof(struct sockaddr_un)) < 0) { - perror("unixif: unix_socket_server: bind"); - return(-1); - } - - if (chmod(unix_addr.sun_path, S_IRWXU | S_IRWXO) < 0) { - perror("unixif: unix_socket_server: chmod"); - return(-1); - } - - - if (listen(fd, 5) < 0) { /* tell kernel we're a server */ - perror("unixif: unix_socket_server: listen"); - return(-1); - } - - return(fd); -} -/*-----------------------------------------------------------------------------------*/ -static void -unixif_input_handler(void *data) -{ - struct netif *netif; - struct unixif *unixif; - char buf[1532], *bufptr; - int len, plen, rlen; - struct pbuf *p, *q; - - netif = (struct netif *)data; - unixif = (struct unixif *)netif->state; - - len = read(unixif->fd, &plen, sizeof(int)); - if (len == -1) { - perror("unixif_irq_handler: read"); - abort(); - } - - LWIP_DEBUGF(UNIXIF_DEBUG, ("unixif_irq_handler: len == %d plen == %d bytes\n", len, plen)); - if (len == sizeof(int)) { - - if (plen < 20 || plen > 1500) { - LWIP_DEBUGF(UNIXIF_DEBUG, ("plen %d!\n", plen)); - return; - } - - len = read(unixif->fd, buf, plen); - if (len == -1) { - perror("unixif_irq_handler: read"); - abort(); - } - LWIP_DEBUGF(UNIXIF_DEBUG, ("unixif_irq_handler: read %d bytes\n", len)); - p = pbuf_alloc(PBUF_LINK, len, PBUF_POOL); - - if (p != NULL) { - rlen = len; - bufptr = buf; - q = p; - while (rlen > 0) { - memcpy(q->payload, bufptr, rlen > q->len? q->len: rlen); - rlen -= q->len; - bufptr += q->len; - q = q->next; - } - pbuf_realloc(p, len); - LINK_STATS_INC(link.recv); - tcpdump(p); - netif->input(p, netif); - } else { - LWIP_DEBUGF(UNIXIF_DEBUG, ("unixif_irq_handler: could not allocate pbuf\n")); - } - - - } -} -/*-----------------------------------------------------------------------------------*/ -static void -unixif_thread(void *arg) -{ - struct netif *netif; - struct unixif *unixif; - - LWIP_DEBUGF(UNIXIF_DEBUG, ("unixif_thread: started.\n")); - - netif = (struct netif *)arg; - unixif = (struct unixif *)netif->state; - - - while (1) { - sys_sem_wait(&unixif->sem); - unixif_input_handler(netif); - } - -} -/*-----------------------------------------------------------------------------------*/ -static void -unixif_thread2(void *arg) -{ - struct netif *netif; - struct unixif *unixif; - fd_set fdset; - - LWIP_DEBUGF(UNIXIF_DEBUG, ("unixif_thread2: started.\n")); - - netif = (struct netif *)arg; - unixif = (struct unixif *)netif->state; - - while (1) { - FD_ZERO(&fdset); - FD_SET(unixif->fd, &fdset); - - if (select(unixif->fd + 1, &fdset, NULL, NULL, NULL) > 0) { - sys_sem_signal(&unixif->sem); - } - } -} -/*-----------------------------------------------------------------------------------*/ -static void unixif_output_timeout(void *arg); - -static err_t -unixif_output(struct netif *netif, struct pbuf *p, ip_addr_t *ipaddr) -{ - struct unixif *unixif; - struct unixif_buf *buf; - LWIP_UNUSED_ARG(ipaddr); - - unixif = (struct unixif *)netif->state; - - buf = (struct unixif_buf *)malloc(sizeof(struct unixif_buf)); - buf->p = p; - buf->len = p->len; - buf->tot_len = p->tot_len; - buf->payload = p->payload; - - if (list_elems(unixif->q) == 0) { - pbuf_ref(p); - list_push(unixif->q, buf); - sys_timeout((double)p->tot_len * 8000.0 / UNIXIF_BPS, unixif_output_timeout, - netif); - - LWIP_DEBUGF(UNIXIF_DEBUG, ("unixif_output: first on list\n")); - - } else { - pbuf_ref(p); - if (list_push(unixif->q, buf) == 0) { -#ifdef UNIXIF_DROP_FIRST - struct unixif_buf *buf2; - - buf2 = list_pop(unixif->q); - pbuf_free(buf2->p); - free(buf2); - list_push(unixif->q, buf); -#else - free(buf); - pbuf_free(p); - - LWIP_DEBUGF(UNIXIF_DEBUG, ("unixif_output: drop\n")); - -#endif /* UNIXIF_DROP_FIRST */ - LINK_STATS_INC(link.drop); - - } else { - LWIP_DEBUGF(UNIXIF_DEBUG, ("unixif_output: on list\n")); - } - - } - return ERR_OK; -} -/*-----------------------------------------------------------------------------------*/ -static void -unixif_output_timeout(void *arg) -{ - struct pbuf *p, *q; - int i, j, len; - unsigned short plen, ptot_len; - struct unixif_buf *buf; - void *payload; - struct netif *netif; - struct unixif *unixif; - char *data; - - netif = (struct netif *)arg; - unixif = (struct unixif *)netif->state; - - LWIP_DEBUGF(UNIXIF_DEBUG, ("unixif_output_timeout\n")); - - /* buf = unixif->q[0]; - unixif->q[0] = unixif->q[1]; - unixif->q[1] = NULL;*/ - buf = (struct unixif_buf *)list_pop(unixif->q); - - p = buf->p; - - plen = p->len; - ptot_len = p->tot_len; - payload = p->payload; - - p->len = buf->len; - p->tot_len = buf->tot_len; - p->payload = buf->payload; - - - if (p->tot_len == 0) { - - LWIP_DEBUGF(UNIXIF_DEBUG, ("p->len!\n")); - abort(); - } - data = (char *)malloc(p->tot_len); - - i = 0; - for(q = p; q != NULL; q = q->next) { - for(j = 0; j < q->len; j++) { - data[i] = ((char *)q->payload)[j]; - i++; - } - } - - LWIP_DEBUGF(UNIXIF_DEBUG, ("unixif_output: sending %d (%d) bytes\n", - p->len, p->tot_len)); - - len = p->tot_len; - if (write(unixif->fd, &len, sizeof(int)) == -1) { - perror("unixif_output: write"); - abort(); - } - - if (write(unixif->fd, data, p->tot_len) == -1) { - perror("unixif_output: write"); - abort(); - } - tcpdump(p); - LINK_STATS_INC(link.xmit); - - free(data); - free(buf); - p->len = plen; - p->tot_len = ptot_len; - p->payload = payload; - - pbuf_free(p); - - /* if (unixif->q[0] != NULL) { - sys_timeout(unixif->q[0]->tot_len * 8000 / UNIXIF_BPS, - unixif_output_timeout, netif); - }*/ - if (list_elems(unixif->q) > 0) { - sys_timeout(((struct unixif_buf *)list_first(unixif->q))->tot_len * - 8000.0 / UNIXIF_BPS, - unixif_output_timeout, netif); - } -} -/*-----------------------------------------------------------------------------------*/ -err_t -unixif_init_server(struct netif *netif) -{ - int fd, fd2; - struct sockaddr_un addr; - socklen_t len; - struct unixif *unixif; - - fd = unix_socket_server("/tmp/unixif"); - - if (fd == -1) { - perror("unixif_server"); - abort(); - } - LWIP_DEBUGF(UNIXIF_DEBUG, ("unixif_server: fd %d\n", fd)); - - unixif = (struct unixif *)malloc(sizeof(struct unixif)); - if (!unixif) { - return ERR_MEM; - } - netif->state = unixif; - netif->name[0] = 'u'; - netif->name[1] = 'n'; - netif->output = unixif_output; - unixif->q = list_new(UNIXIF_QUEUELEN); - - printf("Now run ./simnode.\n"); - len = sizeof(addr); - fd2 = accept(fd, (struct sockaddr *)&addr, &len); - - if (fd2 == -1) { - perror("unixif_accept"); - abort(); - } - - LWIP_DEBUGF(UNIXIF_DEBUG, ("unixif_accept: %d\n", fd2)); - - unixif->fd = fd2; - if(sys_sem_new(&unixif->sem, 0) != ERR_OK) { - LWIP_ASSERT("Failed to create semaphore", 0); - } - sys_thread_new("unixif_thread", unixif_thread, netif, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO); - sys_thread_new("unixif_thread2", unixif_thread2, netif, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO); - return ERR_OK; -} -/*-----------------------------------------------------------------------------------*/ -err_t -unixif_init_client(struct netif *netif) -{ - struct unixif *unixif; - unixif = (struct unixif *)malloc(sizeof(struct unixif)); - if (!unixif) { - return ERR_MEM; - } - netif->state = unixif; - netif->name[0] = 'u'; - netif->name[1] = 'n'; - netif->output = unixif_output; - - unixif->fd = unix_socket_client("/tmp/unixif"); - if (unixif->fd == -1) { - perror("unixif_init"); - abort(); - } - unixif->q = list_new(UNIXIF_QUEUELEN); - if(sys_sem_new(&unixif->sem, 0) != ERR_OK) { - LWIP_ASSERT("Failed to create semaphore", 0); - } - sys_thread_new("unixif_thread", unixif_thread, netif, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO); - sys_thread_new("unixif_thread2", unixif_thread2, netif, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO); - return ERR_OK; -} -/*-----------------------------------------------------------------------------------*/ - - diff --git a/contrib/ports/unix/proj/lib/Makefile b/contrib/ports/unix/proj/lib/Makefile deleted file mode 100644 index 5e7f730..0000000 --- a/contrib/ports/unix/proj/lib/Makefile +++ /dev/null @@ -1,103 +0,0 @@ -# -# 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 -# - -CONTRIBDIR=../../../.. -LWIPARCH=$(CONTRIBDIR)/ports/unix - -#Set this to where you have the lwip core module checked out from CVS -#default assumes it's a dir named lwip at the same level as the contrib module -LWIPDIR=$(CONTRIBDIR)/../lwip/src - - -CCDEP=gcc -CC=gcc -CFLAGS=-g -Wall -DIPv4 -DLWIP_DEBUG -fPIC -pedantic -Werror \ - -Wparentheses -Wsequence-point -Wswitch-default \ - -Wextra -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast \ - -Wc++-compat -Wwrite-strings -Wold-style-definition \ - -Wredundant-decls -Wnested-externs -Wno-address - -CFLAGS:=$(CFLAGS) \ - -I$(LWIPDIR)/include -I$(LWIPARCH)/include -I$(LWIPDIR)/include/ipv4 \ - -I$(LWIPDIR)/include/ipv6 -I$(LWIPDIR) -I. - -# COREFILES, CORE4FILES: The minimum set of files needed for lwIP. -COREFILES=$(LWIPDIR)/core/def.c $(LWIPDIR)/core/dhcp.c $(LWIPDIR)/core/dns.c \ - $(LWIPDIR)/core/inet_chksum.c $(LWIPDIR)/core/init.c $(LWIPDIR)/core/mem.c \ - $(LWIPDIR)/core/memp.c $(LWIPDIR)/core/netif.c $(LWIPDIR)/core/pbuf.c \ - $(LWIPDIR)/core/raw.c $(LWIPDIR)/core/stats.c $(LWIPDIR)/core/sys.c \ - $(LWIPDIR)/core/tcp.c $(LWIPDIR)/core/tcp_in.c $(LWIPDIR)/core/tcp_in.c \ - $(LWIPDIR)/core/tcp_out.c $(LWIPDIR)/core/timers.c $(LWIPDIR)/core/udp.c -CORE4FILES=$(LWIPDIR)/core/ipv4/autoip.c $(LWIPDIR)/core/ipv4/icmp.c \ - $(LWIPDIR)/core/ipv4/igmp.c $(LWIPDIR)/core/ipv4/ip_frag.c \ - $(LWIPDIR)/core/ipv4/ip4.c $(LWIPDIR)/core/ipv4/ip4_addr.c -CORE6FILES=$(LWIPDIR)/core/ipv6/dhcp6.c $(LWIPDIR)/core/ipv6/ethip6.c \ - $(LWIPDIR)/core/ipv6/icmp6.c $(LWIPDIR)/core/ipv6/ip6.c \ - $(LWIPDIR)/core/ipv6/ip6_addr.c $(LWIPDIR)/core/ipv6/ip6_frag.c \ - $(LWIPDIR)/core/ipv6/mld6.c $(LWIPDIR)/core/ipv6/nd6.c - - -# APIFILES: The files which implement the sequential and socket APIs. -APIFILES=$(LWIPDIR)/api/api_lib.c $(LWIPDIR)/api/api_msg.c $(LWIPDIR)/api/err.c \ - $(LWIPDIR)/api/netbuf.c $(LWIPDIR)/api/netdb.c $(LWIPDIR)/api/netifapi.c \ - $(LWIPDIR)/api/sockets.c $(LWIPDIR)/api/tcpip.c - -# NETIFFILES: Files implementing various generic network interface functions.' -NETIFFILES=$(LWIPDIR)/netif/etharp.c - -# ARCHFILES: Architecture specific files. -ARCHFILES=$(wildcard $(LWIPARCH)/*.c $(LWIPARCH)/netif/tapif.c $(LWIPARCH)/netif/tunif.c $(LWIPARCH)/netif/unixif.c $(LWIPARCH)/netif/list.c $(LWIPARCH)/netif/tcpdump.c) - -# LWIPFILES: All the above. -LWIPFILES=$(COREFILES) $(CORE4FILES) $(CORE6FILES) $(APIFILES) $(NETIFFILES) $(ARCHFILES) -LWIPFILESW=$(wildcard $(LWIPFILES)) -LWIPOBJS=$(notdir $(LWIPFILESW:.c=.o)) - -LWIPLIB=liblwip.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 diff --git a/contrib/ports/unix/proj/lib/unixlib.c b/contrib/ports/unix/proj/lib/unixlib.c deleted file mode 100644 index a8ff1b0..0000000 --- a/contrib/ports/unix/proj/lib/unixlib.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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 - * - * $Id: unixlib.c,v 1.10 2010/02/17 16:52:30 goldsimon 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/init.h" -#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 "lwip/sockets.h" - -#include "netif/tapif.h" - -struct netif netif; - -static void -tcpip_init_done(void *arg) -{ - ip_addr_t ipaddr, netmask, gateway; - sys_sem_t *sem; - sem = (sys_sem_t *)arg; - - /* - CHANGE THESE to suit your own network configuration: - */ - IP4_ADDR(&gateway, 192,168,1,1); - IP4_ADDR(&ipaddr, 192,168,1,2); - IP4_ADDR(&netmask, 255,255,255,0); - - netif_set_default(netif_add(&netif, &ipaddr, &netmask, &gateway, NULL, tapif_init, - tcpip_input)); -#if LWIP_IPV6 - netif_create_ip6_linklocal_address(&netif, 1); -#endif - sys_sem_signal(sem); -} - -void _init(void){ - sys_sem_t sem; - - if(sys_sem_new(&sem, 0) != ERR_OK) { - LWIP_ASSERT("failed to create semaphore", 0); - } - tcpip_init(tcpip_init_done, &sem); - sys_sem_wait(&sem); - sys_sem_free(&sem); -} - -void _fini(void){ -} diff --git a/contrib/ports/unix/proj/minimal/Makefile b/contrib/ports/unix/proj/minimal/Makefile deleted file mode 100644 index dfed669..0000000 --- a/contrib/ports/unix/proj/minimal/Makefile +++ /dev/null @@ -1,121 +0,0 @@ -# -# 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 -# - -CCDEP=gcc -CC=gcc -#To compile for linux: make ARCH=linux -#To compile for cygwin: make ARCH=cygwin -#To compile for openbsd: make ARCH=openbsd -ARCH=openbsd -CFLAGS=-g -Wall -D$(ARCH) -DIPv4 -Os -DLWIP_DEBUG -pedantic -Werror \ - -Wparentheses -Wsequence-point -Wswitch-default \ - -Wextra -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast \ - -Wc++-compat -Wwrite-strings -Wold-style-definition \ - -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Wno-address -ARFLAGS=rs - -CONTRIBDIR=../../../.. -LWIPARCH=$(CONTRIBDIR)/ports/unix - -#Set this to where you have the lwip core module checked out from CVS -#default assumes it's a dir named lwip at the same level as the contrib module -LWIPDIR=$(CONTRIBDIR)/../lwip/src - -CFLAGS:=$(CFLAGS) \ - -I$(LWIPDIR)/include -I$(LWIPARCH)/include -I$(LWIPDIR)/include/ipv4 \ - -I$(LWIPDIR)/include/ipv6 -I. -I$(CONTRIBDIR)/apps/snmp_private_mib \ - -I$(CONTRIBDIR)/apps/tcpecho_raw - -# COREFILES, CORE4FILES: The minimum set of files needed for lwIP. -COREFILES=$(LWIPDIR)/core/def.c $(LWIPDIR)/core/dhcp.c $(LWIPDIR)/core/dns.c \ - $(LWIPDIR)/core/inet_chksum.c $(LWIPDIR)/core/init.c $(LWIPDIR)/core/mem.c \ - $(LWIPDIR)/core/memp.c $(LWIPDIR)/core/netif.c $(LWIPDIR)/core/pbuf.c \ - $(LWIPDIR)/core/raw.c $(LWIPDIR)/core/stats.c $(LWIPDIR)/core/sys.c \ - $(LWIPDIR)/core/tcp.c $(LWIPDIR)/core/tcp_in.c $(LWIPDIR)/core/tcp_in.c \ - $(LWIPDIR)/core/tcp_out.c $(LWIPDIR)/core/timers.c $(LWIPDIR)/core/udp.c -CORE4FILES=$(LWIPDIR)/core/ipv4/autoip.c $(LWIPDIR)/core/ipv4/icmp.c \ - $(LWIPDIR)/core/ipv4/igmp.c $(LWIPDIR)/core/ipv4/ip_frag.c \ - $(LWIPDIR)/core/ipv4/ip4.c $(LWIPDIR)/core/ipv4/ip4_addr.c -CORE6FILES=$(LWIPDIR)/core/ipv6/dhcp6.c $(LWIPDIR)/core/ipv6/ethip6.c \ - $(LWIPDIR)/core/ipv6/icmp6.c $(LWIPDIR)/core/ipv6/ip6.c \ - $(LWIPDIR)/core/ipv6/ip6_addr.c $(LWIPDIR)/core/ipv6/ip6_frag.c \ - $(LWIPDIR)/core/ipv6/mld6.c $(LWIPDIR)/core/ipv6/nd6.c - -# SNMPFILES: Extra SNMPv1 agent -SNMPFILES=$(LWIPDIR)/core/snmp/asn1_dec.c $(LWIPDIR)/core/snmp/asn1_enc.c \ - $(LWIPDIR)/core/snmp/mib2.c $(LWIPDIR)/core/snmp/mib_structs.c \ - $(LWIPDIR)/core/snmp/msg_in.c $(LWIPDIR)/core/snmp/msg_out.c \ - ../../../../apps/snmp_private_mib/lwip_prvmib.c - -# NETIFFILES: Files implementing various generic network interface functions.' -NETIFFILES=$(LWIPDIR)/netif/etharp.c mintapif.c - -# ARCHFILES: Architecture specific files -ARCHFILES=$(LWIPARCH)/sys_arch.c - -# LWIPFILES: All the above. -LWIPFILES=$(COREFILES) $(CORE4FILES) $(CORE6FILES) $(SNMPFILES) $(NETIFFILES) $(ARCHFILES) -LWIPFILESW=$(wildcard $(LWIPFILES)) -LWIPOBJS=$(notdir $(LWIPFILESW:.c=.o)) - -# APPFILES -APPFILES=../../../../apps/tcpecho_raw/echo.c timer.c - -LWIPLIB=liblwip4.a -APPLIB=liblwipapps.a -APPOBJS=$(notdir $(APPFILES:.c=.o)) - -%.o: - $(CC) $(CFLAGS) -c $(<:.o=.c) - -all ipv4 compile: echop -.PHONY: all - -clean: - rm -f *.o $(LWIPLIB) $(APPLIB) echop .depend* *.core core - -depend dep: .depend - -include .depend - -$(APPLIB): $(APPOBJS) - $(AR) $(ARFLAGS) $(APPLIB) $? - -$(LWIPLIB): $(LWIPOBJS) - $(AR) $(ARFLAGS) $(LWIPLIB) $? - -.depend: main.c $(LWIPFILES) $(APPFILES) - $(CCDEP) $(CFLAGS) -MM $^ > .depend || rm -f .depend - -echop: .depend $(LWIPLIB) $(APPLIB) main.o $(APPFILES) - $(CC) $(CFLAGS) $(LDFLAGS) -o echop main.o $(APPLIB) $(LWIPLIB) - - diff --git a/contrib/ports/unix/proj/minimal/README b/contrib/ports/unix/proj/minimal/README deleted file mode 100644 index 8789d47..0000000 --- a/contrib/ports/unix/proj/minimal/README +++ /dev/null @@ -1,4 +0,0 @@ -This is an example of a very minimal lwIP project. It runs in a single -thread and runs a single example application - an echo server. The -echo application is implemented using the raw API. Additionally this -raw API example hosts the SNMPv1 agent for development purposes. diff --git a/contrib/ports/unix/proj/minimal/lwipopts.h b/contrib/ports/unix/proj/minimal/lwipopts.h deleted file mode 100644 index 544d388..0000000 --- a/contrib/ports/unix/proj/minimal/lwipopts.h +++ /dev/null @@ -1,395 +0,0 @@ -/** - * @file - * - * lwIP Options Configuration - */ - -/* - * Copyright (c) 2001-2004 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY - * OF SUCH DAMAGE. - * - * This file is part of the lwIP TCP/IP stack. - * - * Author: Adam Dunkels - * - */ -#ifndef LWIP_LWIPOPTS_H -#define LWIP_LWIPOPTS_H - -/* - ----------------------------------------------- - ---------- Platform specific locking ---------- - ----------------------------------------------- -*/ - -/** - * NO_SYS==1: Provides VERY minimal functionality. Otherwise, - * use lwIP facilities. - */ -#define NO_SYS 1 - - -/* - ------------------------------------ - ---------- Memory options ---------- - ------------------------------------ -*/ -/** - * MEM_ALIGNMENT: should be set to the alignment of the CPU - * 4 byte alignment -> #define MEM_ALIGNMENT 4 - * 2 byte alignment -> #define MEM_ALIGNMENT 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 16000 - - -/* - ------------------------------------------------ - ---------- Internal Memory Pool Sizes ---------- - ------------------------------------------------ -*/ -/** - * MEMP_NUM_PBUF: the number of memp struct pbufs (used for PBUF_ROM and PBUF_REF). - * If the application sends a lot of data out of ROM (or other static memory), - * this should be set high. - */ -#define MEMP_NUM_PBUF 30 - -/** - * MEMP_NUM_RAW_PCB: Number of raw connection PCBs - * (requires the LWIP_RAW option) - */ -#define MEMP_NUM_RAW_PCB 4 - -/** - * MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One - * per active UDP "connection". - * (requires the LWIP_UDP option) - */ -#define MEMP_NUM_UDP_PCB 4 - -/** - * MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections. - * (requires the LWIP_TCP option) - */ -#define MEMP_NUM_TCP_PCB 2 - -/** - * MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections. - * (requires the LWIP_TCP option) - */ -#define MEMP_NUM_TCP_PCB_LISTEN 8 - -/** - * MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments. - * (requires the LWIP_TCP option) - */ -#define MEMP_NUM_TCP_SEG 16 - -/** - * MEMP_NUM_ARP_QUEUE: the number of simulateously queued outgoing - * packets (pbufs) that are waiting for an ARP request (to resolve - * their destination address) to finish. - * (requires the ARP_QUEUEING option) - */ -#define MEMP_NUM_ARP_QUEUE 2 - -/** - * MEMP_NUM_SYS_TIMEOUT: the number of simulateously active timeouts. - */ -#define MEMP_NUM_SYS_TIMEOUT 3 - -/** - * MEMP_NUM_NETBUF: the number of struct netbufs. - * (only needed if you use the sequential API, like api_lib.c) - */ -#define MEMP_NUM_NETBUF 0 - -/** - * MEMP_NUM_NETCONN: the number of struct netconns. - * (only needed if you use the sequential API, like api_lib.c) - */ -#define MEMP_NUM_NETCONN 0 - -/** - * MEMP_NUM_TCPIP_MSG_API: the number of struct tcpip_msg, which are used - * for callback/timeout API communication. - * (only needed if you use tcpip.c) - */ -#define MEMP_NUM_TCPIP_MSG_API 0 - -/** - * MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used - * for incoming packets. - * (only needed if you use tcpip.c) - */ -#define MEMP_NUM_TCPIP_MSG_INPKT 0 - -/** - * PBUF_POOL_SIZE: the number of buffers in the pbuf pool. - */ -#define PBUF_POOL_SIZE 32 - -/* - --------------------------------- - ---------- ARP options ---------- - --------------------------------- -*/ -/** - * LWIP_ARP==1: Enable ARP functionality. - */ -#define LWIP_ARP 1 - -/* - -------------------------------- - ---------- IP options ---------- - -------------------------------- -*/ -/** - * IP_FORWARD==1: Enables 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 - -/** - * IP_OPTIONS: Defines the behavior for IP options. - * IP_OPTIONS==0_ALLOWED: All packets with IP options are dropped. - * IP_OPTIONS==1_ALLOWED: IP options are allowed (but not parsed). - */ -#define IP_OPTIONS_ALLOWED 1 - -/** - * IP_REASSEMBLY==1: Reassemble incoming fragmented IP packets. Note that - * this option does not affect outgoing packet sizes, which can be controlled - * via IP_FRAG. - */ -#define IP_REASSEMBLY 1 - -/** - * IP_FRAG==1: Fragment outgoing IP packets if their size exceeds MTU. Note - * that this option does not affect incoming packet sizes, which can be - * controlled via IP_REASSEMBLY. - */ -#define IP_FRAG 1 - -/** - * IP_REASS_MAXAGE: Maximum time (in multiples of IP_TMR_INTERVAL - so seconds, normally) - * a fragmented IP packet waits for all fragments to arrive. If not all fragments arrived - * in this time, the whole packet is discarded. - */ -#define IP_REASS_MAXAGE 3 - -/** - * IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled. - * Since the received pbufs are enqueued, be sure to configure - * PBUF_POOL_SIZE > IP_REASS_MAX_PBUFS so that the stack is still able to receive - * packets even if the maximum amount of fragments is enqueued for reassembly! - */ -#define IP_REASS_MAX_PBUFS 10 - -/** - * IP_FRAG_USES_STATIC_BUF==1: Use a static MTU-sized buffer for IP - * fragmentation. Otherwise pbufs are allocated and reference the original - * packet data to be fragmented. - */ -#define IP_FRAG_USES_STATIC_BUF 0 - -/** - * IP_DEFAULT_TTL: Default value for Time-To-Live used by transport layers. - */ -#define IP_DEFAULT_TTL 255 - -/* - ---------------------------------- - ---------- ICMP options ---------- - ---------------------------------- -*/ -/** - * LWIP_ICMP==1: Enable ICMP module inside the IP stack. - * Be careful, disable that make your product non-compliant to RFC1122 - */ -#define LWIP_ICMP 1 - -/** - * ICMP_TTL: Default value for Time-To-Live used by ICMP packets. - */ -#define ICMP_TTL (IP_DEFAULT_TTL) - -/* - --------------------------------- - ---------- RAW options ---------- - --------------------------------- -*/ -/** - * LWIP_RAW==1: Enable application layer to hook into the IP layer itself. - */ -#define LWIP_RAW 0 - -/* - ---------------------------------- - ---------- DHCP options ---------- - ---------------------------------- -*/ -/** - * LWIP_DHCP==1: Enable DHCP module. - */ -#define LWIP_DHCP 0 - -/* - ------------------------------------ - ---------- AUTOIP options ---------- - ------------------------------------ -*/ -/** - * LWIP_AUTOIP==1: Enable AUTOIP module. - */ -#define LWIP_AUTOIP 0 - -/* - ---------------------------------- - ---------- SNMP options ---------- - ---------------------------------- -*/ -/** - * LWIP_SNMP==1: Turn on SNMP module. UDP must be available for SNMP - * transport. - */ -#define LWIP_SNMP 1 -#define SNMP_PRIVATE_MIB 1 - -/* - ---------------------------------- - ---------- IGMP options ---------- - ---------------------------------- -*/ -/** - * LWIP_IGMP==1: Turn on IGMP module. - */ -#define LWIP_IGMP 0 - -/* - ---------------------------------- - ---------- DNS options ----------- - ---------------------------------- -*/ -/** - * LWIP_DNS==1: Turn on DNS module. UDP must be available for DNS - * transport. - */ -#define LWIP_DNS 0 - -/* - --------------------------------- - ---------- UDP options ---------- - --------------------------------- -*/ -/** - * LWIP_UDP==1: Turn on UDP. - */ -#define LWIP_UDP 1 - -/** - * LWIP_UDPLITE==1: Turn on UDP-Lite. (Requires LWIP_UDP) - */ -#define LWIP_UDPLITE 0 - -/** - * UDP_TTL: Default Time-To-Live value. - */ -#define UDP_TTL (IP_DEFAULT_TTL) - -/* - --------------------------------- - ---------- TCP options ---------- - --------------------------------- -*/ -/** - * LWIP_TCP==1: Turn on TCP. - */ -#define LWIP_TCP 1 - -/* - ---------------------------------- - ---------- Pbuf options ---------- - ---------------------------------- -*/ -/** - * PBUF_LINK_HLEN: the number of bytes that should be allocated for a - * link level header. The default is 14, the standard value for - * Ethernet. - */ -#define PBUF_LINK_HLEN 16 - -/* - ------------------------------------ - ---------- LOOPIF options ---------- - ------------------------------------ -*/ -/** - * LWIP_HAVE_LOOPIF==1: Support loop interface (127.0.0.1) and loopif.c - */ -#define LWIP_HAVE_LOOPIF 0 - - -/* - ---------------------------------------------- - ---------- Sequential layer options ---------- - ---------------------------------------------- -*/ - -/** - * LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c) - */ -#define LWIP_NETCONN 0 - -/* - ------------------------------------ - ---------- Socket options ---------- - ------------------------------------ -*/ -/** - * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c) - */ -#define LWIP_SOCKET 0 - -/* - ---------------------------------------- - ---------- Statistics options ---------- - ---------------------------------------- -*/ -/** - * LWIP_STATS==1: Enable statistics collection in lwip_stats. - */ -#define LWIP_STATS 0 - -/* Misc */ - -#endif /* LWIP_LWIPOPTS_H */ diff --git a/contrib/ports/unix/proj/minimal/main.c b/contrib/ports/unix/proj/minimal/main.c deleted file mode 100644 index 2842482..0000000 --- a/contrib/ports/unix/proj/minimal/main.c +++ /dev/null @@ -1,247 +0,0 @@ -/* - * 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 - * RT timer modifications by Christiaan Simons - */ - -#include -#include - -#include "lwip/init.h" - -#include "lwip/debug.h" - -#include "lwip/mem.h" -#include "lwip/memp.h" -#include "lwip/sys.h" - -#include "lwip/stats.h" - -#include "lwip/ip.h" -#include "lwip/ip_frag.h" -#include "lwip/udp.h" -#include "lwip/snmp_msg.h" -#include "lwip/tcp_impl.h" -#include "mintapif.h" -#include "netif/etharp.h" - -#include "timer.h" -#include - -#include "echo.h" -#include "private_mib.h" - -/* (manual) host IP configuration */ -static ip_addr_t ipaddr, netmask, gw; - -/* SNMP trap destination cmd option */ -static unsigned char trap_flag; -static ip_addr_t trap_addr; - -/* nonstatic debug cmd option, exported in lwipopts.h */ -unsigned char debug_flags; - -/* 'non-volatile' SNMP settings - @todo: make these truly non-volatile */ -u8_t syscontact_str[255]; -u8_t syscontact_len = 0; -u8_t syslocation_str[255]; -u8_t syslocation_len = 0; -/* enable == 1, disable == 2 */ -u8_t snmpauthentraps_set = 2; - -static struct option longopts[] = { - /* turn on debugging output (if build with LWIP_DEBUG) */ - {"debug", no_argument, NULL, 'd'}, - /* help */ - {"help", no_argument, NULL, 'h'}, - /* gateway address */ - {"gateway", required_argument, NULL, 'g'}, - /* ip address */ - {"ipaddr", required_argument, NULL, 'i'}, - /* netmask */ - {"netmask", required_argument, NULL, 'm'}, - /* ping destination */ - {"trap_destination", required_argument, NULL, 't'}, - /* new command line options go here! */ - {NULL, 0, NULL, 0} -}; -#define NUM_OPTS ((sizeof(longopts) / sizeof(struct option)) - 1) - -static void usage(void) -{ - unsigned char i; - - printf("options:\n"); - for (i = 0; i < NUM_OPTS; i++) { - printf("-%c --%s\n",longopts[i].val, longopts[i].name); - } -} - -int -main(int argc, char **argv) -{ - struct netif netif; - sigset_t mask, oldmask, empty; - int ch; - char ip_str[16] = {0}, nm_str[16] = {0}, gw_str[16] = {0}; - - /* startup defaults (may be overridden by one or more opts) */ - IP4_ADDR(&gw, 192,168,0,1); - IP4_ADDR(&ipaddr, 192,168,0,2); - IP4_ADDR(&netmask, 255,255,255,0); - - trap_flag = 0; - /* use debug flags defined by debug.h */ - debug_flags = LWIP_DBG_OFF; - - while ((ch = getopt_long(argc, argv, "dhg:i:m:t:", longopts, NULL)) != -1) { - switch (ch) { - case 'd': - debug_flags |= (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT); - break; - case 'h': - usage(); - exit(0); - break; - case 'g': - ipaddr_aton(optarg, &gw); - break; - case 'i': - ipaddr_aton(optarg, &ipaddr); - break; - case 'm': - ipaddr_aton(optarg, &netmask); - break; - case 't': - trap_flag = !0; - /* @todo: remove this authentraps tweak - when we have proper SET & non-volatile mem */ - snmpauthentraps_set = 1; - ipaddr_aton(optarg, &trap_addr); - strncpy(ip_str, ipaddr_ntoa(&trap_addr),sizeof(ip_str)); - printf("SNMP trap destination %s\n", ip_str); - break; - default: - usage(); - break; - } - } - argc -= optind; - argv += optind; - - strncpy(ip_str, ipaddr_ntoa(&ipaddr), sizeof(ip_str)); - strncpy(nm_str, ipaddr_ntoa(&netmask), sizeof(nm_str)); - strncpy(gw_str, ipaddr_ntoa(&gw), sizeof(gw_str)); - printf("Host at %s mask %s gateway %s\n", ip_str, nm_str, gw_str); - - -#ifdef PERF - perf_init("/tmp/minimal.perf"); -#endif /* PERF */ - - lwip_init(); - - printf("TCP/IP initialized.\n"); - - netif_add(&netif, &ipaddr, &netmask, &gw, NULL, mintapif_init, ethernet_input); - netif_set_default(&netif); - netif_set_up(&netif); -#if LWIP_IPV6 - netif_create_ip6_linklocal_address(&netif, 1); -#endif - - -#if SNMP_PRIVATE_MIB != 0 - /* initialize our private example MIB */ - lwip_privmib_init(); -#endif - snmp_trap_dst_ip_set(0,&trap_addr); - snmp_trap_dst_enable(0,trap_flag); - snmp_set_syscontact(syscontact_str,&syscontact_len); - snmp_set_syslocation(syslocation_str,&syslocation_len); - snmp_set_snmpenableauthentraps(&snmpauthentraps_set); - snmp_init(); - - echo_init(); - - timer_init(); - timer_set_interval(TIMER_EVT_ETHARPTMR, ARP_TMR_INTERVAL / 10); - timer_set_interval(TIMER_EVT_TCPTMR, TCP_TMR_INTERVAL / 10); -#if IP_REASSEMBLY - timer_set_interval(TIMER_EVT_IPREASSTMR, IP_TMR_INTERVAL / 10); -#endif - - printf("Applications started.\n"); - - - while (1) { - - /* poll for input packet and ensure - select() or read() arn't interrupted */ - sigemptyset(&mask); - sigaddset(&mask, SIGALRM); - sigprocmask(SIG_BLOCK, &mask, &oldmask); - - /* start of critical section, - poll netif, pass packet to lwIP */ - if (mintapif_select(&netif) > 0) - { - /* work, immediatly end critical section - hoping lwIP ended quickly ... */ - sigprocmask(SIG_SETMASK, &oldmask, NULL); - } - else - { - /* no work, wait a little (10 msec) for SIGALRM */ - sigemptyset(&empty); - sigsuspend(&empty); - /* ... end critical section */ - sigprocmask(SIG_SETMASK, &oldmask, NULL); - } - - if(timer_testclr_evt(TIMER_EVT_TCPTMR)) - { - tcp_tmr(); - } -#if IP_REASSEMBLY - if(timer_testclr_evt(TIMER_EVT_IPREASSTMR)) - { - ip_reass_tmr(); - } -#endif - if(timer_testclr_evt(TIMER_EVT_ETHARPTMR)) - { - etharp_tmr(); - } - - } - - return 0; -} diff --git a/contrib/ports/unix/proj/minimal/mintapif.c b/contrib/ports/unix/proj/minimal/mintapif.c deleted file mode 100644 index 6241591..0000000 --- a/contrib/ports/unix/proj/minimal/mintapif.c +++ /dev/null @@ -1,382 +0,0 @@ -/*-----------------------------------------------------------------------------------*/ -/* - * 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 - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(linux) -#include -#include -#include -#define DEVTAP "/dev/net/tun" -#define IFCONFIG_ARGS "tap0 inet %d.%d.%d.%d" - -#elif defined(openbsd) -#define DEVTAP "/dev/tun0" -#define IFCONFIG_ARGS "tun0 inet %d.%d.%d.%d link0" - -#else /* freebsd, cygwin? */ -#define DEVTAP "/dev/tap0" -#define IFCONFIG_ARGS "tap0 inet %d.%d.%d.%d" -#endif - -#include "lwip/stats.h" -#include "lwip/snmp.h" -#include "lwip/mem.h" -#include "netif/etharp.h" - -#include "mintapif.h" - -/* Define those to better describe your network interface. */ -#define IFNAME0 'e' -#define IFNAME1 't' - -struct mintapif { - struct eth_addr *ethaddr; - /* Add whatever per-interface state that is needed here. */ - u32_t lasttime; - int fd; -}; - -/* Forward declarations. */ -static void mintapif_input(struct netif *netif); - -/*-----------------------------------------------------------------------------------*/ -static void -low_level_init(struct netif *netif) -{ - struct mintapif *mintapif; - char buf[1024]; - int ret; - - mintapif = (struct mintapif *)netif->state; - - /* Obtain MAC address from network interface. */ - mintapif->ethaddr->addr[0] = 1; - mintapif->ethaddr->addr[1] = 2; - mintapif->ethaddr->addr[2] = 3; - mintapif->ethaddr->addr[3] = 4; - mintapif->ethaddr->addr[4] = 5; - mintapif->ethaddr->addr[5] = 6; - - /* device capabilities */ - /* don't set NETIF_FLAG_ETHARP if this device is not an ethernet one */ - netif->flags |= NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP; - - /* Do whatever else is needed to initialize interface. */ - - mintapif->fd = open(DEVTAP, O_RDWR); - if (mintapif->fd == -1) { - perror("tapif: tapif_init: open"); - exit(1); - } - -#ifdef linux - { - struct ifreq ifr; - memset(&ifr, 0, sizeof(ifr)); - ifr.ifr_flags = IFF_TAP|IFF_NO_PI; - if (ioctl(mintapif->fd, TUNSETIFF, (void *) &ifr) < 0) { - perror(buf); - exit(1); - } - } -#endif /* Linux */ - - snprintf(buf, sizeof(buf), "/sbin/ifconfig " IFCONFIG_ARGS, - ip4_addr1(&(netif->gw)), - ip4_addr2(&(netif->gw)), - ip4_addr3(&(netif->gw)), - ip4_addr4(&(netif->gw))); - - ret = system(buf); - if (ret < 0) { - perror("ifconfig failed"); - exit(1); - } - if (ret != 0) { - printf("ifconfig returned %d\n", ret); - } - - mintapif->lasttime = 0; - -} -/*-----------------------------------------------------------------------------------*/ -/* - * 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 *netif, struct pbuf *p) -{ - struct mintapif *mintapif; - struct pbuf *q; - char buf[1514]; - char *bufptr; - int written; - - mintapif = (struct mintapif *)netif->state; - - /* initiate transfer(); */ - - bufptr = &buf[0]; - - 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); */ - memcpy(bufptr, q->payload, q->len); - bufptr += q->len; - } - - /* signal that packet should be sent(); */ - written = write(mintapif->fd, buf, p->tot_len); - if (written == -1) { - snmp_inc_ifoutdiscards(netif); - perror("tapif: write"); - } - else { - snmp_add_ifoutoctets(netif, written); - } - 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 *netif) -{ - struct pbuf *p, *q; - u16_t len; - char buf[1514]; - char *bufptr; - struct mintapif *mintapif; - - mintapif = (struct mintapif *)netif->state; - - /* Obtain the size of the packet and put it into the "len" - variable. */ - len = read(mintapif->fd, buf, sizeof(buf)); - snmp_add_ifinoctets(netif,len); - - /* if (((double)rand()/(double)RAND_MAX) < 0.1) { - printf("drop\n"); - return NULL; - }*/ - - /* We allocate a pbuf chain of pbufs from the pool. */ - p = pbuf_alloc(PBUF_LINK, len, PBUF_POOL); - - if (p != NULL) { - /* We iterate over the pbuf chain until we have read the entire - packet into the pbuf. */ - bufptr = &buf[0]; - for(q = p; q != NULL; q = q->next) { - /* Read enough bytes to fill this pbuf in the chain. The - available data in the pbuf is given by the q->len - variable. */ - /* read data into(q->payload, q->len); */ - memcpy(q->payload, bufptr, q->len); - bufptr += q->len; - } - /* acknowledge that packet has been read(); */ - } else { - /* drop packet(); */ - snmp_inc_ifindiscards(netif); - printf("Could not allocate pbufs\n"); - } - - return p; -} -/*-----------------------------------------------------------------------------------*/ -/* - * mintapif_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 -mintapif_input(struct netif *netif) -{ - struct pbuf *p; - - p = low_level_input(netif); - if (p != NULL) { -#if LINK_STATS - lwip_stats.link.recv++; -#endif /* LINK_STATS */ - - netif->input(p, netif); - } -} -/*-----------------------------------------------------------------------------------*/ -/* - * mintapif_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. - * - */ -/*-----------------------------------------------------------------------------------*/ -err_t -mintapif_init(struct netif *netif) -{ - struct mintapif *mintapif; - - mintapif = (struct mintapif *)mem_malloc(sizeof(struct mintapif)); - if (mintapif == NULL) - { - LWIP_DEBUGF(NETIF_DEBUG, ("cs8900_init: out of memory for mintapif\n")); - return ERR_MEM; - } - netif->state = mintapif; -#if LWIP_SNMP - /* ifType is other(1), there doesn't seem - to be a proper type for the tunnel if */ - netif->link_type = 1; - /* @todo get this from struct tunif? */ - netif->link_speed = 0; - netif->ts = 0; - netif->ifinoctets = 0; - netif->ifinucastpkts = 0; - netif->ifinnucastpkts = 0; - netif->ifindiscards = 0; - netif->ifoutoctets = 0; - netif->ifoutucastpkts = 0; - netif->ifoutnucastpkts = 0; - netif->ifoutdiscards = 0; -#endif - - netif->hwaddr_len = 6; - netif->name[0] = IFNAME0; - netif->name[1] = IFNAME1; - netif->output = etharp_output; - netif->linkoutput = low_level_output; - netif->mtu = 1500; - - mintapif->ethaddr = (struct eth_addr *)&(netif->hwaddr[0]); - - low_level_init(netif); - - return ERR_OK; -} -/*-----------------------------------------------------------------------------------*/ -enum mintapif_signal -mintapif_wait(struct netif *netif, u16_t time) -{ - fd_set fdset; - struct timeval tv, now; - struct timezone tz; - int ret; - struct mintapif *mintapif; - - mintapif = (struct mintapif *)netif->state; - - while (1) { - - if (mintapif->lasttime >= (u32_t)time * 1000) { - mintapif->lasttime = 0; - return MINTAPIF_TIMEOUT; - } - - tv.tv_sec = 0; - tv.tv_usec = (u32_t)time * 1000 - mintapif->lasttime; - - - FD_ZERO(&fdset); - FD_SET(mintapif->fd, &fdset); - - gettimeofday(&now, &tz); - ret = select(mintapif->fd + 1, &fdset, NULL, NULL, &tv); - if (ret == 0) { - mintapif->lasttime = 0; - return MINTAPIF_TIMEOUT; - } - gettimeofday(&tv, &tz); - mintapif->lasttime += (tv.tv_sec - now.tv_sec) * 1000000 + (tv.tv_usec - now.tv_usec); - - mintapif_input(netif); - } - - return MINTAPIF_PACKET; -} - -int -mintapif_select(struct netif *netif) -{ - fd_set fdset; - int ret; - struct timeval tv; - struct mintapif *mintapif; - - mintapif = (struct mintapif *)netif->state; - - tv.tv_sec = 0; - tv.tv_usec = 0; /* usec_to; */ - - FD_ZERO(&fdset); - FD_SET(mintapif->fd, &fdset); - - ret = select(mintapif->fd + 1, &fdset, NULL, NULL, &tv); - if (ret > 0) { - mintapif_input(netif); - } - return ret; -} diff --git a/contrib/ports/unix/proj/minimal/mintapif.h b/contrib/ports/unix/proj/minimal/mintapif.h deleted file mode 100644 index d186f83..0000000 --- a/contrib/ports/unix/proj/minimal/mintapif.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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 - * - */ -#ifndef LWIP_MINTAPIF_H -#define LWIP_MINTAPIF_H - -#include "lwip/netif.h" - -enum mintapif_signal { - MINTAPIF_TIMEOUT, - MINTAPIF_PACKET -}; - -err_t mintapif_init(struct netif *netif); -int mintapif_select(struct netif *netif); -enum mintapif_signal mintapif_wait(struct netif *netif, u16_t time); - -#endif /* LWIP_MINTAPIF_H */ diff --git a/contrib/ports/unix/proj/minimal/timer.c b/contrib/ports/unix/proj/minimal/timer.c deleted file mode 100644 index 9f14e32..0000000 --- a/contrib/ports/unix/proj/minimal/timer.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2006 Christiaan Simons. - * 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 and a contribution to the lwIP TCP/IP stack. - * - * Author: Christiaan Simons - */ - -/** - * @file - * Simple pre-allocated interval (reload) timers. - * @see timer.h - */ - -#include -#include -#include -#include "timer.h" -#include "lwip/snmp.h" - -static struct itimerval tmr; - -struct itmr -{ - volatile unsigned int interval; - volatile unsigned int cnt; - volatile unsigned char event; -}; - -static struct itmr timers[TIMER_NUM]; - - -void sigalarm_handler(int sig); - -/** - * Initializes interval timers. - */ -void -timer_init(void) -{ - unsigned char i; - struct itmr *tp; - - tp = &timers[TIMER_NUM-1]; - for(i = TIMER_NUM; i > 0; i--) - { - tp->event = 0; - tp->interval = 0; - tp->cnt = 0; - tp--; - } - - signal(SIGALRM,sigalarm_handler); - - /* timer reload is in 10msec steps */ - tmr.it_interval.tv_sec = 0; - tmr.it_interval.tv_usec = 10000; - /* set to half period (enables timer) */ - tmr.it_value.tv_sec = 0; - tmr.it_value.tv_usec = 5000; - - setitimer(ITIMER_REAL,&tmr,NULL); -} - -/** - * Configures timer. - * - * @param tmr the timer number from timer.h - * @param interval when > 0 enables this timer, 0 disables. - */ -void -timer_set_interval(unsigned char tmr_num, unsigned int interval) -{ - if (tmr_num < TIMER_NUM) - { - timers[tmr_num].interval = interval; - } -} - - -/** - * Returns timer event and restarts timer. - */ -unsigned char -timer_testclr_evt(unsigned char tmr_num) -{ - if (tmr_num < TIMER_NUM) - { - unsigned char evt; - struct itmr *tp; - - tp = &timers[tmr_num]; - - evt = tp->event; - if (tp->event != 0) - { - tp->event = 0; - tp->cnt = tp->interval; - } - return evt; - } - else - { - return 0; - } -} - -/** - * interrupting (!) sigalarm handler - */ -void -sigalarm_handler(int sig) -{ - unsigned char i; - struct itmr *tp; - LWIP_UNUSED_ARG(sig); - - snmp_inc_sysuptime(); - - tp = &timers[TIMER_NUM-1]; - for(i = TIMER_NUM; i > 0; i--) - { - if (tp->interval != 0) - { - /* timer is running */ - if (tp->cnt == 0) - { - /* timer expired */ - tp->event |= 1; - } - else - { - /* timer ticking */ - tp->cnt--; - } - } - tp--; - } -} - diff --git a/contrib/ports/unix/proj/minimal/timer.h b/contrib/ports/unix/proj/minimal/timer.h deleted file mode 100644 index bdad881..0000000 --- a/contrib/ports/unix/proj/minimal/timer.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef LWIP_TIMER_H_ -#define LWIP_TIMER_H_ - -#define TIMER_EVT_ETHARPTMR 0 -#define TIMER_EVT_TCPTMR 1 -#define TIMER_EVT_IPREASSTMR 2 -#define TIMER_NUM 3 - -void timer_init(void); -void timer_set_interval(unsigned char tmr, unsigned int interval); -unsigned char timer_testclr_evt(unsigned char tmr); - -#endif diff --git a/contrib/ports/unix/proj/unixsim/Makefile b/contrib/ports/unix/proj/unixsim/Makefile deleted file mode 100644 index b0f6975..0000000 --- a/contrib/ports/unix/proj/unixsim/Makefile +++ /dev/null @@ -1,147 +0,0 @@ -# -# 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 -# - -CCDEP=gcc -CC=gcc - -#To compile for linux: make ARCH=linux -#To compile for cygwin: make ARCH=cygwin -ARCH=unix -CFLAGS=-g -Wall -D$(ARCH) -DIPv4 -DLWIP_DEBUG -pedantic -Werror \ - -Wparentheses -Wsequence-point -Wswitch-default \ - -Wextra -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast \ - -Wc++-compat -Wwrite-strings -Wold-style-definition \ - -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Wno-address -# not used for now but interesting: -# -Wpacked -# -Wunreachable-code -# -ansi -# -std=c89 -LDFLAGS=-pthread -lutil -CONTRIBDIR=../../../.. -LWIPARCH=$(CONTRIBDIR)/ports/unix -ARFLAGS=rs - -#Set this to where you have the lwip core module checked out from CVS -#default assumes it's a dir named lwip at the same level as the contrib module -LWIPDIR=$(CONTRIBDIR)/../lwip/src - -CFLAGS:=$(CFLAGS) \ - -I. -I$(CONTRIBDIR)/apps/httpserver_raw -I$(CONTRIBDIR)/apps/shell \ - -I$(CONTRIBDIR)/apps/tcpecho -I$(CONTRIBDIR)/apps/udpecho \ - -I$(LWIPDIR)/include -I$(LWIPARCH)/include -I$(LWIPDIR)/include/ipv4 \ - -I$(LWIPDIR)/include/ipv6 -I$(LWIPDIR) - -# COREFILES, CORE4FILES: The minimum set of files needed for lwIP. -COREFILES=$(LWIPDIR)/core/def.c $(LWIPDIR)/core/dhcp.c $(LWIPDIR)/core/dns.c \ - $(LWIPDIR)/core/inet_chksum.c $(LWIPDIR)/core/init.c $(LWIPDIR)/core/mem.c \ - $(LWIPDIR)/core/memp.c $(LWIPDIR)/core/netif.c $(LWIPDIR)/core/pbuf.c \ - $(LWIPDIR)/core/raw.c $(LWIPDIR)/core/stats.c $(LWIPDIR)/core/sys.c \ - $(LWIPDIR)/core/tcp.c $(LWIPDIR)/core/tcp_in.c $(LWIPDIR)/core/tcp_in.c \ - $(LWIPDIR)/core/tcp_out.c $(LWIPDIR)/core/timers.c $(LWIPDIR)/core/udp.c -CORE4FILES=$(LWIPDIR)/core/ipv4/autoip.c $(LWIPDIR)/core/ipv4/icmp.c \ - $(LWIPDIR)/core/ipv4/igmp.c $(LWIPDIR)/core/ipv4/ip_frag.c \ - $(LWIPDIR)/core/ipv4/ip4.c $(LWIPDIR)/core/ipv4/ip4_addr.c -CORE6FILES=$(LWIPDIR)/core/ipv6/dhcp6.c $(LWIPDIR)/core/ipv6/ethip6.c \ - $(LWIPDIR)/core/ipv6/icmp6.c $(LWIPDIR)/core/ipv6/ip6.c \ - $(LWIPDIR)/core/ipv6/ip6_addr.c $(LWIPDIR)/core/ipv6/ip6_frag.c \ - $(LWIPDIR)/core/ipv6/mld6.c $(LWIPDIR)/core/ipv6/nd6.c - -# SNMPFILES: Extra SNMPv1 agent -SNMPFILES=$(LWIPDIR)/core/snmp/asn1_dec.c $(LWIPDIR)/core/snmp/asn1_enc.c \ - $(LWIPDIR)/core/snmp/mib2.c $(LWIPDIR)/core/snmp/mib_structs.c \ - $(LWIPDIR)/core/snmp/msg_in.c $(LWIPDIR)/core/snmp/msg_out.c - -# APIFILES: The files which implement the sequential and socket APIs. -APIFILES=$(LWIPDIR)/api/api_lib.c $(LWIPDIR)/api/api_msg.c $(LWIPDIR)/api/err.c \ - $(LWIPDIR)/api/netbuf.c $(LWIPDIR)/api/netdb.c $(LWIPDIR)/api/netifapi.c \ - $(LWIPDIR)/api/sockets.c $(LWIPDIR)/api/tcpip.c - -# NETIFFILES: Files implementing various generic network interface functions.' -NETIFFILES=$(LWIPDIR)/netif/etharp.c $(LWIPDIR)/netif/slipif.c - -# NETIFFILES: Add PPP netif -NETIFFILES+=$(LWIPDIR)/netif/ppp/auth.c $(LWIPDIR)/netif/ppp/chap.c \ - $(LWIPDIR)/netif/ppp/chpms.c $(LWIPDIR)/netif/ppp/fsm.c \ - $(LWIPDIR)/netif/ppp/ipcp.c $(LWIPDIR)/netif/ppp/lcp.c \ - $(LWIPDIR)/netif/ppp/magic.c $(LWIPDIR)/netif/ppp/md5.c \ - $(LWIPDIR)/netif/ppp/pap.c $(LWIPDIR)/netif/ppp/ppp.c \ - $(LWIPDIR)/netif/ppp/randm.c $(LWIPDIR)/netif/ppp/vj.c \ - $(LWIPARCH)/netif/sio.c - -# ARCHFILES: Architecture specific files. -ARCHFILES=$(wildcard $(LWIPARCH)/*.c $(LWIPARCH)/netif/tapif.c $(LWIPARCH)/netif/tunif.c $(LWIPARCH)/netif/unixif.c $(LWIPARCH)/netif/list.c $(LWIPARCH)/netif/tcpdump.c) - -# APPFILES: Applications. -APPFILES=$(CONTRIBDIR)/apps/httpserver_raw/fs.c $(CONTRIBDIR)/apps/httpserver_raw/httpd.c \ - $(CONTRIBDIR)/apps/udpecho/udpecho.c $(CONTRIBDIR)/apps/tcpecho/tcpecho.c \ - $(CONTRIBDIR)/apps/shell/shell.c - -# LWIPFILES: All the above. -LWIPFILES=$(COREFILES) $(CORE4FILES) $(CORE6FILES) $(SNMPFILES) $(APIFILES) $(NETIFFILES) $(ARCHFILES) -LWIPFILESW=$(wildcard $(LWIPFILES)) -LWIPOBJS=$(notdir $(LWIPFILESW:.c=.o)) - -LWIPLIB=liblwip4.a -APPLIB=liblwipapps.a -APPOBJS=$(notdir $(APPFILES:.c=.o)) - -%.o: - $(CC) $(CFLAGS) -c $(<:.o=.c) - -all ipv4 compile: simhost -.PHONY: all - -clean: - rm -f *.o $(LWIPLIB) $(APPLIB) simhost simnode simrouter *.s .depend* *.core core - -depend dep: .depend - -include .depend - -$(APPLIB): $(APPOBJS) - $(AR) $(ARFLAGS) $(APPLIB) $? - -$(LWIPLIB): $(LWIPOBJS) - $(AR) $(ARFLAGS) $(LWIPLIB) $? - -.depend: simhost.c simnode.c simrouter.c $(LWIPFILES) $(APPFILES) - $(CCDEP) $(CFLAGS) -MM $^ > .depend || rm -f .depend - -simhost: .depend $(LWIPLIB) $(APPLIB) simhost.o $(APPFILES) - $(CC) $(CFLAGS) $(LDFLAGS) -o simhost simhost.o $(APPLIB) $(LWIPLIB) - -simrouter: .depend $(LWIPLIB) $(APPLIB) simrouter.o - $(CC) $(CFLAGS) $(LDFLAGS) -o simrouter simrouter.o $(APPLIB) $(LWIPLIB) - -simnode: .depend $(LWIPLIB) $(APPLIB) simnode.o - $(CC) $(CFLAGS) $(LDFLAGS) -o simnode simnode.o $(APPLIB) $(LWIPLIB) - diff --git a/contrib/ports/unix/proj/unixsim/README b/contrib/ports/unix/proj/unixsim/README deleted file mode 100644 index 949c917..0000000 --- a/contrib/ports/unix/proj/unixsim/README +++ /dev/null @@ -1,61 +0,0 @@ -This directory contains an example of how a project using lwIP might -look. It is also the development platform of lwIP, since it can be run -as a user process under FreeBSD or Linux. There are also a number of -example applications (including a simple web server) in the apps/ -directory. - -Some short instructions on how to build and run lwIP on a FreeBSD or -Linux host. For FreeBSD, the tap interface must be enabled in the -kernel configuration and the kernel must be recompiled. The tap -interface is enabled by adding the line "pseudo-device tap" in the -kernel configuration. See Chapter 9 in the FreeBSD handbook for -instructions on how to build a custom FreeBSD kernel. - -For Linux you might need to create a device node with - - > mknod /dev/net/tun c 10 200 - -* Compile the code. This must be done by using GNU Make. Under - FreeBSD, GNU Make can be found in the ports collection under - /usr/ports/devel/gmake (type "make install distclean" to - install). Under Linux, GNU Make is the default "make". - - > gmake (FreeBSD) - - > make (Linux) - -* The compilation process produces the executable file "simhost". To - run this, you have to be root. - - > su (Type password for the root account) - # ./simhost - -* The lwIP TCP/IP stack is now running with IP address - 192.168.0.2. Some things that you can try: - - To see the packets that are going to and from the lwIP stack, run - tcpdump: - - # tcpdump -l -n -i tap0 - - You can ping lwIP: - - > ping 192.168.0.2 - - For a telnet shell, run: - - > telnet 192.168.0.2 - - Finally, "simhost" also includes a simple web server; the URL is - of course http://192.168.0.2/. - -* Simhost has some extra features that can be - selected with command line options. - - To enable runtime debug output (project must be build with -DLWIP_DEBUG): - - # ./simhost -d - - To ping any host, e.g. the gateway: - - # ./simhost -p 192.168.0.1 diff --git a/contrib/ports/unix/proj/unixsim/lwipopts.h b/contrib/ports/unix/proj/unixsim/lwipopts.h deleted file mode 100644 index dce211f..0000000 --- a/contrib/ports/unix/proj/unixsim/lwipopts.h +++ /dev/null @@ -1,311 +0,0 @@ -/* - * 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 - * - */ -#ifndef LWIP_LWIPOPTS_H -#define LWIP_LWIPOPTS_H - -#define LWIP_DBG_MIN_LEVEL 0 -#define LWIP_COMPAT_SOCKETS 1 -#define TAPIF_DEBUG LWIP_DBG_ON -#define TUNIF_DEBUG LWIP_DBG_OFF -#define UNIXIF_DEBUG LWIP_DBG_OFF -#define DELIF_DEBUG LWIP_DBG_OFF -#define SIO_FIFO_DEBUG LWIP_DBG_OFF -#define TCPDUMP_DEBUG LWIP_DBG_ON - -#define PPP_DEBUG LWIP_DBG_OFF -#define MEM_DEBUG LWIP_DBG_OFF -#define MEMP_DEBUG LWIP_DBG_OFF -#define PBUF_DEBUG LWIP_DBG_OFF -#define API_LIB_DEBUG LWIP_DBG_ON -#define API_MSG_DEBUG LWIP_DBG_ON -#define TCPIP_DEBUG LWIP_DBG_ON -#define NETIF_DEBUG LWIP_DBG_ON -#define SOCKETS_DEBUG LWIP_DBG_ON -#define DEMO_DEBUG LWIP_DBG_ON -#define IP_DEBUG LWIP_DBG_ON -#define IP_REASS_DEBUG LWIP_DBG_ON -#define RAW_DEBUG LWIP_DBG_ON -#define ICMP_DEBUG LWIP_DBG_ON -#define UDP_DEBUG LWIP_DBG_ON -#define TCP_DEBUG LWIP_DBG_ON -#define TCP_INPUT_DEBUG LWIP_DBG_ON -#define TCP_OUTPUT_DEBUG LWIP_DBG_ON -#define TCP_RTO_DEBUG LWIP_DBG_ON -#define TCP_CWND_DEBUG LWIP_DBG_ON -#define TCP_WND_DEBUG LWIP_DBG_ON -#define TCP_FR_DEBUG LWIP_DBG_ON -#define TCP_QLEN_DEBUG LWIP_DBG_ON -#define TCP_RST_DEBUG LWIP_DBG_ON - -extern unsigned char debug_flags; -#define LWIP_DBG_TYPES_ON debug_flags - -#define NO_SYS 0 -#define LWIP_SOCKET (NO_SYS==0) -#define LWIP_NETCONN (NO_SYS==0) - - -/* ---------- 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. */ -/* MSVC port: intel processors don't need 4-byte alignment, - but are faster that way! */ -#define MEM_ALIGNMENT 4 - -/* 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 10240 - -/* 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_RAW_PCB: the number of UDP protocol control blocks. One - per active RAW "connection". */ -#define MEMP_NUM_RAW_PCB 3 -/* 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 10 -/* MEMP_NUM_TCPIP_MSG_*: 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_API 16 -#define MEMP_NUM_TCPIP_MSG_INPKT 16 - -/* ---------- Pbuf options ---------- */ -/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */ -#define PBUF_POOL_SIZE 120 - -/* 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 - -/** SYS_LIGHTWEIGHT_PROT - * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection - * for certain critical regions during buffer allocation, deallocation and memory - * allocation and deallocation. - */ -#define SYS_LIGHTWEIGHT_PROT 1 - -/* ---------- 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 1024 - -/* TCP sender buffer space (bytes). */ -#define TCP_SND_BUF 2048 - -/* 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 writable space (bytes). This must be less than or equal - to TCP_SND_BUF. It is the amount of space which must be - available in the tcp snd_buf for select to return writable */ -#define TCP_SNDLOWAT (TCP_SND_BUF/2) - -/* TCP receive window. */ -#define TCP_WND 8096 - -/* 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 LWIP_ARP 1 -#define ARP_TABLE_SIZE 10 -#define ARP_QUEUEING 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 - - -/* IP reassembly and segmentation.These are orthogonal even - * if they both deal with IP fragments */ -#define IP_REASSEMBLY 1 -#define IP_REASS_MAX_PBUFS 10 -#define MEMP_NUM_REASSDATA 10 -#define IP_FRAG 1 - -/* ---------- ICMP options ---------- */ -#define ICMP_TTL 255 - -/* ---------- DHCP options ---------- */ -/* Define LWIP_DHCP to 1 if you want DHCP configuration of - interfaces. */ -#define LWIP_DHCP 0 - -/* 1 if you want to do an ARP check on the offered address - (recommended if using DHCP). */ -#define DHCP_DOES_ARP_CHECK (LWIP_DHCP) - -/* ---------- AUTOIP options ------- */ -#define LWIP_AUTOIP 0 - -/* ---------- SNMP options ---------- */ -/** @todo SNMP is experimental for now - @note UDP must be available for SNMP transport */ -#ifndef LWIP_SNMP -#define LWIP_SNMP 0 -#endif - -#ifndef SNMP_PRIVATE_MIB -#define SNMP_PRIVATE_MIB 0 -#endif - -/* ---------- UDP options ---------- */ -#define LWIP_UDP 1 -#define UDP_TTL 255 - -/* ---------- RAW options ---------- */ -#define LWIP_RAW 1 -#define RAW_TTL 255 - -/* ---------- Statistics options ---------- */ -/* individual STATS options can be turned off by defining them to 0 - * (e.g #define TCP_STATS 0). All of them are turned off if LWIP_STATS - * is 0 - * */ - -#define LWIP_STATS 1 - -/* ---------- PPP options ---------- */ - -#define PPP_SUPPORT 0 /* Set > 0 for PPP */ - -#if PPP_SUPPORT > 0 - -#define NUM_PPP 1 /* Max PPP sessions. */ - - -/* Select modules to enable. Ideally these would be set in the makefile but - * we're limited by the command line length so you need to modify the settings - * in this file. - */ -#define PAP_SUPPORT 1 /* Set > 0 for PAP. */ -#define CHAP_SUPPORT 1 /* Set > 0 for CHAP. */ -#define MSCHAP_SUPPORT 0 /* Set > 0 for MSCHAP (NOT FUNCTIONAL!) */ -#define CBCP_SUPPORT 0 /* Set > 0 for CBCP (NOT FUNCTIONAL!) */ -#define CCP_SUPPORT 0 /* Set > 0 for CCP (NOT FUNCTIONAL!) */ -#define VJ_SUPPORT 1 /* Set > 0 for VJ header compression. */ -#define MD5_SUPPORT 1 /* Set > 0 for MD5 (see also CHAP) */ - - -/* - * Timeouts. - */ -#define FSM_DEFTIMEOUT 6 /* Timeout time in seconds */ -#define FSM_DEFMAXTERMREQS 2 /* Maximum Terminate-Request transmissions */ -#define FSM_DEFMAXCONFREQS 10 /* Maximum Configure-Request transmissions */ -#define FSM_DEFMAXNAKLOOPS 5 /* Maximum number of nak loops */ - -#define UPAP_DEFTIMEOUT 6 /* Timeout (seconds) for retransmitting req */ -#define UPAP_DEFREQTIME 30 /* Time to wait for auth-req from peer */ - -#define CHAP_DEFTIMEOUT 6 /* Timeout time in seconds */ -#define CHAP_DEFTRANSMITS 10 /* max # times to send challenge */ - - -/* Interval in seconds between keepalive echo requests, 0 to disable. */ -#if 1 -#define LCP_ECHOINTERVAL 0 -#else -#define LCP_ECHOINTERVAL 10 -#endif - -/* Number of unanswered echo requests before failure. */ -#define LCP_MAXECHOFAILS 3 - -/* Max Xmit idle time (in jiffies) before resend flag char. */ -#define PPP_MAXIDLEFLAG 100 - -/* - * Packet sizes - * - * Note - lcp shouldn't be allowed to negotiate stuff outside these - * limits. See lcp.h in the pppd directory. - * (XXX - these constants should simply be shared by lcp.c instead - * of living in lcp.h) - */ -#define PPP_MTU 1500 /* Default MTU (size of Info field) */ -#if 0 -#define PPP_MAXMTU 65535 - (PPP_HDRLEN + PPP_FCSLEN) -#else -#define PPP_MAXMTU 1500 /* Largest MTU we allow */ -#endif -#define PPP_MINMTU 64 -#define PPP_MRU 1500 /* default MRU = max length of info field */ -#define PPP_MAXMRU 1500 /* Largest MRU we allow */ -#define PPP_DEFMRU 296 /* Try for this */ -#define PPP_MINMRU 128 /* No MRUs below this */ - - -#define MAXNAMELEN 256 /* max length of hostname or name for auth */ -#define MAXSECRETLEN 256 /* max length of password or secret */ - -#endif /* PPP_SUPPORT > 0 */ - -#endif /* LWIP_LWIPOPTS_H */ diff --git a/contrib/ports/unix/proj/unixsim/simhost.c b/contrib/ports/unix/proj/unixsim/simhost.c deleted file mode 100644 index 786c1e8..0000000 --- a/contrib/ports/unix/proj/unixsim/simhost.c +++ /dev/null @@ -1,498 +0,0 @@ -/* - * 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 - * - */ - -#include -#include -#include - -#include "lwip/opt.h" - -#include "lwip/init.h" - -#include "lwip/mem.h" -#include "lwip/memp.h" -#include "lwip/sys.h" - -#include "lwip/stats.h" - -#include "lwip/tcp_impl.h" -#include "lwip/inet_chksum.h" - -#include "lwip/tcpip.h" -#include "lwip/sockets.h" - -#include "netif/tapif.h" -#include "netif/tunif.h" - -#include "netif/unixif.h" -#include "netif/dropif.h" -#include "netif/pcapif.h" - -#include "netif/tcpdump.h" - -#if PPP_SUPPORT -#include "netif/ppp/ppp.h" -#define PPP_PTY_TEST 1 -#include -#endif - -#include "lwip/ip_addr.h" -#include "arch/perf.h" - -#include "httpd.h" -#include "udpecho.h" -#include "tcpecho.h" -#include "shell.h" - -#if LWIP_RAW -#include "lwip/icmp.h" -#include "lwip/raw.h" -#endif - -/* (manual) host IP configuration */ -static ip_addr_t ipaddr, netmask, gw; - -/* ping out destination cmd option */ -static unsigned char ping_flag; -static ip_addr_t ping_addr; - -/* nonstatic debug cmd option, exported in lwipopts.h */ -unsigned char debug_flags; - -/** @todo add options for selecting netif, starting DHCP client etc */ -static struct option longopts[] = { - /* turn on debugging output (if build with LWIP_DEBUG) */ - {"debug", no_argument, NULL, 'd'}, - /* help */ - {"help", no_argument, NULL, 'h'}, - /* gateway address */ - {"gateway", required_argument, NULL, 'g'}, - /* ip address */ - {"ipaddr", required_argument, NULL, 'i'}, - /* netmask */ - {"netmask", required_argument, NULL, 'm'}, - /* ping destination */ - {"ping", required_argument, NULL, 'p'}, - /* new command line options go here! */ - {NULL, 0, NULL, 0} -}; -#define NUM_OPTS ((sizeof(longopts) / sizeof(struct option)) - 1) - -static void init_netifs(void); - -static void usage(void) -{ - unsigned char i; - - printf("options:\n"); - for (i = 0; i < NUM_OPTS; i++) { - printf("-%c --%s\n",longopts[i].val, longopts[i].name); - } -} - -#if 0 -static void -tcp_debug_timeout(void *data) -{ - LWIP_UNUSED_ARG(data); -#if TCP_DEBUG - tcp_debug_print_pcbs(); -#endif /* TCP_DEBUG */ - sys_timeout(5000, tcp_debug_timeout, NULL); -} -#endif - -static void -tcpip_init_done(void *arg) -{ - sys_sem_t *sem; - sem = (sys_sem_t *)arg; - - init_netifs(); - - sys_sem_signal(sem); -} - -#if PPP_SUPPORT -void -pppLinkStatusCallback(void *ctx, int errCode, void *arg) -{ - switch(errCode) { - case PPPERR_NONE: /* No error. */ - { - struct ppp_addrs *ppp_addrs = arg; - - printf("pppLinkStatusCallback: PPPERR_NONE"); - printf(" our_ipaddr=%s", _inet_ntoa(ppp_addrs->our_ipaddr.addr)); - printf(" his_ipaddr=%s", _inet_ntoa(ppp_addrs->his_ipaddr.addr)); - printf(" netmask=%s", _inet_ntoa(ppp_addrs->netmask.addr)); - printf(" dns1=%s", _inet_ntoa(ppp_addrs->dns1.addr)); - printf(" dns2=%s\n", _inet_ntoa(ppp_addrs->dns2.addr)); - } - break; - - case PPPERR_PARAM: /* Invalid parameter. */ - printf("pppLinkStatusCallback: PPPERR_PARAM\n"); - break; - - case PPPERR_OPEN: /* Unable to open PPP session. */ - printf("pppLinkStatusCallback: PPPERR_OPEN\n"); - break; - - case PPPERR_DEVICE: /* Invalid I/O device for PPP. */ - printf("pppLinkStatusCallback: PPPERR_DEVICE\n"); - break; - - case PPPERR_ALLOC: /* Unable to allocate resources. */ - printf("pppLinkStatusCallback: PPPERR_ALLOC\n"); - break; - - case PPPERR_USER: /* User interrupt. */ - printf("pppLinkStatusCallback: PPPERR_USER\n"); - break; - - case PPPERR_CONNECT: /* Connection lost. */ - printf("pppLinkStatusCallback: PPPERR_CONNECT\n"); - break; - - case PPPERR_AUTHFAIL: /* Failed authentication challenge. */ - printf("pppLinkStatusCallback: PPPERR_AUTHFAIL\n"); - break; - - case PPPERR_PROTOCOL: /* Failed to meet protocol. */ - printf("pppLinkStatusCallback: PPPERR_PROTOCOL\n"); - break; - - default: - printf("pppLinkStatusCallback: unknown errCode %d\n", errCode); - break; - } -} -#endif - -/*-----------------------------------------------------------------------------------*/ -/*-----------------------------------------------------------------------------------*/ -#if LWIP_RAW - -static int seq_num; - -#if 0 -/* Ping using the raw api */ -static int -ping_recv(void *arg, struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *addr) -{ - printf("ping recv\n"); - return 1; /* eat the event */ -} - -static void -ping_send(struct raw_pcb *raw, ip_addr_t *addr) -{ - struct pbuf *p; - struct icmp_echo_hdr *iecho; - - p = pbuf_alloc(PBUF_IP,sizeof(struct icmp_echo_hdr),PBUF_RAM); - if (!p) return; - - iecho = p->payload; - ICMPH_TYPE_SET(iecho,ICMP_ECHO); - iecho->chksum = 0; - iecho->seqno = htons(seq_num); - - iecho->chksum = inet_chksum(iecho, p->len); - raw_send_to(raw,p,addr); - - pbuf_free(p); - - seq_num++; -} - -static void -ping_thread(void *arg) -{ - struct raw_pcb *raw; - - if (!(raw = raw_new(IP_PROTO_ICMP))) return; - - raw_recv(raw,ping_recv,NULL); - - while (1) - { - printf("ping send\n"); - ping_send(raw,&ping_addr); - sleep(1); - } - /* Never reaches this */ - raw_remove(raw); -} -#else -/* Ping using the socket api */ - -static void -ping_send(int s, ip_addr_t *addr) -{ - struct icmp_echo_hdr *iecho; - struct sockaddr_in to; - - if (!(iecho = (struct icmp_echo_hdr *)malloc(sizeof(struct icmp_echo_hdr)))) - return; - - ICMPH_TYPE_SET(iecho,ICMP_ECHO); - iecho->chksum = 0; - iecho->seqno = htons(seq_num); - iecho->chksum = inet_chksum(iecho, sizeof(*iecho)); - - to.sin_len = sizeof(to); - to.sin_family = AF_INET; - to.sin_addr.s_addr = addr->addr; - - lwip_sendto(s,iecho,sizeof(*iecho),0,(struct sockaddr*)&to,sizeof(to)); - - free(iecho); - seq_num++; -} - -static void -ping_recv(int s, ip_addr_t *addr) -{ - char buf[200]; - socklen_t fromlen; - int len; - struct sockaddr_in from; - LWIP_UNUSED_ARG(addr); - - len = lwip_recvfrom(s, buf,sizeof(buf),0,(struct sockaddr*)&from,&fromlen); - - printf("Received %d bytes from %x\n",len,ntohl(from.sin_addr.s_addr)); -} - -static void -ping_thread(void *arg) -{ - int s; - LWIP_UNUSED_ARG(arg); - - if ((s = lwip_socket(AF_INET, SOCK_RAW, IP_PROTO_ICMP)) < 0) { - return; - } - - while (1) { - printf("sending ping\n"); - ping_send(s,&ping_addr); - ping_recv(s,&ping_addr); - sleep(1); - } -} -#endif - -#endif - -struct netif netif; - -static void -init_netifs(void) -{ -#if PPP_SUPPORT - pppInit(); -#if PPP_PTY_TEST - ppp_sio = sio_open(2); -#else - ppp_sio = sio_open(0); -#endif - if(!ppp_sio) - { - perror("Error opening device: "); - exit(1); - } - -#ifdef LWIP_PPP_CHAP_TEST - pppSetAuth(PPPAUTHTYPE_CHAP, "lwip", "mysecret"); -#endif - - pppOpen(ppp_sio, pppLinkStatusCallback, NULL); -#endif /* PPP_SUPPORT */ - -#if LWIP_DHCP - { - IP4_ADDR(&gw, 0,0,0,0); - IP4_ADDR(&ipaddr, 0,0,0,0); - IP4_ADDR(&netmask, 0,0,0,0); - - netif_add(&netif, &ipaddr, &netmask, &gw, NULL, tapif_init, - tcpip_input); - netif_set_default(&netif); - dhcp_start(&netif); - } -#else - - netif_set_default(netif_add(&netif,&ipaddr, &netmask, &gw, NULL, tapif_init, - tcpip_input)); - netif_set_up(&netif); - -#endif -#if LWIP_IPV6 - netif_create_ip6_linklocal_address(&netif, 1); -#endif - -#if 0 - /* Only used for testing purposes: */ - netif_add(&ipaddr, &netmask, &gw, NULL, pcapif_init, tcpip_input); -#endif - -#if LWIP_TCP - tcpecho_init(); - shell_init(); - httpd_init(); -#endif -#if LWIP_UDP - udpecho_init(); -#endif - /* sys_timeout(5000, tcp_debug_timeout, NULL);*/ -} - -/*-----------------------------------------------------------------------------------*/ -static void -main_thread(void *arg) -{ - sys_sem_t sem; -#if PPP_SUPPORT - sio_fd_t ppp_sio; -#endif - LWIP_UNUSED_ARG(arg); - - if(sys_sem_new(&sem, 0) != ERR_OK) { - LWIP_ASSERT("Failed to create semaphore", 0); - } - tcpip_init(tcpip_init_done, &sem); - sys_sem_wait(&sem); - printf("TCP/IP initialized.\n"); - -#if LWIP_RAW - /** @todo remove dependency on RAW PCB support */ - if(ping_flag) { - sys_thread_new("ping_thread", ping_thread, NULL, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO); - } -#endif - - printf("Applications started.\n"); - - -#ifdef MEM_PERF - mem_perf_init("/tmp/memstats.client"); -#endif /* MEM_PERF */ -#if 0 - stats_display(); -#endif - /* Block forever. */ - sys_sem_wait(&sem); -} -/*-----------------------------------------------------------------------------------*/ -int -main(int argc, char **argv) -{ - struct in_addr inaddr; - int ch; - char ip_str[16] = {0}, nm_str[16] = {0}, gw_str[16] = {0}; - - /* startup defaults (may be overridden by one or more opts) */ - IP4_ADDR(&gw, 192,168,0,1); - IP4_ADDR(&netmask, 255,255,255,0); - IP4_ADDR(&ipaddr, 192,168,0,2); - - ping_flag = 0; - /* use debug flags defined by debug.h */ - debug_flags = LWIP_DBG_OFF; - - while ((ch = getopt_long(argc, argv, "dhg:i:m:p:", longopts, NULL)) != -1) { - switch (ch) { - case 'd': - debug_flags |= (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT); - break; - case 'h': - usage(); - exit(0); - break; - case 'g': - inet_aton(optarg, &inaddr); - gw.addr = inaddr.s_addr; - break; - case 'i': - inet_aton(optarg, &inaddr); - ipaddr.addr = inaddr.s_addr; - break; - case 'm': - inet_aton(optarg, &inaddr); - netmask.addr = inaddr.s_addr; - break; - case 'p': - ping_flag = !0; - inet_aton(optarg, &inaddr); - /* lwip inet.h oddity workaround */ - ping_addr.addr = inaddr.s_addr; - strncpy(ip_str,inet_ntoa(inaddr),sizeof(ip_str)); - printf("Using %s to ping\n", ip_str); - break; - default: - usage(); - break; - } - } - argc -= optind; - argv += optind; - - inaddr.s_addr = ipaddr.addr; - strncpy(ip_str,inet_ntoa(inaddr),sizeof(ip_str)); - inaddr.s_addr = netmask.addr; - strncpy(nm_str,inet_ntoa(inaddr),sizeof(nm_str)); - inaddr.s_addr = gw.addr; - strncpy(gw_str,inet_ntoa(inaddr),sizeof(gw_str)); - printf("Host at %s mask %s gateway %s\n", ip_str, nm_str, gw_str); - -#ifdef PERF - perf_init("/tmp/simhost.perf"); -#endif /* PERF */ - - printf("System initialized.\n"); - - sys_thread_new("main_thread", main_thread, NULL, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO); - pause(); - return 0; -} -/*-----------------------------------------------------------------------------------*/ - - - - - - - - diff --git a/contrib/ports/unix/proj/unixsim/simnode.c b/contrib/ports/unix/proj/unixsim/simnode.c deleted file mode 100644 index 6600f4e..0000000 --- a/contrib/ports/unix/proj/unixsim/simnode.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * 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 - * - */ - -#include "lwip/debug.h" - -#include - - -#include "lwip/mem.h" -#include "lwip/memp.h" -#include "lwip/sys.h" -#include "lwip/tcp_impl.h" - -#include "lwip/stats.h" - - -#include "lwip/tcpip.h" - - -#include "netif/unixif.h" -#include "netif/dropif.h" - -#include "netif/tcpdump.h" - -#include "lwip/ip_addr.h" - -#include "arch/perf.h" - -#include "httpd.h" -#include "udpecho.h" -#include "tcpecho.h" -#include "shell.h" - -/* nonstatic debug cmd option, exported in lwipopts.h */ -unsigned char debug_flags; - -/*-----------------------------------------------------------------------------------*/ -static void -tcp_timeout(void *data) -{ - LWIP_UNUSED_ARG(data); -#if TCP_DEBUG - tcp_debug_print_pcbs(); -#endif /* TCP_DEBUG */ - sys_timeout(5000, tcp_timeout, NULL); -} -/*-----------------------------------------------------------------------------------*/ -struct netif netif_unix; -/*-----------------------------------------------------------------------------------*/ -static void -tcpip_init_done(void *arg) -{ - ip_addr_t ipaddr, netmask, gw; - sys_sem_t *sem; - sem = (sys_sem_t *)arg; - - IP4_ADDR(&gw, 192,168,1,1); - IP4_ADDR(&ipaddr, 192,168,1,2); - IP4_ADDR(&netmask, 255,255,255,0); - - netif_set_default(netif_add(&netif_unix, &ipaddr, &netmask, &gw, NULL, unixif_init_client, - tcpip_input)); -#if LWIP_IPV6 - netif_create_ip6_linklocal_address(&netif_unix, 1); -#endif - /* netif_set_default(netif_add(&ipaddr, &netmask, &gw, NULL, sioslipif_init1, - tcpip_input)); */ - - tcpecho_init(); - shell_init(); - httpd_init(); - udpecho_init(); - - printf("Applications started.\n"); - - sys_timeout(5000, tcp_timeout, NULL); - - sys_sem_signal(sem); -} -/*-----------------------------------------------------------------------------------*/ - -static void -main_thread(void *arg) -{ - sys_sem_t sem; - LWIP_UNUSED_ARG(arg); - - if(sys_sem_new(&sem, 0) != ERR_OK) { - LWIP_ASSERT("Failed to create semaphore", 0); - } - tcpip_init(tcpip_init_done, &sem); - sys_sem_wait(&sem); - printf("TCP/IP initialized.\n"); - -#ifdef MEM_PERF - mem_perf_init("/tmp/memstats.client"); -#endif /* MEM_PERF */ - - /* Block forever. */ - sys_sem_wait(&sem); -} -/*-----------------------------------------------------------------------------------*/ -int -main(void) -{ -#ifdef PERF - perf_init("/tmp/client.perf"); -#endif /* PERF */ - - tcpdump_init(); - - printf("System initialized.\n"); - - sys_thread_new("main_thread", main_thread, NULL, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO); - pause(); - return 0; -} -/*-----------------------------------------------------------------------------------*/ - - - - - - - - diff --git a/contrib/ports/unix/proj/unixsim/simrouter.c b/contrib/ports/unix/proj/unixsim/simrouter.c deleted file mode 100644 index 55186d0..0000000 --- a/contrib/ports/unix/proj/unixsim/simrouter.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * 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 - * - */ - -#include "lwip/debug.h" - -#include - - -#include "lwip/mem.h" -#include "lwip/memp.h" -#include "lwip/sys.h" -#include "lwip/tcp_impl.h" - -#include "lwip/stats.h" - - -#include "lwip/tcpip.h" - -#include "netif/tapif.h" - -#include "netif/unixif.h" -#include "netif/dropif.h" - -#include "netif/tcpdump.h" - - -#include "lwip/ip_addr.h" - -#include "arch/perf.h" - -#include "httpd.h" -#include "udpecho.h" -#include "tcpecho.h" -#include "shell.h" - -/* nonstatic debug cmd option, exported in lwipopts.h */ -unsigned char debug_flags; - -/*-----------------------------------------------------------------------------------*/ -static void -tcp_timeout(void *data) -{ - LWIP_UNUSED_ARG(data); -#if TCP_DEBUG - tcp_debug_print_pcbs(); -#endif /* TCP_DEBUG */ - sys_timeout(5000, tcp_timeout, NULL); -} -/*-----------------------------------------------------------------------------------*/ - -struct netif netif_tap, netif_unix; - -/*-----------------------------------------------------------------------------------*/ -static void -tcpip_init_done(void *arg) -{ - ip_addr_t ipaddr, netmask, gw; - sys_sem_t *sem; - sem = (sys_sem_t *)arg; - - IP4_ADDR(&gw, 192,168,0,1); - IP4_ADDR(&ipaddr, 192,168,0,2); - IP4_ADDR(&netmask, 255,255,255,0); - - netif_set_default(netif_add(&netif_tap, &ipaddr, &netmask, &gw, NULL, tapif_init, - tcpip_input)); -#if LWIP_IPV6 - netif_create_ip6_linklocal_address(&netif_tap, 1); -#endif - - IP4_ADDR(&gw, 192,168,1,1); - IP4_ADDR(&ipaddr, 192,168,1,1); - IP4_ADDR(&netmask, 255,255,255,0); - netif_set_default(netif_add(&netif_unix, &ipaddr, &netmask, &gw, NULL, unixif_init_server, - tcpip_input)); -#if LWIP_IPV6 - netif_create_ip6_linklocal_address(&netif_unix, 1); -#endif - - system("route add 192.168.1.1 192.168.0.2"); - system("route add 192.168.1.2 192.168.0.2"); - - - /*netif_set_default(netif_add(&ipaddr, &netmask, &gw, NULL, sioslipif_init1, - tcpip_input)); */ - - tcpecho_init(); - shell_init(); - httpd_init(); - udpecho_init(); - - printf("Applications started.\n"); - - sys_timeout(5000, tcp_timeout, NULL); - - sys_sem_signal(sem); -} - - -static void -main_thread(void *arg) -{ - sys_sem_t sem; - LWIP_UNUSED_ARG(arg); - - if(sys_sem_new(&sem, 0) != ERR_OK) { - LWIP_ASSERT("Failed to create semaphore", 0); - } - tcpip_init(tcpip_init_done, &sem); - sys_sem_wait(&sem); - printf("TCP/IP initialized.\n"); - -#ifdef MEM_PERF - mem_perf_init("/tmp/memstats.client"); -#endif /* MEM_PERF */ - /* Block forever. */ - sys_sem_wait(&sem); -} -/*-----------------------------------------------------------------------------------*/ -int -main(void) -{ -#ifdef PERF - perf_init("/tmp/client.perf"); -#endif /* PERF */ - - tcpdump_init(); - - printf("System initialized.\n"); - sys_thread_new("main_thread", main_thread, NULL, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO); - pause(); - return 0; -} -/*-----------------------------------------------------------------------------------*/ - - - - - - - - diff --git a/contrib/ports/win32/.cvsignore b/contrib/ports/win32/.cvsignore deleted file mode 100644 index bd9bed5..0000000 --- a/contrib/ports/win32/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -lwipcfg_msvc.h \ No newline at end of file diff --git a/contrib/ports/win32/check/config.h b/contrib/ports/win32/check/config.h deleted file mode 100644 index 8096eae..0000000 --- a/contrib/ports/win32/check/config.h +++ /dev/null @@ -1,26 +0,0 @@ -/* config.h for check-0.9.8 on win32 under MSVC/MinGW */ - -#ifdef _MSC_VER - -typedef unsigned int pid_t; -typedef unsigned int uint32_t; - -#define ssize_t size_t -#define snprintf _snprintf - -#define HAVE_DECL_STRDUP 1 -#define HAVE_DECL_FILENO 1 -#define HAVE_DECL_PUTENV 1 - -#define _CRT_SECURE_NO_WARNINGS - -/* disable some warnings */ -#pragma warning (disable: 4090) /* const assigned to non-const */ -#pragma warning (disable: 4996) /* fileno is deprecated */ - -#endif /* _ MSC_VER */ - - -#define LWIP_UNITTESTS_NOFORK - -#include diff --git a/contrib/ports/win32/check/sys/time.h b/contrib/ports/win32/check/sys/time.h deleted file mode 100644 index d71d827..0000000 --- a/contrib/ports/win32/check/sys/time.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef LWIP_SYS__TIME_H -#define LWIP_SYS__TIME_H - -#include /* time_t */ - -struct timeval { - time_t tv_sec; /* seconds */ - long tv_usec; /* and microseconds */ -}; -int gettimeofday(struct timeval* tp, void* tzp); - -#endif diff --git a/contrib/ports/win32/check/time.c b/contrib/ports/win32/check/time.c deleted file mode 100644 index 21e6944..0000000 --- a/contrib/ports/win32/check/time.c +++ /dev/null @@ -1,64 +0,0 @@ -#include - -#include -#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) - #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 -#else - #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL -#endif - -#include "config.h" - -struct timezone -{ - int tz_minuteswest; /* minutes W of Greenwich */ - int tz_dsttime; /* type of dst correction */ -}; - -int gettimeofday(struct timeval *tv, struct timezone *tz) -{ - FILETIME ft; - unsigned __int64 tmpres = 0; - static int tzflag; - - if (NULL != tv) - { - GetSystemTimeAsFileTime(&ft); - - tmpres |= ft.dwHighDateTime; - tmpres <<= 32; - tmpres |= ft.dwLowDateTime; - - /*converting file time to unix epoch*/ - tmpres -= DELTA_EPOCH_IN_MICROSECS; - tmpres /= 10; /*convert into microseconds*/ - tv->tv_sec = (long)(tmpres / 1000000UL); - tv->tv_usec = (long)(tmpres % 1000000UL); - } - - if (NULL != tz) - { - if (!tzflag) - { - _tzset(); - tzflag++; - } - tz->tz_minuteswest = _timezone / 60; - tz->tz_dsttime = _daylight; - } - - return 0; -} - -struct tm * -localtime_r(const time_t *timer, struct tm *result) -{ - struct tm *local_result; - local_result = localtime (timer); - - if (local_result == NULL || result == NULL) - return NULL; - - memcpy (result, local_result, sizeof (result)); - return result; -} diff --git a/contrib/ports/win32/check/unistd.h b/contrib/ports/win32/check/unistd.h deleted file mode 100644 index 332e6e1..0000000 --- a/contrib/ports/win32/check/unistd.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef LWIP_UNISTD_H -#define LWIP_UNISTD_H - -/* include io.h for read() and write() */ -#include - -#endif diff --git a/contrib/ports/win32/include/arch/bpstruct.h b/contrib/ports/win32/include/arch/bpstruct.h deleted file mode 100644 index 1d81e3f..0000000 --- a/contrib/ports/win32/include/arch/bpstruct.h +++ /dev/null @@ -1 +0,0 @@ -#pragma pack(push,1) diff --git a/contrib/ports/win32/include/arch/cc.h b/contrib/ports/win32/include/arch/cc.h deleted file mode 100644 index aed6769..0000000 --- a/contrib/ports/win32/include/arch/cc.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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 - * - */ -#ifndef LWIP_ARCH_CC_H -#define LWIP_ARCH_CC_H - -#include /* printf, fflush, FILE */ -#include /* abort */ -#include - -#ifdef _MSC_VER -#pragma warning (disable: 4244) /* disable conversion warning (implicit integer promotion!) */ -#pragma warning (disable: 4127) /* conditional expression is constant */ -#pragma warning (disable: 4996) /* 'strncpy' was declared deprecated */ -#pragma warning (disable: 4103) /* structure packing changed by including file */ -#endif - -#define LWIP_PROVIDE_ERRNO - -/* Define platform endianness (might already be defined) */ -#ifndef BYTE_ORDER -#define BYTE_ORDER LITTLE_ENDIAN -#endif /* BYTE_ORDER */ - -/* Define generic types used in lwIP */ -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 size_t mem_ptr_t; -typedef u32_t sys_prot_t; - -/* Define (sn)printf formatters for these lwIP types */ -#define X8_F "02x" -#define U16_F "hu" -#define U32_F "lu" -#define S32_F "ld" -#define X32_F "lx" - -#ifdef __GNUC__ -#define S16_F "d" -#define X16_F "uX" -#define SZT_F "u" -#else -#define S16_F "hd" -#define X16_F "hx" -#define SZT_F "lu" -#endif - -/* Compiler hints for packing structures */ -#define PACK_STRUCT_STRUCT -#define PACK_STRUCT_USE_INCLUDES - -/* Plaform specific diagnostic output */ -#define LWIP_PLATFORM_DIAG(x) do { printf x; } while(0) - -#define LWIP_PLATFORM_ASSERT(x) do { printf("Assertion \"%s\" failed at line %d in %s\n", \ - x, __LINE__, __FILE__); fflush(NULL); abort(); } while(0) - -#define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \ - printf("Assertion \"%s\" failed at line %d in %s\n", message, __LINE__, __FILE__); \ - fflush(NULL);handler;} } while(0) - -#ifdef _MSC_VER -/* C runtime functions redefined */ -#define snprintf _snprintf -#endif - -u32_t dns_lookup_external_hosts_file(const char *name); - -#define LWIP_RAND() ((u32_t)rand()) - -#endif /* LWIP_ARCH_CC_H */ diff --git a/contrib/ports/win32/include/arch/epstruct.h b/contrib/ports/win32/include/arch/epstruct.h deleted file mode 100644 index 65898b5..0000000 --- a/contrib/ports/win32/include/arch/epstruct.h +++ /dev/null @@ -1 +0,0 @@ -#pragma pack(pop) diff --git a/contrib/ports/win32/include/arch/perf.h b/contrib/ports/win32/include/arch/perf.h deleted file mode 100644 index 4580aab..0000000 --- a/contrib/ports/win32/include/arch/perf.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2001, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the lwIP TCP/IP stack. - * - * Author: Adam Dunkels - * - */ -#ifndef LWIP_PERF_H -#define LWIP_PERF_H - -#define PERF_START /* null definition */ -#define PERF_STOP(x) /* null definition */ - -#endif /* LWIP_PERF_H */ diff --git a/contrib/ports/win32/include/arch/sys_arch.h b/contrib/ports/win32/include/arch/sys_arch.h deleted file mode 100644 index a6ebb3a..0000000 --- a/contrib/ports/win32/include/arch/sys_arch.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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 - * - */ -#ifndef LWIP_ARCH_SYS_ARCH_H -#define LWIP_ARCH_SYS_ARCH_H - -/* HANDLE is used for sys_sem_t but we won't include windows.h */ -struct _sys_sem { - void *sem; -}; -typedef struct _sys_sem sys_sem_t; -#define SYS_SEM_NULL NULL -#define sys_sem_valid(sema) (((sema) != NULL) && ((sema)->sem != NULL) && ((sema)->sem != (void*)-1)) -#define sys_sem_set_invalid(sema) ((sema)->sem = NULL) - -/* let sys.h use binary semaphores for mutexes */ -#define LWIP_COMPAT_MUTEX 1 - -#ifndef MAX_QUEUE_ENTRIES -#define MAX_QUEUE_ENTRIES 100 -#endif -struct lwip_mbox { - void* sem; - void* q_mem[MAX_QUEUE_ENTRIES]; - u32_t head, tail; -}; -typedef struct lwip_mbox sys_mbox_t; -#define SYS_MBOX_NULL NULL -#define sys_mbox_valid(mbox) ((mbox != NULL) && ((mbox)->sem != NULL) && ((mbox)->sem != (void*)-1)) -#define sys_mbox_set_invalid(mbox) ((mbox)->sem = NULL) - -/* DWORD (thread id) is used for sys_thread_t but we won't include windows.h */ -typedef u32_t sys_thread_t; - -#endif /* LWIP_ARCH_SYS_ARCH_H */ - diff --git a/contrib/ports/win32/include/lwipopts.h b/contrib/ports/win32/include/lwipopts.h deleted file mode 100644 index 3178c93..0000000 --- a/contrib/ports/win32/include/lwipopts.h +++ /dev/null @@ -1,285 +0,0 @@ -/* - * 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 - * - */ -#ifndef LWIP_LWIPOPTS_H -#define LWIP_LWIPOPTS_H - -#define NO_SYS 0 -#define LWIP_SOCKET (NO_SYS==0) -#define LWIP_NETCONN (NO_SYS==0) - -#define LWIP_IGMP 1 -#define LWIP_ICMP 1 -#define LWIP_SNMP 1 - -#define LWIP_DNS 1 - -#define LWIP_HAVE_LOOPIF 1 -#define LWIP_NETIF_LOOPBACK 1 -#define LWIP_LOOPBACK_MAX_PBUFS 10 - -#define TCP_LISTEN_BACKLOG 0 - -#define LWIP_COMPAT_SOCKETS 1 -#define LWIP_SO_RCVTIMEO 1 -#define LWIP_SO_RCVBUF 1 - -#define LWIP_TCPIP_CORE_LOCKING 0 - -#define LWIP_NETIF_LINK_CALLBACK 1 -#define LWIP_NETIF_STATUS_CALLBACK 1 - -#ifdef LWIP_DEBUG - -#define LWIP_DBG_MIN_LEVEL 0 -#define PPP_DEBUG LWIP_DBG_OFF -#define MEM_DEBUG LWIP_DBG_OFF -#define MEMP_DEBUG LWIP_DBG_OFF -#define PBUF_DEBUG LWIP_DBG_OFF -#define API_LIB_DEBUG LWIP_DBG_OFF -#define API_MSG_DEBUG LWIP_DBG_OFF -#define TCPIP_DEBUG LWIP_DBG_OFF -#define NETIF_DEBUG LWIP_DBG_OFF -#define SOCKETS_DEBUG LWIP_DBG_OFF -#define DNS_DEBUG LWIP_DBG_OFF -#define AUTOIP_DEBUG LWIP_DBG_OFF -#define DHCP_DEBUG LWIP_DBG_OFF -#define IP_DEBUG LWIP_DBG_OFF -#define IP_REASS_DEBUG LWIP_DBG_OFF -#define ICMP_DEBUG LWIP_DBG_OFF -#define IGMP_DEBUG LWIP_DBG_OFF -#define UDP_DEBUG LWIP_DBG_OFF -#define TCP_DEBUG LWIP_DBG_OFF -#define TCP_INPUT_DEBUG LWIP_DBG_OFF -#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF -#define TCP_RTO_DEBUG LWIP_DBG_OFF -#define TCP_CWND_DEBUG LWIP_DBG_OFF -#define TCP_WND_DEBUG LWIP_DBG_OFF -#define TCP_FR_DEBUG LWIP_DBG_OFF -#define TCP_QLEN_DEBUG LWIP_DBG_OFF -#define TCP_RST_DEBUG LWIP_DBG_OFF -#endif - -#define LWIP_DBG_TYPES_ON (LWIP_DBG_ON|LWIP_DBG_TRACE|LWIP_DBG_STATE|LWIP_DBG_FRESH|LWIP_DBG_HALT) - - -/* ---------- 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. */ -/* MSVC port: intel processors don't need 4-byte alignment, - but are faster that way! */ -#define MEM_ALIGNMENT 4 - -/* 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 10240 - -/* 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_RAW_PCB: the number of UDP protocol control blocks. One - per active RAW "connection". */ -#define MEMP_NUM_RAW_PCB 3 -/* 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 15 - -/* 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 10 -/* MEMP_NUM_TCPIP_MSG_*: 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_API 16 -#define MEMP_NUM_TCPIP_MSG_INPKT 16 - - -/* ---------- Pbuf options ---------- */ -/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */ -#define PBUF_POOL_SIZE 120 - -/* 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 - -/** SYS_LIGHTWEIGHT_PROT - * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection - * for certain critical regions during buffer allocation, deallocation and memory - * allocation and deallocation. - */ -#define SYS_LIGHTWEIGHT_PROT (NO_SYS==0) - - -/* ---------- 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 1024 - -/* TCP sender buffer space (bytes). */ -#define TCP_SND_BUF 2048 - -/* 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 writable space (bytes). This must be less than or equal - to TCP_SND_BUF. It is the amount of space which must be - available in the tcp snd_buf for select to return writable */ -#define TCP_SNDLOWAT (TCP_SND_BUF/2) - -/* TCP receive window. */ -#define TCP_WND 8096 - -/* 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 LWIP_ARP 1 -#define ARP_TABLE_SIZE 10 -#define ARP_QUEUEING 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 - -/* IP reassembly and segmentation.These are orthogonal even - * if they both deal with IP fragments */ -#define IP_REASSEMBLY 1 -#define IP_REASS_MAX_PBUFS 10 -#define MEMP_NUM_REASSDATA 10 -#define IP_FRAG 1 - - -/* ---------- ICMP options ---------- */ -#define ICMP_TTL 255 - - -/* ---------- DHCP options ---------- */ -/* Define LWIP_DHCP to 1 if you want DHCP configuration of - interfaces. */ -#define LWIP_DHCP 0 - -/* 1 if you want to do an ARP check on the offered address - (recommended). */ -#define DHCP_DOES_ARP_CHECK (LWIP_DHCP) - - -/* ---------- AUTOIP options ------- */ -#define LWIP_AUTOIP 0 -#define LWIP_DHCP_AUTOIP_COOP (LWIP_DHCP && LWIP_AUTOIP) - - -/* ---------- UDP options ---------- */ -#define LWIP_UDP 1 -#define LWIP_UDPLITE 1 -#define UDP_TTL 255 - - -/* ---------- Statistics options ---------- */ - -#define LWIP_STATS 1 -#define LWIP_STATS_DISPLAY 1 - -#if LWIP_STATS -#define LINK_STATS 1 -#define IP_STATS 1 -#define ICMP_STATS 1 -#define IGMP_STATS 1 -#define IPFRAG_STATS 1 -#define UDP_STATS 1 -#define TCP_STATS 1 -#define MEM_STATS 1 -#define MEMP_STATS 1 -#define PBUF_STATS 1 -#define SYS_STATS 1 -#endif /* LWIP_STATS */ - - -/* ---------- PPP options ---------- */ - -#define PPP_SUPPORT 0 /* Set > 0 for PPP */ - -#if PPP_SUPPORT - -#define NUM_PPP 1 /* Max PPP sessions. */ - - -/* Select modules to enable. Ideally these would be set in the makefile but - * we're limited by the command line length so you need to modify the settings - * in this file. - */ -#define PPPOE_SUPPORT 1 -#define PPPOS_SUPPORT 1 - -#define PAP_SUPPORT 1 /* Set > 0 for PAP. */ -#define CHAP_SUPPORT 1 /* Set > 0 for CHAP. */ -#define MSCHAP_SUPPORT 0 /* Set > 0 for MSCHAP (NOT FUNCTIONAL!) */ -#define CBCP_SUPPORT 0 /* Set > 0 for CBCP (NOT FUNCTIONAL!) */ -#define CCP_SUPPORT 0 /* Set > 0 for CCP (NOT FUNCTIONAL!) */ -#define VJ_SUPPORT 1 /* Set > 0 for VJ header compression. */ -#define MD5_SUPPORT 1 /* Set > 0 for MD5 (see also CHAP) */ - -#endif /* PPP_SUPPORT */ - -#endif /* LWIP_LWIPOPTS_H */ diff --git a/contrib/ports/win32/lwipcfg_msvc.h.example b/contrib/ports/win32/lwipcfg_msvc.h.example deleted file mode 100644 index e8afd2f..0000000 --- a/contrib/ports/win32/lwipcfg_msvc.h.example +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Additional settings for the win32 port. - * Copy this to lwipcfg_msvc.h and make the config changes you need. - */ - -/* configuration for this port */ -#define PPP_USERNAME "Admin" -#define PPP_PASSWORD "pass" - -/** Define this to the index of the windows network adapter to use */ -#define PACKET_LIB_ADAPTER_NR 1 -/** Define this to the GUID of the windows network adapter to use - * or NOT define this if you want PACKET_LIB_ADAPTER_NR to be used */ -/*#define PACKET_LIB_ADAPTER_GUID "00000000-0000-0000-0000-000000000000"*/ -/*#define PACKET_LIB_GET_ADAPTER_NETADDRESS(addr) IP4_ADDR((addr), 192,168,1,0)*/ -/*#define PACKET_LIB_QUIET*/ - -/* If these 2 are not defined, the corresponding config setting is used */ -/* #define USE_DHCP 0 */ -/* #define USE_AUTOIP 0 */ - -/* #define USE_PCAPIF 1 */ -#define LWIP_PORT_INIT_IPADDR(addr) IP4_ADDR((addr), 192,168,1,200) -#define LWIP_PORT_INIT_GW(addr) IP4_ADDR((addr), 192,168,1,1) -#define LWIP_PORT_INIT_NETMASK(addr) IP4_ADDR((addr), 255,255,255,0) - -/* remember to change this MAC address to suit your needs! - the last octet will be increased by netif->num for each netif */ -#define LWIP_MAC_ADDR_BASE {0x00,0x01,0x02,0x03,0x04,0x05} - -/* #define USE_SLIPIF 0 */ -/* #define SIO_USE_COMPORT 0 */ -#ifdef USE_SLIPIF -#if USE_SLIPIF -#define LWIP_PORT_INIT_SLIP1_IPADDR(addr) IP4_ADDR((addr), 192, 168, 2, 2) -#define LWIP_PORT_INIT_SLIP1_GW(addr) IP4_ADDR((addr), 192, 168, 2, 1) -#define LWIP_PORT_INIT_SLIP1_NETMASK(addr) IP4_ADDR((addr), 255, 255, 255, 0) -#if USE_SLIPIF > 1 -#define LWIP_PORT_INIT_SLIP2_IPADDR(addr) IP4_ADDR((addr), 192, 168, 2, 1) -#define LWIP_PORT_INIT_SLIP2_GW(addr) IP4_ADDR((addr), 0, 0, 0, 0) -#define LWIP_PORT_INIT_SLIP2_NETMASK(addr) IP4_ADDR((addr), 255, 255, 255, 0)*/ -#endif /* USE_SLIPIF > 1 */ -#endif /* USE_SLIPIF */ -#endif /* USE_SLIPIF */ - -/* configuration for applications */ - -#define LWIP_CHARGEN_APP 0 -#define LWIP_DNS_APP 0 -#define LWIP_HTTPD_APP 0 -/* Set this to 1 to use the netconn http server, - * otherwise the raw api server will be used. */ -/*#define LWIP_HTTPD_APP_NETCONN */ -#define LWIP_NETBIOS_APP 0 -#define LWIP_NETIO_APP 0 -#define LWIP_PING_APP 0 -#define LWIP_RTP_APP 0 -#define LWIP_SHELL_APP 0 -#define LWIP_SNTP_APP 0 -#define LWIP_SOCKET_EXAMPLES_APP 0 -#define LWIP_TCPECHO_APP 0 -/* Set this to 1 to use the netconn tcpecho server, - * otherwise the raw api server will be used. */ -/*#define LWIP_TCPECHO_APP_NETCONN */ -#define LWIP_UDPECHO_APP 0 - -/* define this to your custom application-init function */ -/* #define LWIP_APP_INIT my_app_init() */ diff --git a/contrib/ports/win32/lwippools.h b/contrib/ports/win32/lwippools.h deleted file mode 100644 index 8fc2c92..0000000 --- a/contrib/ports/win32/lwippools.h +++ /dev/null @@ -1,20 +0,0 @@ -/* OPTIONAL: Pools to replace heap allocation - * Optional: Pools can be used instead of the heap for mem_malloc. If - * so, these should be defined here, in increasing order according to - * the pool element size. - * - * LWIP_MALLOC_MEMPOOL(number_elements, element_size) - */ -#if MEM_USE_POOLS -LWIP_MALLOC_MEMPOOL_START -LWIP_MALLOC_MEMPOOL(100, 256) -LWIP_MALLOC_MEMPOOL(50, 512) -LWIP_MALLOC_MEMPOOL(20, 1024) -LWIP_MALLOC_MEMPOOL(20, 1536) -LWIP_MALLOC_MEMPOOL_END -#endif /* MEM_USE_POOLS */ - -/* Optional: Your custom pools can go here if you would like to use - * lwIP's memory pools for anything else. - */ -LWIP_MEMPOOL(SYS_MBOX, 22, 100, "SYS_MBOX") diff --git a/contrib/ports/win32/msvc8/libcheck.vcproj b/contrib/ports/win32/msvc8/libcheck.vcproj deleted file mode 100644 index f8f34a4..0000000 --- a/contrib/ports/win32/msvc8/libcheck.vcproj +++ /dev/null @@ -1,251 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/contrib/ports/win32/msvc8/lwIP.vcproj b/contrib/ports/win32/msvc8/lwIP.vcproj deleted file mode 100644 index b15d07a..0000000 --- a/contrib/ports/win32/msvc8/lwIP.vcproj +++ /dev/null @@ -1,1265 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/contrib/ports/win32/msvc8/lwIP_Test.sln b/contrib/ports/win32/msvc8/lwIP_Test.sln deleted file mode 100644 index 24d50b0..0000000 --- a/contrib/ports/win32/msvc8/lwIP_Test.sln +++ /dev/null @@ -1,44 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual C++ Express 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lwIP_test", "lwIP_Test.vcproj", "{8CC0CE51-32CF-4585-BFAF-A9343BC5A96D}" - ProjectSection(ProjectDependencies) = postProject - {6F44E49E-9F21-4144-91EC-53B92AEF62CE} = {6F44E49E-9F21-4144-91EC-53B92AEF62CE} - {2CC276FA-B226-49C9-8F82-7FCD5A228E28} = {2CC276FA-B226-49C9-8F82-7FCD5A228E28} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lwIP pcapif", "lwIP_pcapif.vcproj", "{6F44E49E-9F21-4144-91EC-53B92AEF62CE}" - ProjectSection(ProjectDependencies) = postProject - {2CC276FA-B226-49C9-8F82-7FCD5A228E28} = {2CC276FA-B226-49C9-8F82-7FCD5A228E28} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lwIP", "lwIP.vcproj", "{2CC276FA-B226-49C9-8F82-7FCD5A228E28}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "makefsdata", "makefsdata.vcproj", "{0BFC0F21-8E84-4E68-A9E1-CE2A09B72F6D}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8CC0CE51-32CF-4585-BFAF-A9343BC5A96D}.Debug|Win32.ActiveCfg = Debug|Win32 - {8CC0CE51-32CF-4585-BFAF-A9343BC5A96D}.Debug|Win32.Build.0 = Debug|Win32 - {8CC0CE51-32CF-4585-BFAF-A9343BC5A96D}.Release|Win32.ActiveCfg = Release|Win32 - {8CC0CE51-32CF-4585-BFAF-A9343BC5A96D}.Release|Win32.Build.0 = Release|Win32 - {6F44E49E-9F21-4144-91EC-53B92AEF62CE}.Debug|Win32.ActiveCfg = Debug|Win32 - {6F44E49E-9F21-4144-91EC-53B92AEF62CE}.Debug|Win32.Build.0 = Debug|Win32 - {6F44E49E-9F21-4144-91EC-53B92AEF62CE}.Release|Win32.ActiveCfg = Release|Win32 - {6F44E49E-9F21-4144-91EC-53B92AEF62CE}.Release|Win32.Build.0 = Release|Win32 - {2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Debug|Win32.ActiveCfg = Debug|Win32 - {2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Debug|Win32.Build.0 = Debug|Win32 - {2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release|Win32.ActiveCfg = Release|Win32 - {2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release|Win32.Build.0 = Release|Win32 - {0BFC0F21-8E84-4E68-A9E1-CE2A09B72F6D}.Debug|Win32.ActiveCfg = Debug|Win32 - {0BFC0F21-8E84-4E68-A9E1-CE2A09B72F6D}.Debug|Win32.Build.0 = Debug|Win32 - {0BFC0F21-8E84-4E68-A9E1-CE2A09B72F6D}.Release|Win32.ActiveCfg = Release|Win32 - {0BFC0F21-8E84-4E68-A9E1-CE2A09B72F6D}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/contrib/ports/win32/msvc8/lwIP_Test.vcproj b/contrib/ports/win32/msvc8/lwIP_Test.vcproj deleted file mode 100644 index ebddf4f..0000000 --- a/contrib/ports/win32/msvc8/lwIP_Test.vcproj +++ /dev/null @@ -1,391 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/contrib/ports/win32/msvc8/lwIP_pcapif.vcproj b/contrib/ports/win32/msvc8/lwIP_pcapif.vcproj deleted file mode 100644 index 7bb24f0..0000000 --- a/contrib/ports/win32/msvc8/lwIP_pcapif.vcproj +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/contrib/ports/win32/msvc8/lwIP_unittests.sln b/contrib/ports/win32/msvc8/lwIP_unittests.sln deleted file mode 100644 index 78966ce..0000000 --- a/contrib/ports/win32/msvc8/lwIP_unittests.sln +++ /dev/null @@ -1,35 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lwip_unittests", "lwip_unittests.vcproj", "{6CCABAA4-F86F-4119-AFF8-43C9A4A234C2}" - ProjectSection(ProjectDependencies) = postProject - {EBB156DC-01BF-47B2-B69C-1A750B6B5F09} = {EBB156DC-01BF-47B2-B69C-1A750B6B5F09} - {2CC276FA-B226-49C9-8F82-7FCD5A228E28} = {2CC276FA-B226-49C9-8F82-7FCD5A228E28} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lwIP", "lwIP.vcproj", "{2CC276FA-B226-49C9-8F82-7FCD5A228E28}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcheck", "libcheck.vcproj", "{EBB156DC-01BF-47B2-B69C-1A750B6B5F09}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Debug|Win32.ActiveCfg = Debug unittests|Win32 - {2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Debug|Win32.Build.0 = Debug unittests|Win32 - {2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release|Win32.ActiveCfg = Release unittests|Win32 - {2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release|Win32.Build.0 = Release unittests|Win32 - {EBB156DC-01BF-47B2-B69C-1A750B6B5F09}.Debug|Win32.ActiveCfg = Debug|Win32 - {EBB156DC-01BF-47B2-B69C-1A750B6B5F09}.Debug|Win32.Build.0 = Debug|Win32 - {EBB156DC-01BF-47B2-B69C-1A750B6B5F09}.Release|Win32.ActiveCfg = Release|Win32 - {EBB156DC-01BF-47B2-B69C-1A750B6B5F09}.Release|Win32.Build.0 = Release|Win32 - {6CCABAA4-F86F-4119-AFF8-43C9A4A234C2}.Debug|Win32.ActiveCfg = Debug|Win32 - {6CCABAA4-F86F-4119-AFF8-43C9A4A234C2}.Debug|Win32.Build.0 = Debug|Win32 - {6CCABAA4-F86F-4119-AFF8-43C9A4A234C2}.Release|Win32.ActiveCfg = Release|Win32 - {6CCABAA4-F86F-4119-AFF8-43C9A4A234C2}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/contrib/ports/win32/msvc8/lwip_unittests.vcproj b/contrib/ports/win32/msvc8/lwip_unittests.vcproj deleted file mode 100644 index 48a20ef..0000000 --- a/contrib/ports/win32/msvc8/lwip_unittests.vcproj +++ /dev/null @@ -1,261 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/contrib/ports/win32/msvc8/makefsdata.vcproj b/contrib/ports/win32/msvc8/makefsdata.vcproj deleted file mode 100644 index 4546e73..0000000 --- a/contrib/ports/win32/msvc8/makefsdata.vcproj +++ /dev/null @@ -1,184 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/contrib/ports/win32/msvc8/readme.txt b/contrib/ports/win32/msvc8/readme.txt deleted file mode 100644 index 2e90f95..0000000 --- a/contrib/ports/win32/msvc8/readme.txt +++ /dev/null @@ -1,29 +0,0 @@ -lwIP for Win32 - -This is a quickly hacked port and example project of the lwIP library to -Win32/MSVC9. - -It doesn't (yet?) include support for dhcp, autoip, slipif, ppp or pppoe. This -is simply because none of the active developers using this port are using these -interfaces right now. - -To get this compiling, you have to set a couple of environment variables: -- LWIP_DIR: points to the main lwip tree (the folder where is the CHANGELOG file). -- PCAP_DIR: points to the WinPcap Developer's Packs (containing 'include' and 'lib') - -You also will have to copy the file 'lwipcfg_msvc.h.example' to -'lwipcfg_msvc.h' and modify to suit your needs (WinPcap adapter number, -IP configuration, applications...). - -Note that you also have to set the PCAP_DIR environment variable to point -to the WinPcap Developer's Packs (containing 'include' and 'lib'). - -Included in the contrib\ports\win32 directory is the network interface driver -using the winpcap library. - -lwIP: http://savannah.nongnu.org/projects/lwip/ -WinPCap: http://netgroup-serv.polito.it/winpcap/ - -To compile the unittests, download check (tested with v0.9.8) from -http://sourceforge.net/projects/check/ -and place it in a folder "check" next to the "contrib" folder. \ No newline at end of file diff --git a/contrib/ports/win32/pcapif.c b/contrib/ports/win32/pcapif.c deleted file mode 100644 index 1e54c3f..0000000 --- a/contrib/ports/win32/pcapif.c +++ /dev/null @@ -1,792 +0,0 @@ -/** - * pcapif.c - This file is part of lwIP pcapif - * - **************************************************************************** - * - * 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. - * - */ - -#include -#include - -#include "pcap.h" - -#include "lwip/opt.h" - -#if LWIP_ETHERNET - -/* @todo: once moved to the correct place, this should be unconditional! */ -#ifdef _MSC_VER -#include "pcapif.h" -#else -#include "netif/pcapif.h" -#endif - -#include -#include -#include - -#include "lwip/debug.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 "lwip/snmp.h" -#include "lwip/tcpip.h" -#include "lwip/timers.h" -#include "lwip/ethip6.h" - -#include "netif/etharp.h" - -/* include the port-dependent configuration */ -#include "lwipcfg_msvc.h" - -/* For compatibility with old pcap */ -#ifndef PCAP_OPENFLAG_PROMISCUOUS -#define PCAP_OPENFLAG_PROMISCUOUS 1 -#endif - -/* Define those to better describe your network interface. - For now, we use 'e0', 'e1', 'e2' and so on */ -#define IFNAME0 'e' -#define IFNAME1 '0' - -/** index of the network adapter to use for lwIP */ -#ifndef PACKET_LIB_ADAPTER_NR -#define PACKET_LIB_ADAPTER_NR 0 -#endif - -/** If 1, check link state and report it to lwIP. - * If 0, don't check link state (lwIP link state is always UP). - */ -#ifndef PCAPIF_HANDLE_LINKSTATE -#define PCAPIF_HANDLE_LINKSTATE 1 -#endif - -#if PCAPIF_HANDLE_LINKSTATE -#include "pcapif_helper.h" - -/* Define "PHY" delay when "link up" */ -#ifndef PCAPIF_LINKUP_DELAY -#define PCAPIF_LINKUP_DELAY 0 -#endif - -#define PCAPIF_LINKCHECK_INTERVAL_MS 500 - -/* link state notification macro */ -#if PCAPIF_LINKUP_DELAY -#define PCAPIF_NOTIFY_LINKSTATE(netif, linkfunc) sys_timeout(PCAPIF_LINKUP_DELAY, (sys_timeout_handler)linkfunc, netif) -#else /* PHY_LINKUP_DELAY */ -#define PCAPIF_NOTIFY_LINKSTATE(netif, linkfunc) linkfunc(netif) -#endif /* PHY_LINKUP_DELAY */ - -#endif /* PCAPIF_HANDLE_LINKSTATE */ - - -#define ADAPTER_NAME_LEN 128 -#define ADAPTER_DESC_LEN 128 - -/* Packet Adapter informations */ -struct pcapif_private { - void *input_fn_arg; - pcap_t *adapter; - char name[ADAPTER_NAME_LEN]; - char description[ADAPTER_DESC_LEN]; - int shutdown_called; -#if PCAPIF_RX_USE_THREAD - volatile int rx_run; - volatile int rx_running; -#endif /* PCAPIF_RX_USE_THREAD */ -#if PCAPIF_HANDLE_LINKSTATE - struct pcapifh_linkstate *link_state; - enum pcapifh_link_event last_link_event; -#endif /* PCAPIF_HANDLE_LINKSTATE */ -}; - -/* Forward declarations. */ -static void pcapif_input(u_char *user, const struct pcap_pkthdr *pkt_header, const u_char *packet); - -#ifdef PACKET_LIB_GET_ADAPTER_NETADDRESS -/** Get the index of an adapter by its network address - * - * @param netaddr network address of the adapter (e.g. 192.168.1.0) - * @return index of the adapter or negative on error - */ -static int -get_adapter_index_from_addr(struct in_addr *netaddr, char *guid, size_t guid_len) -{ - pcap_if_t *alldevs; - pcap_if_t *d; - char errbuf[PCAP_ERRBUF_SIZE+1]; - int index = 0; - - memset(guid, 0, guid_len); - - /* Retrieve the interfaces list */ - if (pcap_findalldevs(&alldevs, errbuf) == -1) { - printf("Error in pcap_findalldevs: %s\n", errbuf); - return -1; - } - /* Scan the list printing every entry */ - for (d = alldevs; d != NULL; d = d->next, index++) { - pcap_addr_t *a; - for(a = d->addresses; a != NULL; a = a->next) { - if (a->addr->sa_family == AF_INET) { - ULONG a_addr = ((struct sockaddr_in *)a->addr)->sin_addr.s_addr; - ULONG a_netmask = ((struct sockaddr_in *)a->netmask)->sin_addr.s_addr; - ULONG a_netaddr = a_addr & a_netmask; - ULONG addr = (*netaddr).s_addr; - if (a_netaddr == addr) { - int ret = -1; - char name[128]; - char *start, *end; - size_t len = strlen(d->name); - if(len > 127) { - len = 127; - } - memcpy(name, d->name, len); - name[len] = 0; - start = strstr(name, "{"); - if (start != NULL) { - end = strstr(start, "}"); - if (end != NULL) { - size_t len = end - start + 1; - memcpy(guid, start, len); - ret = index; - } - } - pcap_freealldevs(alldevs); - return ret; - } - } - } - } - printf("Network address not found.\n"); - - pcap_freealldevs(alldevs); - return -1; -} -#endif /* PACKET_LIB_GET_ADAPTER_NETADDRESS */ - -#if defined(PACKET_LIB_GET_ADAPTER_NETADDRESS) || defined(PACKET_LIB_ADAPTER_GUID) -/** Get the index of an adapter by its GUID - * - * @param adapter_guid GUID of the adapter - * @return index of the adapter or negative on error - */ -static int -get_adapter_index(const char* adapter_guid) -{ - pcap_if_t *alldevs; - pcap_if_t *d; - char errbuf[PCAP_ERRBUF_SIZE+1]; - int idx = 0; - - /* Retrieve the interfaces list */ - if (pcap_findalldevs(&alldevs, errbuf) == -1) { - printf("Error in pcap_findalldevs: %s\n", errbuf); - return -1; - } - /* Scan the list and compare name vs. adapter_guid */ - for (d = alldevs; d != NULL; d = d->next, idx++) { - if(strstr(d->name, adapter_guid)) { - pcap_freealldevs(alldevs); - return idx; - } - } - /* not found, dump all adapters */ - printf("%d available adapters:\n", idx); - for (d = alldevs, idx = 0; d != NULL; d = d->next, idx++) { - printf("- %d: %s\n", idx, d->name); - } - pcap_freealldevs(alldevs); - return -1; -} -#endif /* defined(PACKET_LIB_GET_ADAPTER_NETADDRESS) || defined(PACKET_LIB_ADAPTER_GUID) */ - -/** - * Open a network adapter and set it up for packet input - * - * @param adapter_num the index of the adapter to use - * @param arg argument to pass to input - * @return an adapter handle on success, NULL on failure - */ -static struct pcapif_private* -pcapif_init_adapter(int adapter_num, void *arg) -{ - int i; - int number_of_adapters; - struct pcapif_private *pa; - char errbuf[PCAP_ERRBUF_SIZE+1]; - - pcap_if_t *alldevs; - pcap_if_t *d; - pcap_if_t *used_adapter = NULL; - - pa = (struct pcapif_private *)malloc(sizeof(struct pcapif_private)); - if (!pa) { - printf("Unable to alloc the adapter!\n"); - return NULL; - } - - memset(pa, 0, sizeof(struct pcapif_private)); - pa->input_fn_arg = arg; - - /* Retrieve the interfaces list */ - if (pcap_findalldevs(&alldevs, errbuf) == -1) { - free(pa); - return NULL; /* no adapters found */ - } - /* get number of adatpers and adapter pointer */ - for (d = alldevs, number_of_adapters = 0; d != NULL; d = d->next, number_of_adapters++) { - if (number_of_adapters == adapter_num) { - char *desc = d->description; - size_t len; - - len = strlen(d->name); - LWIP_ASSERT("len < ADAPTER_NAME_LEN", len < ADAPTER_NAME_LEN); - strcpy(pa->name, d->name); - - used_adapter = d; - /* format vendor description */ - if (desc != NULL) { - len = strlen(desc); - if (strstr(desc, " ' on local host") != NULL) { - len -= 16; - } - else if (strstr(desc, "' on local host") != NULL) { - len -= 15; - } - if (strstr(desc, "Network adapter '") == desc) { - len -= 17; - desc += 17; - } - len = LWIP_MIN(len, ADAPTER_DESC_LEN-1); - while ((desc[len-1] == ' ') || (desc[len-1] == '\t')) { - /* don't copy trailing whitespace */ - len--; - } - strncpy(pa->description, desc, len); - pa->description[len] = 0; - } else { - strcpy(pa->description, ""); - } - } - } - -#ifndef PCAPIF_LIB_QUIET - /* Scan the list printing every entry */ - for (d = alldevs, i = 0; d != NULL; d = d->next, i++) { - char *desc = d->description; - char descBuf[128]; - size_t len; - const char* devname = d->name; - if (d->name == NULL) { - devname = ""; - } else { - if (strstr(devname, "\\Device\\") == devname) { - /* windows: strip the first part */ - devname += 8; - } - } - printf("%2i: %s\n", i, devname); - if (desc != NULL) { - /* format vendor description */ - len = strlen(desc); - if (strstr(desc, " ' on local host") != NULL) { - len -= 16; - } - else if (strstr(desc, "' on local host") != NULL) { - len -= 15; - } - if (strstr(desc, "Network adapter '") == desc) { - len -= 17; - desc += 17; - } - len = LWIP_MIN(len, 127); - while ((desc[len-1] == ' ') || (desc[len-1] == '\t')) { - /* don't copy trailing whitespace */ - len--; - } - strncpy(descBuf, desc, len); - descBuf[len] = 0; - printf(" Desc: \"%s\"\n", descBuf); - } - } -#endif /* PCAPIF_LIB_QUIET */ - - /* invalid adapter index -> check this after printing the adapters */ - if (adapter_num < 0) { - printf("Invalid adapter_num: %d\n", adapter_num); - free(pa); - pcap_freealldevs(alldevs); - return NULL; - } - /* adapter index out of range */ - if (adapter_num >= number_of_adapters) { - printf("Invalid adapter_num: %d\n", adapter_num); - free(pa); - pcap_freealldevs(alldevs); - return NULL; - } -#ifndef PCAPIF_LIB_QUIET - printf("Using adapter_num: %d\n", adapter_num); -#endif /* PCAPIF_LIB_QUIET */ - /* set up the selected adapter */ - - LWIP_ASSERT("used_adapter != NULL", used_adapter != NULL); - - /* Open the device */ - pa->adapter = pcap_open_live(used_adapter->name,/* name of the device */ - 65536, /* portion of the packet to capture */ - /* 65536 guarantees that the whole packet will be captured on all the link layers */ - PCAP_OPENFLAG_PROMISCUOUS,/* promiscuous mode */ -#if PCAPIF_RX_USE_THREAD - /*-*/1, /* don't wait at all for lower latency */ -#else - 1, /* wait 1 ms in ethernetif_poll */ -#endif - errbuf); /* error buffer */ - if (pa->adapter == NULL) { - printf("\nUnable to open the adapter. %s is not supported by WinPcap\n", used_adapter->name); - /* Free the device list */ - pcap_freealldevs(alldevs); - free(pa); - return NULL; - } - printf("Using adapter: \"%s\"\n", pa->description); - pcap_freealldevs(alldevs); - -#if PCAPIF_HANDLE_LINKSTATE - pa->link_state = pcapifh_linkstate_init(pa->name); - pa->last_link_event = PCAPIF_LINKEVENT_UNKNOWN; -#endif /* PCAPIF_HANDLE_LINKSTATE */ - - return pa; -} - -#if PCAPIF_HANDLE_LINKSTATE -void -pcapif_check_linkstate(void *netif_ptr) -{ - struct netif *netif = (struct netif*)netif_ptr; - struct pcapif_private *pa = (struct pcapif_private*)netif->state; - enum pcapifh_link_event le; - - le = pcapifh_linkstate_get(pa->link_state); - - if (pa->last_link_event != le) { - pa->last_link_event = le; - switch (le) { - case PCAPIF_LINKEVENT_UP: { - PCAPIF_NOTIFY_LINKSTATE(netif, netif_set_link_up); - break; - } - case PCAPIF_LINKEVENT_DOWN: { - PCAPIF_NOTIFY_LINKSTATE(netif, netif_set_link_down); - break; - } - } - } - sys_timeout(PCAPIF_LINKCHECK_INTERVAL_MS, pcapif_check_linkstate, netif); -} -#endif /* PCAPIF_HANDLE_LINKSTATE */ - - -/** - * Close the adapter (no more packets can be sent or received) - * - * @param netif netif to shutdown - */ -void -pcapif_shutdown(struct netif *netif) -{ - struct pcapif_private *pa = (struct pcapif_private*)netif->state; - if (pa) { -#if PCAPIF_RX_USE_THREAD - pa->rx_run = 0; -#endif /* PCAPIF_RX_USE_THREAD */ - if (pa->adapter) { - pcap_breakloop(pa->adapter); - pcap_close(pa->adapter); - } -#if PCAPIF_RX_USE_THREAD - /* wait for rxthread to end */ - while(pa->rx_running); -#endif /* PCAPIF_RX_USE_THREAD */ -#if PCAPIF_HANDLE_LINKSTATE - pcapifh_linkstate_close(pa->link_state); -#endif /* PCAPIF_HANDLE_LINKSTATE */ - free(pa); - } -} - -#if PCAPIF_RX_USE_THREAD -/** RX running in its own thread */ -static void -pcapif_input_thread(void *arg) -{ - struct netif *netif = (struct netif *)arg; - struct pcapif_private *pa = (struct pcapif_private*)netif->state; - do - { - struct pcap_pkthdr pkt_header; - const u_char *packet = pcap_next(pa->adapter, &pkt_header); - if(packet != NULL) { - pcapif_input((u_char*)pa, &pkt_header, packet); - } - } while (pa->rx_run); - pa->rx_running = 0; -} -#endif /* PCAPIF_RX_USE_THREAD */ - -/** Low-level initialization: find the correct adapter and initialize it. - */ -static void -pcapif_low_level_init(struct netif *netif) -{ - u8_t my_mac_addr[ETHARP_HWADDR_LEN] = LWIP_MAC_ADDR_BASE; - int adapter_num = PACKET_LIB_ADAPTER_NR; - struct pcapif_private *pa; - - /* If 'state' is != NULL at this point, we assume it is an 'int' giving - the index of the adapter to use (+ 1 because 0==NULL is invalid). - This can be used to instantiate multiple PCAP drivers. */ - if (netif->state != NULL) { - adapter_num = ((int)netif->state) - 1; - if (adapter_num < 0) { - printf("ERROR: invalid adapter index \"%d\"!\n", adapter_num); - LWIP_ASSERT("ERROR initializing network adapter!\n", 0); - return; - } - } - -#ifdef PACKET_LIB_GET_ADAPTER_NETADDRESS - ip_addr_t netaddr; -#define GUID_LEN 128 - char guid[GUID_LEN + 1]; - memset(&guid, 0, sizeof(guid)); - PACKET_LIB_GET_ADAPTER_NETADDRESS(&netaddr); - if (get_adapter_index_from_addr((struct in_addr *)&netaddr, guid, GUID_LEN) < 0) { - printf("ERROR initializing network adapter, failed to get GUID for network address %s\n", ip_ntoa(&netaddr)); - LWIP_ASSERT("ERROR initializing network adapter, failed to get GUID for network address!", 0); - return; - } - adapter_num = get_adapter_index(guid); - if (adapter_num < 0) { - printf("ERROR finding network adapter with GUID \"%s\"!\n", guid); - LWIP_ASSERT("ERROR finding network adapter with expected GUID!", 0); - return; - } - -#else /* PACKET_LIB_GET_ADAPTER_NETADDRESS */ -#ifdef PACKET_LIB_ADAPTER_GUID - /* get adapter index for guid string */ - adapter_num = get_adapter_index(PACKET_LIB_ADAPTER_GUID); - if (adapter_num < 0) { - printf("ERROR finding network adapter with GUID \"%s\"!\n", PACKET_LIB_ADAPTER_GUID); - LWIP_ASSERT("ERROR initializing network adapter!\n", 0); - return; - } -#endif /* PACKET_LIB_ADAPTER_GUID */ -#endif /* PACKET_LIB_GET_ADAPTER_NETADDRESS */ - - /* Do whatever else is needed to initialize interface. */ - pa = pcapif_init_adapter(adapter_num, netif); - if (pa == NULL) { - printf("ERROR initializing network adapter %d!\n", adapter_num); - LWIP_ASSERT("ERROR initializing network adapter!", 0); - return; - } - netif->state = pa; - - /* change the MAC address to a unique value - so that multiple ethernetifs are supported */ - /* @todo: this does NOT support multiple processes using this adapter! */ - my_mac_addr[ETHARP_HWADDR_LEN - 1] += netif->num; - /* Copy MAC addr */ - memcpy(&netif->hwaddr, my_mac_addr, ETHARP_HWADDR_LEN); - - /* get the initial link state of the selected interface */ -#if PCAPIF_HANDLE_LINKSTATE - pa->last_link_event = pcapifh_linkstate_get(pa->link_state); - if (pa->last_link_event == PCAPIF_LINKEVENT_DOWN) { - netif_set_link_down(netif); - } else { - netif_set_link_up(netif); - } - sys_timeout(PCAPIF_LINKCHECK_INTERVAL_MS, pcapif_check_linkstate, netif); -#endif /* PCAPIF_HANDLE_LINKSTATE */ - -#if PCAPIF_RX_USE_THREAD - pa->rx_run = 1; - pa->rx_running = 1; - sys_thread_new("pcapif_rxthread", pcapif_input_thread, netif, 0, 0); -#endif - - LWIP_DEBUGF(NETIF_DEBUG, ("pcapif: eth_addr %02X%02X%02X%02X%02X%02X\n",netif->hwaddr[0],netif->hwaddr[1],netif->hwaddr[2],netif->hwaddr[3],netif->hwaddr[4],netif->hwaddr[5])); -} - -/** low_level_output(): - * Transmit a packet. The packet is contained in the pbuf that is passed to - * the function. This pbuf might be chained. - */ -static err_t -pcapif_low_level_output(struct netif *netif, struct pbuf *p) -{ - struct pbuf *q; - unsigned char buffer[1520]; - unsigned char *buf = buffer; - unsigned char *ptr; - struct eth_hdr *ethhdr; - u16_t tot_len = p->tot_len - ETH_PAD_SIZE; - struct pcapif_private *pa = (struct pcapif_private*)netif->state; - -#if defined(LWIP_DEBUG) && LWIP_NETIF_TX_SINGLE_PBUF - LWIP_ASSERT("p->next == NULL && p->len == p->tot_len", p->next == NULL && p->len == p->tot_len); -#endif - - /* initiate transfer */ - if (p->len == p->tot_len) { - /* no pbuf chain, don't have to copy -> faster */ - buf = &((unsigned char*)p->payload)[ETH_PAD_SIZE]; - } else { - /* pbuf chain, copy into contiguous buffer */ - if (p->tot_len >= sizeof(buffer)) { - LINK_STATS_INC(link.lenerr); - LINK_STATS_INC(link.drop); - snmp_inc_ifoutdiscards(netif); - return ERR_BUF; - } - 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); */ - LWIP_DEBUGF(NETIF_DEBUG, ("netif: send ptr %p q->payload %p q->len %i q->next %p\n", ptr, q->payload, (int)q->len, (void*)q->next)); - if (q == p) { - memcpy(ptr, &((char*)q->payload)[ETH_PAD_SIZE], q->len - ETH_PAD_SIZE); - ptr += q->len - ETH_PAD_SIZE; - } else { - memcpy(ptr, q->payload, q->len); - ptr += q->len; - } - } - } - - /* signal that packet should be sent */ - if (pcap_sendpacket(pa->adapter, buf, tot_len) < 0) { - LINK_STATS_INC(link.memerr); - LINK_STATS_INC(link.drop); - snmp_inc_ifoutdiscards(netif); - return ERR_BUF; - } - - LINK_STATS_INC(link.xmit); - snmp_add_ifoutoctets(netif, tot_len); - ethhdr = (struct eth_hdr *)p->payload; - if ((ethhdr->dest.addr[0] & 1) != 0) { - /* broadcast or multicast packet*/ - snmp_inc_ifoutnucastpkts(netif); - } else { - /* unicast packet */ - snmp_inc_ifoutucastpkts(netif); - } - return ERR_OK; -} - -/** low_level_input(): Allocate a pbuf and transfer the bytes of the incoming - * packet from the interface into the pbuf. - */ -static struct pbuf * -pcapif_low_level_input(struct netif *netif, const void *packet, int packet_len) -{ - struct pbuf *p, *q; - int start; - int length = packet_len; - struct eth_addr *dest = (struct eth_addr*)packet; - struct eth_addr *src = dest + 1; - int unicast; - const u8_t bcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - const u8_t ipv4mcast[] = {0x01, 0x00, 0x5e}; - const u8_t ipv6mcast[] = {0x33, 0x33}; - - /* Don't let feedback packets through (limitation in winpcap?) */ - if(!memcmp(src, netif->hwaddr, ETHARP_HWADDR_LEN)) { - /* don't update counters here! */ - return NULL; - } - - /* MAC filter: only let my MAC or non-unicast through (pcap receives loopback traffic, too) */ - unicast = ((dest->addr[0] & 0x01) == 0); - if (memcmp(dest, &netif->hwaddr, ETHARP_HWADDR_LEN) && - (memcmp(dest, ipv4mcast, 3) || ((dest->addr[3] & 0x80) != 0)) && - memcmp(dest, ipv6mcast, 2) && - memcmp(dest, bcast, 6)) { - /* don't update counters here! */ - return NULL; - } - - /* We allocate a pbuf chain of pbufs from the pool. */ - p = pbuf_alloc(PBUF_RAW, (u16_t)length + ETH_PAD_SIZE, PBUF_POOL); - LWIP_DEBUGF(NETIF_DEBUG, ("netif: recv length %i p->tot_len %i\n", length, (int)p->tot_len)); - - 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) { - u16_t copy_len = q->len; - /* Read enough bytes to fill this pbuf in the chain. The - available data in the pbuf is given by the q->len - variable. */ - /* read data into(q->payload, q->len); */ - LWIP_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, (void*)q->next)); - if (q == p) { -#if ETH_PAD_SIZE - LWIP_ASSERT("q->len >= ETH_PAD_SIZE", q->len >= ETH_PAD_SIZE); - copy_len -= ETH_PAD_SIZE; -#endif /* ETH_PAD_SIZE*/ - memcpy(&((char*)q->payload)[ETH_PAD_SIZE], &((char*)packet)[start], copy_len); - } else { - memcpy(q->payload, &((char*)packet)[start], copy_len); - } - start += copy_len; - length -= copy_len; - if (length <= 0) { - break; - } - } - LINK_STATS_INC(link.recv); - snmp_add_ifinoctets(netif, p->tot_len); - if (unicast) { - snmp_inc_ifinucastpkts(netif); - } else { - snmp_inc_ifinnucastpkts(netif); - } - } else { - /* drop packet(); */ - LINK_STATS_INC(link.memerr); - LINK_STATS_INC(link.drop); - } - - return p; -} - -/** pcapif_input: This function is 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 -pcapif_input(u_char *user, const struct pcap_pkthdr *pkt_header, const u_char *packet) -{ - struct pcapif_private *pa = (struct pcapif_private*)user; - int packet_len = pkt_header->caplen; - struct netif *netif = (struct netif *)pa->input_fn_arg; - struct pbuf *p; - - /* move received packet into a new pbuf */ - p = pcapif_low_level_input(netif, packet, packet_len); - /* no packet could be read, silently ignore this */ - if (p != NULL) { - /* pass all packets to ethernet_input, which decides what packets it supports */ - if (netif->input(p, netif) != ERR_OK) { - LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_input: IP input error\n")); - pbuf_free(p); - } - } -} - -/** - * pcapif_init(): initialization function, pass to netif_add(). - */ -err_t -pcapif_init(struct netif *netif) -{ - static int ethernetif_index; - - int local_index; - SYS_ARCH_DECL_PROTECT(lev); - SYS_ARCH_PROTECT(lev); - local_index = ethernetif_index++; - SYS_ARCH_UNPROTECT(lev); - - netif->name[0] = IFNAME0; - netif->name[1] = (char)(IFNAME1 + local_index); - netif->linkoutput = pcapif_low_level_output; -#if LWIP_ARP - netif->output = etharp_output; -#if LWIP_IPV6 - netif->output_ip6 = ethip6_output; -#endif /* LWIP_IPV6 */ -#else /* LWIP_ARP */ - netif->output = NULL; /* not used for PPPoE */ -#if LWIP_IPV6 - netif->output_ip6 = NULL; /* not used for PPPoE */ -#endif /* LWIP_IPV6 */ -#endif /* LWIP_ARP */ -#if LWIP_NETIF_HOSTNAME - /* Initialize interface hostname */ - netif_set_hostname(netif, "lwip"); -#endif /* LWIP_NETIF_HOSTNAME */ - - netif->mtu = 1500; - netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_IGMP; - netif->hwaddr_len = ETHARP_HWADDR_LEN; - - NETIF_INIT_SNMP(netif, snmp_ifType_ethernet_csmacd, 100000000); - - /* sets link up or down based on current status */ - pcapif_low_level_init(netif); - - return ERR_OK; -} - -#if !PCAPIF_RX_USE_THREAD -void -pcapif_poll(struct netif *netif) -{ - struct pcapif_private *pa = (struct pcapif_private*)netif->state; - - int ret; - do - { - ret = pcap_dispatch(pa->adapter, -1, pcapif_input, (u_char*)pa); - } while(ret > 0); - -} -#endif /* !PCAPIF_RX_USE_THREAD */ - -#endif /* LWIP_ETHERNET */ diff --git a/contrib/ports/win32/pcapif.h b/contrib/ports/win32/pcapif.h deleted file mode 100644 index 8d67ea4..0000000 --- a/contrib/ports/win32/pcapif.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef LWIP_PCAPIF_H -#define LWIP_PCAPIF_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "lwip/err.h" - -/** Set to 1 to let rx use an own thread (only for NO_SYS==0). - * If set to 0, ethernetif_poll is used to poll for packets. - */ -#ifndef PCAPIF_RX_USE_THREAD -#define PCAPIF_RX_USE_THREAD !NO_SYS -#endif -#if PCAPIF_RX_USE_THREAD && NO_SYS -#error "Can't create a dedicated RX thread with NO_SYS==1" -#endif - -struct netif; - -err_t pcapif_init (struct netif *netif); -void pcapif_shutdown(struct netif *netif); -#if !PCAPIF_RX_USE_THREAD -void pcapif_poll (struct netif *netif); -#endif /* !PCAPIF_RX_USE_THREAD */ - -#ifdef __cplusplus -} -#endif - -#endif /* LWIP_PCAPIF_H */ diff --git a/contrib/ports/win32/pcapif_helper.c b/contrib/ports/win32/pcapif_helper.c deleted file mode 100644 index 6c733e6..0000000 --- a/contrib/ports/win32/pcapif_helper.c +++ /dev/null @@ -1,104 +0,0 @@ -/** - * pcapif_helper.c - This file is part of lwIP pcapif and provides helper functions - * for managing the link state. - */ - -#include "pcapif_helper.h" - - -#include -#include - -#ifdef WIN32 - -#ifdef _MSC_VER -#pragma warning (disable: 4201) /* don't warn about union without name */ -#endif /* _MSC_VER */ - -#define WIN32_LEAN_AND_MEAN - -#include -#include -#include - -struct pcapifh_linkstate { - LPADAPTER lpAdapter; - PPACKET_OID_DATA ppacket_oid_data; -}; - -struct pcapifh_linkstate* pcapifh_linkstate_init(const char *adapter_name) -{ - struct pcapifh_linkstate* state = (struct pcapifh_linkstate*)malloc(sizeof(struct pcapifh_linkstate)); - if (state != NULL) { - memset(state, 0, sizeof(struct pcapifh_linkstate)); - state->ppacket_oid_data = (PPACKET_OID_DATA)malloc(sizeof(PACKET_OID_DATA) + sizeof(NDIS_MEDIA_STATE)); - if (state->ppacket_oid_data == NULL) { - free(state); - state = NULL; - } else { - state->lpAdapter = PacketOpenAdapter((char*)adapter_name); - if ((state->lpAdapter == NULL) || (state->lpAdapter->hFile == INVALID_HANDLE_VALUE)) { - /* failed to open adapter */ - free(state); - state = NULL; - } - } - } - return state; -} - -enum pcapifh_link_event pcapifh_linkstate_get(struct pcapifh_linkstate* state) -{ - enum pcapifh_link_event ret = PCAPIF_LINKEVENT_UNKNOWN; - if (state != NULL) { - state->ppacket_oid_data->Oid = OID_GEN_MEDIA_CONNECT_STATUS; - state->ppacket_oid_data->Length = sizeof(NDIS_MEDIA_STATE); - if (PacketRequest(state->lpAdapter, FALSE, state->ppacket_oid_data)) { - NDIS_MEDIA_STATE fNdisMediaState; - fNdisMediaState = (*((PNDIS_MEDIA_STATE)(state->ppacket_oid_data->Data))); - ret = ((fNdisMediaState == NdisMediaStateConnected) ? PCAPIF_LINKEVENT_UP : PCAPIF_LINKEVENT_DOWN); - } - } - return ret; -} - -void pcapifh_linkstate_close(struct pcapifh_linkstate* state) -{ - if (state != NULL) { - if (state->lpAdapter != NULL) { - PacketCloseAdapter(state->lpAdapter); - } - if (state->ppacket_oid_data != NULL) { - free(state->ppacket_oid_data); - } - free(state); - } -} - -#else /* WIN32 */ - -/* @todo: add linux/unix implementation? */ - -struct pcapifh_linkstate { - u8_t empty; -}; - -struct pcapifh_linkstate* pcapifh_linkstate_init(const char *adapter_name) -{ - LWIP_UNUSED_ARG(adapter_name); - return NULL; -} - -enum pcapifh_link_event pcapifh_linkstate_get(struct pcapifh_linkstate* state) -{ - LWIP_UNUSED_ARG(state); - LWIP_ASSERT("not implemented", 0); - return LINKEVENT_UNKNOWN; -} -void pcapifh_linkstate_close(struct pcapifh_linkstate* state) -{ - LWIP_UNUSED_ARG(state); - LWIP_ASSERT("not implemented", 0); -} - -#endif /* WIN32 */ \ No newline at end of file diff --git a/contrib/ports/win32/pcapif_helper.h b/contrib/ports/win32/pcapif_helper.h deleted file mode 100644 index 2ebde22..0000000 --- a/contrib/ports/win32/pcapif_helper.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef LWIP_PCAPIF_HELPER_H -#define LWIP_PCAPIF_HELPER_H - -#ifdef __cplusplus -extern "C" { -#endif - -struct pcapifh_linkstate; - -enum pcapifh_link_event { - PCAPIF_LINKEVENT_UNKNOWN, - PCAPIF_LINKEVENT_UP, - PCAPIF_LINKEVENT_DOWN -}; - -struct pcapifh_linkstate* pcapifh_linkstate_init(const char *adapter_name); -enum pcapifh_link_event pcapifh_linkstate_get(struct pcapifh_linkstate* state); -void pcapifh_linkstate_close(struct pcapifh_linkstate* state); - - -#ifdef __cplusplus -} -#endif - -#endif /* LWIP_PCAPIF_HELPER_H */ \ No newline at end of file diff --git a/contrib/ports/win32/readme.txt b/contrib/ports/win32/readme.txt deleted file mode 100644 index 75dfb30..0000000 --- a/contrib/ports/win32/readme.txt +++ /dev/null @@ -1,9 +0,0 @@ -lwIP for Win32 - -- MSVC6 compiler, read contrib\ports\win32\msvc6\readme.txt - -- MSVC8 compiler, read contrib\ports\win32\msvc8\readme.txt - -lwIP: http://savannah.nongnu.org/projects/lwip/ -WinPCap: http://netgroup-serv.polito.it/winpcap/ -Visual C++: http://www.microsoft.com/express/download/ diff --git a/contrib/ports/win32/sio.c b/contrib/ports/win32/sio.c deleted file mode 100644 index 9e244c0..0000000 --- a/contrib/ports/win32/sio.c +++ /dev/null @@ -1,295 +0,0 @@ -/* - * 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. - * - */ - -#include -#include -#include - -#include -#include - -#include -#include "lwipcfg_msvc.h" - -/** When 1, use COM ports, when 0, use named pipes (for simulation). */ -#ifndef SIO_USE_COMPORT -#define SIO_USE_COMPORT 1 -#endif - -/** If SIO_USE_COMPORT==1, use COMx, if 0, use a pipe (default) */ -#if SIO_USE_COMPORT -#define SIO_DEVICENAME "\\\\.\\COM" -#else -#define SIO_DEVICENAME "\\\\.\\pipe\\lwip" -#endif - -#if SIO_USE_COMPORT -#ifndef SIO_COMPORT_SPEED -#define SIO_COMPORT_SPEED 115200 -#endif -#ifndef SIO_COMPORT_BYTESIZE -#define SIO_COMPORT_BYTESIZE 8 -#endif -#ifndef SIO_COMPORT_STOPBITS -#define SIO_COMPORT_STOPBITS 0 /* ONESTOPBIT */ -#endif -#ifndef SIO_COMPORT_PARITY -#define SIO_COMPORT_PARITY 0 /* NOPARITY */ -#endif -#endif /* SIO_USE_COMPORT */ - -static int sio_abort = 0; - -/* \\.\pipe\lwip0 */ -/* pppd /dev/ttyS0 logfile mylog debug nocrtscts local noauth noccp ms-dns 212.27.54.252 192.168.0.4:192.168.0.5 - */ - -/** - * SIO_DEBUG: Enable debugging for SIO. - */ -#ifndef SIO_DEBUG -#define SIO_DEBUG LWIP_DBG_OFF -#endif - -#if SIO_USE_COMPORT -/** When using a real COM port, set up the - * serial line settings (baudrate etc.) - */ -static BOOL -sio_setup(HANDLE fd) -{ - COMMTIMEOUTS cto; - DCB dcb; - - /* set up baudrate and other communication settings */ - memset(&dcb, 0, sizeof(dcb)); - /* Obtain the DCB structure for the device */ - if (!GetCommState(fd, &dcb)) { - return FALSE; - } - /* Set the new data */ - dcb.BaudRate = SIO_COMPORT_SPEED; - dcb.ByteSize = SIO_COMPORT_BYTESIZE; - dcb.StopBits = 0; /* ONESTOPBIT */ - dcb.Parity = 0; /* NOPARITY */ - dcb.fParity = 0; /* parity is not used */ - /* do not use flow control */ - /*dcb.fOutxDsrFlow = dcb.fDtrControl = 0; - dcb.fOutxCtsFlow = dcb.fRtsControl = 0; - dcb.fErrorChar = dcb.fNull = 0; - dcb.fInX = dcb.fOutX = 0; - dcb.XonChar = dcb.XoffChar = 0; - dcb.XonLim = dcb.XoffLim = 100;*/ - - /* Set the new DCB structure */ - if (!SetCommState(fd, &dcb)) { - return FALSE; - } - - memset(&cto, 0, sizeof(cto)); - if(!GetCommTimeouts(fd, &cto)) - { - return FALSE; - } - /* change read timeout, leave write timeout as it is */ - cto.ReadIntervalTimeout = 1; - cto.ReadTotalTimeoutMultiplier = 0; - cto.ReadTotalTimeoutConstant = 1;// 1ms //100; /* 10 ms */ - if(!SetCommTimeouts(fd, &cto)) { - return FALSE; - } - - return TRUE; -} -#endif /* SIO_USE_COMPORT */ - -/** - * Opens a serial device for communication. - * - * @param devnum device number - * @return handle to serial device if successful, NULL otherwise - */ -sio_fd_t sio_open(u8_t devnum) -{ - HANDLE fileHandle = INVALID_HANDLE_VALUE; - CHAR fileName[256]; - LWIP_DEBUGF(SIO_DEBUG, ("sio_open(%lu)\n", (DWORD)devnum)); -#if SIO_USE_COMPORT - _snprintf(fileName, 255, SIO_DEVICENAME"%lu", (DWORD)(devnum)); -#else /* SIO_USE_COMPORT */ - _snprintf(fileName, 255, SIO_DEVICENAME"%lu", (DWORD)(devnum & ~1)); - if ((devnum & 1) == 0) { - fileHandle = CreateNamedPipe(fileName, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_NOWAIT, - PIPE_UNLIMITED_INSTANCES, 102400, 102400, 100, NULL); - } else -#endif /* SIO_USE_COMPORT */ - { - fileHandle = CreateFile(fileName, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); - } - if (fileHandle != INVALID_HANDLE_VALUE) { - sio_abort = 0; -#if !SIO_USE_COMPORT - if (devnum & 1) { - DWORD mode = PIPE_NOWAIT; - if (!SetNamedPipeHandleState(fileHandle, &mode, NULL, NULL)) { - LWIP_DEBUGF(SIO_DEBUG, ("sio_open(%lu): SetNamedPipeHandleState failed. GetLastError() returns %d\n", - (DWORD)devnum, GetLastError())); - } - } else -#endif /* !SIO_USE_COMPORT */ - { - FlushFileBuffers(fileHandle); - } -#if SIO_USE_COMPORT - if(!sio_setup(fileHandle)) { - CloseHandle(fileHandle); - LWIP_DEBUGF(SIO_DEBUG, ("sio_open(%lu): sio_setup failed. GetLastError() returns %d\n", - (DWORD)devnum, GetLastError())); - return NULL; - } -#endif /* SIO_USE_COMPORT */ - LWIP_DEBUGF(SIO_DEBUG, ("sio_open: file \"%s\" successfully opened.\n", fileName)); - printf("sio_open: file \"%s\" (%lu) successfully opened: 0x%08x\n", fileName, devnum, (u32_t)fileHandle); - return (sio_fd_t)(fileHandle); - } - LWIP_DEBUGF(SIO_DEBUG, ("sio_open(%lu) failed. GetLastError() returns %d\n", - (DWORD)devnum, GetLastError())); - printf("sio_open(%lu) failed. GetLastError() returns %d\n", - (DWORD)devnum, GetLastError()); - return NULL; -} - -/** - * Sends a single character to the serial device. - * - * @param c character to send - * @param fd serial device handle - * - * @note This function will block until the character can be sent. - */ -void sio_send(u8_t c, sio_fd_t fd) -{ - DWORD dwNbBytesWritten = 0; - LWIP_DEBUGF(SIO_DEBUG, ("sio_send(%lu)\n", (DWORD)c)); - while ((!WriteFile((HANDLE)(fd), &c, 1, &dwNbBytesWritten, NULL)) || (dwNbBytesWritten < 1)) { - } -} - -/** - * Receives a single character from the serial device. - * - * @param fd serial device handle - * - * @note This function will block until a character is received. - */ -u8_t sio_recv(sio_fd_t fd) -{ - DWORD dwNbBytesReadden = 0; - u8_t byte = 0; - LWIP_DEBUGF(SIO_DEBUG, ("sio_recv()\n")); - while ((sio_abort == 0) && ((!ReadFile((HANDLE)(fd), &byte, 1, &dwNbBytesReadden, NULL)) || (dwNbBytesReadden < 1))); - LWIP_DEBUGF(SIO_DEBUG, ("sio_recv()=%lu\n", (DWORD)byte)); - return byte; -} - -/** - * Reads from the serial device. - * - * @param fd serial device handle - * @param data pointer to data buffer for receiving - * @param len maximum length (in bytes) of data to receive - * @return number of bytes actually received - may be 0 if aborted by sio_read_abort - * - * @note This function will block until data can be received. The blocking - * can be cancelled by calling sio_read_abort(). - */ -u32_t sio_read(sio_fd_t fd, u8_t* data, u32_t len) -{ - BOOL ret; - DWORD dwNbBytesReadden = 0; - LWIP_DEBUGF(SIO_DEBUG, ("sio_read()...\n")); - ret = ReadFile((HANDLE)(fd), data, len, &dwNbBytesReadden, NULL); - LWIP_DEBUGF(SIO_DEBUG, ("sio_read()=%lu bytes -> %d\n", dwNbBytesReadden, ret)); - return dwNbBytesReadden; -} - -/** - * Tries to read from the serial device. Same as sio_read but returns - * immediately if no data is available and never blocks. - * - * @param fd serial device handle - * @param data pointer to data buffer for receiving - * @param len maximum length (in bytes) of data to receive - * @return number of bytes actually received - */ -u32_t sio_tryread(sio_fd_t fd, u8_t* data, u32_t len) -{ - /* @todo: implement non-blocking read */ - BOOL ret; - DWORD dwNbBytesReadden = 0; - LWIP_DEBUGF(SIO_DEBUG, ("sio_read()...\n")); - ret = ReadFile((HANDLE)(fd), data, len, &dwNbBytesReadden, NULL); - LWIP_DEBUGF(SIO_DEBUG, ("sio_read()=%lu bytes -> %d\n", dwNbBytesReadden, ret)); - return dwNbBytesReadden; -} - -/** - * Writes to the serial device. - * - * @param fd serial device handle - * @param data pointer to data to send - * @param len length (in bytes) of data to send - * @return number of bytes actually sent - * - * @note This function will block until all data can be sent. - */ -u32_t sio_write(sio_fd_t fd, u8_t* data, u32_t len) -{ - BOOL ret; - DWORD dwNbBytesWritten = 0; - LWIP_DEBUGF(SIO_DEBUG, ("sio_write()...\n")); - ret = WriteFile((HANDLE)(fd), data, len, &dwNbBytesWritten, NULL); - LWIP_DEBUGF(SIO_DEBUG, ("sio_write()=%lu bytes -> %d\n", dwNbBytesWritten, ret)); - return dwNbBytesWritten; -} - -/** - * Aborts a blocking sio_read() call. - * @todo: This currently ignores fd and aborts all reads - * - * @param fd serial device handle - */ -void sio_read_abort(sio_fd_t fd) -{ - LWIP_UNUSED_ARG(fd); - LWIP_DEBUGF(SIO_DEBUG, ("sio_read_abort() !!!!!...\n")); - sio_abort = 1; - return; -} diff --git a/contrib/ports/win32/sys_arch.c b/contrib/ports/win32/sys_arch.c deleted file mode 100644 index 3a0c1d0..0000000 --- a/contrib/ports/win32/sys_arch.c +++ /dev/null @@ -1,399 +0,0 @@ -/* - * 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 - * Simon Goldschmidt - * - */ - -#include -#include /* sprintf() for task names */ - -#include -#include - -#include -#include -#include -#include -#include - -/* These functions are used from NO_SYS also, for precise timer triggering */ -LARGE_INTEGER freq, sys_start_time; - -void sys_init_timing() -{ - QueryPerformanceFrequency(&freq); - QueryPerformanceCounter(&sys_start_time); -} - -static LONGLONG sys_get_ms_longlong() -{ - LONGLONG ret; - LARGE_INTEGER now; -#if NO_SYS - if (freq.QuadPart == 0) { - sys_init_timing(); - } -#endif /* NO_SYS */ - QueryPerformanceCounter(&now); - ret = now.QuadPart-sys_start_time.QuadPart; - return (u32_t)(((ret)*1000)/freq.QuadPart); -} - -u32_t sys_jiffies() -{ - return (u32_t)sys_get_ms_longlong(); -} - -u32_t sys_now() -{ - return (u32_t)sys_get_ms_longlong(); -} - -CRITICAL_SECTION critSec; - -void InitSysArchProtect() -{ - InitializeCriticalSection(&critSec); -} -u32_t sys_arch_protect() -{ - EnterCriticalSection(&critSec); - return 0; -} -void sys_arch_unprotect(u32_t pval) -{ - LWIP_UNUSED_ARG(pval); - LeaveCriticalSection(&critSec); -} - -void msvc_sys_init() -{ - srand(time(0)); - sys_init_timing(); - InitSysArchProtect(); -} - -void sys_init() -{ - msvc_sys_init(); -} - -#if !NO_SYS - -struct threadlist { - DWORD id; - struct threadlist *next; -}; - -struct threadlist *lwip_win32_threads = NULL; - -void do_sleep(int ms) -{ - Sleep(ms); -} - -err_t sys_sem_new(sys_sem_t *sem, u8_t count) -{ - HANDLE new_sem = NULL; - - LWIP_ASSERT("sem != NULL", sem != NULL); - - new_sem = CreateSemaphore(0, count, 100000, 0); - LWIP_ASSERT("Error creating semaphore", new_sem != NULL); - if(new_sem != NULL) { - SYS_STATS_INC_USED(sem); -#if LWIP_STATS && SYS_STATS - LWIP_ASSERT("sys_sem_new() counter overflow", lwip_stats.sys.sem.used != 0 ); -#endif /* LWIP_STATS && SYS_STATS*/ - sem->sem = new_sem; - return ERR_OK; - } - - /* failed to allocate memory... */ - SYS_STATS_INC(sem.err); - sem->sem = SYS_SEM_NULL; - return ERR_MEM; -} - -void sys_sem_free(sys_sem_t *sem) -{ - /* parameter check */ - LWIP_ASSERT("sem != NULL", sem != NULL); - LWIP_ASSERT("sem->sem != SYS_SEM_NULL", sem->sem != SYS_SEM_NULL); - LWIP_ASSERT("sem->sem != INVALID_HANDLE_VALUE", sem->sem != INVALID_HANDLE_VALUE); - CloseHandle(sem->sem); - - SYS_STATS_DEC(sem.used); -#if LWIP_STATS && SYS_STATS - LWIP_ASSERT("sys_sem_free() closed more than created", lwip_stats.sys.sem.used != (u16_t)-1); -#endif /* LWIP_STATS && SYS_STATS */ - sem->sem = NULL; -} - -u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout) -{ - DWORD ret; - LONGLONG starttime, endtime; - LWIP_ASSERT("sem != NULL", sem != NULL); - LWIP_ASSERT("sem != INVALID_HANDLE_VALUE", sem != INVALID_HANDLE_VALUE); - if(!timeout) - { - /* wait infinite */ - starttime = sys_get_ms_longlong(); - ret = WaitForSingleObject(sem->sem, INFINITE); - LWIP_ASSERT("Error waiting for semaphore", ret == WAIT_OBJECT_0); - endtime = sys_get_ms_longlong(); - /* return the time we waited for the sem */ - return (u32_t)(endtime - starttime); - } - else - { - int ret; - starttime = sys_get_ms_longlong(); - ret = WaitForSingleObject(sem->sem, timeout); - LWIP_ASSERT("Error waiting for semaphore", (ret == WAIT_OBJECT_0) || (ret == WAIT_TIMEOUT)); - if(ret == WAIT_OBJECT_0) - { - endtime = sys_get_ms_longlong(); - /* return the time we waited for the sem */ - return (u32_t)(endtime - starttime); - } - else - { - /* timeout */ - return SYS_ARCH_TIMEOUT; - } - } -} - -void sys_sem_signal(sys_sem_t *sem) -{ - DWORD ret; - LWIP_ASSERT("sem != NULL", sem != NULL); - LWIP_ASSERT("sem->sem != NULL", sem->sem != NULL); - LWIP_ASSERT("sem->sem != INVALID_HANDLE_VALUE", sem->sem != INVALID_HANDLE_VALUE); - ret = ReleaseSemaphore(sem->sem, 1, NULL); - LWIP_ASSERT("Error releasing semaphore", ret != 0); -} - -sys_thread_t sys_thread_new(const char *name, lwip_thread_fn function, void *arg, int stacksize, int prio) -{ - struct threadlist *new_thread; - HANDLE h; - SYS_ARCH_DECL_PROTECT(lev); - - LWIP_UNUSED_ARG(name); - LWIP_UNUSED_ARG(stacksize); - LWIP_UNUSED_ARG(prio); - - new_thread = (struct threadlist*)malloc(sizeof(struct threadlist)); - LWIP_ASSERT("new_thread != NULL", new_thread != NULL); - if(new_thread != NULL) { - SYS_ARCH_PROTECT(lev); - new_thread->next = lwip_win32_threads; - lwip_win32_threads = new_thread; - - h = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)function, arg, 0, &(new_thread->id)); - LWIP_ASSERT("h != 0", h != 0); - LWIP_ASSERT("h != -1", h != INVALID_HANDLE_VALUE); - - SYS_ARCH_UNPROTECT(lev); - return new_thread->id; - } - return 0; -} - -err_t sys_mbox_new(sys_mbox_t *mbox, int size) -{ - LWIP_ASSERT("mbox != NULL", mbox != NULL); - LWIP_UNUSED_ARG(size); - - mbox->sem = CreateSemaphore(0, 0, MAX_QUEUE_ENTRIES, 0); - LWIP_ASSERT("Error creating semaphore", mbox->sem != NULL); - if(mbox->sem == NULL) { - SYS_STATS_INC(mbox.err); - return ERR_MEM; - } - memset(&mbox->q_mem, 0, sizeof(u32_t)*MAX_QUEUE_ENTRIES); - mbox->head = 0; - mbox->tail = 0; - SYS_STATS_INC_USED(mbox); -#if LWIP_STATS && SYS_STATS - LWIP_ASSERT("sys_mbox_new() counter overflow", lwip_stats.sys.mbox.used != 0 ); -#endif /* LWIP_STATS && SYS_STATS */ - return ERR_OK; -} - -void sys_mbox_free(sys_mbox_t *mbox) -{ - /* parameter check */ - LWIP_ASSERT("mbox != NULL", mbox != NULL); - LWIP_ASSERT("mbox->sem != NULL", mbox->sem != NULL); - LWIP_ASSERT("mbox->sem != INVALID_HANDLE_VALUE", mbox->sem != INVALID_HANDLE_VALUE); - - CloseHandle(mbox->sem); - - SYS_STATS_DEC(mbox.used); -#if LWIP_STATS && SYS_STATS - LWIP_ASSERT( "sys_mbox_free() ", lwip_stats.sys.mbox.used!= (u16_t)-1 ); -#endif /* LWIP_STATS && SYS_STATS */ - mbox->sem = NULL; -} - -void sys_mbox_post(sys_mbox_t *q, void *msg) -{ - DWORD ret; - SYS_ARCH_DECL_PROTECT(lev); - - /* parameter check */ - LWIP_ASSERT("q != SYS_MBOX_NULL", q != SYS_MBOX_NULL); - LWIP_ASSERT("q->sem != NULL", q->sem != NULL); - LWIP_ASSERT("q->sem != INVALID_HANDLE_VALUE", q->sem != INVALID_HANDLE_VALUE); - - SYS_ARCH_PROTECT(lev); - q->q_mem[q->head] = msg; - (q->head)++; - if (q->head >= MAX_QUEUE_ENTRIES) { - q->head = 0; - } - LWIP_ASSERT("mbox is full!", q->head != q->tail); - ret = ReleaseSemaphore(q->sem, 1, 0); - LWIP_ASSERT("Error releasing sem", ret != 0); - - SYS_ARCH_UNPROTECT(lev); -} - -err_t sys_mbox_trypost(sys_mbox_t *q, void *msg) -{ - u32_t new_head; - DWORD ret; - SYS_ARCH_DECL_PROTECT(lev); - - /* parameter check */ - LWIP_ASSERT("q != SYS_MBOX_NULL", q != SYS_MBOX_NULL); - LWIP_ASSERT("q->sem != NULL", q->sem != NULL); - LWIP_ASSERT("q->sem != INVALID_HANDLE_VALUE", q->sem != INVALID_HANDLE_VALUE); - - SYS_ARCH_PROTECT(lev); - - new_head = q->head + 1; - if (new_head >= MAX_QUEUE_ENTRIES) { - new_head = 0; - } - if (new_head == q->tail) { - SYS_ARCH_UNPROTECT(lev); - return ERR_MEM; - } - - q->q_mem[q->head] = msg; - q->head = new_head; - LWIP_ASSERT("mbox is full!", q->head != q->tail); - ret = ReleaseSemaphore(q->sem, 1, 0); - LWIP_ASSERT("Error releasing sem", ret != 0); - - SYS_ARCH_UNPROTECT(lev); - return ERR_OK; -} - -u32_t sys_arch_mbox_fetch(sys_mbox_t *q, void **msg, u32_t timeout) -{ - DWORD ret; - LONGLONG starttime, endtime; - SYS_ARCH_DECL_PROTECT(lev); - - /* parameter check */ - LWIP_ASSERT("q != SYS_MBOX_NULL", q != SYS_MBOX_NULL); - LWIP_ASSERT("q->sem != NULL", q->sem != NULL); - LWIP_ASSERT("q->sem != INVALID_HANDLE_VALUE", q->sem != INVALID_HANDLE_VALUE); - - if (timeout == 0) { - timeout = INFINITE; - } - starttime = sys_get_ms_longlong(); - if ((ret = WaitForSingleObject(q->sem, timeout)) == WAIT_OBJECT_0) { - SYS_ARCH_PROTECT(lev); - if(msg != NULL) { - *msg = q->q_mem[q->tail]; - } - - (q->tail)++; - if (q->tail >= MAX_QUEUE_ENTRIES) { - q->tail = 0; - } - SYS_ARCH_UNPROTECT(lev); - endtime = sys_get_ms_longlong(); - return (u32_t)(endtime - starttime); - } - else - { - LWIP_ASSERT("Error waiting for sem", ret == WAIT_TIMEOUT); - if(msg != NULL) { - *msg = NULL; - } - - return SYS_ARCH_TIMEOUT; - } -} - -u32_t sys_arch_mbox_tryfetch(sys_mbox_t *q, void **msg) -{ - DWORD ret; - SYS_ARCH_DECL_PROTECT(lev); - - /* parameter check */ - LWIP_ASSERT("q != SYS_MBOX_NULL", q != SYS_MBOX_NULL); - LWIP_ASSERT("q->sem != NULL", q->sem != NULL); - LWIP_ASSERT("q->sem != INVALID_HANDLE_VALUE", q->sem != INVALID_HANDLE_VALUE); - - if ((ret = WaitForSingleObject(q->sem, 0)) == WAIT_OBJECT_0) { - SYS_ARCH_PROTECT(lev); - if(msg != NULL) { - *msg = q->q_mem[q->tail]; - } - - (q->tail)++; - if (q->tail >= MAX_QUEUE_ENTRIES) { - q->tail = 0; - } - SYS_ARCH_UNPROTECT(lev); - return 0; - } - else - { - LWIP_ASSERT("Error waiting for sem", ret == WAIT_TIMEOUT); - if(msg != NULL) { - *msg = NULL; - } - - return SYS_ARCH_TIMEOUT; - } -} - -#endif /* !NO_SYS */ diff --git a/contrib/ports/win32/test.c b/contrib/ports/win32/test.c deleted file mode 100644 index 3f26431..0000000 --- a/contrib/ports/win32/test.c +++ /dev/null @@ -1,649 +0,0 @@ -/* - * 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 lwIP test - * - */ - -/* C runtime includes */ -#include -#include -#include -#include -#include - -/* lwIP core includes */ -#include "lwip/opt.h" - -#include "lwip/sys.h" -#include "lwip/timers.h" -#include "lwip/debug.h" -#include "lwip/stats.h" -#include "lwip/init.h" -#include "lwip/tcpip.h" -#include "lwip/netif.h" - -#include "lwip/tcp.h" -#include "lwip/udp.h" -#include "lwip/dns.h" -#include "lwip/dhcp.h" -#include "lwip/autoip.h" - -/* lwIP netif includes */ -#include "netif/etharp.h" - -/* applications includes */ -#include "apps/httpserver_raw/httpd.h" -#include "apps/httpserver/httpserver-netconn.h" -#include "apps/netio/netio.h" -#include "apps/netbios/netbios.h" -#include "apps/ping/ping.h" -#include "apps/rtp/rtp.h" -#include "apps/sntp/sntp.h" -#include "apps/chargen/chargen.h" -#include "apps/shell/shell.h" -#include "apps/tcpecho/tcpecho.h" -#include "apps/udpecho/udpecho.h" -#include "apps/tcpecho_raw/echo.h" -#include "apps/socket_examples/socket_examples.h" - -#if NO_SYS -/* ... then we need information about the timer intervals: */ -#include "lwip/ip_frag.h" -#include "lwip/igmp.h" -#endif /* NO_SYS */ - -#if PPP_SUPPORT -/* PPP includes */ -#include "../netif/ppp/ppp_impl.h" -#include "lwip/sio.h" -#include "netif/ppp_oe.h" -#endif /* PPP_SUPPORT */ - -/* include the port-dependent configuration */ -#include "lwipcfg_msvc.h" - -/** Define this to 1 to enable a PCAP interface as default interface. */ -#ifndef USE_PCAPIF -#define USE_PCAPIF 1 -#endif - -/** Define this to 1 or 2 to support 1 or 2 SLIP interfaces. */ -#ifndef USE_SLIPIF -#define USE_SLIPIF 0 -#endif - -/** Use an ethernet adapter? Default to enabled if PCAPIF or PPPoE are used. */ -#ifndef USE_ETHERNET -#define USE_ETHERNET (USE_PCAPIF || PPPOE_SUPPORT) -#endif - -/** Use an ethernet adapter for TCP/IP? By default only if PCAPIF is used. */ -#ifndef USE_ETHERNET_TCPIP -#define USE_ETHERNET_TCPIP (USE_PCAPIF) -#endif - -#if USE_ETHERNET -#include "pcapif.h" -#endif /* USE_ETHERNET */ -#if USE_SLIPIF -#include -#endif /* USE_SLIPIF */ - -#ifndef USE_DHCP -#define USE_DHCP LWIP_DHCP -#endif -#ifndef USE_AUTOIP -#define USE_AUTOIP LWIP_AUTOIP -#endif - -/* globales variables for netifs */ -#if USE_ETHERNET -/* THE ethernet interface */ -struct netif netif; -#if LWIP_DHCP -/* dhcp struct for the ethernet netif */ -struct dhcp netif_dhcp; -#endif /* LWIP_DHCP */ -#if LWIP_AUTOIP -/* autoip struct for the ethernet netif */ -struct autoip netif_autoip; -#endif /* LWIP_AUTOIP */ -#endif /* USE_ETHERNET */ -#if PPP_SUPPORT -/* THE PPP descriptor */ -int ppp_desc = -1; -u8_t sio_idx = 0; -sio_fd_t ppp_sio; -#endif /* PPP_SUPPORT */ -#if USE_SLIPIF -struct netif slipif1; -#if USE_SLIPIF > 1 -struct netif slipif2; -#endif /* USE_SLIPIF > 1 */ -#endif /* USE_SLIPIF */ - - -#if PPP_SUPPORT -void -pppLinkStatusCallback(void *ctx, int errCode, void *arg) -{ - LWIP_UNUSED_ARG(ctx); - - switch(errCode) { - case PPPERR_NONE: { /* No error. */ - struct ppp_addrs *ppp_addrs = (struct ppp_addrs *)arg; - - printf("pppLinkStatusCallback: PPPERR_NONE\n"); - printf(" our_ipaddr=%s\n", ip_ntoa(&ppp_addrs->our_ipaddr)); - printf(" his_ipaddr=%s\n", ip_ntoa(&ppp_addrs->his_ipaddr)); - printf(" netmask =%s\n", ip_ntoa(&ppp_addrs->netmask)); - printf(" dns1 =%s\n", ip_ntoa(&ppp_addrs->dns1)); - printf(" dns2 =%s\n", ip_ntoa(&ppp_addrs->dns2)); - break; - } - case PPPERR_PARAM: { /* Invalid parameter. */ - printf("pppLinkStatusCallback: PPPERR_PARAM\n"); - break; - } - case PPPERR_OPEN: { /* Unable to open PPP session. */ - printf("pppLinkStatusCallback: PPPERR_OPEN\n"); - break; - } - case PPPERR_DEVICE: { /* Invalid I/O device for PPP. */ - printf("pppLinkStatusCallback: PPPERR_DEVICE\n"); - break; - } - case PPPERR_ALLOC: { /* Unable to allocate resources. */ - printf("pppLinkStatusCallback: PPPERR_ALLOC\n"); - break; - } - case PPPERR_USER: { /* User interrupt. */ - printf("pppLinkStatusCallback: PPPERR_USER\n"); - break; - } - case PPPERR_CONNECT: { /* Connection lost. */ - printf("pppLinkStatusCallback: PPPERR_CONNECT\n"); - break; - } - case PPPERR_AUTHFAIL: { /* Failed authentication challenge. */ - printf("pppLinkStatusCallback: PPPERR_AUTHFAIL\n"); - break; - } - case PPPERR_PROTOCOL: { /* Failed to meet protocol. */ - printf("pppLinkStatusCallback: PPPERR_PROTOCOL\n"); - break; - } - default: { - printf("pppLinkStatusCallback: unknown errCode %d\n", errCode); - break; - } - } -} -#endif /* PPP_SUPPORT */ - -#if LWIP_NETIF_STATUS_CALLBACK -void status_callback(struct netif *netif) -{ - if (netif_is_up(netif)) { - printf("status_callback==UP, local interface IP is %s\n", ip_ntoa(&netif->ip_addr)); - } else { - printf("status_callback==DOWN\n"); - } -} -#endif /* LWIP_NETIF_STATUS_CALLBACK */ - -#if LWIP_NETIF_LINK_CALLBACK -void link_callback(struct netif *netif) -{ - if (netif_is_link_up(netif)) { - printf("link_callback==UP\n"); -#if USE_DHCP - if (netif->dhcp != NULL) { - dhcp_renew(netif); - } -#endif /* USE_DHCP */ - } else { - printf("link_callback==DOWN\n"); - } -} -#endif /* LWIP_NETIF_LINK_CALLBACK */ - -/* This function initializes all network interfaces */ -static void -msvc_netif_init() -{ -#if USE_ETHERNET - ip_addr_t ipaddr, netmask, gw; -#endif /* USE_ETHERNET */ -#if USE_SLIPIF - u8_t num_slip1 = 0; - ip_addr_t ipaddr_slip1, netmask_slip1, gw_slip1; -#if USE_SLIPIF > 1 - u8_t num_slip2 = 1; - ip_addr_t ipaddr_slip2, netmask_slip2, gw_slip2; -#endif /* USE_SLIPIF > 1 */ -#endif /* USE_SLIPIF */ - -#if PPP_SUPPORT - const char *username = NULL, *password = NULL; -#ifdef PPP_USERNAME - username = PPP_USERNAME; -#endif -#ifdef PPP_PASSWORD - password = PPP_PASSWORD; -#endif - printf("pppInit\n"); - pppInit(); - pppSetAuth(PPPAUTHTYPE_ANY, username, password); - printf("pppOpen: COM%d\n", (int)sio_idx); -#if PPPOS_SUPPORT - ppp_sio = sio_open(sio_idx); - if (ppp_sio == NULL) { - printf("sio_open error\n"); - } else { - ppp_desc = pppOpen(ppp_sio, pppLinkStatusCallback, NULL); - } -#endif /* PPPOS_SUPPORT */ -#endif /* PPP_SUPPORT */ - -#if USE_ETHERNET - ip_addr_set_zero(&gw); - ip_addr_set_zero(&ipaddr); - ip_addr_set_zero(&netmask); -#if USE_ETHERNET_TCPIP -#if USE_DHCP - printf("Starting lwIP, local interface IP is dhcp-enabled\n"); -#elif USE_AUTOIP - printf("Starting lwIP, local interface IP is autoip-enabled\n"); -#else /* USE_DHCP */ - LWIP_PORT_INIT_GW(&gw); - LWIP_PORT_INIT_IPADDR(&ipaddr); - LWIP_PORT_INIT_NETMASK(&netmask); - printf("Starting lwIP, local interface IP is %s\n", ip_ntoa(&ipaddr)); -#endif /* USE_DHCP */ -#endif /* USE_ETHERNET_TCPIP */ - -#if NO_SYS -#if LWIP_ARP - netif_set_default(netif_add(&netif, &ipaddr, &netmask, &gw, NULL, pcapif_init, ethernet_input)); -#else /* LWIP_ARP */ - netif_set_default(netif_add(&netif, &ipaddr, &netmask, &gw, NULL, pcapif_init, ip_input)); -#endif /* LWIP_ARP */ -#else /* NO_SYS */ - netif_set_default(netif_add(&netif, &ipaddr, &netmask, &gw, NULL, pcapif_init, tcpip_input)); -#if LWIP_IPV6 - netif_create_ip6_linklocal_address(&netif, 1); - printf("ip6 linklocal address: "); - ip6_addr_debug_print(0xFFFFFFFF & ~LWIP_DBG_HALT, &netif.ip6_addr[0]); - printf("\n"); -#endif /* LWIP_IPV6 */ -#endif /* NO_SYS */ -#if LWIP_NETIF_STATUS_CALLBACK - netif_set_status_callback(&netif, status_callback); -#endif /* LWIP_NETIF_STATUS_CALLBACK */ -#if LWIP_NETIF_LINK_CALLBACK - netif_set_link_callback(&netif, link_callback); -#endif /* LWIP_NETIF_LINK_CALLBACK */ - -#if USE_ETHERNET_TCPIP -#if LWIP_AUTOIP - autoip_set_struct(&netif, &netif_autoip); -#endif /* LWIP_AUTOIP */ -#if LWIP_DHCP - dhcp_set_struct(&netif, &netif_dhcp); -#endif /* LWIP_DHCP */ -#if USE_DHCP - dhcp_start(&netif); -#elif USE_AUTOIP - autoip_start(&netif); -#else /* USE_DHCP */ - netif_set_up(&netif); -#endif /* USE_DHCP */ -#else /* USE_ETHERNET_TCPIP */ - /* Use ethernet for PPPoE only */ - netif.flags &= ~(NETIF_FLAG_ETHARP | NETIF_FLAG_IGMP); /* no ARP */ - netif.flags |= NETIF_FLAG_ETHERNET; /* but pure ethernet */ -#endif /* USE_ETHERNET_TCPIP */ - -#if PPP_SUPPORT && PPPOE_SUPPORT - /* start PPPoE after ethernet netif is added! */ - ppp_desc = pppOverEthernetOpen(&netif, NULL, NULL, pppLinkStatusCallback, NULL); -#endif /* PPP_SUPPORT && PPPOE_SUPPORT */ - -#endif /* USE_ETHERNET */ -#if USE_SLIPIF - LWIP_PORT_INIT_SLIP1_IPADDR(&ipaddr_slip1); - LWIP_PORT_INIT_SLIP1_GW(&gw_slip1); - LWIP_PORT_INIT_SLIP1_NETMASK(&netmask_slip1); - printf("Starting lwIP slipif, local interface IP is %s\n", ip_ntoa(&ipaddr_slip1)); -#if SIO_USE_COMPORT - num_slip1++; /* COM ports cannot be 0-based */ -#endif - netif_add(&slipif1, &ipaddr_slip1, &netmask_slip1, &gw_slip1, &num_slip1, slipif_init, ip_input); -#if !USE_ETHERNET - netif_set_default(&slipif1); -#endif /* !USE_ETHERNET */ -#if LWIP_IPV6 - netif_create_ip6_linklocal_address(&slipif1, 1); - printf("SLIP ip6 linklocal address: "); - ip6_addr_debug_print(0xFFFFFFFF & ~LWIP_DBG_HALT, &slipif1.ip6_addr[0]); - printf("\n"); -#endif /* LWIP_IPV6 */ -#if LWIP_NETIF_STATUS_CALLBACK - netif_set_status_callback(&slipif1, status_callback); -#endif /* LWIP_NETIF_STATUS_CALLBACK */ -#if LWIP_NETIF_LINK_CALLBACK - netif_set_link_callback(&slipif1, link_callback); -#endif /* LWIP_NETIF_LINK_CALLBACK */ - netif_set_up(&slipif1); - -#if USE_SLIPIF > 1 - LWIP_PORT_INIT_SLIP2_IPADDR(&ipaddr_slip2); - LWIP_PORT_INIT_SLIP2_GW(&gw_slip2); - LWIP_PORT_INIT_SLIP2_NETMASK(&netmask_slip2); - printf("Starting lwIP SLIP if #2, local interface IP is %s\n", ip_ntoa(&ipaddr_slip2)); -#if SIO_USE_COMPORT - num_slip2++; /* COM ports cannot be 0-based */ -#endif - netif_add(&slipif2, &ipaddr_slip2, &netmask_slip2, &gw_slip2, &num_slip2, slipif_init, ip_input); -#if LWIP_IPV6 - netif_create_ip6_linklocal_address(&slipif1, 1); - printf("SLIP2 ip6 linklocal address: "); - ip6_addr_debug_print(0xFFFFFFFF & ~LWIP_DBG_HALT, &slipif2.ip6_addr[0]); - printf("\n"); -#endif /* LWIP_IPV6 */ -#if LWIP_NETIF_STATUS_CALLBACK - netif_set_status_callback(&slipif2, status_callback); -#endif /* LWIP_NETIF_STATUS_CALLBACK */ -#if LWIP_NETIF_LINK_CALLBACK - netif_set_link_callback(&slipif2, link_callback); -#endif /* LWIP_NETIF_LINK_CALLBACK */ - netif_set_up(&slipif2); -#endif /* USE_SLIPIF > 1*/ -#endif /* USE_SLIPIF */ -} - -#if LWIP_DNS_APP && LWIP_DNS -void dns_found(const char *name, ip_addr_t *addr, void *arg) -{ - LWIP_UNUSED_ARG(arg); - printf("%s: %s\n", name, addr ? ip_ntoa(addr) : ""); -} - -void dns_dorequest(void *arg) -{ - char* dnsname = "3com.com"; - ip_addr_t dnsresp; - LWIP_UNUSED_ARG(arg); - - if (dns_gethostbyname(dnsname, &dnsresp, dns_found, 0) == ERR_OK) { - dns_found(dnsname, &dnsresp, 0); - } -} -#endif /* LWIP_DNS_APP && LWIP_DNS */ - -/* This function initializes applications */ -static void -apps_init() -{ -#if LWIP_DNS_APP && LWIP_DNS - /* wait until the netif is up (for dhcp, autoip or ppp) */ - sys_timeout(5000, dns_dorequest, NULL); -#endif /* LWIP_DNS_APP && LWIP_DNS */ - -#if LWIP_CHARGEN_APP && LWIP_SOCKET - chargen_init(); -#endif /* LWIP_CHARGEN_APP && LWIP_SOCKET */ - -#if LWIP_PING_APP && LWIP_RAW && LWIP_ICMP - ping_init(); -#endif /* LWIP_PING_APP && LWIP_RAW && LWIP_ICMP */ - -#if LWIP_NETBIOS_APP && LWIP_UDP - netbios_init(); -#endif /* LWIP_NETBIOS_APP && LWIP_UDP */ - -#if LWIP_HTTPD_APP && LWIP_TCP -#ifdef LWIP_HTTPD_APP_NETCONN - http_server_netconn_init(); -#else /* LWIP_HTTPD_APP_NETCONN */ - httpd_init(); -#endif /* LWIP_HTTPD_APP_NETCONN */ -#endif /* LWIP_HTTPD_APP && LWIP_TCP */ - -#if LWIP_NETIO_APP && LWIP_TCP - netio_init(); -#endif /* LWIP_NETIO_APP && LWIP_TCP */ - -#if LWIP_RTP_APP && LWIP_SOCKET && LWIP_IGMP - rtp_init(); -#endif /* LWIP_RTP_APP && LWIP_SOCKET && LWIP_IGMP */ - -#if LWIP_SNTP_APP && LWIP_SOCKET - sntp_init(); -#endif /* LWIP_SNTP_APP && LWIP_SOCKET */ - -#if LWIP_SHELL_APP && LWIP_NETCONN - shell_init(); -#endif /* LWIP_SHELL_APP && LWIP_NETCONN */ -#if LWIP_TCPECHO_APP -#if LWIP_NETCONN && defined(LWIP_TCPECHO_APP_NETCONN) - tcpecho_init(); -#else /* LWIP_NETCONN && defined(LWIP_TCPECHO_APP_NETCONN) */ - echo_init(); -#endif -#endif /* LWIP_TCPECHO_APP && LWIP_NETCONN */ -#if LWIP_UDPECHO_APP && LWIP_NETCONN - udpecho_init(); -#endif /* LWIP_UDPECHO_APP && LWIP_NETCONN */ -#if LWIP_SOCKET_EXAMPLES_APP && LWIP_SOCKET - socket_examples_init(); -#endif /* LWIP_SOCKET_EXAMPLES_APP && LWIP_SOCKET */ -#ifdef LWIP_APP_INIT - LWIP_APP_INIT(); -#endif -} - -/* This function initializes this lwIP test. When NO_SYS=1, this is done in - * the main_loop context (there is no other one), when NO_SYS=0, this is done - * in the tcpip_thread context */ -static void -test_init(void * arg) -{ /* remove compiler warning */ -#if NO_SYS - LWIP_UNUSED_ARG(arg); -#else /* NO_SYS */ - sys_sem_t *init_sem; - LWIP_ASSERT("arg != NULL", arg != NULL); - init_sem = (sys_sem_t*)arg; -#endif /* NO_SYS */ - - /* init network interfaces */ - msvc_netif_init(); - - /* init apps */ - apps_init(); - -#if !NO_SYS - sys_sem_signal(init_sem); -#endif /* !NO_SYS */ -} - -#if PPP_SUPPORT -static void pppCloseCallback(void *arg) -{ - int pd = (int)arg; - pppClose(pd); -} -#endif /* PPP_SUPPORT */ - -/* This is somewhat different to other ports: we have a main loop here: - * a dedicated task that waits for packets to arrive. This would normally be - * done from interrupt context with embedded hardware, but we don't get an - * interrupt in windows for that :-) */ -void main_loop() -{ -#if !NO_SYS - err_t err; - sys_sem_t init_sem; -#endif /* NO_SYS */ -#if PPP_SUPPORT -#if !USE_ETHERNET - int count; - u8_t rxbuf[1024]; -#endif - volatile int callClosePpp = 0; -#endif /* PPP_SUPPORT */ - - /* initialize lwIP stack, network interfaces and applications */ -#if NO_SYS - lwip_init(); - test_init(NULL); -#else /* NO_SYS */ - err = sys_sem_new(&init_sem, 0); - tcpip_init(test_init, &init_sem); - /* we have to wait for initialization to finish before - * calling update_adapter()! */ - sys_sem_wait(&init_sem); - sys_sem_free(&init_sem); -#endif /* NO_SYS */ - - /* MAIN LOOP for driver update (and timers if NO_SYS) */ - while (!_kbhit()) { -#if NO_SYS - /* handle timers (already done in tcpip.c when NO_SYS=0) */ - sys_check_timeouts(); -#endif /* NO_SYS */ - -#if USE_ETHERNET -#if !PCAPIF_RX_USE_THREAD - /* check for packets and link status*/ - pcapif_poll(&netif); - /* When pcapif_poll comes back, there are not packets, so sleep to - prevent 100% CPU load. Don't do this in an embedded system since it - increases latency! */ - sys_msleep(1); -#else /* !PCAPIF_RX_USE_THREAD */ - sys_msleep(50); -#endif /* !PCAPIF_RX_USE_THREAD */ -#else /* USE_ETHERNET */ -#if 0 /* set this to 1 if PPP_INPROC_OWNTHREAD==0 or not defined (see ppp.c) */ - /* try to read characters from serial line and pass them to PPPoS */ - count = sio_read(ppp_sio, (u8_t*)rxbuf, 1024); - if(count > 0) { - pppos_input(ppp_desc, rxbuf, count); - } else -#endif - { - /* nothing received, give other tasks a chance to run */ - sys_msleep(1); - } - -#endif /* USE_ETHERNET */ -#if USE_SLIPIF - slipif_poll(&slipif1); -#if USE_SLIPIF > 1 - slipif_poll(&slipif2); -#endif /* USE_SLIPIF > 1 */ -#endif /* USE_SLIPIF */ -#if ENABLE_LOOPBACK && !LWIP_NETIF_LOOPBACK_MULTITHREADING - /* check for loopback packets on all netifs */ - netif_poll_all(); -#endif /* ENABLE_LOOPBACK && !LWIP_NETIF_LOOPBACK_MULTITHREADING */ -#if PPP_SUPPORT - { - int do_hup = 0; - if(do_hup) { - pppSigHUP(ppp_desc); - do_hup = 0; - } - } - if(callClosePpp && (ppp_desc >= 0)) { - /* make sure to disconnect PPP before stopping the program... */ - callClosePpp = 0; -#if NO_SYS - pppClose(ppp_desc); -#else - tcpip_callback_with_block(pppCloseCallback, (void*)ppp_desc, 0); -#endif - ppp_desc = -1; - } -#endif /* PPP_SUPPORT */ - } - -#if PPP_SUPPORT - if(ppp_desc >= 0) { - u32_t started; - printf("Closing PPP connection...\n"); - /* make sure to disconnect PPP before stopping the program... */ -#if NO_SYS - pppClose(ppp_desc); -#else - tcpip_callback_with_block(pppCloseCallback, (void*)ppp_desc, 0); -#endif - ppp_desc = -1; - /* Wait for some time to let PPP finish... */ - started = sys_now(); - do - { -#if USE_ETHERNET && !PCAPIF_RX_USE_THREAD - pcapif_poll(&netif); -#else /* USE_ETHERNET && !PCAPIF_RX_USE_THREAD */ - sys_msleep(50); -#endif /* USE_ETHERNET && !PCAPIF_RX_USE_THREAD */ - /* @todo: need a better check here: only wait until PPP is down */ - } while(sys_now() - started < 5000); - } -#endif /* PPP_SUPPORT */ -#if USE_ETHERNET - /* release the pcap library... */ - pcapif_shutdown(&netif); -#endif /* USE_ETHERNET */ -} - -#if PPP_SUPPORT && PPPOS_SUPPORT -int main(int argc, char **argv) -#else /* PPP_SUPPORT && PPPOS_SUPPORT */ -int main(void) -#endif /* PPP_SUPPORT && PPPOS_SUPPORT */ -{ -#if PPP_SUPPORT && PPPOS_SUPPORT - if(argc > 1) { - sio_idx = (u8_t)atoi(argv[1]); - } - printf("Using serial port %d for PPP\n", sio_idx); -#endif /* PPP_SUPPORT && PPPOS_SUPPORT */ - /* no stdio-buffering, please! */ - setvbuf(stdout, NULL,_IONBF, 0); - - main_loop(); - - return 0; -} diff --git a/lwip/.gitattributes b/lwip/.gitattributes deleted file mode 100644 index f34d43d..0000000 --- a/lwip/.gitattributes +++ /dev/null @@ -1,4 +0,0 @@ -# These files are text and should be normalized -*.txt text -*.c text -*.h text diff --git a/lwip/BUILDING b/lwip/BUILDING new file mode 100644 index 0000000..8202f5f --- /dev/null +++ b/lwip/BUILDING @@ -0,0 +1,107 @@ +Building lwIP +============= + +lwIP uses a CMake based build system. + +The CMake files in this project are designed to +be included into your own CMake files. They are +mainly variable definitions containing a list of +source files and predefined static libraries to +be linked against application code. + +1) lwIP sources: + src/Filelists.cmake provides file lists containing + the lwIP core library. + The file also contains two static libraries, lwipcore + and lwipallapps, where you can link your app against. + This is the file that is useful to all lwIP users. + +2) Example applications: + contrib/Filelists.cmake provides several file lists + containing the example applications. + The file also contains several static libraries + for these example apps. + This file is only useful for you, if you can use one + of the examples in your application, which is normally + not the case. + +3) OS/platform port: + Usually the OS port needs to be provided by the user. + If a port to Linux, Windows or MacOS is useful for + you, you can use + contrib/ports/{win32, unix}/Filelists.cmake + that contains file lists and libraries for + these operating systems. + +VARIABLES +========= +In all cases, you need to provide two variables. + +"LWIP_DIR" pointing to the lwIP directory +Example: +set(LWIP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/externals/lwip) + +"LWIP_INCLUDE_DIRS" that contains the include base paths +- for lwIP itself (${LWIP_DIR}/src/include) +- for lwIP contrib if you use it (${LWIP_DIR}/contrib) +- to a directory containing an OS port +- to a directory containing lwipopts.h + +Example: +set (LWIP_INCLUDE_DIRS + "${LWIP_DIR}/src/include" + "${LWIP_DIR}/contrib" + "${LWIP_DIR}/contrib/ports/unix/port/include" + "${LWIP_DIR}/contrib/examples/example_app" +) + +Putting it all together +======================= +To get a working application, your CMake system +needs to provide the variables described above, e.g. +set (LWIP_DIR ) +set (LWIP_INCLUDE_DIRS + "${LWIP_DIR}/src/include" + "${LWIP_DIR}/contrib" + "/include" + "" +) + +You may add some defines: +set (LWIP_DEFINITIONS LWIP_DEBUG=1) + +Then include the filelists you need: +include(${LWIP_DIR}/src/Filelists.cmake) +include(${LWIP_DIR}/contrib/Filelists.cmake) + +Then, declare you executable: +add_executable(my_app ) + +Add lwIP include dirs to your app: +target_include_directories(my_app PRIVATE ${LWIP_INCLUDE_DIRS}) + +Link your app against the lwIP libs from the filelists you need: +target_link_libraries(my_app lwipcontribapps lwipallapps lwipcore) + +Working example +=============== +Working build examples can be found in the +contrib/ports/{win32, unix}/example_app +subdirectory. +To use them, create a build directory and call cmake with +the lwIP root dir: + +- mkdir build +- cd build +- cmake .. +- cmake --build . + +The CMakeLists.txt will autoselect the correct port +for your system (supported: Linux, Windows, Darwin). + +Makefile based build system +=========================== +lwIP also maintains file lists for Makefile-based +build systems. Look for Filelists.mk files +in the source tree. We try to maintain them, +but lwIP's mainly focused build system is CMake. diff --git a/lwip/CHANGELOG b/lwip/CHANGELOG index 32ca51a..df33490 100644 --- a/lwip/CHANGELOG +++ b/lwip/CHANGELOG @@ -1,10 +1,638 @@ HISTORY + * These are only the most important changes. For a full list, use git log: + http://git.savannah.nongnu.org/cgit/lwip.git -(CVS HEAD) +(git master) * [Enter new changes just after this line - do not remove this line] - ++ New features: + 2018-10-04: Jasper Verschueren + * Implement IPv4 ACD (Address Conflict Detection) + + 2018-10-02: Dirk Ziegelmeier + * Integrate contrib repository into main lwIP rep, tag STABLE-2_1_0_RELEASE + +(STABLE-2.1.1): + + ++ Bugfixes: + + 2018-11-01: Joan Lledó + * sockets.c: fix bad assertion in lwip_poll_dec_sockets_used() (bug #54933) + + 2018-11-01: Dirk Ziegelmeier + * ip4.c: don't send 127.* to default netif (bug #54670) + + 2018-10-23: David Girault + * altcp_tls_mbedtls.c: fix use-after free (bug #54774) + + 2018-10-23: Ognjen Bjelica, Dirk Ziegelmeier + * snmp_scalar.c: Avoid NULL pointer dereference (bug #54886) + + 2018-10-23: Simon Goldschmidt + * Fix missing standard includes in multiple files + + 2018-10-17: Ivan Warren + * def.h: fix casting htonX and ntohX to u16_t (bug #54850) + + 2018-10-12: Simon Goldschmidt + * Revert "tcp_abandon: no need to buffer pcb->local_port" (fix that source port was 0 for RST + called when aborting a connection) + + 2018-10-11: Jonas Rabenstein + * tcp.c: tcp_recved: check for overflow and warn about too big values (patch #9699) + + 2018-10-06: Joan Lledó + * sockets.c: alloc_socket(): Check for LWIP_SOCKET_POLL when setting select- + related variables (patch #9696) + + 2018-10-04: Spencer + * tcp.c: Update prev pointer when skipping entries in tcp_slowtmr (patch #9694) + + 2018-09-27: Martine Lenders + * lowpan6.c: Fix IEEE 802.15.4 address setting (bug #54749) + +(STABLE-2.1.0): + + ++ New features: + + 2018-06-17: Simon Goldschmidt + * lwiperf: implemented iPerf client mode + + 2018-04-23: Dirk Ziegelmeier + * added cmake build files + + 2018-03-04: Ray Abram + * netbios responder: respond to '*' queries + + 2018-02-23: Benjamin Aigner + * 6lowpan: add 6lowpan-over-BLE netif (based on existing 6lowpan netif) + + 2018-02-22: Simon Goldschmidt + * ipv6: add support for stateless DHCPv6 (to get DNS servers in SLAAC nets) + + 2018-02-16: Simon Goldschmidt + * add raw API http(s) client (with proxy support) + + 2018-02-01: Simon Goldschmidt + * tcp: add hooks to implement additional socket options + + 2018-02-01: Simon Goldschmidt + * tcp: add hooks to implement tcp md5 signatures or similar (see contrib/addons for an example) + + 2018-01-05: Simon Goldschmidt + * Added sys_mbox_trypost_fromisr() and tcpip_callbackmsg_trycallback_fromisr() + These can be used to post preallocated messages from an ISR to the tcpip thread + (e.g. when using FreeRTOS) + + 2018-01-02: Dirk Ziegelmeier + * task #14780: Add debug helper asserts to ensure threading/locking requirements are met + + 2017-11-21: Simon Goldschmidt + * task #14600: tcp_alloc(): kill TF_CLOSEPEND connections before other ESTABLISHED + + 2017-11-21: Simon Goldschmidt + * makefsdata: added option "-ssi:" to control SSI tag checking/insertion + through a list of filenames, not by checking the file extension at runtime + + 2017-11-20: Joel Cunningham + * netconn: add LWIP_HOOK_NETCONN_EXTERNAL_RESOLVE to use external DNS resolver (patch #9427) + + 2017-11-14: Joel Cunningham + * netifapi: Add thread safe ARP cache APIs (task #14724) + + 2017-11-06: Axel Lin + * TCP: kill existing connections with a LOWER priority than the one currently being opened. + Previous implementations also kill existing connections of the SAME priority. + + 2017-09-21: Kalle Olavi Niemitalo + * sockets: add poll() implementation (patch #9450) + + 2017-09-10: Joel Cunningham + * sockets: add readv() implementation (task #14610) + + 2017-08-04: Simon Goldschmidt + * Clean up DHCP a bit: no need keep msg_out and msg_in as members in struct + dhcp - they are used in a call stack only (p_out and options_out_len as well) + + 2017-08-04: Simon Goldschmidt + * pbuf: split pbuf_header(s16_t) into pbuf_add_header(size_t) and + pbuf_remove_header(size_t) + + 2017-07-20: Douglas + * sys: deprecate sys_arch_sem_wait and sys_arch_mbox_fetch returning the + time waited rather they are now defined to return != SYS_ARCH_TIMEOUT + on success. + + 2017-07-03: Jakub Schmidtke + * tcp: added support for sending TCP SACKs + + 2017-06-20: Joel Cunningham + * netconn/netdb: added core locking support to netconn_gethostbyname (task #14523) + + 2017-04-25: Simon Goldschmidt + * dhcp: added two hooks for adding and parsing user defined DHCP options + + 2017-04-25: Joel Cunningham + * sockets: added recvmsg for UDP (together with CMSG and IP_PKTINFO) (task #14247) + + 2017-04-20: Joel Cunningham + * tcp: added Appropriate Byte Counting support (task #14128) + + 2017-04-11: Simon Goldschmidt + * netconn/sockets: remove fatal error handling, fix asynchronous error handling, + ensure data before RST can be received + + 2017-03-30: Simon Goldschmidt + * added "application layered TCP" connection API (altcp) for seamless integration + of TLS or proxy connections + + 2017-03-09: Simon Goldschmidt + * sockets: add recvmsg for TCP + + 2017-03-02: Joel Cunningham + * netconn/sockets: vectorize netconn_write for TCP, treating a vectored I/O write + atomically in regards to TCP segmentation (patch #8882) + + 2017-03-02: Simon Goldschmidt + * netconn: added nonblocking accept/recv to netconn API (task #14396) + + 2017-02-28: Simon Goldschmidt + * Added LWIP_SINGLE_NETIF for small targets with only one netif + + 2017-02-10: David van Moolenbroek + * Implement UDP and RAW multicast support for IPv6 (core API, not netconn/sockets) + + 2017-02-04: David van Moolenbroek + * IPv6 scopes support + + 2017-01-20: Joel Cunningham + * sockets: add interface name/index APIs (task #14314) + + 2017-01-08: David van Moolenbroek + * Extensions to RAW API (patch #9208) + - Connected RAW PCBs + - Add raw_sendto_if_src() + - Support IP_HDRINCL socket option + + ++ Bugfixes: + + 2018-06-19: Simon Goldschmidt + * tcp: fix RTO timer not working if link is down + + 2018-06-15: Sylvain Rochet + * ppp: multiple smaller bugfixes + + 2018-05-17: Simon Goldschmidt + * etharp: arp table can now be bigger than 127 entries + + 2018-04-25: Jens Nielsen + * tftp server: correctly handle retransmissions + + 2018-04-18: Simon Goldschmidt + sockets: fix race conditions when closing full-duplex sockets + + 2018-03-09: Simon Goldschmidt + * 6lowpan: fix to work against contiki; added ZigBee encapsulation netif for tests + + 2018-02-04: Simon Goldschmidt + * sockets: fix inconsistencies on close (inconsistent error codes, double FIN) + + 2018-01-05: Dirk Ziegelmeier + * Fix bug #52748: the bug in timeouts.c by reimplementing timer logic to use + absolute instead of relative timeout values + + 2017-12-31: Dirk Ziegelmeier + * Fix bug #52704: DHCP and bad OFFER: Stop timeout only if offer is accepted + + 2017-11-08: Joel Cunningham + * netif: ensure link and admin states are up in issue reports (bug #52353) + + 2017-09-12: David Lockyer + * select: allocate select_cb from memp for LWIP_MPU_COMPATIBLE = 1 (bug #51990) + + 2017-09-11: Simon Goldschmidt + * tcp_in.c: fix bug #51937 (leaking tcp_pcbs on passive close with unacked data) + + 2017-08-11: Joel Cunningham + * lwip_itoa: fix converting the number 0 (previously converted to '\0') (bug #51729) + + 2017-08-08: Dirk Ziegelmeier + * ip4_route_src: parameter order is reversed: ip4_route_src(dest, src) -> ip4_route_src(src, dest) + to make parameter order consistent with other ip*_route*() functions + Same also applies to LWIP_HOOK_IP4_ROUTE_SRC() parameter order. + + 2017-08-04: Joel Cunningham + * tcp: re-work persist timer to fully close window (details in bug #50837) + + 2017-07-26: Simon Goldschmidt + * snmp_msg.c: fix bug #51578 (SNMP failed to decode some values on non 32bit platforms) + + 2017-07-20: Simon Goldschmidt + * compatibility headers: moved from 'src/include/posix' to 'src/include/compat/posix', + 'src/include/compat/stdc' etc. + + 2017-05-09: Joel Cunningham + * tcp: add zero-window probe timeout (bug #50837) + + 2017-04-11: Simon Goldschmidt + * sockets.c: task #14420 (Remove sys_sem_signal from inside SYS_ARCH_PROTECT + crit section) done for LWIP_TCPIP_CORE_LOCKING==1 + + 2017-02-24: Simon Goldschmidt + * sockets.c: fixed close race conditions in lwip_select (for LWIP_NETCONN_FULLDUPLEX) + + 2017-02-24: Simon Goldschmidt + * sockets.c: fixed that select ignored invalid/not open sockets in the fd_sets (bug #50392) + + 2017-01-11: David van Moolenbroek + * Lots of IPv6 related fixes and improvements + +(STABLE-2.0.3) + + ++ Bugfixes: + + 2017-09-11: Simon Goldschmidt + * tcp_in.c: fix bug #51937 (leaking tcp_pcbs on passive close with unacked data) + + 2017-08-02: Abroz Bizjak/Simon Goldschmidt + * multiple fixes in IPv4 reassembly (leading to corrupted datagrams received) + + 2017-03-30: Simon Goldschmidt + * dhcp.c: return ERR_VAL instead of asserting on offset-out-of-pbuf + + 2017-03-23: Dirk Ziegelmeier + * dhcp.h: fix bug #50618 (dhcp_remove_struct() macro does not work) + +(STABLE-2.0.2) + + ++ New features: + + 2017-02-10: Dirk Ziegelmeier + * Implement task #14367: Hooks need a better place to be defined: + We now have a #define for a header file name that is #included in every .c + file that provides hooks. + + 2017-02-10: Simon Goldschmidt + * tcp_close does not fail on memory error (instead, FIN is sent from tcp_tmr) + + ++ Bugfixes: + + 2017-03-08 + * tcp: do not keep sending SYNs when getting ACKs + + 2017-03-08: Joel Cunningham + * tcp: Initialize ssthresh to TCP_SND_BUF (bug #50476) + + 2017-03-01: Simon Goldschmidt + * httpd: LWIP_HTTPD_POST_MANUAL_WND: fixed double-free when httpd_post_data_recved + is called nested from httpd_post_receive_data() (bug #50424) + + 2017-02-28: David van Moolenbroek/Simon Goldschmidt + * tcp: fixed bug #50418: LWIP_EVENT_API: fix invalid calbacks for SYN_RCVD pcb + + 2017-02-17: Simon Goldschmidt + * dns: Improved DNS_LOCAL_HOSTLIST interface (bug #50325) + + 2017-02-16: Simon Goldschmidt + * LWIP_NETCONN_FULLDUPLEX: fixed shutdown during write (bug #50274) + + 2017-02-13: Simon Goldschmidt/Dirk Ziegelmeier + * For tiny targtes, LWIP_RAND is optional (fix compile time checks) + + 2017-02-10: Simon Goldschmidt + * tcp: Fixed bug #47485 (tcp_close() should not fail on memory error) by retrying + to send FIN from tcp_fasttmr + + 2017-02-09: Simon Goldschmidt + * sockets: Fixed bug #44032 (LWIP_NETCONN_FULLDUPLEX: select might work on + invalid/reused socket) by not allowing to reallocate a socket that has + "select_waiting != 0" + + 2017-02-09: Simon Goldschmidt + * httpd: Fixed bug #50059 (httpd LWIP_HTTPD_SUPPORT_11_KEEPALIVE vs. + LWIP_HTTPD_KILL_OLD_ON_CONNECTIONS_EXCEEDED) + + 2017-02-08: Dirk Ziegelmeier + * Rename "IPv6 mapped IPv4 addresses" to their correct name from RFC4191: + "IPv4-mapped IPv6 address" + + 2017-02-08: Luc Revardel + * mld6.c: Fix bug #50220 (mld6_leavegroup does not send ICMP6_TYPE_MLD, even + if last reporter) + + 2017-02-08: David van Moolenbroek + * ip6.c: Patch #9250: fix source substitution in ip6_output_if() + + 2017-02-08: Simon Goldschmidt + * tcp_out.c: Fixed bug #50090 (last_unsent->oversize_left can become wrong value + in tcp_write error path) + + 2017-02-02: Dirk Ziegelmeier + * Fix bug #50206: UDP Netconn bind to IP6_ADDR_ANY fails + + 2017-01-18: Dirk Ziegelmeier + * Fix zero-copy RX, see bug bug #50064. PBUF_REFs were not supported as ARP requests. + + 2017-01-15: Axel Lin, Dirk Ziegelmeier + * minor bug fixes in mqtt + + 2017-01-11: Knut Andre Tidemann + * sockets/netconn: fix broken default ICMPv6 handling of checksums + +(STABLE-2.0.1) + + ++ New features: + + 2016-12-31: Simon Goldschmidt + * tcp.h/.c: added function tcp_listen_with_backlog_and_err() to get the error + reason when listening fails (bug #49861) + + 2016-12-20: Erik Andersen + * Add MQTT client + + 2016-12-14: Jan Breuer: + * opt.h, ndc.h/.c: add support for RDNSS option (as per RFC 6106) + + 2016-12-14: David van Moolenbroek + * opt.h, nd6.c: Added LWIP_HOOK_ND6_GET_GW() + + 2016-12-09: Dirk Ziegelmeier + * ip6_frag.c: Implemented support for LWIP_NETIF_TX_SINGLE_PBUF + + 2016-12-09: Simon Goldschmidt + * dns.c: added one-shot multicast DNS queries + + 2016-11-24: Ambroz Bizjak, David van Moolenbroek + * tcp_out.c: Optimize passing contiguous nocopy buffers to tcp_write (bug #46290) + + 2016-11-16: Dirk Ziegelmeier + * sockets.c: added support for IPv6 mapped IPv4 addresses + + ++ Bugfixes: + + 2016-12-16: Thomas Mueller + * api_lib.c: fixed race condition in return value of netconn_gethostbyname() + (and thus also lwip_gethostbyname/_r() and lwip_getaddrinfo()) + + 2016-12-15: David van Moolenbroek + * opt.h, tcp: added LWIP_HOOK_TCP_ISN() to implement less predictable initial + sequence numbers (see contrib/addons/tcp_isn for an example implementation) + + 2016-12-05: Dirk Ziegelmeier + * fixed compiling with IPv4 disabled (IPv6 only case) + + 2016-11-28: Simon Goldschmidt + * api_lib.c: fixed bug #49725 (send-timeout: netconn_write() can return + ERR_OK without all bytes being written) + + 2016-11-28: Ambroz Bizjak + * tcpi_in.c: fixed bug #49717 (window size in received SYN and SYN-ACK + assumed scaled) + + 2016-11-25: Simon Goldschmidt + * dhcp.c: fixed bug #49676 (Possible endless loop when parsing dhcp options) + + 2016-11-23: Dirk Ziegelmeier + * udp.c: fixed bug #49662: multicast traffic is now only received on a UDP PCB + (and therefore on a UDP socket/netconn) when the PCB is bound to IP_ADDR_ANY + + 2016-11-16: Dirk Ziegelmeier + * *: Fixed dual-stack behaviour, IPv6 mapped IPv4 support in socket API + + 2016-11-14: Joel Cunningham + * tcp_out.c: fixed bug #49533 (start persist timer when unsent seg can't fit + in window) + + 2016-11-16: Roberto Barbieri Carrera + * autoip.c: fixed bug #49610 (sometimes AutoIP fails to reuse the same address) + + 2016-11-11: Dirk Ziegelmeier + * sockets.c: fixed bug #49578 (dropping multicast membership does not work + with LWIP_SOCKET_OFFSET) + +(STABLE-2.0.0) + + ++ New features: + + 2016-07-27: Simon Goldschmidt + * opt.h, timeouts.h/.c: added LWIP_TIMERS_CUSTOM to override the default + implementation of timeouts + + 2016-07-xx: Dirk Ziegelmeier + * Large overhaul of doxygen documentation + + 2016-04-05: Simon Goldschmidt + * timers.h/.c: prepare for overriding current timeout implementation: all + stack-internal caclic timers are avaliable in the lwip_cyclic_timers array + + 2016-03-23: Simon Goldschmidt + * tcp: call accept-callback with ERR_MEM when allocating a pcb fails on + passive open to inform the application about this error + ATTENTION: applications have to handle NULL pcb in accept callback! + + 2016-02-22: Ivan Delamer + * Initial 6LoWPAN support + + 2016-02-XX to 2016-03-XX: Dirk Ziegelmeier + * Cleanup TCPIP thread sync methods in a way that it is possibe to use them + in arbitrary code that needs things to be done in TCPIP thread. Used to + decouple netconn, netif, ppp and 6LoWPAN from LWIP core. + + 2016-02-XX: Dirk Ziegelmeier + * Implement dual-stack support in RAW, UDP and TCP. Add new IP address + type IPADDR_ANY_TYPE for this. Netconn/Socket API: Dual-stack is + automatically supported when an IPv6 netconn/socket is created. + + 2015-12-26: Martin Hentschel and Dirk Ziegelmeier + * Rewrite SNMP agent. SNMPv2c + MIB compiler. + + 2015-11-12: Dirk Ziegelmeier + * Decouple SNMP stack from lwIP core and move stack to apps/ directory. + Breaking change: Users have to call snmp_init() now! + + 2015-11-12: Dirk Ziegelmeier + * Implement possibility to declare private memory pools. This is useful to + decouple some apps from the core (SNMP stack) or make contrib app usage + simpler (httpserver_raw) + + 2015-10-09: Simon Goldschmidt + * started to move "private" header files containing implementation details to + "lwip/priv/" include directory to seperate the API from the implementation. + + 2015-10-07: Simon Goldschmidt + * added sntp client as first "supported" application layer protocol implementation + added 'apps' folder + + 2015-09-30: Dirk Ziegelmeier + * snmp_structs.h, mib_structs.c, mib2.c: snmp: fixed ugly inheritance + implementation by aggregating the "base class" (struct mib_node) in all + derived node classes to get more type-safe code + + 2015-09-23: Simon Goldschmidt + * netif.h/.c, nd6.c: task #13729: Convert netif addresses (IPv4 & IPv6) to + ip_addr_t (so they can be used without conversion/temporary storage) + + 2015-09-08: Dirk Ziegelmeier + * snmp: Separate mib2 counter/table callbacks from snmp agent. This both cleans + up the code and should allow integration of a 3rd party agent/mib2. Simple + counters are kept in MIB2_STATS, tree/table change function prototypes moved to + snmp_mib2.h. + + 2015-09-03: Simon Goldschmidt + * opt.h, dns.h/.c: DNS/IPv6: added support for AAAA records + + 2015-09-01: Simon Goldschmidt + * task #12178: hardware checksum capabilities can be configured per netif + (use NETIF_SET_CHECKSUM_CTRL() in your netif's init function) + + 2015-08-30: Simon Goldschmidt + * PBUF_REF with "custom" pbufs is now supported for RX pbufs (see pcapif in + contrib for an example, LWIP_SUPPORT_CUSTOM_PBUF is required) + + 2015-08-30: Simon Goldschmidt + * support IPv4 source based routing: define LWIP_HOOK_IP4_ROUTE_SRC to point + to a routing function + + 2015-08-05: Simon Goldschmidt + * many files: allow multicast socket options IP_MULTICAST_TTL, IP_MULTICAST_IF + and IP_MULTICAST_LOOP to be used without IGMP + + 2015-04-24: Simon Goldschmidt + * dhcp.h/c, autoip.h/.c: added functions dhcp/autoip_supplied_address() to + check for the source of address assignment (replacement for NETIF_FLAG_DHCP) + + 2015-04-10: Simon Goldschmidt + * many files: task #13480: added LWIP_IPV4 define - IPv4 can be disabled, + leaving an IPv6-only stack + + 2015-04-09: Simon Goldschmidt + * nearly all files: task #12722 (improve IPv4/v6 address handling): renamed + ip_addr_t to ip4_addr_t, renamed ipX_addr_t to ip_addr_t and added IP + version; ip_addr_t is used for all generic IP addresses for the API, + ip(4/6)_addr_t are only used internally or when initializing netifs or when + calling version-related functions + + 2015-03-24: Simon Goldschmidt + * opt.h, ip4_addr.h, ip4.c, ip6.c: loopif is not required for loopback traffic + any more but passed through any netif (ENABLE_LOOPBACK has to be enabled) + + 2015-03-23: Simon Goldschmidt + * opt.h, etharp.c: with ETHARP_TABLE_MATCH_NETIF== 1, duplicate (Auto)-IP + addresses on multiple netifs should now be working correctly (if correctly + addressed by routing, that is) + + 2015-03-23: Simon Goldschmidt + * etharp.c: Stable etharp entries that are about to expire are now refreshed + using unicast to prevent unnecessary broadcast. Only if no answer is received + after 15 seconds, broadcast is used. + + 2015-03-06: Philip Gladstone + * netif.h/.c: patch #8359 (Provide utility function to add an IPv6 address to + an interface) + + 2015-03-05: Simon Goldschmidt + * netif.c, ip4.c, dhcp.c, autoip.c: fixed bug #37068 (netif up/down handling + is unclear): correclty separated administrative status of a netif (up/down) + from 'valid address' status + ATTENTION: netif_set_up() now always has to be called, even when dhcp/autoip + is used! + + 2015-02-26: patch by TabascoEye + * netif.c, udp.h/.c: fixed bug #40753 (re-bind UDP pcbs on change of IP address) + + 2015-02-22: chrysn, Simon Goldschmidt + * *.*: Changed nearly all functions taking 'ip(X)_addr_t' pointer to take + const pointers (changed user callbacks: raw_recv_fn, udp_recv_fn; changed + port callbacks: netif_output_fn, netif_igmp_mac_filter_fn) + + 2015-02-19: Ivan Delamer + * netif.h, dhcp.c: Removed unused netif flag for DHCP. The preferred way to evaluate + if DHCP is active is through netif->dhcp field. + + 2015-02-19: Ivan Delamer + * netif.h, slipif.c, ppp.c: Removed unused netif flag for point to point connections + + 2015-02-18: Simon Goldschmidt + * api_lib.c: fixed bug #37958 "netconn API doesn't handle correctly + connections half-closed by peer" + + 2015-02-18: Simon Goldschmidt + * tcp.c: tcp_alloc() prefers killing CLOSING/LAST_ACK over active connections + (see bug #39565) + + 2015-02-16: Claudius Zingerli, Sergio Caprile + * opt.h, dhcp.h/.c: patch #8361 "Add support for NTP option in DHCP" + + 2015-02-14: Simon Goldschmidt + * opt.h, snmp*: added support for write-access community and dedicated + community for sending traps + + 2015-02-13: Simon Goldschmidt + * opt.h, memp.c: added hook LWIP_HOOK_MEMP_AVAILABLE() to get informed when + a memp pool was empty and an item is now available + + 2015-02-13: Simon Goldschmidt + * opt.h, pbuf.h/.c, etharp.c: Added the option PBUF_LINK_ENCAPSULATION_HLEN to + allocate additional header space for TX on netifs requiring additional headers + + 2015-02-12: chrysn + * timers.h/.c: introduce sys_timeouts_sleeptime (returns the time left before + the next timeout is due, for NO_SYS==1) + + 2015-02-11: Nick van Ijzendoorn + * opt.h, sockets.h/c: patch #7702 "Include ability to increase the socket number + with defined offset" + + 2015-02-11: Frederick Baksik + * opt.h, def.h, others: patch #8423 "arch/perf.h" should be made an optional item + + 2015-02-11: Simon Goldschmidt + * api_msg.c, opt.h: started to implement fullduplex sockets/netconns + (note that this is highly unstable yet!) + + 2015-01-17: Simon Goldschmidt + * api: allow enabling socket API without (public) netconn API - netconn API is + still used by sockets, but keeping it private (static) should allow better + compiler optimizations + + 2015-01-16: Simon Goldschmidt + * tcp_in.c: fixed bug #20506 "Initial congestion window is very small" again + by implementing the calculation formula from RFC3390 + + 2014-12-10: Simon Goldschmidt + * api: added option LWIP_NETCONN_SEM_PER_THREAD to use a semaphore per thread + instead of using one per netconn and per select call + + 2014-12-08: Simon Goldschmidt + * ip6.h: fixed bug #43778: IPv6 header version not set on 16-bit platform + (macro IP6H_VTCFL_SET()) + + 2014-12-08: Simon Goldschmidt + * icmp.c, ip4.c, pbuf.c, udp.c, pbuf.h: task #11472 Support PBUF_REF for RX + (IPv6 and IPv4/v6 reassembly might not work yet) + + 2014-11-06: Simon Goldschmidt + * sockets.c/.h, init.c: lwip_socket_init() is not needed any more + -> compatibility define + + 2014-09-16: Simon Goldschmidt + * dns.c, opt.h: reduced ram usage by parsing DNS responses in place + + 2014-09-16: Simon Goldschmidt + * pbuf.h/.c: added pbuf_take_at() and pbuf_put_at() + + 2014-09-15: Simon Goldschmidt + * dns.c: added source port randomization to make the DNS client more robust + (see bug #43144) + + 2013-09-02: Simon Goldschmidt + * arch.h and many other files: added optional macros PACK_STRUCT_FLD_8() and + PACK_STRUCT_FLD_S() to prevent gcc 4 from warning about struct members that + do not need packing + + 2013-08-19: Simon Goldschmidt + * netif.h: bug #42998: made NETIF_MAX_HWADDR_LEN overridable for some special + networks 2013-03-17: Simon Goldschmidt (patch by Ghobad Emadi) * opt.h, etharp.c: Added LWIP_HOOK_ETHARP_GET_GW to implement IPv4 routing with @@ -48,7 +676,7 @@ HISTORY implementation which is under a BSD-ish license. - Also switched to PolarSSL MD4,MD5,SHA1 implementations, which are meant to be used in embedded devices with reduced memory footprint. - - Removed PPP configuration file parsing support. + - Removed PPP configuration file parsing support. - Added macro definition EAP_SUPPORT to make EAP support optional. - Added macro definition CHAP_SUPPORT to make CHAP support optional. - Added macro definition MSCHAP_SUPPORT to make MSCHAP support optional. @@ -91,79 +719,309 @@ HISTORY - Switched all used PPP types to lwIP types (u8t, u16t, u32t, ...) - Added PPP API "sequential" thread-safe API, based from NETIFAPI. - 2012-03-25: Simon Goldschmidt (idea by Mason) - * posix/*: added posix-compatibility include files posix/netdb.h and posix/sys/socket.h - which are a simple wrapper to the correct lwIP include files. - - 2012-01-16: Simon Goldschmidt - * opt.h, icmp.c: Added option CHECKSUM_GEN_ICMP + 2011-07-21: Simon Goldschmidt + * sockets.c, opt.h: (bug #30185): added LWIP_FIONREAD_LINUXMODE that makes + ioctl/FIONREAD return the size of the next pending datagram. - 2011-12-17: Simon Goldschmidt - * ip.h: implemented API functions to access so_options of IP pcbs (UDP, TCP, RAW) - (fixes bug #35061) + 2011-05-25: Simon Goldschmidt + * again nearly the whole stack, renamed ip.c to ip4.c, ip_addr.c to ip4_addr.c, + combined ipv4/ipv6 inet_chksum.c, added ip.h, ip_addr.h: Combined IPv4 + and IPv6 code where possible, added defines to access IPv4/IPv6 in non-IP + code so that the code is more readable. - 2011-09-27: Simon Goldschmidt - * opt.h, tcp.c, tcp_in.c: Implemented limiting data on ooseq queue (task #9989) - (define TCP_OOSEQ_MAX_BYTES / TCP_OOSEQ_MAX_PBUFS in lwipopts.h) + 2011-05-17: Patch by Ivan Delamer (only checked in by Simon Goldschmidt) + * nearly the whole stack: Finally, we got decent IPv6 support, big thanks to + Ivan! (this is work in progress: we're just post release anyway :-) - 2011-09-21: Simon Goldschmidt - * opt.h, api.h, api_lib.c, api_msg.h/.c, sockets.c: Implemented timeout on - send (TCP only, bug #33820) - 2011-09-21: Simon Goldschmidt - * init.c: Converted runtime-sanity-checks into compile-time checks that can - be disabled (since runtime checks can often not be seen on embedded targets) + ++ Bugfixes: - 2011-09-11: Simon Goldschmidt - * ppp.h, ppp_impl.h: splitted ppp.h to an internal and external header file - to get a clear separation of which functions an application or port may use - (task #11281) + 2016-08-23: Simon Goldschmidt + * etharp: removed ETHARP_TRUST_IP_MAC since it is insecure and we don't need + it any more after implementing unicast ARP renewal towards arp entry timeout - 2011-09-11: Simon Goldschmidt - * opt.h, tcp_impl.h, tcp.c, udp.h/.c: Added a config option to randomize - initial local TCP/UDP ports (so that different port ranges are used after - a reboot; bug #33818; this one added tcp_init/udp_init functions again) + 2016-07-20: Simon Goldschmidt + * memp.h/.c: fixed bug #48442 (memp stats don't work for MEMP_MEM_MALLOC) - 2011-09-03: Simon Goldschmidt - * dhcp.c: DHCP uses LWIP_RAND() for xid's (bug #30302) + 2016-07-21: Simon Goldschmidt (patch by Ambroz Bizjak) + * tcp_in.c, tcp_out.c: fixed bug #48543 (TCP sent callback may prematurely + report sent data when only part of a segment is acked) and don't include + SYN/FIN in snd_buf counter - 2011-08-24: Simon Goldschmidt - * opt.h, netif.h/.c: added netif remove callback (bug #32397) + 2016-07-19: Simon Goldschmidt + * etharp.c: fixed bug #48477 (ARP input packet might update static entry) - 2011-07-26: Simon Goldschmidt - * etharp.c: ETHARP_SUPPORT_VLAN: add support for an external VLAN filter - function instead of only checking for one VLAN (define ETHARP_VLAN_CHECK_FN) + 2016-07-11: Simon Goldschmidt + * tcp_in.c: fixed bug #48476 (TCP sent callback called wrongly due to picking + up old pcb->acked - 2011-07-21: Simon Goldschmidt (patch by hanhui) - * ip4.c, etharp.c, pbuf.h: bug #33634 ip_forward() have a faulty behaviour: - Added pbuf flags to mark incoming packets as link-layer broadcast/multicast. - Also added code to allow ip_forward() to forward non-broadcast packets to - the input netif (set IP_FORWARD_ALLOW_TX_ON_RX_NETIF==1). + 2016-06-30: Simon Goldschmidt (original patch by Fabian Koch) + * tcp_in.c: fixed bug #48170 (Vulnerable to TCP RST spoofing) - 2011-07-21: Simon Goldschmidt - * sockets.c, opt.h: (bug #30185): added LWIP_FIONREAD_LINUXMODE that makes - ioctl/FIONREAD return the size of the next pending datagram. + 2016-05-20: Dirk Ziegelmeier + * sntp.h/.c: Fix return value of sntp_getserver() call to return a pointer - 2011-06-26: Simon Goldschmidt (patch by Cameron Gutman) - * tcp.c, tcp_out.c: bug #33604: added some more asserts to check that - pcb->state != LISTEN + 2016-04-05: Simon Goldschmidt (patch by Philip Gladstone) + * udp.c: patch #8358: allow more combinations of listening PCB for IPv6 - 2011-05-25: Simon Goldschmidt - * again nearly the whole stack, renamed ip.c to ip4.c, ip_addr.c to ip4_addr.c, - combined ipv4/ipv6 inet_chksum.c, added ip.h, ip_addr.h: Combined IPv4 - and IPv6 code where possible, added defines to access IPv4/IPv6 in non-IP - code so that the code is more readable. + 2016-04-05: Simon Goldschmidt + * netconn/socket API: fixed bug# 43739 (Accept not reporting errors about + aborted connections): netconn_accept() returns ERR_ABRT (sockets: ECONNABORTED) + for aborted connections, ERR_CLSD (sockets: EINVAL) if the listening netconn + is closed, which better seems to follow the standard. - 2011-05-17: Patch by Ivan Delamer (only checked in by Simon Goldschmidt) - * nearly the whole stack: Finally, we got decent IPv6 support, big thanks to - Ivan! (this is work in progress: we're just post release anyway :-) + 2016-03-23: Florent Matignon + * dhcp.c: fixed bug #38203: DHCP options are not recorded in all DHCP ack messages - 2011-05-14: Simon Goldschmidt (patch by Stéphane Lesage) - * tcpip.c/.h: patch #7449 allow tcpip callback from interrupt with static - memory message + 2016-03-22: Simon Goldschmidt + * tcp: changed accept handling to be done internally: the application does not + have to call tcp_accepted() any more. Instead, when delaying accept (e.g. sockets + do), call tcp_backlog_delayed()/tcp_backlog_accepted() (fixes bug #46696) + + 2016-03-22: Simon Goldschmidt + * dns.c: ignore dns response parsing errors, only abort resolving for correct + responses or error responses from correct server (bug #47459) + + 2016-03-17: Simon Goldschmidt + * api_msg.c: fixed bug #47448 (netconn/socket leak if RST is received during close) + + 2016-03-17: Joel Cunningham + * api_msg.c: don't fail closing a socket/netconn when failing to allocate the + FIN segment; blocking the calling thread for a while is better than risking + leaking a netconn/socket (see bug #46701) + + 2016-03-16: Joel Cunningham + * tcp_out.c: reset rto timer on fast retransmission + + 2016-03-16: Deomid Ryabkov + * tcp_out.c: fixed bug #46384 Segment size calculation bug with MSS != TCP_MSS + + 2016-03-05: Simon Goldschmidt + * err.h/.c, sockets.c: ERR_IF is not necessarily a fatal error + + 2015-11-19: fix by Kerem Hadimli + * sockets.c: fixed bug #46471: lwip_accept() leaks socket descriptors if new + netconn was already closed because of peer behavior + + 2015-11-12: fix by Valery Ushakov + * tcp_in.c: fixed bug #46365 tcp_accept_null() should call tcp_abort() + + 2015-10-02: Dirk Ziegelmeier/Simon Goldschmidt + * snmp: cleaned up snmp structs API (fixed race conditions from bug #46089, + reduce ram/rom usage of tables): incompatible change for private MIBs + + 2015-09-30: Simon Goldschmidt + * ip4_addr.c: fixed bug #46072: ip4addr_aton() does not check the number range + of all address parts + + 2015-08-28: Simon Goldschmidt + * tcp.c, tcp_in.c: fixed bug #44023: TCP ssthresh value is unclear: ssthresh + is set to the full send window for active open, too, and is updated once + after SYN to ensure the correct send window is used + + 2015-08-28: Simon Goldschmidt + * tcp: fixed bug #45559: Window scaling casts u32_t to u16_t without checks + + 2015-08-26: Simon Goldschmidt + * ip6_frag.h/.c: fixed bug bug #41009: IPv6 reassembly broken on 64-bit platforms: + define IPV6_FRAG_COPYHEADER==1 on these platforms to copy the IPv6 header + instead of referencing it, which gives more room for struct ip6_reass_helper + + 2015-08-25: Simon Goldschmidt + * sockets.c: fixed bug #45827: recvfrom: TCP window is updated with MSG_PEEK + + 2015-08-20: Manoj Kumar + * snmp_msg.h, msg_in.c: fixed bug #43790: Sending octet string of Length >255 + from SNMP agent + + 2015-08-19: Jens Nielsen + * icmp.c, ip4.c, tcp_in.c, udp.c, raw.c: fixed bug #45120: Broadcast & multiple + interfaces handling + + 2015-08-19: Simon Goldschmidt (patch by "Sandra") + * dns.c: fixed bug #45004: dns response without answer might be discarded + + 2015-08-18: Chrysn + * timers.c: patch #8704 fix sys_timeouts_sleeptime function + + 2015-07-01: Erik Ekman + * puf.c: fixed bug #45454 (pbuf_take_at() skips write and returns OK if offset + is at start of pbuf in chain) + + 2015-05-19: Simon Goldschmidt + * dhcp.h/.c: fixed bugs #45140 and #45141 (dhcp was not stopped correctly after + fixing bug #38204) + + 2015-03-21: Simon Goldschmidt (patch by Homyak) + * tcp_in.c: fixed bug #44766 (LWIP_WND_SCALE: tcphdr->wnd was not scaled in + two places) + + 2015-03-21: Simon Goldschmidt + * tcp_impl.h, tcp.c, tcp_in.c: fixed bug #41318 (Bad memory ref in tcp_input() + after tcp_close()) + + 2015-03-21: Simon Goldschmidt + * tcp_in.c: fixed bug #38468 (tcp_sent() not called on half-open connection for + data ACKed with the same ack as FIN) + + 2015-03-21: Simon Goldschmidt (patch by Christoffer Lind) + * dhcp.h/.c: fixed bug #38204 (DHCP lease time not handled correctly) + + 2015-03-20: Simon Goldschmidt + * dhcp.c: fixed bug #38714 (Missing option and client address in DHCPRELEASE message) + + 2015-03-19: Simon Goldschmidt + * api.h, tcpip.h, api_lib.c, api_msg.c: fixed race conditions in assigning + netconn->last_err (fixed bugs #38121 and #37676) + + 2015-03-09: Simon Goldschmidt + * ip4.c: fixed the IPv4 part of bug #43904 (ip_route() must detect linkup status) + + 2015-03-04: Simon Goldschmidt + * nd6.c: fixed bug #43784 (a host should send at least one Router Solicitation) + + 2015-03-04: Valery Ushakov + * ip6.c: fixed bug #41094 (Byte-order bug in IPv6 fragmentation header test) + + 2015-03-04: Zach Smith + * nd6.c: fixed bug #38153 (nd6_input() byte order issues) + + 2015-02-26: Simon Goldschmidt + * netif.c, tcp.h/.c: fixed bug #44378 (TCP connections are not aborted on netif + remove) + + 2015-02-25: Simon Goldschmidt + * ip4.c, etharp.c: fixed bug #40177 (System hangs when dealing with corrupted + packets), implemented task #12357 (Ensure that malicious packets don't + assert-fail): improved some pbuf_header calls to not assert-fail. + + 2015-02-25: patch by Joel Cunningham + * udp.h/.c, sockets.c: fixed bug #43028 (IP_MULTICAST_TTL affects unicast + datagrams) + + 2015-02-25: patch by Greg Renda + * ip4_frag.c: fixed bug #38210 (ip reassembly while remove oldest datagram) + + 2015-02-25: Simon Goldschmidt + * sockets.c: fixed bug #38165 (socket with mulicast): ensure igmp membership + are dropped when socket (not netconn!) is closed. + + 2015-02-25: Simon Goldschmidt + * ip4.h/.c, udp.c: fixed bug #38061 (wrong multicast routing in IPv4) by + adding an optional default netif for multicast routing + + 2015-02-25: Simon Goldschmidt + * netconn API: fixed that netconn_connect still used message passing for + LWIP_TCPIP_CORE_LOCKING==1 + 2015-02-22: patch by Jens Nielsen + * icmp.c: fixed bug #38803 (Source address in broadcast ping reply) - ++ Bugfixes: + 2015-02-22: Simon Goldschmidt + * udp.h, sockets.c: added proper accessor functions for pcb->multicast_ip + (previously used by get/setsockopt only) + + 2015-02-18: Simon Goldschmidt + * sockets.c: Fixed select not reporting received FIN as 'readable' in certain + rare cases (bug #43779: select(), close(), and TCP retransmission error) + + 2015-02-17: Simon Goldschmidt + * err.h, sockets.c, api_msg.c: fixed bug #38853 "connect() use a wrong errno": + return ERR_ALREADY/EALRADY during connect, ERR_ISCONN/EISCONN when already + connected + + 2015-02-17: Simon Goldschmidt + * tcp_impl.h, tcp_out.c, tcp.c, api_msg.c: fixed bug #37614 "Errors from + ipX_output are not processed". Now tcp_output(_segment) checks for the return + value of ipX_output and does not try to send more on error. A netif driver + can call tcp_txnow() (from tcpip_thread!) to try to send again if TX buffers + are available again. + + 2015-02-14: patches by Freddie Chopin + * snmp*: made community writable, fixed some const pointers + + 2015-02-13: Simon Goldschmidt + * msg_in.c: fixed bug #22070 "MIB_OBJECT_WRITE_ONLY not implemented in SNMP" + + 2015-02-12: Simon Goldschmidt + * ip.h, ip4.c, ip6.c: fixed bug #36403 "ip4_input() and ip6_input() always pass + inp to higher layers": now the accepting netif is passed up, but the input + netif is available through ip_current_input_netif() if required. + + 2015-02-11: patch by hichard + * tcpip.c: fixed bug #43094 "The function tcpip_input() forget to handle IPv6" + + 2015-02-10: Simon Goldschmidt + * netconn API: fixed that netconn_close/netconn_delete still used message passing + for LWIP_TCPIP_CORE_LOCKING==1 + + 2015-02-10: Simon Goldschmidt + * netconn/socket api: fixed bug #44225 "closing TCP socket should time out + eventually", implemented task #6930 "Implement SO_LINGER": closing TCP sockets + times out after 20 seconds or after the configured SND_TIMEOUT or depending + on the linger settings. + + 2015-01-27: Simon Goldschmidt + * api_msg.c: fixed that SHUT_RD followed by SHUT_WR was different to SHUT_RDWR, + fixed return value of lwip_netconn_do_close on unconnected netconns + + 2015-01-17: Simon Goldschmidt + * sockets.c: fixed bug #43361 select() crashes with stale FDs + + 2015-01-17: Simon Goldschmidt + * sockets.c/.h, memp_std.h: fixed bug #40788 "lwip_setsockopt_internal() crashes" + by rewriting set/getsockopt functions to combine checks with the actual code + and add more NULL checks; this also fixes that CORE_LOCKING used message + passing for set/getsockopt. + + 2014-12-19: Simon Goldschmidt + * opt.h, dhcp.h/.c: prevent dhcp from starting when netif link is down (only + when LWIP_DHCP_CHECK_LINK_UP==1, which is disabled by default for + compatibility reasons) + + 2014-12-17: Simon Goldschmidt + * tcp_out.c: fixed bug #43840 Checksum error for TCP_CHECKSUM_ON_COPY==1 for + no-copy data with odd length + + 2014-12-10: Simon Goldschmidt + * sockets.c, tcp.c, others: fixed bug #43797 set/getsockopt: SO_SNDTIMEO/SO_RCVTIMEO + take int as option but should take timeval (LWIP_SO_SNDRCVTIMEO_STANDARD==0 can + be used to revert to the old 'winsock' style behaviour) + Fixed implementation of SO_ACCEPTCONN to just look at the pcb state + + 2014-12-09: Simon Goldschmidt + * ip4.c: fixed bug #43596 IGMP queries from 0.0.0.0 are discarded + + 2014-10-21: Simon Goldschmidt (patch by Joel Cunningham and Albert Huitsing) + * sockts.c: fixed bugs #41495 Possible threading issue in select() and #43278 + event_callback() handle context switch when calling sys_sem_signal() + + 2014-10-21: Simon Goldschmidt + * api_msg.c: fixed bug #38219 Assert on TCP netconn_write with sndtimeout set + + 2014-09-16: Kevin Cernekee + * dns.c: patch #8480 Fix handling of dns_seqno wraparound + + 2014-09-16: Simon Goldschmidt + * tcp_out.c: fixed bug #43192 tcp_enqueue_flags() should not check TCP_SND_QUEUELEN + when sending FIN + + 2014-09-03: Simon Goldschmidt + * msg_in.c: fixed bug #39355 SNMP Memory Leak in case of error + + 2014-09-02: Simon Goldschmidt + * err.h/.c, sockets.c, api_msg.c: fixed bug #43110 call getpeername() before + listen() will cause a error + + 2014-09-02: Simon Goldschmidt + * sockets.c: fixed bug #42117 lwip_fcntl does not set errno + + 2014-09-02: Simon Goldschmidt + * tcp.c: fixed bug #42299 tcp_abort() leaves freed pcb on tcp_bound_pcbs list + + 2014-08-20: Simon Goldschmidt + * dns.c: fixed bug #42987 lwIP is vulnerable to DNS cache poisoning due to + non-randomized TXIDs 2014-06-03: Simon Goldschmidt * tcp_impl.h, tcp_in.c: fixed bug #37969 SYN packet dropped as short packet in @@ -304,15 +1162,6 @@ HISTORY 2013-01-11: Simon Goldschmidt * raw.c: fixed bug #38066 Raw pcbs can alter packet without eating it - 2012-09-26: Simon Goldschmidt - * api_msg.c: fixed bug #37405 'err_tcp()' uses already freed 'netconn' object - - 2012-09-26: patch by Henrik Persson - * dhcp.c: patch #7843 Fix corner case with dhcp timeouts - - 2012-09-26: patch by Henrik Persson - * dhcp.c: patch #7840 Segfault in dhcp_parse_reply if no end marker in dhcp packet - 2012-08-22: Simon Goldschmidt * memp.c: fixed bug #37166: memp_sanity check loops itself @@ -331,10 +1180,6 @@ HISTORY * memp.c: fixed bug #36412: memp.c does not compile when MEMP_OVERFLOW_CHECK > zero and MEMP_SEPARATE_POOLS == 1 - 2012-05-08: Simon Goldschmidt - * tcp_out.c: fixed bug #36380: unsent_oversize mismatch in 1.4.1RC1 (this was - a debug-check issue only) - 2012-05-03: Simon Goldschmidt (patch by Sylvain Rochet) * ppp.c: fixed bug #36283 (PPP struct used on header size computation and not packed) @@ -343,13 +1188,6 @@ HISTORY * ppp.c: fixed bug #36388 (PPP: checksum-only in last pbuf leads to pbuf with zero length) - 2012-03-27: Simon Goldschmidt - * vj.c: fixed bug #35756 header length calculation problem in ppp/vj.c - - 2012-03-27: Simon Goldschmidt (patch by Mason) - * tcp_out.c: fixed bug #35945: SYN packet should provide the recv MSS not the - send MSS - 2012-03-25: Simon Goldschmidt * api_msg.c: Fixed bug #35817: do_connect() invalidly signals op_completed for UDP/RAW with LWIP_TCPIP_CORE_LOCKING==1 @@ -358,12 +1196,104 @@ HISTORY * api_msg.h, api_lib.c, api_msg.c, netifapi.c: fixed bug #35931: Name space pollution in api_msg.c and netifapi.c + 2011-08-24: Simon Goldschmidt + * inet6.h: fixed bug #34124 struct in6_addr does not conform to the standard + + + +(STABLE-1.4.1) + + ++ New features: + + 2012-03-25: Simon Goldschmidt (idea by Mason) + * posix/*: added posix-compatibility include files posix/netdb.h and posix/sys/socket.h + which are a simple wrapper to the correct lwIP include files. + + 2012-01-16: Simon Goldschmidt + * opt.h, icmp.c: Added option CHECKSUM_GEN_ICMP + + 2011-12-17: Simon Goldschmidt + * ip.h: implemented API functions to access so_options of IP pcbs (UDP, TCP, RAW) + (fixes bug #35061) + + 2011-09-27: Simon Goldschmidt + * opt.h, tcp.c, tcp_in.c: Implemented limiting data on ooseq queue (task #9989) + (define TCP_OOSEQ_MAX_BYTES / TCP_OOSEQ_MAX_PBUFS in lwipopts.h) + + 2011-09-21: Simon Goldschmidt + * opt.h, api.h, api_lib.c, api_msg.h/.c, sockets.c: Implemented timeout on + send (TCP only, bug #33820) + + 2011-09-21: Simon Goldschmidt + * init.c: Converted runtime-sanity-checks into compile-time checks that can + be disabled (since runtime checks can often not be seen on embedded targets) + + 2011-09-11: Simon Goldschmidt + * ppp.h, ppp_impl.h: splitted ppp.h to an internal and external header file + to get a clear separation of which functions an application or port may use + (task #11281) + + 2011-09-11: Simon Goldschmidt + * opt.h, tcp_impl.h, tcp.c, udp.h/.c: Added a config option to randomize + initial local TCP/UDP ports (so that different port ranges are used after + a reboot; bug #33818; this one added tcp_init/udp_init functions again) + + 2011-09-03: Simon Goldschmidt + * dhcp.c: DHCP uses LWIP_RAND() for xid's (bug #30302) + + 2011-08-24: Simon Goldschmidt + * opt.h, netif.h/.c: added netif remove callback (bug #32397) + + 2011-07-26: Simon Goldschmidt + * etharp.c: ETHARP_SUPPORT_VLAN: add support for an external VLAN filter + function instead of only checking for one VLAN (define ETHARP_VLAN_CHECK_FN) + + 2011-07-21: Simon Goldschmidt (patch by hanhui) + * ip4.c, etharp.c, pbuf.h: bug #33634 ip_forward() have a faulty behaviour: + Added pbuf flags to mark incoming packets as link-layer broadcast/multicast. + Also added code to allow ip_forward() to forward non-broadcast packets to + the input netif (set IP_FORWARD_ALLOW_TX_ON_RX_NETIF==1). + + 2011-06-26: Simon Goldschmidt (patch by Cameron Gutman) + * tcp.c, tcp_out.c: bug #33604: added some more asserts to check that + pcb->state != LISTEN + + 2011-05-14: Simon Goldschmidt (patch by Stéphane Lesage) + * tcpip.c/.h: patch #7449 allow tcpip callback from interrupt with static + memory message + + + ++ Bugfixes: + + 2012-09-26: Simon Goldschmidt + * api_msg.c: fixed bug #37405 'err_tcp()' uses already freed 'netconn' object + + 2012-09-26: patch by Henrik Persson + * dhcp.c: patch #7843 Fix corner case with dhcp timeouts + + 2012-09-26: patch by Henrik Persson + * dhcp.c: patch #7840 Segfault in dhcp_parse_reply if no end marker in dhcp packet + + 2012-08-22: Simon Goldschmidt + * memp.c: fixed bug #37166: memp_sanity check loops itself + + 2012-05-08: Simon Goldschmidt + * tcp_out.c: fixed bug: #36380 unsent_oversize mismatch in 1.4.1RC1 (this was + a debug-check issue only) + + 2012-03-27: Simon Goldschmidt + * vj.c: fixed bug #35756 header length calculation problem in ppp/vj.c + + 2012-03-27: Simon Goldschmidt (patch by Mason) + * tcp_out.c: fixed bug #35945: SYN packet should provide the recv MSS not the + send MSS + 2012-03-22: Simon Goldschmidt * ip4.c: fixed bug #35927: missing refragmentaion in ip_forward - + 2012-03-20: Simon Goldschmidt (patch by Mason) * netdb.c: fixed bug #35907: lwip_gethostbyname_r returns an invalid h_addr_list - + 2012-03-12: Simon Goldschmidt (patch by Bostjan Meglic) * ppp.c: fixed bug #35809: PPP GetMask(): Compiler warning on big endian, possible bug on little endian system @@ -380,7 +1310,7 @@ HISTORY * etharp.c: fixed bug #35531: Impossible to send multicast without a gateway (introduced when fixing bug# 33551) - 2012-02-16: Simon Goldschmidt (patch by Stéphane Lesage) + 2012-02-16: Simon Goldschmidt (patch by Stéphane Lesage) * msg_in.c, msg_out.c: fixed bug #35536 SNMP: error too big response is malformed 2012-02-15: Simon Goldschmidt @@ -516,9 +1446,6 @@ HISTORY 2011-09-01: Simon Goldschmidt * tcp_in.c: fixed bug #34111 RST for ACK to listening pcb has wrong seqno - 2011-08-24: Simon Goldschmidt - * inet6.h: fixed bug #34124 struct in6_addr does not conform to the standard - 2011-08-24: Simon Goldschmidt * api_msg.c, sockets.c: fixed bug #33956 Wrong error returned when calling accept() on UDP connections @@ -568,6 +1495,9 @@ HISTORY 2011-06-26: Simon Goldschmidt * mem.c: fixed bug #33544 "warning in mem.c in lwip 1.4.0 with NO_SYS=1" + 2011-05-25: Simon Goldschmidt + * tcp.c: fixed bug #33398 (pointless conversion when checking TCP port range) + (STABLE-1.4.0) @@ -818,7 +1748,7 @@ HISTORY 2011-03-27: Simon Goldschmidt * sockets.c: Fixed bug #32906: lwip_connect+lwip_send did not work for udp and raw pcbs with LWIP_TCPIP_CORE_LOCKING==1. - + 2011-03-27: Simon Goldschmidt * tcp_out.c: Fixed bug #32820 (Outgoing TCP connections created before route is present never times out) by starting retransmission timer before checking @@ -871,7 +1801,7 @@ HISTORY 2010-11-23: Simon Goldschmidt * tcp_in.c: Fixed bug #30577: tcp_input: don't discard ACK-only packets after refusing 'refused_data' again. - + 2010-11-22: Simon Goldschmidt * sockets.c: Fixed bug #31590: getsockopt(... SO_ERROR ...) gives EINPROGRESS after a successful nonblocking connection. @@ -916,21 +1846,21 @@ HISTORY 2010-08-01: Simon Goldschmidt (patch by Greg Renda) * ppp.c: Applied patch #7264 (PPP protocols are rejected incorrectly on big endian architectures) - + 2010-07-28: Simon Goldschmidt * api_lib.c, api_msg.c, sockets.c, mib2.c: Fixed compilation with TCP or UDP disabled. - + 2010-07-27: Simon Goldschmidt * tcp.c: Fixed bug #30565 (tcp_connect() check bound list): that check did no harm but never did anything - + 2010-07-21: Simon Goldschmidt * ip.c: Fixed invalid fix for bug #30402 (CHECKSUM_GEN_IP_INLINE does not add IP options) 2010-07-16: Kieran Mansley - * msg_in.c: Fixed SNMP ASN constant defines to not use ! operator + * msg_in.c: Fixed SNMP ASN constant defines to not use ! operator 2010-07-10: Simon Goldschmidt * ip.c: Fixed bug #30402: CHECKSUM_GEN_IP_INLINE does not add IP options @@ -1034,7 +1964,7 @@ HISTORY 2010-03-05: Simon Goldschmidt * api_msg.c: Correctly set TCP_WRITE_FLAG_MORE when netconn_write is split - into multiple calls to tcp_write. + into multiple calls to tcp_write. 2010-02-21: Simon Goldschmidt * opt.h, mem.h, dns.c: task #10140: Remove DNS_USES_STATIC_BUF (keep @@ -1105,11 +2035,11 @@ HISTORY * igmp.c/.h, ip.h: Moved most defines from igmp.h to igmp.c for clarity since they are not used anywhere else. - 2010-02-08: Simon Goldschmidt (Stéphane Lesage) + 2010-02-08: Simon Goldschmidt (Stéphane Lesage) * igmp.c, igmp.h, stats.c, stats.h: Improved IGMP stats (patch from bug #28798) - 2010-02-08: Simon Goldschmidt (Stéphane Lesage) + 2010-02-08: Simon Goldschmidt (Stéphane Lesage) * igmp.c: Fixed bug #28798 (Error in "Max Response Time" processing) and another bug when LWIP_RAND() returns zero. @@ -1346,7 +2276,7 @@ HISTORY LWIP_AUTOIP_CREATE_SEED_ADDR() returned address in host byte order instead of network byte order - 2009-10-11 Simon Goldschmidt (Jörg Kesten) + 2009-10-11 Simon Goldschmidt (Jörg Kesten) * tcp_out.c: Fixed bug #27504: tcp_enqueue wrongly concatenates segments which are not consecutive when retransmitting unacked segments @@ -1494,7 +2424,7 @@ HISTORY sent to mbox 2009-06-25 Kieran Mansley - * api_msg.c api.h: BUG26722: initialise netconn write variables + * api_msg.c api.h: BUG26722: initialise netconn write variables in netconn_alloc 2009-06-25 Kieran Mansley @@ -1502,7 +2432,7 @@ HISTORY 2009-06-25 Kieran Mansley * tcp.c, tcp_in.c, tcp_out.c, tcp.h: BUG26301 and BUG26267: correct - simultaneous close behaviour, and make snd_nxt have the same meaning + simultaneous close behaviour, and make snd_nxt have the same meaning as in the RFCs. 2009-05-12 Simon Goldschmidt @@ -1524,7 +2454,7 @@ HISTORY 2009-05-04 Simon Goldschmidt * init.c: snmp was not initialized in lwip_init() - 2009-05-04 Frédéric Bernon + 2009-05-04 Frédéric Bernon * dhcp.c, netbios.c: Changes if IP_SOF_BROADCAST is enabled. 2009-05-03 Simon Goldschmidt @@ -1544,7 +2474,7 @@ HISTORY 2009-05-01 Simon Goldschmidt * ppp.c: bug #24228: Memory corruption with PPP and DHCP - 2009-04-29 Frédéric Bernon + 2009-04-29 Frédéric Bernon * raw.c, udp.c, init.c, opt.h, ip.h, sockets.h: bug #26309: Implement the SO(F)_BROADCAST filter for all API layers. Avoid the unindented reception of broadcast packets even when this option wasn't set. Port maintainers @@ -1566,7 +2496,7 @@ HISTORY when debugging": memp_sizes contained the wrong sizes (including sanity regions); memp pools for MEM_USE_POOLS were too small - 2009-04-24 Simon Goldschmidt, Frédéric Bernon + 2009-04-24 Simon Goldschmidt, Frédéric Bernon * inet.c: patch #6765: Fix a small problem with the last changes (incorrect behavior, with with ip address string not ended by a '\0', a space or a end of line) @@ -1638,7 +2568,7 @@ HISTORY * tcp.c, tcp_in.c, tcp.h: add tcp_abandon() to cope with dropping connections where no reset required (bug #25622) - * tcp_out.c: set TCP_ACK flag on keepalive and zero window probes + * tcp_out.c: set TCP_ACK flag on keepalive and zero window probes (bug #20779) 2009-02-18 Simon Goldschmidt (Jonathan Larmour and Bill Auerbach) @@ -1674,9 +2604,9 @@ HISTORY out of pool pbufs. 2008-12-19 Simon Goldschmidt - * many files: patch #6699: fixed some warnings on platform where sizeof(int) == 2 + * many files: patch #6699: fixed some warnings on platform where sizeof(int) == 2 - 2008-12-10 Tamas Somogyi, Frédéric Bernon + 2008-12-10 Tamas Somogyi, Frédéric Bernon * sockets.c: fixed bug #25051: lwip_recvfrom problem with udp: fromaddr and port uses deleted netbuf. @@ -1710,7 +2640,7 @@ HISTORY * api_msg.c: fixed bug #23847: do_close_internal references freed memory (when tcp_close returns != ERR_OK) - 2008-07-08 Frédéric Bernon + 2008-07-08 Frédéric Bernon * stats.h: Fix some build bugs introduced with patch #6483 (missing some parameters in macros, mainly if MEM_STATS=0 and MEMP_STATS=0). @@ -1758,52 +2688,52 @@ HISTORY * inet_chksum.c: Allow choice of one of the sample algorithms to be made from lwipopts.h. Fix comment on how to override LWIP_CHKSUM. - 2008-01-22 Frédéric Bernon - * tcp.c, tcp_in.c, tcp.h, opt.h: Rename LWIP_CALCULATE_EFF_SEND_MSS in + 2008-01-22 Frédéric Bernon + * tcp.c, tcp_in.c, tcp.h, opt.h: Rename LWIP_CALCULATE_EFF_SEND_MSS in TCP_CALCULATE_EFF_SEND_MSS to have coherent TCP options names. - 2008-01-14 Frédéric Bernon + 2008-01-14 Frédéric Bernon * rawapi.txt, api_msg.c, tcp.c, tcp_in.c, tcp.h: changes for task #7675 "Enable to refuse data on a TCP_EVENT_RECV call". Important, behavior changes for the tcp_recv callback (see rawapi.txt). - 2008-01-14 Frédéric Bernon, Marc Chaland + 2008-01-14 Frédéric Bernon, Marc Chaland * ip.c: Integrate patch #6369" ip_input : checking before realloc". - - 2008-01-12 Frédéric Bernon + + 2008-01-12 Frédéric Bernon * tcpip.h, tcpip.c, api.h, api_lib.c, api_msg.c, sockets.c: replace the field netconn::sem per netconn::op_completed like suggested for the task #7490 "Add return value to sys_mbox_post". - 2008-01-12 Frédéric Bernon + 2008-01-12 Frédéric Bernon * api_msg.c, opt.h: replace DEFAULT_RECVMBOX_SIZE per DEFAULT_TCP_RECVMBOX_SIZE, DEFAULT_UDP_RECVMBOX_SIZE and DEFAULT_RAW_RECVMBOX_SIZE (to optimize queues sizes), like suggested for the task #7490 "Add return value to sys_mbox_post". - 2008-01-10 Frédéric Bernon + 2008-01-10 Frédéric Bernon * tcpip.h, tcpip.c: add tcpip_callback_with_block function for the task #7490 "Add return value to sys_mbox_post". tcpip_callback is always defined as "blocking" ("block" parameter = 1). - 2008-01-10 Frédéric Bernon + 2008-01-10 Frédéric Bernon * tcpip.h, tcpip.c, api.h, api_lib.c, api_msg.c, sockets.c: replace the field netconn::mbox (sys_mbox_t) per netconn::sem (sys_sem_t) for the task #7490 "Add return value to sys_mbox_post". - 2008-01-05 Frédéric Bernon + 2008-01-05 Frédéric Bernon * sys_arch.txt, api.h, api_lib.c, api_msg.h, api_msg.c, tcpip.c, sys.h, opt.h: Introduce changes for task #7490 "Add return value to sys_mbox_post" with some modifications in the sys_mbox api: sys_mbox_new take a "size" parameters which indicate the number of pointers query by the mailbox. There is three defines - in opt.h to indicate sizes for tcpip::mbox, netconn::recvmbox, and for the - netconn::acceptmbox. Port maintainers, you can decide to just add this new + in opt.h to indicate sizes for tcpip::mbox, netconn::recvmbox, and for the + netconn::acceptmbox. Port maintainers, you can decide to just add this new parameter in your implementation, but to ignore it to keep the previous behavior. The new sys_mbox_trypost function return a value to know if the mailbox is full or if the message is posted. Take a look to sys_arch.txt for more details. This new function is used in tcpip_input (so, can be called in an interrupt context since the function is not blocking), and in recv_udp and recv_raw. - 2008-01-04 Frédéric Bernon, Simon Goldschmidt, Jonathan Larmour + 2008-01-04 Frédéric Bernon, Simon Goldschmidt, Jonathan Larmour * rawapi.txt, api.h, api_lib.c, api_msg.h, api_msg.c, sockets.c, tcp.h, tcp.c, tcp_in.c, init.c, opt.h: rename backlog options with TCP_ prefix, limit the "backlog" parameter in an u8_t, 0 is interpreted as "smallest queue", add @@ -1812,31 +2742,31 @@ HISTORY 2007-12-31 Kieran Mansley (based on patch from Per-Henrik Lundbolm) * tcp.c, tcp_in.c, tcp_out.c, tcp.h: Add TCP persist timer - 2007-12-31 Frédéric Bernon, Luca Ceresoli + 2007-12-31 Frédéric Bernon, Luca Ceresoli * autoip.c, etharp.c: ip_addr.h: Integrate patch #6348: "Broadcast ARP packets in autoip". The change in etharp_raw could be removed, since all calls to etharp_raw use ethbroadcast for the "ethdst_addr" parameter. But it could be wrong in the future. - 2007-12-30 Frédéric Bernon, Tom Evans + 2007-12-30 Frédéric Bernon, Tom Evans * ip.c: Fix bug #21846 "LwIP doesn't appear to perform any IP Source Address Filtering" reported by Tom Evans. - 2007-12-21 Frédéric Bernon, Simon Goldschmidt, Jonathan Larmour + 2007-12-21 Frédéric Bernon, Simon Goldschmidt, Jonathan Larmour * tcp.h, opt.h, api.h, api_msg.h, tcp.c, tcp_in.c, api_lib.c, api_msg.c, sockets.c, init.c: task #7252: Implement TCP listen backlog: Warning: raw API applications have to call 'tcp_accepted(pcb)' in their accept callback to keep accepting new connections. - 2007-12-13 Frédéric Bernon + 2007-12-13 Frédéric Bernon * api_msg.c, err.h, err.c, sockets.c, dns.c, dns.h: replace "enum dns_result" by err_t type. Add a new err_t code "ERR_INPROGRESS". - 2007-12-12 Frédéric Bernon + 2007-12-12 Frédéric Bernon * dns.h, dns.c, opt.h: move DNS options to the "right" place. Most visibles are the one which have ram usage. - 2007-12-05 Frédéric Bernon + 2007-12-05 Frédéric Bernon * netdb.c: add a LWIP_DNS_API_HOSTENT_STORAGE option to decide to use a static set of variables (=0) or a local one (=1). In this last case, your port should provide a function "struct hostent* sys_thread_hostent( struct hostent* h)" @@ -1868,7 +2798,7 @@ HISTORY based on the MTU of the netif used to send. Enabled by default. Disable by setting LWIP_CALCULATE_EFF_SEND_MSS to 0. This fixes bug #21492. - 2007-11-19 Frédéric Bernon + 2007-11-19 Frédéric Bernon * api_msg.c, dns.h, dns.c: Implement DNS_DOES_NAME_CHECK option (check if name received match the name query), implement DNS_USES_STATIC_BUF (the place where copy dns payload to parse the response), return an error if there is no place @@ -1885,7 +2815,7 @@ HISTORY dns resolver function for netconn api (netconn_gethostbyname) and socket api (gethostbyname/gethostbyname_r). - 2007-11-15 Jim Pettinato, Frédéric Bernon + 2007-11-15 Jim Pettinato, Frédéric Bernon * opt.h, init.c, tcpip.c, dhcp.c, dns.h, dns.c: add DNS client for simple name requests with RAW api interface. Initialization is done in lwip_init() with build time options. DNS timer is added in tcpip_thread context. DHCP can set @@ -1904,7 +2834,7 @@ HISTORY core header files in api.h (ip/tcp/udp/raw.h) to hide the internal implementation from netconn api applications. - 2007-11-03 Frédéric Bernon + 2007-11-03 Frédéric Bernon * api.h, api_lib.c, api_msg.c, sockets.c, opt.h: add SO_RCVBUF option for UDP & RAW netconn. You need to set LWIP_SO_RCVBUF=1 in your lwipopts.h (it's disabled by default). Netconn API users can use the netconn_recv_bufsize macro to access @@ -1912,15 +2842,15 @@ HISTORY netconn::recv_avail which need to be more "thread-safe" (note there is already the problem for FIONREAD with lwip_ioctl/ioctlsocket). - 2007-11-01 Frédéric Bernon, Marc Chaland + 2007-11-01 Frédéric Bernon, Marc Chaland * sockets.h, sockets.c, api.h, api_lib.c, api_msg.h, api_msg.c, tcp.h, tcp_out.c: Integrate "patch #6250 : MSG_MORE flag for send". MSG_MORE is used at socket api layer, NETCONN_MORE at netconn api layer, and TCP_WRITE_FLAG_MORE at raw api layer. This option enable to delayed TCP PUSH flag on multiple "write" calls. Note that previous "copy" parameter for "write" APIs is now called "apiflags". - 2007-10-24 Frédéric Bernon - * api.h, api_lib.c, api_msg.c: Add macro API_EVENT in the same spirit than + 2007-10-24 Frédéric Bernon + * api.h, api_lib.c, api_msg.c: Add macro API_EVENT in the same spirit than TCP_EVENT_xxx macros to get a code more readable. It could also help to remove some code (like we have talk in "patch #5919 : Create compile switch to remove select code"), but it could be done later. @@ -1939,23 +2869,23 @@ HISTORY * tcpip.c, etharp.h, etharp.c: moved ethernet_input from tcpip.c to etharp.c so all netifs (or ports) can use it. - 2007-10-05 Frédéric Bernon - * netifapi.h, netifapi.c: add function netifapi_netif_set_default. Change the + 2007-10-05 Frédéric Bernon + * netifapi.h, netifapi.c: add function netifapi_netif_set_default. Change the common function to reduce a little bit the footprint (for all functions using only the "netif" parameter). - 2007-10-03 Frédéric Bernon + 2007-10-03 Frédéric Bernon * netifapi.h, netifapi.c: add functions netifapi_netif_set_up, netifapi_netif_set_down, netifapi_autoip_start and netifapi_autoip_stop. Use a common function to reduce a little bit the footprint (for all functions using only the "netif" parameter). - 2007-09-15 Frédéric Bernon + 2007-09-15 Frédéric Bernon * udp.h, udp.c, sockets.c: Changes for "#20503 IGMP Improvement". Add IP_MULTICAST_IF option in socket API, and a new field "multicast_ip" in "struct udp_pcb" (for netconn and raw API users), only if LWIP_IGMP=1. Add getsockopt processing for IP_MULTICAST_TTL and IP_MULTICAST_IF. - 2007-09-10 Frédéric Bernon + 2007-09-10 Frédéric Bernon * snmp.h, mib2.c: enable to remove SNMP timer (which consumne several cycles even when it's not necessary). snmp_agent.txt tell to call snmp_inc_sysuptime() each 10ms (but, it's intrusive if you use sys_timeout feature). Now, you can @@ -1964,10 +2894,10 @@ HISTORY or snmp_add_sysuptime(), and to define the SNMP_GET_SYSUPTIME(sysuptime) macro. This one is undefined by default in mib2.c. SNMP_GET_SYSUPTIME is called inside snmp_get_sysuptime(u32_t *value), and enable to change "sysuptime" value only - when it's queried (any direct call to "sysuptime" is changed by a call to + when it's queried (any direct call to "sysuptime" is changed by a call to snmp_get_sysuptime). - 2007-09-09 Frédéric Bernon, Bill Florac + 2007-09-09 Frédéric Bernon, Bill Florac * igmp.h, igmp.c, netif.h, netif.c, ip.c: To enable to have interfaces with IGMP, and others without it, there is a new NETIF_FLAG_IGMP flag to set in netif->flags if you want IGMP on an interface. igmp_stop() is now called inside netif_remove(). @@ -1975,20 +2905,20 @@ HISTORY LWIP_NETIF_LINK_CALLBACK=1) to resend reports once the link is up (avoid to wait the next query message to receive the matching multicast streams). - 2007-09-08 Frédéric Bernon + 2007-09-08 Frédéric Bernon * sockets.c, ip.h, api.h, tcp.h: declare a "struct ip_pcb" which only contains IP_PCB. Add in the netconn's "pcb" union a "struct ip_pcb *ip;" (no size change). Use this new field to access to common pcb fields (ttl, tos, so_options, etc...). Enable to access to these fields with LWIP_TCP=0. - 2007-09-05 Frédéric Bernon + 2007-09-05 Frédéric Bernon * udp.c, ipv4/icmp.c, ipv4/ip.c, ipv6/icmp.c, ipv6/ip6.c, ipv4/icmp.h, ipv6/icmp.h, opt.h: Integrate "task #7272 : LWIP_ICMP option". The new option LWIP_ICMP enable/disable ICMP module inside the IP stack (enable per default). Be careful, disabling ICMP make your product non-compliant to RFC1122, but help to reduce footprint, and to reduce "visibility" on the Internet. - 2007-09-05 Frédéric Bernon, Bill Florac + 2007-09-05 Frédéric Bernon, Bill Florac * opt.h, sys.h, tcpip.c, slipif.c, ppp.c, sys_arch.txt: Change parameters list for sys_thread_new (see "task #7252 : Create sys_thread_new_ex()"). Two new parameters have to be provided: a task name, and a task stack size. For this @@ -1997,11 +2927,11 @@ HISTORY in your sys_arch.c file, and but it's not mandatory, use them in your OS specific functions. - 2007-09-05 Frédéric Bernon + 2007-09-05 Frédéric Bernon * inet.c, autoip.c, msg_in.c, msg_out.c, init.c: Move some build time checkings inside init.c for task #7142 "Sanity check user-configurable values". - 2007-09-04 Frédéric Bernon, Bill Florac + 2007-09-04 Frédéric Bernon, Bill Florac * igmp.h, igmp.c, memp_std.h, memp.c, init.c, opt.h: Replace mem_malloc call by memp_malloc, and use a new MEMP_NUM_IGMP_GROUP option (see opt.h to define the value). It will avoid potential fragmentation problems, use a counter to know @@ -2009,7 +2939,7 @@ HISTORY leave it. MEMP_NUM_IGMP_GROUP got 8 as default value (and init.c got a sanity check if LWIP_IGMP!=0). - 2007-09-03 Frédéric Bernon + 2007-09-03 Frédéric Bernon * igmp.h, igmp.c, sockets.c, api_msg.c: Changes for "#20503 IGMP Improvement". Initialize igmp_mac_filter to NULL in netif_add (this field should be set in the netif's "init" function). Use the "imr_interface" field (for socket layer) @@ -2017,22 +2947,22 @@ HISTORY The igmp_join/leavegroup first parameter change from a netif to an ipaddr. This field could be a netif's ipaddr, or "any" (same meaning than ip_addr_isany). - 2007-08-30 Frédéric Bernon + 2007-08-30 Frédéric Bernon * Add netbuf.h, netbuf.c, Change api.h, api_lib.c: #7249 "Split netbuf functions from api/api_lib". Now netbuf API is independant of netconn, and can be used with other API (application based on raw API, or future "socket2" API). Ports maintainers just have to add src/api/netbuf.c in their makefile/projects. - 2007-08-30 Frédéric Bernon, Jonathan Larmour + 2007-08-30 Frédéric Bernon, Jonathan Larmour * init.c: Add first version of lwip_sanity_check for task #7142 "Sanity check user-configurable values". - 2007-08-29 Frédéric Bernon + 2007-08-29 Frédéric Bernon * igmp.h, igmp.c, tcpip.c, init.c, netif.c: change igmp_init and add igmp_start. igmp_start is call inside netif_add. Now, igmp initialization is in the same spirit than the others modules. Modify some IGMP debug traces. - 2007-08-29 Frédéric Bernon + 2007-08-29 Frédéric Bernon * Add init.h, init.c, Change opt.h, tcpip.c: Task #7213 "Add a lwip_init function" Add lwip_init function to regroup all modules initializations, and to provide a place to add code for task #7142 "Sanity check user-configurable values". @@ -2045,23 +2975,23 @@ HISTORY 2007-08-26 Marc Boucher * api_msg.c: do_close_internal(): Reset the callbacks and arg (conn) to NULL since they can under certain circumstances be called with an invalid conn - pointer after the connection has been closed (and conn has been freed). + pointer after the connection has been closed (and conn has been freed). - 2007-08-25 Frédéric Bernon (Artem Migaev's Patch) + 2007-08-25 Frédéric Bernon (Artem Migaev's Patch) * netif.h, netif.c: Integrate "patch #6163 : Function to check if link layer is up". Add a netif_is_link_up() function if LWIP_NETIF_LINK_CALLBACK option is set. - 2007-08-22 Frédéric Bernon + 2007-08-22 Frédéric Bernon * netif.h, netif.c, opt.h: Rename LWIP_NETIF_CALLBACK in LWIP_NETIF_STATUS_CALLBACK to be coherent with new LWIP_NETIF_LINK_CALLBACK option before next release. - 2007-08-22 Frédéric Bernon + 2007-08-22 Frédéric Bernon * tcpip.h, tcpip.c, ethernetif.c, opt.h: remove options ETHARP_TCPIP_INPUT & - ETHARP_TCPIP_ETHINPUT, now, only "ethinput" code is supported, even if the + ETHARP_TCPIP_ETHINPUT, now, only "ethinput" code is supported, even if the name is tcpip_input (we keep the name of 1.2.0 function). 2007-08-17 Jared Grubb - * memp_std.h, memp.h, memp.c, mem.c, stats.c: (Task #7136) Centralize mempool + * memp_std.h, memp.h, memp.c, mem.c, stats.c: (Task #7136) Centralize mempool settings into new memp_std.h and optional user file lwippools.h. This adds more dynamic mempools, and allows the user to create an arbitrary number of mempools for mem_malloc. @@ -2107,13 +3037,13 @@ HISTORY 2 * mss (instead of 1 * mss previously) to comply with some newer RFCs and other stacks. - 2007-07-13 Jared Grubb (integrated by Frédéric Bernon) + 2007-07-13 Jared Grubb (integrated by Frédéric Bernon) * opt.h, netif.h, netif.c, ethernetif.c: Add new configuration option to add a link callback in the netif struct, and functions to handle it. Be carefull for port maintainers to add the NETIF_FLAG_LINK_UP flag (like in ethernetif.c) if you want to be sure to be compatible with future changes... - 2007-06-30 Frédéric Bernon + 2007-06-30 Frédéric Bernon * sockets.h, sockets.c: Implement MSG_PEEK flag for recv/recvfrom functions. 2007-06-21 Simon Goldschmidt @@ -2150,7 +3080,7 @@ HISTORY * sockets.c, sockets.h: Implemented socket options SO_NO_CHECK for UDP sockets to disable UDP checksum generation on transmit. - 2007-06-13 Frédéric Bernon, Simon Goldschmidt + 2007-06-13 Frédéric Bernon, Simon Goldschmidt * debug.h, api_msg.c: change LWIP_ERROR to use it to check errors like invalid pointers or parameters, and let the possibility to redefined it in cc.h. Use this macro to check "conn" parameter in api_msg.c functions. @@ -2163,7 +3093,7 @@ HISTORY by default) to switch off UDP-Lite support if not needed (reduces udp.c code size) - 2007-06-09 Dominik Spies (integrated by Frédéric Bernon) + 2007-06-09 Dominik Spies (integrated by Frédéric Bernon) * autoip.h, autoip.c, dhcp.h, dhcp.c, netif.h, netif.c, etharp.h, etharp.c, opt.h: AutoIP implementation available for IPv4, with new options LWIP_AUTOIP and LWIP_DHCP_AUTOIP_COOP if you want to cooperate with DHCP. Some tips to adapt @@ -2184,11 +3114,11 @@ HISTORY (defaulting to off for now) that can be set to 0 to send fragmented packets by passing PBUF_REFs down the stack. - 2007-05-23 Frédéric Bernon + 2007-05-23 Frédéric Bernon * api_lib.c: Implement SO_RCVTIMEO for accept and recv on TCP connections, such present in patch #5959. - 2007-05-23 Frédéric Bernon + 2007-05-23 Frédéric Bernon * api.h, api_lib.c, api_msg.c, sockets.c: group the different NETCONN_UDPxxx code in only one part... @@ -2205,7 +3135,7 @@ HISTORY PBUF_POOL pbufs instead of the old pool implementation in pbuf.c to reduce code size. - 2007-05-11 Frédéric Bernon + 2007-05-11 Frédéric Bernon * sockets.c, api_lib.c, api_msg.h, api_msg.c, netifapi.h, netifapi.c, tcpip.c: Include a function pointer instead of a table index in the message to reduce footprint. Disable some part of lwip_send and lwip_sendto if some options are @@ -2233,7 +3163,7 @@ HISTORY * etharp.c: Introduced fast one-entry-cache to speed up ARP lookup when sending multiple packets to the same host. - 2007-05-04 Frédéric Bernon, Jonathan Larmour + 2007-05-04 Frédéric Bernon, Jonathan Larmour * sockets.c, api.h, api_lib.c, api_msg.h, api_msg.c: Fix bug #19162 "lwip_sento: a possible to corrupt remote addr/port connection state". Reduce problems "not enought memory" with netbuf (if we receive lot of datagrams). Improve lwip_sendto (only one exchange between @@ -2247,12 +3177,12 @@ HISTORY with SYS_MBOX_EMPTY. sys_arch_mbox_tryfetch can be implemented as a function-like macro by the port in sys_arch.h if desired. - 2007-04-06 Frédéric Bernon, Simon Goldschmidt + 2007-04-06 Frédéric Bernon, Simon Goldschmidt * opt.h, tcpip.h, tcpip.c, netifapi.h, netifapi.c: New configuration option LWIP_NETIF_API allow to use thread-safe functions to add/remove netif in list, and to start/stop dhcp clients, using new functions from netifapi.h. Disable as default (no port change to do). - 2007-04-05 Frédéric Bernon + 2007-04-05 Frédéric Bernon * sockets.c: remplace ENOBUFS errors on alloc_socket by ENFILE to be more BSD compliant. 2007-04-04 Simon Goldschmidt @@ -2260,54 +3190,54 @@ HISTORY use this for and architecture-independent form to tell the compiler you intentionally are not using this variable. Can be overriden in cc.h. - 2007-03-28 Frédéric Bernon + 2007-03-28 Frédéric Bernon * opt.h, netif.h, dhcp.h, dhcp.c: New configuration option LWIP_NETIF_HOSTNAME allow to define a hostname in netif struct (this is just a pointer, so, you can use a hardcoded string, point on one of your's ethernetif field, or alloc a string you will free yourself). It will be used by DHCP to register a client hostname, but can also be use when you call snmp_set_sysname. - 2007-03-28 Frédéric Bernon - * netif.h, netif.c: A new NETIF_FLAG_ETHARP flag is defined in netif.h, to allow to + 2007-03-28 Frédéric Bernon + * netif.h, netif.c: A new NETIF_FLAG_ETHARP flag is defined in netif.h, to allow to initialize a network interface's flag with. It tell this interface is an ethernet device, and we can use ARP with it to do a "gratuitous ARP" (RFC 3220 "IP Mobility Support for IPv4" section 4.6) when interface is "up" with netif_set_up(). - 2007-03-26 Frédéric Bernon, Jonathan Larmour + 2007-03-26 Frédéric Bernon, Jonathan Larmour * opt.h, tcpip.c: New configuration option LWIP_ARP allow to disable ARP init at build - time if you only use PPP or SLIP. The default is enable. Note we don't have to call + time if you only use PPP or SLIP. The default is enable. Note we don't have to call etharp_init in your port's initilization sequence if you use tcpip.c, because this call is done in tcpip_init function. - 2007-03-22 Frédéric Bernon + 2007-03-22 Frédéric Bernon * stats.h, stats.c, msg_in.c: Stats counters can be change to u32_t if necessary with the new option LWIP_STATS_LARGE. If you need this option, define LWIP_STATS_LARGE to 1 in - your lwipopts.h. More, unused counters are not defined in the stats structs, and not + your lwipopts.h. More, unused counters are not defined in the stats structs, and not display by stats_display(). Note that some options (SYS_STATS and RAW_STATS) are defined but never used. Fix msg_in.c with the correct #if test for a stat display. 2007-03-21 Kieran Mansley - * netif.c, netif.h: Apply patch#4197 with some changes (originator: rireland@hmgsl.com). + * netif.c, netif.h: Apply patch#4197 with some changes (originator: rireland@hmgsl.com). Provides callback on netif up/down state change. - 2007-03-11 Frédéric Bernon, Mace Gael, Steve Reynolds + 2007-03-11 Frédéric Bernon, Mace Gael, Steve Reynolds * sockets.h, sockets.c, api.h, api_lib.c, api_msg.h, api_msg.c, igmp.h, igmp.c, ip.c, netif.h, tcpip.c, opt.h: - New configuration option LWIP_IGMP to enable IGMP processing. Based on only one + New configuration option LWIP_IGMP to enable IGMP processing. Based on only one filter per all network interfaces. Declare a new function in netif to enable to control the MAC filter (to reduce lwIP traffic processing). - 2007-03-11 Frédéric Bernon + 2007-03-11 Frédéric Bernon * tcp.h, tcp.c, sockets.c, tcp_out.c, tcp_in.c, opt.h: Keepalive values can be configured at run time with LWIP_TCP_KEEPALIVE, but don't change this unless you know what you're doing (default are RFC1122 compliant). Note that TCP_KEEPIDLE and TCP_KEEPINTVL have to be set in seconds. - 2007-03-08 Frédéric Bernon + 2007-03-08 Frédéric Bernon * tcp.h: Keepalive values can be configured at compile time, but don't change this unless you know what you're doing (default are RFC1122 compliant). - 2007-03-08 Frédéric Bernon + 2007-03-08 Frédéric Bernon * sockets.c, api.h, api_lib.c, tcpip.c, sys.h, sys.c, err.c, opt.h: Implement LWIP_SO_RCVTIMEO configuration option to enable/disable SO_RCVTIMEO on UDP sockets/netconn. @@ -2315,8 +3245,8 @@ HISTORY 2007-03-08 Simon Goldschmidt * snmp_msg.h, msg_in.c: SNMP UDP ports can be configured at compile time. - 2007-03-06 Frédéric Bernon - * api.h, api_lib.c, sockets.h, sockets.c, tcpip.c, sys.h, sys.c, err.h: + 2007-03-06 Frédéric Bernon + * api.h, api_lib.c, sockets.h, sockets.c, tcpip.c, sys.h, sys.c, err.h: Implement SO_RCVTIMEO on UDP sockets/netconn. 2007-02-28 Kieran Mansley (based on patch from Simon Goldschmidt) @@ -2335,19 +3265,19 @@ HISTORY ++ Bug fixes: - 2008-03-17 Frédéric Bernon, Ed Kerekes + 2008-03-17 Frédéric Bernon, Ed Kerekes * igmp.h, igmp.c: Fix bug #22613 "IGMP iphdr problem" (could have some problems to fill the IP header on some targets, use now the ip.h macros to do it). - 2008-03-13 Frédéric Bernon + 2008-03-13 Frédéric Bernon * sockets.c: Fix bug #22435 "lwip_recvfrom with TCP break;". Using (lwip_)recvfrom with valid "from" and "fromlen" parameters, on a TCP connection caused a crash. Note that using (lwip_)recvfrom like this is a bit slow and that using (lwip)getpeername is the good lwip way to do it (so, using recv is faster on tcp sockets). - 2008-03-12 Frédéric Bernon, Jonathan Larmour + 2008-03-12 Frédéric Bernon, Jonathan Larmour * api_msg.c, contrib/apps/ping.c: Fix bug #22530 "api_msg.c's recv_raw() does not consume data", and the ping sample (with LWIP_SOCKET=1, the code did the wrong supposition that lwip_recvfrom @@ -2358,11 +3288,11 @@ HISTORY and/or warnings on some systems where mem_size_t and size_t differ. * pbuf.c, ppp.c: Fix warnings on some systems with mem_malloc. - 2008-03-04 Kieran Mansley (contributions by others) + 2008-03-04 Kieran Mansley (contributions by others) * Numerous small compiler error/warning fixes from contributions to mailing list after 1.3.0 release candidate made. - 2008-01-25 Cui hengbin (integrated by Frédéric Bernon) + 2008-01-25 Cui hengbin (integrated by Frédéric Bernon) * dns.c: Fix bug #22108 "DNS problem" caused by unaligned structures. 2008-01-15 Kieran Mansley @@ -2436,7 +3366,7 @@ HISTORY Fixed the nagle algorithm; nagle now also works for all raw API applications and has to be explicitly disabled with 'tcp_pcb->flags |= TF_NODELAY' - 2007-11-12 Frédéric Bernon + 2007-11-12 Frédéric Bernon * sockets.c, api.h, api_lib.c, api_msg.h, api_msg.c: Fixed bug #20900. Now, most of the netconn_peer and netconn_addr processing is done inside tcpip_thread context in do_getaddr. @@ -2468,14 +3398,14 @@ HISTORY 2007-10-08 Simon Goldschmidt * mem.c: lfree was not updated in mem_realloc! - 2007-10-07 Frédéric Bernon + 2007-10-07 Frédéric Bernon * sockets.c, api.h, api_lib.c: First step to fix "bug #20900 : Potential crash error problem with netconn_peer & netconn_addr". VERY IMPORTANT: this change cause an API breakage for netconn_addr, since a parameter type change. Any compiler should cause an error without any changes in yours netconn_peer calls (so, it can't be a "silent change"). It also reduce a little bit the footprint for socket layer (lwip_getpeername & - lwip_getsockname use now a common lwip_getaddrname function since + lwip_getsockname use now a common lwip_getaddrname function since netconn_peer & netconn_addr have the same parameters). 2007-09-20 Simon Goldschmidt @@ -2488,23 +3418,23 @@ HISTORY 2007-09-15 Mike Kleshov * mem.c: Fixed bug #21077 (inaccuracy in calculation of lwip_stat.mem.used) - 2007-09-06 Frédéric Bernon + 2007-09-06 Frédéric Bernon * several-files: replace some #include "arch/cc.h" by "lwip/arch.h", or simply remove it as long as "lwip/opt.h" is included before (this one include "lwip/debug.h" which already include "lwip/arch.h"). Like that, default defines are provided by "lwip/arch.h" if they are not defined in cc.h, in the same spirit than "lwip/opt.h" for lwipopts.h. - 2007-08-30 Frédéric Bernon - * igmp.h, igmp.c: Some changes to remove some redundant code, add some traces, + 2007-08-30 Frédéric Bernon + * igmp.h, igmp.c: Some changes to remove some redundant code, add some traces, and fix some coding style. - 2007-08-28 Frédéric Bernon + 2007-08-28 Frédéric Bernon * tcpip.c: Fix TCPIP_MSG_INPKT processing: now, tcpip_input can be used for any - kind of packets. These packets are considered like Ethernet packets (payload - pointing to ethhdr) if the netif got the NETIF_FLAG_ETHARP flag. Else, packets + kind of packets. These packets are considered like Ethernet packets (payload + pointing to ethhdr) if the netif got the NETIF_FLAG_ETHARP flag. Else, packets are considered like IP packets (payload pointing to iphdr). - 2007-08-27 Frédéric Bernon + 2007-08-27 Frédéric Bernon * api.h, api_lib.c, api_msg.c: First fix for "bug #20900 : Potential crash error problem with netconn_peer & netconn_addr". Introduce NETCONN_LISTEN netconn_state and remove obsolete ones (NETCONN_RECV & NETCONN_ACCEPT). @@ -2513,19 +3443,19 @@ HISTORY * inet.c Modify (acc >> 16) test to ((acc >> 16) != 0) to help buggy compiler (Paradigm C++) - 2007-08-09 Frédéric Bernon, Bill Florac + 2007-08-09 Frédéric Bernon, Bill Florac * stats.h, stats.c, igmp.h, igmp.c, opt.h: Fix for bug #20503 : IGMP Improvement. Introduce IGMP_STATS to centralize statistics management. - 2007-08-09 Frédéric Bernon, Bill Florac + 2007-08-09 Frédéric Bernon, Bill Florac * udp.c: Fix for bug #20503 : IGMP Improvement. Enable to receive a multicast packet on a udp pcb binded on an netif's IP address, and not on "any". - 2007-08-09 Frédéric Bernon, Bill Florac + 2007-08-09 Frédéric Bernon, Bill Florac * igmp.h, igmp.c, ip.c: Fix minor changes from bug #20503 : IGMP Improvement. This is mainly on using lookup/lookfor, and some coding styles... - 2007-07-26 Frédéric Bernon (and "thedoctor") + 2007-07-26 Frédéric Bernon (and "thedoctor") * igmp.c: Fix bug #20595 to accept IGMPv3 "Query" messages. 2007-07-25 Simon Goldschmidt @@ -2549,11 +3479,11 @@ HISTORY * memp.c: Fix bug #20478: memp_malloc returned NULL+MEMP_SIZE on failed allocation. It now returns NULL. - 2007-07-13 Frédéric Bernon + 2007-07-13 Frédéric Bernon * api_msg.c: Fix bug #20318: api_msg "recv" callbacks don't call pbuf_free in all error cases. - 2007-07-13 Frédéric Bernon + 2007-07-13 Frédéric Bernon * api_msg.c: Fix bug #20315: possible memory leak problem if tcp_listen failed, because current code doesn't follow rawapi.txt documentation. @@ -2590,16 +3520,16 @@ HISTORY * tcp.h: Fixed bug #20287: Fixed nagle algorithm (sending was done too early if a segment contained chained pbufs) - 2007-06-28 Frédéric Bernon + 2007-06-28 Frédéric Bernon * autoip.c: replace most of rand() calls by a macro LWIP_AUTOIP_RAND which compute a "pseudo-random" value based on netif's MAC and some autoip fields. It's always possible to define this macro in your own lwipopts.h to always use C library's rand(). Note that autoip_create_rand_addr doesn't use this macro. - 2007-06-28 Frédéric Bernon + 2007-06-28 Frédéric Bernon * netifapi.h, netifapi.c, tcpip.h, tcpip.c: Update code to handle the option LWIP_TCPIP_CORE_LOCKING, and do some changes to be coherent with last modifications - in api_lib/api_msg (use pointers and not type with table, etc...) + in api_lib/api_msg (use pointers and not type with table, etc...) 2007-06-26 Simon Goldschmidt * udp.h: Fixed bug #20259: struct udp_hdr was lacking the packin defines. @@ -2621,11 +3551,11 @@ HISTORY -> netconn_new_..() does not allocate a new connection for unsupported protocols. - 2007-06-13 Frédéric Bernon, Simon Goldschmidt + 2007-06-13 Frédéric Bernon, Simon Goldschmidt * api_lib.c: change return expression in netconn_addr and netconn_peer, because conn->err was reset to ERR_OK without any reasons (and error was lost)... - 2007-06-13 Frédéric Bernon, Matthias Weisser + 2007-06-13 Frédéric Bernon, Matthias Weisser * opt.h, mem.h, mem.c, memp.c, pbuf.c, ip_frag.c, vj.c: Fix bug #20162. Rename MEM_ALIGN in LWIP_MEM_ALIGN and MEM_ALIGN_SIZE in LWIP_MEM_ALIGN_SIZE to avoid some macro names collision with some OS macros. @@ -2654,13 +3584,13 @@ HISTORY 2007-06-01 Simon Goldschmidt * sockets.c: Checked in patch #5914: Moved sockopt processing into tcpip_thread. - 2007-05-23 Frédéric Bernon + 2007-05-23 Frédéric Bernon * api_lib.c, sockets.c: Fixed bug #5958 for netconn_listen (acceptmbox only allocated by do_listen if success) and netconn_accept errors handling. In most of api_lib functions, we replace some errors checkings like "if (conn==NULL)" by ASSERT, except for netconn_delete. - 2007-05-23 Frédéric Bernon + 2007-05-23 Frédéric Bernon * api_lib.c: Fixed bug #5957 "Safe-thread problem inside netconn_recv" to return an error code if it's impossible to fetch a pbuf on a TCP connection (and not directly close the recvmbox). @@ -2669,13 +3599,13 @@ HISTORY * tcp.c: Fixed bug #1895 (tcp_bind not correct) by introducing a list of bound but unconnected (and non-listening) tcp_pcbs. - 2007-05-22 Frédéric Bernon + 2007-05-22 Frédéric Bernon * sys.h, sys.c, api_lib.c, tcpip.c: remove sys_mbox_fetch_timeout() (was only used for LWIP_SO_RCVTIMEO option) and use sys_arch_mbox_fetch() instead of sys_mbox_fetch() in api files. Now, users SHOULD NOT use internal lwIP features like "sys_timeout" in their application threads. - 2007-05-22 Frédéric Bernon + 2007-05-22 Frédéric Bernon * api.h, api_lib.c, api_msg.h, api_msg.c: change the struct api_msg_msg to see which parameters are used by which do_xxx function, and to avoid "misusing" parameters (patch #5938). @@ -2699,9 +3629,9 @@ HISTORY as the one of the netif used for sending to prevent sending from old addresses after a netif address gets changed (partly fixes bug #3168). - 2007-05-16 Frédéric Bernon + 2007-05-16 Frédéric Bernon * tcpip.c, igmp.h, igmp.c: Fixed bug "#19800 : IGMP: igmp_tick() will not work - with NO_SYS=1". Note that igmp_init is always in tcpip_thread (and not in + with NO_SYS=1". Note that igmp_init is always in tcpip_thread (and not in tcpip_init) because we have to be sure that network interfaces are already added (mac filter is updated only in igmp_init for the moment). @@ -2763,24 +3693,24 @@ HISTORY "Constant is long" warnings with 16bit compilers. Contributed by avatar@mmlab.cse.yzu.edu.tw - 2007-04-05 Frédéric Bernon, Jonathan Larmour + 2007-04-05 Frédéric Bernon, Jonathan Larmour * api_msg.c: Fix bug #16830: "err_tcp() posts to connection mailbox when no pend on the mailbox is active". Now, the post is only done during a connect, and do_send, do_write and do_join_leave_group don't do anything if a previous error was signaled. - 2007-04-03 Frédéric Bernon + 2007-04-03 Frédéric Bernon * ip.c: Don't set the IP_DF ("Don't fragment") flag in the IP header in IP output packets. See patch #5834. - 2007-03-30 Frédéric Bernon + 2007-03-30 Frédéric Bernon * api_msg.c: add a "pcb_new" helper function to avoid redundant code, and to add missing pcb allocations checking (in do_bind, and for each raw_new). Fix style. - 2007-03-30 Frédéric Bernon + 2007-03-30 Frédéric Bernon * most of files: prefix all debug.h define with "LWIP_" to avoid any conflict with others environment defines (these were too "generic"). - 2007-03-28 Frédéric Bernon + 2007-03-28 Frédéric Bernon * api.h, api_lib.c, sockets.c: netbuf_ref doesn't check its internal pbuf_alloc call result and can cause a crash. lwip_send now check netbuf_ref result. @@ -2794,19 +3724,19 @@ HISTORY * opt.h Change default PBUF_POOL_BUFSIZE (again) to accomodate default MSS + IP and TCP headers *and* physical link headers - 2007-03-26 Frédéric Bernon (based on patch from Dmitry Potapov) + 2007-03-26 Frédéric Bernon (based on patch from Dmitry Potapov) * api_lib.c: patch for netconn_write(), fixes a possible race condition which cause to send some garbage. It is not a definitive solution, but the patch does solve the problem for most cases. - 2007-03-22 Frédéric Bernon + 2007-03-22 Frédéric Bernon * api_msg.h, api_msg.c: Remove obsolete API_MSG_ACCEPT and do_accept (never used). - 2007-03-22 Frédéric Bernon + 2007-03-22 Frédéric Bernon * api_lib.c: somes resources couldn't be freed if there was errors during netconn_new_with_proto_and_callback. - 2007-03-22 Frédéric Bernon + 2007-03-22 Frédéric Bernon * ethernetif.c: update netif->input calls to check return value. In older ports, it's a good idea to upgrade them, even if before, there could be another problem (access to an uninitialized mailbox). @@ -2815,17 +3745,17 @@ HISTORY * sockets.c: fixed bug #5067 (essentialy a signed/unsigned warning fixed by casting to unsigned). - 2007-03-21 Frédéric Bernon + 2007-03-21 Frédéric Bernon * api_lib.c, api_msg.c, tcpip.c: integrate sys_mbox_fetch(conn->mbox, NULL) calls from api_lib.c to tcpip.c's tcpip_apimsg(). Now, use a local variable and not a dynamic one from memp to send tcpip_msg to tcpip_thread in a synchrone call. Free tcpip_msg from tcpip_apimsg is not done in tcpip_thread. This give a faster and more reliable communication between api_lib and tcpip. - 2007-03-21 Frédéric Bernon + 2007-03-21 Frédéric Bernon * opt.h: Add LWIP_NETIF_CALLBACK (to avoid compiler warning) and set it to 0. - 2007-03-21 Frédéric Bernon + 2007-03-21 Frédéric Bernon * api_msg.c, igmp.c, igmp.h: Fix C++ style comments 2007-03-21 Kieran Mansley @@ -2842,24 +3772,24 @@ HISTORY * sockets.c, igmp.c, igmp.h, memp.h: Fix C++ style comments and comment out missing header include in icmp.c - 2007-03-20 Frédéric Bernon + 2007-03-20 Frédéric Bernon * memp.h, stats.c: Fix stats_display function where memp_names table wasn't synchronized with memp.h. - 2007-03-20 Frédéric Bernon + 2007-03-20 Frédéric Bernon * tcpip.c: Initialize tcpip's mbox, and verify if initialized in tcpip_input, - tcpip_ethinput, tcpip_callback, tcpip_apimsg, to fix a init problem with + tcpip_ethinput, tcpip_callback, tcpip_apimsg, to fix a init problem with network interfaces. Also fix a compiler warning. 2007-03-20 Kieran Mansley * udp.c: Only try and use pbuf_header() to make space for headers if not a ROM or REF pbuf. - 2007-03-19 Frédéric Bernon + 2007-03-19 Frédéric Bernon * api_msg.h, api_msg.c, tcpip.h, tcpip.c: Add return types to tcpip_apimsg() and api_msg_post(). - 2007-03-19 Frédéric Bernon + 2007-03-19 Frédéric Bernon * Remove unimplemented "memp_realloc" function from memp.h. 2007-03-11 Simon Goldschmidt @@ -2871,7 +3801,7 @@ HISTORY (missing `const' qualifier in socket functions), to get more compatible to standard POSIX sockets. - 2007-03-11 Frédéric Bernon (based on patch from Dmitry Potapov) + 2007-03-11 Frédéric Bernon (based on patch from Dmitry Potapov) * sockets.c: Add asserts inside bind, connect and sendto to check input parameters. Remove excessive set_errno() calls after get_socket(), because errno is set inside of get_socket(). Move last sock_set_errno() inside @@ -2885,7 +3815,7 @@ HISTORY * tcpip.c: Initialize dhcp timers in tcpip_thread (if LWIP_DHCP) to protect the stack from concurrent access. - 2007-03-06 Frédéric Bernon, Dmitry Potapov + 2007-03-06 Frédéric Bernon, Dmitry Potapov * tcpip.c, ip_frag.c, ethernetif.c: Fix some build problems, and a redundancy call to "lwip_stats.link.recv++;" in low_level_input() & ethernetif_input(). @@ -2893,7 +3823,7 @@ HISTORY * ip_frag.c, ip_frag.h: Reduce code size: don't include code in those files if IP_FRAG == 0 and IP_REASSEMBLY == 0 - 2007-03-06 Frédéric Bernon, Simon Goldschmidt + 2007-03-06 Frédéric Bernon, Simon Goldschmidt * opt.h, ip_frag.h, tcpip.h, tcpip.c, ethernetif.c: add new configuration option named ETHARP_TCPIP_ETHINPUT, which enable the new tcpip_ethinput. Allow to do ARP processing for incoming packets inside tcpip_thread @@ -2905,15 +3835,15 @@ HISTORY * err.h, err.c: fixed compiler warning "initialization dircards qualifiers from pointer target type" - 2007-03-05 Frédéric Bernon + 2007-03-05 Frédéric Bernon * opt.h, sockets.h: add new configuration options (LWIP_POSIX_SOCKETS_IO_NAMES, ETHARP_TRUST_IP_MAC, review SO_REUSE) - 2007-03-04 Frédéric Bernon + 2007-03-04 Frédéric Bernon * api_msg.c: Remove some compiler warnings : parameter "pcb" was never referenced. - 2007-03-04 Frédéric Bernon + 2007-03-04 Frédéric Bernon * api_lib.c: Fix "[patch #5764] api_lib.c cleanup: after patch #5687" (from Dmitry Potapov). The api_msg struct stay on the stack (not moved to netconn struct). @@ -2927,7 +3857,7 @@ HISTORY * etharp.c, etharp.h, memp.c, memp.h, opt.h: Fix BUG#11400 - don't corrupt existing pbuf chain when enqueuing multiple pbufs to a pending ARP request - 2007-03-03 Frédéric Bernon + 2007-03-03 Frédéric Bernon * udp.c: remove obsolete line "static struct udp_pcb *pcb_cache = NULL;" It is static, and never used in udp.c except udp_init(). @@ -2936,17 +3866,17 @@ HISTORY tcpip_thread() to tcpip_init(). This way, raw API connections can be initialized before tcpip_thread is running (e.g. before OS is started) - 2007-03-02 Frédéric Bernon + 2007-03-02 Frédéric Bernon * rawapi.txt: Fix documentation mismatch with etharp.h about etharp_tmr's call interval. - 2007-02-28 Kieran Mansley + 2007-02-28 Kieran Mansley * pbuf.c: Fix BUG#17645 - ensure pbuf payload pointer is not moved outside the region of the pbuf by pbuf_header() - 2007-02-28 Kieran Mansley + 2007-02-28 Kieran Mansley * sockets.c: Fix BUG#19161 - ensure milliseconds timeout is non-zero - when supplied timeout is also non-zero + when supplied timeout is also non-zero (STABLE-1.2.0) @@ -3030,7 +3960,7 @@ HISTORY in accept() by Kevin Lawson. 2006-05-26 Christiaan Simons - * api_lib.c: Removed conn->sem creation and destruction + * api_lib.c: Removed conn->sem creation and destruction from netconn_write() and added sys_sem_new to netconn_new_*. (STABLE-1_1_1) @@ -3100,7 +4030,7 @@ HISTORY * dhcp.c: Decline messages were not multicast but unicast. * etharp.c: ETHARP_CREATE is renamed to ETHARP_TRY_HARD. Do not try hard to insert arbitrary packet's source address, - etharp_ip_input() now calls etharp_update() without ETHARP_TRY_HARD. + etharp_ip_input() now calls etharp_update() without ETHARP_TRY_HARD. etharp_query() now always DOES call ETHARP_TRY_HARD so that users querying an address will see it appear in the cache (DHCP could suffer from this when a server invalidly gave an in-use address.) diff --git a/lwip/CMakeCache.txt b/lwip/CMakeCache.txt new file mode 100644 index 0000000..ed10732 --- /dev/null +++ b/lwip/CMakeCache.txt @@ -0,0 +1,426 @@ +# This is the CMakeCache file. +# For build in directory: /home/builder/scm/ocproxy/lwip +# It was generated by CMake: /usr/bin/cmake +# You can edit this file to change values found and used by cmake. +# If you do not want to change any of the values, simply exit the editor. +# If you do want to change a value, simply edit, save, and exit the editor. +# The syntax for the file is as follows: +# KEY:TYPE=VALUE +# KEY is the name of a variable in the cache. +# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. +# VALUE is the current value for the KEY. + +######################## +# EXTERNAL cache entries +######################## + +//Path to a program. +CMAKE_AR:FILEPATH=/usr/bin/ar + +//Choose the type of build, options are: Debug;Release. +CMAKE_BUILD_TYPE:STRING=Debug + +//Enable/Disable color output during build. +CMAKE_COLOR_MAKEFILE:BOOL=ON + +//CXX compiler +CMAKE_CXX_COMPILER:FILEPATH=/usr/lib64/ccache/c++ + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib + +//Flags used by the CXX compiler during all build types. +CMAKE_CXX_FLAGS:STRING= + +//Flags used by the CXX compiler during DEBUG builds. +CMAKE_CXX_FLAGS_DEBUG:STRING=-g + +//Flags used by the CXX compiler during MINSIZEREL builds. +CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the CXX compiler during RELEASE builds. +CMAKE_CXX_FLAGS_RELEASE:STRING=-O2 -DNDEBUG + +//Flags used by the CXX compiler during RELWITHDEBINFO builds. +CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//C compiler +CMAKE_C_COMPILER:FILEPATH=/usr/lib64/ccache/cc + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib + +//Flags used by the C compiler during all build types. +CMAKE_C_FLAGS:STRING= + +//Flags used by the C compiler during DEBUG builds. +CMAKE_C_FLAGS_DEBUG:STRING=-g + +//Flags used by the C compiler during MINSIZEREL builds. +CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the C compiler during RELEASE builds. +CMAKE_C_FLAGS_RELEASE:STRING=-O2 -DNDEBUG + +//Flags used by the C compiler during RELWITHDEBINFO builds. +CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//Flags used by the linker during all build types. +CMAKE_EXE_LINKER_FLAGS:STRING= + +//Flags used by the linker during DEBUG builds. +CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during MINSIZEREL builds. +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during RELEASE builds. +CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during RELWITHDEBINFO builds. +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Enable/Disable output of compile commands during generation. +CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=OFF + +//Install path prefix, prepended onto install directories. +CMAKE_INSTALL_PREFIX:PATH=/usr/local + +//Path to a program. +CMAKE_LINKER:FILEPATH=/usr/bin/ld + +//Path to a program. +CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/gmake + +//Flags used by the linker during the creation of modules during +// all build types. +CMAKE_MODULE_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of modules during +// DEBUG builds. +CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of modules during +// MINSIZEREL builds. +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of modules during +// RELEASE builds. +CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of modules during +// RELWITHDEBINFO builds. +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_NM:FILEPATH=/usr/bin/nm + +//Path to a program. +CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy + +//Path to a program. +CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump + +//Value Computed by CMake +CMAKE_PROJECT_DESCRIPTION:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_HOMEPAGE_URL:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_NAME:STATIC=lwIP + +//Path to a program. +CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib + +//Flags used by the linker during the creation of shared libraries +// during all build types. +CMAKE_SHARED_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of shared libraries +// during DEBUG builds. +CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of shared libraries +// during MINSIZEREL builds. +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELEASE builds. +CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELWITHDEBINFO builds. +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//If set, runtime paths are not added when installing shared libraries, +// but are added when building. +CMAKE_SKIP_INSTALL_RPATH:BOOL=NO + +//If set, runtime paths are not added when using shared libraries. +CMAKE_SKIP_RPATH:BOOL=NO + +//Flags used by the linker during the creation of static libraries +// during all build types. +CMAKE_STATIC_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of static libraries +// during DEBUG builds. +CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of static libraries +// during MINSIZEREL builds. +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELEASE builds. +CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELWITHDEBINFO builds. +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_STRIP:FILEPATH=/usr/bin/strip + +//If this value is on, makefiles will be generated without the +// .SILENT directive, and all commands will be echoed to the console +// during the make. This is useful for debugging only. With Visual +// Studio IDE projects all commands are done without /nologo. +CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE + +//Enable to build Debian packages +CPACK_BINARY_DEB:BOOL=OFF + +//Enable to build FreeBSD packages +CPACK_BINARY_FREEBSD:BOOL=OFF + +//Enable to build IFW packages +CPACK_BINARY_IFW:BOOL=OFF + +//Enable to build NSIS packages +CPACK_BINARY_NSIS:BOOL=OFF + +//Enable to build RPM packages +CPACK_BINARY_RPM:BOOL=OFF + +//Enable to build STGZ packages +CPACK_BINARY_STGZ:BOOL=ON + +//Enable to build TBZ2 packages +CPACK_BINARY_TBZ2:BOOL=OFF + +//Enable to build TGZ packages +CPACK_BINARY_TGZ:BOOL=ON + +//Enable to build TXZ packages +CPACK_BINARY_TXZ:BOOL=OFF + +//Enable to build TZ packages +CPACK_BINARY_TZ:BOOL=ON + +//Dot tool for use with Doxygen +DOXYGEN_DOT_EXECUTABLE:FILEPATH=/usr/bin/dot + +//Doxygen documentation generation tool (http://www.doxygen.org) +DOXYGEN_EXECUTABLE:FILEPATH=/usr/bin/doxygen + +//Path to a library. +LIBPTHREAD:FILEPATH=/usr/lib64/libpthread.so + +//Path to a library. +LIBRT:FILEPATH=/usr/lib64/librt.so + +//Path to a library. +LIBUTIL:FILEPATH=/usr/lib64/libutil.so + +//Value Computed by CMake +lwIP_BINARY_DIR:STATIC=/home/builder/scm/ocproxy/lwip + +//Value Computed by CMake +lwIP_SOURCE_DIR:STATIC=/home/builder/scm/ocproxy/lwip + +//Dependencies for the target +lwipcontribportunix_LIB_DEPENDS:STATIC=general;/usr/lib64/libutil.so;general;/usr/lib64/libpthread.so;general;/usr/lib64/librt.so; + + +######################## +# INTERNAL cache entries +######################## + +//ADVANCED property for variable: CMAKE_AR +CMAKE_AR-ADVANCED:INTERNAL=1 +//This is the directory where this CMakeCache.txt was created +CMAKE_CACHEFILE_DIR:INTERNAL=/home/builder/scm/ocproxy/lwip +//Major version of cmake used to create the current loaded cache +CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3 +//Minor version of cmake used to create the current loaded cache +CMAKE_CACHE_MINOR_VERSION:INTERNAL=14 +//Patch version of cmake used to create the current loaded cache +CMAKE_CACHE_PATCH_VERSION:INTERNAL=5 +//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE +CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1 +//Path to CMake executable. +CMAKE_COMMAND:INTERNAL=/usr/bin/cmake +//Path to cpack program executable. +CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack +//Path to ctest program executable. +CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest +//ADVANCED property for variable: CMAKE_CXX_COMPILER +CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_AR +CMAKE_CXX_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_RANLIB +CMAKE_CXX_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS +CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG +CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL +CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE +CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO +CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER +CMAKE_C_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_AR +CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_RANLIB +CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS +CMAKE_C_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG +CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL +CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE +CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO +CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//Path to cache edit program executable. +CMAKE_EDIT_COMMAND:INTERNAL=/usr/bin/ccmake +//Executable file format +CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS +CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG +CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE +CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS +CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1 +//Name of external makefile project generator. +CMAKE_EXTRA_GENERATOR:INTERNAL= +//Name of generator. +CMAKE_GENERATOR:INTERNAL=Unix Makefiles +//Generator instance identifier. +CMAKE_GENERATOR_INSTANCE:INTERNAL= +//Name of generator platform. +CMAKE_GENERATOR_PLATFORM:INTERNAL= +//Name of generator toolset. +CMAKE_GENERATOR_TOOLSET:INTERNAL= +//Source directory with the top level CMakeLists.txt file for this +// project +CMAKE_HOME_DIRECTORY:INTERNAL=/home/builder/scm/ocproxy/lwip +//Install .so files without execute permission. +CMAKE_INSTALL_SO_NO_EXE:INTERNAL=0 +//ADVANCED property for variable: CMAKE_LINKER +CMAKE_LINKER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MAKE_PROGRAM +CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS +CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG +CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE +CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_NM +CMAKE_NM-ADVANCED:INTERNAL=1 +//number of local generators +CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=2 +//ADVANCED property for variable: CMAKE_OBJCOPY +CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJDUMP +CMAKE_OBJDUMP-ADVANCED:INTERNAL=1 +//Platform information initialized +CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_RANLIB +CMAKE_RANLIB-ADVANCED:INTERNAL=1 +//Path to CMake installation. +CMAKE_ROOT:INTERNAL=/usr/share/cmake +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS +CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG +CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE +CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH +CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_RPATH +CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS +CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG +CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE +CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STRIP +CMAKE_STRIP-ADVANCED:INTERNAL=1 +//uname command +CMAKE_UNAME:INTERNAL=/usr/bin/uname +//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE +CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CPACK_BINARY_DEB +CPACK_BINARY_DEB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CPACK_BINARY_FREEBSD +CPACK_BINARY_FREEBSD-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CPACK_BINARY_IFW +CPACK_BINARY_IFW-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CPACK_BINARY_NSIS +CPACK_BINARY_NSIS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CPACK_BINARY_RPM +CPACK_BINARY_RPM-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CPACK_BINARY_STGZ +CPACK_BINARY_STGZ-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CPACK_BINARY_TBZ2 +CPACK_BINARY_TBZ2-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CPACK_BINARY_TGZ +CPACK_BINARY_TGZ-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CPACK_BINARY_TXZ +CPACK_BINARY_TXZ-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CPACK_BINARY_TZ +CPACK_BINARY_TZ-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: DOXYGEN_DOT_EXECUTABLE +DOXYGEN_DOT_EXECUTABLE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: DOXYGEN_EXECUTABLE +DOXYGEN_EXECUTABLE-ADVANCED:INTERNAL=1 +//Details about finding Doxygen +FIND_PACKAGE_MESSAGE_DETAILS_Doxygen:INTERNAL=[/usr/bin/doxygen][cfound components: doxygen dot ][v1.8.15()] + diff --git a/lwip/CMakeDoxyfile.in b/lwip/CMakeDoxyfile.in new file mode 100644 index 0000000..688769f --- /dev/null +++ b/lwip/CMakeDoxyfile.in @@ -0,0 +1,276 @@ +# +# DO NOT EDIT! THIS FILE WAS GENERATED BY CMAKE! +# + +DOXYFILE_ENCODING = @DOXYGEN_DOXYFILE_ENCODING@ +PROJECT_NAME = @DOXYGEN_PROJECT_NAME@ +PROJECT_NUMBER = @DOXYGEN_PROJECT_NUMBER@ +PROJECT_BRIEF = @DOXYGEN_PROJECT_BRIEF@ +PROJECT_LOGO = @DOXYGEN_PROJECT_LOGO@ +OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@ +CREATE_SUBDIRS = @DOXYGEN_CREATE_SUBDIRS@ +ALLOW_UNICODE_NAMES = @DOXYGEN_ALLOW_UNICODE_NAMES@ +OUTPUT_LANGUAGE = @DOXYGEN_OUTPUT_LANGUAGE@ +OUTPUT_TEXT_DIRECTION = @DOXYGEN_OUTPUT_TEXT_DIRECTION@ +BRIEF_MEMBER_DESC = @DOXYGEN_BRIEF_MEMBER_DESC@ +REPEAT_BRIEF = @DOXYGEN_REPEAT_BRIEF@ +ABBREVIATE_BRIEF = @DOXYGEN_ABBREVIATE_BRIEF@ +ALWAYS_DETAILED_SEC = @DOXYGEN_ALWAYS_DETAILED_SEC@ +INLINE_INHERITED_MEMB = @DOXYGEN_INLINE_INHERITED_MEMB@ +FULL_PATH_NAMES = @DOXYGEN_FULL_PATH_NAMES@ +STRIP_FROM_PATH = @DOXYGEN_STRIP_FROM_PATH@ +STRIP_FROM_INC_PATH = @DOXYGEN_STRIP_FROM_INC_PATH@ +SHORT_NAMES = @DOXYGEN_SHORT_NAMES@ +JAVADOC_AUTOBRIEF = @DOXYGEN_JAVADOC_AUTOBRIEF@ +QT_AUTOBRIEF = @DOXYGEN_QT_AUTOBRIEF@ +MULTILINE_CPP_IS_BRIEF = @DOXYGEN_MULTILINE_CPP_IS_BRIEF@ +INHERIT_DOCS = @DOXYGEN_INHERIT_DOCS@ +SEPARATE_MEMBER_PAGES = @DOXYGEN_SEPARATE_MEMBER_PAGES@ +TAB_SIZE = @DOXYGEN_TAB_SIZE@ +ALIASES = @DOXYGEN_ALIASES@ +TCL_SUBST = @DOXYGEN_TCL_SUBST@ +OPTIMIZE_OUTPUT_FOR_C = @DOXYGEN_OPTIMIZE_OUTPUT_FOR_C@ +OPTIMIZE_OUTPUT_JAVA = @DOXYGEN_OPTIMIZE_OUTPUT_JAVA@ +OPTIMIZE_FOR_FORTRAN = @DOXYGEN_OPTIMIZE_FOR_FORTRAN@ +OPTIMIZE_OUTPUT_VHDL = @DOXYGEN_OPTIMIZE_OUTPUT_VHDL@ +OPTIMIZE_OUTPUT_SLICE = @DOXYGEN_OPTIMIZE_OUTPUT_SLICE@ +EXTENSION_MAPPING = @DOXYGEN_EXTENSION_MAPPING@ +MARKDOWN_SUPPORT = @DOXYGEN_MARKDOWN_SUPPORT@ +TOC_INCLUDE_HEADINGS = @DOXYGEN_TOC_INCLUDE_HEADINGS@ +AUTOLINK_SUPPORT = @DOXYGEN_AUTOLINK_SUPPORT@ +BUILTIN_STL_SUPPORT = @DOXYGEN_BUILTIN_STL_SUPPORT@ +CPP_CLI_SUPPORT = @DOXYGEN_CPP_CLI_SUPPORT@ +SIP_SUPPORT = @DOXYGEN_SIP_SUPPORT@ +IDL_PROPERTY_SUPPORT = @DOXYGEN_IDL_PROPERTY_SUPPORT@ +DISTRIBUTE_GROUP_DOC = @DOXYGEN_DISTRIBUTE_GROUP_DOC@ +GROUP_NESTED_COMPOUNDS = @DOXYGEN_GROUP_NESTED_COMPOUNDS@ +SUBGROUPING = @DOXYGEN_SUBGROUPING@ +INLINE_GROUPED_CLASSES = @DOXYGEN_INLINE_GROUPED_CLASSES@ +INLINE_SIMPLE_STRUCTS = @DOXYGEN_INLINE_SIMPLE_STRUCTS@ +TYPEDEF_HIDES_STRUCT = @DOXYGEN_TYPEDEF_HIDES_STRUCT@ +LOOKUP_CACHE_SIZE = @DOXYGEN_LOOKUP_CACHE_SIZE@ +EXTRACT_ALL = @DOXYGEN_EXTRACT_ALL@ +EXTRACT_PRIVATE = @DOXYGEN_EXTRACT_PRIVATE@ +EXTRACT_PACKAGE = @DOXYGEN_EXTRACT_PACKAGE@ +EXTRACT_STATIC = @DOXYGEN_EXTRACT_STATIC@ +EXTRACT_LOCAL_CLASSES = @DOXYGEN_EXTRACT_LOCAL_CLASSES@ +EXTRACT_LOCAL_METHODS = @DOXYGEN_EXTRACT_LOCAL_METHODS@ +EXTRACT_ANON_NSPACES = @DOXYGEN_EXTRACT_ANON_NSPACES@ +HIDE_UNDOC_MEMBERS = @DOXYGEN_HIDE_UNDOC_MEMBERS@ +HIDE_UNDOC_CLASSES = @DOXYGEN_HIDE_UNDOC_CLASSES@ +HIDE_FRIEND_COMPOUNDS = @DOXYGEN_HIDE_FRIEND_COMPOUNDS@ +HIDE_IN_BODY_DOCS = @DOXYGEN_HIDE_IN_BODY_DOCS@ +INTERNAL_DOCS = @DOXYGEN_INTERNAL_DOCS@ +CASE_SENSE_NAMES = @DOXYGEN_CASE_SENSE_NAMES@ +HIDE_SCOPE_NAMES = @DOXYGEN_HIDE_SCOPE_NAMES@ +HIDE_COMPOUND_REFERENCE= @DOXYGEN_HIDE_COMPOUND_REFERENCE@ +SHOW_INCLUDE_FILES = @DOXYGEN_SHOW_INCLUDE_FILES@ +SHOW_GROUPED_MEMB_INC = @DOXYGEN_SHOW_GROUPED_MEMB_INC@ +FORCE_LOCAL_INCLUDES = @DOXYGEN_FORCE_LOCAL_INCLUDES@ +INLINE_INFO = @DOXYGEN_INLINE_INFO@ +SORT_MEMBER_DOCS = @DOXYGEN_SORT_MEMBER_DOCS@ +SORT_BRIEF_DOCS = @DOXYGEN_SORT_BRIEF_DOCS@ +SORT_MEMBERS_CTORS_1ST = @DOXYGEN_SORT_MEMBERS_CTORS_1ST@ +SORT_GROUP_NAMES = @DOXYGEN_SORT_GROUP_NAMES@ +SORT_BY_SCOPE_NAME = @DOXYGEN_SORT_BY_SCOPE_NAME@ +STRICT_PROTO_MATCHING = @DOXYGEN_STRICT_PROTO_MATCHING@ +GENERATE_TODOLIST = @DOXYGEN_GENERATE_TODOLIST@ +GENERATE_TESTLIST = @DOXYGEN_GENERATE_TESTLIST@ +GENERATE_BUGLIST = @DOXYGEN_GENERATE_BUGLIST@ +GENERATE_DEPRECATEDLIST= @DOXYGEN_GENERATE_DEPRECATEDLIST@ +ENABLED_SECTIONS = @DOXYGEN_ENABLED_SECTIONS@ +MAX_INITIALIZER_LINES = @DOXYGEN_MAX_INITIALIZER_LINES@ +SHOW_USED_FILES = @DOXYGEN_SHOW_USED_FILES@ +SHOW_FILES = @DOXYGEN_SHOW_FILES@ +SHOW_NAMESPACES = @DOXYGEN_SHOW_NAMESPACES@ +FILE_VERSION_FILTER = @DOXYGEN_FILE_VERSION_FILTER@ +LAYOUT_FILE = @DOXYGEN_LAYOUT_FILE@ +CITE_BIB_FILES = @DOXYGEN_CITE_BIB_FILES@ +QUIET = @DOXYGEN_QUIET@ +WARNINGS = @DOXYGEN_WARNINGS@ +WARN_IF_UNDOCUMENTED = @DOXYGEN_WARN_IF_UNDOCUMENTED@ +WARN_IF_DOC_ERROR = @DOXYGEN_WARN_IF_DOC_ERROR@ +WARN_NO_PARAMDOC = @DOXYGEN_WARN_NO_PARAMDOC@ +WARN_AS_ERROR = @DOXYGEN_WARN_AS_ERROR@ +WARN_FORMAT = @DOXYGEN_WARN_FORMAT@ +WARN_LOGFILE = @DOXYGEN_WARN_LOGFILE@ +INPUT = @DOXYGEN_INPUT@ +INPUT_ENCODING = @DOXYGEN_INPUT_ENCODING@ +FILE_PATTERNS = @DOXYGEN_FILE_PATTERNS@ +RECURSIVE = @DOXYGEN_RECURSIVE@ +EXCLUDE = @DOXYGEN_EXCLUDE@ +EXCLUDE_SYMLINKS = @DOXYGEN_EXCLUDE_SYMLINKS@ +EXCLUDE_PATTERNS = @DOXYGEN_EXCLUDE_PATTERNS@ +EXCLUDE_SYMBOLS = @DOXYGEN_EXCLUDE_SYMBOLS@ +EXAMPLE_PATH = @DOXYGEN_EXAMPLE_PATH@ +EXAMPLE_PATTERNS = @DOXYGEN_EXAMPLE_PATTERNS@ +EXAMPLE_RECURSIVE = @DOXYGEN_EXAMPLE_RECURSIVE@ +IMAGE_PATH = @DOXYGEN_IMAGE_PATH@ +INPUT_FILTER = @DOXYGEN_INPUT_FILTER@ +FILTER_PATTERNS = @DOXYGEN_FILTER_PATTERNS@ +FILTER_SOURCE_FILES = @DOXYGEN_FILTER_SOURCE_FILES@ +FILTER_SOURCE_PATTERNS = @DOXYGEN_FILTER_SOURCE_PATTERNS@ +USE_MDFILE_AS_MAINPAGE = @DOXYGEN_USE_MDFILE_AS_MAINPAGE@ +SOURCE_BROWSER = @DOXYGEN_SOURCE_BROWSER@ +INLINE_SOURCES = @DOXYGEN_INLINE_SOURCES@ +STRIP_CODE_COMMENTS = @DOXYGEN_STRIP_CODE_COMMENTS@ +REFERENCED_BY_RELATION = @DOXYGEN_REFERENCED_BY_RELATION@ +REFERENCES_RELATION = @DOXYGEN_REFERENCES_RELATION@ +REFERENCES_LINK_SOURCE = @DOXYGEN_REFERENCES_LINK_SOURCE@ +SOURCE_TOOLTIPS = @DOXYGEN_SOURCE_TOOLTIPS@ +USE_HTAGS = @DOXYGEN_USE_HTAGS@ +VERBATIM_HEADERS = @DOXYGEN_VERBATIM_HEADERS@ +ALPHABETICAL_INDEX = @DOXYGEN_ALPHABETICAL_INDEX@ +COLS_IN_ALPHA_INDEX = @DOXYGEN_COLS_IN_ALPHA_INDEX@ +IGNORE_PREFIX = @DOXYGEN_IGNORE_PREFIX@ +GENERATE_HTML = @DOXYGEN_GENERATE_HTML@ +HTML_OUTPUT = @DOXYGEN_HTML_OUTPUT@ +HTML_FILE_EXTENSION = @DOXYGEN_HTML_FILE_EXTENSION@ +HTML_HEADER = @DOXYGEN_HTML_HEADER@ +HTML_FOOTER = @DOXYGEN_HTML_FOOTER@ +HTML_STYLESHEET = @DOXYGEN_HTML_STYLESHEET@ +HTML_EXTRA_STYLESHEET = @DOXYGEN_HTML_EXTRA_STYLESHEET@ +HTML_EXTRA_FILES = @DOXYGEN_HTML_EXTRA_FILES@ +HTML_COLORSTYLE_HUE = @DOXYGEN_HTML_COLORSTYLE_HUE@ +HTML_COLORSTYLE_SAT = @DOXYGEN_HTML_COLORSTYLE_SAT@ +HTML_COLORSTYLE_GAMMA = @DOXYGEN_HTML_COLORSTYLE_GAMMA@ +HTML_TIMESTAMP = @DOXYGEN_HTML_TIMESTAMP@ +HTML_DYNAMIC_MENUS = @DOXYGEN_HTML_DYNAMIC_MENUS@ +HTML_DYNAMIC_SECTIONS = @DOXYGEN_HTML_DYNAMIC_SECTIONS@ +HTML_INDEX_NUM_ENTRIES = @DOXYGEN_HTML_INDEX_NUM_ENTRIES@ +GENERATE_DOCSET = @DOXYGEN_GENERATE_DOCSET@ +DOCSET_FEEDNAME = @DOXYGEN_DOCSET_FEEDNAME@ +DOCSET_BUNDLE_ID = @DOXYGEN_DOCSET_BUNDLE_ID@ +DOCSET_PUBLISHER_ID = @DOXYGEN_DOCSET_PUBLISHER_ID@ +DOCSET_PUBLISHER_NAME = @DOXYGEN_DOCSET_PUBLISHER_NAME@ +GENERATE_HTMLHELP = @DOXYGEN_GENERATE_HTMLHELP@ +CHM_FILE = @DOXYGEN_CHM_FILE@ +HHC_LOCATION = @DOXYGEN_HHC_LOCATION@ +GENERATE_CHI = @DOXYGEN_GENERATE_CHI@ +CHM_INDEX_ENCODING = @DOXYGEN_CHM_INDEX_ENCODING@ +BINARY_TOC = @DOXYGEN_BINARY_TOC@ +TOC_EXPAND = @DOXYGEN_TOC_EXPAND@ +GENERATE_QHP = @DOXYGEN_GENERATE_QHP@ +QCH_FILE = @DOXYGEN_QCH_FILE@ +QHP_NAMESPACE = @DOXYGEN_QHP_NAMESPACE@ +QHP_VIRTUAL_FOLDER = @DOXYGEN_QHP_VIRTUAL_FOLDER@ +QHP_CUST_FILTER_NAME = @DOXYGEN_QHP_CUST_FILTER_NAME@ +QHP_CUST_FILTER_ATTRS = @DOXYGEN_QHP_CUST_FILTER_ATTRS@ +QHP_SECT_FILTER_ATTRS = @DOXYGEN_QHP_SECT_FILTER_ATTRS@ +QHG_LOCATION = @DOXYGEN_QHG_LOCATION@ +GENERATE_ECLIPSEHELP = @DOXYGEN_GENERATE_ECLIPSEHELP@ +ECLIPSE_DOC_ID = @DOXYGEN_ECLIPSE_DOC_ID@ +DISABLE_INDEX = @DOXYGEN_DISABLE_INDEX@ +GENERATE_TREEVIEW = @DOXYGEN_GENERATE_TREEVIEW@ +ENUM_VALUES_PER_LINE = @DOXYGEN_ENUM_VALUES_PER_LINE@ +TREEVIEW_WIDTH = @DOXYGEN_TREEVIEW_WIDTH@ +EXT_LINKS_IN_WINDOW = @DOXYGEN_EXT_LINKS_IN_WINDOW@ +FORMULA_FONTSIZE = @DOXYGEN_FORMULA_FONTSIZE@ +FORMULA_TRANSPARENT = @DOXYGEN_FORMULA_TRANSPARENT@ +USE_MATHJAX = @DOXYGEN_USE_MATHJAX@ +MATHJAX_FORMAT = @DOXYGEN_MATHJAX_FORMAT@ +MATHJAX_RELPATH = @DOXYGEN_MATHJAX_RELPATH@ +MATHJAX_EXTENSIONS = @DOXYGEN_MATHJAX_EXTENSIONS@ +MATHJAX_CODEFILE = @DOXYGEN_MATHJAX_CODEFILE@ +SEARCHENGINE = @DOXYGEN_SEARCHENGINE@ +SERVER_BASED_SEARCH = @DOXYGEN_SERVER_BASED_SEARCH@ +EXTERNAL_SEARCH = @DOXYGEN_EXTERNAL_SEARCH@ +SEARCHENGINE_URL = @DOXYGEN_SEARCHENGINE_URL@ +SEARCHDATA_FILE = @DOXYGEN_SEARCHDATA_FILE@ +EXTERNAL_SEARCH_ID = @DOXYGEN_EXTERNAL_SEARCH_ID@ +EXTRA_SEARCH_MAPPINGS = @DOXYGEN_EXTRA_SEARCH_MAPPINGS@ +GENERATE_LATEX = @DOXYGEN_GENERATE_LATEX@ +LATEX_OUTPUT = @DOXYGEN_LATEX_OUTPUT@ +LATEX_CMD_NAME = @DOXYGEN_LATEX_CMD_NAME@ +MAKEINDEX_CMD_NAME = @DOXYGEN_MAKEINDEX_CMD_NAME@ +LATEX_MAKEINDEX_CMD = @DOXYGEN_LATEX_MAKEINDEX_CMD@ +COMPACT_LATEX = @DOXYGEN_COMPACT_LATEX@ +PAPER_TYPE = @DOXYGEN_PAPER_TYPE@ +EXTRA_PACKAGES = @DOXYGEN_EXTRA_PACKAGES@ +LATEX_HEADER = @DOXYGEN_LATEX_HEADER@ +LATEX_FOOTER = @DOXYGEN_LATEX_FOOTER@ +LATEX_EXTRA_STYLESHEET = @DOXYGEN_LATEX_EXTRA_STYLESHEET@ +LATEX_EXTRA_FILES = @DOXYGEN_LATEX_EXTRA_FILES@ +PDF_HYPERLINKS = @DOXYGEN_PDF_HYPERLINKS@ +USE_PDFLATEX = @DOXYGEN_USE_PDFLATEX@ +LATEX_BATCHMODE = @DOXYGEN_LATEX_BATCHMODE@ +LATEX_HIDE_INDICES = @DOXYGEN_LATEX_HIDE_INDICES@ +LATEX_SOURCE_CODE = @DOXYGEN_LATEX_SOURCE_CODE@ +LATEX_BIB_STYLE = @DOXYGEN_LATEX_BIB_STYLE@ +LATEX_TIMESTAMP = @DOXYGEN_LATEX_TIMESTAMP@ +LATEX_EMOJI_DIRECTORY = @DOXYGEN_LATEX_EMOJI_DIRECTORY@ +GENERATE_RTF = @DOXYGEN_GENERATE_RTF@ +RTF_OUTPUT = @DOXYGEN_RTF_OUTPUT@ +COMPACT_RTF = @DOXYGEN_COMPACT_RTF@ +RTF_HYPERLINKS = @DOXYGEN_RTF_HYPERLINKS@ +RTF_STYLESHEET_FILE = @DOXYGEN_RTF_STYLESHEET_FILE@ +RTF_EXTENSIONS_FILE = @DOXYGEN_RTF_EXTENSIONS_FILE@ +RTF_SOURCE_CODE = @DOXYGEN_RTF_SOURCE_CODE@ +GENERATE_MAN = @DOXYGEN_GENERATE_MAN@ +MAN_OUTPUT = @DOXYGEN_MAN_OUTPUT@ +MAN_EXTENSION = @DOXYGEN_MAN_EXTENSION@ +MAN_SUBDIR = @DOXYGEN_MAN_SUBDIR@ +MAN_LINKS = @DOXYGEN_MAN_LINKS@ +GENERATE_XML = @DOXYGEN_GENERATE_XML@ +XML_OUTPUT = @DOXYGEN_XML_OUTPUT@ +XML_PROGRAMLISTING = @DOXYGEN_XML_PROGRAMLISTING@ +XML_NS_MEMB_FILE_SCOPE = @DOXYGEN_XML_NS_MEMB_FILE_SCOPE@ +GENERATE_DOCBOOK = @DOXYGEN_GENERATE_DOCBOOK@ +DOCBOOK_OUTPUT = @DOXYGEN_DOCBOOK_OUTPUT@ +DOCBOOK_PROGRAMLISTING = @DOXYGEN_DOCBOOK_PROGRAMLISTING@ +GENERATE_AUTOGEN_DEF = @DOXYGEN_GENERATE_AUTOGEN_DEF@ +GENERATE_PERLMOD = @DOXYGEN_GENERATE_PERLMOD@ +PERLMOD_LATEX = @DOXYGEN_PERLMOD_LATEX@ +PERLMOD_PRETTY = @DOXYGEN_PERLMOD_PRETTY@ +PERLMOD_MAKEVAR_PREFIX = @DOXYGEN_PERLMOD_MAKEVAR_PREFIX@ +ENABLE_PREPROCESSING = @DOXYGEN_ENABLE_PREPROCESSING@ +MACRO_EXPANSION = @DOXYGEN_MACRO_EXPANSION@ +EXPAND_ONLY_PREDEF = @DOXYGEN_EXPAND_ONLY_PREDEF@ +SEARCH_INCLUDES = @DOXYGEN_SEARCH_INCLUDES@ +INCLUDE_PATH = @DOXYGEN_INCLUDE_PATH@ +INCLUDE_FILE_PATTERNS = @DOXYGEN_INCLUDE_FILE_PATTERNS@ +PREDEFINED = @DOXYGEN_PREDEFINED@ +EXPAND_AS_DEFINED = @DOXYGEN_EXPAND_AS_DEFINED@ +SKIP_FUNCTION_MACROS = @DOXYGEN_SKIP_FUNCTION_MACROS@ +TAGFILES = @DOXYGEN_TAGFILES@ +GENERATE_TAGFILE = @DOXYGEN_GENERATE_TAGFILE@ +ALLEXTERNALS = @DOXYGEN_ALLEXTERNALS@ +EXTERNAL_GROUPS = @DOXYGEN_EXTERNAL_GROUPS@ +EXTERNAL_PAGES = @DOXYGEN_EXTERNAL_PAGES@ +PERL_PATH = @DOXYGEN_PERL_PATH@ +CLASS_DIAGRAMS = @DOXYGEN_CLASS_DIAGRAMS@ +MSCGEN_PATH = @DOXYGEN_MSCGEN_PATH@ +DIA_PATH = @DOXYGEN_DIA_PATH@ +HIDE_UNDOC_RELATIONS = @DOXYGEN_HIDE_UNDOC_RELATIONS@ +HAVE_DOT = @DOXYGEN_HAVE_DOT@ +DOT_NUM_THREADS = @DOXYGEN_DOT_NUM_THREADS@ +DOT_FONTNAME = @DOXYGEN_DOT_FONTNAME@ +DOT_FONTSIZE = @DOXYGEN_DOT_FONTSIZE@ +DOT_FONTPATH = @DOXYGEN_DOT_FONTPATH@ +CLASS_GRAPH = @DOXYGEN_CLASS_GRAPH@ +COLLABORATION_GRAPH = @DOXYGEN_COLLABORATION_GRAPH@ +GROUP_GRAPHS = @DOXYGEN_GROUP_GRAPHS@ +UML_LOOK = @DOXYGEN_UML_LOOK@ +UML_LIMIT_NUM_FIELDS = @DOXYGEN_UML_LIMIT_NUM_FIELDS@ +TEMPLATE_RELATIONS = @DOXYGEN_TEMPLATE_RELATIONS@ +INCLUDE_GRAPH = @DOXYGEN_INCLUDE_GRAPH@ +INCLUDED_BY_GRAPH = @DOXYGEN_INCLUDED_BY_GRAPH@ +CALL_GRAPH = @DOXYGEN_CALL_GRAPH@ +CALLER_GRAPH = @DOXYGEN_CALLER_GRAPH@ +GRAPHICAL_HIERARCHY = @DOXYGEN_GRAPHICAL_HIERARCHY@ +DIRECTORY_GRAPH = @DOXYGEN_DIRECTORY_GRAPH@ +DOT_IMAGE_FORMAT = @DOXYGEN_DOT_IMAGE_FORMAT@ +INTERACTIVE_SVG = @DOXYGEN_INTERACTIVE_SVG@ +DOT_PATH = @DOXYGEN_DOT_PATH@ +DOTFILE_DIRS = @DOXYGEN_DOTFILE_DIRS@ +MSCFILE_DIRS = @DOXYGEN_MSCFILE_DIRS@ +DIAFILE_DIRS = @DOXYGEN_DIAFILE_DIRS@ +PLANTUML_JAR_PATH = @DOXYGEN_PLANTUML_JAR_PATH@ +PLANTUML_CFG_FILE = @DOXYGEN_PLANTUML_CFG_FILE@ +PLANTUML_INCLUDE_PATH = @DOXYGEN_PLANTUML_INCLUDE_PATH@ +DOT_GRAPH_MAX_NODES = @DOXYGEN_DOT_GRAPH_MAX_NODES@ +MAX_DOT_GRAPH_DEPTH = @DOXYGEN_MAX_DOT_GRAPH_DEPTH@ +DOT_TRANSPARENT = @DOXYGEN_DOT_TRANSPARENT@ +DOT_MULTI_TARGETS = @DOXYGEN_DOT_MULTI_TARGETS@ +GENERATE_LEGEND = @DOXYGEN_GENERATE_LEGEND@ +DOT_CLEANUP = @DOXYGEN_DOT_CLEANUP@ diff --git a/lwip/CMakeLists.txt b/lwip/CMakeLists.txt new file mode 100644 index 0000000..55fc44a --- /dev/null +++ b/lwip/CMakeLists.txt @@ -0,0 +1,35 @@ +cmake_minimum_required(VERSION 3.10) + +set (CMAKE_CONFIGURATION_TYPES "Debug;Release") + +project(lwIP) + +# Example lwIP application +set(LWIP_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + +set (LWIP_DEFINITIONS LWIP_DEBUG=1) + +if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + add_subdirectory(${LWIP_DIR}/contrib/ports/win32/example_app) +elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") + add_subdirectory(${LWIP_DIR}/contrib/ports/unix/example_app) +else() + message(WARNING "Host ${CMAKE_SYSTEM_NAME} is not supported to build example_app") +endif() + +# Source package generation +set(CPACK_SOURCE_GENERATOR "ZIP") +set(CPACK_SOURCE_PACKAGE_DESCRIPTION_SUMMARY "lwIP lightweight IP stack") +set(CPACK_PACKAGE_VERSION_MAJOR "${LWIP_VERSION_MAJOR}") +set(CPACK_PACKAGE_VERSION_MINOR "${LWIP_VERSION_MINOR}") +set(CPACK_PACKAGE_VERSION_PATCH "${LWIP_VERSION_REVISION}") +set(CPACK_SOURCE_IGNORE_FILES "/build/;${CPACK_SOURCE_IGNORE_FILES};.git") +set(CPACK_SOURCE_PACKAGE_FILE_NAME "lwip-${LWIP_VERSION_MAJOR}.${LWIP_VERSION_MINOR}.${LWIP_VERSION_REVISION}") +include(CPack) + +# Generate docs before creating source package +include(src/Filelists.cmake) +add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source) +if (TARGET lwipdocs) + add_dependencies(dist lwipdocs) +endif() diff --git a/lwip/FEATURES b/lwip/FEATURES new file mode 100644 index 0000000..87802d1 --- /dev/null +++ b/lwip/FEATURES @@ -0,0 +1,11 @@ +lwIP is a small independent implementation of the TCP/IP protocol suite targeted at embedded systems. + +The focus of the lwIP TCP/IP implementation is to reduce resource 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. + +Main features include: +- Protocols: IP, IPv6, ICMP, ND, MLD, UDP, TCP, IGMP, ARP, PPPoS, PPPoE, 6LowPAN (via IEEE 802.15.4, BLE or ZEP; since v2.1.0) +- DHCP client, stateless DHCPv6 (since v2.1.0), DNS client (incl. mDNS hostname resolver), AutoIP/APIPA (Zeroconf), ACD (Address Conflict Detection), SNMP agent (v1, v2c, v3 (since v2.1.0), private MIB support & MIB compiler) +- APIs: specialized APIs for enhanced performance & zero copy, optional Berkeley-alike socket API +- Extended features: IP forwarding over multiple network interfaces +- Extended TCP features: congestion control, RTT estimation and fast recovery/fast retransmit, sending SACKs (since v2.1.0), "altcp": nearly transparent TLS for any tcp pcb (since v2.1.0) +- Addon applications: HTTP server (HTTPS via altcp), HTTP(S) client (since v2.1.0), SNTP client, SMTP client (SMTPS via altcp), ping, NetBIOS nameserver, mDNS responder, MQTT client (TLS support since v2.1.0), TFTP server, iPerf2 counterpart diff --git a/lwip/FILES b/lwip/FILES index 6625319..2a7086c 100644 --- a/lwip/FILES +++ b/lwip/FILES @@ -1,4 +1,6 @@ +contrib/ - lwIP examples, ports, and small apps (formerly http://git.savannah.gnu.org/cgit/lwip/lwip-contrib.git/) src/ - The source code for the lwIP TCP/IP stack. doc/ - The documentation for lwIP. +test/ - Some code to test whether the sources do what they should. See also the FILES file in each subdirectory. diff --git a/lwip/README b/lwip/README index a62cc4f..f5df8d1 100644 --- a/lwip/README +++ b/lwip/README @@ -1,37 +1,57 @@ INTRODUCTION -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). +lwIP is a small independent implementation of the TCP/IP protocol suite. 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 tens of kilobytes of free RAM and room for around 40 kilobytes of code ROM. +lwIP was originally developed by Adam Dunkels at the Computer and Networks +Architectures (CNA) lab at the Swedish Institute of Computer Science (SICS) +and is now developed and maintained by a worldwide network of developers. + FEATURES - * IP (Internet Protocol) including packet forwarding over multiple network - interfaces + * IP (Internet Protocol, IPv4 and IPv6) including packet forwarding over + multiple network interfaces * ICMP (Internet Control Message Protocol) for network maintenance and debugging * IGMP (Internet Group Management Protocol) for multicast traffic management + * MLD (Multicast listener discovery for IPv6). Aims to be compliant with + RFC 2710. No support for MLDv2 + * ND (Neighbor discovery and stateless address autoconfiguration for IPv6). + Aims to be compliant with RFC 4861 (Neighbor discovery) and RFC 4862 + (Address autoconfiguration) + * DHCP, AutoIP/APIPA (Zeroconf), ACD (Address Conflict Detection) + and (stateless) DHCPv6 * UDP (User Datagram Protocol) including experimental UDP-lite extensions * TCP (Transmission Control Protocol) with congestion control, RTT estimation - and fast recovery/fast retransmit - * Specialized raw/native API for enhanced performance + fast recovery/fast retransmit and sending SACKs + * raw/native API for enhanced performance * Optional Berkeley-like socket API - * DNS (Domain names resolver) - * SNMP (Simple Network Management Protocol) - * DHCP (Dynamic Host Configuration Protocol) - * AUTOIP (for IPv4, conform with RFC 3927) - * PPP (Point-to-Point Protocol) - * ARP (Address Resolution Protocol) for Ethernet + * TLS: optional layered TCP ("altcp") for nearly transparent TLS for any + TCP-based protocol (ported to mbedTLS) (see changelog for more info) + * PPPoS and PPPoE (Point-to-point protocol over Serial/Ethernet) + * DNS (Domain name resolver incl. mDNS) + * 6LoWPAN (via IEEE 802.15.4, BLE or ZEP) + + +APPLICATIONS + + * HTTP server with SSI and CGI (HTTPS via altcp) + * SNMPv2c agent with MIB compiler (Simple Network Management Protocol), v3 via altcp + * SNTP (Simple network time protocol) + * NetBIOS name service responder + * MDNS (Multicast DNS) responder + * iPerf server implementation + * MQTT client (TLS support via altcp) + LICENSE lwIP is freely available under a BSD license. + DEVELOPMENT lwIP has grown into an excellent TCP/IP stack for embedded devices, @@ -40,50 +60,50 @@ 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. Everyone can -help improve lwIP by use of Savannah's interface, CVS and the +help improve lwIP by use of Savannah's interface, Git and the mailing list. A core team of developers will commit changes to the -CVS source tree. +Git source tree. -The lwIP TCP/IP stack is maintained in the 'lwip' CVS module and -contributions (such as platform ports) are in the 'contrib' module. +The lwIP TCP/IP stack is maintained in the 'lwip' Git module and +contributions (such as platform ports) are in the 'contrib' Git module. -See doc/savannah.txt for details on CVS server access for users and +See doc/savannah.txt for details on Git server access for users and developers. -Last night's CVS tar ball can be downloaded from: - http://savannah.gnu.org/cvs.backups/lwip.tar.gz [CHANGED - NEEDS FIXING] - -The current CVS trees are web-browsable: - http://savannah.nongnu.org/cgi-bin/viewcvs/lwip/lwip/ - http://savannah.nongnu.org/cgi-bin/viewcvs/lwip/contrib/ +The current Git trees are web-browsable: + http://git.savannah.gnu.org/cgit/lwip.git + http://git.savannah.gnu.org/cgit/lwip/lwip-contrib.git Submit patches and bugs via the lwIP project page: http://savannah.nongnu.org/projects/lwip/ +Continuous integration builds (GCC, clang): + https://travis-ci.org/lwip-tcpip/lwip -DOCUMENTATION -The original out-dated homepage of lwIP and Adam Dunkels' papers on -lwIP are at the official lwIP home page: - http://www.sics.se/~adam/lwip/ +DOCUMENTATION -Self documentation of the source code is regularly extracted from the -current CVS sources and is available from this web page: +Self documentation of the source code is regularly extracted from the current +Git sources and is available from this web page: http://www.nongnu.org/lwip/ -There is now a constantly growin wiki about lwIP at - http://lwip.wikia.com/wiki/LwIP_Wiki - Also, there are mailing lists you can subscribe at http://savannah.nongnu.org/mail/?group=lwip plus searchable archives: http://lists.nongnu.org/archive/html/lwip-users/ http://lists.nongnu.org/archive/html/lwip-devel/ +There is a wiki about lwIP at + http://lwip.wikia.com/wiki/LwIP_Wiki +You might get questions answered there, but unfortunately, it is not as +well maintained as it should be. + +lwIP was originally written by Adam Dunkels: + http://dunkels.com/adam/ + Reading Adam's papers, the files in docs/, browsing the source code documentation and browsing the mailing list archives is a good way to become familiar with the design of lwIP. Adam Dunkels Leon Woestenberg - diff --git a/lwip/UPGRADING b/lwip/UPGRADING index 6501107..21ad8cc 100644 --- a/lwip/UPGRADING +++ b/lwip/UPGRADING @@ -4,10 +4,144 @@ application written for an older version of lwIP to correctly work with newer versions. -(CVS HEAD) +(git master) * [Enter new changes just after this line - do not remove this line] +(2.1.0) + + ++ Application changes: + + * Use the new altcp API for seamless TLS integration into existing TCP applications (see changelog) + * TCP only kills existing connections with a LOWER priority than the one currently being opened. + Previous implementations also kill existing connections of the SAME priority. + * ip4_route_src: parameter order is reversed: ip4_route_src(dest, src) -> ip4_route_src(src, dest) + to make parameter order consistent with other ip*_route*() functions. + Same also applies to LWIP_HOOK_IP4_ROUTE_SRC() parameter order. + * pbuf API: pbuf->type (an u8_t holding the enum 'pbuf_type') has changed to only hold a + description of the pbuf (e.g. data following pbuf struct, data volatile, allocation + source heap/pool/etc.). As a consequence, applications can't test pbuf->type any more. + Use pbuf_match_type(pbuf, type) instead. + * socket API: according to the standard, SO_ERROR now only returns asynchronous errors. + All other/normal/synchronous errors are (and always were) available via 'errno'. + LWIP_SOCKET_SET_ERRNO has been removed - 'errno' is always set - and required! + * httpd LWIP_HTTPD_CGI_SSI: httpd_cgi_handler() has an additional parameter "struct fs_file *" + + ++ Port changes: + + * tcpip_trycallback() was renamed to tcpip_callbackmsg_trycallback() to avoid confusion + with tcpip_try_callback() + * compatibility headers: moved from 'src/include/posix' to 'src/include/compat/posix', + 'src/include/compat/stdc' etc. + * The IPv6 implementation now supports address scopes. (See LWIP_IPV6_SCOPES documentation + and ip6_zone.h for more documentation) + * LWIP_HOOK_DHCP_APPEND_OPTIONS() has changed, see description in opt.h (options_out_len is not + available in struct dhcp any more) + * Added debug helper asserts to ensure threading/locking requirements are met (define + LWIP_MARK_TCPIP_THREAD() and LWIP_ASSERT_CORE_LOCKED()). + * Added sys_mbox_trypost_fromisr() and tcpip_callbackmsg_trycallback_fromisr() + These can be used to post preallocated messages from an ISR to the tcpip thread + (e.g. when using FreeRTOS) + +(2.0.2) + + ++ Application changes: + + * slipif: The way to pass serial port number has changed. netif->num is not + supported any more, netif->state is interpreted as an u8_t port number now + (it's not a POINTER to an u8_t any more!) + +(2.0.1) + + ++ Application changes: + + * UDP does NOT receive multicast traffic from ALL netifs on an UDP PCB bound to a specific + netif any more. Users need to bind to IP_ADDR_ANY to receive multicast traffic and compare + ip_current_netif() to the desired netif for every packet. + See bug #49662 for an explanation. + +(2.0.0) + + ++ Application changes: + + * Changed netif "up" flag handling to be an administrative flag (as opposed to the previous meaning of + "ip4-address-valid", a netif will now not be used for transmission if not up) -> even a DHCP netif + has to be set "up" before starting the DHCP client + * Added IPv6 support (dual-stack or IPv4/IPv6 only) + * Changed ip_addr_t to be a union in dual-stack mode (use ip4_addr_t where referring to IPv4 only). + * Major rewrite of SNMP (added MIB parser that creates code stubs for custom MIBs); + supports SNMPv2c (experimental v3 support) + * Moved some core applications from contrib repository to src/apps (and include/lwip/apps) + + +++ Raw API: + * Changed TCP listen backlog: removed tcp_accepted(), added the function pair tcp_backlog_delayed()/ + tcp_backlog_accepted() to explicitly delay backlog handling on a connection pcb + + +++ Socket API: + * Added an implementation for posix sendmsg() + * Added LWIP_FIONREAD_LINUXMODE that makes ioctl/FIONREAD return the size of the next pending datagram + + ++ Port changes + + +++ new files: + * MANY new and moved files! + * Added src/Filelists.mk for use in Makefile projects + * Continued moving stack-internal parts from abc.h to abc_priv.h in sub-folder "priv" + to let abc.h only contain the actual application programmer's API + + +++ sys layer: + * Made LWIP_TCPIP_CORE_LOCKING==1 the default as it usually performs better than + the traditional message passing (although with LWIP_COMPAT_MUTEX you are still + open to priority inversion, so this is not recommended any more) + * Added LWIP_NETCONN_SEM_PER_THREAD to use one "op_completed" semaphore per thread + instead of using one per netconn (these semaphores are used even with core locking + enabled as some longer lasting functions like big writes still need to delay) + * Added generalized abstraction for itoa(), strnicmp(), stricmp() and strnstr() + in def.h (to be overridden in cc.h) instead of config + options for netbiosns, httpd, dns, etc. ... + * New abstraction for hton* and ntoh* functions in def.h. + To override them, use the following in cc.h: + #define lwip_htons(x) + #define lwip_htonl(x) + + +++ new options: + * TODO + + +++ new pools: + * Added LWIP_MEMPOOL_* (declare/init/alloc/free) to declare private memp pools + that share memp.c code but do not have to be made global via lwippools.h + * Added pools for IPv6, MPU_COMPATIBLE, dns-api, netif-api, etc. + * added hook LWIP_HOOK_MEMP_AVAILABLE() to get informed when a memp pool was empty and an item + is now available + + * Signature of LWIP_HOOK_VLAN_SET macro was changed + + * LWIP_DECLARE_MEMORY_ALIGNED() may be used to declare aligned memory buffers (mem/memp) + or to move buffers to dedicated memory using compiler attributes + + * Standard C headers are used to define sized types and printf formatters + (disable by setting LWIP_NO_STDINT_H=1 or LWIP_NO_INTTYPES_H=1 if your compiler + does not support these) + + + ++ Major bugfixes/improvements + + * Added IPv6 support (dual-stack or IPv4/IPv6 only) + * Major rewrite of PPP (incl. keep-up with apache pppd) + see doc/ppp.txt for an upgrading how-to + * Major rewrite of SNMP (incl. MIB parser) + * Fixed timing issues that might have lead to losing a DHCP lease + * Made rx processing path more robust against crafted errors + * TCP window scaling support + * modification of api modules to support FreeRTOS-MPU (don't pass stack-pointers to other threads) + * made DNS client more robust + * support PBUF_REF for RX packets + * LWIP_NETCONN_FULLDUPLEX allows netconn/sockets to be used for reading/writing from separate + threads each (needs LWIP_NETCONN_SEM_PER_THREAD) + * Moved and reordered stats (mainly memp/mib2) + +(1.4.0) + ++ Application changes: * Replaced struct ip_addr by typedef ip_addr_t (struct ip_addr is kept for diff --git a/lwip/VERSION b/lwip/VERSION deleted file mode 100644 index 94c52ee..0000000 --- a/lwip/VERSION +++ /dev/null @@ -1 +0,0 @@ -e7f32240917cc912eb6e3e36780ecb3c4a06f264 diff --git a/lwip/contrib/Coverity/coverity.c b/lwip/contrib/Coverity/coverity.c new file mode 100644 index 0000000..99bebae --- /dev/null +++ b/lwip/contrib/Coverity/coverity.c @@ -0,0 +1,106 @@ +typedef unsigned char err_t; +typedef unsigned int u32_t; +typedef unsigned short u16_t; +typedef unsigned char u8_t; +typedef void sys_sem_t; +typedef void sys_mutex_t; +typedef size_t mem_size_t; +typedef size_t memp_t; +struct pbuf; +struct netif; + +void* mem_malloc(mem_size_t size) +{ + __coverity_alloc__(size); +} +void mem_free(void* mem) +{ + __coverity_free__(mem); +} + +void* memp_malloc(memp_t type) +{ + __coverity_alloc_nosize__(); +} +void memp_free(memp_t type, void* mem) +{ + __coverity_free__(mem); +} + +void sys_mutex_lock(sys_mutex_t* mutex) +{ + __coverity_exclusive_lock_acquire__(mutex); +} +void sys_mutex_unlock(sys_mutex_t* mutex) +{ + __coverity_exclusive_lock_release__(mutex); +} + +u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout) +{ + __coverity_recursive_lock_acquire__(sem); +} +void sys_sem_signal(sys_sem_t *sem) +{ + __coverity_recursive_lock_release__(sem); +} + +err_t ethernet_input(struct pbuf *p, struct netif *inp) +{ + __coverity_tainted_string_sink_content__(p); +} +err_t tcpip_input(struct pbuf *p, struct netif *inp) +{ + __coverity_tainted_string_sink_content__(p); +} +err_t ip_input(struct pbuf *p, struct netif *inp) +{ + __coverity_tainted_string_sink_content__(p); +} +err_t ip4_input(struct pbuf *p, struct netif *inp) +{ + __coverity_tainted_string_sink_content__(p); +} +err_t ip6_input(struct pbuf *p, struct netif *inp) +{ + __coverity_tainted_string_sink_content__(p); +} + +err_t pbuf_take(struct pbuf *buf, const void *dataptr, u16_t len) +{ + __coverity_tainted_string_argument__(buf); + __coverity_tainted_data_argument__(buf); +} +err_t pbuf_take_at(struct pbuf *buf, const void *dataptr, u16_t len, u16_t offset) +{ + __coverity_tainted_string_argument__(buf); + __coverity_tainted_data_argument__(buf); +} +err_t pbuf_copy(struct pbuf *p_to, struct pbuf *p_from) +{ + __coverity_tainted_data_transitive__(p_to, p_from); +} +u16_t pbuf_copy_partial(struct pbuf *p, void *dataptr, u16_t len, u16_t offset) +{ + __coverity_tainted_string_argument__(dataptr); + __coverity_tainted_data_argument__(dataptr); +} +u8_t pbuf_get_at(struct pbuf* p, u16_t offset) +{ + __coverity_tainted_data_return__(); +} + +void abort(void) +{ + __coverity_panic__(); +} + +int check_path(char* path, size_t size) +{ + if (size) { + __coverity_tainted_data_sanitize__(path); + return 1; + } else { + return 0; + } +} diff --git a/lwip/contrib/Filelists.mk b/lwip/contrib/Filelists.mk new file mode 100644 index 0000000..e330295 --- /dev/null +++ b/lwip/contrib/Filelists.mk @@ -0,0 +1,56 @@ +# +# 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 +# + +# CONTRIBAPPFILES: Contrib Applications. +CONTRIBAPPFILES=$(CONTRIBDIR)/apps/httpserver/httpserver-netconn.c \ + $(CONTRIBDIR)/apps/chargen/chargen.c \ + $(CONTRIBDIR)/apps/udpecho/udpecho.c \ + $(CONTRIBDIR)/apps/tcpecho/tcpecho.c \ + $(CONTRIBDIR)/apps/shell/shell.c \ + $(CONTRIBDIR)/apps/udpecho_raw/udpecho_raw.c \ + $(CONTRIBDIR)/apps/tcpecho_raw/tcpecho_raw.c \ + $(CONTRIBDIR)/apps/netio/netio.c \ + $(CONTRIBDIR)/apps/ping/ping.c \ + $(CONTRIBDIR)/apps/socket_examples/socket_examples.c \ + $(CONTRIBDIR)/apps/rtp/rtp.c \ + $(CONTRIBDIR)/examples/httpd/fs_example/fs_example.c \ + $(CONTRIBDIR)/examples/httpd/ssi_example/ssi_example.c \ + $(CONTRIBDIR)/examples/lwiperf/lwiperf_example.c \ + $(CONTRIBDIR)/examples/mdns/mdns_example.c \ + $(CONTRIBDIR)/examples/mqtt/mqtt_example.c \ + $(CONTRIBDIR)/examples/ppp/pppos_example.c \ + $(CONTRIBDIR)/examples/snmp/snmp_private_mib/lwip_prvmib.c \ + $(CONTRIBDIR)/examples/snmp/snmp_v3/snmpv3_dummy.c \ + $(CONTRIBDIR)/examples/snmp/snmp_example.c \ + $(CONTRIBDIR)/examples/sntp/sntp_example.c \ + $(CONTRIBDIR)/examples/tftp/tftp_example.c \ + $(CONTRIBDIR)/addons/tcp_isn/tcp_isn.c \ + $(CONTRIBDIR)/addons/ipv6_static_routing/ip6_route_table.c diff --git a/lwip/contrib/addons/ipv6_static_routing/README b/lwip/contrib/addons/ipv6_static_routing/README new file mode 100644 index 0000000..0c3b06c --- /dev/null +++ b/lwip/contrib/addons/ipv6_static_routing/README @@ -0,0 +1,43 @@ +A simple routing table implementation for addition, deletion and lookup of IPv6 routes.  + +APIs are: +1) s8_t ip6_add_route_entry(struct ip6_prefix *ip6_prefix, +                            struct netif *netif, +                            ip6_addr_t *gateway, +                            s8_t *index); + +2) err_t ip6_remove_route_entry(struct ip6_prefix *ip6_prefix); + +3) s8_t ip6_find_route_entry(ip6_addr_t *ip6_dest_addr); + +4) struct netif *ip6_static_route(ip6_addr_t *src, ip6_addr_t *dest); + +5) ip6_addr_t *ip6_get_gateway(struct netif *netif, ip6_addr_t *dest); + +6) struct ip6_route_entry *ip6_get_route_table(void); + +For route lookup from the table, The LWIP_HOOK_IP6_ROUTE hook in ip6_route(..) of ip6.c +could be assigned to the ip6_static_route() API of this implementation to return the +appropriate netif. + +-- The application can add routes using the API ip6_add_route_entry(..).  +   This API adds the ip6 prefix route into the static route table while +   keeping all entries sorted in decreasing order of prefix length. +   Subsequently, a linear search down the list can be performed to retrieve a +   matching route entry for a Longest Prefix Match. +   The prefix length is expected to be at an 8-bit boundary. While this is  +   a limitation, it would serve most practical purposes. + +-- The application can remove routes using the API ip6_remove_route_entry(..). + +-- The application can find a route entry for a specific address using the  +   ip6_find_route_entry() function which returns the index of the found entry.  +   This is used internally by the route lookup function ip6_static_route() API. + +-- To fetch the gateway IPv6 address for a specific destination IPv6  +   address and target netif, the application can call ip6_get_gateway(..). + This API could be assigned to the LWIP_HOOK_ND6_GET_GW() if a gateway has + been added as part of the ip6_add_route_entry(). + +-- To fetch a pointer to the head of the table, the application can call  +   ip6_get_route_table(). diff --git a/lwip/contrib/addons/ipv6_static_routing/ip6_route_table.c b/lwip/contrib/addons/ipv6_static_routing/ip6_route_table.c new file mode 100644 index 0000000..a92dd33 --- /dev/null +++ b/lwip/contrib/addons/ipv6_static_routing/ip6_route_table.c @@ -0,0 +1,248 @@ +/** + * @file + * IPv6 static route table. + */ + +/* + * Copyright (c) 2015 Nest Labs, Inc. + * 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: Pradip De + * + * + * Please coordinate changes and requests with Pradip De + * + */ + +#include "lwip/opt.h" + +#if LWIP_IPV6 /* don't build if not configured for use in lwipopts.h */ + +#include "ip6_route_table.h" +#include "lwip/def.h" +#include "lwip/mem.h" +#include "lwip/netif.h" +#include "lwip/ip6.h" +#include "lwip/ip6_addr.h" +#include "lwip/nd6.h" +#include "lwip/debug.h" +#include "lwip/stats.h" + +#include "string.h" + +static struct ip6_route_entry static_route_table[LWIP_IPV6_NUM_ROUTE_ENTRIES]; + +/** + * Add the ip6 prefix route and target netif into the static route table while + * keeping all entries sorted in decreasing order of prefix length. + * 1. Search from the last entry up to find the correct slot to insert while + * moving entries one position down to create room. + * 2. Insert into empty slot created. + * + * Subsequently, a linear search down the list can be performed to retrieve a + * matching route entry for a Longest Prefix Match. + * + * @param ip6_prefix the route prefix entry to add. + * @param netif pointer to target netif. + * @param gateway the gateway address to use to send through. Has to be link local. + * @param idx return value argument of index where route entry was added in table. + * @return ERR_OK if addition was successful. + * ERR_MEM if table is already full. + * ERR_ARG if passed argument is bad or route already exists in table. + */ +err_t +ip6_add_route_entry(const struct ip6_prefix *ip6_prefix, struct netif *netif, const ip6_addr_t *gateway, s8_t *idx) +{ + s8_t i = -1; + err_t retval = ERR_OK; + + if (!ip6_prefix_valid(ip6_prefix->prefix_len) || (netif == NULL)) { + retval = ERR_ARG; + goto exit; + } + + /* Check if an entry already exists with matching prefix; If so, replace it. */ + for (i = 0; i < LWIP_IPV6_NUM_ROUTE_ENTRIES; i++) { + if ((ip6_prefix->prefix_len == static_route_table[i].prefix.prefix_len) && + memcmp(&ip6_prefix->addr, &static_route_table[i].prefix.addr, + ip6_prefix->prefix_len / 8) == 0) { + /* Prefix matches; replace the netif with the one being added. */ + goto insert; + } + } + + /* Check if the table is full */ + if (static_route_table[LWIP_IPV6_NUM_ROUTE_ENTRIES - 1].netif != NULL) { + retval = ERR_MEM; + goto exit; + } + + /* Shift all entries down the table until slot is found */ + for (i = LWIP_IPV6_NUM_ROUTE_ENTRIES - 1; + i > 0 && (ip6_prefix->prefix_len > static_route_table[i - 1].prefix.prefix_len); i--) { + SMEMCPY(&static_route_table[i], &static_route_table[i - 1], sizeof(struct ip6_route_entry)); + } + +insert: + /* Insert into the slot selected */ + SMEMCPY(&static_route_table[i].prefix, ip6_prefix, sizeof(struct ip6_prefix)); + static_route_table[i].netif = netif; + + /* Add gateway to route table */ + static_route_table[i].gateway = gateway; + + if (idx != NULL) { + *idx = i; + } + +exit: + return retval; +} + +/** + * Removes the route entry from the static route table. + * + * @param ip6_prefix the route prefix entry to delete. + */ +void +ip6_remove_route_entry(const struct ip6_prefix *ip6_prefix) +{ + int i, pos = -1; + + for (i = 0; i < LWIP_IPV6_NUM_ROUTE_ENTRIES; i++) { + /* compare prefix to find position to delete */ + if (ip6_prefix->prefix_len == static_route_table[i].prefix.prefix_len && + memcmp(&ip6_prefix->addr, &static_route_table[i].prefix.addr, + ip6_prefix->prefix_len / 8) == 0) { + pos = i; + break; + } + } + + if (pos >= 0) { + /* Shift everything beyond pos one slot up */ + for (i = pos; i < LWIP_IPV6_NUM_ROUTE_ENTRIES - 1; i++) { + SMEMCPY(&static_route_table[i], &static_route_table[i+1], sizeof(struct ip6_route_entry)); + if (static_route_table[i].netif == NULL) { + break; + } + } + /* Zero the remaining entries */ + for (; i < LWIP_IPV6_NUM_ROUTE_ENTRIES; i++) { + ip6_addr_set_zero((&static_route_table[i].prefix.addr)); + static_route_table[i].netif = NULL; + } + } +} + +/** + * Finds the appropriate route entry in the static route table corresponding to the given + * destination IPv6 address. Since the entries in the route table are kept sorted in decreasing + * order of prefix length, a linear search down the list is performed to retrieve a matching + * index. + * + * @param ip6_dest_addr the destination address to match + * @return the idx of the found route entry; -1 if not found. + */ +s8_t +ip6_find_route_entry(const ip6_addr_t *ip6_dest_addr) +{ + s8_t i, idx = -1; + + /* Search prefix in the sorted(decreasing order of prefix length) list */ + for(i = 0; i < LWIP_IPV6_NUM_ROUTE_ENTRIES; i++) { + if (memcmp(ip6_dest_addr, &static_route_table[i].prefix.addr, + static_route_table[i].prefix.prefix_len / 8) == 0) { + idx = i; + break; + } + } + + return idx; +} + +/** + * Finds the appropriate network interface for a given IPv6 address from a routing table with + * static IPv6 routes. + * + * @param src the source IPv6 address, if known + * @param dest the destination IPv6 address for which to find the route + * @return the netif on which to send to reach dest + */ +struct netif * +ip6_static_route(const ip6_addr_t *src, const ip6_addr_t *dest) +{ + int i; + + LWIP_UNUSED_ARG(src); + + /* Perform table lookup */ + i = ip6_find_route_entry(dest); + + if (i >= 0) { + return static_route_table[i].netif; + } else { + return NULL; + } +} + +/** + * Finds the gateway IP6 address for a given destination IPv6 address and target netif + * from a routing table with static IPv6 routes. + * + * @param netif the netif used for sending + * @param dest the destination IPv6 address + * @return the ip6 address of the gateway to forward packet to + */ +const ip6_addr_t * +ip6_get_gateway(struct netif *netif, const ip6_addr_t *dest) +{ + const ip6_addr_t *ret_gw = NULL; + const int i = ip6_find_route_entry(dest); + + LWIP_UNUSED_ARG(netif); + + if (i >= 0) { + if (static_route_table[i].gateway != NULL) { + ret_gw = static_route_table[i].gateway; + } + } + + return ret_gw; +} + +/** + * Returns the top of the route table. + * This should be used for debug printing only. + * + * @return the top of the route table. + */ +const struct ip6_route_entry * +ip6_get_route_table(void) +{ + return static_route_table; +} + +#endif /* LWIP_IPV6 */ diff --git a/lwip/contrib/addons/ipv6_static_routing/ip6_route_table.h b/lwip/contrib/addons/ipv6_static_routing/ip6_route_table.h new file mode 100644 index 0000000..478328e --- /dev/null +++ b/lwip/contrib/addons/ipv6_static_routing/ip6_route_table.h @@ -0,0 +1,94 @@ +/** + * @file + * + * IPv6 static route table. + */ + +/* + * Copyright (c) 2015 Nest Labs, Inc. + * 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: Pradip De + * + * + * Please coordinate changes and requests with Pradip De + * + */ + +#ifndef __LWIP_IP6_ROUTE_TABLE_H__ +#define __LWIP_IP6_ROUTE_TABLE_H__ + +#include "lwip/opt.h" + +#if LWIP_IPV6 /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/ip6_addr.h" +#include "lwip/err.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct netif; + +/** + * LWIP_IPV6_NUM_ROUTES: Number of IPV6 routes that can be kept in the static route table. + */ +#ifndef LWIP_IPV6_NUM_ROUTE_ENTRIES +#define LWIP_IPV6_NUM_ROUTE_ENTRIES (8) +#endif + +#define IP6_MAX_PREFIX_LEN (128) +#define IP6_PREFIX_ALLOWED_GRANULARITY (8) +/* Prefix length cannot be greater than 128 bits and needs to be at a byte boundary */ +#define ip6_prefix_valid(prefix_len) (((prefix_len) <= IP6_MAX_PREFIX_LEN) && \ + (((prefix_len) % IP6_PREFIX_ALLOWED_GRANULARITY) == 0)) + +struct ip6_prefix { + ip6_addr_t addr; + u8_t prefix_len; /* prefix length in bits at byte boundaries */ +}; + +struct ip6_route_entry { + struct ip6_prefix prefix; + struct netif *netif; + const ip6_addr_t *gateway; +}; + +err_t ip6_add_route_entry(const struct ip6_prefix *ip6_prefix, struct netif *netif, + const ip6_addr_t *gateway, s8_t *idx); +void ip6_remove_route_entry(const struct ip6_prefix *ip6_prefix); +s8_t ip6_find_route_entry(const ip6_addr_t *ip6_dest_addr); +struct netif *ip6_static_route(const ip6_addr_t *src, const ip6_addr_t *dest); +const ip6_addr_t *ip6_get_gateway(struct netif *netif, const ip6_addr_t *dest); +const struct ip6_route_entry *ip6_get_route_table(void); + +#ifdef __cplusplus +} +#endif + +#endif /* LWIP_IPV6 */ + +#endif /* __LWIP_IP6_ROUTE_TABLE_H__ */ diff --git a/lwip/contrib/addons/netconn/external_resolve/dnssd.c b/lwip/contrib/addons/netconn/external_resolve/dnssd.c new file mode 100644 index 0000000..d26743b --- /dev/null +++ b/lwip/contrib/addons/netconn/external_resolve/dnssd.c @@ -0,0 +1,164 @@ +/** + * @file + * DNS-SD APIs used by LWIP_HOOK_NETCONN_EXTERNAL_RESOLVE + * + * This implementation assumes the DNS-SD API implementation (most likely provided by + * mDNSResponder) is implemented in the same process space as LwIP and can directly + * invoke the callback for DNSServiceGetAddrInfo. This is the typical deployment in + * an embedded environment where as a traditional OS requires pumping the callback results + * through an IPC mechanism (see DNSServiceRefSockFD/DNSServiceProcessResult) + * + * @defgroup dnssd DNS-SD + * @ingroup dns + */ + +/* + * Copyright (c) 2017 Joel Cunningham, Garmin International, Inc. + * 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: Joel Cunningham + * + */ +#include "lwip/opt.h" + +#include "lwip/err.h" +#include "lwip/inet.h" +#include "lwip/sockets.h" +#include "lwip/sys.h" + +#include "dnssd.h" + +/* External headers */ +#include +#include + +/* This timeout should allow for multiple queries. +mDNSResponder has the following query timeline: + Query 1: time = 0s + Query 2: time = 1s + Query 3: time = 4s +*/ +#define GETADDR_TIMEOUT_MS 5000 +#define LOCAL_DOMAIN ".local" + +/* Only consume .local hosts */ +#ifndef CONSUME_LOCAL_ONLY +#define CONSUME_LOCAL_ONLY 1 +#endif + +struct addr_clbk_msg { + sys_sem_t sem; + struct sockaddr_storage addr; + err_t err; +}; + +static void addr_info_callback(DNSServiceRef ref, DNSServiceFlags flags, u32_t interface_index, + DNSServiceErrorType error_code, char const* hostname, + const struct sockaddr* address, u32_t ttl, void* context); + +int +lwip_dnssd_gethostbyname(const char *name, ip_addr_t *addr, u8_t addrtype, err_t *err) +{ + DNSServiceErrorType result; + DNSServiceRef ref; + struct addr_clbk_msg msg; + char *p; + + /* @todo: use with IPv6 */ + LWIP_UNUSED_ARG(addrtype); + +#if CONSUME_LOCAL_ONLY + /* check if this is a .local host. If it is, then we consume the query */ + p = strstr(name, LOCAL_DOMAIN); + if (p == NULL) { + return 0; /* not consumed */ + } + p += (sizeof(LOCAL_DOMAIN) - 1); + /* check to make sure .local isn't a substring (only allow .local\0 or .local.\0) */ + if ((*p != '.' && *p != '\0') || + (*p == '.' && *(p + 1) != '\0')) { + return 0; /* not consumed */ + } +#endif /* CONSUME_LOCAL_ONLY */ + + msg.err = sys_sem_new(&msg.sem, 0); + if (msg.err != ERR_OK) { + goto query_done; + } + + msg.err = ERR_TIMEOUT; + result = DNSServiceGetAddrInfo(&ref, 0, 0, kDNSServiceProtocol_IPv4, name, addr_info_callback, &msg); + if (result == kDNSServiceErr_NoError) { + sys_arch_sem_wait(&msg.sem, GETADDR_TIMEOUT_MS); + DNSServiceRefDeallocate(ref); + + /* We got a response */ + if (msg.err == ERR_OK) { + struct sockaddr_in* addr_in = (struct sockaddr_in *)&msg.addr; + if (addr_in->sin_family == AF_INET) { + inet_addr_to_ip4addr(ip_2_ip4(addr), &addr_in->sin_addr); + } else { + /* @todo add IPv6 support */ + msg.err = ERR_VAL; + } + } + } + sys_sem_free(&msg.sem); + +/* Query has been consumed and is finished */ +query_done: +*err = msg.err; +return 1; +} + +static void +addr_info_callback(DNSServiceRef ref, DNSServiceFlags flags, u32_t interface_index, + DNSServiceErrorType error_code, char const* hostname, + const struct sockaddr* address, u32_t ttl, void* context) +{ + struct addr_clbk_msg* msg = (struct addr_clbk_msg*)context; + struct sockaddr_in* addr_in = (struct sockaddr_in *)address; + + LWIP_UNUSED_ARG(ref); + LWIP_UNUSED_ARG(flags); + LWIP_UNUSED_ARG(interface_index); + LWIP_UNUSED_ARG(hostname); + LWIP_UNUSED_ARG(ttl); + LWIP_UNUSED_ARG(context); + + if ((error_code == kDNSServiceErr_NoError) && + (addr_in->sin_family == AF_INET)) { + MEMCPY(&msg->addr, addr_in, sizeof(*addr_in)); + msg->err = ERR_OK; + } + else { + /* @todo add IPv6 support */ + msg->err = ERR_VAL; + } + + sys_sem_signal(&msg->sem); +} /* addr_info_callback() */ diff --git a/lwip/src/include/ipv6/lwip/dhcp6.h b/lwip/contrib/addons/netconn/external_resolve/dnssd.h similarity index 74% rename from lwip/src/include/ipv6/lwip/dhcp6.h rename to lwip/contrib/addons/netconn/external_resolve/dnssd.h index 345bcf0..e2d71d9 100644 --- a/lwip/src/include/ipv6/lwip/dhcp6.h +++ b/lwip/contrib/addons/netconn/external_resolve/dnssd.h @@ -1,11 +1,13 @@ /** * @file + * DNS-SD APIs used by LWIP_HOOK_NETCONN_EXTERNAL_RESOLVE * - * IPv6 address autoconfiguration as per RFC 4862. + * @defgroup dnssd DNS-SD + * @ingroup dns */ /* - * Copyright (c) 2010 Inico Technologies Ltd. + * Copyright (c) 2017 Joel Cunningham, Garmin International, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -32,27 +34,17 @@ * * This file is part of the lwIP TCP/IP stack. * - * Author: Ivan Delamer + * Author: Joel Cunningham * - * IPv6 address autoconfiguration as per RFC 4862. - * - * Please coordinate changes and requests with Ivan Delamer - * */ - -#ifndef LWIP_HDR_IP6_DHCP6_H -#define LWIP_HDR_IP6_DHCP6_H - #include "lwip/opt.h" -#if LWIP_IPV6_DHCP6 /* don't build if not configured for use in lwipopts.h */ - +#ifndef LWIP_HDR_DNSSD_H +#define LWIP_HDR_DNSSD_H -struct dhcp6 -{ - /*TODO: implement DHCP6*/ -}; +#include "lwip/err.h" +#include "lwip/ip_addr.h" -#endif /* LWIP_IPV6_DHCP6 */ +int lwip_dnssd_gethostbyname(const char *name, ip_addr_t *addr, u8_t addrtype, err_t *err); -#endif /* LWIP_HDR_IP6_DHCP6_H */ +#endif /* LWIP_HDR_DNSSD_H */ diff --git a/lwip/contrib/addons/tcp_isn/tcp_isn.c b/lwip/contrib/addons/tcp_isn/tcp_isn.c new file mode 100644 index 0000000..c161499 --- /dev/null +++ b/lwip/contrib/addons/tcp_isn/tcp_isn.c @@ -0,0 +1,182 @@ +/** + * @file + * + * Reference implementation of the TCP ISN algorithm standardized in RFC 6528. + * Produce TCP Initial Sequence Numbers by combining an MD5-generated hash + * based on the new TCP connection's identity and a stable secret, with the + * current time at 4-microsecond granularity. + * + * Specifically, the implementation uses MD5 to compute a hash of the input + * buffer, which contains both the four-tuple of the new TCP connection (local + * and remote IP address and port), as well as a 16-byte secret to make the + * results unpredictable to external parties. The secret must be given at + * initialization time and should ideally remain the same across system + * reboots. To be sure: the spoofing-resistance of the resulting ISN depends + * mainly on the strength of the supplied secret! + * + * The implementation takes 32 bits from the computed hash, and adds to it the + * current time, in 4-microsecond units. The current time is computed from a + * boot time given at initialization, and the current uptime as provided by + * sys_now(). Thus, it assumes that sys_now() returns a time value that is + * relative to the boot time, i.e., that it starts at 0 at system boot, and + * only ever increases monotonically. + * + * For efficiency reasons, a single MD5 input buffer is used, and partially + * filled in at initialization time. Specifically, of this 64-byte buffer, the + * first 36 bytes are used for the four-way TCP tuple data, followed by the + * 16-byte secret, followed by 12-byte zero padding. The 64-byte size of the + * buffer should achieve the best performance for the actual MD5 computation. + * + * Basic usage: + * + * 1. in your lwipopts.h, add the following lines: + * + * #include + * struct ip_addr; + * u32_t lwip_hook_tcp_isn(const struct ip_addr *local_ip, u16_t local_port, + * const struct ip_addr *remote_ip, u16_t remote_port); + * "#define LWIP_HOOK_TCP_ISN lwip_hook_tcp_isn"; + * + * 2. from your own code, call lwip_init_tcp_isn() at initialization time, with + * appropriate parameters. + */ + +/* + * Copyright (c) 2016 The MINIX 3 Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. 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: David van Moolenbroek + */ + +#include "tcp_isn.h" +#include "lwip/ip_addr.h" +#include "lwip/sys.h" +#include + +#ifdef LWIP_HOOK_TCP_ISN + +/* pull in md5 of ppp? */ +#include "netif/ppp/ppp_opts.h" +#if !PPP_SUPPORT || (!LWIP_USE_EXTERNAL_POLARSSL && !LWIP_USE_EXTERNAL_MBEDTLS) +#undef LWIP_INCLUDED_POLARSSL_MD5 +#define LWIP_INCLUDED_POLARSSL_MD5 1 +#include "netif/ppp/polarssl/md5.h" +#endif + +static u8_t input[64]; +static u32_t base_time; + +/** + * Initialize the TCP ISN module, with the boot time and a secret. + * + * @param boot_time Wall clock boot time of the system, in seconds. + * @param secret_16_bytes A 16-byte secret used to randomize the TCP ISNs. + */ +void +lwip_init_tcp_isn(u32_t boot_time, const u8_t *secret_16_bytes) +{ + /* Initialize the input buffer with the secret and trailing zeroes. */ + memset(input, 0, sizeof(input)); + + MEMCPY(&input[36], secret_16_bytes, 16); + + /* Save the boot time in 4-us units. Overflow is no problem here. */ + base_time = boot_time * 250000; +} + +/** + * Hook to generate an Initial Sequence Number (ISN) for a new TCP connection. + * + * @param local_ip The local IP address. + * @param local_port The local port number, in host-byte order. + * @param remote_ip The remote IP address. + * @param remote_port The remote port number, in host-byte order. + * @return The ISN to use for the new TCP connection. + */ +u32_t +lwip_hook_tcp_isn(const ip_addr_t *local_ip, u16_t local_port, + const ip_addr_t *remote_ip, u16_t remote_port) +{ + md5_context ctx; + u8_t output[16]; + u32_t isn; + +#if LWIP_IPV4 && LWIP_IPV6 + if (IP_IS_V6(local_ip)) +#endif /* LWIP_IPV4 && LWIP_IPV6 */ +#if LWIP_IPV6 + { + const ip6_addr_t *local_ip6, *remote_ip6; + + local_ip6 = ip_2_ip6(local_ip); + remote_ip6 = ip_2_ip6(remote_ip); + + SMEMCPY(&input[0], &local_ip6->addr, 16); + SMEMCPY(&input[16], &remote_ip6->addr, 16); + } +#endif /* LWIP_IPV6 */ +#if LWIP_IPV4 && LWIP_IPV6 + else +#endif /* LWIP_IPV4 && LWIP_IPV6 */ +#if LWIP_IPV4 + { + const ip4_addr_t *local_ip4, *remote_ip4; + + local_ip4 = ip_2_ip4(local_ip); + remote_ip4 = ip_2_ip4(remote_ip); + + /* Represent IPv4 addresses as IPv4-mapped IPv6 addresses, to ensure that + * the IPv4 and IPv6 address spaces are completely disjoint. */ + memset(&input[0], 0, 10); + input[10] = 0xff; + input[11] = 0xff; + SMEMCPY(&input[12], &local_ip4->addr, 4); + memset(&input[16], 0, 10); + input[26] = 0xff; + input[27] = 0xff; + SMEMCPY(&input[28], &remote_ip4->addr, 4); + } +#endif /* LWIP_IPV4 */ + + input[32] = (u8_t)(local_port >> 8); + input[33] = (u8_t)(local_port & 0xff); + input[34] = (u8_t)(remote_port >> 8); + input[35] = (u8_t)(remote_port & 0xff); + + /* The secret and padding are already filled in. */ + + /* Generate the hash, using MD5. */ + md5_starts(&ctx); + md5_update(&ctx, input, sizeof(input)); + md5_finish(&ctx, output); + + /* Arbitrarily take the first 32 bits from the generated hash. */ + MEMCPY(&isn, output, sizeof(isn)); + + /* Add the current time in 4-microsecond units. */ + return isn + base_time + sys_now() * 250; +} + +#endif /* LWIP_HOOK_TCP_ISN */ diff --git a/contrib/apps/httpserver_raw/fsdata.h b/lwip/contrib/addons/tcp_isn/tcp_isn.h similarity index 62% rename from contrib/apps/httpserver_raw/fsdata.h rename to lwip/contrib/addons/tcp_isn/tcp_isn.h index 818458a..ebaeca2 100644 --- a/contrib/apps/httpserver_raw/fsdata.h +++ b/lwip/contrib/addons/tcp_isn/tcp_isn.h @@ -1,8 +1,8 @@ /* - * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * Copyright (c) 2016 The MINIX 3 Project. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -11,40 +11,38 @@ * 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. + * 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 + * 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 - * + * Author: David van Moolenbroek */ -#ifndef LWIP_FSDATA_H -#define LWIP_FSDATA_H + +#ifndef LWIP_HDR_CONTRIB_ADDONS_TCP_ISN_H +#define LWIP_HDR_CONTRIB_ADDONS_TCP_ISN_H #include "lwip/opt.h" -#include "fs.h" +#include "lwip/ip_addr.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void lwip_init_tcp_isn(u32_t boot_time, const u8_t *secret_16_bytes); +u32_t lwip_hook_tcp_isn(const ip_addr_t *local_ip, u16_t local_port, + const ip_addr_t *remote_ip, u16_t remote_port); -struct fsdata_file { - const struct fsdata_file *next; - const unsigned char *name; - const unsigned char *data; - int len; - u8_t http_header_included; -#if HTTPD_PRECALCULATED_CHECKSUM - u16_t chksum_count; - const struct fsdata_chksum *chksum; -#endif /* HTTPD_PRECALCULATED_CHECKSUM */ -}; +#ifdef __cplusplus +} +#endif -#endif /* LWIP_FSDATA_H */ +#endif /* LWIP_HDR_CONTRIB_ADDONS_TCP_ISN_H */ diff --git a/lwip/contrib/addons/tcp_md5/README b/lwip/contrib/addons/tcp_md5/README new file mode 100644 index 0000000..a6408ca --- /dev/null +++ b/lwip/contrib/addons/tcp_md5/README @@ -0,0 +1,27 @@ +This folder provides an example implementation of how to add custom tcp header +options and custom socket options. + +It does this by implementing the (seldom used) tcp md5 signature. + +To enable it, add an LWIP_HOOK_FILENAME hook file, include tcp_md5.h in it and +define these hooks: + + #define LWIP_HOOK_TCP_INPACKET_PCB(pcb, hdr, optlen, opt1len, opt2, p) tcp_md5_check_inpacket(pcb, hdr, optlen, opt1len, opt2, p) + #define LWIP_HOOK_TCP_OPT_LENGTH_SEGMENT(pcb, internal_len) tcp_md5_get_additional_option_length(pcb, internal_len) + #define LWIP_HOOK_TCP_ADD_TX_OPTIONS(p, hdr, pcb, opts) tcp_md5_add_tx_options(p, hdr, pcb, opts) + #define LWIP_HOOK_SOCKETS_SETSOCKOPT(s, sock, level, optname, optval, optlen, err) tcp_md5_setsockopt_hook(sock, level, optname, optval, optlen, err) + +Then, in your sockets application, enable md5 signature on a socket like this: + + struct tcp_md5sig md5; + struct sockaddr_storage addr_remote; /* Initialize this to remote address and port */ + memcpy(&md5.tcpm_addr, &addr_remote, sizeof(addr_remote)); + strcpy(md5.tcpm_key, key); /* this is the md5 key per connection */ + md5.tcpm_keylen = strlen(key); + if ((ret = setsockopt(sockfd, IPPROTO_TCP, TCP_MD5SIG, &md5, sizeof(md5))) < 0) { + perror("setsockopt TCP_MD5SIG"); + return; + } + +After that, your connection (client) or all incoming connections (server) require +tcp md5 signatures. diff --git a/lwip/contrib/addons/tcp_md5/tcp_md5.c b/lwip/contrib/addons/tcp_md5/tcp_md5.c new file mode 100644 index 0000000..1e50eb6 --- /dev/null +++ b/lwip/contrib/addons/tcp_md5/tcp_md5.c @@ -0,0 +1,534 @@ +/** + * @file: An implementation of TCP MD5 signatures by using various hooks in + * lwIP to implement custom tcp options and custom socket options. + */ + +/* + * Copyright (c) 2018 Simon Goldschmidt + * 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: Simon Goldschmidt + */ + +#include "tcp_md5.h" +#include "lwip/ip_addr.h" +#include "lwip/sys.h" +#include "lwip/prot/tcp.h" +#include "lwip/priv/tcp_priv.h" +#include "lwip/sockets.h" +#include "lwip/priv/sockets_priv.h" +#include "lwip/api.h" +#include + +/* pull in md5 of ppp? */ +#include "netif/ppp/ppp_opts.h" +#if !PPP_SUPPORT || (!LWIP_USE_EXTERNAL_POLARSSL && !LWIP_USE_EXTERNAL_MBEDTLS) +#undef LWIP_INCLUDED_POLARSSL_MD5 +#define LWIP_INCLUDED_POLARSSL_MD5 1 +#include "netif/ppp/polarssl/md5.h" +#endif + +#if !LWIP_TCP_PCB_NUM_EXT_ARGS +#error tcp_md5 needs LWIP_TCP_PCB_NUM_EXT_ARGS +#endif + +#define LWIP_TCP_OPT_MD5 19 /* number of the md5 option */ +#define LWIP_TCP_OPT_LEN_MD5 18 /* length of the md5 option */ +#define LWIP_TCP_OPT_LEN_MD5_OUT 20 /* 18 + alignment */ + +#define LWIP_TCP_MD5_DIGEST_LEN 16 + +/* This keeps the md5 state internally */ +struct tcp_md5_conn_info { + struct tcp_md5_conn_info *next; + ip_addr_t remote_addr; + u16_t remote_port; + u8_t key[TCP_MD5SIG_MAXKEYLEN]; + u16_t key_len; +}; + +/* Callback function prototypes: */ +static void tcp_md5_extarg_destroy(u8_t id, void *data); +static err_t tcp_md5_extarg_passive_open(u8_t id, struct tcp_pcb_listen *lpcb, struct tcp_pcb *cpcb); +/* Define our tcp ext arg callback structure: */ +const struct tcp_ext_arg_callbacks tcp_md5_ext_arg_callbacks = { + tcp_md5_extarg_destroy, + tcp_md5_extarg_passive_open +}; + +static u8_t tcp_md5_extarg_id = LWIP_TCP_PCB_NUM_EXT_ARG_ID_INVALID; +static u8_t tcp_md5_opts_buf[40]; + +/** Initialize this module (allocates a tcp ext arg id) */ +void +tcp_md5_init(void) +{ + tcp_md5_extarg_id = tcp_ext_arg_alloc_id(); +} + +/* Create a conn-info structure that holds the md5 state per connection */ +static struct tcp_md5_conn_info * +tcp_md5_conn_info_alloc(void) +{ + return (struct tcp_md5_conn_info *)mem_malloc(sizeof(struct tcp_md5_conn_info)); +} + +/* Frees a conn-info structure that holds the md5 state per connection */ +static void +tcp_md5_conn_info_free(struct tcp_md5_conn_info *info) +{ + mem_free(info); +} + +/* A pcb is about to be destroyed. Free its extdata */ +static void +tcp_md5_extarg_destroy(u8_t id, void *data) +{ + struct tcp_md5_conn_info *iter; + + LWIP_ASSERT("tcp_md5_extarg_id != LWIP_TCP_PCB_NUM_EXT_ARG_ID_INVALID", + tcp_md5_extarg_id != LWIP_TCP_PCB_NUM_EXT_ARG_ID_INVALID); + LWIP_ASSERT("id == tcp_md5_extarg_id", id == tcp_md5_extarg_id); + LWIP_UNUSED_ARG(id); + + iter = (struct tcp_md5_conn_info *)data; + while (iter != NULL) { + struct tcp_md5_conn_info *info = iter; + iter = iter->next; + tcp_md5_conn_info_free(info); + } +} + +/* Try to find an md5 connection info for the specified remote connection */ +static struct tcp_md5_conn_info * +tcp_md5_get_info(const struct tcp_pcb *pcb, const ip_addr_t *remote_ip, u16_t remote_port) +{ + if (pcb != NULL) { + struct tcp_md5_conn_info *info = (struct tcp_md5_conn_info *)tcp_ext_arg_get(pcb, tcp_md5_extarg_id); + while (info != NULL) { + if (ip_addr_cmp(&info->remote_addr, remote_ip)) { + if (info->remote_port == remote_port) { + return info; + } + } + info = info->next; + } + } + return NULL; +} + +/* Passive open: copy md5 connection info from listen pcb to connection pcb + * or return error (connection will be closed) + */ +static err_t +tcp_md5_extarg_passive_open(u8_t id, struct tcp_pcb_listen *lpcb, struct tcp_pcb *cpcb) +{ + struct tcp_md5_conn_info *iter; + + LWIP_ASSERT("lpcb != NULL", lpcb != NULL); + LWIP_ASSERT("cpcb != NULL", cpcb != NULL); + LWIP_ASSERT("tcp_md5_extarg_id != LWIP_TCP_PCB_NUM_EXT_ARG_ID_INVALID", + tcp_md5_extarg_id != LWIP_TCP_PCB_NUM_EXT_ARG_ID_INVALID); + LWIP_ASSERT("id == tcp_md5_extarg_id", id == tcp_md5_extarg_id); + LWIP_UNUSED_ARG(id); + + iter = (struct tcp_md5_conn_info *)tcp_ext_arg_get((struct tcp_pcb *)lpcb, id); + while (iter != NULL) { + if (iter->remote_port == cpcb->remote_port) { + if (ip_addr_cmp(&iter->remote_addr, &cpcb->remote_ip)) { + struct tcp_md5_conn_info *info = tcp_md5_conn_info_alloc(); + if (info != NULL) { + memcpy(info, iter, sizeof(struct tcp_md5_conn_info)); + tcp_ext_arg_set(cpcb, id, info); + tcp_ext_arg_set_callbacks(cpcb, id, &tcp_md5_ext_arg_callbacks); + return ERR_OK; + } else { + return ERR_MEM; + } + } + } + iter = iter->next; + } + /* remote connection not found */ + return ERR_VAL; +} + +/* Parse tcp header options and return 1 if an md5 signature option was found */ +static int +tcp_md5_parseopt(const u8_t *opts, u16_t optlen, u8_t *md5_digest_out) +{ + u8_t data; + u16_t optidx; + + /* Parse the TCP MSS option, if present. */ + if (optlen != 0) { + for (optidx = 0; optidx < optlen; ) { + u8_t opt = opts[optidx++]; + switch (opt) { + case LWIP_TCP_OPT_EOL: + /* End of options. */ + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_parseopt: EOL\n")); + return 0; + case LWIP_TCP_OPT_NOP: + /* NOP option. */ + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_parseopt: NOP\n")); + break; + case LWIP_TCP_OPT_MD5: + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_parseopt: MD5\n")); + if (opts[optidx++] != LWIP_TCP_OPT_LEN_MD5 || (optidx - 2 + LWIP_TCP_OPT_LEN_MD5) > optlen) { + /* Bad length */ + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_parseopt: bad length\n")); + return 0; + } + /* An MD5 option with the right option length. */ + memcpy(md5_digest_out, &opts[optidx], LWIP_TCP_MD5_DIGEST_LEN); + /* no need to process the options further */ + return 1; + break; + default: + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_parseopt: other\n")); + data = opts[optidx++]; + if (data < 2) { + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_parseopt: bad length\n")); + /* If the length field is zero, the options are malformed + and we don't process them further. */ + return 0; + } + /* All other options have a length field, so that we easily + can skip past them. */ + optidx += data - 2; + } + } + } + return 0; +} + +/* Get tcp options into contiguous memory. May be required if input pbufs + * are chained. + */ +static const u8_t* +tcp_md5_options_singlebuf(struct tcp_hdr *hdr, u16_t optlen, u16_t opt1len, u8_t *opt2) +{ + const u8_t *opts; + LWIP_ASSERT("hdr != NULL", hdr != NULL); + LWIP_ASSERT("optlen >= opt1len", optlen >= opt1len); + opts = (const u8_t *)hdr + TCP_HLEN; + if (optlen == opt1len) { + /* arleady in one piece */ + return opts; + } + if (optlen > sizeof(tcp_md5_opts_buf)) { + /* options too long */ + return NULL; + } + LWIP_ASSERT("opt2 != NULL", opt2 != NULL); + /* copy first part */ + memcpy(tcp_md5_opts_buf, opts, opt1len); + /* copy second part */ + memcpy(&tcp_md5_opts_buf[opt1len], opt2, optlen - opt1len); + return tcp_md5_opts_buf; +} + +/* Create the md5 digest for a given segment */ +static int +tcp_md5_create_digest(const ip_addr_t *ip_src, const ip_addr_t *ip_dst, const struct tcp_hdr *hdr, + const u8_t *key, size_t key_len, u8_t *digest_out, struct pbuf *p) +{ + md5_context ctx; + u8_t tmp8; + u16_t tmp16; + const size_t addr_len = IP_ADDR_RAW_SIZE(*ip_src); + + if (p != NULL) { + LWIP_ASSERT("pbuf must not point to tcp header here!", (const void *)hdr != p->payload); + } + + /* Generate the hash, using MD5. */ + md5_starts(&ctx); + /* 1. the TCP pseudo-header (in the order: source IP address, + destination IP address, zero-padded protocol number, and + segment length) */ + md5_update(&ctx, (const unsigned char*)ip_src, addr_len); + md5_update(&ctx, (const unsigned char*)ip_dst, addr_len); + tmp8 = 0; /* zero-padded */ + md5_update(&ctx, &tmp8, 1); + tmp8 = IP_PROTO_TCP; + md5_update(&ctx, &tmp8, 1); + tmp16 = lwip_htons(TCPH_HDRLEN_BYTES(hdr) + (p ? p->tot_len : 0)); + md5_update(&ctx, (const unsigned char*)&tmp16, 2); + /* 2. the TCP header, excluding options, and assuming a checksum of + zero */ + md5_update(&ctx, (const unsigned char*)hdr, sizeof(struct tcp_hdr)); + /* 3. the TCP segment data (if any) */ + if ((p != NULL) && (p->tot_len != 0)) { + struct pbuf *q; + for (q = p; q != NULL; q = q->next) { + md5_update(&ctx, (const unsigned char*)q->payload, q->len); + } + } + /* 4. an independently-specified key or password, known to both TCPs + and presumably connection-specific */ + md5_update(&ctx, key, key_len); + + md5_finish(&ctx, digest_out); + return 1; +} + +/* Duplicate a tcp header and make sure the fields are in network byte order */ +static void +tcp_md5_dup_tcphdr(struct tcp_hdr *tcphdr_copy, const struct tcp_hdr *tcphdr_in, int tcphdr_in_is_host_order) +{ + memcpy(tcphdr_copy, tcphdr_in, sizeof(struct tcp_hdr)); + tcphdr_copy->chksum = 0; /* checksum is zero for the pseudo header */ + if (tcphdr_in_is_host_order) { + /* lwIP writes the TCP header values back to the buffer, we need to invert that here: */ + tcphdr_copy->src = lwip_htons(tcphdr_copy->src); + tcphdr_copy->dest = lwip_htons(tcphdr_copy->dest); + tcphdr_copy->seqno = lwip_htonl(tcphdr_copy->seqno); + tcphdr_copy->ackno = lwip_htonl(tcphdr_copy->ackno); + tcphdr_copy->wnd = lwip_htons(tcphdr_copy->wnd); + tcphdr_copy->urgp = lwip_htons(tcphdr_copy->urgp); + } +} + +/* Check if md5 is enabled on a given pcb */ +static int +tcp_md5_is_enabled_on_pcb(const struct tcp_pcb *pcb) +{ + if (tcp_md5_extarg_id != LWIP_TCP_PCB_NUM_EXT_ARG_ID_INVALID) { + struct tcp_md5_conn_info *info = (struct tcp_md5_conn_info *)tcp_ext_arg_get(pcb, tcp_md5_extarg_id); + if (info != NULL) { + return 1; + } + } + return 0; +} + +/* Check if md5 is enabled on a given listen pcb */ +static int +tcp_md5_is_enabled_on_lpcb(const struct tcp_pcb_listen *lpcb) +{ + /* same as for connection pcbs */ + return tcp_md5_is_enabled_on_pcb((const struct tcp_pcb *)lpcb); +} + +/* Hook implementation for LWIP_HOOK_TCP_OPT_LENGTH_SEGMENT */ +u8_t +tcp_md5_get_additional_option_length(const struct tcp_pcb *pcb, u8_t internal_option_length) +{ + if ((pcb != NULL) && tcp_md5_is_enabled_on_pcb(pcb)) { + u8_t new_option_length = internal_option_length + LWIP_TCP_OPT_LEN_MD5_OUT; + LWIP_ASSERT("overflow", new_option_length > internal_option_length); + LWIP_ASSERT("options too long", new_option_length <= TCP_MAX_OPTION_BYTES); + return new_option_length; + } + return internal_option_length; +} + +/* Hook implementation for LWIP_HOOK_TCP_INPACKET_PCB when called for listen pcbs */ +static err_t +tcp_md5_check_listen(struct tcp_pcb_listen* lpcb, struct tcp_hdr *hdr, u16_t optlen, u16_t opt1len, u8_t *opt2) +{ + LWIP_ASSERT("lpcb != NULL", lpcb != NULL); + + if (tcp_md5_is_enabled_on_lpcb(lpcb)) { + const u8_t *opts; + u8_t digest_received[LWIP_TCP_MD5_DIGEST_LEN]; + u8_t digest_calculated[LWIP_TCP_MD5_DIGEST_LEN]; + const struct tcp_md5_conn_info *info = tcp_md5_get_info((struct tcp_pcb *)lpcb, ip_current_src_addr(), hdr->src); + if (info != NULL) { + opts = tcp_md5_options_singlebuf(hdr, optlen, opt1len, opt2); + if (opts != NULL) { + if (tcp_md5_parseopt(opts, optlen, digest_received)) { + struct tcp_hdr tcphdr_copy; + tcp_md5_dup_tcphdr(&tcphdr_copy, hdr, 1); + if (tcp_md5_create_digest(ip_current_src_addr(), ip_current_dest_addr(), &tcphdr_copy, info->key, info->key_len, digest_calculated, NULL)) { + /* everything set up, compare the digests */ + if (!memcmp(digest_received, digest_calculated, LWIP_TCP_MD5_DIGEST_LEN)) { + /* equal */ + return ERR_OK; + } + /* not equal */ + } + } + } + } + /* md5 enabled on this pcb but no match or other error -> fail */ + return ERR_VAL; + } + return ERR_OK; +} + +/* Hook implementation for LWIP_HOOK_TCP_INPACKET_PCB */ +err_t +tcp_md5_check_inpacket(struct tcp_pcb* pcb, struct tcp_hdr *hdr, u16_t optlen, u16_t opt1len, u8_t *opt2, struct pbuf *p) +{ + LWIP_ASSERT("pcb != NULL", pcb != NULL); + + if (pcb->state == LISTEN) { + return tcp_md5_check_listen((struct tcp_pcb_listen *)pcb, hdr, optlen, opt1len, opt2); + } + + if (tcp_md5_is_enabled_on_pcb(pcb)) { + const struct tcp_md5_conn_info *info = tcp_md5_get_info(pcb, ip_current_src_addr(), hdr->src); + if (info != NULL) { + const u8_t *opts; + u8_t digest_received[LWIP_TCP_MD5_DIGEST_LEN]; + u8_t digest_calculated[LWIP_TCP_MD5_DIGEST_LEN]; + opts = tcp_md5_options_singlebuf(hdr, optlen, opt1len, opt2); + if (opts != NULL) { + if (tcp_md5_parseopt(opts, optlen, digest_received)) { + struct tcp_hdr hdr_copy; + tcp_md5_dup_tcphdr(&hdr_copy, hdr, 1); + if (tcp_md5_create_digest(&pcb->remote_ip, &pcb->local_ip, &hdr_copy, info->key, info->key_len, digest_calculated, p)) { + /* everything set up, compare the digests */ + if (!memcmp(digest_received, digest_calculated, LWIP_TCP_MD5_DIGEST_LEN)) { + /* equal */ + return ERR_OK; + } + /* not equal */ + } + } + } + } + /* md5 enabled on this pcb but no match or other error -> fail */ + return ERR_VAL; + } + return ERR_OK; +} + +/* Hook implementation for LWIP_HOOK_TCP_ADD_TX_OPTIONS */ +u32_t * +tcp_md5_add_tx_options(struct pbuf *p, struct tcp_hdr *hdr, const struct tcp_pcb *pcb, u32_t *opts) +{ + LWIP_ASSERT("p != NULL", p != NULL); + LWIP_ASSERT("hdr != NULL", hdr != NULL); + LWIP_ASSERT("pcb != NULL", pcb != NULL); + LWIP_ASSERT("opts != NULL", opts != NULL); + + if (tcp_md5_is_enabled_on_pcb(pcb)) { + u8_t digest_calculated[LWIP_TCP_MD5_DIGEST_LEN]; + u32_t *opts_ret = opts + 5; /* we use 20 bytes: 2 bytes padding + 18 bytes for this option */ + u8_t *ptr = (u8_t*)opts; + + const struct tcp_md5_conn_info *info = tcp_md5_get_info(pcb, &pcb->remote_ip, pcb->remote_port); + if (info != NULL) { + struct tcp_hdr hdr_copy; + size_t hdrsize = TCPH_HDRLEN_BYTES(hdr); + tcp_md5_dup_tcphdr(&hdr_copy, hdr, 0); + /* p->payload points to the tcp header */ + LWIP_ASSERT("p->payload == hdr", p->payload == hdr); + if (!pbuf_remove_header(p, hdrsize)) { + u8_t ret; + if (!tcp_md5_create_digest(&pcb->local_ip, &pcb->remote_ip, &hdr_copy, info->key, info->key_len, digest_calculated, p)) { + info = NULL; + } + ret = pbuf_add_header_force(p, hdrsize); + LWIP_ASSERT("tcp_md5_add_tx_options: pbuf_add_header_force failed", !ret); + LWIP_UNUSED_ARG(ret); + } else { + LWIP_ASSERT("error", 0); + } + } + if (info == NULL) { + /* create an invalid signature by zeroing the digest */ + memset(&digest_calculated, 0, sizeof(digest_calculated)); + } + + *ptr++ = LWIP_TCP_OPT_NOP; + *ptr++ = LWIP_TCP_OPT_NOP; + *ptr++ = LWIP_TCP_OPT_MD5; + *ptr++ = LWIP_TCP_OPT_LEN_MD5; + memcpy(ptr, digest_calculated, LWIP_TCP_MD5_DIGEST_LEN); + ptr += LWIP_TCP_MD5_DIGEST_LEN; + LWIP_ASSERT("ptr == opts_ret", ptr == (u8_t *)opts_ret); + return opts_ret; + } + return opts; +} + +/* Hook implementation for LWIP_HOOK_SOCKETS_SETSOCKOPT */ +int +tcp_md5_setsockopt_hook(struct lwip_sock *sock, int level, int optname, const void *optval, socklen_t optlen, int *err) +{ + LWIP_ASSERT("sock != NULL", sock != NULL); + LWIP_ASSERT("err != NULL", err != NULL); + + if ((level == IPPROTO_TCP) && (optname == TCP_MD5SIG)) { + const struct tcp_md5sig *md5 = (const struct tcp_md5sig*)optval; + if ((optval == NULL) || (optlen < sizeof(struct tcp_md5sig))) { + *err = EINVAL; + } else { + if (sock->conn && (NETCONNTYPE_GROUP(netconn_type(sock->conn)) == NETCONN_TCP) && (sock->conn->pcb.tcp != NULL)) { + if (tcp_md5_extarg_id == LWIP_TCP_PCB_NUM_EXT_ARG_ID_INVALID) { + /* not initialized */ + *err = EINVAL; + } else { + struct tcp_md5_conn_info *info = tcp_md5_conn_info_alloc(); + if (info == NULL) { + *err = ENOMEM; + } else { + int addr_valid = 0; + /* OK, fill and link this request */ + memcpy(info->key, md5->tcpm_key, TCP_MD5SIG_MAXKEYLEN); + info->key_len = md5->tcpm_keylen; + memset(&info->remote_addr, 0, sizeof(info->remote_addr)); + if (md5->tcpm_addr.ss_family == AF_INET) { +#if LWIP_IPV4 + const struct sockaddr_in *sin = (const struct sockaddr_in *)&md5->tcpm_addr; + memcpy(&info->remote_addr, &sin->sin_addr, sizeof(sin->sin_addr)); + IP_SET_TYPE_VAL(info->remote_addr, IPADDR_TYPE_V4); + info->remote_port = lwip_htons(sin->sin_port); + addr_valid = 1; +#endif /* LWIP_IPV4 */ + } else if (md5->tcpm_addr.ss_family == AF_INET6) { +#if LWIP_IPV6 + const struct sockaddr_in6 *sin6 = (const struct sockaddr_in6 *)&md5->tcpm_addr; + memcpy(&info->remote_addr, &sin6->sin6_addr, sizeof(sin6->sin6_addr)); + IP_SET_TYPE_VAL(info->remote_addr, IPADDR_TYPE_V6); + info->remote_port = lwip_htons(sin6->sin6_port); + addr_valid = 1; +#endif /* LWIP_IPV6 */ + } + if (addr_valid) { + /* store it */ + tcp_ext_arg_set_callbacks(sock->conn->pcb.tcp, tcp_md5_extarg_id, &tcp_md5_ext_arg_callbacks); + info->next = (struct tcp_md5_conn_info *)tcp_ext_arg_get(sock->conn->pcb.tcp, tcp_md5_extarg_id); + tcp_ext_arg_set(sock->conn->pcb.tcp, tcp_md5_extarg_id, info); + } else { + *err = EINVAL; + tcp_md5_conn_info_free(info); + } + } + } + } else { + /* not a tcp netconn */ + *err = EINVAL; + } + } + return 1; + } + return 0; +} diff --git a/lwip/contrib/addons/tcp_md5/tcp_md5.h b/lwip/contrib/addons/tcp_md5/tcp_md5.h new file mode 100644 index 0000000..e55740a --- /dev/null +++ b/lwip/contrib/addons/tcp_md5/tcp_md5.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2018 Simon Goldschmidt + * 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: Simon Goldschmidt + * + * To use the hooks in this file, make sure this file is included in LWIP_HOOK_FILENAME + * and define these hooks: + * + * #define LWIP_HOOK_TCP_INPACKET_PCB(pcb, hdr, optlen, opt1len, opt2, p) tcp_md5_check_inpacket(pcb, hdr, optlen, opt1len, opt2, p) + * #define LWIP_HOOK_TCP_OPT_LENGTH_SEGMENT(pcb, internal_len) tcp_md5_get_additional_option_length(pcb, internal_len) + * #define LWIP_HOOK_TCP_ADD_TX_OPTIONS(p, hdr, pcb, opts) tcp_md5_add_tx_options(p, hdr, pcb, opts) + * + * #define LWIP_HOOK_SOCKETS_SETSOCKOPT(s, sock, level, optname, optval, optlen, err) tcp_md5_setsockopt_hook(sock, level, optname, optval, optlen, err) + */ + +#ifndef LWIP_HDR_CONTRIB_ADDONS_TCP_MD5_H +#define LWIP_HDR_CONTRIB_ADDONS_TCP_MD5_H + +#include "lwip/opt.h" +#include "lwip/ip_addr.h" +#include "lwip/err.h" + +#include "lwip/priv/sockets_priv.h" +#include "lwip/priv/tcp_priv.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* setsockopt definitions and structs: */ + +/* This is the optname (for level = IPPROTO_TCP) */ +#ifndef TCP_MD5SIG +#define TCP_MD5SIG 14 +#endif + +#define TCP_MD5SIG_MAXKEYLEN 80 + +/* This is the optval type */ +struct tcp_md5sig { + struct sockaddr_storage tcpm_addr; + u16_t __tcpm_pad1; + u16_t tcpm_keylen; + u32_t __tcpm_pad2; + u8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN]; +}; + +/* socket setsockopt hook: */ +int tcp_md5_setsockopt_hook(struct lwip_sock *sock, int level, int optname, const void *optval, u32_t optlen, int *err); + +/* Internal hook functions */ +void tcp_md5_init(void); +err_t tcp_md5_check_inpacket(struct tcp_pcb* pcb, struct tcp_hdr *hdr, u16_t optlen, u16_t opt1len, u8_t *opt2, struct pbuf *p); +u8_t tcp_md5_get_additional_option_length(const struct tcp_pcb *pcb, u8_t internal_option_length); +u32_t *tcp_md5_add_tx_options(struct pbuf *p, struct tcp_hdr *hdr, const struct tcp_pcb *pcb, u32_t *opts); + +#ifdef __cplusplus +} +#endif + +#endif /* LWIP_HDR_CONTRIB_ADDONS_TCP_MD5_H */ diff --git a/lwip/contrib/ports/unix/Common.mk b/lwip/contrib/ports/unix/Common.mk new file mode 100644 index 0000000..f80a980 --- /dev/null +++ b/lwip/contrib/ports/unix/Common.mk @@ -0,0 +1,51 @@ +# +# 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 +# + +# Architecture specific files. +LWIPARCH?=$(CONTRIBDIR)/ports/unix/port +SYSARCH?=$(LWIPARCH)/sys_arch.c +ARCHFILES=$(LWIPARCH)/perf.c \ + $(SYSARCH) \ + $(LWIPARCH)/netif/tapif.c \ + $(LWIPARCH)/netif/list.c \ + $(LWIPARCH)/netif/sio.c \ + $(LWIPARCH)/netif/fifo.c + +UNIX_COMMON_MK_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +include $(UNIX_COMMON_MK_DIR)../Common.allports.mk + +LDFLAGS+=-lutil + +UNAME_S:= $(shell uname -s) +ifneq ($(UNAME_S),Darwin) +# Darwin doesn't have pthreads or POSIX real-time extensions libs +LDFLAGS+=-pthread -lrt +endif diff --git a/lwip/contrib/ports/unix/README b/lwip/contrib/ports/unix/README new file mode 100644 index 0000000..45d256d --- /dev/null +++ b/lwip/contrib/ports/unix/README @@ -0,0 +1,25 @@ +This port contains infrastructure and examples for running lwIP on Unix-like +operating systems (Linux, OpenBSD, cygwin). Much of this is targetted towards +testing lwIP applications. + +* port/sys_arch.c, port/perf.c, port/include/arch/: Generic platform porting, + for both states of NO_SYS. (Mapping debugging to printf, providing + sys_now & co from the system time etc.) + +* check: Runs the unit tests shipped with main lwIP on the Unix port. + +* port/netif, port/include/netif: Various network interface implementations and + their helpers, some explicitly for Unix infrastructure, some generic (but most + useful on an easy to debug system): + + * fifo: Helper for sio + + * list: Helper for unixif + + * pcapif: Network interface that replays packages from a PCAP dump file, and + discards packages sent out from it + + * sio: Mapping Unix character devices to lwIP's sio mechanisms + + * tapif: Network interface that is mapped to a tap interface (Unix user + space layer 2 network device). Uses lwIP threads. diff --git a/lwip/contrib/ports/unix/check/CMakeLists.txt b/lwip/contrib/ports/unix/check/CMakeLists.txt new file mode 100644 index 0000000..6883316 --- /dev/null +++ b/lwip/contrib/ports/unix/check/CMakeLists.txt @@ -0,0 +1,59 @@ +cmake_minimum_required(VERSION 3.8) + +set (CMAKE_CONFIGURATION_TYPES "Debug;Release") + +project(lwipunittests C) + +if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") + message(FATAL_ERROR "Unit test are currently only working on Linux or Darwin") +endif() + +set(LWIP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../..) +set(LWIP_USE_SANITIZERS true) +include(${LWIP_DIR}/contrib/ports/CMakeCommon.cmake) + +if(CMAKE_C_COMPILER_ID STREQUAL "Clang") + # check.h causes 'error: token pasting of ',' and __VA_ARGS__ is a GNU extension' with clang 9.0.0 + list(LWIP_COMPILER_FLAGS APPEND -Wno-gnu-zero-variadic-macro-arguments) +endif() + +set (LWIP_DEFINITIONS -DLWIP_DEBUG -DLWIP_NOASSERT_ON_ERROR) +set (LWIP_INCLUDE_DIRS + "${LWIP_DIR}/test/unit" + "${LWIP_DIR}/src/include" + "${LWIP_CONTRIB_DIR}/" + "${LWIP_CONTRIB_DIR}/ports/unix/port/include" + "${CMAKE_CURRENT_SOURCE_DIR}/" +) + +include(${LWIP_CONTRIB_DIR}/ports/unix/Filelists.cmake) +include(${LWIP_DIR}/src/Filelists.cmake) +include(${LWIP_DIR}/test/unit/Filelists.cmake) + +add_executable(lwip_unittests ${LWIP_TESTFILES}) +target_include_directories(lwip_unittests PRIVATE ${LWIP_INCLUDE_DIRS}) +target_compile_options(lwip_unittests PRIVATE ${LWIP_COMPILER_FLAGS}) +target_compile_definitions(lwip_unittests PRIVATE ${LWIP_DEFINITIONS} ${LWIP_MBEDTLS_DEFINITIONS}) + +find_library(LIBCHECK check) +find_library(LIBM m) +target_link_libraries(lwip_unittests ${LWIP_SANITIZER_LIBS} lwipallapps lwipcore ${LIBCHECK} ${LIBM}) + +if (NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") + # check installed via brew on Darwin doesn't have a separate subunit library (must be statically linked) + find_library(LIBSUBUNIT subunit) + target_link_libraries(lwip_unittests ${LIBSUBUNIT}) +endif() + +if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + find_library(LIBUTIL util) + find_library(LIBPTHREAD pthread) + find_library(LIBRT rt) + target_link_libraries(lwip_unittests ${LIBUTIL} ${LIBPTHREAD} ${LIBRT}) +endif() + +if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") + # Darwin doesn't have pthreads or POSIX real-time extensions libs + find_library(LIBUTIL util) + target_link_libraries(lwip_unittests ${LIBUTIL}) +endif() diff --git a/contrib/ports/unix/check/README b/lwip/contrib/ports/unix/check/README similarity index 69% rename from contrib/ports/unix/check/README rename to lwip/contrib/ports/unix/check/README index 421ae3b..3d67866 100644 --- a/contrib/ports/unix/check/README +++ b/lwip/contrib/ports/unix/check/README @@ -2,7 +2,7 @@ Helper files to run lwIP unit tests on unix-like systems. 1. Install the check library, through a package manager or from http://check.sourceforge.net/ -2. Put the lwip code in a directory called 'lwip' in the same directory as lwip-contrib is +2. Put the lwip code in a directory called 'lwip' 3. Run `make check` 4. Make sure all tests pass diff --git a/lwip/contrib/ports/unix/lib/CMakeLists.txt b/lwip/contrib/ports/unix/lib/CMakeLists.txt new file mode 100644 index 0000000..93d17bd --- /dev/null +++ b/lwip/contrib/ports/unix/lib/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 3.8) + +project(lwip C) + +set (BUILD_SHARED_LIBS ON) + +if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT CMAKE_SYSTEM_NAME STREQUAL "GNU") + message(FATAL_ERROR "Lwip shared library is only working on Linux or the Hurd") +endif() + +set(LWIP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../..) +include(${LWIP_DIR}/contrib/ports/CMakeCommon.cmake) + +set (LWIP_DEFINITIONS -DLWIP_DEBUG) +set (LWIP_INCLUDE_DIRS + "${LWIP_DIR}/src/include" + "${LWIP_CONTRIB_DIR}/" + "${LWIP_CONTRIB_DIR}/ports/unix/port/include" + "${CMAKE_CURRENT_SOURCE_DIR}/" +) + +include(${LWIP_CONTRIB_DIR}/ports/unix/Filelists.cmake) +include(${LWIP_DIR}/src/Filelists.cmake) + +add_library(lwip ${lwipnoapps_SRCS} ${lwipcontribportunix_SRCS} ${lwipcontribportunixnetifs_SRCS}) +target_compile_options(lwip PRIVATE ${LWIP_COMPILER_FLAGS}) +target_compile_definitions(lwip PRIVATE ${LWIP_DEFINITIONS} ${LWIP_MBEDTLS_DEFINITIONS}) +target_include_directories(lwip PRIVATE ${LWIP_INCLUDE_DIRS} ${LWIP_MBEDTLS_INCLUDE_DIRS}) +target_link_libraries(lwip ${LWIP_SANITIZER_LIBS}) + +find_library(LIBPTHREAD pthread) +target_link_libraries(lwip ${LIBPTHREAD}) diff --git a/contrib/ports/unix/proj/lib/README b/lwip/contrib/ports/unix/lib/README similarity index 61% rename from contrib/ports/unix/proj/lib/README rename to lwip/contrib/ports/unix/lib/README index cd6cc7b..3e6d0b1 100644 --- a/contrib/ports/unix/proj/lib/README +++ b/lwip/contrib/ports/unix/lib/README @@ -1,31 +1,28 @@ -This directory contains an example of how to compile lwIP as a self -initialising shared library on Linux. +This directory contains an example of how to compile lwIP as a shared library +on Linux. Some brief instructions: - + * Compile the code: + > mkdir build + > cd build + > cmake .. > make clean all - This should produce liblwip4unixlib.so. This is the shared library. + This should produce liblwip.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. + If you're using gcc you can do this by including -llwip in your link command. * Run your application - - Ensure that LD_LIBRARY_PATH includes the directory that contains -liblwip4unixlib.so (ie. this directory) + Ensure that LD_LIBRARY_PATH includes the directory that contains liblwip.so + (ie. this directory) If you are unsure about shared libraries and libraries on linux in general, you might find this HOWTO useful: - - - -Kieran Mansley, October 2002. \ No newline at end of file diff --git a/contrib/ports/unix/proj/lib/lwipopts.h b/lwip/contrib/ports/unix/lib/lwipopts.h similarity index 90% rename from contrib/ports/unix/proj/lib/lwipopts.h rename to lwip/contrib/ports/unix/lib/lwipopts.h index f39fbdb..660f7f7 100644 --- a/contrib/ports/unix/proj/lib/lwipopts.h +++ b/lwip/contrib/ports/unix/lib/lwipopts.h @@ -6,9 +6,9 @@ /* * Copyright (c) 2001-2004 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * 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, @@ -17,21 +17,21 @@ * 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. + * 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 + * 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 * */ @@ -58,7 +58,7 @@ */ #define SYS_LIGHTWEIGHT_PROT 0 -/** +/** * NO_SYS==1: Provides VERY minimal functionality. Otherwise, * use lwIP facilities. */ @@ -75,7 +75,7 @@ * 4 byte alignment -> #define MEM_ALIGNMENT 4 * 2 byte alignment -> #define MEM_ALIGNMENT 2 */ -#define MEM_ALIGNMENT 1 +#define MEM_ALIGNMENT 1U /** * MEM_SIZE: the size of the heap memory. If the application will send @@ -144,7 +144,7 @@ * MEMP_NUM_SYS_TIMEOUT: the number of simulateously active timeouts. * (requires NO_SYS==0) */ -#define MEMP_NUM_SYS_TIMEOUT 3 +#define MEMP_NUM_SYS_TIMEOUT 8 /** * MEMP_NUM_NETBUF: the number of struct netbufs. @@ -156,24 +156,24 @@ * MEMP_NUM_NETCONN: the number of struct netconns. * (only needed if you use the sequential API, like api_lib.c) */ -#define MEMP_NUM_NETCONN 4 +#define MEMP_NUM_NETCONN 32 /** * MEMP_NUM_TCPIP_MSG_API: the number of struct tcpip_msg, which are used - * for callback/timeout API communication. + * for callback/timeout API communication. * (only needed if you use tcpip.c) */ #define MEMP_NUM_TCPIP_MSG_API 8 /** * MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used - * for incoming packets. + * for incoming packets. * (only needed if you use tcpip.c) */ #define MEMP_NUM_TCPIP_MSG_INPKT 8 /** - * PBUF_POOL_SIZE: the number of buffers in the pbuf pool. + * PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */ #define PBUF_POOL_SIZE 8 @@ -306,7 +306,7 @@ ---------------------------------- */ /** - * LWIP_IGMP==1: Turn on IGMP module. + * LWIP_IGMP==1: Turn on IGMP module. */ #define LWIP_IGMP 0 @@ -394,6 +394,11 @@ */ #define LWIP_SOCKET 1 +/** + * SO_REUSE==1: Enable SO_REUSEADDR + */ +#define SO_REUSE 1 + /* ---------------------------------------- ---------- Statistics options ---------- @@ -414,6 +419,27 @@ #define PPP_SUPPORT 0 -/* Misc */ + +/* + --------------------------------------- + ---------- Threading options ---------- + --------------------------------------- +*/ + +#define LWIP_TCPIP_CORE_LOCKING 1 + +#if !NO_SYS +void sys_check_core_locking(void); +#define LWIP_ASSERT_CORE_LOCKED() sys_check_core_locking() +void sys_mark_tcpip_thread(void); +#define LWIP_MARK_TCPIP_THREAD() sys_mark_tcpip_thread() + +#if LWIP_TCPIP_CORE_LOCKING +void sys_lock_tcpip_core(void); +#define LOCK_TCPIP_CORE() sys_lock_tcpip_core() +void sys_unlock_tcpip_core(void); +#define UNLOCK_TCPIP_CORE() sys_unlock_tcpip_core() +#endif +#endif #endif /* LWIP_LWIPOPTS_H */ diff --git a/contrib/ports/unix/include/netif/fifo.h b/lwip/contrib/ports/unix/port/include/netif/fifo.h similarity index 94% rename from contrib/ports/unix/include/netif/fifo.h rename to lwip/contrib/ports/unix/port/include/netif/fifo.h index a067dd8..6c2ad20 100644 --- a/contrib/ports/unix/include/netif/fifo.h +++ b/lwip/contrib/ports/unix/port/include/netif/fifo.h @@ -23,7 +23,7 @@ typedef struct fifo_t { /** * Get a character from fifo * Blocking call. -* @param pointer to fifo data structure +* @param fifo pointer to fifo data structure * @return character read from fifo */ u8_t fifoGet(fifo_t * fifo); @@ -31,7 +31,7 @@ u8_t fifoGet(fifo_t * fifo); /** * Get a character from fifo * Non blocking call. -* @param pointer to fifo data structure +* @param fifo pointer to fifo data structure * @return character read from fifo, or < zero if non was available */ s16_t fifoGetNonBlock(fifo_t * fifo); diff --git a/contrib/ports/unix/include/netif/list.h b/lwip/contrib/ports/unix/port/include/netif/list.h similarity index 100% rename from contrib/ports/unix/include/netif/list.h rename to lwip/contrib/ports/unix/port/include/netif/list.h diff --git a/contrib/ports/unix/include/netif/pcapif.h b/lwip/contrib/ports/unix/port/include/netif/pcapif.h similarity index 100% rename from contrib/ports/unix/include/netif/pcapif.h rename to lwip/contrib/ports/unix/port/include/netif/pcapif.h diff --git a/contrib/ports/unix/include/netif/sio.h b/lwip/contrib/ports/unix/port/include/netif/sio.h similarity index 65% rename from contrib/ports/unix/include/netif/sio.h rename to lwip/contrib/ports/unix/port/include/netif/sio.h index e47a27e..4822b53 100644 --- a/contrib/ports/unix/include/netif/sio.h +++ b/lwip/contrib/ports/unix/port/include/netif/sio.h @@ -1,18 +1,17 @@ -#ifndef SIO_H -#define SIO_H +#ifndef SIO_UNIX_H +#define SIO_UNIX_H #include "lwip/sys.h" #include "lwip/netif.h" #include "netif/fifo.h" /*#include "netif/pppif.h"*/ -/* BAUDRATE is defined in sio.c as it is implementation specific */ -typedef struct sio_status_t { +struct sio_status_s { int fd; fifo_t myfifo; -} sio_status_t; - +}; +/* BAUDRATE is defined in sio.c as it is implementation specific */ /** Baudrates */ typedef enum sioBaudrates { SIO_BAUD_9600, @@ -22,13 +21,6 @@ typedef enum sioBaudrates { SIO_BAUD_115200 } sioBaudrates; -/** -* Read a char from incoming data stream, this call blocks until data has arrived -* @param siostat siostatus struct, contains sio instance data, given by sio_open -* @return char read from input stream -*/ -u8_t sio_recv( sio_status_t * siostat ); - /** * Poll for a new character from incoming data stream * @param siostat siostatus struct, contains sio instance data, given by sio_open @@ -43,13 +35,6 @@ s16_t sio_poll(sio_status_t * siostat); */ void sio_expect_string(u8_t *str, sio_status_t * siostat); -/** -* Write a char to output data stream -* @param c char to write to output stream -* @param siostat siostatus struct, contains sio instance data, given by sio_open -*/ -void sio_send( u8_t c, sio_status_t * siostat ); - /** * Write a char to output data stream * @param str pointer to a zero terminated string @@ -64,13 +49,6 @@ void sio_send_string(u8_t *str, sio_status_t * siostat); */ void sio_flush( sio_status_t * siostat ); -/** -* Open serial port entry point from serial protocol (slipif, pppif) -* @param devnum the device number to use, i.e. ttySx, comx:, etc. there x = devnum -* @return siostatus struct, contains sio instance data, use when calling sio functions -*/ -sio_status_t * sio_open( int devnum ); - /** * Change baudrate of port, may close and reopen port * @param baud new baudrate diff --git a/contrib/ports/unix/include/netif/tapif.h b/lwip/contrib/ports/unix/port/include/netif/tapif.h similarity index 83% rename from contrib/ports/unix/include/netif/tapif.h rename to lwip/contrib/ports/unix/port/include/netif/tapif.h index 4cb0a5d..4c0fa6b 100644 --- a/contrib/ports/unix/include/netif/tapif.h +++ b/lwip/contrib/ports/unix/port/include/netif/tapif.h @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * 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, @@ -11,21 +11,21 @@ * 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. + * 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 + * 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 * */ @@ -35,5 +35,9 @@ #include "lwip/netif.h" err_t tapif_init(struct netif *netif); +void tapif_poll(struct netif *netif); +#if NO_SYS +int tapif_select(struct netif *netif); +#endif /* NO_SYS */ #endif /* LWIP_TAPIF_H */ diff --git a/contrib/ports/unix/netif/fifo.c b/lwip/contrib/ports/unix/port/netif/fifo.c similarity index 87% rename from contrib/ports/unix/netif/fifo.c rename to lwip/contrib/ports/unix/port/netif/fifo.c index 53465aa..350d3ea 100644 --- a/contrib/ports/unix/netif/fifo.c +++ b/lwip/contrib/ports/unix/port/netif/fifo.c @@ -3,6 +3,7 @@ /* ---------------------------------------------- */ /* --- fifo 4 unix ------------------------------ */ /* ---------------------------------------------- */ +#include "lwip/err.h" #include "netif/fifo.h" #include "lwip/debug.h" #include "lwip/def.h" @@ -17,14 +18,17 @@ #define FALSE 0 #endif +#ifndef SIO_FIFO_DEBUG +#define SIO_FIFO_DEBUG LWIP_DBG_OFF +#endif -u8_t fifoGet(fifo_t * fifo) +u8_t fifoGet(fifo_t * fifo) { u8_t c; sys_sem_wait(&fifo->sem); /* enter critical section */ - if (fifo->dataslot == fifo->emptyslot) + if (fifo->dataslot == fifo->emptyslot) { fifo->getWaiting = TRUE; /* tell putFifo to signal us when data is available */ sys_sem_signal(&fifo->sem); /* leave critical section (allow input from serial port..) */ @@ -35,22 +39,22 @@ u8_t fifoGet(fifo_t * fifo) c = fifo->data[fifo->dataslot++]; fifo->len--; - if (fifo->dataslot == FIFOSIZE) + if (fifo->dataslot == FIFOSIZE) { - fifo->dataslot = 0; + fifo->dataslot = 0; } sys_sem_signal(&fifo->sem); /* leave critical section */ return c; } -s16_t fifoGetNonBlock(fifo_t * fifo) +s16_t fifoGetNonBlock(fifo_t * fifo) { u16_t c; sys_sem_wait(&fifo->sem); /* enter critical section */ - if (fifo->dataslot == fifo->emptyslot) + if (fifo->dataslot == fifo->emptyslot) { /* empty fifo */ c = -1; @@ -60,9 +64,9 @@ s16_t fifoGetNonBlock(fifo_t * fifo) c = fifo->data[fifo->dataslot++]; fifo->len--; - if (fifo->dataslot == FIFOSIZE) + if (fifo->dataslot == FIFOSIZE) { - fifo->dataslot = 0; + fifo->dataslot = 0; } } sys_sem_signal(&fifo->sem); /* leave critical section */ @@ -70,7 +74,7 @@ s16_t fifoGetNonBlock(fifo_t * fifo) } -void fifoPut(fifo_t * fifo, int fd) +void fifoPut(fifo_t * fifo, int fd) { /* FIXME: mutex around struct data.. */ int cnt=0; @@ -82,7 +86,7 @@ void fifoPut(fifo_t * fifo, int fd) if ( fifo->emptyslot < fifo->dataslot ) { cnt = read( fd, &fifo->data[fifo->emptyslot], fifo->dataslot - fifo->emptyslot ); - } + } else { cnt = read( fd, &fifo->data[fifo->emptyslot], FIFOSIZE-fifo->emptyslot ); diff --git a/contrib/ports/unix/netif/list.c b/lwip/contrib/ports/unix/port/netif/list.c similarity index 94% rename from contrib/ports/unix/netif/list.c rename to lwip/contrib/ports/unix/port/netif/list.c index fd61f53..77faab5 100644 --- a/contrib/ports/unix/netif/list.c +++ b/lwip/contrib/ports/unix/port/netif/list.c @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * 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, @@ -11,21 +11,21 @@ * 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. + * 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 + * 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 * */ @@ -150,4 +150,3 @@ list_map(struct list *list, void (* func)(void *arg)) } } /*-----------------------------------------------------------------------------------*/ - diff --git a/contrib/ports/unix/netif/pcapif.c b/lwip/contrib/ports/unix/port/netif/pcapif.c similarity index 83% rename from contrib/ports/unix/netif/pcapif.c rename to lwip/contrib/ports/unix/port/netif/pcapif.c index 82a015e..2851c82 100644 --- a/contrib/ports/unix/netif/pcapif.c +++ b/lwip/contrib/ports/unix/port/netif/pcapif.c @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * 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, @@ -11,21 +11,21 @@ * 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. + * 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 + * 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 * */ @@ -55,16 +55,11 @@ #include "lwip/def.h" #include "lwip/mem.h" #include "lwip/pbuf.h" -#include "netif/unixif.h" #include "lwip/sys.h" #include "lwip/ip.h" -#if defined(LWIP_DEBUG) && defined(LWIP_TCPDUMP) -#include "netif/tcpdump.h" -#endif /* LWIP_DEBUG && LWIP_TCPDUMP */ - struct pcapif { pcap_t *pd; sys_sem_t sem; @@ -90,40 +85,25 @@ timeout(void *arg) { struct netif *netif; struct pcapif *pcapif; - struct pbuf *p, *q; - u8_t *bufptr; + struct pbuf *p; struct eth_hdr *ethhdr; - + netif = (struct netif *)arg; pcapif = netif->state; ethhdr = (struct eth_hdr *)pcapif->pkt; - - if (htons(ethhdr->type) != ETHTYPE_IP || + + if (lwip_htons(ethhdr->type) != ETHTYPE_IP || ip_lookup(pcapif->pkt + 14, netif)) { - + /* We allocate a pbuf chain of pbufs from the pool. */ p = pbuf_alloc(PBUF_LINK, pcapif->len, PBUF_POOL); - - if (p != NULL) { - /* We iterate over the pbuf chain until we have read the entire - packet into the pbuf. */ - bufptr = (u_char *)pcapif->pkt; - for(q = p; q != NULL; q = q->next) { - /* Read enough bytes to fill this pbuf in the chain. The - available data in the pbuf is given by the q->len - variable. */ - /* read data into(q->payload, q->len); */ - bcopy(bufptr, q->payload, q->len); - bufptr += q->len; - } -#if defined(LWIP_DEBUG) && defined(LWIP_TCPDUMP) - tcpdump(p); -#endif /* LWIP_DEBUG && LWIP_TCPDUMP */ + if (p != NULL) { + pbuf_take(p, pcapif->pkt, pcapif->len); ethhdr = p->payload; - switch (htons(ethhdr->type)) { + switch (lwip_htons(ethhdr->type)) { /* IP or ARP packet? */ case ETHTYPE_IP: case ETHTYPE_ARP: @@ -157,19 +137,19 @@ callback(u_char *arg, const struct pcap_pkthdr *hdr, const u_char *pkt) struct netif *netif; struct pcapif *pcapif; u32_t time, lasttime; - + netif = (struct netif *)arg; pcapif = netif->state; pcapif->len = hdr->len; - + bcopy(pkt, pcapif->pkt, hdr->len); time = hdr->ts.tv_sec * 1000 + hdr->ts.tv_usec / 1000; lasttime = pcapif->lasttime; pcapif->lasttime = time; - + if (lasttime == 0) { sys_timeout(1000, timeout, netif); @@ -199,7 +179,7 @@ err_t pcapif_init(struct netif *netif) { struct pcapif *p; - + p = malloc(sizeof(struct pcapif)); if (p == NULL) return ERR_MEM; @@ -218,8 +198,8 @@ pcapif_init(struct netif *netif) LWIP_ASSERT("Failed to create semaphore", 0); } p->p = NULL; - p->lasttime = 0; - + p->lasttime = 0; + sys_thread_new("pcapif_thread", pcapif_thread, netif, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO); return ERR_OK; } diff --git a/contrib/ports/unix/netif/sio.c b/lwip/contrib/ports/unix/port/netif/sio.c similarity index 58% rename from contrib/ports/unix/netif/sio.c rename to lwip/contrib/ports/unix/port/netif/sio.c index fbc80a2..d5a38af 100644 --- a/contrib/ports/unix/netif/sio.c +++ b/lwip/contrib/ports/unix/port/netif/sio.c @@ -1,11 +1,25 @@ /* Author: Magnus Ivarsson */ -#include "netif/sio.h" +/* to get rid of implicit function declarations */ +#define _XOPEN_SOURCE 600 +#define _GNU_SOURCE + +/* build with Darwin C extensions not part of POSIX, i.e. FASYNC, SIGIO. + we can't use LWIP_UNIX_MACH because extensions need to be turned + on before any system headers (which are pulled in through cc.h) + are included */ +#if defined(__APPLE__) +#define _DARWIN_C_SOURCE +#endif + +#include "netif/sio.h" #include "netif/fifo.h" #include "lwip/debug.h" #include "lwip/def.h" #include "lwip/sys.h" #include "lwip/arch.h" +#include "lwip/sio.h" +#include "netif/ppp/ppp_opts.h" /* Following #undefs are here to keep compiler from issuing warnings about them being double defined. (They are defined in lwip/inet.h @@ -20,7 +34,8 @@ #undef NTOHS #include -#if defined(openbsd) +#include +#if defined(LWIP_UNIX_OPENBSD) #include #endif #include @@ -28,10 +43,15 @@ #include #include #include +#include #include #include -#if PPP_SUPPORT && defined(linux) +#ifndef LWIP_HAVE_SLIPIF +#define LWIP_HAVE_SLIPIF 0 +#endif + +#if (PPP_SUPPORT || LWIP_HAVE_SLIPIF) && defined(LWIP_UNIX_LINUX) #include #endif @@ -58,12 +78,12 @@ /* } siostruct_t; */ /** array of ((siostruct*)netif->state)->sio structs */ -static sio_status_t statusar[3]; +static sio_status_t statusar[4]; -#if ! PPP_SUPPORT +#if ! (PPP_SUPPORT || LWIP_HAVE_SLIPIF) /* --private-functions----------------------------------------------------------------- */ -/** - * Signal handler for ttyXX0 to indicate bytes received +/** + * Signal handler for ttyXX0 to indicate bytes received * one per interface is needed since we cannot send a instance number / pointer as callback argument (?) */ static void signal_handler_IO_0( int status ) @@ -74,7 +94,7 @@ static void signal_handler_IO_0( int status ) } /** - * Signal handler for ttyXX1 to indicate bytes received + * Signal handler for ttyXX1 to indicate bytes received * one per interface is needed since we cannot send a instance number / pointer as callback argument (?) */ static void signal_handler_IO_1( int status ) @@ -83,22 +103,24 @@ static void signal_handler_IO_1( int status ) LWIP_DEBUGF(SIO_DEBUG, ("SigHand: rxSignal channel 1\n")); fifoPut( &statusar[1].myfifo, statusar[1].fd ); } -#endif +#endif /* ! (PPP_SUPPORT || LWIP_HAVE_SLIPIF) */ /** -* Initiation of serial device -* @param device : string with the device name and path, eg. "/dev/ttyS0" -* @param netif : netinterface struct, contains interface instance data +* Initiation of serial device +* @param device string with the device name and path, eg. "/dev/ttyS0" +* @param devnum device number +* @param siostat status * @return file handle to serial dev. */ static int sio_init( char * device, int devnum, sio_status_t * siostat ) { struct termios oldtio,newtio; -#if ! PPP_SUPPORT +#if ! (PPP_SUPPORT || LWIP_HAVE_SLIPIF) struct sigaction saio; /* definition of signal action */ #endif int fd; LWIP_UNUSED_ARG(siostat); + LWIP_UNUSED_ARG(devnum); /* open the device to be non-blocking (read will return immediately) */ fd = open( device, O_RDWR | O_NOCTTY | O_NONBLOCK ); @@ -108,7 +130,7 @@ static int sio_init( char * device, int devnum, sio_status_t * siostat ) exit( -1 ); } -#if ! PPP_SUPPORT +#if ! (PPP_SUPPORT || LWIP_HAVE_SLIPIF) /* install the signal handler before making the device asynchronous */ switch ( devnum ) { @@ -126,23 +148,37 @@ static int sio_init( char * device, int devnum, sio_status_t * siostat ) } saio.sa_flags = 0; -#if linux +#if defined(LWIP_UNIX_LINUX) saio.sa_restorer = NULL; -#endif /* linux */ +#endif /* LWIP_UNIX_LINUX */ sigaction( SIGIO,&saio,NULL ); /* allow the process to receive SIGIO */ - fcntl( fd, F_SETOWN, getpid( ) ); + if ( fcntl( fd, F_SETOWN, getpid( ) ) != 0) + { + perror( device ); + exit( -1 ); + } /* Make the file descriptor asynchronous (the manual page says only O_APPEND and O_NONBLOCK, will work with F_SETFL...) */ - fcntl( fd, F_SETFL, FASYNC ); + if ( fcntl( fd, F_SETFL, FASYNC ) != 0) + { + perror( device ); + exit( -1 ); + } #else - fcntl( fd, F_SETFL, 0 ); -#endif /* ! PPP_SUPPORT */ + if ( fcntl( fd, F_SETFL, 0 ) != 0) + { + perror( device ); + exit( -1 ); + } + +#endif /* ! (PPP_SUPPORT || LWIP_HAVE_SLIPIF) */ tcgetattr( fd,&oldtio ); /* save current port settings */ /* set new port settings */ /* see 'man termios' for further settings */ + memset(&newtio, 0, sizeof(newtio)); newtio.c_cflag = BAUDRATE | CS8 | CLOCAL | CREAD | CRTSCTS; newtio.c_iflag = 0; newtio.c_oflag = 0; @@ -164,19 +200,20 @@ static void sio_speed( int fd, int speed ) struct termios oldtio,newtio; /* int fd; */ - LWIP_DEBUGF( 1,("sio_speed: baudcode:%d enter\n",speed ) ); + LWIP_DEBUGF(SIO_DEBUG, ("sio_speed[%d]: baudcode:%d enter\n", fd, speed)); if ( fd < 0 ) { - LWIP_DEBUGF(SIO_DEBUG, ( "sio_speed: fd ERROR\n" )); + LWIP_DEBUGF(SIO_DEBUG, ("sio_speed[%d]: fd ERROR\n", fd)); exit( -1 ); } tcgetattr( fd,&oldtio ); /* get current port settings */ - /* set new port settings + /* set new port settings * see 'man termios' for further settings */ - newtio.c_cflag = speed | CS8 | CLOCAL | CREAD; /*§ | CRTSCTS; */ + memset(&newtio, 0, sizeof(newtio)); + newtio.c_cflag = speed | CS8 | CLOCAL | CREAD; /* | CRTSCTS; */ newtio.c_iflag = 0; newtio.c_oflag = 0; newtio.c_lflag = 0; /*ECHO; */ @@ -186,7 +223,7 @@ static void sio_speed( int fd, int speed ) tcsetattr( fd,TCSANOW,&newtio ); tcflush( fd, TCIOFLUSH ); - LWIP_DEBUGF( SIO_DEBUG ,("sio_speed: leave\n" )); + LWIP_DEBUGF(SIO_DEBUG, ("sio_speed[%d]: leave\n", fd)); } /* --public-functions----------------------------------------------------------------------------- */ @@ -196,7 +233,7 @@ void sio_send( u8_t c, sio_status_t * siostat ) if ( write( siostat->fd, &c, 1 ) <= 0 ) { - LWIP_DEBUGF( SIO_DEBUG,("sio_send: write refused\n") ); + LWIP_DEBUGF(SIO_DEBUG, ("sio_send[%d]: write refused\n", siostat->fd)); } } @@ -207,9 +244,9 @@ void sio_send_string( u8_t *str, sio_status_t * siostat ) if ( write( siostat->fd, str, len ) <= 0 ) { - LWIP_DEBUGF( SIO_DEBUG,("sio_send_string: write refused\n") ); + LWIP_DEBUGF(SIO_DEBUG, ("sio_send_string[%d]: write refused\n", siostat->fd)); } - LWIP_DEBUGF( (PPP_DEBUG | SIO_DEBUG),("sent:%s\n",str ) ); + LWIP_DEBUGF(SIO_DEBUG, ("sio_send_string[%d]: sent: %s\n", siostat->fd, str)); } @@ -221,7 +258,7 @@ void sio_flush( sio_status_t * siostat ) } -#if ! PPP_SUPPORT +#if ! (PPP_SUPPORT || LWIP_HAVE_SLIPIF) /*u8_t sio_recv( struct netif * netif )*/ u8_t sio_recv( sio_status_t * siostat ) { @@ -241,12 +278,12 @@ void sio_expect_string( u8_t *str, sio_status_t * siostat ) /* sio_status_t * siostat = ((siostruct_t*)netif->state)->sio;*/ u8_t c; int finger=0; - - LWIP_DEBUGF( (PPP_DEBUG | SIO_DEBUG), ("expect:%s\n",str) ); + + LWIP_DEBUGF(SIO_DEBUG, ("sio_expect_string[%d]: %s\n", siostat->fd, str)); while ( 1 ) { c=fifoGet( &(siostat->myfifo) ); - LWIP_DEBUGF( (PPP_DEBUG | SIO_DEBUG), ("_%c",c) ); + LWIP_DEBUGF(SIO_DEBUG, ("_%c", c)); if ( c==str[finger] ) { finger++; @@ -258,31 +295,34 @@ void sio_expect_string( u8_t *str, sio_status_t * siostat ) finger = 1; } } - if ( 0 == str[finger] ) + if ( 0 == str[finger] ) break; /* done, we have a match */ } - LWIP_DEBUGF( (PPP_DEBUG | SIO_DEBUG), ("[match]\n") ); + LWIP_DEBUGF(SIO_DEBUG, ("sio_expect_string[%d]: [match]\n", siostat->fd)); } -#endif /* ! PPP_SUPPORT */ +#endif /* ! (PPP_SUPPORT || LWIP_HAVE_SLIPIF) */ -#if PPP_SUPPORT +#if (PPP_SUPPORT || LWIP_HAVE_SLIPIF) u32_t sio_write(sio_status_t * siostat, u8_t *buf, u32_t size) { - return write( siostat->fd, buf, size ); + ssize_t wsz = write( siostat->fd, buf, size ); + return wsz < 0 ? 0 : wsz; } u32_t sio_read(sio_status_t * siostat, u8_t *buf, u32_t size) { - return read( siostat->fd, buf, size ); + ssize_t rsz = read( siostat->fd, buf, size ); + return rsz < 0 ? 0 : rsz; } void sio_read_abort(sio_status_t * siostat) { - printf("sio_read_abort: not yet implemented for unix\n"); + LWIP_UNUSED_ARG(siostat); + printf("sio_read_abort[%d]: not yet implemented for unix\n", siostat->fd); } -#endif /* PPP_SUPPORT */ +#endif /* (PPP_SUPPORT || LWIP_HAVE_SLIPIF) */ -sio_status_t * sio_open( int devnum ) +sio_fd_t sio_open(u8_t devnum) { char dev[20]; @@ -298,7 +338,9 @@ sio_status_t * sio_open( int devnum ) /* ((sio_status_t*)(tmp->sio))->fd = 0; */ -#if ! PPP_SUPPORT + LWIP_DEBUGF(SIO_DEBUG, ("sio_open: for devnum %d\n", devnum)); + +#if ! (PPP_SUPPORT || LWIP_HAVE_SLIPIF) fifoInit( &siostate->myfifo ); #endif /* ! PPP_SUPPORT */ @@ -308,15 +350,17 @@ sio_status_t * sio_open( int devnum ) { if ( ( siostate->fd = sio_init( dev, devnum, siostate ) ) == 0 ) { - LWIP_DEBUGF(SIO_DEBUG, ( "sio_open: ERROR opening serial device\n" )); + LWIP_DEBUGF(SIO_DEBUG, ("sio_open: ERROR opening serial device dev=%s\n", dev)); abort( ); return NULL; } - } + LWIP_DEBUGF(SIO_DEBUG, ("sio_open[%d]: dev=%s open.\n", siostate->fd, dev)); + } #if PPP_SUPPORT else if (devnum == 2) { pid_t childpid; - childpid = forkpty(&siostate->fd, NULL, NULL, NULL); + char name[256]; + childpid = forkpty(&siostate->fd, name, NULL, NULL); if(childpid < 0) { perror("forkpty"); exit (1); @@ -332,23 +376,79 @@ sio_status_t * sio_open( int devnum ) "remotename", "lwip", #else "noauth", +#endif +#if LWIP_IPV6 + "+ipv6", #endif "192.168.1.1:192.168.1.2", NULL); perror("execl pppd"); exit (1); } else { - LWIP_DEBUGF(SIO_DEBUG, ( "sio_open: spawned pppd pid %d\n", childpid)); + LWIP_DEBUGF(SIO_DEBUG, ("sio_open[%d]: spawned pppd pid %d on %s\n", + siostate->fd, childpid, name)); } } #endif +#if LWIP_HAVE_SLIPIF + else if (devnum == 3) { + pid_t childpid; + /* create PTY pair */ + siostate->fd = posix_openpt(O_RDWR | O_NOCTTY); + if (siostate->fd < 0) { + perror("open pty master"); + exit (1); + } + if (grantpt(siostate->fd) != 0) { + perror("grant pty master"); + exit (1); + } + if (unlockpt(siostate->fd) != 0) { + perror("unlock pty master"); + exit (1); + } + LWIP_DEBUGF(SIO_DEBUG, ("sio_open[%d]: for %s\n", + siostate->fd, ptsname(siostate->fd))); + /* fork for slattach */ + childpid = fork(); + if(childpid < 0) { + perror("fork"); + exit (1); + } + if(childpid == 0) { + /* esteblish SLIP interface on host side connected to PTY slave */ + execl("/sbin/slattach", "slattach", + "-d", "-v", "-L", "-p", "slip", + ptsname(siostate->fd), + NULL); + perror("execl slattach"); + exit (1); + } else { + int ret; + char buf[1024]; + LWIP_DEBUGF(SIO_DEBUG, ("sio_open[%d]: spawned slattach pid %d on %s\n", + siostate->fd, childpid, ptsname(siostate->fd))); + /* wait a moment for slattach startup */ + sleep(1); + /* configure SLIP interface on host side as P2P interface */ + snprintf(buf, sizeof(buf), + "/sbin/ifconfig sl0 mtu %d %s pointopoint %s up", + SLIP_MAX_SIZE, "192.168.2.1", "192.168.2.2"); + LWIP_DEBUGF(SIO_DEBUG, ("sio_open[%d]: system(\"%s\");\n", siostate->fd, buf)); + ret = system(buf); + if (ret < 0) { + perror("ifconfig failed"); + exit(1); + } + } + } +#endif /* LWIP_HAVE_SLIPIF */ else { - LWIP_DEBUGF(SIO_DEBUG, ( "sio_open: device %s (%d) is not supported\n", dev, devnum )); + LWIP_DEBUGF(SIO_DEBUG, ("sio_open: device %s (%d) is not supported\n", dev, devnum)); return NULL; } - LWIP_DEBUGF( 1,("sio_open: dev=%s open.\n", dev )); return siostate; } @@ -360,7 +460,7 @@ void sio_change_baud( sioBaudrates baud, sio_status_t * siostat ) { /* sio_status_t * siostat = ((siostruct_t*)netif->state)->sio;*/ - LWIP_DEBUGF( 1,("sio_change_baud\n" )); + LWIP_DEBUGF(SIO_DEBUG, ("sio_change_baud[%d]\n", siostat->fd)); switch ( baud ) { @@ -381,8 +481,8 @@ void sio_change_baud( sioBaudrates baud, sio_status_t * siostat ) break; default: - LWIP_DEBUGF( 1,("sio_change_baud: Unknown baudrate, code:%d\n", baud )); + LWIP_DEBUGF(SIO_DEBUG, ("sio_change_baud[%d]: Unknown baudrate, code:%d\n", + siostat->fd, baud)); break; } } - diff --git a/contrib/ports/unix/netif/tapif.c b/lwip/contrib/ports/unix/port/netif/tapif.c similarity index 55% rename from contrib/ports/unix/netif/tapif.c rename to lwip/contrib/ports/unix/port/netif/tapif.c index 562acfe..b5f8ad2 100644 --- a/contrib/ports/unix/netif/tapif.c +++ b/lwip/contrib/ports/unix/port/netif/tapif.c @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * 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, @@ -11,69 +11,86 @@ * 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. + * 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 + * 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 * */ -#include "netif/tapif.h" - #include #include #include -#include #include +#include +#include +#include #include +#include #include #include +#include "lwip/opt.h" #include "lwip/debug.h" - -#include "lwip/opt.h" #include "lwip/def.h" #include "lwip/ip.h" #include "lwip/mem.h" +#include "lwip/stats.h" +#include "lwip/snmp.h" #include "lwip/pbuf.h" #include "lwip/sys.h" - +#include "lwip/timeouts.h" #include "netif/etharp.h" #include "lwip/ethip6.h" -#if defined(LWIP_DEBUG) && defined(LWIP_TCPDUMP) -#include "netif/tcpdump.h" -#endif /* LWIP_DEBUG && LWIP_TCPDUMP */ +#include "netif/tapif.h" #define IFCONFIG_BIN "/sbin/ifconfig " -#if defined(linux) +#if defined(LWIP_UNIX_LINUX) #include #include #include +/* + * Creating a tap interface requires special privileges. If the interfaces + * is created in advance with `tunctl -u ` it can be opened as a regular + * user. The network must already be configured. If DEVTAP_IF is defined it + * will be opened instead of creating a new tap device. + * + * You can also use PRECONFIGURED_TAPIF environment variable to do so. + */ +#ifndef DEVTAP_DEFAULT_IF +#define DEVTAP_DEFAULT_IF "tap0" +#endif +#ifndef DEVTAP #define DEVTAP "/dev/net/tun" -#define IFCONFIG_ARGS "tap0 inet %d.%d.%d.%d" -#elif defined(openbsd) +#endif +#define NETMASK_ARGS "netmask %d.%d.%d.%d" +#define IFCONFIG_ARGS "tap0 inet %d.%d.%d.%d " NETMASK_ARGS +#elif defined(LWIP_UNIX_OPENBSD) #define DEVTAP "/dev/tun0" -#define IFCONFIG_ARGS "tun0 inet %d.%d.%d.%d link0" +#define NETMASK_ARGS "netmask %d.%d.%d.%d" +#define IFCONFIG_ARGS "tun0 inet %d.%d.%d.%d " NETMASK_ARGS " link0" #else /* others */ #define DEVTAP "/dev/tap0" -#define IFCONFIG_ARGS "tap0 inet %d.%d.%d.%d" +#define NETMASK_ARGS "netmask %d.%d.%d.%d" +#define IFCONFIG_ARGS "tap0 inet %d.%d.%d.%d " NETMASK_ARGS #endif +/* Define those to better describe your network interface. */ #define IFNAME0 't' #define IFNAME1 'p' @@ -82,70 +99,110 @@ #endif struct tapif { - struct eth_addr *ethaddr; /* Add whatever per-interface state that is needed here. */ int fd; }; /* Forward declarations. */ -static void tapif_input(struct netif *netif); - -static void tapif_thread(void *data); +static void tapif_input(struct netif *netif); +#if !NO_SYS +static void tapif_thread(void *arg); +#endif /* !NO_SYS */ /*-----------------------------------------------------------------------------------*/ static void low_level_init(struct netif *netif) { struct tapif *tapif; - char buf[sizeof(IFCONFIG_ARGS) + sizeof(IFCONFIG_BIN) + 50]; +#if LWIP_IPV4 + int ret; + char buf[1024]; +#endif /* LWIP_IPV4 */ + char *preconfigured_tapif = getenv("PRECONFIGURED_TAPIF"); tapif = (struct tapif *)netif->state; /* Obtain MAC address from network interface. */ /* (We just fake an address...) */ - tapif->ethaddr->addr[0] = 0x1; - tapif->ethaddr->addr[1] = 0x2; - tapif->ethaddr->addr[2] = 0x3; - tapif->ethaddr->addr[3] = 0x4; - tapif->ethaddr->addr[4] = 0x5; - tapif->ethaddr->addr[5] = 0x6; + netif->hwaddr[0] = 0x02; + netif->hwaddr[1] = 0x12; + netif->hwaddr[2] = 0x34; + netif->hwaddr[3] = 0x56; + netif->hwaddr[4] = 0x78; + netif->hwaddr[5] = 0xab; + netif->hwaddr_len = 6; - /* Do whatever else is needed to initialize interface. */ + /* device capabilities */ + netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_IGMP; tapif->fd = open(DEVTAP, O_RDWR); LWIP_DEBUGF(TAPIF_DEBUG, ("tapif_init: fd %d\n", tapif->fd)); - if(tapif->fd == -1) { -#ifdef linux + if (tapif->fd == -1) { +#ifdef LWIP_UNIX_LINUX perror("tapif_init: try running \"modprobe tun\" or rebuilding your kernel with CONFIG_TUN; cannot open "DEVTAP); -#else +#else /* LWIP_UNIX_LINUX */ perror("tapif_init: cannot open "DEVTAP); -#endif +#endif /* LWIP_UNIX_LINUX */ exit(1); } -#ifdef linux +#ifdef LWIP_UNIX_LINUX { struct ifreq ifr; memset(&ifr, 0, sizeof(ifr)); + + if (preconfigured_tapif) { + strncpy(ifr.ifr_name, preconfigured_tapif, sizeof(ifr.ifr_name)); + } else { + strncpy(ifr.ifr_name, DEVTAP_DEFAULT_IF, sizeof(ifr.ifr_name)); + } + ifr.ifr_name[sizeof(ifr.ifr_name)-1] = 0; /* ensure \0 termination */ + ifr.ifr_flags = IFF_TAP|IFF_NO_PI; if (ioctl(tapif->fd, TUNSETIFF, (void *) &ifr) < 0) { perror("tapif_init: "DEVTAP" ioctl TUNSETIFF"); exit(1); } } -#endif /* Linux */ - - sprintf(buf, IFCONFIG_BIN IFCONFIG_ARGS, - ip4_addr1(&(netif->gw)), - ip4_addr2(&(netif->gw)), - ip4_addr3(&(netif->gw)), - ip4_addr4(&(netif->gw))); +#endif /* LWIP_UNIX_LINUX */ + + netif_set_link_up(netif); + + if (preconfigured_tapif == NULL) { +#if LWIP_IPV4 + snprintf(buf, 1024, IFCONFIG_BIN IFCONFIG_ARGS, + ip4_addr1(netif_ip4_gw(netif)), + ip4_addr2(netif_ip4_gw(netif)), + ip4_addr3(netif_ip4_gw(netif)), + ip4_addr4(netif_ip4_gw(netif)) +#ifdef NETMASK_ARGS + , + ip4_addr1(netif_ip4_netmask(netif)), + ip4_addr2(netif_ip4_netmask(netif)), + ip4_addr3(netif_ip4_netmask(netif)), + ip4_addr4(netif_ip4_netmask(netif)) +#endif /* NETMASK_ARGS */ + ); + + LWIP_DEBUGF(TAPIF_DEBUG, ("tapif_init: system(\"%s\");\n", buf)); + ret = system(buf); + if (ret < 0) { + perror("ifconfig failed"); + exit(1); + } + if (ret != 0) { + printf("ifconfig returned %d\n", ret); + } +#else /* LWIP_IPV4 */ + perror("todo: support IPv6 support for non-preconfigured tapif"); + exit(1); +#endif /* LWIP_IPV4 */ + } - LWIP_DEBUGF(TAPIF_DEBUG, ("tapif_init: system(\"%s\");\n", buf)); - system(buf); +#if !NO_SYS sys_thread_new("tapif_thread", tapif_thread, netif, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO); - +#endif /* !NO_SYS */ } /*-----------------------------------------------------------------------------------*/ /* @@ -161,36 +218,36 @@ low_level_init(struct netif *netif) static err_t low_level_output(struct netif *netif, struct pbuf *p) { - struct pbuf *q; - char buf[1514]; - char *bufptr; - struct tapif *tapif; + struct tapif *tapif = (struct tapif *)netif->state; + char buf[1518]; /* max packet size including VLAN excluding CRC */ + ssize_t written; - tapif = (struct tapif *)netif->state; #if 0 - if(((double)rand()/(double)RAND_MAX) < 0.2) { + if (((double)rand()/(double)RAND_MAX) < 0.2) { printf("drop output\n"); - return ERR_OK; - } + return ERR_OK; /* ERR_OK because we simulate packet loss on cable */ + } #endif - /* initiate transfer(); */ - bufptr = &buf[0]; - - 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); */ - memcpy(bufptr, q->payload, q->len); - bufptr += q->len; + if (p->tot_len > sizeof(buf)) { + MIB2_STATS_NETIF_INC(netif, ifoutdiscards); + perror("tapif: packet too large"); + return ERR_IF; } + /* initiate transfer(); */ + pbuf_copy_partial(p, buf, p->tot_len, 0); + /* signal that packet should be sent(); */ - if(write(tapif->fd, buf, p->tot_len) == -1) { + written = write(tapif->fd, buf, p->tot_len); + if (written < p->tot_len) { + MIB2_STATS_NETIF_INC(netif, ifoutdiscards); perror("tapif: write"); + return ERR_IF; + } else { + MIB2_STATS_NETIF_ADD(netif, ifoutoctets, (u32_t)written); + return ERR_OK; } - return ERR_OK; } /*-----------------------------------------------------------------------------------*/ /* @@ -202,72 +259,46 @@ low_level_output(struct netif *netif, struct pbuf *p) */ /*-----------------------------------------------------------------------------------*/ static struct pbuf * -low_level_input(struct tapif *tapif) +low_level_input(struct netif *netif) { - struct pbuf *p, *q; + struct pbuf *p; u16_t len; - char buf[1514]; - char *bufptr; + ssize_t readlen; + char buf[1518]; /* max packet size including VLAN excluding CRC */ + struct tapif *tapif = (struct tapif *)netif->state; /* Obtain the size of the packet and put it into the "len" variable. */ - len = read(tapif->fd, buf, sizeof(buf)); + readlen = read(tapif->fd, buf, sizeof(buf)); + if (readlen < 0) { + perror("read returned -1"); + exit(1); + } + len = (u16_t)readlen; + + MIB2_STATS_NETIF_ADD(netif, ifinoctets, len); + #if 0 - if(((double)rand()/(double)RAND_MAX) < 0.2) { + if (((double)rand()/(double)RAND_MAX) < 0.2) { printf("drop\n"); return NULL; - } + } #endif /* We allocate a pbuf chain of pbufs from the pool. */ p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL); - - if(p != NULL) { - /* We iterate over the pbuf chain until we have read the entire - packet into the pbuf. */ - bufptr = &buf[0]; - for(q = p; q != NULL; q = q->next) { - /* Read enough bytes to fill this pbuf in the chain. The - available data in the pbuf is given by the q->len - variable. */ - /* read data into(q->payload, q->len); */ - memcpy(q->payload, bufptr, q->len); - bufptr += q->len; - } + if (p != NULL) { + pbuf_take(p, buf, len); /* acknowledge that packet has been read(); */ } else { /* drop packet(); */ + MIB2_STATS_NETIF_INC(netif, ifindiscards); + LWIP_DEBUGF(NETIF_DEBUG, ("tapif_input: could not allocate pbuf\n")); } return p; } -/*-----------------------------------------------------------------------------------*/ -static void -tapif_thread(void *arg) -{ - struct netif *netif; - struct tapif *tapif; - fd_set fdset; - int ret; - netif = (struct netif *)arg; - tapif = (struct tapif *)netif->state; - - while(1) { - FD_ZERO(&fdset); - FD_SET(tapif->fd, &fdset); - - /* Wait for a packet to arrive. */ - ret = select(tapif->fd + 1, &fdset, NULL, NULL, NULL); - - if(ret == 1) { - /* Handle incoming packet. */ - tapif_input(netif); - } else if(ret == -1) { - perror("tapif_thread: select"); - } - } -} /*-----------------------------------------------------------------------------------*/ /* * tapif_input(): @@ -282,43 +313,19 @@ tapif_thread(void *arg) static void tapif_input(struct netif *netif) { - struct tapif *tapif; - struct eth_hdr *ethhdr; - struct pbuf *p; - - - tapif = (struct tapif *)netif->state; + struct pbuf *p = low_level_input(netif); - p = low_level_input(tapif); - - if(p == NULL) { + if (p == NULL) { +#if LINK_STATS + LINK_STATS_INC(link.recv); +#endif /* LINK_STATS */ LWIP_DEBUGF(TAPIF_DEBUG, ("tapif_input: low_level_input returned NULL\n")); return; } - ethhdr = (struct eth_hdr *)p->payload; - switch(htons(ethhdr->type)) { - /* IP or ARP packet? */ - case ETHTYPE_IP: - case ETHTYPE_ARP: -#if LWIP_IPV6 - case ETHTYPE_IPV6: -#endif /* LWIP_IPV6 */ -#if PPPOE_SUPPORT - /* PPPoE packet? */ - case ETHTYPE_PPPOEDISC: - case ETHTYPE_PPPOE: -#endif /* PPPOE_SUPPORT */ - /* full packet send to tcpip_thread to process */ - if (netif->input(p, netif) != ERR_OK) { - LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_input: IP input error\n")); - pbuf_free(p); - p = NULL; - } - break; - default: + if (netif->input(p, netif) != ERR_OK) { + LWIP_DEBUGF(NETIF_DEBUG, ("tapif_input: netif input error\n")); pbuf_free(p); - break; } } /*-----------------------------------------------------------------------------------*/ @@ -334,30 +341,92 @@ tapif_input(struct netif *netif) err_t tapif_init(struct netif *netif) { - struct tapif *tapif; + struct tapif *tapif = (struct tapif *)mem_malloc(sizeof(struct tapif)); - tapif = (struct tapif *)mem_malloc(sizeof(struct tapif)); - if (!tapif) { + if (tapif == NULL) { + LWIP_DEBUGF(NETIF_DEBUG, ("tapif_init: out of memory for tapif\n")); return ERR_MEM; } netif->state = tapif; + MIB2_INIT_NETIF(netif, snmp_ifType_other, 100000000); + netif->name[0] = IFNAME0; netif->name[1] = IFNAME1; +#if LWIP_IPV4 netif->output = etharp_output; +#endif /* LWIP_IPV4 */ #if LWIP_IPV6 netif->output_ip6 = ethip6_output; #endif /* LWIP_IPV6 */ netif->linkoutput = low_level_output; netif->mtu = 1500; - /* hardware address length */ - netif->hwaddr_len = 6; - - tapif->ethaddr = (struct eth_addr *)&(netif->hwaddr[0]); - - netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_IGMP; low_level_init(netif); return ERR_OK; } + + /*-----------------------------------------------------------------------------------*/ +void +tapif_poll(struct netif *netif) +{ + tapif_input(netif); +} + +#if NO_SYS + +int +tapif_select(struct netif *netif) +{ + fd_set fdset; + int ret; + struct timeval tv; + struct tapif *tapif; + u32_t msecs = sys_timeouts_sleeptime(); + + tapif = (struct tapif *)netif->state; + + tv.tv_sec = msecs / 1000; + tv.tv_usec = (msecs % 1000) * 1000; + + FD_ZERO(&fdset); + FD_SET(tapif->fd, &fdset); + + ret = select(tapif->fd + 1, &fdset, NULL, NULL, &tv); + if (ret > 0) { + tapif_input(netif); + } + return ret; +} + +#else /* NO_SYS */ + +static void +tapif_thread(void *arg) +{ + struct netif *netif; + struct tapif *tapif; + fd_set fdset; + int ret; + + netif = (struct netif *)arg; + tapif = (struct tapif *)netif->state; + + while(1) { + FD_ZERO(&fdset); + FD_SET(tapif->fd, &fdset); + + /* Wait for a packet to arrive. */ + ret = select(tapif->fd + 1, &fdset, NULL, NULL, NULL); + + if(ret == 1) { + /* Handle incoming packet. */ + tapif_input(netif); + } else if(ret == -1) { + perror("tapif_thread: select"); + } + } +} + +#endif /* NO_SYS */ diff --git a/contrib/ports/unix/perf.c b/lwip/contrib/ports/unix/port/perf.c similarity index 100% rename from contrib/ports/unix/perf.c rename to lwip/contrib/ports/unix/port/perf.c diff --git a/contrib/ports/unix/sys_arch.c b/lwip/contrib/ports/unix/port/sys_arch.c similarity index 69% rename from contrib/ports/unix/sys_arch.c rename to lwip/contrib/ports/unix/port/sys_arch.c index 9bb1f59..a56d7de 100644 --- a/contrib/ports/unix/sys_arch.c +++ b/lwip/contrib/ports/unix/port/sys_arch.c @@ -1,8 +1,8 @@ /* * Copyright (c) 2001-2003 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * 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, @@ -11,21 +11,21 @@ * 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. + * 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 + * 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 * */ @@ -44,6 +44,8 @@ * will block until there is more room instead of just * leaking messages. */ +#define _GNU_SOURCE /* pull in pthread_setname_np() on Linux */ + #include "lwip/debug.h" #include @@ -52,14 +54,49 @@ #include #include #include +#include + +#include "lwip/def.h" + +#ifdef LWIP_UNIX_MACH +#include +#include +#endif #include "lwip/sys.h" #include "lwip/opt.h" #include "lwip/stats.h" +#include "lwip/tcpip.h" + +u32_t +lwip_port_rand(void) +{ + return (u32_t)rand(); +} -#define UMAX(a, b) ((a) > (b) ? (a) : (b)) +static void +get_monotonic_time(struct timespec *ts) +{ +#ifdef LWIP_UNIX_MACH + /* darwin impl (no CLOCK_MONOTONIC) */ + u64_t t = mach_absolute_time(); + mach_timebase_info_data_t timebase_info = {0, 0}; + mach_timebase_info(&timebase_info); + u64_t nano = (t * timebase_info.numer) / (timebase_info.denom); + u64_t sec = nano/1000000000L; + nano -= sec * 1000000000L; + ts->tv_sec = sec; + ts->tv_nsec = nano; +#else + clock_gettime(CLOCK_MONOTONIC, ts); +#endif +} -static struct timeval starttime; +#if SYS_LIGHTWEIGHT_PROT +static pthread_mutex_t lwprot_mutex = PTHREAD_MUTEX_INITIALIZER; +static pthread_t lwprot_thread = (pthread_t)0xDEAD; +static int lwprot_count = 0; +#endif /* SYS_LIGHTWEIGHT_PROT */ #if !NO_SYS @@ -84,21 +121,20 @@ struct sys_mbox { struct sys_sem { unsigned int c; + pthread_condattr_t condattr; pthread_cond_t cond; pthread_mutex_t mutex; }; +struct sys_mutex { + pthread_mutex_t mutex; +}; + struct sys_thread { struct sys_thread *next; pthread_t pthread; }; -#if SYS_LIGHTWEIGHT_PROT -static pthread_mutex_t lwprot_mutex = PTHREAD_MUTEX_INITIALIZER; -static pthread_t lwprot_thread = (pthread_t)0xDEAD; -static int lwprot_count = 0; -#endif /* SYS_LIGHTWEIGHT_PROT */ - static struct sys_sem *sys_sem_new_internal(u8_t count); static void sys_sem_free_internal(struct sys_sem *sem); @@ -106,7 +142,8 @@ static u32_t cond_wait(pthread_cond_t * cond, pthread_mutex_t * mutex, u32_t timeout); /*-----------------------------------------------------------------------------------*/ -static struct sys_thread * +/* Threads */ +static struct sys_thread * introduce_thread(pthread_t id) { struct sys_thread *thread; @@ -123,27 +160,52 @@ introduce_thread(pthread_t id) return thread; } -/*-----------------------------------------------------------------------------------*/ + +struct thread_wrapper_data +{ + lwip_thread_fn function; + void *arg; +}; + +static void * +thread_wrapper(void *arg) +{ + struct thread_wrapper_data *thread_data = (struct thread_wrapper_data *)arg; + + thread_data->function(thread_data->arg); + + /* we should never get here */ + free(arg); + return NULL; +} + sys_thread_t sys_thread_new(const char *name, lwip_thread_fn function, void *arg, int stacksize, int prio) { int code; pthread_t tmp; struct sys_thread *st = NULL; + struct thread_wrapper_data *thread_data; LWIP_UNUSED_ARG(name); LWIP_UNUSED_ARG(stacksize); LWIP_UNUSED_ARG(prio); + thread_data = (struct thread_wrapper_data *)malloc(sizeof(struct thread_wrapper_data)); + thread_data->arg = arg; + thread_data->function = function; code = pthread_create(&tmp, - NULL, - (void *(*)(void *)) - function, - arg); - + NULL, + thread_wrapper, + thread_data); + +#ifdef LWIP_UNIX_LINUX + pthread_setname_np(tmp, name); +#endif + if (0 == code) { st = introduce_thread(tmp); } - + if (NULL == st) { LWIP_DEBUGF(SYS_DEBUG, ("sys_thread_new: pthread_create %d, st = 0x%lx", code, (unsigned long)st)); @@ -151,7 +213,45 @@ sys_thread_new(const char *name, lwip_thread_fn function, void *arg, int stacksi } return st; } + +#if LWIP_TCPIP_CORE_LOCKING +static pthread_t lwip_core_lock_holder_thread_id; +void sys_lock_tcpip_core(void) +{ + sys_mutex_lock(&lock_tcpip_core); + lwip_core_lock_holder_thread_id = pthread_self(); +} + +void sys_unlock_tcpip_core(void) +{ + lwip_core_lock_holder_thread_id = 0; + sys_mutex_unlock(&lock_tcpip_core); +} +#endif /* LWIP_TCPIP_CORE_LOCKING */ + +static pthread_t lwip_tcpip_thread_id; +void sys_mark_tcpip_thread(void) +{ + lwip_tcpip_thread_id = pthread_self(); +} + +void sys_check_core_locking(void) +{ + /* Embedded systems should check we are NOT in an interrupt context here */ + + if (lwip_tcpip_thread_id != 0) { + pthread_t current_thread_id = pthread_self(); + +#if LWIP_TCPIP_CORE_LOCKING + LWIP_ASSERT("Function called without core lock", current_thread_id == lwip_core_lock_holder_thread_id); +#else /* LWIP_TCPIP_CORE_LOCKING */ + LWIP_ASSERT("Function called from wrong thread", current_thread_id == lwip_tcpip_thread_id); +#endif /* LWIP_TCPIP_CORE_LOCKING */ + } +} + /*-----------------------------------------------------------------------------------*/ +/* Mailbox */ err_t sys_mbox_new(struct sys_mbox **mb, int size) { @@ -172,7 +272,7 @@ sys_mbox_new(struct sys_mbox **mb, int size) *mb = mbox; return ERR_OK; } -/*-----------------------------------------------------------------------------------*/ + void sys_mbox_free(struct sys_mbox **mb) { @@ -180,7 +280,7 @@ sys_mbox_free(struct sys_mbox **mb) struct sys_mbox *mbox = *mb; SYS_STATS_DEC(mbox.used); sys_arch_sem_wait(&mbox->mutex, 0); - + sys_sem_free_internal(mbox->not_empty); sys_sem_free_internal(mbox->not_full); sys_sem_free_internal(mbox->mutex); @@ -189,7 +289,7 @@ sys_mbox_free(struct sys_mbox **mb) free(mbox); } } -/*-----------------------------------------------------------------------------------*/ + err_t sys_mbox_trypost(struct sys_mbox **mb, void *msg) { @@ -226,7 +326,13 @@ sys_mbox_trypost(struct sys_mbox **mb, void *msg) return ERR_OK; } -/*-----------------------------------------------------------------------------------*/ + +err_t +sys_mbox_trypost_fromisr(sys_mbox_t *q, void *msg) +{ + return sys_mbox_trypost(q, msg); +} + void sys_mbox_post(struct sys_mbox **mb, void *msg) { @@ -263,7 +369,7 @@ sys_mbox_post(struct sys_mbox **mb, void *msg) sys_sem_signal(&mbox->mutex); } -/*-----------------------------------------------------------------------------------*/ + u32_t sys_arch_mbox_tryfetch(struct sys_mbox **mb, void **msg) { @@ -296,7 +402,7 @@ sys_arch_mbox_tryfetch(struct sys_mbox **mb, void **msg) return 0; } -/*-----------------------------------------------------------------------------------*/ + u32_t sys_arch_mbox_fetch(struct sys_mbox **mb, void **msg, u32_t timeout) { @@ -345,7 +451,9 @@ sys_arch_mbox_fetch(struct sys_mbox **mb, void **msg, u32_t timeout) return time_needed; } + /*-----------------------------------------------------------------------------------*/ +/* Semaphore */ static struct sys_sem * sys_sem_new_internal(u8_t count) { @@ -354,12 +462,16 @@ sys_sem_new_internal(u8_t count) sem = (struct sys_sem *)malloc(sizeof(struct sys_sem)); if (sem != NULL) { sem->c = count; - pthread_cond_init(&(sem->cond), NULL); + pthread_condattr_init(&(sem->condattr)); +#if !(defined(LWIP_UNIX_MACH) || (defined(LWIP_UNIX_ANDROID) && __ANDROID_API__ < 21)) + pthread_condattr_setclock(&(sem->condattr), CLOCK_MONOTONIC); +#endif + pthread_cond_init(&(sem->cond), &(sem->condattr)); pthread_mutex_init(&(sem->mutex), NULL); } return sem; } -/*-----------------------------------------------------------------------------------*/ + err_t sys_sem_new(struct sys_sem **sem, u8_t count) { @@ -370,48 +482,54 @@ sys_sem_new(struct sys_sem **sem, u8_t count) } return ERR_OK; } -/*-----------------------------------------------------------------------------------*/ + static u32_t cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex, u32_t timeout) { - time_t tdiff; - time_t sec, usec; - struct timeval rtime1, rtime2; - struct timespec ts; - int retval; - - if (timeout > 0) { - /* Get a timestamp and add the timeout value. */ - gettimeofday(&rtime1, NULL); - sec = rtime1.tv_sec; - usec = rtime1.tv_usec; - usec += timeout % 1000 * 1000; - sec += (int)(timeout / 1000) + (int)(usec / 1000000); - usec = usec % 1000000; - ts.tv_nsec = usec * 1000; - ts.tv_sec = sec; - - retval = pthread_cond_timedwait(cond, mutex, &ts); - - if (retval == ETIMEDOUT) { - return SYS_ARCH_TIMEOUT; - } else { - /* Calculate for how long we waited for the cond. */ - gettimeofday(&rtime2, NULL); - tdiff = (rtime2.tv_sec - rtime1.tv_sec) * 1000 + - (rtime2.tv_usec - rtime1.tv_usec) / 1000; + struct timespec rtime1, rtime2, ts; + int ret; - if (tdiff <= 0) { - return 0; - } - return (u32_t)tdiff; - } - } else { +#ifdef __GNU__ + #define pthread_cond_wait pthread_hurd_cond_wait_np + #define pthread_cond_timedwait pthread_hurd_cond_timedwait_np +#endif + + if (timeout == 0) { pthread_cond_wait(cond, mutex); return 0; } + + /* Get a timestamp and add the timeout value. */ + get_monotonic_time(&rtime1); +#if defined(LWIP_UNIX_MACH) || (defined(LWIP_UNIX_ANDROID) && __ANDROID_API__ < 21) + ts.tv_sec = timeout / 1000L; + ts.tv_nsec = (timeout % 1000L) * 1000000L; + ret = pthread_cond_timedwait_relative_np(cond, mutex, &ts); +#else + ts.tv_sec = rtime1.tv_sec + timeout / 1000L; + ts.tv_nsec = rtime1.tv_nsec + (timeout % 1000L) * 1000000L; + if (ts.tv_nsec >= 1000000000L) { + ts.tv_sec++; + ts.tv_nsec -= 1000000000L; + } + + ret = pthread_cond_timedwait(cond, mutex, &ts); +#endif + if (ret == ETIMEDOUT) { + return SYS_ARCH_TIMEOUT; + } + + /* Calculate for how long we waited for the cond. */ + get_monotonic_time(&rtime2); + ts.tv_sec = rtime2.tv_sec - rtime1.tv_sec; + ts.tv_nsec = rtime2.tv_nsec - rtime1.tv_nsec; + if (ts.tv_nsec < 0) { + ts.tv_sec--; + ts.tv_nsec += 1000000000L; + } + return (u32_t)(ts.tv_sec * 1000L + ts.tv_nsec / 1000000L); } -/*-----------------------------------------------------------------------------------*/ + u32_t sys_arch_sem_wait(struct sys_sem **s, u32_t timeout) { @@ -439,7 +557,7 @@ sys_arch_sem_wait(struct sys_sem **s, u32_t timeout) pthread_mutex_unlock(&(sem->mutex)); return (u32_t)time_needed; } -/*-----------------------------------------------------------------------------------*/ + void sys_sem_signal(struct sys_sem **s) { @@ -457,15 +575,16 @@ sys_sem_signal(struct sys_sem **s) pthread_cond_broadcast(&(sem->cond)); pthread_mutex_unlock(&(sem->mutex)); } -/*-----------------------------------------------------------------------------------*/ + static void sys_sem_free_internal(struct sys_sem *sem) { pthread_cond_destroy(&(sem->cond)); + pthread_condattr_destroy(&(sem->condattr)); pthread_mutex_destroy(&(sem->mutex)); free(sem); } -/*-----------------------------------------------------------------------------------*/ + void sys_sem_free(struct sys_sem **sem) { @@ -474,28 +593,85 @@ sys_sem_free(struct sys_sem **sem) sys_sem_free_internal(*sem); } } + +/*-----------------------------------------------------------------------------------*/ +/* Mutex */ +/** Create a new mutex + * @param mutex pointer to the mutex to create + * @return a new mutex */ +err_t +sys_mutex_new(struct sys_mutex **mutex) +{ + struct sys_mutex *mtx; + + mtx = (struct sys_mutex *)malloc(sizeof(struct sys_mutex)); + if (mtx != NULL) { + pthread_mutex_init(&(mtx->mutex), NULL); + *mutex = mtx; + return ERR_OK; + } + else { + return ERR_MEM; + } +} + +/** Lock a mutex + * @param mutex the mutex to lock */ +void +sys_mutex_lock(struct sys_mutex **mutex) +{ + pthread_mutex_lock(&((*mutex)->mutex)); +} + +/** Unlock a mutex + * @param mutex the mutex to unlock */ +void +sys_mutex_unlock(struct sys_mutex **mutex) +{ + pthread_mutex_unlock(&((*mutex)->mutex)); +} + +/** Delete a mutex + * @param mutex the mutex to delete */ +void +sys_mutex_free(struct sys_mutex **mutex) +{ + pthread_mutex_destroy(&((*mutex)->mutex)); + free(*mutex); +} + #endif /* !NO_SYS */ + /*-----------------------------------------------------------------------------------*/ +/* Time */ u32_t sys_now(void) { - struct timeval tv; - u32_t sec, usec, msec; - gettimeofday(&tv, NULL); + struct timespec ts; - sec = (u32_t)(tv.tv_sec - starttime.tv_sec); - usec = (u32_t)(tv.tv_usec - starttime.tv_usec); - msec = sec * 1000 + usec / 1000; + get_monotonic_time(&ts); + return (u32_t)(ts.tv_sec * 1000L + ts.tv_nsec / 1000000L); +} - return msec; +u32_t +sys_jiffies(void) +{ + struct timespec ts; + + get_monotonic_time(&ts); + return (u32_t)(ts.tv_sec * 1000000000L + ts.tv_nsec); } + /*-----------------------------------------------------------------------------------*/ +/* Init */ + void sys_init(void) { - gettimeofday(&starttime, NULL); } + /*-----------------------------------------------------------------------------------*/ +/* Critical section */ #if SYS_LIGHTWEIGHT_PROT /** sys_prot_t sys_arch_protect(void) @@ -530,7 +706,7 @@ sys_arch_protect(void) lwprot_count++; return 0; } -/*-----------------------------------------------------------------------------------*/ + /** void sys_arch_unprotect(sys_prot_t pval) This optional function does a "fast" set of critical region protection to the @@ -544,7 +720,8 @@ sys_arch_unprotect(sys_prot_t pval) LWIP_UNUSED_ARG(pval); if (lwprot_thread == pthread_self()) { - if (--lwprot_count == 0) + lwprot_count--; + if (lwprot_count == 0) { lwprot_thread = (pthread_t) 0xDEAD; pthread_mutex_unlock(&lwprot_mutex); @@ -553,45 +730,13 @@ sys_arch_unprotect(sys_prot_t pval) } #endif /* SYS_LIGHTWEIGHT_PROT */ -/*-----------------------------------------------------------------------------------*/ - -#ifndef MAX_JIFFY_OFFSET -#define MAX_JIFFY_OFFSET ((~0U >> 1)-1) -#endif - -#ifndef HZ -#define HZ 100 -#endif - -u32_t -sys_jiffies(void) +/* get keyboard state to terminate the debug app by using select */ +int +lwip_unix_keypressed(void) { - struct timeval tv; - unsigned long sec; - long usec; - - gettimeofday(&tv,NULL); - sec = tv.tv_sec - starttime.tv_sec; - usec = tv.tv_usec; - - if (sec >= (MAX_JIFFY_OFFSET / HZ)) - return MAX_JIFFY_OFFSET; - usec += 1000000L / HZ - 1; - usec /= 1000000L / HZ; - return HZ * sec + usec; + struct timeval tv = { 0L, 0L }; + fd_set fds; + FD_ZERO(&fds); + FD_SET(0, &fds); + return select(1, &fds, NULL, NULL, &tv); } - -#if PPP_DEBUG - -#include - -void ppp_trace(int level, const char *format, ...) -{ - va_list args; - - (void)level; - va_start(args, format); - vprintf(format, args); - va_end(args); -} -#endif diff --git a/lwip/contrib/ports/unix/setup-tapif b/lwip/contrib/ports/unix/setup-tapif new file mode 100755 index 0000000..d5c4935 --- /dev/null +++ b/lwip/contrib/ports/unix/setup-tapif @@ -0,0 +1,22 @@ +#!/bin/bash + +# This script needs bridge-util debian package or similar +# for other distros. + +# Run using "source setup-tapif" to get exported PRECONFIGURED_TAPIF variable +# Alternatively, add "export PRECONFIGURED_TAPIF=tap0" to ~/.bashrc + +# http://backreference.org/2010/03/26/tuntap-interface-tutorial/ + +# After executing this script, start example_app. +# Enter 192.168.1.200 or "http://lwip.local/" (Zeroconf) +# in your webbrowser to see example_app webpage. + +export PRECONFIGURED_TAPIF=tap0 + +sudo ip tuntap add dev $PRECONFIGURED_TAPIF mode tap user `whoami` +sudo ip link set $PRECONFIGURED_TAPIF up +sudo brctl addbr lwipbridge +sudo brctl addif lwipbridge $PRECONFIGURED_TAPIF +sudo ip addr add 192.168.1.1/24 dev lwipbridge +sudo ip link set dev lwipbridge up diff --git a/lwip/doc/FILES b/lwip/doc/FILES index 05d356f..e588575 100644 --- a/lwip/doc/FILES +++ b/lwip/doc/FILES @@ -1,6 +1,9 @@ +doxygen/ - Configuration files and scripts to create the lwIP doxygen source + documentation (found at http://www.nongnu.org/lwip/) + savannah.txt - How to obtain the current development source code. contrib.txt - How to contribute to lwIP as a developer. rawapi.txt - The documentation for the core API of lwIP. Also provides an overview about the other APIs and multithreading. -snmp_agent.txt - The documentation for the lwIP SNMP agent. sys_arch.txt - The documentation for a system abstraction layer of lwIP. +ppp.txt - Documentation of the PPP interface for lwIP. diff --git a/lwip/doc/NO_SYS_SampleCode.c b/lwip/doc/NO_SYS_SampleCode.c new file mode 100644 index 0000000..71f1c9f --- /dev/null +++ b/lwip/doc/NO_SYS_SampleCode.c @@ -0,0 +1,122 @@ +void +eth_mac_irq() +{ + /* Service MAC IRQ here */ + + /* Allocate pbuf from pool (avoid using heap in interrupts) */ + struct pbuf* p = pbuf_alloc(PBUF_RAW, eth_data_count, PBUF_POOL); + + if(p != NULL) { + /* Copy ethernet frame into pbuf */ + pbuf_take(p, eth_data, eth_data_count); + + /* Put in a queue which is processed in main loop */ + if(!queue_try_put(&queue, p)) { + /* queue is full -> packet loss */ + pbuf_free(p); + } + } +} + +static err_t +netif_output(struct netif *netif, struct pbuf *p) +{ + LINK_STATS_INC(link.xmit); + + /* Update SNMP stats (only if you use SNMP) */ + MIB2_STATS_NETIF_ADD(netif, ifoutoctets, p->tot_len); + int unicast = ((p->payload[0] & 0x01) == 0); + if (unicast) { + MIB2_STATS_NETIF_INC(netif, ifoutucastpkts); + } else { + MIB2_STATS_NETIF_INC(netif, ifoutnucastpkts); + } + + lock_interrupts(); + pbuf_copy_partial(p, mac_send_buffer, p->tot_len, 0); + /* Start MAC transmit here */ + unlock_interrupts(); + + return ERR_OK; +} + +static void +netif_status_callback(struct netif *netif) +{ + printf("netif status changed %s\n", ip4addr_ntoa(netif_ip4_addr(netif))); +} + +static err_t +netif_init(struct netif *netif) +{ + netif->linkoutput = netif_output; + netif->output = etharp_output; + netif->output_ip6 = ethip6_output; + netif->mtu = ETHERNET_MTU; + netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_ETHERNET | NETIF_FLAG_IGMP | NETIF_FLAG_MLD6; + MIB2_INIT_NETIF(netif, snmp_ifType_ethernet_csmacd, 100000000); + + SMEMCPY(netif->hwaddr, your_mac_address_goes_here, ETH_HWADDR_LEN); + netif->hwaddr_len = ETH_HWADDR_LEN; + + return ERR_OK; +} + +void +main(void) +{ + struct netif netif; + + lwip_init(); + + netif_add(&netif, IP4_ADDR_ANY, IP4_ADDR_ANY, IP4_ADDR_ANY, NULL, netif_init, netif_input); + netif.name[0] = 'e'; + netif.name[1] = '0'; + netif_create_ip6_linklocal_address(&netif, 1); + netif.ip6_autoconfig_enabled = 1; + netif_set_status_callback(&netif, netif_status_callback); + netif_set_default(&netif); + netif_set_up(&netif); + + /* Start DHCP and HTTPD */ + dhcp_start(&netif ); + httpd_init(); + + while(1) { + /* Check link state, e.g. via MDIO communication with PHY */ + if(link_state_changed()) { + if(link_is_up()) { + netif_set_link_up(&netif); + } else { + netif_set_link_down(&netif); + } + } + + /* Check for received frames, feed them to lwIP */ + lock_interrupts(); + struct pbuf* p = queue_try_get(&queue); + unlock_interrupts(); + + if(p != NULL) { + LINK_STATS_INC(link.recv); + + /* Update SNMP stats (only if you use SNMP) */ + MIB2_STATS_NETIF_ADD(netif, ifinoctets, p->tot_len); + int unicast = ((p->payload[0] & 0x01) == 0); + if (unicast) { + MIB2_STATS_NETIF_INC(netif, ifinucastpkts); + } else { + MIB2_STATS_NETIF_INC(netif, ifinnucastpkts); + } + + if(netif.input(p, &netif) != ERR_OK) { + pbuf_free(p); + } + } + + /* Cyclic lwIP timers check */ + sys_check_timeouts(); + + /* your application goes here */ + } +} diff --git a/lwip/doc/ZeroCopyRx.c b/lwip/doc/ZeroCopyRx.c new file mode 100644 index 0000000..0e8219b --- /dev/null +++ b/lwip/doc/ZeroCopyRx.c @@ -0,0 +1,45 @@ +typedef struct my_custom_pbuf +{ + struct pbuf_custom p; + void* dma_descriptor; +} my_custom_pbuf_t; + +LWIP_MEMPOOL_DECLARE(RX_POOL, 10, sizeof(my_custom_pbuf_t), "Zero-copy RX PBUF pool"); + +void my_pbuf_free_custom(void* p) +{ + SYS_ARCH_DECL_PROTECT(old_level); + + my_custom_pbuf_t* my_puf = (my_custom_pbuf_t*)p; + + // invalidate data cache here - lwIP and/or application may have written into buffer! + // (invalidate is faster than flushing, and noone needs the correct data in the buffer) + invalidate_cpu_cache(p->payload, p->tot_len); + + SYS_ARCH_PROTECT(old_level); + free_rx_dma_descriptor(my_pbuf->dma_descriptor); + LWIP_MEMPOOL_FREE(RX_POOL, my_pbuf); + SYS_ARCH_UNPROTECT(old_level); +} + +void eth_rx_irq() +{ + dma_descriptor* dma_desc = get_RX_DMA_descriptor_from_ethernet(); + my_custom_pbuf_t* my_pbuf = (my_custom_pbuf_t*)LWIP_MEMPOOL_ALLOC(RX_POOL); + + my_pbuf->p.custom_free_function = my_pbuf_free_custom; + my_pbuf->dma_descriptor = dma_desc; + + invalidate_cpu_cache(dma_desc->rx_data, dma_desc->rx_length); + + struct pbuf* p = pbuf_alloced_custom(PBUF_RAW, + dma_desc->rx_length, + PBUF_REF, + &my_pbuf->p, + dma_desc->rx_data, + dma_desc->max_buffer_size); + + if(netif->input(p, netif) != ERR_OK) { + pbuf_free(p); + } +} diff --git a/lwip/doc/contrib.txt b/lwip/doc/contrib.txt index b986020..2a44857 100644 --- a/lwip/doc/contrib.txt +++ b/lwip/doc/contrib.txt @@ -34,26 +34,25 @@ features of Savannah help us not lose users' input. 2.3 Bug reports and patches: 1. Make sure you are reporting bugs or send patches against the latest - sources. (From the latest release and/or the current CVS sources.) + sources. (From the latest release and/or the current Git sources.) 2. If you think you found a bug make sure it's not already filed in the bugtracker at Savannah. 3. If you have a fix put the patch on Savannah. If it is a patch that affects both core and arch specific stuff please separate them so that the core can - be applied separately while leaving the other patch 'open'. The prefered way + be applied separately while leaving the other patch 'open'. The preferred way is to NOT touch archs you can't test and let maintainers take care of them. This is a good way to see if they are used at all - the same goes for unix netifs except tapif. 4. Do not file a bug and post a fix to it to the patch area. Either a bug report or a patch will be enough. If you correct an existing bug then attach the patch to the bug rather than creating a new entry in the patch area. -5. Patches should be specific to a single change or to related changes.Do not mix bugfixes with spelling and other - trivial fixes unless the bugfix is trivial too.Do not reorganize code and rename identifiers in the same patch you - change behaviour if not necessary.A patch is easier to read and understand if it's to the point and short than +5. Patches should be specific to a single change or to related changes. Do not mix bugfixes with spelling and other + trivial fixes unless the bugfix is trivial too. Do not reorganize code and rename identifiers in the same patch you + change behaviour if not necessary. A patch is easier to read and understand if it's to the point and short than if it's not to the point and long :) so the chances for it to be applied are greater. 2.4 Platform porters: 1. If you have ported lwIP to a platform (an OS, a uC/processor or a combination of these) and you think it could benefit others[1] you might want discuss this on the mailing list. You - can also ask for CVS access to submit and maintain your port in the contrib CVS module. - \ No newline at end of file + can also ask for Git access to submit and maintain your port in the lwIP/contrib subdir. diff --git a/lwip/doc/doxygen/generate.bat b/lwip/doc/doxygen/generate.bat new file mode 100644 index 0000000..99afb12 --- /dev/null +++ b/lwip/doc/doxygen/generate.bat @@ -0,0 +1 @@ +doxygen lwip.Doxyfile diff --git a/lwip/doc/doxygen/generate.sh b/lwip/doc/doxygen/generate.sh new file mode 100755 index 0000000..89344b0 --- /dev/null +++ b/lwip/doc/doxygen/generate.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +doxygen lwip.Doxyfile diff --git a/lwip/doc/doxygen/lwip.Doxyfile b/lwip/doc/doxygen/lwip.Doxyfile new file mode 100644 index 0000000..750e0ad --- /dev/null +++ b/lwip/doc/doxygen/lwip.Doxyfile @@ -0,0 +1,2531 @@ +# Doxyfile 1.8.13 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all text +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv +# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv +# for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = "lwIP" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = "2.2.0.dev" + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "Lightweight IP stack" + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = "output" + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = "The $name class " \ + "The $name widget " \ + "The $name file " \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = ../../ + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, +# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: +# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: +# Fortran. In the later case the parser tries to guess whether the code is fixed +# or free formatted code, this is the default for Fortran type files), VHDL. For +# instance to make doxygen treat .inc files as Fortran files (default is PHP), +# and .f files as C (default is Fortran), use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 0. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 0 + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = YES + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = YES + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# (class|struct|union) declarations. If set to NO, these declarations will be +# included in the documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES, upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. +# The default value is: system dependent. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. + +GENERATE_TODOLIST = NO + +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong or incomplete +# parameter documentation, but not about the absence of documentation. +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. +# The default value is: NO. + +WARN_AS_ERROR = YES + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text " + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. + +INPUT = main_page.h \ + ../../src + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, +# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, +# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.idl \ + *.odl \ + *.inc \ + *.m \ + *.mm \ + *.dox + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = ../../src/include/netif/ppp/polarssl + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = ../ \ + ../../ + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = main_page.h + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# function all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see http://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = NO + +# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the +# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the +# cost of reduced performance. This can be particularly helpful with template +# rich C++ code for which doxygen's built-in parser lacks the necessary type +# information. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse-libclang=ON option for CMake. +# The default value is: NO. + +CLANG_ASSISTED_PARSING = NO + +# If clang assisted parsing is enabled you can provide the compiler with command +# line options that you would normally use when invoking the compiler. Note that +# the include paths will already be set by doxygen for the files and directories +# specified with INPUT and INCLUDE_PATH. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_OPTIONS = + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = NO + +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = NO + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: http://developer.apple.com/tools/xcode/), introduced with +# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = lwip.chm + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the master .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- +# folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = YES + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# http://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from http://www.mathjax.org before deployment. +# The default value is: http://cdn.mathjax.org/mathjax/latest. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /