%% 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}
\usepackage[latin1]{inputenc}
\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


\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


\makeatother

\begin{document}

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

\textbf{1.} (10) Next to each item in the column below, write either
``bridge'' or ``router,'' according to which one the item is better
related to:

\begin{verbatim}
IP address
nodes aware of existence
switching hubs
always will copy to at 
   least one other network
Ethernet ID
\end{verbatim}

\textbf{2.} (10) Fill in the blanks with {\bf official terms from our
coursee}:  We worry about loops in extended LANs, and thus remove some
bridges in order to produce a loop-free structure called a
\_\_\_\_\_\_\_\_\_\_\_\_\_.  However, in the case of routers, we do not
have to remove some routers, because the \_\_\_\_\_\_\_\_\_\_\_\_ allows
us to tolerate loops. 

\textbf{3.} Look at the example internet on page 4 of the introductory
unit in our printed lecture notes.  Suppose we have a TCP connection
between Saturn and Holstein, and suppose that one of the TCP segments
from Saturn to Holstein gets some of its data bits corrupted as it
travels on network B.  (But no other bits get corrupted.)  Assume that
the link between Citroen and Moo uses PPP.  State all network nodes at
which the following actions may occur (at some layer):

\begin{itemize}

\item (a) (10) A node notices the error.

\item (b) (10) A node sends an error-notification message (to some other
node). 

\end{itemize}   

\textbf{4.} (10) Suppose we have a global array declared as

\begin{verbatim}
char IPPacket[10000];
\end{verbatim}

into which a given IP packet has been placed.  Write C code which will
check whether the packet contains a TCP segment, and if so, set the
variable DstPort to the destination port. 

\textbf{5.} (10) Fill in the blanks:  A {\bf graph} is defined to be a
set of points, called {\bf vertices} or {\bf nodes}, some of which are
connected by lines called {\bf edges} or {\bf arcs}.  The problem we
have investigated of finding a loop-free set of bridges in an extended
LAN can be considered in terms of a graph, whose vertices are
\_\_\_\_\_\_\_ and whose edges are \_\_\_\_\_\_\_\_.

\textbf{6.} (10) Recall that each Ethernet card has a 48-bit
identification number burned into it, unique in all the world.  Find a
statement made in either Tanenbaum or our printed lecture notes (in
either case, covered by this exam) from which we can infer that there is
a specific 48-bit string which no Ethernet card has as its
identification number.  (The specific string must appear in your
cited passage.)   

\textbf{7.} (10) Write a C function with heading

\begin{verbatim}
int SameNet(int SrcIP, int DstIP, int SubnetMask)
\end{verbatim}

which will return either 1 or 0, depending on whether SrcIP and DstIP
are on the same network.  (The goal is to see whether routing is
needed.)

\textbf{8.} (10) Cite a paragraph in either our printed lecture notes or
Tanenbaum (in the parts covered by this exam) in which a TDM setting is
implied. 

\textbf{9.} (10) Write a C function with heading

\begin{verbatim}
void ProcessFrame(char * FPtr, int InPortNumber)
\end{verbatim}

which will be executed by a bridge.  FPtr points to an Ethernet frame,
and InPortNumber is the port number for the Ethernet at which the bridge
noticed this frame.  The function ProcessFrame is now supposed to
process this frame.  

Assume the following are given to you:

\begin{itemize}

\item A function with heading

\begin{verbatim}
int TableLookup(int48 EID)
\end{verbatim}

(where {\bf int48} is an assumed 48-bit integer type, for our
convenience), which will look up the Ethernet ID EID on the bridge's
table which lists Ethernet IDs and their port numbers (for those network
nodes which are currently known to the bridge).  This function will
return the port number if there is a table entry for EID, otherwise -1.

\item A function with heading

\begin{verbatim}
void WriteFrame(char * FPtr, int PortNumber)
\end{verbatim}

which will write the frame pointed to be FPtr to the port PortNumber.

\item A function with heading

\begin{verbatim}
void AddTableEntry(int48 E, int P)
\end{verbatim}

which adds the Ethernet ID and its port P to the table. 

\item Global variables:

\begin{verbatim}
int NPorts,Port{MAXPORTS];
\end{verbatim} 

which contain the number of ports for this bridge, and their port
numbers.

\end{itemize}    

{\bf 1.}  Router; router; bridge; router; bridge.

{\bf 2.}  MST; Time to Live field.

{\bf 3.a.}  Citroen (Ethernet); Holstein (TCP).

{\bf 3.b.}  None.

{\bf 4.}

\begin{verbatim}
HeaderLength = IPPacket[0] & 0x0f;
DataStart = HeaderLength * 4;
if (IPPacket[9] == 0x06)
   DstPort = 0x0000ffff & *((int *) IPPacket[DataStart]);
\end{verbatim}

{\bf 5.}  LANs; bridges (p.313, Tanenbaum).

{\bf 6.}  Level-2 unit in lecture notes; BPDU ``address'' is
0x0180c2000000.

{\bf 7.}

\begin{verbatim}
int SameNet(......)

{  if (SrcIP & DstIP & SubnetMask) return 1;
   else return 0;
}  
\end{verbatim}

{\bf 8.}  P.321, ``..four T1 channels,...''

{\bf 9.}  Here is the pseudocode, but full C code was required:

\begin{verbatim}
extract the destination Ethernet ID from bytes 8-13
call TableLookup() with that Ethernet ID
if found
   call WriteFrame() to the correct port
else
   call TableLookup() on all ports except the input port
   call AddTableEntry() with the destination Ethernet ID
extract the source Ethernet ID from bytes 14-19
call TableLookup() with the source Ethernet ID  
\end{verbatim}

\end{document}
