#include <arp.h>
Inheritance diagram for ARPTable:


Public Member Functions | |
| ARPTable (const char *tclnode, const char *tclmac) | |
| int | command (int argc, const char *const *argv) |
| int | arpresolve (nsaddr_t dst, Packet *p, LL *ll) |
| void | arpinput (Packet *p, LL *ll) |
| ARPEntry * | arplookup (nsaddr_t dst) |
| void | arprequest (nsaddr_t src, nsaddr_t dst, LL *ll) |
| void | Terminate (void) |
| LIST_ENTRY (ARPTable) link_ | |
| void | recv (Packet *p, Handler *) |
| virtual void | recv (Packet *p, const char *s) |
| void | send (Packet *p, Handler *) |
| void | handle (Event *e) |
| 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,...) |
Static Public Attributes | |
| ARPTable_List | athead_ = { 0 } |
Protected Member Functions | |
| void | reset () |
| virtual void | drop (Packet *p, const char *s) |
Protected Attributes | |
| double | bandwidth_ |
| double | delay_ |
| Event | intr_ |
| int | dynamic_ |
| PacketQueue * | itq_ |
| int | total_ [4] |
| NsObject * | target_ |
| NsObject * | drop_ |
| int | debug_ |
Private Member Functions | |
| int | initialized () |
Private Attributes | |
| ARPEntry_List | arphead_ |
| MobileNode * | node_ |
| Mac * | mac_ |
|
||||||||||||
|
Definition at line 100 of file mac/arp.cc. References arphead_, athead_, LIST_INIT, LIST_INSERT_HEAD, mac_, and node_.
00100 : LinkDelay() { 00101 LIST_INIT(&arphead_); 00102 00103 node_ = (MobileNode*) TclObject::lookup(tclnode); 00104 assert(node_); 00105 00106 mac_ = (Mac*) TclObject::lookup(tclmac); 00107 assert(mac_); 00108 LIST_INSERT_HEAD(&athead_, this, link_); 00109 } |
|
||||||||||||
|
Definition at line 253 of file mac/arp.cc. References hdr_cmn::addr_type(), Node::address(), ARP_HDR_LEN, hdr_arp::arp_op, hdr_arp::arp_sha, hdr_arp::arp_spa, hdr_arp::arp_tha, hdr_arp::arp_tpa, arphead_, arplookup(), ARPOP_REPLY, ARPOP_REQUEST, hdr_ip::daddr(), LinkDelay::delay_, hdr_cmn::direction(), hdr_cmn::DOWN, hdr_cmn::error(), ETHERTYPE_ARP, Packet::free(), Address::get_nodeaddr(), HDR_ARP, HDR_CMN, Mac::hdr_dst(), HDR_IP, HDR_LL, HDR_MAC, Mac::hdr_src(), Mac::hdr_type(), ARPEntry::hold_, initialized(), Address::instance(), Scheduler::instance(), ll, LL_DATA, hdr_ll::lltype(), mac_, ARPEntry::macaddr_, hdr_cmn::next_hop(), node_, NS_AF_INET, NS_AF_NONE, nsaddr_t, Scheduler::schedule(), hdr_ll::seqno(), hdr_cmn::size(), and ARPEntry::up_. Referenced by LL::recv().
00254 {
00255 Scheduler& s = Scheduler::instance();
00256 hdr_arp *ah = HDR_ARP(p);
00257 ARPEntry *llinfo;
00258
00259 assert(initialized());
00260
00261 #ifdef DEBUG
00262 fprintf(stderr,
00263 "%d - %s\n\top: %x, sha: %x, tha: %x, spa: %x, tpa: %x\n",
00264 node_->address(), __FUNCTION__, ah->arp_op,
00265 ah->arp_sha, ah->arp_tha, ah->arp_spa, ah->arp_tpa);
00266 #endif
00267
00268 if((llinfo = arplookup(ah->arp_spa)) == 0) {
00269
00270 /*
00271 * Create a new ARP entry
00272 */
00273 llinfo = new ARPEntry(&arphead_, ah->arp_spa);
00274 }
00275 assert(llinfo);
00276
00277 llinfo->macaddr_ = ah->arp_sha;
00278 llinfo->up_ = 1;
00279
00280 /*
00281 * Can we send whatever's being held?
00282 */
00283 if(llinfo->hold_) {
00284 hdr_cmn *ch = HDR_CMN(llinfo->hold_);
00285 char *mh = (char*) HDR_MAC(llinfo->hold_);
00286 hdr_ip *ih = HDR_IP(llinfo->hold_);
00287
00288 // XXXHACK for now:
00289 // Future work: separate port-id from IP address ??
00290 int dst = Address::instance().get_nodeaddr(ih->daddr());
00291
00292 if((ch->addr_type() == NS_AF_NONE &&
00293 dst == ah->arp_spa) ||
00294 (NS_AF_INET == ch->addr_type() &&
00295 ch->next_hop() == ah->arp_spa)) {
00296 #ifdef DEBUG
00297 fprintf(stderr, "\tsending HELD packet.\n");
00298 #endif
00299 mac_->hdr_dst(mh, ah->arp_sha);
00300 s.schedule(ll->downtarget_, llinfo->hold_, delay_);
00301 llinfo->hold_ = 0;
00302 }
00303 else {
00304 fprintf(stderr, "\tfatal ARP error...\n");
00305 exit(1);
00306 }
00307 }
00308
00309 if(ah->arp_op == ARPOP_REQUEST &&
00310 ah->arp_tpa == node_->address()) {
00311
00312 hdr_cmn *ch = HDR_CMN(p);
00313 char *mh = (char*)HDR_MAC(p);
00314 hdr_ll *lh = HDR_LL(p);
00315
00316 ch->size() = ARP_HDR_LEN;
00317 ch->error() = 0;
00318 ch->direction() = hdr_cmn::DOWN; // send this pkt down
00319
00320 mac_->hdr_dst(mh, ah->arp_sha);
00321 mac_->hdr_src(mh, ll->mac_->addr());
00322 mac_->hdr_type(mh, ETHERTYPE_ARP);
00323
00324 lh->seqno() = 0;
00325 lh->lltype() = LL_DATA;
00326
00327 // ah->arp_hrd =
00328 // ah->arp_pro =
00329 // ah->arp_hln =
00330 // ah->arp_pln =
00331
00332 ah->arp_op = ARPOP_REPLY;
00333 ah->arp_tha = ah->arp_sha;
00334 ah->arp_sha = ll->mac_->addr();
00335
00336 nsaddr_t t = ah->arp_spa;
00337 ah->arp_spa = ah->arp_tpa;
00338 ah->arp_tpa = t;
00339
00340 s.schedule(ll->downtarget_, p, delay_);
00341 return;
00342 }
00343 Packet::free(p);
00344 }
|
Here is the call graph for this function:

|
|
Definition at line 202 of file mac/arp.cc. References arphead_, ARPEntry::ipaddr_, and ARPEntry::nextarp(). Referenced by OmniMcastAgent::ArpBufferCheck(), DiffusionAgent::ArpBufferCheck(), arpinput(), arpresolve(), OmniMcastAgent::StickPacketInArpBuffer(), and DiffusionAgent::StickPacketInArpBuffer().
|
Here is the call graph for this function:

|
||||||||||||||||
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 122 of file mac/arp.cc. References Node::address(), ARP_MAX_REQUEST_COUNT, arphead_, arplookup(), arprequest(), ARPEntry::count_, Connector::drop(), DROP_IFQ_ARP_FULL, EADDRNOTAVAIL, HDR_CMN, Mac::hdr_dst(), HDR_MAC, ARPEntry::hold_, initialized(), ll, mac_, ARPEntry::macaddr_, node_, ARPEntry::up_, hdr_cmn::xmit_failure_, hdr_cmn::xmit_failure_data_, and hdr_cmn::xmit_reason_. Referenced by LL::sendDown().
00123 {
00124 ARPEntry *llinfo ;
00125
00126 assert(initialized());
00127 llinfo = arplookup(dst);
00128
00129 #ifdef DEBUG
00130 fprintf(stderr, "%d - %s\n", node_->address(), __FUNCTION__);
00131 #endif
00132
00133 if(llinfo && llinfo->up_) {
00134 mac_->hdr_dst((char*) HDR_MAC(p), llinfo->macaddr_);
00135 return 0;
00136 }
00137
00138 if(llinfo == 0) {
00139 /*
00140 * Create a new ARP entry
00141 */
00142 llinfo = new ARPEntry(&arphead_, dst);
00143 }
00144
00145 if(llinfo->count_ >= ARP_MAX_REQUEST_COUNT) {
00146 /*
00147 * Because there is not necessarily a scheduled event between
00148 * this callback and the point where the callback can return
00149 * to this point in the code, the order of operations is very
00150 * important here so that we don't get into an infinite loop.
00151 * - josh
00152 */
00153 Packet *t = llinfo->hold_;
00154
00155 llinfo->count_ = 0;
00156 llinfo->hold_ = 0;
00157 hdr_cmn* ch;
00158
00159 if(t) {
00160 ch = HDR_CMN(t);
00161
00162 if (ch->xmit_failure_) {
00163 ch->xmit_reason_ = 0;
00164 ch->xmit_failure_(t, ch->xmit_failure_data_);
00165 }
00166 else {
00167 drop(t, DROP_IFQ_ARP_FULL);
00168 }
00169 }
00170
00171 ch = HDR_CMN(p);
00172
00173 if (ch->xmit_failure_) {
00174 ch->xmit_reason_ = 0;
00175 ch->xmit_failure_(p, ch->xmit_failure_data_);
00176 }
00177 else {
00178 drop(p, DROP_IFQ_ARP_FULL);
00179 }
00180
00181 return EADDRNOTAVAIL;
00182 }
00183
00184 llinfo->count_++;
00185 if(llinfo->hold_)
00186 drop(llinfo->hold_, DROP_IFQ_ARP_FULL);
00187 llinfo->hold_ = p;
00188
00189 /*
00190 * We don't have a MAC address for this node. Send an ARP Request.
00191 *
00192 * XXX: Do I need to worry about the case where I keep ARPing
00193 * for the SAME destination.
00194 */
00195 int src = node_->address(); // this host's IP addr
00196 arprequest(src, dst, ll);
00197 return EADDRNOTAVAIL;
00198 }
|
Here is the call graph for this function:

|
|
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. Definition at line 112 of file mac/arp.cc. References LinkDelay::command(), and Terminate().
00113 {
00114 if (argc == 2 && strcasecmp(argv[1], "reset") == 0) {
00115 Terminate();
00116 //FALL-THROUGH to give parents a chance to reset
00117 }
00118 return LinkDelay::command(argc, argv);
00119 }
|
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 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 NsObject. Reimplemented in LL. Definition at line 115 of file delay.cc. References PacketQueue::deque(), LinkDelay::itq_, LinkDelay::send(), and Event::time_.
|
Here is the call graph for this function:

|
|
Definition at line 129 of file arp.h. Referenced by arpinput(), and arpresolve().
|
|
|
Definition at line 61 of file object.h. References NsObject::debug_.
00061 { return debug_; }
|
|
|
|
|
||||||||||||
|
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 Connector. Reimplemented in LL, SatLL, and LLSnoop. Definition at line 81 of file delay.cc. References LinkDelay::delay_, LinkDelay::dynamic_, PacketQueue::enque(), Scheduler::instance(), LinkDelay::intr_, LinkDelay::itq_, Scheduler::schedule(), Connector::target_, Event::time_, and LinkDelay::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:

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

|
|
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 88 of file mac/arp.cc. References arphead_, Connector::drop(), DROP_END_OF_SIMULATION, and ll. Referenced by command().
|
Here is the call graph for this function:

|
|
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 131 of file arp.h. Referenced by arpinput(), arplookup(), arpresolve(), ARPTable(), and Terminate(). |
|
|
Definition at line 85 of file mac/arp.cc. Referenced by ARPTable(). |
|
|
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 arpinput(), arprequest(), LinkDelay::delay(), LinkDelay::LinkDelay(), LinkDelay::recv(), SatLL::sendDown(), LL::sendDown(), SatLL::sendUp(), and LL::sendUp(). |
|
|
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 64 of file delay.h. Referenced by LLSnoop::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 133 of file arp.h. Referenced by arpinput(), arprequest(), arpresolve(), ARPTable(), and initialized(). |
|
|
Definition at line 132 of file arp.h. Referenced by arpinput(), arpresolve(), ARPTable(), and initialized(). |
|
|
|
Definition at line 68 of file delay.h. Referenced by LinkDelay::command(), and LinkDelay::pktintran(). |
1.3.3