#include <satlink.h>
Inheritance diagram for SatMac:


Public Member Functions | |
| SatMac () | |
| void | sendDown (Packet *p) |
| void | sendUp (Packet *p) |
| virtual void | send_timer () |
| virtual void | recv_timer () |
| virtual void | recv (Packet *p, Handler *h) |
| virtual void | recv (Packet *p, const char *s) |
| virtual void | resume (Packet *p=0) |
| virtual void | installTap (Tap *t) |
| double | txtime (int bytes) |
| double | txtime (Packet *p) |
| double | bandwidth () const |
| int | addr () |
| MacState | state () |
| MacState | state (int m) |
| virtual int | hdr_dst (char *hdr, int dst=-2) |
| virtual int | hdr_src (char *hdr, int src=-2) |
| virtual int | hdr_type (char *hdr, u_int16_t type=0) |
| NsObject * | uptarget () |
| NsObject * | downtarget () |
| 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,...) |
Protected Member Functions | |
| int | command (int argc, const char *const *argv) |
| virtual void | sendDown (Packet *p, Handler *h) |
| virtual void | sendUp (Packet *p, Handler *h) |
| virtual int | initialized () |
| virtual void | drop (Packet *p, const char *s) |
| virtual void | reset () |
| void | handle (Event *) |
Protected Attributes | |
| MacSendTimer | send_timer_ |
| MacRecvTimer | recv_timer_ |
| SatTrace * | drop_trace_ |
| int | trace_drops_ |
| SatTrace * | coll_trace_ |
| int | trace_collisions_ |
| int | index_ |
| double | bandwidth_ |
| double | delay_ |
| int | abstract_ |
| Phy * | netif_ |
| Tap * | tap_ |
| LL * | ll_ |
| Channel * | channel_ |
| Handler * | callback_ |
| MacHandlerResume | hRes_ |
| MacHandlerSend | hSend_ |
| Event | intr_ |
| MacState | state_ |
| Packet * | pktRx_ |
| Packet * | pktTx_ |
| NsObject * | uptarget_ |
| NsObject * | downtarget_ |
| NsObject * | drop_ |
| int | debug_ |
|
|
Definition at line 323 of file satlink.cc. References trace_collisions_, and trace_drops_.
00323 : Mac(), send_timer_(this), recv_timer_(this) 00324 { 00325 bind_bool("trace_collisions_", &trace_collisions_); 00326 bind_bool("trace_drops_", &trace_drops_); 00327 } |
|
|
Definition at line 190 of file mac.h. References Mac::index_. Referenced by Mac::command(), MacClassifier::recv(), SatLL::sendDown(), and LL::sendDown().
00190 { return index_; }
|
|
|
Definition at line 188 of file mac.h. References Mac::bandwidth_. Referenced by MultihopMac::pollTxtime().
00188 { return bandwidth_; }
|
|
||||||||||||
|
Reimplemented from Mac. Definition at line 329 of file satlink.cc. References coll_trace_, Mac::command(), and drop_trace_.
00330 {
00331 Tcl& tcl = Tcl::instance();
00332 if(argc == 2) {
00333 }
00334 else if (argc == 3) {
00335 TclObject *obj;
00336 if( (obj = TclObject::lookup(argv[2])) == 0) {
00337 fprintf(stderr, "%s lookup failed\n", argv[1]);
00338 return TCL_ERROR;
00339 }
00340 if (strcmp(argv[1], "channel") == 0) {
00341 //channel_ = (Channel*) obj;
00342 return (TCL_OK);
00343 }
00344 if (strcmp(argv[1], "set_drop_trace") == 0) {
00345 drop_trace_ = (SatTrace *) TclObject::lookup(argv[2]);
00346 if (drop_trace_ == 0) {
00347 tcl.resultf("no such object %s", argv[2]);
00348 return (TCL_ERROR);
00349 }
00350 return (TCL_OK);
00351 }
00352 if (strcmp(argv[1], "set_coll_trace") == 0) {
00353 coll_trace_ = (SatTrace *) TclObject::lookup(argv[2]);
00354 if (coll_trace_ == 0) {
00355 tcl.resultf("no such object %s", argv[2]);
00356 return (TCL_ERROR);
00357 }
00358 return (TCL_OK);
00359 }
00360 }
00361 return Mac::command(argc, argv);
00362 }
|
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 49 of file bi-connector.h. References BiConnector::downtarget_. Referenced by SatLL::channel().
00049 { return downtarget_; }
|
|
||||||||||||
|
Definition at line 144 of file bi-connector.cc. References BiConnector::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:
|
|
Definition at line 135 of file bi-connector.cc. References BiConnector::drop_, Packet::free(), and NsObject::recv(). Referenced by Mac802_3::collision(), Mac802_11::discard(), SMAC::drop_CTS(), SMAC::drop_DATA(), SMAC::drop_RTS(), SMAC::drop_SYNC(), UnslottedAlohaMac::end_of_contention(), MacTdma::recvHandler(), Mac::resume(), MacCsma::resume(), UnslottedAlohaMac::sendUp(), 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:
|
|
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:

|
||||||||||||
|
Reimplemented in Mac802_11, MacTdma, and SMAC. Definition at line 196 of file mac.h. References dh. Referenced by ARPTable::arpinput(), ARPTable::arprequest(), ARPTable::arpresolve(), UnslottedAlohaMac::end_of_contention(), SatLL::sendDown(), LL::sendDown(), UnslottedAlohaMac::sendUp(), sendUp(), and Mac::sendUp().
|
|
||||||||||||
|
Reimplemented in Mac802_11, MacTdma, and SMAC. Definition at line 202 of file mac.h. References dh. Referenced by ARPTable::arpinput(), ARPTable::arprequest(), UnslottedAlohaMac::end_of_contention(), DSRAgent::handleRouteRequest(), SatLL::sendDown(), and LL::sendDown().
|
|
||||||||||||
|
Reimplemented in Mac802_11, MacTdma, and SMAC. Definition at line 208 of file mac.h. References dh. Referenced by ARPTable::arpinput(), ARPTable::arprequest(), SatLL::sendDown(), and LL::sendDown().
|
|
|
Reimplemented in Mac802_11, and SMAC. Definition at line 223 of file mac.h. References BiConnector::downtarget_, Mac::netif_, and BiConnector::uptarget_. Referenced by Mac802_11::initialized(), and Mac802_3::sendDown().
00223 {
00224 return (netif_ && uptarget_ && downtarget_);
00225 }
|
|
|
Definition at line 179 of file mac.h. References Mac::tap_. Referenced by DSRAgent::command().
00179 { tap_ = t; }
|
|
|
Definition at line 61 of file object.h. References NsObject::debug_.
00061 { return debug_; }
|
|
||||||||||||
|
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 BiConnector. Reimplemented in Mac802_11, Mac802_3, MultihopMac, MacTdma, and SMAC. Definition at line 131 of file mac.cc. References hdr_cmn::access(), Mac::callback_, hdr_cmn::direction(), HDR_MAC, Mac::index_, MAC_SEND, MF_DATA, Mac::sendDown(), Mac::sendUp(), hdr_mac::set(), Mac::state(), and hdr_cmn::UP. Referenced by MacClassifier::recv().
00132 {
00133 if (hdr_cmn::access(p)->direction() == hdr_cmn::UP) {
00134 sendUp(p);
00135 return;
00136 }
00137
00138 callback_ = h;
00139 hdr_mac* mh = HDR_MAC(p);
00140 mh->set(MF_DATA, index_);
00141 state(MAC_SEND);
00142 sendDown(p);
00143 }
|
Here is the call graph for this function:

|
|
Reimplemented in UnslottedAlohaMac. Definition at line 114 of file satlink.h. Referenced by MacRecvTimer::expire().
00114 {}
|
|
|
Reimplemented in Agent, and Trace. Definition at line 56 of file object.h. Referenced by Trace::recvOnly().
00056 {};
|
|
|
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 MacCsma. Definition at line 173 of file mac.cc. References Mac::callback_, BiConnector::drop(), Handler::handle(), Mac::intr_, MAC_IDLE, and Mac::state(). Referenced by UnslottedAlohaMac::backoff(), UnslottedAlohaMac::end_of_contention(), and MacHandlerResume::handle().
|
Here is the call graph for this function:

|
|
Reimplemented in UnslottedAlohaMac. Definition at line 113 of file satlink.h. Referenced by MacSendTimer::expire().
00113 {}
|
|
||||||||||||
|
Reimplemented in Mac802_3. Definition at line 55 of file bi-connector.h. References BiConnector::downtarget_, and NsObject::recv(). Referenced by BiConnector::recv().
00056 { downtarget_->recv(p, h); }
|
Here is the call graph for this function:
|
|
Reimplemented from Mac. Reimplemented in UnslottedAlohaMac. Definition at line 380 of file satlink.cc. References Mac::bandwidth_, BiConnector::downtarget_, HDR_CMN, HDR_MAC, Mac::hRes_, Scheduler::instance(), Mac::intr_, LINK_HDRSIZE, NsObject::recv(), Scheduler::schedule(), and Mac::txtime().
00381 {
00382 Scheduler& s = Scheduler::instance();
00383 double txt;
00384 // LINK_HDRSIZE is defined in satlink.h. This is the size of header
00385 // information for all layers below IP. Alternatively, one could
00386 // derive this information dynamically from packet headers.
00387 int packetsize_ = HDR_CMN(p)->size() + LINK_HDRSIZE;
00388 if (bandwidth_ != 0)
00389 txt = txtime(packetsize_);
00390 // For convenience, we encode the transmit time in the Mac header
00391 // The packet will be held (for collision detection) for txtime
00392 // at the receiving mac.
00393 HDR_MAC(p)->txtime() = txt;
00394 downtarget_->recv(p, this);
00395 // Callback for when this packet's transmission will be done
00396 s.schedule(&hRes_, &intr_, txt);
00397 }
|
Here is the call graph for this function:

|
||||||||||||
|
Reimplemented in Mac802_3. Definition at line 57 of file bi-connector.h. References NsObject::recv(), and BiConnector::uptarget_. Referenced by BiConnector::recv().
|
Here is the call graph for this function:
|
|
Reimplemented from Mac. Reimplemented in UnslottedAlohaMac. Definition at line 364 of file satlink.cc. References Mac::delay_, BiConnector::drop(), Mac::hdr_dst(), HDR_MAC, Mac::index_, Scheduler::instance(), MAC_BROADCAST, Scheduler::schedule(), hdr_mac::txtime(), u_int32_t, and BiConnector::uptarget_.
00365 {
00366 hdr_mac* mh = HDR_MAC(p);
00367 int dst = this->hdr_dst((char*)mh); // mac destination address
00368
00369 if (((u_int32_t)dst != MAC_BROADCAST) && (dst != index_)) {
00370 drop(p);
00371 return;
00372 }
00373 // First bit of packet has arrived-- wait for
00374 // (txtime + delay_) before sending up
00375 Scheduler::instance().schedule(uptarget_, p, delay_ + mh->txtime());
00376 }
|
Here is the call graph for this function:

|
|
Definition at line 192 of file mac.h. References MacState, and Mac::state_.
|
|
|
Definition at line 191 of file mac.h. References MacState, and Mac::state_. Referenced by Mac::recv(), MacTdma::recv(), Mac::resume(), MacCsma::resume(), and Mac::sendUp().
00191 { return state_; }
|
|
|
Reimplemented in Mac802_11, and SMAC. Definition at line 184 of file mac.h. References Mac::bandwidth_, HDR_CMN, and MAC_HDR_LEN.
00184 {
00185 return 8. * (MAC_HDR_LEN + \
00186 (HDR_CMN(p))->size()) / bandwidth_;
00187 }
|
|
|
Reimplemented in Mac802_11. Definition at line 181 of file mac.h. References Mac::bandwidth_. Referenced by MacCsma::endofContention(), MultihopMac::send(), UnslottedAlohaMac::sendDown(), sendDown(), Mac::sendDown(), and Mac802_3::transmit().
00181 {
00182 return (8. * bytes / bandwidth_);
00183 }
|
|
|
Definition at line 48 of file bi-connector.h. References BiConnector::uptarget_. Referenced by SatChannel::find_peer_mac_addr().
00048 { return uptarget_; }
|
|
|
Definition at line 229 of file mac.h. Referenced by Mac::Mac(), Mac::sendDown(), and Mac::sendUp(). |
|
|
Definition at line 227 of file mac.h. Referenced by Mac::bandwidth(), Mac::Mac(), Mac802_11::Mac802_11(), UnslottedAlohaMac::sendDown(), sendDown(), and Mac::txtime(). |
|
|
Definition at line 236 of file mac.h. Referenced by MacTdma::dump(), Mac802_11::dump(), UnslottedAlohaMac::end_of_contention(), Mac::recv(), MacTdma::recv(), MultihopMac::recv(), Mac::resume(), MacCsma::resume(), Mac802_3::resume(), MultihopMac::send(), Mac802_11::send(), Mac802_3::sendDown(), MacTdma::sendHandler(), SMAC::sendMsg(), Mac802_3::transmit(), Mac802_11::tx_resume(), and SMAC::txMsgDone(). |
|
|
Definition at line 234 of file mac.h. Referenced by MacCsma::backoff(), Mac::command(), MacCsmaCd::endofContention(), MacCsma::endofContention(), MultihopMac::send(), MacCsmaCa::send(), and MacCsma::send(). |
|
|
Definition at line 122 of file satlink.h. Referenced by command(), and UnslottedAlohaMac::sendUp(). |
|
|
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 228 of file mac.h. Referenced by UnslottedAlohaMac::end_of_contention(), Mac::Mac(), MultihopMac::recv(), sendUp(), and Mac::sendUp(). |
|
|
Definition at line 63 of file bi-connector.h. Referenced by Phy::command(), BiConnector::command(), BiConnector::downtarget(), WirelessPhy::initialized(), WiredPhy::initialized(), SMAC::initialized(), Mac::initialized(), FECModel::recv(), MacTdma::send(), UnslottedAlohaMac::sendDown(), sendDown(), Mac::sendDown(), BiConnector::sendDown(), SMAC::transmit(), and Mac802_3::transmit(). |
|
|
Definition at line 64 of file bi-connector.h. Referenced by BiConnector::command(), and BiConnector::drop(). |
|
|
Definition at line 120 of file satlink.h. Referenced by UnslottedAlohaMac::backoff(), and command(). |
|
|
Definition at line 237 of file mac.h. Referenced by MacCsma::endofContention(), sendDown(), and Mac::sendDown(). |
|
|
Definition at line 238 of file mac.h. Referenced by MacCsmaCd::endofContention(), MacCsmaCa::send(), and MacCsma::send(). |
|
|
|
Definition at line 239 of file mac.h. Referenced by MacTdma::MacTdma(), Mac::resume(), MacCsma::resume(), MultihopMac::send(), sendDown(), and Mac::sendDown(). |
|
|
|
|
|
Definition at line 231 of file mac.h. Referenced by Mac802_3::collision(), Mac::command(), Mac8023HandlerSend::handle(), SMAC::initialized(), Mac::initialized(), MacTdma::radioSwitch(), Mac802_3::recv_complete(), Mac802_11::recv_timer(), MacHandlerRetx::schedule(), Mac802_11::send(), Mac802_3::sendDown(), Mac802_3::sendUp(), and Mac802_3::transmit(). |
|
|
Reimplemented in SMAC. Definition at line 245 of file mac.h. Referenced by Mac802_11::collision(), MacTdma::dump(), Mac802_11::dump(), Mac802_11::recv(), Mac802_11::recv_timer(), MacTdma::recvHandler(), Mac802_11::rx_resume(), and MacTdma::sendUp(). |
|
|
Reimplemented in SMAC. Definition at line 246 of file mac.h. Referenced by Mac802_11::check_pktTx(), Mac802_11::deferHandler(), MacTdma::dump(), Mac802_11::dump(), MacTdma::makePreamble(), Mac802_11::recvACK(), Mac802_11::recvCTS(), Mac802_11::RetransmitDATA(), Mac802_11::RetransmitRTS(), MacTdma::send(), Mac802_11::sendDATA(), MacTdma::sendDown(), Mac802_11::sendRTS(), and Mac802_11::tx_resume(). |
|
|
Definition at line 119 of file satlink.h. Referenced by UnslottedAlohaMac::sendUp(). |
|
|
Definition at line 118 of file satlink.h. Referenced by UnslottedAlohaMac::backoff(), UnslottedAlohaMac::end_of_contention(), and UnslottedAlohaMac::sendDown(). |
|
|
Reimplemented in SMAC. Definition at line 244 of file mac.h. Referenced by Mac802_3::collision(), Mac802_3::resume(), Mac802_3::sendUp(), Mac::state(), and Mac802_3::transmit(). |
|
|
Definition at line 232 of file mac.h. Referenced by Mac::installTap(), and Mac802_11::recv_timer(). |
|
|
Definition at line 123 of file satlink.h. Referenced by SatMac(), and UnslottedAlohaMac::sendUp(). |
|
|
Definition at line 121 of file satlink.h. Referenced by UnslottedAlohaMac::backoff(), and SatMac(). |
|
1.3.3