diff options
author | Steve Price <steve@FreeBSD.org> | 1999-01-26 02:56:30 +0000 |
---|---|---|
committer | Steve Price <steve@FreeBSD.org> | 1999-01-26 02:56:30 +0000 |
commit | 1265dc060ebbf21ab03bd25a10d8b84305e77652 (patch) | |
tree | a6e3c4e0d5898c60f4c8a64e8f3d992444cda284 /net/pppload | |
parent | 3cf6d3ef122417d176b11f5c1255ad9eb6ee6721 (diff) | |
download | ports-1265dc060ebbf21ab03bd25a10d8b84305e77652.tar.gz ports-1265dc060ebbf21ab03bd25a10d8b84305e77652.zip |
Notes
Diffstat (limited to 'net/pppload')
-rw-r--r-- | net/pppload/Makefile | 4 | ||||
-rw-r--r-- | net/pppload/files/patch-aa | 1123 | ||||
-rw-r--r-- | net/pppload/files/patch-ab | 38 | ||||
-rw-r--r-- | net/pppload/files/patch-ac | 27 | ||||
-rw-r--r-- | net/pppload/files/patch-ad | 115 | ||||
-rw-r--r-- | net/pppload/files/patch-ae | 124 | ||||
-rw-r--r-- | net/pppload/files/patch-af | 49 | ||||
-rw-r--r-- | net/pppload/files/patch-ag | 64 |
8 files changed, 437 insertions, 1107 deletions
diff --git a/net/pppload/Makefile b/net/pppload/Makefile index 0969b47378ea..fbc96ef2ea0e 100644 --- a/net/pppload/Makefile +++ b/net/pppload/Makefile @@ -3,7 +3,7 @@ # Date created: 30 January 1998 # Whom: Sean Cole <scole@aracnet.com> # -# $Id: Makefile,v 1.7 1998/10/13 23:53:28 jseger Exp $ +# $Id: Makefile,v 1.8 1998/11/21 07:27:39 steve Exp $ # DISTNAME= pppload-1.0 @@ -12,8 +12,6 @@ MASTER_SITES= http://sunsite.unc.edu/pub/Linux/system/network/serial/ppp/ MAINTAINER= ports@FreeBSD.ORG -BROKEN_ELF= yes - USE_QT= yes USE_GMAKE= yes diff --git a/net/pppload/files/patch-aa b/net/pppload/files/patch-aa index d7f19274a824..a1cd3394e64d 100644 --- a/net/pppload/files/patch-aa +++ b/net/pppload/files/patch-aa @@ -1,33 +1,33 @@ -diff -u --new-file pppload-1.0/Makefile ./Makefile ---- pppload-1.0/Makefile Wed Sep 11 19:49:33 1996 -+++ ./Makefile Sat Jan 31 16:54:54 1998 -@@ -2,20 +2,20 @@ +--- Makefile.orig Wed Sep 11 21:49:33 1996 ++++ Makefile Sun Jan 24 16:50:01 1999 +@@ -1,21 +1,19 @@ + ####### Installation RM=rm -f LN=ln -sf - INSTALL=install +-INSTALL=install -PREFIX=/usr -+PREFIX=/usr/local ++INSTALL=install -c ++PREFIX?=/usr/local BINDIR=$(PREFIX)/bin MANDIR=$(PREFIX)/man/man1 ####### Directories -QTDIR = /usr/lib/qt -+QTDIR = /usr/X11R6/include/X11 #/usr/lib/qt - BASEDIR = $(QTDIR) +-BASEDIR = $(QTDIR) -INCDIR = $(BASEDIR)/include -LIBDIR = $(BASEDIR)/lib -+INCDIR = /usr/X11R6/include/X11/qt #$(BASEDIR)/include -+LIBDIR = /usr/X11R6/lib #$(BASEDIR)/lib ++INCDIR = $(X11BASE)/include/X11/qt ++LIBDIR = $(X11BASE)/lib ####### Compiler -CFLAGS = -pipe -O2 -m486 -Wall -+CFLAGS = -pipe -O2 -Wall ++CFLAGS ?= -pipe -O -Wall LFLAGS = -L$(LIBDIR) -lqt LEXTRA = CC = g++ -@@ -75,7 +75,7 @@ +@@ -75,7 +73,7 @@ doc: ../h2html-1.0/h2html $(HEADERS) @@ -36,10 +36,13 @@ diff -u --new-file pppload-1.0/Makefile ./Makefile srctar: make veryclean make doc -@@ -107,70 +107,90 @@ - - # DO NOT DELETE THIS LINE -- make depend depends on it. - +@@ -104,73 +102,3 @@ + + mMainWindow.C: MainWindow.H + moc -o mMainWindow.C MainWindow.H +- +-# DO NOT DELETE THIS LINE -- make depend depends on it. +- -pppload.o: /usr/lib/qt/include/qapp.h /usr/lib/qt/include/qwidget.h -pppload.o: /usr/lib/qt/include/qwindefs.h /usr/lib/qt/include/qobjdefs.h -pppload.o: /usr/lib/qt/include/qglobal.h /usr/lib/qt/include/qobject.h @@ -107,1091 +110,3 @@ diff -u --new-file pppload-1.0/Makefile ./Makefile -Options.o: /usr/include/string.h /usr/include/features.h -Options.o: /usr/include/sys/cdefs.h -Options.o: /usr/lib/gcc-lib/i486-linux/2.7.2/include/stddef.h -+pppload.o: /usr/X11R6/include/X11/qt/qapp.h -+pppload.o: /usr/X11R6/include/X11/qt/qwidget.h -+pppload.o: /usr/X11R6/include/X11/qt/qwindefs.h -+pppload.o: /usr/X11R6/include/X11/qt/qobjdefs.h -+pppload.o: /usr/X11R6/include/X11/qt/qglobal.h -+pppload.o: /usr/X11R6/include/X11/qt/qobject.h -+pppload.o: /usr/X11R6/include/X11/qt/qstring.h -+pppload.o: /usr/X11R6/include/X11/qt/qarray.h -+pppload.o: /usr/X11R6/include/X11/qt/qgarray.h -+pppload.o: /usr/X11R6/include/X11/qt/qshared.h -+pppload.o: /usr/X11R6/include/X11/qt/qgeneric.h /usr/include/string.h -+pppload.o: /usr/include/machine/ansi.h /usr/include/sys/cdefs.h -+pppload.o: /usr/X11R6/include/X11/qt/qevent.h -+pppload.o: /usr/X11R6/include/X11/qt/qrect.h -+pppload.o: /usr/X11R6/include/X11/qt/qsize.h -+pppload.o: /usr/X11R6/include/X11/qt/qpoint.h -+pppload.o: /usr/X11R6/include/X11/qt/qpaintd.h -+pppload.o: /usr/X11R6/include/X11/qt/qpalette.h -+pppload.o: /usr/X11R6/include/X11/qt/qcolor.h -+pppload.o: /usr/X11R6/include/X11/qt/qcursor.h -+pppload.o: /usr/X11R6/include/X11/qt/qfont.h -+pppload.o: /usr/X11R6/include/X11/qt/qfontmet.h -+pppload.o: /usr/X11R6/include/X11/qt/qfontinf.h PPPStats.H MainWindow.H -+pppload.o: /usr/X11R6/include/X11/qt/qpixmap.h Options.H -+PPPStats.o: /usr/include/stdlib.h /usr/include/machine/ansi.h -+PPPStats.o: /usr/include/machine/types.h /usr/include/sys/cdefs.h -+PPPStats.o: /usr/include/stdio.h /usr/include/sys/types.h -+PPPStats.o: /usr/include/machine/endian.h /usr/include/sys/select.h -+PPPStats.o: /usr/include/sys/ioctl.h /usr/include/sys/ttycom.h -+PPPStats.o: /usr/include/sys/ioccom.h /usr/include/sys/filio.h -+PPPStats.o: /usr/include/sys/sockio.h /usr/include/sys/socket.h -+PPPStats.o: /usr/include/sys/time.h /usr/include/time.h /usr/include/net/if.h -+PPPStats.o: /usr/include/net/if_ppp.h /usr/include/net/ppp_defs.h PPPStats.H -+PPPStats.o: /usr/X11R6/include/X11/qt/qobject.h -+PPPStats.o: /usr/X11R6/include/X11/qt/qobjdefs.h -+PPPStats.o: /usr/X11R6/include/X11/qt/qglobal.h -+PPPStats.o: /usr/X11R6/include/X11/qt/qstring.h -+PPPStats.o: /usr/X11R6/include/X11/qt/qarray.h -+PPPStats.o: /usr/X11R6/include/X11/qt/qgarray.h -+PPPStats.o: /usr/X11R6/include/X11/qt/qshared.h -+PPPStats.o: /usr/X11R6/include/X11/qt/qgeneric.h /usr/include/string.h -+PPPStats.o: /usr/X11R6/include/X11/qt/qevent.h -+PPPStats.o: /usr/X11R6/include/X11/qt/qwindefs.h -+PPPStats.o: /usr/X11R6/include/X11/qt/qrect.h -+PPPStats.o: /usr/X11R6/include/X11/qt/qsize.h -+PPPStats.o: /usr/X11R6/include/X11/qt/qpoint.h Options.H -+PPPStats.o: /usr/X11R6/include/X11/qt/qcolor.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qpainter.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qpaintd.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qwindefs.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qobjdefs.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qglobal.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qrect.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qsize.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qpoint.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qcolor.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qfontmet.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qfont.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qstring.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qarray.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qgarray.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qshared.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qgeneric.h /usr/include/string.h -+MainWindow.o: /usr/include/machine/ansi.h /usr/include/sys/cdefs.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qfontinf.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qregion.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qpen.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qbrush.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qpntarry.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qwmatrix.h MainWindow.H -+MainWindow.o: /usr/X11R6/include/X11/qt/qwidget.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qobject.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qevent.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qpalette.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qcursor.h -+MainWindow.o: /usr/X11R6/include/X11/qt/qpixmap.h Options.H -+Options.o: /usr/include/stdio.h /usr/include/sys/cdefs.h -+Options.o: /usr/include/machine/ansi.h Options.H -+Options.o: /usr/X11R6/include/X11/qt/qcolor.h -+Options.o: /usr/X11R6/include/X11/qt/qwindefs.h -+Options.o: /usr/X11R6/include/X11/qt/qobjdefs.h -+Options.o: /usr/X11R6/include/X11/qt/qglobal.h -+Options.o: /usr/X11R6/include/X11/qt/qstring.h -+Options.o: /usr/X11R6/include/X11/qt/qarray.h -+Options.o: /usr/X11R6/include/X11/qt/qgarray.h -+Options.o: /usr/X11R6/include/X11/qt/qshared.h -+Options.o: /usr/X11R6/include/X11/qt/qgeneric.h /usr/include/string.h -diff -u --new-file pppload-1.0/Options.C ./Options.C ---- pppload-1.0/Options.C Tue Sep 10 16:55:27 1996 -+++ ./Options.C Fri Jan 30 20:01:38 1998 -@@ -24,7 +24,7 @@ - #include "Options.H" - - Options::Options( int argc, char* argv[] ) --: _divider( 512 ), _interval( 5 ), _link( 0 ), _period( 60 ), _retry( 60 ), _showTx( true ), _showRx( true ), _txColor( "forestgreen" ), _rxColor( "red" ) -+: _divider( 512 ), _interval( 5 ), _device("tun"), _link( 0 ), _period( 60 ), _retry( 60 ), _showTx( true ), _showRx( true ), _txColor( "forestgreen" ), _rxColor( "red" ) - { - for ( int i = 1; i < argc; i++ ) { - if ( !strcmp( argv[i], "-cmd" ) ) { -@@ -33,6 +33,8 @@ - sscanf( argv[++i], "%d", &_divider ); - } else if ( !strcmp( argv[i], "-i" ) ) { - sscanf( argv[++i], "%d", &_interval ); -+ } else if ( !strcmp( argv[i], "-device" ) ) { -+ strcpy(_device,argv[++i]); - } else if ( !strcmp( argv[i], "-link" ) ) { - sscanf( argv[++i], "%d", &_link ); - } else if ( !strcmp( argv[i], "-p" ) ) { -@@ -60,6 +62,7 @@ - fprintf( stderr, "-d n Horizontal divider spacing in bytes per second (default: %d).\n", divider() ); - fprintf( stderr, "-h Print this help.\n" ); - fprintf( stderr, "-i interval Set the polling interval to be 'interval' seconds (default: %d).\n", interval() ); -+ fprintf( stderr, "-device name Name of the device to monitor (default is tun). \n"); - fprintf( stderr, "-link link The PPP link number to monitor (default: %d).\n", link() ); - fprintf( stderr, "-p period Set the load averaging period to be 'period seconds (default: %d).\n", period() ); - fprintf( stderr, "-retry interval Time between retries when dialling PPP link (default: %d).\n", retry() ); -@@ -74,7 +77,7 @@ - fprintf( stderr, "pppload comes with ABSOLUTELY NO WARRANTY; for details see the LICENSE file.\n" ); - fprintf( stderr, "This is free software, and you are welcome to redistribute it\n" ); - fprintf( stderr, "under certain conditions; see the LICENSE file for details.\n" ); -- -+ fprintf( stderr, "Modified for FreeBSD 1998 \n"); - exit( 1 ); - } - } -diff -u --new-file pppload-1.0/Options.H ./Options.H ---- pppload-1.0/Options.H Tue Sep 10 16:53:36 1996 -+++ ./Options.H Thu Jan 29 21:12:01 1998 -@@ -31,6 +31,8 @@ - int _divider; - //: Statistics polling interval in seconds. - int _interval; -+ //: Network device to monitor -+ char _device[4]; - //: PPP link number to monitor. - int _link; - //: Load averaging interval in seconds. -@@ -49,9 +51,12 @@ - //: Extract command line opotions from argc and argv. - Options( int argc, char* argv[] ); - -- //: Return the PPP command. -- QString& cmd() { return _cmd; } -+ //: Return the PPP command. -+ QString& cmd() { return _cmd; } - -+ //: Return the name of the device being monitored -+ char * device() { return _device; } -+ - //: Return the spacing between horizontal dividers. - int divider() { return _divider; } - -diff -u --new-file pppload-1.0/PPPStats.C ./PPPStats.C ---- pppload-1.0/PPPStats.C Wed Sep 11 19:50:13 1996 -+++ ./PPPStats.C Fri Jan 30 20:16:04 1998 -@@ -19,16 +19,22 @@ - - extern "C" { - #include <stdlib.h> --#include <errno.h> - #include <stdio.h> -+#include <sys/types.h> -+#include <sys/select.h> - #include <sys/ioctl.h> - #include <sys/socket.h> --#include <net/if.h> --#include <linux/ppp_defs.h> -+#include <sys/time.h> -+#include <net/if.h> -+#include <net/if_ppp.h> - } - - #include "PPPStats.H" - #include "Options.H" -+#include <iostream.h> -+ -+void get_command(char *); -+char command[200]; - - typedef struct - { -@@ -53,38 +59,42 @@ - system( (const char*)options->cmd() ); - } - -- DclPPPInfo PPPInfo[1]; -- struct ifreq ifreq; -+ DclPPPInfo PPPInfo[1]; -+ struct ifpppstatsreq ifreq; - struct ppp_stats* PPPStat; -- struct ppp_stats LastPPPStat[1]; -- -- memset (& ifreq, 0, sizeof (ifreq)); -- sprintf (ifreq.ifr_ifrn.ifrn_name, "ppp%d", options->link()); -+ struct ppp_stats LastPPPStat[1]; - -- ifreq.ifr_ifru.ifru_data = (caddr_t) PPPInfo; -+ memset (&ifreq, 0, sizeof (ifreq)); -+ sprintf (ifreq.ifr_name, "%s%d",(const char*)options->device(),options->link()); -+ - PPPStat = & PPPInfo->stats; - memset (LastPPPStat, 0, sizeof (LastPPPStat)); - -- if ( (ioctl (_s, SIOCDEVPRIVATE, (caddr_t) & ifreq) < 0) || -- ( _isUp && ( PPPStat->p.ppp_ibytes < _rxTotal ) ) || -- ( !_isUp && ( PPPStat->p.ppp_ibytes == 0 ) ) -- ) { -- if ( _isUp ) { -- _isUp = false; -- emit linkDown(); -- if ( options->cmd().length() ) { -- _retryId = startTimer( options->retry() * 1000 ); -- system( (const char*)options->cmd() ); -- } -- } -- PPPStat->p.ppp_ibytes = 0; -- PPPStat->p.ppp_obytes = 0; -+ get_command(ifreq.ifr_name); -+ FILE * fptr; -+ fptr=popen(command,"r+"); -+ fscanf(fptr,"%u%u",&PPPStat->p.ppp_ibytes,&PPPStat->p.ppp_obytes); -+ pclose(fptr); -+ -+ if ( ( _isUp && ( PPPStat->p.ppp_ibytes < _rxTotal ) ) || -+ ( !_isUp && ( PPPStat->p.ppp_ibytes == 0 )) -+ ) { -+ if ( _isUp ) { -+ _isUp = false; -+ emit linkDown(); -+ if ( options->cmd().length() ) { -+ _retryId = startTimer( options->retry() * 1000 ); -+ system( (const char*)options->cmd() ); -+ } -+ } -+ PPPStat->p.ppp_ibytes = 0; -+ PPPStat->p.ppp_obytes = 0; - } else if ( !_isUp ) { -- _isUp = true; -- killTimer( _retryId ); -- _retryId = -1; -+ _isUp = true; -+ killTimer( _retryId ); -+ _retryId = -1; - } -- -+ - unsigned int rxDelta = PPPStat->p.ppp_ibytes - _rxTotal; - unsigned int txDelta = PPPStat->p.ppp_obytes - _txTotal; - _rxTotal = PPPStat->p.ppp_ibytes; -@@ -92,4 +102,17 @@ - if ( rxDelta == _rxTotal ) rxDelta = 0; - if ( txDelta == _txTotal ) txDelta = 0; - emit changeStats( rxDelta, txDelta, _rxTotal, _txTotal ); -+ -+} -+ -+void get_command(char * interface) { -+ /*"/usr/bin/netstat -b -I tun0 | /usr/bin/grep Link | awk '{print $(NF-4),$(NF-1)}' */ -+ const char * netstat_command ="/usr/bin/netstat -n -b -I "; -+ const char * grep_command =" | /usr/bin/grep Link | /usr/bin/awk '{print $(NF-4),$(NF-1)}'"; -+ command[0]='\0'; -+ strcat(command,netstat_command); -+ strcat(command,interface); -+ strcat(command,grep_command); - } -+ -+ -diff -u --new-file pppload-1.0/PPPStats.C.ppp ./PPPStats.C.ppp ---- pppload-1.0/PPPStats.C.ppp Wed Dec 31 16:00:00 1969 -+++ ./PPPStats.C.ppp Wed Jan 28 18:27:30 1998 -@@ -0,0 +1,120 @@ -+// pppload - A PPP Load Monitor -+// Copyright (C) 1996 Sean Vyain -+// svyain@mail.tds.net -+// smvyain@softart.com -+// -+// This program is free software; you can redistribute it and/or modify -+// it under the terms of the GNU General Public License as published by -+// the Free Software Foundation; either version 2 of the License, or -+// (at your option) any later version. -+// -+// This program is distributed in the hope that it will be useful, -+// but WITHOUT ANY WARRANTY; without even the implied warranty of -+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+// -+// You should have received a copy of the GNU General Public License -+// along with this program; if not, write to the Free Software -+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -+ -+extern "C" { -+#include <stdlib.h> -+#include <stdio.h> -+#include <sys/types.h> -+#include <sys/select.h> -+#include <sys/ioctl.h> -+#include <sys/socket.h> -+#include <sys/time.h> -+#include <net/if.h> -+#include <net/if_ppp.h> -+#include <net/if_var.h> -+#include <net/if_tun.h> -+} -+ -+#include "PPPStats.H" -+#include "Options.H" -+#include <iostream.h> -+ -+ -+typedef struct -+{ -+ struct ppp_stats stats; -+} DclPPPInfo; -+ -+PPPStats::PPPStats() -+: _rxTotal( 0 ), _txTotal( 0 ), _isUp( true ), _retryId( -1 ) -+{ -+ if ((_s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { -+ perror("couldn't create IP socket"); -+ exit(1); -+ } -+ -+ startTimer( options->interval() * 1000 ); -+} -+ -+void PPPStats::timerEvent( QTimerEvent* e ) -+{ -+ if ( e->timerId() == _retryId ) -+ { -+ system( (const char*)options->cmd() ); -+ } -+ -+ DclPPPInfo PPPInfo[1]; // what is this var for? -+ struct ifpppstatsreq ifreq; // ifreq ifreq; -+ struct ppp_stats* PPPStat; -+ struct ppp_stats LastPPPStat[1]; // what is this var for? -+ -+ memset (&ifreq, 0, sizeof (ifreq)); -+// sprintf (ifreq.ifr_ifrn.ifrn_name, "ppp%d", options->link()); -+ sprintf (ifreq.ifr_name, "tun%d", options->link()); -+ -+// ifreq.ifr_ifru.ifru_data = (caddr_t) PPPInfo; -+ -+ PPPStat = & PPPInfo->stats; -+ memset (LastPPPStat, 0, sizeof (LastPPPStat)); -+ -+ -+ -+// if ( (ioctl (_s, SIOCDEVPRIVATE, (caddr_t) & ifreq) < 0) || -+// ( _isUp && ( PPPStat->p.ppp_ibytes < _rxTotal ) ) || -+// ( !_isUp && ( PPPStat->p.ppp_ibytes == 0 ) ) -+ if ( (ioctl (_s, SIOCGPPPSTATS , &ifreq) < 0) || -+ ( _isUp && ( ifreq.stats.p.ppp_ibytes < _rxTotal ) ) || -+ ( !_isUp && ( ifreq.stats.p.ppp_ibytes == 0 )) -+ ) { -+ if ( _isUp ) { -+ _isUp = false; -+ emit linkDown(); -+ if ( options->cmd().length() ) { -+ _retryId = startTimer( options->retry() * 1000 ); -+ system( (const char*)options->cmd() ); -+ } -+ } -+ PPPStat->p.ppp_ibytes = 0; -+ PPPStat->p.ppp_obytes = 0; -+ } else if ( !_isUp ) { -+ _isUp = true; -+ killTimer( _retryId ); -+ _retryId = -1; -+ } -+ -+ PPPStat->p.ppp_ibytes=ifreq.stats.p.ppp_ibytes; -+ PPPStat->p.ppp_obytes=ifreq.stats.p.ppp_obytes; -+ -+ -+cout<<ifreq.stats.p.ppp_ibytes<<" "<<ifreq.stats.p.ppp_ipackets<<" " -+ <<ifreq.stats.p.ppp_ierrors<<" "<<ifreq.stats.p.ppp_obytes <<" " -+ <<ifreq.stats.p.ppp_opackets<<" "<<ifreq.stats.p.ppp_oerrors<<endl -+ <<PPPStat->p.ppp_ibytes<<" "<<PPPStat->p.ppp_ipackets<<" " -+ <<PPPStat->p.ppp_ierrors<<" "<<PPPStat->p.ppp_obytes <<" " -+ <<PPPStat->p.ppp_opackets<<" "<<PPPStat->p.ppp_oerrors<<endl; -+ unsigned int rxDelta = PPPStat->p.ppp_ibytes - _rxTotal; -+ unsigned int txDelta = PPPStat->p.ppp_obytes - _txTotal; -+ _rxTotal = PPPStat->p.ppp_ibytes; -+ _txTotal = PPPStat->p.ppp_obytes; -+ if ( rxDelta == _rxTotal ) rxDelta = 0; -+ if ( txDelta == _txTotal ) txDelta = 0; -+ emit changeStats( rxDelta, txDelta, _rxTotal, _txTotal ); -+ -+} -+ -diff -u --new-file pppload-1.0/README.freebsd ./README.freebsd ---- pppload-1.0/README.freebsd Wed Dec 31 16:00:00 1969 -+++ ./README.freebsd Fri Jan 30 20:14:36 1998 -@@ -0,0 +1,45 @@ -+PPPLoad is designed to display the current throughput of a particular -+PPP link in a format that is similar to xload. Written by Sean Vyain. -+ -+This is a FreeBSD port of the linux program called pppload, available at -+http://sunsite.unc.edu/pub/Linux/system/network/serial/ppp/pppload-1.0.tar.gz -+ -+Original program homepage at: -+http://www.geocities.com/SiliconValley/Pines/1029/pppload.html -+ -+I have modified the FreeBSD port to be able to show the throughput of -+any network device that will work with netstat, e.g. tun, ppp, ed, -+etc. I just wanted a program to nicely display throughput -+statistics for the tun device. -+ -+ Examples of usage: -+For tun0 (tun is the default device,0 is the default link number): -+% pppload & -+ -+For first ne2000 clone: -+% pppload -device ed -link 0 & -+ -+for ppp2: -+% pppload -device ppp -link 2 & -+ -+BUGS -+Command line is awkward with -device and -link. -+ -+Can't detect whether the network device is up or not, so any command -+line options like -cmd -percmd -retry probably don't work. This is -+different that the original linux version. -+ -+Keeps track of all packets network device has ever used, even if it -+has gone down then up again. This is also different than the linux -+version. -+ -+Requires awk, grep, and netstat to get the data. Very short polling -+time are definitely not recommended. -+ -+Network interface names are limited to a total of 4 characters or less -+at the moment, e.g. ppp0 ed3 ze1. -+ -+ -+Documentation of this FreeBSD port is not complete. -+ -+ -Common subdirectories: pppload-1.0/backup and ./backup -diff -u --new-file pppload-1.0/patch ./patch ---- pppload-1.0/patch Wed Dec 31 16:00:00 1969 -+++ ./patch Sat Jan 31 16:54:56 1998 -@@ -0,0 +1,561 @@ -+diff -u --new-file pppload-1.0/Makefile ./Makefile -+--- pppload-1.0/Makefile Wed Sep 11 19:49:33 1996 -++++ ./Makefile Sat Jan 31 16:54:54 1998 -+@@ -2,20 +2,20 @@ -+ RM=rm -f -+ LN=ln -sf -+ INSTALL=install -+-PREFIX=/usr -++PREFIX=/usr/local -+ BINDIR=$(PREFIX)/bin -+ MANDIR=$(PREFIX)/man/man1 -+ -+ ####### Directories -+ -+-QTDIR = /usr/lib/qt -++QTDIR = /usr/X11R6/include/X11 #/usr/lib/qt -+ BASEDIR = $(QTDIR) -+-INCDIR = $(BASEDIR)/include -+-LIBDIR = $(BASEDIR)/lib -++INCDIR = /usr/X11R6/include/X11/qt #$(BASEDIR)/include -++LIBDIR = /usr/X11R6/lib #$(BASEDIR)/lib -+ -+ ####### Compiler -+ -+-CFLAGS = -pipe -O2 -m486 -Wall -++CFLAGS = -pipe -O2 -Wall -+ LFLAGS = -L$(LIBDIR) -lqt -+ LEXTRA = -+ CC = g++ -+@@ -75,7 +75,7 @@ -+ -+ doc: -+ ../h2html-1.0/h2html $(HEADERS) -+- -++ -+ srctar: -+ make veryclean -+ make doc -+@@ -90,8 +90,8 @@ -+ cd ..; tar -zcvf pppload-$(VERSION)-bin.tar.gz pppload-$(VERSION) -+ -+ install: -+- $(INSTALL) -s pppload $(BINDIR) -+- $(INSTALL) pppload.1 $(MANDIR) -++# $(INSTALL) -c pppload $(BINDIR) -++# $(INSTALL) -c pppload.1 $(MANDIR) -+ -+ uninstall: -+ $(RM) $(BINDIR)/pppload -+@@ -107,70 +107,90 @@ -+ -+ # DO NOT DELETE THIS LINE -- make depend depends on it. -+ -+-pppload.o: /usr/lib/qt/include/qapp.h /usr/lib/qt/include/qwidget.h -+-pppload.o: /usr/lib/qt/include/qwindefs.h /usr/lib/qt/include/qobjdefs.h -+-pppload.o: /usr/lib/qt/include/qglobal.h /usr/lib/qt/include/qobject.h -+-pppload.o: /usr/lib/qt/include/qstring.h /usr/lib/qt/include/qarray.h -+-pppload.o: /usr/lib/qt/include/qgarray.h /usr/lib/qt/include/qshared.h -+-pppload.o: /usr/lib/qt/include/qgeneric.h /usr/include/string.h -+-pppload.o: /usr/include/features.h /usr/include/sys/cdefs.h -+-pppload.o: /usr/lib/gcc-lib/i486-linux/2.7.2/include/stddef.h -+-pppload.o: /usr/lib/qt/include/qevent.h /usr/lib/qt/include/qrect.h -+-pppload.o: /usr/lib/qt/include/qsize.h /usr/lib/qt/include/qpoint.h -+-pppload.o: /usr/lib/qt/include/qpaintd.h /usr/lib/qt/include/qpalette.h -+-pppload.o: /usr/lib/qt/include/qcolor.h /usr/lib/qt/include/qcursor.h -+-pppload.o: /usr/lib/qt/include/qfont.h /usr/lib/qt/include/qfontmet.h -+-pppload.o: /usr/lib/qt/include/qfontinf.h PPPStats.H MainWindow.H -+-pppload.o: /usr/lib/qt/include/qpixmap.h Options.H -+-PPPStats.o: /usr/include/stdlib.h /usr/include/features.h -+-PPPStats.o: /usr/include/sys/cdefs.h -+-PPPStats.o: /usr/lib/gcc-lib/i486-linux/2.7.2/include/stddef.h -+-PPPStats.o: /usr/include/errno.h /usr/include/linux/errno.h -+-PPPStats.o: /usr/include/asm/errno.h /usr/include/alloca.h -+-PPPStats.o: /usr/include/stdio.h /usr/include/libio.h -+-PPPStats.o: /usr/include/_G_config.h /usr/include/sys/ioctl.h -+-PPPStats.o: /usr/include/linux/ioctl.h /usr/include/asm/ioctl.h -+-PPPStats.o: /usr/include/sys/termios.h /usr/include/sys/socketio.h -+-PPPStats.o: /usr/include/linux/sockios.h /usr/include/asm/sockios.h -+-PPPStats.o: /usr/include/sys/socket.h /usr/include/linux/socket.h -+-PPPStats.o: /usr/include/asm/socket.h /usr/include/linux/uio.h -+-PPPStats.o: /usr/include/sys/types.h /usr/include/linux/types.h -+-PPPStats.o: /usr/include/linux/posix_types.h /usr/include/asm/posix_types.h -+-PPPStats.o: /usr/include/asm/types.h /usr/include/sys/bitypes.h -+-PPPStats.o: /usr/include/net/if.h /usr/include/linux/if.h -+-PPPStats.o: /usr/include/linux/ppp_defs.h PPPStats.H -+-PPPStats.o: /usr/lib/qt/include/qobject.h /usr/lib/qt/include/qobjdefs.h -+-PPPStats.o: /usr/lib/qt/include/qglobal.h /usr/lib/qt/include/qstring.h -+-PPPStats.o: /usr/lib/qt/include/qarray.h /usr/lib/qt/include/qgarray.h -+-PPPStats.o: /usr/lib/qt/include/qshared.h /usr/lib/qt/include/qgeneric.h -+-PPPStats.o: /usr/include/string.h /usr/lib/qt/include/qevent.h -+-PPPStats.o: /usr/lib/qt/include/qwindefs.h /usr/lib/qt/include/qrect.h -+-PPPStats.o: /usr/lib/qt/include/qsize.h /usr/lib/qt/include/qpoint.h -+-PPPStats.o: Options.H /usr/lib/qt/include/qcolor.h -+-MainWindow.o: /usr/lib/qt/include/qpainter.h /usr/lib/qt/include/qpaintd.h -+-MainWindow.o: /usr/lib/qt/include/qwindefs.h /usr/lib/qt/include/qobjdefs.h -+-MainWindow.o: /usr/lib/qt/include/qglobal.h /usr/lib/qt/include/qrect.h -+-MainWindow.o: /usr/lib/qt/include/qsize.h /usr/lib/qt/include/qpoint.h -+-MainWindow.o: /usr/lib/qt/include/qcolor.h /usr/lib/qt/include/qfontmet.h -+-MainWindow.o: /usr/lib/qt/include/qfont.h /usr/lib/qt/include/qstring.h -+-MainWindow.o: /usr/lib/qt/include/qarray.h /usr/lib/qt/include/qgarray.h -+-MainWindow.o: /usr/lib/qt/include/qshared.h /usr/lib/qt/include/qgeneric.h -+-MainWindow.o: /usr/include/string.h /usr/include/features.h -+-MainWindow.o: /usr/include/sys/cdefs.h -+-MainWindow.o: /usr/lib/gcc-lib/i486-linux/2.7.2/include/stddef.h -+-MainWindow.o: /usr/lib/qt/include/qfontinf.h /usr/lib/qt/include/qregion.h -+-MainWindow.o: /usr/lib/qt/include/qpen.h /usr/lib/qt/include/qbrush.h -+-MainWindow.o: /usr/lib/qt/include/qpntarry.h /usr/lib/qt/include/qwmatrix.h -+-MainWindow.o: MainWindow.H /usr/lib/qt/include/qwidget.h -+-MainWindow.o: /usr/lib/qt/include/qobject.h /usr/lib/qt/include/qevent.h -+-MainWindow.o: /usr/lib/qt/include/qpalette.h /usr/lib/qt/include/qcursor.h -+-MainWindow.o: /usr/lib/qt/include/qpixmap.h Options.H -+-Options.o: /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h -+-Options.o: Options.H /usr/lib/qt/include/qcolor.h -+-Options.o: /usr/lib/qt/include/qwindefs.h /usr/lib/qt/include/qobjdefs.h -+-Options.o: /usr/lib/qt/include/qglobal.h /usr/lib/qt/include/qstring.h -+-Options.o: /usr/lib/qt/include/qarray.h /usr/lib/qt/include/qgarray.h -+-Options.o: /usr/lib/qt/include/qshared.h /usr/lib/qt/include/qgeneric.h -+-Options.o: /usr/include/string.h /usr/include/features.h -+-Options.o: /usr/include/sys/cdefs.h -+-Options.o: /usr/lib/gcc-lib/i486-linux/2.7.2/include/stddef.h -++pppload.o: /usr/X11R6/include/X11/qt/qapp.h -++pppload.o: /usr/X11R6/include/X11/qt/qwidget.h -++pppload.o: /usr/X11R6/include/X11/qt/qwindefs.h -++pppload.o: /usr/X11R6/include/X11/qt/qobjdefs.h -++pppload.o: /usr/X11R6/include/X11/qt/qglobal.h -++pppload.o: /usr/X11R6/include/X11/qt/qobject.h -++pppload.o: /usr/X11R6/include/X11/qt/qstring.h -++pppload.o: /usr/X11R6/include/X11/qt/qarray.h -++pppload.o: /usr/X11R6/include/X11/qt/qgarray.h -++pppload.o: /usr/X11R6/include/X11/qt/qshared.h -++pppload.o: /usr/X11R6/include/X11/qt/qgeneric.h /usr/include/string.h -++pppload.o: /usr/include/machine/ansi.h /usr/include/sys/cdefs.h -++pppload.o: /usr/X11R6/include/X11/qt/qevent.h -++pppload.o: /usr/X11R6/include/X11/qt/qrect.h -++pppload.o: /usr/X11R6/include/X11/qt/qsize.h -++pppload.o: /usr/X11R6/include/X11/qt/qpoint.h -++pppload.o: /usr/X11R6/include/X11/qt/qpaintd.h -++pppload.o: /usr/X11R6/include/X11/qt/qpalette.h -++pppload.o: /usr/X11R6/include/X11/qt/qcolor.h -++pppload.o: /usr/X11R6/include/X11/qt/qcursor.h -++pppload.o: /usr/X11R6/include/X11/qt/qfont.h -++pppload.o: /usr/X11R6/include/X11/qt/qfontmet.h -++pppload.o: /usr/X11R6/include/X11/qt/qfontinf.h PPPStats.H MainWindow.H -++pppload.o: /usr/X11R6/include/X11/qt/qpixmap.h Options.H -++PPPStats.o: /usr/include/stdlib.h /usr/include/machine/ansi.h -++PPPStats.o: /usr/include/machine/types.h /usr/include/sys/cdefs.h -++PPPStats.o: /usr/include/stdio.h /usr/include/sys/types.h -++PPPStats.o: /usr/include/machine/endian.h /usr/include/sys/select.h -++PPPStats.o: /usr/include/sys/ioctl.h /usr/include/sys/ttycom.h -++PPPStats.o: /usr/include/sys/ioccom.h /usr/include/sys/filio.h -++PPPStats.o: /usr/include/sys/sockio.h /usr/include/sys/socket.h -++PPPStats.o: /usr/include/sys/time.h /usr/include/time.h /usr/include/net/if.h -++PPPStats.o: /usr/include/net/if_ppp.h /usr/include/net/ppp_defs.h PPPStats.H -++PPPStats.o: /usr/X11R6/include/X11/qt/qobject.h -++PPPStats.o: /usr/X11R6/include/X11/qt/qobjdefs.h -++PPPStats.o: /usr/X11R6/include/X11/qt/qglobal.h -++PPPStats.o: /usr/X11R6/include/X11/qt/qstring.h -++PPPStats.o: /usr/X11R6/include/X11/qt/qarray.h -++PPPStats.o: /usr/X11R6/include/X11/qt/qgarray.h -++PPPStats.o: /usr/X11R6/include/X11/qt/qshared.h -++PPPStats.o: /usr/X11R6/include/X11/qt/qgeneric.h /usr/include/string.h -++PPPStats.o: /usr/X11R6/include/X11/qt/qevent.h -++PPPStats.o: /usr/X11R6/include/X11/qt/qwindefs.h -++PPPStats.o: /usr/X11R6/include/X11/qt/qrect.h -++PPPStats.o: /usr/X11R6/include/X11/qt/qsize.h -++PPPStats.o: /usr/X11R6/include/X11/qt/qpoint.h Options.H -++PPPStats.o: /usr/X11R6/include/X11/qt/qcolor.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qpainter.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qpaintd.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qwindefs.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qobjdefs.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qglobal.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qrect.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qsize.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qpoint.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qcolor.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qfontmet.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qfont.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qstring.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qarray.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qgarray.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qshared.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qgeneric.h /usr/include/string.h -++MainWindow.o: /usr/include/machine/ansi.h /usr/include/sys/cdefs.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qfontinf.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qregion.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qpen.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qbrush.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qpntarry.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qwmatrix.h MainWindow.H -++MainWindow.o: /usr/X11R6/include/X11/qt/qwidget.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qobject.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qevent.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qpalette.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qcursor.h -++MainWindow.o: /usr/X11R6/include/X11/qt/qpixmap.h Options.H -++Options.o: /usr/include/stdio.h /usr/include/sys/cdefs.h -++Options.o: /usr/include/machine/ansi.h Options.H -++Options.o: /usr/X11R6/include/X11/qt/qcolor.h -++Options.o: /usr/X11R6/include/X11/qt/qwindefs.h -++Options.o: /usr/X11R6/include/X11/qt/qobjdefs.h -++Options.o: /usr/X11R6/include/X11/qt/qglobal.h -++Options.o: /usr/X11R6/include/X11/qt/qstring.h -++Options.o: /usr/X11R6/include/X11/qt/qarray.h -++Options.o: /usr/X11R6/include/X11/qt/qgarray.h -++Options.o: /usr/X11R6/include/X11/qt/qshared.h -++Options.o: /usr/X11R6/include/X11/qt/qgeneric.h /usr/include/string.h -+diff -u --new-file pppload-1.0/Options.C ./Options.C -+--- pppload-1.0/Options.C Tue Sep 10 16:55:27 1996 -++++ ./Options.C Fri Jan 30 20:01:38 1998 -+@@ -24,7 +24,7 @@ -+ #include "Options.H" -+ -+ Options::Options( int argc, char* argv[] ) -+-: _divider( 512 ), _interval( 5 ), _link( 0 ), _period( 60 ), _retry( 60 ), _showTx( true ), _showRx( true ), _txColor( "forestgreen" ), _rxColor( "red" ) -++: _divider( 512 ), _interval( 5 ), _device("tun"), _link( 0 ), _period( 60 ), _retry( 60 ), _showTx( true ), _showRx( true ), _txColor( "forestgreen" ), _rxColor( "red" ) -+ { -+ for ( int i = 1; i < argc; i++ ) { -+ if ( !strcmp( argv[i], "-cmd" ) ) { -+@@ -33,6 +33,8 @@ -+ sscanf( argv[++i], "%d", &_divider ); -+ } else if ( !strcmp( argv[i], "-i" ) ) { -+ sscanf( argv[++i], "%d", &_interval ); -++ } else if ( !strcmp( argv[i], "-device" ) ) { -++ strcpy(_device,argv[++i]); -+ } else if ( !strcmp( argv[i], "-link" ) ) { -+ sscanf( argv[++i], "%d", &_link ); -+ } else if ( !strcmp( argv[i], "-p" ) ) { -+@@ -60,6 +62,7 @@ -+ fprintf( stderr, "-d n Horizontal divider spacing in bytes per second (default: %d).\n", divider() ); -+ fprintf( stderr, "-h Print this help.\n" ); -+ fprintf( stderr, "-i interval Set the polling interval to be 'interval' seconds (default: %d).\n", interval() ); -++ fprintf( stderr, "-device name Name of the device to monitor (default is tun). \n"); -+ fprintf( stderr, "-link link The PPP link number to monitor (default: %d).\n", link() ); -+ fprintf( stderr, "-p period Set the load averaging period to be 'period seconds (default: %d).\n", period() ); -+ fprintf( stderr, "-retry interval Time between retries when dialling PPP link (default: %d).\n", retry() ); -+@@ -74,7 +77,7 @@ -+ fprintf( stderr, "pppload comes with ABSOLUTELY NO WARRANTY; for details see the LICENSE file.\n" ); -+ fprintf( stderr, "This is free software, and you are welcome to redistribute it\n" ); -+ fprintf( stderr, "under certain conditions; see the LICENSE file for details.\n" ); -+- -++ fprintf( stderr, "Modified for FreeBSD 1998 \n"); -+ exit( 1 ); -+ } -+ } -+diff -u --new-file pppload-1.0/Options.H ./Options.H -+--- pppload-1.0/Options.H Tue Sep 10 16:53:36 1996 -++++ ./Options.H Thu Jan 29 21:12:01 1998 -+@@ -31,6 +31,8 @@ -+ int _divider; -+ //: Statistics polling interval in seconds. -+ int _interval; -++ //: Network device to monitor -++ char _device[4]; -+ //: PPP link number to monitor. -+ int _link; -+ //: Load averaging interval in seconds. -+@@ -49,9 +51,12 @@ -+ //: Extract command line opotions from argc and argv. -+ Options( int argc, char* argv[] ); -+ -+- //: Return the PPP command. -+- QString& cmd() { return _cmd; } -++ //: Return the PPP command. -++ QString& cmd() { return _cmd; } -+ -++ //: Return the name of the device being monitored -++ char * device() { return _device; } -++ -+ //: Return the spacing between horizontal dividers. -+ int divider() { return _divider; } -+ -+diff -u --new-file pppload-1.0/PPPStats.C ./PPPStats.C -+--- pppload-1.0/PPPStats.C Wed Sep 11 19:50:13 1996 -++++ ./PPPStats.C Fri Jan 30 20:16:04 1998 -+@@ -19,16 +19,22 @@ -+ -+ extern "C" { -+ #include <stdlib.h> -+-#include <errno.h> -+ #include <stdio.h> -++#include <sys/types.h> -++#include <sys/select.h> -+ #include <sys/ioctl.h> -+ #include <sys/socket.h> -+-#include <net/if.h> -+-#include <linux/ppp_defs.h> -++#include <sys/time.h> -++#include <net/if.h> -++#include <net/if_ppp.h> -+ } -+ -+ #include "PPPStats.H" -+ #include "Options.H" -++#include <iostream.h> -++ -++void get_command(char *); -++char command[200]; -+ -+ typedef struct -+ { -+@@ -53,38 +59,42 @@ -+ system( (const char*)options->cmd() ); -+ } -+ -+- DclPPPInfo PPPInfo[1]; -+- struct ifreq ifreq; -++ DclPPPInfo PPPInfo[1]; -++ struct ifpppstatsreq ifreq; -+ struct ppp_stats* PPPStat; -+- struct ppp_stats LastPPPStat[1]; -+- -+- memset (& ifreq, 0, sizeof (ifreq)); -+- sprintf (ifreq.ifr_ifrn.ifrn_name, "ppp%d", options->link()); -++ struct ppp_stats LastPPPStat[1]; -+ -+- ifreq.ifr_ifru.ifru_data = (caddr_t) PPPInfo; -++ memset (&ifreq, 0, sizeof (ifreq)); -++ sprintf (ifreq.ifr_name, "%s%d",(const char*)options->device(),options->link()); -++ -+ PPPStat = & PPPInfo->stats; -+ memset (LastPPPStat, 0, sizeof (LastPPPStat)); -+ -+- if ( (ioctl (_s, SIOCDEVPRIVATE, (caddr_t) & ifreq) < 0) || -+- ( _isUp && ( PPPStat->p.ppp_ibytes < _rxTotal ) ) || -+- ( !_isUp && ( PPPStat->p.ppp_ibytes == 0 ) ) -+- ) { -+- if ( _isUp ) { -+- _isUp = false; -+- emit linkDown(); -+- if ( options->cmd().length() ) { -+- _retryId = startTimer( options->retry() * 1000 ); -+- system( (const char*)options->cmd() ); -+- } -+- } -+- PPPStat->p.ppp_ibytes = 0; -+- PPPStat->p.ppp_obytes = 0; -++ get_command(ifreq.ifr_name); -++ FILE * fptr; -++ fptr=popen(command,"r+"); -++ fscanf(fptr,"%u%u",&PPPStat->p.ppp_ibytes,&PPPStat->p.ppp_obytes); -++ pclose(fptr); -++ -++ if ( ( _isUp && ( PPPStat->p.ppp_ibytes < _rxTotal ) ) || -++ ( !_isUp && ( PPPStat->p.ppp_ibytes == 0 )) -++ ) { -++ if ( _isUp ) { -++ _isUp = false; -++ emit linkDown(); -++ if ( options->cmd().length() ) { -++ _retryId = startTimer( options->retry() * 1000 ); -++ system( (const char*)options->cmd() ); -++ } -++ } -++ PPPStat->p.ppp_ibytes = 0; -++ PPPStat->p.ppp_obytes = 0; -+ } else if ( !_isUp ) { -+- _isUp = true; -+- killTimer( _retryId ); -+- _retryId = -1; -++ _isUp = true; -++ killTimer( _retryId ); -++ _retryId = -1; -+ } -+- -++ -+ unsigned int rxDelta = PPPStat->p.ppp_ibytes - _rxTotal; -+ unsigned int txDelta = PPPStat->p.ppp_obytes - _txTotal; -+ _rxTotal = PPPStat->p.ppp_ibytes; -+@@ -92,4 +102,17 @@ -+ if ( rxDelta == _rxTotal ) rxDelta = 0; -+ if ( txDelta == _txTotal ) txDelta = 0; -+ emit changeStats( rxDelta, txDelta, _rxTotal, _txTotal ); -++ -++} -++ -++void get_command(char * interface) { -++ /*"/usr/bin/netstat -b -I tun0 | /usr/bin/grep Link | awk '{print $(NF-4),$(NF-1)}' */ -++ const char * netstat_command ="/usr/bin/netstat -n -b -I "; -++ const char * grep_command =" | /usr/bin/grep Link | /usr/bin/awk '{print $(NF-4),$(NF-1)}'"; -++ command[0]='\0'; -++ strcat(command,netstat_command); -++ strcat(command,interface); -++ strcat(command,grep_command); -+ } -++ -++ -+diff -u --new-file pppload-1.0/PPPStats.C.ppp ./PPPStats.C.ppp -+--- pppload-1.0/PPPStats.C.ppp Wed Dec 31 16:00:00 1969 -++++ ./PPPStats.C.ppp Wed Jan 28 18:27:30 1998 -+@@ -0,0 +1,120 @@ -++// pppload - A PPP Load Monitor -++// Copyright (C) 1996 Sean Vyain -++// svyain@mail.tds.net -++// smvyain@softart.com -++// -++// This program is free software; you can redistribute it and/or modify -++// it under the terms of the GNU General Public License as published by -++// the Free Software Foundation; either version 2 of the License, or -++// (at your option) any later version. -++// -++// This program is distributed in the hope that it will be useful, -++// but WITHOUT ANY WARRANTY; without even the implied warranty of -++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -++// GNU General Public License for more details. -++// -++// You should have received a copy of the GNU General Public License -++// along with this program; if not, write to the Free Software -++// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -++ -++extern "C" { -++#include <stdlib.h> -++#include <stdio.h> -++#include <sys/types.h> -++#include <sys/select.h> -++#include <sys/ioctl.h> -++#include <sys/socket.h> -++#include <sys/time.h> -++#include <net/if.h> -++#include <net/if_ppp.h> -++#include <net/if_var.h> -++#include <net/if_tun.h> -++} -++ -++#include "PPPStats.H" -++#include "Options.H" -++#include <iostream.h> -++ -++ -++typedef struct -++{ -++ struct ppp_stats stats; -++} DclPPPInfo; -++ -++PPPStats::PPPStats() -++: _rxTotal( 0 ), _txTotal( 0 ), _isUp( true ), _retryId( -1 ) -++{ -++ if ((_s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { -++ perror("couldn't create IP socket"); -++ exit(1); -++ } -++ -++ startTimer( options->interval() * 1000 ); -++} -++ -++void PPPStats::timerEvent( QTimerEvent* e ) -++{ -++ if ( e->timerId() == _retryId ) -++ { -++ system( (const char*)options->cmd() ); -++ } -++ -++ DclPPPInfo PPPInfo[1]; // what is this var for? -++ struct ifpppstatsreq ifreq; // ifreq ifreq; -++ struct ppp_stats* PPPStat; -++ struct ppp_stats LastPPPStat[1]; // what is this var for? -++ -++ memset (&ifreq, 0, sizeof (ifreq)); -++// sprintf (ifreq.ifr_ifrn.ifrn_name, "ppp%d", options->link()); -++ sprintf (ifreq.ifr_name, "tun%d", options->link()); -++ -++// ifreq.ifr_ifru.ifru_data = (caddr_t) PPPInfo; -++ -++ PPPStat = & PPPInfo->stats; -++ memset (LastPPPStat, 0, sizeof (LastPPPStat)); -++ -++ -++ -++// if ( (ioctl (_s, SIOCDEVPRIVATE, (caddr_t) & ifreq) < 0) || -++// ( _isUp && ( PPPStat->p.ppp_ibytes < _rxTotal ) ) || -++// ( !_isUp && ( PPPStat->p.ppp_ibytes == 0 ) ) -++ if ( (ioctl (_s, SIOCGPPPSTATS , &ifreq) < 0) || -++ ( _isUp && ( ifreq.stats.p.ppp_ibytes < _rxTotal ) ) || -++ ( !_isUp && ( ifreq.stats.p.ppp_ibytes == 0 )) -++ ) { -++ if ( _isUp ) { -++ _isUp = false; -++ emit linkDown(); -++ if ( options->cmd().length() ) { -++ _retryId = startTimer( options->retry() * 1000 ); -++ system( (const char*)options->cmd() ); -++ } -++ } -++ PPPStat->p.ppp_ibytes = 0; -++ PPPStat->p.ppp_obytes = 0; -++ } else if ( !_isUp ) { -++ _isUp = true; -++ killTimer( _retryId ); -++ _retryId = -1; -++ } -++ -++ PPPStat->p.ppp_ibytes=ifreq.stats.p.ppp_ibytes; -++ PPPStat->p.ppp_obytes=ifreq.stats.p.ppp_obytes; -++ -++ -++cout<<ifreq.stats.p.ppp_ibytes<<" "<<ifreq.stats.p.ppp_ipackets<<" " -++ <<ifreq.stats.p.ppp_ierrors<<" "<<ifreq.stats.p.ppp_obytes <<" " -++ <<ifreq.stats.p.ppp_opackets<<" "<<ifreq.stats.p.ppp_oerrors<<endl -++ <<PPPStat->p.ppp_ibytes<<" "<<PPPStat->p.ppp_ipackets<<" " -++ <<PPPStat->p.ppp_ierrors<<" "<<PPPStat->p.ppp_obytes <<" " -++ <<PPPStat->p.ppp_opackets<<" "<<PPPStat->p.ppp_oerrors<<endl; -++ unsigned int rxDelta = PPPStat->p.ppp_ibytes - _rxTotal; -++ unsigned int txDelta = PPPStat->p.ppp_obytes - _txTotal; -++ _rxTotal = PPPStat->p.ppp_ibytes; -++ _txTotal = PPPStat->p.ppp_obytes; -++ if ( rxDelta == _rxTotal ) rxDelta = 0; -++ if ( txDelta == _txTotal ) txDelta = 0; -++ emit changeStats( rxDelta, txDelta, _rxTotal, _txTotal ); -++ -++} -++ -+diff -u --new-file pppload-1.0/README.freebsd ./README.freebsd -+--- pppload-1.0/README.freebsd Wed Dec 31 16:00:00 1969 -++++ ./README.freebsd Fri Jan 30 20:14:36 1998 -+@@ -0,0 +1,45 @@ -++PPPLoad is designed to display the current throughput of a particular -++PPP link in a format that is similar to xload. Written by Sean Vyain. -++ -++This is a FreeBSD port of the linux program called pppload, available at -++http://sunsite.unc.edu/pub/Linux/system/network/serial/ppp/pppload-1.0.tar.gz -++ -++Original program homepage at: -++http://www.geocities.com/SiliconValley/Pines/1029/pppload.html -++ -++I have modified the FreeBSD port to be able to show the throughput of -++any network device that will work with netstat, e.g. tun, ppp, ed, -++etc. I just wanted a program to nicely display throughput -++statistics for the tun device. -++ -++ Examples of usage: -++For tun0 (tun is the default device,0 is the default link number): -++% pppload & -++ -++For first ne2000 clone: -++% pppload -device ed -link 0 & -++ -++for ppp2: -++% pppload -device ppp -link 2 & -++ -++BUGS -++Command line is awkward with -device and -link. -++ -++Can't detect whether the network device is up or not, so any command -++line options like -cmd -percmd -retry probably don't work. This is -++different that the original linux version. -++ -++Keeps track of all packets network device has ever used, even if it -++has gone down then up again. This is also different than the linux -++version. -++ -++Requires awk, grep, and netstat to get the data. Very short polling -++time are definitely not recommended. -++ -++Network interface names are limited to a total of 4 characters or less -++at the moment, e.g. ppp0 ed3 ze1. -++ -++ -++Documentation of this FreeBSD port is not complete. -++ -++ -+Common subdirectories: pppload-1.0/backup and ./backup -Binary files pppload-1.0/pppload and ./pppload differ -Common subdirectories: pppload-1.0/pppload-1.0 and ./pppload-1.0 -diff -u --new-file pppload-1.0/pppload.1 ./pppload.1 ---- pppload-1.0/pppload.1 Tue Sep 10 16:56:20 1996 -+++ ./pppload.1 Fri Jan 30 21:35:55 1998 -@@ -3,7 +3,7 @@ - pppload \- display an xload-style graph of PPP activity - .SH SYNOPSIS - .B pppload --[\-cmd ppp_cmd] [\-i interval] [\-p period] [\-retry interval] [\-rx] [\-norx] -+[\-cmd ppp_cmd] [\-i interval] [\-device name] [\-p period] [\-retry interval] [\-rx] [\-norx] - [\-rxcolor color] [\-tx] [\-notx] [\-txcolor color] - .SH DESCRIPTION - .BR pppload -@@ -28,6 +28,9 @@ - .I "\-h" - Print command line usage. - .TP -+.I "\-device name" -+Network device to monitor (default: tun) -+.TP - .I "\-i interval" - The statistics polling interval in seconds (default: 5). - .TP -@@ -60,3 +63,41 @@ - The name of the color to draw transmit rates in (default: red). - .SH AUTHOR - Sean Vyain <svyain@mail.tds.net, smvyain@softart.com> -+www.geocities.com/SiliconValley/Pines/1029/pppload.html -+ -+.SH FREEBSD PORT -+Examples of usage for the FreeBSD port: -+ -+For tun0 (tun is the default device,0 is the default link number): -+ -+% pppload & -+ -+For the first ne2000 ethernet card: -+ -+% pppload -device ed -link 0 & -+ -+for the third ppp device: -+ -+% pppload -device ppp -link 2 & -+ -+.SH BUGS -+The port to FreeBSD can't determine when the link is up or down, so -+some of the command line options like -+.I "\-cmd" -+.I "\-percmd" -+may not work. -+ -+Command line is awkward with -device and -link. -+ -+Keeps track of all packets network device has ever used, even if it -+has gone down then up again. This is different than the linux -+version. -+ -+Requires awk, grep, and netstat to get the data. Very short polling -+times are definitely not recommended. -+ -+Network interface names are limited to a total of 4 characters or less -+at the moment, e.g. ppp0 ed3 ze1. -+ -+ -+Modified January 1998 -diff -u --new-file pppload-1.0/pppload.C ./pppload.C ---- pppload-1.0/pppload.C Wed Sep 11 19:56:40 1996 -+++ ./pppload.C Fri Jan 30 14:33:07 1998 -@@ -27,6 +27,7 @@ - int main(int argc, - char* argv[]) - { -+ - QApplication a( argc, argv ); - options = new Options( argc, argv ); - MainWindow* mw = new MainWindow; -@@ -39,3 +40,4 @@ - mw->show(); - return a.exec(); - } -+ diff --git a/net/pppload/files/patch-ab b/net/pppload/files/patch-ab new file mode 100644 index 000000000000..2c7732baae69 --- /dev/null +++ b/net/pppload/files/patch-ab @@ -0,0 +1,38 @@ +diff -u --new-file pppload-1.0/Options.C ./Options.C +--- pppload-1.0/Options.C Tue Sep 10 16:55:27 1996 ++++ ./Options.C Fri Jan 30 20:01:38 1998 +@@ -24,7 +24,7 @@ + #include "Options.H" + + Options::Options( int argc, char* argv[] ) +-: _divider( 512 ), _interval( 5 ), _link( 0 ), _period( 60 ), _retry( 60 ), _showTx( true ), _showRx( true ), _txColor( "forestgreen" ), _rxColor( "red" ) ++: _divider( 512 ), _interval( 5 ), _device("tun"), _link( 0 ), _period( 60 ), _retry( 60 ), _showTx( true ), _showRx( true ), _txColor( "forestgreen" ), _rxColor( "red" ) + { + for ( int i = 1; i < argc; i++ ) { + if ( !strcmp( argv[i], "-cmd" ) ) { +@@ -33,6 +33,8 @@ + sscanf( argv[++i], "%d", &_divider ); + } else if ( !strcmp( argv[i], "-i" ) ) { + sscanf( argv[++i], "%d", &_interval ); ++ } else if ( !strcmp( argv[i], "-device" ) ) { ++ strcpy(_device,argv[++i]); + } else if ( !strcmp( argv[i], "-link" ) ) { + sscanf( argv[++i], "%d", &_link ); + } else if ( !strcmp( argv[i], "-p" ) ) { +@@ -60,6 +62,7 @@ + fprintf( stderr, "-d n Horizontal divider spacing in bytes per second (default: %d).\n", divider() ); + fprintf( stderr, "-h Print this help.\n" ); + fprintf( stderr, "-i interval Set the polling interval to be 'interval' seconds (default: %d).\n", interval() ); ++ fprintf( stderr, "-device name Name of the device to monitor (default is tun). \n"); + fprintf( stderr, "-link link The PPP link number to monitor (default: %d).\n", link() ); + fprintf( stderr, "-p period Set the load averaging period to be 'period seconds (default: %d).\n", period() ); + fprintf( stderr, "-retry interval Time between retries when dialling PPP link (default: %d).\n", retry() ); +@@ -74,7 +77,7 @@ + fprintf( stderr, "pppload comes with ABSOLUTELY NO WARRANTY; for details see the LICENSE file.\n" ); + fprintf( stderr, "This is free software, and you are welcome to redistribute it\n" ); + fprintf( stderr, "under certain conditions; see the LICENSE file for details.\n" ); +- ++ fprintf( stderr, "Modified for FreeBSD 1998 \n"); + exit( 1 ); + } + } diff --git a/net/pppload/files/patch-ac b/net/pppload/files/patch-ac new file mode 100644 index 000000000000..541be44618ad --- /dev/null +++ b/net/pppload/files/patch-ac @@ -0,0 +1,27 @@ +diff -u --new-file pppload-1.0/Options.H ./Options.H +--- pppload-1.0/Options.H Tue Sep 10 16:53:36 1996 ++++ ./Options.H Thu Jan 29 21:12:01 1998 +@@ -31,6 +31,8 @@ + int _divider; + //: Statistics polling interval in seconds. + int _interval; ++ //: Network device to monitor ++ char _device[4]; + //: PPP link number to monitor. + int _link; + //: Load averaging interval in seconds. +@@ -49,9 +51,12 @@ + //: Extract command line opotions from argc and argv. + Options( int argc, char* argv[] ); + +- //: Return the PPP command. +- QString& cmd() { return _cmd; } ++ //: Return the PPP command. ++ QString& cmd() { return _cmd; } + ++ //: Return the name of the device being monitored ++ char * device() { return _device; } ++ + //: Return the spacing between horizontal dividers. + int divider() { return _divider; } + diff --git a/net/pppload/files/patch-ad b/net/pppload/files/patch-ad new file mode 100644 index 000000000000..7e819476e22a --- /dev/null +++ b/net/pppload/files/patch-ad @@ -0,0 +1,115 @@ +diff -u --new-file pppload-1.0/PPPStats.C ./PPPStats.C +--- pppload-1.0/PPPStats.C Wed Sep 11 19:50:13 1996 ++++ ./PPPStats.C Fri Jan 30 20:16:04 1998 +@@ -19,16 +19,22 @@ + + extern "C" { + #include <stdlib.h> +-#include <errno.h> + #include <stdio.h> ++#include <sys/types.h> ++#include <sys/select.h> + #include <sys/ioctl.h> + #include <sys/socket.h> +-#include <net/if.h> +-#include <linux/ppp_defs.h> ++#include <sys/time.h> ++#include <net/if.h> ++#include <net/if_ppp.h> + } + + #include "PPPStats.H" + #include "Options.H" ++#include <iostream.h> ++ ++void get_command(char *); ++char command[200]; + + typedef struct + { +@@ -53,38 +59,42 @@ + system( (const char*)options->cmd() ); + } + +- DclPPPInfo PPPInfo[1]; +- struct ifreq ifreq; ++ DclPPPInfo PPPInfo[1]; ++ struct ifpppstatsreq ifreq; + struct ppp_stats* PPPStat; +- struct ppp_stats LastPPPStat[1]; +- +- memset (& ifreq, 0, sizeof (ifreq)); +- sprintf (ifreq.ifr_ifrn.ifrn_name, "ppp%d", options->link()); ++ struct ppp_stats LastPPPStat[1]; + +- ifreq.ifr_ifru.ifru_data = (caddr_t) PPPInfo; ++ memset (&ifreq, 0, sizeof (ifreq)); ++ sprintf (ifreq.ifr_name, "%s%d",(const char*)options->device(),options->link()); ++ + PPPStat = & PPPInfo->stats; + memset (LastPPPStat, 0, sizeof (LastPPPStat)); + +- if ( (ioctl (_s, SIOCDEVPRIVATE, (caddr_t) & ifreq) < 0) || +- ( _isUp && ( PPPStat->p.ppp_ibytes < _rxTotal ) ) || +- ( !_isUp && ( PPPStat->p.ppp_ibytes == 0 ) ) +- ) { +- if ( _isUp ) { +- _isUp = false; +- emit linkDown(); +- if ( options->cmd().length() ) { +- _retryId = startTimer( options->retry() * 1000 ); +- system( (const char*)options->cmd() ); +- } +- } +- PPPStat->p.ppp_ibytes = 0; +- PPPStat->p.ppp_obytes = 0; ++ get_command(ifreq.ifr_name); ++ FILE * fptr; ++ fptr=popen(command,"r+"); ++ fscanf(fptr,"%u%u",&PPPStat->p.ppp_ibytes,&PPPStat->p.ppp_obytes); ++ pclose(fptr); ++ ++ if ( ( _isUp && ( PPPStat->p.ppp_ibytes < _rxTotal ) ) || ++ ( !_isUp && ( PPPStat->p.ppp_ibytes == 0 )) ++ ) { ++ if ( _isUp ) { ++ _isUp = false; ++ emit linkDown(); ++ if ( options->cmd().length() ) { ++ _retryId = startTimer( options->retry() * 1000 ); ++ system( (const char*)options->cmd() ); ++ } ++ } ++ PPPStat->p.ppp_ibytes = 0; ++ PPPStat->p.ppp_obytes = 0; + } else if ( !_isUp ) { +- _isUp = true; +- killTimer( _retryId ); +- _retryId = -1; ++ _isUp = true; ++ killTimer( _retryId ); ++ _retryId = -1; + } +- ++ + unsigned int rxDelta = PPPStat->p.ppp_ibytes - _rxTotal; + unsigned int txDelta = PPPStat->p.ppp_obytes - _txTotal; + _rxTotal = PPPStat->p.ppp_ibytes; +@@ -92,4 +102,17 @@ + if ( rxDelta == _rxTotal ) rxDelta = 0; + if ( txDelta == _txTotal ) txDelta = 0; + emit changeStats( rxDelta, txDelta, _rxTotal, _txTotal ); ++ ++} ++ ++void get_command(char * interface) { ++ /*"/usr/bin/netstat -b -I tun0 | /usr/bin/grep Link | awk '{print $(NF-4),$(NF-1)}' */ ++ const char * netstat_command ="/usr/bin/netstat -n -b -I "; ++ const char * grep_command =" | /usr/bin/grep Link | /usr/bin/awk '{print $(NF-4),$(NF-1)}'"; ++ command[0]='\0'; ++ strcat(command,netstat_command); ++ strcat(command,interface); ++ strcat(command,grep_command); + } ++ ++ diff --git a/net/pppload/files/patch-ae b/net/pppload/files/patch-ae new file mode 100644 index 000000000000..ff57f7afc721 --- /dev/null +++ b/net/pppload/files/patch-ae @@ -0,0 +1,124 @@ +diff -u --new-file pppload-1.0/PPPStats.C.ppp ./PPPStats.C.ppp +--- pppload-1.0/PPPStats.C.ppp Wed Dec 31 16:00:00 1969 ++++ ./PPPStats.C.ppp Wed Jan 28 18:27:30 1998 +@@ -0,0 +1,120 @@ ++// pppload - A PPP Load Monitor ++// Copyright (C) 1996 Sean Vyain ++// svyain@mail.tds.net ++// smvyain@softart.com ++// ++// This program is free software; you can redistribute it and/or modify ++// it under the terms of the GNU General Public License as published by ++// the Free Software Foundation; either version 2 of the License, or ++// (at your option) any later version. ++// ++// This program is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++// ++// You should have received a copy of the GNU General Public License ++// along with this program; if not, write to the Free Software ++// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ ++extern "C" { ++#include <stdlib.h> ++#include <stdio.h> ++#include <sys/types.h> ++#include <sys/select.h> ++#include <sys/ioctl.h> ++#include <sys/socket.h> ++#include <sys/time.h> ++#include <net/if.h> ++#include <net/if_ppp.h> ++#include <net/if_var.h> ++#include <net/if_tun.h> ++} ++ ++#include "PPPStats.H" ++#include "Options.H" ++#include <iostream.h> ++ ++ ++typedef struct ++{ ++ struct ppp_stats stats; ++} DclPPPInfo; ++ ++PPPStats::PPPStats() ++: _rxTotal( 0 ), _txTotal( 0 ), _isUp( true ), _retryId( -1 ) ++{ ++ if ((_s = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { ++ perror("couldn't create IP socket"); ++ exit(1); ++ } ++ ++ startTimer( options->interval() * 1000 ); ++} ++ ++void PPPStats::timerEvent( QTimerEvent* e ) ++{ ++ if ( e->timerId() == _retryId ) ++ { ++ system( (const char*)options->cmd() ); ++ } ++ ++ DclPPPInfo PPPInfo[1]; // what is this var for? ++ struct ifpppstatsreq ifreq; // ifreq ifreq; ++ struct ppp_stats* PPPStat; ++ struct ppp_stats LastPPPStat[1]; // what is this var for? ++ ++ memset (&ifreq, 0, sizeof (ifreq)); ++// sprintf (ifreq.ifr_ifrn.ifrn_name, "ppp%d", options->link()); ++ sprintf (ifreq.ifr_name, "tun%d", options->link()); ++ ++// ifreq.ifr_ifru.ifru_data = (caddr_t) PPPInfo; ++ ++ PPPStat = & PPPInfo->stats; ++ memset (LastPPPStat, 0, sizeof (LastPPPStat)); ++ ++ ++ ++// if ( (ioctl (_s, SIOCDEVPRIVATE, (caddr_t) & ifreq) < 0) || ++// ( _isUp && ( PPPStat->p.ppp_ibytes < _rxTotal ) ) || ++// ( !_isUp && ( PPPStat->p.ppp_ibytes == 0 ) ) ++ if ( (ioctl (_s, SIOCGPPPSTATS , &ifreq) < 0) || ++ ( _isUp && ( ifreq.stats.p.ppp_ibytes < _rxTotal ) ) || ++ ( !_isUp && ( ifreq.stats.p.ppp_ibytes == 0 )) ++ ) { ++ if ( _isUp ) { ++ _isUp = false; ++ emit linkDown(); ++ if ( options->cmd().length() ) { ++ _retryId = startTimer( options->retry() * 1000 ); ++ system( (const char*)options->cmd() ); ++ } ++ } ++ PPPStat->p.ppp_ibytes = 0; ++ PPPStat->p.ppp_obytes = 0; ++ } else if ( !_isUp ) { ++ _isUp = true; ++ killTimer( _retryId ); ++ _retryId = -1; ++ } ++ ++ PPPStat->p.ppp_ibytes=ifreq.stats.p.ppp_ibytes; ++ PPPStat->p.ppp_obytes=ifreq.stats.p.ppp_obytes; ++ ++ ++cout<<ifreq.stats.p.ppp_ibytes<<" "<<ifreq.stats.p.ppp_ipackets<<" " ++ <<ifreq.stats.p.ppp_ierrors<<" "<<ifreq.stats.p.ppp_obytes <<" " ++ <<ifreq.stats.p.ppp_opackets<<" "<<ifreq.stats.p.ppp_oerrors<<endl ++ <<PPPStat->p.ppp_ibytes<<" "<<PPPStat->p.ppp_ipackets<<" " ++ <<PPPStat->p.ppp_ierrors<<" "<<PPPStat->p.ppp_obytes <<" " ++ <<PPPStat->p.ppp_opackets<<" "<<PPPStat->p.ppp_oerrors<<endl; ++ unsigned int rxDelta = PPPStat->p.ppp_ibytes - _rxTotal; ++ unsigned int txDelta = PPPStat->p.ppp_obytes - _txTotal; ++ _rxTotal = PPPStat->p.ppp_ibytes; ++ _txTotal = PPPStat->p.ppp_obytes; ++ if ( rxDelta == _rxTotal ) rxDelta = 0; ++ if ( txDelta == _txTotal ) txDelta = 0; ++ emit changeStats( rxDelta, txDelta, _rxTotal, _txTotal ); ++ ++} ++ diff --git a/net/pppload/files/patch-af b/net/pppload/files/patch-af new file mode 100644 index 000000000000..3eb62e541a18 --- /dev/null +++ b/net/pppload/files/patch-af @@ -0,0 +1,49 @@ +diff -u --new-file pppload-1.0/README.freebsd ./README.freebsd +--- pppload-1.0/README.freebsd Wed Dec 31 16:00:00 1969 ++++ ./README.freebsd Fri Jan 30 20:14:36 1998 +@@ -0,0 +1,45 @@ ++PPPLoad is designed to display the current throughput of a particular ++PPP link in a format that is similar to xload. Written by Sean Vyain. ++ ++This is a FreeBSD port of the linux program called pppload, available at ++http://sunsite.unc.edu/pub/Linux/system/network/serial/ppp/pppload-1.0.tar.gz ++ ++Original program homepage at: ++http://www.geocities.com/SiliconValley/Pines/1029/pppload.html ++ ++I have modified the FreeBSD port to be able to show the throughput of ++any network device that will work with netstat, e.g. tun, ppp, ed, ++etc. I just wanted a program to nicely display throughput ++statistics for the tun device. ++ ++ Examples of usage: ++For tun0 (tun is the default device,0 is the default link number): ++% pppload & ++ ++For first ne2000 clone: ++% pppload -device ed -link 0 & ++ ++for ppp2: ++% pppload -device ppp -link 2 & ++ ++BUGS ++Command line is awkward with -device and -link. ++ ++Can't detect whether the network device is up or not, so any command ++line options like -cmd -percmd -retry probably don't work. This is ++different that the original linux version. ++ ++Keeps track of all packets network device has ever used, even if it ++has gone down then up again. This is also different than the linux ++version. ++ ++Requires awk, grep, and netstat to get the data. Very short polling ++time are definitely not recommended. ++ ++Network interface names are limited to a total of 4 characters or less ++at the moment, e.g. ppp0 ed3 ze1. ++ ++ ++Documentation of this FreeBSD port is not complete. ++ ++ diff --git a/net/pppload/files/patch-ag b/net/pppload/files/patch-ag new file mode 100644 index 000000000000..944bd4f81556 --- /dev/null +++ b/net/pppload/files/patch-ag @@ -0,0 +1,64 @@ +diff -u --new-file pppload-1.0/pppload.1 ./pppload.1 +--- pppload-1.0/pppload.1 Tue Sep 10 16:56:20 1996 ++++ ./pppload.1 Fri Jan 30 21:35:55 1998 +@@ -3,7 +3,7 @@ + pppload \- display an xload-style graph of PPP activity + .SH SYNOPSIS + .B pppload +-[\-cmd ppp_cmd] [\-i interval] [\-p period] [\-retry interval] [\-rx] [\-norx] ++[\-cmd ppp_cmd] [\-i interval] [\-device name] [\-p period] [\-retry interval] [\-rx] [\-norx] + [\-rxcolor color] [\-tx] [\-notx] [\-txcolor color] + .SH DESCRIPTION + .BR pppload +@@ -28,6 +28,9 @@ + .I "\-h" + Print command line usage. + .TP ++.I "\-device name" ++Network device to monitor (default: tun) ++.TP + .I "\-i interval" + The statistics polling interval in seconds (default: 5). + .TP +@@ -60,3 +63,41 @@ + The name of the color to draw transmit rates in (default: red). + .SH AUTHOR + Sean Vyain <svyain@mail.tds.net, smvyain@softart.com> ++www.geocities.com/SiliconValley/Pines/1029/pppload.html ++ ++.SH FREEBSD PORT ++Examples of usage for the FreeBSD port: ++ ++For tun0 (tun is the default device,0 is the default link number): ++ ++% pppload & ++ ++For the first ne2000 ethernet card: ++ ++% pppload -device ed -link 0 & ++ ++for the third ppp device: ++ ++% pppload -device ppp -link 2 & ++ ++.SH BUGS ++The port to FreeBSD can't determine when the link is up or down, so ++some of the command line options like ++.I "\-cmd" ++.I "\-percmd" ++may not work. ++ ++Command line is awkward with -device and -link. ++ ++Keeps track of all packets network device has ever used, even if it ++has gone down then up again. This is different than the linux ++version. ++ ++Requires awk, grep, and netstat to get the data. Very short polling ++times are definitely not recommended. ++ ++Network interface names are limited to a total of 4 characters or less ++at the moment, e.g. ppp0 ed3 ze1. ++ ++ ++Modified January 1998 |