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

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

?? mac-gprs.cc

?? 用C++編寫的GPRS協(xié)議棧源代碼
?? CC
?? 第 1 頁 / 共 3 頁
字號:
    // base_stn() doesnt work here. since it hasnt yet got its     // ARP reply and doesnt know the MAC address of its base station!!!		this->hdr_src((char*)dh1, this->addr());	this->hdr_dst((char*)dh1, dst);	ch1->uid() = 0;	ch1->direction() = hdr_cmn::DOWN;	ch1->ptype() = PT_MAC;    //ch1->size() = slot_packet_len_;    ch1->size() = 20; //arbitly set at 20.    ch1->iface() = -2;	ch1->error() = 0;  		dh1->dh_fc.fc_type       = MAC_Type_Control;	dh1->dh_fc.fc_subtype    = MAC_Subtype_res_request;		ch1->chan() = 0; // send on upslot 0, freq 0 ie random access chan	pktTx[0] = p1;    //block the IFQ from sending down further pkts till a res_reply is    //recvd    q_->block();	    if (verbose_==1)	    printf("<%d> %f res_request created. dst= %d. IFQ blocked.\n", 			index_, NOW, /*node_->base_stn() */ dst);	rx_from_ll (pktTx[0]);}//create a resource reply message and schedule it to be sent in//downlsot 0void MacGprs::send_res_reply(int dst, int freq, int slot){	//dst= the node that sent the res_request...	//or the node to which a res_reply has to be sent.	Packet *p1 = Packet::alloc();	struct hdr_cmn* ch1= HDR_CMN(p1);	struct hdr_mac_gprs* dh1 = HDR_MAC_GPRS(p1);		this->hdr_src((char*)dh1, this->addr());	this->hdr_dst((char*)dh1, dst);		ch1->uid() = 0;	ch1->ptype() = PT_MAC;    //ch1->size() = slot_packet_len_;    ch1->size() = 20; //arbitly set at 20.    ch1->iface() = -2;	ch1->error() = 0;  	ch1->direction() = hdr_cmn::DOWN;    	if (verbose_==1)	   printf("<%d> %f res_reply created. freq=%d, slot=%d booked for dst=%d\n",		index_, NOW, freq, slot,dst);				dh1->dh_fc.fc_type     = MAC_Type_Control;	dh1->dh_fc.fc_subtype  = MAC_Subtype_res_reply;	dh1->dh_freq		   = freq;		dh1->dh_slot		   = slot;		ch1->chan() = 0; // send on upslot 0, freq 0 ie random access chan	if (txQ[0][0]==0){		txQ[0][0] = p1;		rx_from_ll (txQ[0][0]);	}	else {		 // if I already have an as-yet-untransmitted res_reply and		 // another comes along - store the new arrival and tx it on		 // the next TDMA frame.         temp_reply=p1;		 rx_from_ll(temp_reply);	}//	{	//	printf("<%d> %f i have another res_reply to send, cant send yours.\n",  index_, NOW);	//	vlr_.down_table[freq][slot]==-10;	//	vlr_.up_table[freq][slot]==-10;	//	 printf("<%d> %f vlr_entry %d, %d cleared\n",index_, NOW, freq, slot);//    }   		}// Prepare pkt to be sent onto PHY. ie add headers. Is actually// rx from IFQ! void MacGprs::rx_from_ll(Packet* p) {	u_int32_t dst, src, size;	struct hdr_cmn* ch = HDR_CMN(p);	struct hdr_mac_gprs* dh = HDR_MAC_GPRS(p);    if (verbose_==1)	   printf("<%d> %f rxing_from_ll, size=%d\n", index_, NOW,ch->size());		// Update the MAC header, same as 802.11 	dh->dh_fc.fc_protocol_version = MAC_ProtocolVersion;		if (dh->dh_fc.fc_type  != MAC_Type_Control){		ch->size() += ETHER_HDR_LEN;		dh->dh_fc.fc_type       = MAC_Type_Data;		dh->dh_fc.fc_subtype    = MAC_Subtype_data;	} 		dh->dh_fc.fc_to_ds      = 0;	dh->dh_fc.fc_from_ds    = 0;	dh->dh_fc.fc_more_frag  = 0;	dh->dh_fc.fc_retry      = 0;	dh->dh_fc.fc_pwr_mgt    = 0;	dh->dh_fc.fc_more_data  = 0;	dh->dh_fc.fc_wep        = 0;	dh->dh_fc.fc_order      = 0;	if ( dh->dh_wait != 1) dh->dh_wait = 0; 		if((u_int32_t)ETHER_ADDR(dh->dh_da) != MAC_BROADCAST)		dh->dh_duration = DATA_DURATION;	else		dh->dh_duration = 0;}// Actually TX  the packet. void MacGprs::tx_onto_PHY(Packet *p) {	double stime;	double temp;		struct hdr_cmn* ch = HDR_CMN(p);	struct hdr_mac_gprs* dh  = HDR_MAC_GPRS(p);			//check if any other MS is txing too... if this is the Random Access Channel 	if ( ch->chan()==0 && up_slot_ ==0 && index_!=0) {		//have to amke sure it's not a BS - coz BS may tx		//on chan0 in downslot3		switch (chan0_0) {			case IDLE:				chan0_0 = BUSY;				if (verbose_==1)				    printf("<%d> %f chan0_0 made BUSY \n", index_, NOW);				break;			case BUSY:				coll_count = 2;				chan0_0 = COLL;				if (verbose_==1)				    printf("<%d> %f chan0_0=%0x coll_count=%d \n", index_, NOW,chan0_0, coll_count);				break;			case COLL:				coll_count ++;				if (verbose_==1)				   printf("<%d> %f chan0_0 => COLL coll_count=%d \n", index_, NOW, coll_count);				ch->error() = 1; //mark the pkt as erroneous				break;		}	}	if (dh->dh_fc.fc_subtype == MAC_Subtype_res_request)  {		//sent only by ms in Upslot 0. MS waits for 7 TS		temp= (double)((SLOTS_PER_FRAME-1)*slot_time_);		mhwait_.start(temp);		if (verbose_==1)		   printf("<%d> %f  wait timer started \n", index_, NOW);	}	stime =	TX_Time(p);   	if (stime > slot_time_) stime= slot_time_ ;// just to make sure.	assert(stime >= 0);  	if (verbose_==1)		printf("<%d> %f txing_onto_PHY, sendtime=%f, size=%d\n", index_, NOW, stime, ch->size());	mhTxPkt_.start(p->copy(), stime);	//mhTxPkt_.start(p->copy(), slot_time_);	downtarget_->recv(p, this);        }// Turn on / off the radiovoid MacGprs::radioSwitch(int i) {	radio_active_ = i;	EnergyModel *em = netif_->node()->energy_model();	if (i == ON) {		if (em && em->sleep()){			em->set_node_sleep(0);		}		if (verbose_==1)		    printf("<%d> %f radio switched ON\n", index_, NOW);			return;	}	if (i == OFF) {		if (em && !em->sleep()) {			em->set_node_sleep(1);		};	    if (verbose_==1)		   printf("<%d> %f radio switched OFF\n", index_, NOW);		return;	}}		 //============================================================//		 Timers' handlers //============================================================/* Slot Timers:*/void MacGprs::downslotHandler(Event *e) {    int i, len;	 	struct hdr_mac_gprs *dh;	MobileNode * node_ = (MobileNode*)(netif_->node());		if (( first_round_ ==1) & (down_slot_==0)) {		vlr_.hier_addr_[index_] =  Address::instance().get_nodeaddr(node_->address());		// set info in data_at_bs - since we cdnlt do it in the		// constructor as there wasnt yet a pointer to netif_........		if (verbose_==1) 		  printf(" hier_Add[%d]=%d ; grps=%d \n", index_, vlr_.hier_addr_[index_], gprs_);   	}				// Restart timer for next slot.	mhDownSlot_.start((Packet *)e, slot_time_);	if (index_==0 && verbose_==1)	    printf("<%d> %f  down slot %d starts now. \n", index_, NOW, down_slot_);	//start Upslottimer after 3 downslots to ensure skew	if (( first_round_ ==1) & (down_slot_==3)) {		first_round_ = 0;	    mhUpSlot_.start((Packet *) (& intr1_), 0);  	}			if (node_->base_stn() == node_->address()) {//node is a BS 		for (i=0; i<max_num_freq_ ; i ++) {			if (down_slot_==0 && txQ[i][down_slot_]==0) {				if (temp_reply != 0) {					radioSwitch(ON);					tx_onto_PHY (temp_reply);					temp_reply=0;			     }			}				// check if any chan has to tx in this slot.			if  (txQ[i][down_slot_] !=NULL) {				dh = HDR_MAC_GPRS(txQ[i][down_slot_]);   				if (dh->dh_wait !=1) {					radioSwitch(ON);					tx_onto_PHY ( txQ[i][down_slot_] );					txQ[i][down_slot_] = 0;				}				}		}		}	if (node_->base_stn() != node_->address()) {//node is an MS 		/* I do nothing here! all taken care of in ms_recv() */	}			down_slot_ ++; 	if (down_slot_ == SLOTS_PER_FRAME	) {		down_slot_ = 0; //ie wrap around.	}	return;				}	void MacGprs::upslotHandler(Event *e) {	int i,len;	MobileNode * node_ = (MobileNode*)(netif_->node());		struct hdr_cmn* ch ;		if (index_==0 && verbose_==1 ) printf("<%d> %f	 Up slot %d starts now. \n", 			index_, NOW, up_slot_);		// Restart timer for next slot.	mhUpSlot_.start((Packet *)e, slot_time_);	if (node_->base_stn() != node_->address()) {//node is an MS 				if (pktTx[up_slot_] != NULL) { 					//check if no more pkts to tx, start slot release timer			if (q_ !=NULL && gprs_==1){				len= q_->length();					//printf("<%d> %f MAC que=%0x length=%d \n", index_, NOW, q_, len);			 	if  (up_slot_ != 0) {// tx_chan[0]=0 always.for random access/signals 					if ( len==0 &&  (mhRel_.busy() ==0) && (tx_chan[up_slot_] !=-10) ) {					//	slot_release_time_ =(2*(SLOTS_PER_FRAME-1) - up_slot_ +1)* slot_time_;						slot_release_time_ = ((4*SLOTS_PER_FRAME) ) *slot_time_;						mhRel_.start(slot_release_time_);						if (verbose_==1)						  printf("<%d> %f  release timer started \n",index_, NOW);					}				}	 			} else {		 	//printf("<%d> %f MAC que NULL q=%0x \n",index_, NOW, q_ ); 			}						//start transmission			radioSwitch(ON);		   			ch =  HDR_CMN(pktTx[up_slot_]);				  			if (verbose_==1)				    printf("<%d> %f in upslothandler. ptype=%s size=%d, slot=%d \n",					index_, NOW, packet_info.name(ch->ptype()), ch->size(),up_slot_ );						tx_onto_PHY ( pktTx[up_slot_] );			pktTx[up_slot_] =0;		}	}			if (node_->base_stn() == node_->address()) {//node is itself a BS 			/* Do nothign here. taken care of in bs_recv() */	}	up_slot_ ++;	if (up_slot_ == SLOTS_PER_FRAME	) {		up_slot_ = 0; //ie wrap around.	}	return;}	void MacGprs::recvHandler(Event *e) {	u_int32_t dst, src; 	int size;	Packet * p= (Packet * )e;		struct hdr_cmn *ch = HDR_CMN(p);	struct hdr_mac_gprs *dh = HDR_MAC_GPRS(p);	/* Check for collision.  */	if  (ch->error() == EF_COLLISION) {		ch->error() = 1;	}			dst = ETHER_ADDR(dh->dh_da);	src = ETHER_ADDR(dh->dh_sa);	size = ch->size();		if (verbose_==1)	  printf("<%d> %f pkt [from %d to %d], size = %d uid=%d recv compleeted.\n", 			index_, NOW, src, dst, size, ch->uid()); //richa	radioSwitch(OFF);	if ((dst != MAC_BROADCAST) && (dst != (u_int32_t)index_)) {		// some error happened somewhere and the pkt landed up with me		// somehow... so am dropping.		drop(p);		return;	} 	fwd_DATA_to_LL(p);	return;} // Called after transmission a packet ie when txTimer expires.// Frees the pkt. Turns off the radio.void MacGprs::sendHandler(Event *e) {    if (verbose_==1) 		printf("<%d> %f pkt uid =  %d send complete.\n", 		 index_, NOW, HDR_CMN((Packet*)e)->uid());	Packet::free((Packet *)e);	radioSwitch(OFF);	/* unlock IFQ if not waiting for res_reply. */	if (mhwait_.busy() ==0 ) { 		if(callback_) {			Handler *h = callback_;			callback_ = 0;			h->handle((Event*) 0);		} 	}		return;}// Called when the release timer expiresvoid MacGprs::releaseHandler(){	if (verbose_==1) printf("<%d> %f in release handler. \n" ,index_, NOW );    send_let_go()  ;   	return;}	 // Called when the back off timer expiresvoid MacGprs::backoffHandler(){  //resend resource request	if (verbose_==1) printf("<%d> %f Backoff timer expired \n" , index_, NOW);	send_res_request();}// Called when the wait timer expiresvoid MacGprs::waitHandler(){ 	int temp;    double backoff_time;	temp =  Random::integer(30);  	backoff_time = ( double)( temp * slot_time_) ; 	if (verbose_==1) 		printf("<%d> %f res reply not recvd in 7 TS. will backoff for %fs (%d slots)\n", 		index_, NOW, backoff_time, temp);	// arbitly limited the backoff timer to 30 slots.- 	// integer(K) gives a uniformly distributed integer btwn 0 and k-1 	// maybe shud backoff for some num of frames instead.	mhBackoff_.start(backoff_time); //start back off timer}	//create a resource release messagevoid MacGprs::send_let_go() { // sent by an MS to its  BS		int dst, j;	Packet *p1 = Packet::alloc();		struct hdr_cmn* ch1= HDR_CMN(p1);	struct hdr_mac_gprs* dh1 = HDR_MAC_GPRS(p1);		MobileNode * node_ = (MobileNode*)(netif_->node());	//dst=node_->base_stn();		dst=0;		this->hdr_src((char*)dh1, this->addr());	this->hdr_dst((char*)dh1, dst);	ch1->uid() = 0;	ch1->direction() = hdr_cmn::DOWN;	ch1->ptype() = PT_MAC;    //ch1->size() = slot_packet_len_;    ch1->size() = 20; //arbitly set at 20.    ch1->iface() = -2;	ch1->error() = 0; 		if (verbose_==1)	   printf("<%d> %f in send_let_go dst= %d\n", index_, NOW, /*node_->base_stn() */ dst);		dh1->dh_fc.fc_type       = MAC_Type_Control;	dh1->dh_fc.fc_subtype    = MAC_Subtype_tx_end;		// find upslot/freq to tx on	for ( j=1; j< SLOTS_PER_FRAME ; j++) {		if ( tx_chan[j] != -10 ) {				break; 		 }	 }		ch1->chan() = tx_chan[j]; // sent on freq j, upslot 0.	tx_chan[j]= -10; //release the channels...	rx_chan[j]= -10;	pktTx[j] = p1;	return;}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品一二三| 色婷婷综合五月| 日韩欧美精品三级| 免费成人美女在线观看.| 欧美一区二区国产| 国内精品免费**视频| 国产免费久久精品| 成人午夜免费视频| 樱花草国产18久久久久| 欧美三片在线视频观看 | 91精品欧美一区二区三区综合在| 性久久久久久久久久久久| 欧美一级在线视频| 国产一区二区三区美女| 中文字幕一区二区在线观看| 色噜噜狠狠成人中文综合| 日本va欧美va精品发布| 国产视频在线观看一区二区三区 | 精品国产乱码久久久久久老虎| 国产米奇在线777精品观看| 亚洲图片激情小说| 麻豆成人av在线| 日韩一区二区精品在线观看| 国产精品一区不卡| 亚洲精品免费在线| 日韩一级高清毛片| 91在线播放网址| 免费黄网站欧美| 国产精品电影院| 欧美一区二区三区免费大片| www.欧美色图| 免费看日韩a级影片| 国产精品久久久久一区二区三区| 欧美日韩精品福利| 成人av综合在线| 天堂资源在线中文精品| 国产欧美一区二区精品久导航 | 中文字幕av不卡| 7777精品伊人久久久大香线蕉 | 欧美激情一区不卡| 欧美另类变人与禽xxxxx| 高清免费成人av| 日本不卡不码高清免费观看| 欧美国产欧美综合| 成人免费看的视频| 亚洲高清免费观看高清完整版在线观看| 欧美一级片在线观看| 一本大道久久a久久综合婷婷| 六月婷婷色综合| 一区二区三区日韩欧美| 国产亚洲欧美一级| 555www色欧美视频| 日本精品一区二区三区高清 | 日韩va欧美va亚洲va久久| 国产精品萝li| 欧美哺乳videos| 欧美日本在线视频| 欧美午夜精品免费| av成人动漫在线观看| 国产大陆亚洲精品国产| 美女视频黄免费的久久 | 91网站最新网址| 韩国欧美国产1区| 日韩av电影一区| 亚洲va韩国va欧美va精品| 成人免费一区二区三区在线观看| 国产亚洲一区二区在线观看| 欧美一区二区三区的| 在线播放日韩导航| 欧美情侣在线播放| 欧美亚洲一区三区| 欧美自拍丝袜亚洲| 欧美亚洲国产怡红院影院| 91免费在线播放| 91蜜桃在线免费视频| 92精品国产成人观看免费| 成人激情开心网| 豆国产96在线|亚洲| 成人午夜在线视频| 91亚洲永久精品| 91免费版pro下载短视频| 色噜噜偷拍精品综合在线| 一本久久精品一区二区| 在线观看亚洲精品| 欧美男同性恋视频网站| 欧美日韩精品二区第二页| 欧美男人的天堂一二区| 日韩午夜激情免费电影| 2019国产精品| 中文字幕乱码亚洲精品一区| 亚洲人成人一区二区在线观看| 亚洲精品视频一区二区| 亚洲成人精品一区| 蜜臀av性久久久久av蜜臀妖精| 美女视频一区在线观看| 国产精品1区2区| 91丨九色porny丨蝌蚪| 欧美私模裸体表演在线观看| 欧美三级日本三级少妇99| 8v天堂国产在线一区二区| 欧美大片拔萝卜| 欧美极品aⅴ影院| 亚洲美女视频在线| 蜜臀久久久99精品久久久久久| 国产精品一区二区男女羞羞无遮挡| 懂色一区二区三区免费观看| 色偷偷一区二区三区| 337p亚洲精品色噜噜狠狠| 久久精品亚洲国产奇米99| 一区二区在线看| 九色porny丨国产精品| 成人av在线观| 7777精品伊人久久久大香线蕉 | 97se亚洲国产综合自在线观| 欧美精品成人一区二区三区四区| 久久色在线观看| 亚洲欧美影音先锋| 日韩电影免费在线看| 国产精品影音先锋| 欧美少妇xxx| 欧美国产1区2区| 免费成人在线播放| 99久久婷婷国产| 欧美第一区第二区| 亚洲综合免费观看高清完整版在线 | 国产精品乱子久久久久| 午夜精品久久久久影视| 成人免费三级在线| 91精品国产欧美一区二区成人| 最新中文字幕一区二区三区| 青青草97国产精品免费观看无弹窗版| 成人三级在线视频| 精品999在线播放| 亚洲制服欧美中文字幕中文字幕| 国产精品资源在线看| 欧美精品一二三四| 一区二区三区免费看视频| 国产另类ts人妖一区二区| 欧美日韩一区三区四区| 最新日韩av在线| 国产成人鲁色资源国产91色综| 制服丝袜一区二区三区| 亚洲综合色婷婷| 91免费在线视频观看| 国产精品网站在线播放| 韩国精品主播一区二区在线观看| 欧美日韩高清一区二区三区| 亚洲日本在线视频观看| 成人免费的视频| 久久日韩精品一区二区五区| 石原莉奈一区二区三区在线观看| 在线观看精品一区| 成人免费一区二区三区在线观看| 国产精品1024| 久久久99精品免费观看| 黄一区二区三区| 精品三级在线观看| 免费国产亚洲视频| 日韩一区二区三区在线视频| 日韩av不卡在线观看| 欧美日本一区二区| 亚洲va国产天堂va久久en| 欧美在线一二三| 一区二区三区精品| 在线精品视频一区二区三四| 亚洲欧美激情一区二区| 色婷婷久久99综合精品jk白丝| 自拍av一区二区三区| 91蜜桃网址入口| 亚洲美女精品一区| 欧美性做爰猛烈叫床潮| 亚洲电影一区二区三区| 欧美日精品一区视频| 视频一区欧美日韩| 欧美一区二区精美| 狠狠色综合色综合网络| 国产亚洲美州欧州综合国| 国模少妇一区二区三区| 26uuu欧美日本| 成人免费视频网站在线观看| 日韩一区有码在线| 欧美日韩久久一区二区| 免费观看在线综合色| 久久久久久久久岛国免费| 成人av一区二区三区| 亚洲黄色免费网站| 日韩欧美在线影院| 国产精品一区在线| 亚洲精品国产无天堂网2021| 欧美美女bb生活片| 精品亚洲欧美一区| 亚洲视频免费看| 欧美日韩高清一区二区不卡| 国内精品久久久久影院色| 国产精品久久久久一区二区三区 | 日韩精品中文字幕一区二区三区| 美女一区二区三区在线观看| 国产女人18毛片水真多成人如厕 | 国产精品麻豆欧美日韩ww| 在线观看区一区二|