亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mac80211.cc

?? 基于omnet++開發的Mf框架下的802.11協議仿真。
?? CC
?? 第 1 頁 / 共 2 頁
字號:
/***	Handle the time out timer. Called by HandleTimer(cMessage**	msg)**/void Mac80211::handleTimeOutTimer(){    //if (state == WFCTS || state == WFACK) retryCounter++;    //if there's a packet to send and if the channel is free then  //start a new contension period  if (state != QUIET) beginNewCycle();  }  /***	Handle the end sifs timer. Then sends a CTS, a DATA, or an ACK*	frame**/void Mac80211::handleEndSifsTimer(){  Mac80211Pkt* frame = (Mac80211Pkt*) endSifs->contextPointer();    switch (frame->kind()){  case RTS:    sendCTSframe(frame);    break;  case CTS:    sendDATAframe();    break;  case DATA:    sendACKframe(frame);    break;  default :    error ("end sifs timer with previous received packet != RTS, CTS, or DATA");  }    //don't need previous frame any more  delete frame;}/***	Handle the end of transmission timer (end of the transmission*	of an ACK or a broadcast packet). Called by*	HandleTimer(cMessage* msg)**/void Mac80211::handleEndTransmissionTimer(){  EV <<"transmission of ACK/BROADCAST is over\n";  if (state == BUSY)        //if thre's a packet to send and if the channel is free then start a new contension period    beginNewCycle();  else     error("expiration of the end_transmission timer outside the BUSY state ... should not happen");}/** *	Send a DATA frame. Called by HandleEndSifsTimer() or *	handleEndContensionTimer() **/void Mac80211::sendDATAframe(){  //schedule time out  scheduleAt(simTime() + timeOut(DATA, 0), timeout);     if(!rtsCts)    //retryCounter incremented    retryCounter++;    //send DATA frame    sendDown(buildDATAframe());  energyConsumption += txEnergy*(buildDATAframe())->length()/(double)par("bitrate");   //update state and display  state = WFACK;  //updateDisplay(WFACK);}/***	Send an ACK frame.Called by HandleEndSifsTimer()**/void Mac80211::sendACKframe( Mac80211Pkt* af ){  //the MAC must wait the end of the transmission before beginning an  //other contension period  scheduleAt(simTime() +packetDuration(LENGTH_ACK) + delta, endTransmission );    //send ACK frame  sendDown(buildACKframe(af));  energyConsumption += txEnergy*(buildACKframe(af))->length()/(double)par("bitrate");   EV <<"sent ACK frame!\n";  //update state and display  state = BUSY;  //  updateDisplay(BUSY);}/***	Send a RTS frame.Called by handleContentionTimer()**/void Mac80211::sendRTSframe(){      //schedule time-out  scheduleAt(simTime() + timeOut(RTS, 0), timeout);    //long_retry_counter incremented  retryCounter++;    //send RTS frame  sendDown(buildRTSframe());  energyConsumption += txEnergy*(buildRTSframe())->length()/(double)par("bitrate");   //update state and display  state = WFCTS;  //updateDisplay(WFCTS);??}/***	Send a CTS frame.Called by HandleEndSifsTimer()**/void Mac80211::sendCTSframe( Mac80211Pkt* af ){  //schedule time-out  scheduleAt(simTime() + timeOut(CTS, af->getDuration() ), timeout);    //send CTS frame  sendDown(buildCTSframe(af));  energyConsumption += txEnergy*(buildCTSframe(af))->length()/(double)par("bitrate");   //update state and display  state = WFDATA;  //  updateDisplay(WFDATA);}/***	Send a BROADCAST frame.Called by handleContentionTimer()**/void Mac80211::sendBROADCASTframe( ){  //the MAC must wait the end of the transmission before beginning any  //other contension period  scheduleAt(simTime() + packetDuration( fromUpperLayer.front()->length() ), endTransmission );  //send ACK frame  sendDown(buildBROADCASTframe());  energyConsumption += txEnergy*(buildBROADCASTframe())->length()/(double)par("bitrate");   //update state and display  state = BUSY;  //  updateDisplay(BUSY);}/***	Build a DATA frame. Called by sendDATAframe()**/Mac80211Pkt* Mac80211::buildDATAframe(){  //send a copy of the frame in front of the queue  Mac80211Pkt *frame = (Mac80211Pkt*)(fromUpperLayer.front() )->dup();  frame->setSrcAddr(myMacAddr());  frame->setKind(DATA);  frame->setName("DATA");  if(rtsCts)    frame->setDuration ( SIFS + packetDuration(LENGTH_ACK));  else    frame->setDuration(0);    return(frame);}/***	Build an ACK frame. Called by sendACKframe()**/Mac80211Pkt* Mac80211::buildACKframe( Mac80211Pkt* af ){  Mac80211Pkt* frame = static_cast<Mac80211Pkt *>(createCapsulePkt());  frame->setName("ACK");  frame->setKind(ACK);  frame->setLength(LENGTH_ACK);    //the dest address must be the src adress of the RTS or the DATA  //packet received. The src adress is the adress of the node  frame->setSrcAddr(myMacAddr());  frame->setDestAddr(af->getSrcAddr());  frame->setDuration(0);    return(frame);}/***	Build a RTS frame. Called by sendRTSframe()**/Mac80211Pkt* Mac80211:: buildRTSframe(){  Mac80211Pkt *frame  = new Mac80211Pkt;  frame->setName("RTS");  frame->setKind(RTS);  frame->setLength(LENGTH_RTS);    //the src adress and dest address are copied in the frame in the queue (frame to be sent)  frame->setSrcAddr( ( ( Mac80211Pkt*) fromUpperLayer.front() )->getSrcAddr());  frame->setDestAddr( ( (Mac80211Pkt*) fromUpperLayer.front() )->getDestAddr());  frame->setDuration ( 3*SIFS + packetDuration(LENGTH_CTS) + packetDuration( fromUpperLayer.front()->length() ) +packetDuration(LENGTH_ACK));    return(frame);}/***	Build a CTS frame. Called by sendCTSframe()**/Mac80211Pkt* Mac80211::buildCTSframe( Mac80211Pkt* af ){  Mac80211Pkt* frame = new Mac80211Pkt;  frame->setName("CTS");  frame->setKind(CTS);  frame->setLength(LENGTH_CTS);    //the dest adress must be the src adress of the RTS received. The  //src adress is the adress of the node  frame->setSrcAddr(myMacAddr());  frame->setDestAddr(af->getSrcAddr());  frame->setDuration (af->getDuration() - SIFS - packetDuration(LENGTH_CTS));    return(frame);}/***	Build a BROADCAST frame. Called sendBROADCASTframe()**/Mac80211Pkt* Mac80211:: buildBROADCASTframe( ){  //send a copy of the frame in front of the queue  Mac80211Pkt *frame = (Mac80211Pkt*)(fromUpperLayer.front())->dup();  frame->setKind(BROADCAST);  frame->setName("BROADCAST");    return(frame);}/***	Start a new contension period if the channel is free and if*	there's a packet to send.  Called at the end of a deferring*	period, a busy period, or after a failure. Called by the*	HandleMsgForMe(), HandleTimer() HandleUpperMsg(), and, without*	RTS/CTS, by handleMsgNotForMe().**/void Mac80211::beginNewCycle(){  //before trying to send one more time a packet, test if the  //maximum retry limit is reached. If it is the case, then  //delete the packet and send the next packet.    testMaxAttempts();    if (!fromUpperLayer.empty()) {        //look if the next packet is unicast or broadcast    nextIsBroadcast = ( ( (Mac80211Pkt*) fromUpperLayer.front() )->getDestAddr() == BROADCAST_ADDRESS);        //    print("next is broadcast = "<<nextIsBroadcast);        //if the channel is free then wait a random time and transmit    if((static_cast<const RadioState *>(bbRs->data()))->getState()==RadioState::IDLE){      //if channel is idle AND I was not the last one that transmitted      //data: no backoff      if(tryWithoutBackoff){		EV <<"trying to send without backoff...\n";		scheduleAt(simTime() + DIFS, contension);		energyConsumption += idleEnergy*DIFS;      }      else{   // backoff!		scheduleAt(simTime() + backoff() + DIFS, contension);		energyConsumption += idleEnergy*(backoff() + DIFS);      }    }    tryWithoutBackoff=false;        //else wait until the channel is free    //the state is now contend    state = CONTEND;    EV <<"Now in State: "<<state<<endl;    //updateDisplay(CONTEND);  }  else {    tryWithoutBackoff=false;    state = IDLE;    EV <<"Now in state: "<<state<<endl;    idleTimeStamp=simTime();    findHost()->displayString().setTagArg("i",1,"yellow");          }}/** *	Compute the backoff value. **/double Mac80211::backoff(){  //the MAC has won the previous contension. We have to compute a new  //backoff window  if (BW == 0)     BW = ((double)intrand(CW()+1)) * ST;  //CW is the contention window (see the function). ST is the  //slot time.  else we take the old value of BW, in order to give a  //bigger priority to a node which has lost a previous contension  //period.  EV <<"backing off for: "<<BW+DIFS<<endl;  return(BW);}/***	Compute the contention window with the binary backoff*	algorithm.  Use the variable counter (attempts to transmit*	packet), the constant values CWmax (contention window maximum)*	and m (parameter for the initial backoff window, usally m=7).*	Called by backoff()**/int Mac80211::CW(){  //the next packet is an unicast packet  if (!nextIsBroadcast){    int cw;    cw = (CW_MIN+1) * (unsigned int) pow(2.0, (int) retryCounter) - 1;    //return the calculated value or CWmax if the maximal value is reached    if (cw <= CW_MAX) return (cw);    else return (CW_MAX);  }    //the next packet is broadcast : the contension window must be maximal  else return (broadcastBackoff);}/*** 	Test if the maximal retry limit is reached, and delete the* 	frame to send in this case.**/void Mac80211::testMaxAttempts(){   //reCounter++;  if (retryCounter > retryLimit) {        //initialize counter        retryCounter = 1;    //reportLost(fromUpperLayer.front());    //\todo publish on Blackboard        //delete the frame to transmit    Mac80211Pkt* temp = fromUpperLayer.front();    fromUpperLayer.pop_front();    delete(temp);  }}/** * Handle messages from the blackboard. In this layer it is usally * information about the channel, i.e. if it is IDLE etc. **/bool Mac80211::blackboardItemChanged( BBItemRef bbItem){  Enter_Method("blackboardItemChanged(\"%s\")", bbItem->label());  // check whether item was already handled by parent module  if( BasicMacLayer::blackboardItemChanged( bbItem ) ){    EV <<"bbItem handled by parent class -> return\n";    return true;  }  if( bbRs == bbItem ){    EV <<"In blackboardItemChanged() I have to handle item!\n";    //beginning of a reception    if ((static_cast<const RadioState *>(bbRs->data()))->getState()==RadioState::RECV){            EV <<"Carrier Sense: receiving!\n";      phy_receiving = true; //is it needed?            //if there's a contention period      if (contension->isScheduled()){	//update the backoff window in order to give higher priority in	//the next battle	if(simTime()-contension->sendingTime()>=DIFS){	  BW = contension->arrivalTime() - simTime();	  EV <<"Backoff window made smaller, new BW: "<<BW<<endl;	}	cancelEvent( contension );      }            //if there's a SIFS period      if(endSifs->isScheduled() ){	//delete the previously received frame	delete ( (Mac80211Pkt*) endSifs->contextPointer());		//cancel the next transmission	cancelEvent(endSifs);		//state in now IDLE or CONTEND	if (fromUpperLayer.empty())	  state = IDLE;	else	  state = CONTEND;      }    }        EV <<"now state: "<<state<<endl;    // item was handeled -> return true    return true;  } // end if( bbRs == bbItem )  // item not interesting for me  EV <<"item "<<bbItem->label()<<" not for me, let derived module handle it\n";  return false;  }/***	Return a time-out value for a type of frame. Called by*	SendRTSframe, sendCTSframe, etc.**/double Mac80211::timeOut(_802_11frameType type, double last_frame_duration){  double time_out = 0;  switch (type){  case RTS :    time_out = SIFS + packetDuration(LENGTH_RTS) + packetDuration(LENGTH_CTS) + delta;    break;  case CTS :    time_out = last_frame_duration - packetDuration(LENGTH_ACK) - 2*SIFS + delta;    break;  case DATA :    time_out = SIFS + packetDuration( fromUpperLayer.front()->length() ) + packetDuration(LENGTH_ACK) + delta;    break;  default :    EV <<"Unused frame type was given when calling timeOut(), this should not happen!\n";  }  return(time_out);}/** * Computes the duration of the transmission of a frame over the * physical channel. 'bits' should be the total length of the MAC * packet in bits. */double Mac80211::packetDuration(int bits) {  return(bits/bitrate+PHY_HEADER_LENGTH/BITRATE_HEADER);}              /** * revised by Yupeng 2006-11-21 14:50 *  *  */ void Mac80211::finish(){	BasicMacLayer::finish();			FILE   *fp;     	fp   =   fopen("c:\\80211Energy.txt","a");     	fprintf(fp,   "%f\r\n",  energyConsumption);     	fclose(fp);  	ev << logName() << "::80211MacLayer: Total energy consumed: " << energyConsumption <<"(mW)" <<endl;	}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人激情av| 国产女人18水真多18精品一级做| 青青草97国产精品免费观看| 欧美变态tickle挠乳网站| 欧美视频自拍偷拍| 欧美日韩一区在线观看| 蜜臀av一区二区在线观看| 日本vs亚洲vs韩国一区三区 | 卡一卡二国产精品 | 欧美一区二区日韩| 成人做爰69片免费看网站| 精品一区二区三区欧美| 韩国成人在线视频| 国产福利91精品一区| 午夜久久电影网| 视频一区二区中文字幕| 美腿丝袜亚洲综合| 国产伦精品一区二区三区免费| 亚洲欧美视频在线观看| 午夜影院在线观看欧美| 麻豆精品视频在线观看免费| 亚洲激情第一区| 婷婷六月综合网| 极品少妇xxxx偷拍精品少妇| 成人h精品动漫一区二区三区| 日本福利一区二区| 欧美一级精品大片| 欧美丰满美乳xxx高潮www| 欧美一区二区三区四区五区| 国产欧美日韩在线看| 一片黄亚洲嫩模| 国产资源在线一区| 91久久人澡人人添人人爽欧美| 粉嫩在线一区二区三区视频| 免费高清在线视频一区·| 亚洲v日本v欧美v久久精品| 久久精品99国产精品日本| 成人国产视频在线观看| 91麻豆精品国产91| 欧美精品色一区二区三区| 色哟哟精品一区| 99精品国产91久久久久久| 国产乱子伦视频一区二区三区 | 一区二区免费在线| 亚洲三级免费观看| 久久成人免费电影| 经典三级一区二区| 狠狠色综合色综合网络| 午夜精品福利久久久| 天天综合天天做天天综合| 成人一区二区三区中文字幕| 不卡高清视频专区| 日韩一二在线观看| 欧美精品一区二区三区视频| 亚洲综合一区二区三区| 不卡视频一二三四| 欧美日韩三级一区| 国产精品高潮久久久久无| 一区二区在线免费| 成人黄色免费短视频| 91蜜桃传媒精品久久久一区二区| 欧美精品一区二区在线观看| 日韩在线卡一卡二| 欧美伊人久久久久久午夜久久久久| 91网上在线视频| 欧美日韩视频一区二区| 亚洲精品欧美综合四区| 99久久久久久| 国产精品嫩草影院av蜜臀| 伊人婷婷欧美激情| 91理论电影在线观看| 国产精品久久久久久久久晋中| 风流少妇一区二区| 欧美人xxxx| 午夜视频在线观看一区二区三区| 在线看日本不卡| 亚洲国产视频一区| 国产99久久久精品| 国产色产综合产在线视频| 亚洲最色的网站| 91在线精品一区二区| 欧美电影精品一区二区| 亚洲三级免费电影| 欧美专区在线观看一区| 久久久久久综合| 国产精品亚洲视频| 欧美一区二区在线免费播放| 日韩精品每日更新| 久久品道一品道久久精品| 国产精品资源在线观看| 在线看一区二区| 麻豆国产欧美一区二区三区| 色综合天天综合网天天狠天天| 精品国产亚洲一区二区三区在线观看 | 欧美日韩精品一区二区三区四区| 亚洲成人资源网| 不卡一卡二卡三乱码免费网站| 亚洲视频一二三| 欧美挠脚心视频网站| 久久99精品久久久| 日韩伦理电影网| 国产一区 二区| 亚洲伦理在线免费看| 91精品国产乱码久久蜜臀| 亚洲一区二区三区激情| 99re6这里只有精品视频在线观看| 亚洲人被黑人高潮完整版| 丁香婷婷深情五月亚洲| 欧美变态tickling挠脚心| 不卡一区在线观看| 国产精品久久久久婷婷| 国产精品1024久久| 亚洲精品在线免费播放| 蜜芽一区二区三区| 欧美浪妇xxxx高跟鞋交| 亚洲一区二区在线免费看| 色久综合一二码| 国产一区二区美女诱惑| 亚洲国产欧美在线| 国产日韩精品一区| 国v精品久久久网| 亚洲一区欧美一区| 欧美日韩不卡在线| 成人午夜碰碰视频| 免费在线观看视频一区| 亚洲一区影音先锋| 欧美一区日韩一区| 91久久久免费一区二区| 亚洲第一福利视频在线| 国产精品久久久久久久久果冻传媒| 欧美高清你懂得| 91久久精品一区二区三| 国产馆精品极品| 国精产品一区一区三区mba桃花| 亚洲综合图片区| 欧美一区二区三区四区在线观看 | 久久疯狂做爰流白浆xx| 亚洲国产综合色| 欧美日韩免费一区二区三区 | 久久精品一区二区三区av| 欧美日韩激情一区二区| 日本va欧美va精品发布| 亚洲一区二区影院| 欧美一级高清片| 欧美一区二区三区免费大片| 国产精品一线二线三线精华| 久久99深爱久久99精品| 国产精品久久久久久久蜜臀| 国产亚洲午夜高清国产拍精品| 精品国产污网站| 欧美一级淫片007| 精品欧美一区二区久久| 欧美tickle裸体挠脚心vk| 91香蕉视频在线| 久久成人麻豆午夜电影| 成人欧美一区二区三区| 亚洲日本免费电影| 日韩视频在线一区二区| 日韩欧美不卡在线观看视频| av电影在线观看一区| 色综合久久久久久久| 欧美日韩国产成人在线91| 风间由美一区二区三区在线观看 | 91精品久久久久久久99蜜桃| 7777女厕盗摄久久久| 日韩欧美国产1| 久久综合九色综合97婷婷| 在线观看国产精品网站| 欧美日韩视频第一区| 欧美成人一区二区三区片免费| 色综合中文字幕国产 | 日韩三级中文字幕| 国产v日产∨综合v精品视频| 91亚洲午夜精品久久久久久| 久久se精品一区二区| 三级亚洲高清视频| 日韩码欧中文字| 国产亲近乱来精品视频| 国产精品九色蝌蚪自拍| 同产精品九九九| 国产高清精品在线| 欧美日韩一级片网站| 99久久99久久精品免费观看| 国产精品综合在线视频| av不卡免费电影| 69久久夜色精品国产69蝌蚪网| 99国产精品久久久久| 欧美另类久久久品| 国产精品伦理一区二区| 日韩国产精品久久| 午夜电影一区二区| 亚洲精品欧美在线| 国产最新精品免费| 狠狠色综合播放一区二区| 色天使久久综合网天天| 91欧美一区二区| 久久久亚洲高清| 人人精品人人爱| 在线观看免费亚洲| 国产日韩v精品一区二区|