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

📄 aodv_wlan_mac.pr.c

📁 利用opnet对AODV过程进行编码
💻 C
📖 第 1 页 / 共 5 页
字号:
	Stathandle	             		packet_load_handle;	double	                 		intrpt_time;	Packet *	               		wlan_transmit_frame_copy_ptr;	Stathandle	             		backoff_slots_handle;	int	                    		instrm_from_mac_if;	int	                    		outstrm_to_mac_if;	int	                    		num_fragments;	int	                    		remainder_size;	List*	                  		defragmentation_list_ptr;	WlanT_Mac_Flags*	       		wlan_flags;	OmsT_Aa_Address_Handle	 		oms_aa_handle;	double	                 		current_time;	double	                 		rcv_idle_time;	double	                 		cw_end;	WlanT_Mac_Duplicate_Buffer_Entry**			duplicate_list_ptr;	Pmohandle	              		hld_pmh;	int	                    		max_backoff;	char	                   		current_state_name [32];	Stathandle	             		hl_packets_rcvd;	Stathandle	             		media_access_delay;	Stathandle	             		ete_delay_handle;	Stathandle	             		global_ete_delay_handle;	Stathandle	             		global_throughput_handle;	Stathandle	             		global_load_handle;	Stathandle	             		global_dropped_data_handle;	Stathandle	             		global_mac_delay_handle;	Stathandle	             		ctrl_traffic_rcvd_handle_inbits;	Stathandle	             		ctrl_traffic_sent_handle_inbits;	Stathandle	             		ctrl_traffic_rcvd_handle;	Stathandle	             		ctrl_traffic_sent_handle;	Stathandle	             		data_traffic_rcvd_handle_inbits;	Stathandle	             		data_traffic_sent_handle_inbits;	Stathandle	             		data_traffic_rcvd_handle;	Stathandle	             		data_traffic_sent_handle;	double	                 		sifs_time;	double	                 		slot_time;	int	                    		cw_min;	int	                    		cw_max;	double	                 		difs_time;	Stathandle	             		channel_reserv_handle;	Stathandle	             		retrans_handle;	Stathandle	             		throughput_handle;	int	                    		long_retry_limit;	int	                    		short_retry_limit;	int	                    		retry_limit;	WlanT_Mac_Frame_Type	   		last_frametx_type;	Evhandle	               		deference_evh;	Evhandle	               		backoff_elapsed_evh;	Evhandle	               		frame_timeout_evh;	Evhandle	               		cw_end_evh;	double	                 		eifs_time;	int	                    		i_strm;	Boolean	                		wlan_trace_active;	int	                    		pkt_in_service;	Stathandle	             		bits_load_handle;	int	                    		ap_flag;	int	                    		bss_flag;	int	                    		bss_id;	int	                    		hld_max_size;	double	                 		max_receive_lifetime;	WlanT_Phy_Char_Code	    		phy_char_flag;	OmsT_Aa_Address_Handle	 		oms_aa_wlan_handle;	int	                    		total_hlpk_size;	Stathandle	             		drop_packet_handle;	Stathandle	             		drop_packet_handle_inbits;	Log_Handle	             		drop_pkt_log_handle;	Boolean	                		drop_pkt_entry_log_flag;	int	                    		packet_size;	double	                 		receive_time;	Ici*	                   		llc_iciptr;	int*	                   		bss_stn_list;	int	                    		bss_stn_count;	int	                    		data_packet_type;	int	                    		data_packet_dest;	int	                    		data_packet_final_dest;	int	                    		DEBUG;	} aodv_wlan_mac_state;#define pr_state_ptr            		((aodv_wlan_mac_state*) SimI_Mod_State_Ptr)#define retry_count             		pr_state_ptr->retry_count#define intrpt_type             		pr_state_ptr->intrpt_type#define intrpt_code             		pr_state_ptr->intrpt_code#define my_address              		pr_state_ptr->my_address#define hld_list_ptr            		pr_state_ptr->hld_list_ptr#define operational_speed       		pr_state_ptr->operational_speed#define frag_threshold          		pr_state_ptr->frag_threshold#define packet_seq_number       		pr_state_ptr->packet_seq_number#define packet_frag_number      		pr_state_ptr->packet_frag_number#define destination_addr        		pr_state_ptr->destination_addr#define fragmentation_buffer_ptr		pr_state_ptr->fragmentation_buffer_ptr#define fresp_to_send           		pr_state_ptr->fresp_to_send#define nav_duration            		pr_state_ptr->nav_duration#define rts_threshold           		pr_state_ptr->rts_threshold#define duplicate_entry         		pr_state_ptr->duplicate_entry#define expected_frame_type     		pr_state_ptr->expected_frame_type#define remote_sta_addr         		pr_state_ptr->remote_sta_addr#define backoff_slots           		pr_state_ptr->backoff_slots#define packet_load_handle      		pr_state_ptr->packet_load_handle#define intrpt_time             		pr_state_ptr->intrpt_time#define wlan_transmit_frame_copy_ptr		pr_state_ptr->wlan_transmit_frame_copy_ptr#define backoff_slots_handle    		pr_state_ptr->backoff_slots_handle#define instrm_from_mac_if      		pr_state_ptr->instrm_from_mac_if#define outstrm_to_mac_if       		pr_state_ptr->outstrm_to_mac_if#define num_fragments           		pr_state_ptr->num_fragments#define remainder_size          		pr_state_ptr->remainder_size#define defragmentation_list_ptr		pr_state_ptr->defragmentation_list_ptr#define wlan_flags              		pr_state_ptr->wlan_flags#define oms_aa_handle           		pr_state_ptr->oms_aa_handle#define current_time            		pr_state_ptr->current_time#define rcv_idle_time           		pr_state_ptr->rcv_idle_time#define cw_end                  		pr_state_ptr->cw_end#define duplicate_list_ptr      		pr_state_ptr->duplicate_list_ptr#define hld_pmh                 		pr_state_ptr->hld_pmh#define max_backoff             		pr_state_ptr->max_backoff#define current_state_name      		pr_state_ptr->current_state_name#define hl_packets_rcvd         		pr_state_ptr->hl_packets_rcvd#define media_access_delay      		pr_state_ptr->media_access_delay#define ete_delay_handle        		pr_state_ptr->ete_delay_handle#define global_ete_delay_handle 		pr_state_ptr->global_ete_delay_handle#define global_throughput_handle		pr_state_ptr->global_throughput_handle#define global_load_handle      		pr_state_ptr->global_load_handle#define global_dropped_data_handle		pr_state_ptr->global_dropped_data_handle#define global_mac_delay_handle 		pr_state_ptr->global_mac_delay_handle#define ctrl_traffic_rcvd_handle_inbits		pr_state_ptr->ctrl_traffic_rcvd_handle_inbits#define ctrl_traffic_sent_handle_inbits		pr_state_ptr->ctrl_traffic_sent_handle_inbits#define ctrl_traffic_rcvd_handle		pr_state_ptr->ctrl_traffic_rcvd_handle#define ctrl_traffic_sent_handle		pr_state_ptr->ctrl_traffic_sent_handle#define data_traffic_rcvd_handle_inbits		pr_state_ptr->data_traffic_rcvd_handle_inbits#define data_traffic_sent_handle_inbits		pr_state_ptr->data_traffic_sent_handle_inbits#define data_traffic_rcvd_handle		pr_state_ptr->data_traffic_rcvd_handle#define data_traffic_sent_handle		pr_state_ptr->data_traffic_sent_handle#define sifs_time               		pr_state_ptr->sifs_time#define slot_time               		pr_state_ptr->slot_time#define cw_min                  		pr_state_ptr->cw_min#define cw_max                  		pr_state_ptr->cw_max#define difs_time               		pr_state_ptr->difs_time#define channel_reserv_handle   		pr_state_ptr->channel_reserv_handle#define retrans_handle          		pr_state_ptr->retrans_handle#define throughput_handle       		pr_state_ptr->throughput_handle#define long_retry_limit        		pr_state_ptr->long_retry_limit#define short_retry_limit       		pr_state_ptr->short_retry_limit#define retry_limit             		pr_state_ptr->retry_limit#define last_frametx_type       		pr_state_ptr->last_frametx_type#define deference_evh           		pr_state_ptr->deference_evh#define backoff_elapsed_evh     		pr_state_ptr->backoff_elapsed_evh#define frame_timeout_evh       		pr_state_ptr->frame_timeout_evh#define cw_end_evh              		pr_state_ptr->cw_end_evh#define eifs_time               		pr_state_ptr->eifs_time#define i_strm                  		pr_state_ptr->i_strm#define wlan_trace_active       		pr_state_ptr->wlan_trace_active#define pkt_in_service          		pr_state_ptr->pkt_in_service#define bits_load_handle        		pr_state_ptr->bits_load_handle#define ap_flag                 		pr_state_ptr->ap_flag#define bss_flag                		pr_state_ptr->bss_flag#define bss_id                  		pr_state_ptr->bss_id#define hld_max_size            		pr_state_ptr->hld_max_size#define max_receive_lifetime    		pr_state_ptr->max_receive_lifetime#define phy_char_flag           		pr_state_ptr->phy_char_flag#define oms_aa_wlan_handle      		pr_state_ptr->oms_aa_wlan_handle#define total_hlpk_size         		pr_state_ptr->total_hlpk_size#define drop_packet_handle      		pr_state_ptr->drop_packet_handle#define drop_packet_handle_inbits		pr_state_ptr->drop_packet_handle_inbits#define drop_pkt_log_handle     		pr_state_ptr->drop_pkt_log_handle#define drop_pkt_entry_log_flag 		pr_state_ptr->drop_pkt_entry_log_flag#define packet_size             		pr_state_ptr->packet_size#define receive_time            		pr_state_ptr->receive_time#define llc_iciptr              		pr_state_ptr->llc_iciptr#define bss_stn_list            		pr_state_ptr->bss_stn_list#define bss_stn_count           		pr_state_ptr->bss_stn_count#define data_packet_type        		pr_state_ptr->data_packet_type#define data_packet_dest        		pr_state_ptr->data_packet_dest#define data_packet_final_dest  		pr_state_ptr->data_packet_final_dest#define DEBUG                   		pr_state_ptr->DEBUG/* This macro definition will define a local variable called	*//* "op_sv_ptr" in each function containing a FIN statement.	*//* This variable points to the state variable data structure,	*//* and can be used from a C debugger to display their values.	*/#undef FIN_PREAMBLE#define FIN_PREAMBLE	aodv_wlan_mac_state *op_sv_ptr = pr_state_ptr;/* Function Block */enum { _block_origin = __LINE__ };static voidwlan_mac_sv_init ()	{	Objid					mac_params_comp_attr_objid;	Objid					params_attr_objid;	Objid					phy_params_comp_attr_objid;	Objid					my_objid;	Objid					my_node_objid;	Objid					my_subnet_objid;	Objid					rx_objid;	Objid					tx_objid;	Objid					chann_params_comp_attr_objid;	Objid					subchann_params_attr_objid;	Objid					chann_objid;	Objid					sub_chann_objid;	int						num_chann;	char					subnet_name [512];	double					bandwidth;	double					frequency;	int						ap1_flag, i ;	/**	1. Initialize state variables.					**/	/** 2. Read model attribute values in variables.	**/	/** 3. Create global lists							**/	/** 4. Register statistics handlers					**/	FIN (wlan_mac_sv_init ());	/* object id of the surrounding processor.	*/	my_objid = op_id_self ();	/* Obtain the node's object identifier	*/	my_node_objid = op_topo_parent (my_objid);	/* Obtain subnet objid.					*/	my_subnet_objid = op_topo_parent (my_node_objid);	/* Obtain the values assigned to the various attributes	*/	op_ima_obj_attr_get (my_objid, "Wireless LAN Parameters", &mac_params_comp_attr_objid);    params_attr_objid = op_topo_child (mac_params_comp_attr_objid, OPC_OBJTYPE_GENERIC, 0);	/* Determine the assigned MAC address.	*/	op_ima_obj_attr_get (my_objid, "station_address", &my_address);	/* Obtain an address handle for resolving WLAN MAC addresses.	*/	oms_aa_handle = oms_aa_address_handle_get ("MAC Addresses", "station_address");	/* Creating a pool of station addresses for each subnet based on subnet name.	*/	op_ima_obj_attr_get (my_subnet_objid, "name", &subnet_name);	oms_aa_wlan_handle = oms_aa_address_handle_get (subnet_name, "station_address");		/* Get model attributes.	*/	op_ima_obj_attr_get (params_attr_objid, "Data Rate", &operational_speed);	op_ima_obj_attr_get (params_attr_objid, "Fragmentation Threshold", &frag_threshold);	op_ima_obj_attr_get (params_attr_objid, "Rts Threshold", &rts_threshold);	op_ima_obj_attr_get (params_attr_objid, "Short Retry Limit", &short_retry_limit);	op_ima_obj_attr_get (params_attr_objid, "Long Retry Limit", &long_retry_limit);	op_ima_obj_attr_get (params_attr_objid, "Access Point Functionality", &ap_flag);		op_ima_obj_attr_get (params_attr_objid, "Buffer Size", &hld_max_size);	op_ima_obj_attr_get (params_attr_objid, "Max Receive Lifetime", &max_receive_lifetime);		/* Initialize the retry limit for the current frame to long retry limit.	*/	retry_limit = long_retry_limit;		/* Get the Channel Settings.										*/	/* Extracting Channel 0,1,2,3 (i.e. 1,2,5.5 and 11Mbps) Settings	*/	op_ima_obj_attr_get (params_attr_objid, "Channel Settings", &chann_params_comp_attr_objid);	subchann_params_attr_objid = op_topo_child (chann_params_comp_attr_objid, OPC_OBJTYPE_GENERIC, 0);	op_ima_obj_attr_get (subchann_params_attr_objid, "Bandwidth", &bandwidth);		op_ima_obj_attr_get (subchann_params_attr_objid, "Min Frequency", &frequency);		/* Load the appropriate physical layer characteristics.	*/		op_ima_obj_attr_get (params_attr_objid, "Physical Characteristics", &phy_char_flag);	/* Based on physical charateristics settings set appropriate values to the variables.	*/	switch (phy_char_flag)		{		case WlanC_Frequency_Hopping:			{			/* Slot duration in terms of sec.	*/			slot_time = 5E-05;			/* Short interframe gap in terms of sec.	*/			sifs_time = 2.8E-05;			/* Minimum contention window size for selecting backoff slots.	*/			cw_min = 15;			/* Maximum contention window size for selecting backoff slots.	*/			cw_max = 1023;			break;			}		case WlanC_Direct_Sequence:			{			/* Slot duration in terms of sec.	*/			slot_time = 2E-05;			/* Short interframe gap in terms of sec.	*/			sifs_time = 1E-05;			/* Minimum contention window size for selecting backoff slots.	*/			cw_min = 31;			/* Maximum contention window size for selecting backoff slots.	*/			cw_max = 1023;			break;			}		case WlanC_Infra_Red:			{			/* Slot duration in terms of sec.	*/			slot_time = 8E-06;			/* Short interframe gap in terms of sec.	*/			sifs_time = 1E-05;			/* Minimum contention window size for selecting backoff slots.	*/			cw_min = 63;

⌨️ 快捷键说明

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