LCOV - code coverage report
Current view: top level - vnsw/agent/controller - controller_route_walker.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 5 5 100.0 %
Date: 2026-08-03 02:19:58 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
       3             :  */
       4             : 
       5             : #ifndef vnsw_controller_route_walker_hpp
       6             : #define vnsw_controller_route_walker_hpp
       7             : 
       8             : #include <oper/agent_route_walker.h>
       9             : 
      10             : /*
      11             :  * Handles all kind of walks issued in context ofr controller i.e. bgp peer.
      12             :  * This walker is existing per peer. Internally it uses agent_route_walker.
      13             :  * Kind of walks supported are:
      14             :  * 1) NOTIFYALL - Walks all VRF and corresponding route table  to notify to peer
      15             :  * 2) NOTIFYMULTICAST - Only sends multicast entries from all tables to peer.
      16             :  * 3) DELPEER - Deletes path received from this peer from all.
      17             :  * 4) DELSTALE - Marks the path/info from this peer as stale and does not delete
      18             :  * it. In the case of unicast it marks peer path as stale and in multicast
      19             :  * it doesnt delete  the info sent by this peer.
      20             :  */
      21             : class ControllerRouteWalker : public AgentRouteWalker {
      22             : public:
      23             :     enum Type {
      24             :         NOTIFYALL,
      25             :         NOTIFYMULTICAST,
      26             :         DELPEER,
      27             :         DELSTALE,
      28             :     };
      29             : 
      30             :     ControllerRouteWalker(const std::string &name, Peer *peer);
      31          40 :     virtual ~ControllerRouteWalker() { }
      32             : 
      33             :     //Starts the walk- walk_done_cb is used to get callback when walk is over
      34             :     //i.e. all VRF and all corresponding route walks are over.
      35             :     void Start(Type type, bool associate,
      36             :                AgentRouteWalker::WalkDone walk_done_cb);
      37             :     void StartRouteWalk(VrfEntry *vrf, bool associate, Type type);
      38             :     //Callback for identifying walk complete of all route tables for given vrf
      39             :     void RouteWalkDoneForVrf(VrfEntry *vrf);
      40           2 :     void set_type(Type type) {type_ = type;}
      41             :     uint64_t sequence_number() const {return sequence_number_;}
      42           5 :     void set_sequence_number(uint64_t sequence_number) {
      43           5 :         sequence_number_ = sequence_number;
      44           5 :     }
      45             : 
      46             :     //Override vrf notification
      47             :     virtual bool VrfWalkNotify(DBTablePartBase *partition, DBEntryBase *e);
      48             :     //Override route notification
      49             :     virtual bool RouteWalkNotify(DBTablePartBase *partition, DBEntryBase *e);
      50             : 
      51             : private:
      52             :     //VRF notification handlers
      53             :     bool VrfNotifyInternal(DBTablePartBase *partition, DBEntryBase *e);
      54             :     bool VrfNotifyMulticast(DBTablePartBase *partition, DBEntryBase *e);
      55             :     bool VrfNotifyAll(DBTablePartBase *partition, DBEntryBase *e);
      56             :     bool VrfDelPeer(DBTablePartBase *partition, DBEntryBase *e);
      57             :     bool VrfDelStale(DBTablePartBase *partition, DBEntryBase *e);
      58             : 
      59             :     //Route notification handlers
      60             :     bool RouteNotifyInternal(DBTablePartBase *partition, DBEntryBase *e);
      61             :     bool RouteNotifyAll(DBTablePartBase *partition, DBEntryBase *e);
      62             :     bool RouteNotifyMulticast(DBTablePartBase *partition, DBEntryBase *e);
      63             :     bool RouteDelPeer(DBTablePartBase *partition, DBEntryBase *e);
      64             :     bool RouteDelStale(DBTablePartBase *partition, DBEntryBase *e);
      65             : 
      66             :     //Helpers
      67             :     bool IsDeleteWalk() const;
      68             :     bool IgnoreNotify();
      69             : 
      70             :     Peer *peer_;
      71             :     bool associate_;
      72             :     Type type_;
      73             :     uint64_t sequence_number_;
      74             :     DISALLOW_COPY_AND_ASSIGN(ControllerRouteWalker);
      75             : };
      76             : 
      77             : #endif

Generated by: LCOV version 1.14