📄 dsr_wlan_mac.pr.c
字号:
static void wlan_higher_layer_data_arrival ();
static void wlan_physical_layer_data_arrival ();
static void wlan_hlpk_enqueue (Packet* hld_pkptr, int dest_addr);
Boolean wlan_tuple_find (int sta_addr, int seq_id, int frag_num);
static void wlan_data_process (Packet* seg_pkptr,int dest_addr, int sta_addr, int final_dest_addr, int frag_num, int more_frag, int pkt_id);
static void wlan_accepted_frame_stats_update (Packet* seg_pkptr);
static void wlan_interrupts_process ();
static void wlan_prepare_frame_to_send (int frame_type);
static void wlan_frame_transmit ();
static void wlan_schedule_deference ();
static void wlan_frame_discard ();
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);
/* End of Header Block */
#if !defined (VOSD_NO_FIN)
#undef BIN
#undef BOUT
#define BIN FIN_LOCAL_FIELD(last_line_passed) = __LINE__ - _block_origin;
#define BOUT BIN
#define BINIT FIN_LOCAL_FIELD(last_line_passed) = 0; _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 retry_count;
int intrpt_type;
WlanT_Mac_Intrpt_Code intrpt_code;
int my_address;
Objid my_objid;
Objid my_node_objid;
Objid my_subnet_objid;
List* hld_list_ptr;
double operational_speed;
int frag_threshold;
int packet_seq_number;
int packet_frag_number;
int destination_addr;
Sbhandle fragmentation_buffer_ptr;
WlanT_Mac_Frame_Type fresp_to_send;
double nav_duration;
int rts_threshold;
int duplicate_entry;
WlanT_Mac_Frame_Type expected_frame_type;
int remote_sta_addr;
double backoff_slots;
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;
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;
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 ap_mac_address;
int hld_max_size;
double max_receive_lifetime;
Boolean accept_large_packets;
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;
int drop_pkt_entry_log_flag;
int packet_size;
double receive_time;
Ici* llc_iciptr;
int rcv_channel_status;
int* bss_stn_list;
int bss_stn_count;
int bss_id;
int data_packet_type;
int data_packet_dest;
int data_packet_final_dest;
} dsr_wlan_mac_state;
#define pr_state_ptr ((dsr_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 my_objid pr_state_ptr->my_objid
#define my_node_objid pr_state_ptr->my_node_objid
#define my_subnet_objid pr_state_ptr->my_subnet_objid
#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 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 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 ap_mac_address pr_state_ptr->ap_mac_address
#define hld_max_size pr_state_ptr->hld_max_size
#define max_receive_lifetime pr_state_ptr->max_receive_lifetime
#define accept_large_packets pr_state_ptr->accept_large_packets
#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 rcv_channel_status pr_state_ptr->rcv_channel_status
#define bss_stn_list pr_state_ptr->bss_stn_list
#define bss_stn_count pr_state_ptr->bss_stn_count
#define bss_id pr_state_ptr->bss_id
#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
/* 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 dsr_wlan_mac_state *op_sv_ptr = pr_state_ptr;
/* Function Block */
enum { _block_origin = __LINE__ };
static void
wlan_mac_sv_init ()
{
Objid mac_params_comp_attr_objid;
Objid params_attr_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 i;
char bss_name[128];
Log_Handle bssid_changed_log_handle;
char ip_addr_mode [64];
/** 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");
/* Obtain the BSS_Id attribute to determine if BSS based network is used */
op_ima_obj_attr_get (params_attr_objid, "BSS Identifier", &bss_id);
/* Update the global variable if this is the first node to come up. If not the */
/* first node, then check for mismatches. A subnet can be a traditional subnet */
/* (i.e. a subnet with one BSS,this is the existing model) or a BSS based */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -