📄 jigb_wlan_mac_jamming.pr.c
字号:
/* Process model C form file: JIGB_wlan_mac_Jamming.pr.c */
/* Portions of this file copyright 1992-2004 by OPNET Technologies, Inc. */
/* This variable carries the header into the object file */
const char JIGB_wlan_mac_Jamming_pr_c [] = "MIL_3_Tfile_Hdr_ 110A 30A op_runsim 7 44B38BEB 44B38BEB 1 DIPRO2 pfc 0 0 none none 0 0 none 0 0 0 0 0 0 0 0 b56 1 ";
#include <string.h>
/* OPNET system definitions */
#include <opnet.h>
/* Header Block */
/** Include files **/
#include <math.h>
#include <string.h>
#include "oms_pr.h"
#include "oms_tan.h"
#include "oms_bgutil.h"
#include "wlan_support.h"
#include "oms_auto_addr_support.h"
#include "oms_dist_support.h"
#include "bridge_header.h"
#include "prg_mapping.h"
#include <prg_geo.h>
#include <oms_rr.h>
/** Constants **/
/* Incoming statistics and stream wires. */
#define TRANSMITTER_BUSY_INSTAT 1
#define LOW_LAYER_INPUT_STREAM 0
#define LOW_LAYER_OUTPUT_STREAM 0
/* Flags to load different variables based on attribute settings. */
#define WLAN_AP 1
#define WLAN_STA 0
/* Flags to indicate the medium access mode (PCF/DCF). */
#define PCF_ACTIVE 1
#define PCF_INACTIVE 0
/* Special value indicating BSS identification is not used. */
#define WLAN_BSSID_NOT_USED -1
/* Special value indicating radio transceiver frequencies are set */
/* based on the BSS identification. */
#define BSS_BASED_FREQ_USED -1.0
/* Special value indicating that the bandwidth of the transceiver */
/* channels are configured to use the standard value of the */
/* specified physical layer technology. */
#define PHY_TECH_BASED_BW_USED -1.0
/* Special value indicating that the number of back-off slots are */
/* not determined yet. */
#define BACKOFF_SLOTS_UNSET -1.0
/* Special value for nav_reset_time when NAV is not set based on a */
/* received RTS. */
#define NAV_RESET_TIME_UNSET -1.0
/* Define a small value (= 1 psec), which will be used to recover */
/* from double arithmetic precision losts while doing time related */
/* precision sensitive computations. */
#define PRECISION_RECOVERY 0.000000000001
/* Special value indicating BSS identification is currently unset. */
#define WLANC_BSS_ID_UNKNOWN -2
/* Speed of light (m/s). */
#define C 3.0E+08
/* 16 times pi-squared. */
#define SIXTEEN_PI_SQ (16.0 * VOSC_NA_PI * VOSC_NA_PI)
/* A small delay (= 10 nsec) between the transmission and reception */
/* of a CTS-to-self message to guarantee that the packet isn't */
/* delivered before the transmitter completes the transmission. */
#define CTS_TO_SELF_RX_DELAY 0.00000001
/* In the idle state, number of beacon intervals after which the STA will wake */
/* up to check if it is still connected, if scanning is based on beacon */
/* reliability. There are no interrupts pending in the idle state, therefore, */
/* it is possible that the STA's state may be set to "scan" from a pipeline */
/* state without the MAC becoming aware of the state change till a packet */
/* arrives from the higher layer. Hence, there is a need to schedule periodic */
/* interrupts when in IDLE. */
#define WLANC_CONN_CHK_BEACON_MULT 5.0
/* Period after which the STA will check for connectivity if scanning is */
/* distance based. */
#define WLANC_CONN_CHK_DIST_INTERVAL 10.0
/* When in the SCAN state, the period that an STA will wait before trying a new */
/* channel. */
#define WLANC_NEW_SCAN_BEACON_MULT 2.5
/** Enumerated Types **/
/* Define the three possible values that a global variable takes */
/* to check and ensure that all the MAC modules are either BSS ID */
/* based or purely subnet based. The variable is initialized to */
/* Not_Set and the first wireless MAC process sets it to either */
/* Entire_Subnet (if BSS_Identifier is Not Used) or Bssid_Subnet */
/* (if the BSS_Identifier is set to some value other than Not */
/* Used). */
typedef enum WlanT_Bssid_Approach
{
WlanC_Not_Set, /* Type of network not set */
WlanC_Entire_Subnet, /* The network is a pure subnet */
WlanC_Bss_Divided_Subnet /* The network is a BSS based subnet */
} WlanT_Bss_Identification_Approach;
/* Define interrupt codes for generating handling interrupts */
/* indicating changes in deference, frame timeout which infers */
/* that the collision has occurred, random backoff and transmission */
/* completion by the physical layer (self interrupts). */
typedef enum WlanT_Mac_Intrpt_Code
{
WlanC_Deference_Off, /* Deference before frame transmission */
WlanC_Tslot_Off, /* C骴igo para la espera tras la se馻l de atasco */
WlanC_Frame_Timeout, /* No frame rcvd in set duration (infer collision) */
WlanC_Backoff_Elapsed, /* Backoff done before frame transmission */
WlanC_CW_Elapsed, /* Backoff done after successful frame transmission */
WlanC_Beacon_Tx_Time, /* Time to transmit beacon frame */
WlanC_Cfp_End, /* End of the Contention free period */
WlanC_Scan_Timeout, /* End of scan duration for given channel */
WlanC_AP_Check_Timeout, /* Time to check the connectivity status with the */
/* current AP. */
WlanC_NAV_Reset_Time /* Time to reset NAV that is updated by an RTS. */
} WlanT_Mac_Intrpt_Code;
/** Data Structures **/
/* Define a structure to maintain data fragments received by each */
/* station for the purpose of reassembly (or defragmentation) */
typedef struct WlanT_Mac_Defragmentation_Buffer_Entry
{
int tx_station_address ;/* Store the station address of transmitting station */
double time_rcvd ;/* Store time the last fragment for this frame was received */
Sbhandle reassembly_buffer_ptr ;/* Store data fragments for a particular packet */
} WlanT_Mac_Defragmentation_Buffer_Entry;
/* Define a structure to maintain a copy of each unique data frame */
/* received by the station. This is done so that the station can */
/* discard any additional copies of the frame received by it. */
typedef struct WlanT_Mac_Duplicate_Buffer_Entry
{
int tx_station_address; /* store the station address of transmitting station */
int sequence_id ; /* rcvd packet sequence id */
int fragment_number ; /* rcvd packet fragment number */
} WlanT_Mac_Duplicate_Buffer_Entry;
/* This structure contains all the flags used in this process model to determine */
/* various conditions as mentioned in the comments for each flag */
typedef struct WlanT_Mac_Flags
{
Boolean data_frame_to_send; /* Flag to check when station needs to transmit. */
Boolean backoff_flag; /* Backoff flag is set when either the collision is */
/* inferred or the channel switched from busy to idle */
Boolean Jam_flag; /* Indica si el procedimiento de atasco esta activado */
Boolean Jam_ini; /* Indica que el paquete de la cola ya fue desencolado */
Boolean Jam_retry; /* Indica que se reintenta mandar la se馻l de atasco */
Boolean Tslot_activo; /* Indica que la espera SIFS esta activada */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -