Lecture #19: Transport Protocols. Elements and Examples Contents OSI Transport Layer 2 Transport Service Primitives 4 Addressing Connection Control Transport Layer in Internet 11 TCP Addressing 12 TCP protocol 13 UDP 18 6 9 1 OSI Transport Layer Application layer Presentation layer Session layer 6/1 User application 1 Encryption/ decryption Session control Session synch. ... compression/ expansion Choice of syntax Session to transport mapping Session management Transport layer Layer and flow control Error recovery Multiplexing Network layer Connection control Routing Addressing Link layer Data link establishment Error control Physical layer Access to transm. media Physical and electrical interface Flow control Synch Framing Activation/ deactivation of con. Functions within the transport layer may include: • • • • • mapping transport-address onto network-address; multiplexing (end-to-end) transport-connections onto network-connections; establishment and release of transport-connections; end-to-end sequence control on individual connections; end-to-end error detection and any necessary monitoring of the quality of 2 service; etc. Services of the Transport Layer Services to the session (or application) layer: – unique identification of each session entity by its transport address. The transport-service provides the means to establish, maintain and release transport-connections (case the service is connection-oriented) – duplex transmission between a pair of transport addresses (one or more transport connection can be established between the same pair of transport addresses) – provides endpoint identifiers that distinguish the transport connection endpoints – the quality of service provided on a transport connection depends on the service class requested by the session entities (the selected quality of service is maintained throughout the lifetime of the transport connection) – the following services are provided by the transport layer: • transport-connection establishment • data transfer • transport-connection release 3 Transport service provider and transport service user. 6/3 Access primitives provide interface to user applications and sessions Example set of transport service’s access primitives Transport Protocol Data Unit (TPDU) - standard data entity exchanged between transport peers. TPDU payload is packed with header in Network Layer packet. NL packet is cut into Data Link Layer frames with frame’s headers 6/4 UNIX implementation of transport service primitives: as any other interface in UNIX the network transport layer data has file presentation established by SOCKET and assigned by BIND. Unblocking LISTEN allocates buffer for remote requests. 6/6 6/5 Transport Service Primitives Transport services are provided by the access primitives State-transition diagram of the transport layer connection process: – event driven control; events: local execution of a transport primitive or incoming packet 4 Transport Protocol Elements Transport protocols implement transport layer functionality Example protocol hierarchy (TCP/IP model) Transport protocol environment: 19/1 – host-to-host communication over the subnet (instead the Network layer communication between subnet components - routers, over data link) 6/7 – source/destination addressing (instead addressing by selection of router’s outgoing line by the Network Layer – possibility to store (and delay) packets in the subnet by datagram model --> special transport protocols for real-time and interactive communications – dynamic allocation of connection’s buffers as the number of connections is not predefined (in contrast to the Network Layer where the number of input/output lines is fixed and static allocation of the buffer space is applicable). 5 Addressing Addressing is based on TSAP (Transport Service Access Point) that corresponds to some port of a local process. TSAP is defined by pairs (IP address, local port i) where NSAP (Network Layer SAP) is presented by IP address (or another adequate addressing - AAL…) TSAP are multiple for any transport entity while NSAP are either one or few in a machine/router Connection phases: 6/8 – server OS assigns a TSAP to an active server process upon its request – application process on a remote machine requests connection to server’s TSAP via its local TSAP – transport entities use the network link to process the communication request either as connection oriented service (session) or as connectionless data delivery 6 Addressing 6/9 Constant TSAP address services Dynamic TSAP assignment to the service processes – Initial connection protocol by process server – process server acts as a proxy between a set of server processes and remote client processes – the requested server is split out from the process server set and communicates autonomously to the client during the session 7 Classes of the transport protocol Protocol Network class type Functions 0 A Minimal functions 1 B Network error recovery 2 A Connection bonding 3 B Network error recovery, connection bonding 4 C Error detection and recovery, connection bonding 8 Connection Establishment Three-way handshaking – Normal operation: 6/11a • control parameters: – sequential number of initiator - x – sequential number of the party - y • CR - connection request from initiating host • ACK - connection accepted from • Data transfer – delayed duplicate request TPDU - the delayed request is 6/11b rejected by the initiator – delayed duplicate request and delayed duplicate acknowledge: 6/11c the initiator rejects the delayed request acknowledge as in previous case; the party rejects the delayed duplicate dataacknowledge because of imparity of its sequential number (z instead y) 9 Connection Release • Asymmetric release: connection release initiative of any of the parties: • simple and quick 6/12 • possible lost of data • Symmetric release • treats the connection as two independent unidirectional connections and release each of them separately • no data losses 6/13 • synchronization problem (two-army problem) 10 Transport Layer in Internet • Connection-oriented and connectionless oriented protocols in Internet 19/1 • TCP (Transport Control Protocol) features: • connection oriented protocol supporting end-to-end fullduplex byte stream over network links with losses and errors • upper interface to user processes or OS kernel requests • lower interface to IP • brakes user/OS data into IP datagrams of 1500-64kB or restore the IP datagrams into upper level byte stream • controls the timeout periods, retransmission events, sequencing, etc, over the unreliable IP transfer 11 • Addressing based on sockets: TCP addressing • a socket unifies NSAP end TSAP • the socket number consists of: • IP address (NSAP) - 4 bytes • local port (TSAP) - 16b (up to 64k ports addressing space) • a socket pair uniquely identifies a transport connection: (socket1, socket2) • several connections may ended in a common socket • socket calls from the OS: 6/6 • port address space: • 0 - 255 - well-known ports: 7 - Echo; 13 - Daytime; 21 - FTP File Transfer; 23 - Telnet; 49 - Login Host Protocol; 79 - Finger; 80 - World Wide Web HTTP; 110 - Post Office Protocol - Version 3 (POP3) 12 TCP protocol • • • 32-bit numbering (0 - 4G) of the byte sequence TPDUs: segments Segmentation according the network properties (user data stream can be split into smaller segments or collected in larger ones). • Segment structure: • header (20B) • header options • data (optional, up to 64k) • Segment header: • 5 * 32-bit words 6/24 • Source/Destination port - 16b - local end points of the connection • Sequence Number/Acknowledgement Number - 32b (4G ) the byte numbers in the stream (last received and next expected) 13 TCP protocol • Segment Header (cont.) 6/24 • TCP header length - (4b) - the header length in 32b words - up to 16 words of which 5 are standard header and up to 11 are optional header words • reserved field of 6b (not used in TCP versions up to now) • 6 flags field; the value 1 of the flags means respectively: • URG: Urgent pointer in use. Urgent pointer is a facility that points the urgent data field. Urgent data contains interrupt messages that are interpret by the upper levels but not by TCP itself • ACK: Valid Acknowledgement number. If ACK=0 the contents of the Acknowledgement number field is ignored • PSH: Pushed data indicator. “Pushed data” is data that has to be delivered to the application layer without buffering (i.e. without delay) • RST: Reset connection. Used in cases of host failure or refusal of connection opening attempt 14 TCP protocol • Segment Header - Flags’ field (cont.) 6/24 • SYN: Establish connection. Connection request/replay indicator. SYN=1 and ACK=0 means connection request (no piggybacked acknowledgement) and SYN=1 and ACK=1 means connection replay (acceptance) with a acknowledgement piggybacked in the same segment. SYN segments are ordered by the sequence numbers in order to prevent delayed duplications. • FIN: Release connection request. The sender has finished the data transmission. FIN segments also are ordered by the sequence numbers in order to prevent delayed duplications. • Window size. 16b - Indicates the free buffer space of the receiver after the last received byte (which is Acknowledgement number - 1). The maximum buffer buffer indicated is 64kB. 0 buffer space means temporarily to stop data transmission to the receiver. • Checksum. 16b - checksum over header, data and the pseudoheader: (set of segment parameters) • pseudoheader: set of transmission parameters that includes 6/25 source/destination IP addresses and the segment length (Note that the control over IP addresses is not a functionality of TCP but of IP) 15 TCP protocol • Segment Header (cont.) 6/24 • Urgent pointer. 16b - Used in compination with URG flag. • Header Options. Variable length - optional extension of the header facilities e.g. maximum segment length. The segment length has to be compromised between the transmission effectiveness and the host/application requirements. 16 TCP connection management • TCP uses 3-way handshaking for connection establishment: • the server host (host2) waits for incoming having issued LISTEN or ACCEPT primitive 6/26 • the client host (host1) issued CONNECT primitive specifying TSAP by (IP addr., port) couple; the flags SYN=1, ACK=0 • the server host acknowledges the connection if there is active server process listening the specified port • simultaneous attempts to open connection lead to failure because of different sequence numbering (6/26b) • simultaneous attempts to close connection are not in a collision; FIN segments are acknowledged (or timed-out) and the connection is closed • Finite state-machine of a TCP connection: • set of states 6/28 6/27 17 • set of transitions (the transitions are invoced by event/action pair) UDP • UDP (User Datagram Protocol) implements connectionless unreliable services of the Transport Layer • The establishment/release of the connection is skipped • UDP segment: 6/34 • 8B (2x32b words) header • extends IP datagram with • source/destination ports fields • UDP segment length field (data + 8B header) • UDP checksum field over header, pseudoheader and data • UDP is generally the protocol used in transmitting voice and video across a network. In some instant messengers/chat programs too. 18 Miscellaneous Transport protocols Stream Control Transmission Protocol (SCTP) – RFC 4960 defines the protocol, with RFC 3286 providing an introductory text. – Provides reliable, in-sequence transport of message streams with congestion control. Feature Name TCP UDP SCTP Connection oriented Yes No Yes Reliable transport Yes No Yes Preserve message boundary No Yes Yes Ordered delivery Yes No Yes Unordered delivery No Yes Yes Data checksum Yes Yes Yes Checksum size (bits) 16 16 32 Path MTU Yes No Yes Congestion control Yes No Yes Multiple streams No No Yes MultiMulti-homing support No No Yes Bundling No No Yes 19 Miscellaneous Transport protocols (2) Real-time Transport Protocol (RTP) defines a standardized packet format for delivering audio and video over the Internet. It was developed by the Audio-Video Transport Working Group of the IETF and first published in 1996 as RFC 1889 which was made obsolete in 2003 by RFC 3550. Real time transport protocol can also be used in conjunction with RSVP protocol which enhances the field of multimedia applications. Resource ReSerVation Protocol (RSVP), described in RFC 2205. Designed to reserve resources across a network for an integrated services Internet (QoS). "RSVP does not transport application data but is rather an Internet control protocol, like ICMP, IGMP, or routing protocols.“ RSVP provides receiver-initiated setup of resource reservations for multicast or unicast data flows with scaling and robustness. 20 19/1 19/1 21 6/1 6/1 22 6/3 6/3 6/4 6/4 23 6/5 6/5 24 6/6 6/6 25 6/7 6/7 26 6/8 6/8 27 6/9 6/9 28 6/11 6/11 29 6/12 6/12 30 6/13 6/13 31 6/24 6/24 32 6/25 6/25 33 6/26 6/26 34 6/27 6/27 35 6/28 6/28 36 6/34 6/34 37