ns-allinone-2.35/satellite/sathandoff.cc
SatLinkHead* LinkHandoffMgr::get_peer_linkhead(SatLinkHead* slhp)
{
	SatChannel *schan_;
	Phy *remote_phy_;

	schan_ = (SatChannel*) slhp->phy_tx()->channel();
	if (schan_ == 0) {
		printf("Error:  get_peer_linkhead called for a non-");
		printf("connected link on node %d\n", slhp->node()->address());
		return 0; // Link is not currently connected
	}
	remote_phy_ = schan_->ifhead_.lh_first; 
	if (remote_phy_ == 0) {
		printf("Error:  node %d's tx phy ", slhp->node()->address());
		printf("connected to channel with no receivers\n");
		return 0;
	}
	if (remote_phy_->nextchnl()) {
		printf("Error:  This ISL channel has more than one target\n");
		return 0;
	}
	return ( (SatLinkHead*) remote_phy_->head());
}
// This helper function assumes that the channel to which the link interface
// is attached has one peer node (i.e., no other receive infs on channel)
This helper function assumes that the channel to which the link interface
is attached has one peer node
This helper function assumes that the channel to which the link interface is attached has one peer node
SatLinkHead* LinkHandoffMgr::get_peer_linkhead(SatLinkHead* slhp)
{
	SatChannel *schan_;
	Phy *remote_phy_;
	schan_ = (SatChannel*) slhp->phy_tx()->channel();
	if (schan_ == 0) {
		printf("Error:  get_peer_linkhead called for a non-");
		printf("connected link on node %d\n", slhp->node()->address());
		return 0; 
	}
	remote_phy_ = schan_->ifhead_.lh_first; 
	if (remote_phy_ == 0) {
		printf("Error:  node %d's tx phy ", slhp->node()->address());
		printf("connected to channel with no receivers\n");
		return 0;
	}
	if (remote_phy_->nextchnl()) {
		printf("Error:  This ISL channel has more than one target\n");
		return 0;
	}
	return ( (SatLinkHead*) remote_phy_->head());
}
SatLinkHead * LinkHandoffMgr :: get_peer_linkhead ( SatLinkHead * slhp ) { SatChannel * schan_ ; Phy * remote_phy_ ; schan_ = ( SatChannel * ) slhp -> phy_tx ( ) -> channel ( ) ; if ( schan_ == 0 ) { printf ( " " ) ; printf ( " \n " , slhp -> node ( ) -> address ( ) ) ; return 0 ; } remote_phy_ = schan_ -> ifhead_ . lh_first ; if ( remote_phy_ == 0 ) { printf ( " " , slhp -> node ( ) -> address ( ) ) ; printf ( " \n " ) ; return 0 ; } if ( remote_phy_ -> nextchnl ( ) ) { printf ( " \n " ) ; return 0 ; } return ( ( SatLinkHead * ) remote_phy_ -> head ( ) ) ; }
This helper function assumes that the channel to which the link interface
is attached has one peer node (i.e., no other receive infs on channel)
This helper function assumes that the channel to which the link interface is attached has one peer node ( i . e . no other receive infs on channel )
// Link is not currently connected