* maximal -> maximum
[kdenetwork.git] / kppp / pppstats.h
blob1e96c25f268f61d795cf6fc1c7ab9893b6265ff5
1 /*
3 * kPPP: A pppd front end for the KDE project
5 * $Id$
7 * (c) 1997-1998 Bernd Johannes Wuebben <wuebben@kde.org>
8 * (c) 1997-1999 Mario Weilguni <mweilguni@kde.org>
9 * (c) 1998-1999 Harri Porten <porten@kde.org>
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Library General Public
13 * License as published by the Free Software Foundation; either
14 * version 2 of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Library General Public License for more details.
21 * You should have received a copy of the GNU Library General Public
22 * License along with this program; if not, write to the Free
23 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 #ifndef _PPPSTATS_H_
27 #define _PPPSTATS_H_
30 #include "kpppconfig.h"
31 #include <qobject.h>
33 #ifdef Q_OS_BSD4
34 #include <sys/types.h>
35 #include <sys/socket.h>
36 #include <net/ppp_defs.h>
37 #include <net/if.h>
38 #include <net/if_ppp.h>
39 #endif
41 class QTimer;
43 class PPPStats : public QObject {
44 Q_OBJECT
45 public:
46 PPPStats();
47 ~PPPStats();
48 void clear();
49 bool initStats();
50 bool doStats();
51 bool ifIsUp();
52 void setUnit(int u);
53 void start();
54 void stop();
56 signals:
57 void statsChanged(int);
59 private slots:
60 void timerClick();
62 public:
63 int ibytes, obytes;
64 int totalbytes;
65 int ipackets, opackets;
66 int compressedin;
67 int uncompressedin;
68 int compressed;
69 int errorin;
70 int packetsunc, packetsoutunc;
72 QString local_ip_address;
73 QString remote_ip_address;
75 enum IOStatus { BytesNone = 0, BytesIn, BytesOut, BytesBoth };
77 private:
78 bool get_ppp_stats(struct ppp_stats *curp);
79 bool strioctl(int fd, int cmd, char* ptr,int ilen, int olen);
81 int ibytes_last, obytes_last;
82 int s; // socket file descriptor
83 #ifdef STREAMS
84 int t;
85 #endif
86 int unit;
87 char unitName[5];
88 enum IOStatus ioStatus;
89 QTimer *timer;
92 #endif