20 Ip4Address::bytes_type bt = { { 0 } };
21 copy(proto_prefix.
prefix.begin(), proto_prefix.
prefix.end(), bt.begin());
37 size_t nlri_size = proto_prefix.
prefix.size();
38 size_t expected_min_nlri_size =
41 if (nlri_size < expected_min_nlri_size)
46 size_t label_offset = 0;
47 *label = proto_prefix.
ReadLabel(label_offset);
50 Ip4Address::bytes_type bt = { { 0 } };
51 copy(proto_prefix.
prefix.begin() + prefix_offset,
52 proto_prefix.
prefix.end(), bt.begin());
63 snprintf(strplen,
sizeof(strplen),
"/%d",
prefixlen());
85 boost::system::error_code *errorp) {
119 boost::system::error_code ec;
131 boost::system::error_code ec;
154 const uint32_t label,
155 uint32_t l3_label)
const {
161 prefix->
prefix.resize(nlri_size, 0);
162 size_t label_offset = 0;
166 const Ip4Address::bytes_type &addr_bytes =
prefix_.
ip4_addr().to_bytes();
167 copy(addr_bytes.begin(), addr_bytes.begin() + prefix_size,
168 prefix->
prefix.begin() + prefix_offset);
171 const Ip4Address::bytes_type &addr_bytes =
prefix_.
ip4_addr().to_bytes();
172 prefix_size = (prefix->
prefixlen + 7) / 8;
173 copy(addr_bytes.begin(), addr_bytes.begin() + prefix_size,
174 back_inserter(prefix->
prefix));
181 const Ip4Address::bytes_type &addr_bytes = nexthop.to_v4().to_bytes();
182 copy(addr_bytes.begin(), addr_bytes.end(), nh.begin());
static int FromProtoPrefix(const BgpProtoPrefix &proto_prefix, Ip4Prefix *prefix)
int CompareTo(const Ip4Prefix &rhs) const
void WriteLabel(size_t label_offset, uint32_t label, bool is_vni=false)
virtual bool IsMoreSpecific(const std::string &match) const
boost::asio::ip::address IpAddress
uint32_t ReadLabel(size_t label_offset, bool is_vni=false) const
static const uint8_t kMaxV4PrefixLen
std::unique_ptr< DBRequestKey > KeyPtr
static string ToString(PhysicalDevice::ManagementProtocol proto)
boost::intrusive_ptr< const BgpAttr > BgpAttrPtr
Ip4Address ip4_addr() const
virtual void BuildBgpProtoNextHop(std::vector< uint8_t > &nh, IpAddress nexthop) const
static const uint8_t kMaxV4Bytes
static const size_t kLabelSize
std::vector< uint8_t > prefix
static Ip4Prefix FromString(const std::string &str, boost::system::error_code *errorp=NULL)
virtual int CompareTo(const Route &rhs) const
std::string ToString() const
virtual bool IsLessSpecific(const std::string &match) const
const Ip4Prefix & GetPrefix() const
virtual KeyPtr GetDBRequestKey() const
boost::asio::ip::address_v4 Ip4Address
boost::system::error_code Ip4SubnetParse(const string &str, Ip4Address *addr, int *plen)
virtual void SetKey(const DBRequestKey *reqkey)
bool IsMoreSpecific(const Ip4Prefix &rhs) const
virtual void BuildProtoPrefix(BgpProtoPrefix *prefix, const BgpAttr *attr=NULL, uint32_t label=0, uint32_t l3_label=0) const
InetRoute(const Ip4Prefix &prefix)