Você está na página 1de 2

C:\Users\wilder\Desktop\aodv\aodv_logs.cc Pgina 1 de 2 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 /* Copyright (c) 1997, 1998 Carnegie Mellon University. Reserved.

14/04/2012 14:02:06 All Rights

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice , this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL , SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

21 22 23 24 25 26 27 The AODV code developed by the CMU/MONARCH group was optimized and tuned by Samir Das and Mahesh Marina, University of Cincinnati. The work was partia lly done in Sun Microsystems. 28 29 */ 30 31 #include <aodv/aodv.h> 32 #include <aodv/aodv_packet.h> 33 #include <ip.h> 34 35 #define CURRENT_TIME Scheduler::instance().clock() 36 37 static const int verbose = 0; 38 39 /* ===================================================================== 40 Logging Functions 41 ===================================================================== */ 42 void 43 AODV::log_link_del(nsaddr_t dst) 44 { 45 static int link_del = 0; 46 47 if(! logtarget || ! verbose) return; 48 49 /* 50 * If "god" thinks that these two nodes are still 51 * reachable then this is an erroneous deletion. 52 */ 53 sprintf(logtarget->pt_->buffer(), 54 "A %.9f _%d_ deleting LL hop to %d (delete %d is %s)", 55 CURRENT_TIME, 56 index, 57 dst, 58 ++link_del, 59 God::instance()->hops(index, dst) != 1 ? "VALID" : "INVALID "); 60 logtarget->pt_->dump();
- 1 -

C:\Users\wilder\Desktop\aodv\aodv_logs.cc Pgina 2 de 2 61 62 63 64 65 66 67 68 69 70 71 72 73 } void AODV::log_link_broke(Packet *p) { static int link_broke = 0; struct hdr_cmn *ch = HDR_CMN(p); if(! logtarget || ! verbose) return;

14/04/2012 14:02:06

sprintf(logtarget->pt_->buffer(), "A %.9f _%d_ LL unable to deliver packet %d to %d (%d) (rea son = %d, ifqlen = %d)", 74 CURRENT_TIME, 75 index, 76 ch->uid_, 77 ch->next_hop_, 78 ++link_broke, 79 ch->xmit_reason_, 80 ifqueue->length()); 81 logtarget->pt_->dump(); 82 } 83 84 void 85 AODV::log_link_kept(nsaddr_t dst) 86 { 87 static int link_kept = 0; 88 89 if(! logtarget || ! verbose) return; 90 91 92 /* 93 * If "god" thinks that these two nodes are now 94 * unreachable, then we are erroneously keeping 95 * a bad route. 96 */ 97 sprintf(logtarget->pt_->buffer(), 98 "A %.9f _%d_ keeping LL hop to %d (keep %d is %s)", 99 CURRENT_TIME, 100 index, 101 dst, 102 ++link_kept, 103 God::instance()->hops(index, dst) == 1 ? "VALID" : "INVALID "); 104 logtarget->pt_->dump(); 105 } 106 107

- 2 -

Você também pode gostar