📄 wlan_chanmatch.ps.c
字号:
/* wlan_chanmatch.ps.c */ /* Modified for IEEE802.11 *//* Channel match model for radio link Transceiver Pipeline *//****************************************//* Copyright (c) 1993 *//* by MIL 3, Inc. *//* (A Delaware Corporation) *//* 3400 International Drive, N.W. *//* Washington, D.C., U.S.A. *//* All Rights Reserved. *//****************************************/#include "opnet.h"#if defined (__cplusplus)extern "C"#endifvoidwlan_chanmatch (Packet * pkptr) { double tx_freq, tx_bw, tx_drate, tx_code; double rx_freq, rx_bw, rx_drate, rx_code; Vartype tx_mod; Vartype rx_mod; /** Determine the compatibility between transmitter and receiver channels. **/ FIN (wlan_chanmatch (pkptr)); /* Obtain transmitting channel attributes. */ tx_freq = op_td_get_dbl (pkptr, OPC_TDA_RA_TX_FREQ); tx_bw = op_td_get_dbl (pkptr, OPC_TDA_RA_TX_BW); tx_drate = op_td_get_dbl (pkptr, OPC_TDA_RA_TX_DRATE); tx_code = op_td_get_dbl (pkptr, OPC_TDA_RA_TX_CODE); tx_mod = op_td_get_ptr (pkptr, OPC_TDA_RA_TX_MOD); /* Obtain receiving channel attributes. */ rx_freq = op_td_get_dbl (pkptr, OPC_TDA_RA_RX_FREQ); rx_bw = op_td_get_dbl (pkptr, OPC_TDA_RA_RX_BW); rx_drate = op_td_get_dbl (pkptr, OPC_TDA_RA_RX_DRATE); rx_code = op_td_get_dbl (pkptr, OPC_TDA_RA_RX_CODE); rx_mod = op_td_get_ptr (pkptr, OPC_TDA_RA_RX_MOD); /* For non-overlapping bands, the packet has no */ /* effect; such packets are ignored entirely. */ if ((tx_freq > rx_freq + rx_bw) || (tx_freq + tx_bw < rx_freq)) { op_td_set_int (pkptr, OPC_TDA_RA_MATCH_STATUS, OPC_TDA_RA_MATCH_IGNORE); FOUT; } /* If the transmitter and receiver data rate do not match then drop the packet. */ if (tx_drate != rx_drate) { op_td_set_int (pkptr, OPC_TDA_RA_MATCH_STATUS, OPC_TDA_RA_MATCH_IGNORE); FOUT; } /* Otherwise check for channel attribute mismatches which would */ /* cause the in-band packet to be considered as noise. */ if ((tx_freq != rx_freq) || (tx_bw != rx_bw) || (tx_code != rx_code) || (tx_mod != rx_mod)) { op_td_set_int (pkptr, OPC_TDA_RA_MATCH_STATUS, OPC_TDA_RA_MATCH_NOISE); FOUT; } /* Otherwise the packet is considered a valid transmission which */ /* could eventually be accepted at the error correction stage. */ op_td_set_int (pkptr, OPC_TDA_RA_MATCH_STATUS, OPC_TDA_RA_MATCH_VALID); FOUT; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -