12.07.2015 Views

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>The</strong> QueueMonitor class is not derived from Connector, <strong>and</strong> is not linked directly into the network topology. R<strong>at</strong>her,objects of the SnoopQueue class (or its derived classes) are i<strong>ns</strong>erted into the network topology, <strong>and</strong> these objects containreferences to an associ<strong>at</strong>ed queue monitor. Ordinarily, multiple SnoopQueue objects will refer to the same queue monitor.Objects co<strong>ns</strong>tructed out of these classes are linked in the simul<strong>at</strong>ion topology as described above <strong>and</strong> call QueueMonitorout, in, or drop procedures, depending on the particular type of snoopy queue.26.7 Per-Flow MonitoringA collection of specialized classes are used to to implement per-flow st<strong>at</strong>istics g<strong>at</strong>hering. <strong>The</strong>se classes include:QueueMonitor/ED/Flowmon, QueueMonitor/ED/Flow, <strong>and</strong> Classifier/Hash. Typically, an arriving packetis i<strong>ns</strong>pected to determine to which flow it belongs. This i<strong>ns</strong>pection <strong>and</strong> flow mapping is performed by a classifier object(described in section 26.7.1). Once the correct flow is determined, the packet is passed to a flow monitor, which is respo<strong>ns</strong>iblefor collecting per-flow st<strong>at</strong>e. Per-flow st<strong>at</strong>e is contained in flow objects in a one-to-one rel<strong>at</strong>io<strong>ns</strong>hip to the flows known by theflow monitor. Typically, a flow monitor will cre<strong>at</strong>e flow objects on-dem<strong>and</strong> when packets arrive th<strong>at</strong> cannot be mapped to analready-known flow.26.7.1 <strong>The</strong> Flow Monitor<strong>The</strong> QueueMonitor/ED/Flowmon class is respo<strong>ns</strong>ible for managing the cre<strong>at</strong>ion of new flow objects when packets arriveon previously unknown flows <strong>and</strong> for upd<strong>at</strong>ing existing flow objects. Because it is a subclass of QueueMonitor, each flowmonitor contai<strong>ns</strong> an aggreg<strong>at</strong>e count of packet <strong>and</strong> byte arrivals, departures, <strong>and</strong> drops. Thus, it is not necessary to cre<strong>at</strong>e asepar<strong>at</strong>e queue monitor to record aggreg<strong>at</strong>e st<strong>at</strong>istics. It provides the following OTcl interface:classifier<strong>at</strong>tachdumpflowsget(set) classifier to map packets to flows<strong>at</strong>tach a Tcl I/O channel to this monitordump contents of flow monitor to Tcl channelreturn string of flow object names known to this monitor<strong>The</strong> classifier function sets or gets the name of the previously-alloc<strong>at</strong>ed object which will perform packet-to-flowmapping for the flow monitor. Typically, the type of classifier used will have to do with the notion of “flow” held by the user.One of the hash based classifiers th<strong>at</strong> i<strong>ns</strong>pect various IP-level header fields is typically used here (e.g. fid, src/dst, src/dst/fid).Note th<strong>at</strong> while classifiers usually receive packets <strong>and</strong> forward them on to dow<strong>ns</strong>tream objects, the flow monitor uses theclassifier only for its packet mapping capability, so the flow monitor acts as a passive monitor only <strong>and</strong> does not activelyforward packets.<strong>The</strong> <strong>at</strong>tach <strong>and</strong> dump functio<strong>ns</strong> are used to associ<strong>at</strong>e a Tcl I/O stream with the flow monitor, <strong>and</strong> dump its contentson-dem<strong>and</strong>. <strong>The</strong> file form<strong>at</strong> used by the dump comm<strong>and</strong> is described below.<strong>The</strong> flows function retur<strong>ns</strong> a list of the names of flows known by the flow monitor in a way underst<strong>and</strong>able to Tcl. Thisallows tcl code to interrog<strong>at</strong>e a flow monitor in order to obtain h<strong>and</strong>les to the individual flows it maintai<strong>ns</strong>.26.7.2 Flow Monitor Trace Form<strong>at</strong><strong>The</strong> flow monitor defines a trace form<strong>at</strong> which may be used by post-processing scripts to determine various counts on aper-flow basis. <strong>The</strong> form<strong>at</strong> is defined by the following code in ~<strong>ns</strong>/flowmon.cc:240

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!