To do that you need iptables. The table of TOS is the following:
HEXA BINAIRE DECIMAL SIGNIFICATION
0x10 1000 8 Minimize Delay
0x08 0100 4 Maximize throughput
0x04 0010 2 Maximize reliability
0x02 0001 1 Minimize monetary cost
0x00 0000 0 Normal
and here is an example of the rules to use to add TOS in packets:
iptables -A PREROUTING -t mangle -p tcp --sport ssh -j TOS --set-tos Minimize-Delay
iptables -A PREROUTING -t mangle -p tcp --sport ftp -j TOS --set-tos Minimize-Delay
iptables -A PREROUTING -t mangle -p tcp --sport ftp-data -j TOS --set-tos Maximize-Throughput
Hope this help you