  <chapter>
    <title>Introduction</title>
    <para>
    Welcome! You're looking at the manual for &lnd;. Thanks for reading this.
    </para>
    <sect1>
      <title>What is &lnd;?</title>
      <para>
        &lnd; is a library for manipulating &pcap;/&tcpdump; trace files. You
        may ask why this requires a new library. We believe that a lot of code
        that uses &pcap; is wasted, for two reasons:
	<itemizedlist>
	  <listitem>
	    <para>
	      Developers often write monolithic, stand-alone programs that address
	      a particular problem at the time of writing. Many of these applications
	      are never released. Others only exist as executable programs and
	      not as libraries that would provide far better reuse of the code.
	    </para>
	  </listitem>
	  <listitem>
	    <para>
	      For lack of better alternatives, developers write their tools
	      at the &pcap; level, whose API operates at a very low level:
              essentially one is given means to apply BPF filters and iterate
              packets. 
	      That is not a bad thing &mdash; &pcap was never meant to provide
	      higher-level features. However, so far few libraries have attempted to
              fill the gap between &pcap and more complex applications.
	    </para>
	  </listitem>
	</itemizedlist>
      </para>
      <para>
        &lnd;'s goal is to improve this situation. It provides abstractions on top of the
        &pcap; paradigm that save developers a lot of time by focusing on the
        relevant parts of their applications. Moreover, &lnd; supports plugins
        (dynamically loaded libraries) that can essentially do whatever the
        programmer desires. When developers write their packet manipulation code
        as &lnd; plugins, this instantly allows other developers to use their
        tools.
      </para>
      <para>
        &lnd; provides data types and APIs for the most common situations when
        dealing with &pcap; trace files: trace files of arbitrary size, packets,
        network protocols, packet iterators, packet filters, just to name a few.
      </para>
    </sect1>
    <sect1>
      <title>How does it work?</title>
      <para>
        At a glance, &lnd; allows the user to edit trace files in terms of arbitrary
	<emphasis>trace areas</emphasis>, regions of packets in a trace file, defined
	by start- and end timestamps or size fractions. These areas can be conveniently
	<emphasis>iterated</emphasis> and <emphasis>modified</emphasis>, including
	<emphasis>insertion</emphasis>, <emphasis>modification</emphasis>, and
	<emphasis>deletion</emphasis> of packets. The <emphasis>filtering API</emphasis>
	allows the definition of arbitrary packet filters that cause packet iterators
	to report only those packets passing the currently active filters.
	&lnd; takes care of managing the various areas, so that the user always has a
	<emphasis>consistent view</emphasis> of the trace. &lnd;'s packet initialization
	provides <emphasis>structured packet data</emphasis> as much as the installed
	 protocol plugins permit; for all such protocols, it becomes trivially easy
	to <emphasis>obtain protocol data</emphasis> at a certain nesting level from
	a packet. No need to write protocol demuxers any more.
        &lnd; builds on the &pcapnav; library in order to facilitate navigation
        in a trace file in time and space.
      </para>
    </sect1>
    <sect1>
      <title>Read more ...</title>
      <para>
        For more details, please refer to the
        <ulink url="http://netdude.sf.net/doco/netdude-freenix2004/index.html">Freenix 2004 paper</ulink>
        on Netdude that presents the design and implementation of the entire framework.
      </para>
    </sect1>
    <sect1>
      <title>The Rest of this Manual</title>
      <para>The rest of this document is structured as follows: the 
        <link linkend="ch-concepts">first</link> chapter presents the
	main concepts of &lnd;. The <link linkend="ch-using">second</link>
	chapter explains how to build the library, the layout of the library's
	files on disk and how to build programs that use &lnd;.
	The <link linkend="ch-protocol">third</link> chapter explains
	Netdude's protocols.
	</para>
	<para>
	Code examples are not meant to be readily
	compilable when cut and pasted into a C file: variables are introduced
	when context requires them, and not all variables are meaningfully
	initialized. Admonitions in this manual have the following meaning:
	<note><para>Note: something you should be aware of.</para></note>
	<caution><para>Caution: listen up, you'll be glad you did.</para></caution>
	<warning><para>Warning: forget this and we'll get upset.</para></warning>
      </para>
    </sect1>
  </chapter>
