LwIP 之一 详解源码目录文件、及移植过程、版本变更

LwIP 是一个轻量级的TCP/IP协议栈,适用于嵌入式系统。本文详细介绍了LwIP的版本变更,源码目录结构,包括api、apps和core目录的功能。LwIP提供了Callback-style APIs和Sequential-style APIs,以及 Raw API、Netconn API和Socket API。移植LwIP涉及操作系统接口、网络接口驱动和初始化步骤。同时,文章还讨论了不同版本中API和文档的不匹配问题。
摘要由CSDN通过智能技术生成

  LwIP 是 TCP/IP 协议套件的一个小型独立实现。LwIP TCP/IP 实现的重点是减少 RAM 使用同时仍然有一个完整的 TCP。 这使得 lwIP 适合使用在具有数 10k 字节的可用 RAM 和空间大约 40k 字节的代码 ROM 的嵌入式系统中。

版本变更

2.1.x

   LwIP 从 2.0.3 版本,直接跳到了 2.1.0 版本,又是一个大的版本更新。增加了一些功能!同时源码的目录结构也有了一定的变化(增加了一些文件)! 按照 LwIP 的发布策略,以后 2.1.x 都是从 2.1.0 版本开始的 BUG 修复版本,最新的 BUG 修复版本是 2.1.2。具体变化参见源码目录下的 CHANGELOG 文件。下图显示了 2.0.3 版 和 2.1.2 版的文件对比差异:
在这里插入图片描述
  关于这个版本,官网有个这么一句话 “Oh, and this will be the last release with a separate contrib repository. I’ll be merging the files from contrib into the main repository soon after th

INTRODUCTION lwIP is a small independent implementation of the TCP/IP protocol suite. The focus of the lwIP TCP/IP implementation is to reduce the RAM usage while still having a full scale TCP. This making lwIP suitable for use in embedded systems with tens of kilobytes of free RAM and room for around 40 kilobytes of code ROM. lwIP was originally developed by Adam Dunkels at the Computer and Networks Architectures (CNA) lab at the Swedish Institute of Computer Science (SICS) and is now developed and maintained by a worldwide network of developers. FEATURES * IP (Internet Protocol, IPv4 and IPv6) including packet forwarding over multiple network interfaces * ICMP (Internet Control Message Protocol) for network maintenance and debugging * IGMP (Internet Group Management Protocol) for multicast traffic management * MLD (Multicast listener discovery for IPv6). Aims to be compliant with RFC 2710. No support for MLDv2 * ND (Neighbor discovery and stateless address autoconfiguration for IPv6). Aims to be compliant with RFC 4861 (Neighbor discovery) and RFC 4862 (Address autoconfiguration) * DHCP, AutoIP/APIPA (Zeroconf), ACD (Address Conflict Detection) and (stateless) DHCPv6 * UDP (User Datagram Protocol) including experimental UDP-lite extensions * TCP (Transmission Control Protocol) with congestion control, RTT estimation fast recovery/fast retransmit and sending SACKs * raw/native API for enhanced performance * Optional Berkeley-like socket API * TLS: optional layered TCP ("altcp") for nearly transparent TLS for any TCP-based protocol (ported to mbedTLS) (see changelog for more info) * PPPoS and PPPoE (Point-to-point protocol over Serial/Ethernet) * DNS (Domain name resolver incl. mDNS) * 6LoWPAN (via IEEE 802.15.4, BLE or ZEP) APPLICATIONS * HTTP server with SSI and CGI (HTTPS via altcp) * SNMPv2c agent with MIB compiler (Simple Network Management Protocol), v3 via altcp * SNTP (Simple network time protocol) * NetBIOS name service responder * MDNS (Multicast DNS) responder * iPerf server implementation * MQTT client (TLS support via altcp) LICENSE lwIP is freely available under a BSD license. DEVELOPMENT lwIP has grown into an excellent TCP/IP stack for embedded devices, and developers using the stack often submit bug fixes, improvements, and additions to the stack to further increase its usefulness. Development of lwIP is hosted on Savannah, a central point for software development, maintenance and distribution. Everyone can help improve lwIP by use of Savannah's interface, Git and the mailing list. A core team of developers will commit changes to the Git source tree. The lwIP TCP/IP stack is maintained in the 'lwip' Git module and contributions (such as platform ports) are in the 'contrib' Git module. See doc/savannah.txt for details on Git server access for users and developers. The current Git trees are web-browsable: http://git.savannah.gnu.org/cgit/lwip.git http://git.savannah.gnu.org/cgit/lwip/lwip-contrib.git Submit patches and bugs via the lwIP project page: http://savannah.nongnu.org/projects/lwip/ Continuous integration builds (GCC, clang): https://travis-ci.org/lwip-tcpip/lwip DOCUMENTATION Self documentation of the source code is regularly extracted from the current Git sources and is available from this web page: http://www.nongnu.org/lwip/ Also, there are mailing lists you can subscribe at http://savannah.nongnu.org/mail/?group=lwip plus searchable archives: http://lists.nongnu.org/archive/html/lwip-users/ http://lists.nongnu.org/archive/html/lwip-devel/ There is a wiki about lwIP at http://lwip.wikia.com/wiki/LwIP_Wiki You might get questions answered there, but unfortunately, it is not as well maintained as it should be. lwIP was originally written by Adam Dunkels: http://dunkels.com/adam/ Reading Adam's papers, the files in docs/, browsing the source code documentation and browsing the mailing list archives is a good way to become familiar with the design of lwIP. Adam Dunkels Leon Woestenberg
官网下载的最新的LWIP源码,非常详细,不但有完整的IPTCP源码,还包括http, mttp源码。 FEATURES * IP (Internet Protocol, IPv4 and IPv6) including packet forwarding over multiple network interfaces * ICMP (Internet Control Message Protocol) for network maintenance and debugging * IGMP (Internet Group Management Protocol) for multicast traffic management * MLD (Multicast listener discovery for IPv6). Aims to be compliant with RFC 2710. No support for MLDv2 * ND (Neighbor discovery and stateless address autoconfiguration for IPv6). Aims to be compliant with RFC 4861 (Neighbor discovery) and RFC 4862 (Address autoconfiguration) * DHCP, AutoIP/APIPA (Zeroconf), ACD (Address Conflict Detection) and (stateless) DHCPv6 * UDP (User Datagram Protocol) including experimental UDP-lite extensions * TCP (Transmission Control Protocol) with congestion control, RTT estimation fast recovery/fast retransmit and sending SACKs * raw/native API for enhanced performance * Optional Berkeley-like socket API * TLS: optional layered TCP ("altcp") for nearly transparent TLS for any TCP-based protocol (ported to mbedTLS) (see changelog for more info) * PPPoS and PPPoE (Point-to-point protocol over Serial/Ethernet) * DNS (Domain name resolver incl. mDNS) * 6LoWPAN (via IEEE 802.15.4, BLE or ZEP) APPLICATIONS * HTTP server with SSI and CGI (HTTPS via altcp) * SNMPv2c agent with MIB compiler (Simple Network Management Protocol), v3 via altcp * SNTP (Simple network time protocol) * NetBIOS name service responder * MDNS (Multicast DNS) responder * iPerf server implementation * MQTT client (TLS support via altcp)
lwip(Lightweight IP协议栈是一个嵌入式实现的轻量级网络通信协议栈。下面将对lwip协议栈源码进行详解lwip协议栈包含了常用的网络协议,如IPTCP、UDP、ICMP等,以及相应的应用层接口。它的设计目标是针对资源有限的嵌入式设备进行优化,具有较小的内存占用和较低的计算负载。lwip协议栈支持多种操作系统和硬件平台,并且易于移植和定制。 lwip协议栈源码主要包括核心组件和协议实现。核心组件包括网络接口、IP协议栈TCP/IP协议栈和UDP协议栈。协议实现包括IPV4/6协议、ARP协议、DHCP协议、ICMP协议、TCP传输控制协议和UDP用户数据报协议等。 lwip协议栈源码结构清晰,易于阅读和理解。它采用了模块化的设计思想,各个模块之间通过函数调用进行交互。源码中使用了大量的宏定义和数据结构,以提高代码的可读性和可维护性。 在lwip协议栈源码中,可以看到它的实现流程。首先,lwip会初始化网络接口和协议栈相关的数据结构。然后,它会根据网络接口收到的数据包进行处理,包括解析和分发。接着,根据协议类型,lwip会调用相应的协议实现进行数据包的处理和转发。最后,处理完数据包后,lwip会根据协议规则生成相应的响应包,并发送到网络接口。 总之,lwip协议栈源码是一个高效、可靠且易于移植的嵌入式网络通信协议栈。通过对其源码的详细分析和理解,我们可以深入了解网络通信的实现原理,并在嵌入式设备中实现各种网络应用。
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ZC·Shou

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值