BiConnector Class Reference

#include <bi-connector.h>

Inheritance diagram for BiConnector:

NsObject TclObject Handler FECModel God Mac Phy Mac802_11 Mac802_15_4 Mac802_3 MacCsma MacSimple MacTdma MultihopMac SatMac SMAC RepeaterPhy SatPhy WiredPhy WirelessPhy Collaboration diagram for BiConnector:

Collaboration graph
[legend]

Detailed Description

Definition at line 45 of file bi-connector.h.

Public Member Functions

 BiConnector ()
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 ()
NsObjectdowntarget ()
virtual void drop (Packet *p)
int isdebug () const
virtual void recv (Packet *p, const char *s)
virtual void recvOnly (Packet *)
NsObjectuptarget ()

Protected Member Functions

int command (int argc, const char *const *argv)
virtual void drop (Packet *p, const char *s)
void handle (Event *)
void recv (Packet *, Handler *callback=0)
virtual void reset ()
virtual void sendDown (Packet *p, Handler *h)
virtual void sendUp (Packet *p, Handler *h)

Protected Attributes

int debug_
NsObjectdowntarget_
NsObjectdrop_
NsObjectuptarget_


Constructor & Destructor Documentation

BiConnector::BiConnector  ) 
 

Definition at line 47 of file bi-connector.cc.

00047                          : uptarget_(0), downtarget_(0), drop_(0)
00048 {}


Member Function Documentation

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

Reimplemented from NsObject.

Reimplemented in Mac802_11, MacSimple, MacTdma, Mac, Phy, SMAC, WiredPhy, WirelessPhy, God, FECModel, SatMac, SatPhy, and Mac802_15_4.

Definition at line 51 of file bi-connector.cc.

References NsObject::command(), downtarget_, drop_, and uptarget_.

Referenced by Phy::command(), Mac::command(), God::command(), and FECModel::command().

00052 {
00053     Tcl& tcl = Tcl::instance();
00054     /*XXX*/
00055     if (argc == 2) {
00056         if (strcmp(argv[1], "up-target") == 0) {
00057             if (uptarget_ != 0)
00058                 tcl.result(uptarget_->name());
00059             return (TCL_OK);
00060         }
00061         if (strcmp(argv[1], "down-target") == 0) {
00062             if (downtarget_ != 0)
00063                 tcl.result(downtarget_->name());
00064             return (TCL_OK);
00065         }
00066         if (strcmp(argv[1], "drop-target") == 0) {
00067             if (drop_ != 0)
00068                 tcl.resultf("%s", drop_->name());
00069             return (TCL_OK);
00070         }
00071         if (strcmp(argv[1], "isDynamic") == 0) {
00072             return TCL_OK;
00073         }
00074     }
00075 
00076     else if (argc == 3) {
00077         TclObject *obj;
00078         
00079         if( (obj = TclObject::lookup(argv[2])) == 0) {
00080             fprintf(stderr, "%s lookup failed\n", argv[1]);
00081             return TCL_ERROR;
00082         }
00083         if (strcmp(argv[1], "up-target") == 0) {
00084             if (*argv[2] == '0') {
00085                 uptarget_ = 0;
00086                 return (TCL_OK);
00087             }
00088             uptarget_ = (NsObject*) obj;
00089             if (uptarget_ == 0) {
00090                 tcl.resultf("no such object %s", argv[2]);
00091                 return (TCL_ERROR);
00092             }
00093             return (TCL_OK);
00094         }
00095         if (strcmp(argv[1], "down-target") == 0) {
00096             if (*argv[2] == '0') {
00097                 downtarget_ = 0;
00098                 return (TCL_OK);
00099             }
00100             downtarget_ = (NsObject*) obj;
00101             if (downtarget_ == 0) {
00102                 tcl.resultf("no such object %s", argv[2]);
00103                 return (TCL_ERROR);
00104             }
00105             return (TCL_OK);
00106         }
00107         if (strcmp(argv[1], "drop-target") == 0) {
00108             drop_ = (NsObject*) obj;
00109             if (drop_ == 0) {
00110                 tcl.resultf("no object %s", argv[2]);
00111                 return (TCL_ERROR);
00112             }
00113             return (TCL_OK);
00114         }
00115     }
00116     return (NsObject::command(argc, argv));
00117 }

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 }

NsObject* BiConnector::downtarget  )  [inline]
 

Definition at line 49 of file bi-connector.h.

References downtarget_.

Referenced by SatLL::channel().

00049 { return downtarget_; }

void BiConnector::drop Packet p,
const char *  s
[protected, virtual]
 

Definition at line 144 of file bi-connector.cc.

References drop_, Packet::free(), and NsObject::recv().

00145 {
00146     if (drop_ != 0)
00147         drop_->recv(p, s);
00148     else
00149         Packet::free(p);
00150 }

Here is the call graph for this function:

void BiConnector::drop Packet p  )  [virtual]
 

Definition at line 135 of file bi-connector.cc.

References drop_, Packet::free(), and NsObject::recv().

Referenced by Mac802_3::collision(), SMAC::drop_CTS(), SMAC::drop_DATA(), SMAC::drop_RTS(), SMAC::drop_SYNC(), UnslottedAlohaMac::end_of_contention(), Mac802_15_4::recv(), MacTdma::recvHandler(), MacSimple::recvHandler(), Phy802_15_4::recvOverHandler(), Mac::resume(), MacCsma::resume(), UnslottedAlohaMac::sendUp(), SatMac::sendUp(), Mac::sendUp(), MacTdma::TX_Time(), and Mac802_11::txtime().

00136 {
00137     if (drop_ != 0)
00138         drop_->recv(p);
00139     else
00140         Packet::free(p);
00141 }

Here is the call graph for this function:

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

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

Implements NsObject.

Reimplemented in Mac802_11, Mac802_3, MultihopMac, MacSimple, MacTdma, Mac, Phy, SMAC, God, FECModel, RepeaterPhy, Mac802_15_4, and Phy802_15_4.

Definition at line 119 of file bi-connector.cc.

References hdr_cmn::direction(), hdr_cmn::DOWN, HDR_CMN, sendDown(), sendUp(), and hdr_cmn::UP.

Referenced by Mac802_3::recv().

00120 {
00121     hdr_cmn *ch = HDR_CMN(p);
00122     switch (ch->direction()) {
00123     case hdr_cmn::UP :
00124         sendUp(p, h);
00125         break;
00126     case hdr_cmn::DOWN :
00127         sendDown(p, h);
00128         break;
00129     default:
00130         printf("Error: Packet Direction not specified; Using default 'UP' direction\n\n");
00131         sendUp(p, h);
00132     }
00133 }

Here is the call graph for this function:

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 }

virtual void BiConnector::sendDown Packet p,
Handler h
[inline, protected, virtual]
 

Reimplemented in Mac802_3, and Mac802_15_4.

Definition at line 55 of file bi-connector.h.

References downtarget_, and NsObject::recv().

Referenced by recv().

00056         { downtarget_->recv(p, h); }

Here is the call graph for this function:

virtual void BiConnector::sendUp Packet p,
Handler h
[inline, protected, virtual]
 

Reimplemented in Mac802_3.

Definition at line 57 of file bi-connector.h.

References NsObject::recv(), and uptarget_.

Referenced by recv().

00058         { uptarget_->recv(p, h); }

Here is the call graph for this function:

NsObject* BiConnector::uptarget  )  [inline]
 

Definition at line 48 of file bi-connector.h.

References uptarget_.

00048 { return uptarget_; }


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().

NsObject* BiConnector::downtarget_ [protected]
 

Definition at line 63 of file bi-connector.h.

Referenced by Phy::command(), command(), downtarget(), WirelessPhy::initialized(), WiredPhy::initialized(), Mac::initialized(), FECModel::recv(), MacTdma::send(), UnslottedAlohaMac::sendDown(), SatMac::sendDown(), Mac::sendDown(), sendDown(), SMAC::transmit(), Mac802_11::transmit(), and MacSimple::waitHandler().

NsObject* BiConnector::drop_ [protected]
 

Definition at line 64 of file bi-connector.h.

Referenced by command(), and drop().

NsObject* BiConnector::uptarget_ [protected]
 

Definition at line 60 of file bi-connector.h.

Referenced by command(), Phy::dump(), UnslottedAlohaMac::end_of_contention(), WirelessPhy::initialized(), WiredPhy::initialized(), Mac::initialized(), God::initialized(), Mac802_15_4::MCPS_DATA_indication(), Phy802_15_4::PD_DATA_indication(), RepeaterPhy::recv(), Phy::recv(), MacTdma::recvDATA(), SMAC::rxMsgDone(), SatMac::sendUp(), Mac::sendUp(), sendUp(), and uptarget().


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