LCOV - code coverage report
Current view: top level - dns/cmn - dns.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 14 17 82.4 %
Date: 2026-11-09 02:10:49 Functions: 9 11 81.8 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
       3             :  * Copyright Contributors to the OpenSDN project
       4             :  */
       5             : 
       6             : #ifndef __DNS_CMN_H_
       7             : #define __DNS_CMN_H_
       8             : 
       9             : #include <boost/intrusive_ptr.hpp>
      10             : #include <boost/bind/bind.hpp>
      11             : 
      12             : #include <io/event_manager.h>
      13             : #include <base/logging.h>
      14             : #include <base/address.h>
      15             : #include <db/db.h>
      16             : #include <db/db_entry.h>
      17             : #include <db/db_table.h>
      18             : #include <base/task.h>
      19             : #include <base/task_trigger.h>
      20             : #include <io/event_manager.h>
      21             : #include <base/misc_utils.h>
      22             : #include <sandesh/sandesh_trace.h>
      23             : 
      24             : using namespace boost::placeholders;
      25             : 
      26             : class EventManager;
      27             : class DnsManager;
      28             : class DnsConfigManager;
      29             : class XmppServer;
      30             : class DnsAgentXmppChannelManager;
      31             : 
      32             : class Dns {
      33             : public:
      34          61 :     static EventManager *GetEventManager() { return event_mgr_; }
      35           1 :     static void SetEventManager(EventManager *evm) { event_mgr_ = evm; }
      36             : 
      37           2 :     static DnsManager *GetDnsManager() { return dns_mgr_; }
      38          15 :     static void SetDnsManager(DnsManager *mgr) { dns_mgr_ = mgr; }
      39             : 
      40          54 :     static DnsConfigManager *GetDnsConfigManager() { return dns_config_mgr_; }
      41          15 :     static void SetDnsConfigManager(DnsConfigManager *cfg) { dns_config_mgr_ = cfg; }
      42             : 
      43           0 :     static XmppServer *GetXmppServer() { return xmpp_server_; }
      44             :     static void SetXmppServer(XmppServer *server) { xmpp_server_ = server; }
      45             : 
      46             :     static const uint32_t GetXmppServerPort() { return xmpp_srv_port_; }
      47             :     static void SetXmppServerPort(uint32_t port) { xmpp_srv_port_ = port; }
      48             : 
      49           0 :     static DnsAgentXmppChannelManager *GetAgentXmppChannelManager() {
      50           0 :         return agent_xmpp_channel_mgr_;
      51             :     }
      52             :     static void SetAgentXmppChannelManager(DnsAgentXmppChannelManager *mgr) {
      53             :         agent_xmpp_channel_mgr_ = mgr;
      54             :     }
      55             : 
      56             :     static const std::string &GetHostName() {return host_name_;}
      57             :     static void SetHostName(const std::string name) { host_name_ = name; };
      58             :     static const std::string &GetProgramName() {return prog_name_;}
      59             :     static void SetProgramName(const char *name) { prog_name_ = name; };
      60             :     static const std::string &GetCollector() {return collector_;}
      61             :     static void SetCollector(std::string name) { collector_ = name; };
      62             :     static const uint32_t GetHttpPort() { return http_port_; }
      63             :     static void SetHttpPort(uint32_t port) { http_port_ = port; };
      64          96 :     static const uint32_t GetDnsPort() { return dns_port_; }
      65             :     static void SetDnsPort(uint32_t port) { dns_port_ = port; };
      66          19 :     static std::string GetSelfIp() { return self_ip_; }
      67             :     static void SetSelfIp(std::string ip) { self_ip_ = ip; }
      68             : 
      69             :     static bool GetVersion(std::string &build_info_str);
      70           1 :     static void Init() {
      71             :         EventManager *evm;
      72           1 :         evm = new EventManager();
      73           1 :         assert(evm);
      74           1 :         SetEventManager(evm);
      75             : 
      76           1 :         SetTaskSchedulingPolicy();
      77           1 :     }
      78             : 
      79             : private:
      80             :     static void SetTaskSchedulingPolicy();
      81             : 
      82             :     static EventManager *event_mgr_;
      83             :     static DnsManager *dns_mgr_;
      84             :     static DnsConfigManager *dns_config_mgr_;
      85             : 
      86             :     static XmppServer *xmpp_server_;
      87             :     static uint32_t xmpp_srv_port_;
      88             :     static std::string host_name_;
      89             :     static std::string prog_name_;
      90             :     static std::string self_ip_;
      91             :     static std::string collector_;
      92             :     static uint32_t http_port_;
      93             :     static uint32_t dns_port_;
      94             :     static DnsAgentXmppChannelManager *agent_xmpp_channel_mgr_;
      95             : };
      96             : 
      97             : #endif // __DNS_CMN_H_

Generated by: LCOV version 1.14