13 #include "pugixml/pugixml.hpp"
18 using process::ConnectionType;
19 using process::ConnectionStatus;
25 std::string xmpp_server, uint8_t xs_idx)
26 : channel_(NULL), xmpp_server_(xmpp_server), xs_idx_(xs_idx),
75 pugi::xml_node node = pugi->
FindNode(
"dns");
81 code, xmpp_data.get())) {
97 std::unique_ptr<XmlBase> dummy_dom;
101 std::move(dummy_dom),
116 bool update_list =
false;
119 for (; iter != end; iter++) {
120 std::vector<string> server;
121 boost::split(server, *iter, boost::is_any_of(
":"));
124 if (iter + 1 == end)
break;
125 std::rotate(iter, iter + 1, end);
158 boost::asio::ip::tcp::endpoint ep;
159 boost::system::error_code ec;
160 std::string last_state_name;
164 ep.address().to_string();
171 ConnectionStatus::UP, ep,
175 ConnectionStatus::DOWN, ep,
pugi::xml_node FindNode(const std::string &name)
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 void RegisterReceive(xmps::PeerId, ReceiveCb)=0
virtual ~AgentDnsXmppChannel()
std::vector< string > & GetDnslist()
const std::string & dns_server(uint8_t idx) const
virtual bool SendMsg(uint8_t *msg, std::size_t len)
uint8_t GetXmppServerIdx()
const pugi::xml_document & doc()
boost::function< void(DnsUpdateData *, DnsAgentXmpp::XmppType, VmInterface const *, bool)> DnsMessageHandler
void Enqueue(ControllerWorkQueueDataType data)
virtual xmps::PeerState GetPeerState() const =0
void UpdateConnectionInfo(xmps::PeerState state)
void RegisterXmppChannel(XmppChannel *channel)
static void set_dns_xmpp_event_handler_cb(DnsXmppEventHandler cb)
virtual bool Send(const uint8_t *, size_t, xmps::PeerId, SendReadyCb)=0
virtual void ReceiveMsg(const XmppStanza::XmppMessage *msg)
std::unique_ptr< XmlBase > dom
void ReceiveInternal(const XmppStanza::XmppMessage *msg)
std::string GetXmppServer()
static void set_dns_message_handler_cb(DnsMessageHandler cb)
VNController * controller() const
virtual std::string ToString() const
void LoadXmlDoc(const pugi::xml_document &doc)
static const std::string & xmpp_dns_server_prefix()
virtual const std::string & ToString() const =0
virtual void UnRegisterReceive(xmps::PeerId)=0
virtual std::string LastStateName() const =0
const uint16_t dns_server_port(uint8_t idx) const
IpAddress AddressFromString(const std::string &ip_address_str, boost::system::error_code *ec)
static int compare(const Type &lhs, const Type &rhs)
boost::function< void(AgentDnsXmppChannel *)> DnsXmppEventHandler
static bool DnsAgentXmppDecode(const pugi::xml_node dns, XmppType &type, uint32_t &xid, uint16_t &resp_code, DnsUpdateData *data, std::string source_name="")
virtual void UnRegisterWriteReady(xmps::PeerId id)=0
XmppChannel * GetXmppChannel()
static void XmppClientChannelEvent(AgentDnsXmppChannel *peer, xmps::PeerState state)
static XmppXmlImplFactory * Instance()
process::ConnectionState * connection_state() const
void ReceiveDnsMessage(std::unique_ptr< XmlBase > impl)
AgentDnsXmppChannel(Agent *agent, std::string xmpp_server, uint8_t xs_idx)
void ReConnectDnsServer()