OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mac_learning_key.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef SRC_VNSW_AGENT_MAC_LEARNING_MAC_LEARNING_KEY_H_
6 #define SRC_VNSW_AGENT_MAC_LEARNING_MAC_LEARNING_KEY_H_
7 
8 struct MacLearningKey {
9  MacLearningKey(uint32_t vrf_id, const MacAddress &mac):
10  vrf_id_(vrf_id), mac_(mac) {}
11  const uint32_t vrf_id_;
13 
14  bool IsLess(const MacLearningKey &rhs) const {
15  if (vrf_id_ != rhs.vrf_id_) {
16  return vrf_id_ < rhs.vrf_id_;
17  }
18 
19  return mac_ < rhs.mac_;
20  }
21 };
22 
24  bool operator()(const MacLearningKey &lhs, const MacLearningKey &rhs) const {
25  return lhs.IsLess(rhs);
26  }
27 };
28 #endif
bool operator()(const MacLearningKey &lhs, const MacLearningKey &rhs) const
bool IsLess(const MacLearningKey &rhs) const
MacLearningKey(uint32_t vrf_id, const MacAddress &mac)
const uint32_t vrf_id_
const MacAddress mac_