├── .cproject ├── .project ├── .settings ├── language.settings.xml ├── org.eclipse.cdt.core.prefs └── org.eclipse.cdt.ui.prefs ├── .vscode └── dryrun.log ├── Debug ├── lwip-2.0.2 │ ├── src │ │ ├── api │ │ │ └── subdir.mk │ │ ├── apps │ │ │ ├── httpd │ │ │ │ └── subdir.mk │ │ │ ├── lwiperf │ │ │ │ └── subdir.mk │ │ │ ├── mdns │ │ │ │ └── subdir.mk │ │ │ ├── mqtt │ │ │ │ └── subdir.mk │ │ │ ├── netbiosns │ │ │ │ └── subdir.mk │ │ │ ├── snmp │ │ │ │ └── subdir.mk │ │ │ ├── sntp │ │ │ │ └── subdir.mk │ │ │ └── tftp │ │ │ │ └── subdir.mk │ │ ├── arch │ │ │ ├── pcap.d │ │ │ └── subdir.mk │ │ ├── core │ │ │ ├── ipv4 │ │ │ │ └── subdir.mk │ │ │ ├── ipv6 │ │ │ │ └── subdir.mk │ │ │ └── subdir.mk │ │ └── netif │ │ │ └── subdir.mk │ └── test │ │ └── linux │ │ └── subdir.mk ├── makefile ├── objects.mk └── sources.mk ├── README.md └── lwip-2.0.2 ├── .gitattributes ├── .gitignore ├── CHANGELOG ├── COPYING ├── FILES ├── README ├── UPGRADING ├── doc ├── FILES ├── NO_SYS_SampleCode.c ├── contrib.txt ├── doxygen │ ├── generate.bat │ ├── generate.sh │ ├── lwip.Doxyfile │ ├── main_page.h │ └── output │ │ └── index.html ├── mdns.txt ├── mqtt_client.txt ├── ppp.txt ├── rawapi.txt ├── savannah.txt └── sys_arch.txt ├── src ├── FILES ├── Filelists.mk ├── api │ ├── api_lib.c │ ├── api_msg.c │ ├── err.c │ ├── netbuf.c │ ├── netdb.c │ ├── netifapi.c │ ├── sockets.c │ └── tcpip.c ├── apps │ ├── httpd │ │ ├── fs.c │ │ ├── fs │ │ │ ├── 404.html │ │ │ ├── img │ │ │ │ └── sics.gif │ │ │ └── index.html │ │ ├── fsdata.c │ │ ├── fsdata.h │ │ ├── httpd.c │ │ ├── httpd_structs.h │ │ └── makefsdata │ │ │ ├── makefsdata │ │ │ ├── makefsdata.c │ │ │ └── readme.txt │ ├── lwiperf │ │ └── lwiperf.c │ ├── mdns │ │ └── mdns.c │ ├── mqtt │ │ └── mqtt.c │ ├── netbiosns │ │ └── netbiosns.c │ ├── snmp │ │ ├── snmp_asn1.c │ │ ├── snmp_asn1.h │ │ ├── snmp_core.c │ │ ├── snmp_core_priv.h │ │ ├── snmp_mib2.c │ │ ├── snmp_mib2_icmp.c │ │ ├── snmp_mib2_interfaces.c │ │ ├── snmp_mib2_ip.c │ │ ├── snmp_mib2_snmp.c │ │ ├── snmp_mib2_system.c │ │ ├── snmp_mib2_tcp.c │ │ ├── snmp_mib2_udp.c │ │ ├── snmp_msg.c │ │ ├── snmp_msg.h │ │ ├── snmp_netconn.c │ │ ├── snmp_pbuf_stream.c │ │ ├── snmp_pbuf_stream.h │ │ ├── snmp_raw.c │ │ ├── snmp_scalar.c │ │ ├── snmp_table.c │ │ ├── snmp_threadsync.c │ │ ├── snmp_traps.c │ │ ├── snmpv3.c │ │ ├── snmpv3_dummy.c │ │ ├── snmpv3_mbedtls.c │ │ └── snmpv3_priv.h │ ├── sntp │ │ └── sntp.c │ └── tftp │ │ └── tftp_server.c ├── arch │ ├── cc.h │ ├── if.c │ ├── netif.c │ └── pcap.c ├── core │ ├── def.c │ ├── dns.c │ ├── inet_chksum.c │ ├── init.c │ ├── ip.c │ ├── ipv4 │ │ ├── autoip.c │ │ ├── dhcp.c │ │ ├── etharp.c │ │ ├── icmp.c │ │ ├── igmp.c │ │ ├── ip4.c │ │ ├── ip4_addr.c │ │ └── ip4_frag.c │ ├── ipv6 │ │ ├── dhcp6.c │ │ ├── ethip6.c │ │ ├── icmp6.c │ │ ├── inet6.c │ │ ├── ip6.c │ │ ├── ip6_addr.c │ │ ├── ip6_frag.c │ │ ├── mld6.c │ │ └── nd6.c │ ├── mem.c │ ├── memp.c │ ├── netif.c │ ├── pbuf.c │ ├── raw.c │ ├── stats.c │ ├── sys.c │ ├── tcp.c │ ├── tcp_in.c │ ├── tcp_out.c │ ├── timeouts.c │ └── udp.c ├── include │ ├── lwip │ │ ├── api.h │ │ ├── apps │ │ │ ├── FILES │ │ │ ├── fs.h │ │ │ ├── httpd.h │ │ │ ├── httpd_opts.h │ │ │ ├── lwiperf.h │ │ │ ├── mdns.h │ │ │ ├── mdns_opts.h │ │ │ ├── mdns_priv.h │ │ │ ├── mqtt.h │ │ │ ├── mqtt_opts.h │ │ │ ├── netbiosns.h │ │ │ ├── netbiosns_opts.h │ │ │ ├── snmp.h │ │ │ ├── snmp_core.h │ │ │ ├── snmp_mib2.h │ │ │ ├── snmp_opts.h │ │ │ ├── snmp_scalar.h │ │ │ ├── snmp_table.h │ │ │ ├── snmp_threadsync.h │ │ │ ├── snmpv3.h │ │ │ ├── sntp.h │ │ │ ├── sntp_opts.h │ │ │ ├── tftp_opts.h │ │ │ └── tftp_server.h │ │ ├── arch.h │ │ ├── autoip.h │ │ ├── debug.h │ │ ├── def.h │ │ ├── dhcp.h │ │ ├── dhcp6.h │ │ ├── dns.h │ │ ├── err.h │ │ ├── errno.h │ │ ├── etharp.h │ │ ├── ethip6.h │ │ ├── icmp.h │ │ ├── icmp6.h │ │ ├── igmp.h │ │ ├── inet.h │ │ ├── inet_chksum.h │ │ ├── init.h │ │ ├── ip.h │ │ ├── ip4.h │ │ ├── ip4_addr.h │ │ ├── ip4_frag.h │ │ ├── ip6.h │ │ ├── ip6_addr.h │ │ ├── ip6_frag.h │ │ ├── ip_addr.h │ │ ├── mem.h │ │ ├── memp.h │ │ ├── mld6.h │ │ ├── nd6.h │ │ ├── netbuf.h │ │ ├── netdb.h │ │ ├── netif.h │ │ ├── netifapi.h │ │ ├── opt.h │ │ ├── pbuf.h │ │ ├── priv │ │ │ ├── api_msg.h │ │ │ ├── memp_priv.h │ │ │ ├── memp_std.h │ │ │ ├── nd6_priv.h │ │ │ ├── tcp_priv.h │ │ │ └── tcpip_priv.h │ │ ├── prot │ │ │ ├── autoip.h │ │ │ ├── dhcp.h │ │ │ ├── dns.h │ │ │ ├── etharp.h │ │ │ ├── ethernet.h │ │ │ ├── icmp.h │ │ │ ├── icmp6.h │ │ │ ├── igmp.h │ │ │ ├── ip.h │ │ │ ├── ip4.h │ │ │ ├── ip6.h │ │ │ ├── mld6.h │ │ │ ├── nd6.h │ │ │ ├── tcp.h │ │ │ └── udp.h │ │ ├── raw.h │ │ ├── sio.h │ │ ├── snmp.h │ │ ├── sockets.h │ │ ├── stats.h │ │ ├── sys.h │ │ ├── tcp.h │ │ ├── tcpip.h │ │ ├── timeouts.h │ │ └── udp.h │ ├── netif │ │ ├── etharp.h │ │ ├── ethernet.h │ │ ├── lowpan6.h │ │ ├── lowpan6_opts.h │ │ ├── ppp │ │ │ ├── ccp.h │ │ │ ├── chap-md5.h │ │ │ ├── chap-new.h │ │ │ ├── chap_ms.h │ │ │ ├── eap.h │ │ │ ├── ecp.h │ │ │ ├── eui64.h │ │ │ ├── fsm.h │ │ │ ├── ipcp.h │ │ │ ├── ipv6cp.h │ │ │ ├── lcp.h │ │ │ ├── magic.h │ │ │ ├── mppe.h │ │ │ ├── polarssl │ │ │ │ ├── arc4.h │ │ │ │ ├── des.h │ │ │ │ ├── md4.h │ │ │ │ ├── md5.h │ │ │ │ └── sha1.h │ │ │ ├── ppp.h │ │ │ ├── ppp_impl.h │ │ │ ├── ppp_opts.h │ │ │ ├── pppapi.h │ │ │ ├── pppcrypt.h │ │ │ ├── pppdebug.h │ │ │ ├── pppoe.h │ │ │ ├── pppol2tp.h │ │ │ ├── pppos.h │ │ │ ├── upap.h │ │ │ └── vj.h │ │ └── slipif.h │ └── posix │ │ ├── errno.h │ │ ├── netdb.h │ │ └── sys │ │ └── socket.h └── netif │ ├── FILES │ ├── ethernet.c │ ├── ethernetif.c │ ├── lowpan6.c │ ├── ppp │ ├── PPPD_FOLLOWUP │ ├── auth.c │ ├── ccp.c │ ├── chap-md5.c │ ├── chap-new.c │ ├── chap_ms.c │ ├── demand.c │ ├── eap.c │ ├── ecp.c │ ├── eui64.c │ ├── fsm.c │ ├── ipcp.c │ ├── ipv6cp.c │ ├── lcp.c │ ├── magic.c │ ├── mppe.c │ ├── multilink.c │ ├── polarssl │ │ ├── README │ │ ├── arc4.c │ │ ├── des.c │ │ ├── md4.c │ │ ├── md5.c │ │ └── sha1.c │ ├── ppp.c │ ├── pppapi.c │ ├── pppcrypt.c │ ├── pppoe.c │ ├── pppol2tp.c │ ├── pppos.c │ ├── upap.c │ ├── utils.c │ └── vj.c │ └── slipif.c └── test ├── fuzz ├── Makefile ├── README ├── config.h ├── fuzz.c ├── inputs │ ├── arp │ │ └── arp_req.bin │ ├── icmp │ │ └── icmp_ping.bin │ ├── ipv6 │ │ ├── neighbor_solicitation.bin │ │ └── router_adv.bin │ ├── tcp │ │ └── tcp_syn.bin │ └── udp │ │ └── udp_port_5000.bin ├── lwipopts.h └── output_to_pcap.sh ├── linux ├── echo_server.c ├── lwip.h ├── lwipopts.h ├── main.c └── tcp_client.c └── unit ├── core ├── test_mem.c ├── test_mem.h ├── test_pbuf.c └── test_pbuf.h ├── dhcp ├── test_dhcp.c └── test_dhcp.h ├── etharp ├── test_etharp.c └── test_etharp.h ├── lwip_check.h ├── lwip_unittests.c ├── lwipopts.h ├── mdns ├── test_mdns.c └── test_mdns.h ├── tcp ├── tcp_helper.c ├── tcp_helper.h ├── test_tcp.c ├── test_tcp.h ├── test_tcp_oos.c └── test_tcp_oos.h └── udp ├── test_udp.c └── test_udp.h /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | lwip-linux 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | 14 | 15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 16 | full,incremental, 17 | 18 | 19 | 20 | 21 | 22 | org.eclipse.cdt.core.cnature 23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 25 | 26 | 27 | -------------------------------------------------------------------------------- /.settings/language.settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.settings/org.eclipse.cdt.ui.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | formatter_profile=_miniHome 3 | formatter_settings_version=1 4 | -------------------------------------------------------------------------------- /.vscode/dryrun.log: -------------------------------------------------------------------------------- 1 | make --dry-run --always-make --keep-going --print-directory 2 | make: Entering directory `/Users/haohoang/workspace/01-git/lwip-linux' 3 | make: Leaving directory `/Users/haohoang/workspace/01-git/lwip-linux' 4 | 5 | make: *** No targets specified and no makefile found. Stop. 6 | 7 | -------------------------------------------------------------------------------- /Debug/lwip-2.0.2/src/api/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../lwip-2.0.2/src/api/api_lib.c \ 8 | ../lwip-2.0.2/src/api/api_msg.c \ 9 | ../lwip-2.0.2/src/api/err.c \ 10 | ../lwip-2.0.2/src/api/netbuf.c \ 11 | ../lwip-2.0.2/src/api/netdb.c \ 12 | ../lwip-2.0.2/src/api/netifapi.c \ 13 | ../lwip-2.0.2/src/api/sockets.c \ 14 | ../lwip-2.0.2/src/api/tcpip.c 15 | 16 | OBJS += \ 17 | ./lwip-2.0.2/src/api/api_lib.o \ 18 | ./lwip-2.0.2/src/api/api_msg.o \ 19 | ./lwip-2.0.2/src/api/err.o \ 20 | ./lwip-2.0.2/src/api/netbuf.o \ 21 | ./lwip-2.0.2/src/api/netdb.o \ 22 | ./lwip-2.0.2/src/api/netifapi.o \ 23 | ./lwip-2.0.2/src/api/sockets.o \ 24 | ./lwip-2.0.2/src/api/tcpip.o 25 | 26 | C_DEPS += \ 27 | ./lwip-2.0.2/src/api/api_lib.d \ 28 | ./lwip-2.0.2/src/api/api_msg.d \ 29 | ./lwip-2.0.2/src/api/err.d \ 30 | ./lwip-2.0.2/src/api/netbuf.d \ 31 | ./lwip-2.0.2/src/api/netdb.d \ 32 | ./lwip-2.0.2/src/api/netifapi.d \ 33 | ./lwip-2.0.2/src/api/sockets.d \ 34 | ./lwip-2.0.2/src/api/tcpip.d 35 | 36 | 37 | # Each subdirectory must supply rules for building sources it contributes 38 | lwip-2.0.2/src/api/%.o: ../lwip-2.0.2/src/api/%.c 39 | @echo 'Building file: $<' 40 | @echo 'Invoking: Cross GCC Compiler' 41 | gcc -I../lwip-2.0.2/src/include -I../lwip-2.0.2/src -I../lwip-2.0.2/test/linux -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" 42 | @echo 'Finished building: $<' 43 | @echo ' ' 44 | 45 | 46 | -------------------------------------------------------------------------------- /Debug/lwip-2.0.2/src/apps/httpd/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../lwip-2.0.2/src/apps/httpd/fs.c 8 | 9 | OBJS += \ 10 | ./lwip-2.0.2/src/apps/httpd/fs.o 11 | 12 | C_DEPS += \ 13 | ./lwip-2.0.2/src/apps/httpd/fs.d 14 | 15 | 16 | # Each subdirectory must supply rules for building sources it contributes 17 | lwip-2.0.2/src/apps/httpd/%.o: ../lwip-2.0.2/src/apps/httpd/%.c 18 | @echo 'Building file: $<' 19 | @echo 'Invoking: Cross GCC Compiler' 20 | gcc -I../lwip-2.0.2/src/include -I../lwip-2.0.2/src -I../lwip-2.0.2/test/linux -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" 21 | @echo 'Finished building: $<' 22 | @echo ' ' 23 | 24 | 25 | -------------------------------------------------------------------------------- /Debug/lwip-2.0.2/src/apps/lwiperf/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../lwip-2.0.2/src/apps/lwiperf/lwiperf.c 8 | 9 | OBJS += \ 10 | ./lwip-2.0.2/src/apps/lwiperf/lwiperf.o 11 | 12 | C_DEPS += \ 13 | ./lwip-2.0.2/src/apps/lwiperf/lwiperf.d 14 | 15 | 16 | # Each subdirectory must supply rules for building sources it contributes 17 | lwip-2.0.2/src/apps/lwiperf/%.o: ../lwip-2.0.2/src/apps/lwiperf/%.c 18 | @echo 'Building file: $<' 19 | @echo 'Invoking: Cross GCC Compiler' 20 | gcc -I../lwip-2.0.2/src/include -I../lwip-2.0.2/src -I../lwip-2.0.2/test/linux -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" 21 | @echo 'Finished building: $<' 22 | @echo ' ' 23 | 24 | 25 | -------------------------------------------------------------------------------- /Debug/lwip-2.0.2/src/apps/mdns/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../lwip-2.0.2/src/apps/mdns/mdns.c 8 | 9 | OBJS += \ 10 | ./lwip-2.0.2/src/apps/mdns/mdns.o 11 | 12 | C_DEPS += \ 13 | ./lwip-2.0.2/src/apps/mdns/mdns.d 14 | 15 | 16 | # Each subdirectory must supply rules for building sources it contributes 17 | lwip-2.0.2/src/apps/mdns/%.o: ../lwip-2.0.2/src/apps/mdns/%.c 18 | @echo 'Building file: $<' 19 | @echo 'Invoking: Cross GCC Compiler' 20 | gcc -I../lwip-2.0.2/src/include -I../lwip-2.0.2/src -I../lwip-2.0.2/test/linux -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" 21 | @echo 'Finished building: $<' 22 | @echo ' ' 23 | 24 | 25 | -------------------------------------------------------------------------------- /Debug/lwip-2.0.2/src/apps/mqtt/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../lwip-2.0.2/src/apps/mqtt/mqtt.c 8 | 9 | OBJS += \ 10 | ./lwip-2.0.2/src/apps/mqtt/mqtt.o 11 | 12 | C_DEPS += \ 13 | ./lwip-2.0.2/src/apps/mqtt/mqtt.d 14 | 15 | 16 | # Each subdirectory must supply rules for building sources it contributes 17 | lwip-2.0.2/src/apps/mqtt/%.o: ../lwip-2.0.2/src/apps/mqtt/%.c 18 | @echo 'Building file: $<' 19 | @echo 'Invoking: Cross GCC Compiler' 20 | gcc -I../lwip-2.0.2/src/include -I../lwip-2.0.2/src -I../lwip-2.0.2/test/linux -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" 21 | @echo 'Finished building: $<' 22 | @echo ' ' 23 | 24 | 25 | -------------------------------------------------------------------------------- /Debug/lwip-2.0.2/src/apps/netbiosns/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../lwip-2.0.2/src/apps/netbiosns/netbiosns.c 8 | 9 | OBJS += \ 10 | ./lwip-2.0.2/src/apps/netbiosns/netbiosns.o 11 | 12 | C_DEPS += \ 13 | ./lwip-2.0.2/src/apps/netbiosns/netbiosns.d 14 | 15 | 16 | # Each subdirectory must supply rules for building sources it contributes 17 | lwip-2.0.2/src/apps/netbiosns/%.o: ../lwip-2.0.2/src/apps/netbiosns/%.c 18 | @echo 'Building file: $<' 19 | @echo 'Invoking: Cross GCC Compiler' 20 | gcc -I../lwip-2.0.2/src/include -I../lwip-2.0.2/src -I../lwip-2.0.2/test/linux -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" 21 | @echo 'Finished building: $<' 22 | @echo ' ' 23 | 24 | 25 | -------------------------------------------------------------------------------- /Debug/lwip-2.0.2/src/apps/sntp/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../lwip-2.0.2/src/apps/sntp/sntp.c 8 | 9 | OBJS += \ 10 | ./lwip-2.0.2/src/apps/sntp/sntp.o 11 | 12 | C_DEPS += \ 13 | ./lwip-2.0.2/src/apps/sntp/sntp.d 14 | 15 | 16 | # Each subdirectory must supply rules for building sources it contributes 17 | lwip-2.0.2/src/apps/sntp/%.o: ../lwip-2.0.2/src/apps/sntp/%.c 18 | @echo 'Building file: $<' 19 | @echo 'Invoking: Cross GCC Compiler' 20 | gcc -I../lwip-2.0.2/src/include -I../lwip-2.0.2/src -I../lwip-2.0.2/test/linux -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" 21 | @echo 'Finished building: $<' 22 | @echo ' ' 23 | 24 | 25 | -------------------------------------------------------------------------------- /Debug/lwip-2.0.2/src/apps/tftp/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../lwip-2.0.2/src/apps/tftp/tftp_server.c 8 | 9 | OBJS += \ 10 | ./lwip-2.0.2/src/apps/tftp/tftp_server.o 11 | 12 | C_DEPS += \ 13 | ./lwip-2.0.2/src/apps/tftp/tftp_server.d 14 | 15 | 16 | # Each subdirectory must supply rules for building sources it contributes 17 | lwip-2.0.2/src/apps/tftp/%.o: ../lwip-2.0.2/src/apps/tftp/%.c 18 | @echo 'Building file: $<' 19 | @echo 'Invoking: Cross GCC Compiler' 20 | gcc -I../lwip-2.0.2/src/include -I../lwip-2.0.2/src -I../lwip-2.0.2/test/linux -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" 21 | @echo 'Finished building: $<' 22 | @echo ' ' 23 | 24 | 25 | -------------------------------------------------------------------------------- /Debug/lwip-2.0.2/src/arch/pcap.d: -------------------------------------------------------------------------------- 1 | lwip-2.0.2/src/arch/pcap.o: ../lwip-2.0.2/src/arch/pcap.c 2 | -------------------------------------------------------------------------------- /Debug/lwip-2.0.2/src/arch/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../lwip-2.0.2/src/arch/if.c \ 8 | ../lwip-2.0.2/src/arch/netif.c \ 9 | ../lwip-2.0.2/src/arch/pcap.c 10 | 11 | OBJS += \ 12 | ./lwip-2.0.2/src/arch/if.o \ 13 | ./lwip-2.0.2/src/arch/netif.o \ 14 | ./lwip-2.0.2/src/arch/pcap.o 15 | 16 | C_DEPS += \ 17 | ./lwip-2.0.2/src/arch/if.d \ 18 | ./lwip-2.0.2/src/arch/netif.d 19 | 20 | 21 | # Each subdirectory must supply rules for building sources it contributes 22 | lwip-2.0.2/src/arch/%.o: ../lwip-2.0.2/src/arch/%.c 23 | @echo 'Building file: $<' 24 | @echo 'Invoking: Cross GCC Compiler' 25 | gcc -I../lwip-2.0.2/src/include -I../lwip-2.0.2/src -I../lwip-2.0.2/test/linux -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" 26 | @echo 'Finished building: $<' 27 | @echo ' ' 28 | 29 | 30 | -------------------------------------------------------------------------------- /Debug/lwip-2.0.2/src/core/ipv4/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../lwip-2.0.2/src/core/ipv4/autoip.c \ 8 | ../lwip-2.0.2/src/core/ipv4/dhcp.c \ 9 | ../lwip-2.0.2/src/core/ipv4/etharp.c \ 10 | ../lwip-2.0.2/src/core/ipv4/icmp.c \ 11 | ../lwip-2.0.2/src/core/ipv4/igmp.c \ 12 | ../lwip-2.0.2/src/core/ipv4/ip4.c \ 13 | ../lwip-2.0.2/src/core/ipv4/ip4_addr.c \ 14 | ../lwip-2.0.2/src/core/ipv4/ip4_frag.c 15 | 16 | OBJS += \ 17 | ./lwip-2.0.2/src/core/ipv4/autoip.o \ 18 | ./lwip-2.0.2/src/core/ipv4/dhcp.o \ 19 | ./lwip-2.0.2/src/core/ipv4/etharp.o \ 20 | ./lwip-2.0.2/src/core/ipv4/icmp.o \ 21 | ./lwip-2.0.2/src/core/ipv4/igmp.o \ 22 | ./lwip-2.0.2/src/core/ipv4/ip4.o \ 23 | ./lwip-2.0.2/src/core/ipv4/ip4_addr.o \ 24 | ./lwip-2.0.2/src/core/ipv4/ip4_frag.o 25 | 26 | C_DEPS += \ 27 | ./lwip-2.0.2/src/core/ipv4/autoip.d \ 28 | ./lwip-2.0.2/src/core/ipv4/dhcp.d \ 29 | ./lwip-2.0.2/src/core/ipv4/etharp.d \ 30 | ./lwip-2.0.2/src/core/ipv4/icmp.d \ 31 | ./lwip-2.0.2/src/core/ipv4/igmp.d \ 32 | ./lwip-2.0.2/src/core/ipv4/ip4.d \ 33 | ./lwip-2.0.2/src/core/ipv4/ip4_addr.d \ 34 | ./lwip-2.0.2/src/core/ipv4/ip4_frag.d 35 | 36 | 37 | # Each subdirectory must supply rules for building sources it contributes 38 | lwip-2.0.2/src/core/ipv4/%.o: ../lwip-2.0.2/src/core/ipv4/%.c 39 | @echo 'Building file: $<' 40 | @echo 'Invoking: Cross GCC Compiler' 41 | gcc -I../lwip-2.0.2/src/include -I../lwip-2.0.2/src -I../lwip-2.0.2/test/linux -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" 42 | @echo 'Finished building: $<' 43 | @echo ' ' 44 | 45 | 46 | -------------------------------------------------------------------------------- /Debug/lwip-2.0.2/src/core/ipv6/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../lwip-2.0.2/src/core/ipv6/dhcp6.c \ 8 | ../lwip-2.0.2/src/core/ipv6/ethip6.c \ 9 | ../lwip-2.0.2/src/core/ipv6/icmp6.c \ 10 | ../lwip-2.0.2/src/core/ipv6/inet6.c \ 11 | ../lwip-2.0.2/src/core/ipv6/ip6.c \ 12 | ../lwip-2.0.2/src/core/ipv6/ip6_addr.c \ 13 | ../lwip-2.0.2/src/core/ipv6/ip6_frag.c \ 14 | ../lwip-2.0.2/src/core/ipv6/mld6.c \ 15 | ../lwip-2.0.2/src/core/ipv6/nd6.c 16 | 17 | OBJS += \ 18 | ./lwip-2.0.2/src/core/ipv6/dhcp6.o \ 19 | ./lwip-2.0.2/src/core/ipv6/ethip6.o \ 20 | ./lwip-2.0.2/src/core/ipv6/icmp6.o \ 21 | ./lwip-2.0.2/src/core/ipv6/inet6.o \ 22 | ./lwip-2.0.2/src/core/ipv6/ip6.o \ 23 | ./lwip-2.0.2/src/core/ipv6/ip6_addr.o \ 24 | ./lwip-2.0.2/src/core/ipv6/ip6_frag.o \ 25 | ./lwip-2.0.2/src/core/ipv6/mld6.o \ 26 | ./lwip-2.0.2/src/core/ipv6/nd6.o 27 | 28 | C_DEPS += \ 29 | ./lwip-2.0.2/src/core/ipv6/dhcp6.d \ 30 | ./lwip-2.0.2/src/core/ipv6/ethip6.d \ 31 | ./lwip-2.0.2/src/core/ipv6/icmp6.d \ 32 | ./lwip-2.0.2/src/core/ipv6/inet6.d \ 33 | ./lwip-2.0.2/src/core/ipv6/ip6.d \ 34 | ./lwip-2.0.2/src/core/ipv6/ip6_addr.d \ 35 | ./lwip-2.0.2/src/core/ipv6/ip6_frag.d \ 36 | ./lwip-2.0.2/src/core/ipv6/mld6.d \ 37 | ./lwip-2.0.2/src/core/ipv6/nd6.d 38 | 39 | 40 | # Each subdirectory must supply rules for building sources it contributes 41 | lwip-2.0.2/src/core/ipv6/%.o: ../lwip-2.0.2/src/core/ipv6/%.c 42 | @echo 'Building file: $<' 43 | @echo 'Invoking: Cross GCC Compiler' 44 | gcc -I../lwip-2.0.2/src/include -I../lwip-2.0.2/src -I../lwip-2.0.2/test/linux -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" 45 | @echo 'Finished building: $<' 46 | @echo ' ' 47 | 48 | 49 | -------------------------------------------------------------------------------- /Debug/lwip-2.0.2/src/core/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../lwip-2.0.2/src/core/def.c \ 8 | ../lwip-2.0.2/src/core/dns.c \ 9 | ../lwip-2.0.2/src/core/inet_chksum.c \ 10 | ../lwip-2.0.2/src/core/init.c \ 11 | ../lwip-2.0.2/src/core/ip.c \ 12 | ../lwip-2.0.2/src/core/mem.c \ 13 | ../lwip-2.0.2/src/core/memp.c \ 14 | ../lwip-2.0.2/src/core/netif.c \ 15 | ../lwip-2.0.2/src/core/pbuf.c \ 16 | ../lwip-2.0.2/src/core/raw.c \ 17 | ../lwip-2.0.2/src/core/stats.c \ 18 | ../lwip-2.0.2/src/core/sys.c \ 19 | ../lwip-2.0.2/src/core/tcp.c \ 20 | ../lwip-2.0.2/src/core/tcp_in.c \ 21 | ../lwip-2.0.2/src/core/tcp_out.c \ 22 | ../lwip-2.0.2/src/core/timeouts.c \ 23 | ../lwip-2.0.2/src/core/udp.c 24 | 25 | OBJS += \ 26 | ./lwip-2.0.2/src/core/def.o \ 27 | ./lwip-2.0.2/src/core/dns.o \ 28 | ./lwip-2.0.2/src/core/inet_chksum.o \ 29 | ./lwip-2.0.2/src/core/init.o \ 30 | ./lwip-2.0.2/src/core/ip.o \ 31 | ./lwip-2.0.2/src/core/mem.o \ 32 | ./lwip-2.0.2/src/core/memp.o \ 33 | ./lwip-2.0.2/src/core/netif.o \ 34 | ./lwip-2.0.2/src/core/pbuf.o \ 35 | ./lwip-2.0.2/src/core/raw.o \ 36 | ./lwip-2.0.2/src/core/stats.o \ 37 | ./lwip-2.0.2/src/core/sys.o \ 38 | ./lwip-2.0.2/src/core/tcp.o \ 39 | ./lwip-2.0.2/src/core/tcp_in.o \ 40 | ./lwip-2.0.2/src/core/tcp_out.o \ 41 | ./lwip-2.0.2/src/core/timeouts.o \ 42 | ./lwip-2.0.2/src/core/udp.o 43 | 44 | C_DEPS += \ 45 | ./lwip-2.0.2/src/core/def.d \ 46 | ./lwip-2.0.2/src/core/dns.d \ 47 | ./lwip-2.0.2/src/core/inet_chksum.d \ 48 | ./lwip-2.0.2/src/core/init.d \ 49 | ./lwip-2.0.2/src/core/ip.d \ 50 | ./lwip-2.0.2/src/core/mem.d \ 51 | ./lwip-2.0.2/src/core/memp.d \ 52 | ./lwip-2.0.2/src/core/netif.d \ 53 | ./lwip-2.0.2/src/core/pbuf.d \ 54 | ./lwip-2.0.2/src/core/raw.d \ 55 | ./lwip-2.0.2/src/core/stats.d \ 56 | ./lwip-2.0.2/src/core/sys.d \ 57 | ./lwip-2.0.2/src/core/tcp.d \ 58 | ./lwip-2.0.2/src/core/tcp_in.d \ 59 | ./lwip-2.0.2/src/core/tcp_out.d \ 60 | ./lwip-2.0.2/src/core/timeouts.d \ 61 | ./lwip-2.0.2/src/core/udp.d 62 | 63 | 64 | # Each subdirectory must supply rules for building sources it contributes 65 | lwip-2.0.2/src/core/%.o: ../lwip-2.0.2/src/core/%.c 66 | @echo 'Building file: $<' 67 | @echo 'Invoking: Cross GCC Compiler' 68 | gcc -I../lwip-2.0.2/src/include -I../lwip-2.0.2/src -I../lwip-2.0.2/test/linux -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" 69 | @echo 'Finished building: $<' 70 | @echo ' ' 71 | 72 | 73 | -------------------------------------------------------------------------------- /Debug/lwip-2.0.2/src/netif/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../lwip-2.0.2/src/netif/ethernet.c \ 8 | ../lwip-2.0.2/src/netif/ethernetif.c \ 9 | ../lwip-2.0.2/src/netif/lowpan6.c 10 | 11 | OBJS += \ 12 | ./lwip-2.0.2/src/netif/ethernet.o \ 13 | ./lwip-2.0.2/src/netif/ethernetif.o \ 14 | ./lwip-2.0.2/src/netif/lowpan6.o 15 | 16 | C_DEPS += \ 17 | ./lwip-2.0.2/src/netif/ethernet.d \ 18 | ./lwip-2.0.2/src/netif/ethernetif.d \ 19 | ./lwip-2.0.2/src/netif/lowpan6.d 20 | 21 | 22 | # Each subdirectory must supply rules for building sources it contributes 23 | lwip-2.0.2/src/netif/%.o: ../lwip-2.0.2/src/netif/%.c 24 | @echo 'Building file: $<' 25 | @echo 'Invoking: Cross GCC Compiler' 26 | gcc -I../lwip-2.0.2/src/include -I../lwip-2.0.2/src -I../lwip-2.0.2/test/linux -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" 27 | @echo 'Finished building: $<' 28 | @echo ' ' 29 | 30 | 31 | -------------------------------------------------------------------------------- /Debug/lwip-2.0.2/test/linux/subdir.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | # Add inputs and outputs from these tool invocations to the build variables 6 | C_SRCS += \ 7 | ../lwip-2.0.2/test/linux/echo_server.c \ 8 | ../lwip-2.0.2/test/linux/main.c \ 9 | ../lwip-2.0.2/test/linux/tcp_client.c 10 | 11 | OBJS += \ 12 | ./lwip-2.0.2/test/linux/echo_server.o \ 13 | ./lwip-2.0.2/test/linux/main.o \ 14 | ./lwip-2.0.2/test/linux/tcp_client.o 15 | 16 | C_DEPS += \ 17 | ./lwip-2.0.2/test/linux/echo_server.d \ 18 | ./lwip-2.0.2/test/linux/main.d \ 19 | ./lwip-2.0.2/test/linux/tcp_client.d 20 | 21 | 22 | # Each subdirectory must supply rules for building sources it contributes 23 | lwip-2.0.2/test/linux/%.o: ../lwip-2.0.2/test/linux/%.c 24 | @echo 'Building file: $<' 25 | @echo 'Invoking: Cross GCC Compiler' 26 | gcc -I../lwip-2.0.2/src/include -I../lwip-2.0.2/src -I../lwip-2.0.2/test/linux -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<" 27 | @echo 'Finished building: $<' 28 | @echo ' ' 29 | 30 | 31 | -------------------------------------------------------------------------------- /Debug/makefile: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | -include ../makefile.init 6 | 7 | RM := rm -rf 8 | 9 | # All of the sources participating in the build are defined here 10 | -include sources.mk 11 | -include lwip-2.0.2/test/linux/subdir.mk 12 | -include lwip-2.0.2/src/netif/subdir.mk 13 | -include lwip-2.0.2/src/core/ipv6/subdir.mk 14 | -include lwip-2.0.2/src/core/ipv4/subdir.mk 15 | -include lwip-2.0.2/src/core/subdir.mk 16 | -include lwip-2.0.2/src/arch/subdir.mk 17 | -include lwip-2.0.2/src/apps/tftp/subdir.mk 18 | -include lwip-2.0.2/src/apps/sntp/subdir.mk 19 | -include lwip-2.0.2/src/apps/snmp/subdir.mk 20 | -include lwip-2.0.2/src/apps/netbiosns/subdir.mk 21 | -include lwip-2.0.2/src/apps/mqtt/subdir.mk 22 | -include lwip-2.0.2/src/apps/mdns/subdir.mk 23 | -include lwip-2.0.2/src/apps/lwiperf/subdir.mk 24 | -include lwip-2.0.2/src/apps/httpd/subdir.mk 25 | -include lwip-2.0.2/src/api/subdir.mk 26 | -include subdir.mk 27 | -include objects.mk 28 | 29 | ifneq ($(MAKECMDGOALS),clean) 30 | ifneq ($(strip $(C_DEPS)),) 31 | -include $(C_DEPS) 32 | endif 33 | endif 34 | 35 | -include ../makefile.defs 36 | 37 | # Add inputs and outputs from these tool invocations to the build variables 38 | 39 | # All Target 40 | all: lwip-linux 41 | 42 | # Tool invocations 43 | lwip-linux: $(OBJS) $(USER_OBJS) 44 | @echo 'Building target: $@' 45 | @echo 'Invoking: Cross GCC Linker' 46 | gcc -o "lwip-linux" $(OBJS) $(USER_OBJS) $(LIBS) 47 | @echo 'Finished building target: $@' 48 | @echo ' ' 49 | 50 | # Other Targets 51 | clean: 52 | -$(RM) $(EXECUTABLES)$(OBJS)$(C_DEPS) lwip-linux 53 | -@echo ' ' 54 | 55 | .PHONY: all clean dependents 56 | .SECONDARY: 57 | 58 | -include ../makefile.targets 59 | -------------------------------------------------------------------------------- /Debug/objects.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | USER_OBJS := 6 | 7 | LIBS := -lpcap -lrt -lpthread 8 | 9 | -------------------------------------------------------------------------------- /Debug/sources.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Automatically-generated file. Do not edit! 3 | ################################################################################ 4 | 5 | OBJ_SRCS := 6 | ASM_SRCS := 7 | C_SRCS := 8 | O_SRCS := 9 | S_UPPER_SRCS := 10 | EXECUTABLES := 11 | OBJS := 12 | C_DEPS := 13 | 14 | # Every subdirectory with source files must be described here 15 | SUBDIRS := \ 16 | lwip-2.0.2/src/api \ 17 | lwip-2.0.2/src/apps/httpd \ 18 | lwip-2.0.2/src/apps/lwiperf \ 19 | lwip-2.0.2/src/apps/mdns \ 20 | lwip-2.0.2/src/apps/mqtt \ 21 | lwip-2.0.2/src/apps/netbiosns \ 22 | lwip-2.0.2/src/apps/snmp \ 23 | lwip-2.0.2/src/apps/sntp \ 24 | lwip-2.0.2/src/apps/tftp \ 25 | lwip-2.0.2/src/arch \ 26 | lwip-2.0.2/src/core \ 27 | lwip-2.0.2/src/core/ipv4 \ 28 | lwip-2.0.2/src/core/ipv6 \ 29 | lwip-2.0.2/src/netif \ 30 | lwip-2.0.2/test/linux \ 31 | 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # lwip-linux 2 | This is a version of lwip running on Ubuntu 3 | 4 | ## 1. Ubuntu Setup 5 | Install libpcap-dev 6 | 7 | sudo apt-get install libpcap-dev 8 | 9 | ## 2. Compile 10 | Go to the folder ./Debug, then run: 11 | 12 | make clean; make 13 | 14 | ## 3. Run tests 15 | Must be run under root user 16 | 17 | ### 3.1 Echo server test 18 | Under the header file `./lwip-2.0.2/test/linux/lwip.h`, set `TEST_ID` to `ECHO_SERVER` 19 | 20 | #define TEST_ID ECHO_SERVER 21 | 22 | Then, re-compile the source code, and run the lwip-linux app. Use puty to connect to server at port 6677. 23 | 24 | 25 | ### 3.2 TCP client test 26 | Under the header file `./lwip-2.0.2/test/linux/lwip.h`, set `TEST_ID` to `TCP_CLIENT` 27 | 28 | #define TEST_ID TCP_CLIENT 29 | 30 | Then, re-compile the source code, and run the lwip-linux app. 31 | 32 | Notes: 33 | - The remote server address is being hard code at "192.168.2.12", we can modify this address via macro TCP_REMOTE_SERVER_ADDR under ./lwip-2.0.2/test/linux/lwip.h. 34 | - Remote server port is 6677, it can be changed via macro TCP_REMOTE_SERVER_PORT. 35 | 36 | 37 | ## 4. Other notes 38 | - lwip-linux only supports 32 local server ports from 6677 to 6709. When we create a tcp server, please use the server port in this range. 39 | - For local client ports, the lwip-linux supports to allocate port in range from 49152 to 49184. 40 | 41 | -------------------------------------------------------------------------------- /lwip-2.0.2/.gitattributes: -------------------------------------------------------------------------------- 1 | # These files are text and should be normalized 2 | *.txt text 3 | *.c text 4 | *.h text 5 | -------------------------------------------------------------------------------- /lwip-2.0.2/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.a 3 | /doc/doxygen/output/html 4 | /src/apps/snmp/LwipMibCompiler/CCodeGeneration/bin/ 5 | /src/apps/snmp/LwipMibCompiler/CCodeGeneration/obj/ 6 | /src/apps/snmp/LwipMibCompiler/LwipMibCompiler/bin/ 7 | /src/apps/snmp/LwipMibCompiler/LwipMibCompiler/obj/ 8 | /src/apps/snmp/LwipMibCompiler/MibViewer/bin/ 9 | /src/apps/snmp/LwipMibCompiler/MibViewer/obj/ 10 | /src/apps/snmp/LwipMibCompiler/LwipSnmpCodeGeneration/bin/ 11 | /src/apps/snmp/LwipMibCompiler/LwipSnmpCodeGeneration/obj/ 12 | /src/apps/snmp/LwipMibCompiler/SharpSnmpLib/bin/ 13 | /src/apps/snmp/LwipMibCompiler/SharpSnmpLib/obj/ 14 | /src/apps/snmp/LwipMibCompiler/LwipMibCompiler.userprefs 15 | /src/apps/snmp/LwipMibCompiler/*.suo 16 | /test/fuzz/output 17 | /test/fuzz/lwip_fuzz 18 | /test/fuzz/.depend 19 | -------------------------------------------------------------------------------- /lwip-2.0.2/COPYING: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001, 2002 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | 33 | 34 | -------------------------------------------------------------------------------- /lwip-2.0.2/FILES: -------------------------------------------------------------------------------- 1 | src/ - The source code for the lwIP TCP/IP stack. 2 | doc/ - The documentation for lwIP. 3 | test/ - Some code to test whether the sources do what they should. 4 | 5 | See also the FILES file in each subdirectory. 6 | -------------------------------------------------------------------------------- /lwip-2.0.2/doc/FILES: -------------------------------------------------------------------------------- 1 | doxygen/ - Configuration files and scripts to create the lwIP doxygen source 2 | documentation (found at http://www.nongnu.org/lwip/) 3 | 4 | savannah.txt - How to obtain the current development source code. 5 | contrib.txt - How to contribute to lwIP as a developer. 6 | rawapi.txt - The documentation for the core API of lwIP. 7 | Also provides an overview about the other APIs and multithreading. 8 | sys_arch.txt - The documentation for a system abstraction layer of lwIP. 9 | ppp.txt - Documentation of the PPP interface for lwIP. 10 | -------------------------------------------------------------------------------- /lwip-2.0.2/doc/contrib.txt: -------------------------------------------------------------------------------- 1 | 1 Introduction 2 | 3 | This document describes some guidelines for people participating 4 | in lwIP development. 5 | 6 | 2 How to contribute to lwIP 7 | 8 | Here is a short list of suggestions to anybody working with lwIP and 9 | trying to contribute bug reports, fixes, enhancements, platform ports etc. 10 | First of all as you may already know lwIP is a volunteer project so feedback 11 | to fixes or questions might often come late. Hopefully the bug and patch tracking 12 | features of Savannah help us not lose users' input. 13 | 14 | 2.1 Source code style: 15 | 16 | 1. do not use tabs. 17 | 2. indentation is two spaces per level (i.e. per tab). 18 | 3. end debug messages with a trailing newline (\n). 19 | 4. one space between keyword and opening bracket. 20 | 5. no space between function and opening bracket. 21 | 6. one space and no newline before opening curly braces of a block. 22 | 7. closing curly brace on a single line. 23 | 8. spaces surrounding assignment and comparisons. 24 | 9. don't initialize static and/or global variables to zero, the compiler takes care of that. 25 | 10. use current source code style as further reference. 26 | 27 | 2.2 Source code documentation style: 28 | 29 | 1. JavaDoc compliant and Doxygen compatible. 30 | 2. Function documentation above functions in .c files, not .h files. 31 | (This forces you to synchronize documentation and implementation.) 32 | 3. Use current documentation style as further reference. 33 | 34 | 2.3 Bug reports and patches: 35 | 36 | 1. Make sure you are reporting bugs or send patches against the latest 37 | sources. (From the latest release and/or the current Git sources.) 38 | 2. If you think you found a bug make sure it's not already filed in the 39 | bugtracker at Savannah. 40 | 3. If you have a fix put the patch on Savannah. If it is a patch that affects 41 | both core and arch specific stuff please separate them so that the core can 42 | be applied separately while leaving the other patch 'open'. The preferred way 43 | is to NOT touch archs you can't test and let maintainers take care of them. 44 | This is a good way to see if they are used at all - the same goes for unix 45 | netifs except tapif. 46 | 4. Do not file a bug and post a fix to it to the patch area. Either a bug report 47 | or a patch will be enough. 48 | If you correct an existing bug then attach the patch to the bug rather than creating a new entry in the patch area. 49 | 5. Patches should be specific to a single change or to related changes. Do not mix bugfixes with spelling and other 50 | trivial fixes unless the bugfix is trivial too. Do not reorganize code and rename identifiers in the same patch you 51 | change behaviour if not necessary. A patch is easier to read and understand if it's to the point and short than 52 | if it's not to the point and long :) so the chances for it to be applied are greater. 53 | 54 | 2.4 Platform porters: 55 | 56 | 1. If you have ported lwIP to a platform (an OS, a uC/processor or a combination of these) and 57 | you think it could benefit others[1] you might want discuss this on the mailing list. You 58 | can also ask for Git access to submit and maintain your port in the contrib Git module. 59 | -------------------------------------------------------------------------------- /lwip-2.0.2/doc/doxygen/generate.bat: -------------------------------------------------------------------------------- 1 | doxygen lwip.Doxyfile 2 | -------------------------------------------------------------------------------- /lwip-2.0.2/doc/doxygen/generate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | doxygen lwip.Doxyfile 4 | -------------------------------------------------------------------------------- /lwip-2.0.2/doc/doxygen/output/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Redirection 5 | 6 | 7 | 8 | index.html 9 | 10 | 11 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/FILES: -------------------------------------------------------------------------------- 1 | api/ - The code for the high-level wrapper API. Not needed if 2 | you use the lowel-level call-back/raw API. 3 | 4 | apps/ - Higher layer applications that are specifically programmed 5 | with the lwIP low-level raw API. 6 | 7 | core/ - The core of the TPC/IP stack; protocol implementations, 8 | memory and buffer management, and the low-level raw API. 9 | 10 | include/ - lwIP include files. 11 | 12 | netif/ - Generic network interface device drivers are kept here. 13 | 14 | For more information on the various subdirectories, check the FILES 15 | file in each directory. 16 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/apps/httpd/fs/404.html: -------------------------------------------------------------------------------- 1 | 2 | lwIP - A Lightweight TCP/IP Stack 3 | 4 | 5 | 6 | 19 |
7 | SICS logo 9 | 10 |

lwIP - A Lightweight TCP/IP Stack

11 |

404 - Page not found

12 |

13 | Sorry, the page you are requesting was not found on this 14 | server. 15 |

16 |
17 |   18 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/apps/httpd/fs/img/sics.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haohd/lwip-linux/4fb5c7a6ffdfdd52bdde235d09b8c4729500fe76/lwip-2.0.2/src/apps/httpd/fs/img/sics.gif -------------------------------------------------------------------------------- /lwip-2.0.2/src/apps/httpd/fs/index.html: -------------------------------------------------------------------------------- 1 | 2 | lwIP - A Lightweight TCP/IP Stack 3 | 4 | 5 | 6 | 44 |
7 | SICS logo 9 | 10 |

lwIP - A Lightweight TCP/IP Stack

11 |

12 | The web page you are watching was served by a simple web 13 | server running on top of the lightweight TCP/IP stack lwIP. 15 |

16 |

17 | lwIP is an open source implementation of the TCP/IP 18 | protocol suite that was originally written by Adam Dunkels 20 | of the Swedish Institute of Computer Science but now is 21 | being actively developed by a team of developers 22 | distributed world-wide. Since it's release, lwIP has 23 | spurred a lot of interest and has been ported to several 24 | platforms and operating systems. lwIP can be used either 25 | with or without an underlying OS. 26 |

27 |

28 | The focus of the lwIP TCP/IP implementation is to reduce 29 | the RAM usage while still having a full scale TCP. This 30 | makes lwIP suitable for use in embedded systems with tens 31 | of kilobytes of free RAM and room for around 40 kilobytes 32 | of code ROM. 33 |

34 |

35 | More information about lwIP can be found at the lwIP 36 | homepage at http://savannah.nongnu.org/projects/lwip/ 38 | or at the lwIP wiki at http://lwip.wikia.com/. 40 |

41 |
42 |   43 |
45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/apps/httpd/fsdata.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2003 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Adam Dunkels 30 | * 31 | */ 32 | #ifndef LWIP_FSDATA_H 33 | #define LWIP_FSDATA_H 34 | 35 | #include "lwip/apps/httpd_opts.h" 36 | #include "lwip/apps/fs.h" 37 | 38 | struct fsdata_file { 39 | const struct fsdata_file *next; 40 | const unsigned char *name; 41 | const unsigned char *data; 42 | int len; 43 | u8_t flags; 44 | #if HTTPD_PRECALCULATED_CHECKSUM 45 | u16_t chksum_count; 46 | const struct fsdata_chksum *chksum; 47 | #endif /* HTTPD_PRECALCULATED_CHECKSUM */ 48 | }; 49 | 50 | #endif /* LWIP_FSDATA_H */ 51 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/apps/httpd/makefsdata/makefsdata: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | open(OUTPUT, "> fsdata.c"); 4 | 5 | chdir("fs"); 6 | open(FILES, "find . -type f |"); 7 | 8 | while($file = ) { 9 | 10 | # Do not include files in CVS directories nor backup files. 11 | if($file =~ /(CVS|~)/) { 12 | next; 13 | } 14 | 15 | chop($file); 16 | 17 | open(HEADER, "> /tmp/header") || die $!; 18 | if($file =~ /404/) { 19 | print(HEADER "HTTP/1.0 404 File not found\r\n"); 20 | } else { 21 | print(HEADER "HTTP/1.0 200 OK\r\n"); 22 | } 23 | print(HEADER "Server: lwIP/pre-0.6 (http://www.sics.se/~adam/lwip/)\r\n"); 24 | if($file =~ /\.html$/) { 25 | print(HEADER "Content-type: text/html\r\n"); 26 | } elsif($file =~ /\.gif$/) { 27 | print(HEADER "Content-type: image/gif\r\n"); 28 | } elsif($file =~ /\.png$/) { 29 | print(HEADER "Content-type: image/png\r\n"); 30 | } elsif($file =~ /\.jpg$/) { 31 | print(HEADER "Content-type: image/jpeg\r\n"); 32 | } elsif($file =~ /\.class$/) { 33 | print(HEADER "Content-type: application/octet-stream\r\n"); 34 | } elsif($file =~ /\.ram$/) { 35 | print(HEADER "Content-type: audio/x-pn-realaudio\r\n"); 36 | } else { 37 | print(HEADER "Content-type: text/plain\r\n"); 38 | } 39 | print(HEADER "\r\n"); 40 | close(HEADER); 41 | 42 | unless($file =~ /\.plain$/ || $file =~ /cgi/) { 43 | system("cat /tmp/header $file > /tmp/file"); 44 | } else { 45 | system("cp $file /tmp/file"); 46 | } 47 | 48 | open(FILE, "/tmp/file"); 49 | unlink("/tmp/file"); 50 | unlink("/tmp/header"); 51 | 52 | $file =~ s/\.//; 53 | $fvar = $file; 54 | $fvar =~ s-/-_-g; 55 | $fvar =~ s-\.-_-g; 56 | print(OUTPUT "static const unsigned char data".$fvar."[] = {\n"); 57 | print(OUTPUT "\t/* $file */\n\t"); 58 | for($j = 0; $j < length($file); $j++) { 59 | printf(OUTPUT "%#02x, ", unpack("C", substr($file, $j, 1))); 60 | } 61 | printf(OUTPUT "0,\n"); 62 | 63 | 64 | $i = 0; 65 | while(read(FILE, $data, 1)) { 66 | if($i == 0) { 67 | print(OUTPUT "\t"); 68 | } 69 | printf(OUTPUT "%#02x, ", unpack("C", $data)); 70 | $i++; 71 | if($i == 10) { 72 | print(OUTPUT "\n"); 73 | $i = 0; 74 | } 75 | } 76 | print(OUTPUT "};\n\n"); 77 | close(FILE); 78 | push(@fvars, $fvar); 79 | push(@files, $file); 80 | } 81 | 82 | for($i = 0; $i < @fvars; $i++) { 83 | $file = $files[$i]; 84 | $fvar = $fvars[$i]; 85 | 86 | if($i == 0) { 87 | $prevfile = "NULL"; 88 | } else { 89 | $prevfile = "file" . $fvars[$i - 1]; 90 | } 91 | print(OUTPUT "const struct fsdata_file file".$fvar."[] = {{$prevfile, data$fvar, "); 92 | print(OUTPUT "data$fvar + ". (length($file) + 1) .", "); 93 | print(OUTPUT "sizeof(data$fvar) - ". (length($file) + 1) ."}};\n\n"); 94 | } 95 | 96 | print(OUTPUT "#define FS_ROOT file$fvars[$i - 1]\n\n"); 97 | print(OUTPUT "#define FS_NUMFILES $i\n"); 98 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/apps/httpd/makefsdata/readme.txt: -------------------------------------------------------------------------------- 1 | This directory contains a script ('makefsdata') to create C code suitable for 2 | httpd for given html pages (or other files) in a directory. 3 | 4 | There is also a plain C console application doing the same and extended a bit. 5 | 6 | Usage: htmlgen [targetdir] [-s] [-i]s 7 | targetdir: relative or absolute path to files to convert 8 | switch -s: toggle processing of subdirectories (default is on) 9 | switch -e: exclude HTTP header from file (header is created at runtime, default is on) 10 | switch -11: include HTTP 1.1 header (1.0 is default) 11 | 12 | if targetdir not specified, makefsdata will attempt to 13 | process files in subdirectory 'fs'. 14 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/apps/snmp/snmp_pbuf_stream.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * SNMP pbuf stream wrapper (internal API, do not use in client code). 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | * Author: Martin Hentschel 35 | * 36 | */ 37 | 38 | #ifndef LWIP_HDR_APPS_SNMP_PBUF_STREAM_H 39 | #define LWIP_HDR_APPS_SNMP_PBUF_STREAM_H 40 | 41 | #include "lwip/apps/snmp_opts.h" 42 | 43 | #if LWIP_SNMP 44 | 45 | #include "lwip/err.h" 46 | #include "lwip/pbuf.h" 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | 52 | struct snmp_pbuf_stream 53 | { 54 | struct pbuf* pbuf; 55 | u16_t offset; 56 | u16_t length; 57 | }; 58 | 59 | err_t snmp_pbuf_stream_init(struct snmp_pbuf_stream* pbuf_stream, struct pbuf* p, u16_t offset, u16_t length); 60 | err_t snmp_pbuf_stream_read(struct snmp_pbuf_stream* pbuf_stream, u8_t* data); 61 | err_t snmp_pbuf_stream_write(struct snmp_pbuf_stream* pbuf_stream, u8_t data); 62 | err_t snmp_pbuf_stream_writebuf(struct snmp_pbuf_stream* pbuf_stream, const void* buf, u16_t buf_len); 63 | err_t snmp_pbuf_stream_writeto(struct snmp_pbuf_stream* pbuf_stream, struct snmp_pbuf_stream* target_pbuf_stream, u16_t len); 64 | err_t snmp_pbuf_stream_seek(struct snmp_pbuf_stream* pbuf_stream, s32_t offset); 65 | err_t snmp_pbuf_stream_seek_abs(struct snmp_pbuf_stream* pbuf_stream, u32_t offset); 66 | 67 | #ifdef __cplusplus 68 | } 69 | #endif 70 | 71 | #endif /* LWIP_SNMP */ 72 | 73 | #endif /* LWIP_HDR_APPS_SNMP_PBUF_STREAM_H */ 74 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/apps/snmp/snmp_raw.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * SNMP RAW API frontend. 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * Author: Dirk Ziegelmeier 33 | */ 34 | 35 | #include "lwip/apps/snmp_opts.h" 36 | #include "lwip/ip_addr.h" 37 | 38 | #if LWIP_SNMP && SNMP_USE_RAW 39 | 40 | #include "lwip/udp.h" 41 | #include "lwip/ip.h" 42 | #include "snmp_msg.h" 43 | 44 | /* lwIP UDP receive callback function */ 45 | static void 46 | snmp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *addr, u16_t port) 47 | { 48 | LWIP_UNUSED_ARG(arg); 49 | 50 | snmp_receive(pcb, p, addr, port); 51 | 52 | pbuf_free(p); 53 | } 54 | 55 | err_t 56 | snmp_sendto(void *handle, struct pbuf *p, const ip_addr_t *dst, u16_t port) 57 | { 58 | return udp_sendto((struct udp_pcb*)handle, p, dst, port); 59 | } 60 | 61 | u8_t 62 | snmp_get_local_ip_for_dst(void* handle, const ip_addr_t *dst, ip_addr_t *result) 63 | { 64 | struct udp_pcb* udp_pcb = (struct udp_pcb*)handle; 65 | struct netif *dst_if; 66 | const ip_addr_t* dst_ip; 67 | 68 | LWIP_UNUSED_ARG(udp_pcb); /* unused in case of IPV4 only configuration */ 69 | 70 | ip_route_get_local_ip(&udp_pcb->local_ip, dst, dst_if, dst_ip); 71 | 72 | if ((dst_if != NULL) && (dst_ip != NULL)) { 73 | ip_addr_copy(*result, *dst_ip); 74 | return 1; 75 | } else { 76 | return 0; 77 | } 78 | } 79 | 80 | /** 81 | * @ingroup snmp_core 82 | * Starts SNMP Agent. 83 | * Allocates UDP pcb and binds it to IP_ANY_TYPE port 161. 84 | */ 85 | void 86 | snmp_init(void) 87 | { 88 | err_t err; 89 | 90 | struct udp_pcb *snmp_pcb = udp_new_ip_type(IPADDR_TYPE_ANY); 91 | LWIP_ERROR("snmp_raw: no PCB", (snmp_pcb != NULL), return;); 92 | 93 | snmp_traps_handle = snmp_pcb; 94 | 95 | udp_recv(snmp_pcb, snmp_recv, (void *)SNMP_IN_PORT); 96 | err = udp_bind(snmp_pcb, IP_ANY_TYPE, SNMP_IN_PORT); 97 | LWIP_ERROR("snmp_raw: Unable to bind PCB", (err == ERR_OK), return;); 98 | } 99 | 100 | #endif /* LWIP_SNMP && SNMP_USE_RAW */ 101 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/apps/snmp/snmpv3_priv.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Additional SNMPv3 functionality RFC3414 and RFC3826 (internal API, do not use in client code). 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2016 Elias Oenal. 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * Author: Elias Oenal 33 | */ 34 | 35 | #ifndef LWIP_HDR_APPS_SNMP_V3_PRIV_H 36 | #define LWIP_HDR_APPS_SNMP_V3_PRIV_H 37 | 38 | #include "lwip/apps/snmp_opts.h" 39 | 40 | #if LWIP_SNMP && LWIP_SNMP_V3 41 | 42 | #include "snmp_pbuf_stream.h" 43 | 44 | /* According to RFC 3411 */ 45 | #define SNMP_V3_MAX_ENGINE_ID_LENGTH 32 46 | #define SNMP_V3_MAX_USER_LENGTH 32 47 | 48 | #define SNMP_V3_MAX_AUTH_PARAM_LENGTH 12 49 | #define SNMP_V3_MAX_PRIV_PARAM_LENGTH 8 50 | 51 | #define SNMP_V3_AUTH_FLAG 0x01 52 | #define SNMP_V3_PRIV_FLAG 0x02 53 | 54 | #define SNMP_V3_MD5_LEN 16 55 | #define SNMP_V3_SHA_LEN 20 56 | 57 | u32_t snmpv3_get_engine_boots_internal(void); 58 | u32_t snmpv3_get_engine_time_internal(void); 59 | err_t snmpv3_auth(struct snmp_pbuf_stream* stream, u16_t length, const u8_t* key, u8_t algo, u8_t* hmac_out); 60 | err_t snmpv3_crypt(struct snmp_pbuf_stream* stream, u16_t length, const u8_t* key, 61 | const u8_t* priv_param, const u32_t engine_boots, const u32_t engine_time, u8_t algo, u8_t mode); 62 | err_t snmpv3_build_priv_param(u8_t* priv_param); 63 | 64 | #endif 65 | 66 | #endif /* LWIP_HDR_APPS_SNMP_V3_PRIV_H */ 67 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/arch/cc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cc.h 3 | * 4 | * Created on: Jul 18, 2017 5 | * Author: haohd 6 | * 7 | * Copyright (C) 2017 miniHome 8 | * 9 | * This library is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * This library is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public 20 | * License along with this library. 21 | * If not, see . 22 | */ 23 | 24 | #ifndef LWIP_2_0_2_SRC_ARCH_ARCH_CC_H_ 25 | #define LWIP_2_0_2_SRC_ARCH_ARCH_CC_H_ 26 | 27 | 28 | 29 | 30 | 31 | #endif /* LWIP_2_0_2_SRC_ARCH_ARCH_CC_H_ */ 32 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/arch/if.c: -------------------------------------------------------------------------------- 1 | /* 2 | * if.c 3 | * 4 | * Created on: Jul 19, 2017 5 | * Author: haohd 6 | * 7 | * Copyright (C) 2017 miniHome 8 | * 9 | * This library is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * This library is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public 20 | * License along with this library. 21 | * If not, see . 22 | */ 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | int get_if_address(const char *ifname, uint32_t *ip, uint32_t *mask, uint8_t *mac) 33 | { 34 | char *buffer = NULL; 35 | struct ifreq *ifr; 36 | size_t i; 37 | int ret = -1; 38 | 39 | if (ifname == NULL || ip == NULL || mask == NULL || mac == NULL) 40 | { 41 | return -1; 42 | } 43 | int fd = socket(AF_INET, SOCK_DGRAM, 0); 44 | if (fd < 0) 45 | { 46 | return -1; 47 | } 48 | 49 | struct ifreq _ifr; 50 | memset(&_ifr, 0, sizeof(_ifr)); 51 | _ifr.ifr_addr.sa_family = AF_INET; 52 | strncpy(_ifr.ifr_name, ifname , IFNAMSIZ - 1); 53 | if (0 == ioctl(fd, SIOCGIFHWADDR, &_ifr)) 54 | { 55 | memcpy(mac, (unsigned char *)_ifr.ifr_hwaddr.sa_data, 6); 56 | } 57 | 58 | buffer = (char *) malloc(2048); 59 | if (buffer == NULL) 60 | { 61 | goto _end; 62 | } 63 | 64 | struct ifconf ifc = { 65 | .ifc_len = 2048, 66 | .ifc_buf = (caddr_t) buffer 67 | }; 68 | if (ioctl(fd, SIOCGIFCONF, &ifc) < 0) 69 | { 70 | goto _end; 71 | } 72 | 73 | for (i = 0; i < ifc.ifc_len; i += sizeof(*ifr)) 74 | { 75 | ifr = (struct ifreq *)(buffer + i); 76 | if (ifr->ifr_addr.sa_family != AF_INET) 77 | { 78 | // only support IPv4 79 | continue; 80 | } 81 | 82 | char _ip[16] = {}; 83 | struct sockaddr_in * addr = (struct sockaddr_in *) &ifr->ifr_addr; 84 | if (inet_ntop(AF_INET, &addr->sin_addr, _ip, sizeof(_ip)) == NULL) 85 | { 86 | continue; 87 | } 88 | 89 | if(!strcmp(ifname, ifr->ifr_name)) 90 | { 91 | struct ifreq netmask = {}; 92 | strcpy(netmask.ifr_name, ifr->ifr_name); 93 | if (ioctl(fd, SIOCGIFNETMASK, &netmask) != 0) 94 | { 95 | continue; 96 | } 97 | *ip = addr->sin_addr.s_addr; 98 | addr = (struct sockaddr_in *) &netmask.ifr_addr; 99 | *mask = addr->sin_addr.s_addr; 100 | ret = 1; 101 | } 102 | } 103 | _end: 104 | if (buffer) 105 | { 106 | free(buffer); 107 | } 108 | if (fd >= 0) 109 | { 110 | close(fd); 111 | } 112 | return ret; 113 | } 114 | 115 | 116 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/arch/pcap.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | static char gerrbuf[PCAP_ERRBUF_SIZE]; 11 | 12 | char* w_pcap_lookupdev(char **errbuf) { 13 | *errbuf = gerrbuf; 14 | pcap_lookupdev(gerrbuf); 15 | } 16 | 17 | void* w_pcap_open(char *dev, char *errbuf) { 18 | return (void*) pcap_open_live(dev, BUFSIZ, 1,-1, errbuf); 19 | } 20 | 21 | int w_pcap_next_ex(void *pcap, unsigned char **pkt_data) { 22 | struct pcap_pkthdr *header; 23 | int ret = pcap_next_ex(pcap, &header, pkt_data); 24 | if (ret < 0) { 25 | return ret; 26 | } 27 | return header->len; 28 | } 29 | 30 | void pcap_send(void *pcap, void *src, uint32_t size) { 31 | pcap_sendpacket(pcap, (uint8_t *) src, size); 32 | } 33 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/core/ipv6/dhcp6.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * 4 | * DHCPv6. 5 | */ 6 | 7 | /* 8 | * Copyright (c) 2010 Inico Technologies Ltd. 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright notice, 15 | * this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 3. The name of the author may not be used to endorse or promote products 20 | * derived from this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31 | * OF SUCH DAMAGE. 32 | * 33 | * This file is part of the lwIP TCP/IP stack. 34 | * 35 | * Author: Ivan Delamer 36 | * 37 | * 38 | * Please coordinate changes and requests with Ivan Delamer 39 | * 40 | */ 41 | 42 | #include "lwip/opt.h" 43 | 44 | #if LWIP_IPV6 && LWIP_IPV6_DHCP6 /* don't build if not configured for use in lwipopts.h */ 45 | 46 | #include "lwip/ip6_addr.h" 47 | #include "lwip/def.h" 48 | 49 | 50 | #endif /* LWIP_IPV6 && LWIP_IPV6_DHCP6 */ 51 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/core/ipv6/inet6.c: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * 4 | * INET v6 addresses. 5 | */ 6 | 7 | /* 8 | * Copyright (c) 2010 Inico Technologies Ltd. 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright notice, 15 | * this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 3. The name of the author may not be used to endorse or promote products 20 | * derived from this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31 | * OF SUCH DAMAGE. 32 | * 33 | * This file is part of the lwIP TCP/IP stack. 34 | * 35 | * Author: Ivan Delamer 36 | * 37 | * 38 | * Please coordinate changes and requests with Ivan Delamer 39 | * 40 | */ 41 | 42 | #include "lwip/opt.h" 43 | 44 | #if LWIP_IPV6 && LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */ 45 | 46 | #include "lwip/def.h" 47 | #include "lwip/inet.h" 48 | 49 | /** This variable is initialized by the system to contain the wildcard IPv6 address. 50 | */ 51 | const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT; 52 | 53 | #endif /* LWIP_IPV6 */ 54 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/lwip/apps/FILES: -------------------------------------------------------------------------------- 1 | This directory contains application headers. 2 | Every application shall provide one api file APP.h and optionally one options file APP_opts.h 3 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/lwip/apps/lwiperf.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * lwIP iPerf server implementation 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2014 Simon Goldschmidt 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | * Author: Simon Goldschmidt 35 | * 36 | */ 37 | #ifndef LWIP_HDR_APPS_LWIPERF_H 38 | #define LWIP_HDR_APPS_LWIPERF_H 39 | 40 | #include "lwip/opt.h" 41 | #include "lwip/ip_addr.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | #define LWIPERF_TCP_PORT_DEFAULT 5001 48 | 49 | /** lwIPerf test results */ 50 | enum lwiperf_report_type 51 | { 52 | /** The server side test is done */ 53 | LWIPERF_TCP_DONE_SERVER, 54 | /** The client side test is done */ 55 | LWIPERF_TCP_DONE_CLIENT, 56 | /** Local error lead to test abort */ 57 | LWIPERF_TCP_ABORTED_LOCAL, 58 | /** Data check error lead to test abort */ 59 | LWIPERF_TCP_ABORTED_LOCAL_DATAERROR, 60 | /** Transmit error lead to test abort */ 61 | LWIPERF_TCP_ABORTED_LOCAL_TXERROR, 62 | /** Remote side aborted the test */ 63 | LWIPERF_TCP_ABORTED_REMOTE 64 | }; 65 | 66 | /** Prototype of a report function that is called when a session is finished. 67 | This report function can show the test results. 68 | @param report_type contains the test result */ 69 | typedef void (*lwiperf_report_fn)(void *arg, enum lwiperf_report_type report_type, 70 | const ip_addr_t* local_addr, u16_t local_port, const ip_addr_t* remote_addr, u16_t remote_port, 71 | u32_t bytes_transferred, u32_t ms_duration, u32_t bandwidth_kbitpsec); 72 | 73 | 74 | void* lwiperf_start_tcp_server(const ip_addr_t* local_addr, u16_t local_port, 75 | lwiperf_report_fn report_fn, void* report_arg); 76 | void* lwiperf_start_tcp_server_default(lwiperf_report_fn report_fn, void* report_arg); 77 | void lwiperf_abort(void* lwiperf_session); 78 | 79 | 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | 84 | #endif /* LWIP_HDR_APPS_LWIPERF_H */ 85 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/lwip/apps/mdns.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * MDNS responder 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2015 Verisure Innovation AB 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | * Author: Erik Ekman 35 | * 36 | */ 37 | #ifndef LWIP_HDR_MDNS_H 38 | #define LWIP_HDR_MDNS_H 39 | 40 | #include "lwip/apps/mdns_opts.h" 41 | #include "lwip/netif.h" 42 | 43 | #if LWIP_MDNS_RESPONDER 44 | 45 | enum mdns_sd_proto { 46 | DNSSD_PROTO_UDP = 0, 47 | DNSSD_PROTO_TCP = 1 48 | }; 49 | 50 | #define MDNS_LABEL_MAXLEN 63 51 | 52 | struct mdns_host; 53 | struct mdns_service; 54 | 55 | /** Callback function to add text to a reply, called when generating the reply */ 56 | typedef void (*service_get_txt_fn_t)(struct mdns_service *service, void *txt_userdata); 57 | 58 | void mdns_resp_init(void); 59 | 60 | err_t mdns_resp_add_netif(struct netif *netif, const char *hostname, u32_t dns_ttl); 61 | err_t mdns_resp_remove_netif(struct netif *netif); 62 | 63 | err_t mdns_resp_add_service(struct netif *netif, const char *name, const char *service, enum mdns_sd_proto proto, u16_t port, u32_t dns_ttl, service_get_txt_fn_t txt_fn, void *txt_userdata); 64 | err_t mdns_resp_add_service_txtitem(struct mdns_service *service, const char *txt, u8_t txt_len); 65 | void mdns_resp_netif_settings_changed(struct netif *netif); 66 | 67 | #endif /* LWIP_MDNS_RESPONDER */ 68 | 69 | #endif /* LWIP_HDR_MDNS_H */ 70 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/lwip/apps/mdns_opts.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * MDNS responder 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2015 Verisure Innovation AB 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | * Author: Erik Ekman 35 | * 36 | */ 37 | 38 | #ifndef LWIP_HDR_APPS_MDNS_OPTS_H 39 | #define LWIP_HDR_APPS_MDNS_OPTS_H 40 | 41 | #include "lwip/opt.h" 42 | 43 | /** 44 | * @defgroup mdns_opts Options 45 | * @ingroup mdns 46 | * @{ 47 | */ 48 | 49 | /** 50 | * LWIP_MDNS_RESPONDER==1: Turn on multicast DNS module. UDP must be available for MDNS 51 | * transport. IGMP is needed for IPv4 multicast. 52 | */ 53 | #ifndef LWIP_MDNS_RESPONDER 54 | #define LWIP_MDNS_RESPONDER 0 55 | #endif /* LWIP_MDNS_RESPONDER */ 56 | 57 | /** The maximum number of services per netif */ 58 | #ifndef MDNS_MAX_SERVICES 59 | #define MDNS_MAX_SERVICES 1 60 | #endif 61 | 62 | /** 63 | * MDNS_DEBUG: Enable debugging for multicast DNS. 64 | */ 65 | #ifndef MDNS_DEBUG 66 | #define MDNS_DEBUG LWIP_DBG_OFF 67 | #endif 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | #endif /* LWIP_HDR_APPS_MDNS_OPTS_H */ 74 | 75 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/lwip/apps/mdns_priv.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * MDNS responder private definitions 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2015 Verisure Innovation AB 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | * Author: Erik Ekman 35 | * 36 | */ 37 | #ifndef LWIP_HDR_MDNS_PRIV_H 38 | #define LWIP_HDR_MDNS_PRIV_H 39 | 40 | #include "lwip/apps/mdns_opts.h" 41 | #include "lwip/pbuf.h" 42 | 43 | #if LWIP_MDNS_RESPONDER 44 | 45 | /* Domain struct and methods - visible for unit tests */ 46 | 47 | #define MDNS_DOMAIN_MAXLEN 256 48 | #define MDNS_READNAME_ERROR 0xFFFF 49 | 50 | struct mdns_domain { 51 | /* Encoded domain name */ 52 | u8_t name[MDNS_DOMAIN_MAXLEN]; 53 | /* Total length of domain name, including zero */ 54 | u16_t length; 55 | /* Set if compression of this domain is not allowed */ 56 | u8_t skip_compression; 57 | }; 58 | 59 | err_t mdns_domain_add_label(struct mdns_domain *domain, const char *label, u8_t len); 60 | u16_t mdns_readname(struct pbuf *p, u16_t offset, struct mdns_domain *domain); 61 | int mdns_domain_eq(struct mdns_domain *a, struct mdns_domain *b); 62 | u16_t mdns_compress_domain(struct pbuf *pbuf, u16_t *offset, struct mdns_domain *domain); 63 | 64 | #endif /* LWIP_MDNS_RESPONDER */ 65 | 66 | #endif /* LWIP_HDR_MDNS_PRIV_H */ 67 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/lwip/apps/mqtt_opts.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * MQTT client options 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2016 Erik Andersson 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | * Author: Erik Andersson 35 | * 36 | */ 37 | #ifndef LWIP_HDR_APPS_MQTT_OPTS_H 38 | #define LWIP_HDR_APPS_MQTT_OPTS_H 39 | 40 | #include "lwip/opt.h" 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /** 47 | * @defgroup mqtt_opts Options 48 | * @ingroup mqtt 49 | * @{ 50 | */ 51 | 52 | /** 53 | * Output ring-buffer size, must be able to fit largest outgoing publish message topic+payloads 54 | */ 55 | #ifndef MQTT_OUTPUT_RINGBUF_SIZE 56 | #define MQTT_OUTPUT_RINGBUF_SIZE 256 57 | #endif 58 | 59 | /** 60 | * Number of bytes in receive buffer, must be at least the size of the longest incoming topic + 8 61 | * If one wants to avoid fragmented incoming publish, set length to max incoming topic length + max payload length + 8 62 | */ 63 | #ifndef MQTT_VAR_HEADER_BUFFER_LEN 64 | #define MQTT_VAR_HEADER_BUFFER_LEN 128 65 | #endif 66 | 67 | /** 68 | * Maximum number of pending subscribe, unsubscribe and publish requests to server . 69 | */ 70 | #ifndef MQTT_REQ_MAX_IN_FLIGHT 71 | #define MQTT_REQ_MAX_IN_FLIGHT 4 72 | #endif 73 | 74 | /** 75 | * Seconds between each cyclic timer call. 76 | */ 77 | #ifndef MQTT_CYCLIC_TIMER_INTERVAL 78 | #define MQTT_CYCLIC_TIMER_INTERVAL 5 79 | #endif 80 | 81 | /** 82 | * Publish, subscribe and unsubscribe request timeout in seconds. 83 | */ 84 | #ifndef MQTT_REQ_TIMEOUT 85 | #define MQTT_REQ_TIMEOUT 30 86 | #endif 87 | 88 | /** 89 | * Seconds for MQTT connect response timeout after sending connect request 90 | */ 91 | #ifndef MQTT_CONNECT_TIMOUT 92 | #define MQTT_CONNECT_TIMOUT 100 93 | #endif 94 | 95 | /** 96 | * @} 97 | */ 98 | 99 | #ifdef __cplusplus 100 | } 101 | #endif 102 | 103 | #endif /* LWIP_HDR_APPS_MQTT_OPTS_H */ 104 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/lwip/apps/netbiosns.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * NETBIOS name service responder 4 | */ 5 | 6 | /* 7 | * Redistribution and use in source and binary forms, with or without modification, 8 | * are permitted provided that the following conditions are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 3. The name of the author may not be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 19 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 21 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 23 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 26 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 27 | * OF SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | */ 32 | #ifndef LWIP_HDR_APPS_NETBIOS_H 33 | #define LWIP_HDR_APPS_NETBIOS_H 34 | 35 | #include "lwip/apps/netbiosns_opts.h" 36 | 37 | void netbiosns_init(void); 38 | #ifndef NETBIOS_LWIP_NAME 39 | void netbiosns_set_name(const char* hostname); 40 | #endif 41 | void netbiosns_stop(void); 42 | 43 | #endif /* LWIP_HDR_APPS_NETBIOS_H */ 44 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/lwip/apps/netbiosns_opts.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * NETBIOS name service responder options 4 | */ 5 | 6 | /* 7 | * Redistribution and use in source and binary forms, with or without modification, 8 | * are permitted provided that the following conditions are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 3. The name of the author may not be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 19 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 21 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 23 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 26 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 27 | * OF SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | */ 32 | #ifndef LWIP_HDR_APPS_NETBIOS_OPTS_H 33 | #define LWIP_HDR_APPS_NETBIOS_OPTS_H 34 | 35 | #include "lwip/opt.h" 36 | 37 | /** 38 | * @defgroup netbiosns_opts Options 39 | * @ingroup netbiosns 40 | * @{ 41 | */ 42 | 43 | /** NetBIOS name of lwip device 44 | * This must be uppercase until NETBIOS_STRCMP() is defined to a string 45 | * comparision function that is case insensitive. 46 | * If you want to use the netif's hostname, use this (with LWIP_NETIF_HOSTNAME): 47 | * (ip_current_netif() != NULL ? ip_current_netif()->hostname != NULL ? ip_current_netif()->hostname : "" : "") 48 | * 49 | * If this is not defined, netbiosns_set_name() can be called at runtime to change the name. 50 | */ 51 | #ifdef __DOXYGEN__ 52 | #define NETBIOS_LWIP_NAME "NETBIOSLWIPDEV" 53 | #endif 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | #endif /* LWIP_HDR_APPS_NETBIOS_OPTS_H */ 60 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/lwip/apps/snmp_mib2.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * SNMP MIB2 API 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | * Author: Dirk Ziegelmeier 35 | * 36 | */ 37 | #ifndef LWIP_HDR_APPS_SNMP_MIB2_H 38 | #define LWIP_HDR_APPS_SNMP_MIB2_H 39 | 40 | #include "lwip/apps/snmp_opts.h" 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */ 47 | #if SNMP_LWIP_MIB2 48 | 49 | #include "lwip/apps/snmp_core.h" 50 | 51 | extern const struct snmp_mib mib2; 52 | 53 | #if SNMP_USE_NETCONN 54 | #include "lwip/apps/snmp_threadsync.h" 55 | void snmp_mib2_lwip_synchronizer(snmp_threadsync_called_fn fn, void* arg); 56 | extern struct snmp_threadsync_instance snmp_mib2_lwip_locks; 57 | #endif 58 | 59 | #ifndef SNMP_SYSSERVICES 60 | #define SNMP_SYSSERVICES ((1 << 6) | (1 << 3) | ((IP_FORWARD) << 2)) 61 | #endif 62 | 63 | void snmp_mib2_set_sysdescr(const u8_t* str, const u16_t* len); /* read-only be defintion */ 64 | void snmp_mib2_set_syscontact(u8_t *ocstr, u16_t *ocstrlen, u16_t bufsize); 65 | void snmp_mib2_set_syscontact_readonly(const u8_t *ocstr, const u16_t *ocstrlen); 66 | void snmp_mib2_set_sysname(u8_t *ocstr, u16_t *ocstrlen, u16_t bufsize); 67 | void snmp_mib2_set_sysname_readonly(const u8_t *ocstr, const u16_t *ocstrlen); 68 | void snmp_mib2_set_syslocation(u8_t *ocstr, u16_t *ocstrlen, u16_t bufsize); 69 | void snmp_mib2_set_syslocation_readonly(const u8_t *ocstr, const u16_t *ocstrlen); 70 | 71 | #endif /* SNMP_LWIP_MIB2 */ 72 | #endif /* LWIP_SNMP */ 73 | 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | 78 | #endif /* LWIP_HDR_APPS_SNMP_MIB2_H */ 79 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/lwip/apps/sntp.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * SNTP client API 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2007-2009 Frédéric Bernon, Simon Goldschmidt 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | * Author: Frédéric Bernon, Simon Goldschmidt 35 | * 36 | */ 37 | #ifndef LWIP_HDR_APPS_SNTP_H 38 | #define LWIP_HDR_APPS_SNTP_H 39 | 40 | #include "lwip/apps/sntp_opts.h" 41 | #include "lwip/ip_addr.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /* SNTP operating modes: default is to poll using unicast. 48 | The mode has to be set before calling sntp_init(). */ 49 | #define SNTP_OPMODE_POLL 0 50 | #define SNTP_OPMODE_LISTENONLY 1 51 | void sntp_setoperatingmode(u8_t operating_mode); 52 | u8_t sntp_getoperatingmode(void); 53 | 54 | void sntp_init(void); 55 | void sntp_stop(void); 56 | u8_t sntp_enabled(void); 57 | 58 | void sntp_setserver(u8_t idx, const ip_addr_t *addr); 59 | const ip_addr_t* sntp_getserver(u8_t idx); 60 | 61 | #if SNTP_SERVER_DNS 62 | void sntp_setservername(u8_t idx, char *server); 63 | char *sntp_getservername(u8_t idx); 64 | #endif /* SNTP_SERVER_DNS */ 65 | 66 | #if SNTP_GET_SERVERS_FROM_DHCP 67 | void sntp_servermode_dhcp(int set_servers_from_dhcp); 68 | #else /* SNTP_GET_SERVERS_FROM_DHCP */ 69 | #define sntp_servermode_dhcp(x) 70 | #endif /* SNTP_GET_SERVERS_FROM_DHCP */ 71 | 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | 76 | #endif /* LWIP_HDR_APPS_SNTP_H */ 77 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/lwip/apps/tftp_opts.h: -------------------------------------------------------------------------------- 1 | /****************************************************************//** 2 | * 3 | * @file tftp_opts.h 4 | * 5 | * @author Logan Gunthorpe 6 | * 7 | * @brief Trivial File Transfer Protocol (RFC 1350) implementation options 8 | * 9 | * Copyright (c) Deltatee Enterprises Ltd. 2013 10 | * All rights reserved. 11 | * 12 | ********************************************************************/ 13 | 14 | /* 15 | * Redistribution and use in source and binary forms, with or without 16 | * modification,are permitted provided that the following conditions are met: 17 | * 18 | * 1. Redistributions of source code must retain the above copyright notice, 19 | * this list of conditions and the following disclaimer. 20 | * 2. Redistributions in binary form must reproduce the above copyright notice, 21 | * this list of conditions and the following disclaimer in the documentation 22 | * and/or other materials provided with the distribution. 23 | * 3. The name of the author may not be used to endorse or promote products 24 | * derived from this software without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 27 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 28 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 29 | * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 31 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 32 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 33 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 34 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 35 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | * 37 | * Author: Logan Gunthorpe 38 | * 39 | */ 40 | 41 | #ifndef LWIP_HDR_APPS_TFTP_OPTS_H 42 | #define LWIP_HDR_APPS_TFTP_OPTS_H 43 | 44 | #include "lwip/opt.h" 45 | 46 | /** 47 | * @defgroup tftp_opts Options 48 | * @ingroup tftp 49 | * @{ 50 | */ 51 | 52 | /** 53 | * Enable TFTP debug messages 54 | */ 55 | #if !defined TFTP_DEBUG || defined __DOXYGEN__ 56 | #define TFTP_DEBUG LWIP_DBG_ON 57 | #endif 58 | 59 | /** 60 | * TFTP server port 61 | */ 62 | #if !defined TFTP_PORT || defined __DOXYGEN__ 63 | #define TFTP_PORT 69 64 | #endif 65 | 66 | /** 67 | * TFTP timeout 68 | */ 69 | #if !defined TFTP_TIMEOUT_MSECS || defined __DOXYGEN__ 70 | #define TFTP_TIMEOUT_MSECS 10000 71 | #endif 72 | 73 | /** 74 | * Max. number of retries when a file is read from server 75 | */ 76 | #if !defined TFTP_MAX_RETRIES || defined __DOXYGEN__ 77 | #define TFTP_MAX_RETRIES 5 78 | #endif 79 | 80 | /** 81 | * TFTP timer cyclic interval 82 | */ 83 | #if !defined TFTP_TIMER_MSECS || defined __DOXYGEN__ 84 | #define TFTP_TIMER_MSECS 50 85 | #endif 86 | 87 | /** 88 | * Max. length of TFTP filename 89 | */ 90 | #if !defined TFTP_MAX_FILENAME_LEN || defined __DOXYGEN__ 91 | #define TFTP_MAX_FILENAME_LEN 20 92 | #endif 93 | 94 | /** 95 | * Max. length of TFTP mode 96 | */ 97 | #if !defined TFTP_MAX_MODE_LEN || defined __DOXYGEN__ 98 | #define TFTP_MAX_MODE_LEN 7 99 | #endif 100 | 101 | /** 102 | * @} 103 | */ 104 | 105 | #endif /* LWIP_HDR_APPS_TFTP_OPTS_H */ 106 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/lwip/dhcp6.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * 4 | * IPv6 address autoconfiguration as per RFC 4862. 5 | */ 6 | 7 | /* 8 | * Copyright (c) 2010 Inico Technologies Ltd. 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright notice, 15 | * this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 3. The name of the author may not be used to endorse or promote products 20 | * derived from this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31 | * OF SUCH DAMAGE. 32 | * 33 | * This file is part of the lwIP TCP/IP stack. 34 | * 35 | * Author: Ivan Delamer 36 | * 37 | * IPv6 address autoconfiguration as per RFC 4862. 38 | * 39 | * Please coordinate changes and requests with Ivan Delamer 40 | * 41 | */ 42 | 43 | #ifndef LWIP_HDR_IP6_DHCP6_H 44 | #define LWIP_HDR_IP6_DHCP6_H 45 | 46 | #include "lwip/opt.h" 47 | 48 | #if LWIP_IPV6_DHCP6 /* don't build if not configured for use in lwipopts.h */ 49 | 50 | 51 | struct dhcp6 52 | { 53 | /*@todo: implement DHCP6*/ 54 | }; 55 | 56 | #endif /* LWIP_IPV6_DHCP6 */ 57 | 58 | #endif /* LWIP_HDR_IP6_DHCP6_H */ 59 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/lwip/ethip6.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * 4 | * Ethernet output for IPv6. Uses ND tables for link-layer addressing. 5 | */ 6 | 7 | /* 8 | * Copyright (c) 2010 Inico Technologies Ltd. 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright notice, 15 | * this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 3. The name of the author may not be used to endorse or promote products 20 | * derived from this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31 | * OF SUCH DAMAGE. 32 | * 33 | * This file is part of the lwIP TCP/IP stack. 34 | * 35 | * Author: Ivan Delamer 36 | * 37 | * 38 | * Please coordinate changes and requests with Ivan Delamer 39 | * 40 | */ 41 | 42 | #ifndef LWIP_HDR_ETHIP6_H 43 | #define LWIP_HDR_ETHIP6_H 44 | 45 | #include "lwip/opt.h" 46 | 47 | #if LWIP_IPV6 && LWIP_ETHERNET /* don't build if not configured for use in lwipopts.h */ 48 | 49 | #include "lwip/pbuf.h" 50 | #include "lwip/ip6.h" 51 | #include "lwip/ip6_addr.h" 52 | #include "lwip/netif.h" 53 | 54 | 55 | #ifdef __cplusplus 56 | extern "C" { 57 | #endif 58 | 59 | 60 | err_t ethip6_output(struct netif *netif, struct pbuf *q, const ip6_addr_t *ip6addr); 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | #endif /* LWIP_IPV6 && LWIP_ETHERNET */ 67 | 68 | #endif /* LWIP_HDR_ETHIP6_H */ 69 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/lwip/icmp6.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * 4 | * IPv6 version of ICMP, as per RFC 4443. 5 | */ 6 | 7 | /* 8 | * Copyright (c) 2010 Inico Technologies Ltd. 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright notice, 15 | * this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 3. The name of the author may not be used to endorse or promote products 20 | * derived from this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31 | * OF SUCH DAMAGE. 32 | * 33 | * This file is part of the lwIP TCP/IP stack. 34 | * 35 | * Author: Ivan Delamer 36 | * 37 | * 38 | * Please coordinate changes and requests with Ivan Delamer 39 | * 40 | */ 41 | #ifndef LWIP_HDR_ICMP6_H 42 | #define LWIP_HDR_ICMP6_H 43 | 44 | #include "lwip/opt.h" 45 | #include "lwip/pbuf.h" 46 | #include "lwip/ip6_addr.h" 47 | #include "lwip/netif.h" 48 | #include "lwip/prot/icmp6.h" 49 | 50 | #ifdef __cplusplus 51 | extern "C" { 52 | #endif 53 | 54 | #if LWIP_ICMP6 && LWIP_IPV6 /* don't build if not configured for use in lwipopts.h */ 55 | 56 | void icmp6_input(struct pbuf *p, struct netif *inp); 57 | void icmp6_dest_unreach(struct pbuf *p, enum icmp6_dur_code c); 58 | void icmp6_packet_too_big(struct pbuf *p, u32_t mtu); 59 | void icmp6_time_exceeded(struct pbuf *p, enum icmp6_te_code c); 60 | void icmp6_param_problem(struct pbuf *p, enum icmp6_pp_code c, u32_t pointer); 61 | 62 | #endif /* LWIP_ICMP6 && LWIP_IPV6 */ 63 | 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | 69 | 70 | #endif /* LWIP_HDR_ICMP6_H */ 71 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/lwip/ip4_frag.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * IP fragmentation/reassembly 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | * Author: Jani Monoses 35 | * 36 | */ 37 | 38 | #ifndef LWIP_HDR_IP4_FRAG_H 39 | #define LWIP_HDR_IP4_FRAG_H 40 | 41 | #include "lwip/opt.h" 42 | #include "lwip/err.h" 43 | #include "lwip/pbuf.h" 44 | #include "lwip/netif.h" 45 | #include "lwip/ip_addr.h" 46 | #include "lwip/ip.h" 47 | 48 | #if LWIP_IPV4 49 | 50 | #ifdef __cplusplus 51 | extern "C" { 52 | #endif 53 | 54 | #if IP_REASSEMBLY 55 | /* The IP reassembly timer interval in milliseconds. */ 56 | #define IP_TMR_INTERVAL 1000 57 | 58 | /** IP reassembly helper struct. 59 | * This is exported because memp needs to know the size. 60 | */ 61 | struct ip_reassdata { 62 | struct ip_reassdata *next; 63 | struct pbuf *p; 64 | struct ip_hdr iphdr; 65 | u16_t datagram_len; 66 | u8_t flags; 67 | u8_t timer; 68 | }; 69 | 70 | void ip_reass_init(void); 71 | void ip_reass_tmr(void); 72 | struct pbuf * ip4_reass(struct pbuf *p); 73 | #endif /* IP_REASSEMBLY */ 74 | 75 | #if IP_FRAG 76 | #if !LWIP_NETIF_TX_SINGLE_PBUF 77 | #ifndef LWIP_PBUF_CUSTOM_REF_DEFINED 78 | #define LWIP_PBUF_CUSTOM_REF_DEFINED 79 | /** A custom pbuf that holds a reference to another pbuf, which is freed 80 | * when this custom pbuf is freed. This is used to create a custom PBUF_REF 81 | * that points into the original pbuf. */ 82 | struct pbuf_custom_ref { 83 | /** 'base class' */ 84 | struct pbuf_custom pc; 85 | /** pointer to the original pbuf that is referenced */ 86 | struct pbuf *original; 87 | }; 88 | #endif /* LWIP_PBUF_CUSTOM_REF_DEFINED */ 89 | #endif /* !LWIP_NETIF_TX_SINGLE_PBUF */ 90 | 91 | err_t ip4_frag(struct pbuf *p, struct netif *netif, const ip4_addr_t *dest); 92 | #endif /* IP_FRAG */ 93 | 94 | #ifdef __cplusplus 95 | } 96 | #endif 97 | 98 | #endif /* LWIP_IPV4 */ 99 | 100 | #endif /* LWIP_HDR_IP4_FRAG_H */ 101 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/lwip/mem.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Heap API 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | * Author: Adam Dunkels 35 | * 36 | */ 37 | #ifndef LWIP_HDR_MEM_H 38 | #define LWIP_HDR_MEM_H 39 | 40 | #include "lwip/opt.h" 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #if MEM_LIBC_MALLOC 47 | 48 | #include "lwip/arch.h" 49 | 50 | typedef size_t mem_size_t; 51 | #define MEM_SIZE_F SZT_F 52 | 53 | #elif MEM_USE_POOLS 54 | 55 | typedef u16_t mem_size_t; 56 | #define MEM_SIZE_F U16_F 57 | 58 | #else 59 | 60 | /* MEM_SIZE would have to be aligned, but using 64000 here instead of 61 | * 65535 leaves some room for alignment... 62 | */ 63 | #if MEM_SIZE > 64000L 64 | typedef u32_t mem_size_t; 65 | #define MEM_SIZE_F U32_F 66 | #else 67 | typedef u16_t mem_size_t; 68 | #define MEM_SIZE_F U16_F 69 | #endif /* MEM_SIZE > 64000 */ 70 | #endif 71 | 72 | void mem_init(void); 73 | void *mem_trim(void *mem, mem_size_t size); 74 | void *mem_malloc(mem_size_t size); 75 | void *mem_calloc(mem_size_t count, mem_size_t size); 76 | void mem_free(void *mem); 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | 82 | #endif /* LWIP_HDR_MEM_H */ 83 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/lwip/nd6.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * 4 | * Neighbor discovery and stateless address autoconfiguration for IPv6. 5 | * Aims to be compliant with RFC 4861 (Neighbor discovery) and RFC 4862 6 | * (Address autoconfiguration). 7 | */ 8 | 9 | /* 10 | * Copyright (c) 2010 Inico Technologies Ltd. 11 | * All rights reserved. 12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 16 | * 1. Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 3. The name of the author may not be used to endorse or promote products 22 | * derived from this software without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 25 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 26 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 27 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 28 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 29 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 32 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 33 | * OF SUCH DAMAGE. 34 | * 35 | * This file is part of the lwIP TCP/IP stack. 36 | * 37 | * Author: Ivan Delamer 38 | * 39 | * 40 | * Please coordinate changes and requests with Ivan Delamer 41 | * 42 | */ 43 | 44 | #ifndef LWIP_HDR_ND6_H 45 | #define LWIP_HDR_ND6_H 46 | 47 | #include "lwip/opt.h" 48 | 49 | #if LWIP_IPV6 /* don't build if not configured for use in lwipopts.h */ 50 | 51 | #include "lwip/ip6_addr.h" 52 | #include "lwip/err.h" 53 | 54 | #ifdef __cplusplus 55 | extern "C" { 56 | #endif 57 | 58 | /** 1 second period */ 59 | #define ND6_TMR_INTERVAL 1000 60 | 61 | struct pbuf; 62 | struct netif; 63 | 64 | void nd6_tmr(void); 65 | void nd6_input(struct pbuf *p, struct netif *inp); 66 | void nd6_clear_destination_cache(void); 67 | struct netif *nd6_find_route(const ip6_addr_t *ip6addr); 68 | err_t nd6_get_next_hop_addr_or_queue(struct netif *netif, struct pbuf *q, const ip6_addr_t *ip6addr, const u8_t **hwaddrp); 69 | u16_t nd6_get_destination_mtu(const ip6_addr_t *ip6addr, struct netif *netif); 70 | #if LWIP_ND6_TCP_REACHABILITY_HINTS 71 | void nd6_reachability_hint(const ip6_addr_t *ip6addr); 72 | #endif /* LWIP_ND6_TCP_REACHABILITY_HINTS */ 73 | void nd6_cleanup_netif(struct netif *netif); 74 | #if LWIP_IPV6_MLD 75 | void nd6_adjust_mld_membership(struct netif *netif, s8_t addr_idx, u8_t new_state); 76 | #endif /* LWIP_IPV6_MLD */ 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | 82 | #endif /* LWIP_IPV6 */ 83 | 84 | #endif /* LWIP_HDR_ND6_H */ 85 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/lwip/prot/autoip.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * AutoIP protocol definitions 4 | */ 5 | 6 | /* 7 | * 8 | * Copyright (c) 2007 Dominik Spies 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright notice, 15 | * this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 3. The name of the author may not be used to endorse or promote products 20 | * derived from this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31 | * OF SUCH DAMAGE. 32 | * 33 | * Author: Dominik Spies 34 | * 35 | * This is a AutoIP implementation for the lwIP TCP/IP stack. It aims to conform 36 | * with RFC 3927. 37 | * 38 | */ 39 | 40 | #ifndef LWIP_HDR_PROT_AUTOIP_H 41 | #define LWIP_HDR_PROT_AUTOIP_H 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /* 169.254.0.0 */ 48 | #define AUTOIP_NET 0xA9FE0000 49 | /* 169.254.1.0 */ 50 | #define AUTOIP_RANGE_START (AUTOIP_NET | 0x0100) 51 | /* 169.254.254.255 */ 52 | #define AUTOIP_RANGE_END (AUTOIP_NET | 0xFEFF) 53 | 54 | /* RFC 3927 Constants */ 55 | #define PROBE_WAIT 1 /* second (initial random delay) */ 56 | #define PROBE_MIN 1 /* second (minimum delay till repeated probe) */ 57 | #define PROBE_MAX 2 /* seconds (maximum delay till repeated probe) */ 58 | #define PROBE_NUM 3 /* (number of probe packets) */ 59 | #define ANNOUNCE_NUM 2 /* (number of announcement packets) */ 60 | #define ANNOUNCE_INTERVAL 2 /* seconds (time between announcement packets) */ 61 | #define ANNOUNCE_WAIT 2 /* seconds (delay before announcing) */ 62 | #define MAX_CONFLICTS 10 /* (max conflicts before rate limiting) */ 63 | #define RATE_LIMIT_INTERVAL 60 /* seconds (delay between successive attempts) */ 64 | #define DEFEND_INTERVAL 10 /* seconds (min. wait between defensive ARPs) */ 65 | 66 | /* AutoIP client states */ 67 | typedef enum { 68 | AUTOIP_STATE_OFF = 0, 69 | AUTOIP_STATE_PROBING = 1, 70 | AUTOIP_STATE_ANNOUNCING = 2, 71 | AUTOIP_STATE_BOUND = 3 72 | } autoip_state_enum_t; 73 | 74 | #ifdef __cplusplus 75 | } 76 | #endif 77 | 78 | #endif /* LWIP_HDR_PROT_AUTOIP_H */ 79 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/lwip/prot/etharp.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * ARP protocol definitions 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | * Author: Adam Dunkels 35 | * 36 | */ 37 | #ifndef LWIP_HDR_PROT_ETHARP_H 38 | #define LWIP_HDR_PROT_ETHARP_H 39 | 40 | #include "lwip/arch.h" 41 | #include "lwip/prot/ethernet.h" 42 | #include "lwip/ip4_addr.h" 43 | 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif 47 | 48 | #ifndef ETHARP_HWADDR_LEN 49 | #define ETHARP_HWADDR_LEN ETH_HWADDR_LEN 50 | #endif 51 | 52 | #ifdef PACK_STRUCT_USE_INCLUDES 53 | # include "arch/bpstruct.h" 54 | #endif 55 | PACK_STRUCT_BEGIN 56 | /** the ARP message, see RFC 826 ("Packet format") */ 57 | struct etharp_hdr { 58 | PACK_STRUCT_FIELD(u16_t hwtype); 59 | PACK_STRUCT_FIELD(u16_t proto); 60 | PACK_STRUCT_FLD_8(u8_t hwlen); 61 | PACK_STRUCT_FLD_8(u8_t protolen); 62 | PACK_STRUCT_FIELD(u16_t opcode); 63 | PACK_STRUCT_FLD_S(struct eth_addr shwaddr); 64 | PACK_STRUCT_FLD_S(struct ip4_addr2 sipaddr); 65 | PACK_STRUCT_FLD_S(struct eth_addr dhwaddr); 66 | PACK_STRUCT_FLD_S(struct ip4_addr2 dipaddr); 67 | } PACK_STRUCT_STRUCT; 68 | PACK_STRUCT_END 69 | #ifdef PACK_STRUCT_USE_INCLUDES 70 | # include "arch/epstruct.h" 71 | #endif 72 | 73 | #define SIZEOF_ETHARP_HDR 28 74 | 75 | /* ARP hwtype values */ 76 | enum etharp_hwtype { 77 | HWTYPE_ETHERNET = 1 78 | /* others not used */ 79 | }; 80 | 81 | /* ARP message types (opcodes) */ 82 | enum etharp_opcode { 83 | ARP_REQUEST = 1, 84 | ARP_REPLY = 2 85 | }; 86 | 87 | #ifdef __cplusplus 88 | } 89 | #endif 90 | 91 | #endif /* LWIP_HDR_PROT_ETHARP_H */ 92 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/lwip/prot/icmp.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * ICMP protocol definitions 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | * Author: Adam Dunkels 35 | * 36 | */ 37 | #ifndef LWIP_HDR_PROT_ICMP_H 38 | #define LWIP_HDR_PROT_ICMP_H 39 | 40 | #include "lwip/arch.h" 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #define ICMP_ER 0 /* echo reply */ 47 | #define ICMP_DUR 3 /* destination unreachable */ 48 | #define ICMP_SQ 4 /* source quench */ 49 | #define ICMP_RD 5 /* redirect */ 50 | #define ICMP_ECHO 8 /* echo */ 51 | #define ICMP_TE 11 /* time exceeded */ 52 | #define ICMP_PP 12 /* parameter problem */ 53 | #define ICMP_TS 13 /* timestamp */ 54 | #define ICMP_TSR 14 /* timestamp reply */ 55 | #define ICMP_IRQ 15 /* information request */ 56 | #define ICMP_IR 16 /* information reply */ 57 | #define ICMP_AM 17 /* address mask request */ 58 | #define ICMP_AMR 18 /* address mask reply */ 59 | 60 | #ifdef PACK_STRUCT_USE_INCLUDES 61 | # include "arch/bpstruct.h" 62 | #endif 63 | /** This is the standard ICMP header only that the u32_t data 64 | * is split to two u16_t like ICMP echo needs it. 65 | * This header is also used for other ICMP types that do not 66 | * use the data part. 67 | */ 68 | PACK_STRUCT_BEGIN 69 | struct icmp_echo_hdr { 70 | PACK_STRUCT_FLD_8(u8_t type); 71 | PACK_STRUCT_FLD_8(u8_t code); 72 | PACK_STRUCT_FIELD(u16_t chksum); 73 | PACK_STRUCT_FIELD(u16_t id); 74 | PACK_STRUCT_FIELD(u16_t seqno); 75 | } PACK_STRUCT_STRUCT; 76 | PACK_STRUCT_END 77 | #ifdef PACK_STRUCT_USE_INCLUDES 78 | # include "arch/epstruct.h" 79 | #endif 80 | 81 | /* Compatibility defines, old versions used to combine type and code to an u16_t */ 82 | #define ICMPH_TYPE(hdr) ((hdr)->type) 83 | #define ICMPH_CODE(hdr) ((hdr)->code) 84 | #define ICMPH_TYPE_SET(hdr, t) ((hdr)->type = (t)) 85 | #define ICMPH_CODE_SET(hdr, c) ((hdr)->code = (c)) 86 | 87 | #ifdef __cplusplus 88 | } 89 | #endif 90 | 91 | #endif /* LWIP_HDR_PROT_ICMP_H */ 92 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/lwip/prot/igmp.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * IGMP protocol definitions 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | * Author: Adam Dunkels 35 | * 36 | */ 37 | #ifndef LWIP_HDR_PROT_IGMP_H 38 | #define LWIP_HDR_PROT_IGMP_H 39 | 40 | #include "lwip/arch.h" 41 | #include "lwip/ip4_addr.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /* 48 | * IGMP constants 49 | */ 50 | #define IGMP_TTL 1 51 | #define IGMP_MINLEN 8 52 | #define ROUTER_ALERT 0x9404U 53 | #define ROUTER_ALERTLEN 4 54 | 55 | /* 56 | * IGMP message types, including version number. 57 | */ 58 | #define IGMP_MEMB_QUERY 0x11 /* Membership query */ 59 | #define IGMP_V1_MEMB_REPORT 0x12 /* Ver. 1 membership report */ 60 | #define IGMP_V2_MEMB_REPORT 0x16 /* Ver. 2 membership report */ 61 | #define IGMP_LEAVE_GROUP 0x17 /* Leave-group message */ 62 | 63 | /* Group membership states */ 64 | #define IGMP_GROUP_NON_MEMBER 0 65 | #define IGMP_GROUP_DELAYING_MEMBER 1 66 | #define IGMP_GROUP_IDLE_MEMBER 2 67 | 68 | /** 69 | * IGMP packet format. 70 | */ 71 | #ifdef PACK_STRUCT_USE_INCLUDES 72 | # include "arch/bpstruct.h" 73 | #endif 74 | PACK_STRUCT_BEGIN 75 | struct igmp_msg { 76 | PACK_STRUCT_FLD_8(u8_t igmp_msgtype); 77 | PACK_STRUCT_FLD_8(u8_t igmp_maxresp); 78 | PACK_STRUCT_FIELD(u16_t igmp_checksum); 79 | PACK_STRUCT_FLD_S(ip4_addr_p_t igmp_group_address); 80 | } PACK_STRUCT_STRUCT; 81 | PACK_STRUCT_END 82 | #ifdef PACK_STRUCT_USE_INCLUDES 83 | # include "arch/epstruct.h" 84 | #endif 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | #endif /* LWIP_HDR_PROT_IGMP_H */ 91 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/lwip/prot/ip.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * IP protocol definitions 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | * Author: Adam Dunkels 35 | * 36 | */ 37 | #ifndef LWIP_HDR_PROT_IP_H 38 | #define LWIP_HDR_PROT_IP_H 39 | 40 | #include "lwip/arch.h" 41 | 42 | #define IP_PROTO_ICMP 1 43 | #define IP_PROTO_IGMP 2 44 | #define IP_PROTO_UDP 17 45 | #define IP_PROTO_UDPLITE 136 46 | #define IP_PROTO_TCP 6 47 | 48 | /** This operates on a void* by loading the first byte */ 49 | #define IP_HDR_GET_VERSION(ptr) ((*(u8_t*)(ptr)) >> 4) 50 | 51 | #endif /* LWIP_HDR_PROT_IP_H */ 52 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/lwip/prot/mld6.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * MLD6 protocol definitions 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | * Author: Adam Dunkels 35 | * 36 | */ 37 | #ifndef LWIP_HDR_PROT_MLD6_H 38 | #define LWIP_HDR_PROT_MLD6_H 39 | 40 | #include "lwip/arch.h" 41 | #include "lwip/prot/ip6.h" 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /** Multicast listener report/query/done message header. */ 48 | #ifdef PACK_STRUCT_USE_INCLUDES 49 | # include "arch/bpstruct.h" 50 | #endif 51 | PACK_STRUCT_BEGIN 52 | struct mld_header { 53 | PACK_STRUCT_FLD_8(u8_t type); 54 | PACK_STRUCT_FLD_8(u8_t code); 55 | PACK_STRUCT_FIELD(u16_t chksum); 56 | PACK_STRUCT_FIELD(u16_t max_resp_delay); 57 | PACK_STRUCT_FIELD(u16_t reserved); 58 | PACK_STRUCT_FLD_S(ip6_addr_p_t multicast_address); 59 | /* Options follow. */ 60 | } PACK_STRUCT_STRUCT; 61 | PACK_STRUCT_END 62 | #ifdef PACK_STRUCT_USE_INCLUDES 63 | # include "arch/epstruct.h" 64 | #endif 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif /* LWIP_HDR_PROT_MLD6_H */ 71 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/lwip/prot/udp.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * UDP protocol definitions 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | * Author: Adam Dunkels 35 | * 36 | */ 37 | #ifndef LWIP_HDR_PROT_UDP_H 38 | #define LWIP_HDR_PROT_UDP_H 39 | 40 | #include "lwip/arch.h" 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #define UDP_HLEN 8 47 | 48 | /* Fields are (of course) in network byte order. */ 49 | #ifdef PACK_STRUCT_USE_INCLUDES 50 | # include "arch/bpstruct.h" 51 | #endif 52 | PACK_STRUCT_BEGIN 53 | struct udp_hdr { 54 | PACK_STRUCT_FIELD(u16_t src); 55 | PACK_STRUCT_FIELD(u16_t dest); /* src/dest UDP ports */ 56 | PACK_STRUCT_FIELD(u16_t len); 57 | PACK_STRUCT_FIELD(u16_t chksum); 58 | } PACK_STRUCT_STRUCT; 59 | PACK_STRUCT_END 60 | #ifdef PACK_STRUCT_USE_INCLUDES 61 | # include "arch/epstruct.h" 62 | #endif 63 | 64 | #ifdef __cplusplus 65 | } 66 | #endif 67 | 68 | #endif /* LWIP_HDR_PROT_UDP_H */ 69 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/netif/etharp.h: -------------------------------------------------------------------------------- 1 | /* ARP has been moved to core/ipv4, provide this #include for compatibility only */ 2 | #include "lwip/etharp.h" 3 | #include "netif/ethernet.h" 4 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/netif/ethernet.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Ethernet input function - handles INCOMING ethernet level traffic 4 | * To be used in most low-level netif implementations 5 | */ 6 | 7 | /* 8 | * Copyright (c) 2001-2003 Swedish Institute of Computer Science. 9 | * Copyright (c) 2003-2004 Leon Woestenberg 10 | * Copyright (c) 2003-2004 Axon Digital Design B.V., The Netherlands. 11 | * All rights reserved. 12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 16 | * 1. Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 3. The name of the author may not be used to endorse or promote products 22 | * derived from this software without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 25 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 26 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 27 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 28 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 29 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 32 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 33 | * OF SUCH DAMAGE. 34 | * 35 | * This file is part of the lwIP TCP/IP stack. 36 | * 37 | * Author: Adam Dunkels 38 | * 39 | */ 40 | 41 | #ifndef LWIP_HDR_NETIF_ETHERNET_H 42 | #define LWIP_HDR_NETIF_ETHERNET_H 43 | 44 | #include "lwip/opt.h" 45 | 46 | #include "lwip/pbuf.h" 47 | #include "lwip/netif.h" 48 | #include "lwip/prot/ethernet.h" 49 | 50 | #ifdef __cplusplus 51 | extern "C" { 52 | #endif 53 | 54 | #if LWIP_ARP || LWIP_ETHERNET 55 | 56 | /** Define this to 1 and define LWIP_ARP_FILTER_NETIF_FN(pbuf, netif, type) 57 | * to a filter function that returns the correct netif when using multiple 58 | * netifs on one hardware interface where the netif's low-level receive 59 | * routine cannot decide for the correct netif (e.g. when mapping multiple 60 | * IP addresses to one hardware interface). 61 | */ 62 | #ifndef LWIP_ARP_FILTER_NETIF 63 | #define LWIP_ARP_FILTER_NETIF 0 64 | #endif 65 | 66 | err_t ethernet_input(struct pbuf *p, struct netif *netif); 67 | err_t ethernet_output(struct netif* netif, struct pbuf* p, const struct eth_addr* src, const struct eth_addr* dst, u16_t eth_type); 68 | 69 | extern const struct eth_addr ethbroadcast, ethzero; 70 | 71 | #endif /* LWIP_ARP || LWIP_ETHERNET */ 72 | 73 | #ifdef __cplusplus 74 | } 75 | #endif 76 | 77 | #endif /* LWIP_HDR_NETIF_ETHERNET_H */ 78 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/netif/lowpan6.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * 4 | * 6LowPAN output for IPv6. Uses ND tables for link-layer addressing. Fragments packets to 6LowPAN units. 5 | */ 6 | 7 | /* 8 | * Copyright (c) 2015 Inico Technologies Ltd. 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without modification, 12 | * are permitted provided that the following conditions are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright notice, 15 | * this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 3. The name of the author may not be used to endorse or promote products 20 | * derived from this software without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 25 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 31 | * OF SUCH DAMAGE. 32 | * 33 | * This file is part of the lwIP TCP/IP stack. 34 | * 35 | * Author: Ivan Delamer 36 | * 37 | * 38 | * Please coordinate changes and requests with Ivan Delamer 39 | * 40 | */ 41 | 42 | #ifndef LWIP_HDR_LOWPAN6_H 43 | #define LWIP_HDR_LOWPAN6_H 44 | 45 | #include "netif/lowpan6_opts.h" 46 | 47 | #if LWIP_IPV6 && LWIP_6LOWPAN /* don't build if not configured for use in lwipopts.h */ 48 | 49 | #include "lwip/pbuf.h" 50 | #include "lwip/ip.h" 51 | #include "lwip/ip_addr.h" 52 | #include "lwip/netif.h" 53 | 54 | #ifdef __cplusplus 55 | extern "C" { 56 | #endif 57 | 58 | /** 1 second period */ 59 | #define LOWPAN6_TMR_INTERVAL 1000 60 | 61 | void lowpan6_tmr(void); 62 | 63 | err_t lowpan6_set_context(u8_t index, const ip6_addr_t * context); 64 | err_t lowpan6_set_short_addr(u8_t addr_high, u8_t addr_low); 65 | 66 | #if LWIP_IPV4 67 | err_t lowpan4_output(struct netif *netif, struct pbuf *q, const ip4_addr_t *ipaddr); 68 | #endif /* LWIP_IPV4 */ 69 | err_t lowpan6_output(struct netif *netif, struct pbuf *q, const ip6_addr_t *ip6addr); 70 | err_t lowpan6_input(struct pbuf * p, struct netif *netif); 71 | err_t lowpan6_if_init(struct netif *netif); 72 | 73 | /* pan_id in network byte order. */ 74 | err_t lowpan6_set_pan_id(u16_t pan_id); 75 | 76 | #if !NO_SYS 77 | err_t tcpip_6lowpan_input(struct pbuf *p, struct netif *inp); 78 | #endif /* !NO_SYS */ 79 | 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | 84 | #endif /* LWIP_IPV6 && LWIP_6LOWPAN */ 85 | 86 | #endif /* LWIP_HDR_LOWPAN6_H */ 87 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/netif/lowpan6_opts.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * 6LowPAN options list 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2015 Inico Technologies Ltd. 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright notice, 14 | * this list of conditions and the following disclaimer. 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, 16 | * this list of conditions and the following disclaimer in the documentation 17 | * and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote products 19 | * derived from this software without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 24 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 30 | * OF SUCH DAMAGE. 31 | * 32 | * This file is part of the lwIP TCP/IP stack. 33 | * 34 | * Author: Ivan Delamer 35 | * 36 | * 37 | * Please coordinate changes and requests with Ivan Delamer 38 | * 39 | */ 40 | 41 | #ifndef LWIP_HDR_LOWPAN6_OPTS_H 42 | #define LWIP_HDR_LOWPAN6_OPTS_H 43 | 44 | #include "lwip/opt.h" 45 | 46 | #ifndef LWIP_6LOWPAN 47 | #define LWIP_6LOWPAN 0 48 | #endif 49 | 50 | #ifndef LWIP_6LOWPAN_NUM_CONTEXTS 51 | #define LWIP_6LOWPAN_NUM_CONTEXTS 10 52 | #endif 53 | 54 | #ifndef LWIP_6LOWPAN_INFER_SHORT_ADDRESS 55 | #define LWIP_6LOWPAN_INFER_SHORT_ADDRESS 1 56 | #endif 57 | 58 | #ifndef LWIP_6LOWPAN_IPHC 59 | #define LWIP_6LOWPAN_IPHC 1 60 | #endif 61 | 62 | #ifndef LWIP_6LOWPAN_HW_CRC 63 | #define LWIP_6LOWPAN_HW_CRC 1 64 | #endif 65 | 66 | #ifndef LOWPAN6_DEBUG 67 | #define LOWPAN6_DEBUG LWIP_DBG_OFF 68 | #endif 69 | 70 | #endif /* LWIP_HDR_LOWPAN6_OPTS_H */ 71 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/netif/ppp/chap-md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * chap-md5.h - New CHAP/MD5 implementation. 3 | * 4 | * Copyright (c) 2003 Paul Mackerras. 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 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. The name(s) of the authors of this software must not be used to 14 | * endorse or promote products derived from this software without 15 | * prior written permission. 16 | * 17 | * 3. Redistributions of any form whatsoever must retain the following 18 | * acknowledgment: 19 | * "This product includes software developed by Paul Mackerras 20 | * ". 21 | * 22 | * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO 23 | * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 24 | * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 25 | * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 26 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 27 | * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 28 | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 29 | */ 30 | 31 | #include "netif/ppp/ppp_opts.h" 32 | #if PPP_SUPPORT && CHAP_SUPPORT /* don't build if not configured for use in lwipopts.h */ 33 | 34 | extern const struct chap_digest_type md5_digest; 35 | 36 | #endif /* PPP_SUPPORT && CHAP_SUPPORT */ 37 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/netif/ppp/chap_ms.h: -------------------------------------------------------------------------------- 1 | /* 2 | * chap_ms.h - Challenge Handshake Authentication Protocol definitions. 3 | * 4 | * Copyright (c) 1995 Eric Rosenquist. 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 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * 3. The name(s) of the authors of this software must not be used to 19 | * endorse or promote products derived from this software without 20 | * prior written permission. 21 | * 22 | * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO 23 | * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 24 | * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 25 | * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 26 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 27 | * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 28 | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 29 | * 30 | * $Id: chap_ms.h,v 1.13 2004/11/15 22:13:26 paulus Exp $ 31 | */ 32 | 33 | #include "netif/ppp/ppp_opts.h" 34 | #if PPP_SUPPORT && MSCHAP_SUPPORT /* don't build if not configured for use in lwipopts.h */ 35 | 36 | #ifndef CHAPMS_INCLUDE 37 | #define CHAPMS_INCLUDE 38 | 39 | extern const struct chap_digest_type chapms_digest; 40 | extern const struct chap_digest_type chapms2_digest; 41 | 42 | #endif /* CHAPMS_INCLUDE */ 43 | 44 | #endif /* PPP_SUPPORT && MSCHAP_SUPPORT */ 45 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/netif/ppp/ecp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ecp.h - Definitions for PPP Encryption Control Protocol. 3 | * 4 | * Copyright (c) 2002 Google, Inc. 5 | * All rights reserved. 6 | * 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in 16 | * the documentation and/or other materials provided with the 17 | * distribution. 18 | * 19 | * 3. The name(s) of the authors of this software must not be used to 20 | * endorse or promote products derived from this software without 21 | * prior written permission. 22 | * 23 | * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO 24 | * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 25 | * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 26 | * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 27 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 28 | * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 29 | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 30 | * 31 | * $Id: ecp.h,v 1.2 2003/01/10 07:12:36 fcusack Exp $ 32 | */ 33 | 34 | #include "netif/ppp/ppp_opts.h" 35 | #if PPP_SUPPORT && ECP_SUPPORT /* don't build if not configured for use in lwipopts.h */ 36 | 37 | typedef struct ecp_options { 38 | bool required; /* Is ECP required? */ 39 | unsigned enctype; /* Encryption type */ 40 | } ecp_options; 41 | 42 | extern fsm ecp_fsm[]; 43 | extern ecp_options ecp_wantoptions[]; 44 | extern ecp_options ecp_gotoptions[]; 45 | extern ecp_options ecp_allowoptions[]; 46 | extern ecp_options ecp_hisoptions[]; 47 | 48 | extern const struct protent ecp_protent; 49 | 50 | #endif /* PPP_SUPPORT && ECP_SUPPORT */ 51 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/netif/ppp/eui64.h: -------------------------------------------------------------------------------- 1 | /* 2 | * eui64.h - EUI64 routines for IPv6CP. 3 | * 4 | * Copyright (c) 1999 Tommi Komulainen. 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 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * 3. The name(s) of the authors of this software must not be used to 19 | * endorse or promote products derived from this software without 20 | * prior written permission. 21 | * 22 | * 4. Redistributions of any form whatsoever must retain the following 23 | * acknowledgment: 24 | * "This product includes software developed by Tommi Komulainen 25 | * ". 26 | * 27 | * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO 28 | * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 30 | * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 31 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 32 | * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 33 | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 34 | * 35 | * $Id: eui64.h,v 1.6 2002/12/04 23:03:32 paulus Exp $ 36 | */ 37 | 38 | #include "netif/ppp/ppp_opts.h" 39 | #if PPP_SUPPORT && PPP_IPV6_SUPPORT /* don't build if not configured for use in lwipopts.h */ 40 | 41 | #ifndef EUI64_H 42 | #define EUI64_H 43 | 44 | /* 45 | * @todo: 46 | * 47 | * Maybe this should be done by processing struct in6_addr directly... 48 | */ 49 | typedef union 50 | { 51 | u8_t e8[8]; 52 | u16_t e16[4]; 53 | u32_t e32[2]; 54 | } eui64_t; 55 | 56 | #define eui64_iszero(e) (((e).e32[0] | (e).e32[1]) == 0) 57 | #define eui64_equals(e, o) (((e).e32[0] == (o).e32[0]) && \ 58 | ((e).e32[1] == (o).e32[1])) 59 | #define eui64_zero(e) (e).e32[0] = (e).e32[1] = 0; 60 | 61 | #define eui64_copy(s, d) memcpy(&(d), &(s), sizeof(eui64_t)) 62 | 63 | #define eui64_magic(e) do { \ 64 | (e).e32[0] = magic(); \ 65 | (e).e32[1] = magic(); \ 66 | (e).e8[0] &= ~2; \ 67 | } while (0) 68 | #define eui64_magic_nz(x) do { \ 69 | eui64_magic(x); \ 70 | } while (eui64_iszero(x)) 71 | #define eui64_magic_ne(x, y) do { \ 72 | eui64_magic(x); \ 73 | } while (eui64_equals(x, y)) 74 | 75 | #define eui64_get(ll, cp) do { \ 76 | eui64_copy((*cp), (ll)); \ 77 | (cp) += sizeof(eui64_t); \ 78 | } while (0) 79 | 80 | #define eui64_put(ll, cp) do { \ 81 | eui64_copy((ll), (*cp)); \ 82 | (cp) += sizeof(eui64_t); \ 83 | } while (0) 84 | 85 | #define eui64_set32(e, l) do { \ 86 | (e).e32[0] = 0; \ 87 | (e).e32[1] = lwip_htonl(l); \ 88 | } while (0) 89 | #define eui64_setlo32(e, l) eui64_set32(e, l) 90 | 91 | char *eui64_ntoa(eui64_t); /* Returns ascii representation of id */ 92 | 93 | #endif /* EUI64_H */ 94 | #endif /* PPP_SUPPORT && PPP_IPV6_SUPPORT */ 95 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/netif/ppp/polarssl/arc4.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file arc4.h 3 | * 4 | * Based on XySSL: Copyright (C) 2006-2008 Christophe Devine 5 | * 6 | * Copyright (C) 2009 Paul Bakker 7 | * 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 14 | * * Redistributions of source code must retain the above copyright 15 | * notice, this list of conditions and the following disclaimer. 16 | * * Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in the 18 | * documentation and/or other materials provided with the distribution. 19 | * * Neither the names of PolarSSL or XySSL nor the names of its contributors 20 | * may be used to endorse or promote products derived from this software 21 | * without specific prior written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 29 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #include "netif/ppp/ppp_opts.h" 37 | #if LWIP_INCLUDED_POLARSSL_ARC4 38 | 39 | #ifndef LWIP_INCLUDED_POLARSSL_ARC4_H 40 | #define LWIP_INCLUDED_POLARSSL_ARC4_H 41 | 42 | /** 43 | * \brief ARC4 context structure 44 | */ 45 | typedef struct 46 | { 47 | int x; /*!< permutation index */ 48 | int y; /*!< permutation index */ 49 | unsigned char m[256]; /*!< permutation table */ 50 | } 51 | arc4_context; 52 | 53 | #ifdef __cplusplus 54 | extern "C" { 55 | #endif 56 | 57 | /** 58 | * \brief ARC4 key schedule 59 | * 60 | * \param ctx ARC4 context to be initialized 61 | * \param key the secret key 62 | * \param keylen length of the key 63 | */ 64 | void arc4_setup( arc4_context *ctx, unsigned char *key, int keylen ); 65 | 66 | /** 67 | * \brief ARC4 cipher function 68 | * 69 | * \param ctx ARC4 context 70 | * \param buf buffer to be processed 71 | * \param buflen amount of data in buf 72 | */ 73 | void arc4_crypt( arc4_context *ctx, unsigned char *buf, int buflen ); 74 | 75 | #ifdef __cplusplus 76 | } 77 | #endif 78 | 79 | #endif /* LWIP_INCLUDED_POLARSSL_ARC4_H */ 80 | 81 | #endif /* LWIP_INCLUDED_POLARSSL_ARC4 */ 82 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/netif/ppp/polarssl/des.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file des.h 3 | * 4 | * Based on XySSL: Copyright (C) 2006-2008 Christophe Devine 5 | * 6 | * Copyright (C) 2009 Paul Bakker 7 | * 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 14 | * * Redistributions of source code must retain the above copyright 15 | * notice, this list of conditions and the following disclaimer. 16 | * * Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in the 18 | * documentation and/or other materials provided with the distribution. 19 | * * Neither the names of PolarSSL or XySSL nor the names of its contributors 20 | * may be used to endorse or promote products derived from this software 21 | * without specific prior written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 29 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #include "netif/ppp/ppp_opts.h" 37 | #if LWIP_INCLUDED_POLARSSL_DES 38 | 39 | #ifndef LWIP_INCLUDED_POLARSSL_DES_H 40 | #define LWIP_INCLUDED_POLARSSL_DES_H 41 | 42 | #define DES_ENCRYPT 1 43 | #define DES_DECRYPT 0 44 | 45 | /** 46 | * \brief DES context structure 47 | */ 48 | typedef struct 49 | { 50 | int mode; /*!< encrypt/decrypt */ 51 | unsigned long sk[32]; /*!< DES subkeys */ 52 | } 53 | des_context; 54 | 55 | #ifdef __cplusplus 56 | extern "C" { 57 | #endif 58 | 59 | /** 60 | * \brief DES key schedule (56-bit, encryption) 61 | * 62 | * \param ctx DES context to be initialized 63 | * \param key 8-byte secret key 64 | */ 65 | void des_setkey_enc( des_context *ctx, unsigned char key[8] ); 66 | 67 | /** 68 | * \brief DES key schedule (56-bit, decryption) 69 | * 70 | * \param ctx DES context to be initialized 71 | * \param key 8-byte secret key 72 | */ 73 | void des_setkey_dec( des_context *ctx, unsigned char key[8] ); 74 | 75 | /** 76 | * \brief DES-ECB block encryption/decryption 77 | * 78 | * \param ctx DES context 79 | * \param input 64-bit input block 80 | * \param output 64-bit output block 81 | */ 82 | void des_crypt_ecb( des_context *ctx, 83 | const unsigned char input[8], 84 | unsigned char output[8] ); 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | #endif /* LWIP_INCLUDED_POLARSSL_DES_H */ 91 | 92 | #endif /* LWIP_INCLUDED_POLARSSL_DES */ 93 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/netif/ppp/polarssl/md4.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file md4.h 3 | * 4 | * Based on XySSL: Copyright (C) 2006-2008 Christophe Devine 5 | * 6 | * Copyright (C) 2009 Paul Bakker 7 | * 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 14 | * * Redistributions of source code must retain the above copyright 15 | * notice, this list of conditions and the following disclaimer. 16 | * * Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in the 18 | * documentation and/or other materials provided with the distribution. 19 | * * Neither the names of PolarSSL or XySSL nor the names of its contributors 20 | * may be used to endorse or promote products derived from this software 21 | * without specific prior written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 29 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #include "netif/ppp/ppp_opts.h" 37 | #if LWIP_INCLUDED_POLARSSL_MD4 38 | 39 | #ifndef LWIP_INCLUDED_POLARSSL_MD4_H 40 | #define LWIP_INCLUDED_POLARSSL_MD4_H 41 | 42 | /** 43 | * \brief MD4 context structure 44 | */ 45 | typedef struct 46 | { 47 | unsigned long total[2]; /*!< number of bytes processed */ 48 | unsigned long state[4]; /*!< intermediate digest state */ 49 | unsigned char buffer[64]; /*!< data block being processed */ 50 | } 51 | md4_context; 52 | 53 | #ifdef __cplusplus 54 | extern "C" { 55 | #endif 56 | 57 | /** 58 | * \brief MD4 context setup 59 | * 60 | * \param ctx context to be initialized 61 | */ 62 | void md4_starts( md4_context *ctx ); 63 | 64 | /** 65 | * \brief MD4 process buffer 66 | * 67 | * \param ctx MD4 context 68 | * \param input buffer holding the data 69 | * \param ilen length of the input data 70 | */ 71 | void md4_update( md4_context *ctx, const unsigned char *input, int ilen ); 72 | 73 | /** 74 | * \brief MD4 final digest 75 | * 76 | * \param ctx MD4 context 77 | * \param output MD4 checksum result 78 | */ 79 | void md4_finish( md4_context *ctx, unsigned char output[16] ); 80 | 81 | /** 82 | * \brief Output = MD4( input buffer ) 83 | * 84 | * \param input buffer holding the data 85 | * \param ilen length of the input data 86 | * \param output MD4 checksum result 87 | */ 88 | void md4( unsigned char *input, int ilen, unsigned char output[16] ); 89 | 90 | 91 | #ifdef __cplusplus 92 | } 93 | #endif 94 | 95 | #endif /* LWIP_INCLUDED_POLARSSL_MD4_H */ 96 | 97 | #endif /* LWIP_INCLUDED_POLARSSL_MD4 */ 98 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/netif/ppp/polarssl/md5.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file md5.h 3 | * 4 | * Based on XySSL: Copyright (C) 2006-2008 Christophe Devine 5 | * 6 | * Copyright (C) 2009 Paul Bakker 7 | * 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 14 | * * Redistributions of source code must retain the above copyright 15 | * notice, this list of conditions and the following disclaimer. 16 | * * Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in the 18 | * documentation and/or other materials provided with the distribution. 19 | * * Neither the names of PolarSSL or XySSL nor the names of its contributors 20 | * may be used to endorse or promote products derived from this software 21 | * without specific prior written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 29 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #include "netif/ppp/ppp_opts.h" 37 | #if LWIP_INCLUDED_POLARSSL_MD5 38 | 39 | #ifndef LWIP_INCLUDED_POLARSSL_MD5_H 40 | #define LWIP_INCLUDED_POLARSSL_MD5_H 41 | 42 | /** 43 | * \brief MD5 context structure 44 | */ 45 | typedef struct 46 | { 47 | unsigned long total[2]; /*!< number of bytes processed */ 48 | unsigned long state[4]; /*!< intermediate digest state */ 49 | unsigned char buffer[64]; /*!< data block being processed */ 50 | } 51 | md5_context; 52 | 53 | #ifdef __cplusplus 54 | extern "C" { 55 | #endif 56 | 57 | /** 58 | * \brief MD5 context setup 59 | * 60 | * \param ctx context to be initialized 61 | */ 62 | void md5_starts( md5_context *ctx ); 63 | 64 | /** 65 | * \brief MD5 process buffer 66 | * 67 | * \param ctx MD5 context 68 | * \param input buffer holding the data 69 | * \param ilen length of the input data 70 | */ 71 | void md5_update( md5_context *ctx, const unsigned char *input, int ilen ); 72 | 73 | /** 74 | * \brief MD5 final digest 75 | * 76 | * \param ctx MD5 context 77 | * \param output MD5 checksum result 78 | */ 79 | void md5_finish( md5_context *ctx, unsigned char output[16] ); 80 | 81 | /** 82 | * \brief Output = MD5( input buffer ) 83 | * 84 | * \param input buffer holding the data 85 | * \param ilen length of the input data 86 | * \param output MD5 checksum result 87 | */ 88 | void md5( unsigned char *input, int ilen, unsigned char output[16] ); 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | 94 | #endif /* LWIP_INCLUDED_POLARSSL_MD5_H */ 95 | 96 | #endif /* LWIP_INCLUDED_POLARSSL_MD5 */ 97 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/netif/ppp/polarssl/sha1.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file sha1.h 3 | * 4 | * Based on XySSL: Copyright (C) 2006-2008 Christophe Devine 5 | * 6 | * Copyright (C) 2009 Paul Bakker 7 | * 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 14 | * * Redistributions of source code must retain the above copyright 15 | * notice, this list of conditions and the following disclaimer. 16 | * * Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in the 18 | * documentation and/or other materials provided with the distribution. 19 | * * Neither the names of PolarSSL or XySSL nor the names of its contributors 20 | * may be used to endorse or promote products derived from this software 21 | * without specific prior written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 29 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | 36 | #include "netif/ppp/ppp_opts.h" 37 | #if LWIP_INCLUDED_POLARSSL_SHA1 38 | 39 | #ifndef LWIP_INCLUDED_POLARSSL_SHA1_H 40 | #define LWIP_INCLUDED_POLARSSL_SHA1_H 41 | 42 | /** 43 | * \brief SHA-1 context structure 44 | */ 45 | typedef struct 46 | { 47 | unsigned long total[2]; /*!< number of bytes processed */ 48 | unsigned long state[5]; /*!< intermediate digest state */ 49 | unsigned char buffer[64]; /*!< data block being processed */ 50 | } 51 | sha1_context; 52 | 53 | #ifdef __cplusplus 54 | extern "C" { 55 | #endif 56 | 57 | /** 58 | * \brief SHA-1 context setup 59 | * 60 | * \param ctx context to be initialized 61 | */ 62 | void sha1_starts( sha1_context *ctx ); 63 | 64 | /** 65 | * \brief SHA-1 process buffer 66 | * 67 | * \param ctx SHA-1 context 68 | * \param input buffer holding the data 69 | * \param ilen length of the input data 70 | */ 71 | void sha1_update( sha1_context *ctx, const unsigned char *input, int ilen ); 72 | 73 | /** 74 | * \brief SHA-1 final digest 75 | * 76 | * \param ctx SHA-1 context 77 | * \param output SHA-1 checksum result 78 | */ 79 | void sha1_finish( sha1_context *ctx, unsigned char output[20] ); 80 | 81 | /** 82 | * \brief Output = SHA-1( input buffer ) 83 | * 84 | * \param input buffer holding the data 85 | * \param ilen length of the input data 86 | * \param output SHA-1 checksum result 87 | */ 88 | void sha1( unsigned char *input, int ilen, unsigned char output[20] ); 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | 94 | #endif /* LWIP_INCLUDED_POLARSSL_SHA1_H */ 95 | 96 | #endif /* LWIP_INCLUDED_POLARSSL_SHA1 */ 97 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/netif/ppp/pppdebug.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * pppdebug.h - System debugging utilities. 3 | * 4 | * Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. 5 | * portions Copyright (c) 1998 Global Election Systems Inc. 6 | * portions Copyright (c) 2001 by Cognizant Pty Ltd. 7 | * 8 | * The authors hereby grant permission to use, copy, modify, distribute, 9 | * and license this software and its documentation for any purpose, provided 10 | * that existing copyright notices are retained in all copies and that this 11 | * notice and the following disclaimer are included verbatim in any 12 | * distributions. No written agreement, license, or royalty fee is required 13 | * for any of the authorized uses. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | * 26 | ****************************************************************************** 27 | * REVISION HISTORY (please don't use tabs!) 28 | * 29 | * 03-01-01 Marc Boucher 30 | * Ported to lwIP. 31 | * 98-07-29 Guy Lancaster , Global Election Systems Inc. 32 | * Original. 33 | * 34 | ***************************************************************************** 35 | */ 36 | 37 | #include "netif/ppp/ppp_opts.h" 38 | #if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */ 39 | 40 | #ifndef PPPDEBUG_H 41 | #define PPPDEBUG_H 42 | 43 | /* Trace levels. */ 44 | #define LOG_CRITICAL (PPP_DEBUG | LWIP_DBG_LEVEL_SEVERE) 45 | #define LOG_ERR (PPP_DEBUG | LWIP_DBG_LEVEL_SEVERE) 46 | #define LOG_NOTICE (PPP_DEBUG | LWIP_DBG_LEVEL_WARNING) 47 | #define LOG_WARNING (PPP_DEBUG | LWIP_DBG_LEVEL_WARNING) 48 | #define LOG_INFO (PPP_DEBUG) 49 | #define LOG_DETAIL (PPP_DEBUG) 50 | #define LOG_DEBUG (PPP_DEBUG) 51 | 52 | #if PPP_DEBUG 53 | 54 | #define MAINDEBUG(a) LWIP_DEBUGF(LWIP_DBG_LEVEL_WARNING, a) 55 | #define SYSDEBUG(a) LWIP_DEBUGF(LWIP_DBG_LEVEL_WARNING, a) 56 | #define FSMDEBUG(a) LWIP_DEBUGF(LWIP_DBG_LEVEL_WARNING, a) 57 | #define LCPDEBUG(a) LWIP_DEBUGF(LWIP_DBG_LEVEL_WARNING, a) 58 | #define IPCPDEBUG(a) LWIP_DEBUGF(LWIP_DBG_LEVEL_WARNING, a) 59 | #define IPV6CPDEBUG(a) LWIP_DEBUGF(LWIP_DBG_LEVEL_WARNING, a) 60 | #define UPAPDEBUG(a) LWIP_DEBUGF(LWIP_DBG_LEVEL_WARNING, a) 61 | #define CHAPDEBUG(a) LWIP_DEBUGF(LWIP_DBG_LEVEL_WARNING, a) 62 | #define PPPDEBUG(a, b) LWIP_DEBUGF(a, b) 63 | 64 | #else /* PPP_DEBUG */ 65 | 66 | #define MAINDEBUG(a) 67 | #define SYSDEBUG(a) 68 | #define FSMDEBUG(a) 69 | #define LCPDEBUG(a) 70 | #define IPCPDEBUG(a) 71 | #define IPV6CPDEBUG(a) 72 | #define UPAPDEBUG(a) 73 | #define CHAPDEBUG(a) 74 | #define PPPDEBUG(a, b) 75 | 76 | #endif /* PPP_DEBUG */ 77 | 78 | #endif /* PPPDEBUG_H */ 79 | 80 | #endif /* PPP_SUPPORT */ 81 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/netif/slipif.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * 4 | * SLIP netif API 5 | */ 6 | 7 | /* 8 | * Copyright (c) 2001, Swedish Institute of Computer Science. 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without 12 | * modification, are permitted provided that the following conditions 13 | * are met: 14 | * 1. Redistributions of source code must retain the above copyright 15 | * notice, this list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in the 18 | * documentation and/or other materials provided with the distribution. 19 | * 3. Neither the name of the Institute nor the names of its contributors 20 | * may be used to endorse or promote products derived from this software 21 | * without specific prior written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 24 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 27 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 | * SUCH DAMAGE. 34 | * 35 | * This file is part of the lwIP TCP/IP stack. 36 | * 37 | * Author: Adam Dunkels 38 | * 39 | */ 40 | #ifndef LWIP_HDR_NETIF_SLIPIF_H 41 | #define LWIP_HDR_NETIF_SLIPIF_H 42 | 43 | #include "lwip/opt.h" 44 | #include "lwip/netif.h" 45 | 46 | /** Set this to 1 to start a thread that blocks reading on the serial line 47 | * (using sio_read()). 48 | */ 49 | #ifndef SLIP_USE_RX_THREAD 50 | #define SLIP_USE_RX_THREAD !NO_SYS 51 | #endif 52 | 53 | /** Set this to 1 to enable functions to pass in RX bytes from ISR context. 54 | * If enabled, slipif_received_byte[s]() process incoming bytes and put assembled 55 | * packets on a queue, which is fed into lwIP from slipif_poll(). 56 | * If disabled, slipif_poll() polls the serial line (using sio_tryread()). 57 | */ 58 | #ifndef SLIP_RX_FROM_ISR 59 | #define SLIP_RX_FROM_ISR 0 60 | #endif 61 | 62 | /** Set this to 1 (default for SLIP_RX_FROM_ISR) to queue incoming packets 63 | * received by slipif_received_byte[s]() as long as PBUF_POOL pbufs are available. 64 | * If disabled, packets will be dropped if more than one packet is received. 65 | */ 66 | #ifndef SLIP_RX_QUEUE 67 | #define SLIP_RX_QUEUE SLIP_RX_FROM_ISR 68 | #endif 69 | 70 | #ifdef __cplusplus 71 | extern "C" { 72 | #endif 73 | 74 | err_t slipif_init(struct netif * netif); 75 | void slipif_poll(struct netif *netif); 76 | #if SLIP_RX_FROM_ISR 77 | void slipif_process_rxqueue(struct netif *netif); 78 | void slipif_received_byte(struct netif *netif, u8_t data); 79 | void slipif_received_bytes(struct netif *netif, u8_t *data, u8_t len); 80 | #endif /* SLIP_RX_FROM_ISR */ 81 | 82 | #ifdef __cplusplus 83 | } 84 | #endif 85 | 86 | #endif /* LWIP_HDR_NETIF_SLIPIF_H */ 87 | 88 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/posix/errno.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * This file is a posix wrapper for lwip/errno.h. 4 | */ 5 | 6 | /* 7 | * Redistribution and use in source and binary forms, with or without modification, 8 | * are permitted provided that the following conditions are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 3. The name of the author may not be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 19 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 21 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 23 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 26 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 27 | * OF SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | */ 32 | 33 | #include "lwip/errno.h" 34 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/posix/netdb.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * This file is a posix wrapper for lwip/netdb.h. 4 | */ 5 | 6 | /* 7 | * Redistribution and use in source and binary forms, with or without modification, 8 | * are permitted provided that the following conditions are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 3. The name of the author may not be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 19 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 21 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 23 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 26 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 27 | * OF SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | */ 32 | 33 | #include "lwip/netdb.h" 34 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/include/posix/sys/socket.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * This file is a posix wrapper for lwip/sockets.h. 4 | */ 5 | 6 | /* 7 | * Redistribution and use in source and binary forms, with or without modification, 8 | * are permitted provided that the following conditions are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright notice, 11 | * this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 3. The name of the author may not be used to endorse or promote products 16 | * derived from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 19 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 20 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 21 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 23 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 26 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 27 | * OF SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | */ 32 | 33 | #include "lwip/sockets.h" 34 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/netif/FILES: -------------------------------------------------------------------------------- 1 | This directory contains generic network interface device drivers that 2 | do not contain any hardware or architecture specific code. The files 3 | are: 4 | 5 | ethernet.c 6 | Shared code for Ethernet based interfaces. 7 | 8 | ethernetif.c 9 | An example of how an Ethernet device driver could look. This 10 | file can be used as a "skeleton" for developing new Ethernet 11 | network device drivers. It uses the etharp.c ARP code. 12 | 13 | lowpan6.c 14 | A 6LoWPAN implementation as a netif. 15 | 16 | slipif.c 17 | A generic implementation of the SLIP (Serial Line IP) 18 | protocol. It requires a sio (serial I/O) module to work. 19 | 20 | ppp/ Point-to-Point Protocol stack 21 | The lwIP PPP support is based from pppd (http://ppp.samba.org) with 22 | huge changes to match code size and memory requirements for embedded 23 | devices. Please read /doc/ppp.txt and ppp/PPPD_FOLLOWUP for a detailed 24 | explanation. 25 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/netif/ppp/eui64.c: -------------------------------------------------------------------------------- 1 | /* 2 | * eui64.c - EUI64 routines for IPv6CP. 3 | * 4 | * Copyright (c) 1999 Tommi Komulainen. 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 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * 3. The name(s) of the authors of this software must not be used to 19 | * endorse or promote products derived from this software without 20 | * prior written permission. 21 | * 22 | * 4. Redistributions of any form whatsoever must retain the following 23 | * acknowledgment: 24 | * "This product includes software developed by Tommi Komulainen 25 | * ". 26 | * 27 | * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO 28 | * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 29 | * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 30 | * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 31 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 32 | * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 33 | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 34 | * 35 | * $Id: eui64.c,v 1.6 2002/12/04 23:03:32 paulus Exp $ 36 | */ 37 | 38 | #include "netif/ppp/ppp_opts.h" 39 | #if PPP_SUPPORT && PPP_IPV6_SUPPORT /* don't build if not configured for use in lwipopts.h */ 40 | 41 | #include "netif/ppp/ppp_impl.h" 42 | #include "netif/ppp/eui64.h" 43 | 44 | /* 45 | * eui64_ntoa - Make an ascii representation of an interface identifier 46 | */ 47 | char *eui64_ntoa(eui64_t e) { 48 | static char buf[20]; 49 | 50 | sprintf(buf, "%02x%02x:%02x%02x:%02x%02x:%02x%02x", 51 | e.e8[0], e.e8[1], e.e8[2], e.e8[3], 52 | e.e8[4], e.e8[5], e.e8[6], e.e8[7]); 53 | return buf; 54 | } 55 | 56 | #endif /* PPP_SUPPORT && PPP_IPV6_SUPPORT */ 57 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/netif/ppp/polarssl/README: -------------------------------------------------------------------------------- 1 | About PolarSSL files into lwIP PPP support 2 | ------------------------------------------ 3 | 4 | This folder contains some files fetched from the latest BSD release of 5 | the PolarSSL project (PolarSSL 0.10.1-bsd) for ciphers and encryption 6 | methods we need for lwIP PPP support. 7 | 8 | The PolarSSL files were cleaned to contain only the necessary struct 9 | fields and functions needed for lwIP. 10 | 11 | The PolarSSL API was not changed at all, so if you are already using 12 | PolarSSL you can choose to skip the compilation of the included PolarSSL 13 | library into lwIP. 14 | 15 | If you are not using the embedded copy you must include external 16 | libraries into your arch/cc.h port file. 17 | 18 | Beware of the stack requirements which can be a lot larger if you are not 19 | using our cleaned PolarSSL library. 20 | 21 | 22 | PolarSSL project website: http://polarssl.org/ 23 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/netif/ppp/polarssl/arc4.c: -------------------------------------------------------------------------------- 1 | /* 2 | * An implementation of the ARCFOUR algorithm 3 | * 4 | * Based on XySSL: Copyright (C) 2006-2008 Christophe Devine 5 | * 6 | * Copyright (C) 2009 Paul Bakker 7 | * 8 | * All rights reserved. 9 | * 10 | * Redistribution and use in source and binary forms, with or without 11 | * modification, are permitted provided that the following conditions 12 | * are met: 13 | * 14 | * * Redistributions of source code must retain the above copyright 15 | * notice, this list of conditions and the following disclaimer. 16 | * * Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in the 18 | * documentation and/or other materials provided with the distribution. 19 | * * Neither the names of PolarSSL or XySSL nor the names of its contributors 20 | * may be used to endorse or promote products derived from this software 21 | * without specific prior written permission. 22 | * 23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 26 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 29 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | */ 35 | /* 36 | * The ARCFOUR algorithm was publicly disclosed on 94/09. 37 | * 38 | * http://groups.google.com/group/sci.crypt/msg/10a300c9d21afca0 39 | */ 40 | 41 | #include "netif/ppp/ppp_opts.h" 42 | #if PPP_SUPPORT && LWIP_INCLUDED_POLARSSL_ARC4 43 | 44 | #include "netif/ppp/polarssl/arc4.h" 45 | /* 46 | * ARC4 key schedule 47 | */ 48 | void arc4_setup( arc4_context *ctx, unsigned char *key, int keylen ) 49 | { 50 | int i, j, k, a; 51 | unsigned char *m; 52 | 53 | ctx->x = 0; 54 | ctx->y = 0; 55 | m = ctx->m; 56 | 57 | for( i = 0; i < 256; i++ ) 58 | m[i] = (unsigned char) i; 59 | 60 | j = k = 0; 61 | 62 | for( i = 0; i < 256; i++, k++ ) 63 | { 64 | if( k >= keylen ) k = 0; 65 | 66 | a = m[i]; 67 | j = ( j + a + key[k] ) & 0xFF; 68 | m[i] = m[j]; 69 | m[j] = (unsigned char) a; 70 | } 71 | } 72 | 73 | /* 74 | * ARC4 cipher function 75 | */ 76 | void arc4_crypt( arc4_context *ctx, unsigned char *buf, int buflen ) 77 | { 78 | int i, x, y, a, b; 79 | unsigned char *m; 80 | 81 | x = ctx->x; 82 | y = ctx->y; 83 | m = ctx->m; 84 | 85 | for( i = 0; i < buflen; i++ ) 86 | { 87 | x = ( x + 1 ) & 0xFF; a = m[x]; 88 | y = ( y + a ) & 0xFF; b = m[y]; 89 | 90 | m[x] = (unsigned char) b; 91 | m[y] = (unsigned char) a; 92 | 93 | buf[i] = (unsigned char) 94 | ( buf[i] ^ m[(unsigned char)( a + b )] ); 95 | } 96 | 97 | ctx->x = x; 98 | ctx->y = y; 99 | } 100 | 101 | #endif /* PPP_SUPPORT && LWIP_INCLUDED_POLARSSL_DES */ 102 | -------------------------------------------------------------------------------- /lwip-2.0.2/src/netif/ppp/pppcrypt.c: -------------------------------------------------------------------------------- 1 | /* 2 | * pppcrypt.c - PPP/DES linkage for MS-CHAP and EAP SRP-SHA1 3 | * 4 | * Extracted from chap_ms.c by James Carlson. 5 | * 6 | * Copyright (c) 1995 Eric Rosenquist. All rights reserved. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in 17 | * the documentation and/or other materials provided with the 18 | * distribution. 19 | * 20 | * 3. The name(s) of the authors of this software must not be used to 21 | * endorse or promote products derived from this software without 22 | * prior written permission. 23 | * 24 | * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO 25 | * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 26 | * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY 27 | * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 28 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 29 | * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 30 | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 31 | */ 32 | 33 | #include "netif/ppp/ppp_opts.h" 34 | #if PPP_SUPPORT && MSCHAP_SUPPORT /* don't build if not necessary */ 35 | 36 | #include "netif/ppp/ppp_impl.h" 37 | 38 | #include "netif/ppp/pppcrypt.h" 39 | 40 | 41 | static u_char pppcrypt_get_7bits(u_char *input, int startBit) { 42 | unsigned int word; 43 | 44 | word = (unsigned)input[startBit / 8] << 8; 45 | word |= (unsigned)input[startBit / 8 + 1]; 46 | 47 | word >>= 15 - (startBit % 8 + 7); 48 | 49 | return word & 0xFE; 50 | } 51 | 52 | /* IN 56 bit DES key missing parity bits 53 | * OUT 64 bit DES key with parity bits added 54 | */ 55 | void pppcrypt_56_to_64_bit_key(u_char *key, u_char * des_key) { 56 | des_key[0] = pppcrypt_get_7bits(key, 0); 57 | des_key[1] = pppcrypt_get_7bits(key, 7); 58 | des_key[2] = pppcrypt_get_7bits(key, 14); 59 | des_key[3] = pppcrypt_get_7bits(key, 21); 60 | des_key[4] = pppcrypt_get_7bits(key, 28); 61 | des_key[5] = pppcrypt_get_7bits(key, 35); 62 | des_key[6] = pppcrypt_get_7bits(key, 42); 63 | des_key[7] = pppcrypt_get_7bits(key, 49); 64 | } 65 | 66 | #endif /* PPP_SUPPORT && MSCHAP_SUPPORT */ 67 | -------------------------------------------------------------------------------- /lwip-2.0.2/test/fuzz/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2001, 2002 Swedish Institute of Computer Science. 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, 6 | # are permitted provided that the following conditions are met: 7 | # 8 | # 1. Redistributions of source code must retain the above copyright notice, 9 | # this list of conditions and the following disclaimer. 10 | # 2. Redistributions in binary form must reproduce the above copyright notice, 11 | # this list of conditions and the following disclaimer in the documentation 12 | # and/or other materials provided with the distribution. 13 | # 3. The name of the author may not be used to endorse or promote products 14 | # derived from this software without specific prior written permission. 15 | # 16 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | # SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | # OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | # OF SUCH DAMAGE. 26 | # 27 | # This file is part of the lwIP TCP/IP stack. 28 | # 29 | # Author: Adam Dunkels 30 | # 31 | 32 | all compile: lwip_fuzz 33 | .PHONY: all clean 34 | 35 | CC=afl-gcc 36 | LDFLAGS=-lm 37 | CFLAGS=-O0 38 | 39 | CONTRIBDIR=../../../lwip-contrib 40 | include $(CONTRIBDIR)/ports/unix/Common.mk 41 | 42 | clean: 43 | rm -f *.o $(LWIPLIBCOMMON) lwip_fuzz *.s .depend* *.core core 44 | 45 | depend dep: .depend 46 | 47 | include .depend 48 | 49 | .depend: fuzz.c $(LWIPFILES) $(APPFILES) 50 | $(CCDEP) $(CFLAGS) -MM $^ > .depend || rm -f .depend 51 | 52 | lwip_fuzz: .depend $(LWIPLIBCOMMON) fuzz.o 53 | $(CC) $(CFLAGS) -o lwip_fuzz fuzz.o $(LWIPLIBCOMMON) $(LDFLAGS) 54 | -------------------------------------------------------------------------------- /lwip-2.0.2/test/fuzz/README: -------------------------------------------------------------------------------- 1 | 2 | Fuzzing the lwIP stack (afl-fuzz requires linux/unix or similar) 3 | 4 | This directory contains a small app that reads Ethernet frames from stdin and 5 | processes them. It is used together with the 'american fuzzy lop' tool (found 6 | at http://lcamtuf.coredump.cx/afl/) and the sample inputs to test how 7 | unexpected inputs are handled. The afl tool will read the known inputs, and 8 | try to modify them to exercise as many code paths as possible, by instrumenting 9 | the code and keeping track of which code is executed. 10 | 11 | Just running make will produce the test program. 12 | 13 | Then run afl with: 14 | 15 | afl-fuzz -i inputs/ -o output ./lwip_fuzz 16 | 17 | and it should start working. It will probably complain about CPU scheduler, 18 | set AFL_SKIP_CPUFREQ=1 to ignore it. 19 | If it complains about invalid "/proc/sys/kernel/core_pattern" setting, try 20 | executing "sudo bash -c 'echo core > /proc/sys/kernel/core_pattern'". 21 | 22 | The input is split into different subdirectories since they test different 23 | parts of the code, and since you want to run one instance of afl-fuzz on each 24 | core. 25 | 26 | When afl finds a crash or a hang, the input that caused it will be placed in 27 | the output directory. If you have hexdump and text2pcap tools installed, 28 | running output_to_pcap.sh will create pcap files for each input 29 | file to simplify viewing in wireshark. 30 | 31 | The lwipopts.h file needs to have checksum checking off, otherwise almost every 32 | packet will be discarded because of that. The other options can be tuned to 33 | expose different parts of the code. 34 | 35 | -------------------------------------------------------------------------------- /lwip-2.0.2/test/fuzz/config.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haohd/lwip-linux/4fb5c7a6ffdfdd52bdde235d09b8c4729500fe76/lwip-2.0.2/test/fuzz/config.h -------------------------------------------------------------------------------- /lwip-2.0.2/test/fuzz/inputs/arp/arp_req.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haohd/lwip-linux/4fb5c7a6ffdfdd52bdde235d09b8c4729500fe76/lwip-2.0.2/test/fuzz/inputs/arp/arp_req.bin -------------------------------------------------------------------------------- /lwip-2.0.2/test/fuzz/inputs/icmp/icmp_ping.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haohd/lwip-linux/4fb5c7a6ffdfdd52bdde235d09b8c4729500fe76/lwip-2.0.2/test/fuzz/inputs/icmp/icmp_ping.bin -------------------------------------------------------------------------------- /lwip-2.0.2/test/fuzz/inputs/ipv6/neighbor_solicitation.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haohd/lwip-linux/4fb5c7a6ffdfdd52bdde235d09b8c4729500fe76/lwip-2.0.2/test/fuzz/inputs/ipv6/neighbor_solicitation.bin -------------------------------------------------------------------------------- /lwip-2.0.2/test/fuzz/inputs/ipv6/router_adv.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haohd/lwip-linux/4fb5c7a6ffdfdd52bdde235d09b8c4729500fe76/lwip-2.0.2/test/fuzz/inputs/ipv6/router_adv.bin -------------------------------------------------------------------------------- /lwip-2.0.2/test/fuzz/inputs/tcp/tcp_syn.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haohd/lwip-linux/4fb5c7a6ffdfdd52bdde235d09b8c4729500fe76/lwip-2.0.2/test/fuzz/inputs/tcp/tcp_syn.bin -------------------------------------------------------------------------------- /lwip-2.0.2/test/fuzz/inputs/udp/udp_port_5000.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haohd/lwip-linux/4fb5c7a6ffdfdd52bdde235d09b8c4729500fe76/lwip-2.0.2/test/fuzz/inputs/udp/udp_port_5000.bin -------------------------------------------------------------------------------- /lwip-2.0.2/test/fuzz/lwipopts.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2003 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Simon Goldschmidt 30 | * 31 | */ 32 | #ifndef LWIP_HDR_LWIPOPTS_H__ 33 | #define LWIP_HDR_LWIPOPTS_H__ 34 | 35 | /* Prevent having to link sys_arch.c (we don't test the API layers in unit tests) */ 36 | #define NO_SYS 1 37 | #define LWIP_NETCONN 0 38 | #define LWIP_SOCKET 0 39 | #define SYS_LIGHTWEIGHT_PROT 0 40 | 41 | #define LWIP_IPV6 1 42 | #define IPV6_FRAG_COPYHEADER 1 43 | #define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0 44 | 45 | /* Enable DHCP to test it */ 46 | #define LWIP_DHCP 1 47 | 48 | /* Turn off checksum verification of fuzzed data */ 49 | #define CHECKSUM_CHECK_IP 0 50 | #define CHECKSUM_CHECK_UDP 0 51 | #define CHECKSUM_CHECK_TCP 0 52 | #define CHECKSUM_CHECK_ICMP 0 53 | #define CHECKSUM_CHECK_ICMP6 0 54 | 55 | /* Minimal changes to opt.h required for tcp unit tests: */ 56 | #define MEM_SIZE 16000 57 | #define TCP_SND_QUEUELEN 40 58 | #define MEMP_NUM_TCP_SEG TCP_SND_QUEUELEN 59 | #define TCP_SND_BUF (12 * TCP_MSS) 60 | #define TCP_WND (10 * TCP_MSS) 61 | #define LWIP_WND_SCALE 1 62 | #define TCP_RCV_SCALE 0 63 | #define PBUF_POOL_SIZE 400 /* pbuf tests need ~200KByte */ 64 | 65 | /* Minimal changes to opt.h required for etharp unit tests: */ 66 | #define ETHARP_SUPPORT_STATIC_ENTRIES 1 67 | 68 | #endif /* LWIP_HDR_LWIPOPTS_H__ */ 69 | -------------------------------------------------------------------------------- /lwip-2.0.2/test/fuzz/output_to_pcap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -z "$1" ] 4 | then 5 | echo "This script will make pcap files from the afl-fuzz crash/hang files" 6 | echo "It needs hexdump and text2pcap" 7 | echo "Please give output directory as argument" 8 | exit 2 9 | fi 10 | 11 | for i in `ls $1/crashes/id*` 12 | do 13 | PCAPNAME=`echo $i | grep pcap` 14 | if [ -z "$PCAPNAME" ]; then 15 | hexdump -C $i > $1/$$.tmp 16 | text2pcap $1/$$.tmp ${i}.pcap 17 | fi 18 | done 19 | for i in `ls $1/hangs/id*` 20 | do 21 | PCAPNAME=`echo $i | grep pcap` 22 | if [ -z "$PCAPNAME" ]; then 23 | hexdump -C $i > $1/$$.tmp 24 | text2pcap $1/$$.tmp ${i}.pcap 25 | fi 26 | done 27 | rm -f $1/$$.tmp 28 | 29 | echo 30 | echo "Created pcap files:" 31 | ls $1/*/*.pcap 32 | -------------------------------------------------------------------------------- /lwip-2.0.2/test/linux/lwip.h: -------------------------------------------------------------------------------- 1 | /* 2 | * lwip.h 3 | * 4 | * Created on: Jul 19, 2017 5 | * Author: admin 6 | */ 7 | 8 | #ifndef LWIP_2_0_2_TEST_LINUX_LWIP_H_ 9 | #define LWIP_2_0_2_TEST_LINUX_LWIP_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | #include "lwip/arch.h" 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #define TCP_SERVER_PRIO TCP_PRIO_MIN 29 | #define TCP_REMOTE_SERVER_ADDR ((12 << 24) | (2 << 16) | (168 << 8) | (192)) 30 | #define TCP_REMOTE_SERVER_PORT 6677 31 | #define TCP_LOCAL_SERVER_PORT 6677 32 | 33 | #define ECHO_SERVER 1 34 | #define TCP_CLIENT 2 35 | #define TEST_ID TCP_CLIENT 36 | 37 | err_t net_init(char *ifname); 38 | void net_quit(void); 39 | pthread_t start_netif(void); 40 | struct netif* get_netif(void); 41 | int lwip_linux_check_port(u16_t port); 42 | int get_if_address(const char *ifname, uint32_t *ip, uint32_t *mask, uint8_t *mac); 43 | 44 | err_t create_echo_server(void); 45 | err_t tcp_client(const ip_addr_t *ip_addr, u16_t port); 46 | #endif /* LWIP_2_0_2_TEST_LINUX_LWIP_H_ */ 47 | -------------------------------------------------------------------------------- /lwip-2.0.2/test/linux/lwipopts.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2003 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Simon Goldschmidt 30 | * 31 | */ 32 | #ifndef LWIP_HDR_LWIPOPTS_H 33 | #define LWIP_HDR_LWIPOPTS_H 34 | 35 | #define LWIP_LINUX 1 36 | #define LWIP_DEBUG 1 37 | #define lwip_linux_dbg(x) printf x 38 | 39 | #define LWIP_LINUX_PORT_NUM 32 40 | #define LWIP_LINUX_SERVER_START_PORT_NUM 6677 41 | #define LWIP_LINUX_CLIENT_START_PORT_NUM 0xC000 42 | 43 | /* Prevent having to link sys_arch.c (we don't test the API layers in unit tests) */ 44 | #define NO_SYS 1 45 | #define SYS_LIGHTWEIGHT_PROT 0 46 | #define LWIP_NETCONN 0 47 | #define LWIP_SOCKET 0 48 | 49 | /* Enable DHCP to test it, disable UDP checksum to easier inject packets */ 50 | #define LWIP_DHCP 0 51 | 52 | /* Minimal changes to opt.h required for tcp unit tests: */ 53 | #define MEM_SIZE 16000 54 | #define TCP_SND_QUEUELEN 40 55 | #define MEMP_NUM_TCP_SEG TCP_SND_QUEUELEN 56 | #define TCP_SND_BUF (12 * TCP_MSS) 57 | #define TCP_WND (10 * TCP_MSS) 58 | #define LWIP_WND_SCALE 1 59 | #define TCP_RCV_SCALE 0 60 | #define PBUF_POOL_SIZE 400 /* pbuf tests need ~200KByte */ 61 | 62 | /* Enable IGMP and MDNS for MDNS tests */ 63 | //#define LWIP_IGMP 1 64 | //#define LWIP_MDNS_RESPONDER 1 65 | //#define LWIP_NUM_NETIF_CLIENT_DATA (LWIP_MDNS_RESPONDER) 66 | 67 | /* Minimal changes to opt.h required for etharp unit tests: */ 68 | #define ETHARP_SUPPORT_STATIC_ENTRIES 1 69 | 70 | /* ---------- ARP options ---------- */ 71 | //#define LWIP_ARP 1 72 | //#define ARP_TABLE_SIZE 10 73 | //#define ARP_QUEUEING 1 74 | 75 | #endif /* LWIP_HDR_LWIPOPTS_H */ 76 | -------------------------------------------------------------------------------- /lwip-2.0.2/test/linux/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * main.c 3 | * 4 | * Created on: Jul 18, 2017 5 | * Author: haohd 6 | * 7 | * Copyright (C) 2017 miniHome 8 | * 9 | * This library is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * This library is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public 20 | * License along with this library. 21 | * If not, see . 22 | */ 23 | #include "lwip.h" 24 | 25 | int main(void) 26 | { 27 | pthread_t thread; 28 | 29 | if(net_init(NULL) != ERR_OK) 30 | { 31 | printf("Failed to initialize netif!\n"); 32 | goto _EXIT; 33 | } 34 | 35 | thread = start_netif(); 36 | if (thread < 0) 37 | { 38 | printf("Failed to start netif!\n"); 39 | goto _EXIT; 40 | } 41 | 42 | #if TEST_ID == ECHO_SERVER 43 | if (create_echo_server() != ERR_OK) 44 | { 45 | printf("Failed to create echo server!\n"); 46 | goto _EXIT; 47 | } 48 | #elif TEST_ID == TCP_CLIENT 49 | ip_addr_t ip_addr = { TCP_REMOTE_SERVER_ADDR }; 50 | if (tcp_client(&ip_addr, TCP_REMOTE_SERVER_PORT) != ERR_OK) 51 | { 52 | printf("Failed to connect to server!\n"); 53 | goto _EXIT; 54 | } 55 | #endif 56 | 57 | 58 | pthread_join(thread, NULL); 59 | _EXIT: 60 | net_quit(); 61 | return 1; 62 | } 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /lwip-2.0.2/test/unit/core/test_mem.c: -------------------------------------------------------------------------------- 1 | #include "test_mem.h" 2 | 3 | #include "lwip/mem.h" 4 | #include "lwip/stats.h" 5 | 6 | #if !LWIP_STATS || !MEM_STATS 7 | #error "This tests needs MEM-statistics enabled" 8 | #endif 9 | #if LWIP_DNS 10 | #error "This test needs DNS turned off (as it mallocs on init)" 11 | #endif 12 | 13 | /* Setups/teardown functions */ 14 | 15 | static void 16 | mem_setup(void) 17 | { 18 | } 19 | 20 | static void 21 | mem_teardown(void) 22 | { 23 | } 24 | 25 | 26 | /* Test functions */ 27 | 28 | /** Call mem_malloc, mem_free and mem_trim and check stats */ 29 | START_TEST(test_mem_one) 30 | { 31 | #define SIZE1 16 32 | #define SIZE1_2 12 33 | #define SIZE2 16 34 | void *p1, *p2; 35 | mem_size_t s1, s2; 36 | LWIP_UNUSED_ARG(_i); 37 | 38 | fail_unless(lwip_stats.mem.used == 0); 39 | 40 | p1 = mem_malloc(SIZE1); 41 | fail_unless(p1 != NULL); 42 | fail_unless(lwip_stats.mem.used >= SIZE1); 43 | s1 = lwip_stats.mem.used; 44 | 45 | p2 = mem_malloc(SIZE2); 46 | fail_unless(p2 != NULL); 47 | fail_unless(lwip_stats.mem.used >= SIZE2 + s1); 48 | s2 = lwip_stats.mem.used; 49 | 50 | mem_trim(p1, SIZE1_2); 51 | 52 | mem_free(p2); 53 | fail_unless(lwip_stats.mem.used <= s2 - SIZE2); 54 | 55 | mem_free(p1); 56 | fail_unless(lwip_stats.mem.used == 0); 57 | } 58 | END_TEST 59 | 60 | static void malloc_keep_x(int x, int num, int size, int freestep) 61 | { 62 | int i; 63 | void* p[16]; 64 | LWIP_ASSERT("invalid size", size >= 0 && size < (mem_size_t)-1); 65 | memset(p, 0, sizeof(p)); 66 | for(i = 0; i < num && i < 16; i++) { 67 | p[i] = mem_malloc((mem_size_t)size); 68 | fail_unless(p[i] != NULL); 69 | } 70 | for(i = 0; i < num && i < 16; i += freestep) { 71 | if (i == x) { 72 | continue; 73 | } 74 | mem_free(p[i]); 75 | p[i] = NULL; 76 | } 77 | for(i = 0; i < num && i < 16; i++) { 78 | if (i == x) { 79 | continue; 80 | } 81 | if (p[i] != NULL) { 82 | mem_free(p[i]); 83 | p[i] = NULL; 84 | } 85 | } 86 | fail_unless(p[x] != NULL); 87 | mem_free(p[x]); 88 | } 89 | 90 | START_TEST(test_mem_random) 91 | { 92 | const int num = 16; 93 | int x; 94 | int size; 95 | int freestep; 96 | LWIP_UNUSED_ARG(_i); 97 | 98 | fail_unless(lwip_stats.mem.used == 0); 99 | 100 | for (x = 0; x < num; x++) { 101 | for (size = 1; size < 32; size++) { 102 | for (freestep = 1; freestep <= 3; freestep++) { 103 | fail_unless(lwip_stats.mem.used == 0); 104 | malloc_keep_x(x, num, size, freestep); 105 | fail_unless(lwip_stats.mem.used == 0); 106 | } 107 | } 108 | } 109 | } 110 | END_TEST 111 | 112 | /** Create the suite including all tests for this module */ 113 | Suite * 114 | mem_suite(void) 115 | { 116 | testfunc tests[] = { 117 | TESTFUNC(test_mem_one), 118 | TESTFUNC(test_mem_random) 119 | }; 120 | return create_suite("MEM", tests, sizeof(tests)/sizeof(testfunc), mem_setup, mem_teardown); 121 | } 122 | -------------------------------------------------------------------------------- /lwip-2.0.2/test/unit/core/test_mem.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_MEM_H 2 | #define LWIP_HDR_TEST_MEM_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite *mem_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /lwip-2.0.2/test/unit/core/test_pbuf.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_PBUF_H 2 | #define LWIP_HDR_TEST_PBUF_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite *pbuf_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /lwip-2.0.2/test/unit/dhcp/test_dhcp.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_DHCP_H 2 | #define LWIP_HDR_TEST_DHCP_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite* dhcp_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /lwip-2.0.2/test/unit/etharp/test_etharp.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_ETHARP_H 2 | #define LWIP_HDR_TEST_ETHARP_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite* etharp_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /lwip-2.0.2/test/unit/lwip_check.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_LWIP_CHECK_H 2 | #define LWIP_HDR_LWIP_CHECK_H 3 | 4 | /* Common header file for lwIP unit tests using the check framework */ 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #define FAIL_RET() do { fail(); return; } while(0) 11 | #define EXPECT(x) fail_unless(x) 12 | #define EXPECT_RET(x) do { fail_unless(x); if(!(x)) { return; }} while(0) 13 | #define EXPECT_RETX(x, y) do { fail_unless(x); if(!(x)) { return y; }} while(0) 14 | #define EXPECT_RETNULL(x) EXPECT_RETX(x, NULL) 15 | 16 | typedef struct { 17 | TFun func; 18 | const char *name; 19 | } testfunc; 20 | 21 | #define TESTFUNC(x) {(x), "" # x "" } 22 | 23 | /* Modified function from check.h, supplying function name */ 24 | #define tcase_add_named_test(tc,tf) \ 25 | _tcase_add_test((tc),(tf).func,(tf).name,0, 0, 0, 1) 26 | 27 | /** typedef for a function returning a test suite */ 28 | typedef Suite* (suite_getter_fn)(void); 29 | 30 | /** Create a test suite */ 31 | Suite* create_suite(const char* name, testfunc *tests, size_t num_tests, SFun setup, SFun teardown); 32 | 33 | #ifdef LWIP_UNITTESTS_LIB 34 | int lwip_unittests_run(void) 35 | #endif 36 | 37 | #endif /* LWIP_HDR_LWIP_CHECK_H */ 38 | -------------------------------------------------------------------------------- /lwip-2.0.2/test/unit/lwip_unittests.c: -------------------------------------------------------------------------------- 1 | #include "lwip_check.h" 2 | 3 | #include "udp/test_udp.h" 4 | #include "tcp/test_tcp.h" 5 | #include "tcp/test_tcp_oos.h" 6 | #include "core/test_mem.h" 7 | #include "core/test_pbuf.h" 8 | #include "etharp/test_etharp.h" 9 | #include "dhcp/test_dhcp.h" 10 | #include "mdns/test_mdns.h" 11 | 12 | #include "lwip/init.h" 13 | 14 | Suite* create_suite(const char* name, testfunc *tests, size_t num_tests, SFun setup, SFun teardown) 15 | { 16 | size_t i; 17 | Suite *s = suite_create(name); 18 | 19 | for(i = 0; i < num_tests; i++) { 20 | TCase *tc_core = tcase_create(name); 21 | if ((setup != NULL) || (teardown != NULL)) { 22 | tcase_add_checked_fixture(tc_core, setup, teardown); 23 | } 24 | tcase_add_named_test(tc_core, tests[i]); 25 | suite_add_tcase(s, tc_core); 26 | } 27 | return s; 28 | } 29 | 30 | #ifdef LWIP_UNITTESTS_LIB 31 | int lwip_unittests_run(void) 32 | #else 33 | int main(void) 34 | #endif 35 | { 36 | int number_failed; 37 | SRunner *sr; 38 | size_t i; 39 | suite_getter_fn* suites[] = { 40 | udp_suite, 41 | tcp_suite, 42 | tcp_oos_suite, 43 | mem_suite, 44 | pbuf_suite, 45 | etharp_suite, 46 | dhcp_suite, 47 | mdns_suite 48 | }; 49 | size_t num = sizeof(suites)/sizeof(void*); 50 | LWIP_ASSERT("No suites defined", num > 0); 51 | 52 | lwip_init(); 53 | 54 | sr = srunner_create((suites[0])()); 55 | for(i = 1; i < num; i++) { 56 | srunner_add_suite(sr, ((suite_getter_fn*)suites[i])()); 57 | } 58 | 59 | #ifdef LWIP_UNITTESTS_NOFORK 60 | srunner_set_fork_status(sr, CK_NOFORK); 61 | #endif 62 | #ifdef LWIP_UNITTESTS_FORK 63 | srunner_set_fork_status(sr, CK_FORK); 64 | #endif 65 | 66 | srunner_run_all(sr, CK_NORMAL); 67 | number_failed = srunner_ntests_failed(sr); 68 | srunner_free(sr); 69 | return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; 70 | } 71 | -------------------------------------------------------------------------------- /lwip-2.0.2/test/unit/lwipopts.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2003 Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without modification, 6 | * are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 25 | * OF SUCH DAMAGE. 26 | * 27 | * This file is part of the lwIP TCP/IP stack. 28 | * 29 | * Author: Simon Goldschmidt 30 | * 31 | */ 32 | #ifndef LWIP_HDR_LWIPOPTS_H 33 | #define LWIP_HDR_LWIPOPTS_H 34 | 35 | /* Prevent having to link sys_arch.c (we don't test the API layers in unit tests) */ 36 | #define NO_SYS 1 37 | #define SYS_LIGHTWEIGHT_PROT 0 38 | #define LWIP_NETCONN 0 39 | #define LWIP_SOCKET 0 40 | 41 | /* Enable DHCP to test it, disable UDP checksum to easier inject packets */ 42 | #define LWIP_DHCP 1 43 | 44 | /* Minimal changes to opt.h required for tcp unit tests: */ 45 | #define MEM_SIZE 16000 46 | #define TCP_SND_QUEUELEN 40 47 | #define MEMP_NUM_TCP_SEG TCP_SND_QUEUELEN 48 | #define TCP_SND_BUF (12 * TCP_MSS) 49 | #define TCP_WND (10 * TCP_MSS) 50 | #define LWIP_WND_SCALE 1 51 | #define TCP_RCV_SCALE 0 52 | #define PBUF_POOL_SIZE 400 /* pbuf tests need ~200KByte */ 53 | 54 | /* Enable IGMP and MDNS for MDNS tests */ 55 | #define LWIP_IGMP 1 56 | #define LWIP_MDNS_RESPONDER 1 57 | #define LWIP_NUM_NETIF_CLIENT_DATA (LWIP_MDNS_RESPONDER) 58 | 59 | /* Minimal changes to opt.h required for etharp unit tests: */ 60 | #define ETHARP_SUPPORT_STATIC_ENTRIES 1 61 | 62 | #endif /* LWIP_HDR_LWIPOPTS_H */ 63 | -------------------------------------------------------------------------------- /lwip-2.0.2/test/unit/mdns/test_mdns.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_MDNS_H__ 2 | #define LWIP_HDR_TEST_MDNS_H__ 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite* mdns_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /lwip-2.0.2/test/unit/tcp/tcp_helper.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TCP_HELPER_H 2 | #define LWIP_HDR_TCP_HELPER_H 3 | 4 | #include "../lwip_check.h" 5 | #include "lwip/arch.h" 6 | #include "lwip/tcp.h" 7 | #include "lwip/netif.h" 8 | 9 | /* counters used for test_tcp_counters_* callback functions */ 10 | struct test_tcp_counters { 11 | u32_t recv_calls; 12 | u32_t recved_bytes; 13 | u32_t recv_calls_after_close; 14 | u32_t recved_bytes_after_close; 15 | u32_t close_calls; 16 | u32_t err_calls; 17 | err_t last_err; 18 | char* expected_data; 19 | u32_t expected_data_len; 20 | }; 21 | 22 | struct test_tcp_txcounters { 23 | u32_t num_tx_calls; 24 | u32_t num_tx_bytes; 25 | u8_t copy_tx_packets; 26 | struct pbuf *tx_packets; 27 | }; 28 | 29 | /* Helper functions */ 30 | void tcp_remove_all(void); 31 | 32 | struct pbuf* tcp_create_segment(ip_addr_t* src_ip, ip_addr_t* dst_ip, 33 | u16_t src_port, u16_t dst_port, void* data, size_t data_len, 34 | u32_t seqno, u32_t ackno, u8_t headerflags); 35 | struct pbuf* tcp_create_rx_segment(struct tcp_pcb* pcb, void* data, size_t data_len, 36 | u32_t seqno_offset, u32_t ackno_offset, u8_t headerflags); 37 | struct pbuf* tcp_create_rx_segment_wnd(struct tcp_pcb* pcb, void* data, size_t data_len, 38 | u32_t seqno_offset, u32_t ackno_offset, u8_t headerflags, u16_t wnd); 39 | void tcp_set_state(struct tcp_pcb* pcb, enum tcp_state state, ip_addr_t* local_ip, 40 | ip_addr_t* remote_ip, u16_t local_port, u16_t remote_port); 41 | void test_tcp_counters_err(void* arg, err_t err); 42 | err_t test_tcp_counters_recv(void* arg, struct tcp_pcb* pcb, struct pbuf* p, err_t err); 43 | 44 | struct tcp_pcb* test_tcp_new_counters_pcb(struct test_tcp_counters* counters); 45 | 46 | void test_tcp_input(struct pbuf *p, struct netif *inp); 47 | 48 | void test_tcp_init_netif(struct netif *netif, struct test_tcp_txcounters *txcounters, 49 | ip_addr_t *ip_addr, ip_addr_t *netmask); 50 | 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /lwip-2.0.2/test/unit/tcp/test_tcp.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_TCP_H 2 | #define LWIP_HDR_TEST_TCP_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite *tcp_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /lwip-2.0.2/test/unit/tcp/test_tcp_oos.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_TCP_OOS_H 2 | #define LWIP_HDR_TEST_TCP_OOS_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite *tcp_oos_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /lwip-2.0.2/test/unit/udp/test_udp.c: -------------------------------------------------------------------------------- 1 | #include "test_udp.h" 2 | 3 | #include "lwip/udp.h" 4 | #include "lwip/stats.h" 5 | 6 | #if !LWIP_STATS || !UDP_STATS || !MEMP_STATS 7 | #error "This tests needs UDP- and MEMP-statistics enabled" 8 | #endif 9 | 10 | /* Helper functions */ 11 | static void 12 | udp_remove_all(void) 13 | { 14 | struct udp_pcb *pcb = udp_pcbs; 15 | struct udp_pcb *pcb2; 16 | 17 | while(pcb != NULL) { 18 | pcb2 = pcb; 19 | pcb = pcb->next; 20 | udp_remove(pcb2); 21 | } 22 | fail_unless(MEMP_STATS_GET(used, MEMP_UDP_PCB) == 0); 23 | } 24 | 25 | /* Setups/teardown functions */ 26 | 27 | static void 28 | udp_setup(void) 29 | { 30 | udp_remove_all(); 31 | } 32 | 33 | static void 34 | udp_teardown(void) 35 | { 36 | udp_remove_all(); 37 | } 38 | 39 | 40 | /* Test functions */ 41 | 42 | START_TEST(test_udp_new_remove) 43 | { 44 | struct udp_pcb* pcb; 45 | LWIP_UNUSED_ARG(_i); 46 | 47 | fail_unless(MEMP_STATS_GET(used, MEMP_UDP_PCB) == 0); 48 | 49 | pcb = udp_new(); 50 | fail_unless(pcb != NULL); 51 | if (pcb != NULL) { 52 | fail_unless(MEMP_STATS_GET(used, MEMP_UDP_PCB) == 1); 53 | udp_remove(pcb); 54 | fail_unless(MEMP_STATS_GET(used, MEMP_UDP_PCB) == 0); 55 | } 56 | } 57 | END_TEST 58 | 59 | 60 | /** Create the suite including all tests for this module */ 61 | Suite * 62 | udp_suite(void) 63 | { 64 | testfunc tests[] = { 65 | TESTFUNC(test_udp_new_remove), 66 | }; 67 | return create_suite("UDP", tests, sizeof(tests)/sizeof(testfunc), udp_setup, udp_teardown); 68 | } 69 | -------------------------------------------------------------------------------- /lwip-2.0.2/test/unit/udp/test_udp.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_UDP_H 2 | #define LWIP_HDR_TEST_UDP_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite* udp_suite(void); 7 | 8 | #endif 9 | --------------------------------------------------------------------------------