diff options
author | Markus Brueffer <markus@FreeBSD.org> | 2005-01-22 01:39:05 +0000 |
---|---|---|
committer | Markus Brueffer <markus@FreeBSD.org> | 2005-01-22 01:39:05 +0000 |
commit | 9c29f9eabbe0fd2bb8bbcba4b1ad7cbc099e4425 (patch) | |
tree | bb7bbe3a431fe7b2c4d4e1b2ea420285023c6d33 /net/knemo | |
parent | 1f08544d942340ee59c8433e1dbb352c635c9178 (diff) | |
download | ports-9c29f9eabbe0fd2bb8bbcba4b1ad7cbc099e4425.tar.gz ports-9c29f9eabbe0fd2bb8bbcba4b1ad7cbc099e4425.zip |
Notes
Diffstat (limited to 'net/knemo')
-rw-r--r-- | net/knemo/Makefile | 29 | ||||
-rw-r--r-- | net/knemo/distinfo | 2 | ||||
-rw-r--r-- | net/knemo/files/patch-kcm-configdialog.cpp | 78 | ||||
-rw-r--r-- | net/knemo/files/patch-knemod-data.h | 35 | ||||
-rw-r--r-- | net/knemo/files/patch-knemod-interfacestatusdialog.cpp | 50 | ||||
-rw-r--r-- | net/knemo/files/patch-knemod-interfacestatusdlg.ui | 271 | ||||
-rw-r--r-- | net/knemo/files/patch-knemod-interfacetooltip.cpp | 34 | ||||
-rw-r--r-- | net/knemo/files/patch-knemod-interfaceupdater.cpp | 290 | ||||
-rw-r--r-- | net/knemo/pkg-descr | 6 | ||||
-rw-r--r-- | net/knemo/pkg-message | 4 | ||||
-rw-r--r-- | net/knemo/pkg-plist | 62 |
11 files changed, 861 insertions, 0 deletions
diff --git a/net/knemo/Makefile b/net/knemo/Makefile new file mode 100644 index 000000000000..e16da908d0f8 --- /dev/null +++ b/net/knemo/Makefile @@ -0,0 +1,29 @@ +# New ports collection makefile for: knemo +# Date created: Sat Jan 22 00:20:26 CET 2005 +# Whom: Markus Brueffer <markus@FreeBSD.org> +# +# $FreeBSD$ + +PORTNAME= knemo +PORTVERSION= 0.3.1 +CATEGORIES= net kde +MASTER_SITES= http://www.eris23.de/knemo/ + +MAINTAINER= markus@FreeBSD.org +COMMENT= Network monitor for KDE + +EXTRA_PATCHES= ${.CURDIR}/../../x11/kde3/files/extrapatch-old_configure + +USE_BZIP2= yes +USE_KDELIBS_VER=3 +USE_GMAKE= yes +GNU_CONFIGURE= yes +USE_REINPLACE= yes + +post-patch: + @${REINPLACE_CMD} -e 's|-O2||g' ${WRKSRC}/${CONFIGURE_SCRIPT} + +post-install: + @${CAT} ${PKGMESSAGE} + +.include <bsd.port.mk> diff --git a/net/knemo/distinfo b/net/knemo/distinfo new file mode 100644 index 000000000000..cb2201637487 --- /dev/null +++ b/net/knemo/distinfo @@ -0,0 +1,2 @@ +MD5 (knemo-0.3.1.tar.bz2) = 774b7b085e7b2d492bf811d7f89cee6e +SIZE (knemo-0.3.1.tar.bz2) = 549018 diff --git a/net/knemo/files/patch-kcm-configdialog.cpp b/net/knemo/files/patch-kcm-configdialog.cpp new file mode 100644 index 000000000000..d8285d4fe55f --- /dev/null +++ b/net/knemo/files/patch-kcm-configdialog.cpp @@ -0,0 +1,78 @@ +--- kcm/configdialog.cpp.orig Wed Sep 15 18:24:37 2004 ++++ kcm/configdialog.cpp Wed Jan 19 15:23:57 2005 +@@ -17,6 +17,16 @@ + Boston, MA 02111-1307, USA. + */ + ++#ifdef __FreeBSD__ ++#include <sys/types.h> ++#include <sys/socket.h> ++#include <net/if.h> ++#include <net/if_mib.h> ++#include <sys/param.h> ++#include <sys/sysctl.h> ++#include <net/route.h> ++#endif ++ + #include <qfile.h> + #include <qdict.h> + #include <qlabel.h> +@@ -355,6 +365,39 @@ + void ConfigDialog::defaults() + { + // Default interfaces ++#ifdef Q_OS_FREEBSD ++ /* Determine number of interfaces */ ++ u_int n = 0; ++ size_t nlen = 0; ++ nlen = sizeof(n); ++ ++ if ( sysctlbyname("net.link.generic.system.ifcount", &n, &nlen, NULL, 0) != -1 ) ++ { ++ mSettingsDict.clear(); ++ mDlg->listBoxInterfaces->clear(); ++ ++ ifmibdata ifmd; ++ size_t len = 0; ++ len = sizeof(ifmd); ++ static int name[] = { CTL_NET, ++ PF_LINK, ++ NETLINK_GENERIC, ++ IFMIB_IFDATA, ++ 0, ++ IFDATA_GENERAL }; ++ ++ for (int i = 1; i <= n; ++i) ++ { ++ name[4] = i; ++ /* Get data for iface-number i */ ++ if ( sysctl(name, 6, (void*)&ifmd, (size_t*)&len, (void*)NULL, (size_t)0) == -1 ) ++ continue; ++ ++ QString interface = QString::fromLatin1(ifmd.ifmd_name); ++ ++ if ( ifmd.ifmd_flags & IFF_LOOPBACK) ++ continue; ++#else + QFile proc( "/proc/net/dev" ); + if ( proc.open( IO_ReadOnly ) ) + { +@@ -372,6 +415,7 @@ + if ( interface == "lo" ) + continue; + ++#endif + InterfaceSettings* settings = new InterfaceSettings(); + settings->customCommands = false; + settings->hideWhenNotAvailable = false; +@@ -391,8 +435,10 @@ + mDlg->checkBoxNotExisting->setChecked( false ); + mDlg->checkBoxCustom->setChecked( false ); + } ++#ifndef __FreeBSD__ + } + proc.close(); ++#endif + } + + // Default tool tips diff --git a/net/knemo/files/patch-knemod-data.h b/net/knemo/files/patch-knemod-data.h new file mode 100644 index 000000000000..c45f8b191029 --- /dev/null +++ b/net/knemo/files/patch-knemod-data.h @@ -0,0 +1,35 @@ +--- knemod/data.h.orig Sat Jan 22 00:10:05 2005 ++++ knemod/data.h Fri Jan 21 17:38:50 2005 +@@ -22,6 +22,7 @@ + + #include <qpair.h> + #include <qcolor.h> ++#include <qdict.h> + #include <qstring.h> + #include <qvaluevector.h> + +@@ -41,6 +42,11 @@ + int toolTipContent; + }; + ++struct AddrData { ++ QString subnetMask; ++ QString broadcastAddress; ++}; ++ + struct InterfaceData + { + InterfaceData::InterfaceData() +@@ -64,11 +70,9 @@ + unsigned long prevTxBytes; + unsigned long incomingBytes; + unsigned long outgoingBytes; +- QString ipAddress; +- QString subnetMask; ++ QDict<AddrData> addrData; + QString hwAddress; + QString ptpAddress; +- QString broadcastAddress; + QString defaultGateway; + QString rxString; + QString txString; diff --git a/net/knemo/files/patch-knemod-interfacestatusdialog.cpp b/net/knemo/files/patch-knemod-interfacestatusdialog.cpp new file mode 100644 index 000000000000..822857eff083 --- /dev/null +++ b/net/knemo/files/patch-knemod-interfacestatusdialog.cpp @@ -0,0 +1,50 @@ +--- knemod/interfacestatusdialog.cpp.orig Sat Jan 22 00:11:02 2005 ++++ knemod/interfacestatusdialog.cpp Sat Jan 22 00:15:24 2005 +@@ -24,6 +24,7 @@ + #include <qtabwidget.h> + + #include <kdebug.h> ++#include <kcombobox.h> + #include <kconfig.h> + #include <klocale.h> + #include <kglobal.h> +@@ -69,6 +70,10 @@ + mTimer = new QTimer(); + connect( mTimer, SIGNAL( timeout() ), this, SLOT( updateDialog() ) ); + mTimer->start( 1000 ); ++ ++#ifdef Q_OS_FREEBSD ++ connect( comboBoxIP, SIGNAL( activated(int) ), this, SLOT( updateDialog() ) ); ++#endif + } + + InterfaceStatusDialog::~InterfaceStatusDialog() +@@ -152,12 +157,28 @@ + if ( data.available ) + { + // ip tab ++#ifdef Q_OS_FREEBSD ++ if ( data.addrData.count() != comboBoxIP->count() ) ++ comboBoxIP->clear(); ++ ++ QDictIterator<AddrData> it( data.addrData ); ++ for( ; it.current(); ++it ) ++ if (!comboBoxIP->contains(it.currentKey())) ++ comboBoxIP->insertItem( it.currentKey() ); ++ ++ textLabelSubnet->setText(data.addrData[ comboBoxIP->currentText() ]->subnetMask); ++#else + textLabelIP->setText( data.ipAddress ); + textLabelSubnet->setText( data.subnetMask ); ++#endif + if ( mInterface->getType() == Interface::ETHERNET ) + { + variableLabel1->setText( i18n( "Broadcast Address:" ) ); ++#ifdef Q_OS_FREEBSD ++ variableText1->setText( data.addrData[ comboBoxIP->currentText() ]->broadcastAddress); ++#else + variableText1->setText( data.broadcastAddress ); ++#endif + variableLabel2->setText( i18n( "Default Gateway:" ) ); + variableText2->setText( data.defaultGateway ); + variableLabel3->setText( i18n( "HW-Address:" ) ); diff --git a/net/knemo/files/patch-knemod-interfacestatusdlg.ui b/net/knemo/files/patch-knemod-interfacestatusdlg.ui new file mode 100644 index 000000000000..d506e3f44a0f --- /dev/null +++ b/net/knemo/files/patch-knemod-interfacestatusdlg.ui @@ -0,0 +1,271 @@ +--- knemod/interfacestatusdlg.ui.orig Fri Jan 21 16:57:24 2005 ++++ knemod/interfacestatusdlg.ui Fri Jan 21 20:02:50 2005 +@@ -9,7 +9,7 @@ + <x>0</x> + <y>0</y> + <width>272</width> +- <height>258</height> ++ <height>237</height> + </rect> + </property> + <property name="caption"> +@@ -145,7 +145,7 @@ + </property> + <widget class="QLayoutWidget"> + <property name="name"> +- <cstring>layout3</cstring> ++ <cstring>layout7</cstring> + </property> + <hbox> + <property name="name"> +@@ -171,18 +171,18 @@ + </property> + <property name="sizeHint"> + <size> +- <width>20</width> ++ <width>40</width> + <height>20</height> + </size> + </property> + </spacer> +- <widget class="KActiveLabel"> ++ <widget class="KComboBox"> + <property name="name"> +- <cstring>textLabelIP</cstring> ++ <cstring>comboBoxIP</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> +- <hsizetype>1</hsizetype> ++ <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> +@@ -193,7 +193,7 @@ + </widget> + <widget class="QLayoutWidget"> + <property name="name"> +- <cstring>layout4</cstring> ++ <cstring>layout8</cstring> + </property> + <hbox> + <property name="name"> +@@ -207,41 +207,30 @@ + <string>Subnet Mask:</string> + </property> + </widget> +- <spacer> +- <property name="name"> +- <cstring>spacer13_2</cstring> +- </property> +- <property name="orientation"> +- <enum>Horizontal</enum> +- </property> +- <property name="sizeType"> +- <enum>Expanding</enum> +- </property> +- <property name="sizeHint"> +- <size> +- <width>71</width> +- <height>21</height> +- </size> +- </property> +- </spacer> +- <widget class="KActiveLabel"> ++ <widget class="QLabel"> + <property name="name"> + <cstring>textLabelSubnet</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> +- <hsizetype>1</hsizetype> +- <vsizetype>0</vsizetype> ++ <hsizetype>7</hsizetype> ++ <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> ++ <property name="text"> ++ <string></string> ++ </property> ++ <property name="alignment"> ++ <set>AlignVCenter|AlignRight</set> ++ </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> +- <cstring>layout5</cstring> ++ <cstring>layout9</cstring> + </property> + <hbox> + <property name="name"> +@@ -255,41 +244,22 @@ + <string>Broadcast Address:</string> + </property> + </widget> +- <spacer> +- <property name="name"> +- <cstring>spacer13_3</cstring> +- </property> +- <property name="orientation"> +- <enum>Horizontal</enum> +- </property> +- <property name="sizeType"> +- <enum>Expanding</enum> +- </property> +- <property name="sizeHint"> +- <size> +- <width>71</width> +- <height>21</height> +- </size> +- </property> +- </spacer> +- <widget class="KActiveLabel"> ++ <widget class="QLabel"> + <property name="name"> + <cstring>variableText1</cstring> + </property> +- <property name="sizePolicy"> +- <sizepolicy> +- <hsizetype>1</hsizetype> +- <vsizetype>0</vsizetype> +- <horstretch>0</horstretch> +- <verstretch>0</verstretch> +- </sizepolicy> ++ <property name="text"> ++ <string></string> ++ </property> ++ <property name="alignment"> ++ <set>AlignVCenter|AlignRight</set> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> +- <cstring>layout6</cstring> ++ <cstring>layout10</cstring> + </property> + <hbox> + <property name="name"> +@@ -303,41 +273,30 @@ + <string>Default Gateway:</string> + </property> + </widget> +- <spacer> +- <property name="name"> +- <cstring>spacer13_4</cstring> +- </property> +- <property name="orientation"> +- <enum>Horizontal</enum> +- </property> +- <property name="sizeType"> +- <enum>Expanding</enum> +- </property> +- <property name="sizeHint"> +- <size> +- <width>71</width> +- <height>21</height> +- </size> +- </property> +- </spacer> +- <widget class="KActiveLabel"> ++ <widget class="QLabel"> + <property name="name"> + <cstring>variableText2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> +- <hsizetype>1</hsizetype> +- <vsizetype>0</vsizetype> ++ <hsizetype>7</hsizetype> ++ <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> ++ <property name="text"> ++ <string></string> ++ </property> ++ <property name="alignment"> ++ <set>AlignVCenter|AlignRight</set> ++ </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> +- <cstring>layout7</cstring> ++ <cstring>layout11</cstring> + </property> + <hbox> + <property name="name"> +@@ -351,35 +310,24 @@ + <string>HW-Address:</string> + </property> + </widget> +- <spacer> +- <property name="name"> +- <cstring>spacer13_5</cstring> +- </property> +- <property name="orientation"> +- <enum>Horizontal</enum> +- </property> +- <property name="sizeType"> +- <enum>Expanding</enum> +- </property> +- <property name="sizeHint"> +- <size> +- <width>71</width> +- <height>21</height> +- </size> +- </property> +- </spacer> +- <widget class="KActiveLabel"> ++ <widget class="QLabel"> + <property name="name"> + <cstring>variableText3</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> +- <hsizetype>1</hsizetype> +- <vsizetype>0</vsizetype> ++ <hsizetype>7</hsizetype> ++ <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> ++ <property name="text"> ++ <string></string> ++ </property> ++ <property name="alignment"> ++ <set>AlignVCenter|AlignRight</set> ++ </property> + </widget> + </hbox> + </widget> +@@ -728,8 +676,6 @@ + </widget> + </vbox> + </widget> +-<customwidgets> +-</customwidgets> + <connections> + <connection> + <sender>buttonClose</sender> +@@ -740,10 +686,6 @@ + </connections> + <layoutdefaults spacing="6" margin="11"/> + <includehints> +- <includehint>kactivelabel.h</includehint> +- <includehint>kactivelabel.h</includehint> +- <includehint>kactivelabel.h</includehint> +- <includehint>kactivelabel.h</includehint> +- <includehint>kactivelabel.h</includehint> ++ <includehint>kcombobox.h</includehint> + </includehints> + </UI> diff --git a/net/knemo/files/patch-knemod-interfacetooltip.cpp b/net/knemo/files/patch-knemod-interfacetooltip.cpp new file mode 100644 index 000000000000..10235e4477c3 --- /dev/null +++ b/net/knemo/files/patch-knemod-interfacetooltip.cpp @@ -0,0 +1,34 @@ +--- knemod/interfacetooltip.cpp.orig Fri Jan 21 17:51:13 2005 ++++ knemod/interfacetooltip.cpp Fri Jan 21 17:59:47 2005 +@@ -99,6 +99,23 @@ + + if ( data.available ) + { ++#ifdef Q_OS_FREEBSD ++ QDictIterator<AddrData> it( data.addrData ); ++ for( ; it.current(); ++it ) ++ { ++ if ( toolTipContent & IP_ADDRESS ) ++ text += "<tr><td>" + mToolTips[4].first + "</td><td>" + it.currentKey() + "</td></tr>"; ++ if ( toolTipContent & SUBNET_MASK ) ++ text += "<tr><td>" + mToolTips[5].first + "</td><td>" + it.current()->subnetMask + "</td></tr>"; ++ if ( mInterface->getType() == Interface::ETHERNET ) ++ { ++ if ( toolTipContent & BCAST_ADDRESS ) ++ text += "<tr><td>" + mToolTips[18].first + "</td><td>" + it.current()->broadcastAddress + "</td></tr>"; ++ } ++ } ++ if ( mInterface->getType() == Interface::ETHERNET ) ++ { ++#else + if ( toolTipContent & IP_ADDRESS ) + text += "<tr><td>" + mToolTips[4].first + "</td><td>" + data.ipAddress + "</td></tr>"; + if ( toolTipContent & SUBNET_MASK ) +@@ -107,6 +124,7 @@ + { + if ( toolTipContent & BCAST_ADDRESS ) + text += "<tr><td>" + mToolTips[18].first + "</td><td>" + data.broadcastAddress + "</td></tr>"; ++#endif + if ( toolTipContent & GATEWAY ) + text += "<tr><td>" + mToolTips[19].first + "</td><td>" + data.defaultGateway + "</td></tr>"; + if ( toolTipContent & HW_ADDRESS ) diff --git a/net/knemo/files/patch-knemod-interfaceupdater.cpp b/net/knemo/files/patch-knemod-interfaceupdater.cpp new file mode 100644 index 000000000000..34382254219f --- /dev/null +++ b/net/knemo/files/patch-knemod-interfaceupdater.cpp @@ -0,0 +1,290 @@ +--- knemod/interfaceupdater.cpp.orig Fri Aug 20 20:26:41 2004 ++++ knemod/interfaceupdater.cpp Sat Jan 22 00:56:21 2005 +@@ -17,6 +17,24 @@ + Boston, MA 02111-1307, USA. + */ + ++#ifdef __FreeBSD__ ++#include <sys/types.h> ++#include <sys/socket.h> ++#include <sys/sysctl.h> ++#include <sys/time.h> ++#include <sys/ioctl.h> ++#include <net/ethernet.h> ++#include <net/if_media.h> ++#include <net/if_types.h> ++#include <net/if.h> ++#include <net/if_dl.h> ++#include <net/if_mib.h> ++#include <netdb.h> ++#include <ifaddrs.h> ++#include <netinet/in.h> ++#include <arpa/inet.h> ++#endif ++ + #include <qmap.h> + #include <qtimer.h> + #include <qregexp.h> +@@ -48,6 +66,7 @@ + mTimer->stop(); + delete mTimer; + ++#ifndef Q_OS_FREEBSD + if ( mRouteProcess ) + { + mRouteProcess->kill(); +@@ -63,10 +82,12 @@ + mIwconfigProcess->kill(); + delete mIwconfigProcess; + } ++#endif + } + + void InterfaceUpdater::checkConfig() + { ++#ifndef Q_OS_FREEBSD + if ( !mIfconfigProcess ) + { + mIfconfigStdout = QString::null; +@@ -108,6 +129,7 @@ + } + } + #endif ++#endif // Q_OS_FREEBSD + + #ifdef PATH_ROUTE + if ( !mRouteProcess ) +@@ -116,7 +138,11 @@ + mRouteProcess = new KProcess(); + mRouteProcess->setEnvironment( "LANG", "C" ); + mRouteProcess->setEnvironment( "LC_ALL", "C" ); ++#ifdef Q_OS_FREEBSD ++ *mRouteProcess << PATH_ROUTE << "-n" << "get" << "default"; ++#else + *mRouteProcess << PATH_ROUTE << "-n"; ++#endif + connect( mRouteProcess, SIGNAL( receivedStdout( KProcess*, char*, int ) ), + this, SLOT( routeProcessStdout( KProcess*, char*, int ) ) ); + connect( mRouteProcess, SIGNAL( receivedStderr( KProcess*, char*, int ) ), +@@ -131,6 +157,137 @@ + } + } + #endif ++ ++#ifdef Q_OS_FREEBSD ++ // Check interfaces and update accordingly ++ ++ Interface* interface = 0; ++ InterfaceData* data = 0; ++ ++ struct if_data* ifd; ++ struct ifaddrs *ifap; ++ char buf[NI_MAXHOST]; ++ ++ // Reset all devices first ++ QDictIterator<Interface> ifIt( mInterfaceDict ); ++ for ( ; ifIt.current(); ++ifIt ) ++ { ++ interface = ifIt.current(); ++ interface->getData().existing = false; ++ interface->getData().available = false; ++ interface->getData().addrData.clear(); ++ } ++ ++ // Get IP address and related information ++ if ( getifaddrs(&ifap) == 0 ) { ++ for ( ifaddrs *ifa = ifap; ifa; ifa = ifa->ifa_next ) { ++ switch ( ifa->ifa_addr->sa_family ) { ++ case AF_INET6: ++ case AF_INET: ++ interface = mInterfaceDict[QString::fromLatin1(ifa->ifa_name)]; ++ if ( interface ) { ++ data = &interface->getData(); ++ ++ bzero(buf, NI_MAXHOST); ++ getnameinfo(ifa->ifa_addr, ifa->ifa_addr->sa_len, buf, sizeof(buf), 0, 0, NI_NUMERICHOST); ++ AddrData *addrData = new AddrData; ++ data->addrData.insert( QString::fromLatin1(buf), addrData); ++ ++ if ( ifa->ifa_netmask != NULL ) { ++ if (ifa->ifa_addr->sa_family == AF_INET6 ) { ++ bzero(buf, NI_MAXHOST); ++ getnameinfo(ifa->ifa_netmask, ifa->ifa_netmask->sa_len, buf, sizeof(buf), 0, 0, NI_NUMERICHOST); ++ addrData->subnetMask = QString::fromLatin1( buf ); ++ } else { ++ struct sockaddr_in *sin = (struct sockaddr_in *)ifa->ifa_netmask; ++ addrData->subnetMask = QString::fromLatin1( inet_ntoa(sin->sin_addr) ); ++ } ++ } ++ ++ if ( ifa->ifa_broadaddr != NULL ) { ++ bzero(buf, NI_MAXHOST); ++ getnameinfo(ifa->ifa_broadaddr, ifa->ifa_broadaddr->sa_len, buf, sizeof(buf), 0, 0, NI_NUMERICHOST); ++ addrData->broadcastAddress = QString::fromLatin1(buf); ++ } ++ ++ if ( ifa->ifa_dstaddr != NULL ) { ++ bzero(buf, NI_MAXHOST); ++ getnameinfo(ifa->ifa_dstaddr, ifa->ifa_dstaddr->sa_len, buf, sizeof(buf), 0, 0, NI_NUMERICHOST); ++ data->ptpAddress = QString::fromLatin1(buf); ++ } ++ ++ data->existing = true; ++ interface->setType((ifa->ifa_flags & IFF_POINTOPOINT ) ? Interface::PPP : Interface::ETHERNET ); ++ ++ // Get media status ++ int s; ++ if ((s = socket(ifa->ifa_addr->sa_family, SOCK_DGRAM, 0)) >= 0) { ++ struct ifmediareq ifmr; ++ (void) memset(&ifmr, 0, sizeof(ifmr)); ++ (void) strncpy(ifmr.ifm_name, ifa->ifa_name, sizeof(ifmr.ifm_name)); ++ ++ if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) >= 0) { ++ if (ifmr.ifm_status & IFM_AVALID) ++ /* ++ * The interface is marked available, if the interface is up ++ * and if it is has carrier (LAN) or is associated (WLAN) ++ */ ++ data->available = (ifa->ifa_flags & IFF_UP) && (ifmr.ifm_status & IFM_ACTIVE); ++ } ++ else ++ data->available = (ifa->ifa_flags & IFF_UP); ++ ++ close(s); ++ } ++ ++ interface->activateMonitor(); ++ } ++ break; ++ ++ case AF_LINK: ++ interface = mInterfaceDict[QString::fromLatin1(ifa->ifa_name)]; ++ if ( interface ) { ++ data = &interface->getData(); ++ ++ // get MAC address ++ struct sockaddr_dl* sdl = (struct sockaddr_dl*)ifa->ifa_addr; ++ if (sdl->sdl_type == IFT_ETHER && sdl->sdl_alen == ETHER_ADDR_LEN) ++ data->hwAddress = QString::fromLatin1(ether_ntoa((struct ether_addr*)LLADDR(sdl))); ++ else ++ data->hwAddress = ""; ++ ++ // Get traffic statistics ++ if (ifa->ifa_data != NULL) { ++ ifd = (if_data *)ifa->ifa_data; ++ ++ data->rxPackets = ifd->ifi_ipackets; ++ data->txPackets = ifd->ifi_opackets; ++ ++ if ( data->prevRxBytes == 0L ) ++ data->prevRxBytes = ifd->ifi_ibytes; ++ else ++ data->prevRxBytes = data->rxBytes; ++ ++ data->rxBytes = ifd->ifi_ibytes; ++ data->incomingBytes = data->rxBytes - data->prevRxBytes; ++ data->rxString = KIO::convertSize( data->rxBytes ); ++ ++ if ( data->prevTxBytes == 0L ) ++ data->prevTxBytes = ifd->ifi_obytes; ++ else ++ data->prevTxBytes = data->txBytes; ++ ++ data->txBytes = ifd->ifi_obytes; ++ data->outgoingBytes = data->txBytes - data->prevTxBytes; ++ data->txString = KIO::convertSize( data->txBytes ); ++ } ++ } ++ break; ++ } ++ } ++ freeifaddrs(ifap); ++ } ++#endif // Q_OS_FREEBSD + } + + void InterfaceUpdater::routeProcessExited( KProcess* process ) +@@ -180,6 +337,7 @@ + + void InterfaceUpdater::parseIfconfigOutput() + { ++#ifndef Q_OS_FREEBSD + /* mIfconfigStdout contains the complete output of 'ifconfig' which we + * are going to parse here. + */ +@@ -235,10 +393,12 @@ + } + interface->activateMonitor(); + } ++#endif + } + + void InterfaceUpdater::updateInterfaceData( QString& config, InterfaceData& data, int type ) + { ++#ifndef Q_OS_FREEBSD + QRegExp regExp( ".*RX.*:(\\d+).*:\\d+.*:\\d+.*:\\d+" ); + if ( regExp.search( config ) > -1 ) + data.rxPackets = regExp.cap( 1 ).toULong(); +@@ -318,10 +478,12 @@ + if ( regExp.search( config ) > -1 ) + data.ptpAddress = regExp.cap( 2 ); + } ++#endif + } + + void InterfaceUpdater::parseIwconfigOutput() + { ++#ifndef Q_OS_FREEBSD + /* mIwconfigStdout contains the complete output of 'iwconfig' which we + * are going to parse here. + */ +@@ -364,10 +526,12 @@ + updateWirelessData( configs[key], interface->getWirelessData() ); + } + } ++#endif + } + + void InterfaceUpdater::updateWirelessData( QString& config, WirelessData& data ) + { ++#ifndef Q_OS_FREEBSD + QRegExp regExp( "ESSID:\"?([^\"]*)\"?" ); + if ( regExp.search( config ) > -1 ) + data.essid = regExp.cap( 1 ); +@@ -401,6 +565,7 @@ + regExp.setPattern( "Link Quality:([\\d/]*)" ); + if ( regExp.search( config ) > -1 ) + data.linkQuality = regExp.cap( 1 ); ++#endif + } + + void InterfaceUpdater::parseRouteOutput() +@@ -409,18 +574,26 @@ + * are going to parse here. + */ + QMap<QString, QStringList> configs; +- QStringList routeList = QStringList::split( "\n", mRouteStdout ); ++ QStringList gateway, routeList = QStringList::split( "\n", mRouteStdout ); + QStringList::Iterator it; + for ( it = routeList.begin(); it != routeList.end(); ++it ) + { + QStringList routeParameter = QStringList::split( " ", *it ); ++#ifdef Q_OS_FREEBSD ++ if ( routeParameter.count() != 2 ) ++ continue; ++ if ( routeParameter[0] == "gateway:" ) ++ gateway = routeParameter; ++ if ( routeParameter[0] == "interface:" ) ++ configs[routeParameter[1]] = gateway; ++#else + if ( routeParameter.count() < 8 ) // no routing entry + continue; + if ( routeParameter[0] != "0.0.0.0" ) // no default route + continue; + configs[routeParameter[7]] = routeParameter; ++#endif + } +- + /* We loop over the interfaces the user wishs to monitor. + * If we find the interface in the output of 'route' we update + * the data of the interface. diff --git a/net/knemo/pkg-descr b/net/knemo/pkg-descr new file mode 100644 index 000000000000..0fa8cdc5e1f4 --- /dev/null +++ b/net/knemo/pkg-descr @@ -0,0 +1,6 @@ +KNemo - the KDE Network Monitor + +KNemo offers a network monitor similar to the one found in Windows. +For every network interface it displays an icon in the systray. + +WWW: http://www.kde-apps.org/content/show.php?content=12956 diff --git a/net/knemo/pkg-message b/net/knemo/pkg-message new file mode 100644 index 000000000000..e0a417e2f008 --- /dev/null +++ b/net/knemo/pkg-message @@ -0,0 +1,4 @@ +----------------------------------------------------------------------------- + IMPORTANT: KNemo is not an executable but an KDED service. Therefore + it has to be started using Control Center/KDE Components/Service Manager. +----------------------------------------------------------------------------- diff --git a/net/knemo/pkg-plist b/net/knemo/pkg-plist new file mode 100644 index 000000000000..6b4b4b4d21b5 --- /dev/null +++ b/net/knemo/pkg-plist @@ -0,0 +1,62 @@ +lib/kde3/kcm_knemo.la +lib/kde3/kcm_knemo.so +lib/kde3/kded_knemod.la +lib/kde3/kded_knemod.so +share/applnk/Settings/Network/kcm_knemo.desktop +share/apps/knemo/eventsrc +share/icons/crystalsvg/16x16/apps/knemo.png +share/icons/crystalsvg/22x22/actions/network_connected.png +share/icons/crystalsvg/22x22/actions/network_connected_lan.png +share/icons/crystalsvg/22x22/actions/network_connected_ppp.png +share/icons/crystalsvg/22x22/actions/network_connected_wlan.png +share/icons/crystalsvg/22x22/actions/network_disconnected.png +share/icons/crystalsvg/22x22/actions/network_disconnected_lan.png +share/icons/crystalsvg/22x22/actions/network_disconnected_ppp.png +share/icons/crystalsvg/22x22/actions/network_disconnected_wlan.png +share/icons/crystalsvg/22x22/actions/network_incoming.png +share/icons/crystalsvg/22x22/actions/network_incoming_lan.png +share/icons/crystalsvg/22x22/actions/network_incoming_ppp.png +share/icons/crystalsvg/22x22/actions/network_incoming_wlan.png +share/icons/crystalsvg/22x22/actions/network_outgoing.png +share/icons/crystalsvg/22x22/actions/network_outgoing_lan.png +share/icons/crystalsvg/22x22/actions/network_outgoing_ppp.png +share/icons/crystalsvg/22x22/actions/network_outgoing_wlan.png +share/icons/crystalsvg/22x22/actions/network_traffic.png +share/icons/crystalsvg/22x22/actions/network_traffic_lan.png +share/icons/crystalsvg/22x22/actions/network_traffic_ppp.png +share/icons/crystalsvg/22x22/actions/network_traffic_wlan.png +share/icons/crystalsvg/32x32/apps/knemo.png +share/locale/bg/LC_MESSAGES/kcm_knemo.mo +share/locale/bg/LC_MESSAGES/knemod.mo +share/locale/cs/LC_MESSAGES/kcm_knemo.mo +share/locale/cs/LC_MESSAGES/knemod.mo +share/locale/de/LC_MESSAGES/kcm_knemo.mo +share/locale/de/LC_MESSAGES/knemod.mo +share/locale/es/LC_MESSAGES/kcm_knemo.mo +share/locale/es/LC_MESSAGES/knemod.mo +share/locale/fr/LC_MESSAGES/kcm_knemo.mo +share/locale/fr/LC_MESSAGES/knemod.mo +share/locale/it/LC_MESSAGES/kcm_knemo.mo +share/locale/it/LC_MESSAGES/knemod.mo +share/locale/nl/LC_MESSAGES/kcm_knemo.mo +share/locale/nl/LC_MESSAGES/knemod.mo +share/locale/pt_BR/LC_MESSAGES/kcm_knemo.mo +share/locale/pt_BR/LC_MESSAGES/knemod.mo +share/locale/ru/LC_MESSAGES/kcm_knemo.mo +share/locale/ru/LC_MESSAGES/knemod.mo +share/services/kded/knemod.desktop +@unexec rmdir %D/share/services/kded 2>/dev/null || true +@unexec rmdir %D/share/services 2>/dev/null || true +@unexec rmdir %D/share/icons/crystalsvg/32x32/apps 2>/dev/null || true +@unexec rmdir %D/share/icons/crystalsvg/32x32 2>/dev/null || true +@unexec rmdir %D/share/icons/crystalsvg/22x22/actions 2>/dev/null || true +@unexec rmdir %D/share/icons/crystalsvg/22x22 2>/dev/null || true +@unexec rmdir %D/share/icons/crystalsvg/16x16/apps 2>/dev/null || true +@unexec rmdir %D/share/icons/crystalsvg/16x16 2>/dev/null || true +@unexec rmdir %D/share/icons/crystalsvg 2>/dev/null || true +@unexec rmdir %D/share/icons 2>/dev/null || true +@dirrm share/apps/knemo +@unexec rmdir %D/share/apps 2>/dev/null || true +@unexec rmdir %D/share/applnk/Settings/Network 2>/dev/null || true +@unexec rmdir %D/share/applnk/Settings 2>/dev/null || true +@unexec rmdir %D/share/applnk 2>/dev/null || true |