更新架构图和readme

Signed-off-by: Agrant <luojuheng@huawei.com>
This commit is contained in:
Agrant
2025-06-02 19:59:14 +08:00
parent 94959b3bd2
commit bf0fb7db38
7 changed files with 98 additions and 84 deletions
+63 -55
View File
@@ -1,7 +1,7 @@
# t2stack
#### Description
t2stack is a collective name for the simplified network protocol stack and its supporting middleware for intelligent terminal scenarios, which mainly provides two core transmission capabilities: file and stream, and is suitable for multiple operating system platforms.
## Description
t2stack is a collective name for the simplified network protocol stack and its supporting middleware for intelligent terminal scenarios. It mainly provides three core capabilities: file transmission, audio and video stream transmission, and device discovery, while being compatible with various operating system platforms.
File transfer capability: Mainly for file sharing and cloning scenarios, compared with the Linux kernel protocol stack used before the application, the innovative protocol of t2stack can provide higher bandwidth utilization and lower latency than TCP in the WIFI environment, and provide a variety of optimizations in file transfer, such as large and small file collaboration, small file packaging and other purposes.
@@ -9,73 +9,81 @@ Streaming capability: Mainly for video streaming and audio streaming scenarios,
Device discovery capability: It mainly provides the ability to discover between devices in the local area network, and realizes reliable unicast, power-reducing filtering, and scalable packet structure.
#### System Architecture
## System Architecture
![](figures/t2stack_arch_eng.jpg)
#### Instructions
<div align="left">
<img src=figures/arch_eng.png width=75%/>
</div>
### Instructions
t2stack main code directory structure is as follows
```text
//t2stack
├── fillp # Streaming protocol code
   ├── include # VTP External interface code
   ├── src # VTP Core code
├── include # Dstream External interface code
├── src # Dstream Core code
├── nstackx_congestion # congestion algorithms public module
   ├── interface # External interface code
   ├── core # Core code
   ├── platform # Adaptation code for different platforms
├── interface # External interface code
├── core # Core code
├── platform # Adaptation code for different platforms
├── nstackx_core # File transfer protocol code
   ├── dfile # DFile protocol code
   |   ├── include # DFile External interface code
   |   ├── src # DFile Core code
   ├── platform # Adaptation code for different platforms
├── dfile # DFile protocol code
| ├── include # DFile External interface code
| ├── src # DFile Core code
├── platform # Adaptation code for different platforms
├── nstackx_ctrl # ctrl module
   ├── interface # External interface code
   ├── core # Core code
   ├── platform # Adaptation code for different platforms
├── interface # External interface code
├── core # Core code
├── platform # Adaptation code for different platforms
├── nstackx_util # public module
   ├── interface # External interface code
   ├── core # Core code
   ├── platform # Adaptation code for different platforms
├── interface # External interface code
├── core # Core code
├── platform # Adaptation code for different platforms
```
#### Introduction to the main interface functions
##### File Transfer
1. Establish a connection
NSTACKX_DFileServer:Create a file transfer server
NSTACKX_DFileClient:Create a file transfer client
NSTACKX_DFileClose:close file trasfer
2. File transfer
NSTACKX_DFileSendFiles:client send files
NSTACKX_DFileSetStoragePath:server set file's storage path
NSTACKX_DFileSetRenameHook:Set a callback function on server end to rename files with the same path and the same file name to prevent them from being overwritten
3. Get and Set Capabilities
NSTACKX_DFileGetCapabilities:Get DFile's Capabilities
NSTACKX_DFileSetCapabilities:Set DFile's Capabilities
4. Interactive processes
## Introduction to the main interface functions
![](figures/File_transfer_processes.png)
### File Transfer
#### 1. Set up a connection.
Step 1: NSTACKX_DFileServer: Create a file transfer server.
Step 2: NSTACKX_DFileClient: Create a file transfer client and connect it to the server.
#### 2. Close the connection.
NSTACKX_DFileClose: closes a file transfer session instance.
#### 3. Transferring Files
NSTACKX_DFileSendFiles: The client sends a file.
NSTACKX_DFileSetStoragePath: Sets the root path for storing received files on the recipient side.
NSTACKX_DFileSetRenameHook: The receiver sets a callback function to rename the file with the same name in the same path to prevent the file from being overwritten.
#### 4. Obtains and sets supported functions.
NSTACKX_DFileGetCapabilities: Obtains the functions supported by the DFile.
NSTACKX_DFileSetCapabilities: Sets the functions to be enabled for the DFile.
#### 5. Interaction Process
##### Stream Transfer
1. Initialize and destroy
FtInit:initialize the VTP/FillP stack
FtDestroy:deinitialize the FillP stack
2. Establish a connection
FtSocket:create socket
FtBind:bind socket and address on server
FtListen:listen for connections on a socket
FtAccept:acccept a connection on a socket
FtConnect:Initiate a connection on a socket
3. Send and recv
FtSendFrame:Send a video frame on a socket
FtRecv:receive messages from a socket
4. Close a connection
FtClose:close the socket connection and releases all associated resources
5. Interactive processes
<div align="left">
<img src=figures/File_transfer_processes.png width=75%/>
</div>
![](figures/Stream_transfer_processes.png)
### Stream Transfer
#### 1. Initialization and Destruction
FtInit: Initializes Fillp before use.
FtDestroy: Destroys Fillp after use.
#### 2. Establish a connection.
FtSocket: creates a socket.
FtBind: The server binds the socket to the address.
FtListen: The server enables the socket to enter the listening state.
FtAccept: The server starts to receive the connection request from the client.
FtConnect: The client invokes this interface to connect to the server.
#### 3. Sending and Receiving
FtSendFrame: The client invokes this interface to send a video frame.
FtRecv: The receiver calls this interface to receive video frames.
#### 4. Close the connection.
FtClose: This interface is invoked to close a connection.
##### For more information about APIs, see API Documentation
#### 5. Interaction Process
<div align="left">
<img src=figures/Stream_transfer_processes.png width=80%/>
</div>
## For more information about APIs, see API Documentation
[Interface doc of t2stack](https://gitcode.com/openharmony-sig/communication_t2stack/blob/master/%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E%E6%96%87%E6%A1%A3.md)
+35 -29
View File
@@ -1,26 +1,27 @@
# t2stack
#### 简介
t2stack是面向智能终端场景的极简网络协议栈及其配套中间件的统称,主要提供文件、流两大核心传输能力,且适配多种操作系统平台;
## 简介
t2stack是面向智能终端场景的极简网络协议栈及其配套中间件的统称,主要提供文件、音视频流以及设备发现三大核心能力,且适配多种操作系统平台;同时,也属于软总线下面的关键传输、设备发现模块,在华为分享,克隆,cast+场景提供了关键能力。
文件传输能力:主要针对文件分享和克隆场景,与应用之前使用的Linux内核协议栈相比,用t2stack私有的创新型协议,可以提供在WIFI环境下比TCP更高的带宽利用率和更低的时延,并在文件传输中提供多种优化,如大小文件协同、小文件打包等用途。
文件传输能力:主要针对文件分享和克隆场景,与应用之前使用的Linux内核协议栈相比,使用t2stack私有的创新型协议,可以提供在WIFI环境下比TCP更高的带宽利用率和更低的时延,并在文件传输中提供多种优化,如大小文件协同、小文件打包等用途。
流传输能力:主要针对视频流、音频流传输场景,实现半可靠传输、带宽评估码率自适应、弱网检测动态缓存等三大竞争力方案,优化用户体验。
流传输能力:主要针对视频流、音频流传输场景,实现半可靠传输,自适应丢掉非关键帧,避免传输阻塞、带宽评估码率自适应、弱网检测动态缓存等三大竞争力方案,优化用户体验。
设备发现能力:主要提供局域网下设备之间进行发现能力,实现可靠单播、降功耗过滤、可扩展报文结构。
设备发现能力:主要提供局域网下设备之间发现能力,实现可靠单播、可扩展报文结构。
#### 系统架构
## 系统架构
<div align="left">
<img src=figures/arch.png width=75%/>
</div>
![](figures/t2stack_arch.jpg)
#### 目录
### 目录
t2stack主要代码目录结构如下:
```text
//t2stack
├── fillp # 流传输协议代码
│   ├── include # VTP对外接口代码
│   ├── src # VTP核心代码
│   ├── include # Dstream对外接口代码
│   ├── src # Dstream核心代码
├── nstackx_congestion # 拥塞算法相关公共模块
│   ├── interface # 对外接口
│   ├── core # 核心代码
@@ -41,42 +42,47 @@ t2stack主要代码目录结构如下:
```
#### 主要接口功能介绍
## 主要接口功能介绍
##### 文件传输
1. 建立连接
NSTACKX_DFileServer:创建文件传输服务端
NSTACKX_DFileClient:创建文件传输客户端,连接到服务端
### 文件传输
#### 1. 建立连接
Step 1: NSTACKX_DFileServer:创建文件传输服务端
Step 2: NSTACKX_DFileClient:创建文件传输客户端,连接到服务端
#### 2. 关闭连接
NSTACKX_DFileClose:关闭文件传输会话实例。
2. 传输文件
#### 3. 传输文件
NSTACKX_DFileSendFiles:客户端发送文件
NSTACKX_DFileSetStoragePath:接收端设置接收文件存储根路径
NSTACKX_DFileSetRenameHook:接收端设置一个回调函数,对相同路径相同文件名的文件进行重命名,防止被覆盖
3. 获取和设置支持的功能
#### 4. 获取和设置支持的功能
NSTACKX_DFileGetCapabilities:获取DFile支持的功能
NSTACKX_DFileSetCapabilities:设置DFile需要开启的功能
4. 交互流程
#### 5. 交互流程
![](figures/File_transfer_processes.png)
<div align="left">
<img src=figures/File_transfer_processes.png width=75%/>
</div>
##### 流传输
1. 初始化和销毁
### 流传输
#### 1. 初始化和销毁
FtInit:使用前对Fillp进行初始化
FtDestroy:使用完对Fillp进行销毁
2. 建立连接
#### 2. 建立连接
FtSocket:创建socket
FtBind:服务端将socket与地址绑定
FtListen:服务端使socket进入监听
FtAccept:服务端开始接收客户端的连接
FtConnect:客户端调用此接口与服务端连接
3. 发送和接收
#### 3. 发送和接收
FtSendFrame:客户端调用此接口发送一个视频帧
FtRecv:接收端调用此接口接收视频帧
4. 关闭连接
#### 4. 关闭连接
FtClose:调用此接口来关闭连接
5. 交互流程
#### 5. 交互流程
![](figures/Stream_transfer_processes.png)
<div align="left">
<img src=figures/Stream_transfer_processes.png width=75%/>
</div>
##### 更多、更详细的接口说明请参考接口说明文档
## 更多、更详细的接口说明请参考接口说明文档
[t2stack接口说明文档](https://gitcode.com/openharmony-sig/communication_t2stack/blob/master/%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E%E6%96%87%E6%A1%A3.md)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 482 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 257 KiB