24.1.1 Requirements on TCP

   


24.1 Overview

The protocol units that exchange TCP instances in this way are called segments, and the protocol units of the IP protocol instances are called IP packets or datagrams.

The TCP protocol was developed in the beginning of the eighties to run on top of the IP protocol and provide a byte-oriented, reliable, connection-oriented transport service. The requirements on such a protocol are as follows [Pete00]:

  • to guarantee transmission of byte streams;

  • to maintain the transmission order when delivering byte streams;

  • congestion: to deliver not more than one single copy of each data unit passed for transmission;

  • to transport data for an arbitrary length;

  • to support synchronization between sender and receiver;

  • to support flow control at the receiver's end; and

  • to support several application processes in one system.

To meet these requirements, the TCP protocol provides a reliable, connection-oriented, byte-oriented full-duplex transport service allowing two applications to set up a connection, to send data in both directions reliably, and to finally close this connection. Each TCP connection is set up and terminated gracefully, and all data are delivered before a connection is torn down, provided that the IP protocol behaves in a service-compliant way. From an application's view, the TCP service can be divided into the following properties [Pete00, Come00]:

  • Connection orientation: TCP provides connection-oriented service where an application must first request a connection to a destination and then use the connection to transfer data.

  • Peer-to-peer communication: Each TCP connection has exactly two endpoints.

  • Complete reliability: TCP guarantees that the data sent across a connection will be delivered exactly as sent, with no data missing or out of order.

  • Full-duplex communication: A TCP connection allows data to flow in either direction and allows either application program to send data at any time. TCP can buffer outgoing and incoming data in both directions, making it possible for an application to send data and then to continue computation while the data is being transferred.

  • Byte-stream interface: We say that TCP provides a stream interface in which an application sends a continuous sequence of octets across a connection. That is, TCP does not provide a notion of records, and does not guarantee that data will be delivered to the receiving application in pieces of the same size in which it was transferred by the sending application.

  • Reliable connection startup: TCP requires that, when two applications create a connection, both must agree to the new connection; duplicate packets used in previous connections will not appear to be valid responses or otherwise interfere with the new connection.

  • Graceful connection shutdown: An application program can open a connection, send arbitrary amounts of data, and then request that the connection be shut down. TCP guarantees to deliver all the data reliably before closing the connection.

24.1.2 The TCP Packet Format

Figure 24-1 shows how a TCP segment is structured. TCP groups data from higher layers and adds a header, as will be described below:

  • The 16-bit SOURCE PORT (SRC PORT) field identifies a process in the sending end system.

  • The 16-bit DESTINATION PORT (DEST PORT) field identifies a process in the end system of the communication partner.

  • The 32-bit SEQUENCE NUMBER (SEQ) field identifies the sequence number of the first data byte in this segment.

  • The 32-bit ACKNOWLEDGEMENT NUMBER (ACK) field means that, if the ACK control bit is set, then this value includes the next sequence number expected by the sender.

  • The DATA OFFSET field is 4 bits wide and specifies the number of 32-bit words in the TCP data header. This field is required, because the Options field has a variable size.

  • RESERVED (6 bits) is reserved for future use and has to be set to null.

  • CONTROL FLAGS are divided into the following flags:

    • URG (Urgent Pointer) points to important data that have to be forwarded immediately.

    • SYN is used to establish connections. SYN = 1 denotes a connection request.

    • ACK shows that the ACKNOWLEDGEMENT NUMBER field includes relevant data.

    • RST can request a connection to be reset. RST = 1 denotes a request to reset a connection.

    • PSH means that, if this bit is set, the TCP instance must immediately pass the data received to the higher layers.

    • FIN means that, if this bit is set, the connection is to be torn down.

  • The 16-bit WINDOW (WNDW) field specifies how much additional buffer space is available for more data.

  • The 16-bit CHECKSUM field contains a checksum that covers the TCP segment header and the data. As in UDP, a pseudo header is computed. (See Chapter 25.)

  • The 16-bit URGENT POINTER (URGPTR) field points to the last byte of important data.

  • The OPTIONS field is variable and can contain, for example, the maximum segment size.

Figure 24-1. The TCP segment format.

graphics/24fig01.gif



       


    Linux Network Architecture
    Linux Network Architecture
    ISBN: 131777203
    EAN: N/A
    Year: 2004
    Pages: 187

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net