%% LyX 1.1 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[twocolumn]{article}
\usepackage[T1]{fontenc}
\setlength\parskip{\medskipamount}
\setlength\parindent{0pt}

\makeatletter


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\providecommand{\LyX}{L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\@}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage[T1]{fontenc}
\setlength\parskip{\medskipamount}
\setlength\parindent{0pt}

\makeatletter


\setlength{\oddsidemargin}{-0.5in}
\setlength{\evensidemargin}{-0.5in}
\setlength{\topmargin}{0.0in}
\setlength{\headheight}{0in}
\setlength{\headsep}{0in}
\setlength{\textwidth}{7.0in}
\setlength{\textheight}{9.5in}
\setlength{\parindent}{0in}
\setlength{\parskip}{0.1in}
\setlength{\columnseprule}{0.4pt}

\makeatother

\makeatother

\begin{document}

Name: \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_

\textbf{Directions: Work only on this sheet (on both sides, if needed); do not
turn in any supplementary sheets of paper. There is actually plenty of room
for your answers, as long as you organize yourself BEFORE starting writing.
In order to get full credit, SHOW YOUR WORK.}

\textbf{1.} (15) File in the blanks with network protocol names from our course
materials: A protocol in which a message may arrive at the destination out of
order is \_\_\_\_\_\_\_\_\_\_\_\_, while a protocol under which the pieces cannot
arrive out of order is \_\_\_\_\_\_\_\_\_\_\_\_. A protocol which does not break
a message into pieces is \_\_\_\_\_\_\_\_\_\_\_\_.

\textbf{2.} (10) Fill in the blank: If in a C program I wish to determine the
numerical IP address of, say, www.yahoo.com, I would call the function \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_.

\textbf{3.} (10) If I wish to view the Web site www.google.com and type \texttt{netscape
209.185.108.220} instead of \texttt{netscape www.google.com} then what is the
3-letter acronym of the service that \textbf{Netscape} will not have to use
this time?

\textbf{4.} (15) Consider the asynchronous serial connection example in our
printed lecture notes, with the receiver 7\% fast relative to the sender. Suppose
we had designed the receiver to aim for the end of the first quarter of each
bit, starting at time 125. Which bit (first, second, etc.) would the receiver
sample incorrectly, and by how many microseconds will it miss the true bit?
\textbf{Explain thoroughly}.

\textbf{5.} (10) On p.61 of Tanenbaum it is noted that B-ISDN will offer LAN
interconnection services. What other service offered by the phone company is
described by Tanenbaum to perform this function?

\textbf{6.} (10) In class I mentioned a version of \textbf{Telnet} for Windows
called \textbf{CRT}, which I downloaded from the UC Davis IT site. I mentioned
that when I submitted a request for the download, the server program likely
made a certain system call (assuming the program used TCP). What system call
is that, and what specific string would it verify in this case?

\textbf{7.} (10) If we were to replace the Ethernet card on, say, pc8 in CSIF,
pc8's IP address would not change. However, there is another protocol described
by Tanenbaum, in which pc8's address would change. State the specific sentence
in Tanenbaum's book that implies this.

\textbf{8.} (10) Look at the quantity \( f_{c} \) mentioned on p.79 of Tanenbaum.
Using mathematical notation (e.g. maybe T, \( a_{n} \), etc.) from our printed
lecture notes (\textit{use} \textit{no English prose}), fill in the right-hand
side of the following equation: \( f_{c}= \) 

\textbf{9.} (10) Write C code for a device driver on an asynchronous serial
line. Your code will consist of a \texttt{while(1)} loop which executes one
iteration for each bit time, by calling a function wait\_for\_bit() at the beginning
of the loop. (Do not write this function or the rest of the program outside
the \texttt{while(1)} loop, e.g. declarations.) The received bit will be stored
by wait\_for\_bit() in a global variable Bit. Each time a bit is received, your
code will take appropriate action for that bit. When your code notices that
a full character D has been received, your code will check for parity error,
and if no such error occurs, it will copy the character to a global array C,
at index CIndex. In other words, our code will do 

\texttt{C{[}CIndex++{]} = D;}

If there is a parity error, the character is just ignored. Assume the same parameters
as in our example, e.g. k = 8.

{\bf Solutions:}

{\bf 1.}  TCP; ATM or X.25; UDP

{\bf 2.}  gethostbyname()

{\bf 3.}  DNS

{\bf 4.}  The receiver's time ``125'' wll actually be 0.93 x 125 =
116.25.  It will sample every 93 microseconds after that.  One then
finds that the fourth bit sampling will actually occur 4.75 microseconds 
before the end of the third bit. 

{\bf 5.}  SMDS

{\bf 6.}  getpeername(), ``ucdavis.edu''

{\bf 7.}  IPX; p.46, ``48-bit machine address (the 802 LAN address)''

{\bf 8.}  $f_N$ (or $f_{max}$)

{\bf 9.}

\begin{verbatim}

// the various State values, e.g. WAITING_FOR_START_BIT, would
// be set via #define statements, as arbitrary (though of course
// distinct) integers

while (1)  {
   
   Bit = wait_for_bit();

   switch (State)  {

      case WAITING_FOR_START_BIT:
         if (Bit == 0)  {
            State = RECEIVING_CHARACTER; 
            NCharBitsRcvd = 0;
            D = 0;
            break;
         }

      case RECEIVING_CHARACTER:
         D = D << 1 + Bit;
         SumBits += Bit;
         if (++NCharBitsRcvd == 8)  
            State = PARITY_BIT_WILL_BE_NEXT;
         break;

      case PARITY_BIT_WILL_BE_NEXT:
         if ((SumBits + Bit) % 2 == 0)
            C[CIndex++] = D;
         State = STOP_BIT_WILL_BE_NEXT; 
         break;

      case STOP_BIT_WILL_BE_NEXT:
         State = WAITING_FOR_START_BIT;
         break;
         
   }

}

\end{verbatim}   
  
\end{document}
