diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000000000000000000000000000000000000..9f3b2db23c48fc44a2c9a334f847da02dc4627d9 --- /dev/null +++ b/README.en.md @@ -0,0 +1,83 @@ +# TCP/IP Protocol Stack Implementation + +This is a C-language implementation of a TCP/IP protocol stack, designed for learning and researching the underlying principles of network protocols. The project features a clear structure and well-modularized design, encompassing complete network protocol stack functionality. + +## Features + +- Complete TCP/IP protocol stack implementation +- Support for major protocols including ARP, IP, UDP, and ICMP +- Provides support for raw sockets and datagram sockets +- Includes a network device driver framework +- Implements foundational modules such as memory management, timers, and packet buffers + +## Directory Structure + +- `src/` - Source code directory + - `arp/` - ARP protocol implementation + - `ether/` - Ethernet protocol implementation + - `ipv4/` - IPv4 protocol implementation + - `udp/` - UDP protocol implementation + - `icmpv4/` - ICMP protocol implementation + - `socket/` - Socket interface implementation + - `net/` - Network core module + - `netif/` - Network interface implementation + - `mblock/` - Memory block management + - `timer/` - Timer management + - `common_list/` - Generic linked list implementation + - `plat/` - Platform-specific code + - `app/` - Application examples (ping, echo, etc.) + +## Usage Examples + +### UDP Echo Client +```c +#include "app/echo/udp_echo_client.h" + +int main() { + udp_echo_client_start("127.0.0.1", 7); + return 0; +} +``` + +### UDP Echo Server +```c +#include "app/echo/udp_echo_server.h" + +int main() { + udp_echo_server_thread_start(7); + return 0; +} +``` + +### Ping Program +```c +#include "app/ping/ping.h" + +int main() { + ping_t ping; + ping_run(&ping, "127.0.0.1", 4, 56, 1000); + return 0; +} +``` + +## Build Instructions + +Use the CMake build system: +```bash +mkdir build +cd build +cmake .. +make +``` + +## Contribution Guidelines + +Contributions of code and documentation are welcome. Please follow these steps: +1. Fork the repository +2. Create a new branch +3. Commit your changes +4. Submit a Pull Request + +## License + +This project is licensed under the MIT License. See the LICENSE file for details. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..b0edfa2c1ab225c39df341441349a3af2738e9da --- /dev/null +++ b/README.md @@ -0,0 +1,83 @@ +# TCP/IP协议栈实现 + +这是一个基于C语言的TCP/IP协议栈实现,适用于学习和研究网络协议底层原理。项目结构清晰,模块化设计良好,包含完整的网络协议栈功能。 + +## 功能特性 + +- 完整的TCP/IP协议栈实现 +- 支持ARP、IP、UDP、ICMP等主要协议 +- 提供原始套接字和数据报套接字支持 +- 包含网络设备驱动框架 +- 实现了内存管理、定时器、数据包缓冲区等基础模块 + +## 目录结构 + +- `src/` - 源代码目录 + - `arp/` - ARP协议实现 + - `ether/` - 以太网协议实现 + - `ipv4/` - IPv4协议实现 + - `udp/` - UDP协议实现 + - `icmpv4/` - ICMP协议实现 + - `socket/` - 套接字接口实现 + - `net/` - 网络核心模块 + - `netif/` - 网络接口实现 + - `mblock/` - 内存块管理 + - `timer/` - 定时器管理 + - `common_list/` - 通用链表实现 + - `plat/` - 平台相关代码 + - `app/` - 应用示例(ping、echo等) + +## 使用示例 + +### UDP回声客户端 +```c +#include "app/echo/udp_echo_client.h" + +int main() { + udp_echo_client_start("127.0.0.1", 7); + return 0; +} +``` + +### UDP回声服务器 +```c +#include "app/echo/udp_echo_server.h" + +int main() { + udp_echo_server_thread_start(7); + return 0; +} +``` + +### Ping程序 +```c +#include "app/ping/ping.h" + +int main() { + ping_t ping; + ping_run(&ping, "127.0.0.1", 4, 56, 1000); + return 0; +} +``` + +## 构建方法 + +使用CMake构建系统: +```bash +mkdir build +cd build +cmake .. +make +``` + +## 贡献指南 + +欢迎贡献代码和文档。请遵循以下步骤: +1. Fork仓库 +2. 创建新分支 +3. 提交代码更改 +4. 发起Pull Request + +## 许可证 + +本项目采用MIT许可证。详情请参阅LICENSE文件。 \ No newline at end of file