OpenSDN source code
mac_ip_learning_key.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Juniper Networks, Inc. All rights reserved.
3  * Copyright Contributors to the OpenSDN project
4  */
5 
6 #ifndef SRC_VNSW_AGENT_MAC_IP_LEARNING_MAC_LEARNING_KEY_H_
7 #define SRC_VNSW_AGENT_MAC_IP_LEARNING_MAC_LEARNING_KEY_H_
8 
10  MacIpLearningKey(uint32_t vrf_id, const IpAddress ip):
11  vrf_id_(vrf_id), ip_addr_(ip) {}
12  const uint32_t vrf_id_;
14 
15  bool IsLess(const MacIpLearningKey &rhs) const {
16  if (vrf_id_ != rhs.vrf_id_) {
17  return vrf_id_ < rhs.vrf_id_;
18  }
19 
20  return ip_addr_ < rhs.ip_addr_;
21  }
22 };
23 
25  bool operator()(const MacIpLearningKey &lhs, const MacIpLearningKey &rhs) const {
26  return lhs.IsLess(rhs);
27  }
28 };
29 #endif
boost::asio::ip::address IpAddress
Definition: address.h:14
bool operator()(const MacIpLearningKey &lhs, const MacIpLearningKey &rhs) const
bool IsLess(const MacIpLearningKey &rhs) const
const uint32_t vrf_id_
MacIpLearningKey(uint32_t vrf_id, const IpAddress ip)
const IpAddress ip_addr_