home .. forth .. colorforth mail list archive ..

[colorforth] TCP TCB structure


ok, here is my structure for the TCP TCB (Transmission Control Block). 

src address     (adl*32 bit)
src port        (16bit)
dest address    (adl*32 bit)
dest port       (16bit)
state           (32bit)
SND.UNA         (32bit)
SND.NXT         (32bit)
SND.WND         (32bit)
SND.UP          (32bit)
SND.WL1         (32bit)
SND.WL2         (32bit)
ISS             (32bit)
RCV.NXT         (32bit) 
RCV.WND         (32bit)
RCV.UP          (32bit)
IRS             (32bit)
RTQ             (32bit (ptr))
APP             (32bit (ptr))

        The first four fields, when taken together are the "socket 
number." This sould allow us to quickly search through the list of sockets 
to find the one to which this packet belongs. The address is length is 
adl*32 where adl is a variable set in the parent protocol's block.

        The next field is the current state which the TCP state engine is 
in. There are 11 states, 10 of which may be represented in this field:
LISTEN, SYN-SENT, SYN-RCVD, ESTAB, FIN-WAIT-1, FIN-WAIT-2, CLOSE-WAIT, CLOSING, 
LAST-ACK, TIME-WAIT, and CLOSED (which is not represented in the field,
because the TCB is distroyed as we enter the CLOSED state)

        The next 7 fields are the send sequence variables, they are all of 
the information required to know what has been sent, and what the next 
sequence number sould be.

        The next 4 fields are the recive sequence variables, they provide 
all if the information to decide if we can accept a packet that has been 
recived

        RTQ is a pointer to the retransmition queue, this is where we 
store packets which have been sent but are unACKed.

        APP is a pointer to the application-spicific function for 
handeling packets arriving to this socket.

XeF4 points out that tieing the TCP to IPv4 is bad, which is why i call 
for a variable to specify the size of the addresses. This implimentation 
also takes into account that one COULD impliment IP which allowes for 
multiple address per NIC (there may be other reasons to support this too). 
The obvious question is "why use the adderess at all?" because it a number 
that will always be unique to the target.

Oninoshiko

"A Pax, a pax, a pax upon thee"

---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com