raptor wrote:> is there a way so that I can write something like that :
Hmm, looks like a good use for pragmas with tc output ;-)
After applying the attached quick and dirty patch, this
htb (pragma "#the_outer_qdisc") {
class (rate 10kbps,ceil 20kbps,pragma "#the_first_class") {
fifo(pragma "#the_inner_qdisc");
}
}
yields this:
# the_outer_qdisc
tc qdisc add dev eth0 handle 1:0 root htb
# the_first_class
tc class add dev eth0 parent 1:0 classid 1:1 htb rate 1250bps ceil 2500bps
# the_inner_qdisc
tc qdisc add dev eth0 handle 2:0 parent 1:1 pfifo
Note that you can''t include spaces in pragams, but all other
non-blank characters are fine.
> And similar thing for filters/classifiers ?!
Works there too, but only if using "on". When using "if",
tcc
may transform the expression quite heavily, and there''s no way
for associating output items with input items (in the general
case).
But a better way to do all this is to use tcc''s location map
to extract the comments directly from the source, as demonstrated
by the Perl script in the second attachment.
Input example:
/* this is the comment
for HTB */
htb {
// another comment, this
// time for a class
class (rate 10kbps,ceil 20kbps) {
// last but not least, a comment for the FIFO
fifo;
}
}
Not that, when invoking com.pl, the name of the input file
must be the last command-line argument.
- Werner
--
_________________________________________________________________________
/ Werner Almesberger, Buenos Aires, Argentina wa@almesberger.net /
/_http://www.almesberger.net/____________________________________________/