if ! test -e disciplines.tar.gz then echo "Please copy disciplines.tar.gz to this directory !" exit 1 fi if test $NSHOME="" then if test -d $HOME/ns-allinone-2.1b5/ns-2.1b5 then NSHOME=$HOME/ns-allinone-2.1b5/ns-2.1b5 else NSHOME=$HOME/ns-allinone-2.1b5/ns-2.1b6 fi fi mv disciplines.tar.gz $NSHOME cd $NSHOME gzip -d disciplines.tar.gz tar xvf disciplines.tar rm disciplines.tar # ----------------------- Changes to $NSHOME/fred.cc --------------------------- sed '/printf("Error:.*q_->length,/ c\ printf("Error: invalid length: length %d, qlen %d \\n", q_->length(),' fred.cc > fred.tmp mv fred.tmp fred.cc # ----------------------- Changes to $NSHOME/packet.h -------------------------- sed '/double.*label_;/ d /inline.*double.*label().*{.*return.*(label_/ d /inline.*void.*setlabel.*(.*double.*label.*).*{.*label_.*=.*label/ d' packet.h > packet.tmp mv packet.tmp packet.h sed '/inline.*static.*int.*offset().*{.*return.*offset_;.*}/ i\ double label_; /inline.*static.*int.*offset().*{.*return.*offset_;.*}/ i\ inline double& label() { return (label_); } /inline.*static.*int.*offset().*{.*return.*offset_;.*}/ i\ inline void setlabel(double label) { label_= label; }' packet.h > packet.tmp mv packet.tmp packet.h cd $NSHOME/tcl/lib # ---------------- Changes to $NSHOME/tcl/lib/ns-default.tcl ------------------- sed '/Queue.RED set bytes_ false/ i\ Queue/CSFQ set id_ 0 /Queue.RED set bytes_ false/ i\ Queue/CSFQ set kLink_ 50000 /Queue.RED set bytes_ false/ i\ Queue/CSFQ set edge_ 1 /Queue.RED set bytes_ false/ i\ Queue/CSFQ set qsize_ 400000 /Queue.RED set bytes_ false/ i\ Queue/CSFQ set qsizeThresh_ 80000 /Queue.RED set bytes_ false/ i\ Queue/CSFQ set rate_ 10000 /Queue.RED set bytes_ false/ i\ Queue/FRED set bytes_ false /Queue.RED set bytes_ false/ i\ Queue/FRED set queue-in-bytes_ false /Queue.RED set bytes_ false/ i\ Queue/FRED set thresh_ 5 /Queue.RED set bytes_ false/ i\ Queue/FRED set maxthresh_ 15 /Queue.RED set bytes_ false/ i\ Queue/FRED set mean_pktsize_ 500 /Queue.RED set bytes_ false/ i\ Queue/FRED set q_weight_ 0.002 /Queue.RED set bytes_ false/ i\ Queue/FRED set wait_ true /Queue.RED set bytes_ false/ i\ Queue/FRED set linterm_ 10 /Queue.RED set bytes_ false/ i\ Queue/FRED set setbit_ false /Queue.RED set bytes_ false/ i\ Queue/FRED set drop-tail_ false /Queue.RED set bytes_ false/ i\ Queue/FRED set doubleq_ false /Queue.RED set bytes_ false/ i\ Queue/FRED set dqthresh_ 50 /Queue.RED set bytes_ false/ i\ Queue/FRED set many-flows_ 0' ns-default.tcl > ns-default.tmp mv ns-default.tmp ns-default.tcl # ------------------ Changes to $NSHOME/tcl/lib/ns-lib.tcl --------------------- sed '/if.*string first "RED".*qtype.*!=.*-1/ i\ if {[string first "CSFQ" $qtype]!=-1} { /if.*string first "RED".*qtype.*!=.*-1/ i\ $q link [$link_($sid:$did) set link_] /if.*string first "RED".*qtype.*!=.*-1/ i\ } /if.*string first "RED".*qtype.*!=.*-1/ i\ if {[string first "FRED" $qtype]!=-1} { /if.*string first "RED".*qtype.*!=.*-1/ i\ $q link [$link_($sid:$did) set link_] /if.*string first "RED".*qtype.*!=.*-1/ i\ } /if.*string first "RED".*qtype.*!=.*-1/ i\ if {[string first "FREDL" $qtype]!=-1} { /if.*string first "RED".*qtype.*!=.*-1/ i\ $q link [$link_($sid:$did) set link_] /if.*string first "RED".*qtype.*!=.*-1/ i\ }' ns-lib.tcl > ns-lib.tmp mv ns-lib.tmp ns-lib.tcl # ----------------- Changes to $NSHOME/tcl/lib/ns-queue.tcl -------------------- sed '/if.*type.*==.*"RED".*/ i\ if { $type == "CSFQ" } { /if.*type.*==.*"RED".*/ i\ set bw [$link_ set bandwidth_] /if.*type.*==.*"RED".*/ i\ $q set ptc_ [expr $bw / (8. * [$q set mean_pktsize_])] /if.*type.*==.*"RED".*/ i\ } /if.*type.*==.*"RED".*/ i\ if { $type == "FRED" } { /if.*type.*==.*"RED".*/ i\ set bw [$link_ set bandwidth_] /if.*type.*==.*"RED".*/ i\ $q set ptc_ [expr $bw / (8. * [$q set mean_pktsize_])] /if.*type.*==.*"RED".*/ i\ } /if.*type.*==.*"RED".*/ i\ if { $type == "FREDL" } { /if.*type.*==.*"RED".*/ i\ set bw [$link_ set bandwidth_] /if.*type.*==.*"RED".*/ i\ $q set ptc_ [expr $bw / (8. * [$q set mean_pktsize_])] /if.*type.*==.*"RED".*/ i\ }' ns-queue.tcl > ns-queue.tmp mv ns-queue.tmp ns-queue.tcl cd $NSHOME # ----------------------- Changes to $NSHOME/Makefile -------------------------- sed '/random.o.*timer-handler.o/ c\ random.o rng.o ranvar.o csfq.o fred.o util.o misc.o timer-handler.o \\' Makefile > Makefile.tmp mv Makefile.tmp Makefile make || { echo "disciplines make failed! Exiting ..." exit 1 }