xorp

vlink.hh

00001 // -*- c-basic-offset: 4; tab-width: 8; indent-tabs-mode: t -*-
00002 // vim:set sts=4 ts=8:
00003 
00004 // Copyright (c) 2001-2009 XORP, Inc.
00005 //
00006 // This program is free software; you can redistribute it and/or modify
00007 // it under the terms of the GNU General Public License, Version 2, June
00008 // 1991 as published by the Free Software Foundation. Redistribution
00009 // and/or modification of this program under the terms of any other
00010 // version of the GNU General Public License is not permitted.
00011 // 
00012 // This program is distributed in the hope that it will be useful, but
00013 // WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
00015 // see the GNU General Public License, Version 2, a copy of which can be
00016 // found in the XORP LICENSE.gpl file.
00017 // 
00018 // XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
00019 // http://xorp.net
00020 
00021 // $XORP: xorp/ospf/vlink.hh,v 1.14 2008/10/02 21:57:50 bms Exp $
00022 
00023 #ifndef __OSPF_VLINK_HH__
00024 #define __OSPF_VLINK_HH__
00025 
00029 template <typename A>
00030 class Vlink {
00031  public:
00035     bool create_vlink(OspfTypes::RouterID rid);
00036 
00040     bool delete_vlink(OspfTypes::RouterID rid);
00041 
00045     bool set_transit_area(OspfTypes::RouterID rid,
00046               OspfTypes::AreaID transit_area);
00047 
00051     bool get_transit_area(OspfTypes::RouterID rid,
00052               OspfTypes::AreaID& transit_area) const;
00053 
00058     bool set_transit_area_notified(OspfTypes::RouterID rid, bool state);
00059 
00063     bool get_transit_area_notified(OspfTypes::RouterID rid) const;
00064 
00068     bool add_address(OspfTypes::RouterID rid, A source, A destination);
00069 
00073     bool get_address(OspfTypes::RouterID rid, A& source, A& destination);
00074 
00079     bool get_interface_vif(OspfTypes::RouterID rid, string& interface,
00080                string& vif) const;
00081 
00085     bool add_peerid(OspfTypes::RouterID rid, OspfTypes::PeerID peerid);
00086 
00090     OspfTypes::PeerID get_peerid(OspfTypes::RouterID rid) const;
00091 
00095     bool set_physical_interface_vif(OspfTypes::RouterID rid, string& interface,
00096                     string& vif);
00097 
00102     bool get_physical_interface_vif(A source, A destination, string& interface,
00103                     string& vif) const;
00104 
00109     OspfTypes::PeerID get_peerid(A source, A destination) const;
00110 
00115     void get_router_ids(OspfTypes::AreaID transit_area,
00116             list<OspfTypes::RouterID>& rids) const;
00117 
00122     void area_removed(OspfTypes::AreaID area);
00123 
00124  private:
00128     struct Vstate {
00129     Vstate() : 
00130         _peerid(OspfTypes::ALLPEERS),   // Illegal value for a PeerID.
00131         _transit_area(OspfTypes::BACKBONE), // Again an illegal value.
00132         _notified(false)
00133     {}
00134 
00135     OspfTypes::PeerID _peerid;      // PeerID of virtual link
00136     OspfTypes::AreaID _transit_area;    // Transit area for the link
00137     // True if the transit area has been notified.
00138     bool _notified;
00139     A _source;              // Source address
00140     A _destination;             // Destination address
00141     // Required for transmission.
00142     string _physical_interface;     // Actual interface
00143     string _physical_vif;           // Actual vif
00144     };
00145 
00146     map <OspfTypes::RouterID, Vstate> _vlinks;
00147 };
00148 
00149 #endif // __OSPF_VLINK_HH__
 All Classes Namespaces Functions Variables Typedefs Enumerations