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-06-08 02:02:55 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             :  */
       4             : 
       5             : #include "bgp/rtarget/rtarget_route.h"
       6             : #include "bgp/rtarget/rtarget_table.h"
       7             : 
       8             : #include <algorithm>
       9             : 
      10             : using std::copy;
      11             : using std::string;
      12             : using std::vector;
      13             : 
      14      348080 : RTargetRoute::RTargetRoute(const RTargetPrefix &prefix)
      15      348080 :     : prefix_(prefix) {
      16      348080 : }
      17             : 
      18     1637894 : int RTargetRoute::CompareTo(const Route &rhs) const {
      19     1637894 :     const RTargetRoute &rt_rhs = static_cast<const RTargetRoute &>(rhs);
      20     1637894 :     return prefix_.CompareTo(rt_rhs.prefix_);
      21             : }
      22             : 
      23       26497 : string RTargetRoute::ToString() const {
      24       26497 :     return prefix_.ToString();
      25             : }
      26             : 
      27           2 : void RTargetRoute::SetKey(const DBRequestKey *reqkey) {
      28           2 :     const RTargetTable::RequestKey *key =
      29             :         static_cast<const RTargetTable::RequestKey *>(reqkey);
      30           2 :     prefix_ = key->prefix;
      31           2 : }
      32             : 
      33       38089 : void RTargetRoute::BuildProtoPrefix(BgpProtoPrefix *prefix,
      34             :                                     const BgpAttr *attr,
      35             :                                     uint32_t label,
      36             :                                     uint32_t l3_label) const {
      37       38089 :     prefix_.BuildProtoPrefix(prefix);
      38       38089 : }
      39             : 
      40       14310 : void RTargetRoute::BuildBgpProtoNextHop(vector<uint8_t> &nh,
      41             :                                         IpAddress nexthop) const {
      42       14310 :     nh.resize(4);
      43       14310 :     const Ip4Address::bytes_type &addr_bytes = nexthop.to_v4().to_bytes();
      44       14310 :     copy(addr_bytes.begin(), addr_bytes.end(), nh.begin());
      45       14310 : }
      46             : 
      47       38306 : DBEntryBase::KeyPtr RTargetRoute::GetDBRequestKey() const {
      48             :     RTargetTable::RequestKey *key =
      49       38306 :         new RTargetTable::RequestKey(GetPrefix(), NULL);
      50       38306 :     return KeyPtr(key);
      51             : }

Generated by: LCOV version 1.14