ns-allinone-2.35/ns-2.35/linkstate/ls.cc
int LsRetransmissionManager::messageOut(int peerId, 
					const LsMessage& msg)
{
	LsUnackPeer* peerPtr = findPtr(peerId);
	if (peerPtr == NULL) {
		iterator itr = insert(peerId, LsUnackPeer(this, peerId));
		if (itr == end()) { 
			ls_error ("Can't insert."); 
		}
		peerPtr = &((*itr).second);
	}
	LsIdSeq* idSeqPtr;
	switch (msg.type_) {
	case LS_MSG_TPM:
		peerPtr->tpmSeq_ = msg.sequenceNumber_;
		break;
	case LS_MSG_LSA:
		idSeqPtr =  peerPtr->lsaMap_.findPtr(msg.originNodeId_);
		if (idSeqPtr == NULL)
			peerPtr->lsaMap_.insert(msg.originNodeId_, 
				 LsIdSeq(msg.messageId_, msg.sequenceNumber_));
		else {
			idSeqPtr->msgId_ = msg.messageId_;
			idSeqPtr->seq_ = msg.sequenceNumber_;
		}
		break;
	case LS_MSG_TPMACK:
	case LS_MSG_LSAACK:
	case LS_MSG_LSM:
	default:
		// nothing, just to avoid compiler warning
		break;
	}
 
	// reschedule timer to allow account for this latest message
	peerPtr->timer_.resched(peerPtr->rtxTimeout_);
  
	return 0;
}
// Called by LsRouting when a message is sent out
Called by LsRouting when a message is sent out
Called by LsRouting when a message is sent out
int LsRetransmissionManager::messageOut(int peerId, 
					const LsMessage& msg)
{
	LsUnackPeer* peerPtr = findPtr(peerId);
	if (peerPtr == NULL) {
		iterator itr = insert(peerId, LsUnackPeer(this, peerId));
		if (itr == end()) { 
			ls_error ("Can't insert."); 
		}
		peerPtr = &((*itr).second);
	}
	LsIdSeq* idSeqPtr;
	switch (msg.type_) {
	case LS_MSG_TPM:
		peerPtr->tpmSeq_ = msg.sequenceNumber_;
		break;
	case LS_MSG_LSA:
		idSeqPtr =  peerPtr->lsaMap_.findPtr(msg.originNodeId_);
		if (idSeqPtr == NULL)
			peerPtr->lsaMap_.insert(msg.originNodeId_, 
				 LsIdSeq(msg.messageId_, msg.sequenceNumber_));
		else {
			idSeqPtr->msgId_ = msg.messageId_;
			idSeqPtr->seq_ = msg.sequenceNumber_;
		}
		break;
	case LS_MSG_TPMACK:
	case LS_MSG_LSAACK:
	case LS_MSG_LSM:
	default:
		break;
	}
	peerPtr->timer_.resched(peerPtr->rtxTimeout_);
	return 0;
}
int LsRetransmissionManager :: messageOut ( int peerId , const LsMessage & msg ) { LsUnackPeer * peerPtr = findPtr ( peerId ) ; if ( peerPtr == NULL ) { iterator itr = insert ( peerId , LsUnackPeer ( this , peerId ) ) ; if ( itr == end ( ) ) { ls_error ( " " ) ; } peerPtr = & ( ( * itr ) . second ) ; } LsIdSeq * idSeqPtr ; switch ( msg . type_ ) { case LS_MSG_TPM : peerPtr -> tpmSeq_ = msg . sequenceNumber_ ; break ; case LS_MSG_LSA : idSeqPtr = peerPtr -> lsaMap_ . findPtr ( msg . originNodeId_ ) ; if ( idSeqPtr == NULL ) peerPtr -> lsaMap_ . insert ( msg . originNodeId_ , LsIdSeq ( msg . messageId_ , msg . sequenceNumber_ ) ) ; else { idSeqPtr -> msgId_ = msg . messageId_ ; idSeqPtr -> seq_ = msg . sequenceNumber_ ; } break ; case LS_MSG_TPMACK : case LS_MSG_LSAACK : case LS_MSG_LSM : default : break ; } peerPtr -> timer_ . resched ( peerPtr -> rtxTimeout_ ) ; return 0 ; }
Called by LsRouting when a message is sent out
Called by LsRouting when a message is sent out
// nothing, just to avoid compiler warning // reschedule timer to allow account for this latest message