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

Generated by: LCOV version 1.14