Changeset 19232


Ignore:
Timestamp:
10/03/18 20:32:17 (6 years ago)
Author:
tbretz
Message:
Added the possibility to change the port through which the DIM communication with the DNS takes place.
Location:
trunk/FACT++/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/DimSetup.cc

    r12348 r19232  
    158158//!     Address of the Dim-dns
    159159//!
    160 void Dim::Setup(const std::string &dns, const std::string &host)
     160void Dim::Setup(const std::string &dns, const std::string &host, const uint16_t &port)
    161161{
    162162    if (dns.empty())
     
    172172    setenv("DIM_DNS_NODE",  dns.c_str(), 1);
    173173    setenv("DIM_HOST_NODE", loc.c_str(), 1);
     174    if (port>0)
     175        setenv("DIM_DNS_PORT", to_string(port).c_str(), 1);
    174176
    175     cout << "Setting DIM_DNS_NODE =" << dns << endl;
     177    cout << "Setting DIM_DNS_NODE =" << dns;
     178    if (port>0)
     179        cout << ':' << port << endl;
    176180    cout << "Setting DIM_HOST_NODE=" << loc << endl;
    177181}
  • trunk/FACT++/src/DimSetup.h

    r14955 r19232  
    88    //std::string GetLocalIp(const std::string &dns="192.168.0.255");
    99    std::string GetLocalIp(const std::string &dns="10.0.100.1");
    10     void Setup(const std::string &dns="", const std::string &host="");
     10    void Setup(const std::string &dns="", const std::string &host="", const uint16_t &port=0);
    1111}
    1212
  • trunk/FACT++/src/Main.h

    r18845 r19232  
    2929        po::options_description config("Program options");
    3030        config.add_options()
    31             ("dns",        var<string>("localhost"),       "Dim nameserver (overwites DIM_DNS_NODE environment variable)")
    32             ("host",       var<string>(),                  "Address with which the Dim nameserver can connect to this host (overwites DIM_HOST_NODE environment variable)")
     31            ("dns",        var<string>("localhost"), "Dim nameserver (overwites DIM_DNS_NODE environment variable)")
     32            ("port",       var<uint16_t>(DNS_PORT),  "Port to connect to dim nameserver.")
     33            ("host",       var<string>(""),          "Address with which the Dim nameserver can connect to this host (overwites DIM_HOST_NODE environment variable)")
    3334            ("log,l",      var<string>(n), "Name of local log-file")
    3435            ("logpath",    var<string>(),  "Absolute path to log-files (default: excutable's directory)")
     
    4546
    4647        conf.AddEnv("dns",  "DIM_DNS_NODE");
     48        conf.AddEnv("port", "DIM_DNS_PORT");
    4749        conf.AddEnv("host", "DIM_HOST_NODE");
    4850        conf.AddEnv("home", "HOME");
     
    8890    int execute(Configuration &conf, bool dummy=false)
    8991    {
    90         Dim::Setup(conf.Get<string>("dns"), conf.Has("host")?conf.Get<string>("host"):"");
     92        Dim::Setup(conf.Get<string>("dns"), conf.Get<string>("host"), conf.Get<uint16_t>("port"));
    9193
    9294        // -----------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.