├── BUILDING ├── CHANGELOG ├── CMakeLists.txt ├── COPYING ├── FEATURES ├── FILES ├── README ├── UPGRADING ├── codespell_changed_files.sh ├── codespell_check.sh ├── contrib ├── Coverity │ └── coverity.c ├── Filelists.cmake ├── Filelists.mk ├── addons │ ├── ipv6_static_routing │ │ ├── README │ │ ├── ip6_route_table.c │ │ └── ip6_route_table.h │ ├── netconn │ │ └── external_resolve │ │ │ ├── dnssd.c │ │ │ └── dnssd.h │ ├── tcp_isn │ │ ├── tcp_isn.c │ │ └── tcp_isn.h │ └── tcp_md5 │ │ ├── README │ │ ├── tcp_md5.c │ │ └── tcp_md5.h ├── apps │ ├── LwipMibCompiler │ │ ├── CCodeGeneration │ │ │ ├── CCodeGeneration.csproj │ │ │ ├── CFile.cs │ │ │ ├── CGenerator.cs │ │ │ ├── Code.cs │ │ │ ├── CodeContainerBase.cs │ │ │ ├── CodeElement.cs │ │ │ ├── Comment.cs │ │ │ ├── EmptyLine.cs │ │ │ ├── Function.cs │ │ │ ├── FunctionDeclaration.cs │ │ │ ├── IfThenElse.cs │ │ │ ├── PP_If.cs │ │ │ ├── PP_Ifdef.cs │ │ │ ├── PP_Include.cs │ │ │ ├── PP_Macro.cs │ │ │ ├── PlainText.cs │ │ │ ├── Properties │ │ │ │ └── AssemblyInfo.cs │ │ │ ├── Switch.cs │ │ │ ├── VariableDeclaration.cs │ │ │ ├── VariablePrototype.cs │ │ │ └── VariableType.cs │ │ ├── LwipMibCompiler.sln │ │ ├── LwipMibCompiler │ │ │ ├── LwipMibCompiler.csproj │ │ │ ├── Program.cs │ │ │ ├── Properties │ │ │ │ └── AssemblyInfo.cs │ │ │ └── app.config │ │ ├── LwipSnmpCodeGeneration │ │ │ ├── IRestriction.cs │ │ │ ├── LwipSnmp.cs │ │ │ ├── LwipSnmpCodeGeneration.csproj │ │ │ ├── MibCFile.cs │ │ │ ├── MibHeaderFile.cs │ │ │ ├── Properties │ │ │ │ └── AssemblyInfo.cs │ │ │ ├── SnmpMib.cs │ │ │ ├── SnmpNode.cs │ │ │ ├── SnmpScalarAggregationNode.cs │ │ │ ├── SnmpScalarArrayNode.cs │ │ │ ├── SnmpScalarNode.cs │ │ │ ├── SnmpScalarNodeBits.cs │ │ │ ├── SnmpScalarNodeCounter64.cs │ │ │ ├── SnmpScalarNodeInt.cs │ │ │ ├── SnmpScalarNodeObjectIdentifier.cs │ │ │ ├── SnmpScalarNodeOctetString.cs │ │ │ ├── SnmpScalarNodeTruthValue.cs │ │ │ ├── SnmpScalarNodeUint.cs │ │ │ ├── SnmpTableNode.cs │ │ │ └── SnmpTreeNode.cs │ │ ├── MibViewer │ │ │ ├── FormMain.Designer.cs │ │ │ ├── FormMain.cs │ │ │ ├── FormMain.resx │ │ │ ├── MibViewer.csproj │ │ │ ├── Program.cs │ │ │ ├── Properties │ │ │ │ ├── AssemblyInfo.cs │ │ │ │ ├── Resources.Designer.cs │ │ │ │ ├── Resources.resx │ │ │ │ ├── Settings.Designer.cs │ │ │ │ └── Settings.settings │ │ │ └── app.config │ │ ├── Mibs │ │ │ ├── IANA-ADDRESS-FAMILY-NUMBERS-MIB │ │ │ ├── IANA-CHARSET-MIB │ │ │ ├── IANA │ │ │ │ ├── IANA-ITU-ALARM-TC-MIB │ │ │ │ ├── IANA-LANGUAGE-MIB │ │ │ │ ├── IANA-MALLOC-MIB │ │ │ │ ├── IANA-MAU-MIB │ │ │ │ ├── IANA-PRINTER-MIB │ │ │ │ ├── IANA-RTPROTO-MIB │ │ │ │ ├── IANATn3270eTC-MIB │ │ │ │ └── IANAifType-MIB │ │ │ ├── IF-MIB │ │ │ ├── INET-ADDRESS-MIB │ │ │ ├── IP-MIB │ │ │ ├── RFC-1212 │ │ │ ├── RFC-1215 │ │ │ ├── RFC1065-SMI │ │ │ ├── RFC1155-SMI │ │ │ ├── RFC1158-MIB │ │ │ ├── RFC1213-MIB │ │ │ ├── SNMPv2-CONF │ │ │ ├── SNMPv2-MIB │ │ │ ├── SNMPv2-SMI │ │ │ ├── SNMPv2-TC │ │ │ ├── SNMPv2-TM │ │ │ ├── TCP-MIB │ │ │ └── UDP-MIB │ │ ├── SharpSnmpLib │ │ │ ├── Mib │ │ │ │ ├── DisplayHint.cs │ │ │ │ ├── Elements │ │ │ │ │ ├── Entities │ │ │ │ │ │ ├── AgentCapabilities.cs │ │ │ │ │ │ ├── EntityBase.cs │ │ │ │ │ │ ├── IEntity.cs │ │ │ │ │ │ ├── ModuleCompliance.cs │ │ │ │ │ │ ├── ModuleIdentity.cs │ │ │ │ │ │ ├── NotificationGroup.cs │ │ │ │ │ │ ├── NotificationType.cs │ │ │ │ │ │ ├── ObjectGroup.cs │ │ │ │ │ │ ├── ObjectIdentity.cs │ │ │ │ │ │ ├── ObjectType.cs │ │ │ │ │ │ └── OidValueAssignment.cs │ │ │ │ │ ├── Exports.cs │ │ │ │ │ ├── IDeclaration.cs │ │ │ │ │ ├── IElement.cs │ │ │ │ │ ├── ITypeReferrer.cs │ │ │ │ │ ├── Imports.cs │ │ │ │ │ ├── ImportsFrom.cs │ │ │ │ │ ├── TrapType.cs │ │ │ │ │ └── Types │ │ │ │ │ │ ├── BaseType.cs │ │ │ │ │ │ ├── BitsType.cs │ │ │ │ │ │ ├── Choice.cs │ │ │ │ │ │ ├── ITypeAssignment.cs │ │ │ │ │ │ ├── IntegerType.cs │ │ │ │ │ │ ├── IpAddressType.cs │ │ │ │ │ │ ├── Macro.cs │ │ │ │ │ │ ├── ObjectIdentifierType.cs │ │ │ │ │ │ ├── OctetStringType.cs │ │ │ │ │ │ ├── OpaqueType.cs │ │ │ │ │ │ ├── Sequence.cs │ │ │ │ │ │ ├── SequenceOf.cs │ │ │ │ │ │ ├── TextualConvention.cs │ │ │ │ │ │ ├── TypeAssignment.cs │ │ │ │ │ │ └── UnsignedType.cs │ │ │ │ ├── IModule.cs │ │ │ │ ├── ISymbolEnumerator.cs │ │ │ │ ├── Lexer.cs │ │ │ │ ├── MaxAccess.cs │ │ │ │ ├── MibDocument.cs │ │ │ │ ├── MibException.cs │ │ │ │ ├── MibModule.cs │ │ │ │ ├── MibResolver.cs │ │ │ │ ├── MibTree.cs │ │ │ │ ├── MibTreeNode.cs │ │ │ │ ├── MibTypesResolver.cs │ │ │ │ ├── ObjectIdentifier.cs │ │ │ │ ├── Status.cs │ │ │ │ ├── Symbol.cs │ │ │ │ ├── SymbolList.cs │ │ │ │ ├── ValueMap.cs │ │ │ │ └── ValueRange.cs │ │ │ ├── Properties │ │ │ │ ├── AssemblyInfo.cs │ │ │ │ ├── Resources.Designer.cs │ │ │ │ └── Resources.resx │ │ │ ├── SharpSnmpLib.Mib.csproj │ │ │ ├── license.txt │ │ │ ├── readme.txt │ │ │ └── sharpsnmplib.snk │ │ └── example │ │ │ ├── compile_udp_mib.cmd │ │ │ └── compile_udp_mib.sh │ ├── chargen │ │ ├── README │ │ ├── chargen.c │ │ └── chargen.h │ ├── httpserver │ │ ├── README │ │ ├── httpserver-netconn.c │ │ └── httpserver-netconn.h │ ├── netio │ │ ├── netio.c │ │ └── netio.h │ ├── ping │ │ ├── ping.c │ │ └── ping.h │ ├── rtp │ │ ├── rtp.c │ │ ├── rtp.h │ │ └── rtpdata.h │ ├── shell │ │ ├── shell.c │ │ └── shell.h │ ├── socket_examples │ │ ├── socket_examples.c │ │ └── socket_examples.h │ ├── tcpecho │ │ ├── tcpecho.c │ │ └── tcpecho.h │ ├── tcpecho_raw │ │ ├── tcpecho_raw.c │ │ └── tcpecho_raw.h │ ├── udpecho │ │ ├── udpecho.c │ │ └── udpecho.h │ └── udpecho_raw │ │ ├── udpecho_raw.c │ │ └── udpecho_raw.h ├── examples │ ├── ethernetif │ │ └── ethernetif.c │ ├── example_app │ │ ├── default_netif.h │ │ ├── lwipcfg.h.ci │ │ ├── lwipcfg.h.example │ │ ├── lwipopts.h │ │ ├── lwippools.h │ │ ├── ppp_settings.h │ │ ├── test.c │ │ └── test_configs │ │ │ ├── opt_default.h │ │ │ ├── opt_dualstack.h │ │ │ ├── opt_ipv4only.h │ │ │ ├── opt_ipv6only.h │ │ │ ├── opt_no_tcp_dualstack.h │ │ │ ├── opt_no_tcp_ipv4only.h │ │ │ ├── opt_no_tcp_ipv6only.h │ │ │ ├── opt_no_udp_dualstack.h │ │ │ ├── opt_no_udp_ipv4only.h │ │ │ ├── opt_no_udp_ipv6only.h │ │ │ ├── opt_none.h │ │ │ ├── opt_nosys_dual.h │ │ │ ├── opt_nosys_ipv4.h │ │ │ └── opt_nosys_ipv6.h │ ├── httpd │ │ ├── cgi_example │ │ │ ├── cgi_example.c │ │ │ └── cgi_example.h │ │ ├── examples_fs │ │ │ ├── 404.html │ │ │ ├── img │ │ │ │ └── sics.gif │ │ │ ├── index.html │ │ │ ├── login.html │ │ │ ├── loginfail.html │ │ │ ├── session.html │ │ │ └── ssi.shtml │ │ ├── examples_fsdata.c │ │ ├── fs_example │ │ │ ├── fs_example.c │ │ │ └── fs_example.h │ │ ├── genfiles_example │ │ │ ├── genfiles_example.c │ │ │ └── genfiles_example.h │ │ ├── https_example │ │ │ ├── https_example.c │ │ │ └── https_example.h │ │ ├── post_example │ │ │ └── post_example.c │ │ └── ssi_example │ │ │ ├── ssi_example.c │ │ │ └── ssi_example.h │ ├── lwiperf │ │ ├── lwiperf_example.c │ │ └── lwiperf_example.h │ ├── mdns │ │ ├── mdns_example.c │ │ └── mdns_example.h │ ├── mqtt │ │ ├── mqtt_example.c │ │ └── mqtt_example.h │ ├── ppp │ │ ├── pppos_example.c │ │ └── pppos_example.h │ ├── snmp │ │ ├── snmp_example.c │ │ ├── snmp_example.h │ │ ├── snmp_private_mib │ │ │ ├── lwip_prvmib.c │ │ │ └── private_mib.h │ │ └── snmp_v3 │ │ │ ├── snmpv3_dummy.c │ │ │ └── snmpv3_dummy.h │ ├── sntp │ │ ├── sntp_example.c │ │ └── sntp_example.h │ └── tftp │ │ ├── tftp_example.c │ │ └── tftp_example.h └── ports │ ├── CMakeCommon.cmake │ ├── Common.allports.mk │ ├── freertos │ ├── include │ │ └── arch │ │ │ └── sys_arch.h │ └── sys_arch.c │ ├── unix │ ├── Common.mk │ ├── Filelists.cmake │ ├── README │ ├── check │ │ ├── CMakeLists.txt │ │ ├── Makefile │ │ ├── README │ │ └── config.h │ ├── example_app │ │ ├── CMakeLists.txt │ │ ├── Makefile │ │ ├── default_netif.c │ │ └── iteropts.sh │ ├── lib │ │ ├── CMakeLists.txt │ │ ├── README │ │ └── lwipopts.h │ ├── port │ │ ├── include │ │ │ ├── arch │ │ │ │ ├── cc.h │ │ │ │ ├── perf.h │ │ │ │ └── sys_arch.h │ │ │ └── netif │ │ │ │ ├── fifo.h │ │ │ │ ├── list.h │ │ │ │ ├── pcapif.h │ │ │ │ ├── sio.h │ │ │ │ └── tapif.h │ │ ├── netif │ │ │ ├── fifo.c │ │ │ ├── list.c │ │ │ ├── pcapif.c │ │ │ ├── sio.c │ │ │ └── tapif.c │ │ ├── perf.c │ │ └── sys_arch.c │ └── setup-tapif │ └── win32 │ ├── Common.mk │ ├── Filelists.cmake │ ├── check │ ├── check_stdint.h │ ├── config.h │ ├── stdbool.h │ ├── sys │ │ └── time.h │ ├── time.c │ └── unistd.h │ ├── example_app │ ├── CMakeLists.txt │ ├── Makefile │ └── default_netif.c │ ├── include │ └── arch │ │ ├── bpstruct.h │ │ ├── cc.h │ │ ├── epstruct.h │ │ ├── perf.h │ │ └── sys_arch.h │ ├── msvc │ ├── build_coverity.cmd │ ├── libcheck.vcxproj │ ├── libcheck.vcxproj.filters │ ├── lwIP.vcxproj │ ├── lwIP.vcxproj.filters │ ├── lwIP_Test.sln │ ├── lwIP_Test.vcxproj │ ├── lwIP_Test.vcxproj.filters │ ├── lwIP_pcapif.vcxproj │ ├── lwIP_pcapif.vcxproj.filters │ ├── lwIP_unittests.sln │ ├── lwip_unittests.vcxproj │ ├── lwip_unittests.vcxproj.filters │ ├── makefsdata.vcxproj │ └── makefsdata.vcxproj.filters │ ├── pcapif.c │ ├── pcapif.h │ ├── pcapif_helper.c │ ├── pcapif_helper.h │ ├── readme.txt │ ├── sio.c │ └── sys_arch.c ├── doc ├── FILES ├── NO_SYS_SampleCode.c ├── ZeroCopyRx.c ├── contrib.txt ├── doxygen │ ├── generate.bat │ ├── generate.sh │ ├── lwip.Doxyfile │ ├── lwip.Doxyfile.cmake.in │ ├── main_page.h │ └── output │ │ └── index.html ├── mdns.txt ├── mqtt_client.txt ├── ppp.txt └── savannah.txt ├── src ├── FILES ├── Filelists.cmake ├── Filelists.mk ├── api │ ├── api_lib.c │ ├── api_msg.c │ ├── err.c │ ├── if_api.c │ ├── netbuf.c │ ├── netdb.c │ ├── netifapi.c │ ├── sockets.c │ └── tcpip.c ├── apps │ ├── altcp_tls │ │ ├── altcp_tls_mbedtls.c │ │ ├── altcp_tls_mbedtls_mem.c │ │ ├── altcp_tls_mbedtls_mem.h │ │ └── altcp_tls_mbedtls_structs.h │ ├── http │ │ ├── altcp_proxyconnect.c │ │ ├── fs.c │ │ ├── fs │ │ │ ├── 404.html │ │ │ ├── img │ │ │ │ └── sics.gif │ │ │ └── index.html │ │ ├── fsdata.c │ │ ├── fsdata.h │ │ ├── http_client.c │ │ ├── httpd.c │ │ ├── httpd_structs.h │ │ └── makefsdata │ │ │ ├── makefsdata │ │ │ ├── makefsdata.c │ │ │ ├── readme.txt │ │ │ └── tinydir.h │ ├── lwiperf │ │ └── lwiperf.c │ ├── mdns │ │ ├── mdns.c │ │ ├── mdns_domain.c │ │ └── mdns_out.c │ ├── mqtt │ │ └── mqtt.c │ ├── netbiosns │ │ └── netbiosns.c │ ├── smtp │ │ └── smtp.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_snmpv2_framework.c │ │ ├── snmp_snmpv2_usm.c │ │ ├── snmp_table.c │ │ ├── snmp_threadsync.c │ │ ├── snmp_traps.c │ │ ├── snmpv3.c │ │ ├── snmpv3_mbedtls.c │ │ └── snmpv3_priv.h │ ├── sntp │ │ └── sntp.c │ └── tftp │ │ └── tftp.c ├── core │ ├── altcp.c │ ├── altcp_alloc.c │ ├── altcp_tcp.c │ ├── def.c │ ├── dns.c │ ├── inet_chksum.c │ ├── init.c │ ├── ip.c │ ├── ipv4 │ │ ├── acd.c │ │ ├── autoip.c │ │ ├── dhcp.c │ │ ├── etharp.c │ │ ├── icmp.c │ │ ├── igmp.c │ │ ├── ip4.c │ │ ├── ip4_addr.c │ │ ├── ip4_frag.c │ │ └── ip4_nat.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 │ ├── compat │ │ ├── posix │ │ │ ├── arpa │ │ │ │ └── inet.h │ │ │ ├── net │ │ │ │ └── if.h │ │ │ ├── netdb.h │ │ │ └── sys │ │ │ │ └── socket.h │ │ └── stdc │ │ │ └── errno.h │ ├── lwip │ │ ├── acd.h │ │ ├── altcp.h │ │ ├── altcp_tcp.h │ │ ├── altcp_tls.h │ │ ├── api.h │ │ ├── apps │ │ │ ├── FILES │ │ │ ├── altcp_proxyconnect.h │ │ │ ├── altcp_tls_mbedtls_opts.h │ │ │ ├── fs.h │ │ │ ├── http_client.h │ │ │ ├── httpd.h │ │ │ ├── httpd_opts.h │ │ │ ├── lwiperf.h │ │ │ ├── mdns.h │ │ │ ├── mdns_domain.h │ │ │ ├── mdns_opts.h │ │ │ ├── mdns_out.h │ │ │ ├── mdns_priv.h │ │ │ ├── mqtt.h │ │ │ ├── mqtt_opts.h │ │ │ ├── mqtt_priv.h │ │ │ ├── netbiosns.h │ │ │ ├── netbiosns_opts.h │ │ │ ├── smtp.h │ │ │ ├── smtp_opts.h │ │ │ ├── snmp.h │ │ │ ├── snmp_core.h │ │ │ ├── snmp_mib2.h │ │ │ ├── snmp_opts.h │ │ │ ├── snmp_scalar.h │ │ │ ├── snmp_snmpv2_framework.h │ │ │ ├── snmp_snmpv2_usm.h │ │ │ ├── snmp_table.h │ │ │ ├── snmp_threadsync.h │ │ │ ├── snmpv3.h │ │ │ ├── sntp.h │ │ │ ├── sntp_opts.h │ │ │ ├── tftp_client.h │ │ │ ├── tftp_common.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 │ │ ├── if_api.h │ │ ├── igmp.h │ │ ├── inet.h │ │ ├── inet_chksum.h │ │ ├── init.h │ │ ├── init.h.cmake.in │ │ ├── ip.h │ │ ├── ip4.h │ │ ├── ip4_addr.h │ │ ├── ip4_frag.h │ │ ├── ip4_nat.h │ │ ├── ip6.h │ │ ├── ip6_addr.h │ │ ├── ip6_frag.h │ │ ├── ip6_zone.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 │ │ │ ├── altcp_priv.h │ │ │ ├── api_msg.h │ │ │ ├── mem_priv.h │ │ │ ├── memp_priv.h │ │ │ ├── memp_std.h │ │ │ ├── nd6_priv.h │ │ │ ├── raw_priv.h │ │ │ ├── sockets_priv.h │ │ │ ├── tcp_priv.h │ │ │ └── tcpip_priv.h │ │ ├── prot │ │ │ ├── acd.h │ │ │ ├── autoip.h │ │ │ ├── dhcp.h │ │ │ ├── dhcp6.h │ │ │ ├── dns.h │ │ │ ├── etharp.h │ │ │ ├── ethernet.h │ │ │ ├── iana.h │ │ │ ├── icmp.h │ │ │ ├── icmp6.h │ │ │ ├── ieee.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 │ │ ├── tcpbase.h │ │ ├── tcpip.h │ │ ├── timeouts.h │ │ └── udp.h │ └── netif │ │ ├── bridgeif.h │ │ ├── bridgeif_opts.h │ │ ├── etharp.h │ │ ├── ethernet.h │ │ ├── ieee802154.h │ │ ├── lowpan6.h │ │ ├── lowpan6_ble.h │ │ ├── lowpan6_common.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 │ │ └── zepif.h └── netif │ ├── FILES │ ├── bridgeif.c │ ├── bridgeif_fdb.c │ ├── ethernet.c │ ├── lowpan6.c │ ├── lowpan6_ble.c │ ├── lowpan6_common.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 │ └── zepif.c └── test ├── fuzz ├── Makefile ├── README ├── config.h ├── fuzz.c ├── fuzz2.c ├── fuzz3.c ├── fuzz_common.c ├── fuzz_common.h ├── 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 ├── sockets ├── sockets_stresstest.c └── sockets_stresstest.h └── unit ├── Filelists.cmake ├── Filelists.mk ├── Makefile ├── api ├── test_sockets.c └── test_sockets.h ├── arch ├── sys_arch.c └── sys_arch.h ├── core ├── test_def.c ├── test_def.h ├── test_dns.c ├── test_dns.h ├── test_mem.c ├── test_mem.h ├── test_netif.c ├── test_netif.h ├── test_pbuf.c ├── test_pbuf.h ├── test_timers.c └── test_timers.h ├── dhcp ├── test_dhcp.c └── test_dhcp.h ├── etharp ├── test_etharp.c └── test_etharp.h ├── ip4 ├── test_ip4.c └── test_ip4.h ├── ip6 ├── test_ip6.c └── test_ip6.h ├── lwip_check.h ├── lwip_unittests.c ├── lwipopts.h ├── mdns ├── test_mdns.c └── test_mdns.h ├── mqtt ├── test_mqtt.c └── test_mqtt.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 /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | 3 | set (CMAKE_CONFIGURATION_TYPES "Debug;Release") 4 | 5 | project(lwIP) 6 | 7 | # Example lwIP application 8 | set(LWIP_DIR ${CMAKE_CURRENT_SOURCE_DIR}) 9 | 10 | set (LWIP_DEFINITIONS LWIP_DEBUG=1) 11 | 12 | if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") 13 | add_subdirectory(${LWIP_DIR}/contrib/ports/win32/example_app) 14 | elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") 15 | add_subdirectory(${LWIP_DIR}/contrib/ports/unix/example_app) 16 | else() 17 | message(WARNING "Host ${CMAKE_SYSTEM_NAME} is not supported to build example_app") 18 | endif() 19 | 20 | # Source package generation 21 | set(CPACK_SOURCE_GENERATOR "ZIP") 22 | set(CPACK_SOURCE_PACKAGE_DESCRIPTION_SUMMARY "lwIP lightweight IP stack") 23 | set(CPACK_PACKAGE_VERSION_MAJOR "${LWIP_VERSION_MAJOR}") 24 | set(CPACK_PACKAGE_VERSION_MINOR "${LWIP_VERSION_MINOR}") 25 | set(CPACK_PACKAGE_VERSION_PATCH "${LWIP_VERSION_REVISION}") 26 | set(CPACK_SOURCE_IGNORE_FILES "/build/;${CPACK_SOURCE_IGNORE_FILES};.git") 27 | set(CPACK_SOURCE_PACKAGE_FILE_NAME "lwip-${LWIP_VERSION_MAJOR}.${LWIP_VERSION_MINOR}.${LWIP_VERSION_REVISION}") 28 | include(CPack) 29 | 30 | # Generate docs before creating source package 31 | include(src/Filelists.cmake) 32 | add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source) 33 | if (TARGET lwipdocs) 34 | add_dependencies(dist lwipdocs) 35 | endif() 36 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2001, 2002 Swedish Institute of Computer Science. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 3. The name of the author may not be used to endorse or promote products 13 | derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 16 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 17 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 18 | SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 20 | OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 22 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 23 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 24 | OF SUCH DAMAGE. 25 | 26 | -------------------------------------------------------------------------------- /FEATURES: -------------------------------------------------------------------------------- 1 | lwIP is a small independent implementation of the TCP/IP protocol suite targeted at embedded systems. 2 | 3 | The focus of the lwIP TCP/IP implementation is to reduce resource usage while still having a full scale TCP. This makes lwIP suitable for use in embedded systems with tens of kilobytes of free RAM and room for around 40 kilobytes of code ROM. 4 | 5 | Main features include: 6 | - Protocols: IP, IPv6, ICMP, ND, MLD, UDP, TCP, IGMP, ARP, PPPoS, PPPoE, 6LowPAN (via IEEE 802.15.4, BLE or ZEP; since v2.1.0) 7 | - DHCP client, stateless DHCPv6 (since v2.1.0), DNS client (incl. mDNS hostname resolver), AutoIP/APIPA (Zeroconf), ACD (Address Conflict Detection), SNMP agent (v1, v2c, v3 (since v2.1.0), private MIB support & MIB compiler) 8 | - APIs: specialized APIs for enhanced performance & zero copy, optional Berkeley-alike socket API 9 | - Extended features: IP forwarding over multiple network interfaces 10 | - Extended TCP features: congestion control, RTT estimation and fast recovery/fast retransmit, sending SACKs (since v2.1.0), "altcp": nearly transparent TLS for any tcp pcb (since v2.1.0) 11 | - Addon applications: HTTP server (HTTPS via altcp), HTTP(S) client (since v2.1.0), SNTP client, SMTP client (SMTPS via altcp), ping, NetBIOS nameserver, mDNS responder, MQTT client (TLS support since v2.1.0), TFTP server, iPerf2 counterpart 12 | -------------------------------------------------------------------------------- /FILES: -------------------------------------------------------------------------------- 1 | contrib/ - lwIP examples, ports, and small apps (formerly http://git.savannah.gnu.org/cgit/lwip/lwip-contrib.git/) 2 | src/ - The source code for the lwIP TCP/IP stack. 3 | doc/ - The documentation for lwIP. 4 | test/ - Some code to test whether the sources do what they should. 5 | 6 | See also the FILES file in each subdirectory. 7 | -------------------------------------------------------------------------------- /codespell_changed_files.sh: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Kaspar Schleiser 2 | # Copyright 2014 Ludwig Knüpfer 3 | # Copyright 2014 Hinnerk van Bruinehsen 4 | # Copyright 2020 Jonathan Demeyer 5 | # 6 | # This file is subject to the terms and conditions of the GNU Lesser 7 | # General Public License v2.1. See the file LICENSE in the top level 8 | # directory for more details. 9 | 10 | changed_files() { 11 | : ${FILEREGEX:='\.([CcHh])$'} 12 | : ${EXCLUDE:=''} 13 | : ${DIFFFILTER:='ACMR'} 14 | 15 | DIFFFILTER="--diff-filter=${DIFFFILTER}" 16 | 17 | # select either all or only touched-in-branch files, filter through FILEREGEX 18 | if [ -z "${BASE_BRANCH}" ]; then 19 | FILES="$(git ls-tree -r --full-tree --name-only HEAD | grep -E ${FILEREGEX})" 20 | else 21 | FILES="$(git diff ${DIFFFILTER} --name-only ${BASE_BRANCH} | grep -E ${FILEREGEX})" 22 | fi 23 | 24 | # filter out negatives 25 | echo "${FILES}" | grep -v -E ${EXCLUDE} 26 | } 27 | -------------------------------------------------------------------------------- /codespell_check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2019 Alexandre Abadie 4 | # 5 | # This file is subject to the terms and conditions of the GNU Lesser 6 | # General Public License v2.1. See the file LICENSE in the top level 7 | # directory for more details. 8 | 9 | CODESPELL_CMD="codespell" 10 | 11 | if tput colors &> /dev/null && [ "$(tput colors)" -ge 8 ]; then 12 | CERROR=$'\033[1;31m' 13 | CRESET=$'\033[0m' 14 | else 15 | CERROR= 16 | CRESET= 17 | fi 18 | 19 | : "${LWIPBASE:=$(cd $(dirname $0)/; pwd)}" 20 | cd $LWIPBASE 21 | 22 | : "${LWIPTOOLS:=${LWIPBASE}}" 23 | . "${LWIPTOOLS}"/codespell_changed_files.sh 24 | 25 | FILEREGEX='\.([CcHh]|sh|py|md|txt)$' 26 | EXCLUDE='^(./contrib/apps/LwipMibCompiler/Mibs)' 27 | FILES=$(FILEREGEX=${FILEREGEX} EXCLUDE=${EXCLUDE} changed_files) 28 | 29 | if [ -z "${FILES}" ]; then 30 | exit 0 31 | fi 32 | 33 | ${CODESPELL_CMD} --version &> /dev/null || { 34 | printf "%s%s: cannot execute \"%s\"!%s\n" "${CERROR}" "$0" "${CODESPELL_CMD}" "${CRESET}" 35 | exit 1 36 | } 37 | 38 | CODESPELL_OPTS="-q 2" # Disable "WARNING: Binary file" 39 | CODESPELL_OPTS+=" --check-hidden" 40 | # Disable false positives "nd => and, 2nd", "ans => and", "tolen => token", 41 | # "ofo => of", "WAN => WANT", "mut => must, mutt, moot" 42 | CODESPELL_OPTS+=" --ignore-words-list=nd,ans,tolen,ofo,wan,mut " 43 | # propagate all options to codespell -> pass "-w" to this script to write changes 44 | CODESPELL_OPTS+="$@" 45 | 46 | # Filter-out all false positive raising "disabled due to" messages. 47 | ERRORS=$(${CODESPELL_CMD} ${CODESPELL_OPTS} ${FILES} | grep -ve "disabled due to") 48 | 49 | if [ -n "${ERRORS}" ] 50 | then 51 | printf "%sThere are typos in the following files:%s\n\n" "${CERROR}" "${CRESET}" 52 | printf "%s\n" "${ERRORS}" 53 | # TODO: return 1 when all typos are fixed 54 | exit 0 55 | else 56 | exit 0 57 | fi 58 | -------------------------------------------------------------------------------- /contrib/addons/ipv6_static_routing/README: -------------------------------------------------------------------------------- 1 | A simple routing table implementation for addition, deletion and lookup of IPv6 routes.  2 | 3 | APIs are: 4 | 1) s8_t ip6_add_route_entry(struct ip6_prefix *ip6_prefix, 5 |                             struct netif *netif, 6 |                             ip6_addr_t *gateway, 7 |                             s8_t *index); 8 | 9 | 2) err_t ip6_remove_route_entry(struct ip6_prefix *ip6_prefix); 10 | 11 | 3) s8_t ip6_find_route_entry(ip6_addr_t *ip6_dest_addr); 12 | 13 | 4) struct netif *ip6_static_route(ip6_addr_t *src, ip6_addr_t *dest); 14 | 15 | 5) ip6_addr_t *ip6_get_gateway(struct netif *netif, ip6_addr_t *dest); 16 | 17 | 6) struct ip6_route_entry *ip6_get_route_table(void); 18 | 19 | For route lookup from the table, The LWIP_HOOK_IP6_ROUTE hook in ip6_route(..) of ip6.c 20 | could be assigned to the ip6_static_route() API of this implementation to return the 21 | appropriate netif. 22 | 23 | -- The application can add routes using the API ip6_add_route_entry(..).  24 |    This API adds the ip6 prefix route into the static route table while 25 |    keeping all entries sorted in decreasing order of prefix length. 26 |    Subsequently, a linear search down the list can be performed to retrieve a 27 |    matching route entry for a Longest Prefix Match. 28 |    The prefix length is expected to be at an 8-bit boundary. While this is  29 |    a limitation, it would serve most practical purposes. 30 | 31 | -- The application can remove routes using the API ip6_remove_route_entry(..). 32 | 33 | -- The application can find a route entry for a specific address using the  34 |    ip6_find_route_entry() function which returns the index of the found entry.  35 |    This is used internally by the route lookup function ip6_static_route() API. 36 | 37 | -- To fetch the gateway IPv6 address for a specific destination IPv6  38 |    address and target netif, the application can call ip6_get_gateway(..). 39 | This API could be assigned to the LWIP_HOOK_ND6_GET_GW() if a gateway has 40 | been added as part of the ip6_add_route_entry(). 41 | 42 | -- To fetch a pointer to the head of the table, the application can call  43 |    ip6_get_route_table(). 44 | -------------------------------------------------------------------------------- /contrib/addons/netconn/external_resolve/dnssd.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * DNS-SD APIs used by LWIP_HOOK_NETCONN_EXTERNAL_RESOLVE 4 | * 5 | * @defgroup dnssd DNS-SD 6 | * @ingroup dns 7 | */ 8 | 9 | /* 10 | * Copyright (c) 2017 Joel Cunningham, Garmin International, Inc. 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: Joel Cunningham 38 | * 39 | */ 40 | #include "lwip/opt.h" 41 | 42 | #ifndef LWIP_HDR_DNSSD_H 43 | #define LWIP_HDR_DNSSD_H 44 | 45 | #include "lwip/err.h" 46 | #include "lwip/ip_addr.h" 47 | 48 | int lwip_dnssd_gethostbyname(const char *name, ip_addr_t *addr, u8_t addrtype, err_t *err); 49 | 50 | #endif /* LWIP_HDR_DNSSD_H */ 51 | -------------------------------------------------------------------------------- /contrib/addons/tcp_isn/tcp_isn.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 The MINIX 3 Project. 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 | * Author: David van Moolenbroek 28 | */ 29 | 30 | #ifndef LWIP_HDR_CONTRIB_ADDONS_TCP_ISN_H 31 | #define LWIP_HDR_CONTRIB_ADDONS_TCP_ISN_H 32 | 33 | #include "lwip/opt.h" 34 | #include "lwip/ip_addr.h" 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | void lwip_init_tcp_isn(u32_t boot_time, const u8_t *secret_16_bytes); 41 | u32_t lwip_hook_tcp_isn(const ip_addr_t *local_ip, u16_t local_port, 42 | const ip_addr_t *remote_ip, u16_t remote_port); 43 | 44 | #ifdef __cplusplus 45 | } 46 | #endif 47 | 48 | #endif /* LWIP_HDR_CONTRIB_ADDONS_TCP_ISN_H */ 49 | -------------------------------------------------------------------------------- /contrib/addons/tcp_md5/README: -------------------------------------------------------------------------------- 1 | This folder provides an example implementation of how to add custom tcp header 2 | options and custom socket options. 3 | 4 | It does this by implementing the (seldom used) tcp md5 signature. 5 | 6 | To enable it, add an LWIP_HOOK_FILENAME hook file, include tcp_md5.h in it and 7 | define these hooks: 8 | 9 | #define LWIP_HOOK_TCP_INPACKET_PCB(pcb, hdr, optlen, opt1len, opt2, p) tcp_md5_check_inpacket(pcb, hdr, optlen, opt1len, opt2, p) 10 | #define LWIP_HOOK_TCP_OPT_LENGTH_SEGMENT(pcb, internal_len) tcp_md5_get_additional_option_length(pcb, internal_len) 11 | #define LWIP_HOOK_TCP_ADD_TX_OPTIONS(p, hdr, pcb, opts) tcp_md5_add_tx_options(p, hdr, pcb, opts) 12 | #define LWIP_HOOK_SOCKETS_SETSOCKOPT(s, sock, level, optname, optval, optlen, err) tcp_md5_setsockopt_hook(sock, level, optname, optval, optlen, err) 13 | 14 | Then, in your sockets application, enable md5 signature on a socket like this: 15 | 16 | struct tcp_md5sig md5; 17 | struct sockaddr_storage addr_remote; /* Initialize this to remote address and port */ 18 | memcpy(&md5.tcpm_addr, &addr_remote, sizeof(addr_remote)); 19 | strcpy(md5.tcpm_key, key); /* this is the md5 key per connection */ 20 | md5.tcpm_keylen = strlen(key); 21 | if ((ret = setsockopt(sockfd, IPPROTO_TCP, TCP_MD5SIG, &md5, sizeof(md5))) < 0) { 22 | perror("setsockopt TCP_MD5SIG"); 23 | return; 24 | } 25 | 26 | After that, your connection (client) or all incoming connections (server) require 27 | tcp md5 signatures. 28 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/CCodeGeneration/CFile.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 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: Martin Hentschel 30 | * 31 | */ 32 | 33 | using System; 34 | 35 | namespace CCodeGeneration 36 | { 37 | public class CFile: CodeContainerBase 38 | { 39 | public CFile() 40 | { 41 | base.IncreaseLevel = false; 42 | } 43 | 44 | public void Save(CGenerator generator) 45 | { 46 | if (generator == null) 47 | { 48 | throw new ArgumentNullException("generator"); 49 | } 50 | 51 | this.GenerateCode(0, generator); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/CCodeGeneration/Code.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 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: Martin Hentschel 30 | * 31 | */ 32 | 33 | namespace CCodeGeneration 34 | { 35 | public class Code: CodeElement 36 | { 37 | public string Code_ { get; set; } 38 | 39 | public Code() 40 | { 41 | } 42 | 43 | public Code(string code) 44 | { 45 | this.Code_ = code; 46 | } 47 | 48 | public override void GenerateCode(int level, CGenerator generator) 49 | { 50 | generator.IndentLine(level); 51 | generator.WriteMultilineString(this.Code_, level); 52 | generator.WriteNewLine(); 53 | } 54 | 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/CCodeGeneration/CodeElement.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 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: Martin Hentschel 30 | * 31 | */ 32 | 33 | namespace CCodeGeneration 34 | { 35 | public class CodeElement 36 | { 37 | public virtual void GenerateCode(int level, CGenerator generator) 38 | { 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/CCodeGeneration/PlainText.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 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: Martin Hentschel 30 | * 31 | */ 32 | 33 | namespace CCodeGeneration 34 | { 35 | public class PlainText : CodeElement 36 | { 37 | public string Value { get; set; } 38 | 39 | public PlainText(string value) 40 | { 41 | this.Value = value; 42 | } 43 | 44 | public override void GenerateCode(int level, CGenerator generator) 45 | { 46 | generator.WriteMultilineString(this.Value); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/CCodeGeneration/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // Allgemeine Informationen über eine Assembly werden über die folgenden 6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, 7 | // die mit einer Assembly verknüpft sind. 8 | [assembly: AssemblyTitle("CCodeGeneration")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("CCodeGeneration")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar 18 | // für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von 19 | // COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. 20 | [assembly: ComVisible(false)] 21 | 22 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird 23 | [assembly: Guid("8f07a0fa-86f4-48a0-97c7-f94fc5c3f103")] 24 | 25 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: 26 | // 27 | // Hauptversion 28 | // Nebenversion 29 | // Buildnummer 30 | // Revision 31 | // 32 | // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern 33 | // übernehmen, indem Sie "*" eingeben: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/LwipMibCompiler/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // Allgemeine Informationen über eine Assembly werden über die folgenden 6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, 7 | // die mit einer Assembly verknüpft sind. 8 | [assembly: AssemblyTitle("ConsoleApplication28")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ConsoleApplication28")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar 18 | // für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von 19 | // COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. 20 | [assembly: ComVisible(false)] 21 | 22 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird 23 | [assembly: Guid("0abf7541-6a96-43cd-9e24-462e074b2c96")] 24 | 25 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: 26 | // 27 | // Hauptversion 28 | // Nebenversion 29 | // Buildnummer 30 | // Revision 31 | // 32 | // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern 33 | // übernehmen, indem Sie "*" eingeben: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/LwipMibCompiler/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/LwipSnmpCodeGeneration/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // Allgemeine Informationen über eine Assembly werden über die folgenden 6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, 7 | // die mit einer Assembly verknüpft sind. 8 | [assembly: AssemblyTitle("LwipSnmpCodeGeneration")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("LwipSnmpCodeGeneration")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar 18 | // für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von 19 | // COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. 20 | [assembly: ComVisible(false)] 21 | 22 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird 23 | [assembly: Guid("8cfbbb8b-dfbb-4dd5-80c9-e07845dd58c9")] 24 | 25 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: 26 | // 27 | // Hauptversion 28 | // Nebenversion 29 | // Buildnummer 30 | // Revision 31 | // 32 | // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern 33 | // übernehmen, indem Sie "*" eingeben: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/MibViewer/Program.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 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: Martin Hentschel 30 | * 31 | */ 32 | 33 | using System; 34 | using System.Windows.Forms; 35 | 36 | namespace LwipMibViewer 37 | { 38 | static class Program 39 | { 40 | /// 41 | /// Der Haupteinstiegspunkt für die Anwendung. 42 | /// 43 | [STAThread] 44 | static void Main() 45 | { 46 | Application.EnableVisualStyles(); 47 | Application.SetCompatibleTextRenderingDefault(false); 48 | Application.Run(new FormMain()); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/MibViewer/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // Allgemeine Informationen über eine Assembly werden über die folgenden 6 | // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, 7 | // die mit einer Assembly verknüpft sind. 8 | [assembly: AssemblyTitle("LwipMibViewer")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("LwipMibViewer")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar 18 | // für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von 19 | // COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest. 20 | [assembly: ComVisible(false)] 21 | 22 | // Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird 23 | [assembly: Guid("7ffbd1c1-1c64-45bb-b243-2400446c649d")] 24 | 25 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: 26 | // 27 | // Hauptversion 28 | // Nebenversion 29 | // Buildnummer 30 | // Revision 31 | // 32 | // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern 33 | // übernehmen, indem Sie "*" eingeben: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/MibViewer/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Dieser Code wurde von einem Tool generiert. 4 | // Laufzeitversion:4.0.30319.225 5 | // 6 | // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn 7 | // der Code erneut generiert wird. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace LwipMibViewer.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/MibViewer/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/MibViewer/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/Mibs/RFC-1215: -------------------------------------------------------------------------------- 1 | RFC-1215 DEFINITIONS ::= BEGIN 2 | 3 | IMPORTS 4 | ObjectName 5 | FROM RFC1155-SMI; 6 | 7 | TRAP-TYPE MACRO ::= 8 | BEGIN 9 | TYPE NOTATION ::= "ENTERPRISE" value 10 | (enterprise OBJECT IDENTIFIER) 11 | VarPart 12 | DescrPart 13 | ReferPart 14 | VALUE NOTATION ::= value (VALUE INTEGER) 15 | 16 | VarPart ::= 17 | "VARIABLES" "{" VarTypes "}" 18 | | empty 19 | VarTypes ::= 20 | VarType | VarTypes "," VarType 21 | VarType ::= 22 | value (vartype ObjectName) 23 | 24 | DescrPart ::= 25 | "DESCRIPTION" value (description DisplayString) 26 | | empty 27 | 28 | ReferPart ::= 29 | "REFERENCE" value (reference DisplayString) 30 | | empty 31 | 32 | END 33 | 34 | END 35 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/Entities/AgentCapabilities.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: lextm 4 | * Date: 2008/5/31 5 | * Time: 13:18 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | 10 | namespace Lextm.SharpSnmpLib.Mib.Elements.Entities 11 | { 12 | /// 13 | /// The AGENT-CAPABILITIES construct is used to specify implementation characteristics of an SNMP agent sub-system with respect to object types and events. 14 | /// 15 | public sealed class AgentCapabilities : EntityBase 16 | { 17 | /// 18 | /// Creates an instance. 19 | /// 20 | /// 21 | /// 22 | /// 23 | public AgentCapabilities(IModule module, SymbolList preAssignSymbols, ISymbolEnumerator symbols) 24 | : base(module, preAssignSymbols, symbols) 25 | { 26 | } 27 | 28 | } 29 | } -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/Entities/EntityBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Lextm.SharpSnmpLib.Mib.Elements.Entities 4 | { 5 | public abstract class EntityBase: IEntity 6 | { 7 | private readonly IModule _module; 8 | private string _parent; 9 | private readonly uint _value; 10 | private readonly string _name; 11 | 12 | public EntityBase(IModule module, SymbolList preAssignSymbols, ISymbolEnumerator symbols) 13 | { 14 | _module = module; 15 | _name = preAssignSymbols[0].ToString(); 16 | 17 | Lexer.ParseOidValue(symbols, out _parent, out _value); 18 | } 19 | 20 | public IModule Module 21 | { 22 | get { return _module; } 23 | } 24 | 25 | public string Parent 26 | { 27 | get { return _parent; } 28 | set { _parent = value; } 29 | } 30 | 31 | public uint Value 32 | { 33 | get { return _value; } 34 | } 35 | 36 | public string Name 37 | { 38 | get { return _name; } 39 | } 40 | 41 | public virtual string Description 42 | { 43 | get { return string.Empty; } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/Entities/IEntity.cs: -------------------------------------------------------------------------------- 1 | // Entity interface. 2 | // Copyright (C) 2008-2010 Malcolm Crowe, Lex Li, and other contributors. 3 | // 4 | // This library is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU Lesser General Public 6 | // License as published by the Free Software Foundation; either 7 | // version 2.1 of the License, or (at your option) any later version. 8 | // 9 | // This library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | // Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public 15 | // License along with this library; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | /* 19 | * Created by SharpDevelop. 20 | * User: lextm 21 | * Date: 2008/5/19 22 | * Time: 20:10 23 | * 24 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 25 | */ 26 | 27 | using System; 28 | 29 | namespace Lextm.SharpSnmpLib.Mib.Elements.Entities 30 | { 31 | /// 32 | /// Basic interface for all elements building up the MIB tree, thus having an OID as value. 33 | /// 34 | public interface IEntity : IDeclaration 35 | { 36 | /// 37 | /// Parent name. 38 | /// 39 | string Parent 40 | { 41 | get; 42 | set; 43 | } 44 | 45 | /// 46 | /// Value. 47 | /// 48 | uint Value 49 | { 50 | get; 51 | } 52 | 53 | /// 54 | /// Gets the description. 55 | /// 56 | /// The description. 57 | string Description 58 | { 59 | get; 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/Entities/ModuleCompliance.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: lextm 4 | * Date: 2008/5/21 5 | * Time: 19:35 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | 10 | namespace Lextm.SharpSnmpLib.Mib.Elements.Entities 11 | { 12 | /// 13 | /// Description of ModuleComplianceNode. 14 | /// 15 | public sealed class ModuleCompliance : EntityBase 16 | { 17 | public ModuleCompliance(IModule module, SymbolList preAssignSymbols, ISymbolEnumerator symbols) 18 | : base(module, preAssignSymbols, symbols) 19 | { 20 | } 21 | 22 | } 23 | } -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/Entities/ModuleIdentity.cs: -------------------------------------------------------------------------------- 1 | namespace Lextm.SharpSnmpLib.Mib.Elements.Entities 2 | { 3 | public sealed class ModuleIdentity : EntityBase 4 | { 5 | public ModuleIdentity(IModule module, SymbolList preAssignSymbols, ISymbolEnumerator symbols) 6 | : base(module, preAssignSymbols, symbols) 7 | { 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/Entities/NotificationGroup.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: lextm 4 | * Date: 2008/5/21 5 | * Time: 19:34 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | 10 | namespace Lextm.SharpSnmpLib.Mib.Elements.Entities 11 | { 12 | /// 13 | /// Description of NotificationGroupNode. 14 | /// 15 | public sealed class NotificationGroup : EntityBase 16 | { 17 | public NotificationGroup(IModule module, SymbolList preAssignSymbols, ISymbolEnumerator symbols) 18 | : base(module, preAssignSymbols, symbols) 19 | { 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/Entities/NotificationType.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Lextm.SharpSnmpLib.Mib.Elements.Entities 3 | { 4 | public sealed class NotificationType : EntityBase 5 | { 6 | public NotificationType(IModule module, SymbolList preAssignSymbols, ISymbolEnumerator symbols) 7 | : base(module, preAssignSymbols, symbols) 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/Entities/ObjectGroup.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: lextm 4 | * Date: 2008/5/21 5 | * Time: 19:27 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | 10 | namespace Lextm.SharpSnmpLib.Mib.Elements.Entities 11 | { 12 | /// 13 | /// Description of ObjectGroupNode. 14 | /// 15 | public sealed class ObjectGroup : EntityBase 16 | { 17 | public ObjectGroup(IModule module, SymbolList preAssignSymbols, ISymbolEnumerator symbols) 18 | : base(module, preAssignSymbols, symbols) 19 | { 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/Entities/ObjectIdentity.cs: -------------------------------------------------------------------------------- 1 | 2 | namespace Lextm.SharpSnmpLib.Mib.Elements.Entities 3 | { 4 | /// 5 | /// Object identifier node. 6 | /// 7 | public sealed class ObjectIdentity : EntityBase 8 | { 9 | 10 | /// 11 | /// Creates a . 12 | /// 13 | /// Module name 14 | /// Header 15 | /// Lexer 16 | public ObjectIdentity(IModule module, SymbolList preAssignSymbols, ISymbolEnumerator symbols) 17 | : base(module, preAssignSymbols, symbols) 18 | { 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/Entities/OidValueAssignment.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: lextm 4 | * Date: 2008/5/17 5 | * Time: 20:49 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | 10 | using System; 11 | 12 | namespace Lextm.SharpSnmpLib.Mib.Elements.Entities 13 | { 14 | /// 15 | /// Object identifier node. 16 | /// 17 | public sealed class OidValueAssignment : EntityBase 18 | { 19 | /// 20 | /// Creates a . 21 | /// 22 | /// Module 23 | /// Name 24 | /// Lexer 25 | public OidValueAssignment(IModule module, SymbolList preAssignSymbols, ISymbolEnumerator symbols) 26 | : base(module, preAssignSymbols, symbols) 27 | { 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/Exports.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: lextm 4 | * Date: 2008/6/7 5 | * Time: 17:34 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | 10 | using System.Collections.Generic; 11 | 12 | namespace Lextm.SharpSnmpLib.Mib.Elements 13 | { 14 | /// 15 | /// Description of Exports. 16 | /// 17 | public sealed class Exports: IElement 18 | { 19 | private IModule _module; 20 | private readonly IList _types = new List(); 21 | 22 | public Exports(IModule module, ISymbolEnumerator s) 23 | { 24 | _module = module; 25 | 26 | Symbol previous = null; 27 | Symbol current; 28 | do 29 | { 30 | current = s.NextSymbol(); 31 | 32 | if (current == Symbol.EOL) 33 | { 34 | continue; 35 | } 36 | else if (((current == Symbol.Comma) || (current == Symbol.Semicolon)) && (previous != null)) 37 | { 38 | previous.AssertIsValidIdentifier(); 39 | _types.Add(previous.ToString()); 40 | } 41 | 42 | previous = current; 43 | } 44 | while (current != Symbol.Semicolon); 45 | } 46 | 47 | #region IElement Member 48 | 49 | public IModule Module 50 | { 51 | get { return _module; } 52 | } 53 | 54 | #endregion 55 | } 56 | } -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/IDeclaration.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Lextm.SharpSnmpLib.Mib.Elements 7 | { 8 | public interface IDeclaration: IElement 9 | { 10 | /// 11 | /// Name. 12 | /// 13 | string Name 14 | { 15 | get; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/IElement.cs: -------------------------------------------------------------------------------- 1 | // Construct interface. 2 | // Copyright (C) 2008-2010 Malcolm Crowe, Lex Li, and other contributors. 3 | // 4 | // This library is free software; you can redistribute it and/or 5 | // modify it under the terms of the GNU Lesser General Public 6 | // License as published by the Free Software Foundation; either 7 | // version 2.1 of the License, or (at your option) any later version. 8 | // 9 | // This library is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | // Lesser General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU Lesser General Public 15 | // License along with this library; if not, write to the Free Software 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 | 18 | namespace Lextm.SharpSnmpLib.Mib.Elements 19 | { 20 | /// 21 | /// Construct interface. 22 | /// 23 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1040:AvoidEmptyInterfaces")] 24 | public interface IElement 25 | { 26 | /// 27 | /// Containing module. 28 | /// 29 | IModule Module 30 | { 31 | get; 32 | } 33 | 34 | } 35 | } -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/ITypeReferrer.cs: -------------------------------------------------------------------------------- 1 | using Lextm.SharpSnmpLib.Mib.Elements.Types; 2 | 3 | namespace Lextm.SharpSnmpLib.Mib.Elements 4 | { 5 | public interface ITypeReferrer 6 | { 7 | ITypeAssignment ReferredType { get; set; } 8 | ITypeAssignment BaseType { get; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/ImportsFrom.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: lextm 4 | * Date: 2008/5/31 5 | * Time: 12:07 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | 10 | using System.Collections.Generic; 11 | 12 | namespace Lextm.SharpSnmpLib.Mib.Elements 13 | { 14 | public sealed class ImportsFrom 15 | { 16 | private readonly string _module; 17 | private readonly List _types = new List(); 18 | 19 | public ImportsFrom(Symbol last, ISymbolEnumerator symbols) 20 | { 21 | Symbol previous = last; 22 | Symbol current; 23 | while ((current = symbols.NextSymbol()) != Symbol.From) 24 | { 25 | if (current == Symbol.EOL) 26 | { 27 | continue; 28 | } 29 | 30 | if (current == Symbol.Comma) 31 | { 32 | previous.AssertIsValidIdentifier(); 33 | _types.Add(previous.ToString()); 34 | } 35 | 36 | previous = current; 37 | } 38 | 39 | previous.AssertIsValidIdentifier(); 40 | _types.Add(previous.ToString()); 41 | 42 | _module = symbols.NextSymbol().ToString().ToUpperInvariant(); // module names are uppercase 43 | } 44 | 45 | public string Module 46 | { 47 | get { return _module; } 48 | } 49 | 50 | public IList Types 51 | { 52 | get { return _types; } 53 | } 54 | 55 | public override string ToString() 56 | { 57 | return string.Join(", ", _types.ToArray()) + " FROM " + _module; 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/TrapType.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: lextm 4 | * Date: 2008/5/31 5 | * Time: 12:20 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | 10 | namespace Lextm.SharpSnmpLib.Mib.Elements 11 | { 12 | public sealed class TrapType : IDeclaration 13 | { 14 | private readonly IModule _module; 15 | private readonly string _name; 16 | private readonly int _value; 17 | 18 | public TrapType(IModule module, SymbolList preAssignSymbols, ISymbolEnumerator symbols) 19 | { 20 | _module = module; 21 | _name = preAssignSymbols[0].ToString(); 22 | 23 | Symbol valueSymbol = symbols.NextNonEOLSymbol(); 24 | 25 | bool succeeded = int.TryParse(valueSymbol.ToString(), out _value); 26 | valueSymbol.Assert(succeeded, "not a decimal"); 27 | } 28 | 29 | public int Value 30 | { 31 | get { return _value; } 32 | } 33 | 34 | #region IDeclaration Member 35 | 36 | public IModule Module 37 | { 38 | get { return _module; } 39 | } 40 | 41 | public string Name 42 | { 43 | get { return _name; } 44 | } 45 | 46 | #endregion 47 | } 48 | } -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/Types/BaseType.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace Lextm.SharpSnmpLib.Mib.Elements.Types 3 | { 4 | public abstract class BaseType : ITypeAssignment 5 | { 6 | private IModule _module; 7 | private string _name; 8 | 9 | protected BaseType(IModule module, string name) 10 | { 11 | _module = module; 12 | _name = name; 13 | } 14 | 15 | public virtual IModule Module 16 | { 17 | // differentiate between: 18 | // FddiTimeNano ::= INTEGER (0..2147483647) 19 | // which is an IntegerType which appears under Types in a MibModule and therefore has a name and module 20 | // and 21 | // SYNTAX INTEGER (0..2147483647) 22 | // which is also an IntegerType but not defined as a separate type and therefore has NO name and NO module 23 | get 24 | { 25 | if (!string.IsNullOrEmpty(_name)) 26 | { 27 | return _module; 28 | } 29 | else 30 | { 31 | return null; 32 | } 33 | } 34 | protected set { _module = value; } 35 | } 36 | 37 | public virtual string Name 38 | { 39 | get 40 | { 41 | if (!string.IsNullOrEmpty(_name)) 42 | { 43 | return _name; 44 | } 45 | else 46 | { 47 | return "{ Implicit Base Type }"; 48 | } 49 | } 50 | protected set { _name = value; } 51 | } 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/Types/BitsType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Lextm.SharpSnmpLib.Mib.Elements.Types 5 | { 6 | public class BitsType : BaseType 7 | { 8 | private ValueMap _map; 9 | 10 | public BitsType(IModule module, string name, ISymbolEnumerator symbols) 11 | : base(module, name) 12 | { 13 | _map = Lexer.DecodeEnumerations(symbols); 14 | } 15 | 16 | public ValueMap Map 17 | { 18 | get { return _map; } 19 | } 20 | 21 | public string this[int value] 22 | { 23 | get { return _map[value]; } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/Types/Choice.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: lextm 4 | * Date: 2008/5/31 5 | * Time: 11:39 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | 10 | namespace Lextm.SharpSnmpLib.Mib.Elements.Types 11 | { 12 | /// 13 | /// The CHOICE type represents a list of alternatives.. 14 | /// 15 | public sealed class Choice : BaseType 16 | { 17 | /// 18 | /// Creates a instance. 19 | /// 20 | /// 21 | /// 22 | /// 23 | public Choice(IModule module, string name, ISymbolEnumerator symbols) 24 | : base(module, name) 25 | { 26 | while (symbols.NextNonEOLSymbol() != Symbol.OpenBracket) 27 | { 28 | } 29 | 30 | while (symbols.NextNonEOLSymbol() != Symbol.CloseBracket) 31 | { 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/Types/ITypeAssignment.cs: -------------------------------------------------------------------------------- 1 | namespace Lextm.SharpSnmpLib.Mib.Elements.Types 2 | { 3 | public interface ITypeAssignment : IDeclaration 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/Types/IpAddressType.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace Lextm.SharpSnmpLib.Mib.Elements.Types 3 | { 4 | public class IpAddressType : OctetStringType 5 | { 6 | public IpAddressType(IModule module, string name, ISymbolEnumerator symbols) 7 | : base(module, name, symbols) 8 | { 9 | if (this.Size.Count != 0) 10 | { 11 | throw new MibException("Size definition not allowed for IpAddress type!"); 12 | } 13 | 14 | // IpAddress type is defined as: 15 | // IpAddress ::= 16 | // [APPLICATION 0] 17 | // IMPLICIT OCTET STRING (SIZE (4)) 18 | this.Size.Add(new ValueRange(4, null)); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/Types/Macro.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace Lextm.SharpSnmpLib.Mib.Elements.Types 3 | { 4 | public sealed class Macro : ITypeAssignment 5 | { 6 | private IModule _module; 7 | private string _name; 8 | 9 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1804:RemoveUnusedLocals", MessageId = "temp")] 10 | public Macro(IModule module, SymbolList preAssignSymbols, ISymbolEnumerator symbols) 11 | { 12 | _module = module; 13 | _name = preAssignSymbols[0].ToString(); 14 | 15 | while (symbols.NextNonEOLSymbol() != Symbol.Begin) 16 | { 17 | } 18 | 19 | while (symbols.NextNonEOLSymbol() != Symbol.End) 20 | { 21 | } 22 | } 23 | 24 | public IModule Module 25 | { 26 | get { return _module; } 27 | } 28 | 29 | public string Name 30 | { 31 | get { return _name; } 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/Types/ObjectIdentifierType.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace Lextm.SharpSnmpLib.Mib.Elements.Types 3 | { 4 | public class ObjectIdentifierType : BaseType 5 | { 6 | public ObjectIdentifierType(IModule module, string name, ISymbolEnumerator symbols) 7 | : base(module, name) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/Types/OctetStringType.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Lextm.SharpSnmpLib.Mib.Elements.Types 4 | { 5 | public class OctetStringType : BaseType 6 | { 7 | private ValueRanges _size; 8 | 9 | public OctetStringType(IModule module, string name, ISymbolEnumerator symbols) 10 | : base(module, name) 11 | { 12 | Symbol current = symbols.NextNonEOLSymbol(); 13 | if (current == Symbol.OpenParentheses) 14 | { 15 | symbols.PutBack(current); 16 | _size = Lexer.DecodeRanges(symbols); 17 | current.Assert(_size.IsSizeDeclaration, "SIZE keyword is required for ranges of octet string!"); 18 | } 19 | else 20 | { 21 | symbols.PutBack(current); 22 | _size = new ValueRanges(isSizeDecl: true); 23 | } 24 | } 25 | 26 | public ValueRanges Size 27 | { 28 | get { return _size; } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/Types/OpaqueType.cs: -------------------------------------------------------------------------------- 1 |  2 | namespace Lextm.SharpSnmpLib.Mib.Elements.Types 3 | { 4 | public class OpaqueType : OctetStringType 5 | { 6 | public OpaqueType(IModule module, string name, ISymbolEnumerator symbols) 7 | : base(module, name, symbols) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/Types/Sequence.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: lextm 4 | * Date: 2008/5/21 5 | * Time: 19:43 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | 10 | 11 | namespace Lextm.SharpSnmpLib.Mib.Elements.Types 12 | { 13 | /// 14 | /// The SEQUENCE type represents a set of specified types. This is roughly analogous to a struct in C. 15 | /// 16 | public sealed class Sequence : BaseType 17 | { 18 | /// 19 | /// Creates a instance. 20 | /// 21 | /// The module. 22 | /// The name. 23 | /// The enumerator. 24 | public Sequence(IModule module, string name, ISymbolEnumerator symbols) 25 | : base(module, name) 26 | { 27 | // parse between ( ) 28 | Symbol temp = symbols.NextNonEOLSymbol(); 29 | int bracketSection = 0; 30 | temp.Expect(Symbol.OpenBracket); 31 | bracketSection++; 32 | while (bracketSection > 0) 33 | { 34 | temp = symbols.NextNonEOLSymbol(); 35 | if (temp == Symbol.OpenBracket) 36 | { 37 | bracketSection++; 38 | } 39 | else if (temp == Symbol.CloseBracket) 40 | { 41 | bracketSection--; 42 | } 43 | } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Elements/Types/SequenceOf.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Lextm.SharpSnmpLib.Mib.Elements.Types 4 | { 5 | /// 6 | /// The SEQUENCE OF type represents a list of data sets.. 7 | /// 8 | public sealed class SequenceOf : BaseType 9 | { 10 | private string _type; 11 | 12 | public SequenceOf(IModule module, string name, ISymbolEnumerator sym) 13 | : base(module, name) 14 | { 15 | _type = sym.NextNonEOLSymbol().ToString(); 16 | } 17 | 18 | public string Type 19 | { 20 | get { return _type; } 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/ISymbolEnumerator.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Lextm.SharpSnmpLib.Mib 4 | { 5 | public interface ISymbolEnumerator: IEnumerator 6 | { 7 | bool PutBack(Symbol item); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/MaxAccess.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Lextm.SharpSnmpLib.Mib 7 | { 8 | public enum MaxAccess 9 | { 10 | notAccessible, 11 | accessibleForNotify, 12 | readOnly, 13 | readWrite, 14 | readCreate 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/MibDocument.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: lextm 4 | * Date: 2008/5/17 5 | * Time: 17:38 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | 10 | using System.Collections.Generic; 11 | 12 | namespace Lextm.SharpSnmpLib.Mib 13 | { 14 | /// 15 | /// MIB document. 16 | /// 17 | public sealed class MibDocument 18 | { 19 | private readonly List _modules = new List(); 20 | 21 | /// 22 | /// Initializes a new instance of the class. 23 | /// 24 | /// The file. 25 | public MibDocument(string file) 26 | : this(new Lexer(file)) 27 | { 28 | } 29 | 30 | /// 31 | /// Initializes a new instance of the class. 32 | /// 33 | /// The lexer. 34 | public MibDocument(Lexer lexer) 35 | { 36 | ISymbolEnumerator symbols = lexer.GetEnumerator(); 37 | 38 | Symbol current; 39 | while ((current = symbols.NextNonEOLSymbol()) != null) 40 | { 41 | symbols.PutBack(current); 42 | _modules.Add(new MibModule(symbols)); 43 | } 44 | } 45 | 46 | /// 47 | /// containing in this document. 48 | /// 49 | public IList Modules 50 | { 51 | get 52 | { 53 | return _modules; 54 | } 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/ObjectIdentifier.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text; 3 | 4 | namespace Lextm.SharpSnmpLib.Mib 5 | { 6 | public class ObjectIdentifier: List> 7 | { 8 | public void Add(string name, uint oid) 9 | { 10 | this.Add(new KeyValuePair(name, oid)); 11 | } 12 | 13 | public void Prepend(string name, uint oid) 14 | { 15 | this.Insert(0, new KeyValuePair(name, oid)); 16 | } 17 | 18 | public void Insert(int index, string name, uint oid) 19 | { 20 | this.Insert(index, new KeyValuePair(name, oid)); 21 | } 22 | 23 | public string GetOidString() 24 | { 25 | StringBuilder result = new StringBuilder(); 26 | 27 | foreach (KeyValuePair level in this) 28 | { 29 | result.Append(level.Value); 30 | result.Append('.'); 31 | } 32 | 33 | if (result.Length > 0) 34 | { 35 | result.Length--; 36 | } 37 | 38 | return result.ToString(); 39 | } 40 | 41 | public uint[] GetOidValues() 42 | { 43 | List result = new List(); 44 | 45 | foreach (KeyValuePair level in this) 46 | { 47 | result.Add(level.Value); 48 | } 49 | 50 | return result.ToArray(); 51 | } 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/Status.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Lextm.SharpSnmpLib.Mib 7 | { 8 | public enum Status 9 | { 10 | current, 11 | deprecated, 12 | obsolete, 13 | mandatory, 14 | optional 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/Mib/ValueRange.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Lextm.SharpSnmpLib.Mib 5 | { 6 | public class ValueRanges: List 7 | { 8 | public bool IsSizeDeclaration { get; internal set; } 9 | 10 | public ValueRanges(bool isSizeDecl = false) 11 | { 12 | IsSizeDeclaration = isSizeDecl; 13 | } 14 | 15 | public bool Contains(Int64 value) 16 | { 17 | foreach (ValueRange range in this) 18 | { 19 | if (range.Contains(value)) 20 | { 21 | return true; 22 | } 23 | } 24 | 25 | return false; 26 | } 27 | } 28 | 29 | public class ValueRange 30 | { 31 | private readonly Int64 _start; 32 | private readonly Int64? _end; 33 | 34 | public ValueRange(Int64 first, Int64? second) 35 | { 36 | _start = first; 37 | _end = second; 38 | } 39 | 40 | public Int64 Start 41 | { 42 | get { return _start; } 43 | } 44 | 45 | public Int64? End 46 | { 47 | get { return _end; } 48 | } 49 | 50 | public bool IntersectsWith(ValueRange other) 51 | { 52 | if (this._end == null) 53 | { 54 | return other.Contains(this._start); 55 | } 56 | else if (other._end == null) 57 | { 58 | return this.Contains(other._start); 59 | } 60 | 61 | return (this._start <= other.End) && (this._end >= other._start); 62 | } 63 | 64 | public bool Contains(Int64 value) 65 | { 66 | if (_end == null) 67 | { 68 | return value == _start; 69 | } 70 | else 71 | { 72 | return (_start <= value) && (value <= _end); 73 | } 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/readme.txt: -------------------------------------------------------------------------------- 1 | See docs in src/apps/snmp/snmp_core.c. 2 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/SharpSnmpLib/sharpsnmplib.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaybhargav/lwip_nat/399b9908193fb86357424c996c5d47e7a51e5f6b/contrib/apps/LwipMibCompiler/SharpSnmpLib/sharpsnmplib.snk -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/example/compile_udp_mib.cmd: -------------------------------------------------------------------------------- 1 | ..\LwipMibCompiler\bin\Debug\LwipMibCompiler.exe ..\Mibs\UDP-MIB .\ ..\Mibs\ 2 | -------------------------------------------------------------------------------- /contrib/apps/LwipMibCompiler/example/compile_udp_mib.sh: -------------------------------------------------------------------------------- 1 | ../LwipMibCompiler/bin/Debug/LwipMibCompiler.exe ../Mibs/UDP-MIB ./ ../Mibs/ 2 | -------------------------------------------------------------------------------- /contrib/apps/chargen/chargen.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_CHARGEN_H 2 | #define LWIP_CHARGEN_H 3 | 4 | #include "lwip/opt.h" 5 | 6 | #if LWIP_SOCKET 7 | 8 | void chargen_init(void); 9 | 10 | #endif /* LWIP_SOCKET */ 11 | 12 | #endif /* LWIP_CHARGEN_H */ 13 | -------------------------------------------------------------------------------- /contrib/apps/httpserver/README: -------------------------------------------------------------------------------- 1 | HTTPSERVER 2 | 3 | This is a demonstration of how to make the most basic kind 4 | of server using lWIP. 5 | 6 | * httpserver-raw.c - uses raw TCP calls (coming soon!) 7 | 8 | * httpserver-netconn.c - uses netconn and netbuf API 9 | 10 | This code updates the examples in Adam Dunkel's original 11 | lwIP documentation to match changes in the code since that 12 | PDF release. 13 | -------------------------------------------------------------------------------- /contrib/apps/httpserver/httpserver-netconn.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HTTPSERVER_NETCONN_H 2 | #define LWIP_HTTPSERVER_NETCONN_H 3 | 4 | void http_server_netconn_init(void); 5 | 6 | #endif /* LWIP_HTTPSERVER_NETCONN_H */ 7 | -------------------------------------------------------------------------------- /contrib/apps/netio/netio.c: -------------------------------------------------------------------------------- 1 | #include "netio.h" 2 | 3 | #include "lwip/opt.h" 4 | #include "lwip/tcp.h" 5 | 6 | /* See http://www.nwlab.net/art/netio/netio.html to get the netio tool */ 7 | 8 | #if LWIP_TCP && LWIP_CALLBACK_API 9 | static err_t 10 | netio_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err) 11 | { 12 | LWIP_UNUSED_ARG(arg); 13 | 14 | if (err == ERR_OK && p != NULL) { 15 | tcp_recved(pcb, p->tot_len); 16 | pbuf_free(p); 17 | } else { 18 | pbuf_free(p); 19 | } 20 | 21 | if (err == ERR_OK && p == NULL) { 22 | tcp_arg(pcb, NULL); 23 | tcp_sent(pcb, NULL); 24 | tcp_recv(pcb, NULL); 25 | tcp_close(pcb); 26 | } 27 | 28 | return ERR_OK; 29 | } 30 | 31 | static err_t 32 | netio_accept(void *arg, struct tcp_pcb *pcb, err_t err) 33 | { 34 | LWIP_UNUSED_ARG(arg); 35 | LWIP_UNUSED_ARG(err); 36 | 37 | if (pcb != NULL) { 38 | tcp_arg(pcb, NULL); 39 | tcp_sent(pcb, NULL); 40 | tcp_recv(pcb, netio_recv); 41 | } 42 | return ERR_OK; 43 | } 44 | 45 | void 46 | netio_init(void) 47 | { 48 | struct tcp_pcb *pcb; 49 | 50 | pcb = tcp_new_ip_type(IPADDR_TYPE_ANY); 51 | tcp_bind(pcb, IP_ANY_TYPE, 18767); 52 | pcb = tcp_listen(pcb); 53 | tcp_accept(pcb, netio_accept); 54 | } 55 | #endif /* LWIP_TCP && LWIP_CALLBACK_API */ 56 | -------------------------------------------------------------------------------- /contrib/apps/netio/netio.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_NETIO_H 2 | #define LWIP_NETIO_H 3 | 4 | void netio_init(void); 5 | 6 | #endif /* LWIP_NETIO_H */ 7 | -------------------------------------------------------------------------------- /contrib/apps/ping/ping.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_PING_H 2 | #define LWIP_PING_H 3 | 4 | #include "lwip/ip_addr.h" 5 | 6 | /** 7 | * PING_USE_SOCKETS: Set to 1 to use sockets, otherwise the raw api is used 8 | */ 9 | #ifndef PING_USE_SOCKETS 10 | #define PING_USE_SOCKETS LWIP_SOCKET 11 | #endif 12 | 13 | void ping_init(const ip_addr_t* ping_addr); 14 | 15 | #if !PING_USE_SOCKETS 16 | void ping_send_now(void); 17 | #endif /* !PING_USE_SOCKETS */ 18 | 19 | #endif /* LWIP_PING_H */ 20 | -------------------------------------------------------------------------------- /contrib/apps/rtp/rtp.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_RTP_H 2 | #define LWIP_RTP_H 3 | 4 | #if LWIP_SOCKET && LWIP_IGMP 5 | void rtp_init(void); 6 | #endif /* LWIP_SOCKET && LWIP_IGMP */ 7 | 8 | #endif /* LWIP_RTP_H */ 9 | -------------------------------------------------------------------------------- /contrib/apps/shell/shell.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_SHELL_H 33 | #define LWIP_SHELL_H 34 | 35 | void shell_init(void); 36 | 37 | #endif /* LWIP_SHELL_H */ 38 | -------------------------------------------------------------------------------- /contrib/apps/socket_examples/socket_examples.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_SOCKET_EXAMPLES_H 2 | #define LWIP_SOCKET_EXAMPLES_H 3 | 4 | void socket_examples_init(void); 5 | 6 | #endif /* LWIP_SOCKET_EXAMPLES_H */ 7 | -------------------------------------------------------------------------------- /contrib/apps/tcpecho/tcpecho.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 | 33 | #ifndef LWIP_TCPECHO_H 34 | #define LWIP_TCPECHO_H 35 | 36 | void tcpecho_init(void); 37 | 38 | #endif /* LWIP_TCPECHO_H */ 39 | -------------------------------------------------------------------------------- /contrib/apps/tcpecho_raw/tcpecho_raw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001-2004 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 | */ 30 | #ifndef LWIP_TCPECHO_RAW_H 31 | #define LWIP_TCPECHO_RAW_H 32 | 33 | void tcpecho_raw_init(void); 34 | 35 | #endif /* LWIP_TCPECHO_RAW_H */ 36 | -------------------------------------------------------------------------------- /contrib/apps/udpecho/udpecho.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_UDPECHO_H 33 | #define LWIP_UDPECHO_H 34 | 35 | void udpecho_init(void); 36 | 37 | #endif /* LWIP_UDPECHO_H */ 38 | -------------------------------------------------------------------------------- /contrib/apps/udpecho_raw/udpecho_raw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Stephan Linz , Li-Pro.Net 3 | * All rights reserved. 4 | * 5 | * Based on examples provided by 6 | * Iwan Budi Kusnanto (https://gist.github.com/iwanbk/1399729) 7 | * Juri Haberland (https://lists.gnu.org/archive/html/lwip-users/2007-06/msg00078.html) 8 | * 9 | * Redistribution and use in source and binary forms, with or without modification, 10 | * are permitted provided that the following conditions are met: 11 | * 12 | * 1. Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * 3. The name of the author may not be used to endorse or promote products 18 | * derived from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 22 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 23 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 25 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 28 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 29 | * OF SUCH DAMAGE. 30 | * 31 | * This file is part of the lwIP TCP/IP stack. 32 | * 33 | */ 34 | #ifndef LWIP_UDPECHO_RAW_H 35 | #define LWIP_UDPECHO_RAW_H 36 | 37 | void udpecho_raw_init(void); 38 | 39 | #endif /* LWIP_UDPECHO_RAW_H */ 40 | -------------------------------------------------------------------------------- /contrib/examples/example_app/default_netif.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 | 33 | #ifndef LWIP_DEFAULT_NETIF_H 34 | #define LWIP_DEFAULT_NETIF_H 35 | 36 | #include "lwip/ip_addr.h" 37 | 38 | #if LWIP_IPV4 39 | void init_default_netif(const ip4_addr_t *ipaddr, const ip4_addr_t *netmask, const ip4_addr_t *gw); 40 | #else 41 | void init_default_netif(void); 42 | #endif 43 | 44 | void default_netif_poll(void); 45 | void default_netif_shutdown(void); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /contrib/examples/example_app/lwippools.h: -------------------------------------------------------------------------------- 1 | /* OPTIONAL: Pools to replace heap allocation 2 | * Optional: Pools can be used instead of the heap for mem_malloc. If 3 | * so, these should be defined here, in increasing order according to 4 | * the pool element size. 5 | * 6 | * LWIP_MALLOC_MEMPOOL(number_elements, element_size) 7 | */ 8 | #if MEM_USE_POOLS 9 | LWIP_MALLOC_MEMPOOL_START 10 | LWIP_MALLOC_MEMPOOL(100, 256) 11 | LWIP_MALLOC_MEMPOOL(50, 512) 12 | LWIP_MALLOC_MEMPOOL(20, 1024) 13 | LWIP_MALLOC_MEMPOOL(20, 1536) 14 | LWIP_MALLOC_MEMPOOL_END 15 | #endif /* MEM_USE_POOLS */ 16 | 17 | /* Optional: Your custom pools can go here if you would like to use 18 | * lwIP's memory pools for anything else. 19 | */ 20 | LWIP_MEMPOOL(SYS_MBOX, 22, 100, "SYS_MBOX") 21 | -------------------------------------------------------------------------------- /contrib/examples/example_app/ppp_settings.h: -------------------------------------------------------------------------------- 1 | #ifdef _MSC_VER 2 | #pragma warning (disable: 4242) /* PPP only: conversion from 'x' to 'y', possible loss of data */ 3 | #pragma warning (disable: 4244) /* PPP only: conversion from 'x' to 'y', possible loss of data (again?) */ 4 | #pragma warning (disable: 4310) /* PPP only: cast truncates constant value */ 5 | #pragma warning (disable: 4706) /* PPP only: assignment within conditional expression */ 6 | #endif /* MSC_VER */ 7 | -------------------------------------------------------------------------------- /contrib/examples/example_app/test_configs/opt_no_tcp_dualstack.h: -------------------------------------------------------------------------------- 1 | #include "test_configs/opt_dualstack.h" 2 | 3 | #undef LWIP_TCP 4 | #define LWIP_TCP 0 5 | -------------------------------------------------------------------------------- /contrib/examples/example_app/test_configs/opt_no_tcp_ipv4only.h: -------------------------------------------------------------------------------- 1 | #include "test_configs/opt_ipv4only.h" 2 | 3 | #undef LWIP_TCP 4 | #define LWIP_TCP 0 5 | -------------------------------------------------------------------------------- /contrib/examples/example_app/test_configs/opt_no_tcp_ipv6only.h: -------------------------------------------------------------------------------- 1 | #include "test_configs/opt_ipv6only.h" 2 | 3 | #undef LWIP_TCP 4 | #define LWIP_TCP 0 5 | -------------------------------------------------------------------------------- /contrib/examples/example_app/test_configs/opt_no_udp_dualstack.h: -------------------------------------------------------------------------------- 1 | #include "test_configs/opt_dualstack.h" 2 | 3 | #undef LWIP_UDP 4 | #define LWIP_UDP 0 5 | -------------------------------------------------------------------------------- /contrib/examples/example_app/test_configs/opt_no_udp_ipv4only.h: -------------------------------------------------------------------------------- 1 | #include "test_configs/opt_ipv4only.h" 2 | 3 | #undef LWIP_UDP 4 | #define LWIP_UDP 0 5 | -------------------------------------------------------------------------------- /contrib/examples/example_app/test_configs/opt_no_udp_ipv6only.h: -------------------------------------------------------------------------------- 1 | #include "test_configs/opt_ipv6only.h" 2 | 3 | #undef LWIP_UDP 4 | #define LWIP_UDP 0 5 | -------------------------------------------------------------------------------- /contrib/examples/example_app/test_configs/opt_none.h: -------------------------------------------------------------------------------- 1 | /* test and empty lwipopts.h file */ 2 | 3 | -------------------------------------------------------------------------------- /contrib/examples/httpd/cgi_example/cgi_example.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Simon Goldschmidt 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 | 33 | #ifndef LWIP_HDR_HTTP_EXAMPLES_CGI_EXAMPLE 34 | #define LWIP_HDR_HTTP_EXAMPLES_CGI_EXAMPLE 35 | 36 | void cgi_ex_init(void); 37 | 38 | #endif /* LWIP_HDR_HTTP_EXAMPLES_CGI_EXAMPLE */ 39 | -------------------------------------------------------------------------------- /contrib/examples/httpd/examples_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 | -------------------------------------------------------------------------------- /contrib/examples/httpd/examples_fs/img/sics.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaybhargav/lwip_nat/399b9908193fb86357424c996c5d47e7a51e5f6b/contrib/examples/httpd/examples_fs/img/sics.gif -------------------------------------------------------------------------------- /contrib/examples/httpd/examples_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 | -------------------------------------------------------------------------------- /contrib/examples/httpd/examples_fs/login.html: -------------------------------------------------------------------------------- 1 | 2 | lwIP - A Lightweight TCP/IP Stack 3 | 4 | 5 | 6 | 7 | 10 | 22 | 25 | 26 |
8 | SICS logo 9 | 11 |

Login

12 |
13 |
14 | 15 | 16 | 17 | 18 | 19 |
20 |
21 |
23 |   24 |
27 | 28 | 29 | -------------------------------------------------------------------------------- /contrib/examples/httpd/examples_fs/loginfail.html: -------------------------------------------------------------------------------- 1 | 2 | lwIP - A Lightweight TCP/IP Stack 3 | 4 | 5 | 6 | 7 | 10 | 19 | 22 | 23 |
8 | SICS logo 9 | 11 |

lwIP - A Lightweight TCP/IP Stack

12 |

13 | Login failed. 14 |

15 |

16 | Click here to retry login. 17 |

18 |
20 |   21 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /contrib/examples/httpd/examples_fs/session.html: -------------------------------------------------------------------------------- 1 | 2 | lwIP - A Lightweight TCP/IP Stack 3 | 4 | 5 | 6 | 7 | 10 | 19 | 22 | 23 |
8 | SICS logo 9 | 11 |

lwIP - A Lightweight TCP/IP Stack

12 |

13 | Login succeeded, session active. 14 |

15 |

16 | Click here to retry login. 17 |

18 |
20 |   21 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /contrib/examples/httpd/fs_example/fs_example.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Simon Goldschmidt 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 | 33 | #ifndef LWIP_HDR_HTTP_EXAMPLES_FS_EXAMPLE 34 | #define LWIP_HDR_HTTP_EXAMPLES_FS_EXAMPLE 35 | 36 | void fs_ex_init(const char *httpd_root_dir); 37 | 38 | #endif /* LWIP_HDR_HTTP_EXAMPLES_FS_EXAMPLE */ 39 | -------------------------------------------------------------------------------- /contrib/examples/httpd/genfiles_example/genfiles_example.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Simon Goldschmidt 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 | 33 | #ifndef LWIP_HDR_HTTP_EXAMPLES_GENFILES_EXAMPLE 34 | #define LWIP_HDR_HTTP_EXAMPLES_GENFILES_EXAMPLE 35 | 36 | void genfiles_ex_init(void); 37 | 38 | #endif /* LWIP_HDR_HTTP_EXAMPLES_GENFILES_EXAMPLE */ 39 | -------------------------------------------------------------------------------- /contrib/examples/httpd/https_example/https_example.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Simon Goldschmidt 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 | 33 | #ifndef LWIP_HDR_HTTP_EXAMPLES_HTTPS_EXAMPLE 34 | #define LWIP_HDR_HTTP_EXAMPLES_HTTPS_EXAMPLE 35 | 36 | void https_ex_init(void); 37 | 38 | #endif /* LWIP_HDR_HTTP_EXAMPLES_HTTPS_EXAMPLE */ 39 | -------------------------------------------------------------------------------- /contrib/examples/httpd/ssi_example/ssi_example.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Simon Goldschmidt 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 | 33 | #ifndef LWIP_HDR_HTTP_EXAMPLES_SSI_EXAMPLE 34 | #define LWIP_HDR_HTTP_EXAMPLES_SSI_EXAMPLE 35 | 36 | void ssi_ex_init(void); 37 | 38 | #endif /* LWIP_HDR_HTTP_EXAMPLES_SSI_EXAMPLE */ 39 | -------------------------------------------------------------------------------- /contrib/examples/lwiperf/lwiperf_example.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Redistribution and use in source and binary forms, with or without modification, 3 | * are permitted provided that the following conditions are met: 4 | * 5 | * 1. Redistributions of source code must retain the above copyright notice, 6 | * this list of conditions and the following disclaimer. 7 | * 2. Redistributions in binary form must reproduce the above copyright notice, 8 | * this list of conditions and the following disclaimer in the documentation 9 | * and/or other materials provided with the distribution. 10 | * 3. The name of the author may not be used to endorse or promote products 11 | * derived from this software without specific prior written permission. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 14 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 16 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 18 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 19 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 20 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 21 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 22 | * OF SUCH DAMAGE. 23 | * 24 | * This file is part of the lwIP TCP/IP stack. 25 | * 26 | * Author: Dirk Ziegelmeier 27 | * 28 | */ 29 | 30 | #ifndef LWIPERF_EXAMPLE_H 31 | #define LWIPERF_EXAMPLE_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | void lwiperf_example_init(void); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif /* LWIPERF_EXAMPLE_H */ 44 | -------------------------------------------------------------------------------- /contrib/examples/mdns/mdns_example.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Redistribution and use in source and binary forms, with or without modification, 3 | * are permitted provided that the following conditions are met: 4 | * 5 | * 1. Redistributions of source code must retain the above copyright notice, 6 | * this list of conditions and the following disclaimer. 7 | * 2. Redistributions in binary form must reproduce the above copyright notice, 8 | * this list of conditions and the following disclaimer in the documentation 9 | * and/or other materials provided with the distribution. 10 | * 3. The name of the author may not be used to endorse or promote products 11 | * derived from this software without specific prior written permission. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 14 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 16 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 18 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 19 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 20 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 21 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 22 | * OF SUCH DAMAGE. 23 | * 24 | * This file is part of the lwIP TCP/IP stack. 25 | * 26 | * Author: Dirk Ziegelmeier 27 | * 28 | */ 29 | 30 | #ifndef MDNS_EXAMPLE_H 31 | #define MDNS_EXAMPLE_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | void mdns_example_init(void); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif /* MDNS_EXAMPLE_H */ 44 | -------------------------------------------------------------------------------- /contrib/examples/mqtt/mqtt_example.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Redistribution and use in source and binary forms, with or without modification, 3 | * are permitted provided that the following conditions are met: 4 | * 5 | * 1. Redistributions of source code must retain the above copyright notice, 6 | * this list of conditions and the following disclaimer. 7 | * 2. Redistributions in binary form must reproduce the above copyright notice, 8 | * this list of conditions and the following disclaimer in the documentation 9 | * and/or other materials provided with the distribution. 10 | * 3. The name of the author may not be used to endorse or promote products 11 | * derived from this software without specific prior written permission. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 14 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 16 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 18 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 19 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 20 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 21 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 22 | * OF SUCH DAMAGE. 23 | * 24 | * This file is part of the lwIP TCP/IP stack. 25 | * 26 | * Author: Dirk Ziegelmeier 27 | * 28 | */ 29 | 30 | #ifndef MQTT_EXAMPLE_H 31 | #define MQTT_EXAMPLE_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | void mqtt_example_init(void); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif /* MQTT_EXAMPLE_H */ 44 | -------------------------------------------------------------------------------- /contrib/examples/ppp/pppos_example.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Redistribution and use in source and binary forms, with or without modification, 3 | * are permitted provided that the following conditions are met: 4 | * 5 | * 1. Redistributions of source code must retain the above copyright notice, 6 | * this list of conditions and the following disclaimer. 7 | * 2. Redistributions in binary form must reproduce the above copyright notice, 8 | * this list of conditions and the following disclaimer in the documentation 9 | * and/or other materials provided with the distribution. 10 | * 3. The name of the author may not be used to endorse or promote products 11 | * derived from this software without specific prior written permission. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 14 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 16 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 18 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 19 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 20 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 21 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 22 | * OF SUCH DAMAGE. 23 | * 24 | * This file is part of the lwIP TCP/IP stack. 25 | * 26 | * Author: Dirk Ziegelmeier 27 | * 28 | */ 29 | 30 | #ifndef PPPOS_EXAMPLE_H 31 | #define PPPOS_EXAMPLE_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | void pppos_example_init(void); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif /* PPPOS_EXAMPLE_H */ 44 | -------------------------------------------------------------------------------- /contrib/examples/snmp/snmp_example.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Redistribution and use in source and binary forms, with or without modification, 3 | * are permitted provided that the following conditions are met: 4 | * 5 | * 1. Redistributions of source code must retain the above copyright notice, 6 | * this list of conditions and the following disclaimer. 7 | * 2. Redistributions in binary form must reproduce the above copyright notice, 8 | * this list of conditions and the following disclaimer in the documentation 9 | * and/or other materials provided with the distribution. 10 | * 3. The name of the author may not be used to endorse or promote products 11 | * derived from this software without specific prior written permission. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 14 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 16 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 18 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 19 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 20 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 21 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 22 | * OF SUCH DAMAGE. 23 | * 24 | * This file is part of the lwIP TCP/IP stack. 25 | * 26 | * Author: Dirk Ziegelmeier 27 | * 28 | */ 29 | 30 | #ifndef SNMP_EXAMPLE_H 31 | #define SNMP_EXAMPLE_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | void snmp_example_init(void); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif /* SNMP_EXAMPLE_H */ 44 | -------------------------------------------------------------------------------- /contrib/examples/snmp/snmp_private_mib/private_mib.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * Exports Private lwIP MIB 4 | */ 5 | 6 | #ifndef LWIP_HDR_PRIVATE_MIB_H 7 | #define LWIP_HDR_PRIVATE_MIB_H 8 | 9 | #include "lwip/apps/snmp_opts.h" 10 | 11 | #include "lwip/apps/snmp_core.h" 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | /* export MIB */ 18 | extern const struct snmp_mib mib_private; 19 | 20 | void lwip_privmib_init(void); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /contrib/examples/sntp/sntp_example.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Redistribution and use in source and binary forms, with or without modification, 3 | * are permitted provided that the following conditions are met: 4 | * 5 | * 1. Redistributions of source code must retain the above copyright notice, 6 | * this list of conditions and the following disclaimer. 7 | * 2. Redistributions in binary form must reproduce the above copyright notice, 8 | * this list of conditions and the following disclaimer in the documentation 9 | * and/or other materials provided with the distribution. 10 | * 3. The name of the author may not be used to endorse or promote products 11 | * derived from this software without specific prior written permission. 12 | * 13 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 14 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 16 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 18 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 19 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 20 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 21 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 22 | * OF SUCH DAMAGE. 23 | * 24 | * This file is part of the lwIP TCP/IP stack. 25 | * 26 | * Author: Dirk Ziegelmeier 27 | * 28 | */ 29 | 30 | #ifndef SNTP_EXAMPLE_H 31 | #define SNTP_EXAMPLE_H 32 | 33 | #ifdef __cplusplus 34 | extern "C" { 35 | #endif 36 | 37 | void sntp_example_init(void); 38 | 39 | void sntp_set_system_time(u32_t sec); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif /* SNTP_EXAMPLE_H */ 46 | -------------------------------------------------------------------------------- /contrib/examples/tftp/tftp_example.h: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | /* 8 | * File: tftp_example.h 9 | * Author: dziegel 10 | * 11 | * Created on February 17, 2018, 3:43 PM 12 | */ 13 | 14 | #ifndef TFTP_EXAMPLE_H 15 | #define TFTP_EXAMPLE_H 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | void tftp_example_init_server(void); 22 | void tftp_example_init_client(void); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | 28 | #endif /* TFTP_EXAMPLE_H */ 29 | 30 | -------------------------------------------------------------------------------- /contrib/ports/unix/Filelists.cmake: -------------------------------------------------------------------------------- 1 | # This file is indended to be included in end-user CMakeLists.txt 2 | # include(/path/to/Filelists.cmake) 3 | # It assumes the variable LWIP_CONTRIB_DIR is defined pointing to the 4 | # root path of lwIP/contrib sources. 5 | # 6 | # This file is NOT designed (on purpose) to be used as cmake 7 | # subdir via add_subdirectory() 8 | # The intention is to provide greater flexibility to users to 9 | # create their own targets using the *_SRCS variables. 10 | 11 | if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0") 12 | include_guard(GLOBAL) 13 | endif() 14 | 15 | set(lwipcontribportunix_SRCS 16 | ${LWIP_CONTRIB_DIR}/ports/unix/port/sys_arch.c 17 | ${LWIP_CONTRIB_DIR}/ports/unix/port/perf.c 18 | ) 19 | 20 | set(lwipcontribportunixnetifs_SRCS 21 | ${LWIP_CONTRIB_DIR}/ports/unix/port/netif/tapif.c 22 | ${LWIP_CONTRIB_DIR}/ports/unix/port/netif/list.c 23 | ${LWIP_CONTRIB_DIR}/ports/unix/port/netif/sio.c 24 | ${LWIP_CONTRIB_DIR}/ports/unix/port/netif/fifo.c 25 | ) 26 | 27 | add_library(lwipcontribportunix EXCLUDE_FROM_ALL ${lwipcontribportunix_SRCS} ${lwipcontribportunixnetifs_SRCS}) 28 | target_include_directories(lwipcontribportunix PRIVATE ${LWIP_INCLUDE_DIRS} ${LWIP_MBEDTLS_INCLUDE_DIRS}) 29 | target_compile_options(lwipcontribportunix PRIVATE ${LWIP_COMPILER_FLAGS}) 30 | target_compile_definitions(lwipcontribportunix PRIVATE ${LWIP_DEFINITIONS} ${LWIP_MBEDTLS_DEFINITIONS}) 31 | target_link_libraries(lwipcontribportunix PUBLIC ${LWIP_MBEDTLS_LINK_LIBRARIES}) 32 | 33 | if (CMAKE_SYSTEM_NAME STREQUAL "Linux") 34 | find_library(LIBUTIL util) 35 | find_library(LIBPTHREAD pthread) 36 | find_library(LIBRT rt) 37 | target_link_libraries(lwipcontribportunix PUBLIC ${LIBUTIL} ${LIBPTHREAD} ${LIBRT}) 38 | endif() 39 | 40 | if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") 41 | # Darwin doesn't have pthreads or POSIX real-time extensions libs 42 | find_library(LIBUTIL util) 43 | target_link_libraries(lwipcontribportunix PUBLIC ${LIBUTIL}) 44 | endif() 45 | -------------------------------------------------------------------------------- /contrib/ports/unix/README: -------------------------------------------------------------------------------- 1 | This port contains infrastructure and examples for running lwIP on Unix-like 2 | operating systems (Linux, OpenBSD, cygwin). Much of this is targeted towards 3 | testing lwIP applications. 4 | 5 | * port/sys_arch.c, port/perf.c, port/include/arch/: Generic platform porting, 6 | for both states of NO_SYS. (Mapping debugging to printf, providing 7 | sys_now & co from the system time etc.) 8 | 9 | * check: Runs the unit tests shipped with main lwIP on the Unix port. 10 | 11 | * port/netif, port/include/netif: Various network interface implementations and 12 | their helpers, some explicitly for Unix infrastructure, some generic (but most 13 | useful on an easy to debug system): 14 | 15 | * fifo: Helper for sio 16 | 17 | * list: Helper for unixif 18 | 19 | * pcapif: Network interface that replays packages from a PCAP dump file, and 20 | discards packages sent out from it 21 | 22 | * sio: Mapping Unix character devices to lwIP's sio mechanisms 23 | 24 | * tapif: Network interface that is mapped to a tap interface (Unix user 25 | space layer 2 network device). Uses lwIP threads. 26 | -------------------------------------------------------------------------------- /contrib/ports/unix/check/README: -------------------------------------------------------------------------------- 1 | 2 | Helper files to run lwIP unit tests on unix-like systems. 3 | 4 | 1. Install the check library, through a package manager or from https://libcheck.github.io/check/ 5 | 2. Put the lwip code in a directory called 'lwip' 6 | 3. Run `make check` 7 | 4. Make sure all tests pass 8 | 9 | -------------------------------------------------------------------------------- /contrib/ports/unix/check/config.h: -------------------------------------------------------------------------------- 1 | /* Enable this to simplify debugging */ 2 | /* #define LWIP_UNITTESTS_NOFORK */ 3 | -------------------------------------------------------------------------------- /contrib/ports/unix/example_app/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(${LWIP_DIR}/contrib/ports/CMakeCommon.cmake) 2 | 3 | set (LWIP_INCLUDE_DIRS 4 | "${LWIP_DIR}/src/include" 5 | "${LWIP_DIR}/contrib/" 6 | "${LWIP_DIR}/contrib/ports/unix/port/include" 7 | "${LWIP_DIR}/contrib/examples/example_app" 8 | ) 9 | 10 | include(${LWIP_DIR}/src/Filelists.cmake) 11 | include(${LWIP_DIR}/contrib/Filelists.cmake) 12 | include(${LWIP_DIR}/contrib/ports/unix/Filelists.cmake) 13 | 14 | add_executable(example_app ${LWIP_DIR}/contrib/examples/example_app/test.c default_netif.c) 15 | target_include_directories(example_app PRIVATE ${LWIP_INCLUDE_DIRS}) 16 | target_compile_options(example_app PRIVATE ${LWIP_COMPILER_FLAGS}) 17 | target_compile_definitions(example_app PRIVATE ${LWIP_DEFINITIONS} ${LWIP_MBEDTLS_DEFINITIONS}) 18 | target_link_libraries(example_app ${LWIP_SANITIZER_LIBS} lwipcontribexamples lwipcontribapps lwipcontribaddons lwipallapps lwipcontribportunix lwipcore lwipmbedtls) 19 | 20 | add_executable(makefsdata ${lwipmakefsdata_SRCS}) 21 | target_compile_options(makefsdata PRIVATE ${LWIP_COMPILER_FLAGS}) 22 | target_include_directories(makefsdata PRIVATE ${LWIP_INCLUDE_DIRS}) 23 | target_link_libraries(makefsdata ${LWIP_SANITIZER_LIBS}) 24 | -------------------------------------------------------------------------------- /contrib/ports/unix/example_app/iteropts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | LOGFILE=iteropts.log 4 | EXAPPDIR=../../../examples/example_app 5 | RETVAL=0 6 | 7 | pushd `dirname "$0"` 8 | pwd 9 | echo Starting Iteropts run >> $LOGFILE 10 | for f in $EXAPPDIR/test_configs/*.h 11 | do 12 | echo Cleaning... 13 | make clean > /dev/null 14 | BUILDLOG=$(basename "$f" ".h").log 15 | echo testing $f 16 | echo testing $f >> $LOGFILE 17 | rm -f $EXAPPDIR/lwipopts_test.h 18 | # cat the file to update its timestamp 19 | cat $f > $EXAPPDIR/lwipopts_test.h 20 | make TESTFLAGS="-DLWIP_OPTTEST_FILE -Wno-documentation" -j 4 1> $BUILDLOG 2>&1 21 | ERR=$? 22 | if [ $ERR != 0 ]; then 23 | cat $BUILDLOG 24 | echo file $f failed with $ERR >> $LOGFILE 25 | echo ++++++++ $f FAILED +++++++ 26 | RETVAL=1 27 | fi 28 | echo test $f done >> $LOGFILE 29 | done 30 | echo done, cleaning 31 | make clean > /dev/null 32 | popd 33 | echo Exit value: $RETVAL 34 | exit $RETVAL 35 | -------------------------------------------------------------------------------- /contrib/ports/unix/lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8) 2 | 3 | project(lwip C) 4 | 5 | set (BUILD_SHARED_LIBS ON) 6 | 7 | if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT CMAKE_SYSTEM_NAME STREQUAL "GNU") 8 | message(FATAL_ERROR "Lwip shared library is only working on Linux or the Hurd") 9 | endif() 10 | 11 | set(LWIP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../..) 12 | include(${LWIP_DIR}/contrib/ports/CMakeCommon.cmake) 13 | 14 | set (LWIP_DEFINITIONS -DLWIP_DEBUG) 15 | set (LWIP_INCLUDE_DIRS 16 | "${LWIP_DIR}/src/include" 17 | "${LWIP_CONTRIB_DIR}/" 18 | "${LWIP_CONTRIB_DIR}/ports/unix/port/include" 19 | "${CMAKE_CURRENT_SOURCE_DIR}/" 20 | ) 21 | 22 | include(${LWIP_CONTRIB_DIR}/ports/unix/Filelists.cmake) 23 | include(${LWIP_DIR}/src/Filelists.cmake) 24 | 25 | add_library(lwip ${lwipnoapps_SRCS} ${lwipcontribportunix_SRCS} ${lwipcontribportunixnetifs_SRCS}) 26 | target_compile_options(lwip PRIVATE ${LWIP_COMPILER_FLAGS}) 27 | target_compile_definitions(lwip PRIVATE ${LWIP_DEFINITIONS} ${LWIP_MBEDTLS_DEFINITIONS}) 28 | target_include_directories(lwip PRIVATE ${LWIP_INCLUDE_DIRS} ${LWIP_MBEDTLS_INCLUDE_DIRS}) 29 | target_link_libraries(lwip ${LWIP_SANITIZER_LIBS}) 30 | 31 | find_library(LIBPTHREAD pthread) 32 | target_link_libraries(lwip ${LIBPTHREAD}) 33 | -------------------------------------------------------------------------------- /contrib/ports/unix/lib/README: -------------------------------------------------------------------------------- 1 | This directory contains an example of how to compile lwIP as a shared library 2 | on Linux. 3 | 4 | Some brief instructions: 5 | 6 | * Compile the code: 7 | 8 | > mkdir build 9 | > cd build 10 | > cmake .. 11 | > make clean all 12 | 13 | This should produce liblwip.so. This is the shared library. 14 | 15 | * Link an application against the shared library 16 | 17 | If you're using gcc you can do this by including -llwip in your link command. 18 | 19 | * Run your application 20 | 21 | Ensure that LD_LIBRARY_PATH includes the directory that contains liblwip.so 22 | (ie. this directory) 23 | 24 | 25 | If you are unsure about shared libraries and libraries on linux in 26 | general, you might find this HOWTO useful: 27 | 28 | 29 | -------------------------------------------------------------------------------- /contrib/ports/unix/port/include/netif/fifo.h: -------------------------------------------------------------------------------- 1 | #ifndef FIFO_H 2 | #define FIFO_H 3 | 4 | #include "lwip/sys.h" 5 | 6 | /** How many bytes in fifo */ 7 | #define FIFOSIZE 2048 8 | 9 | /** fifo data structure, this one is passed to all fifo functions */ 10 | typedef struct fifo_t { 11 | u8_t data[FIFOSIZE+10]; /* data segment, +10 is a hack probably not needed.. FIXME! */ 12 | int dataslot; /* index to next char to be read */ 13 | int emptyslot; /* index to next empty slot */ 14 | int len; /* len probably not needed, may be calculated from dataslot and emptyslot in conjunction with FIFOSIZE */ 15 | 16 | sys_sem_t sem; /* semaphore protecting simultaneous data manipulation */ 17 | sys_sem_t getSem; /* sepaphore used to signal new data if getWaiting is set */ 18 | u8_t getWaiting; /* flag used to indicate that fifoget is waiting for data. fifoput is supposed to clear */ 19 | /* this flag prior to signaling the getSem semaphore */ 20 | } fifo_t; 21 | 22 | 23 | /** 24 | * Get a character from fifo 25 | * Blocking call. 26 | * @param fifo pointer to fifo data structure 27 | * @return character read from fifo 28 | */ 29 | u8_t fifoGet(fifo_t * fifo); 30 | 31 | /** 32 | * Get a character from fifo 33 | * Non blocking call. 34 | * @param fifo pointer to fifo data structure 35 | * @return character read from fifo, or < zero if non was available 36 | */ 37 | s16_t fifoGetNonBlock(fifo_t * fifo); 38 | 39 | /** 40 | * fifoput is called by the signalhandler when new data has arrived (or some other event is indicated) 41 | * fifoput reads directly from the serialport and is thus highly dependent on unix arch at this moment 42 | * @param fifo pointer to fifo data structure 43 | * @param fd unix file descriptor 44 | */ 45 | void fifoPut(fifo_t * fifo, int fd); 46 | 47 | /** 48 | * fifoinit initiate fifo 49 | * @param fifo pointer to fifo data structure, allocated by the user 50 | */ 51 | void fifoInit(fifo_t * fifo); 52 | 53 | #endif 54 | 55 | -------------------------------------------------------------------------------- /contrib/ports/unix/port/include/netif/list.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef LWIP_LIST_H 3 | #define LWIP_LIST_H 4 | 5 | struct elem; 6 | 7 | struct list { 8 | struct elem *first, *last; 9 | int size, elems; 10 | }; 11 | 12 | struct elem { 13 | struct elem *next; 14 | void *data; 15 | }; 16 | 17 | struct list *list_new(int size); 18 | int list_push(struct list *list, void *data); 19 | void *list_pop(struct list *list); 20 | void *list_first(struct list *list); 21 | int list_elems(struct list *list); 22 | void list_delete(struct list *list); 23 | int list_remove(struct list *list, void *elem); 24 | void list_map(struct list *list, void (* func)(void *arg)); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /contrib/ports/unix/port/include/netif/pcapif.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_PCAPIF_H 33 | #define LWIP_PCAPIF_H 34 | 35 | #include "lwip/netif.h" 36 | 37 | err_t pcapif_init(struct netif *netif); 38 | 39 | #endif /* LWIP_PCAPIF_H */ 40 | -------------------------------------------------------------------------------- /contrib/ports/unix/port/include/netif/sio.h: -------------------------------------------------------------------------------- 1 | #ifndef SIO_UNIX_H 2 | #define SIO_UNIX_H 3 | 4 | #include "lwip/sys.h" 5 | #include "lwip/netif.h" 6 | #include "netif/fifo.h" 7 | /*#include "netif/pppif.h"*/ 8 | 9 | struct sio_status_s { 10 | int fd; 11 | fifo_t myfifo; 12 | }; 13 | 14 | /* BAUDRATE is defined in sio.c as it is implementation specific */ 15 | /** Baudrates */ 16 | typedef enum sioBaudrates { 17 | SIO_BAUD_9600, 18 | SIO_BAUD_19200, 19 | SIO_BAUD_38400, 20 | SIO_BAUD_57600, 21 | SIO_BAUD_115200 22 | } sioBaudrates; 23 | 24 | /** 25 | * Poll for a new character from incoming data stream 26 | * @param siostat siostatus struct, contains sio instance data, given by sio_open 27 | * @return char read from input stream, or < 0 if no char was available 28 | */ 29 | s16_t sio_poll(sio_status_t * siostat); 30 | 31 | /** 32 | * Parse incoming characters until a string str is received, blocking call 33 | * @param str zero terminated string to expect 34 | * @param siostat siostatus struct, contains sio instance data, given by sio_open 35 | */ 36 | void sio_expect_string(u8_t *str, sio_status_t * siostat); 37 | 38 | /** 39 | * Write a char to output data stream 40 | * @param str pointer to a zero terminated string 41 | * @param siostat siostatus struct, contains sio instance data, given by sio_open 42 | */ 43 | void sio_send_string(u8_t *str, sio_status_t * siostat); 44 | 45 | /** 46 | * Flush outbuffer (send everything in buffer now), useful if some layer below is 47 | * holding on to data, waitng to fill a buffer 48 | * @param siostat siostatus struct, contains sio instance data, given by sio_open 49 | */ 50 | void sio_flush( sio_status_t * siostat ); 51 | 52 | /** 53 | * Change baudrate of port, may close and reopen port 54 | * @param baud new baudrate 55 | * @param siostat siostatus struct, contains sio instance data, given by sio_open 56 | */ 57 | void sio_change_baud( sioBaudrates baud, sio_status_t * siostat ); 58 | 59 | #endif 60 | 61 | -------------------------------------------------------------------------------- /contrib/ports/unix/port/include/netif/tapif.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_TAPIF_H 33 | #define LWIP_TAPIF_H 34 | 35 | #include "lwip/netif.h" 36 | 37 | err_t tapif_init(struct netif *netif); 38 | void tapif_poll(struct netif *netif); 39 | #if NO_SYS 40 | int tapif_select(struct netif *netif); 41 | #endif /* NO_SYS */ 42 | 43 | #endif /* LWIP_TAPIF_H */ 44 | -------------------------------------------------------------------------------- /contrib/ports/unix/setup-tapif: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script needs bridge-util debian package or similar 4 | # for other distros. 5 | 6 | # Run using "source setup-tapif" to get exported PRECONFIGURED_TAPIF variable 7 | # Alternatively, add "export PRECONFIGURED_TAPIF=tap0" to ~/.bashrc 8 | 9 | # http://backreference.org/2010/03/26/tuntap-interface-tutorial/ 10 | 11 | # After executing this script, start example_app. 12 | # Enter 192.168.1.200 or "http://lwip.local/" (Zeroconf) 13 | # in your webbrowser to see example_app webpage. 14 | 15 | export PRECONFIGURED_TAPIF=tap0 16 | 17 | sudo ip tuntap add dev $PRECONFIGURED_TAPIF mode tap user `whoami` 18 | sudo ip link set $PRECONFIGURED_TAPIF up 19 | sudo brctl addbr lwipbridge 20 | sudo brctl addif lwipbridge $PRECONFIGURED_TAPIF 21 | sudo ip addr add 192.168.1.1/24 dev lwipbridge 22 | sudo ip link set dev lwipbridge up 23 | -------------------------------------------------------------------------------- /contrib/ports/win32/Filelists.cmake: -------------------------------------------------------------------------------- 1 | # This file is indended to be included in end-user CMakeLists.txt 2 | # include(/path/to/Filelists.cmake) 3 | # It assumes the variable LWIP_CONTRIB_DIR is defined pointing to the 4 | # root path of lwIP/contrib sources. 5 | # 6 | # This file is NOT designed (on purpose) to be used as cmake 7 | # subdir via add_subdirectory() 8 | # The intention is to provide greater flexibility to users to 9 | # create their own targets using the *_SRCS variables. 10 | 11 | if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0") 12 | include_guard(GLOBAL) 13 | endif() 14 | 15 | set(lwipcontribportwindows_SRCS 16 | ${LWIP_CONTRIB_DIR}/ports/win32/sys_arch.c 17 | ${LWIP_CONTRIB_DIR}/ports/win32/sio.c 18 | ${LWIP_CONTRIB_DIR}/ports/win32/pcapif.c 19 | ${LWIP_CONTRIB_DIR}/ports/win32/pcapif_helper.c 20 | ) 21 | 22 | # pcapif needs WinPcap developer package: https://www.winpcap.org/devel.htm 23 | if(NOT DEFINED WPDPACK_DIR) 24 | set(WPDPACK_DIR ${LWIP_DIR}/../WpdPack) 25 | message(STATUS "WPDPACK_DIR not set - using default location ${WPDPACK_DIR}") 26 | endif() 27 | if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") 28 | if(CMAKE_SIZEOF_VOID_P EQUAL 8) 29 | set(WPDPACK_LIB_DIR ${WPDPACK_DIR}/lib/x64) 30 | else() 31 | set(WPDPACK_LIB_DIR ${WPDPACK_DIR}/lib) 32 | endif() 33 | set(WPCAP ${WPDPACK_DIR}/lib/x64/wpcap.lib) 34 | set(PACKET ${WPDPACK_DIR}/lib/x64/packet.lib) 35 | else() 36 | find_library(WPCAP wpcap HINTS ${WPDPACK_DIR}/lib/x64) 37 | find_library(PACKET packet HINTS ${WPDPACK_DIR}/lib/x64) 38 | endif() 39 | message(STATUS "WPCAP library: ${WPCAP}") 40 | message(STATUS "PACKET library: ${PACKET}") 41 | 42 | add_library(lwipcontribportwindows EXCLUDE_FROM_ALL ${lwipcontribportwindows_SRCS}) 43 | target_include_directories(lwipcontribportwindows PRIVATE ${LWIP_INCLUDE_DIRS} "${WPDPACK_DIR}/include" ${LWIP_MBEDTLS_INCLUDE_DIRS}) 44 | target_compile_options(lwipcontribportwindows PRIVATE ${LWIP_COMPILER_FLAGS}) 45 | target_compile_definitions(lwipcontribaddons PRIVATE ${LWIP_DEFINITIONS} ${LWIP_MBEDTLS_DEFINITIONS}) 46 | target_link_libraries(lwipcontribportwindows PUBLIC ${WPCAP} ${PACKET} ${LWIP_MBEDTLS_LINK_LIBRARIES}) 47 | -------------------------------------------------------------------------------- /contrib/ports/win32/check/check_stdint.h: -------------------------------------------------------------------------------- 1 | /* deliberateliy empty */ 2 | -------------------------------------------------------------------------------- /contrib/ports/win32/check/config.h: -------------------------------------------------------------------------------- 1 | /* config.h for check-0.11.0 on win32 under MSVC/MinGW */ 2 | 3 | #ifdef _MSC_VER 4 | 5 | typedef unsigned int pid_t; 6 | typedef unsigned int uint32_t; 7 | 8 | typedef int ssize_t; 9 | #define snprintf _snprintf 10 | 11 | #define HAVE_DECL_STRDUP 1 12 | #define HAVE_DECL_FILENO 1 13 | #define HAVE_DECL_PUTENV 1 14 | 15 | #define _CRT_SECURE_NO_WARNINGS 16 | 17 | /* disable some warnings */ 18 | #pragma warning (disable: 4090) /* const assigned to non-const */ 19 | #pragma warning (disable: 4996) /* fileno is deprecated */ 20 | 21 | #endif /* _ MSC_VER */ 22 | 23 | 24 | #define LWIP_UNITTESTS_NOFORK 25 | 26 | #include 27 | 28 | typedef unsigned int clockid_t; 29 | typedef unsigned int timer_t; 30 | #define STRUCT_TIMESPEC_DEFINITION_MISSING 31 | -------------------------------------------------------------------------------- /contrib/ports/win32/check/stdbool.h: -------------------------------------------------------------------------------- 1 | #ifndef MY_STDBOOL_H 2 | #define MY_STDBOOL_H 3 | 4 | typedef int bool; 5 | #define true 1 6 | #define false 0 7 | #define __bool_true_false_are_defined 1 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /contrib/ports/win32/check/sys/time.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_SYS__TIME_H 2 | #define LWIP_SYS__TIME_H 3 | 4 | #include /* time_t */ 5 | 6 | struct timeval { 7 | time_t tv_sec; /* seconds */ 8 | long tv_usec; /* and microseconds */ 9 | }; 10 | int gettimeofday(struct timeval* tp, void* tzp); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /contrib/ports/win32/check/time.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) 5 | #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 6 | #else 7 | #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL 8 | #endif 9 | 10 | #include "config.h" 11 | 12 | struct timezone 13 | { 14 | int tz_minuteswest; /* minutes W of Greenwich */ 15 | int tz_dsttime; /* type of dst correction */ 16 | }; 17 | 18 | int gettimeofday(struct timeval *tv, struct timezone *tz) 19 | { 20 | FILETIME ft; 21 | unsigned __int64 tmpres = 0; 22 | static int tzflag; 23 | 24 | if (NULL != tv) { 25 | GetSystemTimeAsFileTime(&ft); 26 | 27 | tmpres |= ft.dwHighDateTime; 28 | tmpres <<= 32; 29 | tmpres |= ft.dwLowDateTime; 30 | 31 | /*converting file time to unix epoch*/ 32 | tmpres -= DELTA_EPOCH_IN_MICROSECS; 33 | tmpres /= 10; /*convert into microseconds*/ 34 | tv->tv_sec = (long)(tmpres / 1000000UL); 35 | tv->tv_usec = (long)(tmpres % 1000000UL); 36 | } 37 | 38 | if (NULL != tz) { 39 | if (!tzflag) { 40 | _tzset(); 41 | tzflag++; 42 | } 43 | tz->tz_minuteswest = _timezone / 60; 44 | tz->tz_dsttime = _daylight; 45 | } 46 | 47 | return 0; 48 | } 49 | 50 | struct tm * 51 | localtime_r(const time_t *timer, struct tm *result) 52 | { 53 | struct tm *local_result; 54 | 55 | if (result == NULL) { 56 | return NULL; 57 | } 58 | 59 | local_result = localtime (timer); 60 | if (local_result == NULL) { 61 | return NULL; 62 | } 63 | 64 | memcpy(result, local_result, sizeof(*result)); 65 | return result; 66 | } 67 | -------------------------------------------------------------------------------- /contrib/ports/win32/check/unistd.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_UNISTD_H 2 | #define LWIP_UNISTD_H 3 | 4 | /* include io.h for read() and write() */ 5 | #include 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /contrib/ports/win32/example_app/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(${LWIP_DIR}/contrib/ports/CMakeCommon.cmake) 2 | 3 | set (LWIP_INCLUDE_DIRS 4 | "${LWIP_DIR}/src/include" 5 | "${LWIP_DIR}/contrib/" 6 | "${LWIP_DIR}/contrib/ports/win32/include" 7 | "${LWIP_DIR}/contrib/examples/example_app" 8 | ) 9 | 10 | include(${LWIP_DIR}/src/Filelists.cmake) 11 | include(${LWIP_DIR}/contrib/Filelists.cmake) 12 | include(${LWIP_DIR}/contrib/ports/win32/Filelists.cmake) 13 | 14 | add_executable(example_app ${LWIP_DIR}/contrib/examples/example_app/test.c default_netif.c) 15 | target_include_directories(example_app PRIVATE ${LWIP_INCLUDE_DIRS}) 16 | target_compile_options(example_app PRIVATE ${LWIP_COMPILER_FLAGS}) 17 | target_compile_definitions(example_app PRIVATE ${LWIP_DEFINITIONS} ${LWIP_MBEDTLS_DEFINITIONS}) 18 | target_link_libraries(example_app ${LWIP_SANITIZER_LIBS} lwipallapps lwipcontribexamples lwipcontribapps lwipcontribaddons lwipcontribportwindows lwipcore lwipmbedtls) 19 | 20 | add_executable(makefsdata ${lwipmakefsdata_SRCS}) 21 | target_compile_options(makefsdata PRIVATE ${LWIP_COMPILER_FLAGS}) 22 | target_include_directories(makefsdata PRIVATE ${LWIP_INCLUDE_DIRS}) 23 | target_link_libraries(makefsdata ${LWIP_SANITIZER_LIBS} lwipcore lwipcontribportwindows) 24 | -------------------------------------------------------------------------------- /contrib/ports/win32/include/arch/bpstruct.h: -------------------------------------------------------------------------------- 1 | #pragma pack(push,1) 2 | -------------------------------------------------------------------------------- /contrib/ports/win32/include/arch/epstruct.h: -------------------------------------------------------------------------------- 1 | #pragma pack(pop) 2 | -------------------------------------------------------------------------------- /contrib/ports/win32/include/arch/perf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2001, Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * This file is part of the lwIP TCP/IP stack. 30 | * 31 | * Author: Adam Dunkels 32 | * 33 | */ 34 | #ifndef LWIP_PERF_H 35 | #define LWIP_PERF_H 36 | 37 | #define PERF_START /* null definition */ 38 | #define PERF_STOP(x) /* null definition */ 39 | 40 | #endif /* LWIP_PERF_H */ 41 | -------------------------------------------------------------------------------- /contrib/ports/win32/msvc/build_coverity.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem Usage: pass the path to cov-build.exe (with trailing backslash, without the exe) as first parameter 3 | rem ATTENTION: this deletes the output folder "cov-int" and the output file "cov-int.zip" first! 4 | 5 | set devenv="%ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" 6 | if not exist %devenv% set devenv="%ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\vcexpress.exe" 7 | if not exist %devenv% set devenv="%ProgramFiles(x86)%\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" 8 | if not exist %devenv% set devenv="%ProgramFiles(x86)%\Microsoft Visual Studio 10.0\Common7\IDE\vcexpress.exe" 9 | set covbuild=%1cov-build.exe 10 | set covoutput=cov-int 11 | set zip7="c:\Program Files\7-Zip\7z.exe" 12 | 13 | pushd %~dp0 14 | 15 | if exist %covoutput% rd /s /q %covoutput% 16 | if exist %covoutput%.zip del %covoutput%.zip 17 | 18 | %covbuild% --dir %covoutput% %devenv% lwip_test.sln /build Debug || goto error 19 | 20 | if exist %zip7% goto dozip 21 | echo error: 7zip not found at \"%zip7% 22 | goto error 23 | :dozip 24 | %zip7% a %covoutput%.zip %covoutput% 25 | :error 26 | popd -------------------------------------------------------------------------------- /contrib/ports/win32/msvc/lwIP_pcapif.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {0d38b8c3-e694-4572-89b8-fc6e825a092d} 6 | cpp;c;cxx;rc;def;r;odl;idl;hpj;bat 7 | 8 | 9 | {e5ce29d5-319e-4e99-978b-b88e8d6167e4} 10 | 11 | 12 | 13 | 14 | Source Files 15 | 16 | 17 | Source Files 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | -------------------------------------------------------------------------------- /contrib/ports/win32/msvc/lwIP_unittests.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 11.00 2 | # Visual C++ Express 2010 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lwip_unittests", "lwip_unittests.vcxproj", "{6CCABAA4-F86F-4119-AFF8-43C9A4A234C2}" 4 | EndProject 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lwIP", "lwIP.vcxproj", "{2CC276FA-B226-49C9-8F82-7FCD5A228E28}" 6 | EndProject 7 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcheck", "libcheck.vcxproj", "{EBB156DC-01BF-47B2-B69C-1A750B6B5F09}" 8 | EndProject 9 | Global 10 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 11 | Debug|Win32 = Debug|Win32 12 | Release|Win32 = Release|Win32 13 | EndGlobalSection 14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 15 | {6CCABAA4-F86F-4119-AFF8-43C9A4A234C2}.Debug|Win32.ActiveCfg = Debug|Win32 16 | {6CCABAA4-F86F-4119-AFF8-43C9A4A234C2}.Debug|Win32.Build.0 = Debug|Win32 17 | {6CCABAA4-F86F-4119-AFF8-43C9A4A234C2}.Release|Win32.ActiveCfg = Release|Win32 18 | {6CCABAA4-F86F-4119-AFF8-43C9A4A234C2}.Release|Win32.Build.0 = Release|Win32 19 | {2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Debug|Win32.ActiveCfg = Debug unittests|Win32 20 | {2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Debug|Win32.Build.0 = Debug unittests|Win32 21 | {2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release|Win32.ActiveCfg = Release unittests|Win32 22 | {2CC276FA-B226-49C9-8F82-7FCD5A228E28}.Release|Win32.Build.0 = Release unittests|Win32 23 | {EBB156DC-01BF-47B2-B69C-1A750B6B5F09}.Debug|Win32.ActiveCfg = Debug|Win32 24 | {EBB156DC-01BF-47B2-B69C-1A750B6B5F09}.Debug|Win32.Build.0 = Debug|Win32 25 | {EBB156DC-01BF-47B2-B69C-1A750B6B5F09}.Release|Win32.ActiveCfg = Release|Win32 26 | {EBB156DC-01BF-47B2-B69C-1A750B6B5F09}.Release|Win32.Build.0 = Release|Win32 27 | EndGlobalSection 28 | GlobalSection(SolutionProperties) = preSolution 29 | HideSolutionNode = FALSE 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /contrib/ports/win32/msvc/makefsdata.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | 10 | 11 | Quelldateien 12 | 13 | 14 | -------------------------------------------------------------------------------- /contrib/ports/win32/pcapif.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_PCAPIF_H 2 | #define LWIP_PCAPIF_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include "lwip/err.h" 9 | 10 | /** Set to 1 to let rx use an own thread (only for NO_SYS==0). 11 | * If set to 0, ethernetif_poll is used to poll for packets. 12 | */ 13 | #ifndef PCAPIF_RX_USE_THREAD 14 | #define PCAPIF_RX_USE_THREAD !NO_SYS 15 | #endif 16 | #if PCAPIF_RX_USE_THREAD && NO_SYS 17 | #error "Can't create a dedicated RX thread with NO_SYS==1" 18 | #endif 19 | 20 | struct netif; 21 | 22 | err_t pcapif_init (struct netif *netif); 23 | void pcapif_shutdown(struct netif *netif); 24 | #if !PCAPIF_RX_USE_THREAD 25 | void pcapif_poll (struct netif *netif); 26 | #endif /* !PCAPIF_RX_USE_THREAD */ 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | 32 | #endif /* LWIP_PCAPIF_H */ 33 | -------------------------------------------------------------------------------- /contrib/ports/win32/pcapif_helper.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_PCAPIF_HELPER_H 2 | #define LWIP_PCAPIF_HELPER_H 3 | 4 | #include 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | struct pcapifh_linkstate; 11 | 12 | enum pcapifh_link_event { 13 | PCAPIF_LINKEVENT_UNKNOWN, 14 | PCAPIF_LINKEVENT_UP, 15 | PCAPIF_LINKEVENT_DOWN 16 | }; 17 | 18 | struct pcapifh_linkstate* pcapifh_linkstate_init(char *adapter_name); 19 | enum pcapifh_link_event pcapifh_linkstate_get(struct pcapifh_linkstate* state); 20 | void pcapifh_linkstate_close(struct pcapifh_linkstate* state); 21 | 22 | void *pcapifh_alloc_readonly_copy(void *data, size_t len); 23 | void pcapifh_free_readonly_mem(void *data); 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | 29 | #endif /* LWIP_PCAPIF_HELPER_H */ 30 | -------------------------------------------------------------------------------- /contrib/ports/win32/readme.txt: -------------------------------------------------------------------------------- 1 | lwIP for Win32 2 | 3 | This is an example port of lwIP for Win32. It uses WinPCAP to send & receive packets. 4 | To compile it, use the MSVC projects in the 'msvc' subdir or the Makefile in the 'mingw' subdir. 5 | 6 | For both compilers: 7 | - the lwIP core repository must be in a folder "lwip" next to the "contrib" folder 8 | - you have to set an environment variable PCAP_DIR pointing to the WinPcap Developer's 9 | Pack (containing 'include' and 'lib') 10 | alternatively, place the WinPcap Developer's pack next to the "lwip" and "contrib" folders: 11 | "winpcap\WpdPack" 12 | 13 | You also will have to copy the file 'lwipcfg_msvc.h.example' to 14 | 'lwipcfg_msvc.h' and modify to suit your needs (WinPcap adapter number, 15 | IP configuration, applications...). 16 | 17 | Included in the contrib\ports\win32 directory is the network interface driver 18 | using the winpcap library. 19 | 20 | lwIP: http://savannah.nongnu.org/projects/lwip/ 21 | WinPCap: https://www.winpcap.org/devel.htm 22 | Visual C++: http://www.microsoft.com/express/download/ 23 | 24 | To compile the unittests (msvc\lwIP_unittests.sln), download check (tested with v0.11.0) from 25 | https://github.com/libcheck/check/releases/ 26 | and place it in a folder "check" next to the "contrib" folder. 27 | -------------------------------------------------------------------------------- /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 | ppp.txt - Documentation of the PPP interface for lwIP. 7 | -------------------------------------------------------------------------------- /doc/ZeroCopyRx.c: -------------------------------------------------------------------------------- 1 | typedef struct my_custom_pbuf 2 | { 3 | struct pbuf_custom p; 4 | void* dma_descriptor; 5 | } my_custom_pbuf_t; 6 | 7 | LWIP_MEMPOOL_DECLARE(RX_POOL, 10, sizeof(my_custom_pbuf_t), "Zero-copy RX PBUF pool"); 8 | 9 | void my_pbuf_free_custom(void* p) 10 | { 11 | SYS_ARCH_DECL_PROTECT(old_level); 12 | 13 | my_custom_pbuf_t* my_puf = (my_custom_pbuf_t*)p; 14 | 15 | // invalidate data cache here - lwIP and/or application may have written into buffer! 16 | // (invalidate is faster than flushing, and no one needs the correct data in the buffer) 17 | invalidate_cpu_cache(p->payload, p->tot_len); 18 | 19 | SYS_ARCH_PROTECT(old_level); 20 | free_rx_dma_descriptor(my_pbuf->dma_descriptor); 21 | LWIP_MEMPOOL_FREE(RX_POOL, my_pbuf); 22 | SYS_ARCH_UNPROTECT(old_level); 23 | } 24 | 25 | void eth_rx_irq() 26 | { 27 | dma_descriptor* dma_desc = get_RX_DMA_descriptor_from_ethernet(); 28 | my_custom_pbuf_t* my_pbuf = (my_custom_pbuf_t*)LWIP_MEMPOOL_ALLOC(RX_POOL); 29 | 30 | my_pbuf->p.custom_free_function = my_pbuf_free_custom; 31 | my_pbuf->dma_descriptor = dma_desc; 32 | 33 | invalidate_cpu_cache(dma_desc->rx_data, dma_desc->rx_length); 34 | 35 | struct pbuf* p = pbuf_alloced_custom(PBUF_RAW, 36 | dma_desc->rx_length, 37 | PBUF_REF, 38 | &my_pbuf->p, 39 | dma_desc->rx_data, 40 | dma_desc->max_buffer_size); 41 | 42 | if(netif->input(p, netif) != ERR_OK) { 43 | pbuf_free(p); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /doc/doxygen/generate.bat: -------------------------------------------------------------------------------- 1 | doxygen lwip.Doxyfile 2 | -------------------------------------------------------------------------------- /doc/doxygen/generate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | doxygen lwip.Doxyfile 4 | -------------------------------------------------------------------------------- /doc/doxygen/output/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Redirection 5 | 6 | 7 | 8 | index.html 9 | 10 | 11 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /src/apps/http/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 | -------------------------------------------------------------------------------- /src/apps/http/fs/img/sics.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaybhargav/lwip_nat/399b9908193fb86357424c996c5d47e7a51e5f6b/src/apps/http/fs/img/sics.gif -------------------------------------------------------------------------------- /src/apps/http/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 | -------------------------------------------------------------------------------- /src/apps/http/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 | /* THIS FILE IS DEPRECATED AND WILL BE REMOVED IN THE FUTURE */ 39 | /* content was moved to fs.h to simplify #include structure */ 40 | 41 | #endif /* LWIP_FSDATA_H */ 42 | -------------------------------------------------------------------------------- /src/apps/http/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 | 15 | The C version of this program can optionally store the none-SSI files in 16 | a compressed form in which they are also sent to the web client (which 17 | must support the Deflate content encoding). Files that grow during compression 18 | (due to being not compressible well), will stored umcompressed automatically. 19 | In order to do so, compile the program with MAKEFS_SUPPORT_DEFLATE set to 1. You must 20 | manually download minizip.c for this to work. As an alternative, you can additionally 21 | define MAKEFS_SUPPORT_DEFLATE_ZLIB to use your system's zlib instead. 22 | Compression of .html, .js, .css and .svg files usually yields very good compression 23 | rates and is a great way of reducing your program's size. 24 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /src/include/compat/posix/arpa/inet.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 | -------------------------------------------------------------------------------- /src/include/compat/posix/net/if.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * This file is a posix wrapper for lwip/if_api.h. 4 | */ 5 | 6 | /* 7 | * Copyright (c) 2017 Joel Cunningham, Garmin International, Inc. 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 | */ 35 | 36 | #include "lwip/if_api.h" 37 | -------------------------------------------------------------------------------- /src/include/compat/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 | -------------------------------------------------------------------------------- /src/include/compat/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 | -------------------------------------------------------------------------------- /src/include/compat/stdc/errno.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file 3 | * This file is a posix/stdc 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | void netbiosns_init(void); 42 | #ifndef NETBIOS_LWIP_NAME 43 | void netbiosns_set_name(const char* hostname); 44 | #endif 45 | void netbiosns_stop(void); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif /* LWIP_HDR_APPS_NETBIOS_H */ 52 | -------------------------------------------------------------------------------- /src/include/lwip/apps/smtp_opts.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_APPS_SMTP_OPTS_H 2 | #define LWIP_HDR_APPS_SMTP_OPTS_H 3 | 4 | #include "lwip/opt.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | /** 11 | * @defgroup smtp_opts Options 12 | * @ingroup smtp 13 | * 14 | * @{ 15 | */ 16 | 17 | /** Set this to 1 to enable data handler callback on BODY */ 18 | #ifndef SMTP_BODYDH 19 | #define SMTP_BODYDH 0 20 | #endif 21 | 22 | /** SMTP_DEBUG: Enable debugging for SNTP. */ 23 | #ifndef SMTP_DEBUG 24 | #define SMTP_DEBUG LWIP_DBG_OFF 25 | #endif 26 | 27 | /** Maximum length reserved for server name including terminating 0 byte */ 28 | #ifndef SMTP_MAX_SERVERNAME_LEN 29 | #define SMTP_MAX_SERVERNAME_LEN 256 30 | #endif 31 | 32 | /** Maximum length reserved for username */ 33 | #ifndef SMTP_MAX_USERNAME_LEN 34 | #define SMTP_MAX_USERNAME_LEN 32 35 | #endif 36 | 37 | /** Maximum length reserved for password */ 38 | #ifndef SMTP_MAX_PASS_LEN 39 | #define SMTP_MAX_PASS_LEN 32 40 | #endif 41 | 42 | /** Set this to 0 if you know the authentication data will not change 43 | * during the smtp session, which saves some heap space. */ 44 | #ifndef SMTP_COPY_AUTHDATA 45 | #define SMTP_COPY_AUTHDATA 1 46 | #endif 47 | 48 | /** Set this to 0 to save some code space if you know for sure that all data 49 | * passed to this module conforms to the requirements in the SMTP RFC. 50 | * WARNING: use this with care! 51 | */ 52 | #ifndef SMTP_CHECK_DATA 53 | #define SMTP_CHECK_DATA 1 54 | #endif 55 | 56 | /** Set this to 1 to enable AUTH PLAIN support */ 57 | #ifndef SMTP_SUPPORT_AUTH_PLAIN 58 | #define SMTP_SUPPORT_AUTH_PLAIN 1 59 | #endif 60 | 61 | /** Set this to 1 to enable AUTH LOGIN support */ 62 | #ifndef SMTP_SUPPORT_AUTH_LOGIN 63 | #define SMTP_SUPPORT_AUTH_LOGIN 1 64 | #endif 65 | 66 | /* Memory allocation/deallocation can be overridden... */ 67 | #ifndef SMTP_STATE_MALLOC 68 | #define SMTP_STATE_MALLOC(size) mem_malloc(size) 69 | #define SMTP_STATE_FREE(ptr) mem_free(ptr) 70 | #endif 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | 80 | #endif /* SMTP_OPTS_H */ 81 | -------------------------------------------------------------------------------- /src/include/lwip/apps/snmp_snmpv2_framework.h: -------------------------------------------------------------------------------- 1 | /* 2 | Generated by LwipMibCompiler 3 | */ 4 | 5 | #ifndef LWIP_HDR_APPS_SNMP_FRAMEWORK_MIB_H 6 | #define LWIP_HDR_APPS_SNMP_FRAMEWORK_MIB_H 7 | 8 | #include "lwip/apps/snmp_opts.h" 9 | #if LWIP_SNMP 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif /* __cplusplus */ 14 | 15 | #include "lwip/apps/snmp_core.h" 16 | 17 | extern const struct snmp_obj_id usmNoAuthProtocol; 18 | extern const struct snmp_obj_id usmHMACMD5AuthProtocol; 19 | extern const struct snmp_obj_id usmHMACSHAAuthProtocol; 20 | 21 | extern const struct snmp_obj_id usmNoPrivProtocol; 22 | extern const struct snmp_obj_id usmDESPrivProtocol; 23 | extern const struct snmp_obj_id usmAESPrivProtocol; 24 | 25 | extern const struct snmp_mib snmpframeworkmib; 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif /* __cplusplus */ 30 | 31 | #endif /* LWIP_SNMP */ 32 | #endif /* LWIP_HDR_APPS_SNMP_FRAMEWORK_MIB_H */ 33 | -------------------------------------------------------------------------------- /src/include/lwip/apps/snmp_snmpv2_usm.h: -------------------------------------------------------------------------------- 1 | /* 2 | Generated by LwipMibCompiler 3 | */ 4 | 5 | #ifndef LWIP_HDR_APPS_SNMP_USER_BASED_SM_MIB_H 6 | #define LWIP_HDR_APPS_SNMP_USER_BASED_SM_MIB_H 7 | 8 | #include "lwip/apps/snmp_opts.h" 9 | #if LWIP_SNMP 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif /* __cplusplus */ 14 | 15 | #include "lwip/apps/snmp_core.h" 16 | 17 | extern const struct snmp_mib snmpusmmib; 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif /* __cplusplus */ 22 | 23 | #endif /* LWIP_SNMP */ 24 | #endif /* LWIP_HDR_APPS_SNMP_USER_BASED_SM_MIB_H */ 25 | -------------------------------------------------------------------------------- /src/include/lwip/apps/tftp_client.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * @file tftp_client.h 4 | * TFTP client header 5 | * 6 | */ 7 | 8 | /* 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification,are permitted provided that the following conditions are met: 11 | * 12 | * 1. Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * 3. The name of the author may not be used to endorse or promote products 18 | * derived from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 22 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 23 | * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 25 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | * This file is part of the lwIP TCP/IP stack. 32 | * 33 | */ 34 | 35 | #ifndef LWIP_HDR_APPS_TFTP_CLIENT_H 36 | #define LWIP_HDR_APPS_TFTP_CLIENT_H 37 | 38 | #include "lwip/apps/tftp_common.h" 39 | 40 | enum tftp_transfer_mode { 41 | TFTP_MODE_OCTET, 42 | TFTP_MODE_NETASCII, 43 | TFTP_MODE_BINARY /* used in old versions only */ 44 | }; 45 | 46 | err_t tftp_init_client(const struct tftp_context* ctx); 47 | err_t tftp_get(void* handle, const ip_addr_t *addr, u16_t port, const char* fname, enum tftp_transfer_mode mode); 48 | err_t tftp_put(void* handle, const ip_addr_t *addr, u16_t port, const char* fname, enum tftp_transfer_mode mode); 49 | 50 | #endif /* LWIP_HDR_APPS_TFTP_CLIENT_H */ 51 | -------------------------------------------------------------------------------- /src/include/lwip/apps/tftp_server.h: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * @file tftp_server.h 4 | * TFTP server header 5 | * 6 | */ 7 | 8 | /* 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification,are permitted provided that the following conditions are met: 11 | * 12 | * 1. Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * 3. The name of the author may not be used to endorse or promote products 18 | * derived from this software without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 22 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO 23 | * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 25 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | * This file is part of the lwIP TCP/IP stack. 32 | * 33 | */ 34 | 35 | #ifndef LWIP_HDR_APPS_TFTP_SERVER_H 36 | #define LWIP_HDR_APPS_TFTP_SERVER_H 37 | 38 | #include "lwip/apps/tftp_common.h" 39 | 40 | err_t tftp_init_server(const struct tftp_context* ctx); 41 | 42 | #endif /* LWIP_HDR_APPS_TFTP_SERVER_H */ 43 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | #ifndef ECP_H 38 | #define ECP_H 39 | 40 | #ifdef __cplusplus 41 | extern "C" { 42 | #endif 43 | 44 | typedef struct ecp_options { 45 | bool required; /* Is ECP required? */ 46 | unsigned enctype; /* Encryption type */ 47 | } ecp_options; 48 | 49 | extern fsm ecp_fsm[]; 50 | extern ecp_options ecp_wantoptions[]; 51 | extern ecp_options ecp_gotoptions[]; 52 | extern ecp_options ecp_allowoptions[]; 53 | extern ecp_options ecp_hisoptions[]; 54 | 55 | extern const struct protent ecp_protent; 56 | 57 | #ifdef __cplusplus 58 | } 59 | #endif 60 | 61 | #endif /* ECP_H */ 62 | #endif /* PPP_SUPPORT && ECP_SUPPORT */ 63 | -------------------------------------------------------------------------------- /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 | lowpan6.c 9 | A 6LoWPAN implementation as a netif. 10 | 11 | lowpan6_ble.c 12 | A 6LoWPAN over Bluetooth Low Energy (BLE) implementation as netif, 13 | according to RFC-7668. 14 | 15 | slipif.c 16 | A generic implementation of the SLIP (Serial Line IP) 17 | protocol. It requires a sio (serial I/O) module to work. 18 | 19 | ppp/ Point-to-Point Protocol stack 20 | The lwIP PPP support is based from pppd (http://ppp.samba.org) with 21 | huge changes to match code size and memory requirements for embedded 22 | devices. Please read /doc/ppp.txt and ppp/PPPD_FOLLOWUP for a detailed 23 | explanation. 24 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /test/fuzz/README: -------------------------------------------------------------------------------- 1 | 2 | Fuzzing the lwIP stack (afl-fuzz requires linux/unix or similar) 3 | 4 | This directory contains small apps that read Ethernet frames from stdin and 5 | process them. They are 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 programs. 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 | -------------------------------------------------------------------------------- /test/fuzz/config.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaybhargav/lwip_nat/399b9908193fb86357424c996c5d47e7a51e5f6b/test/fuzz/config.h -------------------------------------------------------------------------------- /test/fuzz/fuzz.c: -------------------------------------------------------------------------------- 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: Erik Ekman 30 | * Simon Goldschmidt 31 | * 32 | */ 33 | 34 | #include "fuzz_common.h" 35 | 36 | int main(int argc, char** argv) 37 | { 38 | return lwip_fuzztest(argc, argv, LWIP_FUZZ_SINGLE, LWIP_FUZZ_DEFAULT); 39 | } 40 | -------------------------------------------------------------------------------- /test/fuzz/fuzz2.c: -------------------------------------------------------------------------------- 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: Erik Ekman 30 | * Simon Goldschmidt 31 | * 32 | */ 33 | 34 | #include "fuzz_common.h" 35 | 36 | int main(int argc, char** argv) 37 | { 38 | return lwip_fuzztest(argc, argv, LWIP_FUZZ_MULTIPACKET, LWIP_FUZZ_DEFAULT); 39 | } 40 | -------------------------------------------------------------------------------- /test/fuzz/fuzz3.c: -------------------------------------------------------------------------------- 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: Erik Ekman 30 | * Simon Goldschmidt 31 | * 32 | */ 33 | 34 | #include "fuzz_common.h" 35 | 36 | int main(int argc, char** argv) 37 | { 38 | return lwip_fuzztest(argc, argv, LWIP_FUZZ_MULTIPACKET_TIME, 39 | LWIP_FUZZ_STATICARP|LWIP_FUZZ_TCP_SERVER|LWIP_FUZZ_TCP_CLIENT|LWIP_FUZZ_UDP_SERVER|LWIP_FUZZ_UDP_CLIENT); 40 | } 41 | -------------------------------------------------------------------------------- /test/fuzz/inputs/arp/arp_req.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaybhargav/lwip_nat/399b9908193fb86357424c996c5d47e7a51e5f6b/test/fuzz/inputs/arp/arp_req.bin -------------------------------------------------------------------------------- /test/fuzz/inputs/icmp/icmp_ping.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaybhargav/lwip_nat/399b9908193fb86357424c996c5d47e7a51e5f6b/test/fuzz/inputs/icmp/icmp_ping.bin -------------------------------------------------------------------------------- /test/fuzz/inputs/ipv6/neighbor_solicitation.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaybhargav/lwip_nat/399b9908193fb86357424c996c5d47e7a51e5f6b/test/fuzz/inputs/ipv6/neighbor_solicitation.bin -------------------------------------------------------------------------------- /test/fuzz/inputs/ipv6/router_adv.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaybhargav/lwip_nat/399b9908193fb86357424c996c5d47e7a51e5f6b/test/fuzz/inputs/ipv6/router_adv.bin -------------------------------------------------------------------------------- /test/fuzz/inputs/tcp/tcp_syn.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaybhargav/lwip_nat/399b9908193fb86357424c996c5d47e7a51e5f6b/test/fuzz/inputs/tcp/tcp_syn.bin -------------------------------------------------------------------------------- /test/fuzz/inputs/udp/udp_port_5000.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ajaybhargav/lwip_nat/399b9908193fb86357424c996c5d47e7a51e5f6b/test/fuzz/inputs/udp/udp_port_5000.bin -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /test/sockets/sockets_stresstest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 Simon Goldschmidt 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 | 33 | #ifndef LWIP_HDR_TEST_SOCKETS_STRESSTEST 34 | #define LWIP_HDR_TEST_SOCKETS_STRESSTEST 35 | 36 | void sockets_stresstest_init_loopback(int addr_family); 37 | void sockets_stresstest_init_server(int addr_family, u16_t server_port); 38 | void sockets_stresstest_init_client(const char *remote_ip, u16_t remote_port); 39 | 40 | #endif /* LWIP_HDR_TEST_SOCKETS_STRESSTEST */ 41 | -------------------------------------------------------------------------------- /test/unit/Filelists.cmake: -------------------------------------------------------------------------------- 1 | # This file is indended to be included in end-user CMakeLists.txt 2 | # include(/path/to/Filelists.cmake) 3 | # It assumes the variable LWIP_DIR is defined pointing to the 4 | # root path of lwIP sources. 5 | # 6 | # This file is NOT designed (on purpose) to be used as cmake 7 | # subdir via add_subdirectory() 8 | # The intention is to provide greater flexibility to users to 9 | # create their own targets using the *_SRCS variables. 10 | 11 | if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0") 12 | include_guard(GLOBAL) 13 | endif() 14 | 15 | set(LWIP_TESTDIR ${LWIP_DIR}/test/unit) 16 | set(LWIP_TESTFILES 17 | ${LWIP_TESTDIR}/lwip_unittests.c 18 | ${LWIP_TESTDIR}/api/test_sockets.c 19 | ${LWIP_TESTDIR}/arch/sys_arch.c 20 | ${LWIP_TESTDIR}/core/test_def.c 21 | ${LWIP_TESTDIR}/core/test_dns.c 22 | ${LWIP_TESTDIR}/core/test_mem.c 23 | ${LWIP_TESTDIR}/core/test_netif.c 24 | ${LWIP_TESTDIR}/core/test_pbuf.c 25 | ${LWIP_TESTDIR}/core/test_timers.c 26 | ${LWIP_TESTDIR}/dhcp/test_dhcp.c 27 | ${LWIP_TESTDIR}/etharp/test_etharp.c 28 | ${LWIP_TESTDIR}/ip4/test_ip4.c 29 | ${LWIP_TESTDIR}/ip6/test_ip6.c 30 | ${LWIP_TESTDIR}/mdns/test_mdns.c 31 | ${LWIP_TESTDIR}/mqtt/test_mqtt.c 32 | ${LWIP_TESTDIR}/tcp/tcp_helper.c 33 | ${LWIP_TESTDIR}/tcp/test_tcp_oos.c 34 | ${LWIP_TESTDIR}/tcp/test_tcp.c 35 | ${LWIP_TESTDIR}/udp/test_udp.c 36 | ) 37 | -------------------------------------------------------------------------------- /test/unit/Makefile: -------------------------------------------------------------------------------- 1 | # Shortcuts to building and running tests on unix platforms. 2 | # Output files will be written to the directory listed below. 3 | 4 | all: 5 | cd ../../contrib/ports/unix/check/ && $(MAKE) 6 | 7 | check: 8 | cd ../../contrib/ports/unix/check/ && $(MAKE) check 9 | 10 | clean: 11 | cd ../../contrib/ports/unix/check/ && $(MAKE) clean 12 | -------------------------------------------------------------------------------- /test/unit/api/test_sockets.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_SOCKETS_H 2 | #define LWIP_HDR_TEST_SOCKETS_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite *sockets_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /test/unit/core/test_def.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_DEF_H 2 | #define LWIP_HDR_TEST_DEF_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite *def_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /test/unit/core/test_dns.c: -------------------------------------------------------------------------------- 1 | #include "test_dns.h" 2 | 3 | #include "lwip/dns.h" 4 | 5 | /* Setups/teardown functions */ 6 | 7 | static void 8 | dns_setup(void) 9 | { 10 | } 11 | 12 | static void 13 | dns_teardown(void) 14 | { 15 | } 16 | 17 | /* Test functions */ 18 | 19 | START_TEST(test_dns_set_get_server) 20 | { 21 | int n; 22 | LWIP_UNUSED_ARG(_i); 23 | 24 | for (n = 0; n < 256; n++) { 25 | u8_t i = (u8_t)n; 26 | ip_addr_t server; 27 | /* Should return a zeroed address for any index */ 28 | fail_unless(dns_getserver(i)); 29 | fail_unless(ip_addr_isany(dns_getserver(i))); 30 | 31 | /* Should accept setting address for any index, and ignore if out of range */ 32 | IP_ADDR4(&server, 10, 0, 0, i); 33 | dns_setserver(i, &server); 34 | fail_unless(dns_getserver(i)); 35 | if (i < DNS_MAX_SERVERS) { 36 | fail_unless(ip_addr_eq(dns_getserver(i), &server) == 1); 37 | } else { 38 | fail_unless(ip_addr_isany(dns_getserver(i))); 39 | } 40 | } 41 | } 42 | END_TEST 43 | 44 | /** Create the suite including all tests for this module */ 45 | Suite * 46 | dns_suite(void) 47 | { 48 | testfunc tests[] = { 49 | TESTFUNC(test_dns_set_get_server) 50 | }; 51 | return create_suite("DNS", tests, sizeof(tests)/sizeof(testfunc), dns_setup, dns_teardown); 52 | } 53 | -------------------------------------------------------------------------------- /test/unit/core/test_dns.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_DNS_H 2 | #define LWIP_HDR_TEST_DNS_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite *dns_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /test/unit/core/test_netif.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_NETIF_H 2 | #define LWIP_HDR_TEST_NETIF_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite *netif_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /test/unit/core/test_timers.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_TIMERS_H 2 | #define LWIP_HDR_TEST_TIMERS_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite *timers_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /test/unit/ip4/test_ip4.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_IP4_H 2 | #define LWIP_HDR_TEST_IP4_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite* ip4_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /test/unit/ip6/test_ip6.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_IP6_H 2 | #define LWIP_HDR_TEST_IP6_H 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite* ip6_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /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 | #if (CHECK_MAJOR_VERSION == 0 && CHECK_MINOR_VERSION < 13) 17 | typedef struct { 18 | TFun func; 19 | const char *name; 20 | } testfunc; 21 | 22 | #define TESTFUNC(x) {(x), "" # x "" } 23 | 24 | /* Modified function from check.h, supplying function name */ 25 | #define tcase_add_named_test(tc,tf) \ 26 | _tcase_add_test((tc),(tf).func,(tf).name,0, 0, 0, 1) 27 | 28 | #else 29 | /* From 0.13.0 check keeps track of the method name internally */ 30 | typedef const TTest * testfunc; 31 | 32 | #define TESTFUNC(x) x 33 | 34 | #define tcase_add_named_test(tc,tf) tcase_add_test(tc,tf) 35 | #endif 36 | 37 | /** typedef for a function returning a test suite */ 38 | typedef Suite* (suite_getter_fn)(void); 39 | 40 | /** Create a test suite */ 41 | Suite* create_suite(const char* name, testfunc *tests, size_t num_tests, SFun setup, SFun teardown); 42 | 43 | #ifdef LWIP_UNITTESTS_LIB 44 | int lwip_unittests_run(void) 45 | #endif 46 | 47 | /* helper functions */ 48 | #define SKIP_POOL(x) (1 << x) 49 | #define SKIP_HEAP (1 << MEMP_MAX) 50 | void lwip_check_ensure_no_alloc(unsigned int skip); 51 | 52 | #endif /* LWIP_HDR_LWIP_CHECK_H */ 53 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /test/unit/mqtt/test_mqtt.h: -------------------------------------------------------------------------------- 1 | #ifndef LWIP_HDR_TEST_MQTT_H__ 2 | #define LWIP_HDR_TEST_MQTT_H__ 3 | 4 | #include "../lwip_check.h" 5 | 6 | Suite* mqtt_suite(void); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /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 | extern const ip_addr_t test_local_ip; 30 | extern const ip_addr_t test_remote_ip; 31 | extern const ip_addr_t test_netmask; 32 | #define TEST_REMOTE_PORT 0x100 33 | #define TEST_LOCAL_PORT 0x101 34 | 35 | /* Helper functions */ 36 | void tcp_remove_all(void); 37 | 38 | struct pbuf* tcp_create_segment(ip_addr_t* src_ip, ip_addr_t* dst_ip, 39 | u16_t src_port, u16_t dst_port, void* data, size_t data_len, 40 | u32_t seqno, u32_t ackno, u8_t headerflags); 41 | struct pbuf* tcp_create_rx_segment(struct tcp_pcb* pcb, void* data, size_t data_len, 42 | u32_t seqno_offset, u32_t ackno_offset, u8_t headerflags); 43 | struct pbuf* tcp_create_rx_segment_wnd(struct tcp_pcb* pcb, void* data, size_t data_len, 44 | u32_t seqno_offset, u32_t ackno_offset, u8_t headerflags, u16_t wnd); 45 | void tcp_set_state(struct tcp_pcb* pcb, enum tcp_state state, const ip_addr_t* local_ip, 46 | const ip_addr_t* remote_ip, u16_t local_port, u16_t remote_port); 47 | void test_tcp_counters_err(void* arg, err_t err); 48 | err_t test_tcp_counters_recv(void* arg, struct tcp_pcb* pcb, struct pbuf* p, err_t err); 49 | 50 | struct tcp_pcb* test_tcp_new_counters_pcb(struct test_tcp_counters* counters); 51 | 52 | void test_tcp_input(struct pbuf *p, struct netif *inp); 53 | 54 | void test_tcp_init_netif(struct netif *netif, struct test_tcp_txcounters *txcounters, 55 | const ip_addr_t *ip_addr, const ip_addr_t *netmask); 56 | 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | --------------------------------------------------------------------------------