LCOV - code coverage report
Current view: top level - dns/cmn - dns_options.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 48 48 100.0 %
Date: 2026-11-09 02:10:49 Functions: 36 36 100.0 %
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             : #include <boost/program_options.hpp>
       7             : #include "config-client-mgr/config_client_options.h"
       8             : #include "io/event_manager.h"
       9             : #include "sandesh/sandesh.h"
      10             : 
      11             : class ConfigClientManager;
      12             : 
      13             : // Process command line/configuration file options for dns.
      14             : class Options {
      15             : public:
      16             :     Options();
      17             :     bool Parse(EventManager &evm, int argc, char *argv[]);
      18             :     void ParseReConfig();
      19             : 
      20          36 :     std::vector<std::string> collector_server_list() const {
      21          36 :         return collector_server_list_;
      22             :     }
      23             :     std::vector<std::string> randomized_collector_server_list() const {
      24             :         return randomized_collector_server_list_;
      25             :     }
      26           6 :     std::string dns_config_file() const { return dns_config_file_; }
      27           6 :     std::string config_file() const { return config_file_; };
      28           5 :     const std::string & named_config_file() const { return named_config_file_; }
      29           5 :     const std::string & named_config_dir() const { return named_config_dir_; }
      30           5 :     const std::string & named_log_file() const { return named_log_file_; }
      31           5 :     const std::string & rndc_config_file() const { return rndc_config_file_; }
      32           5 :     const std::string & rndc_secret() const { return rndc_secret_; }
      33           2 :     const std::string & named_max_cache_size() const {
      34           2 :         return named_max_cache_size_;
      35             :     }
      36             :     const uint16_t named_max_retransmissions() { return named_max_retransmissions_; }
      37             :     const uint16_t named_retransmission_interval() {
      38             :         return named_retransmission_interval_;
      39             :     }
      40           6 :     std::string hostname() const { return hostname_; }
      41           6 :     std::string host_ip() const { return host_ip_; }
      42           6 :     uint16_t http_server_port() const { return http_server_port_; }
      43           6 :     uint16_t dns_server_port() const { return dns_server_port_; }
      44           6 :     std::string log_category() const { return log_category_; }
      45           6 :     bool log_disable() const { return log_disable_; }
      46           6 :     std::string log_file() const { return log_file_; }
      47           3 :     std::string log_property_file() const { return log_property_file_; }
      48           6 :     int log_files_count() const { return log_files_count_; }
      49           6 :     long log_file_size() const { return log_file_size_; }
      50           6 :     std::string log_level() const { return log_level_; }
      51           6 :     bool log_local() const { return log_local_; }
      52             :     bool use_syslog() const { return use_syslog_; }
      53             :     std::string syslog_facility() const { return syslog_facility_; }
      54           7 :     std::string config_db_user() const {
      55           7 :         return configdb_options_.config_db_username;
      56             :     }
      57           7 :     std::string config_db_password() const {
      58           7 :         return configdb_options_.config_db_password;
      59             :     }
      60           7 :     bool config_db_use_ssl() const {
      61           7 :         return configdb_options_.config_db_use_ssl;
      62             :     }
      63          20 :     std::vector<std::string> config_db_server_list() const {
      64          20 :         return configdb_options_.config_db_server_list;
      65             :     }
      66          20 :     std::vector<std::string> rabbitmq_server_list() const {
      67          20 :         return configdb_options_.rabbitmq_server_list;
      68             :     }
      69           8 :     std::string rabbitmq_user() const {
      70           8 :         return configdb_options_.rabbitmq_user;
      71             :     }
      72           8 :     std::string rabbitmq_password() const {
      73           8 :         return configdb_options_.rabbitmq_password;
      74             :     }
      75           6 :     bool rabbitmq_ssl_enabled() const {
      76           6 :         return configdb_options_.rabbitmq_use_ssl;
      77             :     }
      78           5 :     const ConfigClientOptions &configdb_options() const {
      79           5 :         return configdb_options_;
      80             :     }
      81           1 :     bool xmpp_auth_enabled() const { return xmpp_auth_enable_; }
      82           1 :     std::string xmpp_server_cert() const { return xmpp_server_cert_; }
      83           1 :     std::string xmpp_server_key() const { return xmpp_server_key_; }
      84           1 :     std::string xmpp_ca_cert() const { return xmpp_ca_cert_; }
      85           6 :     bool test_mode() const { return test_mode_; }
      86             :     bool collectors_configured() const { return collectors_configured_; }
      87           9 :     const SandeshConfig &sandesh_config() const {
      88           9 :         return sandesh_config_;
      89             :     }
      90             : 
      91             :     void set_config_client_manager(ConfigClientManager *mgr) {
      92             :         config_client_manager_ = mgr;
      93             :     }
      94             : 
      95             : private:
      96             : 
      97             :     void Process(int argc, char *argv[],
      98             :             boost::program_options::options_description &cmdline_options);
      99             :     void Initialize(EventManager &evm,
     100             :                     boost::program_options::options_description &options);
     101             :     void ParseConfigOptions(const boost::program_options::variables_map
     102             :                             &var_map);
     103             :     uint32_t GenerateHash(const std::vector<std::string> &list);
     104             :     uint32_t GenerateHash(const ConfigClientOptions &config);
     105             : 
     106             :     std::vector<std::string> collector_server_list_;
     107             :     std::vector<std::string> randomized_collector_server_list_;
     108             :     uint32_t collector_chksum_;
     109             :     uint32_t configdb_chksum_;
     110             :     std::string dns_config_file_;
     111             :     std::string config_file_;
     112             : 
     113             :     std::string named_config_file_;
     114             :     std::string named_config_dir_;
     115             :     std::string named_log_file_;
     116             :     std::string rndc_config_file_;
     117             :     std::string rndc_secret_;
     118             :     std::string named_max_cache_size_;
     119             :     uint16_t named_max_retransmissions_;
     120             :     uint16_t named_retransmission_interval_;
     121             : 
     122             :     std::string hostname_;
     123             :     std::string host_ip_;
     124             :     uint16_t http_server_port_;
     125             :     uint16_t dns_server_port_;
     126             :     std::string log_category_;
     127             :     bool log_disable_;
     128             :     std::string log_file_;
     129             :     std::string log_property_file_;
     130             :     int log_files_count_;
     131             :     long log_file_size_;
     132             :     std::string log_level_;
     133             :     bool log_local_;
     134             :     bool use_syslog_;
     135             :     std::string syslog_facility_;
     136             :     ConfigClientOptions configdb_options_;
     137             :     bool xmpp_auth_enable_;
     138             :     std::string xmpp_server_cert_;
     139             :     std::string xmpp_server_key_;
     140             :     std::string xmpp_ca_cert_;
     141             :     bool test_mode_;
     142             :     bool collectors_configured_;
     143             :     std::vector<std::string> default_collector_server_list_;
     144             :     uint32_t send_ratelimit_;
     145             :     SandeshConfig sandesh_config_;
     146             : 
     147             :     boost::program_options::options_description config_file_options_;
     148             :     ConfigClientManager *config_client_manager_;
     149             : };

Generated by: LCOV version 1.14