#include <snoop.h>
Inheritance diagram for LLSnoop:


Public Member Functions | |
| LLSnoop () | |
| void | recv (Packet *, Handler *) |
| void | snoop_rtt (double) |
| double | timeout () |
| int | integrate () |
| virtual void | recv (Packet *p, const char *s) |
| void | handle (Event *e) |
| int | initialized () |
| virtual void | sendUp (Packet *p) |
| virtual void | sendDown (Packet *p) |
| int | seqno () |
| int | ackno () |
| int | macDA () |
| Queue * | ifq () |
| NsObject * | downtarget () |
| NsObject * | uptarget () |
| ARPTable * | arp_table () |
| void | send (Packet *p, Handler *) |
| double | delay () |
| double | txtime (Packet *p) |
| double | bandwidth () const |
| void | pktintran (int src, int group) |
| NsObject * | target () |
| virtual void | drop (Packet *p) |
| 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 | |
| int | integrate_ |
| double | srtt_ |
| double | rttvar_ |
| double | g_ |
| double | snoopTick_ |
| int | seqno_ |
| int | ackno_ |
| int | macDA_ |
| Queue * | ifq_ |
| Mac * | mac_ |
| LanRouter * | lanrouter_ |
| ARPTable * | arptable_ |
| VARPTable * | varp_ |
| NsObject * | downtarget_ |
| NsObject * | uptarget_ |
| double | bandwidth_ |
| double | delay_ |
| Event | intr_ |
| int | dynamic_ |
| PacketQueue * | itq_ |
| int | total_ [4] |
| NsObject * | target_ |
| NsObject * | drop_ |
| int | debug_ |
Friends | |
| void | ARPTable::arpinput (Packet *p, LL *ll) |
| void | ARPTable::arprequest (nsaddr_t src, nsaddr_t dst, LL *ll) |
|
|
Definition at line 94 of file snoop.h. References integrate_.
00094 : LL() { bind("integrate_", &integrate_);} |
|
|
Definition at line 94 of file ll.h. References LL::ackno_.
00094 { return ackno_; }
|
|
|
Definition at line 99 of file ll.h. References LL::arptable_.
00099 { return arptable_; }
|
|
|
Definition at line 57 of file delay.h. References LinkDelay::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_; }
|
|
||||||||||||
|
Reimplemented from LinkDelay. Reimplemented in SatLL. Definition at line 75 of file ll.cc. References LL::arptable_, LinkDelay::command(), LL::downtarget_, LL::ifq_, LL::lanrouter_, LL::mac_, LL::uptarget_, and LL::varp_. Referenced by SatLL::command().
00076 {
00077 Tcl& tcl = Tcl::instance();
00078 if (argc == 3) {
00079 if (strcmp(argv[1], "ifq") == 0) {
00080 ifq_ = (Queue*) TclObject::lookup(argv[2]);
00081 return (TCL_OK);
00082 }
00083 if(strcmp(argv[1], "arptable") == 0) {
00084 arptable_ = (ARPTable*)TclObject::lookup(argv[2]);
00085 assert(arptable_);
00086 return TCL_OK;
00087 }
00088 if(strcmp(argv[1], "varp") == 0) {
00089 varp_ = (VARPTable*)TclObject::lookup(argv[2]);
00090 assert(varp_);
00091 return TCL_OK;
00092 }
00093 if (strcmp(argv[1], "mac") == 0) {
00094 mac_ = (Mac*) TclObject::lookup(argv[2]);
00095 assert(mac_);
00096 return (TCL_OK);
00097 }
00098 if (strcmp(argv[1], "down-target") == 0) {
00099 downtarget_ = (NsObject*) TclObject::lookup(argv[2]);
00100 return (TCL_OK);
00101 }
00102 if (strcmp(argv[1], "up-target") == 0) {
00103 uptarget_ = (NsObject*) TclObject::lookup(argv[2]);
00104 return (TCL_OK);
00105 }
00106 if (strcmp(argv[1], "lanrouter") == 0) {
00107 lanrouter_ = (LanRouter*) TclObject::lookup(argv[2]);
00108 return (TCL_OK);
00109 }
00110
00111 }
00112 else if (argc == 2) {
00113 if (strcmp(argv[1], "ifq") == 0) {
00114 tcl.resultf("%s", ifq_->name());
00115 return (TCL_OK);
00116 }
00117 if (strcmp(argv[1], "mac") == 0) {
00118 tcl.resultf("%s", mac_->name());
00119 return (TCL_OK);
00120 }
00121 if (strcmp(argv[1], "down-target") == 0) {
00122 tcl.resultf("%s", downtarget_->name());
00123 return (TCL_OK);
00124 }
00125 if (strcmp(argv[1], "up-target") == 0) {
00126 tcl.resultf("%s", uptarget_->name());
00127 return (TCL_OK);
00128 }
00129 }
00130 return LinkDelay::command(argc, argv);
00131 }
|
Here is the call graph for this function:

|
||||||||||||
|
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 }
|
|
|
Definition at line 53 of file delay.h. References LinkDelay::delay_. Referenced by REDQueue::command(), and Snoop::handle().
00053 { return delay_; }
|
|
||||||||||||||||
|
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 }
|
|
|
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 }
|
|
|
Definition at line 97 of file ll.h. References LL::downtarget_.
00097 { return downtarget_; }
|
|
||||||||||||
|
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:

|
Here is the call graph for this function:

|
|
Reimplemented from LinkDelay. Definition at line 85 of file ll.h. References LL::recv().
|
Here is the call graph for this function:

|
|
Definition at line 96 of file ll.h. References LL::ifq_. Referenced by Snoop::snoop_data().
00096 { return ifq_; }
|
|
|
Definition at line 86 of file ll.h. References LL::downtarget_, LL::mac_, and LL::uptarget_. Referenced by SatLL::recv(), and LL::recv().
00086 {
00087 return (mac_ && uptarget_ && downtarget_);
00088 }
|
|
|
Definition at line 100 of file snoop.h. References integrate_. Referenced by Snoop::snoop_rtt(), and Snoop::timeout().
00100 { return integrate_; }
|
|
|
Definition at line 61 of file object.h. References NsObject::debug_.
00061 { return debug_; }
|
|
|
Definition at line 95 of file ll.h. References LL::macDA_.
00095 { return macDA_; }
|
|
||||||||||||
|
Definition at line 122 of file delay.cc. References hdr_CtrMcast::access(), hdr_ip::access(), hdr_ip::daddr(), LinkDelay::dynamic_, hdr_ip::flowid(), hdr_CtrMcast::group(), LinkDelay::itq_, len, PacketQueue::length(), PacketQueue::lookup(), hdr_ip::saddr(), hdr_CtrMcast::src(), and LinkDelay::total_. Referenced by LinkDelay::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:

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

|
||||||||||||
|
Reimplemented from LL. Definition at line 166 of file snoop.cc. References hdr_ip::access(), hdr_ip::daddr(), hdr_cmn::direction(), HDR_CMN, Scheduler::instance(), integrate_, LinkDelay::intr_, Snoop::recv(), hdr_ip::saddr(), Scheduler::schedule(), and hdr_cmn::UP.
00167 {
00168 Tcl &tcl = Tcl::instance();
00169 hdr_ip *iph = hdr_ip::access(p);
00170
00171 /* get-snoop creates a snoop object if none currently exists */
00172 hdr_cmn *ch = HDR_CMN(p);
00173 if(ch->direction() == hdr_cmn::UP)
00174 /* get-snoop creates a snoop object if none currently exists */
00175 /* In ns, addresses have ports embedded in them. */
00176 tcl.evalf("%s get-snoop %d %d", name(), iph->daddr(),
00177 iph->saddr());
00178
00179 else
00180 tcl.evalf("%s get-snoop %d %d", name(), iph->saddr(),
00181 iph->daddr());
00182
00183 Snoop *snoop = (Snoop *) TclObject::lookup(tcl.result());
00184
00185 snoop->recv(p, h);
00186
00187 if (integrate_)
00188 tcl.evalf("%s integrate %d %d", name(), iph->saddr(),
00189 iph->daddr());
00190 if (h) /* resume higher layer (queue) */
00191 Scheduler::instance().schedule(h, &intr_, 0.000001);
00192 return;
00193 }
|
Here is the call graph for this function:

|
|
Reimplemented in Agent, and Trace. Definition at line 56 of file object.h. Referenced by Trace::recvOnly().
00056 {};
|
|
|
Reimplemented from NsObject. Definition at line 101 of file delay.cc. References Scheduler::cancel(), PacketQueue::deque(), Connector::drop(), Scheduler::instance(), LinkDelay::itq_, and PacketQueue::length().
|
Here is the call graph for this function:

|
||||||||||||
|
Reimplemented from Connector. Definition at line 96 of file delay.cc. References NsObject::recv(), and Connector::target_. Referenced by LinkDelay::handle().
|
Here is the call graph for this function:

|
|
Reimplemented in SatLL. Definition at line 167 of file ll.cc. References Packet::access(), Mac::addr(), hdr_cmn::addr_type(), VARPTable::arpresolve(), ARPTable::arpresolve(), LL::arptable_, hdr_ip::daddr(), LinkDelay::delay_, LL::downtarget_, ETHERTYPE_IP, Address::get_nodeaddr(), HDR_CMN, Mac::hdr_dst(), HDR_IP, HDR_LL, HDR_MAC, Mac::hdr_src(), Mac::hdr_type(), Scheduler::instance(), Address::instance(), IP_BROADCAST, LL::lanrouter_, LL_DATA, hdr_ll::lltype(), LL::mac_, MAC_BROADCAST, LL::macDA_, LanRouter::next_hop(), hdr_cmn::next_hop(), NS_AF_ILINK, NS_AF_INET, NS_AF_NONE, nsaddr_t, hdr_mac::offset_, Scheduler::schedule(), LL::seqno_, hdr_ll::seqno_, u_int32_t, and LL::varp_. Referenced by Snoop::recv(), LL::recv(), and Snoop::snoop_rxmit().
00168 {
00169 hdr_cmn *ch = HDR_CMN(p);
00170 hdr_ip *ih = HDR_IP(p);
00171
00172 nsaddr_t dst = (nsaddr_t)Address::instance().get_nodeaddr(ih->daddr());
00173 //nsaddr_t dst = ih->dst();
00174 hdr_ll *llh = HDR_LL(p);
00175 char *mh = (char*)p->access(hdr_mac::offset_);
00176
00177 llh->seqno_ = ++seqno_;
00178 llh->lltype() = LL_DATA;
00179
00180 mac_->hdr_src(mh, mac_->addr());
00181 mac_->hdr_type(mh, ETHERTYPE_IP);
00182 int tx = 0;
00183
00184 switch(ch->addr_type()) {
00185
00186 case NS_AF_ILINK:
00187 mac_->hdr_dst((char*) HDR_MAC(p), ch->next_hop());
00188 break;
00189
00190 case NS_AF_INET:
00191 dst = ch->next_hop();
00192 /* FALL THROUGH */
00193
00194 case NS_AF_NONE:
00195
00196 if (IP_BROADCAST == (u_int32_t) dst)
00197 {
00198 mac_->hdr_dst((char*) HDR_MAC(p), MAC_BROADCAST);
00199 break;
00200 }
00201 /* Assuming arptable is present, send query */
00202 if (arptable_) {
00203 tx = arptable_->arpresolve(dst, p, this);
00204 break;
00205 }
00206 //if (varp_) {
00207 //tx = varp_->arpresolve(dst, p);
00208 //break;
00209
00210 //}
00211 /* FALL THROUGH */
00212
00213 default:
00214
00215 int IPnh = (lanrouter_) ? lanrouter_->next_hop(p) : -1;
00216 if (IPnh < 0)
00217 mac_->hdr_dst((char*) HDR_MAC(p),macDA_);
00218 else if (varp_)
00219 tx = varp_->arpresolve(IPnh, p);
00220 else
00221 mac_->hdr_dst((char*) HDR_MAC(p), IPnh);
00222 break;
00223 }
00224
00225 if (tx == 0) {
00226 Scheduler& s = Scheduler::instance();
00227 // let mac decide when to take a new packet from the queue.
00228 s.schedule(downtarget_, p, delay_);
00229 }
00230 }
|
Here is the call graph for this function:

|
|
Reimplemented in SatLL. Definition at line 234 of file ll.cc. References hdr_cmn::access(), LinkDelay::delay_, Connector::drop(), hdr_cmn::error(), Scheduler::instance(), Scheduler::schedule(), and LL::uptarget_. Referenced by LL::recv().
00235 {
00236
00237 Scheduler& s = Scheduler::instance();
00238 if (hdr_cmn::access(p)->error() > 0)
00239 drop(p);
00240 else
00241 s.schedule(uptarget_, p, delay_);
00242 }
|
Here is the call graph for this function:

|
|
Definition at line 93 of file ll.h. References LL::seqno_.
00093 { return seqno_; }
|
|
|
Definition at line 684 of file snoop.cc. References Scheduler::clock(), g_, Scheduler::instance(), rttvar_, and srtt_. Referenced by Snoop::snoop_rtt().
00685 {
00686 double rtt = Scheduler::instance().clock() - sndTime;
00687 if (rtt > 0) {
00688 srtt_ = g_*srtt_ + (1-g_)*rtt;
00689 double delta = rtt - srtt_;
00690 if (delta < 0)
00691 delta = -delta;
00692 if (rttvar_ != 0)
00693 rttvar_ = g_*delta + (1-g_)*rttvar_;
00694 else
00695 rttvar_ = delta;
00696 }
00697 }
|
Here is the call graph for this function:

|
|
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_; }
|
|
|
Definition at line 97 of file snoop.h. References max, rttvar_, snoopTick_, and srtt_. Referenced by Snoop::timeout().
00097 {
00098 return max(srtt_+4*rttvar_, snoopTick_);
00099 }
|
|
|
Definition at line 54 of file delay.h. References hdr_cmn::access(), LinkDelay::bandwidth_, and hdr_cmn::size(). Referenced by LinkDelay::recv(), and CBQClass::update().
00054 {
00055 return (8. * hdr_cmn::access(p)->size() / bandwidth_);
00056 }
|
Here is the call graph for this function:

|
|
Definition at line 98 of file ll.h. References LL::uptarget_. Referenced by Snoop::command().
00098 { return uptarget_; }
|
|
||||||||||||
|
|
|
||||||||||||||||
|
|
|
|
Definition at line 105 of file ll.h. Referenced by LL::ackno(). |
|
|
Definition at line 111 of file ll.h. Referenced by LL::arp_table(), LL::command(), LL::recv(), and LL::sendDown(). |
|
|
Definition at line 62 of file delay.h. Referenced by LinkDelay::bandwidth(), LinkDelay::LinkDelay(), and LinkDelay::txtime(). |
|
|
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(). |
|
|
Definition at line 63 of file delay.h. Referenced by ARPTable::arpinput(), ARPTable::arprequest(), LinkDelay::delay(), LinkDelay::LinkDelay(), LinkDelay::recv(), SatLL::sendDown(), LL::sendDown(), SatLL::sendUp(), and LL::sendUp(). |
|
|
Definition at line 114 of file ll.h. Referenced by LL::command(), LL::downtarget(), LL::initialized(), SatLL::sendDown(), and LL::sendDown(). |
|
|
Definition at line 57 of file connector.h. Referenced by Connector::command(), Connector::drop(), and ErrorModel::recv(). |
|
|
Definition at line 65 of file delay.h. Referenced by LinkDelay::command(), LinkDelay::pktintran(), and LinkDelay::recv(). |
|
|
Definition at line 105 of file snoop.h. Referenced by snoop_rtt(). |
|
|
Definition at line 108 of file ll.h. Referenced by LL::command(), and LL::ifq(). |
|
|
Definition at line 102 of file snoop.h. Referenced by integrate(), LLSnoop(), and recv(). |
|
|
Definition at line 64 of file delay.h. Referenced by recv(), and LinkDelay::recv(). |
|
|
Definition at line 67 of file delay.h. Referenced by LinkDelay::command(), LinkDelay::handle(), LinkDelay::pktintran(), LinkDelay::recv(), and LinkDelay::reset(). |
|
|
Definition at line 110 of file ll.h. Referenced by LL::command(), and LL::sendDown(). |
|
|
Definition at line 109 of file ll.h. Referenced by SatLL::channel(), LL::command(), LL::initialized(), SatLL::sendDown(), and LL::sendDown(). |
|
|
Definition at line 106 of file ll.h. Referenced by LL::LL(), LL::macDA(), and LL::sendDown(). |
|
|
Definition at line 104 of file snoop.h. Referenced by snoop_rtt(), and timeout(). |
|
|
Definition at line 104 of file ll.h. Referenced by SatLL::sendDown(), LL::sendDown(), and LL::seqno(). |
|
|
Definition at line 106 of file snoop.h. Referenced by timeout(). |
|
|
Definition at line 103 of file snoop.h. Referenced by snoop_rtt(), and timeout(). |
|
|
|
Definition at line 68 of file delay.h. Referenced by LinkDelay::command(), and LinkDelay::pktintran(). |
|
|
Definition at line 115 of file ll.h. Referenced by LL::command(), LL::initialized(), SatLL::recv(), LL::recv(), SatLL::sendUp(), LL::sendUp(), and LL::uptarget(). |
|
|
Definition at line 112 of file ll.h. Referenced by LL::command(), and LL::sendDown(). |
1.3.3