summaryrefslogtreecommitdiff
path: root/libopie2/opienet/onetwork.h
Side-by-side diff
Diffstat (limited to 'libopie2/opienet/onetwork.h') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opienet/onetwork.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h
index 93b129f..a953296 100644
--- a/libopie2/opienet/onetwork.h
+++ b/libopie2/opienet/onetwork.h
@@ -35,48 +35,51 @@
#error Need to define a wireless extension version to build against!
#endif
#if OPIE_WE_VERSION == 15
#include "wireless.15.h"
#endif
#if OPIE_WE_VERSION == 16
#include "wireless.16.h"
#endif
/* OPIE */
#include <opie2/onetutils.h>
#include <opie2/ostation.h>
/* QT */
#include <qvaluelist.h>
#include <qdict.h>
#include <qmap.h>
#include <qobject.h>
#include <qhostaddress.h>
+namespace Opie {
+namespace Net {
+
class ONetworkInterface;
class OWirelessNetworkInterface;
class OChannelHopper;
class OMonitoringInterface;
/*======================================================================================
* ONetwork
*======================================================================================*/
/**
* @brief A container class for all network interfaces
*
* This class provides access to all available network interfaces of your computer.
*
* @author Michael 'Mickey' Lauer <mickey@vanille.de>
*/
class ONetwork : public QObject
{
Q_OBJECT
public:
typedef QDict<ONetworkInterface> InterfaceMap;
typedef QDictIterator<ONetworkInterface> InterfaceIterator;
@@ -102,48 +105,50 @@ class ONetwork : public QObject
*/
bool isWirelessInterface( const char* interface ) const;
/**
* @returns a pointer to the @ref ONetworkInterface object for the specified @a interface or 0, if not found.
* @see ONetworkInterface
*/
ONetworkInterface* interface( const QString& interface ) const;
/**
* @internal Rebuild the internal interface database
* @note Sometimes it might be useful to call this from client code,
* e.g. after issuing a cardctl insert
*/
void synchronize();
/**
* @returns the wireless extension version used at compile time.
**/
static short wirelessExtensionVersion();
protected:
ONetwork();
private:
static ONetwork* _instance;
InterfaceMap _interfaces;
+ class Private;
+ Private *d;
};
/*======================================================================================
* ONetworkInterface
*======================================================================================*/
/**
* @brief A network interface wrapper.
*
* This class provides a wrapper for a network interface. All the cumbersume details of
* Linux ioctls are hidden under a convenient high-level interface.
* @warning Most of the setting methods contained in this class require the appropriate
* process permissions to work.
*
* @author Michael 'Mickey' Lauer <mickey@vanille.de>
*/
class ONetworkInterface : public QObject
{
friend class OMonitoringInterface;
friend class OCiscoMonitoringInterface;
friend class OWlanNGMonitoringInterface;
friend class OHostAPMonitoringInterface;
friend class OOrinocoMonitoringInterface;
@@ -213,48 +218,51 @@ class ONetworkInterface : public QObject
/**
* Associate the IPv4 @a netmask with the interface.
*/
void setIPV4Netmask( const QHostAddress& netmask );
/**
* @returns the IPv4 netmask associated with the interface.
*/
QString ipV4Netmask() const; //TODO: make this return an OHostAddress
/**
* @returns the data link type currently associated with the interface.
* @see #include <net/if_arp.h> for possible values.
*/
int dataLinkType() const;
protected:
const int _sfd;
mutable ifreq _ifr;
OMonitoringInterface* _mon;
protected:
struct ifreq& ifr() const;
virtual void init();
bool ioctl( int call ) const;
bool ioctl( int call, struct ifreq& ) const;
+ private:
+ class Private;
+ Private *d;
};
/*======================================================================================
* OChannelHopper
*======================================================================================*/
/**
* @brief A radio frequency channel hopper.
*
* This class provides a channel hopper for radio frequencies. A channel hopper frequently
* changes the radio frequency channel of its associated @ref OWirelessNetworkInterface.
* This is necessary when in monitoring mode and scanning for other devices, because
* the radio frequency hardware can only detect packets sent on the same frequency.
*
* @author Michael 'Mickey' Lauer <mickey@vanille.de>
*/
class OChannelHopper : public QObject
{
Q_OBJECT
public:
/**
* Constructor.
*/
@@ -275,48 +283,50 @@ class OChannelHopper : public QObject
* Set the channel hopping @a interval.
* An interval of 0 deactivates the channel hopper.
*/
void setInterval( int interval );
/**
* @returns the channel hopping interval
*/
int interval() const;
signals:
/**
* This signal is emitted right after the channel hopper performed a hop
*/
void hopped( int );
protected:
virtual void timerEvent( QTimerEvent* );
private:
OWirelessNetworkInterface* _iface;
int _interval;
int _tid;
QValueList<int> _channels;
QValueList<int>::Iterator _channel;
+ class Private;
+ Private *d;
};
/*======================================================================================
* OWirelessNetworkInterface
*======================================================================================*/
/**
* @brief A network interface wrapper for interfaces supporting the wireless extensions protocol.
*
* This class provides a high-level encapsulation of the Linux wireless extension API.
*
* @author Michael 'Mickey' Lauer <mickey@vanille.de>
*/
class OWirelessNetworkInterface : public ONetworkInterface
{
friend class OMonitoringInterface;
friend class OCiscoMonitoringInterface;
friend class OWlanNGMonitoringInterface;
friend class OHostAPMonitoringInterface;
friend class OOrinocoMonitoringInterface;
friend class OPrivateIOCTL;
@@ -434,126 +444,147 @@ class OWirelessNetworkInterface : public ONetworkInterface
* In other modes the result is driver dependent.
*/
virtual int signalStrength() const;
/** @internal commit pending changes to the driver
*
*/
void commit() const;
protected:
void buildInformation();
void buildPrivateList();
void dumpInformation() const;
virtual void init();
struct iwreq& iwr() const;
bool wioctl( int call ) const;
bool wioctl( int call, struct iwreq& ) const;
protected:
mutable struct iwreq _iwr;
QMap<int,int> _channels;
struct iw_range _range;
private:
OChannelHopper* _hopper;
+ class Private;
+ Private *d;
};
/*======================================================================================
* OMonitoringInterface
*======================================================================================*/
class OMonitoringInterface
{
public:
OMonitoringInterface();
OMonitoringInterface( ONetworkInterface*, bool _prismHeader );
virtual ~OMonitoringInterface();
public:
virtual void setEnabled( bool );
virtual void setChannel( int );
virtual QString name() const = 0;
protected:
OWirelessNetworkInterface* _if;
bool _prismHeader;
+ private:
+ class Private;
+ Private *d;
};
/*======================================================================================
* OCiscoMonitoring
*======================================================================================*/
class OCiscoMonitoringInterface : public OMonitoringInterface
{
public:
OCiscoMonitoringInterface( ONetworkInterface*, bool _prismHeader );
virtual ~OCiscoMonitoringInterface();
virtual void setEnabled( bool );
virtual QString name() const;
virtual void setChannel( int );
+ private:
+ class Private;
+ Private *d;
};
/*======================================================================================
* OWlanNGMonitoringInterface
*======================================================================================*/
class OWlanNGMonitoringInterface : public OMonitoringInterface
{
public:
OWlanNGMonitoringInterface( ONetworkInterface*, bool _prismHeader );
virtual ~OWlanNGMonitoringInterface();
public:
virtual void setEnabled( bool );
virtual QString name() const;
virtual void setChannel( int );
+ private:
+ class Private;
+ Private *d;
};
/*======================================================================================
* OHostAPMonitoringInterface
*======================================================================================*/
class OHostAPMonitoringInterface : public OMonitoringInterface
{
public:
OHostAPMonitoringInterface( ONetworkInterface*, bool _prismHeader );
virtual ~OHostAPMonitoringInterface();
public:
virtual void setEnabled( bool );
virtual QString name() const;
+
+ private:
+ class Private;
+ Private *d;
};
/*======================================================================================
* OOrinocoMonitoringInterface
*======================================================================================*/
class OOrinocoMonitoringInterface : public OMonitoringInterface
{
public:
OOrinocoMonitoringInterface( ONetworkInterface*, bool _prismHeader );
virtual ~OOrinocoMonitoringInterface();
public:
virtual void setChannel( int );
virtual void setEnabled( bool );
virtual QString name() const;
+ private:
+ class Private;
+ Private *d;
};
+}
+}
+
#endif // ONETWORK_H