Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

LinkDelay Class Reference

#include <delay.h>

Inheritance diagram for LinkDelay:

Inheritance graph
[legend]
Collaboration diagram for LinkDelay:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 LinkDelay ()
void recv (Packet *p, Handler *)
void send (Packet *p, Handler *)
void handle (Event *e)
double delay ()
double txtime (Packet *p)
double bandwidth () const
void pktintran (int src, int group)
NsObjecttarget ()
virtual void drop (Packet *p)
virtual void recv (Packet *p, const char *s)
virtual void recvOnly (Packet *)
virtual void delay_bind_init_all ()
virtual int delay_bind_dispatch (const char *varName, const char *localName, TclObject *tracer)
int isdebug () const
virtual void debug (const char *fmt,...)

Protected Member Functions

int command (int argc, const char *const *argv)
void reset ()
virtual void drop (Packet *p, const char *s)

Protected Attributes

double bandwidth_
double delay_
Event intr_
int dynamic_
PacketQueueitq_
int total_ [4]
NsObjecttarget_
NsObjectdrop_
int debug_

Constructor & Destructor Documentation

LinkDelay::LinkDelay  ) 
 

Definition at line 52 of file delay.cc.

References bandwidth_, and delay_.

00052                      : dynamic_(0), itq_(0)
00053 {
00054         bind_bw("bandwidth_", &bandwidth_);
00055         bind_time("delay_", &delay_);
00056 }


Member Function Documentation

double LinkDelay::bandwidth  )  const [inline]
 

Definition at line 57 of file delay.h.

References bandwidth_.

Referenced by REMQueue::command(), REDQueue::command(), JoBS::deque(), JoBS::enforceWC(), PushbackQueue::getBW(), CBQueue::insert_class(), CBQClass::newallot(), QSAgent::recv(), REMQueue::reset(), REDQueue::reset(), dsREDQueue::reset(), PushbackQueue::timeout(), and JoBS::updateStats().

00057 { return bandwidth_; }

int LinkDelay::command int  argc,
const char *const *  argv
[protected, virtual]
 

Reimplemented from Connector.

Reimplemented in ARPTable, LL, and SatLL.

Definition at line 58 of file delay.cc.

References Connector::command(), dynamic_, itq_, pktintran(), and total_.

Referenced by LL::command(), and ARPTable::command().

00059 {
00060         if (argc == 2) {
00061                 if (strcmp(argv[1], "isDynamic") == 0) {
00062                         dynamic_ = 1;
00063                         itq_ = new PacketQueue();
00064                         return TCL_OK;
00065                 }
00066         } else if (argc == 6) {
00067                 if (strcmp(argv[1], "pktintran") == 0) {
00068                         int src = atoi(argv[2]);
00069                         int grp = atoi(argv[3]);
00070                         int from = atoi(argv[4]);
00071                         int to = atoi(argv[5]);
00072                         pktintran (src, grp);
00073                         Tcl::instance().evalf("%s puttrace %d %d %d %d %d %d %d %d", name(), total_[0], total_[1], total_[2], total_[3], src, grp, from, to);
00074                         return TCL_OK;
00075                 }
00076         }
00077 
00078         return Connector::command(argc, argv);
00079 }

Here is the call graph for this function:

void NsObject::debug const char *  fmt,
... 
[virtual, inherited]
 

Definition at line 102 of file object.cc.

References NsObject::debug_.

00103 {
00104         if (!debug_)
00105                 return;
00106         va_list ap;
00107         va_start(ap, fmt);
00108         vprintf(fmt, ap);
00109 }

double LinkDelay::delay  )  [inline]
 

Definition at line 53 of file delay.h.

References delay_.

Referenced by REDQueue::command(), and Snoop::handle().

00053 { return delay_; }

int NsObject::delay_bind_dispatch const char *  varName,
const char *  localName,
TclObject tracer
[virtual, inherited]
 

Reimplemented in BayFullTcpAgent, Agent, MPLSAddressClassifier, LDPAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, and VegasTcpAgent.

Definition at line 63 of file object.cc.

References NsObject::debug_.

Referenced by MPLSAddressClassifier::delay_bind_dispatch(), and Agent::delay_bind_dispatch().

00064 {
00065         if (delay_bind_bool(varName, localName, "debug_", &debug_, tracer)) 
00066                 return TCL_OK;
00067         return TclObject::delay_bind_dispatch(varName, localName, tracer);
00068 }

void NsObject::delay_bind_init_all  )  [virtual, inherited]
 

Reimplemented in BayFullTcpAgent, Agent, MPLSAddressClassifier, LDPAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, and VegasTcpAgent.

Definition at line 57 of file object.cc.

Referenced by MPLSAddressClassifier::delay_bind_init_all(), and Agent::delay_bind_init_all().

00058 {
00059         delay_bind_init_one("debug_");
00060 }

void Connector::drop Packet p,
const char *  s
[protected, virtual, inherited]
 

Definition at line 114 of file connector.cc.

References Connector::drop_, Packet::free(), and NsObject::recv().

00115 {
00116         if (drop_ != 0)
00117                 drop_->recv(p, s);
00118         else
00119                 Packet::free(p);
00120 }

Here is the call graph for this function:

void Connector::drop Packet p  )  [virtual, inherited]
 

Definition at line 106 of file connector.cc.

References Connector::drop_, Packet::free(), and NsObject::recv().

Referenced by DSRAgent::acceptRouteReply(), ARPTable::arpresolve(), JoBS::dropFront(), Vq::dropPacketForECN(), DSRAgent::dropSendBuff(), JoBS::dropTail(), dsREDQueue::edrop(), Vq::enque(), SRR::enque(), SimpleIntServ::enque(), SFQ::enque(), rtqueue::enque(), RIOQueue::enque(), REMQueue::enque(), REDQueue::enque(), RedPDQueue::enque(), PIQueue::enque(), Marker::enque(), GK::enque(), dsREDQueue::enque(), DRR::enque(), DropTail::enque(), Demarker::enque(), aodv_rqueue::enque(), toraAgent::forward(), AODV::forward(), LandmarkAgent::ForwardPacket(), DSDV_Agent::forwardPacket(), DSRAgent::getRouteForPacket(), Snoop::handle(), DSRAgent::handleFlowForwarding(), DSRAgent::handleForwarding(), DSDV_Agent::lost_link(), TCPTapAgent::processpkt(), CMUPriQueue::prq_enqueue(), rtqueue::purge(), imepAgent::purgeReXmitQ(), SessionTTLChecker::recv(), TTLChecker::recv(), toraAgent::recv(), FullTcpAgent::recv(), BayFullTcpAgent::recv(), TBF::recv(), SatLL::recv(), LL::recv(), GAFPartner::recv(), FloodAgent::recv(), Filter::recv(), DynamicLink::recv(), DSDV_Agent::recv(), AODV::recv(), AODV::recvError(), PriQueue::recvHighPriority(), AODV::recvReply(), toraAgent::reset(), Queue< T >::reset(), reset(), AODV::rt_ll_failed(), AODV::rt_purge(), AODV::rt_resolve(), toraAgent::rtRoutePacket(), TCPTapAgent::sendpkt(), TapAgent::sendpkt(), IPTapAgent::sendpkt(), AODV::sendRequest(), SatLL::sendUp(), LL::sendUp(), PriQueue::Terminate(), DSRAgent::Terminate(), CMUPriQueue::Terminate(), ARPTable::Terminate(), and DSRAgent::undeliverablePkt().

00107 {
00108         if (drop_ != 0)
00109                 drop_->recv(p);
00110         else
00111                 Packet::free(p);
00112 }

Here is the call graph for this function:

void LinkDelay::handle Event e  )  [virtual]
 

Reimplemented from NsObject.

Reimplemented in LL.

Definition at line 115 of file delay.cc.

References PacketQueue::deque(), itq_, send(), and Event::time_.

00116 {
00117         Packet *p = itq_->deque();
00118         assert(p->time_ == e->time_);
00119         send(p, (Handler*) NULL);
00120 }

Here is the call graph for this function:

int NsObject::isdebug  )  const [inline, inherited]
 

Definition at line 61 of file object.h.

References NsObject::debug_.

00061 { return debug_; }

void LinkDelay::pktintran int  src,
int  group
 

Definition at line 122 of file delay.cc.

References hdr_CtrMcast::access(), hdr_ip::access(), hdr_ip::daddr(), dynamic_, hdr_ip::flowid(), hdr_CtrMcast::group(), itq_, len, PacketQueue::length(), PacketQueue::lookup(), hdr_ip::saddr(), hdr_CtrMcast::src(), and total_.

Referenced by command().

00123 {
00124         int reg = 1;
00125         int prune = 30;
00126         int graft = 31;
00127         int data = 0;
00128         for (int i=0; i<4; i++) {
00129                 total_[i] = 0;
00130         }
00131 
00132         if (! dynamic_)
00133                 return;
00134 
00135         int len = itq_->length();
00136         while (len) {
00137                 len--;
00138                 Packet* p = itq_->lookup(len);
00139                 hdr_ip* iph = hdr_ip::access(p);
00140                 if (iph->flowid() == prune) {
00141                         if (iph->saddr() == src && iph->daddr() == group) {
00142                                 total_[0]++;
00143                         }
00144                 } else if (iph->flowid() == graft) {
00145                         if (iph->saddr() == src && iph->daddr() == group) {
00146                                 total_[1]++;
00147                         }
00148                 } else if (iph->flowid() == reg) {
00149                         hdr_CtrMcast* ch = hdr_CtrMcast::access(p);
00150                         if (ch->src() == src+1 && ch->group() == group) {
00151                                 total_[2]++;
00152                         }
00153                 } else if (iph->flowid() == data) {
00154                         if (iph->saddr() == src+1 && iph->daddr() == group) {
00155                                 total_[3]++;
00156                         }
00157                 }
00158         }
00159         //printf ("%f %d %d %d %d\n", Scheduler::instance().clock(), total_[0], total_[1], total_[2],total_[3]);
00160 }

Here is the call graph for this function:

void NsObject::recv Packet p,
const char *  s
[virtual, inherited]
 

Reimplemented in CMUTrace.

Definition at line 96 of file object.cc.

References Packet::free().

00097 {
00098         Packet::free(p);
00099 }

Here is the call graph for this function:

void LinkDelay::recv Packet p,
Handler
[virtual]
 

Reimplemented from Connector.

Reimplemented in LL, SatLL, and LLSnoop.

Definition at line 81 of file delay.cc.

References delay_, dynamic_, PacketQueue::enque(), Scheduler::instance(), intr_, itq_, Scheduler::schedule(), Connector::target_, Event::time_, and txtime().

00082 {
00083         double txt = txtime(p);
00084         Scheduler& s = Scheduler::instance();
00085         if (dynamic_) {
00086                 Event* e = (Event*)p;
00087                 e->time_= txt + delay_;
00088                 itq_->enque(p); // for convinience, use a queue to store packets in transit
00089                 s.schedule(this, p, txt + delay_);
00090         } else {
00091                 s.schedule(target_, p, txt + delay_);
00092         }
00093         s.schedule(h, &intr_, txt);
00094 }

Here is the call graph for this function:

virtual void NsObject::recvOnly Packet  )  [inline, virtual, inherited]
 

Reimplemented in Agent, and Trace.

Definition at line 56 of file object.h.

Referenced by Trace::recvOnly().

00056 {};

void LinkDelay::reset  )  [protected, virtual]
 

Reimplemented from NsObject.

Definition at line 101 of file delay.cc.

References Scheduler::cancel(), PacketQueue::deque(), Connector::drop(), Scheduler::instance(), itq_, and PacketQueue::length().

00102 {
00103         Scheduler& s= Scheduler::instance();
00104 
00105         if (itq_ && itq_->length()) {
00106                 Packet *np;
00107                 // walk through packets currently in transit and kill 'em
00108                 while ((np = itq_->deque()) != 0) {
00109                         s.cancel(np);
00110                         drop(np);
00111                 }
00112         }
00113 }

Here is the call graph for this function:

void LinkDelay::send Packet p,
Handler
 

Reimplemented from Connector.

Definition at line 96 of file delay.cc.

References NsObject::recv(), and Connector::target_.

Referenced by handle().

00097 {
00098         target_->recv(p, (Handler*) NULL);
00099 }

Here is the call graph for this function:

NsObject* Connector::target  )  [inline, inherited]
 

Definition at line 48 of file connector.h.

References Connector::target_.

Referenced by JoBS::assignRateDropsADC(), FQ::deque(), QSAgent::recv(), and MIPMHAgent::reg().

00048 { return target_; }

double LinkDelay::txtime Packet p  )  [inline]
 

Definition at line 54 of file delay.h.

References hdr_cmn::access(), bandwidth_, and hdr_cmn::size().

Referenced by recv(), and CBQClass::update().

00054                                         {
00055                 return (8. * hdr_cmn::access(p)->size() / bandwidth_);
00056         }

Here is the call graph for this function:


Member Data Documentation

double LinkDelay::bandwidth_ [protected]
 

Definition at line 62 of file delay.h.

Referenced by bandwidth(), LinkDelay(), and txtime().

int NsObject::debug_ [protected, inherited]
 

Reimplemented in FECModel, FloodAgent, and LandmarkAgent.

Definition at line 66 of file object.h.

Referenced by REDQueue::command(), RedPDQueue::command(), PushbackQueue::command(), NsObject::debug(), NsObject::delay_bind_dispatch(), RedPDQueue::enque(), PushbackQueue::enque(), NsObject::isdebug(), NsObject::NsObject(), TfrcAgent::recv(), PushbackQueue::reportDrop(), and REDQueue::reset().

double LinkDelay::delay_ [protected]
 

Definition at line 63 of file delay.h.

Referenced by ARPTable::arpinput(), ARPTable::arprequest(), delay(), LinkDelay(), recv(), SatLL::sendDown(), LL::sendDown(), SatLL::sendUp(), and LL::sendUp().

NsObject* Connector::drop_ [protected, inherited]
 

Definition at line 57 of file connector.h.

Referenced by Connector::command(), Connector::drop(), and ErrorModel::recv().

int LinkDelay::dynamic_ [protected]
 

Definition at line 65 of file delay.h.

Referenced by command(), pktintran(), and recv().

Event LinkDelay::intr_ [protected]
 

Definition at line 64 of file delay.h.

Referenced by LLSnoop::recv(), and recv().

PacketQueue* LinkDelay::itq_ [protected]
 

Definition at line 67 of file delay.h.

Referenced by command(), handle(), pktintran(), recv(), and reset().

NsObject* Connector::target_ [protected, inherited]
 

Definition at line 56 of file connector.h.

Referenced by SRAgent::command(), SA_Agent::command(), IvsReceiver::command(), MultiFieldFilter::command(), Filter::command(), Connector::command(), DiffusionAgent::DiffusionAgent(), DSRAgent::DSRAgent(), PromotionTimer::expire(), FloodingAgent::FloodingAgent(), toraAgent::forward(), AODV::forward(), LandmarkAgent::ForwardPacket(), DSDV_Agent::forwardPacket(), SensorQueryAgent::generate_query(), DSDVTriggerHandler::handle(), AckRecons::handle(), DSRAgent::handlePacketReceipt(), DSDV_Agent::helper_callback(), AODV::initialized(), DSDV_Agent::lost_link(), OmniMcastAgent::OmniMcastAgent(), LandmarkAgent::periodic_callback(), LandmarkAgent::ProcessHierUpdate(), TCPTapAgent::processpkt(), IPTapAgent::processpkt(), CMUPriQueue::prq_enqueue(), CMUPriQueue::prq_resume(), DequeTrace::recv(), Trace::recv(), TraceIpMac::recv(), TraceIp::recv(), TBF::recv(), SRMAgent::recv(), SSMSRMAgent::recv(), SatDequeTrace::recv(), SAack_Agent::recv(), Queue< T >::recv(), PingResponder::recv(), MIPEncapsulator::recv(), LmsAgent::recv(), HackLossyLink::recv(), GAFPartner::recv(), FQ::recv(), FloodAgent::recv(), ErrorModel::recv(), DynamicLink::recv(), DumbAgent::recv(), DSRAgent::recv(), DelayModel::recv(), recv(), CtrMcastDecap::recv(), CtrMcastEncap::recv(), CMUTrace::recv(), PriQueue::recvHighPriority(), Trace::recvOnly(), TapAgent::recvpkt(), Queue< T >::resume(), send(), Connector::send(), Agent::send(), MIPBSAgent::send_ads(), SRMAgent::send_ctrl(), SSMSRMAgent::send_ctrl(), MFTPSndAgent::send_data(), LmsSender::send_dmcast(), LmsReceiver::send_dmcast(), LmsAgent::send_downstream(), SSMSRMAgent::send_glb_sess(), LmsSender::send_lms_pkt(), SSMSRMAgent::send_loc_sess(), MFTPRcvAgent::send_nak(), LmsReceiver::send_nak(), LmsReceiver::send_refresh(), SSMSRMAgent::send_rep_sess(), SRMAgent::send_sess(), MIPMHAgent::send_sols(), LmsSender::send_spm(), MFTPSndAgent::send_status_request(), LmsAgent::send_upstream(), LandmarkAgent::SendChangedTagListUpdate(), AODV::sendError(), AODV::sendHello(), UdpAgent::sendmsg(), SRMAgent::sendmsg(), SA_Agent::sendmsg(), RTPAgent::sendmsg(), LmsSender::sendmsg(), DSDV_Agent::sendOutBCastPkt(), SA_Agent::sendpkt(), rtProtoDV::sendpkt(), RTPAgent::sendpkt(), RTCPAgent::sendpkt(), IvsSource::sendpkt(), AODV::sendReply(), AODV::sendRequest(), LmsSender::solicit_naks(), Connector::target(), TBF::timeout(), and toraAgent::tora_output().

int LinkDelay::total_[4] [protected]
 

Definition at line 68 of file delay.h.

Referenced by command(), and pktintran().


The documentation for this class was generated from the following files:
Generated on Tue Apr 20 12:55:06 2004 for NS2.26SourcesOriginal by doxygen 1.3.3