Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

SMAC Class Reference

#include <smac.h>

Inheritance diagram for SMAC:

Inheritance graph
[legend]
Collaboration diagram for SMAC:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SMAC (void)
 ~SMAC ()
void recv (Packet *p, Handler *h)
virtual void recv (Packet *p, const char *s)
virtual void sendDown (Packet *p)
virtual void sendUp (Packet *p)
virtual void resume (Packet *p=0)
virtual void installTap (Tap *t)
double txtime (int bytes)
double bandwidth () const
int addr ()
MacState state ()
MacState state (int m)
NsObjectuptarget ()
NsObjectdowntarget ()
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

void handleGeneTimer ()
void handleRecvTimer ()
void handleSendTimer ()
void handleNavTimer ()
void handleNeighNavTimer ()
void handleCsTimer ()
void handleCounterTimer (int i)
int command (int argc, const char *const *argv)
virtual int initialized ()
virtual void sendDown (Packet *p, Handler *h)
virtual void sendUp (Packet *p, Handler *h)
virtual void drop (Packet *p, const char *s)
virtual void reset ()
void handle (Event *)

Protected Attributes

double slotTime_
double slotTime_sec_
double difs_
double sifs_
double eifs_
double guardTime_
double byte_tx_time_
int index_
double bandwidth_
double delay_
int abstract_
Phynetif_
Taptap_
LLll_
Channelchannel_
Handlercallback_
MacHandlerResume hRes_
MacHandlerSend hSend_
Event intr_
NsObjectuptarget_
NsObjectdowntarget_
NsObjectdrop_
int debug_

Private Member Functions

void setMySched (Packet *syncpkt)
void sleep ()
void wakeup ()
void rxMsgDone (Packet *p)
void handleRTS (Packet *p)
void handleCTS (Packet *p)
void handleDATA (Packet *p)
void handleACK (Packet *p)
void handleSYNC (Packet *p)
int checkToSend ()
bool chkRadio ()
void transmit (Packet *p)
bool sendMsg (Packet *p, Handler *h)
bool bcastMsg (Packet *p)
bool unicastMsg (int n, Packet *p)
void txMsgDone ()
int startBcast ()
int startUcast ()
bool sendRTS ()
bool sendCTS (double duration)
bool sendDATA ()
bool sendACK (double duration)
bool sendSYNC ()
void sentRTS (Packet *p)
void sentCTS (Packet *p)
void sentDATA (Packet *p)
void sentACK (Packet *p)
void sentSYNC (Packet *p)
void collision (Packet *p)
void capture (Packet *p)
double txtime (Packet *p)
void updateNav (double duration)
void updateNeighNav (double duration)
void mac_log (Packet *p)
void discard (Packet *p, const char *why)
int drop_RTS (Packet *p, const char *why)
int drop_CTS (Packet *p, const char *why)
int drop_DATA (Packet *p, const char *why)
int drop_SYNC (Packet *p, const char *why)
int hdr_dst (char *hdr, int dst=-2)
int hdr_src (char *hdr, int src=-2)
int hdr_type (char *hdr, u_int16_t type=0)

Private Attributes

NsObjectlogtarget_
int state_
int radioState_
int tx_active_
int mac_collision_
int sendAddr_
int recvAddr_
double nav_
double neighNav_
SmacNavTimer mhNav_
SmacNeighNavTimer mhNeighNav_
SmacSendTimer mhSend_
SmacRecvTimer mhRecv_
SmacGeneTimer mhGene_
SmacCsTimer mhCS_
SmacCounterTimermhCounter_ [SMAC_MAX_NUM_SCHEDULES]
int numRetry_
int numExtend_
int lastRxFrag_
int howToSend_
double durSyncPkt_
double durDataPkt_
double durCtrlPkt_
double timeWaitCtrl_
SchedTable schedTab_ [SMAC_MAX_NUM_SCHEDULES]
NeighbList neighbList_ [SMAC_MAX_NUM_NEIGHBORS]
int mySyncNode_
int currSched_
int numSched_
int numNeighb_
int numBcast_
PacketdataPkt_
PacketpktRx_
PacketpktTx_
int txData_
int syncFlag_
int syncTime_
int dataTime_
int listenTime_
int sleepTime_
int cycleTime_

Friends

class SmacGeneTimer
class SmacRecvTimer
class SmacSendTimer
class SmacNavTimer
class SmacNeighNavTimer
class SmacCsTimer
class SmacCounterTimer

Constructor & Destructor Documentation

SMAC::SMAC void   ) 
 

Definition at line 176 of file smac.cc.

References BANDWIDTH, byte_tx_time_, CLKTICK2SEC, CLOCKRES, SmacCounterTimer::cycleTime_, cycleTime_, DATA_CW, dataPkt_, SmacCounterTimer::dataTime_, dataTime_, difs_, durCtrlPkt_, durDataPkt_, durSyncPkt_, eifs_, ENCODE_RATIO, guardTime_, IDLE, lastRxFrag_, SmacCounterTimer::listenTime_, listenTime_, mac_collision_, mhCounter_, mhGene_, nav_, neighNav_, numExtend_, numNeighb_, numRetry_, numSched_, pktRx_, pktTx_, PRE_PKT_BYTES, PROC_DELAY, RADIO_IDLE, radioState_, recvAddr_, TimerHandler::sched(), SEC2CLKTICK, sendAddr_, sifs_, SIZEOF_SMAC_CTRLPKT, SIZEOF_SMAC_DATAPKT, SIZEOF_SMAC_SYNCPKT, SmacCounterTimer::sleepTime_, sleepTime_, slotTime_, slotTime_sec_, SMAC_DUTY_CYCLE, SMAC_MAX_NUM_SCHEDULES, SmacCounterTimer, state_, SYNC_CW, syncFlag_, SYNCPERIOD, SmacCounterTimer::syncTime_, syncTime_, timeWaitCtrl_, tx_active_, and txData_.

00176            : Mac(), mhNav_(this), mhNeighNav_(this), mhSend_(this), mhRecv_(this), mhGene_(this), mhCS_(this), syncFlag_(0) {
00177 
00178         state_ = IDLE;
00179         radioState_ = RADIO_IDLE;
00180         tx_active_ = 0;
00181         mac_collision_ = 0;
00182   
00183         sendAddr_ = -1;
00184         recvAddr_ = -1;
00185 
00186         nav_ = 0;
00187         neighNav_ = 0;
00188   
00189         numRetry_ = 0;
00190         numExtend_ = 0;
00191         lastRxFrag_ = -3; // since -1, -2 and 0 could be valid pkt uid's
00192         //numFrags_ = 0;
00193         //succFrags_ = 0;
00194 
00195         dataPkt_ = 0;
00196         pktRx_ = 0;
00197         pktTx_ = 0;
00198 
00199         /* setup internal mac and physical parameters
00200            ----------------------------------------------
00201            byte_tx_time_: time to transmit a byte, in ms. Derived from bandwidth
00202   
00203            slotTime_: time of each slot in contention window. It should be large
00204            enough to receive the whole start symbol but cannot be smaller than clock 
00205            resolution. in msec
00206   
00207            slotTime_sec_: slottime in sec
00208   
00209            difs_: DCF interframe space (from 802.11), in ms. It is used at the beginning
00210            of each contention window. It's the minmum time to wait to start a new 
00211            transmission.
00212   
00213            sifs_: short interframe space (f
00214 
00215            /rom 802.11), in ms. It is used before sending
00216            an CTS or ACK packet. It takes care of the processing delay of each pkt.
00217   
00218            eifs_: Entended interfrane space (from 802.11) in ms. Used for backing off 
00219            incase of a collision.
00220 
00221            guardTime_: guard time at the end of each listen interval, in ms.
00222 
00223         */
00224 
00225         byte_tx_time_ = 8.0 / BANDWIDTH;
00226         double start_symbol = byte_tx_time_ * 2.5;  // time to tx 20 bits
00227         slotTime_ = CLOCKRES >= start_symbol ? CLOCKRES : start_symbol;  // in msec
00228         slotTime_sec_ = slotTime_ / 1.0e3;   // in sec
00229         difs_ = 10.0 * slotTime_;
00230         sifs_ = 5.0 * slotTime_;
00231         eifs_ = 50.0 * slotTime_;
00232         guardTime_ = 4.0 * slotTime_;
00233   
00234         // calculate packet duration. Following equations assume 4b/6b coding.
00235         // All calculations yield in usec
00236 
00237         //durSyncPkt_ = ((SIZEOF_SMAC_SYNCPKT) * 12 + 18) / 1.0e4 ;
00238 
00239         durSyncPkt_ =  (PRE_PKT_BYTES + (SIZEOF_SMAC_SYNCPKT * ENCODE_RATIO)) * byte_tx_time_ + 1;
00240         durSyncPkt_ = CLKTICK2SEC(durSyncPkt_);
00241 
00242         //durDataPkt_ = ((SIZEOF_SMAC_DATAPKT) * 12 + 18) / 1.0e4 ;
00243         durDataPkt_ = (PRE_PKT_BYTES + (SIZEOF_SMAC_DATAPKT * ENCODE_RATIO)) * byte_tx_time_ + 1;
00244         durDataPkt_ = CLKTICK2SEC(durDataPkt_);
00245 
00246         //durCtrlPkt_ = ((SIZEOF_SMAC_CTRLPKT) * 12 + 18) / 1.0e4;
00247         durCtrlPkt_ = (PRE_PKT_BYTES + (SIZEOF_SMAC_CTRLPKT * ENCODE_RATIO)) * byte_tx_time_ + 1;
00248         durCtrlPkt_ = CLKTICK2SEC(durCtrlPkt_);
00249   
00250         // time to wait for CTS or ACK
00251         //timeWaitCtrl_ = durCtrlPkt_ + CLKTICK2SEC(4) ;    // timeout time
00252         double delay = 2 * PROC_DELAY + sifs_;
00253         timeWaitCtrl_ = CLKTICK2SEC(delay) + durCtrlPkt_;    // timeout time
00254 
00255   
00256         numSched_ = 0;
00257         numNeighb_ = 0;
00258 
00259         Tcl& tcl = Tcl::instance();
00260         tcl.evalf("Mac/SMAC set syncFlag_");
00261         if (strcmp(tcl.result(), "0") != 0)  
00262                 syncFlag_ = 1;              // syncflag is set; use sleep-wakeup cycle
00263   
00264         if (!syncFlag_)
00265                 txData_ = 0;
00266   
00267         else {
00268   
00269                 // Calculate sync/data/sleeptime based on duty cycle
00270                 // all time in ms
00271                 syncTime_ = difs_ + slotTime_ * SYNC_CW + SEC2CLKTICK(durSyncPkt_) + guardTime_;
00272                 dataTime_ = difs_ + slotTime_ * DATA_CW + SEC2CLKTICK(durCtrlPkt_) + guardTime_;
00273                 listenTime_ = syncTime_ + dataTime_;
00274                 cycleTime_ = listenTime_ * 100 / SMAC_DUTY_CYCLE + 1;
00275                 sleepTime_ = cycleTime_ - listenTime_;
00276     
00277                 //printf("cycletime=%d, sleeptime=%d, listentime=%d\n", cycleTime_, sleepTime_, listenTime_);
00278 
00279 
00280                 for (int i=0; i< SMAC_MAX_NUM_SCHEDULES; i++) {
00281                         mhCounter_[i] = new SmacCounterTimer(this, i);
00282                         mhCounter_[i]->syncTime_ = syncTime_;
00283                         mhCounter_[i]->dataTime_ = dataTime_;
00284                         mhCounter_[i]->listenTime_ = listenTime_;
00285                         mhCounter_[i]->sleepTime_ = sleepTime_;
00286                         mhCounter_[i]->cycleTime_ = cycleTime_;
00287                 }
00288 
00289                 // printf("syncTime= %d, dataTime= %d, listentime = %d, sleepTime= %d, cycletime= %d\n", syncTime_, dataTime_, listenTime_, sleepTime_, cycleTime_);
00290 
00291                 // listen for a whole period to choose a schedule first
00292                 //double cw = (Random::random() % SYNC_CW) * slotTime_sec_ ;
00293   
00294                 // The foll (higher) CW value allows neigh nodes to follow a single schedule
00295                 // double w = (Random::random() % (SYNC_CW)) ;
00296                 // double cw = w/10.0;
00297                 double c = CLKTICK2SEC(listenTime_) + CLKTICK2SEC(sleepTime_);
00298                 double s = SYNCPERIOD + 1;
00299                 double t = c * s ;
00300                 //mhGene_.sched(t + cw);
00301                 mhGene_.sched(t);
00302         }
00303 }

Here is the call graph for this function:

SMAC::~SMAC  )  [inline]
 

Definition at line 351 of file smac.h.

References mhCounter_, and SMAC_MAX_NUM_SCHEDULES.

00351           { 
00352     for (int i=0; i< SMAC_MAX_NUM_SCHEDULES; i++) {
00353       delete mhCounter_[i];
00354     }
00355   }


Member Function Documentation

int Mac::addr  )  [inline, inherited]
 

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

double Mac::bandwidth  )  const [inline, inherited]
 

Definition at line 188 of file mac.h.

References Mac::bandwidth_.

Referenced by MultihopMac::pollTxtime().

00188 { return bandwidth_; }

bool SMAC::bcastMsg Packet p  )  [private]
 

Definition at line 1249 of file smac.cc.

References checkToSend(), DATA_PKT, dataPkt_, HDR_SMAC, numBcast_, numSched_, schedTab_, sh, SIZEOF_SMAC_DATAPKT, syncFlag_, SchedTable::txData, and txData_.

Referenced by sendMsg().

01249                              {
01250         //if (dataPkt_ != 0 || p == 0) 
01251         //return 0;
01252         assert(p);
01253   
01254         //if (state_ != IDLE && state_ != SLEEP && state_!= WAIT_DATA)
01255         //return 0;
01256 
01257         //char * mh = (char *)p->access(hdr_mac::offset_);
01258         //int dst = hdr_dst(mh);
01259         //int src = hdr_src(mh);
01260   
01261         struct hdr_smac *sh = HDR_SMAC(p);
01262   
01263         sh->type = DATA_PKT;
01264         sh->length = SIZEOF_SMAC_DATAPKT;
01265         //sh->srcAddr = src;
01266         //sh->dstAddr = dst;
01267         dataPkt_ = p;
01268 
01269         for(int i=0; i < numSched_; i++) {
01270                 schedTab_[i].txData = 1;
01271         }
01272 
01273         if (!syncFlag_) {
01274                 txData_ = 1;
01275                 // check if can send now
01276                 if (checkToSend())
01277                         return 1;
01278                 else 
01279                         return 0;
01280   
01281         } else {
01282                 numBcast_ = numSched_;
01283                 return 1;
01284         }
01285 }

Here is the call graph for this function:

void SMAC::capture Packet p  )  [private]
 

Definition at line 787 of file smac.cc.

References CLKTICK2SEC, eifs_, Packet::free(), txtime(), and updateNav().

Referenced by recv().

00787                             {
00788         // we update NAV for this pkt txtime
00789         updateNav(CLKTICK2SEC(eifs_) + txtime(p));
00790         Packet::free(p);
00791 }

Here is the call graph for this function:

int SMAC::checkToSend  )  [private]
 

Definition at line 548 of file smac.cc.

References BCASTDATA, SmacTimer::busy(), CLKTICK2SEC, CR_SENSE, DATA_CW, dataPkt_, difs_, HDR_SMAC, howToSend_, IDLE, MAC_BROADCAST, mhCS_, mhNav_, mhNeighNav_, RADIO_IDLE, RADIO_SLP, radioState_, Random::random(), TimerHandler::sched(), SLEEP, slotTime_sec_, state_, txData_, u_int32_t, UNICAST, WAIT_DATA, and wakeup().

Referenced by bcastMsg(), handleDATA(), handleGeneTimer(), handleNavTimer(), handleNeighNavTimer(), rxMsgDone(), txMsgDone(), and unicastMsg().

00548                       {
00549         if (txData_ == 1) {
00550                 assert(dataPkt_);
00551                 struct hdr_smac *mh = HDR_SMAC(dataPkt_);
00552     
00553                 if (radioState_ != RADIO_SLP && radioState_ != RADIO_IDLE)
00554                         goto done;  // cannot send if radio is sending or recving
00555     
00556                 if (state_ != SLEEP && state_ != IDLE && state_ != WAIT_DATA )
00557                         goto done; // cannot send if not in any of these states
00558     
00559                 if (!(mhNav_.busy()) && !(mhNeighNav_.busy()) &&
00560                     (state_ == SLEEP || state_ == IDLE)) {
00561       
00562                         if (state_ == SLEEP) wakeup();
00563       
00564                         if ((u_int32_t)mh->dstAddr == MAC_BROADCAST)
00565                                 howToSend_ = BCASTDATA;
00566                         else
00567                                 howToSend_ = UNICAST;
00568       
00569                         state_ = CR_SENSE;
00570     
00571                         // start cstimer
00572                         double cw = (Random::random() % DATA_CW) * slotTime_sec_;
00573                         mhCS_.sched(CLKTICK2SEC(difs_) + cw);
00574       
00575                         return 1;
00576     
00577                 } else {
00578                         return 0;
00579                 }
00580     
00581         done:
00582                 return 0;
00583     
00584         } else {
00585                 return 0;
00586         }
00587 }

Here is the call graph for this function:

bool SMAC::chkRadio  )  [private]
 

Definition at line 1159 of file smac.cc.

References RADIO_IDLE, RADIO_SLP, and radioState_.

Referenced by sendACK(), sendCTS(), sendDATA(), sendRTS(), sendSYNC(), and startBcast().

01159                     {
01160         // check radiostate
01161         if (radioState_ == RADIO_IDLE || radioState_ == RADIO_SLP)
01162                 return (1);
01163 
01164         return (0); // phy interface is ready to tx
01165 }

void SMAC::collision Packet p  )  [private]
 

Definition at line 794 of file smac.cc.

References discard(), DROP_MAC_COLLISION, mac_collision_, mhRecv_, pktRx_, TimerHandler::resched(), SmacRecvTimer::timeToExpire(), and txtime().

Referenced by recv().

00794                               {
00795         if (!mac_collision_)
00796                 mac_collision_ = 1;
00797   
00798         // since a collision has occured figure out which packet that caused 
00799         // the collision will "last" longer. Make this pkt pktRx_ and reset the
00800         // recv timer.
00801         if (txtime(p) > mhRecv_.timeToExpire()) {
00802                 mhRecv_.resched(txtime(p));
00803                 discard(pktRx_, DROP_MAC_COLLISION);
00804                 // shouldn't we free pkt here ???
00805                 pktRx_ = p;
00806 
00807         }
00808         else 
00809                 discard(p, DROP_MAC_COLLISION);
00810         // shouldn't we free pkt here ???
00811 }

Here is the call graph for this function:

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

Reimplemented from Mac.

Definition at line 339 of file smac.cc.

References Mac::command(), and logtarget_.

00340 {
00341         if (argc == 3) {
00342                 if (strcmp(argv[1], "log-target") == 0) {
00343                         logtarget_ = (NsObject*) TclObject::lookup(argv[2]);
00344                         if(logtarget_ == 0)
00345                                 return TCL_ERROR;
00346                         return TCL_OK;
00347                 }
00348         }
00349 
00350         return Mac::command(argc, argv);
00351 
00352 }

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, 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 }

void NsObject::delay_bind_init_all  )  [virtual, inherited]
 

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 }

void SMAC::discard Packet p,
const char *  why
[private]
 

Definition at line 814 of file smac.cc.

References ACK_PKT, CTS_PKT, DATA_PKT, drop_CTS(), drop_DATA(), drop_RTS(), drop_SYNC(), hdr_cmn::error(), Packet::free(), HDR_CMN, HDR_SMAC, RTS_PKT, sh, and SYNC_PKT.

Referenced by collision(), handleGeneTimer(), and handleRecvTimer().

00815 {
00816         hdr_cmn *ch = HDR_CMN(p);
00817         hdr_smac *sh = HDR_SMAC(p);
00818   
00819         /* if the rcvd pkt contains errors, a real MAC layer couldn't
00820            necessarily read any data from it, so we just toss it now */
00821         if(ch->error() != 0) {
00822                 Packet::free(p);
00823                 //p = 0;
00824                 return;
00825         }
00826 
00827         switch(sh->type) {
00828     
00829         case RTS_PKT:
00830                 if (drop_RTS(p, why))
00831                         return;
00832                 break;
00833     
00834         case CTS_PKT:
00835         case ACK_PKT:
00836                 if (drop_CTS(p, why))
00837                         return;
00838                 break;
00839   
00840         case DATA_PKT:
00841                 if (drop_DATA(p, why))
00842                         return;
00843                 break;
00844 
00845         case SYNC_PKT:
00846                 if(drop_SYNC(p, why))
00847                         return;
00848                 break;
00849 
00850         default:
00851                 fprintf(stderr, "invalid MAC type (%x)\n", sh->type);
00852                 //trace_pkt(p);
00853                 exit(1);
00854         }
00855         Packet::free(p);
00856 }

Here is the call graph for this function:

NsObject* BiConnector::downtarget  )  [inline, inherited]
 

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

References BiConnector::downtarget_.

Referenced by SatLL::channel().

00049 { return downtarget_; }

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

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:

void BiConnector::drop Packet p  )  [virtual, inherited]
 

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(), drop_CTS(), drop_DATA(), drop_RTS(), drop_SYNC(), UnslottedAlohaMac::end_of_contention(), MacTdma::recvHandler(), 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:

int SMAC::drop_CTS Packet p,
const char *  why
[private]
 

Definition at line 870 of file smac.cc.

References Packet::access(), cf, BiConnector::drop(), Mac::index_, and hdr_mac::offset_.

Referenced by discard().

00871 {
00872         struct smac_control_frame *cf = (smac_control_frame *)p->access(hdr_mac::offset_);
00873 
00874         if (cf->dstAddr == index_) {
00875                 drop(p, why);
00876                 return 1;
00877         }
00878         return 0;
00879 }

Here is the call graph for this function:

int SMAC::drop_DATA Packet p,
const char *  why
[private]
 

Definition at line 881 of file smac.cc.

References BiConnector::drop(), HDR_SMAC, Mac::index_, MAC_BROADCAST, sh, and u_int32_t.

Referenced by discard().

00882 {
00883         hdr_smac *sh = HDR_SMAC(p);
00884 
00885         if ( (sh->dstAddr == index_) ||
00886              (sh->srcAddr == index_) ||
00887              ((u_int32_t)sh->dstAddr == MAC_BROADCAST)) {
00888                 drop(p, why);
00889                 return 1;
00890         }
00891         return 0;
00892 }

Here is the call graph for this function:

int SMAC::drop_RTS Packet p,
const char *  why
[private]
 

Definition at line 859 of file smac.cc.

References Packet::access(), cf, BiConnector::drop(), Mac::index_, and hdr_mac::offset_.

Referenced by discard().

00860 {
00861         struct smac_control_frame *cf = (smac_control_frame *)p->access(hdr_mac::offset_);
00862   
00863         if (cf->srcAddr == index_) {
00864                 drop(p, why);
00865                 return 1;
00866         }
00867         return 0;
00868 }

Here is the call graph for this function:

int SMAC::drop_SYNC Packet p,
const char *  why
[private]
 

Definition at line 894 of file smac.cc.

References BiConnector::drop().

Referenced by discard().

00895 {
00896         drop(p, why);
00897         return 1;
00898 }

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:

void SMAC::handleACK Packet p  )  [private]
 

Definition at line 1015 of file smac.cc.

References Packet::access(), TimerHandler::cancel(), cf, CR_SENSE, dataPkt_, IDLE, Mac::index_, mhGene_, hdr_mac::offset_, sendAddr_, sleep(), state_, txMsgDone(), updateNav(), and WAIT_ACK.

Referenced by handleRecvTimer().

01015                               {
01016   
01017         // internal handler for ack
01018         struct smac_control_frame *cf = (smac_control_frame *)p->access(hdr_mac::offset_);
01019   
01020         if (cf->dstAddr == index_) {
01021                 if (state_ == WAIT_ACK && cf->srcAddr == sendAddr_) {
01022                         // cancel ACK timer
01023                         mhGene_.cancel();
01024                         dataPkt_ = 0;
01025                         //numFrags_--;
01026                         //succFrags_++;
01027       
01028                         // if (numFrags_ > 0) { //need to send more frags
01029                         //      if (neighNav__ < (durDataPkt_ + durCtrlPkt_)) {
01030                         //        // used up reserved time, have to stop
01031                         //        state_ = IDLE;
01032                         //        // txMsgFailed(succFrags_);
01033                         //        txMsgDone();
01034                         //      } else { // continue on next fragment
01035                         //        state_ = WAIT_NEXTFRAG;
01036                         //        txFragDone(dataPkt_);
01037                         //      }
01038 
01039                         //       } else {
01040                         state_ = IDLE;
01041                         txMsgDone();
01042                         //}
01043                 }
01044     
01045         } else { // destined to another node
01046                 if (cf->duration > 0) {
01047                         updateNav(cf->duration);
01048                         if (state_ == IDLE || state_ == CR_SENSE)
01049                                 sleep();
01050                 }
01051         }
01052 }

Here is the call graph for this function:

void SMAC::handleCounterTimer int  i  )  [protected]
 

Definition at line 633 of file smac.cc.

References Packet::access(), BCASTDATA, BCASTSYNC, SmacTimer::busy(), CLKTICK2SEC, CR_SENSE, currSched_, cycleTime_, DATA_CW, dataPkt_, dataTime_, difs_, howToSend_, IDLE, listenTime_, MAC_BROADCAST, mhCounter_, mhCS_, mhNav_, mhNeighNav_, SchedTable::numPeriods, hdr_mac::offset_, RADIO_IDLE, RADIO_RX, RADIO_SLP, radioState_, Random::random(), SmacCounterTimer::sched(), TimerHandler::sched(), schedTab_, sleep(), SLEEP, sleepTime_, slotTime_sec_, state_, SYNC_CW, syncTime_, SchedTable::txData, SchedTable::txSync, u_int32_t, UNICAST, SmacCounterTimer::value_, WAIT_DATA, and wakeup().

Referenced by SmacCounterTimer::expire().

00633                                     {
00634   
00635         //printf("MAC:%d,id:%d - time:%.9f\n", index_,id,Scheduler::instance().clock());
00636 
00637         if (mhCounter_[id]->value_ == sleepTime_) { //woken up from sleep
00638                 // listentime starts now
00639 
00640                 if (radioState_ != RADIO_SLP && radioState_ != RADIO_IDLE)
00641                         goto sched_1;  // cannot send if radio is sending or recving
00642     
00643                 if (state_ != SLEEP && state_ != IDLE && state_ != WAIT_DATA )
00644                         goto sched_1;; // cannot send if not in any of these states
00645     
00646                 if (!(mhNav_.busy()) && !(mhNeighNav_.busy()) &&
00647                     (state_ == SLEEP || state_ == IDLE)) {
00648     
00649                         if (state_ == SLEEP &&
00650                             (id == 0 || schedTab_[id].txSync == 1)) {
00651         
00652                                 wakeup();
00653                         }
00654                         if (schedTab_[id].txSync == 1) {
00655                                 // start carrier sense for sending sync
00656                                 howToSend_ = BCASTSYNC;
00657                                 currSched_ = id;
00658                                 state_ = CR_SENSE;
00659                                 double cw = (Random::random() % SYNC_CW) * slotTime_sec_;
00660                                 mhCS_.sched(CLKTICK2SEC(difs_) + cw);
00661                         }
00662                 }
00663                 // start to listen now
00664         sched_1:
00665                 mhCounter_[id]->sched(CLKTICK2SEC(listenTime_));
00666     
00667         } else if (mhCounter_[id]->value_ == syncTime_) { //synctime over
00668                 // can start datatime now
00669     
00670                 if (radioState_ != RADIO_SLP && radioState_ != RADIO_IDLE)
00671                         goto sched_2;  // cannot send if radio is sending or recving
00672     
00673                 if (state_ != SLEEP && state_ != IDLE && state_ != WAIT_DATA )
00674                         goto sched_2; // cannot send if not in any of these states
00675     
00676                 if (schedTab_[id].txData == 1 &&
00677                     (!(mhNav_.busy()) && !(mhNeighNav_.busy())) &&
00678                     (state_ == SLEEP || state_ == IDLE)) {
00679                         // schedule sending data
00680       
00681                         if (state_ == SLEEP)
00682                                 wakeup();
00683       
00684                         struct hdr_smac *mh = (struct hdr_smac *)dataPkt_->access(hdr_mac::offset_);
00685                         if ((u_int32_t)mh->dstAddr == MAC_BROADCAST)
00686                                 howToSend_ = BCASTDATA;
00687                         else
00688                                 howToSend_ = UNICAST;
00689                         currSched_ = id;
00690                         state_ = CR_SENSE;
00691                         // start cstimer
00692                         double cw = (Random::random() % DATA_CW) * slotTime_sec_;
00693                         mhCS_.sched(CLKTICK2SEC(difs_) + cw);
00694                 }
00695         sched_2:
00696                 mhCounter_[id]->sched(CLKTICK2SEC(dataTime_));
00697     
00698         } else if (mhCounter_[id]->value_ == dataTime_) { //datatime over
00699 
00700                 // check if in the middle of recving a pkt
00701                 if (radioState_ == RADIO_RX)
00702                         goto sched_3;
00703     
00704                 if (id == 0 && state_ == IDLE)
00705                         sleep();
00706 
00707         sched_3:
00708                 // now time to go to sleep
00709                 mhCounter_[id]->sched(CLKTICK2SEC(cycleTime_));
00710     
00711                 // check if ready to send out sync 
00712                 if (schedTab_[id].numPeriods > 0) {
00713                         schedTab_[id].numPeriods--;
00714                         if (schedTab_[id].numPeriods == 0) {
00715                                 schedTab_[id].txSync = 1;
00716                         }
00717                 }
00718         }
00719 }

Here is the call graph for this function:

void SMAC::handleCsTimer  )  [protected]
 

Definition at line 608 of file smac.cc.

References BCASTDATA, BCASTSYNC, dataPkt_, howToSend_, IDLE, sendSYNC(), startBcast(), startUcast(), state_, and UNICAST.

Referenced by SmacCsTimer::expire().

00608                          {
00609   
00610         // carrier sense successful
00611   
00612 #ifdef MAC_DEBUG
00613         if (howToSend_ != BCASTSYNC && dataPkt_ == 0)
00614                 numCSError++;
00615 #endif // MAC_DEBUG
00616   
00617         switch(howToSend_) {
00618         case BCASTSYNC:
00619                 if (sendSYNC())
00620                         state_ = IDLE;
00621                 break;
00622     
00623         case BCASTDATA:
00624                 startBcast();
00625                 break;
00626     
00627         case UNICAST:
00628                 startUcast();
00629                 break;
00630         }
00631 }

Here is the call graph for this function:

void SMAC::handleCTS Packet p  )  [private]
 

Definition at line 928 of file smac.cc.

References Packet::access(), TimerHandler::cancel(), cf, CR_SENSE, currSched_, IDLE, Mac::index_, mhGene_, hdr_mac::offset_, schedTab_, sendAddr_, sendDATA(), sleep(), state_, syncFlag_, txData_, updateNav(), WAIT_ACK, and WAIT_CTS.

Referenced by handleRecvTimer().

00928                               {
00929         // internal handler for CTS
00930         struct smac_control_frame *cf = (smac_control_frame *)p->access(hdr_mac::offset_);
00931         if(cf->dstAddr == index_) { // for me
00932                 if(state_ == WAIT_CTS && cf->srcAddr == sendAddr_) {
00933                         // cancel CTS timer
00934                         mhGene_.cancel();
00935 
00936                         if(sendDATA()) {
00937                                 state_ = WAIT_ACK;
00938 
00939                                 if (!syncFlag_)
00940                                         txData_ = 0;
00941                                 else
00942                                         schedTab_[currSched_].txData = 0;
00943                         }
00944                 }
00945         } else { // for others
00946                 updateNav(cf->duration);
00947                 if(state_ == IDLE || state_ == CR_SENSE)
00948                         sleep();
00949         }
00950 }

Here is the call graph for this function:

void SMAC::handleDATA Packet p  )  [private]
 

Definition at line 952 of file smac.cc.

References checkToSend(), CR_SENSE, Packet::free(), HDR_CMN, HDR_SMAC, IDLE, Mac::index_, lastRxFrag_, MAC_BROADCAST, recvAddr_, rxMsgDone(), sendACK(), sh, sleep(), state_, syncFlag_, u_int32_t, updateNav(), updateNeighNav(), and WAIT_DATA.

Referenced by handleRecvTimer().

00952                                {
00953         // internal handler for DATA packet
00954         struct hdr_cmn *ch = HDR_CMN(p);
00955         struct hdr_smac * sh = HDR_SMAC(p);
00956   
00957         if((u_int32_t)sh->dstAddr == MAC_BROADCAST) { // brdcast pkt
00958                 state_ = IDLE;
00959                 // hand pkt over to higher layer
00960                 rxMsgDone(p);
00961     
00962         } else if (sh->dstAddr == index_) { // unicast pkt
00963                 if(state_ == WAIT_DATA && sh->srcAddr == recvAddr_) {
00964                         // Should track neighbors' NAV, in case tx extended
00965                         updateNeighNav(sh->duration);
00966                         sendACK(sh->duration);
00967       
00968                         //if (sh->duration > durCtrlPkt_) { // wait for more frag
00969                         //rxFragDone(p);   no frag for now
00970                         //state_ = IDLE;
00971                         //} else {   // no more fragments
00972       
00973                         state_ = IDLE;
00974                         if(lastRxFrag_ != ch->uid()) {
00975                                 lastRxFrag_ = ch->uid();
00976                                 rxMsgDone(p);
00977                         }
00978                         else {
00979                                 printf("Recd duplicate data pkt at %d from %d! free pkt\n",index_,sh->srcAddr);
00980                                 Packet::free(p);
00981                                 if (!syncFlag_)
00982                                         checkToSend();
00983                         }
00984                 } else if (state_ == IDLE || state_ == CR_SENSE ) {
00985                         printf("got data pkt in %d state XXX %d\n", state_, index_);
00986                         //updateNav(sh->duration + 0.00001);  // incase I have a pkt to send
00987                         sendACK(sh->duration);
00988                         state_ = IDLE;
00989                         if(lastRxFrag_ != ch->uid()) {
00990                                 lastRxFrag_ = ch->uid();
00991                                 rxMsgDone(p);
00992                         }
00993                         else {
00994                                 printf("Recd duplicate data pkt! free pkt\n");
00995                                 Packet::free(p);
00996                                 if (!syncFlag_)
00997                                         checkToSend();
00998                         }
00999                 } else { // some other state
01000                         // not sure we can handle this
01001                         // so drop pkt
01002                         printf("Got data pkt in !WAIT_DATA/!CR_SENSE/!IDLE state(%d) XXX %d\n", state_, index_);
01003                         printf("Dropping data pkt\n");
01004                         Packet::free(p);
01005                 }
01006         } else { // unicast pkt destined to other node
01007                 updateNav(sh->duration);
01008                 if (state_ == IDLE || state_ == CR_SENSE)
01009                         sleep();
01010         }
01011 }

Here is the call graph for this function:

void SMAC::handleGeneTimer  )  [protected]
 

Definition at line 469 of file smac.cc.

References checkToSend(), dataPkt_, discard(), DROP_MAC_RETRY_COUNT_EXCEEDED, durCtrlPkt_, durDataPkt_, IDLE, Mac::index_, neighNav_, numExtend_, numRetry_, numSched_, pktTx_, sendDATA(), setMySched(), SMAC_EXTEND_LIMIT, SMAC_RETRY_LIMIT, state_, syncFlag_, txMsgDone(), updateNeighNav(), WAIT_ACK, and WAIT_CTS.

Referenced by SmacGeneTimer::expire().

00470 {
00471   
00472         if (syncFlag_) {
00473                 // still in choose-schedule state
00474                 if (numSched_ == 0) {
00475                         setMySched(0); // I'm the primary synchroniser
00476                         return;
00477                 } 
00478         }
00479         if (state_ == WAIT_CTS) {  // CTS timeout
00480                 if (numRetry_ < SMAC_RETRY_LIMIT) {
00481                         numRetry_++;
00482                         // wait until receiver's next wakeup
00483                         state_ = IDLE;
00484       
00485                         if (!syncFlag_)
00486                                 checkToSend();
00487       
00488                 } else {
00489                         state_ = IDLE;
00490                         dataPkt_ = 0;
00491                         numRetry_ = 0;
00492                         //numFrags_ = 0;
00493                         // signal upper layer about failure of tx 
00494                         // txMsgFailed();
00495                         txMsgDone();
00496       
00497                 }
00498     
00499         } else if (state_ == WAIT_ACK) { // ack timeout
00500     
00501                 if (numExtend_ < SMAC_EXTEND_LIMIT) { // extend time
00502                         printf("SMAC %d: no ACK received. Extend Tx time.\n", index_);
00503                         numExtend_++;
00504       
00505                         updateNeighNav(durDataPkt_ + durCtrlPkt_);
00506                         //neighNav_ = (durDataPkt_ + durCtrlPkt_);
00507       
00508                 } else { // reached extension limit, can't extend time
00509                         //numFrags_--;
00510       
00511                 }
00512                 if (neighNav_ < (durDataPkt_ + durCtrlPkt_)) {
00513       
00514                         // used up reserved time, stop tx
00515       
00516                         discard(dataPkt_, DROP_MAC_RETRY_COUNT_EXCEEDED);
00517                         dataPkt_ = 0;
00518                         pktTx_ = 0;
00519                         state_ = IDLE;
00520       
00521                         // signal upper layer the number of transmitted frags
00522                         //txMsgFailed(succFrags); -> no frag for now
00523       
00524                         txMsgDone();
00525       
00526                 } else { // still have time
00527                         // keep sending until use up remaining time
00528                         sendDATA();
00529                 }
00530         }
00531 }

Here is the call graph for this function:

void SMAC::handleNavTimer  )  [protected]
 

Definition at line 534 of file smac.cc.

References checkToSend(), nav_, SLEEP, state_, syncFlag_, and wakeup().

Referenced by SmacNavTimer::expire().

00534                           {
00535         // medium is now free
00536         nav_ = 0; // why have this variable?? probably not required use the timer instead
00537   
00538         if (!syncFlag_) {
00539                 if (state_ == SLEEP)
00540                         wakeup();
00541 
00542                 // try to send waiting data, if any
00543                 checkToSend();
00544         } 
00545 }

Here is the call graph for this function:

void SMAC::handleNeighNavTimer  )  [protected]
 

Definition at line 590 of file smac.cc.

References checkToSend(), IDLE, neighNav_, rxMsgDone(), state_, syncFlag_, and WAIT_DATA.

Referenced by SmacNeighNavTimer::expire().

00590                                {
00591   
00592         // Timer to track my neighbor's NAV
00593         neighNav_ = 0;         // probably don't need to use this variable
00594   
00595         if (state_ == WAIT_DATA) { // data timeout
00596                 state_ = IDLE;
00597     
00598                 // signal upper layer that rx msg is done
00599                 // didnot get any/all data
00600                 rxMsgDone(0); 
00601         } else {
00602                 if (!syncFlag_)
00603                         checkToSend();
00604         }
00605 }

Here is the call graph for this function:

void SMAC::handleRecvTimer  )  [protected]
 

Definition at line 395 of file smac.cc.

References ACK_PKT, CLKTICK2SEC, CR_SENSE, CTS_PKT, DATA_PKT, discard(), DROP_MAC_COLLISION, DROP_MAC_SLEEP, eifs_, Packet::free(), handleACK(), handleCTS(), handleDATA(), handleRTS(), handleSYNC(), HDR_CMN, HDR_SMAC, mac_collision_, pktRx_, RADIO_IDLE, RADIO_SLP, RADIO_TX, radioState_, RTS_PKT, sh, sleep(), SLEEP, state_, SYNC_PKT, and updateNav().

Referenced by SmacRecvTimer::expire().

00395                            {
00396         assert(pktRx_);
00397   
00398         struct hdr_cmn *ch = HDR_CMN(pktRx_);
00399         struct hdr_smac *sh = HDR_SMAC(pktRx_);
00400 
00401         if (state_ == SLEEP) {
00402                 discard(pktRx_, DROP_MAC_SLEEP);
00403                 radioState_ = RADIO_SLP;
00404                 goto done;
00405         }
00406   
00407         // if the radio interface is tx'ing when this packet arrives
00408         // I would never have seen it and should do a silent discard 
00409   
00410         if (radioState_ == RADIO_TX) {
00411                 Packet::free(pktRx_);
00412                 goto done;
00413         }
00414   
00415         if (mac_collision_) {
00416                 discard(pktRx_, DROP_MAC_COLLISION);
00417                 mac_collision_ = 0;
00418                 updateNav(CLKTICK2SEC(eifs_));
00419     
00420                 if (state_ == CR_SENSE) 
00421                         sleep(); // have to wait until next wakeup time
00422                 else 
00423                         radioState_ = RADIO_IDLE;
00424     
00425                 goto done;
00426         }
00427   
00428         if (ch->error()) {
00429                 Packet::free(pktRx_);
00430                 updateNav(CLKTICK2SEC(eifs_));
00431 
00432                 if (state_ == CR_SENSE) 
00433                         sleep();
00434                 else 
00435                         radioState_ = RADIO_IDLE;
00436       
00437                 goto done;
00438         }
00439   
00440         // set radio from rx to idle again
00441         radioState_ = RADIO_IDLE;
00442 
00443         switch (sh->type) {
00444         case DATA_PKT:
00445                 handleDATA(pktRx_);
00446                 break;
00447         case RTS_PKT:
00448                 handleRTS(pktRx_);
00449                 break;
00450         case CTS_PKT:
00451                 handleCTS(pktRx_);
00452                 break;
00453         case ACK_PKT:
00454                 handleACK(pktRx_);
00455                 break;
00456         case SYNC_PKT:
00457                 handleSYNC(pktRx_);
00458                 break;
00459         default:
00460                 fprintf(stderr, "Unknown smac pkt type, %d\n", sh->type);
00461                 break;
00462         }
00463   
00464  done:
00465         pktRx_ = 0;
00466   
00467 }

Here is the call graph for this function:

void SMAC::handleRTS Packet p  )  [private]
 

Definition at line 903 of file smac.cc.

References Packet::access(), cf, CR_SENSE, durCtrlPkt_, durDataPkt_, IDLE, Mac::index_, lastRxFrag_, nav_, hdr_mac::offset_, recvAddr_, sendCTS(), state_, updateNav(), and WAIT_DATA.

Referenced by handleRecvTimer().

00903                               {
00904         // internal handler for RTS
00905 
00906         struct smac_control_frame *cf = (smac_control_frame *)p->access(hdr_mac::offset_);
00907   
00908         if(cf->dstAddr == index_) {
00909                 if((state_ == IDLE || state_ == CR_SENSE) && nav_ == 0) {
00910                         recvAddr_ = cf->srcAddr; // remember sender's addr
00911 
00912                         if(sendCTS(cf->duration)) {
00913                                 state_ = WAIT_DATA;
00914                                 lastRxFrag_ = -3; //reset frag no 
00915                         }
00916                 }
00917         } else { 
00918                 // pkt destined to another node
00919                 // don't go to sleep unless hear first data fragment
00920                 // so I know how long to sleep
00921                 if (state_ == CR_SENSE)
00922                         state_ = IDLE;
00923                 updateNav(durCtrlPkt_ + durDataPkt_);
00924         }
00925 
00926 }

Here is the call graph for this function:

void SMAC::handleSendTimer  )  [protected]
 

Definition at line 357 of file smac.cc.

References ACK_PKT, CTS_PKT, DATA_PKT, HDR_SMAC, pktTx_, RADIO_IDLE, radioState_, RTS_PKT, sentACK(), sentCTS(), sentDATA(), sentRTS(), sentSYNC(), sh, SYNC_PKT, and tx_active_.

Referenced by SmacSendTimer::expire().

00357                            {
00358         assert(pktTx_);
00359   
00360         struct hdr_smac *sh = HDR_SMAC(pktTx_);
00361   
00362         // Packet tx is done so radio should go back to idle
00363         radioState_ = RADIO_IDLE;
00364         tx_active_ = 0;
00365   
00366         switch(sh->type) {
00367     
00368         case RTS_PKT:
00369                 sentRTS(pktTx_);
00370                 break;
00371 
00372         case CTS_PKT:
00373                 sentCTS(pktTx_);
00374                 break;
00375     
00376         case DATA_PKT:
00377                 sentDATA(pktTx_);
00378                 break;
00379   
00380         case ACK_PKT:
00381                 sentACK(pktTx_);
00382                 break;
00383         case SYNC_PKT:
00384                 sentSYNC(pktTx_);
00385                 break;
00386         default:
00387                 fprintf(stderr, "unknown mac pkt type, %d\n", sh->type);
00388                 break;
00389         }
00390   
00391         pktTx_ = 0;
00392 }

Here is the call graph for this function:

void SMAC::handleSYNC Packet p  )  [private]
 

Definition at line 1055 of file smac.cc.

References Packet::access(), TimerHandler::cancel(), CLKTICK2SEC, IDLE, Mac::index_, mhCounter_, mhGene_, neighbList_, NeighbList::nodeId, numNeighb_, SchedTable::numPeriods, numSched_, hdr_mac::offset_, SmacCounterTimer::sched(), NeighbList::schedId, schedTab_, setMySched(), sf, SMAC_MAX_NUM_SCHEDULES, state_, SmacCounterTimer::timeToSleep(), SchedTable::txData, and SchedTable::txSync.

Referenced by handleRecvTimer().

01056 {
01057         if(numSched_ == 0) { // in choose_sched state
01058                 mhGene_.cancel();
01059                 //double t = Scheduler::instance().clock();
01060                 //struct smac_sync_frame *sf = (struct smac_sync_frame *)p->access(hdr_mac::offset_);
01061                 //printf("Recvd SYNC (follow) at %d from %d.....at %.6f\n", index_, sf->srcAddr, t);
01062                 setMySched(p);
01063                 return;
01064         }
01065         if (numNeighb_ == 0) { // getting first sync pkt
01066                 // follow this sched as have no other neighbor
01067                 //double t = Scheduler::instance().clock();
01068                 //struct smac_sync_frame *sf = (struct smac_sync_frame *)p->access(hdr_mac::offset_);
01069                 //printf("Recvd SYNC (follow) at %d from %d.....at %.6f\n", index_, sf->srcAddr, t);
01070                 setMySched(p);
01071                 return;
01072         }
01073         state_ = IDLE;
01074         // check if sender is on my neighbor list
01075         struct smac_sync_frame *sf = (struct smac_sync_frame *)p->access(hdr_mac::offset_);
01076         int i, j;
01077         int foundNeighb = 0;
01078         int schedId = SMAC_MAX_NUM_SCHEDULES;
01079         //double t = Scheduler::instance().clock();
01080         //printf("Recvd SYNC (not/f) at %d from %d.....at %.6f\n", index_, sf->srcAddr, t);
01081   
01082         for(i = 0; i < numNeighb_; i++) {
01083                 if (neighbList_[i].nodeId == sf->srcAddr) {
01084                         foundNeighb = 1;
01085                         schedId = neighbList_[i].schedId;  // a known neighbor
01086                         mhCounter_[schedId]->sched(sf->sleepTime);
01087                         break;
01088                 }
01089                 if (neighbList_[i].nodeId == sf->syncNode)
01090                         // // found its synchronizer, remember it schedule id
01091                         schedId = neighbList_[i].schedId;
01092         }
01093         if (!foundNeighb) { // unknown node, add it onto neighbor list
01094                 neighbList_[numNeighb_].nodeId = sf->srcAddr;
01095                 if (schedId < SMAC_MAX_NUM_SCHEDULES) {
01096                         // found its synchronizer
01097                         neighbList_[numNeighb_].schedId = schedId;
01098                 } else if (sf->syncNode == index_) { // this node follows my schedule
01099                         neighbList_[numNeighb_].schedId = 0;
01100                 } else { // its synchronizer is unknown
01101                         // check if its schedule equals to an existing one
01102                         int foundSched = 0;
01103                         for (j = 0; j < numSched_; j++) {
01104                                 double t = mhCounter_[j]->timeToSleep();
01105                                 double st = sf->sleepTime; 
01106                                 if (t == st || (t + CLKTICK2SEC(1)) == st || t == (st + CLKTICK2SEC(1))) {
01107                                         neighbList_[numNeighb_].schedId = j;
01108                                         foundSched = 1;
01109                                         break;
01110                                 }
01111                         }
01112                         if (!foundSched) { // this is unknown schedule
01113                                 schedTab_[numSched_].txSync = 1;
01114                                 schedTab_[numSched_].txData = 0;
01115                                 schedTab_[numSched_].numPeriods = 0;
01116                                 neighbList_[numNeighb_].schedId = numSched_;
01117                                 mhCounter_[numSched_]->sched(sf->sleepTime);
01118                                 numSched_++;
01119                         }
01120                 }
01121                 numNeighb_++;  // increment number of neighbors
01122         }
01123 }

Here is the call graph for this function:

int SMAC::hdr_dst char *  hdr,
int  dst = -2
[inline, private, virtual]
 

Reimplemented from Mac.

Definition at line 447 of file smac.h.

References sh.

Referenced by unicastMsg().

00447                                               {
00448     struct hdr_smac *sh = (struct hdr_smac *) hdr;
00449     if (dst > -2)
00450       sh->dstAddr = dst;
00451     return sh->dstAddr;
00452   }

int SMAC::hdr_src char *  hdr,
int  src = -2
[inline, private, virtual]
 

Reimplemented from Mac.

Definition at line 453 of file smac.h.

References sh.

Referenced by unicastMsg().

00453                                               {
00454     struct hdr_smac *sh = (struct hdr_smac *) hdr;
00455     if (src > -2)
00456       sh->srcAddr = src;
00457     return sh->srcAddr;
00458   }

int SMAC::hdr_type char *  hdr,
u_int16_t  type = 0
[inline, private, virtual]
 

Reimplemented from Mac.

Definition at line 459 of file smac.h.

References sh.

00459                                                      {
00460     struct hdr_smac *sh = (struct hdr_smac *) hdr;
00461     if (type)
00462       sh->type = type;
00463     return sh->type;
00464   }

virtual int SMAC::initialized  )  [inline, protected, virtual]
 

Reimplemented from Mac.

Definition at line 537 of file smac.h.

References BiConnector::downtarget_, Mac::netif_, and BiConnector::uptarget_.

Referenced by recv().

00537                             { 
00538     return (netif_ && uptarget_ && downtarget_); 
00539   }

virtual void Mac::installTap Tap t  )  [inline, virtual, inherited]
 

Definition at line 179 of file mac.h.

References Mac::tap_.

Referenced by DSRAgent::command().

00179 { tap_ = t; }

int NsObject::isdebug  )  const [inline, inherited]
 

Definition at line 61 of file object.h.

References NsObject::debug_.

00061 { return debug_; }

void SMAC::mac_log Packet p  )  [inline, private]
 

Reimplemented from Mac.

Definition at line 436 of file smac.h.

References logtarget_, and NsObject::recv().

00436                           {
00437     logtarget_->recv(p, (Handler*) 0);
00438   }

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 SMAC::recv Packet p,
Handler h
[virtual]
 

Reimplemented from Mac.

Definition at line 725 of file smac.cc.

References SmacTimer::busy(), capture(), SmacCsTimer::checkToCancel(), collision(), PacketStamp::CPThresh, CR_SENSE, hdr_cmn::DOWN, HDR_CMN, Mac::index_, initialized(), mhCS_, mhRecv_, pktRx_, RADIO_RX, RADIO_SLP, RADIO_TX, radioState_, TimerHandler::resched(), PacketStamp::RxPr, SmacRecvTimer::sched(), sendMsg(), state_, tx_active_, Packet::txinfo_, and txtime().

00725                                      {
00726   
00727         struct hdr_cmn *ch = HDR_CMN(p);
00728 
00729         assert(initialized());
00730 
00731         // handle outgoing pkt
00732         if ( ch->direction() == hdr_cmn::DOWN) {
00733                 sendMsg(p, h);
00734                 return;
00735         }
00736   
00737         // handle incoming pkt
00738         // we have just recvd the first bit of a pkt on the network interface  
00739   
00740         // if the interface is in tx mode it probably would not see this pkt
00741         if (radioState_ == RADIO_TX && ch->error() == 0) {
00742                 assert(tx_active_);
00743                 ch->error() = 1;
00744                 pktRx_ = p;
00745                 mhRecv_.sched(txtime(p));
00746                 return;
00747         }
00748   
00749         // cancel carrier sense timer and wait for entire pkt
00750         if (state_ == CR_SENSE) {
00751                 printf("Cancelling CS- node %d\n", index_);
00752                 // cancels only if timer is pending; smac could be in CR_SENSE with timer cancelled
00753                 // incase it has already received a pkt and receiving again
00754                 mhCS_.checkToCancel();
00755         }
00756   
00757         // if the interface is already in process of recv'ing pkt
00758         if (radioState_ == RADIO_RX) {
00759                 assert(pktRx_); 
00760                 assert(mhRecv_.busy());
00761     
00762                 // if power of the incoming pkt is smaller than the power 
00763                 // of the pkt currently being recvd by atleast the capture 
00764                 // threshold then we ignore the new pkt.
00765     
00766                 if (pktRx_->txinfo_.RxPr / p->txinfo_.RxPr >= p->txinfo_.CPThresh) 
00767                         capture(p);
00768                 else
00769                         collision(p);
00770         } 
00771   
00772         else {
00773                 if (mhRecv_.busy()) { // and radiostate != RADIO_RX
00774                         assert(radioState_ == RADIO_SLP);
00775                         // The radio interface was recv'ing a pkt when it went to sleep
00776                         // should it postpone sleep till it finishes recving the pkt???
00777                         mhRecv_.resched(txtime(p));
00778                 } else
00779                         mhRecv_.sched(txtime(p));
00780     
00781                 radioState_ = RADIO_RX;
00782                 pktRx_ = p;
00783         }
00784 }

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

Definition at line 70 of file object.cc.

Referenced by NsObject::command().

00071 {
00072 }

void Mac::resume Packet p = 0  )  [virtual, inherited]
 

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

00174 {
00175         if (p != 0)
00176                 drop(p);
00177         state(MAC_IDLE);
00178         callback_->handle(&intr_);
00179 }

Here is the call graph for this function:

void SMAC::rxMsgDone Packet p  )  [private]
 

Definition at line 1126 of file smac.cc.

References checkToSend(), NsObject::recv(), syncFlag_, and BiConnector::uptarget_.

Referenced by handleDATA(), and handleNeighNavTimer().

01126                               {
01127         // no more fragments
01128         // defragment all pkts and send them up
01129         // fragmentation/de-frag to be implemented
01130   
01131         if (p)
01132                 uptarget_->recv(p, (Handler*)0);
01133   
01134         if (!syncFlag_)
01135                 // check if any pkt waiting to get tx'ed
01136                 checkToSend();
01137 }

Here is the call graph for this function:

bool SMAC::sendACK double  duration  )  [private]
 

Definition at line 1433 of file smac.cc.

References Packet::access(), ACK_PKT, Packet::alloc(), cf, chkRadio(), hdr_cmn::DOWN, duration, durCtrlPkt_, HDR_CMN, Mac::index_, MAC_HDR_LEN, hdr_mac::offset_, PT_MAC, recvAddr_, SIZEOF_SMAC_CTRLPKT, and transmit().

Referenced by handleDATA().

01433                                   {
01434         // construct ACK pkt
01435         Packet *p = Packet::alloc();
01436         struct smac_control_frame *cf = (struct smac_control_frame *)p->access(hdr_mac::offset_);
01437         struct hdr_cmn *ch = HDR_CMN(p);
01438 
01439         ch->uid() = 0;
01440         ch->ptype() = PT_MAC;
01441         ch->size() = SIZEOF_SMAC_CTRLPKT;
01442         ch->iface() = UNKN_IFACE.value();
01443         ch->direction() = hdr_cmn::DOWN;
01444         ch->error() = 0;        /* pkt not corrupt to start with */
01445   
01446         bzero(cf, MAC_HDR_LEN);
01447   
01448   cf->length = SIZEOF_SMAC_CTRLPKT;
01449   cf->type = ACK_PKT;
01450   
01451   cf->srcAddr = index_;
01452   cf->dstAddr = recvAddr_;
01453   
01454   // input duration is the duration field from recvd data pkt
01455   // stick to neighbNav -- should update it when rx data packet
01456   cf->duration = duration - durCtrlPkt_;
01457   //cf->duration = mhNeighNav_.timeToExpire() - durCtrlPkt_;
01458   
01459   // send ACK
01460   if (chkRadio()) {
01461     transmit(p);
01462     return 1;
01463   } else
01464     return 0;
01465 }

Here is the call graph for this function:

bool SMAC::sendCTS double  duration  )  [private]
 

Definition at line 1379 of file smac.cc.

References Packet::access(), Packet::alloc(), cf, chkRadio(), CTS_PKT, hdr_cmn::DOWN, duration, durCtrlPkt_, HDR_CMN, Mac::index_, MAC_HDR_LEN, hdr_mac::offset_, PT_MAC, recvAddr_, SIZEOF_SMAC_CTRLPKT, and transmit().

Referenced by handleRTS().

01379                                   {
01380   
01381         // construct CTS
01382         Packet *p = Packet::alloc();
01383         struct smac_control_frame *cf = (struct smac_control_frame *)p->access(hdr_mac::offset_);
01384         struct hdr_cmn *ch = HDR_CMN(p);
01385 
01386         ch->uid() = 0;
01387         ch->ptype() = PT_MAC;
01388         ch->size() = SIZEOF_SMAC_CTRLPKT;
01389         ch->iface() = UNKN_IFACE.value();
01390         ch->direction() = hdr_cmn::DOWN;
01391         ch->error() = 0;        /* pkt not corrupt to start with */
01392 
01393         bzero(cf, MAC_HDR_LEN);
01394   
01395         cf->length = SIZEOF_SMAC_CTRLPKT;
01396         cf->type = CTS_PKT;
01397   
01398         cf->srcAddr = index_;
01399         cf->dstAddr = recvAddr_;
01400 
01401         // input duration is the duration field from received RTS pkt  
01402         cf->duration = duration - durCtrlPkt_ ;  
01403         cf->crc = 0;
01404   
01405         // send CTS
01406         if (chkRadio()) {
01407                 transmit(p);
01408                 return 1;
01409 
01410         } else
01411                 return 0;
01412 }

Here is the call graph for this function:

bool SMAC::sendDATA  )  [private]
 

Definition at line 1415 of file smac.cc.

References chkRadio(), dataPkt_, durCtrlPkt_, HDR_SMAC, sh, and transmit().

Referenced by handleCTS(), and handleGeneTimer().

01415                     {
01416         // assuming data pkt is already constructed
01417         struct hdr_smac * sh = HDR_SMAC(dataPkt_);
01418   
01419         //sh->duration = numFrags_ * durCtrlPkt_ + (numFrags_ - 1) * durDataPkt_;
01420         sh->duration =  durCtrlPkt_;
01421   
01422         // send DATA
01423         if (chkRadio()) {
01424                 transmit(dataPkt_);
01425                 return 1;
01426 
01427         } else 
01428                 return 0;
01429 
01430 }

Here is the call graph for this function:

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

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:

void Mac::sendDown Packet p  )  [virtual, inherited]
 

Reimplemented in MacTdma, SatMac, and UnslottedAlohaMac.

Definition at line 163 of file mac.cc.

References Mac::abstract_, BiConnector::downtarget_, Mac::hRes_, Scheduler::instance(), Mac::intr_, NsObject::recv(), Scheduler::schedule(), and Mac::txtime().

Referenced by MacHandlerSend::handle(), and Mac::recv().

00164 {
00165         Scheduler& s = Scheduler::instance();
00166         double txt = txtime(p);
00167         downtarget_->recv(p, this);
00168         if(!abstract_)
00169                 s.schedule(&hRes_, &intr_, txt);
00170 }

Here is the call graph for this function:

bool SMAC::sendMsg Packet p,
Handler h
[private]
 

Definition at line 1234 of file smac.cc.

References bcastMsg(), Mac::callback_, HDR_SMAC, MAC_BROADCAST, u_int32_t, and unicastMsg().

Referenced by recv().

01234                                           {
01235         struct hdr_smac *mh = HDR_SMAC(pkt);
01236   
01237         callback_ = h;
01238         if ((u_int32_t)mh->dstAddr == MAC_BROADCAST) {
01239                 return (bcastMsg(pkt));
01240         } else {
01241                 return (unicastMsg(1, pkt));     // for now no fragmentation
01242 
01243                 // fragmentation limit is 40 bytes per pkt.
01244                 // max_msg_size is tentatively 1000 bytes; weiye will confirm this
01245         }
01246 }

Here is the call graph for this function:

bool SMAC::sendRTS  )  [private]
 

Definition at line 1341 of file smac.cc.

References Packet::access(), Packet::alloc(), cf, chkRadio(), hdr_cmn::DOWN, durCtrlPkt_, durDataPkt_, HDR_CMN, Mac::index_, MAC_HDR_LEN, hdr_mac::offset_, PT_MAC, RTS_PKT, sendAddr_, SIZEOF_SMAC_CTRLPKT, and transmit().

Referenced by startUcast().

01341                    {
01342         // construct RTS pkt
01343         Packet *p = Packet::alloc();
01344         struct smac_control_frame *cf = (struct smac_control_frame *)p->access(hdr_mac::offset_);
01345         struct hdr_cmn *ch = HDR_CMN(p);
01346 
01347         ch->uid() = 0;
01348         ch->ptype() = PT_MAC;
01349         ch->size() = SIZEOF_SMAC_CTRLPKT;
01350         ch->iface() = UNKN_IFACE.value();
01351         ch->direction() = hdr_cmn::DOWN;
01352         ch->error() = 0;        /* pkt not corrupt to start with */
01353   
01354 
01355         bzero(cf, MAC_HDR_LEN);
01356   
01357         cf->length = SIZEOF_SMAC_CTRLPKT;
01358         cf->type = RTS_PKT;
01359   
01360         cf->srcAddr = index_;  // mac_id
01361         cf->dstAddr = sendAddr_;
01362 
01363         // reserved time for CTS + all fragments + all acks
01364         //cf->duration = (numFrags_ + 1) * durCtrlPkt_ + numFrags_ * durDataPkt_;
01365         cf->duration = (2 * durCtrlPkt_ + durDataPkt_ + 0.001 ); 
01366         cf->crc = 0;
01367   
01368         // send RTS
01369         if (chkRadio()) {
01370                 transmit(p);
01371                 return 1;
01372     
01373         } else 
01374                 return 0;
01375 
01376 }

Here is the call graph for this function:

bool SMAC::sendSYNC  )  [private]
 

Definition at line 1467 of file smac.cc.

References Packet::access(), Packet::alloc(), cf, chkRadio(), CLKTICK2SEC, cycleTime_, hdr_cmn::DOWN, HDR_CMN, Mac::index_, mhCounter_, mySyncNode_, hdr_mac::offset_, PT_MAC, SIZEOF_SMAC_SYNCPKT, SYNC_PKT, SYNCPKTTIME, SmacCounterTimer::timeToSleep(), and transmit().

Referenced by handleCsTimer().

01468 {
01469   // construct and send SYNC pkt
01470   Packet *p = Packet::alloc();
01471   struct smac_sync_frame *cf = (struct smac_sync_frame *)p->access(hdr_mac::offset_);
01472   struct hdr_cmn *ch = HDR_CMN(p);
01473 
01474   ch->uid() = 0;
01475   ch->ptype() = PT_MAC;
01476   ch->size() = SIZEOF_SMAC_SYNCPKT;
01477   ch->iface() = UNKN_IFACE.value();
01478   ch->direction() = hdr_cmn::DOWN;
01479   ch->error() = 0;      /* pkt not corrupt to start with */
01480   
01481   cf->length = SIZEOF_SMAC_SYNCPKT;
01482   cf->type = SYNC_PKT;
01483   
01484   cf->srcAddr = index_;
01485   cf->syncNode = mySyncNode_;
01486   // shld change SYNCPKTTIME to match with the configures durSyncPkt_
01487   cf->sleepTime = mhCounter_[0]->timeToSleep() - CLKTICK2SEC(SYNCPKTTIME);
01488   if (cf->sleepTime < 0)
01489     cf->sleepTime += CLKTICK2SEC(cycleTime_);
01490   
01491   // send SYNC
01492   if (chkRadio()) {
01493     transmit(p);
01494     //double t = Scheduler::instance().clock();
01495     //printf("Sent SYNC from %d.....at %.6f\n", cf->srcAddr, t);
01496     return 1;
01497     
01498   } else 
01499     return 0;
01500 }

Here is the call graph for this function:

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

Reimplemented in Mac802_3.

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

References NsObject::recv(), and BiConnector::uptarget_.

Referenced by BiConnector::recv().

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

Here is the call graph for this function:

void Mac::sendUp Packet p  )  [virtual, inherited]
 

Reimplemented in MacTdma, SatMac, and UnslottedAlohaMac.

Definition at line 145 of file mac.cc.

References Mac::abstract_, Packet::access(), Mac::delay_, BiConnector::drop(), Packet::free(), Mac::hdr_dst(), Mac::index_, Scheduler::instance(), MAC_BROADCAST, MAC_IDLE, hdr_mac::offset_, Scheduler::schedule(), Mac::state(), u_int32_t, and BiConnector::uptarget_.

Referenced by Mac::recv().

00146 {
00147         char* mh = (char*)p->access(hdr_mac::offset_);
00148         int dst = this->hdr_dst(mh);
00149 
00150         state(MAC_IDLE);
00151         if (((u_int32_t)dst != MAC_BROADCAST) && (dst != index_)) {
00152                 if(!abstract_){
00153                         drop(p);
00154                 }else {
00155                         //Dont want to creat a trace
00156                         Packet::free(p);
00157                 }
00158                 return;
00159         }
00160         Scheduler::instance().schedule(uptarget_, p, delay_);
00161 }

Here is the call graph for this function:

void SMAC::sentACK Packet p  )  [private]
 

Definition at line 1564 of file smac.cc.

References Packet::access(), cf, Packet::free(), hdr_mac::offset_, and updateNeighNav().

Referenced by handleSendTimer().

01565 {
01566   struct smac_control_frame *cf = (struct smac_control_frame *)p->access(hdr_mac::offset_);
01567   
01568   updateNeighNav(cf->duration);
01569   Packet::free(p);
01570 }

Here is the call graph for this function:

void SMAC::sentCTS Packet p  )  [private]
 

Definition at line 1511 of file smac.cc.

References Packet::access(), cf, Packet::free(), hdr_mac::offset_, and updateNeighNav().

Referenced by handleSendTimer().

01512 {
01513   // just sent CTS, track my neighbors' NAV
01514   // they update NAV and go to sleep after recv CTS
01515   // no data timeout, just use neighbors' NAV
01516   // since they went to sleep, just wait data for the entire time
01517 
01518   struct smac_control_frame *cf = (struct smac_control_frame *)p->access(hdr_mac::offset_);
01519   
01520   updateNeighNav(cf->duration);
01521   Packet::free(p);
01522 }

Here is the call graph for this function:

void SMAC::sentDATA Packet p  )  [private]
 

Definition at line 1524 of file smac.cc.

References BCASTDATA, currSched_, dataPkt_, Packet::free(), HDR_SMAC, howToSend_, IDLE, mhGene_, numBcast_, TimerHandler::sched(), schedTab_, state_, syncFlag_, timeWaitCtrl_, txData_, txMsgDone(), and updateNeighNav().

Referenced by handleSendTimer().

01525 {
01526   struct hdr_smac *mh = HDR_SMAC(p);
01527   
01528   if (howToSend_ == BCASTDATA) { // if data was brdcast
01529     state_ = IDLE;
01530 
01531     if (!syncFlag_) {
01532       txData_ = 0;
01533       dataPkt_ = 0;
01534       Packet::free(p);
01535     
01536       // signal upper layer
01537       txMsgDone(); 
01538     
01539     } else {
01540       schedTab_[currSched_].txData = 0;
01541       numBcast_--;
01542       if (numBcast_ == 0) {
01543         dataPkt_ = 0;
01544         Packet::free(p);
01545         
01546         // signal upper layer
01547         txMsgDone(); 
01548       }
01549     }
01550     
01551   } else {
01552     
01553     // unicast is done; track my neighbors' NAV
01554     // they update NAV and go to sleep after recv first data fragment
01555 
01556     updateNeighNav(mh->duration);
01557       
01558     //waiting for ACK, set timer for ACK timeout
01559     mhGene_.sched(timeWaitCtrl_);
01560 
01561   }
01562 }

Here is the call graph for this function:

void SMAC::sentRTS Packet p  )  [private]
 

Definition at line 1503 of file smac.cc.

References Packet::free(), mhGene_, TimerHandler::sched(), and timeWaitCtrl_.

Referenced by handleSendTimer().

01504 {
01505   // just sent RTS, set timer for CTS timeout
01506   mhGene_.sched(timeWaitCtrl_);
01507   Packet::free(p);
01508   
01509 }

Here is the call graph for this function:

void SMAC::sentSYNC Packet p  )  [private]
 

Definition at line 1572 of file smac.cc.

References currSched_, Packet::free(), schedTab_, and SYNCPERIOD.

Referenced by handleSendTimer().

01573 {
01574   schedTab_[currSched_].txSync = 0;
01575   schedTab_[currSched_].numPeriods = SYNCPERIOD;
01576   Packet::free(p);
01577 
01578 }

Here is the call graph for this function:

void SMAC::setMySched Packet syncpkt  )  [private]
 

Definition at line 305 of file smac.cc.

References Packet::access(), CLKTICK2SEC, currSched_, IDLE, Mac::index_, listenTime_, mhCounter_, mySyncNode_, neighbList_, NeighbList::nodeId, numNeighb_, SchedTable::numPeriods, numSched_, hdr_mac::offset_, SmacCounterTimer::sched(), NeighbList::schedId, schedTab_, state_, SchedTable::txData, and SchedTable::txSync.

Referenced by handleGeneTimer(), and handleSYNC().

00306 {
00307         // set my schedule and put it into the first entry of schedule table
00308         state_ = IDLE;
00309         numSched_ = 1;
00310         schedTab_[0].numPeriods = 0;
00311         schedTab_[0].txData = 0;
00312         schedTab_[0].txSync = 1; // need to brdcast my schedule
00313   
00314         if (pkt == 0) { // freely choose my schedule
00315 
00316                 mhCounter_[0]->sched(CLKTICK2SEC(listenTime_));
00317                 mySyncNode_ = index_; // myself
00318     
00319                 currSched_ = 0;
00320                 //sendSYNC();  
00321     
00322         } else { // follow schedule in syncpkt
00323     
00324                 struct smac_sync_frame *pf = (struct smac_sync_frame *)pkt->access(hdr_mac::offset_);
00325 
00326                 mhCounter_[0]->sched(pf->sleepTime);
00327 
00328                 mySyncNode_ = pf->srcAddr;
00329     
00330                 //add node in my neighbor list
00331                 neighbList_[0].nodeId = mySyncNode_;
00332                 neighbList_[0].schedId = 0;
00333                 numNeighb_ = 1;
00334         }
00335 }

Here is the call graph for this function:

void SMAC::sleep  )  [private]
 

Definition at line 1580 of file smac.cc.

References RADIO_SLP, radioState_, SLEEP, and state_.

Referenced by handleACK(), handleCounterTimer(), handleCTS(), handleDATA(), and handleRecvTimer().

01581 {
01582   // go to sleep, turn off radio
01583   state_ = SLEEP;
01584   radioState_ = RADIO_SLP;
01585   //printf("SLEEP: ............node %d at %.6f\n", index_, Scheduler::instance().clock());
01586 }

int SMAC::startBcast  )  [private]
 

Definition at line 1168 of file smac.cc.

References chkRadio(), dataPkt_, hdr_smac::duration, HDR_SMAC, and transmit().

Referenced by handleCsTimer().

01169 {
01170         // broadcast data directly; don't use RTS/CTS
01171 
01172         hdr_smac *mh = HDR_SMAC(dataPkt_);
01173   
01174         mh->duration = 0;
01175 
01176         if(chkRadio()) {
01177                 transmit(dataPkt_);
01178                 return 1;
01179         }
01180   
01181         return 0;
01182 }

Here is the call graph for this function:

int SMAC::startUcast  )  [private]
 

Definition at line 1185 of file smac.cc.

References dataPkt_, hdr_smac::dstAddr, HDR_SMAC, numExtend_, numRetry_, sendAddr_, sendRTS(), state_, and WAIT_CTS.

Referenced by handleCsTimer().

01186 {
01187         // start unicast data; send RTS first
01188         hdr_smac *mh = HDR_SMAC(dataPkt_);
01189   
01190         sendAddr_ = mh->dstAddr;
01191         numRetry_ = 0;
01192         //succFrags_ = 0;
01193         numExtend_ = 0;
01194   
01195         if(sendRTS()) {
01196                 state_ = WAIT_CTS;
01197                 return 1;
01198         }
01199   
01200         return 0;
01201 }

Here is the call graph for this function:

MacState Mac::state int  m  )  [inline, inherited]
 

Definition at line 192 of file mac.h.

References MacState, and Mac::state_.

00192 { return state_ = (MacState) m; }

MacState Mac::state  )  [inline, inherited]
 

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

void SMAC::transmit Packet p  )  [private]
 

Definition at line 1147 of file smac.cc.

References BiConnector::downtarget_, mhSend_, pktTx_, RADIO_TX, radioState_, NsObject::recv(), TimerHandler::sched(), tx_active_, and txtime().

Referenced by sendACK(), sendCTS(), sendDATA(), sendRTS(), sendSYNC(), and startBcast().

01147                              {
01148   
01149         radioState_ = RADIO_TX;
01150         tx_active_ = 1;
01151         pktTx_ = p;
01152   
01153         downtarget_->recv(p->copy(), this);
01154         //Scheduler::instance().schedule(downtarget_, p, 0.000001);
01155         mhSend_.sched(txtime(p));
01156 
01157 }

Here is the call graph for this function:

void SMAC::txMsgDone  )  [private]
 

Definition at line 1204 of file smac.cc.

References Mac::callback_, checkToSend(), Handler::handle(), and syncFlag_.

Referenced by handleACK(), handleGeneTimer(), and sentDATA().

01205 {
01206         if (!syncFlag_) {
01207                 // check if any data is waiting to get tx'ed
01208                 if(checkToSend())
01209                         return;
01210                 else if (callback_) { // signal upper layer
01211                         Handler *h = callback_;
01212                         callback_ = 0;
01213                         h->handle((Event*) 0);
01214                 }
01215         } else {
01216                 if (callback_) { // signal upper layer
01217                         Handler *h = callback_;
01218                         callback_ = 0;
01219                         h->handle((Event*) 0);
01220                 }
01221         }
01222   
01223 }

Here is the call graph for this function:

double Mac::txtime int  bytes  )  [inline, inherited]
 

Reimplemented in Mac802_11.

Definition at line 181 of file mac.h.

References Mac::bandwidth_.

Referenced by MacCsma::endofContention(), MultihopMac::send(), UnslottedAlohaMac::sendDown(), SatMac::sendDown(), Mac::sendDown(), and Mac802_3::transmit().

00181                                         {
00182                 return (8. * bytes / bandwidth_);
00183         }

double SMAC::txtime Packet p  )  [private]
 

Reimplemented from Mac.

Definition at line 1629 of file smac.cc.

References ACK_PKT, CLKTICK2SEC, CTS_PKT, DATA_PKT, durCtrlPkt_, durDataPkt_, HDR_SMAC, RTS_PKT, sh, SYNC_PKT, and SYNCPKTTIME.

Referenced by capture(), collision(), recv(), and transmit().

01630 {
01631   struct hdr_smac *sh = HDR_SMAC(p);
01632 
01633   switch(sh->type) {
01634   
01635   case DATA_PKT:
01636     return durDataPkt_;
01637     
01638   case RTS_PKT:
01639   case CTS_PKT:
01640   case ACK_PKT:
01641     return durCtrlPkt_;
01642   case SYNC_PKT:
01643     return CLKTICK2SEC(SYNCPKTTIME);
01644   default:
01645     fprintf(stderr, "invalid smac pkt type %d\n", sh->type);
01646     exit(1);
01647   }
01648   
01649 }

bool SMAC::unicastMsg int  n,
Packet p
[private]
 

Definition at line 1287 of file smac.cc.

References Packet::access(), checkToSend(), DATA_PKT, dataPkt_, hdr_dst(), HDR_SMAC, hdr_src(), neighbList_, NeighbList::nodeId, numNeighb_, hdr_mac::offset_, NeighbList::schedId, schedTab_, sh, SIZEOF_SMAC_DATAPKT, syncFlag_, and txData_.

Referenced by sendMsg().

01287                                              {
01288         //  if (dataPkt != 0 || p == 0)
01289         //return 0;
01290 
01291         assert(p);
01292 
01293         //if (state_ != IDLE && state_ != SLEEP && state_!= WAIT_DATA)
01294         //return 0;
01295 
01296   
01297         char * mh = (char *)p->access(hdr_mac::offset_);
01298         int dst = hdr_dst(mh);
01299         int src = hdr_src(mh);
01300 
01301         // search for schedule of dest node
01302         struct hdr_smac *sh = HDR_SMAC(p);
01303         //int dst = sh->dstAddr;
01304 
01305         if (syncFlag_) {
01306                 int found = 0;
01307                 for (int i=0; i < numNeighb_; i++) {
01308                         if (neighbList_[i].nodeId == dst) {
01309                                 found = 1;
01310                                 schedTab_[neighbList_[i].schedId].txData = 1;
01311                                 break;
01312                         }
01313                 }
01314                 if (found == 0) {
01315                         printf("Neighbor unknown; cannot send pkt\n");
01316                         return 0;  // unknown neighbor
01317                 }
01318         }
01319 
01320         sh->type = DATA_PKT;
01321         sh->length = SIZEOF_SMAC_DATAPKT;
01322         sh->dstAddr = dst;
01323         sh->srcAddr = src;
01324         //numFrags_ = numfrags;
01325         dataPkt_ = p;
01326 
01327         if (!syncFlag_) {
01328                 txData_ = 1;
01329     
01330                 // check if can send now
01331                 if (checkToSend())
01332                         return 1;
01333                 else
01334                         return 0;
01335     
01336         } else 
01337                 return 1;
01338 }

Here is the call graph for this function:

void SMAC::updateNav double  duration  )  [private]
 

Definition at line 1603 of file smac.cc.

References Scheduler::clock(), Scheduler::instance(), mhNav_, nav_, and TimerHandler::resched().

Referenced by capture(), handleACK(), handleCTS(), handleDATA(), handleRecvTimer(), and handleRTS().

01603                               {
01604   double now = Scheduler::instance().clock();
01605   // already in sec
01606   // double d = duration * 1.0e-6; // convert to sec
01607 
01608   if ((now + d) > nav_) {
01609     nav_ = now + d;
01610     
01611     mhNav_.resched(d);
01612     
01613   }
01614 }

Here is the call graph for this function:

void SMAC::updateNeighNav double  duration  )  [private]
 

Definition at line 1617 of file smac.cc.

References Scheduler::clock(), Scheduler::instance(), mhNeighNav_, neighNav_, and TimerHandler::resched().

Referenced by handleDATA(), handleGeneTimer(), sentACK(), sentCTS(), and sentDATA().

01617                                    {
01618   double now = Scheduler::instance().clock();
01619   //double d = duration * 1.0e-6; // convert to sec
01620 
01621   if ((now + d) > neighNav_) {
01622     neighNav_ = now + d;
01623 
01624     mhNeighNav_.resched(d);
01625   
01626   }
01627 }

Here is the call graph for this function:

NsObject* BiConnector::uptarget  )  [inline, inherited]
 

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

References BiConnector::uptarget_.

Referenced by SatChannel::find_peer_mac_addr().

00048 { return uptarget_; }

void SMAC::wakeup  )  [private]
 

Definition at line 1588 of file smac.cc.

References IDLE, RADIO_IDLE, RADIO_SLP, radioState_, and state_.

Referenced by checkToSend(), handleCounterTimer(), and handleNavTimer().

01589 {
01590   //wakeup from sleep. turn on radio
01591   state_ = IDLE;
01592   
01593   // since radio can start to recv while in sleep
01594   // it might be in RX state
01595   // and eventually the pkt will not be recvd if in sleep state 
01596   // so careful not to change state of radio unless it is really sleeping
01597   if (radioState_ == RADIO_SLP)
01598     radioState_ = RADIO_IDLE;
01599   //printf("WAKEUP: ............node %d at %.6f\n", index_, Scheduler::instance().clock());
01600 
01601 }


Friends And Related Function Documentation

friend class SmacCounterTimer [friend]
 

Definition at line 347 of file smac.h.

Referenced by SMAC().

friend class SmacCsTimer [friend]
 

Definition at line 346 of file smac.h.

friend class SmacGeneTimer [friend]
 

Definition at line 341 of file smac.h.

friend class SmacNavTimer [friend]
 

Definition at line 344 of file smac.h.

friend class SmacNeighNavTimer [friend]
 

Definition at line 345 of file smac.h.

friend class SmacRecvTimer [friend]
 

Definition at line 342 of file smac.h.

friend class SmacSendTimer [friend]
 

Definition at line 343 of file smac.h.


Member Data Documentation

int Mac::abstract_ [protected, inherited]
 

Definition at line 229 of file mac.h.

Referenced by Mac::Mac(), Mac::sendDown(), and Mac::sendUp().

double Mac::bandwidth_ [protected, inherited]
 

Definition at line 227 of file mac.h.

Referenced by Mac::bandwidth(), Mac::Mac(), Mac802_11::Mac802_11(), UnslottedAlohaMac::sendDown(), SatMac::sendDown(), and Mac::txtime().

double SMAC::byte_tx_time_ [protected]
 

Definition at line 377 of file smac.h.

Referenced by SMAC().

Handler* Mac::callback_ [protected, inherited]
 

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(), sendMsg(), Mac802_3::transmit(), Mac802_11::tx_resume(), and txMsgDone().

Channel* Mac::channel_ [protected, inherited]
 

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

int SMAC::currSched_ [private]
 

Definition at line 513 of file smac.h.

Referenced by handleCounterTimer(), handleCTS(), sentDATA(), sentSYNC(), and setMySched().

int SMAC::cycleTime_ [private]
 

Definition at line 533 of file smac.h.

Referenced by handleCounterTimer(), sendSYNC(), and SMAC().

Packet* SMAC::dataPkt_ [private]
 

Definition at line 518 of file smac.h.

Referenced by bcastMsg(), checkToSend(), handleACK(), handleCounterTimer(), handleCsTimer(), handleGeneTimer(), sendDATA(), sentDATA(), SMAC(), startBcast(), startUcast(), and unicastMsg().

int SMAC::dataTime_ [private]
 

Definition at line 530 of file smac.h.

Referenced by handleCounterTimer(), and SMAC().

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(), RedPDQueue::enque(), PushbackQueue::enque(), NsObject::isdebug(), NsObject::NsObject(), TfrcAgent::recv(), PushbackQueue::reportDrop(), and REDQueue::reset().

double Mac::delay_ [protected, inherited]
 

Definition at line 228 of file mac.h.

Referenced by UnslottedAlohaMac::end_of_contention(), Mac::Mac(), MultihopMac::recv(), SatMac::sendUp(), and Mac::sendUp().

double SMAC::difs_ [protected]
 

Definition at line 373 of file smac.h.

Referenced by checkToSend(), handleCounterTimer(), and SMAC().

NsObject* BiConnector::downtarget_ [protected, inherited]
 

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

Referenced by Phy::command(), BiConnector::command(), BiConnector::downtarget(), WirelessPhy::initialized(), WiredPhy::initialized(), initialized(), Mac::initialized(), FECModel::recv(), MacTdma::send(), UnslottedAlohaMac::sendDown(), SatMac::sendDown(), Mac::sendDown(), BiConnector::sendDown(), transmit(), and Mac802_3::transmit().

NsObject* BiConnector::drop_ [protected, inherited]
 

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

Referenced by BiConnector::command(), and BiConnector::drop().

double SMAC::durCtrlPkt_ [private]
 

Definition at line 505 of file smac.h.

Referenced by handleGeneTimer(), handleRTS(), sendACK(), sendCTS(), sendDATA(), sendRTS(), SMAC(), and txtime().

double SMAC::durDataPkt_ [private]
 

Definition at line 504 of file smac.h.

Referenced by handleGeneTimer(), handleRTS(), sendRTS(), SMAC(), and txtime().

double SMAC::durSyncPkt_ [private]
 

Definition at line 503 of file smac.h.

Referenced by SMAC().

double SMAC::eifs_ [protected]
 

Definition at line 375 of file smac.h.

Referenced by capture(), handleRecvTimer(), and SMAC().

double SMAC::guardTime_ [protected]
 

Definition at line 376 of file smac.h.

Referenced by SMAC().

int SMAC::howToSend_ [private]
 

Definition at line 501 of file smac.h.

Referenced by checkToSend(), handleCounterTimer(), handleCsTimer(), and sentDATA().

MacHandlerResume Mac::hRes_ [protected, inherited]
 

Definition at line 237 of file mac.h.

Referenced by MacCsma::endofContention(), SatMac::sendDown(), and Mac::sendDown().

MacHandlerSend Mac::hSend_ [protected, inherited]
 

Definition at line 238 of file mac.h.

Referenced by MacCsmaCd::endofContention(), MacCsmaCa::send(), and MacCsma::send().

int Mac::index_ [protected, inherited]
 

Definition at line 226 of file mac.h.

Referenced by Mac::addr(), Mac802_11::discard(), drop_CTS(), drop_DATA(), drop_RTS(), MacTdma::dump(), Mac802_11::dump(), UnslottedAlohaMac::end_of_contention(), handleACK(), handleCTS(), handleDATA(), handleGeneTimer(), handleRTS(), handleSYNC(), Mac::Mac(), MacTdma::re_schedule(), recv(), Mac::recv(), Mac802_3::recv_complete(), Mac802_11::recv_timer(), MacTdma::recvHandler(), MacTdma::send(), sendACK(), sendCTS(), sendRTS(), Mac802_11::sendRTS(), sendSYNC(), UnslottedAlohaMac::sendUp(), SatMac::sendUp(), Mac::sendUp(), MacTdma::sendUp(), setMySched(), MacTdma::slotHandler(), MacTdma::trace_pkt(), Mac802_11::trace_pkt(), and Mac802_3::transmit().

Event Mac::intr_ [protected, inherited]
 

Definition at line 239 of file mac.h.

Referenced by MacTdma::MacTdma(), Mac::resume(), MacCsma::resume(), MultihopMac::send(), SatMac::sendDown(), and Mac::sendDown().

int SMAC::lastRxFrag_ [private]
 

Definition at line 499 of file smac.h.

Referenced by handleDATA(), handleRTS(), and SMAC().

int SMAC::listenTime_ [private]
 

Definition at line 531 of file smac.h.

Referenced by handleCounterTimer(), setMySched(), and SMAC().

LL* Mac::ll_ [protected, inherited]
 

Definition at line 233 of file mac.h.

NsObject* SMAC::logtarget_ [private]
 

Reimplemented from Mac.

Definition at line 468 of file smac.h.

Referenced by command(), and mac_log().

int SMAC::mac_collision_ [private]
 

Definition at line 474 of file smac.h.

Referenced by collision(), handleRecvTimer(), and SMAC().

SmacCounterTimer* SMAC::mhCounter_[SMAC_MAX_NUM_SCHEDULES] [private]
 

Definition at line 492 of file smac.h.

Referenced by handleCounterTimer(), handleSYNC(), sendSYNC(), setMySched(), SMAC(), and ~SMAC().

SmacCsTimer SMAC::mhCS_ [private]
 

Definition at line 488 of file smac.h.

Referenced by checkToSend(), handleCounterTimer(), and recv().

SmacGeneTimer SMAC::mhGene_ [private]
 

Definition at line 487 of file smac.h.

Referenced by handleACK(), handleCTS(), handleSYNC(), sentDATA(), sentRTS(), and SMAC().

SmacNavTimer SMAC::mhNav_ [private]
 

Definition at line 483 of file smac.h.

Referenced by checkToSend(), handleCounterTimer(), and updateNav().

SmacNeighNavTimer SMAC::mhNeighNav_ [private]
 

Definition at line 484 of file smac.h.

Referenced by checkToSend(), handleCounterTimer(), and updateNeighNav().

SmacRecvTimer SMAC::mhRecv_ [private]
 

Definition at line 486 of file smac.h.

Referenced by collision(), and recv().

SmacSendTimer SMAC::mhSend_ [private]
 

Definition at line 485 of file smac.h.

Referenced by transmit().

int SMAC::mySyncNode_ [private]
 

Definition at line 511 of file smac.h.

Referenced by sendSYNC(), and setMySched().

double SMAC::nav_ [private]
 

Definition at line 479 of file smac.h.

Referenced by handleNavTimer(), handleRTS(), SMAC(), and updateNav().

struct NeighbList SMAC::neighbList_[SMAC_MAX_NUM_NEIGHBORS] [private]
 

Definition at line 509 of file smac.h.

Referenced by handleSYNC(), setMySched(), and unicastMsg().

double SMAC::neighNav_ [private]
 

Definition at line 480 of file smac.h.

Referenced by handleGeneTimer(), handleNeighNavTimer(), SMAC(), and updateNeighNav().

Phy* Mac::netif_ [protected, inherited]
 

Definition at line 231 of file mac.h.

Referenced by Mac802_3::collision(), Mac::command(), Mac8023HandlerSend::handle(), 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().

int SMAC::numBcast_ [private]
 

Definition at line 516 of file smac.h.

Referenced by bcastMsg(), and sentDATA().

int SMAC::numExtend_ [private]
 

Definition at line 496 of file smac.h.

Referenced by handleGeneTimer(), SMAC(), and startUcast().

int SMAC::numNeighb_ [private]
 

Definition at line 515 of file smac.h.

Referenced by handleSYNC(), setMySched(), SMAC(), and unicastMsg().

int SMAC::numRetry_ [private]
 

Definition at line 495 of file smac.h.

Referenced by handleGeneTimer(), SMAC(), and startUcast().

int SMAC::numSched_ [private]
 

Definition at line 514 of file smac.h.

Referenced by bcastMsg(), handleGeneTimer(), handleSYNC(), setMySched(), and SMAC().

Packet* SMAC::pktRx_ [private]
 

Reimplemented from Mac.

Definition at line 519 of file smac.h.

Referenced by collision(), handleRecvTimer(), recv(), and SMAC().

Packet* SMAC::pktTx_ [private]
 

Reimplemented from Mac.

Definition at line 520 of file smac.h.

Referenced by handleGeneTimer(), handleSendTimer(), SMAC(), and transmit().

int SMAC::radioState_ [private]
 

Definition at line 472 of file smac.h.

Referenced by checkToSend(), chkRadio(), handleCounterTimer(), handleRecvTimer(), handleSendTimer(), recv(), sleep(), SMAC(), transmit(), and wakeup().

int SMAC::recvAddr_ [private]
 

Definition at line 477 of file smac.h.

Referenced by handleDATA(), handleRTS(), sendACK(), sendCTS(), and SMAC().

struct SchedTable SMAC::schedTab_[SMAC_MAX_NUM_SCHEDULES] [private]
 

Definition at line 508 of file smac.h.

Referenced by bcastMsg(), handleCounterTimer(), handleCTS(), handleSYNC(), sentDATA(), sentSYNC(), setMySched(), and unicastMsg().

int SMAC::sendAddr_ [private]
 

Definition at line 476 of file smac.h.

Referenced by handleACK(), handleCTS(), sendRTS(), SMAC(), and startUcast().

double SMAC::sifs_ [protected]
 

Definition at line 374 of file smac.h.

Referenced by SMAC().

int SMAC::sleepTime_ [private]
 

Definition at line 532 of file smac.h.

Referenced by handleCounterTimer(), and SMAC().

double SMAC::slotTime_ [protected]
 

Definition at line 371 of file smac.h.

Referenced by SMAC().

double SMAC::slotTime_sec_ [protected]
 

Definition at line 372 of file smac.h.

Referenced by checkToSend(), handleCounterTimer(), and SMAC().

int SMAC::state_ [private]
 

Reimplemented from Mac.

Definition at line 471 of file smac.h.

Referenced by checkToSend(), handleACK(), handleCounterTimer(), handleCsTimer(), handleCTS(), handleDATA(), handleGeneTimer(), handleNavTimer(), handleNeighNavTimer(), handleRecvTimer(), handleRTS(), handleSYNC(), recv(), sentDATA(), setMySched(), sleep(), SMAC(), startUcast(), and wakeup().

int SMAC::syncFlag_ [private]
 

Definition at line 526 of file smac.h.

Referenced by bcastMsg(), handleCTS(), handleDATA(), handleGeneTimer(), handleNavTimer(), handleNeighNavTimer(), rxMsgDone(), sentDATA(), SMAC(), txMsgDone(), and unicastMsg().

int SMAC::syncTime_ [private]
 

Definition at line 529 of file smac.h.

Referenced by handleCounterTimer(), and SMAC().

Tap* Mac::tap_ [protected, inherited]
 

Definition at line 232 of file mac.h.

Referenced by Mac::installTap(), and Mac802_11::recv_timer().

double SMAC::timeWaitCtrl_ [private]
 

Definition at line 506 of file smac.h.

Referenced by sentDATA(), sentRTS(), and SMAC().

int SMAC::tx_active_ [private]
 

Definition at line 473 of file smac.h.

Referenced by handleSendTimer(), recv(), SMAC(), and transmit().

int SMAC::txData_ [private]
 

Definition at line 524 of file smac.h.

Referenced by bcastMsg(), checkToSend(), handleCTS(), sentDATA(), SMAC(), and unicastMsg().

NsObject* BiConnector::uptarget_ [protected, inherited]
 

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

Referenced by BiConnector::command(), Phy::dump(), UnslottedAlohaMac::end_of_contention(), WirelessPhy::initialized(), WiredPhy::initialized(), initialized(), Mac::initialized(), God::initialized(), RepeaterPhy::recv(), Phy::recv(), FECModel::recv(), Mac802_3::recv_complete(), MacTdma::recvDATA(), Mac802_11::recvDATA(), rxMsgDone(), SatMac::sendUp(), Mac::sendUp(), BiConnector::sendUp(), and BiConnector::uptarget().


The documentation for this class was generated from the following files:
Generated on Tue Apr 20 13:23:59 2004 for NS2.26SourcesOriginal by doxygen 1.3.3