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.

}hdr_asrm* seh = (hdr_asrm*) p->access(off_asrm_);switch (sh->type()) {case SRM_RQST:sp = get_st<strong>at</strong>e(sh->sender());seh->distance() = sp->distance_;break;...}Similarly, the method parseExtendedHeaders() is invoked every time an SRM packet is received. It sets the agentmember variable pdistance_ to the distance advertised by the peer th<strong>at</strong> sent the message. <strong>The</strong> member variable is boundto an i<strong>ns</strong>tance variable of the same name, so th<strong>at</strong> the peer distance can be accessed by the appropri<strong>at</strong>e i<strong>ns</strong>tance procedures.<strong>The</strong> corresponding parseExtendedHeaders() method for the Adaptive SRM agent is simply:void parseExtendedHeaders(Packet* p) {hdr_asrm* seh = (hdr_asrm*) p->access(off_asrm_);pdistance_ = seh->distance();}Finally, the adaptive SRM agent’s extended headers are defined as struct hdr_asrm. <strong>The</strong> header declar<strong>at</strong>ion is identicalto declaring other packet headers in <strong>ns</strong>. Unlike most other packet headers, these are not autom<strong>at</strong>ically available in the packet.<strong>The</strong> interpreted co<strong>ns</strong>tructor for the first adaptive agent will add the header to the packet form<strong>at</strong>. For example, the start of theco<strong>ns</strong>tructor for the Agent/SRM/Adaptive agent is:Agent/SRM/Adaptive set done_ 0Agent/SRM/Adaptive i<strong>ns</strong>tproc init args {if ![$class set done_] {set pm [[Simul<strong>at</strong>or i<strong>ns</strong>tance] set packetManager_]TclObject set off_asrm_ [$pm allochdr aSRM]$class set done_ 1}}eval $self next $args...36.8 SRM objectsSRM objects are a subclass of agent objects th<strong>at</strong> implement the SRM reliable multicast tra<strong>ns</strong>port protocol. <strong>The</strong>y inherit all ofthe generic agent functionalities. <strong>The</strong> methods for this object is described in the next section 36.9. Configur<strong>at</strong>ion parametersfor this object are:packetSize_ <strong>The</strong> d<strong>at</strong>a packet size th<strong>at</strong> will be used for repair messages. <strong>The</strong> default value is 1024.requestFunction_ <strong>The</strong> algorithm used to produce a retra<strong>ns</strong>mission request, e.g., setting request timers. <strong>The</strong> default value isSRM/request. Other possible request functio<strong>ns</strong> are SRM/request/Adaptive, used by the Adaptive SRM code.repairFunction_ <strong>The</strong> algorithm used to produce a repair, e.g., compute repair timers. <strong>The</strong> default value is SRM/repair. Otherpossible request functio<strong>ns</strong> are SRM/repair/Adaptive, used by the Adaptive SRM code.320

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

Saved successfully!

Ooh no, something went wrong!