一个无线帧的大小如果超过设置的RTS阈值,才发送RTS;否则,为保证吞吐量和空口环境的平衡,不发送RTS。
void
Mac802_11::sendRTS(int dst) //creact a RTS packet and store it in the buffer pktRTS_
{
Packet *p = Packet::alloc();
hdr_cmn* ch = HDR_CMN(p);
struct rts_frame *rf = (struct rts_frame*)p->access(hdr_mac::offset_);
assert(pktTx_);
assert(pktRTS_ == 0);
/*
* If the size of the packet is larger than the
* RTSThreshold, then perform the RTS/CTS exchange.
*/
if( (u_int32_t) HDR_CMN(pktTx_)->size() < macmib_.getRTSThreshold() ||
(u_int32_t) dst == MAC_BROADCAST) {
Packet::free(p);
return;
}
ch->uid() = 0;
ch->ptype() = PT_MAC;
ch->size() = phymib_.getRTSlen();
ch-