10 using boost::system::error_code;
20 Ip6Address::bytes_type bt = { { 0 } };
21 copy(proto_prefix.
prefix.begin(), proto_prefix.
prefix.end(), bt.begin());
32 uint32_t *label, uint32_t *l3_label) {
78 return (left.ToBytes() == right.
ToBytes());
82 Ip6Address::bytes_type addr_bytes;
85 Ip6Address::bytes_type lhs =
ToBytes();
86 Ip6Address::bytes_type rhs = right.
ToBytes();
90 for (
size_t i = 0; i <
sizeof(Ip6Address::bytes_type); ++i) {
91 addr_bytes[i] = lhs[i] & rhs[i];
147 uint32_t l3_label)
const {
150 const Ip6Address::bytes_type &addr_bytes =
prefix_.
ip6_addr().to_bytes();
151 int num_bytes = (prefix->
prefixlen + 7) / 8;
152 copy(addr_bytes.begin(), addr_bytes.begin() + num_bytes,
153 back_inserter(prefix->
prefix));
163 if (nexthop.is_v4()) {
164 address = Ip6Address::v4_mapped(nexthop.to_v4());
166 address = nexthop.to_v6();
169 const Ip6Address::bytes_type &addr_bytes = address.to_bytes();
170 copy(addr_bytes.begin(), addr_bytes.end(), nh.begin());
181 return masks_.at(prefix_len);
198 int num_bytes = prefixlen / 8;
199 int num_bits = prefixlen % 8;
201 Ip6Address::bytes_type addr_bytes;
204 for (
int i = 0; i < num_bytes; ++i) {
205 addr_bytes[i] = 0xff;
208 uint8_t hex_val = 0xff << (8 - num_bits);
209 addr_bytes[num_bytes] = hex_val;
virtual void BuildBgpProtoNextHop(std::vector< uint8_t > &nh, IpAddress nexthop) const
virtual bool IsMoreSpecific(const std::string &match) const
boost::asio::ip::address IpAddress
virtual void SetKey(const DBRequestKey *reqkey)
static int FromProtoPrefix(const BgpProtoPrefix &proto_prefix, Inet6Prefix *prefix)
static std::vector< Inet6Prefix > masks_
std::unique_ptr< DBRequestKey > KeyPtr
int CompareTo(const Inet6Prefix &rhs) const
Inet6Route(const Inet6Prefix &prefix)
static string ToString(PhysicalDevice::ManagementProtocol proto)
boost::intrusive_ptr< const BgpAttr > BgpAttrPtr
static void Inet6InitRoutines()
#define ARRAYBYTES_FILL(obj, val)
static Inet6Prefix FromString(const std::string &str, boost::system::error_code *errorp=NULL)
static const std::string integerToString(const NumberType &num)
Inet6Prefix operator&(const Inet6Prefix &rhs) const
std::vector< uint8_t > prefix
virtual void BuildProtoPrefix(BgpProtoPrefix *prefix, const BgpAttr *attr=NULL, uint32_t label=0, uint32_t l3_label=0) const
boost::asio::ip::address_v6 Ip6Address
std::string ToString() const
virtual KeyPtr GetDBRequestKey() const
const Ip6Address::bytes_type ToBytes() const
static const uint8_t kMaxV6Bytes
Ip6Address ip6_addr() const
static const uint8_t kMaxV6PrefixLen
static Inet6Prefix CalculateMaskFromPrefixlen(int prefixlen)
const Inet6Prefix & GetPrefix() const
virtual bool IsLessSpecific(const std::string &match) const
virtual int CompareTo(const Route &rhs) const
#define MODULE_INITIALIZER(Func)
bool IsMoreSpecific(const Inet6Prefix &rhs) const
static const Inet6Prefix & PrefixlenToMask(uint8_t prefix_len)
boost::system::error_code Inet6SubnetParse(const string &str, Ip6Address *addr, int *plen)