Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/abhinavrobinson/rust-tcp-rfc-793

RFC 793 "TCP" Impl in Rust [education purpose only]
https://github.com/abhinavrobinson/rust-tcp-rfc-793

network-programming rust tcp

Last synced: 5 days ago
JSON representation

RFC 793 "TCP" Impl in Rust [education purpose only]

Awesome Lists containing this project

README

        

# RFC 793 (TCP) implementation in Rust

Handles TCP States:
```
[X] SYN
[ ] ACK
[ ] FIN
[ ] ...rest of tcp state
```

(Educational Purpose Only) Current version of program responds to IPv4 SYN packets and is able to recieve successful ACK packets from sender (netcat).

![Get ACK Packet](/_artifacts/get_ack.png?raw=true "Get ACK Packet from Netcat")

State Diagram:
```
Transmission Control Protocol
Functional Specification

+---------+ ---------\ active OPEN
| CLOSED | \ -----------
+---------+<---------\ \ create TCB
| ^ \ \ snd SYN
passive OPEN | | CLOSE \ \
------------ | | ---------- \ \
create TCB | | delete TCB \ \
V | \ \
+---------+ CLOSE | \
| LISTEN | ---------- | |
+---------+ delete TCB | |
rcv SYN | | SEND | |
----------- | | ------- | V
+---------+ snd SYN,ACK / \ snd SYN +---------+
| |<----------------- ------------------>| |
| SYN | rcv SYN | SYN |
| RCVD |<-----------------------------------------------| SENT |
| | snd ACK | |
| |------------------ -------------------| |
+---------+ rcv ACK of SYN \ / rcv SYN,ACK +---------+
| -------------- | | -----------
| x | | snd ACK
| V V
| CLOSE +---------+
| ------- | ESTAB |
| snd FIN +---------+
| CLOSE | | rcv FIN
V ------- | | -------
+---------+ snd FIN / \ snd ACK +---------+
| FIN |<----------------- ------------------>| CLOSE |
| WAIT-1 |------------------ | WAIT |
+---------+ rcv FIN \ +---------+
| rcv ACK of FIN ------- | CLOSE |
| -------------- snd ACK | ------- |
V x V snd FIN V
+---------+ +---------+ +---------+
|FINWAIT-2| | CLOSING | | LAST-ACK|
+---------+ +---------+ +---------+
| rcv ACK of FIN | rcv ACK of FIN |
| rcv FIN -------------- | Timeout=2MSL -------------- |
| ------- x V ------------ x V
\ snd ACK +---------+delete TCB +---------+
------------------------>|TIME WAIT|------------------>| CLOSED |
+---------+ +---------+

TCP Connection State Diagram
```