NSIS-ka
A free C++ implementation of NSIS protocols

Changeset 4165


Ignore:
Timestamp:
Jul 23, 2009, 5:13:40 PM (8 years ago)
Author:
stud-lenk
Message:

Add first yet incomplete rudimentary multicast support

Location:
ntlp/branches/20090723-multicast
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ntlp/branches/20090723-multicast/include/gist_conf.h

    r4108 r4165  
    7373    gistconf_tls_client_privkey,
    7474    gistconf_tls_cacert,
     75    gistconf_multicast_groups,
    7576    gistconf_maxparno
    7677  };
  • ntlp/branches/20090723-multicast/src/gist_conf.cpp

    r4108 r4165  
    8080  registerPar( new configpar<string>(gist_realm, gistconf_tls_client_privkey, "tls-privkey",  "filename pointing to the SSL/TLS client private key file (may contain absolute path)", false, "client_privkey.pem") );
    8181  registerPar( new configpar<string>(gist_realm, gistconf_tls_cacert, "tls-cacert",  "filename pointing to the SSL/TLS CA cert file (may contain absolute path)", false, "root_cert.pem") );
     82  registerPar( new configpar< hostaddresslist_t >(gist_realm, gistconf_multicast_groups, "gist-multicast-groups", "IP multicast groups for GIST multicast messages", false, list<hostaddress>() ) );
    8283
    8384  DLog("gistconf::registerAllPars", "finished registering gist parameters.");
  • ntlp/branches/20090723-multicast/src/ntlp_starter.cpp

    r4108 r4165  
    4242#include <string>
    4343#include <sstream>
     44#include <cerrno>
    4445
    4546#include <netdb.h>
     
    495496       
    496497  sleep(2);
    497 
    498   DLog(param.name, "Startup phase 9: Enabling Packet Interception");
     498 
     499  // =====================================================================
     500  // Join multicast groups
     501  // =====================================================================
     502  DLog(param.name, "Startup phase 9: Join GIST multicast groups");
     503  hostaddresslist_t& mcastgroups= gconf.getparref< hostaddresslist_t >(gistconf_multicast_groups);
     504  if (mcastgroups.empty() == false) {
     505    hostaddresslist_t::iterator it = mcastgroups.begin();
     506    while (it != mcastgroups.end())
     507    {
     508      if ((*it).is_multicast()) {
     509        int status = (*udpproto).join_multicast_group(*it);
     510        if (status == 0)
     511          ILog(param.name, "Successfully joined IP multicast group " << *it);
     512        else
     513          ERRLog(param.name, "Joining IP multicast group " << *it
     514                             << " failed: " << strerror(errno));
     515      } else {
     516        ERRLog(param.name, "Skipping join to IP multicast group " << *it
     517                             << " (not a multicast address)");
     518      }
     519      it++;
     520    }
     521  }
     522
     523  // =====================================================================
     524  // Enable packet interception
     525  // =====================================================================
     526  DLog(param.name, "Startup phase 10: Enabling Packet Interception");
    499527
    500528  if ( gconf.getpar<string>(gistconf_intercept_cmd).length() == 0 )
Note: See TracChangeset for help on using the changeset viewer.