1
0
mirror of https://gitee.com/willfree/mlsr.git synced 2026-06-15 18:44:53 +08:00

LSDB:实现安装邻接lsa的功能

This commit is contained in:
free will
2022-06-03 22:19:27 +08:00
parent 4592b554ed
commit 1e2780ea1b
2 changed files with 38 additions and 8 deletions
+12
View File
@@ -37,6 +37,18 @@ func (l *AdjLsaAdjacenctList) Insert(info *AdjLsaAdjacencyInfo) {
l.lsaAdjacencys = append(l.lsaAdjacencys, info)
}
//
// InsertAdjacenctList
// @Description: 插入邻接列表
// @receiver l
// @param list
//
func (l *AdjLsaAdjacenctList) InsertAdjacenctList(list []*AdjLsaAdjacencyInfo) {
for i := 0; i < len(list); i++ {
l.Insert(list[i])
}
}
//
// getAdjList
// @Description: 获取包含所有邻接信息的邻接表
+26 -8
View File
@@ -190,8 +190,8 @@ func (l *Lsdb) ScheduleAdjLsaBuild() {
func (l *Lsdb) ProcessInterest(interest *packet.Interest) {
}
func (l Lsdb) processInterestForLsa() bool {
return true
func (l *Lsdb) processInterestForLsa(interest *packet.Interest,
originRouterIdentifier *component.Identifier, lsaType lsa.LsaType, seqNo uint64) {
}
func (l *Lsdb) ProcessGPPkt(pkt *packet.GPPkt) {
@@ -378,6 +378,20 @@ func (l *Lsdb) BuildAdjLsa() {
// @receiver l
//
func (l *Lsdb) BuildAndInstallOwnAdjLsa() {
// 根据配置文件,构造本机的名称LSA
adjLsa := new(lsa.AdjLsa)
adjLsa.SetOriginRouter(l.thisRouterPrefix)
adjLsa.SetSeqNo(l.sequencingManager.GetAdjLsaSeq() + 1) // 序列号
adjLsa.SetLsaExpirationTime(l.getLsaExpirationTimePoint()) // 超期时间
adjLsa.AdjLsaAdjacenctList.InsertAdjacenctList(l.mlsrConfig.GetAdjacencyList()) // 名称前缀列表
// 刷新序列号管理器中的名称LSA序列号
l.sequencingManager.IncreaseAdjLsaSeq()
// todo: 使用sync通知路由更新
// m_sync.publishRoutingUpdate(Lsa::Type::ADJACENCY, m_sequencingManager.getAdjLsaSeq());
// 安装lsa到LSDB
l.InstallLsa(adjLsa)
}
//
@@ -438,10 +452,14 @@ func (l *Lsdb) ExpireOrRefreshLsa(lsa lsa.ILsa) {
}
}
func (l *Lsdb) ProcessInterestForLsa(interest *packet.Interest,
originRouterIdentifier *component.Identifier, lsaType lsa.LsaType, seqNo uint64) {
}
//
// ExpressInterest
// @Description: 发送请求其它路由器LSA的兴趣包
// @receiver l
// @param interestName
// @param timeOut
// @param deadline
//
func (l *Lsdb) ExpressInterest(interestName *component.Identifier,
timeOut uint32, deadline *time.Time) {
}
@@ -458,7 +476,7 @@ func (l *Lsdb) ExpressInterest(interestName *component.Identifier,
// @param lsaName
// @param seqNo
//
func (l *Lsdb) OnFetchLsaError(errorCode uint32, msg string,
func (l *Lsdb) onFetchLsaError(errorCode uint32, msg string,
interestName *component.Identifier, retransmitNo uint32,
deadline *time.Time, lsaName *component.Identifier, seqNo uint64) {
}
@@ -472,7 +490,7 @@ func (l *Lsdb) OnFetchLsaError(errorCode uint32, msg string,
// @param buffer
// @param interestName
//
func (l *Lsdb) AfterFetchLsa(buffer bytes.Buffer, interestName *component.Identifier) {
func (l *Lsdb) afterFetchLsa(buffer bytes.Buffer, interestName *component.Identifier) {
}
func (l *Lsdb) getLsaExpirationTimePoint() uint64 {