Marking the traffic

Marking the traffic is handled by Marker objects. Markers are FIFO queues that set the class index of each packet. To ensure accuracy of the simulations, it is best to configure these queues to have a very large buffer, so that no packets are dropped in the Marker. Demarkers are used to gather end-to-end delay statistics.
{\bfseries{}$ns_ simplex-link $source $router(1) $bw $delay Marker} # set-up marker;
$ns_ queue-limit $source $router(1) [expr $buff*10] # Select huge buffers for markers;
$ns_ queue-limit $router(1) $source [expr $buff*10] # to avoid traffic drops; 
set q [$ns_ get-queue $source $router(1)] #in the marker;
{\bfseries{}$q marker_type 2} # Statistical marker;
{\bfseries{}$q marker_frc 0.1 0.2 0.3 0.4} # 10\% Class 1, 20\% Class 2, 30\% Class 3, 40\% Class 4.;
{\bfseries{}$ns_ simplex-link $router(2) $sink $bw $delay Demarker} # set-up demarker;
$ns_ queue-limit $router(2) $sink [expr $buff*10] 
{\bfseries{}$q trace-file e2e} # trace end-to-end delays to file e2e;
The remaining steps (attaching agents and traffic generators or applications to the nodes) are explained in Chapters 10 and 40, and are handled as usual. We refer to these chapters and the example scripts provided with your ns distribution.

Tom Henderson 2011-11-05