#include <cmu-trace.h>
Inheritance diagram for CMUTrace:


Public Member Functions | |
| CMUTrace (const char *s, char t) | |
| void | recv (Packet *p, Handler *h) |
| void | recv (Packet *p, const char *why) |
| void | recvOnly (Packet *p) |
| virtual void | write_nam_trace (const char *s) |
| void | trace (TracedVar *var) |
| NsObject * | target () |
| virtual void | drop (Packet *p) |
| 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 Member Functions | |
| int | get_seqno (Packet *p) |
Public Attributes | |
| BaseTrace * | pt_ |
| int | type_ |
Protected Member Functions | |
| virtual void | format (int tt, int s, int d, Packet *p) |
| void | annotate (const char *s) |
| void | callback () |
| virtual void | drop (Packet *p, const char *s) |
| void | send (Packet *p, Handler *h) |
| virtual void | reset () |
| void | handle (Event *) |
Protected Attributes | |
| nsaddr_t | src_ |
| nsaddr_t | dst_ |
| int | callback_ |
| int | show_tcphdr_ |
| NsObject * | target_ |
| NsObject * | drop_ |
| int | debug_ |
Private Member Functions | |
| int | initialized () |
| int | node_energy () |
| int | command (int argc, const char *const *argv) |
| void | format (Packet *p, const char *why) |
| void | nam_format (Packet *p, int offset) |
| void | format_mac (Packet *p, const char *why, int offset) |
| void | format_ip (Packet *p, int offset) |
| void | format_arp (Packet *p, int offset) |
| void | format_dsr (Packet *p, int offset) |
| void | format_msg (Packet *p, int offset) |
| void | format_tcp (Packet *p, int offset) |
| void | format_rtp (Packet *p, int offset) |
| void | format_tora (Packet *p, int offset) |
| void | format_imep (Packet *p, int offset) |
| void | format_aodv (Packet *p, int offset) |
Static Private Member Functions | |
| void | calculate_broadcast_parameters () |
Private Attributes | |
| char | tracename [MAX_ID_LEN+1] |
| int | nodeColor [MAX_NODE] |
| int | tracetype |
| MobileNode * | node_ |
| int | newtrace_ |
Static Private Attributes | |
| double | bradius = 0.0 |
| double | radius_scaling_factor_ = 0.0 |
| double | duration_scaling_factor_ = 0.0 |
|
||||||||||||
|
Definition at line 77 of file cmu-trace.cc. References DROP, MAX_ID_LEN, MAX_NODE, newtrace_, node_, nodeColor, RECV, SEND, TR_AGENT, TR_IFQ, TR_MAC, TR_ROUTER, tracename, tracetype, and Trace::type_.
00077 : Trace(t) 00078 { 00079 bzero(tracename, sizeof(tracename)); 00080 strncpy(tracename, s, MAX_ID_LEN); 00081 00082 if(strcmp(tracename, "RTR") == 0) { 00083 tracetype = TR_ROUTER; 00084 } 00085 else if(strcmp(tracename, "TRP") == 0) { 00086 tracetype = TR_ROUTER; 00087 } 00088 else if(strcmp(tracename, "MAC") == 0) { 00089 tracetype = TR_MAC; 00090 } 00091 else if(strcmp(tracename, "IFQ") == 0) { 00092 tracetype = TR_IFQ; 00093 } 00094 else if(strcmp(tracename, "AGT") == 0) { 00095 tracetype = TR_AGENT; 00096 } 00097 else { 00098 fprintf(stderr, "CMU Trace Initialized with invalid type\n"); 00099 exit(1); 00100 } 00101 00102 assert(type_ == DROP || type_ == SEND || type_ == RECV); 00103 00104 newtrace_ = 0; 00105 for (int i=0 ; i < MAX_NODE ; i++) 00106 nodeColor[i] = 3 ; 00107 node_ = 0; 00108 00109 } |
|
|
Definition at line 160 of file trace.cc. References BaseTrace::buffer(), Trace::callback(), Scheduler::clock(), BaseTrace::dump(), Scheduler::instance(), BaseTrace::namdump(), BaseTrace::nbuffer(), Trace::pt_, BaseTrace::round(), BaseTrace::tagged(), and TIME_FORMAT. Referenced by Trace::command().
00161 {
00162 if (pt_->tagged()) {
00163 sprintf(pt_->buffer(),
00164 "v "TIME_FORMAT" -e {sim_annotation %g %s}",
00165 Scheduler::instance().clock(),
00166 Scheduler::instance().clock(), s);
00167 } else {
00168 sprintf(pt_->buffer(),
00169 "v "TIME_FORMAT" eval {set sim_annotation {%s}}",
00170 pt_->round(Scheduler::instance().clock()), s);
00171 }
00172 pt_->dump();
00173 callback();
00174 sprintf(pt_->nbuffer(), "v -t "TIME_FORMAT" -e sim_annotation %g %s",
00175 Scheduler::instance().clock(),
00176 Scheduler::instance().clock(), s);
00177 pt_->namdump();
00178 }
|
Here is the call graph for this function:

|
|
Definition at line 1043 of file cmu-trace.cc. References bradius, duration_scaling_factor_, pow(), and radius_scaling_factor_. Referenced by nam_format().
01043 {
01044 // Calculate the maximum distance at which a packet can be received
01045 // based on the two-ray reflection model using the current default
01046 // values for Phy/WirelessPhy and Antenna/OmniAntenna.
01047
01048 double P_t, P_r, G_t, G_r, h, L;
01049 Tcl& tcl = Tcl::instance();
01050
01051 tcl.evalc("Phy/WirelessPhy set Pt_");
01052 P_t = atof(tcl.result());
01053 tcl.evalc("Phy/WirelessPhy set RXThresh_");
01054 P_r = atof(tcl.result());
01055 tcl.evalc("Phy/WirelessPhy set L_");
01056 L = atof(tcl.result());
01057 tcl.evalc("Antenna/OmniAntenna set Gt_");
01058 G_t = atof(tcl.result());
01059 tcl.evalc("Antenna/OmniAntenna set Gr_");
01060 G_r = atof(tcl.result());
01061 tcl.evalc("Antenna/OmniAntenna set Z_");
01062 h = atof(tcl.result());
01063 bradius = pow(P_t*G_r*G_t*pow(h,4.0)/(P_r*L), 0.25);
01064
01065 // Also get the scaling factors
01066 tcl.evalc("CMUTrace set radius_scaling_factor_");
01067 radius_scaling_factor_ = atof(tcl.result());
01068 tcl.evalc("CMUTrace set duration_scaling_factor_");
01069 duration_scaling_factor_ = atof(tcl.result());
01070 }
|
Here is the call graph for this function:

|
|
Definition at line 401 of file trace.cc. References BaseTrace::buffer(), Trace::callback_, and Trace::pt_. Referenced by Trace::annotate(), DequeTrace::recv(), Trace::recv(), Trace::recvOnly(), and Trace::trace().
|
Here is the call graph for this function:

|
||||||||||||
|
Reimplemented from Trace. Definition at line 953 of file cmu-trace.cc. References Trace::command(), newtrace_, and node_.
00954 {
00955
00956 if(argc == 3) {
00957 if(strcmp(argv[1], "node") == 0) {
00958 node_ = (MobileNode*) TclObject::lookup(argv[2]);
00959 if(node_ == 0)
00960 return TCL_ERROR;
00961 return TCL_OK;
00962 }
00963 if (strcmp(argv[1], "newtrace") == 0) {
00964 newtrace_ = atoi(argv[2]);
00965 return TCL_OK;
00966 }
00967 }
00968 return Trace::command(argc, argv);
00969 }
|
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 }
|
|
||||||||||||||||
|
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 in SatTrace. Definition at line 214 of file trace.cc. References abort(), hdr_flags::access(), hdr_srm::access(), hdr_tcp::access(), hdr_ip::access(), hdr_cmn::access(), hdr_tcp::ackno(), BaseTrace::buffer(), Scheduler::clock(), hdr_flags::cong_action_, hdr_ip::daddr(), hdr_ip::dport(), hdr_flags::ecn_, hdr_flags::ecn_capable_, hdr_flags::ecn_to_echo_, hdr_tcp::flags(), hdr_ip::flowid(), hdr_flags::fs_, Trace::get_seqno(), hdr_tcp::hlen(), Scheduler::instance(), Address::instance(), BaseTrace::namchannel(), p_info::name(), BaseTrace::nbuffer(), NUMFLAGS, packet_info, packet_t, hdr_flags::pri_, Address::print_nodeaddr(), Address::print_portaddr(), Trace::pt_, hdr_cmn::ptype(), BaseTrace::round(), hdr_tcp::sa_length(), hdr_ip::saddr(), sh, Trace::show_tcphdr_, hdr_cmn::size(), hdr_ip::sport(), srm_names, BaseTrace::tagged(), TIME_FORMAT, and hdr_cmn::uid(). Referenced by DequeTrace::recv(), Trace::recv(), TraceIpMac::recv(), TraceIp::recv(), and Trace::recvOnly().
00215 {
00216 hdr_cmn *th = hdr_cmn::access(p);
00217 hdr_ip *iph = hdr_ip::access(p);
00218 hdr_tcp *tcph = hdr_tcp::access(p);
00219 hdr_srm *sh = hdr_srm::access(p);
00220
00221 const char* sname = "null";
00222
00223 packet_t t = th->ptype();
00224 const char* name = packet_info.name(t);
00225
00226 /* SRM-specific */
00227 if (strcmp(name,"SRM") == 0 || strcmp(name,"cbr") == 0 || strcmp(name,"udp") == 0) {
00228 if ( sh->type() < 5 && sh->type() > 0 ) {
00229 sname = srm_names[sh->type()];
00230 }
00231 }
00232
00233 if (name == 0)
00234 abort();
00235
00236 int seqno = get_seqno(p);
00237 /*
00238 * When new flags are added, make sure to change NUMFLAGS
00239 * in trace.h
00240 */
00241 char flags[NUMFLAGS+1];
00242 for (int i = 0; i < NUMFLAGS; i++)
00243 flags[i] = '-';
00244 flags[NUMFLAGS] = 0;
00245
00246 hdr_flags* hf = hdr_flags::access(p);
00247 flags[0] = hf->ecn_ ? 'C' : '-'; // Ecn Echo
00248 flags[1] = hf->pri_ ? 'P' : '-';
00249 flags[2] = '-';
00250 flags[3] = hf->cong_action_ ? 'A' : '-'; // Congestion Action
00251 flags[4] = hf->ecn_to_echo_ ? 'E' : '-'; // Congestion Experienced
00252 flags[5] = hf->fs_ ? 'F' : '-'; // Fast start: see tcp-fs and tcp-int
00253 flags[6] = hf->ecn_capable_ ? 'N' : '-';
00254
00255 #ifdef notdef
00256 flags[1] = (iph->flags() & PF_PRI) ? 'P' : '-';
00257 flags[2] = (iph->flags() & PF_USR1) ? '1' : '-';
00258 flags[3] = (iph->flags() & PF_USR2) ? '2' : '-';
00259 flags[5] = 0;
00260 #endif
00261 char *src_nodeaddr = Address::instance().print_nodeaddr(iph->saddr());
00262 char *src_portaddr = Address::instance().print_portaddr(iph->sport());
00263 char *dst_nodeaddr = Address::instance().print_nodeaddr(iph->daddr());
00264 char *dst_portaddr = Address::instance().print_portaddr(iph->dport());
00265
00266 if (pt_->tagged()) {
00267 sprintf(pt_->buffer(),
00268 "%c "TIME_FORMAT" -s %d -d %d -p %s -e %d -c %d -i %d -a %d -x {%s.%s %s.%s %d %s %s}",
00269 tt,
00270 Scheduler::instance().clock(),
00271 s,
00272 d,
00273 name,
00274 th->size(),
00275 iph->flowid(),
00276 th->uid(),
00277 iph->flowid(),
00278 src_nodeaddr,
00279 src_portaddr,
00280 dst_nodeaddr,
00281 dst_portaddr,
00282 seqno,flags,sname);
00283 } else if (!show_tcphdr_) {
00284 sprintf(pt_->buffer(), "%c "TIME_FORMAT" %d %d %s %d %s %d %s.%s %s.%s %d %d",
00285 tt,
00286 pt_->round(Scheduler::instance().clock()),
00287 s,
00288 d,
00289 name,
00290 th->size(),
00291 flags,
00292 iph->flowid() /* was p->class_ */,
00293 // iph->src() >> (Address::instance().NodeShift_[1]),
00294 // iph->src() & (Address::instance().PortMask_),
00295 // iph->dst() >> (Address::instance().NodeShift_[1]),
00296 // iph->dst() & (Address::instance().PortMask_),
00297 src_nodeaddr,
00298 src_portaddr,
00299 dst_nodeaddr,
00300 dst_portaddr,
00301 seqno,
00302 th->uid() /* was p->uid_ */);
00303 } else {
00304 sprintf(pt_->buffer(),
00305 "%c "TIME_FORMAT" %d %d %s %d %s %d %s.%s %s.%s %d %d %d 0x%x %d %d",
00306 tt,
00307 pt_->round(Scheduler::instance().clock()),
00308 s,
00309 d,
00310 name,
00311 th->size(),
00312 flags,
00313 iph->flowid(), /* was p->class_ */
00314 // iph->src() >> (Address::instance().NodeShift_[1]),
00315 // iph->src() & (Address::instance().PortMask_),
00316 // iph->dst() >> (Address::instance().NodeShift_[1]),
00317 // iph->dst() & (Address::instance().PortMask_),
00318 src_nodeaddr,
00319 src_portaddr,
00320 dst_nodeaddr,
00321 dst_portaddr,
00322 seqno,
00323 th->uid(), /* was p->uid_ */
00324 tcph->ackno(),
00325 tcph->flags(),
00326 tcph->hlen(),
00327 tcph->sa_length());
00328 }
00329 if (pt_->namchannel() != 0)
00330 sprintf(pt_->nbuffer(),
00331 "%c -t "TIME_FORMAT" -s %d -d %d -p %s -e %d -c %d -i %d -a %d -x {%s.%s %s.%s %d %s %s}",
00332 tt,
00333 Scheduler::instance().clock(),
00334 s,
00335 d,
00336 name,
00337 th->size(),
00338 iph->flowid(),
00339 th->uid(),
00340 iph->flowid(),
00341 src_nodeaddr,
00342 src_portaddr,
00343 dst_nodeaddr,
00344 dst_portaddr,
00345 seqno,flags,sname);
00346 delete [] src_nodeaddr;
00347 delete [] src_portaddr;
00348 delete [] dst_nodeaddr;
00349 delete [] dst_portaddr;
00350 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 893 of file cmu-trace.cc. References __PRETTY_FUNCTION__, BaseTrace::buffer(), format_aodv(), format_arp(), format_dsr(), format_imep(), format_ip(), format_mac(), format_msg(), format_rtp(), format_tcp(), format_tora(), HDR_CMN, nam_format(), BaseTrace::namchannel(), p_info::name(), packet_info, Trace::pt_, PT_ACK, PT_AODV, PT_ARP, PT_CBR, PT_DIFF, PT_DSR, PT_GAF, PT_IMEP, PT_MAC, PT_MESSAGE, PT_PING, PT_TCP, PT_TORA, PT_UDP, and hdr_cmn::ptype(). Referenced by recv().
00894 {
00895 hdr_cmn *ch = HDR_CMN(p);
00896 int offset = 0;
00897
00898 /*
00899 * Log the MAC Header
00900 */
00901 format_mac(p, why, offset);
00902
00903 if (pt_->namchannel())
00904 nam_format(p, offset);
00905 offset = strlen(pt_->buffer());
00906 switch(ch->ptype()) {
00907 case PT_MAC:
00908 break;
00909 case PT_ARP:
00910 format_arp(p, offset);
00911 break;
00912 default:
00913 format_ip(p, offset);
00914 offset = strlen(pt_->buffer());
00915 switch(ch->ptype()) {
00916 case PT_AODV:
00917 format_aodv(p, offset);
00918 break;
00919 case PT_TORA:
00920 format_tora(p, offset);
00921 break;
00922 case PT_IMEP:
00923 format_imep(p, offset);
00924 break;
00925 case PT_DSR:
00926 format_dsr(p, offset);
00927 break;
00928 case PT_MESSAGE:
00929 case PT_UDP:
00930 format_msg(p, offset);
00931 break;
00932 case PT_TCP:
00933 case PT_ACK:
00934 format_tcp(p, offset);
00935 break;
00936 case PT_CBR:
00937 format_rtp(p, offset);
00938 break;
00939 case PT_DIFF:
00940 break;
00941 case PT_GAF:
00942 case PT_PING:
00943 break;
00944 default:
00945 fprintf(stderr, "%s - invalid packet type (%s).\n",
00946 __PRETTY_FUNCTION__, packet_info.name(ch->ptype()));
00947 exit(1);
00948 }
00949 }
00950 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 606 of file cmu-trace.cc. References abort(), AODVTYPE_HELLO, AODVTYPE_RERR, AODVTYPE_RREP, AODVTYPE_RREQ, BaseTrace::buffer(), HDR_AODV, HDR_AODV_REPLY, HDR_AODV_REQUEST, newtrace_, Trace::pt_, and BaseTrace::tagged(). Referenced by format().
00607 {
00608 struct hdr_aodv *ah = HDR_AODV(p);
00609 struct hdr_aodv_request *rq = HDR_AODV_REQUEST(p);
00610 struct hdr_aodv_reply *rp = HDR_AODV_REPLY(p);
00611
00612
00613 switch(ah->ah_type) {
00614 case AODVTYPE_RREQ:
00615
00616 if (pt_->tagged()) {
00617 sprintf(pt_->buffer() + offset,
00618 "-aodv:t %x -aodv:h %d -aodv:b %d -aodv:d %d "
00619 "-aodv:ds %d -aodv:s %d -aodv:ss %d "
00620 "-aodv:c REQUEST ",
00621 rq->rq_type,
00622 rq->rq_hop_count,
00623 rq->rq_bcast_id,
00624 rq->rq_dst,
00625 rq->rq_dst_seqno,
00626 rq->rq_src,
00627 rq->rq_src_seqno);
00628 } else if (newtrace_) {
00629
00630 sprintf(pt_->buffer() + offset,
00631 "-P aodv -Pt 0x%x -Ph %d -Pb %d -Pd %d -Pds %d -Ps %d -Pss %d -Pc REQUEST ",
00632 rq->rq_type,
00633 rq->rq_hop_count,
00634 rq->rq_bcast_id,
00635 rq->rq_dst,
00636 rq->rq_dst_seqno,
00637 rq->rq_src,
00638 rq->rq_src_seqno);
00639
00640
00641 } else {
00642
00643 sprintf(pt_->buffer() + offset,
00644 "[0x%x %d %d [%d %d] [%d %d]] (REQUEST)",
00645 rq->rq_type,
00646 rq->rq_hop_count,
00647 rq->rq_bcast_id,
00648 rq->rq_dst,
00649 rq->rq_dst_seqno,
00650 rq->rq_src,
00651 rq->rq_src_seqno);
00652 }
00653 break;
00654
00655 case AODVTYPE_RREP:
00656 case AODVTYPE_HELLO:
00657 case AODVTYPE_RERR:
00658
00659 if (pt_->tagged()) {
00660 sprintf(pt_->buffer() + offset,
00661 "-aodv:t %x -aodv:h %d -aodv:d %d -adov:ds %d "
00662 "-aodv:l %f -aodv:c %s ",
00663 rp->rp_type,
00664 rp->rp_hop_count,
00665 rp->rp_dst,
00666 rp->rp_dst_seqno,
00667 rp->rp_lifetime,
00668 rp->rp_type == AODVTYPE_RREP ? "REPLY" :
00669 (rp->rp_type == AODVTYPE_RERR ? "ERROR" :
00670 "HELLO"));
00671 } else if (newtrace_) {
00672
00673 sprintf(pt_->buffer() + offset,
00674 "-P aodv -Pt 0x%x -Ph %d -Pd %d -Pds %d -Pl %f -Pc %s ",
00675 rp->rp_type,
00676 rp->rp_hop_count,
00677 rp->rp_dst,
00678 rp->rp_dst_seqno,
00679 rp->rp_lifetime,
00680 rp->rp_type == AODVTYPE_RREP ? "REPLY" :
00681 (rp->rp_type == AODVTYPE_RERR ? "ERROR" :
00682 "HELLO"));
00683 } else {
00684
00685 sprintf(pt_->buffer() + offset,
00686 "[0x%x %d [%d %d] %f] (%s)",
00687 rp->rp_type,
00688 rp->rp_hop_count,
00689 rp->rp_dst,
00690 rp->rp_dst_seqno,
00691 rp->rp_lifetime,
00692 rp->rp_type == AODVTYPE_RREP ? "REPLY" :
00693 (rp->rp_type == AODVTYPE_RERR ? "ERROR" :
00694 "HELLO"));
00695 }
00696 break;
00697
00698 default:
00699 #ifdef WIN32
00700 fprintf(stderr,
00701 "CMUTrace::format_aodv: invalid AODV packet type\n");
00702 #else
00703 fprintf(stderr,
00704 "%s: invalid AODV packet type\n", __FUNCTION__);
00705 #endif
00706 abort();
00707 }
00708 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 305 of file cmu-trace.cc. References ARPOP_REQUEST, BaseTrace::buffer(), HDR_ARP, newtrace_, Trace::pt_, and BaseTrace::tagged(). Referenced by format().
00306 {
00307 struct hdr_arp *ah = HDR_ARP(p);
00308
00309 if (pt_->tagged()) {
00310 sprintf(pt_->buffer() + offset,
00311 "-arp:op %s -arp:ms %d -arp:s %d -arp:md %d -arp:d %d ",
00312 ah->arp_op == ARPOP_REQUEST ? "REQUEST" : "REPLY",
00313 ah->arp_sha,
00314 ah->arp_spa,
00315 ah->arp_tha,
00316 ah->arp_tpa);
00317 } else if (newtrace_) {
00318 sprintf(pt_->buffer() + offset,
00319 "-P arp -Po %s -Pms %d -Ps %d -Pmd %d -Pd %d ",
00320 ah->arp_op == ARPOP_REQUEST ? "REQUEST" : "REPLY",
00321 ah->arp_sha,
00322 ah->arp_spa,
00323 ah->arp_tha,
00324 ah->arp_tpa);
00325 } else {
00326
00327 sprintf(pt_->buffer() + offset,
00328 "------- [%s %d/%d %d/%d]",
00329 ah->arp_op == ARPOP_REQUEST ? "REQUEST" : "REPLY",
00330 ah->arp_sha,
00331 ah->arp_spa,
00332 ah->arp_tha,
00333 ah->arp_tpa);
00334 }
00335 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 338 of file cmu-trace.cc. References hdr_sr::access(), sr_addr::addr, BaseTrace::buffer(), hdr_sr::down_links(), newtrace_, hdr_sr::num_addrs(), hdr_sr::num_route_errors(), Trace::pt_, hdr_sr::reply_addrs(), hdr_sr::route_error(), hdr_sr::route_reply(), hdr_sr::route_reply_len(), hdr_sr::route_request(), hdr_sr::rtreq_seq(), and BaseTrace::tagged(). Referenced by format().
00339 {
00340 hdr_sr *srh = hdr_sr::access(p);
00341
00342 if (pt_->tagged()) {
00343 sprintf(pt_->buffer() + offset,
00344 "-dsr:h %d -dsr:q %d -dsr:s %d -dsr:p %d -dsr:n %d "
00345 "-dsr:l %d -dsr:e {%d %d} -dsr:w %d -dsr:m %d -dsr:c %d "
00346 "-dsr:b {%d %d} ",
00347 srh->num_addrs(),
00348 srh->route_request(),
00349 srh->rtreq_seq(),
00350 srh->route_reply(),
00351 srh->rtreq_seq(),
00352 srh->route_reply_len(),
00353 srh->reply_addrs()[0].addr,
00354 srh->reply_addrs()[srh->route_reply_len()-1].addr,
00355 srh->route_error(),
00356 srh->num_route_errors(),
00357 srh->down_links()[srh->num_route_errors() - 1].tell_addr,
00358 srh->down_links()[srh->num_route_errors() - 1].from_addr,
00359 srh->down_links()[srh->num_route_errors() - 1].to_addr);
00360 return;
00361 } else if (newtrace_) {
00362 sprintf(pt_->buffer() + offset,
00363 "-P dsr -Ph %d -Pq %d -Ps %d -Pp %d -Pn %d -Pl %d -Pe %d->%d -Pw %d -Pm %d -Pc %d -Pb %d->%d ",
00364 srh->num_addrs(), // how many nodes travered
00365
00366 srh->route_request(),
00367 srh->rtreq_seq(),
00368
00369 srh->route_reply(),
00370 srh->rtreq_seq(),
00371 srh->route_reply_len(),
00372 // the dest of the src route
00373 srh->reply_addrs()[0].addr,
00374 srh->reply_addrs()[srh->route_reply_len()-1].addr,
00375
00376 srh->route_error(),
00377 srh->num_route_errors(),
00378 srh->down_links()[srh->num_route_errors() - 1].tell_addr,
00379 srh->down_links()[srh->num_route_errors() - 1].from_addr,
00380 srh->down_links()[srh->num_route_errors() - 1].to_addr);
00381
00382 return;
00383 }
00384 sprintf(pt_->buffer() + offset,
00385 "%d [%d %d] [%d %d %d %d->%d] [%d %d %d %d->%d]",
00386 srh->num_addrs(),
00387
00388 srh->route_request(),
00389 srh->rtreq_seq(),
00390
00391 srh->route_reply(),
00392 srh->rtreq_seq(),
00393 srh->route_reply_len(),
00394 // the dest of the src route
00395 srh->reply_addrs()[0].addr,
00396 srh->reply_addrs()[srh->route_reply_len()-1].addr,
00397
00398 srh->route_error(),
00399 srh->num_route_errors(),
00400 srh->down_links()[srh->num_route_errors() - 1].tell_addr,
00401 srh->down_links()[srh->num_route_errors() - 1].from_addr,
00402 srh->down_links()[srh->num_route_errors() - 1].to_addr);
00403 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 482 of file cmu-trace.cc. References BLOCK_FLAG_ACK, BLOCK_FLAG_HELLO, BLOCK_FLAG_OBJECT, BaseTrace::buffer(), HDR_IMEP, newtrace_, Trace::pt_, BaseTrace::tagged(), and U_INT16_T. Referenced by format().
00483 {
00484 struct hdr_imep *im = HDR_IMEP(p);
00485
00486 #define U_INT16_T(x) *((u_int16_t*) &(x))
00487
00488 if (pt_->tagged()) {
00489 sprintf(pt_->buffer() + offset,
00490 "-imep:a %c -imep:h %c -imep:o %c -imep:l %04x ",
00491 (im->imep_block_flags & BLOCK_FLAG_ACK) ? 'A' : '-',
00492 (im->imep_block_flags & BLOCK_FLAG_HELLO) ? 'H' : '-',
00493 (im->imep_block_flags & BLOCK_FLAG_OBJECT) ? 'O' : '-',
00494 U_INT16_T(im->imep_length));
00495 } else if (newtrace_) {
00496 sprintf(pt_->buffer() + offset,
00497 "-P imep -Pa %c -Ph %c -Po %c -Pl 0x%04x ] ",
00498 (im->imep_block_flags & BLOCK_FLAG_ACK) ? 'A' : '-',
00499 (im->imep_block_flags & BLOCK_FLAG_HELLO) ? 'H' : '-',
00500 (im->imep_block_flags & BLOCK_FLAG_OBJECT) ? 'O' : '-',
00501 U_INT16_T(im->imep_length));
00502 } else {
00503 sprintf(pt_->buffer() + offset,
00504 "[%c %c %c 0x%04x] ",
00505 (im->imep_block_flags & BLOCK_FLAG_ACK) ? 'A' : '-',
00506 (im->imep_block_flags & BLOCK_FLAG_HELLO) ? 'H' : '-',
00507 (im->imep_block_flags & BLOCK_FLAG_OBJECT) ? 'O' : '-',
00508 U_INT16_T(im->imep_length));
00509 }
00510 #undef U_INT16_T
00511 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 260 of file cmu-trace.cc. References BaseTrace::buffer(), Address::get_nodeaddr(), HDR_CMN, HDR_IP, Address::instance(), p_info::name(), newtrace_, packet_info, Trace::pt_, and BaseTrace::tagged(). Referenced by format().
00261 {
00262 struct hdr_cmn *ch = HDR_CMN(p);
00263 struct hdr_ip *ih = HDR_IP(p);
00264
00265 // hack the IP address to convert pkt format to hostid format
00266 // for now until port ids are removed from IP address. -Padma.
00267 int src = Address::instance().get_nodeaddr(ih->saddr());
00268 int dst = Address::instance().get_nodeaddr(ih->daddr());
00269
00270 if (pt_->tagged()) {
00271 sprintf(pt_->buffer() + offset,
00272 "-IP:s %d -IP:sp %d -IP:d %d -IP:dp %d -p %s -e %d "
00273 "-c %d -i %d -IP:ttl %d ",
00274 src, // packet src
00275 ih->sport(), // src port
00276 dst, // packet dest
00277 ih->dport(), // dst port
00278 packet_info.name(ch->ptype()), // packet type
00279 ch->size(), // packet size
00280 ih->flowid(), // flow id
00281 ch->uid(), // unique id
00282 ih->ttl_ // ttl
00283 );
00284 } else if (newtrace_) {
00285 sprintf(pt_->buffer() + offset,
00286 "-Is %d.%d -Id %d.%d -It %s -Il %d -If %d -Ii %d -Iv %d ",
00287 src, // packet src
00288 ih->sport(), // src port
00289 dst, // packet dest
00290 ih->dport(), // dst port
00291 packet_info.name(ch->ptype()), // packet type
00292 ch->size(), // packet size
00293 ih->flowid(), // flow id
00294 ch->uid(), // unique id
00295 ih->ttl_); // ttl
00296 } else {
00297 sprintf(pt_->buffer() + offset, "------- [%d:%d %d:%d %d %d] ",
00298 src, ih->sport(),
00299 dst, ih->dport(),
00300 ih->ttl_, (ch->next_hop_ < 0) ? 0 : ch->next_hop_);
00301 }
00302 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 112 of file cmu-trace.cc. References BaseTrace::buffer(), Scheduler::clock(), DROP, EnergyModel::energy(), Node::energy_model(), ETHER_ADDR, FWRD, GET_ETHER_TYPE, Node::get_node_by_address(), Address::get_nodeaddr(), MobileNode::getLoc(), HDR_CMN, HDR_IP, HDR_MAC802_11, Scheduler::instance(), Address::instance(), MAC_Subtype_ACK, MAC_Subtype_CTS, MAC_Subtype_RTS, p_info::name(), newtrace_, node_, Node::nodeid(), packet_info, Trace::pt_, PT_MAC, SEND, Trace::src_, BaseTrace::tagged(), TIME_FORMAT, TR_ROUTER, tracename, tracetype, and Trace::type_. Referenced by format().
00113 {
00114 struct hdr_cmn *ch = HDR_CMN(p);
00115 struct hdr_ip *ih = HDR_IP(p);
00116 struct hdr_mac802_11 *mh = HDR_MAC802_11(p);
00117 double x = 0.0, y = 0.0, z = 0.0;
00118
00119 char op = (char) type_;
00120 Node* thisnode = Node::get_node_by_address(src_);
00121 double energy = -1;
00122 if (thisnode) {
00123 if (thisnode->energy_model()) {
00124 energy = thisnode->energy_model()->energy();
00125 }
00126 }
00127
00128 // hack the IP address to convert pkt format to hostid format
00129 // for now until port ids are removed from IP address. -Padma.
00130
00131 int src = Address::instance().get_nodeaddr(ih->saddr());
00132
00133 if(tracetype == TR_ROUTER && type_ == SEND) {
00134 if(src_ != src)
00135 op = FWRD;
00136 }
00137
00138 // use tagged format if appropriate
00139 if (pt_->tagged()) {
00140 int next_hop = -1 ;
00141 Node* nextnode = Node::get_node_by_address(ch->next_hop_);
00142 if (nextnode) next_hop = nextnode->nodeid();
00143
00144 node_->getLoc(&x, &y, &z);
00145
00146 if (op == DROP) op = 'd';
00147 if (op == SEND) op = '+';
00148 if (op == FWRD) op = 'h';
00149
00150 sprintf(pt_->buffer() + offset,
00151 "%c "TIME_FORMAT" -s %d -d %d -p %s -k %3s -i %d "
00152 "-N:loc {%.2f %.2f %.2f} -N:en %f "
00153 "-M:dur %x -M:s %x -M:d %x -M:t %x ",
00154 op, // event type
00155 Scheduler::instance().clock(), // time
00156 src_, // this node
00157 next_hop, // next hop
00158 packet_info.name(ch->ptype()), // packet type
00159 tracename, // trace level
00160 ch->uid(), // event id
00161 x, y, z, // location
00162 energy, // energy
00163 mh->dh_duration, // MAC: duration
00164 ETHER_ADDR(mh->dh_da), // MAC: source
00165 ETHER_ADDR(mh->dh_sa), // MAC: destination
00166 GET_ETHER_TYPE(mh->dh_body) // MAC: type
00167 );
00168 return;
00169 }
00170
00171
00172 // Use new ns trace format to replace the old cmu trace format)
00173 if (newtrace_) {
00174
00175 node_->getLoc(&x, &y, &z);
00176 // consistence
00177 if ( op == DROP ) { op = 'd';}
00178
00179 // basic trace infomation + basic exenstion
00180
00181 sprintf(pt_->buffer() + offset,
00182 "%c -t %.9f -Hs %d -Hd %d -Ni %d -Nx %.2f -Ny %.2f -Nz %.2f -Ne %f -Nl %3s -Nw %s ",
00183 op, // event type
00184 Scheduler::instance().clock(), // time
00185 src_, // this node
00186 ch->next_hop_, // next hop
00187 src_, // this node
00188 x, // x coordinate
00189 y, // y coordinate
00190 z, // z coordinate
00191 energy, // energy, -1 = not existing
00192 tracename, // trace level
00193 why); // reason
00194
00195 // mac layer extension
00196
00197 offset = strlen(pt_->buffer());
00198
00199 sprintf(pt_->buffer() + offset,
00200 "-Ma %x -Md %x -Ms %x -Mt %x ",
00201 mh->dh_duration,
00202 ETHER_ADDR(mh->dh_da),
00203 ETHER_ADDR(mh->dh_sa),
00204 GET_ETHER_TYPE(mh->dh_body));
00205
00206 return;
00207 }
00208
00209
00210 #ifdef LOG_POSITION
00211 double x = 0.0, y = 0.0, z = 0.0;
00212 node_->getLoc(&x, &y, &z);
00213 #endif
00214
00215 sprintf(pt_->buffer() + offset,
00216 #ifdef LOG_POSITION
00217 "%c %.9f %d (%6.2f %6.2f) %3s %4s %d %s %d [%x %x %x %x] ",
00218 #else
00219 "%c %.9f _%d_ %3s %4s %d %s %d [%x %x %x %x] ",
00220 #endif
00221 op,
00222 Scheduler::instance().clock(),
00223 src_, // this node
00224 #ifdef LOG_POSITION
00225 x,
00226 y,
00227 #endif
00228 tracename,
00229 why,
00230
00231 ch->uid(), // identifier for this event
00232
00233 ((ch->ptype() == PT_MAC) ? (
00234 (mh->dh_fc.fc_subtype == MAC_Subtype_RTS) ? "RTS" :
00235 (mh->dh_fc.fc_subtype == MAC_Subtype_CTS) ? "CTS" :
00236 (mh->dh_fc.fc_subtype == MAC_Subtype_ACK) ? "ACK" :
00237 "UNKN"
00238 ) : packet_info.name(ch->ptype())),
00239
00240 ch->size(),
00241
00242 //*((u_int16_t*) &mh->dh_fc),
00243 mh->dh_duration,
00244 ETHER_ADDR(mh->dh_da),
00245 ETHER_ADDR(mh->dh_sa),
00246 GET_ETHER_TYPE(mh->dh_body));
00247
00248 offset = strlen(pt_->buffer());
00249
00250 if (thisnode) {
00251 if (thisnode->energy_model()) {
00252 sprintf(pt_->buffer() + offset,
00253 "[energy %f] ",
00254 thisnode->energy_model()->energy());
00255 }
00256 }
00257 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 406 of file cmu-trace.cc. Referenced by format().
00407 {
00408 }
|
|
||||||||||||
|
Definition at line 442 of file cmu-trace.cc. References BaseTrace::buffer(), Node::energy_model(), Node::get_node_by_address(), Address::get_nodeaddr(), HDR_CMN, HDR_IP, HDR_RTP, EnergyModel::INROUTE, Address::instance(), newtrace_, EnergyModel::powersavingflag(), Trace::pt_, EnergyModel::set_node_state(), Trace::src_, and BaseTrace::tagged(). Referenced by format().
00443 {
00444 struct hdr_cmn *ch = HDR_CMN(p);
00445 struct hdr_rtp *rh = HDR_RTP(p);
00446 struct hdr_ip *ih = HDR_IP(p);
00447 Node* thisnode = Node::get_node_by_address(src_);
00448
00449 //hacking, needs to change later,
00450 int dst = Address::instance().get_nodeaddr(ih->daddr());
00451
00452 if (dst == src_){
00453 // I just received a cbr data packet
00454 if (thisnode->energy_model() &&
00455 thisnode->energy_model()->powersavingflag()) {
00456 thisnode->energy_model()->set_node_state(EnergyModel::INROUTE);
00457 }
00458 }
00459
00460 if (pt_->tagged()) {
00461 sprintf(pt_->buffer() + offset,
00462 "-cbr:s %d -cbr:f %d -cbr:o %d ",
00463 rh->seqno_,
00464 ch->num_forwards(),
00465 ch->opt_num_forwards());
00466 } else if (newtrace_) {
00467 sprintf(pt_->buffer() + offset,
00468 "-Pn cbr -Pi %d -Pf %d -Po %d ",
00469 rh->seqno_,
00470 ch->num_forwards(),
00471 ch->opt_num_forwards());
00472 } else {
00473 sprintf(pt_->buffer() + offset,
00474 "[%d] %d %d",
00475 rh->seqno_,
00476 ch->num_forwards(),
00477 ch->opt_num_forwards());
00478 }
00479 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 411 of file cmu-trace.cc. References BaseTrace::buffer(), HDR_CMN, HDR_TCP, newtrace_, Trace::pt_, and BaseTrace::tagged(). Referenced by format().
00412 {
00413 struct hdr_cmn *ch = HDR_CMN(p);
00414 struct hdr_tcp *th = HDR_TCP(p);
00415
00416 if (pt_->tagged()) {
00417 sprintf(pt_->buffer() + offset,
00418 "-tcp:s %d -tcp:a %d -tcp:f %d -tcp:o %d ",
00419 th->seqno_,
00420 th->ackno_,
00421 ch->num_forwards(),
00422 ch->opt_num_forwards());
00423 } else if (newtrace_) {
00424 sprintf(pt_->buffer() + offset,
00425 "-Pn tcp -Ps %d -Pa %d -Pf %d -Po %d ",
00426 th->seqno_,
00427 th->ackno_,
00428 ch->num_forwards(),
00429 ch->opt_num_forwards());
00430
00431 } else {
00432 sprintf(pt_->buffer() + offset,
00433 "[%d %d] %d %d",
00434 th->seqno_,
00435 th->ackno_,
00436 ch->num_forwards(),
00437 ch->opt_num_forwards());
00438 }
00439 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 515 of file cmu-trace.cc. References BaseTrace::buffer(), HDR_TORA, HDR_TORA_CLR, HDR_TORA_QRY, HDR_TORA_UPD, newtrace_, Trace::pt_, BaseTrace::tagged(), TORATYPE_CLR, TORATYPE_QRY, and TORATYPE_UPD. Referenced by format().
00516 {
00517 struct hdr_tora *th = HDR_TORA(p);
00518 struct hdr_tora_qry *qh = HDR_TORA_QRY(p);
00519 struct hdr_tora_upd *uh = HDR_TORA_UPD(p);
00520 struct hdr_tora_clr *ch = HDR_TORA_CLR(p);
00521
00522 switch(th->th_type) {
00523
00524 case TORATYPE_QRY:
00525
00526 if (pt_->tagged()) {
00527 sprintf(pt_->buffer() + offset,
00528 "-tora:t %x -tora:d %d -tora:c QUERY",
00529 qh->tq_type, qh->tq_dst);
00530 } else if (newtrace_) {
00531 sprintf(pt_->buffer() + offset,
00532 "-P tora -Pt 0x%x -Pd %d -Pc QUERY ",
00533 qh->tq_type, qh->tq_dst);
00534
00535 } else {
00536
00537 sprintf(pt_->buffer() + offset, "[0x%x %d] (QUERY)",
00538 qh->tq_type, qh->tq_dst);
00539 }
00540 break;
00541
00542 case TORATYPE_UPD:
00543
00544 if (pt_->tagged()) {
00545 sprintf(pt_->buffer() + offset,
00546 "-tora:t %x -tora:d %d -tora:a %f -tora:o %d "
00547 "-tora:r %d -tora:e %d -tora:i %d -tora:c UPDATE",
00548 uh->tu_type,
00549 uh->tu_dst,
00550 uh->tu_tau,
00551 uh->tu_oid,
00552 uh->tu_r,
00553 uh->tu_delta,
00554 uh->tu_id);
00555 } else if (newtrace_) {
00556 sprintf(pt_->buffer() + offset,
00557 "-P tora -Pt 0x%x -Pd %d (%f %d %d %d %d) -Pc UPDATE ",
00558 uh->tu_type,
00559 uh->tu_dst,
00560 uh->tu_tau,
00561 uh->tu_oid,
00562 uh->tu_r,
00563 uh->tu_delta,
00564 uh->tu_id);
00565 } else {
00566 sprintf(pt_->buffer() + offset,
00567 "-Pt 0x%x -Pd %d -Pa %f -Po %d -Pr %d -Pe %d -Pi %d -Pc UPDATE ",
00568 uh->tu_type,
00569 uh->tu_dst,
00570 uh->tu_tau,
00571 uh->tu_oid,
00572 uh->tu_r,
00573 uh->tu_delta,
00574 uh->tu_id);
00575 }
00576 break;
00577
00578 case TORATYPE_CLR:
00579 if (pt_->tagged()) {
00580 sprintf(pt_->buffer() + offset,
00581 "-tora:t %x -tora:d %d -tora:a %f -tora:o %d "
00582 "-tora:c CLEAR ",
00583 ch->tc_type,
00584 ch->tc_dst,
00585 ch->tc_tau,
00586 ch->tc_oid);
00587 } else if (newtrace_) {
00588 sprintf(pt_->buffer() + offset,
00589 "-P tora -Pt 0x%x -Pd %d -Pa %f -Po %d -Pc CLEAR ",
00590 ch->tc_type,
00591 ch->tc_dst,
00592 ch->tc_tau,
00593 ch->tc_oid);
00594 } else {
00595 sprintf(pt_->buffer() + offset, "[0x%x %d %f %d] (CLEAR)",
00596 ch->tc_type,
00597 ch->tc_dst,
00598 ch->tc_tau,
00599 ch->tc_oid);
00600 }
00601 break;
00602 }
00603 }
|
Here is the call graph for this function:

|
|
Definition at line 186 of file trace.cc. References hdr_tfrc::access(), hdr_rap::access(), hdr_rtp::access(), hdr_tcp::access(), hdr_cmn::access(), packet_t, PT_ACK, PT_CBR, PT_EXP, PT_FTP, PT_HTTP, PT_PARETO, PT_RAP_ACK, PT_RAP_DATA, PT_RTP, PT_TCP, PT_TELNET, PT_TFRC, PT_UDP, hdr_cmn::ptype(), hdr_tfrc::seqno, hdr_tcp::seqno(), hdr_rap::seqno(), and hdr_rtp::seqno(). Referenced by Trace::format().
00187 {
00188 hdr_cmn *th = hdr_cmn::access(p);
00189 hdr_tcp *tcph = hdr_tcp::access(p);
00190 hdr_rtp *rh = hdr_rtp::access(p);
00191 hdr_rap *raph = hdr_rap::access(p);
00192 hdr_tfrc *tfrch = hdr_tfrc::access(p);
00193 packet_t t = th->ptype();
00194 int seqno;
00195
00196 /* UDP's now have seqno's too */
00197 if (t == PT_RTP || t == PT_CBR || t == PT_UDP || t == PT_EXP ||
00198 t == PT_PARETO)
00199 seqno = rh->seqno();
00200 else if (t == PT_RAP_DATA || t == PT_RAP_ACK)
00201 seqno = raph->seqno();
00202 else if (t == PT_TCP || t == PT_ACK || t == PT_HTTP || t == PT_FTP ||
00203 t == PT_TELNET)
00204 seqno = tcph->seqno();
00205 else if (t == PT_TFRC)
00206 seqno = tfrch->seqno;
00207 else
00208 seqno = -1;
00209 return seqno;
00210 }
|
Here is the call graph for this function:

|
|
Implements Handler. Reimplemented in LinkDelay, LL, AckRecons, and Snoop. Definition at line 91 of file object.cc. References NsObject::recv().
|
Here is the call graph for this function:

|
|
Definition at line 107 of file cmu-trace.h. References node_. Referenced by recv().
00107 { return node_ && 1; }
|
|
|
Definition at line 61 of file object.h. References NsObject::debug_.
00061 { return debug_; }
|
|
||||||||||||
|
Definition at line 711 of file cmu-trace.cc. References bradius, calculate_broadcast_parameters(), Scheduler::clock(), DATA, duration, duration_scaling_factor_, EnergyModel::energy(), Node::energy_model(), Node::get_node_by_address(), Address::get_nodeaddr(), HDR_CDIFF, HDR_CMN, HDR_IP, EnergyModel::initialenergy(), Scheduler::instance(), Address::instance(), EnergyModel::level1(), EnergyModel::level2(), hdr_cdiff::mess_type, BaseTrace::namdump(), p_info::name(), BaseTrace::nbuffer(), nodeColor, Node::nodeid(), packet_info, MobileNode::propdelay(), Trace::pt_, PT_DIFF, radius_scaling_factor_, RECV, Trace::src_, TR_ROUTER, tracename, tracetype, and Trace::type_. Referenced by format().
00712 {
00713 Node* srcnode = 0 ;
00714 Node* dstnode = 0 ;
00715 Node* nextnode = 0 ;
00716 struct hdr_cmn *ch = HDR_CMN(p);
00717 struct hdr_ip *ih = HDR_IP(p);
00718 char op = (char) type_;
00719 char colors[32];
00720 int next_hop = -1 ;
00721
00722 int dst = Address::instance().get_nodeaddr(ih->daddr());
00723
00724 nextnode = Node::get_node_by_address(ch->next_hop_);
00725 if (nextnode) next_hop = nextnode->nodeid();
00726
00727 srcnode = Node::get_node_by_address(src_);
00728 dstnode = Node::get_node_by_address(ch->next_hop_);
00729
00730 double distance = 0;
00731
00732 if ((srcnode) && (dstnode)) {
00733 MobileNode* tmnode = (MobileNode*)srcnode;
00734 MobileNode* rmnode = (MobileNode*)dstnode;
00735
00736 distance = tmnode->propdelay(rmnode) * 300000000 ;
00737 }
00738
00739 double energy = -1;
00740 double initenergy = -1;
00741
00742 //default value for changing node color with respect to energy depletion
00743 double l1 = 0.5;
00744 double l2 = 0.2;
00745
00746 if (srcnode) {
00747 if (srcnode->energy_model()) {
00748 energy = srcnode->energy_model()->energy();
00749 initenergy = srcnode->energy_model()->initialenergy();
00750 l1 = srcnode->energy_model()->level1();
00751 l2 = srcnode->energy_model()->level2();
00752 }
00753 }
00754
00755 int energyLevel = 0 ;
00756 double energyLeft = (double)(energy/initenergy) ;
00757
00758 if ((energyLeft <= 1 ) && (energyLeft >= l1 )) energyLevel = 3;
00759 if ((energyLeft >= l2 ) && (energyLeft < l1 )) energyLevel = 2;
00760 if ((energyLeft > 0 ) && (energyLeft < l2 )) energyLevel = 1;
00761
00762 if (energyLevel == 0)
00763 strcpy(colors,"-c black -o red");
00764 else if (energyLevel == 1)
00765 strcpy(colors,"-c red -o yellow");
00766 else if (energyLevel == 2)
00767 strcpy(colors,"-c yellow -o green");
00768 else if (energyLevel == 3)
00769 strcpy(colors,"-c green -o black");
00770
00771 // A simple hack for scadds demo (fernandez's visit) -- Chalermek
00772 int pkt_color = 0;
00773 if (ch->ptype()==PT_DIFF) {
00774 hdr_cdiff *dfh= HDR_CDIFF(p);
00775 if (dfh->mess_type != DATA) {
00776 pkt_color = 1;
00777 }
00778 }
00779 // convert to nam format
00780 if (op == 's') op = 'h' ;
00781 if (op == 'D') op = 'd' ;
00782 if (op == 'h') {
00783 sprintf(pt_->nbuffer(),
00784 "+ -t %.9f -s %d -d %d -p %s -e %d -c 2 -a %d -i %d -k %3s ",
00785 Scheduler::instance().clock(),
00786 src_, // this node
00787 next_hop,
00788 packet_info.name(ch->ptype()),
00789 ch->size(),
00790 pkt_color,
00791 ch->uid(),
00792 tracename);
00793
00794 offset = strlen(pt_->nbuffer());
00795 pt_->namdump();
00796 sprintf(pt_->nbuffer() ,
00797 "- -t %.9f -s %d -d %d -p %s -e %d -c 2 -a %d -i %d -k %3s",
00798 Scheduler::instance().clock(),
00799 src_, // this node
00800 next_hop,
00801 packet_info.name(ch->ptype()),
00802 ch->size(),
00803 pkt_color,
00804 ch->uid(),
00805 tracename);
00806
00807 offset = strlen(pt_->nbuffer());
00808 pt_->namdump();
00809 }
00810
00811 // if nodes are too far from each other
00812 // nam won't dump SEND event 'cuz it's
00813 // gonna be dropped later anyway
00814 // this value 250 is pre-calculated by using
00815 // two-ray ground refelction model with fixed
00816 // transmission power 3.652e-10
00817 // if ((type_ == SEND) && (distance > 250 )) return ;
00818
00819 if(tracetype == TR_ROUTER && type_ == RECV && dst != -1 ) return ;
00820 if(type_ == RECV && dst == -1 )dst = src_ ; //broadcasting event
00821
00822 if (energy != -1) { //energy model being turned on
00823 if (nodeColor[src_] != energyLevel ) { //only dump it when node
00824 sprintf(pt_->nbuffer() , //color change
00825 "n -t %.9f -s %d -S COLOR %s",
00826 Scheduler::instance().clock(),
00827 src_, // this node
00828 colors);
00829 offset = strlen(pt_->nbuffer());
00830 pt_->namdump();
00831 nodeColor[src_] = energyLevel ;
00832 }
00833 }
00834
00835
00836 // don't generate an "r" event for a broadcast packet
00837 // as it was already generated when the "h" event was written
00838 if (next_hop == -1 && op == 'r')
00839 return;
00840
00841 sprintf(pt_->nbuffer(),
00842 "%c -t %.9f -s %d -d %d -p %s -e %d -c 2 -a %d -i %d -k %3s",
00843 op,
00844 Scheduler::instance().clock(),
00845 src_, // this node
00846 next_hop,
00847 packet_info.name(ch->ptype()),
00848 ch->size(),
00849 pkt_color,
00850 ch->uid(),
00851 tracename);
00852
00853 if (next_hop == -1 && op == 'h') {
00854 // print extra fields for broadcast packets
00855
00856 // bradius is calculated assuming 2-ray ground reflectlon
00857 // model using default settings of Phy/WirelessPhy and
00858 // Antenna/OmniAntenna
00859 if (bradius == 0.0) calculate_broadcast_parameters();
00860
00861 double radius = bradius*radius_scaling_factor_;
00862
00863 // duration is calculated based on the radius and
00864 // the speed of light (299792458 m/s)
00865 double duration = (bradius/299792458.0)*duration_scaling_factor_;
00866
00867
00868 sprintf(pt_->nbuffer() + strlen(pt_->nbuffer()),
00869 " -R %.2f -D %.2f",
00870 radius,
00871 duration);
00872
00873 // schedule "r" event
00874 Tcl& tcl = Tcl::instance();
00875 tcl.evalf("[Simulator instance] at %f {[Simulator instance] puts-nam-traceall {r -t %.9f -s %d -d %d -p %s -e %d -c 2 -a %d -i %d -k %3s -R %.2f -D %.2f}}",
00876 Scheduler::instance().clock() + duration,
00877 Scheduler::instance().clock() + duration,
00878 src_,
00879 next_hop,
00880 packet_info.name(ch->ptype()),
00881 ch->size(),
00882 pkt_color,
00883 ch->uid(),
00884 tracename,
00885 radius,
00886 duration);
00887 }
00888
00889 offset = strlen(pt_->nbuffer());
00890 pt_->namdump();
00891 }
|
Here is the call graph for this function:

|
|
Definition at line 1030 of file cmu-trace.cc. References EnergyModel::energy(), Node::energy_model(), Node::get_node_by_address(), and Trace::src_. Referenced by recv().
01031 {
01032 Node* thisnode = Node::get_node_by_address(src_);
01033 double energy = 1;
01034 if (thisnode) {
01035 if (thisnode->energy_model()) {
01036 energy = thisnode->energy_model()->energy();
01037 }
01038 }
01039 if (energy > 0) return 1;
01040 return 0;
01041 }
|
Here is the call graph for this function:

|
||||||||||||
|
Reimplemented from NsObject. Definition at line 1007 of file cmu-trace.cc. References DROP, BaseTrace::dump(), format(), Packet::free(), initialized(), God::instance(), node_energy(), Trace::pt_, Trace::src_, God::stampPacket(), and Trace::type_.
01008 {
01009 assert(initialized() && type_ == DROP);
01010 if (!node_energy()) {
01011 Packet::free(p);
01012 return;
01013 }
01014 #if 0
01015 /*
01016 * When the originator of a packet drops the packet, it may or may
01017 * not have been stamped by GOD. Stamp it before logging the
01018 * information.
01019 */
01020 if(src_ == ih->saddr()) {
01021 God::instance()->stampPacket(p);
01022 }
01023 #endif
01024 format(p, why);
01025 pt_->dump();
01026 //namdump();
01027 Packet::free(p);
01028 }
|
Here is the call graph for this function:

|
||||||||||||
|
Reimplemented from Trace. Definition at line 973 of file cmu-trace.cc. References DROP, BaseTrace::dump(), format(), Packet::free(), initialized(), God::instance(), node_energy(), Trace::pt_, Connector::send(), SEND, Trace::src_, God::stampPacket(), Connector::target_, TR_AGENT, tracetype, and Trace::type_.
00974 {
00975 if (!node_energy()) {
00976 Packet::free(p);
00977 return;
00978 }
00979 assert(initialized());
00980 /*
00981 * Agent Trace "stamp" the packet with the optimal route on
00982 * sending.
00983 */
00984 if (tracetype == TR_AGENT && type_ == SEND) {
00985 God::instance()->stampPacket(p);
00986 }
00987 #if 0
00988 /*
00989 * When the originator of a packet drops the packet, it may or may
00990 * not have been stamped by GOD. Stamp it before logging the
00991 * information.
00992 */
00993 if(src_ == src && type_ == DROP) {
00994 God::instance()->stampPacket(p);
00995 }
00996 #endif
00997 format(p, "---");
00998 pt_->dump();
00999 //namdump();
01000 if(target_ == 0)
01001 Packet::free(p);
01002 else
01003 send(p, h);
01004 }
|
Here is the call graph for this function:

|
|
Reimplemented from NsObject. Definition at line 365 of file trace.cc. References Trace::callback(), Trace::dst_, BaseTrace::dump(), Trace::format(), BaseTrace::namdump(), Trace::pt_, NsObject::recvOnly(), Trace::src_, Connector::target_, and Trace::type_.
|
Here is the call graph for this function:

|
|
Reimplemented in BayFullTcpAgent, HashClassifier, IvsSource, dsREDQueue, DiffusionRate, SinkAgent, DiffusionAgent, FloodingAgent, OmniMcastAgent, LinkDelay, CBQueue, DropTail, ErrorModel, PIQueue, Queue< T >, RedPDQueue, REDQueue, REMQueue, RIOQueue, Snoop, FackTcpAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, Sack1TcpAgent, TcpSink, DelAckSink, TcpAgent, VegasTcpAgent, toraAgent, and Queue< T >. Definition at line 70 of file object.cc. Referenced by NsObject::command().
00071 {
00072 }
|
|
||||||||||||
|
Reimplemented in Agent, and LinkDelay. Definition at line 54 of file connector.h. References NsObject::recv(), and Connector::target_. Referenced by SessionTTLChecker::recv(), TTLChecker::recv(), DequeTrace::recv(), Trace::recv(), TraceIpMac::recv(), TraceIp::recv(), SatDequeTrace::recv(), SALink::recv(), SnoopQueueEDrop::recv(), SnoopQueueTagger::recv(), SnoopQueueDrop::recv(), SnoopQueueOut::recv(), SnoopQueueIn::recv(), PktCounter::recv(), NetworkInterface::recv(), MeasureMod::recv(), Filter::recv(), Connector::recv(), recv(), CBQClass::recv(), and AddSR::recv().
|
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 374 of file trace.cc. References BaseTrace::buffer(), Trace::callback(), Scheduler::clock(), BaseTrace::dump(), Scheduler::instance(), Trace::pt_, BaseTrace::round(), BaseTrace::tagged(), TIME_FORMAT, and Trace::type_.
00375 {
00376 char tmp[256] = "";
00377 Scheduler& s = Scheduler::instance();
00378 if (&s == 0)
00379 return;
00380
00381 if (pt_->tagged()) {
00382 sprintf(pt_->buffer(), "%c "TIME_FORMAT" -a %s -n %s -v %s",
00383 type_,
00384 pt_->round(s.clock()),
00385 var->owner()->name(),
00386 var->name(),
00387 var->value(tmp, 256));
00388 } else {
00389 // format: use Mark's nam feature code without the '-' prefix
00390 sprintf(pt_->buffer(), "%c t"TIME_FORMAT" a%s n%s v%s",
00391 type_,
00392 pt_->round(s.clock()),
00393 var->owner()->name(),
00394 var->name(),
00395 var->value(tmp, 256));
00396 }
00397 pt_->dump();
00398 callback();
00399 }
|
Here is the call graph for this function:

|
|
Definition at line 154 of file trace.cc. References BaseTrace::namdump(), BaseTrace::nbuffer(), and Trace::pt_. Referenced by Trace::command().
|
Here is the call graph for this function:

|
|
Definition at line 72 of file cmu-trace.cc. Referenced by calculate_broadcast_parameters(), and nam_format(). |
|
|
Definition at line 59 of file trace.h. Referenced by Trace::callback(), and Trace::Trace(). |
|
|
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 57 of file connector.h. Referenced by Connector::command(), Connector::drop(), and ErrorModel::recv(). |
|
|
Definition at line 58 of file trace.h. Referenced by DequeTrace::recv(), Trace::recv(), SatDequeTrace::recv(), Trace::recvOnly(), Trace::Trace(), and SatTrace::traceonly(). |
|
|
Definition at line 74 of file cmu-trace.cc. Referenced by calculate_broadcast_parameters(), and nam_format(). |
|
|
Definition at line 100 of file cmu-trace.h. Referenced by CMUTrace(), command(), format_aodv(), format_arp(), format_dsr(), format_imep(), format_ip(), format_mac(), format_rtp(), format_tcp(), and format_tora(). |
|
|
Definition at line 99 of file cmu-trace.h. Referenced by CMUTrace(), command(), format_mac(), and initialized(). |
|
|
Definition at line 97 of file cmu-trace.h. Referenced by CMUTrace(), and nam_format(). |
|
|
|
Definition at line 73 of file cmu-trace.cc. Referenced by calculate_broadcast_parameters(), and nam_format(). |
|
|
Definition at line 63 of file trace.h. Referenced by Trace::format(), SatTrace::format(), and Trace::Trace(). |
|
|
Definition at line 57 of file trace.h. Referenced by format_mac(), format_rtp(), nam_format(), node_energy(), DequeTrace::recv(), Trace::recv(), TraceIpMac::recv(), TraceIp::recv(), SatDequeTrace::recv(), recv(), Trace::recvOnly(), Trace::Trace(), and SatTrace::traceonly(). |
|
|
|
Definition at line 96 of file cmu-trace.h. Referenced by CMUTrace(), format_mac(), and nam_format(). |
|
|
Definition at line 98 of file cmu-trace.h. Referenced by CMUTrace(), format_mac(), nam_format(), and recv(). |
|
|
Definition at line 71 of file trace.h. Referenced by CMUTrace(), format_mac(), nam_format(), DequeTrace::recv(), Trace::recv(), TraceIpMac::recv(), TraceIp::recv(), SatDequeTrace::recv(), recv(), Trace::recvOnly(), Trace::trace(), and SatTrace::traceonly(). |
1.3.3