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