TCP Implementation (Part 1)
4.1 INTRODUCTION
Conceptually, the TCP is made up of several processes. Some of these deal with USER/TCP commands, and others with packets arriving from the network. The TCP also has an internal measurement facility which can be activated remotely.
Any particular TCP could be viewed in a number of ways. It could be implemented as an independent process, servicing many user processes. It could be viewed as a set of re-entrant library routines which share a common interface to the local PSN, and common buffer storage. It could even be viewed as a set of processes, some handling the user, some the input of packets from the net, and some the output of packets to the net.
4.2 TCP DATA STRUCTURES
4.2.1 INTERNETWORK PACKET FONMAT
8 bits: Internet information
2 bits: Reserved for local PSN use
2 bits: Header format (11 in binary)
4 bits: Protocol version number
8 bits: Header length in octets (32 is the current value)
16 bits: Length of text in octets
32 bits: Packet sequence number
32 bits: Acknowledgment number (i.e. sequence number of next octet
expected).
16 bits: Window size (in octets)
16 bits: Control Information
Listed from high to low order:
SYN: Request to synchronize sending sequence numbers
ACK: There is a valid acknowledgment in the 32 bit ACK field
FIN: Sender will stop SENDing and RECEIVEing on this connection
DSN: The sender has stopped using sequence numbers and wants to
initiate a new sequence number for sending.
EOS: This packet is the end of a segment and therefore has a
checksum in the 16 bit checksum field. If this bit is not set, the
16 bit checksum field is to be ignored. The bit is usually set,
but if fragmentation at a GATEWAY occurs, the packets preceding
the last one will not have checksums, and the last packet will
have the checksum for the entire original fragment (segment) as it
was calculated by the sending TCP.
EOL: This packet contains the last fragment of a letter. The EOS
bit will always be set in this case.
INT: The sender wants to INTERRUPT on this connection.
XXX: six (6) unused control bits
OD: three (3) bits of control dispatch:
000: Null (the control octet contents should be ignored}
001: Event Code is present in the control octet. These were
defined in section 2.4.3.
010: Special Functions
011: Reject (codes as yet undefined)
1XX: Unused
8 bits: Control Data Octet
If CD is 000 then this octet is to be ignored.
If CD is 001, this octet contains event codes defined in section
2.4.3
If CD is 010, this octet contains a special function code as
defined below:
0: RESET all connections between Source and Destination TCPs
l: RESET the specific connection referenced in this packet
2: ECHO return packet to sender with the special function code
ECHOR (Echo Reply).
3: QUERY Query status of connection referenced in this packet
4: STATUS Reply to QUERY with requested status.
5: ECHOR Echo Reply
6: TRASH Discard packet without acknowledgment
>6: Unused
Note: Special function packets not pertaining to a particular
connection [RESET all, ECHO, ECHOR, and TRASH] are normally
sent using socket zero as described in section 3.2.
If CD is 01l, this octet contains an as yet undefined REJECT code.
If CD is 1XX, this octet is undefined.
4 bits: Length of destination network address in 4 bit units (current
value is 1)
4 bits: Destination network address
1010-1111 are addresses of ARPANET, UCL, CYCLADES, NPL, CADC, and
EPSS respectively.
16 bits: Destination TCP address
8 bits: Padding
4 bits: length of source network address in 4 bit units (current
value is 1)
4 bits: source network address (as for destination address)
16 bits: Source TCP address
24 bits: Destination port address
24 bits: Source port address
16 bits: Checksum (if EOS bit is set)