LCOV - code coverage report
Current view: top level - dns/agent - agent_xmpp_channel.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 0 2 0.0 %
Date: 2026-06-11 01:56:02 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
       3             :  */
       4             : 
       5             : #ifndef _dns_agent_xmpp_channel_h_
       6             : #define _dns_agent_xmpp_channel_h_
       7             : 
       8             : #include <map>
       9             : #include <set>
      10             : #include <string>
      11             : #include <mutex>
      12             : 
      13             : #include <boost/function.hpp>
      14             : #include <boost/bind/bind.hpp>
      15             : 
      16             : #include "xmpp/xmpp_channel.h"
      17             : #include "bind/bind_util.h"
      18             : 
      19             : using namespace boost::placeholders;
      20             : 
      21             : class XmppServer;
      22             : class DnsAgentXmppChannelManager;
      23             : class AgentData;
      24             : class AgentDnsData;
      25             : class TaskTrigger;
      26             : 
      27             : class DnsAgentXmppChannel {
      28             : public:
      29             :     typedef std::set<DnsUpdateData *, DnsUpdateData::Compare> DataSet;
      30             : 
      31             :     DnsAgentXmppChannel(XmppChannel *channel,
      32             :                         DnsAgentXmppChannelManager *mgr);
      33             :     virtual ~DnsAgentXmppChannel();
      34             :     void Close();
      35             :     void ReceiveReq(const XmppStanza::XmppMessage *msg);
      36             :     void GetAgentDnsData(AgentDnsData &data);
      37             :     void UpdateDnsRecords(BindUtil::Operation op);
      38             : 
      39             : private:
      40             :     std::string GetDnsRecordName(std::string &vdns_name, const DnsItem &item);
      41             :     void HandleAgentUpdate(std::unique_ptr<DnsUpdateData> rcv_data);
      42             : 
      43             :     DataSet update_data_;
      44             :     XmppChannel *channel_;
      45             :     DnsAgentXmppChannelManager *mgr_;
      46             : };
      47             : 
      48             : class DnsAgentXmppChannelManager {
      49             : public:
      50             :     struct RecordRequest {
      51             :         BindUtil::Operation op;
      52             :         std::string record_name;
      53             :         std::string vdns_name;
      54             :         DnsItem item;
      55             : 
      56           0 :         RecordRequest(BindUtil::Operation o, const std::string &rec,
      57             :                       const std::string &vdns, const DnsItem &it)
      58           0 :             : op(o), record_name(rec), vdns_name(vdns), item(it) {}
      59             :     };
      60             :     typedef WorkQueue<boost::shared_ptr<RecordRequest> > RecordRequestWorkQueue;
      61             : 
      62             :     typedef std::map<const XmppChannel *, DnsAgentXmppChannel *> ChannelMap;
      63             : 
      64             :     DnsAgentXmppChannelManager(XmppServer *server);
      65             :     virtual ~DnsAgentXmppChannelManager();
      66             :     void RemoveChannel(XmppChannel *ch);
      67             :     DnsAgentXmppChannel *FindChannel(const XmppChannel *ch);
      68             :     void HandleXmppChannelEvent(XmppChannel *channel, xmps::PeerState state);
      69             :     bool ProcessRecord(boost::shared_ptr<RecordRequest> req);
      70             :     void EnqueueRecord(boost::shared_ptr<RecordRequest> req);
      71             : 
      72             :     void GetAgentData(std::vector<AgentData> &list);
      73             :     void GetAgentDnsData(std::vector<AgentDnsData> &dt);
      74             : 
      75             : private:
      76             :     uint8_t ChannelToDscp(const XmppChannel *xc) const;
      77             :     XmppServer *server_;
      78             :     ChannelMap channel_map_;
      79             :     std::mutex mutex_;
      80             :     RecordRequestWorkQueue work_queue_;
      81             : };
      82             : 
      83             : #endif // _dns_agent_xmpp_channel_h_

Generated by: LCOV version 1.14