OpenSDN source code
hbf.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  * Copyright Contributors to the OpenSDN project
4  */
5 
6 #ifndef hbf_agent_oper_hpp
7 #define hbf_agent_oper_hpp
8 
9 #include <netinet/in.h>
10 #include <net/ethernet.h>
11 #include <cmn/agent_cmn.h>
12 #include <cmn/agent.h>
13 #include <oper/vn.h>
15 
17 
18 #define HBFTRACE(obj, ...) \
19 do { \
20  HBF##obj::TraceMsg(HBFTraceBuf, __FILE__, __LINE__, __VA_ARGS__); \
21 } while (false)
22 
24  HBFIntfDBState(bool lintf, std::string projname) :
25  lintf_(lintf), projname_(projname){}
27  bool lintf_; //Is left interface?
28  std::string projname_;
29 };
30 
31 class HBFHandler {
32 public:
34  virtual ~HBFHandler() {
35  }
36 
37  //Registered for VMI notification
38  void ModifyVmInterface(DBTablePartBase *partition, DBEntryBase *e);
39  void Register();
40  bool IsHBFLInterface(VmInterface *vm_itf);
41  bool IsHBFRInterface(VmInterface *vm_itf);
42 
43  void Terminate();
44  const Agent *agent() const {return agent_;}
45 
46 private:
48 
51 };
52 
54 public:
55  HBFVrfWalker(const std::string &name, Agent *agent);
56  virtual ~HBFVrfWalker();
57 
58  void Start(uint32_t hbf_intf_, bool hbf_lintf_, std::string projname);
59  virtual bool VrfWalkNotify(DBTablePartBase *partition, DBEntryBase *e);
60 
61  static void WalkDone(HBFVrfWalker *walker) {
62  LOG(ERROR, "HBF, walk done, releasing the walker");
63  walker->mgr()->ReleaseWalker(walker);
64  }
65 
66 private:
67  uint32_t hbf_intf_;
68  bool hbf_lintf_;
69  std::string projname_;
71 };
72 #endif
boost::intrusive_ptr< AgentRouteWalker > AgentRouteWalkerPtr
void ReleaseWalker(AgentRouteWalker *walker)
AgentRouteWalkerManager * mgr()
Agent * agent() const
Definition: agent.h:361
int ListenerId
Definition: db_table.h:63
Definition: hbf.h:31
HBFHandler(Agent *agent)
Definition: hbf.cc:32
virtual ~HBFHandler()
Definition: hbf.h:34
DISALLOW_COPY_AND_ASSIGN(HBFHandler)
void Register()
Definition: hbf.cc:37
DBTable::ListenerId interface_listener_id_
Definition: hbf.h:49
Agent * agent_
Definition: hbf.h:47
bool IsHBFLInterface(VmInterface *vm_itf)
Definition: hbf.cc:47
bool IsHBFRInterface(VmInterface *vm_itf)
Definition: hbf.cc:51
void ModifyVmInterface(DBTablePartBase *partition, DBEntryBase *e)
Definition: hbf.cc:56
const Agent * agent() const
Definition: hbf.h:44
void Terminate()
Definition: hbf.cc:43
DISALLOW_COPY_AND_ASSIGN(HBFVrfWalker)
static void WalkDone(HBFVrfWalker *walker)
Definition: hbf.h:61
bool hbf_lintf_
Definition: hbf.h:68
std::string projname_
Definition: hbf.h:69
void Start(uint32_t hbf_intf_, bool hbf_lintf_, std::string projname)
Definition: hbf.cc:155
uint32_t hbf_intf_
Definition: hbf.h:67
HBFVrfWalker(const std::string &name, Agent *agent)
Definition: hbf.cc:122
virtual ~HBFVrfWalker()
Definition: hbf.cc:126
virtual bool VrfWalkNotify(DBTablePartBase *partition, DBEntryBase *e)
Definition: hbf.cc:129
SandeshTraceBufferPtr HBFTraceBuf
#define LOG(_Level, _Msg)
Definition: logging.h:35
boost::shared_ptr< TraceBuffer< SandeshTrace > > SandeshTraceBufferPtr
Definition: sandesh_trace.h:19
AgentRouteWalkerPtr vrf_walker_
Definition: hbf.h:26
std::string projname_
Definition: hbf.h:28
bool lintf_
Definition: hbf.h:27
HBFIntfDBState(bool lintf, std::string projname)
Definition: hbf.h:24