2. Philosophy
This chapter summarizes the philosophical basis of the TCP design, explaining TCP's position in the internet environment, design principles, and core concepts.
2.1. Elements of the Internetwork System
The internetwork environment consists of hosts connected to networks which are in turn interconnected via gateways. It is assumed here that the networks may be either local networks (e.g., the ETHERNET) or large networks (e.g., the ARPANET), but in any case are based on packet switching technology. The active agents that produce and consume messages are processes. Various levels of protocols in the networks, the gateways, and the hosts support an interprocess communication system that provides two-way data flow on logical connections between process ports.
Core Concepts
- Processes: Active agents that produce and consume messages
- Interprocess Communication System: Various levels of protocols in networks, gateways, and hosts support two-way data flow on logical connections between process ports
The term packet is used generically here to mean the data of one transaction between a host and its network. The format of data blocks exchanged within a network will generally not be of concern to us.
Terminology Definitions
| Term | Definition |
|---|---|
| Host | Computers attached to a network, and from the communication network's point of view, are the sources and destinations of packets |
| Process | Active elements in host computers (in accordance with the fairly common definition of a process as a program in execution) |
| Port | Logical endpoints through which a process communicates; a process may have multiple ports |
Important Point: All communication is viewed as inter-process communication. Even terminals and files or other I/O devices are viewed as communicating with each other through the use of processes.
Since a process may need to distinguish among several communication streams between itself and another process (or processes), we imagine that each process may have a number of ports through which it communicates with the ports of other processes.
2.2. Model of Operation
Data Transmission Flow
Sending Process
↓ [Calls TCP, passes data buffers]
Sending TCP
↓ [Packages data into segments]
Internet Module
↓ [Encapsulates into internet datagrams]
Local Network
↓ [Embeds in local network packets]
... (through packet switches, gateways) ...
↓
Destination Local Network
↓ [Unwraps]
Destination Internet Module
↓ [Extracts TCP segments]
Receiving TCP
↓ [Places data into user buffers]
Receiving Process
Detailed Description
Sending Side:
- Processes transmit data by calling on the TCP and passing buffers of data as arguments
- The TCP packages the data from these buffers into segments
- The TCP calls on the internet module to transmit each segment to the destination TCP
Receiving Side:
- The receiving TCP places the data from a segment into the receiving user's buffer
- The receiving TCP notifies the receiving user
Control Information:
- The TCPs include control information in the segments which they use to ensure reliable ordered data transmission
Internet Communication Model
[TCP Segment] → [Internet Datagram] → [Local Network Packet] → ...Gateway Forwarding... → [Destination]
Internet Module:
- Associated with each TCP
- Provides an interface to the local network
- Packages TCP segments inside internet datagrams
- Routes these datagrams to a destination internet module or intermediate gateway
Local Network Transmission:
- To transmit the datagram through the local network, it is embedded in a local network packet
- The packet switches may perform further packaging, fragmentation, or other operations to achieve the delivery of the local packet to the destination internet module
Gateway Operation
At a gateway between networks:
- Unwrapping: The internet datagram is "unwrapped" from its local packet
- Examination: Determines through which network the internet datagram should travel next
- Rewrapping: The internet datagram is "wrapped" in a local packet suitable to the next network
- Routing: Routed to the next gateway or to the final destination
Fragmentation Mechanism:
- A gateway is permitted to break up an internet datagram into smaller internet datagram fragments if this is necessary for transmission through the next network
- To do this, the gateway produces a set of internet datagrams, each carrying a fragment
- Fragments may be further broken into smaller fragments at subsequent gateways
- The internet datagram fragment format is designed so that the destination internet module can reassemble fragments into internet datagrams
Final Destination:
- A destination internet module unwraps the segment from the datagram (after reassembling the datagram, if necessary)
- Passes it to the destination TCP
Type of Service
This simple model of the operation glosses over many details. One important feature is the type of service. This provides information to the gateway (or internet module) to guide it in selecting the service parameters to be used in traversing the next network.
Included in type of service information:
- Precedence of the datagram: Priority level for processing
- Security information: To permit hosts and gateways that operate in multilevel secure environments to properly segregate datagrams for security considerations
2.3. The Host Environment
The TCP is assumed to be a module in an operating system. The users access the TCP much like they would access the file system. The TCP may call on other operating system functions, for example, to manage data structures.
Network Interface:
- The actual interface to the network is assumed to be controlled by a device driver module
- The TCP does not call on the network device driver directly
- Rather calls on the internet datagram protocol module which may in turn call on the device driver
Front-End Implementation:
- The mechanisms of TCP do not preclude implementation of the TCP in a front-end processor
- However, in such an implementation, a host-to-front-end protocol must provide the functionality to support the type of TCP-user interface described in this document
2.4. Interfaces
TCP/User Interface
The TCP/user interface provides for calls made by the user on the TCP to:
- OPEN or CLOSE a connection
- SEND or RECEIVE data
- Obtain STATUS about a connection
These calls are like other calls from user programs on the operating system, for example, the calls to open, read from, and close a file.
TCP/Internet Interface
The TCP/internet interface provides calls to send and receive datagrams addressed to TCP modules in hosts anywhere in the internet system. These calls have parameters for passing:
- Address
- Type of service
- Precedence
- Security
- Other control information
2.5. Relation to Other Protocols
The following diagram illustrates the place of the TCP in the protocol hierarchy:
+------+ +-----+ +-----+ +-----+
|Telnet| | FTP | |Voice| ... | | Application Level
+------+ +-----+ +-----+ +-----+
| | | |
+-----+ +-----+ +-----+
| TCP | | RTP | ... | | Host Level
+-----+ +-----+ +-----+
| | |
+-------------------------------+
| Internet Protocol & ICMP | Gateway Level
+-------------------------------+
|
+---------------------------+
| Local Network Protocol | Network Level
+---------------------------+
Protocol Relationships
Key Points:
- It is expected that the TCP will be able to support higher level protocols efficiently
- It should be easy to interface higher level protocols like the ARPANET Telnet or AUTODIN II THP to the TCP
2.6. Reliable Communication
A stream of data sent on a TCP connection is delivered reliably and in order at the destination.
Reliability Mechanisms
Sequence Numbers and Acknowledgments:
- Transmission is made reliable via the use of sequence numbers and acknowledgments
- Conceptually, each octet of data is assigned a sequence number
- The sequence number of the first octet of data in a segment is transmitted with that segment and is called the segment sequence number
- Segments also carry an acknowledgment number which is the sequence number of the next expected data octet of transmissions in the reverse direction
Retransmission:
- When the TCP transmits a segment containing data, it puts a copy on a retransmission queue and starts a timer
- When the acknowledgment for that data is received, the segment is deleted from the queue
- If the acknowledgment is not received before the timer runs out, the segment is retransmitted
Important Note:
- An acknowledgment by TCP does not guarantee that the data has been delivered to the end user
- It only means that the receiving TCP has taken the responsibility to do so
Flow Control
To govern the flow of data between TCPs, a flow control mechanism is employed:
- The receiving TCP reports a "window" to the sending TCP
- This window specifies the number of octets, starting with the acknowledgment number, that the receiving TCP is currently prepared to receive
2.7. Connection Establishment and Clearing
Socket Addressing
Port Identifier:
- To identify the separate data streams that a TCP may handle, the TCP provides a port identifier
- Since port identifiers are selected independently by each TCP, they might not be unique
Socket Creation:
- To provide for unique addresses within each TCP, we concatenate an internet address identifying the TCP with a port identifier to create a socket
- A socket will be unique throughout all networks connected together
Connection Specification:
- A connection is fully specified by the pair of sockets at the ends
- A local socket may participate in many connections to different foreign sockets
- A connection can be used to carry data in both directions, that is, it is "full duplex"
Port and Process Association
Port Ownership:
- TCPs are free to associate ports with processes however they choose
- However, several basic concepts are necessary in any implementation:
- There must be well-known sockets which the TCP associates only with the "appropriate" processes by some means
- We envision that processes may "own" ports
- Processes can initiate connections only on the ports they own
Connection Specification in OPEN Call:
- A connection is specified in the OPEN call by the local port and foreign socket arguments
- In return, the TCP supplies a (short) local connection name by which the user refers to the connection in subsequent calls
Transmission Control Block (TCB)
To store connection information, we imagine that there is a data structure called a Transmission Control Block (TCB):
- One implementation strategy would have the local connection name be a pointer to the TCB for this connection
- The OPEN call also specifies whether the connection establishment is to be actively pursued, or to be passively waited for
Passive OPEN:
- A passive OPEN request means that the process wants to accept incoming connection requests rather than attempting to initiate a connection
- Often the process requesting a passive OPEN will accept a connection request from any caller
- In this case, a foreign socket of all zeros is used to denote an unspecified socket
- Unspecified foreign sockets are allowed only on passive OPENs
2.8. Data Communication
Once a connection is established, data can flow bidirectionally between the processes. The TCP ensures that this data flow is:
- Reliable: Data arrives correctly
- Ordered: Data arrives in the correct sequence
- Flow controlled: The receiving end is not overwhelmed
2.9. Precedence and Security
The TCP provides mechanisms for handling:
- Precedence: Priority levels for traffic
- Security classifications: To operate in multilevel secure environments
- Compartmentation: Segregation of different security domains
These features are inherited from the internet protocol layer and are maintained end-to-end through the TCP connection.
2.10. Robustness Principle
A guiding principle for TCP implementation is the Robustness Principle, often stated as:
"Be conservative in what you send, be liberal in what you accept"
This means:
- TCP implementations should carefully adhere to specifications when sending data
- But should be tolerant and flexible when receiving data, attempting to interpret even slightly malformed input when possible
This principle helps ensure interoperability between different implementations and promotes the overall stability of the internet.
Next: 3. Functional Specification - Detailed specification of TCP operations and segment formats