\subsection{Examples}\label{config_examp}

The {\xk} source tree contains some ready-to-use configuration files
to help you build any of the different types of {\xk}s.  This section
contains locations and descriptions of these files.  All of the
configurations specify a protocol stack that includes ETH, ARP, VNET,
IP, and ICMP, plus some set of higher level protocols 

\subsubsection{User-Level with Simulated Ethernet}\label{ul_sim}

A user\_level {\xk} will usually be configured to use the Unix socket
facility to send and receive from the network (see
Section~\ref{user_level}).  Example {\var graph.comp} and ROM files
for building and running such a kernel that includes the TCP/IP
protocol stack can be found in 
{\var /usr/xkernel/user\_level/build/Template/}. Configuration files
for other protocol stacks can be found subdirectories of
{\var /usr/xkernel/user\_level/build/Template/}; e.g., 
{\var example\_rpc} shows how to configure an RPC stack, and
{\var example\_msp} shows how to configure a stack that includes the 
MSP and SWP protocols.

Note that in this {\var graph.comp} file, the lowest protocol in the
protocol stack is the SIMETH driver.  Refer to
Section~\ref{user_level} for an explanation of the ROM file's 
{\var simeth} and {\var arp} options.

\subsubsection{User-Level with Direct Ethernet Access}\label{ul_direct}

An {\xk} that uses a simulated device driver like SIMETH can
communicate only with other {\xk}s; it is not possible to exchange
messages with a ``native'' application since an {\xk} configured with
SIMETH encapsulates the messages it sends in a UDP datagram. To send
raw ethernet packets over the network, one needs to configure a kernel
that includes a protocol that interacts directly with the device
driver of the host OS. Unlike SIMETH, which is supported on all Unix
platforms, these protocols are platform dependent. The current
distribution includes three such protocols: IRIXFDDI and IRIXETH for
IRIX, and ETHPKT for Linux. In all three cases, root access is required
to run a kernel with one of these protocols configured in.

Example {\var graph.comp} and {\var rom} files for building and
running a kernel that includes ETHPKT are given in 
{\var /usr/xkernel/user\_level/build/Template/example\_ethpkt}.  
Notice that the {\var graph.comp} file specifies that protocol table 
{\var prottbl.nonstd} be used. It does this so that all protocols (most
importantly, IP) are assigned nonstandard protocol numbers; this
prevents messages designated for the {\xk} from being acted upon by
the machine's native protocol stack, and vice versa.

\subsubsection{Simulator}\label{sim}

Directory {\var /usr/xkernel/simulator/build/Template/example}
contains the configuration files needed to build and run the
simulator.  The {\var graph.comp} file is the only one needed to
compile the simulator; the others must be in the working directory at
runtime.

The files residing in the example directory configure a simulated
network consisting of two Ethernets connected by a point-to-point
link.  Each Ethernet has two hosts, for a total of four.  One host on
each Ethernet runs the {\var traffic} protocol to simulate background
traffic from TCP connections.  The two other hosts run {\var megtest},
which uses TCP to stream one megabyte of data from one host to the
other.  Three flavors of TCP are configured into the simulator: {\var
rtcp} (TCP Reno), {\var ttcp} (TCP Tahoe), and {\var vtcp} (TCP
Vegas).  Any of these TCPs can be run on the {\var traffic} and {\var
megtest} hosts.

The simulator treats the {\var graph.comp} file differently than the
user\_level and standalone {\xk}s do.  The simulator does not set up
its protocol graph using the {\var graph.comp}; it only uses it to
decide what protocols it must include in the executable.  At runtime,
the simulator creates the protocol graph using the {\var xsim.data}
file.  Note that in the example {\var graph.comp} file, {\var megtest}
is configured over TCP Reno, but the {\var xsim.data} file runs it
over TCP Vegas.

There is only one ROM file, and this file contains information for all
of the hosts in the simulation.  The example ROM file specifies the
gateway to which a host will send when its IP datagram is addressed to
a machine residing on another network.  Note that the ROM entries
begin first with the name of the protocol ({\var ip}) and then the
name of the host which uses that entry (e.g., {\var h1n0} -- host 1 on
network 0).

Most of the difficulting in configuring the simulator is how to
specify the network you want to simulate. This specification is
given in the file {\var xsim.data}, which is described elsewhere
\cite{xsim}.
