LCOV - code coverage report
Current view: top level - bgp/rtarget - rtarget_prefix.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 7 7 100.0 %
Date: 2026-06-18 01:51:13 Functions: 4 4 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             : #ifndef SRC_BGP_RTARGET_RTARGET_PREFIX_H_
       6             : #define SRC_BGP_RTARGET_RTARGET_PREFIX_H_
       7             : 
       8             : #include <boost/system/error_code.hpp>
       9             : 
      10             : #include <string>
      11             : 
      12             : #include "bgp/bgp_attr.h"
      13             : #include "bgp/bgp_common.h"
      14             : #include "bgp/rtarget/rtarget_address.h"
      15             : 
      16             : class RTargetPrefix {
      17             : public:
      18             :     static const std::string kDefaultPrefixString;
      19             : 
      20             :     RTargetPrefix();
      21             :     explicit RTargetPrefix(const BgpProtoPrefix &prefix);
      22      231618 :     RTargetPrefix(as_t as, RouteTarget rtarget)
      23      231618 :         : as_(as), rtarget_(rtarget) {
      24      231618 :     }
      25             : 
      26             :     static int FromProtoPrefix(const BgpProtoPrefix &proto_prefix,
      27             :                                RTargetPrefix *prefix);
      28             :     static int FromProtoPrefix(BgpServer *server,
      29             :                                const BgpProtoPrefix &proto_prefix,
      30             :                                const BgpAttr *attr,
      31             :                                const Address::Family family,
      32             :                                RTargetPrefix *prefix,
      33             :                                BgpAttrPtr *new_attr, uint32_t *label,
      34             :                                uint32_t *l3_label);
      35             :     static RTargetPrefix FromString(const std::string &str,
      36             :                                     boost::system::error_code *errorp = NULL);
      37             : 
      38             :     std::string ToString() const;
      39      102895 :     RouteTarget rtarget() const { return rtarget_; }
      40           5 :     as_t as() const { return as_; }
      41             :     void BuildProtoPrefix(BgpProtoPrefix *prefix) const;
      42             :     int CompareTo(const RTargetPrefix &rhs) const;
      43           7 :     bool operator==(const RTargetPrefix &rhs) const {
      44           7 :         return (CompareTo(rhs) == 0);
      45             :     }
      46             : 
      47             : private:
      48             :     as_t as_;
      49             :     RouteTarget rtarget_;
      50             : };
      51             : 
      52             : #endif  // SRC_BGP_RTARGET_RTARGET_PREFIX_H_

Generated by: LCOV version 1.14