20 size_t nlri_size = proto_prefix.
prefix.size();
21 size_t expected_min_nlri_size =
24 if (nlri_size < expected_min_nlri_size)
37 size_t label_offset = 0;
38 *label = proto_prefix.
ReadLabel(label_offset, is_vni);
44 Ip4Address::bytes_type bt = { { 0 } };
45 copy(proto_prefix.
prefix.begin() + prefix_offset,
46 proto_prefix.
prefix.end(), bt.begin());
65 proto_prefix->
prefix.clear();
70 proto_prefix->
prefix.resize(nlri_size, 0);
71 size_t label_offset = 0;
81 proto_prefix->
WriteLabel(label_offset, label, is_vni);
84 proto_prefix->
prefix.begin() + rd_offset);
88 const Ip4Address::bytes_type &addr_bytes =
addr_.to_bytes();
89 copy(addr_bytes.begin(), addr_bytes.begin() + prefix_size,
90 proto_prefix->
prefix.begin() + prefix_offset);
95 boost::system::error_code *errorp) {
98 size_t pos = str.rfind(
':');
99 if (pos == string::npos) {
100 if (errorp != NULL) {
101 *errorp = make_error_code(boost::system::errc::invalid_argument);
105 string rdstr = str.substr(0, pos);
106 boost::system::error_code rderr;
108 if (rderr.failed()) {
109 if (errorp != NULL) {
115 string ip4pstr(str, pos + 1);
118 if (errorp != NULL) {
void WriteLabel(size_t label_offset, uint32_t label, bool is_vni=false)
static RouteDistinguisher FromString(const std::string &str, boost::system::error_code *error=NULL)
uint32_t ReadLabel(size_t label_offset, bool is_vni=false) const
std::string ToString() const
static InetVpnPrefix FromString(const std::string &str, boost::system::error_code *errorp=NULL)
bool IsMoreSpecific(const InetVpnPrefix &rhs) const
static const size_t kSize
boost::intrusive_ptr< const BgpAttr > BgpAttrPtr
static const uint8_t kMaxV4Bytes
static const size_t kLabelSize
std::vector< uint8_t > prefix
bool operator==(const InetVpnPrefix &rhs) const
static int FromProtoPrefix(const BgpProtoPrefix &proto_prefix, InetVpnPrefix *prefix, const BgpAttr *attr, uint32_t *label)
std::string ToString() const
boost::asio::ip::address_v4 Ip4Address
boost::system::error_code Ip4SubnetParse(const string &str, Ip4Address *addr, int *plen)
const ExtCommunity * ext_community() const
bool IsMoreSpecific(const Ip4Prefix &rhs) const
std::string ToString() const
const uint8_t * GetData() const
void BuildProtoPrefix(uint32_t label, BgpProtoPrefix *proto_prefix, const BgpAttr *attr=NULL) const