LCOV - code coverage report
Current view: top level - bgp/rtarget - rtarget_route.cc (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 23 23 100.0 %
Date: 2026-11-09 02:10:49 Functions: 7 7 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             : #include "bgp/rtarget/rtarget_route.h"
       7             : #include "bgp/rtarget/rtarget_table.h"
       8             : 
       9             : #include <algorithm>
      10             : 
      11             : using std::copy;
      12             : using std::string;
      13             : using std::vector;
      14             : 
      15      348070 : RTargetRoute::RTargetRoute(const RTargetPrefix &prefix)
      16      348070 :     : prefix_(prefix) {
      17      348071 : }
      18             : 
      19     1630468 : int RTargetRoute::CompareTo(const Route &rhs) const {
      20     1630468 :     const RTargetRoute &rt_rhs = static_cast<const RTargetRoute &>(rhs);
      21     1630468 :     return prefix_.CompareTo(rt_rhs.prefix_);
      22             : }
      23             : 
      24       26475 : string RTargetRoute::ToString() const {
      25       26475 :     return prefix_.ToString();
      26             : }
      27             : 
      28           2 : void RTargetRoute::SetKey(const DBRequestKey *reqkey) {
      29           2 :     const RTargetTable::RequestKey *key =
      30             :         static_cast<const RTargetTable::RequestKey *>(reqkey);
      31           2 :     prefix_ = key->prefix;
      32           2 : }
      33             : 
      34       38084 : void RTargetRoute::BuildProtoPrefix(BgpProtoPrefix *prefix,
      35             :                                     const BgpAttr *attr,
      36             :                                     uint32_t label,
      37             :                                     uint32_t l3_label) const {
      38       38084 :     prefix_.BuildProtoPrefix(prefix);
      39       38084 : }
      40             : 
      41       14378 : void RTargetRoute::BuildBgpProtoNextHop(vector<uint8_t> &nh,
      42             :                                         IpAddress nexthop) const {
      43       14378 :     nh.resize(4);
      44       14378 :     const Ip4Address::bytes_type &addr_bytes = nexthop.to_v4().to_bytes();
      45       14378 :     copy(addr_bytes.begin(), addr_bytes.end(), nh.begin());
      46       14378 : }
      47             : 
      48       38918 : DBEntryBase::KeyPtr RTargetRoute::GetDBRequestKey() const {
      49             :     RTargetTable::RequestKey *key =
      50       38918 :         new RTargetTable::RequestKey(GetPrefix(), NULL);
      51       38918 :     return KeyPtr(key);
      52             : }

Generated by: LCOV version 1.14