OpenSDN source code
controller_dns.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 __DNS_XMPP_H__
7 #define __DNS_XMPP_H__
8 
9 #include <map>
10 #include <string>
11 
12 #include <boost/function.hpp>
13 #include <boost/system/error_code.hpp>
14 
15 #include <bind/bind_util.h>
16 #include <xmpp/xmpp_channel.h>
17 
18 class XmppChannel;
19 class Agent;
20 class VmInterface;
21 
23 public:
24  // Packet module is optional. Callback function to update the flow stats
25  // for ACL. The callback is defined to avoid linking error
26  // when flow is not enabled
27  typedef boost::function<void(DnsUpdateData*, DnsAgentXmpp::XmppType,
29  typedef boost::function<void(AgentDnsXmppChannel*)> DnsXmppEventHandler;
30 
32  std::string xmpp_server, uint8_t xs_idx);
33  virtual ~AgentDnsXmppChannel();
34 
35  virtual std::string ToString() const;
36  virtual bool SendMsg(uint8_t *msg, std::size_t len);
37  virtual void ReceiveMsg(const XmppStanza::XmppMessage *msg);
38  std::string GetXmppServer() { return xmpp_server_; }
39  uint8_t GetXmppServerIdx() { return xs_idx_; }
43  xmps::PeerState state);
45  xmps::PeerState state);
48  Agent *agent() const {return agent_;}
49  void RegisterXmppChannel(XmppChannel *channel);
50  void ReceiveDnsMessage(std::unique_ptr<XmlBase> impl);
51  void TimedOut();
52 
53 protected:
54  virtual void WriteReadyCb(const boost::system::error_code &ec);
55 
56 private:
59  std::string xmpp_server_;
60  uint8_t xs_idx_;
64 };
65 
66 #endif // __DNS_XMPP_H__
void ReceiveDnsMessage(std::unique_ptr< XmlBase > impl)
virtual bool SendMsg(uint8_t *msg, std::size_t len)
static void XmppClientChannelEvent(AgentDnsXmppChannel *peer, xmps::PeerState state)
virtual std::string ToString() const
void ReceiveInternal(const XmppStanza::XmppMessage *msg)
static void set_dns_message_handler_cb(DnsMessageHandler cb)
uint8_t GetXmppServerIdx()
Agent * agent() const
XmppChannel * channel_
void UpdateConnectionInfo(xmps::PeerState state)
boost::function< void(AgentDnsXmppChannel *)> DnsXmppEventHandler
static DnsMessageHandler dns_message_handler_cb_
std::string GetXmppServer()
virtual void WriteReadyCb(const boost::system::error_code &ec)
std::string xmpp_server_
AgentDnsXmppChannel(Agent *agent, std::string xmpp_server, uint8_t xs_idx)
virtual void ReceiveMsg(const XmppStanza::XmppMessage *msg)
XmppChannel * GetXmppChannel()
void RegisterXmppChannel(XmppChannel *channel)
boost::function< void(DnsUpdateData *, DnsAgentXmpp::XmppType, VmInterface const *, bool)> DnsMessageHandler
static void set_dns_xmpp_event_handler_cb(DnsXmppEventHandler cb)
virtual ~AgentDnsXmppChannel()
static void HandleXmppClientChannelEvent(AgentDnsXmppChannel *peer, xmps::PeerState state)
static DnsXmppEventHandler dns_xmpp_event_handler_cb_
Definition: agent.h:361