OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mac_ip_learning.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef SRC_VNSW_AGENT_MAC_IP_LEARNING_MAC_LEARNING_H_
6 #define SRC_VNSW_AGENT_MAC_IP_LEARNING_MAC_LEARNING_H_
7 
8 #include "cmn/agent.h"
9 #include "mac_ip_learning_key.h"
10 #include "mac_learning_base.h"
11 #include "mac_learning_event.h"
12 #include "pkt/flow_token.h"
13 #include "health_check.h"
14 #include <tbb/mutex.h>
15 
16 class MacIpLearningTable;
19 public:
20  MacIpLearningEntry(MacIpLearningTable *table, uint32_t vrf_id_,
21  const IpAddress &ip, const MacAddress &mac,
23  virtual ~MacIpLearningEntry() {}
24  bool Add();
25  void Delete();
26  void Resync();
27  uint32_t vrf_id() {
28  return key_.vrf_id_;
29  }
30  const Interface* intf() {
31  return intf_.get();
32  }
33  const VnEntry* Vn() {
34  return vn_.get();
35  }
37  return hc_service_;
38  }
40  return hc_instance_;
41  }
44  }
45  const MacIpLearningKey& key() const {
46  return key_;
47  }
49  return ip_;
50  }
52  return mac_;
53  }
58 
59 private:
69 };
70 
72 public:
73  typedef std::pair<MacIpLearningKey,
75  typedef std::map<MacIpLearningKey,
78 
80  virtual ~MacIpLearningTable() {}
81  void Add(MacLearningEntryPtr ptr);
82  void Resync(MacLearningEntryPtr ptr);
83  void Delete(MacLearningEntryPtr ptr);
86  void MacIpEntryUnreachable(uint32_t vrf_id, IpAddress &ip, MacAddress &mac);
87  void MacIpEntryHcNotify(const HealthCheckInstanceService *instance_service);
89  MacAddress GetPairedMacAddress(uint32_t vrf_id, const IpAddress &ip);
90  //To be used in test cases only
91  //MacLearningEntryPtr TestGet(const MacLearningKey &key);
93 
94  Agent* agent() {
95  return agent_;
96  }
97 
98  void SetQueueDisable(bool disable) {
100  }
101 
103  void EnqueueMgmtReq(MacLearningEntryPtr ptr, bool add);
104 
105 private:
109  tbb::mutex macip_map_mutex_;
111 };
112 #endif
bool RequestHandler(MacLearningEntryRequestPtr ptr)
MacIpLearningEntry * Find(const MacIpLearningKey &key)
VnEntryConstRef vn_
void Delete(MacLearningEntryPtr ptr)
InterfaceConstRef intf_
void SetQueueDisable(bool disable)
void MacIpEntryUnreachable(MacLearningEntryRequestPtr ptr)
HealthCheckService * GetHealthCheckService(const VnEntry *vn)
MacIpLearningEntryMap mac_ip_learning_entry_map_
MacIpLearningKey key_
HealthCheckService * hc_service_
boost::asio::ip::address IpAddress
Definition: address.h:13
const HealthCheckService * HcService()
void Enqueue(MacLearningEntryRequestPtr req)
const Interface * intf()
MacAddress GetPairedMacAddress(uint32_t vrf_id, const IpAddress &ip)
void AddHealthCheckService(HealthCheckService *service)
void Add(MacLearningEntryPtr ptr)
MacAddress & Mac()
virtual ~MacIpLearningTable()
MacIpLearningTable * mac_ip_learning_table() const
tbb::mutex macip_map_mutex_
Definition: agent.h:358
const HealthCheckInstanceBase * HcInstance()
MacIpLearningRequestQueue work_queue_
MacIpLearningEntry(MacIpLearningTable *table, uint32_t vrf_id_, const IpAddress &ip, const MacAddress &mac, InterfaceConstRef intf)
boost::intrusive_ptr< const Interface > InterfaceConstRef
Definition: agent.h:51
boost::shared_ptr< MacLearningEntryRequest > MacLearningEntryRequestPtr
MacIpLearningTable(Agent *agent, MacLearningProto *proto)
void DetectIpMove(MacLearningEntryRequestPtr ptr)
Definition: vn.h:151
IpAddress & IpAddr()
const VnEntry * Vn()
virtual ~MacIpLearningEntry()
DISALLOW_COPY_AND_ASSIGN(MacIpLearningTable)
const MacIpLearningKey & key() const
DISALLOW_COPY_AND_ASSIGN(MacIpLearningEntry)
void EnqueueMgmtReq(MacLearningEntryPtr ptr, bool add)
void MacIpEntryHcNotify(const HealthCheckInstanceService *instance_service)
HealthCheckInstanceBase * hc_instance_
void SetQueueDisable(bool disable)
void EnqueueToTable(MacLearningEntryRequestPtr req)
boost::intrusive_ptr< const VnEntry > VnEntryConstRef
Definition: agent.h:70
std::pair< MacIpLearningKey, MacLearningEntryPtr > MacIpLearningEntryPair
std::map< MacIpLearningKey, MacLearningEntryPtr, MacIpLearningKeyCmp > MacIpLearningEntryMap
void Resync(MacLearningEntryPtr ptr)
MacIpLearningTable * mac_ip_learning_table_
const uint32_t vrf_id_
boost::shared_ptr< MacLearningEntry > MacLearningEntryPtr