📄 node479.html
字号:
<html><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><!--Converted with jLaTeX2HTML 2002 (1.62) JA patch-1.4patched version by: Kenshi Muto, Debian Project.LaTeX2HTML 2002 (1.62),original version by: Nikos Drakos, CBLU, University of Leeds* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan* with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --><HTML><HEAD><TITLE>35.3 The class TrafficGenerator</TITLE><META NAME="description" CONTENT="35.3 The class TrafficGenerator"><META NAME="keywords" CONTENT="everything"><META NAME="resource-type" CONTENT="document"><META NAME="distribution" CONTENT="global"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"><META NAME="Generator" CONTENT="jLaTeX2HTML v2002 JA patch-1.4"><META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"><LINK REL="STYLESHEET" HREF="everything.css" tppabs="http://www.isi.edu/nsnam/ns/doc/everything.css"><LINK REL="next" HREF="node485.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node485.html"><LINK REL="previous" HREF="node473.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node473.html"><LINK REL="up" HREF="node471.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node471.html"><LINK REL="next" HREF="node480.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node480.html"></HEAD><BODY ><!--Navigation Panel--><A NAME="tex2html8776" HREF="node480.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node480.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html8770" HREF="node471.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node471.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html8764" HREF="node478.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node478.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html8772" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html"><IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="file:/usr/share/latex2html/icons/contents.png"></A> <A NAME="tex2html8774" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html"><IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="file:/usr/share/latex2html/icons/index.png"></A> <BR><B> Next:</B> <A NAME="tex2html8777" HREF="node480.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node480.html">35.3.0.0.1 Exponential On/Off</A><B> Up:</B> <A NAME="tex2html8771" HREF="node471.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node471.html">35. Applications and transport</A><B> Previous:</B> <A NAME="tex2html8765" HREF="node478.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node478.html">35.2.5 An example</A>   <B> <A NAME="tex2html8773" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html8775" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html">Index</A></B> <BR><BR><!--End of Navigation Panel--><H1><A NAME="SECTION07130000000000000000"></A><A NAME="sec:trafgenclass"></A><BR>35.3 The class TrafficGenerator</H1><P>TrafficGenerator is an abstract C++ class defined as follows:<PRE> class TrafficGenerator : public Application { public: TrafficGenerator(); virtual double next_interval(int &) = 0; virtual void init() {} virtual double interval() { return 0; } virtual int on() { return 0; } virtual void timeout(); virtual void recv() {} virtual void resume() {} protected: virtual void start(); virtual void stop(); double nextPkttime_; int size_; int running_; TrafficTimer timer_; };</PRE>The pure virtual function []next_interval returns the time until thenext packet is created and also sets the size in bytes of the nextpacket. The function []start calls init and starts the timer. The function []timeout sends a packet and reschedules thenext timeout. The function []stop cancels any pending transmissions.Callbacks are typically not used for traffic generators, so these functions (<TT>recv, resume</TT>) are null.<P>Currently, there are four C++ classes derived from theclass TrafficGenerator:<OL><LI><TT>EXPOO_Traffic</TT>--generates traffic according to an Exponential On/Off distribution. Packets are sent at a fixed rate during on periods, and no packets are sent during off periods. Both on and off periods are taken from an exponential distribution. Packets are constant size.</LI><LI><TT>POO_Traffic</TT>--generates traffic according to a Pareto On/Off distribution. This is identical to the Exponential On/Off distribution, except the on and off periods are taken from a pareto distribution. These sources can be used to generate aggregate traffic that exhibits long range dependency.</LI><LI><TT>CBR_Traffic</TT>--generates traffic according to a deterministic rate. Packets are constant size. Optionally, some randomizing dither can be enabled on the interpacket departure intervals. </LI><LI><TT>TrafficTrace</TT>--generates traffic according to a trace file. Each record in the trace file consists of 2 32-bit fields in network (big-endian) byte order. The first contains the time in microseconds until the next packet is generated. The second contains the length in bytes of the next packet.</LI></OL>These classes can be created from OTcl. The OTcl classes names andassociated parameters are given below:<P><BR><HR><!--Table of Child-Links--><A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A><UL><LI><UL><LI><UL><LI><A NAME="tex2html8778" HREF="node480.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node480.html">35.3.0.0.1 Exponential On/Off</A><LI><A NAME="tex2html8779" HREF="node481.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node481.html">35.3.0.0.2 Pareto On/Off</A><LI><A NAME="tex2html8780" HREF="node482.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node482.html">35.3.0.0.3 CBR</A><LI><A NAME="tex2html8781" HREF="node483.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node483.html">35.3.0.0.4 Traffic Trace</A></UL></UL><BR><LI><A NAME="tex2html8782" HREF="node484.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node484.html">35.3.1 An example</A></UL><!--End of Table of Child-Links--><HR><!--Navigation Panel--><A NAME="tex2html8776" HREF="node480.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node480.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html8770" HREF="node471.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node471.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html8764" HREF="node478.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node478.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html8772" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html"><IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="file:/usr/share/latex2html/icons/contents.png"></A> <A NAME="tex2html8774" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html"><IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="file:/usr/share/latex2html/icons/index.png"></A> <BR><B> Next:</B> <A NAME="tex2html8777" HREF="node480.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node480.html">35.3.0.0.1 Exponential On/Off</A><B> Up:</B> <A NAME="tex2html8771" HREF="node471.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node471.html">35. Applications and transport</A><B> Previous:</B> <A NAME="tex2html8765" HREF="node478.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node478.html">35.2.5 An example</A>   <B> <A NAME="tex2html8773" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html8775" HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html">Index</A></B> <!--End of Navigation Panel--><ADDRESS>2003-09-23</ADDRESS></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -