TC Next Generation
==================

Written 2001-2004 by Werner Almesberger
Testing and tcng language design also by Milena Mondini, U. of Napoli
"External" interface and related elements jointly designed with Jacob
Teplitsky, Bivio Networks.

Copyright 2001 EPFL-ICA, Werner Almesberger
Copyright 2001,2002 Bivio Networks, Network Robots, Werner Almesberger
Copyright 2003,2004 Werner Almesberger


New versions of tcng can be found in http://tcng.sourceforge.net/

This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

See the file COPYING.GPL for details.

The files tcc/ext/tccext.h, tcc/ext/tccext.c, tcc/ext/echoh.h, and
tcc/ext/echoh.c are distributed under the GNU Lesser General Public
License. See the file COPYING.LGPL for details.


Overview
--------

tcng is a redesign of the Linux traffic control architecture. In the first
phase, the configuration language will be improved. In the second phase,
kernel components will be generated directly by configuration utilities.
Throughout all this, full compatibility with the existing traffic control
infrastructure will be maintained.

The documentation for the tcng system can be found in the files
doc/tcng.ps and doc/tcng.txt


Building
--------

Prerequisites:

 - programs or packages required for running tcc and tcsim:
   cpp, gnuplot, Perl
 - additional packages required for building tcng from the distribution:
   gcc, binutils, make, flex, yacc, grep, sed, awk, textutils (cat, tr,
   etc.), fileutils (ln, rm, etc.), sh-utils (echo, pwd, etc.), LaTeX,
   dvips
 - additional packages needed after "make immaculate":
   transfig (fig2dev), wget

Prepare the other source trees used by tcsim:

 - obtain the Linux kernel source, version 2.4.3 or any later 2.4 kernel
   or any 2.5 kernel from 2.5.0 to 2.5.4 (2.5.5 and above will be supported
   at a later time)
 - if possible, extract it in the tcsim directory
 - obtain iproute2, version 991023, 001007, 010803, 010824, or 020116-try
 - if possible, extract it in the tcsim directory
 - run ./configure
   If the kernel is not in tcsim/linux or /usr/src/linux, specify its location
   with -k <directory> or -k <kernel_tarball>
   If the iproute2 is not in tcsim/iproute2, specify its location with
   -i <directory>
   If you want to use a different version of tcc than the one that will be
   built in tcc/tcc, specify the location of the tcc command with
   -t <path>


Building tcng:

Just run  make

It will first build tcc, then tcsim. For building tcsim, it extracts a
partial kernel source tree (containing mainly traffic control) in tcsim/klib,
compile it, then do the same with iproute2 (mainly tc) in tcsim/ulib.


Testing tcng:

make test


Example:

$ cd tcsim
$ wget ftp://ftp.kernel.org/pub/linux/kernel/v2.4/linux-2.4.26.tar.bz2
$ bzcat linux-2.4.26.tar.bz2 | tar xf -
$ wget ftp://ftp.inr.ac.ru/ip-routing/iproute2-2.4.7-now-ss010824.tar.gz
$ tar xfz iproute2-2.4.7-now-ss010824.tar.gz
$ cd ..
$ ./configure
$ make
$ make test

If taking iproute2 tarball from Debian mirror, the commands would be
as follows:

$ wget \
  http://ftp.debian.org/debian/pool/main/i/iproute/iproute_20010824.orig.tar.gz
$ tar xfz iproute_20010824.orig.tar.gz


Using HTB
---------

In order to use HTB, tcsim must be built with a recent kernel source
(2.4.20 or later). Furthermore, the HTB patch must be applied to the
iproute2 source tree before building tcsim.

Example:

$ wget http://luxik.cdi.cz/~devik/qos/htb/v3/htb3.6-020525.tgz
$ tar xfz iproute2-2.4.7-now-ss010824.tar.gz
$ mkdir htb
$ tar xCfz htb htb3.6-020525.tgz
$ patch -s -p1 -d iproute2 <htb/htb3.6_tc.diff


Installation
------------

$ make install

tries to install tcc, tcsim, and a few support files in the directories
bin, lib, and include underneath the the installation directory. The
latter defaults to /usr/local, but can be changed using  configure -d

Binary distributions of tcc and tcsim can be build with
$ make bindist
The resulting gzip'ed tar archives can be extracted in the desired
installation directory. Both archives contain a script ./localize.sh
that generates wrappers for tcc and tcsim, which convey the location
to those programs. localize.sh can be removed after running it.

The wrappers work by setting the environment variable TCNG_TOPDIR,
which, when defined, takes precedence over the paths built into tcc,
tcsim, etc.
