LanRouter Class Reference

#include <lanRouter.h>

Inheritance diagram for LanRouter:

NsObject TclObject Handler Collaboration diagram for LanRouter:

Collaboration graph
[legend]

Detailed Description

Definition at line 59 of file lanRouter.h.

Public Member Functions

virtual void debug (const char *fmt,...)
virtual int delay_bind_dispatch (const char *varName, const char *localName, TclObject *tracer)
virtual void delay_bind_init_all ()
int isdebug () const
 LanRouter ()
virtual int next_hop (Packet *p)
virtual void recv (Packet *p, const char *s)
virtual void recvOnly (Packet *)

Protected Member Functions

int command (int argc, const char *const *argv)
void handle (Event *)
void recv (Packet *, Handler *=0)
virtual void reset ()

Protected Attributes

int debug_
bool enableHrouting_
char lanaddr_ [SMALL_LEN]
RouteLogicroutelogic_
Classifierswitch_


Constructor & Destructor Documentation

LanRouter::LanRouter  )  [inline]
 

Definition at line 61 of file lanRouter.h.

00061 : routelogic_(0), switch_(0), enableHrouting_(false) {};


Member Function Documentation

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

Reimplemented from NsObject.

Definition at line 93 of file lanRouter.cc.

References NsObject::command(), enableHrouting_, lanaddr_, routelogic_, and switch_.

00094 {
00095     // Tcl& tcl = Tcl::instance();
00096     if (argc == 3) {
00097         // cmd lanaddr <addr>
00098         if (strcmp(argv[1], "lanaddr") == 0) {
00099             strcpy(lanaddr_, argv[2]);
00100             return (TCL_OK);
00101         }
00102         // cmd routing hier|flat
00103         if (strcmp(argv[1], "routing") == 0) {
00104             if (strcmp(argv[2], "hier")==0)
00105                 enableHrouting_= true;
00106             else if (strcmp(argv[2], "flat")==0)
00107                 enableHrouting_= false;
00108             else return (TCL_ERROR);
00109             return (TCL_OK);
00110         }
00111         // cmd switch <switch>
00112         if (strcmp(argv[1], "switch") == 0) {
00113             switch_ = (Classifier*) TclObject::lookup(argv[2]);
00114             return (TCL_OK);
00115         }
00116         // cmd routelogic <routelogic>
00117         if (strcmp(argv[1], "routelogic") == 0) {
00118             routelogic_ = (RouteLogic*) TclObject::lookup(argv[2]);
00119             return (TCL_OK);
00120         }
00121     }
00122     return NsObject::command(argc, argv);
00123 }

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 }

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

Reimplemented in BayFullTcpAgent, Agent, MPLSAddressClassifier, LDPAgent, HbAfterRtoSctpAgent, MfrHbAfterRtoSctpAgent, MfrTimestampSctpAgent, MultipleFastRtxSctpAgent, NewRenoSctpAgent, TimestampSctpAgent, SctpAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, VegasTcpAgent, XcpAgent, and XcpSink.

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, HbAfterRtoSctpAgent, MfrHbAfterRtoSctpAgent, MfrTimestampSctpAgent, MultipleFastRtxSctpAgent, NewRenoSctpAgent, TimestampSctpAgent, SctpAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, VegasTcpAgent, XcpAgent, and XcpSink.

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 NsObject::handle Event  )  [protected, virtual, inherited]
 

Implements Handler.

Reimplemented in LinkDelay, LL, AckRecons, and Snoop.

Definition at line 91 of file object.cc.

References NsObject::recv().

00092 {
00093     recv((Packet*)e);
00094 }

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_; }

int LanRouter::next_hop Packet p  )  [virtual]
 

Definition at line 65 of file lanRouter.cc.

References Classifier::classify(), and switch_.

Referenced by LL::sendDown().

00065                                  {
00066     if (switch_ && switch_->classify(p)==1) {
00067         return -1;
00068     }
00069     if (!routelogic_) return -1;
00070 
00071     hdr_ip* iph= hdr_ip::access(p);
00072     char* adst= Address::instance().print_nodeaddr(iph->daddr());
00073     int next_hopIP;
00074 
00075     if (enableHrouting_) {
00076         char* bdst;
00077 
00078         routelogic_->lookup_hier(lanaddr_, adst, next_hopIP);
00079         // hacking: get rid of the last "."
00080         bdst = Address::instance().print_nodeaddr(next_hopIP);
00081 //      bdst[strlen(bdst)-1] = '\0';
00082         Tcl &tcl = Tcl::instance();
00083         tcl.evalf("[Simulator instance] get-node-id-by-addr %s", bdst);
00084         sscanf(tcl.result(), "%d", &next_hopIP);
00085         delete [] bdst;
00086     } else {
00087         routelogic_->lookup_flat(lanaddr_, adst, next_hopIP);
00088     }
00089     delete [] adst;
00090 
00091     return next_hopIP;
00092 }

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 LanRouter::recv Packet ,
Handler = 0
[inline, protected, virtual]
 

Implements NsObject.

Definition at line 65 of file lanRouter.h.

00065 {} //not used

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 NsObject::reset  )  [protected, virtual, inherited]
 

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, Queue< T >, and XcpSink.

Definition at line 70 of file object.cc.

Referenced by NsObject::command().

00071 {
00072 }


Field Documentation

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(), PushbackQueue::enque(), NsObject::isdebug(), NsObject::NsObject(), TfrcAgent::recv(), PushbackQueue::reportDrop(), SctpAgent::Reset(), REDQueue::reset(), DropTail::shrink_queue(), and Delayer::try_send().

bool LanRouter::enableHrouting_ [protected]
 

Definition at line 70 of file lanRouter.h.

Referenced by command().

char LanRouter::lanaddr_[SMALL_LEN] [protected]
 

Definition at line 69 of file lanRouter.h.

Referenced by command().

RouteLogic* LanRouter::routelogic_ [protected]
 

Definition at line 67 of file lanRouter.h.

Referenced by command().

Classifier* LanRouter::switch_ [protected]
 

Definition at line 68 of file lanRouter.h.

Referenced by command(), and next_hop().


The documentation for this class was generated from the following files:
Generated on Tue Mar 6 17:12:04 2007 for ns2 Network Simulator 2.29 by  doxygen 1.4.6