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: 32 37 86.5 %
Date: 2026-10-05 02:12:29 Functions: 9 11 81.8 %
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         418 : RTargetTable::RTargetTable(DB *db, const string &name)
      14         418 :         : BgpTable(db, name) {
      15         418 : }
      16             : 
      17        8570 : unique_ptr<DBEntry> RTargetTable::AllocEntry(const DBRequestKey *key) const {
      18        8570 :     const RequestKey *pfxkey = static_cast<const RequestKey *>(key);
      19        8570 :     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       71152 : size_t RTargetTable::Hash(const DBEntry *entry) const {
      28       71152 :     return 0;
      29             : }
      30             : 
      31        7122 : size_t RTargetTable::Hash(const DBRequestKey *key) const {
      32        7122 :     return 0;
      33             : }
      34             : 
      35        6066 : BgpRoute *RTargetTable::TableFind(DBTablePartition *rtp,
      36             :                                   const DBRequestKey *prefix) {
      37        6066 :     const RequestKey *pfxkey = static_cast<const RequestKey *>(prefix);
      38        6066 :     RTargetRoute rt_key(pfxkey->prefix);
      39       12132 :     return static_cast<BgpRoute *>(rtp->Find(&rt_key));
      40        6066 : }
      41             : 
      42         418 : DBTableBase *RTargetTable::CreateTable(DB *db, const string &name) {
      43         418 :     RTargetTable *table = new RTargetTable(db, name);
      44         418 :     table->Init();
      45         418 :     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        8260 : bool RTargetTable::Export(RibOut *ribout, Route *route,
      55             :         const RibPeerSet &peerset, UpdateInfoSList &uinfo_slist) {
      56        8260 :     BgpRoute *bgp_route = static_cast<BgpRoute *> (route);
      57        8260 :     UpdateInfo *uinfo = GetUpdateInfo(ribout, bgp_route, peerset);
      58        8260 :     if (!uinfo) return false;
      59        5667 :     uinfo_slist->push_front(*uinfo);
      60             : 
      61        5667 :     return true;
      62             : }
      63             : 
      64        5884 : void RTargetTable::AddRemoveCallback(const DBEntryBase *entry, bool add) const {
      65        5884 :     if (add)
      66        2942 :         last_updated_ = UTCTimestamp();
      67        5884 : }
      68             : 
      69           3 : static void RegisterFactory() {
      70           3 :     DB::RegisterFactory("bgp.rtarget.0", &RTargetTable::CreateTable);
      71           3 : }
      72             : MODULE_INITIALIZER(RegisterFactory);

Generated by: LCOV version 1.14