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...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

eceived from multicast group th<strong>at</strong> must be processed. <strong>The</strong>refore, the applic<strong>at</strong>ion agent must set the packet’s destin<strong>at</strong>ionaddress to zero.For locally origin<strong>at</strong>ed d<strong>at</strong>a, the agent adds the appropri<strong>at</strong>e SRM headers, sets the destin<strong>at</strong>ion address to the multicast group,<strong>and</strong> forwards the packet to its target.On receiving a d<strong>at</strong>a message from the group, recv_d<strong>at</strong>a(sender, msgid) will upd<strong>at</strong>e its st<strong>at</strong>e marking message 〈sender,msgid〉 received, <strong>and</strong> possibly trigger requests if it detects losses. In addition, if the message was an older message receivedout of order, then there must be a pending request or repair th<strong>at</strong> must be cleared. In th<strong>at</strong> case, the compiled object invokes theOTcl i<strong>ns</strong>tance procedure, recv-d<strong>at</strong>a{sender, msgid} 2 .Currently, there is no provision for the receivers to actually receive any applic<strong>at</strong>ion d<strong>at</strong>a. <strong>The</strong> agent does not also store any ofthe user d<strong>at</strong>a. It only gener<strong>at</strong>es repair messages of the appropri<strong>at</strong>e size, defined by the i<strong>ns</strong>tance variable packetSize_. However,the agent assumes th<strong>at</strong> any applic<strong>at</strong>ion d<strong>at</strong>a is placed in the d<strong>at</strong>a portion of the packet, pointed to by packet->accessd<strong>at</strong>a().Request Packets On receiving a request, recv_rqst(sender, msgid) will check whether it needs to schedule requests forother missing d<strong>at</strong>a. If it has received this request before it was aware th<strong>at</strong> the source had gener<strong>at</strong>ed this d<strong>at</strong>a message (i.e.,the sequence number of the request is higher than the last known sequence number of d<strong>at</strong>a from this source), then the agentcan infer th<strong>at</strong> it is missing this, as well as d<strong>at</strong>a from the last known sequence number onwards; it schedules requests for all ofthe missing d<strong>at</strong>a <strong>and</strong> retur<strong>ns</strong>. On the other h<strong>and</strong>, if the sequence number of the request is less than the last known sequencenumber from the source, then the agent can be in one of three st<strong>at</strong>es: (1) it does not have this d<strong>at</strong>a, <strong>and</strong> has a request pendingfor it, (2) it has the d<strong>at</strong>a, <strong>and</strong> has seen an earlier request, upon which it has a repair pending for it, or (3) it has the d<strong>at</strong>a, <strong>and</strong>it should i<strong>ns</strong>tanti<strong>at</strong>e a repair. All of these error recovery mechanisms are done in OTcl; recv_rqst() invokes the i<strong>ns</strong>tanceprocedure recv-rqst{sender, msgid, requester} for further processing.Repair Packets On receiving a repair, recv_repr(sender, msgid) will check whether it needs to schedule requests forother missing d<strong>at</strong>a. If it has received this repair before it was aware th<strong>at</strong> the source had gener<strong>at</strong>ed this d<strong>at</strong>a message (i.e., thesequence number of the repair is higher than the last known sequence number of d<strong>at</strong>a from this source), then the agent caninfer th<strong>at</strong> it is missing all d<strong>at</strong>a between the last known sequence number <strong>and</strong> th<strong>at</strong> on the repair; it schedules requests for all ofthis d<strong>at</strong>a, marks this message as received, <strong>and</strong> retur<strong>ns</strong>. On the other h<strong>and</strong>, if the sequence number of the request is less thanthe last known sequence number from the source, then the agent can be in one of three st<strong>at</strong>es: (1) it does not have this d<strong>at</strong>a,<strong>and</strong> has a request pending for it, (2) it has the d<strong>at</strong>a, <strong>and</strong> has seen an earlier request, upon which it has a repair pending for it,or (3) it has the d<strong>at</strong>a, <strong>and</strong> probably scheduled a repair for it <strong>at</strong> some time; after error recovery, its hold down timer (equal tothree times its distance to some requester) expired, <strong>at</strong> which time the pending object was cleared. In this last situ<strong>at</strong>ion, theagent will simply ignore the repair, for lack of being able to do anything meaningful. All of these error recovery mechanismsare done in OTcl; recv_repr() invokes the i<strong>ns</strong>tance procedure recv-repr{sender, msgid} to complete the loss recoveryphase for the particular message.Session Packets On receiving a session message, the agent upd<strong>at</strong>es its sequence numbers for all active sources, <strong>and</strong> computesits i<strong>ns</strong>tantaneous distance to the sending agent if possible. <strong>The</strong> agent will ignore earlier session messages from a groupmember, if it has received a l<strong>at</strong>er one out of order.Session message processing is done in recv_sess(). <strong>The</strong> form<strong>at</strong> of the session message is: 〈count of tuples in this message,list of tuples〉, where each tuple indic<strong>at</strong>es the 〈sender id, last sequence number from the source, time the last session messagewas received from this sender, time th<strong>at</strong> th<strong>at</strong> message was sent〉. <strong>The</strong> first tuple is the inform<strong>at</strong>ion about the local agent 3 .2 Technically, recv_d<strong>at</strong>a() invokes the i<strong>ns</strong>tance procedure recv d<strong>at</strong>a 〈sender〉 〈msgid〉, th<strong>at</strong> then invokes recv-d<strong>at</strong>a{}. <strong>The</strong> indirectionallows individual simul<strong>at</strong>ion scripts to override the recv{} as needed.3 Note th<strong>at</strong> this implement<strong>at</strong>ion of session message h<strong>and</strong>ling is subtly different from th<strong>at</strong> used in wb or described in [11]. In principle, an agent dissemin<strong>at</strong>esa list of the d<strong>at</strong>a it has actually received. Our implement<strong>at</strong>ion, on the other h<strong>and</strong>, only dissemin<strong>at</strong>es a count of the last message sequence number per sourceth<strong>at</strong> the agent knows th<strong>at</strong> th<strong>at</strong> the source has sent. This is a co<strong>ns</strong>traint when studying aspects of loss recovery during partition <strong>and</strong> healing. It is reasonable toexpect th<strong>at</strong> the maintainer of this code will fix this problem during one of his numerous intervals of copious spare time.315

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

Saved successfully!

Ooh no, something went wrong!