Project "Tuxbox-GIT: apps":

The branch, master has been updated
       via  a549944c911773488fa8138adb61a39e3ebfd295 (commit)
      from  b3f66515501cbd1bad8d572ca4b2f58f630a3b18 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a549944c911773488fa8138adb61a39e3ebfd295
Author: m4r...@gmx.de <m4r...@gmx.de>
Date:   Tue May 26 13:21:37 2015 +0200

    gui/nfs: implement mac address lookup
    
    Signed-off-by: GetAway <get-a...@t-online.de>

diff --git a/tuxbox/neutrino/data/locale/deutsch.locale 
b/tuxbox/neutrino/data/locale/deutsch.locale
index e9ac38d..c3834cb 100644
--- a/tuxbox/neutrino/data/locale/deutsch.locale
+++ b/tuxbox/neutrino/data/locale/deutsch.locale
@@ -1037,6 +1037,7 @@ nfs.mountnow Jetzt mounten
 nfs.mountok Mount erfolgreich
 nfs.mounttimeout Mount-Fehler: Timeout
 nfs.password Passwort
+nfs.refresh_mac MAC-Adresse ermitteln
 nfs.remount Verzeichnisse erneut mounten
 nfs.type Typ
 nfs.type_cifs CIFS
@@ -1213,7 +1214,7 @@ recordingmenu.sectionsd.run nicht anhalten
 recordingmenu.sectionsd.stop anhalten
 recordingmenu.server Server
 recordingmenu.server_ip Aufnahmeserver IP
-recordingmenu.server_mac Mac Adresse
+recordingmenu.server_mac MAC-Adresse
 recordingmenu.server_port Aufnahmeserver Port
 recordingmenu.server_wakeup Aufnahmeserver WOL
 recordingmenu.setupnow Einstellungen jetzt übernehmen
diff --git a/tuxbox/neutrino/data/locale/english.locale 
b/tuxbox/neutrino/data/locale/english.locale
index ff033c6..c6cf746 100644
--- a/tuxbox/neutrino/data/locale/english.locale
+++ b/tuxbox/neutrino/data/locale/english.locale
@@ -1037,6 +1037,7 @@ nfs.mountnow Mount now
 nfs.mountok Mount successful
 nfs.mounttimeout Mount error: timeout
 nfs.password Password
+nfs.refresh_mac look up MAC address
 nfs.remount Remount directories
 nfs.type Type
 nfs.type_cifs CIFS
@@ -1213,7 +1214,7 @@ recordingmenu.sectionsd.run don't stop
 recordingmenu.sectionsd.stop stop
 recordingmenu.server server
 recordingmenu.server_ip Recording Server IP
-recordingmenu.server_mac MAC Address
+recordingmenu.server_mac MAC address
 recordingmenu.server_port Recording Server Port
 recordingmenu.server_wakeup Recording Server WOL
 recordingmenu.setupnow Activate changes
diff --git a/tuxbox/neutrino/src/gui/nfs.cpp b/tuxbox/neutrino/src/gui/nfs.cpp
index be0c9c3..d58bca4 100644
--- a/tuxbox/neutrino/src/gui/nfs.cpp
+++ b/tuxbox/neutrino/src/gui/nfs.cpp
@@ -55,6 +55,8 @@
 
 #include <zapit/client/zapittools.h>
 
+extern int pinghost (const std::string &hostname, std::string *ip = NULL);
+
 CNFSMountGui::CNFSMountGui()
 {
 #warning move probing from exec() to fsmounter
@@ -107,6 +109,27 @@ int CNFSMountGui::exec( CMenuTarget* parent, const 
std::string & actionKey )
                }
                returnval = menu();
        }
+       else if(actionKey.substr(0,10)=="refreshMAC")
+       {
+               int nr=atoi(actionKey.substr(10,1).c_str());
+               std::string h;
+               pinghost(g_settings.network_nfs[nr].ip, &h);
+               if (!h.empty()) {
+                       FILE *arptable = fopen("/proc/net/arp", "r");
+                       if (arptable) {
+                               char line[120], ip[120], mac[120];
+                               while (fgets(line, sizeof(line), arptable)) {
+                                       if (2 == sscanf(line, "%s %*s %*s %s 
%*[^\n]", ip, mac)) {
+                                               if (!strcmp(ip, h.c_str())) {
+                                                       
g_settings.network_nfs[nr].mac = std::string(mac);
+                                                       break;
+                                               }
+                                       }
+                               }
+                               fclose(arptable);
+                       }
+               }
+       }
        else if(actionKey.substr(0,10)=="mountentry")
        {
                parent->hide();
@@ -217,11 +240,13 @@ int CNFSMountGui::menuEntry(int nr)
        CMenuForwarder *password_fwd = new CMenuForwarder(LOCALE_NFS_PASSWORD, 
(g_settings.network_nfs[nr].type != (int)CFSMounter::NFS), NULL, &passInput);
 
        CMACInput macInput(LOCALE_RECORDINGMENU_SERVER_MAC, 
g_settings.network_nfs[nr].mac);
-       CMenuForwarder * macInput_fwd = new 
CMenuForwarder(LOCALE_RECORDINGMENU_SERVER_MAC, true, 
g_settings.network_nfs[nr].mac, &macInput);
+       CMenuForwarder *macInput_fwd = new 
CMenuForwarder(LOCALE_RECORDINGMENU_SERVER_MAC, true, 
g_settings.network_nfs[nr].mac, &macInput);
+
+       CMenuForwarder *refreshMAC_fwd = new 
CMenuForwarder(LOCALE_NFS_REFRESH_MAC, true, NULL, this, ("refreshMAC" + 
to_string(nr)).c_str(), CRCInput::RC_yellow);
 
        CMenuForwarder *mountnow_fwd = new CMenuForwarder(LOCALE_NFS_MOUNTNOW, 
!(CFSMounter::isMounted(g_settings.network_nfs[nr].local_dir)), NULL, this, 
("domount" + to_string(nr)).c_str(), CRCInput::RC_red);
-       mountnow_fwd->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true);
 
+       mountnow_fwd->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true);
        COnOffNotifier notifier(CFSMounter::NFS);
        notifier.addItem(username_fwd);
        notifier.addItem(password_fwd);
@@ -236,6 +261,7 @@ int CNFSMountGui::menuEntry(int nr)
        mountMenuEntryW.addItem(username_fwd);
        mountMenuEntryW.addItem(password_fwd);
        mountMenuEntryW.addItem(macInput_fwd);
+       mountMenuEntryW.addItem(refreshMAC_fwd);
        mountMenuEntryW.addItem(GenericMenuSeparatorLine);
        mountMenuEntryW.addItem(mountnow_fwd);
 
diff --git a/tuxbox/neutrino/src/system/locals.h 
b/tuxbox/neutrino/src/system/locals.h
index cb1510b..2e40fe0 100644
--- a/tuxbox/neutrino/src/system/locals.h
+++ b/tuxbox/neutrino/src/system/locals.h
@@ -1064,6 +1064,7 @@ typedef enum
        LOCALE_NFS_MOUNTOK,
        LOCALE_NFS_MOUNTTIMEOUT,
        LOCALE_NFS_PASSWORD,
+       LOCALE_NFS_REFRESH_MAC,
        LOCALE_NFS_REMOUNT,
        LOCALE_NFS_TYPE,
        LOCALE_NFS_TYPE_CIFS,
diff --git a/tuxbox/neutrino/src/system/locals_intern.h 
b/tuxbox/neutrino/src/system/locals_intern.h
index 4535f7f..381b664 100644
--- a/tuxbox/neutrino/src/system/locals_intern.h
+++ b/tuxbox/neutrino/src/system/locals_intern.h
@@ -1064,6 +1064,7 @@ const char * locale_real_names[] =
        "nfs.mountok",
        "nfs.mounttimeout",
        "nfs.password",
+       "nfs.refresh_mac",
        "nfs.remount",
        "nfs.type",
        "nfs.type_cifs",

-----------------------------------------------------------------------

Summary of changes:
 tuxbox/neutrino/data/locale/deutsch.locale |    3 +-
 tuxbox/neutrino/data/locale/english.locale |    3 +-
 tuxbox/neutrino/src/gui/nfs.cpp            |   30 ++++++++++++++++++++++++++-
 tuxbox/neutrino/src/system/locals.h        |    1 +
 tuxbox/neutrino/src/system/locals_intern.h |    1 +
 5 files changed, 34 insertions(+), 4 deletions(-)


-- 
Tuxbox-GIT: apps

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Tuxbox-cvs-commits mailing list
Tuxbox-cvs-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tuxbox-cvs-commits

Reply via email to