Tuesday, June 24, 2014

Internetworking with TCP/IP Notes (Chapter 10)

Chapter 10 User Datagram Protocol (UDP)

10.1 Using a protocol port as an ultimate destination
Each machine contains a set of abstract destination points called protocol ports. Each protocol port is identified by a positive integer. The local operating system provides an interface mechanism that processes use to specify a port or access it.

Most operating systems provide synchronous access to ports. From an application’s point of view, synchronous access means the computation stops when the application accesses the port.

Each message carries two protocol port numbers: a destination portnumber specifies a port on the destination computer to which the message has been sent, and a source port number specifies a port on the sending machine from which the message has been sent. It is because the destination need this information to generate a reply and forward it back.

10.2 The User Datagram Protocol
The User Datagram Protocol (UDP) provides an unreliable, besteffort, connectionless delivery service using IP to transport messages 
between machines. UDP uses IP to carry messages, but adds the ability to distinguish among multiple destinations within a given host computer.

10.3 UDP Message Format
The entire UDP header occupies a total of only eight octets.


UDP SOURCE PORT
field contains a 16-bit protocol port number used by the 
sending application. This is optional.
UDP DESTINATION PORT field contains the 16-bit UDP protocol port number of the receiving application. 
UDP MESSAGE LENGTH field contains a count of octets in the UDP datagram, including the UDP header and the user data. Thus, the minimum value is eight, the length of the header alone.
UDP MESSAGE LENGTH field consists of sixteen 
bits, which means the maximum value that can be represented is 65,535. 

10.4 Interpretation of the UDP checksum
For IPv6, the UDP checksum is required. For IPv4, the UDP checksum is optional and need not be used at all; a value of zero in theCHECKSUM field means that no checksum has been computed. however, that IP does not compute a checksum on the data portion of an IP datagram.

10.5 UDP Checksum Computation and the Pseudo-Header
The purpose of using a pseudo-header is to verify that a UDP datagram has reached its correct destination. It is important to understand that a pseudo-header is only used for the checksum computation.

The UDP header itself specifies only the protocol port number. Thus, to verify the destination, UDP includes the destination IP address in the checksum as well as the UDP header. At the ultimate destination, UDP software verifies the checksum using the destination IP address obtained from the header of the IP datagram that carried the UDP message.

10.6 IPv4 UDP Pseudo-Header Format
The pseudo-header used in the UDP checksum computation for IPv4 consists of 12 octets of data as figure below


SOURCE IP ADDRESS and DESTINATION IP ADDRESS contain the source and destination IPv4 addresses that will be placed in an IPv4 datagram when sending the UDP message. Field PROTO contains the IPv4 protocol type code (17 for UDP)
Field labeled UDP LENGTH contains the length of the UDP datagram (not including the pseudo-header).

To verify the 
checksum, the receiver must extract these fields from the IPv4 header, assemble them into the pseudo-header format, and compute the checksum

10.7 IPv6 UDP Pseudo-Header FormatThe pseudo-header used in the UDP checksum computation for IPv6 consists of 40 octets of data arranged as figure below.

The pseudo-header for IPv6 uses IPv6 source and destination addresses. The other changes from IPv4 are that the PROTO field is replaced by the NEXT HEADER field and the order of fields has changed.

10.8 UDP Encapsulation and Protocol Layering
UDP lies in the transport layer above the internet layer.
Conceptually, applications access UDP, which uses IP to send and receive datagrams.

That is, because UDP is layered above IP, a complete UDP message, including
the UDP header and payload, is encapsulated in an IP datagram as it travels across an
internet. Of course, the datagram is encapsulated in a network frame as it travels across
an underlying network, which means there are two levels of encapsulation.

Two levels of encapsulation used when a UDP message travels in an IP datagram, which travels in a network frame

The IP layer is responsible only for transferring data between a pair
of hosts on an internet, while the UDP layer is responsible only for

differentiating among multiple sources or destinations within one host. Thus, only the IP header identifies the source and destination hosts; only the UDP layer
identifies the source or destination ports within a host.

9.9 UDP Multiplexing, Demultiplexing and Protocol ports
UDP software provides another example of multiplexing and demultiplexing.

* Multiplexing occurs on output. On a given host computer, multiple applications can use UDP simultaneously.

* Demultiplexing occurs on input. We can envision UDP accepting incoming UDP datagrams from IP, choosing the application to which the datagram has been sent, and passing the data to the application.
Conceptually, only the destination port number is needed to handle demultiplexing. When it processes an incoming datagram,  UDP accepts the datagram from the IP software, extracts the UDP DESTINATION PORT from the header, and passes the data to the application. 

I
t checks to see that the destination port number matches one of the ports currently in use. If it finds a match, UDP enqueues the new datagram at the port where the application program can access it. If none of the allocated ports match the incoming datagram, UDP sends an ICMP message to inform the source that the port was unreachable and discards the datagram.


10.10 Reserved and Available UDP port numbers

The port numbers in the range from 0 to 1023 are the well-known ports. They are used by system processes that provide widely used types of network services.

The range of port numbers from 1024 to 49151 are the registered ports. It need to registered with IANA. On most systems, registered ports can be used by ordinary users.

The range of port numbers from 49152 to 65535 are private ports for any usages.

No comments:

Post a Comment