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

📄 spfifc.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. *//* The definitions relating to OSPF interfaces. *//* The Interface timer definitions */class WaitTimer : public Timer {    class SpfIfc *ip;  public:    inline WaitTimer(class SpfIfc *);    virtual void action();};inline WaitTimer::WaitTimer(class SpfIfc *ifc){    ip = ifc;}class HelloTimer : public ITimer {    class SpfIfc *ip;  public:    inline HelloTimer(class SpfIfc *);    virtual void action();};inline HelloTimer::HelloTimer(class SpfIfc *ifc){    ip = ifc;}class DAckTimer : public Timer {    class SpfIfc *ip;  public:    inline DAckTimer(class SpfIfc *);    virtual void action();};inline DAckTimer::DAckTimer(class SpfIfc *ifc){    ip = ifc;}/* Cryptographic keys. Identified by Key ID, and providing * a 16-byte string to be used in an MD5 authentication * scheme. Also includes the time at which the key should be * activated. */class CryptK : public ConfigItem {    const byte key_id;    class SpfIfc *ip;    CryptK *link; 	// Chained in SpfIfc    byte key[16];    // key activation timers    // stop timers are optional    bool stop_generate_specified;    bool stop_accept_specified;    SPFtime start_accept;    SPFtime start_generate;    SPFtime stop_generate;    SPFtime stop_accept;  public:    inline CryptK(byte id) : key_id(id) {}    inline byte id() const { return key_id; }    inline const SpfIfc* interface() const { return ip; }    inline const byte* key_data() const { return key; }    inline const uns32 key_bytes() const { return sizeof(key)/sizeof(key[0]); }    inline bool stop_generate_set() const { return stop_generate_specified; }    inline bool stop_accept_set() const { return stop_accept_specified; }    inline const SPFtime& accept_start() const { return start_accept; }    inline const SPFtime& accept_stop() const { return stop_accept; }    inline const SPFtime& generate_start() const { return start_generate; }    inline const SPFtime& generate_stop() const { return stop_generate; }    virtual void clear_config();    friend class SpfIfc;    friend class KeyIterator;    friend class OSPF;};/* The OSPF interface class. Divided into two separate parts. * The first part contains the configurable interface parameters * (as described in Appendix C.3 of the OSPF specification). * Default values for some of these parameters is given in the * OSPF MIB, and replicated in the source file "default.h". * * The interface MTU, which is the size of the largest IP datagram * that can be sent out the interface w/o fragmentation, is also * considered a configuration parameter. * * Next come the dynamic interface variables. Many of these are * described in Section 9 of the OSPF specification. The finite * state machine structure contains the current state, and a pointer * to the table that actually drives the FSM. */class SpfIfc : public ConfigItem {  protected:    // Configurable parameters    InMask if_mask;	// Interface address mask    uns16 if_mtu;	// Max IP datagram in bytes    int if_type;	// Physical interface type    int	if_IfIndex;	// MIB-II IfIndex    uns16 if_cost;	// Cost    byte if_rxmt;	// Retransmission interval    byte if_xdelay;	// Transmission delay, in seconds    uns16 if_hint;	// Hello interval    uns32 if_dint;	// Router dead interval    uns32 if_pint;	// Poll interval (NBMA only)    byte if_drpri;	// Router priority    uns32 if_demand:1;	// Demand-based circuit?    autyp_t if_autype;	// Authentication type    byte if_passwd[8];	// Simple password    int if_passive;	// Don't send or receive control packets?    int	if_mcfwd;	// Multicast forwardimg    bool igmp_enabled;	// IGMP enabled on interface?    SpfArea *if_area;	// Associated OSPF area    CryptK *if_keys;	// Cryptographic keys    InAddr if_net; 	// Resulting network number    InAddr if_mcaddr;	// Multicast address to use    InAddr if_faddr;	// Address to use during flooding    // Dynamic parameters    SpfIfc *next; 	// Linked list of interfaces    SpfIfc  *anext; 	// List by area    Pkt	if_update;	// Pending update    Pkt	if_dack;	// Pending delayed acks    uns32 if_demand_helapse; // Elapsed time between demand hellos    // Dynamic parameters    InAddr if_dr; 	// Designated router    InAddr if_bdr; 	// Backup designated router    class SpfNbr *if_dr_p; // DR's neighbor structure    int	if_state;	// Current interface state    WaitTimer if_wtim;	// Wait timer    HelloTimer if_htim;	// Hello timer    DAckTimer if_actim;	// Delayed ack timer    bool in_recv_update;// in midst of processing received Link State Update?    bool area_flood;	// Participate in current area flood?    bool global_flood;	// Ditto for global scope    AVLtree LinkOpqLSAs;// Link-scoped Opaque-LSAs    uns32 db_xsum;	// Database checksum    // FSM action routines    virtual void ifa_start() = 0;    void ifa_nbr_start(int base_priority);    void ifa_elect();    void ifa_reset();    void ifa_allnbrs_event(int event);    // Virtual link parameters    SpfArea *if_tap;	// Transit area    rtid_t if_nbrid;	// Configured neighbor ID    InAddr if_rmtaddr;	// IP address of other end  public:    // Configurable parameters    InAddr if_addr;	// Interface IP address    int	if_phyint;	// The physical interface    class SpfNbr *if_nlst; // List of associated neighbors    int	if_nnbrs;	// Number of neighbors    int	if_nfull;	// Number of fully adjacent neighbors    int if_helping;	// # neighbors being helped through hitless restart    SpfIfc(InAddr addr, int phyint); // Constructor    virtual ~SpfIfc(); 	// Destructor    inline SpfArea *area() const;    inline int state() const;    inline InAddr net() const;    inline InAddr mask() const;    inline uns16 mtu() const;    inline int if_index() const;    inline byte drpri() const;    inline uns16 cost() const;    inline InAddr dr() const;    inline InAddr bdr() const;    inline byte rxmt_interval() const;    inline byte xmt_delay() const;    inline uns16 hello_int() const;    inline uns32 dead_int() const;    inline uns32 poll_int() const;    inline autyp_t autype() const;    inline const byte* passwd() const;    inline int mcfwd() const;    inline bool demand() const;    inline bool passive() const;    inline bool igmp() const;    bool demand_flooding(byte lstype) const;    inline void if_build_dack(LShdr *hdr);    inline void if_send_dack();    inline void if_send_update();    inline int unnumbered() const;    void restart();    void generate_message(Pkt *pdesc);    int verify(Pkt *pdesc, class SpfNbr *np);    void md5_generate(Pkt *pdesc);    int md5_verify(Pkt *pdesc, class SpfNbr *np);    void recv_hello(Pkt *pdesc);    void send_hello(bool empty=false);    int build_hello(Pkt *, uns16 size);    bool suppress_this_hello(SpfNbr *np);    int add_to_update(LShdr *hdr);    void if_build_ack(LShdr *hdr, Pkt *pkt=0, class SpfNbr *np=0);    void nl_orig(int forced); // Originate network-LSA    LShdr *nl_raw_orig();    void finish_pkt(Pkt *pdesc, InAddr addr);    void adjust_hello_interval(SpfNbr *np);    void nonbroadcast_send(Pkt *pdesc, InAddr addr);    void nonbroadcast_stop_hellos();    void nonbroadcast_restart_hellos();    void dump_stats(struct IfcRsp *irsp);    bool mospf_enabled();    void reorig_all_grplsas();    int type() const;    void run_fsm(int event);// Interface Finite state machine    bool is_virtual();    bool is_multi_access();    SpfArea *transit_area();    rtid_t *vl_endpt();    void AddTypesToList(byte lstype, LsaList *lp);    void delete_lsdb();    // Virtual functions    virtual void clear_config();    virtual void if_send(Pkt *, InAddr);    virtual void nbr_send(Pkt *, SpfNbr *); // send OSPF packet to neighbor    virtual class SpfNbr *find_nbr(InAddr, rtid_t);    virtual void set_id_or_addr(SpfNbr *, rtid_t, InAddr);    virtual RtrLink *rl_insert(RTRhdr *, RtrLink *) = 0;    virtual int rl_size();    virtual void add_adj_to_cand(class PriQ &cand) = 0;    virtual int adjacency_wanted(class SpfNbr *np);    virtual void send_hello_response(SpfNbr *np);    virtual void start_hellos();    virtual void restart_hellos();    virtual void stop_hellos();    virtual bool elects_dr();    virtual bool more_adjacencies_needed(rtid_t);    virtual MPath *add_parallel_links(MPath *, TNode *);    friend class PhyInt;    friend class IfcIterator;    friend class NbrIterator;    friend class KeyIterator;    friend class WaitTimer;    friend class HelloTimer;

⌨️ 快捷键说明

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