Diffstat (limited to 'noncore/settings/networksettings2/networksettings2/system.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/networksettings2/system.h | 63 |
1 files changed, 54 insertions, 9 deletions
diff --git a/noncore/settings/networksettings2/networksettings2/system.h b/noncore/settings/networksettings2/networksettings2/system.h index 33af391..e67d695 100644 --- a/noncore/settings/networksettings2/networksettings2/system.h +++ b/noncore/settings/networksettings2/networksettings2/system.h @@ -1,43 +1,81 @@ #ifndef __SYSTEM__H #define __SYSTEM__H +#include <qstring.h> + +#include <opie2/oprocess.h> + +using namespace Opie::Core; + // for hardware types #include <net/if_arp.h> #include <qdict.h> #include <qobject.h> #include <stdio.h> +class NodeCollection; class ANetNodeInstance; class QFile; +class MyProcess : public QObject { + + Q_OBJECT + +public : + + MyProcess(); + ~MyProcess(); + + inline OProcess & process() + { return *P; } + +public slots : + + void SLOT_Stdout( Opie::Core::OProcess * P, char *, int ); + void SLOT_Stderr( Opie::Core::OProcess * P, char *, int ); + void SLOT_ProcessExited( Opie::Core::OProcess * P); + +signals : + + void stdoutLine( const QString & ); + void stderrLine( const QString & ); + void processExited( MyProcess * ); + +private : + + QString StdoutBuffer; + QString StderrBuffer; + OProcess * P; +}; + class InterfaceInfo { public : InterfaceInfo() : Name(), MACAddress(), BCastAddress(), Netmask(), DstAddress() { } - ANetNodeInstance * assignedNode() - { return NetNode; } + NodeCollection * assignedConnection() + { return Collection; } - void assignNode( ANetNodeInstance * NNI ) - { NetNode = NNI; } + void assignConnection( NodeCollection * NNI ) + { Collection = NNI; } - ANetNodeInstance * NetNode; // netnode taking care of me + NodeCollection * Collection; // connection 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; @@ -55,36 +93,43 @@ class System : public QObject { public : System( void ); ~System( void ); QDict<InterfaceInfo> & interfaces( void ) { return ProbedInterfaces; } InterfaceInfo * interface( const QString& N ) { return ProbedInterfaces[N]; } // exec command as root - int runAsRoot( const QString & S ); + int runAsRoot( QStringList & S ); // exec command as user - void execAsUser( QString & Cmd, char * argv[] ); + int execAsUser( QStringList & Cmd ); // refresh stats for this interface void refreshStatistics( InterfaceInfo & ); // reloads interfaces void probeInterfaces( void ); + InterfaceInfo * findInterface( const QString & DevName ); + +private slots : + + void SLOT_ProcessExited( MyProcess * ); + signals : - void lineFromCommand( const QString & S ); + void stdoutLine( const QString & ); + void stderrLine( const QString & ); + void processEvent( const QString & ); private : QDict<InterfaceInfo> ProbedInterfaces; FILE * OutputOfCmd; QFile * ProcDevNet; - }; #endif |