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-11-09 02:10:49 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             :  * Copyright Contributors to the OpenSDN project
       4             :  */
       5             : 
       6             : #ifndef SRC_BGP_RTARGET_RTARGET_PREFIX_H_
       7             : #define SRC_BGP_RTARGET_RTARGET_PREFIX_H_
       8             : 
       9             : #include <boost/system/error_code.hpp>
      10             : 
      11             : #include <string>
      12             : 
      13             : #include "bgp/bgp_attr.h"
      14             : #include "bgp/bgp_common.h"
      15             : #include "bgp/rtarget/rtarget_address.h"
      16             : 
      17             : class RTargetPrefix {
      18             : public:
      19             :     static const std::string kDefaultPrefixString;
      20             : 
      21             :     RTargetPrefix();
      22             :     explicit RTargetPrefix(const BgpProtoPrefix &prefix);
      23      232397 :     RTargetPrefix(as_t as, RouteTarget rtarget)
      24      232397 :         : as_(as), rtarget_(rtarget) {
      25      232397 :     }
      26             : 
      27             :     static int FromProtoPrefix(const BgpProtoPrefix &proto_prefix,
      28             :                                RTargetPrefix *prefix);
      29             :     static int FromProtoPrefix(BgpServer *server,
      30             :                                const BgpProtoPrefix &proto_prefix,
      31             :                                const BgpAttr *attr,
      32             :                                const Address::Family family,
      33             :                                RTargetPrefix *prefix,
      34             :                                BgpAttrPtr *new_attr, uint32_t *label,
      35             :                                uint32_t *l3_label);
      36             :     static RTargetPrefix FromString(const std::string &str,
      37             :                                     boost::system::error_code *errorp = NULL);
      38             : 
      39             :     std::string ToString() const;
      40      102669 :     RouteTarget rtarget() const { return rtarget_; }
      41           5 :     as_t as() const { return as_; }
      42             :     void BuildProtoPrefix(BgpProtoPrefix *prefix) const;
      43             :     int CompareTo(const RTargetPrefix &rhs) const;
      44           7 :     bool operator==(const RTargetPrefix &rhs) const {
      45           7 :         return (CompareTo(rhs) == 0);
      46             :     }
      47             : 
      48             : private:
      49             :     as_t as_;
      50             :     RouteTarget rtarget_;
      51             : };
      52             : 
      53             : #endif  // SRC_BGP_RTARGET_RTARGET_PREFIX_H_

Generated by: LCOV version 1.14