                       Computer Science 826
                           Assignment 3
                         (Due November 6)

For this assignment, continue to work in two person teams.
Please be particularly careful to submit your reports in
BOTH latex and ps formats.

The objective of this assignment is to give you experience
in writing Linux device driver level code to perform TCP
performance analysis. You will use the Linux firewall
construction interface and the character device interface
to build a tool that will capture traces of traffic
associated with a specified TCP connection.

You will use the CPSC 822/826 machines for building and testing
but you run your final performance tests on netlab-gw.
Be sure not to leave source code on the 822/826 machines.
Any source code found there will be DELETED WITHOUT NOTICE.

Begin by getting a copy of the contents of subdirectory
firewall so that you can see how installable modules and the
character device and netfilter interfaces work in linux.

I will give you a team id.  Your installable module must
be named team##.o  where ## is your two digit team id number.
You will also need to create a character device with major
device number 2## and minor number 0 on any machine on which
you test. You should set the permissions to 0666.

For each TCP packet that carries a SYN or FIN flag,
your tcp monitor should create a record of the following
form:

    22 typedef struct tcpletype
    23 {
    24    struct timeval tod;
    25    unsigned int   seq;
    26    unsigned int   ack;
    27    unsigned int   saddr;
    28    unsigned int   daddr;
    29    unsigned short sport;
    30    unsigned short dport;
    31    unsigned short tcp_flags;
    32    unsigned short resvd;
    33 } TCP_LOG_ENT;

These records should be buffered by your kernel module
in a circular buffer capable of holding 4096 such records.

You will build a small application called tcplog (see fwdump.c
for an example) that should enter an infinite loop in which it
does a sleep(1); and then downloads the raw the performance data
captured by your monitor since the last call. This raw data
should be stored written to the standard output.

You will also build a small application called tcpprint
that prints source and dest IP in dotted decimal, source
and dest ports in decimal and the flags in hex.

