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

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

?? aodv_wlan_mac.pr.c

?? 感知無線電有關仿真
?? C
?? 第 1 頁 / 共 5 頁
字號:

			/* Packet fragment number is initialized.	*/
			packet_frag_number = 0;				
						
			/* Packet needs to be fragmented if it is more 	*/
			/* than fragmentation threshold, provided		*/
			/* fragmentation is enabled.					*/
			if ((packet_size > (frag_threshold * 8)) && (frag_threshold != -1))
				{
				/* Determine number of fragments for the packet	*/
				/* and the size of the last fragment			*/							
				num_fragments =  (int) (packet_size / (frag_threshold * 8));
				remainder_size = packet_size - (num_fragments * frag_threshold * 8);

				/* If the remainder size is non zero it means that the	*/
				/* last fragment is fractional but since the number 	*/
				/* of fragments is a whole number we need to transmit	*/
				/* one additional fragment to ensure that all of the	*/
				/* data bits will be transmitted						*/
				if (remainder_size != 0)
					{
					num_fragments = num_fragments + 1;									 
					}
				}
			else
				{			
				/* If no fragments needed then number of	*/
				/* packets to be transmitted is set to 1	*/								
				num_fragments = 1;
				remainder_size = packet_size;
				}

			/* Storing Data packet id for debugging purposes.	*/			
			pkt_in_service = op_pk_id (hld_ptr->pkptr);		

			/* Insert packet to fragmentation buffer	*/					
			op_sar_segbuf_pk_insert (fragmentation_buffer_ptr, hld_ptr->pkptr, 0);

			/* Computing packet duration in the queue in seconds	*/
			/* and reporting it to the statistics					*/
			pkt_tx_time = (current_time - hld_ptr->time_rcvd);

			/* Printing out information to ODB.	*/
			if (wlan_trace_active == OPC_TRUE)
				{
				sprintf (msg_string, "Data packet %d is removed from higher layer buffer", pkt_in_service);
				sprintf	(msg_string1, "The queueing delay for data packet %d is %fs", 	
				pkt_in_service, pkt_tx_time);	
				op_prg_odb_print_major (msg_string, msg_string1, OPC_NIL);
				}

			/* Store the arrival time of the packet.	*/
			receive_time = hld_ptr->time_rcvd;
			
			/* Freeing up allocated memory for the data packet removed from the higher layer queue.	*/
			op_prg_mem_free (hld_ptr);

			/* Send rts if rts is enabled and packet size is more than rts threshold	*/
			if ((packet_size > (rts_threshold * 8)) && (rts_threshold != -1))
				{						 		
				retry_limit = long_retry_limit;
				/* Prepare Rts frame for transmission	*/
				wlan_prepare_frame_to_send (WlanC_Rts);
					
              	/* Break the routine as Rts is already prepared	*/
				FOUT;
				}
			else
				{
				retry_limit = short_retry_limit;
				}
			}
		}
		
	/* Prepare data frame to transmit	*/
	wlan_prepare_frame_to_send (WlanC_Data);

	FOUT;
	}
		
static void 
wlan_prepare_frame_to_send (int frame_type)
	{
	char							msg_string [120];
	Packet*							hld_pkptr;
	Packet*							seg_pkptr;
	int								dest_addr, src_addr;
	int								protocol_type = -1;	
	int								tx_datapacket_size;
	int								type;
//	char							error_string [512];
	int								outstrm_to_phy;
	double							duration, mac_delay;
	WlanT_Data_Header_Fields*		pk_dhstruct_ptr;
	WlanT_Control_Header_Fields*	pk_chstruct_ptr;
	Packet*							wlan_transmit_frame_ptr;

	/** Prepare frames to transmit by setting appropriate fields in the 	**/
    /** packet format for Data,Cts,Rts or Ack.  If data or Rts packet needs **/
    /** to be retransmitted then the older copy of the packet is resent.    **/
	FIN (wlan_prepare_frame_to_send (int frame_type));

	outstrm_to_phy = LOW_LAYER_OUT_STREAM_CH1;

	if(DEBUG) printf("--- MAC Msg @ node %d --- prepare frame to send\n", my_address);
	/* The code is divided as per the frame types */
	switch (frame_type)
		{	
		case WlanC_Data:
			{			
			if (operational_speed == 2000000)
				{
				outstrm_to_phy = LOW_LAYER_OUT_STREAM_CH2;
				}
			else if (operational_speed == 5500000)
				{
				outstrm_to_phy = LOW_LAYER_OUT_STREAM_CH3;
				}
			else if (operational_speed == 11000000)
				{
				outstrm_to_phy = LOW_LAYER_OUT_STREAM_CH4;
				}

			/* If it is a retransmission of a packet then no need 	*/
            /* of preparing data frame.								*/
			if ((retry_count > 0) && (wlan_transmit_frame_copy_ptr != OPC_NIL))
				{
				/* If it is a retransmission then just transmit the previous frame	*/			
				wlan_transmit_frame_ptr = op_pk_copy (wlan_transmit_frame_copy_ptr);

				/* If retry count is non-zero means that the frame is a */
				/* retransmission of the last transmitted frame			*/
				op_pk_nfd_access (wlan_transmit_frame_ptr, "Wlan Header", &pk_dhstruct_ptr);
				pk_dhstruct_ptr->retry = 1;

				/* Printing out information to ODB.	*/
				if (wlan_trace_active == OPC_TRUE)
					{
					sprintf (msg_string, "Data fragment %d for packet %d is retransmitted", pk_dhstruct_ptr->fragment_number, pkt_in_service);							
					op_prg_odb_print_major (msg_string, OPC_NIL);
					}					
				if(DEBUG) printf("--- MAC Msg @ node %d --- Data fragment %d for packet %d is retransmitted\n",my_address, pk_dhstruct_ptr->fragment_number, pkt_in_service);
				/* Calculate nav duration till the channel will be occupied by 	*/
				/* station. The duration is SIFS time plus the ack frame time  	*/
				/* which the station needs in response to the data frame.		*/		
				duration = WLAN_ACK_DURATION + sifs_time + plcp_overhead_control;				

				/* Since the number of fragments for the last transmitted frame is	*/
				/* already decremented, there will be more fragments to transmit  	*/
				/* if number of fragments is more than zero.					  	*/
				if (num_fragments != 1)	
					{
					/* If more fragments need to be transmitted then the station 	*/
					/* need to broadcast the time until the receipt of the       	*/
					/* the acknowledgement for the next fragment. 224 bits (header	*/
					/* size) is the length of the control fields in the data  		*/
					/* frame and needs to be accounted in the duration calculation	*/
					duration = 2 * duration + ((frag_threshold * 8) + WLANC_MSDU_HEADER_SIZE) / operational_speed + 
							   sifs_time + plcp_overhead_control;
					}
			
				/* Station update of it's own nav_duration.	To keep track of the next	*/
				/* available contention window.											*/
				nav_duration = current_time + duration + (double) (op_pk_total_size_get (wlan_transmit_frame_ptr)) / operational_speed;
				}

			else
				{
				/* Creating transmit data packet type	*/
				wlan_transmit_frame_ptr = op_pk_create_fmt ("wlan_mac");
				
				/* Prepare data frame fields for transmission.	*/		
				pk_dhstruct_ptr = wlan_mac_pk_dhstruct_create ();
				type = WlanC_Data;   		

				pk_dhstruct_ptr->retry = 0;				
				pk_dhstruct_ptr->order = 1;
				pk_dhstruct_ptr->sequence_number = packet_seq_number;

				/* Calculate nav duration till the channel will be occupied by  */
				/* station. The duration is SIFS time plus the ack frame time   */
				/* which the station needs in response to the data frame.		*/		
				duration = WLAN_ACK_DURATION + sifs_time + plcp_overhead_control;

				/* If there is more than one fragment to transmit and there are  	*/
				/* equal sized fragments then remove fragmentation threshold size	*/
				/* length of data from the buffer for transmission.					*/
				if  ((num_fragments > 1) || (remainder_size == 0))
					{
					/* Remove next fragment from the fragmentation buffer for 	*/
					/* transmission and set the appropriate fragment number.  	*/
					seg_pkptr = op_sar_srcbuf_seg_remove (fragmentation_buffer_ptr, frag_threshold * 8);
			
					/* Indicate in transmission frame that more fragments need to be sent	*/
					/* if more than one fragments are left								 	*/
					if (num_fragments != 1)	
						{
						pk_dhstruct_ptr->more_frag = 1;

						/* If more fragments need to be transmitted then the station	*/
						/* need to broadcast the time until the receipt of the       	*/
						/* the acknowledgement for the next fragment. 224 bits (header	*/
						/* size) is the length of control fields in the data frame  	*/
						/* and need to be accounted for in the duration calculation		*/
						duration = 2 * duration + ((frag_threshold * 8) + WLANC_MSDU_HEADER_SIZE) / operational_speed + 
						           sifs_time + plcp_overhead_control;
						}
					else
						{
						/* If no more fragments to transmit then set more fragment field to be 0 */
						pk_dhstruct_ptr->more_frag = 0;
						}
						
					/* Set fragment number in packet field	 */
					pk_dhstruct_ptr->fragment_number = packet_frag_number ;

					/* Printing out information to ODB.	*/
					if (wlan_trace_active == OPC_TRUE)
						{
						sprintf (msg_string, "Data fragment %d for packet %d is transmitted",packet_frag_number, pkt_in_service);							
						op_prg_odb_print_major (msg_string, OPC_NIL);
						}
					if(DEBUG) printf ("Data fragment %d for packet %d is transmitted\n",packet_frag_number, pkt_in_service);
					/* Setting packet fragment number for next fragment to be transmitted */
					packet_frag_number = packet_frag_number + 1;    	
					}
				else
					{
					/* Remove last fragments (if any left) from the fragmentation buffer for */
					/* transmission and disable more fragmentation bit.				         */
					seg_pkptr = op_sar_srcbuf_seg_remove (fragmentation_buffer_ptr, remainder_size);					

					pk_dhstruct_ptr->more_frag = 0;

					/* Printing out information to ODB.	*/
					if (wlan_trace_active == OPC_TRUE)
						{
						sprintf (msg_string, "Data fragment %d for packet %d is transmitted",packet_frag_number, pkt_in_service);								
						op_prg_odb_print_major (msg_string, OPC_NIL);
						}
					if(DEBUG) printf ("Data fragment %d for packet %d is transmitted\n",packet_frag_number, pkt_in_service);
					pk_dhstruct_ptr->fragment_number = packet_frag_number;
					}	

				/* Setting the Header field structure.	*/
				pk_dhstruct_ptr->duration  = duration;
				pk_dhstruct_ptr->address1  = destination_addr;
				pk_dhstruct_ptr->address2  = my_address;

				/* In the BSS network the Data frame is going from AP to sta then fromds bit is set.	*/
    			if (ap_flag == OPC_BOOLINT_ENABLED)
					{
					pk_dhstruct_ptr->fromds	 = 1;
					}
				else
					{
					pk_dhstruct_ptr->fromds	 = 0;
					}

				/* if in the BSS network the Data frame is going from sta to AP then tods bit is set.	*/					
    			if ((bss_flag == OPC_BOOLINT_ENABLED) && (ap_flag == OPC_BOOLINT_DISABLED))
					{
					pk_dhstruct_ptr->tods = 1;

					/* If Infrastructure BSS then the immediate destination will be Access point, which 	*/
					/* then forward the frame to the appropriate destination.								*/
					pk_dhstruct_ptr->address1 = bss_id;
					pk_dhstruct_ptr->address3 = destination_addr;
					}
				else
					{
					pk_dhstruct_ptr->tods = 0;
					}
	
				/* If we are sending the first fragment of the data fragment for the first	*/
				/* time, then this is the end of media access duration, hence we must		*/
				/* update the media access delay statistics.								*/
				if (packet_size == op_pk_total_size_get (seg_pkptr) + op_sar_buf_size (fragmentation_buffer_ptr))
					{
					mac_delay = current_time - receive_time;
					op_stat_write (media_access_delay, mac_delay);
					op_stat_write (media_access_delay, 0.0);
					op_stat_write (global_mac_delay_handle, mac_delay);
					op_stat_write (global_mac_delay_handle, 0.0);
					}
				
				op_pk_nfd_set (wlan_transmit_frame_ptr, "Type", type);

				/* Setting the variable which keeps track of the last transmitted frame.	*/
                last_frametx_type = type;

				op_pk_nfd_set (wlan_transmit_frame_ptr, "Accept", OPC_TRUE);
				op_pk_nfd_set (wlan_transmit_frame_ptr, "Data Packet ID", pkt_in_service);
				
				/* Set the frame control field and nav duration.				*/
				op_pk_nfd_set (wlan_transmit_frame_ptr, "Wlan H

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人tv网| 综合电影一区二区三区| 国内一区二区视频| 337p粉嫩大胆噜噜噜噜噜91av| 美女网站一区二区| 国产夜色精品一区二区av| 波多野结衣中文字幕一区二区三区 | 久久精品日产第一区二区三区高清版 | 久久综合狠狠综合| 成人黄色电影在线| 亚洲色图清纯唯美| 宅男在线国产精品| 国产乱码精品一区二区三区五月婷| 久久蜜桃av一区二区天堂 | 免费日本视频一区| 久久精品无码一区二区三区| caoporn国产精品| 亚洲一区二区精品视频| 欧美tickling网站挠脚心| 成人天堂资源www在线| 亚洲一区二区三区视频在线播放 | 免费成人av资源网| 欧美激情一区二区三区不卡| 色呦呦日韩精品| 日韩成人伦理电影在线观看| 国产午夜亚洲精品不卡| 欧洲av在线精品| 国产一区二区福利视频| 亚洲一区二区四区蜜桃| 久久免费偷拍视频| 欧美四级电影网| 国产乱码字幕精品高清av| 亚洲综合免费观看高清完整版 | 91精品国产综合久久香蕉麻豆| 国产精品一区不卡| 亚州成人在线电影| 国产欧美一区在线| 欧美日韩国产精品自在自线| 国产精品18久久久久| 午夜欧美一区二区三区在线播放| 久久免费偷拍视频| 7777精品伊人久久久大香线蕉经典版下载 | 欧美激情中文字幕| 日韩欧美一二区| 日本高清不卡一区| 成人va在线观看| 狠狠色丁香婷婷综合久久片| 亚洲综合一二区| 中文字幕亚洲区| 久久免费电影网| 日韩一级片在线播放| 在线观看亚洲a| caoporm超碰国产精品| 国产尤物一区二区在线| 日精品一区二区三区| 亚洲精品日韩一| 国产精品久久久久婷婷| 欧美精品一区二区精品网| 337p亚洲精品色噜噜狠狠| 色菇凉天天综合网| 91香蕉视频黄| 成年人网站91| 成人一区二区视频| 国产精品白丝av| 精品亚洲成av人在线观看| 日韩电影免费一区| 日韩高清不卡一区二区三区| 亚洲男女一区二区三区| 中文在线免费一区三区高中清不卡| 日韩精品最新网址| 欧美一区二区日韩| 欧美一区二区美女| 久久综合色鬼综合色| 精品国产亚洲在线| 日韩久久免费av| 337p日本欧洲亚洲大胆精品 | 亚洲精品一线二线三线| 日韩一区二区中文字幕| 日韩精品在线一区| 日韩欧美国产一区二区三区| 日韩欧美色电影| 精品美女在线播放| 国产亚洲一区字幕| 国产精品久久久久aaaa樱花| 中文字幕亚洲区| 亚洲一区二区中文在线| 日韩精品久久久久久| 欧美a级理论片| 国产一区二区三区精品视频| 国产成a人亚洲| 99re热这里只有精品免费视频| 色综合欧美在线视频区| 欧美性一二三区| 欧美一区二区三区人| 精品国产不卡一区二区三区| 国产欧美一区二区精品忘忧草 | 欧美影视一区在线| 欧美色视频一区| 欧美videos中文字幕| 国产精品美女视频| 亚洲一区二区不卡免费| 奇米影视一区二区三区| 国产呦萝稀缺另类资源| 懂色av一区二区三区蜜臀 | 欧美日韩国产小视频在线观看| 91精品在线观看入口| 久久精品一区八戒影视| 一区二区在线观看免费视频播放 | 日本不卡1234视频| 国产91丝袜在线观看| 日本道免费精品一区二区三区| 91精品国产入口在线| 欧美国产精品一区二区| 亚洲3atv精品一区二区三区| 国产精品亚洲午夜一区二区三区| 99精品国产91久久久久久 | 国产综合久久久久久鬼色| 色综合久久久久综合99| 日韩一区二区免费视频| 中文字幕一区av| 久久99国产精品尤物| 91麻豆免费在线观看| 亚洲精品一线二线三线无人区| 亚洲欧美区自拍先锋| 另类小说综合欧美亚洲| 欧美在线观看禁18| 国产欧美日韩在线观看| 香蕉成人伊视频在线观看| 成人妖精视频yjsp地址| 91精品国产综合久久久久| 国产精品久久久爽爽爽麻豆色哟哟| 日韩不卡免费视频| 91久久精品日日躁夜夜躁欧美| 精品福利一区二区三区免费视频| 亚洲一区二区美女| 成年人网站91| 久久综合色播五月| 免费在线成人网| 欧美在线观看一二区| 国产精品对白交换视频| 成人国产精品免费观看| 日韩视频免费观看高清完整版| 中文字幕日韩一区二区| 久久这里都是精品| 亚洲美女在线国产| 九九视频精品免费| 欧美日韩高清一区二区| 中文字幕中文字幕中文字幕亚洲无线 | 亚洲欧洲精品成人久久奇米网| 丁香婷婷综合激情五月色| 激情综合色播激情啊| 狠狠色丁香婷婷综合| 精品国产一区二区三区av性色| 韩国精品主播一区二区在线观看 | 国产午夜精品久久久久久久 | 欧美videofree性高清杂交| 国产一区二区中文字幕| 国产精品久久综合| 欧美手机在线视频| 日韩国产欧美在线观看| 久久久久88色偷偷免费| 99久久亚洲一区二区三区青草| 一区二区三区**美女毛片| 91精品国产综合久久精品app| 久久不见久久见免费视频7| 国产亚洲欧美激情| 色先锋久久av资源部| 秋霞成人午夜伦在线观看| 国产亚洲1区2区3区| 色欧美88888久久久久久影院| 日韩中文字幕一区二区三区| 精品美女一区二区| 91色综合久久久久婷婷| 亚洲.国产.中文慕字在线| 久久亚洲欧美国产精品乐播| 97se亚洲国产综合自在线| 日本不卡视频一二三区| 国产精品视频九色porn| 欧美日韩激情一区二区三区| 国产乱对白刺激视频不卡| 亚洲影院免费观看| 欧美精品一区二区三区四区| 色哟哟国产精品| 国产一区欧美日韩| 亚洲一区二区三区中文字幕| 欧美v亚洲v综合ⅴ国产v| 91国偷自产一区二区开放时间| 国内欧美视频一区二区 | 国产精品天美传媒沈樵| 精品视频在线免费看| 福利电影一区二区| 天堂久久久久va久久久久| 国产精品福利av| 久久综合狠狠综合久久综合88| 欧美亚洲综合色| 成人av网在线| 国内成人免费视频| 日韩二区三区在线观看| 亚洲人精品午夜| 国产亚洲精品福利|