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: 16 37 43.2 %
Date: 2026-09-28 02:13:17 Functions: 5 11 45.5 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
       3             :  */
       4             : 
       5             : #include "bgp/rtarget/rtarget_table.h"
       6             : 
       7             : #include "bgp/bgp_update.h"
       8             : #include "db/db.h"
       9             : 
      10             : using std::unique_ptr;
      11             : using std::string;
      12             : 
      13         378 : RTargetTable::RTargetTable(DB *db, const string &name)
      14         378 :         : BgpTable(db, name) {
      15         378 : }
      16             : 
      17           0 : unique_ptr<DBEntry> RTargetTable::AllocEntry(const DBRequestKey *key) const {
      18           0 :     const RequestKey *pfxkey = static_cast<const RequestKey *>(key);
      19           0 :     return unique_ptr<DBEntry> (new RTargetRoute(pfxkey->prefix));
      20             : }
      21             : 
      22           0 : unique_ptr<DBEntry> RTargetTable::AllocEntryStr(const string &key_str) const {
      23           0 :     RTargetPrefix prefix = RTargetPrefix::FromString(key_str);
      24           0 :     return unique_ptr<DBEntry> (new RTargetRoute(prefix));
      25             : }
      26             : 
      27        1119 : size_t RTargetTable::Hash(const DBEntry *entry) const {
      28        1119 :     return 0;
      29             : }
      30             : 
      31           0 : size_t RTargetTable::Hash(const DBRequestKey *key) const {
      32           0 :     return 0;
      33             : }
      34             : 
      35           0 : BgpRoute *RTargetTable::TableFind(DBTablePartition *rtp,
      36             :                                   const DBRequestKey *prefix) {
      37           0 :     const RequestKey *pfxkey = static_cast<const RequestKey *>(prefix);
      38           0 :     RTargetRoute rt_key(pfxkey->prefix);
      39           0 :     return static_cast<BgpRoute *>(rtp->Find(&rt_key));
      40           0 : }
      41             : 
      42         378 : DBTableBase *RTargetTable::CreateTable(DB *db, const string &name) {
      43         378 :     RTargetTable *table = new RTargetTable(db, name);
      44         378 :     table->Init();
      45         378 :     return table;
      46             : }
      47             : 
      48           0 : BgpRoute *RTargetTable::RouteReplicate(BgpServer *server,
      49             :         BgpTable *src_table, BgpRoute *src_rt, const BgpPath *src_path,
      50             :         ExtCommunityPtr community) {
      51           0 :     return NULL;
      52             : }
      53             : 
      54           0 : bool RTargetTable::Export(RibOut *ribout, Route *route,
      55             :         const RibPeerSet &peerset, UpdateInfoSList &uinfo_slist) {
      56           0 :     BgpRoute *bgp_route = static_cast<BgpRoute *> (route);
      57           0 :     UpdateInfo *uinfo = GetUpdateInfo(ribout, bgp_route, peerset);
      58           0 :     if (!uinfo) return false;
      59           0 :     uinfo_slist->push_front(*uinfo);
      60             : 
      61           0 :     return true;
      62             : }
      63             : 
      64         540 : void RTargetTable::AddRemoveCallback(const DBEntryBase *entry, bool add) const {
      65         540 :     if (add)
      66         270 :         last_updated_ = UTCTimestamp();
      67         540 : }
      68             : 
      69           1 : static void RegisterFactory() {
      70           1 :     DB::RegisterFactory("bgp.rtarget.0", &RTargetTable::CreateTable);
      71           1 : }
      72             : MODULE_INITIALIZER(RegisterFactory);

Generated by: LCOV version 1.14