OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
controller_ifmap.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef __IFMAP_XMPP_H__
6 #define __IFMAP_XMPP_H__
7 
8 #include <map>
9 #include <string>
10 
11 #include <boost/function.hpp>
12 #include <boost/system/error_code.hpp>
13 
14 #include <xmpp/xmpp_channel.h>
15 #include <cmn/agent_cmn.h>
16 
17 class XmppChannel;
18 class AgentXmppChannel;
21 
23 public:
25  virtual ~EndOfConfigData() { }
26 
28  return channel_;
29  }
30 
31 private:
34 };
35 
37 public:
38  typedef boost::shared_ptr<EndOfConfigData> EndOfConfigDataPtr;
39  explicit AgentIfMapXmppChannel(Agent *agent, XmppChannel *channel,
40  uint8_t count);
41  virtual ~AgentIfMapXmppChannel();
42 
43  virtual const std::string &identifier() const {
44  return identifier_;
45  }
46 
47  virtual std::string ToString() const;
48  virtual bool SendUpdate(const std::string &msg);
49  void ReceiveConfigMessage(std::unique_ptr<XmlBase> impl);
50  virtual void ReceiveUpdate(const XmppStanza::XmppMessage *msg);
51  uint8_t GetXmppServerIdx() { return xs_idx_; }
52  static uint64_t GetSeqNumber() { return seq_number_; }
53  static uint64_t NewSeqNumber();
54 
55  //config cleanup timer related routines
57  void StartEndOfConfigTimer();
58  void StopEndOfConfigTimer();
59  void EnqueueEndOfConfig();
60  void ProcessEndOfConfig();
61  //End of config timer routines
65 
66 protected:
67  virtual void WriteReadyCb(const boost::system::error_code &ec);
68 
69 private:
72  std::string identifier_;
73  uint8_t xs_idx_;
74  static uint64_t seq_number_;
75  boost::scoped_ptr<ConfigCleanupTimer> config_cleanup_timer_;
76  boost::scoped_ptr<EndOfConfigTimer> end_of_config_timer_;
78 };
79 
81 public:
82  typedef std::list<boost::uuids::uuid> UuidList;
83  struct VmExportInfo {
85  uint64_t seq_number_;
86 
87  VmExportInfo(uint64_t seq_no) : vmi_list_(), seq_number_(seq_no) { }
89  };
90 
93 
94  void VmiAdd(const ControllerVmiSubscribeData *entry);
95  void VmiDelete(const ControllerVmiSubscribeData *entry);
96  void VmiEvent(const ControllerVmiSubscribeData *entry);
97  void NotifyAll(AgentXmppChannel *peer);
98  typedef std::map<boost::uuids::uuid, struct VmExportInfo *> VmMap;
99  Agent *agent() const {return agent_;}
100 
101 private:
105 };
106 #endif // __IFMAP_XMPP_H__
AgentIfMapXmppChannel(Agent *agent, XmppChannel *channel, uint8_t count)
virtual ~EndOfConfigData()
virtual std::string ToString() const
DBTableBase::ListenerId vmi_list_id_
void VmiAdd(const ControllerVmiSubscribeData *entry)
virtual void WriteReadyCb(const boost::system::error_code &ec)
boost::scoped_ptr< ConfigCleanupTimer > config_cleanup_timer_
virtual const std::string & identifier() const
AgentIfMapVmExport(Agent *agent)
int ListenerId
Definition: db_table.h:62
boost::shared_ptr< EndOfConfigData > EndOfConfigDataPtr
void ReceiveInternal(const XmppStanza::XmppMessage *msg)
AgentIfMapXmppChannel * channel()
virtual void ReceiveUpdate(const XmppStanza::XmppMessage *msg)
EndOfConfigTimer * end_of_config_timer()
virtual bool SendUpdate(const std::string &msg)
EndOfConfigData(AgentIfMapXmppChannel *ch)
Definition: agent.h:358
void NotifyAll(AgentXmppChannel *peer)
void VmiDelete(const ControllerVmiSubscribeData *entry)
DISALLOW_COPY_AND_ASSIGN(EndOfConfigData)
Agent * agent() const
boost::scoped_ptr< EndOfConfigTimer > end_of_config_timer_
AgentIfMapXmppChannel * channel_
std::list< boost::uuids::uuid > UuidList
static uint64_t GetSeqNumber()
void ReceiveConfigMessage(std::unique_ptr< XmlBase > impl)
std::map< boost::uuids::uuid, struct VmExportInfo * > VmMap
static uint64_t seq_number_
static uint64_t NewSeqNumber()
void VmiEvent(const ControllerVmiSubscribeData *entry)
ConfigCleanupTimer * config_cleanup_timer()