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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? mac80211.cc

?? 基于omnet++開發(fā)的Mf框架下的802.11協(xié)議仿真。
?? 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一区二区三区免费野_久草精品视频
亚洲国产视频一区| 色就色 综合激情| 97se亚洲国产综合自在线不卡 | 精品国产不卡一区二区三区| 中文字幕制服丝袜一区二区三区 | 日韩黄色免费电影| 91亚洲精品久久久蜜桃网站| 日韩免费高清电影| 亚洲第一成人在线| 91麻豆自制传媒国产之光| 久久久亚洲精品一区二区三区| 亚洲精品久久嫩草网站秘色| 成人免费高清视频| 欧美电影免费观看高清完整版在| 亚洲一区二区精品视频| av一区二区久久| 国产日产精品一区| 国产乱码一区二区三区| 欧美一二三区在线观看| 日韩黄色在线观看| 欧美三级韩国三级日本三斤| 日韩一区有码在线| a亚洲天堂av| 中文字幕一区在线观看视频| 国产麻豆精品一区二区| 精品久久人人做人人爱| 毛片一区二区三区| 日韩欧美一卡二卡| 男男视频亚洲欧美| 日韩欧美国产一区二区三区| 日韩激情一二三区| 日韩亚洲欧美中文三级| 奇米888四色在线精品| 国产欧美精品一区二区色综合| 91啪九色porn原创视频在线观看| 欧美精品一区二| 激情综合色播激情啊| 蜜臀久久99精品久久久久宅男 | 亚洲国产精品自拍| 成人精品高清在线| 欧美激情综合五月色丁香| 东方欧美亚洲色图在线| 亚洲国产成人一区二区三区| 成人综合在线网站| 亚洲欧美日韩国产综合在线| www.在线成人| 亚洲影视资源网| 91.com在线观看| 精品一区二区三区久久久| 久久久久久久性| 成人爱爱电影网址| 一二三区精品视频| 91麻豆精品国产无毒不卡在线观看 | 日韩午夜中文字幕| 国产一区二区0| 国产精品久久久久一区二区三区| 在线视频一区二区三| 日韩不卡一区二区| 国产日韩欧美综合一区| 在线免费一区三区| 久久草av在线| 亚洲色图19p| 91精品国产色综合久久ai换脸| 久久er精品视频| 综合久久综合久久| 日韩女优av电影| 色综合中文字幕| 麻豆免费精品视频| 亚洲天堂中文字幕| 欧美va亚洲va在线观看蝴蝶网| 成人国产精品免费观看| 水野朝阳av一区二区三区| 国产拍欧美日韩视频二区| 欧洲日韩一区二区三区| 国产剧情一区二区三区| 亚洲精品视频观看| 久久综合成人精品亚洲另类欧美| 91小视频免费观看| 国产一区二区三区香蕉| 夜夜精品视频一区二区| 久久久久久久网| 69堂国产成人免费视频| jlzzjlzz欧美大全| 精品亚洲免费视频| 夜夜精品浪潮av一区二区三区| 久久久精品黄色| 欧美一区在线视频| 91黄色激情网站| 成人精品一区二区三区中文字幕| 亚洲一区视频在线| 成人欧美一区二区三区黑人麻豆 | 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 久久97超碰国产精品超碰| 亚洲精品日韩专区silk| 日本一区二区视频在线观看| 日韩欧美亚洲一区二区| 欧美精品成人一区二区三区四区| av一区二区三区| 成人性生交大片| 国产精品资源网站| 国产在线精品视频| 久久福利视频一区二区| 青娱乐精品视频| 天天操天天综合网| 天天色天天操综合| 午夜国产不卡在线观看视频| 亚洲精品免费电影| 中文字幕永久在线不卡| 欧美激情一区三区| 国产精品久久久久一区二区三区| 久久久久久久久久看片| 欧美精品一区二区久久婷婷 | 国产精品麻豆99久久久久久| 精品国产亚洲在线| 精品免费日韩av| 日韩免费高清av| 日韩欧美亚洲国产精品字幕久久久| 在线电影国产精品| 欧美一级黄色录像| 久久午夜羞羞影院免费观看| 日韩三级视频在线看| 日韩一区二区三| wwwwww.欧美系列| 国产欧美综合色| 国产精品另类一区| 亚洲欧美日韩在线播放| 亚洲狠狠爱一区二区三区| 亚洲国产综合在线| 日韩国产高清在线| 久久国产婷婷国产香蕉| 国产精品亚洲成人| 99久久婷婷国产精品综合| 色天天综合久久久久综合片| 欧美肥妇毛茸茸| 久久综合色鬼综合色| 国产欧美一区二区在线| 亚洲情趣在线观看| 日韩成人一级大片| 国产精品小仙女| 91欧美一区二区| 欧美一区二区播放| 国产精品日韩成人| 亚洲无线码一区二区三区| 美女视频一区二区| 94-欧美-setu| 日韩欧美视频一区| 中文字幕字幕中文在线中不卡视频| 亚洲日本在线看| 久久aⅴ国产欧美74aaa| 99视频在线观看一区三区| 欧美日韩你懂得| 国产日韩欧美一区二区三区综合| 樱桃国产成人精品视频| 久久精品噜噜噜成人av农村| www.成人网.com| 日韩一区二区中文字幕| 国产精品免费久久久久| 免费观看在线综合色| 成人激情免费视频| 日韩精品中文字幕一区二区三区 | 视频在线观看一区二区三区| 粉嫩av亚洲一区二区图片| 欧美群妇大交群的观看方式| 国产人妖乱国产精品人妖| 午夜欧美在线一二页| 成人在线视频一区| 日韩欧美成人一区二区| 亚洲一区二区三区中文字幕| 国产精品一卡二卡在线观看| 欧美色综合天天久久综合精品| 久久女同性恋中文字幕| 天天操天天综合网| 日本丰满少妇一区二区三区| 欧美精品一区二区久久婷婷| 香蕉av福利精品导航| av电影天堂一区二区在线 | 亚洲啪啪综合av一区二区三区| 激情综合色综合久久综合| 欧美性猛交xxxx黑人交| 国产精品久久久久四虎| 国产一区二三区| 欧美一区二区三区的| 一区二区不卡在线播放| www.日韩av| 国产夜色精品一区二区av| 美女视频一区二区| 欧美一二三区在线| 日韩国产在线观看一区| 91精品欧美久久久久久动漫| 亚洲人成伊人成综合网小说| www.色精品| 亚洲视频综合在线| 91麻豆国产精品久久| 中文字幕一区av| av一本久道久久综合久久鬼色| 国产精品萝li| 99re6这里只有精品视频在线观看| 国产精品沙发午睡系列990531| 国产成人小视频| 久久久久高清精品|