📄 lspdb.h
字号:
/*# Copyright (C) 2001 Telia Research AB# # Author of this program is Kristian Svensson, kristian.svensson@home.se# # This program is free software; you can redistribute it and/or# modify it under the terms of the GNU General Public License# as published by the Free Software Foundation; either version 2# of the License, or (at your option) any later version.# # This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.# # You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.#*/#ifndef LSP_DB_H#define LSP_DB_H#include <agent.h>#include <lib/bsd-list.h>#include <packet.h>#include "isis.h"#include "Hdr_ISIS.h"#include "clnp.h"#include "rtProtoISIS.h"#include "isisneighborlist.h"#include "packet.h"class MinLspTransmissionTimer : public TimerHandler { public: MinLspTransmissionTimer() : TimerHandler(){} inline virtual void expire(Event* e); //select one function to use private:};/*class SPFdelayTimer : public TimerHandler { public: SPFdelayTimer() : TimerHandler(){ } inline virtual void expire(Event*); // Replaces sched function of TimerHandler, this one does nothing if // timer is not idle void schedule(double delay, u_int32_t seqNr_, u_int64_t srcId); //select the function to use private: LspManager *lspm; u_int32_t seqNr; u_int64_t srcId;};*/class ZeroAgeLifeTimer : public TimerHandler { public: ZeroAgeLifeTimer( ) : TimerHandler(){} void expire(Event *); private:};class MinLspGenerationTimer : public TimerHandler{ public: MinLspGenerationTimer() : TimerHandler(){} inline virtual void expire(Event*); private: int sourceId;};class PsnpIntervalTimer : public TimerHandler { public: PsnpIntervalTimer(int neighId_) : TimerHandler(){} //void expire(Event *); private: int neighId;};class MaxLspGenerationTimer : public TimerHandler { public: MaxLspGenerationTimer() : TimerHandler(){} // inline virtual void expire(Event*); private: // int neighborId;};/*class LspThrottleTimer : public TimerHandler { public: LspThrottleTimer(int dstId_) : TimerHandler(){} void send(IsisPduLsp *pdu); void expire(Event *); private: LspManager *lspm; int dstId; queue<IsisPduLsp *> q;};class ClockTimer : public TimerHandler { public: ClockTimer(LspManager *lspm_) : lspm(lspm_) {} void expire(Event *); private: LspManager *lspm;};*/class LspDbEntry;class LspHoldingTimer : public TimerHandler { public: LspHoldingTimer(LspDbEntry* a) : TimerHandler() { a_ = a; } void expire(Event* e); private: LspDbEntry* a_; };class LspDbEntry { friend class LspHoldingTimer; friend class LspDb; friend class ZeroAgeLifeTimer; friend class PsnpIntervalTimer; friend class rtProtoISIS; friend class ISISNeighborList; friend class ISISNeighborItem; friend class ISISRouteItem; friend class ISISRouteTable; public: LspDbEntry() : ht(this) { } inline Packet* packet(){return p_;} void deleteLspDbEntry(Packet* p); void deleteLspDbEntry(clnpaddr_t addr); void setupTimer(); LspDbEntry* getLspItem(); LspId getLspId(); protected: Packet *p_; LspHoldingTimer ht; LspDb *lsp_db; LIST_ENTRY(LspDbEntry) link;}; class LspDb { //LSP head pointer friend class LspDbEntry; friend class rtProtoISIS; friend class ISISNeighborList; friend class ISISNeighborItem; friend class ISISRouteItem; friend class ISISRouteTable; public: LspDb(){ LIST_INIT(&lspdbhead); routechanged = false; } void deleteLspDbEntry(Packet* p); void deleteLspDbEntry(clnpaddr_t addr); void addLspDbEntry(Packet* p); void addLspDbEntry(hdr_isis* isish,hdr_isislsp* isislsph,cl_isislsp* cl_isislsph,value_isislsp* value_isislsp); LspDbEntry* selectLspDbEntry(LspId * lspid,u_int32_t seqN); LspDbEntry* selectLspDbEntry(u_int32_t a); void computeRoute(); bool routeChanged(); bool changeState(clnpaddr_t, IsisState); void getLspDb(ISISNeighborList * firstnl); int getNodeNum(); void sendLspMessage(); void sendCsnpMessage(clnpaddr_t dst); void dumpLsp(); void createMGraph(MGraph G); inline void setIsisAgent(rtProtoISIS* a){ISISagent=a;} LspDbEntry* recv(Packet*,clnpaddr_t src);private: LIST_HEAD(ISISLspList, LspDbEntry) lspdbhead; bool routechanged; rtProtoISIS* ISISagent;};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -