LCOV - code coverage report
Current view: top level - bgp/inet - inet_table.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 9 9 100.0 %
Date: 2026-11-09 02:10:49 Functions: 5 5 100.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_INET_INET_TABLE_H_
       7             : #define SRC_BGP_INET_INET_TABLE_H_
       8             : 
       9             : #include <string>
      10             : 
      11             : #include "bgp/bgp_table.h"
      12             : #include "bgp/inet/inet_route.h"
      13             : #include "base/address.h"
      14             : 
      15             : class BgpServer;
      16             : class InetVpnPrefix;
      17             : class Ip4Prefix;
      18             : class PathResolver;
      19             : 
      20             : class InetTable : public BgpTable {
      21             : public:
      22             :     struct RequestKey : BgpTable::RequestKey {
      23      311945 :         RequestKey(const Ip4Prefix &prefix, const IPeer *ipeer)
      24      311945 :             : prefix(prefix), peer(ipeer) {
      25      311891 :         }
      26             :         Ip4Prefix prefix;
      27             :         const IPeer *peer;
      28       53993 :         virtual const IPeer *GetPeer() const {
      29       53993 :             return peer;
      30             :         }
      31             :     };
      32             : 
      33             :     InetTable(DB *db, const std::string &name);
      34             : 
      35             :     virtual std::unique_ptr<DBEntry> AllocEntry(const DBRequestKey *key) const;
      36             :     virtual std::unique_ptr<DBEntry> AllocEntryStr(const std::string &key) const;
      37             : 
      38     4690571 :     virtual Address::Family family() const { return family_; }
      39             : 
      40             :     virtual size_t Hash(const DBEntry *entry) const;
      41             :     virtual size_t Hash(const DBRequestKey *key) const;
      42             : 
      43             :     virtual bool Export(RibOut *ribout, Route *route,
      44             :                         const RibPeerSet &peerset,
      45             :                         UpdateInfoSList &info_slist);
      46             :     virtual PathResolver *CreatePathResolver();
      47             : 
      48             :     static size_t HashFunction(const Ip4Prefix &addr);
      49             :     static DBTableBase *CreateTable(DB *db, const std::string &name);
      50             :     BgpRoute *RouteReplicate(BgpServer *server, BgpTable *src_tbl,
      51             :                              BgpRoute *src_rt, const BgpPath *path,
      52             :                              ExtCommunityPtr ptr);
      53             : 
      54      237353 :     virtual bool IsRoutingPolicySupported() const { return true; }
      55      486966 :     virtual bool IsRouteAggregationSupported() const {
      56      486966 :         return((family_ == Address::INETMPLS) ? false : true); }
      57             :     virtual BgpAttrPtr GetAttributes(BgpRoute *rt, BgpAttrPtr attrp,
      58             :                                      const IPeer *peer);
      59             :     void UpdateRoute(const InetVpnPrefix &inetvpn_prefix, const IPeer *peer,
      60             :                      BgpAttrPtr inetvpn_attrp);
      61             : 
      62             : private:
      63             :     BgpAttrPtr GetFabricAttributes(BgpRoute *rt, BgpAttrPtr attrp,
      64             :                                    const IPeer *peer);
      65             :     BgpAttrPtr GetMvpnAttributes(BgpAttrPtr attrp);
      66             :     BgpAttrPtr UpdateAttributes(const BgpAttrPtr inetvpn_attrp,
      67             :                                 const BgpAttrPtr inet_attrp);
      68             :     void UpdateExtendedCommunity(RibOutAttr *roattr);
      69             :     virtual BgpRoute *TableFind(DBTablePartition *rtp,
      70             :                                 const DBRequestKey *prefix);
      71             : 
      72             :     Address::Family family_;
      73             :     DISALLOW_COPY_AND_ASSIGN(InetTable);
      74             : };
      75             : 
      76             : #endif  // SRC_BGP_INET_INET_TABLE_H_

Generated by: LCOV version 1.14