next up previous contents
Next: Basic syntax Up: The tcng language Previous: The tcng language   Contents

Quick start

The following example illustrates most of the elements found in a typical tcng configuration:

#include "fields.tc"
#include "ports.tc"

dev "eth0" {
    egress {
        // classification

        class (<$high>)
            if tcp_dport == PORT_HTTP;
        class (<$low>)
            if 1;

        // queuing

        prio {
            $high = class (1) {
                fifo (limit 20kB);
            }
            $low = class (2) {
                fifo (limit 100kB);
            }
        }
    }
}

The first two lines include files with definitions for header fields and port numbers. For details, see section 2.13.

The dev and egress lines determine what is being configured, i.e. the egress (outbound) side of the network interface ``eth0''.

The configuration consists of two parts: the classification and the setup of the queuing system. In this example, we use a priority scheduler with two classes for the priorities ``high'' and ``low''.

Packets with TCP destination port 80 (HTTP) are sent to the high priority class, while all other packets (if 1;) are sent to the low priority class. Note that it is generally a good idea to finish a classifier with a selection rule that is always true.

The queuing part defines the queuing discipline for static priorities, with the two classes. Inside the high-priority class, there is another queuing discipline - a simple FIFO with a capacity of 20 kilobytes. Likewise, the low-priority class contains a FIFO with 100 kB.


next up previous contents
Next: Basic syntax Up: The tcng language Previous: The tcng language   Contents
Martin A. Brown 2003-11-06