summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/networksettings2/system.h
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings2/networksettings2/system.h') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/networksettings2/networksettings2/system.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/noncore/settings/networksettings2/networksettings2/system.h b/noncore/settings/networksettings2/networksettings2/system.h
new file mode 100644
index 0000000..f89fe5d
--- a/dev/null
+++ b/noncore/settings/networksettings2/networksettings2/system.h
@@ -0,0 +1,76 @@
+#ifndef __SYSTEM__H
+#define __SYSTEM__H
+
+// for hardware types
+#include <net/if_arp.h>
+#include <qdict.h>
+
+class ANetNodeInstance;
+class QFile;
+
+class InterfaceInfo {
+
+public :
+
+ InterfaceInfo() :
+ Name(),
+ MACAddress(),
+ BCastAddress(),
+ Netmask(),
+ DstAddress() {
+ }
+
+ ANetNodeInstance * assignedNode()
+ { return NetNode; }
+
+ void assignNode( ANetNodeInstance * NNI )
+ { NetNode = NNI; }
+
+ ANetNodeInstance * NetNode; // netnode taking care of me
+ QString Name; // name of interface
+ int CardType; // type of card
+ QString MACAddress; // MAC address
+ QString Address; // IP Address
+ QString BCastAddress; // Broadcast Address
+ QString Netmask; // Netmask
+ QString DstAddress; // Peer address (if P-t-P)
+ bool IsUp; // interface is UP
+ bool HasMulticast; // Supports Multicast
+ bool IsPointToPoint; // IsPointToPoint card
+
+ QString RcvBytes;
+ QString SndBytes;
+ QString RcvErrors;
+ QString SndErrors;
+ QString RcvDropped;
+ QString SndDropped;
+ QString Collisions;
+};
+
+class System {
+
+public :
+
+ System( void );
+ ~System( void );
+
+ QDict<InterfaceInfo> & interfaces( void )
+ { return ProbedInterfaces; }
+ InterfaceInfo * interface( const QString& N )
+ { return ProbedInterfaces[N]; }
+
+ int execute( const QString & S );
+ // refresh stats for this interface
+ void refreshStatistics( InterfaceInfo & );
+
+ // reloads interfaces
+ void probeInterfaces( void );
+
+private :
+
+ QDict<InterfaceInfo> ProbedInterfaces;
+ QFile * ProcDevNet;
+
+};
+
+#endif