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

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

?? mac80211.cc

?? 基于omnet++開發的Mf框架下的802.11協議仿真。
?? CC
?? 第 1 頁 / 共 2 頁
字號:
/*************************************************************************** * file:        Mac80211.cc * * author:      David Raguin / Marc L鯾bers * * copyright:   (C) 2004 Telecommunication Networks Group (TKN) at *              Technische Universitaet Berlin, Germany. * *              This program is free software; you can redistribute it  *              and/or modify it under the terms of the GNU General Public  *              License as published by the Free Software Foundation; either *              version 2 of the License, or (at your option) any later  *              version. *              For further information see file COPYING  *              in the top level directory *************************************************************************** * part of:     framework implementation developed by tkn * description: MAC layer for 802.11b * *************************************************************************** * changelog:   $Revision$ *              last modified:   $Date: 2005-01-15 21:52:51 +0100 (Sat, 15 Jan 2005) $ *              by:              $Author: koepke $ **************************************************************************/#include "Mac80211.h"#include "RadioState.h"#define EV (ev.disabled()||!debug) ? (std::ostream&)ev : ev << logName() << "::Mac80211: "Define_Module( Mac80211 );/** * First we have to initialize the module from which we derived ours, * in this case BasicMacLayer. Besides some parameters are set or read * in from omnetpp.ini * * **/void Mac80211::initialize(int stage){  BasicMacLayer::initialize(stage);  if(stage==0){  	txEnergy=(double)par("txEnergy");  	rxEnergy=(double)par("rxEnergy");  	idleEnergy=(double)par("idleEnergy");  	energyConsumption=0;  	reCounter=0;  	WATCH(reCounter);  	idleTimeStamp=simTime();  	retryLimit=(int)par("retryLimit"); // MAX RETRY TIMES  	    EV <<"Initializing stage 0\n";    headerLength=272;//has to be 272, including final CRC-field; this    //makes sure it is!    maxQueueSize=par("maxQueueSize");    //timers    timeout = new cMessage( "timeout", TIMEOUT);    nav = new cMessage("NAV", NAV);    contension = new cMessage("contension", CONTENSION);    endTransmission = new cMessage ("transmission", END_TRANSMISSION);    endSifs = new cMessage("end SIFS", END_SIFS);        BW = 0;    state = IDLE;    retryCounter = 1; //retry counter    WATCH(retryCounter);        broadcastBackoff=par("broadcastBackoff");    rtsCts=par("rtsCts");    bitrate=par("bitrate");    delta = 1E-9;    WATCH_PTRLIST(fromUpperLayer);// revised by Yupeng      EIFS = SIFS +  DIFS + packetDuration(LENGTH_ACK);    EV <<"SIFS: "<<SIFS<<" DIFS: "<<DIFS<<" EIFS: "<<EIFS<<endl;  }  else{    EV <<"initializing stage 1\n";    //subscribe for the information of the carrier sense    bbRs=blackboard()->subscribe( this, "RadioState");  }}/** * This implementation does not support fragmentation, so it is tested * if the maximum length of the MPDU is exceeded. **/void Mac80211::handleUpperMsg(MacPkt *ma){  Mac80211Pkt *mac = static_cast<Mac80211Pkt *>(ma);  if(mac->encapsulatedMsg()->length()>18496)    error("Network Packet is too long for 802.11b! Fragmentation is not supported yet!!");  EV <<"Got upper msg! STATE:"<<state<<endl;  if ((int)fromUpperLayer.size() < maxQueueSize){    fromUpperLayer.push_back(mac);    //If the MAC is in the IDLE state, then start a new contension period    if ( state == IDLE && !endSifs->isScheduled() ) {      tryWithoutBackoff=true;      beginNewCycle();    }  }  else{    delete mac;    EV <<"Mac Queue is full; packet was deleted!\n";    }}/***  Handle all messages from lower layer. Checks the destination MAC*  adress of the packet. Then calls one of the three functions :*  handleMsgNotForMe(MacawFrame *af), handleBroadcastMsg(MacawFrame*  *af), or handleMsgForMe(MacawFrame *af). Called by*  handleMessage(cMessage* msg).**/void Mac80211::handleLowerMsg(MacPkt *mac){  Mac80211Pkt *af = static_cast<Mac80211Pkt *>(mac);  //end of the reception  phy_receiving=false;//<- probably not needed anymore...  EV <<"frame received\n";    switch ( af->kind() ){    //packet lost or bit error  case COLLISION:    delete af;    if (state == CONTEND)      beginNewCycle();    break;      case BITERROR:    handleMsgNotForMe(af);    break;        //broadcast packet!  case BROADCAST:    handleBroadcastMsg(af);    break;        //other packets  default:    if (af->getDestAddr() != myMacAddr() )      handleMsgNotForMe(af);    else      handleMsgForMe(af);  }}/** handle Timer*/void Mac80211::handleSelfMsg(cMessage *msg){    switch (msg->kind()) {  case END_SIFS:    handleEndSifsTimer();//noch zu betrachten    break;      case END_TRANSMISSION:    handleEndTransmissionTimer();//noch zu betrachten    break;      case CONTENSION:    handleEndContensionTimer();    break;        //the MAC was waiting for a CTS, a DATA, or an ACK packet but the timer has expired.  case TIMEOUT:        handleTimeOutTimer();//noch zu betrachten..    break;        //the MAC was waiting because an other communication had won the channel. This communication is now over  case NAV:    handleNavTimer();//noch zu betrachten...    break;      default:    error("unknown timer type");  }  }/***	Handle all ACKs,RTS, CTS, or DATA not for the node. If RTS/CTS*	is used the node must stay quiet until the current handshake*	between the two communicating nodes is over.  This is done by*	scheduling the timer message nav (Network Allocation Vector).*	Without RTS/CTS a new contension is started. If an error*	occured the node must defer for EIFS.  Called by*	handleLowerMsg(MacPkt *af)**/void Mac80211::handleMsgNotForMe(Mac80211Pkt *af){  EV <<"handle msg not for me\n";    //if this packet  can not be correctly read  if (af->kind() == BITERROR)    af->setDuration( EIFS );    //if the duration of the packet is null, then do nothing (to avoid  //the unuseful scheduling of a self message)  if (af->getDuration() != 0) {        //the node is already deferring    if (state == QUIET){      //the current value of the NAV is not sufficient      if (nav->arrivalTime() < simTime() + af->getDuration() ){	  	cancelEvent( nav);		scheduleAt(simTime() + af->getDuration(), nav);		energyConsumption += idleEnergy*af->getDuration(); // revised by Yupeng		EV <<"NAV timer started for: "<<af->getDuration()<<" State QUIET\n";      }    }        //other states    else{      //if the MAC wait for another frame, it can delete its time out      //(exchange is aborted)      if (timeout->isScheduled() )	  cancelEvent(timeout);            //is state == WFCTS or WFACK, the data transfer has failed ...            //the node must defer for the time of the transmission      scheduleAt(simTime() + af->getDuration(), nav);      energyConsumption += idleEnergy*af->getDuration(); // revised by Yupeng      EV <<"NAV timerStartetd, not QUIET: "<<af->getDuration()<<endl;      state = QUIET;    }  }  if(!rtsCts){ //todo: Nachgucken: was passiert bei Error ohne rtsCts!    if(state==CONTEND){      if(af->kind()==BITERROR){		if(contension->isScheduled())	  	cancelEvent(contension);	  	scheduleAt(simTime()+backoff()+EIFS,contension);	  	energyConsumption += idleEnergy*(backoff()+EIFS); 	      }else		beginNewCycle();    }  }  delete af;}/***	Handle a packet for the node. The result of this reception is*	a function of the type of the received message (RTS,CTS,DATA,*	or ACK), and of the current state of the MAC (WFDATA, CONTEND,*	IDLE, WFCTS, or WFACK). Called by handleLowerMsg(MacawFrame*	*af)**/void Mac80211::handleMsgForMe(Mac80211Pkt *af){  EV <<"handle msg for me\n";    switch (state){        //the MAC layer is in CONTEND or IDLE state:waiting for a RTS or    //for the end of the constension period  case IDLE:  case CONTEND:        //if the message is an RTS or DATA    if (af->kind() == RTS)      handleRTSframe(af);    else if(af->kind() == DATA)      handleDATAframe(af);    else      EV <<"in handleMsgForMe() IDLE/CONTED, strange message, darf das?\n";    break;        //the mac layer is waiting for DATA  case WFDATA:        //if the frame is a data frame    if (af->kind() == DATA)      handleDATAframe(af);    else      EV <<"in handleMsgForMe() WFDATA, strange message, darf das?\n";    break;        //the MAC layer is waiting for an ACK  case WFACK:        //if the frame is an ACK    if (af->kind() == ACK)      handleACKframe(af);    else      EV <<"in handleMsgForMe() WFACK, strange message, darf das?\n";    delete af;    break;        //The MAC is waiting for an CTS  case WFCTS:        //if the frame is a CTS    if (af->kind()==CTS)      handleCTSframe(af);    else      EV <<"in handleMsgForMe() WFCTS, strange message, darf das?\n";    break;        //the node is currently deferring. Can not handle any packet with    //its MAC adress  case QUIET:    delete af;      break;        //node currently transmitting an ACK or a BROADCAST packet  case BUSY:    EV <<"ERROR: user error shown in window, myId:"<<parentModule()->id()<<endl;    error("node currently transmitting ... can not receive ... does the physical layer correctly its job?..in handleMsgForMe case BUSY!");    break;      default:     error("unkown state in the mac layer");  }}/***	Handle aframe wich is expected to be an RTS. Called by*	HandleMsgForMe(MacawFrame* af)**/void Mac80211::handleRTSframe(Mac80211Pkt* af){  findHost()->displayString().setTagArg("i",1,"green");   energyConsumption += idleEnergy*(simTime()-idleTimeStamp); // idle time for waiting RTS  //wait a short interframe space  endSifs->setContextPointer(af);  scheduleAt(simTime() + SIFS, endSifs);  energyConsumption += rxEnergy*af->length()/(double)par("bitrate");  energyConsumption += idleEnergy*SIFS;}/***	Handle a frame which expected to be a DATA frame. Called by*	HandleMsgForMe(MAcawFrame* af)**/void Mac80211::handleDATAframe(Mac80211Pkt* af){  if(rtsCts)    //cancel time-out event    cancelEvent( timeout );    //make a copy  Mac80211Pkt* copy = (Mac80211Pkt*) af->dup();    //pass the packet to the upper layer  sendUp(af);  energyConsumption += rxEnergy*af->length()/(double)par("bitrate");   //wait a short interframe space  endSifs->setContextPointer(copy);  scheduleAt(simTime() + SIFS, endSifs);  energyConsumption += idleEnergy*SIFS;}/***	Handle a frame which is expected to be an ACK.Called by*	HandleMsgForMe(MAcawFrame* af)**/void Mac80211::handleACKframe(Mac80211Pkt* af){  //cancel time-out event  cancelEvent( timeout );    //the the transmission is acknowledged : initialize long_retry_counter  retryCounter = 1;    //removes the acknowledged packet from the queue  Mac80211Pkt* temp = fromUpperLayer.front();  fromUpperLayer.pop_front();  delete temp;    //if thre's a packet to send and if the channel is free then start a new contension period  beginNewCycle();}/***	Handle a CTS frame. Called by HandleMsgForMe(Mac80211Pkt* af)**/void Mac80211::handleCTSframe(Mac80211Pkt* af){  //cancel time-out event  cancelEvent( timeout );    //wait a short interframe space  endSifs->setContextPointer(af);  scheduleAt(simTime() + SIFS, endSifs);  energyConsumption += rxEnergy*af->getDuration();  energyConsumption += idleEnergy*SIFS;}/** *	Handle a broadcast packet. This packet is simply passed to the *	upper layer. No acknowledgement is needed.  Called by *	handleLowerMsg(MacawFrame *af)**/void Mac80211::handleBroadcastMsg(Mac80211Pkt *af){  EV <<"handle broadcast\n";  if (state == BUSY)    error("node currently transmitting ... can not receive ... does the physical layer correctly its job?,...in handleBroadcastMsg()");  else {    sendUp( af );    energyConsumption += rxEnergy*af->length()/(double)par("bitrate");     if (state == CONTEND)      beginNewCycle();  }}/** *  The node has won the contension, and is now allowed to send an *  RTS/DATA or Broadcast packet. The backoff value is deleted and *  will be newly computed in the next contension period */void Mac80211::handleEndContensionTimer(){  if (state == CONTEND){        //the node has won the channell, the backof window is deleted and    //will be new calculated in the next contension period    BW = 0;    //unicast packet    if (!nextIsBroadcast){      if(rtsCts){		//send a RTS		sendRTSframe();		state=WFCTS;		//updateDisplay(WFCTS);      }else{		sendDATAframe();		state=WFACK;      }                //broadcast packet    }else{      sendBROADCASTframe();            //removes the packet from the queue without waiting for an acknowledgement      Mac80211Pkt* temp = fromUpperLayer.front();      fromUpperLayer.pop_front();      delete(temp);    }  }  else     error("expiration of the contension timer outside of CONTEND state... should not happen");  }  /***	Handle the NAV timer (end of a defering period). Called by*	HandleTimer(cMessage* msg)**/void Mac80211::handleNavTimer(){  if (state == QUIET)        //if there's a packet to send and if the channel is free then    //start a new contension period    beginNewCycle();    else     error("expiration of the NAV timer outside of the state QUIET ...should not happen");}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美综合色| 日日夜夜免费精品视频| 日韩制服丝袜av| 成人黄色一级视频| 欧美大胆一级视频| 一区二区三区资源| 成人午夜av电影| 欧美成人伊人久久综合网| 一二三区精品视频| www.亚洲精品| 久久免费美女视频| 琪琪久久久久日韩精品| 色噜噜狠狠色综合中国| 国产精品色一区二区三区| 免费视频最近日韩| 9191久久久久久久久久久| 亚洲精品免费在线| 福利一区福利二区| 国产欧美一区二区三区鸳鸯浴| 天天操天天干天天综合网| 97久久精品人人澡人人爽| 欧美激情综合在线| 国产精品一区二区三区99| 欧美mv和日韩mv国产网站| 日韩国产在线一| 欧美日韩精品电影| 亚洲成人av在线电影| 欧美伊人精品成人久久综合97| 国产精品电影一区二区三区| 国产美女一区二区三区| 精品999在线播放| 国产一区二区在线免费观看| 欧美成人精品高清在线播放| 乱一区二区av| 精品国产3级a| 国产超碰在线一区| 国产精品久久久爽爽爽麻豆色哟哟| 国产成人午夜精品影院观看视频| 久久久精品欧美丰满| 国产精品77777| 中文字幕亚洲在| 丰满白嫩尤物一区二区| 国产精品蜜臀av| 一本久道中文字幕精品亚洲嫩 | 久久99久久久久久久久久久| 91精品国模一区二区三区| 日本免费在线视频不卡一不卡二| 在线播放中文一区| 国产一区在线观看视频| 国产日韩欧美精品在线| 97久久超碰精品国产| 亚洲国产欧美一区二区三区丁香婷| 欧美午夜一区二区三区| 日韩av中文字幕一区二区三区 | 男女视频一区二区| 久久这里都是精品| 成人av第一页| 亚洲成av人片在线观看无码| 日韩精品一区二| 成人h动漫精品一区二区| 亚洲综合一二区| 日韩欧美一二区| 99久久综合精品| 水蜜桃久久夜色精品一区的特点| 26uuu欧美| 色av成人天堂桃色av| 老司机精品视频在线| 中文字幕一区二区三区在线播放 | 亚洲三级电影全部在线观看高清| 欧美性猛交xxxxxx富婆| 激情综合网激情| 亚洲精品国产高清久久伦理二区| 日韩一区二区在线免费观看| 高清国产午夜精品久久久久久| 亚洲国产精品久久艾草纯爱| 久久久www成人免费无遮挡大片 | 欧美一级黄色大片| www.99精品| 麻豆国产一区二区| 亚洲精品伦理在线| 久久免费视频一区| 欧美一区二区日韩| 91在线观看高清| 韩国一区二区在线观看| 性久久久久久久| 亚洲欧美怡红院| 2020国产精品自拍| 欧美肥妇free| 欧美私模裸体表演在线观看| 国产99精品国产| 精品一区精品二区高清| 午夜视黄欧洲亚洲| 亚洲男人天堂一区| 国产精品无人区| 国产日本欧美一区二区| 精品日韩一区二区三区免费视频| 欧美亚洲综合色| 色综合天天综合给合国产| 韩国欧美国产1区| 蜜臀av在线播放一区二区三区| 亚洲综合激情另类小说区| 国产精品免费人成网站| 国产人成一区二区三区影院| 日韩欧美成人激情| 日韩一级免费观看| 欧美日韩成人一区| 欧美人动与zoxxxx乱| 欧美伊人精品成人久久综合97 | 国内不卡的二区三区中文字幕 | 国产精品久久久久久一区二区三区 | 亚洲在线免费播放| 国产精品久久久久久久裸模| 国产日韩av一区| 亚洲国产精品ⅴa在线观看| 2欧美一区二区三区在线观看视频| 日韩免费一区二区三区在线播放| 在线成人高清不卡| 欧美一卡二卡三卡| 欧洲精品在线观看| 69久久99精品久久久久婷婷| 91美女在线看| 一本色道久久综合狠狠躁的推荐| 99国产一区二区三精品乱码| 波多野结衣中文字幕一区二区三区| 国产精品一区二区黑丝| 不卡的av网站| 色婷婷综合久久久久中文| 91成人在线观看喷潮| 欧美日韩专区在线| 日韩一二三区不卡| 久久久久久久久久美女| 国产精品久久久99| 一区二区三区日韩在线观看| 亚洲一区二区三区激情| 青青草成人在线观看| 国产成人在线视频免费播放| 97久久精品人人爽人人爽蜜臀| 91福利视频网站| 欧美一区二区三区白人| 国产日韩视频一区二区三区| 国产精品不卡在线| 亚洲高清免费一级二级三级| 麻豆精品在线看| 丰满亚洲少妇av| 欧美三级中文字幕| 精品成a人在线观看| 中文字幕亚洲成人| 午夜激情一区二区三区| 久久精品国产99久久6| www.视频一区| 欧美一区二区三级| 国产精品美女久久久久高潮| 亚洲一区二区av在线| 韩国v欧美v亚洲v日本v| 97aⅴ精品视频一二三区| 91精品国产综合久久精品麻豆 | 久久久91精品国产一区二区精品 | 久久日韩精品一区二区五区| 《视频一区视频二区| 亚洲va欧美va人人爽午夜| 国产91综合一区在线观看| 欧美视频一区二区三区四区| 久久久国产综合精品女国产盗摄| 亚洲一区二区三区四区在线 | 9色porny自拍视频一区二区| 欧美精品日韩综合在线| 久久精品一区二区三区av| 亚洲一级电影视频| 成人av在线网站| 精品国产伦理网| 亚洲高清免费在线| 91老司机福利 在线| 久久―日本道色综合久久| 天天色图综合网| 一本色道亚洲精品aⅴ| 久久精品亚洲精品国产欧美kt∨| 视频一区视频二区在线观看| 99久久免费精品高清特色大片| 亚洲精品一区二区三区福利| 午夜伊人狠狠久久| 日本高清不卡视频| 国产精品无人区| 国产一区视频在线看| 日韩手机在线导航| 日韩激情在线观看| 欧美日韩一级片网站| 亚洲美女淫视频| 99久久99久久精品免费看蜜桃| 国产婷婷色一区二区三区四区| 日本麻豆一区二区三区视频| 欧美日韩视频专区在线播放| 亚洲精品免费一二三区| 97久久久精品综合88久久| 国产精品久久久久久久岛一牛影视| 精品一区二区免费| 久久精品无码一区二区三区| 国产一区二区毛片| 国产亚洲欧美激情| 国产不卡在线播放| 中文字幕中文字幕一区二区|