LCOV - code coverage report
Current view: top level - vnsw/agent/oper - inet_interface.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 0 7 0.0 %
Date: 2026-06-22 02:21:21 Functions: 0 10 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
       3             :  */
       4             : 
       5             : #ifndef vnsw_agent_inet_interface_hpp
       6             : #define vnsw_agent_inet_interface_hpp
       7             : 
       8             : struct InetInterfaceData;
       9             : 
      10             : /////////////////////////////////////////////////////////////////////////////
      11             : // Implementation of inet interfaces created in host-os.
      12             : //
      13             : // Example interfaces:
      14             : // vhost0 : A L3 interface between host-os and vrouter. Used in KVM mode
      15             : // xenbr : A L3 interface between host-os and vrouter. Used in XEN mode
      16             : // xapi0 : A L3 interface for link-local subnets. Used in XEN mode
      17             : // vgw : A un-numbered L3 interface for simple gateway
      18             : /////////////////////////////////////////////////////////////////////////////
      19             : class InetInterface : public Interface {
      20             : public:
      21             :     enum SubType {
      22             :         VHOST,
      23             :         LINK_LOCAL,
      24             :         SIMPLE_GATEWAY
      25             :     };
      26             : 
      27             :     InetInterface(const std::string &name);
      28             :     InetInterface(const std::string &name, SubType sub_type, VrfEntry *vrf,
      29             :                   const Ip4Address &ip_addr, int plen, const Ip4Address &gw,
      30             :                   Interface *xconnect, const std::string &vn_name);
      31           0 :     virtual ~InetInterface() { }
      32             : 
      33             :     // DBTable virtual functions
      34             :     KeyPtr GetDBRequestKey() const;
      35           0 :     std::string ToString() const { return "INET <" + name() + ">"; }
      36             : 
      37             :     // The interfaces are keyed by name. No UUID is allocated for them
      38             :     virtual bool CmpInterface(const DBEntry &rhs) const;
      39           0 :     SubType sub_type() const { return sub_type_; }
      40           0 :     const Ip4Address &ip_addr() const { return ip_addr_; }
      41           0 :     Interface *xconnect() const { return xconnect_.get(); }
      42             : 
      43             :     void PostAdd();
      44             :     bool OnChange(InetInterfaceData *data);
      45             :     bool Delete(const DBRequest *req);
      46             :     void Activate();
      47             :     void DeActivate();
      48             : 
      49             :     void ActivateSimpleGateway();
      50             :     void DeActivateSimpleGateway();
      51             :     void ActivateHostInterface();
      52             :     void DeActivateHostInterface();
      53             :     void AddHostMulticastRoutes();
      54             :     void DelHostMulticastRoutes();
      55             : 
      56             :     // Helper functions
      57             :     static void Create(InterfaceTable *table, const std::string &ifname,
      58             :                        SubType sub_type, const std::string &vrf_name,
      59             :                        const Ip4Address &addr, int plen,
      60             :                        const Ip4Address &gw, const std::string &xconnect,
      61             :                        const std::string &vn_name,
      62             :                        Interface::Transport transport);
      63             :     static void CreateReq(InterfaceTable *table, const std::string &ifname,
      64             :                           SubType sub_type, const std::string &vrf_name,
      65             :                           const Ip4Address &addr, int plen,
      66             :                           const Ip4Address &gw, const std::string &xconnect,
      67             :                           const std::string &vn_name,
      68             :                           Interface::Transport transport);
      69             :     static void Delete(InterfaceTable *table, const std::string &ifname);
      70             :     static void DeleteReq(InterfaceTable *table, const std::string &ifname);
      71             : private:
      72             :     SubType sub_type_;
      73             :     Ip4Address ip_addr_;
      74             :     int plen_;
      75             :     Ip4Address gw_;
      76             :     InterfaceRef xconnect_;   // Physical interface for VHOST
      77             :     std::string vn_name_;
      78             :     DISALLOW_COPY_AND_ASSIGN(InetInterface);
      79             : };
      80             : 
      81             : struct InetInterfaceKey : public InterfaceKey {
      82             :     InetInterfaceKey(const std::string &name);
      83           0 :     virtual ~InetInterfaceKey() { }
      84             : 
      85             :     Interface *AllocEntry(const InterfaceTable *table) const;
      86             :     Interface *AllocEntry(const InterfaceTable *table,
      87             :                           const InterfaceData *data) const;
      88             :     InterfaceKey *Clone() const;
      89             : };
      90             : 
      91             : struct InetInterfaceData : public InterfaceData {
      92             :     InetInterfaceData(InetInterface::SubType sub_type,
      93             :                       const std::string &vrf_name, const Ip4Address &addr,
      94             :                       int plen, const Ip4Address &gw,
      95             :                       const std::string &xconnect, const std::string vn_name,
      96             :                       Interface::Transport transport);
      97           0 :     virtual ~InetInterfaceData() { }
      98             : 
      99             :     InetInterface::SubType sub_type_;
     100             :     Ip4Address ip_addr_;
     101             :     int plen_;
     102             :     Ip4Address gw_;
     103             :     std::string xconnect_;
     104             :     std::string vn_name_;
     105             : };
     106             : 
     107             : #endif // vnsw_agent_inet_interface_hpp

Generated by: LCOV version 1.14