LCOV - code coverage report
Current view: top level - bgp/rtarget - rtarget_table.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 5 6 83.3 %
Date: 2026-11-09 02:10:49 Functions: 3 4 75.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
       3             :  * Copyright Contributors to the OpenSDN project
       4             :  */
       5             : 
       6             : #ifndef SRC_BGP_RTARGET_RTARGET_TABLE_H_
       7             : #define SRC_BGP_RTARGET_RTARGET_TABLE_H_
       8             : 
       9             : #include <atomic>
      10             : #include <string>
      11             : 
      12             : #include "bgp/bgp_attr.h"
      13             : #include "bgp/bgp_table.h"
      14             : #include "bgp/rtarget/rtarget_address.h"
      15             : #include "bgp/rtarget/rtarget_route.h"
      16             : 
      17             : class BgpServer;
      18             : class BgpRoute;
      19             : 
      20             : class RTargetTable : public BgpTable {
      21             : public:
      22             :     struct RequestKey : BgpTable::RequestKey {
      23      162124 :         RequestKey(const RTargetPrefix &prefix, const IPeer *ipeer)
      24      162124 :             : prefix(prefix), peer(ipeer) {
      25      162125 :         }
      26             :         RTargetPrefix prefix;
      27             :         const IPeer *peer;
      28      119889 :         virtual const IPeer *GetPeer() const { return peer; }
      29             :     };
      30             : 
      31             :     RTargetTable(DB *db, const std::string &name);
      32             : 
      33             :     virtual std::unique_ptr<DBEntry> AllocEntry(const DBRequestKey *key) const;
      34             :     virtual std::unique_ptr<DBEntry> AllocEntryStr(const std::string &key) const;
      35             : 
      36      623023 :     virtual Address::Family family() const { return Address::RTARGET; }
      37             : 
      38             :     virtual size_t Hash(const DBEntry *entry) const;
      39             :     virtual size_t Hash(const DBRequestKey *key) const;
      40             : 
      41             :     virtual BgpRoute *RouteReplicate(BgpServer *server, BgpTable *src_table,
      42             :                                      BgpRoute *src_rt, const BgpPath *path,
      43             :                                      ExtCommunityPtr ptr);
      44             : 
      45             :     virtual bool Export(RibOut *ribout, Route *route,
      46             :                         const RibPeerSet &peerset,
      47             :                         UpdateInfoSList &info_slist);
      48             :     static DBTableBase *CreateTable(DB *db, const std::string &name);
      49           0 :     time_t last_updated() const { return last_updated_; }
      50             : 
      51             : private:
      52             :     virtual BgpRoute *TableFind(DBTablePartition *rtp,
      53             :                                 const DBRequestKey *prefix);
      54             :     void AddRemoveCallback(const DBEntryBase *entry, bool add) const;
      55             : 
      56             :     mutable std::atomic<time_t> last_updated_;
      57             : 
      58             :     DISALLOW_COPY_AND_ASSIGN(RTargetTable);
      59             : };
      60             : 
      61             : #endif  // SRC_BGP_RTARGET_RTARGET_TABLE_H_

Generated by: LCOV version 1.14