From a02f4c0b92c318b43c4645ed918a5c58d0c00df8 Mon Sep 17 00:00:00 2001 From: Samuka007 Date: Mon, 10 Mar 2025 15:31:41 +0800 Subject: [PATCH] feat(net): Add Inet documenation --- docs/kernel/net/index.rst | 1 + docs/kernel/net/inet.md | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 docs/kernel/net/inet.md diff --git a/docs/kernel/net/index.rst b/docs/kernel/net/index.rst index d1c37e10..f1a49ea6 100644 --- a/docs/kernel/net/index.rst +++ b/docs/kernel/net/index.rst @@ -5,4 +5,5 @@ DragonOS 网络子系统 .. toctree:: :maxdepth: 1 + inet unix \ No newline at end of file diff --git a/docs/kernel/net/inet.md b/docs/kernel/net/inet.md new file mode 100644 index 00000000..674fd36b --- /dev/null +++ b/docs/kernel/net/inet.md @@ -0,0 +1,38 @@ +# Internet Protocol Socket + +众所都周之,这个 Inet Socket 常用的分为 TCP, UDP 和 ICMP。基于实用性,目前实现的是 TCP 和 UDP。 + +整个 Inet 网络协议栈与网卡的交互基于 `smoltcp` crate 来实现。 + +## Roadmap + +- [ ] TCP + - [x] 接受连接 + - [ ] 发起连接 + - [ ] 半双工关闭 +- [x] UDP + - [x] 传输数据 +- [ ] ICMP +- [ ] ioctl +- [ ] Misc + - [ ] 硬中断转软中断的锁处理(避免死锁) + - [ ] epoll_item 优化 + - [ ] 优化 `inet port` 资源管理 + +## TCP + +根据 TCP 状态机来 TCP Socket 的几个状态类 +- `Init`: 裸状态 + - `Unbound`: 创建出来的状态 + - `Bound`: 绑定了地址 +- `Listening`: 监听状态 +- `Connecting`: 连接中状态 +- `Established`: 连接建立状态 + +## UDP + +UDP 是无连接的,所以没有连接状态。UDP 的状态只有 `Unbound` 和 `Bound` 两种。 + +## BoundInner + +另一个对于 Inet Socket 的抽象,用于处理绑定网卡的 `socket`,从而封装 `smoltcp` 的接口,提供统一的资源管理。 \ No newline at end of file