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

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2017 Juniper Networks, Inc. All rights reserved.
       3             :  */
       4             : #ifndef SRC_VNSW_AGENT_OPER_ROUTE_LEAK_H__
       5             : #define SRC_VNSW_AGENT_OPER_ROUTE_LEAK_H__
       6             : 
       7             : struct RouteLeakState :  public DBState {
       8           0 :     RouteLeakState(Agent *agent, VrfEntry *vrf):
       9           0 :         agent_(agent), dest_vrf_(vrf) {}
      10             : 
      11             :     void AddRoute(const AgentRoute *route);
      12             :     void DeleteRoute(const AgentRoute *route,
      13             :                      const std::set<const Peer *> &peer_list);
      14             : 
      15           0 :     void set_dest_vrf(VrfEntry *vrf) {
      16           0 :         dest_vrf_ = vrf;
      17           0 :     }
      18             : 
      19           0 :     VrfEntry* dest_vrf() const {
      20           0 :         return dest_vrf_.get();
      21             :     }
      22             : 
      23           0 :     std::set<const Peer *>& peer_list() {
      24           0 :         return peer_list_;
      25             :     }
      26             : 
      27             : private:
      28             :     void AddIndirectRoute(const AgentRoute *route);
      29             :     void AddInterfaceRoute(const AgentRoute *route, const AgentPath *path);
      30             :     void AddReceiveRoute(const AgentRoute *route);
      31             :     void AddCompositeRoute(const AgentRoute *route);
      32             :     bool CanAdd(const InetUnicastRouteEntry *route);
      33             :     Agent *agent_;
      34             :     VrfEntryRef dest_vrf_;
      35             :     std::set<const Peer *> peer_list_;
      36             : };
      37             : 
      38             : class RouteLeakVrfState : public DBState {
      39             : public:
      40             :     RouteLeakVrfState(VrfEntry *source_vrf, VrfEntry *dest_vrf);
      41             :     ~RouteLeakVrfState();
      42             :     //Route Notify handler
      43             :     bool Notify(DBTablePartBase *partition, DBEntryBase *e);
      44             :     void Delete();
      45             :     void SetDestVrf(VrfEntry *dest_vrf);
      46             : 
      47           0 :     VrfEntry* dest_vrf() {
      48           0 :         return dest_vrf_.get();
      49             :     }
      50           0 :     bool deleted() const { return deleted_; }
      51             : 
      52             : private:
      53             :     void WalkDoneInternal(DBTableBase *part);
      54             :     bool WalkCallBack(DBTablePartBase *partition, DBEntryBase *entry);
      55             :     void AddDefaultRoute();
      56             :     void DeleteDefaultRoute();
      57             :     //VRF from which routes have to be sourced
      58             :     VrfEntryRef source_vrf_;
      59             :     //VRF to which routes have to be mirrored
      60             :     VrfEntryRef dest_vrf_;
      61             :     DBTableBase::ListenerId route_listener_id_;
      62             :     DBTable::DBTableWalkRef walk_ref_;
      63             :     bool deleted_;
      64             : };
      65             : 
      66             : //Base class registering to VRF table.
      67             : //If route have to be leaked from one VRF to another takes case of it.
      68             : class RouteLeakManager {
      69             : public:
      70             :     RouteLeakManager(Agent *agent);
      71             :     ~RouteLeakManager();
      72             : 
      73             :     Agent *agent() {
      74             :         return agent_;
      75             :     }
      76             : 
      77             :     //VRF notify handler
      78             :     void Notify(DBTablePartBase *partition, DBEntryBase *e);
      79             :     void ReEvaluateRouteExports();
      80             : 
      81             : private:
      82             :     bool VrfWalkNotify(DBTablePartBase *partition, DBEntryBase *e);
      83             :     void VrfWalkDone(DBTableBase *part);
      84             :     void StartRouteWalk(VrfEntry *vrf, RouteLeakVrfState *state);
      85             :     void RouteWalkDone(DBTableBase *part);
      86             : 
      87             :     Agent *agent_;
      88             :     DBTable::DBTableWalkRef vrf_walk_ref_;
      89             :     DBTableBase::ListenerId vrf_listener_id_;
      90             : };
      91             : #endif

Generated by: LCOV version 1.14