├── README ├── apps ├── README ├── dhcpc │ ├── Makefile.dhcpc │ ├── dhcpc.c │ └── dhcpc.h ├── hello-world │ ├── Makefile.hello-world │ ├── hello-world.c │ └── hello-world.h ├── resolv │ ├── Makefile.resolv │ ├── resolv.c │ └── resolv.h ├── smtp │ ├── Makefile.smtp │ ├── makestrings │ ├── smtp-strings │ ├── smtp-strings.c │ ├── smtp-strings.h │ ├── smtp.c │ └── smtp.h ├── telnetd │ ├── Makefile.telnetd │ ├── shell.c │ ├── shell.h │ ├── telnetd.c │ └── telnetd.h ├── webclient │ ├── Makefile.webclient │ ├── makestrings │ ├── webclient-strings │ ├── webclient-strings.c │ ├── webclient-strings.h │ ├── webclient.c │ └── webclient.h └── webserver │ ├── Makefile.webserver │ ├── http-strings │ ├── http-strings.c │ ├── http-strings.h │ ├── httpd-cgi.c │ ├── httpd-cgi.h │ ├── httpd-fs.c │ ├── httpd-fs.h │ ├── httpd-fs │ ├── 404.html │ ├── fade.png │ ├── files.shtml │ ├── footer.html │ ├── header.html │ ├── index.html │ ├── processes.shtml │ ├── stats.shtml │ ├── style.css │ └── tcp.shtml │ ├── httpd-fsdata.c │ ├── httpd-fsdata.h │ ├── httpd.c │ ├── httpd.h │ ├── makefsdata │ ├── makestrings │ └── webserver.h ├── doc ├── Doxyfile ├── Makefile ├── README ├── doxygen.sty ├── example-mainloop-with-arp.c ├── example-mainloop-without-arp.c ├── examples.txt ├── header.tex ├── html │ ├── a00036.html │ ├── a00037.html │ ├── a00038.html │ ├── a00039.html │ ├── a00040.html │ ├── a00041.html │ ├── a00042.html │ ├── a00043.html │ ├── a00044.html │ ├── a00045.html │ ├── a00046.html │ ├── a00047.html │ ├── a00048.html │ ├── a00049.html │ ├── a00050.html │ ├── a00051.html │ ├── a00077.html │ ├── a00078.html │ ├── a00079.html │ ├── a00080.html │ ├── a00081.html │ ├── a00082.html │ ├── a00083.html │ ├── a00084.html │ ├── a00085.html │ ├── a00086.html │ ├── a00087.html │ ├── a00088.html │ ├── a00089.html │ ├── a00090.html │ ├── a00091.html │ ├── a00092.html │ ├── a00093.html │ ├── a00094.html │ ├── a00095.html │ ├── a00096.html │ ├── a00097.html │ ├── a00100.html │ ├── a00101.html │ ├── a00102.html │ ├── a00103.html │ ├── a00104.html │ ├── a00105.html │ ├── a00107.html │ ├── a00110.html │ ├── a00111.html │ ├── a00112.html │ ├── a00113.html │ ├── a00114.html │ ├── a00120.html │ ├── a00121.html │ ├── a00123.html │ ├── a00124.html │ ├── a00125.html │ ├── a00127.html │ ├── a00128.html │ ├── a00129.html │ ├── a00130.html │ ├── a00131.html │ ├── a00132.html │ ├── a00134.html │ ├── a00135.html │ ├── a00136.html │ ├── a00137.html │ ├── a00138.html │ ├── a00139.html │ ├── a00140.html │ ├── a00141.html │ ├── a00142.html │ ├── a00143.html │ ├── a00144.html │ ├── a00145.html │ ├── a00146.html │ ├── a00147.html │ ├── a00148.html │ ├── a00149.html │ ├── a00150.html │ ├── a00151.html │ ├── a00152.html │ ├── a00153.html │ ├── a00154.html │ ├── a00155.html │ ├── a00156.html │ ├── a00157.html │ ├── a00158.html │ ├── a00159.html │ ├── a00160.html │ ├── a00161.html │ ├── a00162.html │ ├── a00163.html │ ├── a00164.html │ ├── a00168.html │ ├── a00169.html │ ├── a00170.html │ ├── a00171.html │ ├── a00172.html │ ├── a00173.html │ ├── a00174.html │ ├── a00175.html │ ├── a00176.html │ ├── a00177.html │ ├── a00178.html │ ├── a00179.html │ ├── a00180.html │ ├── a00181.html │ ├── a00182.html │ ├── a00183.html │ ├── a00184.html │ ├── a00185.html │ ├── a00186.html │ ├── a00187.html │ ├── a00188.html │ ├── a00189.html │ ├── a00190.html │ ├── a00191.html │ ├── a00192.html │ ├── a00193.html │ ├── a00194.html │ ├── a00195.html │ ├── a00196.html │ ├── a00197.html │ ├── a00198.html │ ├── a00199.html │ ├── a00200.html │ ├── a00201.html │ ├── a00202.html │ ├── a00203.html │ ├── a00204.html │ ├── a00205.html │ ├── a00206.html │ ├── a00207.html │ ├── annotated.html │ ├── classes.html │ ├── doxygen.css │ ├── doxygen.png │ ├── examples.html │ ├── files.html │ ├── ftv2blank.png │ ├── ftv2doc.png │ ├── ftv2folderclosed.png │ ├── ftv2folderopen.png │ ├── ftv2lastnode.png │ ├── ftv2link.png │ ├── ftv2mlastnode.png │ ├── ftv2mnode.png │ ├── ftv2node.png │ ├── ftv2plastnode.png │ ├── ftv2pnode.png │ ├── ftv2vertline.png │ ├── functions.html │ ├── functions_vars.html │ ├── globals.html │ ├── globals_0x61.html │ ├── globals_0x62.html │ ├── globals_0x64.html │ ├── globals_0x65.html │ ├── globals_0x66.html │ ├── globals_0x68.html │ ├── globals_0x69.html │ ├── globals_0x6c.html │ ├── globals_0x6d.html │ ├── globals_0x6e.html │ ├── globals_0x70.html │ ├── globals_0x72.html │ ├── globals_0x73.html │ ├── globals_0x74.html │ ├── globals_0x75.html │ ├── globals_0x77.html │ ├── globals_defs.html │ ├── globals_defs_0x61.html │ ├── globals_defs_0x62.html │ ├── globals_defs_0x64.html │ ├── globals_defs_0x65.html │ ├── globals_defs_0x66.html │ ├── globals_defs_0x68.html │ ├── globals_defs_0x69.html │ ├── globals_defs_0x6c.html │ ├── globals_defs_0x6d.html │ ├── globals_defs_0x6e.html │ ├── globals_defs_0x70.html │ ├── globals_defs_0x72.html │ ├── globals_defs_0x73.html │ ├── globals_defs_0x74.html │ ├── globals_defs_0x75.html │ ├── globals_defs_0x77.html │ ├── globals_func.html │ ├── globals_type.html │ ├── globals_vars.html │ ├── hierarchy.html │ ├── index.hhc │ ├── index.hhk │ ├── index.hhp │ ├── index.html │ ├── main.html │ ├── modules.html │ ├── tab_b.gif │ ├── tab_l.gif │ ├── tab_r.gif │ ├── tabs.css │ └── tree.html ├── mobisys2003.pdf ├── pt-doc.txt ├── sicslogo.pdf ├── uip-code-style.c ├── uip-code-style.txt ├── uip-doc.txt └── uip-refman.pdf ├── lib ├── memb.c └── memb.h ├── uip-1.0-changelog.txt ├── uip ├── Makefile.include ├── clock.h ├── lc-addrlabels.h ├── lc-switch.h ├── lc.h ├── psock.c ├── psock.h ├── pt.h ├── timer.c ├── timer.h ├── uip-fw.c ├── uip-fw.h ├── uip-neighbor.c ├── uip-neighbor.h ├── uip-split.c ├── uip-split.h ├── uip.c ├── uip.h ├── uip_arch.h ├── uip_arp.c ├── uip_arp.h ├── uiplib.c ├── uiplib.h └── uipopt.h └── unix ├── Makefile ├── clock-arch.c ├── clock-arch.h ├── main.c ├── tapdev.c ├── tapdev.h └── uip-conf.h /README: -------------------------------------------------------------------------------- 1 | uIP is a very small implementation of the TCP/IP stack that is written 2 | by Adam Dunkels . More information can be obtained 3 | at the uIP homepage at http://www.sics.se/~adam/uip/. 4 | 5 | This is version $Name: uip-1-0 $. 6 | 7 | The directory structure look as follows: 8 | 9 | apps/ - Example applications 10 | doc/ - Documentation 11 | lib/ - Library code used by some applications 12 | uip/ - uIP TCP/IP stack code 13 | unix/ - uIP as a user space process under FreeBSD or Linux 14 | -------------------------------------------------------------------------------- /apps/README: -------------------------------------------------------------------------------- 1 | This directory contains a few example applications. They are not all 2 | heavily tested, however. 3 | -------------------------------------------------------------------------------- /apps/dhcpc/Makefile.dhcpc: -------------------------------------------------------------------------------- 1 | APP_SOURCES += dhcpc.c timer.c 2 | -------------------------------------------------------------------------------- /apps/dhcpc/dhcpc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2005, Swedish Institute of Computer Science 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * This file is part of the uIP TCP/IP stack 30 | * 31 | * @(#)$Id: dhcpc.h,v 1.3 2006/06/11 21:46:37 adam Exp $ 32 | */ 33 | #ifndef __DHCPC_H__ 34 | #define __DHCPC_H__ 35 | 36 | #include "timer.h" 37 | #include "pt.h" 38 | 39 | struct dhcpc_state { 40 | struct pt pt; 41 | char state; 42 | struct uip_udp_conn *conn; 43 | struct timer timer; 44 | u16_t ticks; 45 | const void *mac_addr; 46 | int mac_len; 47 | 48 | u8_t serverid[4]; 49 | 50 | u16_t lease_time[2]; 51 | u16_t ipaddr[2]; 52 | u16_t netmask[2]; 53 | u16_t dnsaddr[2]; 54 | u16_t default_router[2]; 55 | }; 56 | 57 | void dhcpc_init(const void *mac_addr, int mac_len); 58 | void dhcpc_request(void); 59 | 60 | void dhcpc_appcall(void); 61 | 62 | void dhcpc_configured(const struct dhcpc_state *s); 63 | 64 | typedef struct dhcpc_state uip_udp_appstate_t; 65 | #define UIP_UDP_APPCALL dhcpc_appcall 66 | 67 | 68 | #endif /* __DHCPC_H__ */ 69 | -------------------------------------------------------------------------------- /apps/hello-world/Makefile.hello-world: -------------------------------------------------------------------------------- 1 | APP_SOURCES += hello-world.c 2 | -------------------------------------------------------------------------------- /apps/hello-world/hello-world.c: -------------------------------------------------------------------------------- 1 | /** 2 | * \addtogroup helloworld 3 | * @{ 4 | */ 5 | 6 | /** 7 | * \file 8 | * An example of how to write uIP applications 9 | * with protosockets. 10 | * \author 11 | * Adam Dunkels 12 | */ 13 | 14 | /* 15 | * This is a short example of how to write uIP applications using 16 | * protosockets. 17 | */ 18 | 19 | /* 20 | * We define the application state (struct hello_world_state) in the 21 | * hello-world.h file, so we need to include it here. We also include 22 | * uip.h (since this cannot be included in hello-world.h) and 23 | * , since we use the memcpy() function in the code. 24 | */ 25 | #include "hello-world.h" 26 | #include "uip.h" 27 | #include 28 | 29 | /* 30 | * Declaration of the protosocket function that handles the connection 31 | * (defined at the end of the code). 32 | */ 33 | static int handle_connection(struct hello_world_state *s); 34 | /*---------------------------------------------------------------------------*/ 35 | /* 36 | * The initialization function. We must explicitly call this function 37 | * from the system initialization code, some time after uip_init() is 38 | * called. 39 | */ 40 | void 41 | hello_world_init(void) 42 | { 43 | /* We start to listen for connections on TCP port 1000. */ 44 | uip_listen(HTONS(1000)); 45 | } 46 | /*---------------------------------------------------------------------------*/ 47 | /* 48 | * In hello-world.h we have defined the UIP_APPCALL macro to 49 | * hello_world_appcall so that this funcion is uIP's application 50 | * function. This function is called whenever an uIP event occurs 51 | * (e.g. when a new connection is established, new data arrives, sent 52 | * data is acknowledged, data needs to be retransmitted, etc.). 53 | */ 54 | void 55 | hello_world_appcall(void) 56 | { 57 | /* 58 | * The uip_conn structure has a field called "appstate" that holds 59 | * the application state of the connection. We make a pointer to 60 | * this to access it easier. 61 | */ 62 | struct hello_world_state *s = &(uip_conn->appstate); 63 | 64 | /* 65 | * If a new connection was just established, we should initialize 66 | * the protosocket in our applications' state structure. 67 | */ 68 | if(uip_connected()) { 69 | PSOCK_INIT(&s->p, s->inputbuffer, sizeof(s->inputbuffer)); 70 | } 71 | 72 | /* 73 | * Finally, we run the protosocket function that actually handles 74 | * the communication. We pass it a pointer to the application state 75 | * of the current connection. 76 | */ 77 | handle_connection(s); 78 | } 79 | /*---------------------------------------------------------------------------*/ 80 | /* 81 | * This is the protosocket function that handles the communication. A 82 | * protosocket function must always return an int, but must never 83 | * explicitly return - all return statements are hidden in the PSOCK 84 | * macros. 85 | */ 86 | static int 87 | handle_connection(struct hello_world_state *s) 88 | { 89 | PSOCK_BEGIN(&s->p); 90 | 91 | PSOCK_SEND_STR(&s->p, "Hello. What is your name?\n"); 92 | PSOCK_READTO(&s->p, '\n'); 93 | strncpy(s->name, s->inputbuffer, sizeof(s->name)); 94 | PSOCK_SEND_STR(&s->p, "Hello "); 95 | PSOCK_SEND_STR(&s->p, s->name); 96 | PSOCK_CLOSE(&s->p); 97 | 98 | PSOCK_END(&s->p); 99 | } 100 | /*---------------------------------------------------------------------------*/ 101 | -------------------------------------------------------------------------------- /apps/hello-world/hello-world.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \addtogroup apps 3 | * @{ 4 | */ 5 | 6 | /** 7 | * \defgroup helloworld Hello, world 8 | * @{ 9 | * 10 | * A small example showing how to write applications with 11 | * \ref psock "protosockets". 12 | */ 13 | 14 | /** 15 | * \file 16 | * Header file for an example of how to write uIP applications 17 | * with protosockets. 18 | * \author 19 | * Adam Dunkels 20 | */ 21 | 22 | #ifndef __HELLO_WORLD_H__ 23 | #define __HELLO_WORLD_H__ 24 | 25 | /* Since this file will be included by uip.h, we cannot include uip.h 26 | here. But we might need to include uipopt.h if we need the u8_t and 27 | u16_t datatypes. */ 28 | #include "uipopt.h" 29 | 30 | #include "psock.h" 31 | 32 | /* Next, we define the uip_tcp_appstate_t datatype. This is the state 33 | of our application, and the memory required for this state is 34 | allocated together with each TCP connection. One application state 35 | for each TCP connection. */ 36 | typedef struct hello_world_state { 37 | struct psock p; 38 | char inputbuffer[10]; 39 | char name[40]; 40 | } uip_tcp_appstate_t; 41 | 42 | /* Finally we define the application function to be called by uIP. */ 43 | void hello_world_appcall(void); 44 | #ifndef UIP_APPCALL 45 | #define UIP_APPCALL hello_world_appcall 46 | #endif /* UIP_APPCALL */ 47 | 48 | void hello_world_init(void); 49 | 50 | #endif /* __HELLO_WORLD_H__ */ 51 | /** @} */ 52 | /** @} */ 53 | -------------------------------------------------------------------------------- /apps/resolv/Makefile.resolv: -------------------------------------------------------------------------------- 1 | APP_SOURCES += resolv.c 2 | -------------------------------------------------------------------------------- /apps/resolv/resolv.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \addtogroup resolv 3 | * @{ 4 | */ 5 | /** 6 | * \file 7 | * DNS resolver code header file. 8 | * \author Adam Dunkels 9 | */ 10 | 11 | /* 12 | * Copyright (c) 2002-2003, Adam Dunkels. 13 | * All rights reserved. 14 | * 15 | * Redistribution and use in source and binary forms, with or without 16 | * modification, are permitted provided that the following conditions 17 | * are met: 18 | * 1. Redistributions of source code must retain the above copyright 19 | * notice, this list of conditions and the following disclaimer. 20 | * 2. Redistributions in binary form must reproduce the above copyright 21 | * notice, this list of conditions and the following disclaimer in the 22 | * documentation and/or other materials provided with the distribution. 23 | * 3. The name of the author may not be used to endorse or promote 24 | * products derived from this software without specific prior 25 | * written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 28 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 29 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 31 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 32 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 33 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 34 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 35 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 36 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 37 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | * 39 | * This file is part of the uIP TCP/IP stack. 40 | * 41 | * $Id: resolv.h,v 1.4 2006/06/11 21:46:37 adam Exp $ 42 | * 43 | */ 44 | #ifndef __RESOLV_H__ 45 | #define __RESOLV_H__ 46 | 47 | typedef int uip_udp_appstate_t; 48 | void resolv_appcall(void); 49 | #define UIP_UDP_APPCALL resolv_appcall 50 | 51 | #include "uipopt.h" 52 | 53 | /** 54 | * Callback function which is called when a hostname is found. 55 | * 56 | * This function must be implemented by the module that uses the DNS 57 | * resolver. It is called when a hostname is found, or when a hostname 58 | * was not found. 59 | * 60 | * \param name A pointer to the name that was looked up. \param 61 | * ipaddr A pointer to a 4-byte array containing the IP address of the 62 | * hostname, or NULL if the hostname could not be found. 63 | */ 64 | void resolv_found(char *name, u16_t *ipaddr); 65 | 66 | /* Functions. */ 67 | void resolv_conf(u16_t *dnsserver); 68 | u16_t *resolv_getserver(void); 69 | void resolv_init(void); 70 | u16_t *resolv_lookup(char *name); 71 | void resolv_query(char *name); 72 | 73 | #endif /* __RESOLV_H__ */ 74 | 75 | /** @} */ 76 | -------------------------------------------------------------------------------- /apps/smtp/Makefile.smtp: -------------------------------------------------------------------------------- 1 | APP_SOURCES += smtp.c smtp-strings.c memb.c 2 | -------------------------------------------------------------------------------- /apps/smtp/makestrings: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | 4 | sub stringify { 5 | my $name = shift(@_); 6 | open(OUTPUTC, "> $name.c"); 7 | open(OUTPUTH, "> $name.h"); 8 | 9 | open(FILE, "$name"); 10 | 11 | while() { 12 | if(/(.+) "(.+)"/) { 13 | $var = $1; 14 | $data = $2; 15 | 16 | $datan = $data; 17 | $datan =~ s/\\r/\r/g; 18 | $datan =~ s/\\n/\n/g; 19 | $datan =~ s/\\01/\01/g; 20 | $datan =~ s/\\0/\0/g; 21 | 22 | printf(OUTPUTC "const char $var\[%d] = \n", length($datan) + 1); 23 | printf(OUTPUTC "/* \"$data\" */\n"); 24 | printf(OUTPUTC "{"); 25 | for($j = 0; $j < length($datan); $j++) { 26 | printf(OUTPUTC "%#02x, ", unpack("C", substr($datan, $j, 1))); 27 | } 28 | printf(OUTPUTC "};\n"); 29 | 30 | printf(OUTPUTH "extern const char $var\[%d];\n", length($datan) + 1); 31 | 32 | } 33 | } 34 | close(OUTPUTC); 35 | close(OUTPUTH); 36 | } 37 | stringify("smtp-strings"); 38 | 39 | exit 0; 40 | 41 | -------------------------------------------------------------------------------- /apps/smtp/smtp-strings: -------------------------------------------------------------------------------- 1 | smtp_220 "220" 2 | smtp_helo "HELO " 3 | smtp_mail_from "MAIL FROM: " 4 | smtp_rcpt_to "RCPT TO: " 5 | smtp_data "DATA\r\n" 6 | smtp_to "To: " 7 | smtp_from "From: " 8 | smtp_subject "Subject: " 9 | smtp_quit "QUIT\r\n" 10 | smtp_crnl "\r\n" 11 | smtp_crnlperiodcrnl "\r\n.\r\n" -------------------------------------------------------------------------------- /apps/smtp/smtp-strings.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, Adam Dunkels. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * This file is part of the uIP TCP/IP stack 30 | * 31 | * Author: Adam Dunkels 32 | * 33 | * $Id: smtp-strings.c,v 1.3 2006/06/11 21:46:37 adam Exp $ 34 | */ 35 | const char smtp_220[4] = 36 | /* "220" */ 37 | {0x32, 0x32, 0x30, }; 38 | const char smtp_helo[6] = 39 | /* "HELO " */ 40 | {0x48, 0x45, 0x4c, 0x4f, 0x20, }; 41 | const char smtp_mail_from[12] = 42 | /* "MAIL FROM: " */ 43 | {0x4d, 0x41, 0x49, 0x4c, 0x20, 0x46, 0x52, 0x4f, 0x4d, 0x3a, 0x20, }; 44 | const char smtp_rcpt_to[10] = 45 | /* "RCPT TO: " */ 46 | {0x52, 0x43, 0x50, 0x54, 0x20, 0x54, 0x4f, 0x3a, 0x20, }; 47 | const char smtp_data[7] = 48 | /* "DATA\r\n" */ 49 | {0x44, 0x41, 0x54, 0x41, 0xd, 0xa, }; 50 | const char smtp_to[5] = 51 | /* "To: " */ 52 | {0x54, 0x6f, 0x3a, 0x20, }; 53 | const char smtp_cc[5] = 54 | /* "Cc: " */ 55 | {0x43, 0x63, 0x3a, 0x20, }; 56 | const char smtp_from[7] = 57 | /* "From: " */ 58 | {0x46, 0x72, 0x6f, 0x6d, 0x3a, 0x20, }; 59 | const char smtp_subject[10] = 60 | /* "Subject: " */ 61 | {0x53, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x3a, 0x20, }; 62 | const char smtp_quit[7] = 63 | /* "QUIT\r\n" */ 64 | {0x51, 0x55, 0x49, 0x54, 0xd, 0xa, }; 65 | const char smtp_crnl[3] = 66 | /* "\r\n" */ 67 | {0xd, 0xa, }; 68 | const char smtp_crnlperiodcrnl[6] = 69 | /* "\r\n.\r\n" */ 70 | {0xd, 0xa, 0x2e, 0xd, 0xa, }; 71 | -------------------------------------------------------------------------------- /apps/smtp/smtp-strings.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, Adam Dunkels. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * This file is part of the uIP TCP/IP stack 30 | * 31 | * Author: Adam Dunkels 32 | * 33 | * $Id: smtp-strings.h,v 1.3 2006/06/11 21:46:37 adam Exp $ 34 | */ 35 | extern const char smtp_220[4]; 36 | extern const char smtp_helo[6]; 37 | extern const char smtp_mail_from[12]; 38 | extern const char smtp_rcpt_to[10]; 39 | extern const char smtp_data[7]; 40 | extern const char smtp_to[5]; 41 | extern const char smtp_cc[5]; 42 | extern const char smtp_from[7]; 43 | extern const char smtp_subject[10]; 44 | extern const char smtp_quit[7]; 45 | extern const char smtp_crnl[3]; 46 | extern const char smtp_crnlperiodcrnl[6]; 47 | -------------------------------------------------------------------------------- /apps/smtp/smtp.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * \addtogroup smtp 4 | * @{ 5 | */ 6 | 7 | 8 | /** 9 | * \file 10 | * SMTP header file 11 | * \author Adam Dunkels 12 | */ 13 | 14 | /* 15 | * Copyright (c) 2002, Adam Dunkels. 16 | * All rights reserved. 17 | * 18 | * Redistribution and use in source and binary forms, with or without 19 | * modification, are permitted provided that the following conditions 20 | * are met: 21 | * 1. Redistributions of source code must retain the above copyright 22 | * notice, this list of conditions and the following disclaimer. 23 | * 2. Redistributions in binary form must reproduce the above copyright 24 | * notice, this list of conditions and the following disclaimer in the 25 | * documentation and/or other materials provided with the distribution. 26 | * 3. The name of the author may not be used to endorse or promote 27 | * products derived from this software without specific prior 28 | * written permission. 29 | * 30 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 31 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 32 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 33 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 34 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 35 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 36 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 37 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 38 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 39 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 40 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 41 | * 42 | * This file is part of the uIP TCP/IP stack. 43 | * 44 | * $Id: smtp.h,v 1.4 2006/06/11 21:46:37 adam Exp $ 45 | * 46 | */ 47 | #ifndef __SMTP_H__ 48 | #define __SMTP_H__ 49 | 50 | #include "uipopt.h" 51 | 52 | /** 53 | * Error number that signifies a non-error condition. 54 | */ 55 | #define SMTP_ERR_OK 0 56 | 57 | /** 58 | * Callback function that is called when an e-mail transmission is 59 | * done. 60 | * 61 | * This function must be implemented by the module that uses the SMTP 62 | * module. 63 | * 64 | * \param error The number of the error if an error occured, or 65 | * SMTP_ERR_OK. 66 | */ 67 | void smtp_done(unsigned char error); 68 | 69 | void smtp_init(void); 70 | 71 | /* Functions. */ 72 | void smtp_configure(char *localhostname, u16_t *smtpserver); 73 | unsigned char smtp_send(char *to, char *from, 74 | char *subject, char *msg, 75 | u16_t msglen); 76 | #define SMTP_SEND(to, cc, from, subject, msg) \ 77 | smtp_send(to, cc, from, subject, msg, strlen(msg)) 78 | 79 | void smtp_appcall(void); 80 | 81 | struct smtp_state { 82 | u8_t state; 83 | char *to; 84 | char *from; 85 | char *subject; 86 | char *msg; 87 | u16_t msglen; 88 | 89 | u16_t sentlen, textlen; 90 | u16_t sendptr; 91 | 92 | }; 93 | 94 | 95 | #ifndef UIP_APPCALL 96 | #define UIP_APPCALL smtp_appcall 97 | #endif 98 | typedef struct smtp_state uip_tcp_appstate_t; 99 | 100 | 101 | #endif /* __SMTP_H__ */ 102 | 103 | /** @} */ 104 | -------------------------------------------------------------------------------- /apps/telnetd/Makefile.telnetd: -------------------------------------------------------------------------------- 1 | APP_SOURCES += telnetd.c shell.c memb.c 2 | -------------------------------------------------------------------------------- /apps/telnetd/shell.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * Interface for the Contiki shell. 4 | * \author Adam Dunkels 5 | * 6 | * Some of the functions declared in this file must be implemented as 7 | * a shell back-end in the architecture specific files of a Contiki 8 | * port. 9 | */ 10 | 11 | 12 | /* 13 | * Copyright (c) 2003, Adam Dunkels. 14 | * All rights reserved. 15 | * 16 | * Redistribution and use in source and binary forms, with or without 17 | * modification, are permitted provided that the following conditions 18 | * are met: 19 | * 1. Redistributions of source code must retain the above copyright 20 | * notice, this list of conditions and the following disclaimer. 21 | * 2. Redistributions in binary form must reproduce the above copyright 22 | * notice, this list of conditions and the following disclaimer in the 23 | * documentation and/or other materials provided with the distribution. 24 | * 3. The name of the author may not be used to endorse or promote 25 | * products derived from this software without specific prior 26 | * written permission. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 29 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 30 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 31 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 32 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 34 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 35 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 36 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 37 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 38 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | * This file is part of the Contiki desktop OS. 41 | * 42 | * $Id: shell.h,v 1.1 2006/06/07 09:43:54 adam Exp $ 43 | * 44 | */ 45 | #ifndef __SHELL_H__ 46 | #define __SHELL_H__ 47 | 48 | /** 49 | * Initialize the shell. 50 | * 51 | * Called when the shell front-end process starts. This function may 52 | * be used to start listening for signals. 53 | */ 54 | void shell_init(void); 55 | 56 | /** 57 | * Start the shell back-end. 58 | * 59 | * Called by the front-end when a new shell is started. 60 | */ 61 | void shell_start(void); 62 | 63 | /** 64 | * Process a shell command. 65 | * 66 | * This function will be called by the shell GUI / telnet server whan 67 | * a command has been entered that should be processed by the shell 68 | * back-end. 69 | * 70 | * \param command The command to be processed. 71 | */ 72 | void shell_input(char *command); 73 | 74 | /** 75 | * Quit the shell. 76 | * 77 | */ 78 | void shell_quit(char *); 79 | 80 | 81 | /** 82 | * Print a string to the shell window. 83 | * 84 | * This function is implemented by the shell GUI / telnet server and 85 | * can be called by the shell back-end to output a string in the 86 | * shell window. The string is automatically appended with a linebreak. 87 | * 88 | * \param str1 The first half of the string to be output. 89 | * \param str2 The second half of the string to be output. 90 | */ 91 | void shell_output(char *str1, char *str2); 92 | 93 | /** 94 | * Print a prompt to the shell window. 95 | * 96 | * This function can be used by the shell back-end to print out a 97 | * prompt to the shell window. 98 | * 99 | * \param prompt The prompt to be printed. 100 | * 101 | */ 102 | void shell_prompt(char *prompt); 103 | 104 | #endif /* __SHELL_H__ */ 105 | -------------------------------------------------------------------------------- /apps/telnetd/telnetd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003, Adam Dunkels. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following 12 | * disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote 15 | * products derived from this software without specific prior 16 | * written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 19 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 24 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | * This file is part of the uIP TCP/IP stack 31 | * 32 | * $Id: telnetd.h,v 1.2 2006/06/07 09:43:54 adam Exp $ 33 | * 34 | */ 35 | #ifndef __TELNETD_H__ 36 | #define __TELNETD_H__ 37 | 38 | #include "uipopt.h" 39 | 40 | void telnetd_appcall(void); 41 | 42 | #ifndef TELNETD_CONF_LINELEN 43 | #define TELNETD_CONF_LINELEN 40 44 | #endif 45 | #ifndef TELNETD_CONF_NUMLINES 46 | #define TELNETD_CONF_NUMLINES 16 47 | #endif 48 | 49 | struct telnetd_state { 50 | char *lines[TELNETD_CONF_NUMLINES]; 51 | char buf[TELNETD_CONF_LINELEN]; 52 | char bufptr; 53 | u8_t numsent; 54 | u8_t state; 55 | }; 56 | 57 | typedef struct telnetd_state uip_tcp_appstate_t; 58 | 59 | #ifndef UIP_APPCALL 60 | #define UIP_APPCALL telnetd_appcall 61 | #endif 62 | 63 | #endif /* __TELNETD_H__ */ 64 | -------------------------------------------------------------------------------- /apps/webclient/Makefile.webclient: -------------------------------------------------------------------------------- 1 | APP_SOURCES += webclient-strings.c webclient.c 2 | -------------------------------------------------------------------------------- /apps/webclient/makestrings: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | 4 | sub stringify { 5 | my $name = shift(@_); 6 | open(OUTPUTC, "> $name.c"); 7 | open(OUTPUTH, "> $name.h"); 8 | 9 | open(FILE, "$name"); 10 | 11 | while() { 12 | if(/(.+) "(.+)"/) { 13 | $var = $1; 14 | $data = $2; 15 | 16 | $datan = $data; 17 | $datan =~ s/\\r/\r/g; 18 | $datan =~ s/\\n/\n/g; 19 | $datan =~ s/\\01/\01/g; 20 | $datan =~ s/\\0/\0/g; 21 | 22 | printf(OUTPUTC "const char $var\[%d] = \n", length($datan) + 1); 23 | printf(OUTPUTC "/* \"$data\" */\n"); 24 | printf(OUTPUTC "{"); 25 | for($j = 0; $j < length($datan); $j++) { 26 | printf(OUTPUTC "%#02x, ", unpack("C", substr($datan, $j, 1))); 27 | } 28 | printf(OUTPUTC "0 };\n"); 29 | 30 | printf(OUTPUTH "extern const char $var\[%d];\n", length($datan) + 1); 31 | 32 | } 33 | } 34 | close(OUTPUTC); 35 | close(OUTPUTH); 36 | } 37 | stringify("webclient-strings"); 38 | 39 | exit 0; 40 | 41 | -------------------------------------------------------------------------------- /apps/webclient/webclient-strings: -------------------------------------------------------------------------------- 1 | http_http "http://" 2 | http_200 "200 " 3 | http_301 "301 " 4 | http_302 "302 " 5 | http_get "GET " 6 | http_10 "HTTP/1.0" 7 | http_11 "HTTP/1.1" 8 | http_content_type "content-type: " 9 | http_texthtml "text/html" 10 | http_location "location: " 11 | http_host "host: " 12 | http_crnl "\r\n" 13 | http_index_html "/index.html" 14 | http_404_html "/404.html" 15 | http_content_type_html "Content-type: text/html\r\n\r\n" 16 | http_content_type_css "Content-type: text/css\r\n\r\n" 17 | http_content_type_text "Content-type: text/text\r\n\r\n" 18 | http_content_type_png "Content-type: image/png\r\n\r\n" 19 | http_content_type_gif "Content-type: image/gif\r\n\r\n" 20 | http_content_type_jpg "Content-type: image/jpeg\r\n\r\n" 21 | http_content_type_binary "Content-type: application/octet-stream\r\n\r\n" 22 | http_html ".html" 23 | http_shtml ".shtml" 24 | http_htm ".htm" 25 | http_css ".css" 26 | http_png ".png" 27 | http_gif ".gif" 28 | http_jpg ".jpg" 29 | http_text ".text" 30 | http_txt ".txt" 31 | http_user_agent_fields "Connection: close\r\nUser-Agent: uIP/1.0 (; http://www.sics.se/~adam/uip/)\r\n\r\n" 32 | -------------------------------------------------------------------------------- /apps/webclient/webclient-strings.h: -------------------------------------------------------------------------------- 1 | extern const char http_http[8]; 2 | extern const char http_200[5]; 3 | extern const char http_301[5]; 4 | extern const char http_302[5]; 5 | extern const char http_get[5]; 6 | extern const char http_10[9]; 7 | extern const char http_11[9]; 8 | extern const char http_content_type[15]; 9 | extern const char http_texthtml[10]; 10 | extern const char http_location[11]; 11 | extern const char http_host[7]; 12 | extern const char http_crnl[3]; 13 | extern const char http_index_html[12]; 14 | extern const char http_404_html[10]; 15 | extern const char http_content_type_html[28]; 16 | extern const char http_content_type_css [27]; 17 | extern const char http_content_type_text[28]; 18 | extern const char http_content_type_png [28]; 19 | extern const char http_content_type_gif [28]; 20 | extern const char http_content_type_jpg [29]; 21 | extern const char http_content_type_binary[43]; 22 | extern const char http_html[6]; 23 | extern const char http_shtml[7]; 24 | extern const char http_htm[5]; 25 | extern const char http_css[5]; 26 | extern const char http_png[5]; 27 | extern const char http_gif[5]; 28 | extern const char http_jpg[5]; 29 | extern const char http_text[6]; 30 | extern const char http_txt[5]; 31 | extern const char http_user_agent_fields[77]; 32 | -------------------------------------------------------------------------------- /apps/webserver/Makefile.webserver: -------------------------------------------------------------------------------- 1 | APP_SOURCES += httpd.c http-strings.c httpd-fs.c httpd-cgi.c 2 | -------------------------------------------------------------------------------- /apps/webserver/http-strings: -------------------------------------------------------------------------------- 1 | http_http "http://" 2 | http_200 "200 " 3 | http_301 "301 " 4 | http_302 "302 " 5 | http_get "GET " 6 | http_10 "HTTP/1.0" 7 | http_11 "HTTP/1.1" 8 | http_content_type "content-type: " 9 | http_texthtml "text/html" 10 | http_location "location: " 11 | http_host "host: " 12 | http_crnl "\r\n" 13 | http_index_html "/index.html" 14 | http_404_html "/404.html" 15 | http_referer "Referer:" 16 | http_header_200 "HTTP/1.0 200 OK\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n" 17 | http_header_404 "HTTP/1.0 404 Not found\r\nServer: uIP/1.0 http://www.sics.se/~adam/uip/\r\nConnection: close\r\n" 18 | http_content_type_plain "Content-type: text/plain\r\n\r\n" 19 | http_content_type_html "Content-type: text/html\r\n\r\n" 20 | http_content_type_css "Content-type: text/css\r\n\r\n" 21 | http_content_type_text "Content-type: text/text\r\n\r\n" 22 | http_content_type_png "Content-type: image/png\r\n\r\n" 23 | http_content_type_gif "Content-type: image/gif\r\n\r\n" 24 | http_content_type_jpg "Content-type: image/jpeg\r\n\r\n" 25 | http_content_type_binary "Content-type: application/octet-stream\r\n\r\n" 26 | http_html ".html" 27 | http_shtml ".shtml" 28 | http_htm ".htm" 29 | http_css ".css" 30 | http_png ".png" 31 | http_gif ".gif" 32 | http_jpg ".jpg" 33 | http_text ".txt" 34 | http_txt ".txt" 35 | 36 | -------------------------------------------------------------------------------- /apps/webserver/http-strings.h: -------------------------------------------------------------------------------- 1 | extern const char http_http[8]; 2 | extern const char http_200[5]; 3 | extern const char http_301[5]; 4 | extern const char http_302[5]; 5 | extern const char http_get[5]; 6 | extern const char http_10[9]; 7 | extern const char http_11[9]; 8 | extern const char http_content_type[15]; 9 | extern const char http_texthtml[10]; 10 | extern const char http_location[11]; 11 | extern const char http_host[7]; 12 | extern const char http_crnl[3]; 13 | extern const char http_index_html[12]; 14 | extern const char http_404_html[10]; 15 | extern const char http_referer[9]; 16 | extern const char http_header_200[84]; 17 | extern const char http_header_404[91]; 18 | extern const char http_content_type_plain[29]; 19 | extern const char http_content_type_html[28]; 20 | extern const char http_content_type_css [27]; 21 | extern const char http_content_type_text[28]; 22 | extern const char http_content_type_png [28]; 23 | extern const char http_content_type_gif [28]; 24 | extern const char http_content_type_jpg [29]; 25 | extern const char http_content_type_binary[43]; 26 | extern const char http_html[6]; 27 | extern const char http_shtml[7]; 28 | extern const char http_htm[5]; 29 | extern const char http_css[5]; 30 | extern const char http_png[5]; 31 | extern const char http_gif[5]; 32 | extern const char http_jpg[5]; 33 | extern const char http_text[5]; 34 | extern const char http_txt[5]; 35 | -------------------------------------------------------------------------------- /apps/webserver/httpd-cgi.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \addtogroup httpd 3 | * @{ 4 | */ 5 | 6 | /** 7 | * \file 8 | * Web server script interface header file 9 | * \author 10 | * Adam Dunkels 11 | * 12 | */ 13 | 14 | 15 | 16 | /* 17 | * Copyright (c) 2001, Adam Dunkels. 18 | * All rights reserved. 19 | * 20 | * Redistribution and use in source and binary forms, with or without 21 | * modification, are permitted provided that the following conditions 22 | * are met: 23 | * 1. Redistributions of source code must retain the above copyright 24 | * notice, this list of conditions and the following disclaimer. 25 | * 2. Redistributions in binary form must reproduce the above copyright 26 | * notice, this list of conditions and the following disclaimer in the 27 | * documentation and/or other materials provided with the distribution. 28 | * 3. The name of the author may not be used to endorse or promote 29 | * products derived from this software without specific prior 30 | * written permission. 31 | * 32 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 33 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 34 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 35 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 36 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 37 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 38 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 39 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 40 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 41 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 42 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 43 | * 44 | * This file is part of the uIP TCP/IP stack. 45 | * 46 | * $Id: httpd-cgi.h,v 1.2 2006/06/11 21:46:38 adam Exp $ 47 | * 48 | */ 49 | 50 | #ifndef __HTTPD_CGI_H__ 51 | #define __HTTPD_CGI_H__ 52 | 53 | #include "psock.h" 54 | #include "httpd.h" 55 | 56 | typedef PT_THREAD((* httpd_cgifunction)(struct httpd_state *, char *)); 57 | 58 | httpd_cgifunction httpd_cgi(char *name); 59 | 60 | struct httpd_cgi_call { 61 | const char *name; 62 | const httpd_cgifunction function; 63 | }; 64 | 65 | /** 66 | * \brief HTTPD CGI function declaration 67 | * \param name The C variable name of the function 68 | * \param str The string name of the function, used in the script file 69 | * \param function A pointer to the function that implements it 70 | * 71 | * This macro is used for declaring a HTTPD CGI 72 | * function. This function is then added to the list of 73 | * HTTPD CGI functions with the httpd_cgi_add() function. 74 | * 75 | * \hideinitializer 76 | */ 77 | #define HTTPD_CGI_CALL(name, str, function) \ 78 | static PT_THREAD(function(struct httpd_state *, char *)); \ 79 | static const struct httpd_cgi_call name = {str, function} 80 | 81 | void httpd_cgi_init(void); 82 | #endif /* __HTTPD_CGI_H__ */ 83 | 84 | /** @} */ 85 | -------------------------------------------------------------------------------- /apps/webserver/httpd-fs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001, Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | * Author: Adam Dunkels 32 | * 33 | * $Id: httpd-fs.h,v 1.1 2006/06/07 09:13:08 adam Exp $ 34 | */ 35 | #ifndef __HTTPD_FS_H__ 36 | #define __HTTPD_FS_H__ 37 | 38 | #define HTTPD_FS_STATISTICS 1 39 | 40 | struct httpd_fs_file { 41 | char *data; 42 | int len; 43 | }; 44 | 45 | /* file must be allocated by caller and will be filled in 46 | by the function. */ 47 | int httpd_fs_open(const char *name, struct httpd_fs_file *file); 48 | 49 | #ifdef HTTPD_FS_STATISTICS 50 | #if HTTPD_FS_STATISTICS == 1 51 | u16_t httpd_fs_count(char *name); 52 | #endif /* HTTPD_FS_STATISTICS */ 53 | #endif /* HTTPD_FS_STATISTICS */ 54 | 55 | void httpd_fs_init(void); 56 | 57 | #endif /* __HTTPD_FS_H__ */ 58 | -------------------------------------------------------------------------------- /apps/webserver/httpd-fs/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |

404 - file not found

5 |

Go here instead.

6 |
7 | 8 | -------------------------------------------------------------------------------- /apps/webserver/httpd-fs/fade.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdunkels/uip/a49def743f6e5c7d0c0f2d724f0b8e0c563a4a37/apps/webserver/httpd-fs/fade.png -------------------------------------------------------------------------------- /apps/webserver/httpd-fs/files.shtml: -------------------------------------------------------------------------------- 1 | %!: /header.html 2 |

File statistics

3 |
4 | 5 | 6 | 9 | 10 | 13 | 14 | 17 | 18 | 21 | 22 | 25 | 26 | 29 | 30 | 33 |
/index.html%! file-stats /index.html 7 |
/files.shtml%! file-stats /files.shtml 11 |
/tcp.shtml%! file-stats /tcp.shtml 15 |
/stats.shtml%! file-stats /stats.shtml 19 |
/style.css%! file-stats /style.css 23 |
/404.html%! file-stats /404.html 27 |
/fade.png%! file-stats /fade.png 31 |
34 |
35 | %!: /footer.html 36 | -------------------------------------------------------------------------------- /apps/webserver/httpd-fs/footer.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /apps/webserver/httpd-fs/header.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Welcome to the uIP web server! 5 | 6 | 7 | 8 | 9 | 17 | 18 |
19 | -------------------------------------------------------------------------------- /apps/webserver/httpd-fs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Welcome to the uIP web server! 5 | 6 | 7 | 8 | 9 | 17 | 18 |
19 |

20 | These web pages are served by a small web server running on top of 21 | the uIP embedded TCP/IP 22 | stack. 23 |

24 |

25 | Click on the links above for web server statistics. 26 |

27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /apps/webserver/httpd-fs/processes.shtml: -------------------------------------------------------------------------------- 1 | %!: /header.html 2 |

System processes


3 | 4 | %! processes 5 | %!: /footer.html -------------------------------------------------------------------------------- /apps/webserver/httpd-fs/stats.shtml: -------------------------------------------------------------------------------- 1 | %!: /header.html 2 |

Network statistics

3 |
4 |
IDNamePriorityPoll handlerEvent handlerProcstate
5 |
 6 | IP           Packets received
 7 |              Packets sent
 8 | 	     Packets dropped
 9 | IP errors    IP version/header length
10 |              IP length, high byte
11 |              IP length, low byte
12 |              IP fragments
13 |              Header checksum
14 |              Wrong protocol
15 | ICMP	     Packets received
16 |              Packets sent
17 |              Packets dropped
18 |              Type errors
19 | TCP          Packets received
20 |              Packets sent
21 |              Packets dropped
22 |              Checksum errors
23 |              Data packets without ACKs
24 |              Resets
25 |              Retransmissions
26 | 	     No connection avaliable
27 | 	     Connection attempts to closed ports
28 | 
%! net-stats
29 | 
30 | 31 | %!: /footer.html 32 | -------------------------------------------------------------------------------- /apps/webserver/httpd-fs/style.css: -------------------------------------------------------------------------------- 1 | h1 2 | { 3 | text-align: center; 4 | font-size:14pt; 5 | font-family:arial,helvetica; 6 | font-weight:bold; 7 | padding:10px; 8 | } 9 | 10 | body 11 | { 12 | 13 | background-color: #fffeec; 14 | color:black; 15 | 16 | font-size:8pt; 17 | font-family:arial,helvetica; 18 | } 19 | 20 | .menu 21 | { 22 | margin: 4px; 23 | width:60%; 24 | 25 | padding:2px; 26 | 27 | border: solid 1px; 28 | background-color: #fffcd2; 29 | text-align:left; 30 | 31 | font-size:9pt; 32 | font-family:arial,helvetica; 33 | } 34 | 35 | div.menubox 36 | { 37 | width: 25%; 38 | border: 0; 39 | float: left; 40 | text-align: center; 41 | } 42 | 43 | .contentblock 44 | { 45 | margin: 4px; 46 | width:60%; 47 | 48 | padding:2px; 49 | 50 | border: 1px dotted; 51 | background-color: white; 52 | 53 | font-size:8pt; 54 | font-family:arial,helvetica; 55 | 56 | } 57 | 58 | p.intro 59 | { 60 | margin-left:20px; 61 | margin-right:20px; 62 | 63 | font-size:10pt; 64 | /* font-weight:bold; */ 65 | font-family:arial,helvetica; 66 | } 67 | 68 | p.clink 69 | { 70 | font-size:12pt; 71 | font-family:courier,monospace; 72 | text-align:center; 73 | } 74 | 75 | p.clink9 76 | { 77 | font-size:9pt; 78 | font-family:courier,monospace; 79 | text-align:center; 80 | } 81 | 82 | 83 | p 84 | { 85 | padding-left:10px; 86 | } 87 | 88 | p.right 89 | { 90 | text-align:right; 91 | } 92 | 93 | -------------------------------------------------------------------------------- /apps/webserver/httpd-fs/tcp.shtml: -------------------------------------------------------------------------------- 1 | %!: /header.html 2 |

Current connections


3 | 4 | %! tcp-connections 5 | %!: /footer.html -------------------------------------------------------------------------------- /apps/webserver/httpd-fsdata.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001, Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | * Author: Adam Dunkels 32 | * 33 | * $Id: httpd-fsdata.h,v 1.1 2006/06/07 09:13:08 adam Exp $ 34 | */ 35 | #ifndef __HTTPD_FSDATA_H__ 36 | #define __HTTPD_FSDATA_H__ 37 | 38 | #include "uip.h" 39 | 40 | struct httpd_fsdata_file { 41 | const struct httpd_fsdata_file *next; 42 | const char *name; 43 | const char *data; 44 | const int len; 45 | #ifdef HTTPD_FS_STATISTICS 46 | #if HTTPD_FS_STATISTICS == 1 47 | u16_t count; 48 | #endif /* HTTPD_FS_STATISTICS */ 49 | #endif /* HTTPD_FS_STATISTICS */ 50 | }; 51 | 52 | struct httpd_fsdata_file_noconst { 53 | struct httpd_fsdata_file *next; 54 | char *name; 55 | char *data; 56 | int len; 57 | #ifdef HTTPD_FS_STATISTICS 58 | #if HTTPD_FS_STATISTICS == 1 59 | u16_t count; 60 | #endif /* HTTPD_FS_STATISTICS */ 61 | #endif /* HTTPD_FS_STATISTICS */ 62 | }; 63 | 64 | #endif /* __HTTPD_FSDATA_H__ */ 65 | -------------------------------------------------------------------------------- /apps/webserver/httpd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2005, Adam Dunkels. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote 14 | * products derived from this software without specific prior 15 | * written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 18 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 23 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 26 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * This file is part of the uIP TCP/IP stack. 30 | * 31 | * $Id: httpd.h,v 1.2 2006/06/11 21:46:38 adam Exp $ 32 | * 33 | */ 34 | 35 | #ifndef __HTTPD_H__ 36 | #define __HTTPD_H__ 37 | 38 | #include "psock.h" 39 | #include "httpd-fs.h" 40 | 41 | struct httpd_state { 42 | unsigned char timer; 43 | struct psock sin, sout; 44 | struct pt outputpt, scriptpt; 45 | char inputbuf[50]; 46 | char filename[20]; 47 | char state; 48 | struct httpd_fs_file file; 49 | int len; 50 | char *scriptptr; 51 | int scriptlen; 52 | 53 | unsigned short count; 54 | }; 55 | 56 | void httpd_init(void); 57 | void httpd_appcall(void); 58 | 59 | void httpd_log(char *msg); 60 | void httpd_log_file(u16_t *requester, char *file); 61 | 62 | #endif /* __HTTPD_H__ */ 63 | -------------------------------------------------------------------------------- /apps/webserver/makefsdata: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | open(OUTPUT, "> httpd-fsdata.c"); 4 | 5 | chdir("httpd-fs"); 6 | 7 | opendir(DIR, "."); 8 | @files = grep { !/^\./ && !/(CVS|~)/ } readdir(DIR); 9 | closedir(DIR); 10 | 11 | foreach $file (@files) { 12 | 13 | if(-d $file && $file !~ /^\./) { 14 | print "Processing directory $file\n"; 15 | opendir(DIR, $file); 16 | @newfiles = grep { !/^\./ && !/(CVS|~)/ } readdir(DIR); 17 | closedir(DIR); 18 | printf "Adding files @newfiles\n"; 19 | @files = (@files, map { $_ = "$file/$_" } @newfiles); 20 | next; 21 | } 22 | } 23 | 24 | foreach $file (@files) { 25 | if(-f $file) { 26 | 27 | print "Adding file $file\n"; 28 | 29 | open(FILE, $file) || die "Could not open file $file\n"; 30 | 31 | $file =~ s-^-/-; 32 | $fvar = $file; 33 | $fvar =~ s-/-_-g; 34 | $fvar =~ s-\.-_-g; 35 | # for AVR, add PROGMEM here 36 | print(OUTPUT "static const unsigned char data".$fvar."[] = {\n"); 37 | print(OUTPUT "\t/* $file */\n\t"); 38 | for($j = 0; $j < length($file); $j++) { 39 | printf(OUTPUT "%#02x, ", unpack("C", substr($file, $j, 1))); 40 | } 41 | printf(OUTPUT "0,\n"); 42 | 43 | 44 | $i = 0; 45 | while(read(FILE, $data, 1)) { 46 | if($i == 0) { 47 | print(OUTPUT "\t"); 48 | } 49 | printf(OUTPUT "%#02x, ", unpack("C", $data)); 50 | $i++; 51 | if($i == 10) { 52 | print(OUTPUT "\n"); 53 | $i = 0; 54 | } 55 | } 56 | print(OUTPUT "0};\n\n"); 57 | close(FILE); 58 | push(@fvars, $fvar); 59 | push(@pfiles, $file); 60 | } 61 | } 62 | 63 | for($i = 0; $i < @fvars; $i++) { 64 | $file = $pfiles[$i]; 65 | $fvar = $fvars[$i]; 66 | 67 | if($i == 0) { 68 | $prevfile = "NULL"; 69 | } else { 70 | $prevfile = "file" . $fvars[$i - 1]; 71 | } 72 | print(OUTPUT "const struct httpd_fsdata_file file".$fvar."[] = {{$prevfile, data$fvar, "); 73 | print(OUTPUT "data$fvar + ". (length($file) + 1) .", "); 74 | print(OUTPUT "sizeof(data$fvar) - ". (length($file) + 1) ."}};\n\n"); 75 | } 76 | 77 | print(OUTPUT "#define HTTPD_FS_ROOT file$fvars[$i - 1]\n\n"); 78 | print(OUTPUT "#define HTTPD_FS_NUMFILES $i\n"); 79 | -------------------------------------------------------------------------------- /apps/webserver/makestrings: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | 4 | sub stringify { 5 | my $name = shift(@_); 6 | open(OUTPUTC, "> $name.c"); 7 | open(OUTPUTH, "> $name.h"); 8 | 9 | open(FILE, "$name"); 10 | 11 | while() { 12 | if(/(.+) "(.+)"/) { 13 | $var = $1; 14 | $data = $2; 15 | 16 | $datan = $data; 17 | $datan =~ s/\\r/\r/g; 18 | $datan =~ s/\\n/\n/g; 19 | $datan =~ s/\\01/\01/g; 20 | $datan =~ s/\\0/\0/g; 21 | 22 | printf(OUTPUTC "const char $var\[%d] = \n", length($datan) + 1); 23 | printf(OUTPUTC "/* \"$data\" */\n"); 24 | printf(OUTPUTC "{"); 25 | for($j = 0; $j < length($datan); $j++) { 26 | printf(OUTPUTC "%#02x, ", unpack("C", substr($datan, $j, 1))); 27 | } 28 | printf(OUTPUTC "};\n"); 29 | 30 | printf(OUTPUTH "extern const char $var\[%d];\n", length($datan) + 1); 31 | 32 | } 33 | } 34 | close(OUTPUTC); 35 | close(OUTPUTH); 36 | } 37 | stringify("http-strings"); 38 | 39 | exit 0; 40 | 41 | -------------------------------------------------------------------------------- /apps/webserver/webserver.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2002, Adam Dunkels. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above 11 | * copyright notice, this list of conditions and the following 12 | * disclaimer in the documentation and/or other materials provided 13 | * with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote 15 | * products derived from this software without specific prior 16 | * written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 19 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 24 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | * This file is part of the uIP TCP/IP stack 31 | * 32 | * $Id: webserver.h,v 1.2 2006/06/11 21:46:38 adam Exp $ 33 | * 34 | */ 35 | #ifndef __WEBSERVER_H__ 36 | #define __WEBSERVER_H__ 37 | 38 | #include "httpd.h" 39 | 40 | typedef struct httpd_state uip_tcp_appstate_t; 41 | /* UIP_APPCALL: the name of the application function. This function 42 | must return void and take no arguments (i.e., C type "void 43 | appfunc(void)"). */ 44 | #ifndef UIP_APPCALL 45 | #define UIP_APPCALL httpd_appcall 46 | #endif 47 | 48 | 49 | #endif /* __WEBSERVER_H__ */ 50 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | all: htmldoc pdfdoc 2 | 3 | htmldoc: 4 | doxygen Doxyfile 5 | 6 | pdfdoc: htmldoc 7 | cd latex; make refman.pdf && mv refman.pdf ../uip-refman.pdf 8 | -------------------------------------------------------------------------------- /doc/README: -------------------------------------------------------------------------------- 1 | The files in this directory comprise the uIP documentation. The files 2 | are: 3 | 4 | html/ The uIP reference manual in HTML format. 5 | 6 | uip-refman.pdf The uIP reference manual in a printable PDF version. 7 | 8 | mobisys2003.pdf Conference paper about uIP from the First 9 | International Conference on Mobile Systems, 10 | Applications and Services (MobiSys), San 11 | Francisco, May 2003. 12 | 13 | -------------------------------------------------------------------------------- /doc/doxygen.sty: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e} 2 | \ProvidesPackage{doxygen} 3 | \RequirePackage{calc} 4 | \RequirePackage{array} 5 | \pagestyle{fancyplain} 6 | \newcommand{\clearemptydoublepage}{\newpage{\pagestyle{empty}\cleardoublepage}} 7 | \renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}} 8 | \lhead[\fancyplain{}{\bfseries\thepage}] 9 | {\fancyplain{}{\bfseries\rightmark}} 10 | \rhead[\fancyplain{}{\bfseries\leftmark}] 11 | {\fancyplain{}{\bfseries\thepage}} 12 | \rfoot[\fancyplain{}{\bfseries\scriptsize Generated on Wed Jun 7 11:37:14 2006 for uIP 1.0-rc0 by doxygen\lfoot[]{\fancyplain{}{\bfseries\scriptsize Generated on Wed Jun 7 11:37:14 2006 for uIP 1.0-rc0 by doxygen}} 13 | \cfoot{} 14 | \newenvironment{CompactList} 15 | {\begin{list}{}{ 16 | \setlength{\leftmargin}{0.5cm} 17 | \setlength{\itemsep}{0pt} 18 | \setlength{\parsep}{0pt} 19 | \setlength{\topsep}{0pt} 20 | \renewcommand{\makelabel}{}}} 21 | {\end{list}} 22 | \newenvironment{CompactItemize} 23 | { 24 | \begin{itemize} 25 | \setlength{\itemsep}{-3pt} 26 | \setlength{\parsep}{0pt} 27 | \setlength{\topsep}{0pt} 28 | \setlength{\partopsep}{0pt} 29 | } 30 | {\end{itemize}} 31 | \newcommand{\PBS}[1]{\let\temp=\\#1\let\\=\temp} 32 | \newlength{\tmplength} 33 | \newenvironment{TabularC}[1] 34 | { 35 | \setlength{\tmplength} 36 | {\linewidth/(#1)-\tabcolsep*2-\arrayrulewidth*(#1+1)/(#1)} 37 | \par\begin{tabular*}{\linewidth} 38 | {*{#1}{|>{\PBS\raggedright\hspace{0pt}}p{\the\tmplength}}|} 39 | } 40 | {\end{tabular*}\par} 41 | \newcommand{\entrylabel}[1]{ 42 | {\parbox[b]{\labelwidth-4pt}{\makebox[0pt][l]{\textbf{#1}}\\}}} 43 | \newenvironment{Desc} 44 | {\begin{list}{} 45 | { 46 | \settowidth{\labelwidth}{40pt} 47 | \setlength{\leftmargin}{\labelwidth} 48 | \setlength{\parsep}{0pt} 49 | \setlength{\itemsep}{-4pt} 50 | \renewcommand{\makelabel}{\entrylabel} 51 | } 52 | } 53 | {\end{list}} 54 | \newenvironment{Indent} 55 | {\begin{list}{}{\setlength{\leftmargin}{0.5cm}} 56 | \item[]\ignorespaces} 57 | {\unskip\end{list}} 58 | \setlength{\parindent}{0cm} 59 | \setlength{\parskip}{0.2cm} 60 | \addtocounter{secnumdepth}{1} 61 | \sloppy 62 | \usepackage[T1]{fontenc} 63 | -------------------------------------------------------------------------------- /doc/example-mainloop-with-arp.c: -------------------------------------------------------------------------------- 1 | #include "uip.h" 2 | #include "uip_arp.h" 3 | #include "network-device.h" 4 | #include "httpd.h" 5 | #include "timer.h" 6 | 7 | #define BUF ((struct uip_eth_hdr *)&uip_buf[0]) 8 | 9 | /*---------------------------------------------------------------------------*/ 10 | int 11 | main(void) 12 | { 13 | int i; 14 | uip_ipaddr_t ipaddr; 15 | struct timer periodic_timer, arp_timer; 16 | 17 | timer_set(&periodic_timer, CLOCK_SECOND / 2); 18 | timer_set(&arp_timer, CLOCK_SECOND * 10); 19 | 20 | network_device_init(); 21 | uip_init(); 22 | 23 | uip_ipaddr(ipaddr, 192,168,0,2); 24 | uip_sethostaddr(ipaddr); 25 | 26 | httpd_init(); 27 | 28 | while(1) { 29 | uip_len = network_device_read(); 30 | if(uip_len > 0) { 31 | if(BUF->type == htons(UIP_ETHTYPE_IP)) { 32 | uip_arp_ipin(); 33 | uip_input(); 34 | /* If the above function invocation resulted in data that 35 | should be sent out on the network, the global variable 36 | uip_len is set to a value > 0. */ 37 | if(uip_len > 0) { 38 | uip_arp_out(); 39 | network_device_send(); 40 | } 41 | } else if(BUF->type == htons(UIP_ETHTYPE_ARP)) { 42 | uip_arp_arpin(); 43 | /* If the above function invocation resulted in data that 44 | should be sent out on the network, the global variable 45 | uip_len is set to a value > 0. */ 46 | if(uip_len > 0) { 47 | network_device_send(); 48 | } 49 | } 50 | 51 | } else if(timer_expired(&periodic_timer)) { 52 | timer_reset(&periodic_timer); 53 | for(i = 0; i < UIP_CONNS; i++) { 54 | uip_periodic(i); 55 | /* If the above function invocation resulted in data that 56 | should be sent out on the network, the global variable 57 | uip_len is set to a value > 0. */ 58 | if(uip_len > 0) { 59 | uip_arp_out(); 60 | network_device_send(); 61 | } 62 | } 63 | 64 | #if UIP_UDP 65 | for(i = 0; i < UIP_UDP_CONNS; i++) { 66 | uip_udp_periodic(i); 67 | /* If the above function invocation resulted in data that 68 | should be sent out on the network, the global variable 69 | uip_len is set to a value > 0. */ 70 | if(uip_len > 0) { 71 | uip_arp_out(); 72 | network_device_send(); 73 | } 74 | } 75 | #endif /* UIP_UDP */ 76 | 77 | /* Call the ARP timer function every 10 seconds. */ 78 | if(timer_expired(&arp_timer)) { 79 | timer_reset(&arp_timer); 80 | uip_arp_timer(); 81 | } 82 | } 83 | } 84 | return 0; 85 | } 86 | /*---------------------------------------------------------------------------*/ 87 | -------------------------------------------------------------------------------- /doc/example-mainloop-without-arp.c: -------------------------------------------------------------------------------- 1 | #include "uip.h" 2 | #include "uip_arp.h" 3 | #include "network-device.h" 4 | #include "httpd.h" 5 | #include "timer.h" 6 | 7 | /*---------------------------------------------------------------------------*/ 8 | int 9 | main(void) 10 | { 11 | int i; 12 | uip_ipaddr_t ipaddr; 13 | struct timer periodic_timer; 14 | 15 | timer_set(&periodic_timer, CLOCK_SECOND / 2); 16 | 17 | network_device_init(); 18 | uip_init(); 19 | 20 | uip_ipaddr(ipaddr, 192,168,0,2); 21 | uip_sethostaddr(ipaddr); 22 | 23 | httpd_init(); 24 | 25 | while(1) { 26 | uip_len = network_device_read(); 27 | if(uip_len > 0) { 28 | uip_input(); 29 | /* If the above function invocation resulted in data that 30 | should be sent out on the network, the global variable 31 | uip_len is set to a value > 0. */ 32 | if(uip_len > 0) { 33 | network_device_send(); 34 | } 35 | } else if(timer_expired(&periodic_timer)) { 36 | timer_reset(&periodic_timer); 37 | for(i = 0; i < UIP_CONNS; i++) { 38 | uip_periodic(i); 39 | /* If the above function invocation resulted in data that 40 | should be sent out on the network, the global variable 41 | uip_len is set to a value > 0. */ 42 | if(uip_len > 0) { 43 | network_device_send(); 44 | } 45 | } 46 | 47 | #if UIP_UDP 48 | for(i = 0; i < UIP_UDP_CONNS; i++) { 49 | uip_udp_periodic(i); 50 | /* If the above function invocation resulted in data that 51 | should be sent out on the network, the global variable 52 | uip_len is set to a value > 0. */ 53 | if(uip_len > 0) { 54 | network_device_send(); 55 | } 56 | } 57 | #endif /* UIP_UDP */ 58 | } 59 | } 60 | return 0; 61 | } 62 | /*---------------------------------------------------------------------------*/ 63 | -------------------------------------------------------------------------------- /doc/examples.txt: -------------------------------------------------------------------------------- 1 | /** 2 | \defgroup apps Applications 3 | @{ 4 | 5 | The uIP distribution contains a number of example applications that 6 | can be either used directory or studied when learning to develop 7 | applications for uIP. 8 | 9 | */ 10 | 11 | /** \example hello-world.c */ 12 | /** \example hello-world.h */ 13 | 14 | /** \example smtp.c */ 15 | /** \example smtp.h */ 16 | 17 | /** \example webclient.c */ 18 | /** \example webclient.h */ 19 | 20 | /** \example example-mainloop-with-arp.c */ 21 | /** \example example-mainloop-without-arp.c */ 22 | 23 | /** \example telnetd.c */ 24 | /** \example telnetd.h */ 25 | 26 | /** \example resolv.c */ 27 | /** \example resolv.h */ 28 | 29 | /** \example dhcpc.c */ 30 | /** \example dhcpc.h */ 31 | 32 | /** \example uip-conf.h */ 33 | 34 | /** @} */ 35 | -------------------------------------------------------------------------------- /doc/header.tex: -------------------------------------------------------------------------------- 1 | \documentclass[a4paper]{book} 2 | \usepackage{a4wide} 3 | \usepackage{makeidx} 4 | \usepackage{fancyhdr} 5 | \usepackage{graphicx} 6 | \usepackage{multicol} 7 | \usepackage{float} 8 | \usepackage{textcomp} 9 | \usepackage{alltt} 10 | \usepackage{times} 11 | \ifx\pdfoutput\undefined 12 | \usepackage[ps2pdf, 13 | pagebackref=true, 14 | colorlinks=true, 15 | linkcolor=blue 16 | ]{hyperref} 17 | \usepackage{pspicture} 18 | \else 19 | \usepackage[pdftex, 20 | pagebackref=true, 21 | colorlinks=true, 22 | linkcolor=blue 23 | ]{hyperref} 24 | \fi 25 | \usepackage{doxygen} 26 | \makeindex 27 | \setcounter{tocdepth}{1} 28 | \renewcommand{\footrulewidth}{0.4pt} 29 | \begin{document} 30 | \begin{titlepage} 31 | \vspace*{5cm} 32 | \begin{center} 33 | {\Huge The uIP Embedded TCP/IP Stack}\\ 34 | \vspace*{1cm} 35 | {\LARGE The uIP 1.0 Reference Manual}\\ 36 | \vspace*{3cm} 37 | {\Large June 2006}\\ 38 | \vspace*{2cm} 39 | \includegraphics[width=6cm]{../sicslogo.pdf}\\ 40 | \vspace*{1cm} 41 | {\Large Adam Dunkels}\\ 42 | {\Large \texttt{adam@sics.se}}\\ 43 | \vspace*{1cm} 44 | {\LARGE Swedish Institute of Computer Science}\\ 45 | \vspace*{0.5cm} 46 | 47 | \end{center} 48 | \end{titlepage} 49 | \clearemptydoublepage 50 | \pagenumbering{roman} 51 | \tableofcontents 52 | \clearemptydoublepage 53 | \pagenumbering{arabic} 54 | -------------------------------------------------------------------------------- /doc/html/a00078.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: hello_world_state Struct Reference 4 | 5 | 6 | 7 | 8 |
9 |
16 | 23 |

hello_world_state Struct Reference
24 | 25 | [Hello, world] 26 |


Detailed Description

27 |
Examples:
28 | 29 |

30 | hello-world.c, and hello-world.h.

31 |

32 | 33 |

34 | Definition at line 36 of file hello-world.h.

LocalRemoteStateRetransmissionsTimerFlags
35 | 36 | 37 | 39 | 40 | 42 | 43 | 45 | 46 |

Data Fields

38 | psock p
41 | char inputbuffer [10]
44 | char name [40]
47 |
Generated on Mon Jun 12 10:23:01 2006 for uIP 1.0 by  48 | 49 | doxygen 1.4.6
50 | 51 | 52 | -------------------------------------------------------------------------------- /doc/html/a00079.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: httpd_cgi_call Struct Reference 4 | 5 | 6 | 7 | 8 |
9 |
16 | 23 |

httpd_cgi_call Struct Reference
24 | 25 | [Web server] 26 |


Detailed Description

27 | 28 |

29 | 30 |

31 | Definition at line 60 of file httpd-cgi.h. 32 | 33 | 34 | 36 | 37 | 39 | 40 |

Data Fields

35 | const char * name
38 | const httpd_cgifunction function
41 |


Generated on Mon Jun 12 10:23:01 2006 for uIP 1.0 by  42 | 43 | doxygen 1.4.6
44 | 45 | 46 | -------------------------------------------------------------------------------- /doc/html/a00081.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: memb_blocks Struct Reference 4 | 5 | 6 | 7 | 8 |
9 |
16 | 23 |

memb_blocks Struct Reference
24 | 25 | [Memory block management functions] 26 |


Detailed Description

27 | 28 |

29 | 30 |

31 | Definition at line 105 of file memb.h. 32 | 33 | 34 | 36 | 37 | 39 | 40 | 42 | 43 | 45 | 46 |

Data Fields

35 | unsigned short size
38 | unsigned short num
41 | char * count
44 | void * mem
47 |


Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  48 | 49 | doxygen 1.4.6
50 | 51 | 52 | -------------------------------------------------------------------------------- /doc/html/a00083.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: psock_buf Struct Reference 4 | 5 | 6 | 7 | 8 |
9 |
16 | 23 |

psock_buf Struct Reference
24 | 25 | [Protosockets library] 26 |


Detailed Description

27 | 28 |

29 | 30 |

31 | Definition at line 95 of file psock.h. 32 | 33 | 34 | 36 | 37 | 39 | 40 |

Data Fields

35 | u8_tptr
38 | unsigned short left
41 |


Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  42 | 43 | doxygen 1.4.6
44 | 45 | 46 | -------------------------------------------------------------------------------- /doc/html/a00084.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: pt Struct Reference 4 | 5 | 6 | 7 | 8 |
9 |
16 | 23 |

pt Struct Reference
24 | 25 | [Protothreads] 26 |


Detailed Description

27 |
Examples:
28 | 29 |

30 | dhcpc.h.

31 |

32 | 33 |

34 | Definition at line 54 of file pt.h. 35 | 36 | 37 | 39 | 40 |

Data Fields

38 | lc_t lc
41 |


Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  42 | 43 | doxygen 1.4.6
44 | 45 | 46 | -------------------------------------------------------------------------------- /doc/html/a00087.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: timer Struct Reference 4 | 5 | 6 | 7 | 8 |
9 |
16 | 23 |

timer Struct Reference
24 | 25 | [Timer library] 26 |

#include <timer.h> 27 |

28 |


Detailed Description

29 | A timer. 30 |

31 | This structure is used for declaring a timer. The timer must be set with timer_set() before it can be used.

Examples:
32 | 33 |

34 | dhcpc.h, example-mainloop-with-arp.c, example-mainloop-without-arp.c, and webclient.h.

35 |

36 | 37 |

38 | Definition at line 74 of file timer.h. 39 | 40 | 41 | 43 | 44 | 46 | 47 |

Data Fields

42 | clock_time_t start
45 | clock_time_t interval
48 |


Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  49 | 50 | doxygen 1.4.6
51 | 52 | 53 | -------------------------------------------------------------------------------- /doc/html/a00089.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: uip_eth_addr Struct Reference 4 | 5 | 6 | 7 | 8 |
9 |
16 | 23 |

uip_eth_addr Struct Reference
24 | 25 | [The uIP TCP/IP stack] 26 |

#include <uip.h> 27 |

28 |


Detailed Description

29 | Representation of a 48-bit Ethernet address. 30 |

31 | 32 |

33 | Definition at line 1542 of file uip.h. 34 | 35 | 36 | 38 | 39 |

Data Fields

37 | u8_t addr [6]
40 |


Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  41 | 42 | doxygen 1.4.6
43 | 44 | 45 | -------------------------------------------------------------------------------- /doc/html/a00090.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: uip_eth_hdr Struct Reference 4 | 5 | 6 | 7 | 8 |
9 |
16 | 23 |

uip_eth_hdr Struct Reference
24 | 25 | [uIP Address Resolution Protocol] 26 |

#include <uip_arp.h> 27 |

28 |


Detailed Description

29 | The Ethernet header. 30 |

31 | 32 |

33 | Definition at line 63 of file uip_arp.h. 34 | 35 | 36 | 38 | 39 | 41 | 42 | 44 | 45 |

Data Fields

37 | uip_eth_addr dest
40 | uip_eth_addr src
43 | u16_t type
46 |


Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  47 | 48 | doxygen 1.4.6
49 | 50 | 51 | -------------------------------------------------------------------------------- /doc/html/a00092.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: uip_neighbor_addr Struct Reference 4 | 5 | 6 | 7 | 8 |
9 |
16 | 23 |

uip_neighbor_addr Struct Reference


Detailed Description

24 | 25 |

26 | 27 |

28 | Definition at line 47 of file uip-neighbor.h. 29 | 30 | 31 | 33 | 34 |

Data Fields

32 | uip_eth_addr addr
35 |


Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  36 | 37 | doxygen 1.4.6
38 | 39 | 40 | -------------------------------------------------------------------------------- /doc/html/a00100.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: apps/hello-world/hello-world.c File Reference 4 | 5 | 6 | 7 | 8 |
9 |
16 |
17 |
21 |

apps/hello-world/hello-world.c File Reference


Detailed Description

22 | An example of how to write uIP applications with protosockets. 23 |

24 |

Author:
Adam Dunkels <adam@sics.se>
25 | 26 |

27 | Definition in file hello-world.c. 28 |

29 | #include "hello-world.h"
30 | #include "uip.h"
31 | #include <string.h>
32 | 33 |

34 | Go to the source code of this file. 35 | 36 | 37 | 39 | 40 | 42 | 43 |

Functions

38 | void hello_world_init (void)
41 | void hello_world_appcall (void)
44 |


Generated on Mon Jun 12 10:23:01 2006 for uIP 1.0 by  45 | 46 | doxygen 1.4.6
47 | 48 | 49 | -------------------------------------------------------------------------------- /doc/html/a00101.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: apps/hello-world/hello-world.h File Reference 4 | 5 | 6 | 7 | 8 |
9 |
16 |
17 |
21 |

apps/hello-world/hello-world.h File Reference


Detailed Description

22 | Header file for an example of how to write uIP applications with protosockets. 23 |

24 |

Author:
Adam Dunkels <adam@sics.se>
25 | 26 |

27 | Definition in file hello-world.h. 28 |

29 | #include "uipopt.h"
30 | #include "psock.h"
31 | 32 |

33 | Go to the source code of this file. 34 | 35 | 36 | 37 | 38 | 39 | 41 | 42 | 43 | 45 | 46 | 48 | 49 |

Data Structures

struct  hello_world_state

Defines

40 | #define UIP_APPCALL   hello_world_appcall

Functions

44 | void hello_world_appcall (void)
47 | void hello_world_init (void)
50 |


Generated on Mon Jun 12 10:23:01 2006 for uIP 1.0 by  51 | 52 | doxygen 1.4.6
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/html/a00112.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: apps/webserver/httpd-cgi.c File Reference 4 | 5 | 6 | 7 | 8 |
9 |
16 |
17 |
21 |

apps/webserver/httpd-cgi.c File Reference


Detailed Description

22 | Web server script interface. 23 |

24 |

Author:
Adam Dunkels <adam@sics.se>
25 | 26 |

27 | Definition in file httpd-cgi.c. 28 |

29 | #include "uip.h"
30 | #include "psock.h"
31 | #include "httpd.h"
32 | #include "httpd-cgi.h"
33 | #include "httpd-fs.h"
34 | #include <stdio.h>
35 | #include <string.h>
36 | 37 |

38 | Go to the source code of this file. 39 | 40 | 41 | 43 | 44 |

Functions

42 | httpd_cgifunction httpd_cgi (char *name)
45 |


Generated on Mon Jun 12 10:23:01 2006 for uIP 1.0 by  46 | 47 | doxygen 1.4.6
48 | 49 | 50 | -------------------------------------------------------------------------------- /doc/html/a00113.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: apps/webserver/httpd-cgi.h File Reference 4 | 5 | 6 | 7 | 8 |
9 |
16 |
17 |
21 |

apps/webserver/httpd-cgi.h File Reference


Detailed Description

22 | Web server script interface header file. 23 |

24 |

Author:
Adam Dunkels <adam@sics.se>
25 | 26 |

27 | Definition in file httpd-cgi.h. 28 |

29 | #include "psock.h"
30 | #include "httpd.h"
31 | 32 |

33 | Go to the source code of this file. 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 45 | 46 |

Data Structures

struct  httpd_cgi_call

Defines

#define HTTPD_CGI_CALL(name, str, function)
 HTTPD CGI function declaration.

Functions

44 | httpd_cgifunction httpd_cgi (char *name)
47 |


Generated on Mon Jun 12 10:23:01 2006 for uIP 1.0 by  48 | 49 | doxygen 1.4.6
50 | 51 | 52 | -------------------------------------------------------------------------------- /doc/html/a00120.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: lib/memb.c File Reference 4 | 5 | 6 | 7 | 8 |
9 |
16 |
17 |
21 |

lib/memb.c File Reference


Detailed Description

22 | Memory block allocation routines. 23 |

24 |

Author:
Adam Dunkels <adam@sics.se>
25 | 26 |

27 | Definition in file memb.c. 28 |

29 | #include <string.h>
30 | #include "memb.h"
31 | 32 |

33 | Go to the source code of this file. 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |

Functions

void memb_init (struct memb_blocks *m)
 Initialize a memory block that was declared with MEMB().
void * memb_alloc (struct memb_blocks *m)
 Allocate a memory block from a block of memory declared with MEMB().
char memb_free (struct memb_blocks *m, void *ptr)
 Deallocate a memory block from a memory block previously declared with MEMB().
46 |


Generated on Mon Jun 12 10:23:01 2006 for uIP 1.0 by  47 | 48 | doxygen 1.4.6
49 | 50 | 51 | -------------------------------------------------------------------------------- /doc/html/a00125.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: uip/lc.h File Reference 4 | 5 | 6 | 7 | 8 |
9 |
16 |
17 |
21 |

uip/lc.h File Reference


Detailed Description

22 | Local continuations. 23 |

24 |

Author:
Adam Dunkels <adam@sics.se>
25 | 26 |

27 | Definition in file lc.h. 28 |

29 | #include "lc-switch.h"
30 | 31 |

32 | Go to the source code of this file. 33 | 34 |
35 |


Generated on Mon Jun 12 10:23:01 2006 for uIP 1.0 by  36 | 37 | doxygen 1.4.6
38 | 39 | 40 | -------------------------------------------------------------------------------- /doc/html/a00129.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: uip/timer.c File Reference 4 | 5 | 6 | 7 | 8 |
9 |
16 |
17 |
21 |

uip/timer.c File Reference


Detailed Description

22 | Timer library implementation. 23 |

24 |

Author:
Adam Dunkels <adam@sics.se>
25 | 26 |

27 | Definition in file timer.c. 28 |

29 | #include "clock.h"
30 | #include "timer.h"
31 | 32 |

33 | Go to the source code of this file. 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 |

Functions

void timer_set (struct timer *t, clock_time_t interval)
 Set a timer.
void timer_reset (struct timer *t)
 Reset the timer with the same interval.
void timer_restart (struct timer *t)
 Restart the timer from the current point in time.
int timer_expired (struct timer *t)
 Check if a timer has expired.
49 |


Generated on Mon Jun 12 10:23:01 2006 for uIP 1.0 by  50 | 51 | doxygen 1.4.6
52 | 53 | 54 | -------------------------------------------------------------------------------- /doc/html/a00134.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: uip/uip-split.h File Reference 4 | 5 | 6 | 7 | 8 |
9 |
16 |
17 |
21 |

uip/uip-split.h File Reference


Detailed Description

22 | Module for splitting outbound TCP segments in two to avoid the delayed ACK throughput degradation. 23 |

24 |

Author:
Adam Dunkels <adam@sics.se>
25 | 26 |

27 | Definition in file uip-split.h. 28 |

29 | 30 |

31 | Go to the source code of this file. 32 | 33 | 34 | 35 | 36 | 37 |

Functions

void uip_split_output (void)
 Handle outgoing packets.
38 |


Generated on Mon Jun 12 10:23:01 2006 for uIP 1.0 by  39 | 40 | doxygen 1.4.6
41 | 42 | 43 | -------------------------------------------------------------------------------- /doc/html/a00143.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: Applications 4 | 5 | 6 | 7 | 8 |
9 |
16 |

Applications


Detailed Description

17 | The uIP distribution contains a number of example applications that can be either used directory or studied when learning to develop applications for uIP. 18 |

19 | 20 |

21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |

29 |

30 | 31 | 32 | 33 |

34 |

35 | 36 | 37 | 38 |

39 |

40 | 41 | 42 | 43 |

44 |

45 | 46 | 47 | 48 |

49 |


Modules

 DNS resolver
 The uIP DNS resolver functions are used to lookup a hostname and map it to a numerical IP address.
 SMTP E-mail sender
 The Simple Mail Transfer Protocol (SMTP) as defined by RFC821 is the standard way of sending and transfering e-mail on the Internet.
 Hello, world
 A small example showing how to write applications with protosockets.
 Web client
 This example shows a HTTP client that is able to download web pages and files from web servers.
 Web server
 The uIP web server is a very simplistic implementation of an HTTP server.
50 |


Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  51 | 52 | doxygen 1.4.6
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/html/doxygen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdunkels/uip/a49def743f6e5c7d0c0f2d724f0b8e0c563a4a37/doc/html/doxygen.png -------------------------------------------------------------------------------- /doc/html/examples.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: Examples 4 | 5 | 6 | 7 | 8 |
9 |
16 |

uIP 1.0 Examples

Here is a list of all examples: 34 |
Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  35 | 36 | doxygen 1.4.6
37 | 38 | 39 | -------------------------------------------------------------------------------- /doc/html/ftv2blank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdunkels/uip/a49def743f6e5c7d0c0f2d724f0b8e0c563a4a37/doc/html/ftv2blank.png -------------------------------------------------------------------------------- /doc/html/ftv2doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdunkels/uip/a49def743f6e5c7d0c0f2d724f0b8e0c563a4a37/doc/html/ftv2doc.png -------------------------------------------------------------------------------- /doc/html/ftv2folderclosed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdunkels/uip/a49def743f6e5c7d0c0f2d724f0b8e0c563a4a37/doc/html/ftv2folderclosed.png -------------------------------------------------------------------------------- /doc/html/ftv2folderopen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdunkels/uip/a49def743f6e5c7d0c0f2d724f0b8e0c563a4a37/doc/html/ftv2folderopen.png -------------------------------------------------------------------------------- /doc/html/ftv2lastnode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdunkels/uip/a49def743f6e5c7d0c0f2d724f0b8e0c563a4a37/doc/html/ftv2lastnode.png -------------------------------------------------------------------------------- /doc/html/ftv2link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdunkels/uip/a49def743f6e5c7d0c0f2d724f0b8e0c563a4a37/doc/html/ftv2link.png -------------------------------------------------------------------------------- /doc/html/ftv2mlastnode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdunkels/uip/a49def743f6e5c7d0c0f2d724f0b8e0c563a4a37/doc/html/ftv2mlastnode.png -------------------------------------------------------------------------------- /doc/html/ftv2mnode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdunkels/uip/a49def743f6e5c7d0c0f2d724f0b8e0c563a4a37/doc/html/ftv2mnode.png -------------------------------------------------------------------------------- /doc/html/ftv2node.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdunkels/uip/a49def743f6e5c7d0c0f2d724f0b8e0c563a4a37/doc/html/ftv2node.png -------------------------------------------------------------------------------- /doc/html/ftv2plastnode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdunkels/uip/a49def743f6e5c7d0c0f2d724f0b8e0c563a4a37/doc/html/ftv2plastnode.png -------------------------------------------------------------------------------- /doc/html/ftv2pnode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdunkels/uip/a49def743f6e5c7d0c0f2d724f0b8e0c563a4a37/doc/html/ftv2pnode.png -------------------------------------------------------------------------------- /doc/html/ftv2vertline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdunkels/uip/a49def743f6e5c7d0c0f2d724f0b8e0c563a4a37/doc/html/ftv2vertline.png -------------------------------------------------------------------------------- /doc/html/globals.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: Data Fields 4 | 5 | 6 | 7 | 8 |
9 |
16 |
17 |
21 |
22 | 29 |
30 |
31 |
    32 |
  • _
  • 33 |
  • a
  • 34 |
  • b
  • 35 |
  • d
  • 36 |
  • e
  • 37 |
  • f
  • 38 |
  • h
  • 39 |
  • i
  • 40 |
  • l
  • 41 |
  • m
  • 42 |
  • n
  • 43 |
  • p
  • 44 |
  • r
  • 45 |
  • s
  • 46 |
  • t
  • 47 |
  • u
  • 48 |
  • w
  • 49 |
50 |
51 | 52 |

53 | Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation: 54 |

55 |

- _ -

58 |
Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  59 | 60 | doxygen 1.4.6
61 | 62 | 63 | -------------------------------------------------------------------------------- /doc/html/globals_0x61.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: Data Fields 4 | 5 | 6 | 7 | 8 |
9 |
16 |
17 |
21 |
22 | 29 |
30 |
31 |
    32 |
  • _
  • 33 |
  • a
  • 34 |
  • b
  • 35 |
  • d
  • 36 |
  • e
  • 37 |
  • f
  • 38 |
  • h
  • 39 |
  • i
  • 40 |
  • l
  • 41 |
  • m
  • 42 |
  • n
  • 43 |
  • p
  • 44 |
  • r
  • 45 |
  • s
  • 46 |
  • t
  • 47 |
  • u
  • 48 |
  • w
  • 49 |
50 |
51 | 52 |

53 | Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation: 54 |

55 |

- a -

60 |
Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  61 | 62 | doxygen 1.4.6
63 | 64 | 65 | -------------------------------------------------------------------------------- /doc/html/globals_0x62.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: Data Fields 4 | 5 | 6 | 7 | 8 |
9 |
16 |
17 |
21 |
22 | 29 |
30 |
31 |
    32 |
  • _
  • 33 |
  • a
  • 34 |
  • b
  • 35 |
  • d
  • 36 |
  • e
  • 37 |
  • f
  • 38 |
  • h
  • 39 |
  • i
  • 40 |
  • l
  • 41 |
  • m
  • 42 |
  • n
  • 43 |
  • p
  • 44 |
  • r
  • 45 |
  • s
  • 46 |
  • t
  • 47 |
  • u
  • 48 |
  • w
  • 49 |
50 |
51 | 52 |

53 | Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation: 54 |

55 |

- b -

58 |
Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  59 | 60 | doxygen 1.4.6
61 | 62 | 63 | -------------------------------------------------------------------------------- /doc/html/globals_0x65.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: Data Fields 4 | 5 | 6 | 7 | 8 |
9 |
16 |
17 |
21 |
22 | 29 |
30 |
31 |
    32 |
  • _
  • 33 |
  • a
  • 34 |
  • b
  • 35 |
  • d
  • 36 |
  • e
  • 37 |
  • f
  • 38 |
  • h
  • 39 |
  • i
  • 40 |
  • l
  • 41 |
  • m
  • 42 |
  • n
  • 43 |
  • p
  • 44 |
  • r
  • 45 |
  • s
  • 46 |
  • t
  • 47 |
  • u
  • 48 |
  • w
  • 49 |
50 |
51 | 52 |

53 | Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation: 54 |

55 |

- e -

58 |
Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  59 | 60 | doxygen 1.4.6
61 | 62 | 63 | -------------------------------------------------------------------------------- /doc/html/globals_0x66.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: Data Fields 4 | 5 | 6 | 7 | 8 |
9 |
16 |
17 |
21 |
22 | 29 |
30 |
31 |
    32 |
  • _
  • 33 |
  • a
  • 34 |
  • b
  • 35 |
  • d
  • 36 |
  • e
  • 37 |
  • f
  • 38 |
  • h
  • 39 |
  • i
  • 40 |
  • l
  • 41 |
  • m
  • 42 |
  • n
  • 43 |
  • p
  • 44 |
  • r
  • 45 |
  • s
  • 46 |
  • t
  • 47 |
  • u
  • 48 |
  • w
  • 49 |
50 |
51 | 52 |

53 | Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation: 54 |

55 |

- f -

58 |
Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  59 | 60 | doxygen 1.4.6
61 | 62 | 63 | -------------------------------------------------------------------------------- /doc/html/globals_0x6e.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: Data Fields 4 | 5 | 6 | 7 | 8 |
9 |
16 |
17 |
21 |
22 | 29 |
30 |
31 |
    32 |
  • _
  • 33 |
  • a
  • 34 |
  • b
  • 35 |
  • d
  • 36 |
  • e
  • 37 |
  • f
  • 38 |
  • h
  • 39 |
  • i
  • 40 |
  • l
  • 41 |
  • m
  • 42 |
  • n
  • 43 |
  • p
  • 44 |
  • r
  • 45 |
  • s
  • 46 |
  • t
  • 47 |
  • u
  • 48 |
  • w
  • 49 |
50 |
51 | 52 |

53 | Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation: 54 |

55 |

- n -

59 |
Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  60 | 61 | doxygen 1.4.6
62 | 63 | 64 | -------------------------------------------------------------------------------- /doc/html/globals_defs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: Data Fields 4 | 5 | 6 | 7 | 8 |
9 |
16 |
17 |
21 |
22 | 29 |
30 |
31 |
    32 |
  • _
  • 33 |
  • a
  • 34 |
  • b
  • 35 |
  • d
  • 36 |
  • e
  • 37 |
  • f
  • 38 |
  • h
  • 39 |
  • i
  • 40 |
  • l
  • 41 |
  • m
  • 42 |
  • n
  • 43 |
  • p
  • 44 |
  • r
  • 45 |
  • s
  • 46 |
  • t
  • 47 |
  • u
  • 48 |
  • w
  • 49 |
50 |
51 | 52 |

53 |   54 |

55 |

- _ -

58 |
Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  59 | 60 | doxygen 1.4.6
61 | 62 | 63 | -------------------------------------------------------------------------------- /doc/html/globals_defs_0x61.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: Data Fields 4 | 5 | 6 | 7 | 8 |
9 |
16 |
17 |
21 |
22 | 29 |
30 |
31 |
    32 |
  • _
  • 33 |
  • a
  • 34 |
  • b
  • 35 |
  • d
  • 36 |
  • e
  • 37 |
  • f
  • 38 |
  • h
  • 39 |
  • i
  • 40 |
  • l
  • 41 |
  • m
  • 42 |
  • n
  • 43 |
  • p
  • 44 |
  • r
  • 45 |
  • s
  • 46 |
  • t
  • 47 |
  • u
  • 48 |
  • w
  • 49 |
50 |
51 | 52 |

53 |   54 |

55 |

- a -

60 |
Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  61 | 62 | doxygen 1.4.6
63 | 64 | 65 | -------------------------------------------------------------------------------- /doc/html/globals_defs_0x62.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: Data Fields 4 | 5 | 6 | 7 | 8 |
9 |
16 |
17 |
21 |
22 | 29 |
30 |
31 |
    32 |
  • _
  • 33 |
  • a
  • 34 |
  • b
  • 35 |
  • d
  • 36 |
  • e
  • 37 |
  • f
  • 38 |
  • h
  • 39 |
  • i
  • 40 |
  • l
  • 41 |
  • m
  • 42 |
  • n
  • 43 |
  • p
  • 44 |
  • r
  • 45 |
  • s
  • 46 |
  • t
  • 47 |
  • u
  • 48 |
  • w
  • 49 |
50 |
51 | 52 |

53 |   54 |

55 |

- b -

58 |
Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  59 | 60 | doxygen 1.4.6
61 | 62 | 63 | -------------------------------------------------------------------------------- /doc/html/globals_defs_0x65.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: Data Fields 4 | 5 | 6 | 7 | 8 |
9 |
16 |
17 |
21 |
22 | 29 |
30 |
31 |
    32 |
  • _
  • 33 |
  • a
  • 34 |
  • b
  • 35 |
  • d
  • 36 |
  • e
  • 37 |
  • f
  • 38 |
  • h
  • 39 |
  • i
  • 40 |
  • l
  • 41 |
  • m
  • 42 |
  • n
  • 43 |
  • p
  • 44 |
  • r
  • 45 |
  • s
  • 46 |
  • t
  • 47 |
  • u
  • 48 |
  • w
  • 49 |
50 |
51 | 52 |

53 |   54 |

55 |

- e -

58 |
Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  59 | 60 | doxygen 1.4.6
61 | 62 | 63 | -------------------------------------------------------------------------------- /doc/html/globals_defs_0x66.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: Data Fields 4 | 5 | 6 | 7 | 8 |
9 |
16 |
17 |
21 |
22 | 29 |
30 |
31 |
    32 |
  • _
  • 33 |
  • a
  • 34 |
  • b
  • 35 |
  • d
  • 36 |
  • e
  • 37 |
  • f
  • 38 |
  • h
  • 39 |
  • i
  • 40 |
  • l
  • 41 |
  • m
  • 42 |
  • n
  • 43 |
  • p
  • 44 |
  • r
  • 45 |
  • s
  • 46 |
  • t
  • 47 |
  • u
  • 48 |
  • w
  • 49 |
50 |
51 | 52 |

53 |   54 |

55 |

- f -

58 |
Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  59 | 60 | doxygen 1.4.6
61 | 62 | 63 | -------------------------------------------------------------------------------- /doc/html/globals_defs_0x68.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: Data Fields 4 | 5 | 6 | 7 | 8 |
9 |
16 |
17 |
21 |
22 | 29 |
30 |
31 |
    32 |
  • _
  • 33 |
  • a
  • 34 |
  • b
  • 35 |
  • d
  • 36 |
  • e
  • 37 |
  • f
  • 38 |
  • h
  • 39 |
  • i
  • 40 |
  • l
  • 41 |
  • m
  • 42 |
  • n
  • 43 |
  • p
  • 44 |
  • r
  • 45 |
  • s
  • 46 |
  • t
  • 47 |
  • u
  • 48 |
  • w
  • 49 |
50 |
51 | 52 |

53 |   54 |

55 |

- h -

63 |
Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  64 | 65 | doxygen 1.4.6
66 | 67 | 68 | -------------------------------------------------------------------------------- /doc/html/globals_defs_0x6d.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: Data Fields 4 | 5 | 6 | 7 | 8 |
9 |
16 |
17 |
21 |
22 | 29 |
30 |
31 |
    32 |
  • _
  • 33 |
  • a
  • 34 |
  • b
  • 35 |
  • d
  • 36 |
  • e
  • 37 |
  • f
  • 38 |
  • h
  • 39 |
  • i
  • 40 |
  • l
  • 41 |
  • m
  • 42 |
  • n
  • 43 |
  • p
  • 44 |
  • r
  • 45 |
  • s
  • 46 |
  • t
  • 47 |
  • u
  • 48 |
  • w
  • 49 |
50 |
51 | 52 |

53 |   54 |

55 |

- m -

62 |
Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  63 | 64 | doxygen 1.4.6
65 | 66 | 67 | -------------------------------------------------------------------------------- /doc/html/globals_defs_0x6e.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: Data Fields 4 | 5 | 6 | 7 | 8 |
9 |
16 |
17 |
21 |
22 | 29 |
30 |
31 |
    32 |
  • _
  • 33 |
  • a
  • 34 |
  • b
  • 35 |
  • d
  • 36 |
  • e
  • 37 |
  • f
  • 38 |
  • h
  • 39 |
  • i
  • 40 |
  • l
  • 41 |
  • m
  • 42 |
  • n
  • 43 |
  • p
  • 44 |
  • r
  • 45 |
  • s
  • 46 |
  • t
  • 47 |
  • u
  • 48 |
  • w
  • 49 |
50 |
51 | 52 |

53 |   54 |

55 |

- n -

59 |
Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  60 | 61 | doxygen 1.4.6
62 | 63 | 64 | -------------------------------------------------------------------------------- /doc/html/globals_defs_0x72.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: Data Fields 4 | 5 | 6 | 7 | 8 |
9 |
16 |
17 |
21 |
22 | 29 |
30 |
31 |
    32 |
  • _
  • 33 |
  • a
  • 34 |
  • b
  • 35 |
  • d
  • 36 |
  • e
  • 37 |
  • f
  • 38 |
  • h
  • 39 |
  • i
  • 40 |
  • l
  • 41 |
  • m
  • 42 |
  • n
  • 43 |
  • p
  • 44 |
  • r
  • 45 |
  • s
  • 46 |
  • t
  • 47 |
  • u
  • 48 |
  • w
  • 49 |
50 |
51 | 52 |

53 |   54 |

55 |

- r -

58 |
Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  59 | 60 | doxygen 1.4.6
61 | 62 | 63 | -------------------------------------------------------------------------------- /doc/html/globals_type.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: Data Fields 4 | 5 | 6 | 7 | 8 |
9 |
16 |
17 |
21 |
22 | 29 |
30 |   31 |

32 |

43 |
Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  44 | 45 | doxygen 1.4.6
46 | 47 | 48 | -------------------------------------------------------------------------------- /doc/html/hierarchy.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: Hierarchical Index 4 | 5 | 6 | 7 | 8 |
9 |
16 | 23 |

uIP 1.0 Class Hierarchy

This inheritance list is sorted roughly, but not completely, alphabetically: 46 |
Generated on Mon Jun 12 10:23:01 2006 for uIP 1.0 by  47 | 48 | doxygen 1.4.6
49 | 50 | 51 | -------------------------------------------------------------------------------- /doc/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /doc/html/modules.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | uIP 1.0: Module Index 4 | 5 | 6 | 7 | 8 |
9 |
16 |

uIP 1.0 Modules

Here is a list of all modules: 47 |
Generated on Mon Jun 12 10:23:02 2006 for uIP 1.0 by  48 | 49 | doxygen 1.4.6
50 | 51 | 52 | -------------------------------------------------------------------------------- /doc/html/tab_b.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdunkels/uip/a49def743f6e5c7d0c0f2d724f0b8e0c563a4a37/doc/html/tab_b.gif -------------------------------------------------------------------------------- /doc/html/tab_l.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdunkels/uip/a49def743f6e5c7d0c0f2d724f0b8e0c563a4a37/doc/html/tab_l.gif -------------------------------------------------------------------------------- /doc/html/tab_r.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdunkels/uip/a49def743f6e5c7d0c0f2d724f0b8e0c563a4a37/doc/html/tab_r.gif -------------------------------------------------------------------------------- /doc/html/tabs.css: -------------------------------------------------------------------------------- 1 | /* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */ 2 | 3 | DIV.tabs 4 | { 5 | float : left; 6 | width : 100%; 7 | background : url("tab_b.gif") repeat-x bottom; 8 | margin-bottom : 4px; 9 | } 10 | 11 | DIV.tabs UL 12 | { 13 | margin : 0px; 14 | padding-left : 10px; 15 | list-style : none; 16 | } 17 | 18 | DIV.tabs LI, DIV.tabs FORM 19 | { 20 | display : inline; 21 | margin : 0px; 22 | padding : 0px; 23 | } 24 | 25 | DIV.tabs FORM 26 | { 27 | float : right; 28 | } 29 | 30 | DIV.tabs A 31 | { 32 | float : left; 33 | background : url("tab_r.gif") no-repeat right top; 34 | border-bottom : 1px solid #84B0C7; 35 | font-size : x-small; 36 | font-weight : bold; 37 | text-decoration : none; 38 | } 39 | 40 | DIV.tabs A:hover 41 | { 42 | background-position: 100% -150px; 43 | } 44 | 45 | DIV.tabs A:link, DIV.tabs A:visited, 46 | DIV.tabs A:active, DIV.tabs A:hover 47 | { 48 | color: #1A419D; 49 | } 50 | 51 | DIV.tabs SPAN 52 | { 53 | float : left; 54 | display : block; 55 | background : url("tab_l.gif") no-repeat left top; 56 | padding : 5px 9px; 57 | white-space : nowrap; 58 | } 59 | 60 | DIV.tabs INPUT 61 | { 62 | float : right; 63 | display : inline; 64 | font-size : 1em; 65 | } 66 | 67 | DIV.tabs TD 68 | { 69 | font-size : x-small; 70 | font-weight : bold; 71 | text-decoration : none; 72 | } 73 | 74 | 75 | 76 | /* Commented Backslash Hack hides rule from IE5-Mac \*/ 77 | DIV.tabs SPAN {float : none;} 78 | /* End IE5-Mac hack */ 79 | 80 | DIV.tabs A:hover SPAN 81 | { 82 | background-position: 0% -150px; 83 | } 84 | 85 | DIV.tabs LI#current A 86 | { 87 | background-position: 100% -150px; 88 | border-width : 0px; 89 | } 90 | 91 | DIV.tabs LI#current SPAN 92 | { 93 | background-position: 0% -150px; 94 | padding-bottom : 6px; 95 | } 96 | 97 | DIV.nav 98 | { 99 | background : none; 100 | border : none; 101 | border-bottom : 1px solid #84B0C7; 102 | } 103 | -------------------------------------------------------------------------------- /doc/mobisys2003.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdunkels/uip/a49def743f6e5c7d0c0f2d724f0b8e0c563a4a37/doc/mobisys2003.pdf -------------------------------------------------------------------------------- /doc/sicslogo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdunkels/uip/a49def743f6e5c7d0c0f2d724f0b8e0c563a4a37/doc/sicslogo.pdf -------------------------------------------------------------------------------- /doc/uip-code-style.txt: -------------------------------------------------------------------------------- 1 | /** 2 | \example uip-code-style.c 3 | */ 4 | -------------------------------------------------------------------------------- /doc/uip-refman.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamdunkels/uip/a49def743f6e5c7d0c0f2d724f0b8e0c563a4a37/doc/uip-refman.pdf -------------------------------------------------------------------------------- /uip-1.0-changelog.txt: -------------------------------------------------------------------------------- 1 | * A new API: protosockets that are similar to BSD sockets but does not 2 | require any underlying multithreading system. 3 | 4 | * Very rudimentary IPv6 support 5 | 6 | * New application: DHCP client. Web server rewritten with protosockets. 7 | 8 | * Removed uIP zero-copy functionality in order to simplify uIP device 9 | driver coding: outbound packets are now *always* stored in full in 10 | the uip_buf buffer. 11 | 12 | * Checksum computation is now part of uip.c, but it still is possible 13 | to implement them in assembly code by specifying a configuration 14 | option. Checksum code now runs on architectures with 2-byte alignment. 15 | 16 | * Added TCP persistent timer. 17 | 18 | * Made all IP address representations use the new uip_ipaddr_ip 19 | datatype for clarity. 20 | 21 | * Updated window behavior so that sending to a host with a small open 22 | window works better now. 23 | 24 | * UDP API change: uip_udp_new() now takes port numbers in network byte 25 | order like TCP functions. 26 | 27 | * Allow reception of packets when no IP address is configured to make 28 | DHCP work. 29 | 30 | * Moved Ethernet address into main uIP module from ARP module. 31 | 32 | * Made constants explicit #defines and moved them out of the code 33 | (header sizes, TCP options, TCP header length field). 34 | 35 | * If uip_len is less than that reported by the IP header, the packet 36 | is discarded. If uip_len is greater than the length reported by the 37 | IP header, uip_len is adjusted. 38 | 39 | * Moved header size definitions into header file. 40 | 41 | * Added uIP call for polling an application without triggering any 42 | timer events. Removed redundant assignments of uip_len and uip_slen. 43 | 44 | * Removed compiler warning about icmp_input label being defined when 45 | UIP_PINGADDRCONF was not used. 46 | 47 | * Added UIP_APPDATA_SIZE macro that holds the available buffer size 48 | for user data. 49 | 50 | * Added uip_udp_bind() call. 51 | 52 | * Moved checksum code into main uIP module. 53 | 54 | * Switched the TCP, UDP and IP header structures to be structs rather 55 | than typedefs. 56 | 57 | * Prefixed TCP state names with UIP_ to avoid name space 58 | contamination. 59 | 60 | * Changed declarations of uip_appdatap and friends to void * to avoid 61 | explicit typecasts. 62 | 63 | * Bugfixes 64 | 65 | o TCP: Fixed bug with high byte of peer window size. 66 | 67 | o TCP: Fixed bug that in some cases prevented concurrent reception and 68 | transmission of TCP data. 69 | 70 | o TCP: uip_connect() didn't correctly calculate age of TIME_WAIT 71 | connections. 72 | 73 | o TCP: Array index for uip_conns[] array was out of bounds in 74 | comparison. Comparison changed to make index within bounds. 75 | 76 | o TCP: if the remote host crashes and tries to reestablish an old 77 | connection, uIP should respond with an ACK with the correct 78 | sequence and acknowledgment numbers, to which the remote host 79 | should respond with an ACK. uIP did not respond with the correct 80 | ACK. 81 | 82 | o TCP: Fixed check for SYNACK segment: now checks only relevant TCP 83 | control flags and discards flags reserved for future expansion. 84 | 85 | o TCP: Fixed bug where uIP did not inform application that a connection 86 | had been aborted during an active open. 87 | 88 | o TCP: FIN segment was accepted even though application had stopped 89 | incoming data with uip_stop(). 90 | 91 | o TCP: A FINACK segment would not always correctly acknowledge data. 92 | 93 | o UDP: checksums are now calculated after all fields have been 94 | filled in. 95 | 96 | o UDP: network byte order on lastport in uip_udp_new(). 97 | 98 | o IP: memset() bugs in IP fragment reassembly code fixed. 99 | -------------------------------------------------------------------------------- /uip/Makefile.include: -------------------------------------------------------------------------------- 1 | 2 | 3 | ifdef APPS 4 | APPDIRS = $(foreach APP, $(APPS), ../apps/$(APP)) 5 | -include $(foreach APP, $(APPS), ../apps/$(APP)/Makefile.$(APP)) 6 | CFLAGS += $(addprefix -I../apps/,$(APPS)) 7 | endif 8 | 9 | ifndef CCDEP 10 | CCDEP = $(CC) 11 | endif 12 | ifndef CCDEPCFLAGS 13 | CCDEPCFLAGS = $(CFLAGS) 14 | endif 15 | ifndef OBJECTDIR 16 | OBJECTDIR = obj 17 | endif 18 | 19 | ifeq (${wildcard $(OBJECTDIR)},) 20 | DUMMY := ${shell mkdir $(OBJECTDIR)} 21 | endif 22 | 23 | 24 | vpath %.c . ../uip ../lib $(APPDIRS) 25 | 26 | $(OBJECTDIR)/%.o: %.c 27 | $(CC) $(CFLAGS) -c $< -o $@ 28 | 29 | $(OBJECTDIR)/%.d: %.c 30 | @set -e; rm -f $@; \ 31 | $(CCDEP) -MM $(CCDEPCFLAGS) $< > $@.$$$$; \ 32 | sed 's,\($*\)\.o[ :]*,$(OBJECTDIR)/\1.o $@ : ,g' < $@.$$$$ > $@; \ 33 | rm -f $@.$$$$ 34 | 35 | UIP_SOURCES=uip.c uip_arp.c uiplib.c psock.c timer.c uip-neighbor.c 36 | 37 | 38 | ifneq ($(MAKECMDGOALS),clean) 39 | -include $(addprefix $(OBJECTDIR)/,$(UIP_SOURCES:.c=.d) \ 40 | $(APP_SOURCES:.c=.d)) 41 | endif 42 | 43 | uip.a: ${addprefix $(OBJECTDIR)/, $(UIP_SOURCES:.c=.o)} 44 | $(AR) rcf $@ $^ 45 | 46 | apps.a: ${addprefix $(OBJECTDIR)/, $(APP_SOURCES:.c=.o)} 47 | $(AR) rcf $@ $^ 48 | -------------------------------------------------------------------------------- /uip/clock.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \defgroup clock Clock interface 3 | * 4 | * The clock interface is the interface between the \ref timer "timer library" 5 | * and the platform specific clock functionality. The clock 6 | * interface must be implemented for each platform that uses the \ref 7 | * timer "timer library". 8 | * 9 | * The clock interface does only one this: it measures time. The clock 10 | * interface provides a macro, CLOCK_SECOND, which corresponds to one 11 | * second of system time. 12 | * 13 | * \sa \ref timer "Timer library" 14 | * 15 | * @{ 16 | */ 17 | 18 | /* 19 | * Copyright (c) 2004, Swedish Institute of Computer Science. 20 | * All rights reserved. 21 | * 22 | * Redistribution and use in source and binary forms, with or without 23 | * modification, are permitted provided that the following conditions 24 | * are met: 25 | * 1. Redistributions of source code must retain the above copyright 26 | * notice, this list of conditions and the following disclaimer. 27 | * 2. Redistributions in binary form must reproduce the above copyright 28 | * notice, this list of conditions and the following disclaimer in the 29 | * documentation and/or other materials provided with the distribution. 30 | * 3. Neither the name of the Institute nor the names of its contributors 31 | * may be used to endorse or promote products derived from this software 32 | * without specific prior written permission. 33 | * 34 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 35 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 36 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 37 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 38 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 39 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 40 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 41 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 42 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 43 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 44 | * SUCH DAMAGE. 45 | * 46 | * This file is part of the uIP TCP/IP stack 47 | * 48 | * Author: Adam Dunkels 49 | * 50 | * $Id: clock.h,v 1.3 2006/06/11 21:46:39 adam Exp $ 51 | */ 52 | #ifndef __CLOCK_H__ 53 | #define __CLOCK_H__ 54 | 55 | #include "clock-arch.h" 56 | 57 | /** 58 | * Initialize the clock library. 59 | * 60 | * This function initializes the clock library and should be called 61 | * from the main() function of the system. 62 | * 63 | */ 64 | void clock_init(void); 65 | 66 | /** 67 | * Get the current clock time. 68 | * 69 | * This function returns the current system clock time. 70 | * 71 | * \return The current clock time, measured in system ticks. 72 | */ 73 | clock_time_t clock_time(void); 74 | 75 | /** 76 | * A second, measured in system clock time. 77 | * 78 | * \hideinitializer 79 | */ 80 | #ifdef CLOCK_CONF_SECOND 81 | #define CLOCK_SECOND CLOCK_CONF_SECOND 82 | #else 83 | #define CLOCK_SECOND (clock_time_t)32 84 | #endif 85 | 86 | #endif /* __CLOCK_H__ */ 87 | 88 | /** @} */ 89 | -------------------------------------------------------------------------------- /uip/lc-addrlabels.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2005, Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * This file is part of the uIP TCP/IP stack 30 | * 31 | * Author: Adam Dunkels 32 | * 33 | * $Id: lc-addrlabels.h,v 1.3 2006/06/12 08:00:30 adam Exp $ 34 | */ 35 | 36 | /** 37 | * \addtogroup lc 38 | * @{ 39 | */ 40 | 41 | /** 42 | * \file 43 | * Implementation of local continuations based on the "Labels as 44 | * values" feature of gcc 45 | * \author 46 | * Adam Dunkels 47 | * 48 | * This implementation of local continuations is based on a special 49 | * feature of the GCC C compiler called "labels as values". This 50 | * feature allows assigning pointers with the address of the code 51 | * corresponding to a particular C label. 52 | * 53 | * For more information, see the GCC documentation: 54 | * http://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html 55 | * 56 | * Thanks to dividuum for finding the nice local scope label 57 | * implementation. 58 | */ 59 | 60 | #ifndef __LC_ADDRLABELS_H__ 61 | #define __LC_ADDRLABELS_H__ 62 | 63 | /** \hideinitializer */ 64 | typedef void * lc_t; 65 | 66 | #define LC_INIT(s) s = NULL 67 | 68 | 69 | #define LC_RESUME(s) \ 70 | do { \ 71 | if(s != NULL) { \ 72 | goto *s; \ 73 | } \ 74 | } while(0) 75 | 76 | #define LC_SET(s) \ 77 | do { ({ __label__ resume; resume: (s) = &&resume; }); }while(0) 78 | 79 | #define LC_END(s) 80 | 81 | #endif /* __LC_ADDRLABELS_H__ */ 82 | 83 | /** @} */ 84 | -------------------------------------------------------------------------------- /uip/lc-switch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2005, Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * This file is part of the uIP TCP/IP stack 30 | * 31 | * Author: Adam Dunkels 32 | * 33 | * $Id: lc-switch.h,v 1.2 2006/06/12 08:00:30 adam Exp $ 34 | */ 35 | 36 | /** 37 | * \addtogroup lc 38 | * @{ 39 | */ 40 | 41 | /** 42 | * \file 43 | * Implementation of local continuations based on switch() statment 44 | * \author Adam Dunkels 45 | * 46 | * This implementation of local continuations uses the C switch() 47 | * statement to resume execution of a function somewhere inside the 48 | * function's body. The implementation is based on the fact that 49 | * switch() statements are able to jump directly into the bodies of 50 | * control structures such as if() or while() statmenets. 51 | * 52 | * This implementation borrows heavily from Simon Tatham's coroutines 53 | * implementation in C: 54 | * http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html 55 | */ 56 | 57 | #ifndef __LC_SWITCH_H__ 58 | #define __LC_SWTICH_H__ 59 | 60 | /* WARNING! lc implementation using switch() does not work if an 61 | LC_SET() is done within another switch() statement! */ 62 | 63 | /** \hideinitializer */ 64 | typedef unsigned short lc_t; 65 | 66 | #define LC_INIT(s) s = 0; 67 | 68 | #define LC_RESUME(s) switch(s) { case 0: 69 | 70 | #define LC_SET(s) s = __LINE__; case __LINE__: 71 | 72 | #define LC_END(s) } 73 | 74 | #endif /* __LC_SWITCH_H__ */ 75 | 76 | /** @} */ 77 | -------------------------------------------------------------------------------- /uip/timer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \defgroup timer Timer library 3 | * 4 | * The timer library provides functions for setting, resetting and 5 | * restarting timers, and for checking if a timer has expired. An 6 | * application must "manually" check if its timers have expired; this 7 | * is not done automatically. 8 | * 9 | * A timer is declared as a \c struct \c timer and all access to the 10 | * timer is made by a pointer to the declared timer. 11 | * 12 | * \note The timer library uses the \ref clock "Clock library" to 13 | * measure time. Intervals should be specified in the format used by 14 | * the clock library. 15 | * 16 | * @{ 17 | */ 18 | 19 | 20 | /** 21 | * \file 22 | * Timer library header file. 23 | * \author 24 | * Adam Dunkels 25 | */ 26 | 27 | /* 28 | * Copyright (c) 2004, Swedish Institute of Computer Science. 29 | * All rights reserved. 30 | * 31 | * Redistribution and use in source and binary forms, with or without 32 | * modification, are permitted provided that the following conditions 33 | * are met: 34 | * 1. Redistributions of source code must retain the above copyright 35 | * notice, this list of conditions and the following disclaimer. 36 | * 2. Redistributions in binary form must reproduce the above copyright 37 | * notice, this list of conditions and the following disclaimer in the 38 | * documentation and/or other materials provided with the distribution. 39 | * 3. Neither the name of the Institute nor the names of its contributors 40 | * may be used to endorse or promote products derived from this software 41 | * without specific prior written permission. 42 | * 43 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 44 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 45 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 46 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 47 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 48 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 49 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 50 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 51 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 52 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 53 | * SUCH DAMAGE. 54 | * 55 | * This file is part of the uIP TCP/IP stack 56 | * 57 | * Author: Adam Dunkels 58 | * 59 | * $Id: timer.h,v 1.3 2006/06/11 21:46:39 adam Exp $ 60 | */ 61 | #ifndef __TIMER_H__ 62 | #define __TIMER_H__ 63 | 64 | #include "clock.h" 65 | 66 | /** 67 | * A timer. 68 | * 69 | * This structure is used for declaring a timer. The timer must be set 70 | * with timer_set() before it can be used. 71 | * 72 | * \hideinitializer 73 | */ 74 | struct timer { 75 | clock_time_t start; 76 | clock_time_t interval; 77 | }; 78 | 79 | void timer_set(struct timer *t, clock_time_t interval); 80 | void timer_reset(struct timer *t); 81 | void timer_restart(struct timer *t); 82 | int timer_expired(struct timer *t); 83 | 84 | #endif /* __TIMER_H__ */ 85 | 86 | /** @} */ 87 | -------------------------------------------------------------------------------- /uip/uip-neighbor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006, Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * This file is part of the uIP TCP/IP stack 30 | * 31 | * $Id: uip-neighbor.h,v 1.2 2006/06/12 08:00:30 adam Exp $ 32 | */ 33 | 34 | /** 35 | * \file 36 | * Header file for database of link-local neighbors, used by 37 | * IPv6 code and to be used by future ARP code. 38 | * \author 39 | * Adam Dunkels 40 | */ 41 | 42 | #ifndef __UIP_NEIGHBOR_H__ 43 | #define __UIP_NEIGHBOR_H__ 44 | 45 | #include "uip.h" 46 | 47 | struct uip_neighbor_addr { 48 | #if UIP_NEIGHBOR_CONF_ADDRTYPE 49 | UIP_NEIGHBOR_CONF_ADDRTYPE addr; 50 | #else 51 | struct uip_eth_addr addr; 52 | #endif 53 | }; 54 | 55 | void uip_neighbor_init(void); 56 | void uip_neighbor_add(uip_ipaddr_t ipaddr, struct uip_neighbor_addr *addr); 57 | void uip_neighbor_update(uip_ipaddr_t ipaddr); 58 | struct uip_neighbor_addr *uip_neighbor_lookup(uip_ipaddr_t ipaddr); 59 | void uip_neighbor_periodic(void); 60 | 61 | #endif /* __UIP-NEIGHBOR_H__ */ 62 | -------------------------------------------------------------------------------- /uip/uiplib.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, Adam Dunkels and the Swedish Institute of 3 | * Computer Science. 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. The name of the author may not be used to endorse or promote 15 | * products derived from this software without specific prior 16 | * written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 19 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 24 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 27 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | * 30 | * This file is part of the uIP TCP/IP stack 31 | * 32 | * $Id: uiplib.c,v 1.2 2006/06/12 08:00:31 adam Exp $ 33 | * 34 | */ 35 | 36 | 37 | #include "uip.h" 38 | #include "uiplib.h" 39 | 40 | 41 | /*-----------------------------------------------------------------------------------*/ 42 | unsigned char 43 | uiplib_ipaddrconv(char *addrstr, unsigned char *ipaddr) 44 | { 45 | unsigned char tmp; 46 | char c; 47 | unsigned char i, j; 48 | 49 | tmp = 0; 50 | 51 | for(i = 0; i < 4; ++i) { 52 | j = 0; 53 | do { 54 | c = *addrstr; 55 | ++j; 56 | if(j > 4) { 57 | return 0; 58 | } 59 | if(c == '.' || c == 0) { 60 | *ipaddr = tmp; 61 | ++ipaddr; 62 | tmp = 0; 63 | } else if(c >= '0' && c <= '9') { 64 | tmp = (tmp * 10) + (c - '0'); 65 | } else { 66 | return 0; 67 | } 68 | ++addrstr; 69 | } while(c != '.' && c != 0); 70 | } 71 | return 1; 72 | } 73 | 74 | /*-----------------------------------------------------------------------------------*/ 75 | -------------------------------------------------------------------------------- /uip/uiplib.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * Various uIP library functions. 4 | * \author 5 | * Adam Dunkels 6 | * 7 | */ 8 | 9 | /* 10 | * Copyright (c) 2002, Adam Dunkels. 11 | * All rights reserved. 12 | * 13 | * Redistribution and use in source and binary forms, with or without 14 | * modification, are permitted provided that the following conditions 15 | * are met: 16 | * 1. Redistributions of source code must retain the above copyright 17 | * notice, this list of conditions and the following disclaimer. 18 | * 2. Redistributions in binary form must reproduce the above 19 | * copyright notice, this list of conditions and the following 20 | * disclaimer in the documentation and/or other materials provided 21 | * with the distribution. 22 | * 3. The name of the author may not be used to endorse or promote 23 | * products derived from this software without specific prior 24 | * written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 27 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 28 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 29 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 30 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 32 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 33 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 34 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 35 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 36 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 37 | * 38 | * This file is part of the uIP TCP/IP stack 39 | * 40 | * $Id: uiplib.h,v 1.1 2006/06/07 09:15:19 adam Exp $ 41 | * 42 | */ 43 | #ifndef __UIPLIB_H__ 44 | #define __UIPLIB_H__ 45 | 46 | /** 47 | * \addtogroup uipconvfunc 48 | * @{ 49 | */ 50 | 51 | /** 52 | * Convert a textual representation of an IP address to a numerical representation. 53 | * 54 | * This function takes a textual representation of an IP address in 55 | * the form a.b.c.d and converts it into a 4-byte array that can be 56 | * used by other uIP functions. 57 | * 58 | * \param addrstr A pointer to a string containing the IP address in 59 | * textual form. 60 | * 61 | * \param addr A pointer to a 4-byte array that will be filled in with 62 | * the numerical representation of the address. 63 | * 64 | * \retval 0 If the IP address could not be parsed. 65 | * \retval Non-zero If the IP address was parsed. 66 | */ 67 | unsigned char uiplib_ipaddrconv(char *addrstr, unsigned char *addr); 68 | 69 | /** @} */ 70 | 71 | #endif /* __UIPLIB_H__ */ 72 | -------------------------------------------------------------------------------- /unix/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2001, Adam Dunkels. 2 | # All rights reserved. 3 | # 4 | # Redistribution and use in source and binary forms, with or without 5 | # modification, are permitted provided that the following conditions 6 | # are met: 7 | # 1. Redistributions of source code must retain the above copyright 8 | # notice, this list of conditions and the following disclaimer. 9 | # 2. Redistributions in binary form must reproduce the above copyright 10 | # notice, this list of conditions and the following disclaimer in the 11 | # documentation and/or other materials provided with the distribution. 12 | # 3. The name of the author may not be used to endorse or promote 13 | # products derived from this software without specific prior 14 | # written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 17 | # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 20 | # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 22 | # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 25 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | # 28 | # This file is part of the uIP TCP/IP stack. 29 | # 30 | # $Id: Makefile,v 1.13 2006/06/11 21:55:03 adam Exp $ 31 | # 32 | 33 | all: uip 34 | 35 | CC = gcc 36 | AR = ar 37 | APPS = webserver 38 | CFLAGS = -Wall -g -I../uip -I. -fpack-struct -Os 39 | -include ../uip/Makefile.include 40 | 41 | uip: $(addprefix $(OBJECTDIR)/, main.o tapdev.o clock-arch.o) apps.a uip.a 42 | 43 | clean: 44 | rm -fr *.o *~ *core uip $(OBJECTDIR) *.a 45 | -------------------------------------------------------------------------------- /unix/clock-arch.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006, Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * This file is part of the uIP TCP/IP stack 30 | * 31 | * $Id: clock-arch.c,v 1.2 2006/06/12 08:00:31 adam Exp $ 32 | */ 33 | 34 | /** 35 | * \file 36 | * Implementation of architecture-specific clock functionality 37 | * \author 38 | * Adam Dunkels 39 | */ 40 | 41 | #include "clock-arch.h" 42 | #include 43 | 44 | /*---------------------------------------------------------------------------*/ 45 | clock_time_t 46 | clock_time(void) 47 | { 48 | struct timeval tv; 49 | struct timezone tz; 50 | 51 | gettimeofday(&tv, &tz); 52 | 53 | return tv.tv_sec * 1000 + tv.tv_usec / 1000; 54 | } 55 | /*---------------------------------------------------------------------------*/ 56 | -------------------------------------------------------------------------------- /unix/clock-arch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006, Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * This file is part of the uIP TCP/IP stack 30 | * 31 | * $Id: clock-arch.h,v 1.2 2006/06/12 08:00:31 adam Exp $ 32 | */ 33 | 34 | #ifndef __CLOCK_ARCH_H__ 35 | #define __CLOCK_ARCH_H__ 36 | 37 | typedef int clock_time_t; 38 | #define CLOCK_CONF_SECOND 1000 39 | 40 | #endif /* __CLOCK_ARCH_H__ */ 41 | -------------------------------------------------------------------------------- /unix/tapdev.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001, Adam Dunkels. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. All advertising materials mentioning features or use of this software 14 | * must display the following acknowledgement: 15 | * This product includes software developed by Adam Dunkels. 16 | * 4. The name of the author may not be used to endorse or promote 17 | * products derived from this software without specific prior 18 | * written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 21 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 24 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 26 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 28 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | * 32 | * This file is part of the uIP TCP/IP stack. 33 | * 34 | * $Id: tapdev.h,v 1.1 2002/01/10 06:22:56 adam Exp $ 35 | * 36 | */ 37 | 38 | #ifndef __TAPDEV_H__ 39 | #define __TAPDEV_H__ 40 | 41 | void tapdev_init(void); 42 | unsigned int tapdev_read(void); 43 | void tapdev_send(void); 44 | 45 | #endif /* __TAPDEV_H__ */ 46 | --------------------------------------------------------------------------------