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: 8 23 34.8 %
Date: 2026-11-23 02:04:52 Functions: 3 7 42.9 %
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        1044 : RTargetRoute::RTargetRoute(const RTargetPrefix &prefix)
      16        1044 :     : prefix_(prefix) {
      17        1044 : }
      18             : 
      19        3207 : int RTargetRoute::CompareTo(const Route &rhs) const {
      20        3207 :     const RTargetRoute &rt_rhs = static_cast<const RTargetRoute &>(rhs);
      21        3207 :     return prefix_.CompareTo(rt_rhs.prefix_);
      22             : }
      23             : 
      24         403 : string RTargetRoute::ToString() const {
      25         403 :     return prefix_.ToString();
      26             : }
      27             : 
      28           0 : void RTargetRoute::SetKey(const DBRequestKey *reqkey) {
      29           0 :     const RTargetTable::RequestKey *key =
      30             :         static_cast<const RTargetTable::RequestKey *>(reqkey);
      31           0 :     prefix_ = key->prefix;
      32           0 : }
      33             : 
      34           0 : void RTargetRoute::BuildProtoPrefix(BgpProtoPrefix *prefix,
      35             :                                     const BgpAttr *attr,
      36             :                                     uint32_t label,
      37             :                                     uint32_t l3_label) const {
      38           0 :     prefix_.BuildProtoPrefix(prefix);
      39           0 : }
      40             : 
      41           0 : void RTargetRoute::BuildBgpProtoNextHop(vector<uint8_t> &nh,
      42             :                                         IpAddress nexthop) const {
      43           0 :     nh.resize(4);
      44           0 :     const Ip4Address::bytes_type &addr_bytes = nexthop.to_v4().to_bytes();
      45           0 :     copy(addr_bytes.begin(), addr_bytes.end(), nh.begin());
      46           0 : }
      47             : 
      48           0 : DBEntryBase::KeyPtr RTargetRoute::GetDBRequestKey() const {
      49             :     RTargetTable::RequestKey *key =
      50           0 :         new RTargetTable::RequestKey(GetPrefix(), NULL);
      51           0 :     return KeyPtr(key);
      52             : }

Generated by: LCOV version 1.14