The invention belongs to the technical field of network protocol stacks, and particularly relates to a method and a device for constructing an embedded network
protocol stack based on
Rust, common memory errors can be avoided by using the network
protocol stack compiled by the
Rust, a
memory management mechanism of the
Rust comprises an automatic
recovery mechanism and an ownership
system, the memory which is not used any more can be automatically released, and the reliability of the network
protocol stack is improved. The common memory security problems of memory leakage,
buffer overflow, repeated release and the like of the existing network protocol stack in an
embedded system are solved, and the stability and the performance of the
system are improved. The performance of the network protocol stack is optimized while the security of the memory is ensured, and the protocol stack is suitable for various embedded devices, especially in environments requiring high-reliability and efficient
memory management. According to the network protocol stack, the memory security problem existing in a common network protocol stack is solved, and meanwhile, the effect which cannot be achieved by
rewriting the network protocol stack only by simply using the Rust is achieved.