summaryrefslogtreecommitdiff
path: root/noncore/applets/wirelessapplet/networkinfo.h
authormickeyl <mickeyl>2002-08-04 19:06:53 (UTC)
committer mickeyl <mickeyl>2002-08-04 19:06:53 (UTC)
commitc2d27f3bc4fdf7407337a50c92dcb04ab4ce3525 (patch) (unidiff)
tree3913529e3ce4ba338e030e922fe094470211e5b5 /noncore/applets/wirelessapplet/networkinfo.h
parent55019d84057f9c2bd2b2483da2c128a0a927e003 (diff)
downloadopie-c2d27f3bc4fdf7407337a50c92dcb04ab4ce3525.zip
opie-c2d27f3bc4fdf7407337a50c92dcb04ab4ce3525.tar.gz
opie-c2d27f3bc4fdf7407337a50c92dcb04ab4ce3525.tar.bz2
wireless monitoring applet added to opie-cvs
Diffstat (limited to 'noncore/applets/wirelessapplet/networkinfo.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/wirelessapplet/networkinfo.h126
1 files changed, 126 insertions, 0 deletions
diff --git a/noncore/applets/wirelessapplet/networkinfo.h b/noncore/applets/wirelessapplet/networkinfo.h
new file mode 100644
index 0000000..c5eb743
--- a/dev/null
+++ b/noncore/applets/wirelessapplet/networkinfo.h
@@ -0,0 +1,126 @@
1/**********************************************************************
2** MNetwork* classes
3**
4** Encapsulates network information
5**
6** Copyright (C) 2002, Michael Lauer
7** mickey@tm.informatik.uni-frankfurt.de
8** http://www.Vanille.de
9**
10** This file may be distributed and/or modified under the terms of the
11** GNU General Public License version 2 as published by the Free Software
12** Foundation and appearing in the file LICENSE.GPL included in the
13** packaging of this file.
14**
15** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17**
18**********************************************************************/
19
20#ifndef NETWORKINFO_H
21#define NETWORKINFO_H
22
23#include <qstring.h>
24#include <qdict.h>
25
26//---------------------------------------------------------------------------
27// class MNetworkInterface
28//
29
30class MNetworkInterface
31{
32public:
33
34 MNetworkInterface( const char* name = "eth0" );
35 virtual ~MNetworkInterface();
36
37 bool isLoopback() { return isLoopbackInterface; };
38 const QString& getName() { return name; };
39
40 virtual void updateStatistics();
41
42protected:
43
44 int fd;
45 const QString name;
46 bool isLoopbackInterface;
47 bool isIrda;
48 bool isTunnel;
49};
50
51//---------------------------------------------------------------------------
52// class MWirelessNetworkInterface
53//
54
55class MWirelessNetworkInterface : public MNetworkInterface
56{
57public:
58 MWirelessNetworkInterface( const char* name = "wlan0" );
59 virtual ~MWirelessNetworkInterface();
60
61 int noisePercent();
62 int qualityPercent();
63 int signalPercent();
64
65 QString APAddr;
66 QString essid;
67 QString mode;
68 QString nick;
69 QString rate;
70 double freq;
71 int channel;
72
73 virtual void updateStatistics();
74
75private:
76 int quality;
77 int signal;
78 int noise;
79
80 bool hasWirelessExtensions;
81};
82
83//---------------------------------------------------------------------------
84// class MNetwork
85//
86
87class MNetwork
88{
89public:
90 MNetwork();
91 virtual ~MNetwork();
92
93 typedef QDict<MNetworkInterface> InterfaceMap;
94 typedef QDictIterator<MNetworkInterface> InterfaceMapIterator;
95
96 bool hasInterfaces() const { return interfaces.isEmpty(); };
97 int numInterfaces() const { return interfaces.count(); };
98
99 MNetworkInterface* getFirstInterface();
100
101protected:
102 QString procfile;
103 InterfaceMap interfaces;
104
105 virtual MNetworkInterface* createInterface( const char* name ) const;
106
107private:
108 void enumerateInterfaces();
109};
110
111//---------------------------------------------------------------------------
112// class MWirelessNetwork
113//
114
115class MWirelessNetwork : public MNetwork
116{
117public:
118 MWirelessNetwork();
119 virtual ~MWirelessNetwork();
120
121protected:
122 virtual MNetworkInterface* createInterface( const char* name )
123 const;
124};
125
126#endif