/*
 * u32 - Classify using u32
 *
 * We distinguish UDP, TCP in general, two TCP port pairs in particular,
 * and a specific destination host last
 */


#include "ip.def"

#define MY_UDP		UDP_PCK($src=10.0.0.1 $dst=10.0.0.2 \
			  $sport=PORT_USER $dport=PORT_DOMAIN)
#define MY_TCP(PARAMS)	TCP_PCK($src=10.0.0.1 $dst=10.0.0.2 \
			  $sport=PORT_USER $dport=PORT_HTTP PARAMS)
#define MY_ICMP(PARAMS) IP_HDR($ipproto=ICMP $src=10.0.0.2 $dst=10.0.0.1 \
			  PARAMS)

dev eth0 100000 /* 100 Mbps */ {
    #include "fields.tc"

    prio (bands 5) {
	class if (ip_proto == IPPROTO_UDP); /* ... if (udp)  would be neat */
	class if (tcp_sport == PORT_USER && tcp_dport == PORT_TELNET);
	class if (tcp_sport == PORT_USER && tcp_dport == PORT_SMTP);
	class if (ip_proto == IPPROTO_TCP);
	class if (ip_dst == 10.0.0.2);
    }
}

send MY_UDP
send MY_TCP($dport=PORT_TELNET)
send MY_TCP($dport=PORT_SMTP)
send MY_TCP($dport=PORT_HTTP $dst=10.0.0.2)
send MY_ICMP($dst=10.0.0.2)
send MY_ICMP($dst=10.0.0.1)

end
