OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
controller_dns.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef __DNS_XMPP_H__
6 #define __DNS_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 <bind/bind_util.h>
15 #include <xmpp/xmpp_channel.h>
16 
17 class XmppChannel;
18 class Agent;
19 class VmInterface;
20 
22 public:
23  // Packet module is optional. Callback function to update the flow stats
24  // for ACL. The callback is defined to avoid linking error
25  // when flow is not enabled
26  typedef boost::function<void(DnsUpdateData*, DnsAgentXmpp::XmppType,
28  typedef boost::function<void(AgentDnsXmppChannel*)> DnsXmppEventHandler;
29 
31  std::string xmpp_server, uint8_t xs_idx);
32  virtual ~AgentDnsXmppChannel();
33 
34  virtual std::string ToString() const;
35  virtual bool SendMsg(uint8_t *msg, std::size_t len);
36  virtual void ReceiveMsg(const XmppStanza::XmppMessage *msg);
37  std::string GetXmppServer() { return xmpp_server_; }
38  uint8_t GetXmppServerIdx() { return xs_idx_; }
42  xmps::PeerState state);
44  xmps::PeerState state);
47  Agent *agent() const {return agent_;}
48  void RegisterXmppChannel(XmppChannel *channel);
49  void ReceiveDnsMessage(std::unique_ptr<XmlBase> impl);
50  void TimedOut();
51 
52 protected:
53  virtual void WriteReadyCb(const boost::system::error_code &ec);
54 
55 private:
58  std::string xmpp_server_;
59  uint8_t xs_idx_;
63 };
64 
65 #endif // __DNS_XMPP_H__
static void HandleXmppClientChannelEvent(AgentDnsXmppChannel *peer, xmps::PeerState state)
virtual void WriteReadyCb(const boost::system::error_code &ec)
static DnsXmppEventHandler dns_xmpp_event_handler_cb_
static DnsMessageHandler dns_message_handler_cb_
virtual ~AgentDnsXmppChannel()
virtual bool SendMsg(uint8_t *msg, std::size_t len)
uint8_t GetXmppServerIdx()
boost::function< void(DnsUpdateData *, DnsAgentXmpp::XmppType, VmInterface const *, bool)> DnsMessageHandler
Agent * agent() const
void UpdateConnectionInfo(xmps::PeerState state)
void RegisterXmppChannel(XmppChannel *channel)
static void set_dns_xmpp_event_handler_cb(DnsXmppEventHandler cb)
virtual void ReceiveMsg(const XmppStanza::XmppMessage *msg)
void ReceiveInternal(const XmppStanza::XmppMessage *msg)
Definition: agent.h:358
std::string GetXmppServer()
static void set_dns_message_handler_cb(DnsMessageHandler cb)
virtual std::string ToString() const
XmppChannel * channel_
std::string xmpp_server_
boost::function< void(AgentDnsXmppChannel *)> DnsXmppEventHandler
XmppChannel * GetXmppChannel()
static void XmppClientChannelEvent(AgentDnsXmppChannel *peer, xmps::PeerState state)
void ReceiveDnsMessage(std::unique_ptr< XmlBase > impl)
AgentDnsXmppChannel(Agent *agent, std::string xmpp_server, uint8_t xs_idx)