LCOV - code coverage report
Current view: top level - vnsw/agent/oper - inet4_multicast_route.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 5 43 11.6 %
Date: 2026-08-03 02:19:58 Functions: 4 24 16.7 %
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_inet4_multicast_route_hpp
       6             : #define vnsw_inet4_multicast_route_hpp
       7             : 
       8             : //////////////////////////////////////////////////////////////////
       9             : //  MULTICAST INET4
      10             : /////////////////////////////////////////////////////////////////
      11             : class Inet4MulticastAgentRouteTable : public AgentRouteTable {
      12             : public:
      13          12 :     Inet4MulticastAgentRouteTable(DB *db, const std::string &name) :
      14             :         AgentRouteTable(db, name),
      15          12 :         walkid_(DBTableWalker::kInvalidWalkerId) { };
      16          24 :     virtual ~Inet4MulticastAgentRouteTable() { };
      17             :     virtual AgentSandeshPtr GetAgentSandesh(const AgentSandeshArguments *args,
      18             :                                             const std::string &context);
      19             :     // Nexthop will be stored in path as localvmpeer so that it falls in line
      20             :     // Override virtual routines for no action w.r.t. multicast
      21           0 :     virtual string GetTableName() const {
      22           0 :         return "Inet4MulticastAgentRouteTable";
      23             :     }
      24          62 :     virtual Agent::RouteTableType GetTableType() const {
      25          62 :         return Agent::INET4_MULTICAST;
      26             :     }
      27             : 
      28             :     void McRtRouteNotifyDone(DBTableBase *base, DBState *);
      29             :     void AddVHostRecvRoute(const string &vm_vrf,
      30             :                            const string &interface_name,
      31             :                            const Ip4Address &addr,
      32             :                            bool policy);
      33             :     Inet4MulticastRouteEntry *FindRoute(const Ip4Address &grp_addr,
      34             :                            const Ip4Address &src_addr);
      35             :     static DBTableBase *CreateTable(DB *db, const std::string &name);
      36             :     static void AddMulticastRoute(const string &vn_name, const string &vrf_name,
      37             :                                   const Ip4Address &src_addr,
      38             :                                   const Ip4Address &grp_addr,
      39             :                                   ComponentNHKeyList &component_nh_key_list);
      40             :     static void AddMulticastRoute(const Peer *peer,
      41             :                                   const string &vrf_name,
      42             :                                   const Ip4Address &src_addr,
      43             :                                   const Ip4Address &grp_addr,
      44             :                                   uint32_t ethernet_tag,
      45             :                                   AgentRouteData *data);
      46             :     static void DeleteMulticastRoute(const string &vrf_name,
      47             :                                      const Ip4Address &src_addr,
      48             :                                      const Ip4Address &grp_addr);
      49             :     static void DeleteMulticastRoute(const Peer *peer,
      50             :                                      const string &vrf_name,
      51             :                                      const Ip4Address &src_addr,
      52             :                                      const Ip4Address &grp_addr,
      53             :                                      uint32_t ethernet_tag,
      54             :                                      COMPOSITETYPE type);
      55             :     static void Delete(const string &vrf_name, const Ip4Address &src_addr,
      56             :                        const Ip4Address &grp_addr);
      57             : private:
      58             :     DBTableWalker::WalkId walkid_;
      59             :     DISALLOW_COPY_AND_ASSIGN(Inet4MulticastAgentRouteTable);
      60             : };
      61             : 
      62             : class Inet4MulticastRouteEntry : public AgentRoute {
      63             : public:
      64           0 :     Inet4MulticastRouteEntry(VrfEntry *vrf, const Ip4Address &dst,
      65           0 :                              const Ip4Address &src) :
      66           0 :         AgentRoute(vrf, true), dst_addr_(dst), src_addr_(src) {
      67           0 :     }
      68           0 :     virtual ~Inet4MulticastRouteEntry() { }
      69             : 
      70             :     virtual int CompareTo(const Route &rhs) const;
      71             :     virtual string ToString() const;
      72             :     virtual KeyPtr GetDBRequestKey() const;
      73             :     virtual void SetKey(const DBRequestKey *key);
      74             :     virtual bool ReComputePathAdd(AgentPath *path);
      75             :     virtual bool ReComputePathDeletion(AgentPath *path);
      76           0 :     virtual const string GetAddressString() const {
      77           0 :         return dst_addr_.to_string();
      78             :     }
      79           0 :     virtual const string GetSourceAddressString() const {
      80           0 :         return src_addr_.to_string();
      81             :     }
      82             :     virtual bool DBEntrySandesh(Sandesh *sresp, bool stale) const;
      83           0 :     virtual Agent::RouteTableType GetTableType() const {
      84           0 :         return Agent::INET4_MULTICAST;
      85             :     }
      86             :     bool DBEntrySandesh(Sandesh *sresp, const Ip4Address &src_addr,
      87             :                             const Ip4Address &dst_addr, bool stale) const;
      88             : 
      89           0 :     void set_dest_ip_addr(const Ip4Address &dst) {dst_addr_ = dst;}
      90           0 :     void set_src_ip_addr(const Ip4Address &src) {src_addr_ = src;}
      91           0 :     const Ip4Address &src_ip_addr() const {return src_addr_;}
      92           0 :     const Ip4Address &dest_ip_addr() const {return dst_addr_;}
      93           0 :     virtual Composite::Type GetMulticastCompType() { return Composite::L3COMP; }
      94             : 
      95             : private:
      96             :     Ip4Address dst_addr_;
      97             :     Ip4Address src_addr_;
      98             :     DISALLOW_COPY_AND_ASSIGN(Inet4MulticastRouteEntry);
      99             : };
     100             : 
     101             : class Inet4MulticastRouteKey : public AgentRouteKey {
     102             : public:
     103           0 :     Inet4MulticastRouteKey(const Peer *peer, const string &vrf_name,
     104             :                            const Ip4Address &dip,
     105             :                            const Ip4Address &sip,
     106           0 :                            uint32_t ethernet_tag) :
     107             :         AgentRouteKey(peer, vrf_name),
     108           0 :         dip_(dip), sip_(sip), ethernet_tag_(ethernet_tag) {
     109           0 :     }
     110           0 :     Inet4MulticastRouteKey(const string &vrf_name,const Ip4Address &dip,
     111           0 :                            const Ip4Address &sip) :
     112             :         AgentRouteKey(Agent::GetInstance()->multicast_peer(), vrf_name),
     113           0 :         dip_(dip), sip_(sip) {
     114           0 :         ethernet_tag_ = 0;
     115           0 :     }
     116           0 :     Inet4MulticastRouteKey(const string &vrf_name, const Ip4Address &dip) :
     117             :         AgentRouteKey(Agent::GetInstance()->multicast_peer(), vrf_name),
     118           0 :         dip_(dip) {
     119           0 :         boost::system::error_code ec;
     120           0 :         sip_ =  IpAddress::from_string("0.0.0.0", ec).to_v4();
     121           0 :         ethernet_tag_ = 0;
     122           0 :     }
     123             :     Inet4MulticastRouteKey(const string &vrf_name) :
     124             :         AgentRouteKey(Agent::GetInstance()->multicast_peer(), vrf_name) {
     125             :             boost::system::error_code ec;
     126             :             dip_ =  IpAddress::from_string("255.255.255.255", ec).to_v4();
     127             :             sip_ =  IpAddress::from_string("0.0.0.0", ec).to_v4();
     128             :             ethernet_tag_ = 0;
     129             :     }
     130           0 :     virtual ~Inet4MulticastRouteKey() { }
     131             :     virtual AgentRoute *AllocRouteEntry(VrfEntry *vrf, bool is_multicast) const;
     132           0 :     virtual Agent::RouteTableType GetRouteTableType() {
     133           0 :        return Agent::INET4_MULTICAST;
     134             :     }
     135             :     virtual AgentRouteKey *Clone() const;
     136             :     virtual string ToString() const;
     137             : 
     138           0 :     const Ip4Address &dest_ip_addr() const {return dip_;}
     139           0 :     const Ip4Address &src_ip_addr() const {return sip_;}
     140             : 
     141             : private:
     142             :     Ip4Address dip_;
     143             :     Ip4Address sip_;
     144             :     uint32_t ethernet_tag_;
     145             :     DISALLOW_COPY_AND_ASSIGN(Inet4MulticastRouteKey);
     146             : };
     147             : 
     148             : #endif // vnsw_inet4_multicast_route_hpp

Generated by: LCOV version 1.14