ns-allinone-2.35/ns-2.35/mac/mac-multihop.cc
void MultihopMac::recv(Packet* p, Handler *h)
{
	if (h == 0) {		/* from MAC classifier (pass pkt to LL) */
		mode_ = MAC_IDLE;
		Scheduler::instance().schedule(target_, p, delay_);
		return;
	}
	callback_ = h;
	hdr_mac* mh = hdr_mac::access(p);
	mh->macSA() = addr_;
	if (mh->ftype() == MF_ACK) {
		mode_ = MAC_SND;
		send(p);
	} else {
		mh->ftype() = MF_DATA;
		poll(p);		/* poll first */
	}
}
/*
 * This is the call from the higher layer of the protocol stack (i.e., LL)
 */
This is the call from the higher layer of the protocol stack
This is the call from the higher layer of the protocol stack
void MultihopMac::recv(Packet* p, Handler *h)
{
	if (h == 0) {		
		mode_ = MAC_IDLE;
		Scheduler::instance().schedule(target_, p, delay_);
		return;
	}
	callback_ = h;
	hdr_mac* mh = hdr_mac::access(p);
	mh->macSA() = addr_;
	if (mh->ftype() == MF_ACK) {
		mode_ = MAC_SND;
		send(p);
	} else {
		mh->ftype() = MF_DATA;
		poll(p);		
	}
}
void MultihopMac :: recv ( Packet * p , Handler * h ) { if ( h == 0 ) { mode_ = MAC_IDLE ; Scheduler :: instance ( ) . schedule ( target_ , p , delay_ ) ; return ; } callback_ = h ; hdr_mac * mh = hdr_mac :: access ( p ) ; mh -> macSA ( ) = addr_ ; if ( mh -> ftype ( ) == MF_ACK ) { mode_ = MAC_SND ; send ( p ) ; } else { mh -> ftype ( ) = MF_DATA ; poll ( p ) ; } }
This is the call from the higher layer of the protocol stack (i.e., LL)
This is the call from the higher layer of the protocol stack ( i . e . LL )
/* from MAC classifier (pass pkt to LL) */ /* poll first */