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