⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ospf.h

📁 BCAST Implementation for NS2
💻 H
📖 第 1 页 / 共 2 页
字号:
/* *   OSPFD routing daemon *   Copyright (C) 1998 by John T. Moy *    *   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. */// Stl list for query all routines#include <list>// Interval timer. When fires, database aging performed.class DBageTimer : public ITimer {  public:    virtual void action();};// Exit database overflow timer.class ExitOverflowTimer : public ITimer {  public:    virtual void action();};// Local LSA origination rate limitingclass LocalOrigTimer : public ITimer {  public:    virtual void action();};// Hitless Restart Preparation Timerclass HitlessPrepTimer : public Timer {  public:    virtual void action();};// Hitless Restart Timerclass HitlessRSTTimer : public Timer {  public:    virtual void action();};// Global timer queueextern PriQ timerq;		// Currently pending timers/* The OSPF base class. This class contains all the data necessary * to run a sungle instance of the OSPF protocol. */class OSPF : public ConfigItem {    // Global configuration data    const rtid_t myid;	// Our router ID    bool inter_area_mc; // An inter-area multicast forwarder?    bool g_mospf_enabled;// Running multicast extensions?    int	ExtLsdbLimit;	// Max # AS-external-LSAs in database    int	ExitOverflowInterval; // Elapsed time before leaving overflow    int	new_flood_rate; // # self-orig per second    uns16 max_rxmt_window;// # back-to-back retransmissions    byte max_dds;	// # simultaneous DB exchanges    byte host_mode;	// Don't forward data packets?    int32 refresh_rate;	// Rate to refresh DoNotAge LSAs    uns32 PPAdjLimit;	// Max # p-p adjacencies to neighbor    bool random_refresh;// Should we spread out LSA refreshes?    // Dynamic data    InAddr myaddr;	// Global address: source on unnumbered    bool wakeup; 	// Timers running?    SpfIfc *ifcs; 	// List of interfaces    int	inter_AS_mc:1;	// Are we an inter-AS multicast forwarder?    int n_extImports;	// # Imported AS externals    AVLtree extLSAs;	// AS-external-LSAs    AVLtree ASOpqLSAs;	// AS-scoped Opaque-LSAs    uns32 ase_xsum;	// checksum of AS-external-LSAs    AVLtree ASBRtree;	// AVL tree of ASBRs    ASBRrte *ASBRs; 	// Singly-linked ASBR routing table entries    int	n_exlsas;	// # non-default AS-external-LSAs    uns32 wo_donotage;	// #LSAs claiming no DoNotAge support    bool dna_change;	// Change in network DoNotAge support    LsaList dna_flushq; // DoNotAge LSAs being flushed from lack of support    SpfNbr *g_adj_head;	// Adjacencies to form, head    SpfNbr *g_adj_tail;	// Adjacencies to form, tail    byte *build_area;	// build area    uns16 build_size;	// size of build area    byte *orig_buff;	// Origination staging area    uns16 orig_size;	// size of staging area    bool orig_buff_in_use;// Staging area being used?    uns32 n_orig_allocs;// # allocs for staging area    byte *mon_buff;	// Monitor replay staging area    int mon_size;	// size of staging area    int	shutdown_phase;	// Shutting down if > 0    int	countdown;	// Number of seconds before exit    int hitless_prep_phase;// Hitless restart version    int phase_duration; // Time in current phase    HitlessPrepTimer htltim;    int grace_period;	// Length of grace period (current or next)    byte restart_reason;// Encoding in lshdr.h    TLVbuf tlvbuf;	// Buffer in which grace-LSAs are built    bool delete_neighbors; // Neighbors being deleted?    AVLtree phyints;	// Physical interfaces    AVLtree krtdeletes;	// Deleted, unsynced kernel routing entries    bool need_remnants; // Yet to get remnants?    // Flooding queues    int	n_local_flooded;// AS-external-LSAs originated this tick    ExRtData *ases_pending; // Pending AS-external-LSA originations    ExRtData *ases_end;	// End of pending AS-external-LSAs    LocalOrigTimer origtim; // AS-external-LSA origination timer    LsaList replied_list; // LSAs that we have recently sent			 // in reponse to old LSAs received    // For LSA aging    DBageTimer dbtim;	// Database aging timer    LsaList MaxAge_list; // MaxAge LSAs, being flushed    uns32 total_lsas;	// Total number of LSAs in all databases    LsaList dbcheck_list; // LSAs whose checksum is being verified    LsaList pending_refresh; // LSAs awaiting refresh    // Database Overflow variables    bool OverflowState;	// true => database has overflowed    ExitOverflowTimer oflwtim; // Exit overflow timer    // Group membership    AVLtree ospfd_membership; // Our application's    AVLtree local_membership; // Of local LAN segments    AVLtree multicast_cache; // MOSPF Cache entries    bool clear_mospf;	// Delete cache on next timer tick?    SpfArea *areas; 	// List of areas    SpfArea *summary_area;    SpfArea *first_area;    int	n_area;		// Number of actively attached areas    int	n_dbx_nbrs;	// # nbrs undergoing database exchange    int	n_lcl_inits;	// # locally initiated    int	n_rmt_inits;	// # remotely initiated    uns16 ospf_mtu;	// Max IP datagram for all interfaces    Pkt	o_update;	// Current flood    Pkt	o_demand_upd;	// Current flood out demand interfaces    // State flags    int	full_sched:1,	// true => full calculation scheduled	ase_sched:1;	// true => all ases should be reexamined    // Statistics    uns32 n_dijkstras;    // Logging variables    int logno;		// Logging event number    char logbuf[200];   // Logging buffer    char *logptr;       // Current place in logging buffer    char *logend;	// End of logging buffer    int base_priority;    bool disabled_msgno[MAXLOG+1];    bool enabled_msgno[MAXLOG+1];    AVLtree opq_uploads; // Opaque-LSA requesting connections    // Hitless restart variables    HitlessRSTTimer hlrsttim; // Timing grace period    AVLtree remnants;	// Entries installed before restart	    bool start_htl_exit;    bool exiting_htl_restart;    bool check_htl_termination;    const char *htl_exit_reason;    // Helper variables    bool topology_change;    SPFtime start_time;    int n_helping;	// # neighbors being helped    // Monitoring routines    class MonMsg *get_monbuf(int size);    void global_stats(class MonMsg *, int conn_id);    void area_stats(class MonMsg *, int conn_id);    void interface_stats(class MonMsg *, int conn_id);    void vl_stats(class MonMsg *, int conn_id);    void neighbor_stats(class MonMsg *, int conn_id);    void vlnbr_stats(class MonMsg *, int conn_id);    void lsa_stats(class MonMsg *, int conn_id);    void rte_stats(class MonMsg *, int conn_id);    void opq_stats(class MonMsg *, int con_id);    void lllsa_stats(class MonMsg *, int conn_id);    // Utility routines    void clear_config();    SpfIfc *find_ifc(uns32 addr, int phyint = -1) const;    SpfIfc *next_ifc(uns32 addr, int phyint);    SpfIfc *find_ifc(Pkt *pdesc);    SpfIfc *find_vl(aid_t transit_id, rtid_t endpt);    SpfIfc *next_vl(aid_t transit_id, rtid_t endpt);    SpfIfc *find_nbr_ifc(InAddr nbr_addr) const;    SpfNbr *find_nbr(InAddr nbr_addr, int phyint);    SpfNbr *next_nbr(InAddr nbr_addr, int phyint);    int run_fsm(FsmTran *table, int& i_state, int event);    int	ospf_getpkt(Pkt *pkt, int type, uns16 size);    void ospf_freepkt(Pkt *pkt);    void delete_down_neighbors();    void app_join(int phyint, InAddr group);    void app_leave(int phyint, InAddr group);    void phy_attach(int phyint);    void phy_detach(int phyint, InAddr if_addr);    void calc_my_addr();    LShdr *orig_buffer(int ls_len);    void free_orig_buffer(LShdr *);    inline int mospf_enabled();    inline bool	mc_abr();    inline int donotage();    inline InAddr my_addr();    // Database routines    AVLtree *FindLSdb(SpfIfc *, SpfArea *ap, byte lstype);    LSA	*FindLSA(SpfIfc *, SpfArea *, byte lstype, lsid_t lsid, rtid_t rtid);    LSA	*myLSA(SpfIfc *, SpfArea *, byte lstype, lsid_t lsid);    LSA	*AddLSA(SpfIfc *,SpfArea *, LSA *current, LShdr *hdr, bool changed);    void DeleteLSA(LSA *lsap);    LSA *NextLSA(aid_t, byte, lsid_t, rtid_t);    LSA *NextLSA(InAddr, int, aid_t, byte, lsid_t, rtid_t);    void update_lsdb_xsum(LSA *, bool add);    Range *GetBestRange(INrte *rte);    SpfArea *FindArea(aid_t id) const;    SpfArea *NextArea(aid_t &id) const;    inline SpfArea *SummaryArea();	// summary-LSAs from this area used    void ParseLSA(LSA *lsap, LShdr *hdr);    void UnParseLSA(LSA *lsap);    LShdr *BuildLSA(LSA *lsap, LShdr *hdr=0);    void send_updates();    bool maxage_free(byte lstype);    void flush_self_orig(AVLtree *tree);    void flush_donotage();    void shutdown_continue();    void rl_orig();    void delete_from_ifmap(SpfIfc *ip);    void upload_opq(LSA *);    // Database aging    void dbage();    void deferred_lsas();    void checkages();    void refresh_lsas();    void maxage_lsas();    void refresh_donotages();    void free_maxage_lsas();    void donotage_changes();    void schedule_refresh(LSA *);    void do_refreshes();    // LSA origination    int	self_originated(SpfNbr *, LShdr *hdr, LSA *database_copy);    int	get_lsid(INrte *rte, byte lstype, SpfArea *ap, lsid_t &id);    seq_t ospf_get_seqno(byte lstype, LSA *lsap, int forced);    LSA	*lsa_reorig(SpfIfc *,SpfArea *ap, LSA *olsap, LShdr *hdr, int forced);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -