LCOV - code coverage report
Current view: top level - bgp/l3vpn - inetvpn_address.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 6 6 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_L3VPN_INETVPN_ADDRESS_H_
       7             : #define SRC_BGP_L3VPN_INETVPN_ADDRESS_H_
       8             : 
       9             : #include <boost/system/error_code.hpp>
      10             : 
      11             : #include <string>
      12             : 
      13             : #include "bgp/bgp_attr.h"
      14             : #include "base/address.h"
      15             : #include "net/rd.h"
      16             : 
      17             : class BgpServer;
      18             : 
      19             : class InetVpnPrefix {
      20             : public:
      21             :     InetVpnPrefix();
      22             :     explicit InetVpnPrefix(const BgpProtoPrefix &prefix);
      23       43847 :     InetVpnPrefix(const RouteDistinguisher &rd, Ip4Address ip, int prefixlen)
      24       43847 :         : rd_(rd), addr_(ip), prefixlen_(prefixlen) {
      25       43846 :     }
      26             : 
      27             :     static int FromProtoPrefix(const BgpProtoPrefix &proto_prefix,
      28             :                                InetVpnPrefix *prefix,
      29             :                                const BgpAttr *attr, uint32_t *label);
      30             :     static int FromProtoPrefix(BgpServer *server,
      31             :                                const BgpProtoPrefix &proto_prefix,
      32             :                                const BgpAttr *attr,
      33             :                                const Address::Family family,
      34             :                                InetVpnPrefix *prefix,
      35             :                                BgpAttrPtr *new_attr, uint32_t *label,
      36             :                                uint32_t *l3_label);
      37             :     static InetVpnPrefix FromString(const std::string &str,
      38             :                                     boost::system::error_code *errorp = NULL);
      39             : 
      40             :     std::string ToString() const;
      41             :     bool IsMoreSpecific(const InetVpnPrefix &rhs) const;
      42             :     bool operator==(const InetVpnPrefix &rhs) const;
      43             : 
      44     4812920 :     const RouteDistinguisher &route_distinguisher() const { return rd_; }
      45     4956885 :     Ip4Address addr() const { return addr_; }
      46     3612514 :     int prefixlen() const { return prefixlen_; }
      47             :     void BuildProtoPrefix(uint32_t label, BgpProtoPrefix *proto_prefix,
      48             :         const BgpAttr *attr = NULL) const;
      49             : 
      50             : private:
      51             :     RouteDistinguisher rd_;
      52             :     Ip4Address addr_;
      53             :     int prefixlen_;
      54             : };
      55             : 
      56             : #endif  // SRC_BGP_L3VPN_INETVPN_ADDRESS_H_

Generated by: LCOV version 1.14