
\documentclass[11pt]{article}

\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\topmargin}{0.0in}
\setlength{\headheight}{0in}
\setlength{\headsep}{0.5in}
\setlength{\textwidth}{6.5in}
\setlength{\textheight}{8.5in}
\setlength{\parindent}{0in}
\setlength{\parskip}{0.12in}

\usepackage{times}
\usepackage{psfig}
\usepackage{fancyheadings}

\begin{document}

\pagestyle{fancy}
\cfoot{Introduction: \thepage}     

\title{Overview of Computer Networks}

\author{Norman Matloff \\
Dept. of Computer Science \\
University of California at Davis}

\date{April 12, 1999}

\maketitle 



\appendix

\section{Packet/Frame Formats}

In order to get a more concrete understanding of some of the
concepts introduced here, we now take a look at the specific
formats in which some of the protocols send data.

\subsection{TCP}

{\bf Bytes 0-1:}  Source Port.

{\bf Bytes 2-3:}  Destination Port.

{\bf Bytes 4-7:}  Sequence number.

{\bf Bytes 8-11:}  Acknowledgement.

{\bf Byte 12:}  The first four bits comprise the Header Length field
(the other four bits are 0s), meaning the number of words (not bytes)
from the beginning of the packet to the first data byte within the
packet.  Most of the header is of fixed length, so we would not need
this, except for the fact that the Options field below is of variable
length.  The software thus uses this field to deduce where in the packet
the data starts.

{\bf Byte 13:}  Flags, which are various bits giving control
information such as a PUSH command (which tells the host not
to continue accumulating bytes to send; ``send whatever you
have now, without waiting for more'').

{\bf Bytes 14-15:}  Advertised Window, a value that the recipient
uses to say, ``OK, you can now send me sequence numbers
such-and-such.''

{\bf Bytes 16-19:}  Check Sum (two bytes), for error checking,
and a two-byte Urgent Pointer field.

{\bf Bytes 20-whatever:}  Options field.

{\bf Remaining Bytes:}  Data, e.g. your e-mail message in the
case of {\bf sendmail}.  (Note:  No length field is needed for
specifying the amount of data, since this can be deduced from
a similar field in the IP header which will contain this
TCP packet.)

\subsection{IP}

{\bf Byte 0:}  The first four bits are the Version Number (currently
4, going to 6), and the other four bits are the Header Length in words.

{\bf Byte 1:}  Type of Service field, intended to give priority to
some packets but not used much in practice.

{\bf Bytes 2-3:}  Length field, giving length of the entire IP
packet including data.

{\bf Bytes 4-7:}  Miscellaneous fields.

{\bf Byte 8:}  Time to Live field.  If this equals, say, k, then
this packet will be allowed k more hops through the network.  If
it hasn't reached its destination by then, it is discarded, to
prevent infinite routing loops.

{\bf Byte 9:}  Transport-layer protocol (e.g. 6 for TCP, 17 for UDP).

{\bf Bytes 10-11:}  Checksum, to check for errors within this
packet.

{\bf Bytes 12-15:}  Source IP address.

{\bf Bytes 16-19:}  Destination IP address. 

{\bf Bytes 20-whatever:}  Options including blank padding to make
an integral number of words.

{\bf Remaining Bytes:}  Data.  Remember, from the point of view of
the IP layer, the ``data'' consists of a TCP or UDP packet
(or other packet from a higher layer).

\subsection{Ethernet}

{\bf Preamble:}  Start-of-frame indicator, a special 64-bit pattern.

{\bf Destination Ethernet ID:}  48 bits; burned into the NIC by the
manufacturer.

{\bf Source Ethernet ID:}  See Destination Ethernet ID above.

{\bf Type:}  Sixteen bits.  Indicates the protocol being used,
e.g. 0x0800 for IP, 0x809b for Appletalk, 0x8137 for Netware IPX/SPX.
This is the mechanism by which different protocols can coexist on the
same Ethernet.

{\bf Data:}  This consists of the IP packet (in the case of the
IP protocol).  Its length is inferred by subtracting the lengths
of the other fields from the overall frame length. 

{\bf CRC:}  An error-checking field for this frame.

{\bf Postamble:}  End-of-frame indicator, a special 8-bit pattern.

\end{document}




