⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jigb_wlan_mac_bb.pr.c

📁 利用opnet网络仿真软件,研究802.11的QOS,可以利用此模块研究802.11e
💻 C
📖 第 1 页 / 共 5 页
字号:
static Boolean		wlan_dest_is_11g_enabled (int dest_mac_addr);
static void 		wlan_prepare_frame_to_send (WlanT_Mac_Frame_Type frame_type);
static double		wlan_ctrl_response_drate_determine (double rcvd_data_rate);
static void			wlan_slot_time_set (double new_slot_time);
static void			wlan_frame_tx_phy_info_set (Packet* frame_ptr, double tx_data_rate);
static void			wlan_interrupts_process (void);
static void			wlan_physical_layer_data_arrival (void);
static Boolean		wlan_tuple_find (int sta_addr, int seq_id, int frag_num, int dest_addr);
static void			wlan_data_process (Packet* seg_pkptr, int dest_addr, int sta_addr, int final_dest_addr, int frag_num, int more_frag, OpT_Packet_Id pkt_id);
static void			wlan_accepted_frame_stats_update (Packet* seg_pkptr);
static void			wlan_schedule_deference (void);
static void			wlan_frame_discard (void);
static void			wlan_pcf_frame_discard (void);
static void			wlan_mac_rcv_channel_status_update (int channel_id);
static void			wlan_mac_error (const char* msg1, const char* msg2, const char* msg3);
static Boolean		wlan_poll_list_member_find (int dest_addr); 

static void						wlan_frame_type_conv (WlanT_Mac_Frame_Type frame_type, char* frame_type_name); 
static int						wlan_bss_id_list_manage (int bssid, const char* operation);
static PrgT_Mapping_Handle		wlan_bss_mapping_get (void);
static int 						wlan_get_ap_sta_addr (int bss_idx);
static WlanT_Sta_Mapping_Info*	wlan_sta_addr_register (int bss_idx, int sta_addr, int sta_is_ap, Objid sta_mac_objid, WlanT_Phy_Char_Code phy_char);
static WlanT_Bss_Mapping_Info*	wlan_bss_info_get (int bssid);
static WlanT_Sta_Mapping_Info*	wlan_sta_info_get (int sta_addr, Boolean serialize);
static double 					wlan_min_freq_for_chan (int chan_num);
static Boolean					wlanc_11a_channel_is_regular (double frequency, int* channel_num_ptr);
static void 					wlan_begin_new_scan (void);
static void 					wlan_set_transceiver_channel (int chan_num);
static void						wlan_ap_switch (void);
static void 					wlan_sta_addr_deregister (int bss_idx, int sta_addr);
static void						wlan_reset_sv (void);
static void 					wlan_ap_position_publish (void);
static void 					wlan_ap_eval_virtual (void);
static double 					wlan_ap_signal_strength_calc (double prop_distance, WlanT_AP_Position_Info *ap_info_ptr);
static void 					wlan_find_new_ap_virtual (void);

/* Callback functions		*/
#if defined (__cplusplus)
extern "C" {
#endif

static int	   					wlan_hld_list_elem_add_comp (const void* list_elem_ptr1, const void* list_elem_ptr2);
static void*					wlan_bss_info_get_key (void *value_ptr);
static int 						wlan_mapping_int_key_compare (void *key_a_ptr, void *key_b_ptr);
static void 					wlan_bss_info_free (void *value_ptr);
static void*					wlan_sta_info_get_key (void *value_ptr);
static void 					wlan_sta_info_free (void *value_ptr);
static void*					wlan_dup_info_get_key (void *value_ptr);
static void 					wlan_dup_info_free (void *value_ptr);

#if defined (__cplusplus)
} /* end of 'extern "C" {' */
#endif

/* End of Header Block */


#if !defined (VOSD_NO_FIN)
#undef	BIN
#undef	BOUT
#define	BIN		FIN_LOCAL_FIELD(_op_last_line_passed) = __LINE__ - _op_block_origin;
#define	BOUT	BIN
#define	BINIT	FIN_LOCAL_FIELD(_op_last_line_passed) = 0; _op_block_origin = __LINE__;
#else
#define	BINIT
#endif /* #if !defined (VOSD_NO_FIN) */



/* State variable definitions */
typedef struct
	{
	/* Internal state tracking for FSM */
	FSM_SYS_STATE
	/* State Variables */
	int	                    		intrpt_type                                     ;	/* Intrpt type is stored in this variable */
	WlanT_Mac_Intrpt_Code	  		intrpt_code                                     ;	/* Enumerated intrpt code for interrupts */
	int	                    		my_address                                      ;	/* Station's own address				 */
	Objid	                  		my_objid                                        ;	/* The object ID of the surrounding module.	 */
	Objid	                  		my_node_objid                                   ;	/* The object ID of the surrounding node.	 */
	Objid	                  		my_subnet_objid                                 ;	/* The object ID of the subnet in which the	 */
	                        		                                                	/* surrounding node model resides.			        */
	Objid	                  		tx_objid                                        ;	/* Object ID of the radio transmitter that	 */
	                        		                                                	/* we are connected to.						               */
	Objid	                  		txch_objid                                      ;	/* Object ID of the channel of our transmitter.		 */
	Objid	                  		rx_objid                                        ;	/* Object ID of the radio receiver that we	 */
	                        		                                                	/* are connected to.						                  */
	Objid	                  		rxch_objid                                      ;	/* Object ID of the channel of our receiver.		 */
	OmsT_Pr_Handle	         		own_process_record_handle                       ;	/* Handle to the own process record in the network wide process	 */
	                        		                                                	/* registery.													                                       */
	List*	                  		hld_list_ptr                                    ;	/* Higher layer data arrival queue or list */
	double	                 		data_tx_rate                                    ;	/* Used in storing data rate attribute. This is the rate at which	 */
	                        		                                                	/* data frame is transmitted.										                            */
	double	                 		operational_speed                               ;	/* Current data rate used for the transmissions of the data frames.	 */
	                        		                                                	/* This rate can be different than the value of data_tx_rate if the	 */
	                        		                                                	/* current connected access point can't support that rate.			        */
	double	                 		control_data_rate                               ;	/* Data rate used for the transmission of control frames. The rate	 */
	                        		                                                	/* is the lowest one of the mandatory data rates set of the			      */
	                        		                                                	/* configured physical layer technology.							                     */
	double	                 		rcvd_frame_drate                                ;	/* Data rate of the last successfully received frame, which is used	 */
	                        		                                                	/* in determining the transmission rate of the control response		    */
	                        		                                                	/* messages (CTS and ACK).											                                */
	int	                    		frag_threshold                                  ;	/* Used in storing fragmentation threshold attribute */
	int	                    		packet_seq_number                               ;	/* Counter to determine packet sequence number for each transmitted packet */
	int	                    		packet_frag_number                              ;	/* Counter to determine fragment number for each packet fragment */
	int	                    		destination_addr                                ;	/* Used in storing destination address */
	Sbhandle	               		fragmentation_buffer_ptr                        ;	/* Fragmentation buffer used to store transmit packet fragments.	 */
	Sbhandle	               		common_rsmbuf_ptr                               ;	/* Common reassembly buffer used for segment containing the entire	 */
	                        		                                                	/* original packet.													                                    */
	WlanT_Mac_Frame_Type	   		fresp_to_send                                   ;	/* After receiving a frame station will determine that what response	 */
	                        		                                                	/* need to be sent.														                                     */
	double	                 		nav_duration                                    ;	/* Network allocation vector duration this an absolute time from the	   */
	                        		                                                	/* beginning of the simulation. It will be considered as zero if it is	 */
	                        		                                                	/* set to the current time.						                		                     */
	Evhandle	               		nav_reset_evh                                   ;	/* Handle for the procedure interrupt that is scheduled to reset the	 */
	                        		                                                	/* NAV that is updated based on a received RTS, if no activity is		   */
	                        		                                                	/* detected on the medium for a	certain time as specified in section	 */
	                        		                                                	/* 9.2.5.4 of the IEEE 802.11-1999 standard.							                   */
	int	                    		rts_threshold                                   ;	/* Used in storing Rts threshold attribute */
	int	                    		duplicate_entry                                 ;	/* Flag for duplicate entry  Keeps track that whether the receive frame was a duplicate frame or not.	 */
	                        		                                                	/* This information is transmitted in ACK frame.														                                         */
	WlanT_Mac_Frame_Type	   		expected_frame_type                             ;	/* Set the expected frame type needed in response	 */
	                        		                                                	/* to the transmitted frame							                 */
	int	                    		remote_sta_addr                                 ;	/* Extracting remote station's address from	 */
	                        		                                                	/* the received packet	                	     */
	double	                 		backoff_slots                                   ;	/* Random number of backoff slots determined by */
	                        		                                                	/* a uniform distribution	                 	    */
	Stathandle	             		packet_load_handle                              ;	/* Recording number of packets received from the	 */
	                        		                                                	/* higher layer		                        		       */
	double	                 		intrpt_time                                     ;	/* Storing total backoff time when backoff duration is set */
	Packet *	               		wlan_transmit_frame_copy_ptr                    ;	/* Make copy of the transmit frame before transmission */
	Stathandle	             		backoff_slots_handle                            ;	/* Number of backoff slots before transmission. */
	int	                    		instrm_from_mac_if                              ;	/* Stream index coming from the higher layer MAC interface. */
	int	                    		outstrm_to_mac_if                               ;	/* Stream index connected to the higher layer MAC interface. */
	int	                    		num_fragments                                   ;	/* Number of data fragments that need to be transmitted */
	                        		                                                	/* for each data frame received from higher layer       */
	OpT_Packet_Size	        		remainder_size                                  ;	/* Size of the last data fragment 		 */
	List*	                  		defragmentation_list_ptr                        ;	/* This buffer contains the fragments received from		   */
	                        		                                                	/* remote station and maintains following information	  */
	                        		                                                	/* for each fragment:									                          */
	                        		                                                	/* 1. remote station address 						   	              	  */
	                        		                                                	/* 2. time the last fragment was received             	 */
	                        		                                                	/* 3. reassembly buffer 			                   	         */
	WlanT_Mac_Flags*	       		wlan_flags                                      ;	/* This structure contains all the flags which the process    */
	                        		                                                	/* model used to convey information from one state to another */
	                        		                                                	/* for details check the header block where the structure is  */
	                        		                                                	/* defined.													                                      */
	OmsT_Aa_Address_Handle	 		oms_aa_handle                                   ;	/* used to obtain address handle to resolve wlan MAC address */
	double	                 		current_time                                    ;	/* Keeps track of the current simulation time at each interrupt */
	double	                 		rcv_idle_time                                   ;	/* Last simulation time when the receiver became idle again. */
	Pmohandle	              		hld_pmh                                         ;	/* This list stores the information of the received packet.	 */
	                        		                                                	/* The information includes source station address, packet   */
	                        		                                                	/* sequence id, and packet fragment number. This             */
	                        		                                                	/* is used to keep track that whether the received packet is */
	                        		                                                	/* a duplicate of the previously received frame. If that's   */
	                        		                                                	/* the case then packet is simply discarded.				             */
	                        		                                                	/*                                                           */
	                        		                                                	/* Pool memory handle used to allocate memory for the data   */
	                        		                                                	/* received from the higher layer and inserted in the queue  */
	int	                    		max_backoff                                     ;	/* Maximum backoff value for picking random backoff interval */
	char	                   		current_state_name [32]                         ;	/* Keeping track of the current state of the station.	 */
	Stathandle	             		hl_packets_rcvd                                 ;	/* Monitor queue size as the packets arrive from higher layer.	 */
	Stathandle	             		media_access_delay                              ;	/* Keep tracks of the delay from the time the packet is received		      */
	                        		                                                	/* from the higher layer to the time it is transmitted by the station.	 */
	Stathandle	             		ete_delay_handle                                ;	/* Handle for the end to end delay statistic that is recorded for	   */
	                        		                                                	/* the packets that are accepted and forwarded to the higher layer.	 */
	Stathandle	             		global_ete_delay_handle                         ;	/* Handle for global end-to-end delay statistic.					 */
	Stathandle	             		global_throughput_handle                        ;	/* Handle for global WLAN throughput statistic.						 */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -