Ignore:
Timestamp:
10/23/13 10:09:58 (14 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3, releng/10.1
Children:
dfb8c89
Parents:
b62e8c4
Message:

Add the ability to scan the network for hosts with SSH availability (port 22) to the Configuration UI. If it works, I will add the same thing to the LPWizard.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/life-preserver/lp-gui/LPGUtils.cpp

    r6a2483b rb22b3a5  
    253253  return devs; 
    254254} 
     255 
     256QStringList LPGUtils::scanNetworkSSH(){ 
     257  //Output format: <name>:::<address>::::<port> 
     258  QStringList out; 
     259  QStringList netout = LPBackend::getCmdOutput("avahi-browse -art"); 
     260  for(int i=0; i<netout.length(); i++){ 
     261    if(netout[i].startsWith("=") && netout[i].contains("local")){ 
     262      QString name, address, port; 
     263      for(int j=0; j<3; j++){ //need the next 3 lines 
     264        i++; //Move to the next line 
     265        QString var = netout[i].section("=",0,0).replace("\t"," ").simplified(); 
     266        QString val = netout[i].section("[",1,1).section("]",0,0).simplified(); 
     267        if(var == "hostname"){ name = val.section(".local",0,0).simplified(); } 
     268        else if(var == "address"){ address = val; } 
     269        else if(var == "port"){ port = val; } 
     270      } 
     271      //Check that it is an SSH connection that is open (port 22) 
     272      if(port == "22"){  
     273         out << name+":::"+address+":::"+port; 
     274      } 
     275    } 
     276  } 
     277  return out; 
     278} 
Note: See TracChangeset for help on using the changeset viewer.