\section{Presentation Formatting}

% -----------------------------------------------------------------
\begin{slide}{}

   \subsection{Overview}

   \begin{sitem}
      \item Marshalling (encoding) application data into messages
      \item Unmarshalling (decoding) messages into application data

      \pichere{marshal1.eps,height=2in}

      \item Data types we consider:
      \begin{sitem}
         \item integers
         \item floating point numbers
         \item character strings
         \item arrays
         \item structures
      \end{sitem}
      \item Types of data we do not consider (now):
      \begin{sitem}
         \item images
         \item video
         \item multimedia documents
      \end{sitem}
   \end{sitem}
\end{slide}
% -----------------------------------------------------------------
\begin{slide}{}

   \subsection{Difficulties}

   \begin{sitem}
      \item Representation of base types
      \begin{sitem}
         \item floating point: IEEE 754 versus non-standard
         \item integer: big-endian versus little-endian (e.g., 34,677,374)
      \end{sitem}

      \pichere{endian.eps,height=2.5in}

      \item Compiler layout of structures
   \end{sitem}
\end{slide}
% -----------------------------------------------------------------
\begin{slide}{}

   \subsection{Taxonomy}

   \begin{sitem}
      \item Data types
      \begin{sitem}
         \item base types (e.g., ints, floats); must convert
         \item flat types (e.g., structures, arrays); must pack
         \item complex types (e.g., pointers); must linearize
      \end{sitem}
      \pichere{marshal2.eps,height=3in}

      \item Conversion Strategy
      \begin{sitem}
         \item canonical intermediate form
         \item receiver-makes-right (an $N\times{}N$ solution)
      \end{sitem}
   \end{sitem}
\end{slide}
% -----------------------------------------------------------------
\begin{slide}{}

   \begin{sitem}
      \item Tagged versus Untagged data
      \pichere{ber2.eps,height=0.5in}

      \item Stubs
      \begin{sitem}
         \item compiled
         \item interpreted
      \end{sitem}
      \pichere{stubs.eps,height=3in}
   \end{sitem}
\end{slide}
% -----------------------------------------------------------------
\begin{slide}{}

   \subsection{Examples}

   XDR: eXternal Data Representation
   \begin{sitem}
      \item Defined by Sun for use with SunRPC
      \item C type system (without function pointers)
      \item Canonical intermediate form
      \item Untagged (except array length)
      \item Compiled stubs
   \end{sitem}
\end{slide}
% -----------------------------------------------------------------
\begin{slide}{}

\begin{verbatim}
#define MAXNAME 256;
#define MAXLIST 100;

struct item {
   int     count;
   char    name[MAXNAME];
   int     list[MAXLIST];
};

bool_t
xdr_item(XDR *xdrs, struct item *ptr)
{
    return(xdr_int(xdrs, &ptr->count) &&
       xdr_string(xdrs, &ptr->name, MAXNAME) &&
       xdr_array(xdrs, &ptr->list, &ptr->count, 
                 MAXLIST, sizeof(int), xdr_int));
}
\end{verbatim}

   \pichere{xdr.eps,height=1.5in}
\end{slide}
% -----------------------------------------------------------------
\begin{slide}{}

   ASN.1: Abstract Syntax Notation One
   \begin{sitem}
      \item An ISO standard
      \item Essentially the C type system
      \item Canonical intermediate form
      \item Tagged 
      \item Compiled or interpretted stubs
      \item BER: Basic Encoding Rules
      \begin{quote}
         {\tt $\langle$tag, length, value$\rangle$}
      \end{quote}
   \end{sitem}
   \pichere{ber1.eps,height=0.75in}
   \pichere{ber3.eps,height=1.25in}
\end{slide}
% -----------------------------------------------------------------
\begin{slide}{}

   NDR: Network Data Representation
   \begin{sitem}
      \item Defined by DCE
      \item Essentially the C type system
      \item Receiver-makes-right (architecture tag)
      \item Individual data items untagged
      \item Compiled stubs from IDL
      \item 4-byte architecture definition tag
      \pichere{ndr.eps,height=0.5in}
      \begin{sitem}
         \item {\tt IntegrRep}
         \begin{sitem}
            \item 0 = big-endian
            \item 1 = little-endian
         \end{sitem}
         \item {\tt CharRep}
         \begin{sitem}
            \item 0 = ASCII
            \item 1 = EBCDIC
         \end{sitem}
         \item {\tt FloatRep}
         \begin{sitem}
            \item 0 = IEEE 754
            \item 1 = VAX
            \item 2 = Cray
            \item 3 = IBM
         \end{sitem}
      \end{sitem}
   \end{sitem}
\end{slide}