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.

36.4 Loss Detection—<strong>The</strong> Class SRMinfoA very small encapsul<strong>at</strong>ing class, entirely in C++, tracks a number of assorted st<strong>at</strong>e inform<strong>at</strong>ion. Each member of the group,n i , uses one SRMinfo block for every other member of the group.An SRMinfo object about group member n j <strong>at</strong> n i , contai<strong>ns</strong> inform<strong>at</strong>ion about the session messages received by n i from n j .n i can use this inform<strong>at</strong>ion to compute its distance to n j .If n j sends is active in sending d<strong>at</strong>a traffic, then the SRMinfo object will also contain inform<strong>at</strong>ion about the received d<strong>at</strong>a,including a bit vector indic<strong>at</strong>ing all packets received from n j .<strong>The</strong> agent keeps a list of SRMinfo objects, one per group member, in its member variable, sip_. Its method, get_st<strong>at</strong>e(intsender) will return the object corresponding to th<strong>at</strong> sender, possibly cre<strong>at</strong>ing th<strong>at</strong> object, if it did not already exist. <strong>The</strong> classSRMinfo has two methods to access <strong>and</strong> set the bit vector, i.e.,ifReceived(int id)setReceived(int id)indic<strong>at</strong>es whether the particular message from the appropri<strong>at</strong>e sender, with id id was received<strong>at</strong> n i ,to set the bit to indic<strong>at</strong>e th<strong>at</strong> the particular message from the appropri<strong>at</strong>e sender, with id id wasreceived <strong>at</strong> n i .<strong>The</strong> session message variables to access timing inform<strong>at</strong>ion are public; no encapsul<strong>at</strong>ing methods are provided. <strong>The</strong>se are:int lsess_; /* # of last session msg received */int sendTime_; /* Time sess. msg. # sent */int recvTime_; /* Time sess. msg. # received */double distance_;/* D<strong>at</strong>a messages */int ld<strong>at</strong>a_; /* # of last d<strong>at</strong>a msg sent */36.5 Loss Recovery ObjectsIn the last section, we described the agent behavior when it receives a message. Timers are used to control when any particularcontrol message is to be sent. <strong>The</strong> SRM agent uses a separ<strong>at</strong>e class SRM to do the timer based processing. In this section,we describe the basics if the class SRM, <strong>and</strong> the loss recovery objects. <strong>The</strong> following section will describe how the classSRM is used for sending periodic session messages. An SRM agent will i<strong>ns</strong>tanti<strong>at</strong>e one object to recover from one lost d<strong>at</strong>apacket. Agents th<strong>at</strong> detect the loss will i<strong>ns</strong>tanti<strong>at</strong>e an object in the class SRM/request; agents th<strong>at</strong> receive a request <strong>and</strong>have the required d<strong>at</strong>a will i<strong>ns</strong>tanti<strong>at</strong>e an object in the class SRM/repair.Request Mechanisms SRM agents detect loss when they receive a message, <strong>and</strong> infer the loss based on the sequencenumber on the message received. Since packet reception is h<strong>and</strong>led entirely by the compiled object, loss detection occurs inthe C++ methods. Loss recovery, however, is h<strong>and</strong>led entirely by i<strong>ns</strong>tance procedures of the corresponding interpreted objectin OTcl.When any of the methods detects new losses, it invokes Agent/SRM::request{} with a list of the message sequencenumbers th<strong>at</strong> are missing. request{} will cre<strong>at</strong>e a new requestFunction_ object for each message th<strong>at</strong> is missing.<strong>The</strong> agent stores the object h<strong>and</strong>le in its array of pending_ objects. <strong>The</strong> key to the array is the message identifier〈sender〉:〈msgid〉.316

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

Saved successfully!

Ooh no, something went wrong!