LCOV - code coverage report
Current view: top level - bgp/rtarget - rtarget_table.cc (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 26 37 70.3 %
Date: 2026-11-23 02:04:52 Functions: 8 11 72.7 %
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             : #include "bgp/rtarget/rtarget_table.h"
       7             : 
       8             : #include "bgp/bgp_update.h"
       9             : #include "db/db.h"
      10             : 
      11             : using std::unique_ptr;
      12             : using std::string;
      13             : 
      14          68 : RTargetTable::RTargetTable(DB *db, const string &name)
      15          68 :         : BgpTable(db, name) {
      16          68 : }
      17             : 
      18         198 : unique_ptr<DBEntry> RTargetTable::AllocEntry(const DBRequestKey *key) const {
      19         198 :     const RequestKey *pfxkey = static_cast<const RequestKey *>(key);
      20         198 :     return unique_ptr<DBEntry> (new RTargetRoute(pfxkey->prefix));
      21             : }
      22             : 
      23           0 : unique_ptr<DBEntry> RTargetTable::AllocEntryStr(const string &key_str) const {
      24           0 :     RTargetPrefix prefix = RTargetPrefix::FromString(key_str);
      25           0 :     return unique_ptr<DBEntry> (new RTargetRoute(prefix));
      26             : }
      27             : 
      28        1156 : size_t RTargetTable::Hash(const DBEntry *entry) const {
      29        1156 :     return 0;
      30             : }
      31             : 
      32         724 : size_t RTargetTable::Hash(const DBRequestKey *key) const {
      33         724 :     return 0;
      34             : }
      35             : 
      36         526 : BgpRoute *RTargetTable::TableFind(DBTablePartition *rtp,
      37             :                                   const DBRequestKey *prefix) {
      38         526 :     const RequestKey *pfxkey = static_cast<const RequestKey *>(prefix);
      39         526 :     RTargetRoute rt_key(pfxkey->prefix);
      40        1052 :     return static_cast<BgpRoute *>(rtp->Find(&rt_key));
      41         526 : }
      42             : 
      43          68 : DBTableBase *RTargetTable::CreateTable(DB *db, const string &name) {
      44          68 :     RTargetTable *table = new RTargetTable(db, name);
      45          68 :     table->Init();
      46          68 :     return table;
      47             : }
      48             : 
      49           0 : BgpRoute *RTargetTable::RouteReplicate(BgpServer *server,
      50             :         BgpTable *src_table, BgpRoute *src_rt, const BgpPath *src_path,
      51             :         ExtCommunityPtr community) {
      52           0 :     return NULL;
      53             : }
      54             : 
      55           0 : bool RTargetTable::Export(RibOut *ribout, Route *route,
      56             :         const RibPeerSet &peerset, UpdateInfoSList &uinfo_slist) {
      57           0 :     BgpRoute *bgp_route = static_cast<BgpRoute *> (route);
      58           0 :     UpdateInfo *uinfo = GetUpdateInfo(ribout, bgp_route, peerset);
      59           0 :     if (!uinfo) return false;
      60           0 :     uinfo_slist->push_front(*uinfo);
      61             : 
      62           0 :     return true;
      63             : }
      64             : 
      65         304 : void RTargetTable::AddRemoveCallback(const DBEntryBase *entry, bool add) const {
      66         304 :     if (add)
      67         152 :         last_updated_ = UTCTimestamp();
      68         304 : }
      69             : 
      70           1 : static void RegisterFactory() {
      71           1 :     DB::RegisterFactory("bgp.rtarget.0", &RTargetTable::CreateTable);
      72           1 : }
      73             : MODULE_INITIALIZER(RegisterFactory);

Generated by: LCOV version 1.14