-rw-r--r-- | libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp | 8 | ||||
-rw-r--r-- | libopie2/opienet/onetutils.cpp | 33 | ||||
-rw-r--r-- | libopie2/opienet/onetutils.h | 4 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 33 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.h | 5 |
5 files changed, 79 insertions, 4 deletions
diff --git a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp index 7703b4c..b010ac5 100644 --- a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp +++ b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp @@ -28,2 +28,10 @@ int main( int argc, char** argv ) + // try to set monitor mode + + // first some wrong calls to check if this is working + iface->setPrivate( "seppel", 10 ); + iface->setPrivate( "monitor", 0 ); + + // now the real deal + iface->setPrivate( "monitor", 2, 2, 3 ); } diff --git a/libopie2/opienet/onetutils.cpp b/libopie2/opienet/onetutils.cpp index 3e11b53..fd8f9e9 100644 --- a/libopie2/opienet/onetutils.cpp +++ b/libopie2/opienet/onetutils.cpp @@ -32,2 +32,3 @@ #include <opie2/onetutils.h> +#include <opie2/onetwork.h> @@ -120,3 +121,6 @@ OPrivateIOCTL::~OPrivateIOCTL() -inline int OPrivateIOCTL::numberGetArgs() const +#ifdef QT_NO_DEBUG +inline +#endif +int OPrivateIOCTL::numberGetArgs() const { @@ -126,3 +130,6 @@ inline int OPrivateIOCTL::numberGetArgs() const -inline int OPrivateIOCTL::typeGetArgs() const +#ifdef QT_NO_DEBUG +inline +#endif +int OPrivateIOCTL::typeGetArgs() const { @@ -132,3 +139,6 @@ inline int OPrivateIOCTL::typeGetArgs() const -inline int OPrivateIOCTL::numberSetArgs() const +#ifdef QT_NO_DEBUG +inline +#endif +int OPrivateIOCTL::numberSetArgs() const { @@ -138,3 +148,6 @@ inline int OPrivateIOCTL::numberSetArgs() const -inline int OPrivateIOCTL::typeSetArgs() const +#ifdef QT_NO_DEBUG +inline +#endif +int OPrivateIOCTL::typeSetArgs() const { @@ -144,2 +157,14 @@ inline int OPrivateIOCTL::typeSetArgs() const +void OPrivateIOCTL::invoke() const +{ + ( (OWirelessNetworkInterface*) parent() )->wioctl( _ioctl ); +} + + +void OPrivateIOCTL::setParameter( int num, u_int32_t value ) +{ + u_int32_t* arglist = (u_int32_t*) &( (OWirelessNetworkInterface*) parent() )->_iwr.u.name; + arglist[num] = value; +} + /*====================================================================================== diff --git a/libopie2/opienet/onetutils.h b/libopie2/opienet/onetutils.h index 6640515..8be042b 100644 --- a/libopie2/opienet/onetutils.h +++ b/libopie2/opienet/onetutils.h @@ -100,2 +100,5 @@ class OPrivateIOCTL : public QObject + void invoke() const; + void setParameter( int, u_int32_t ); + private: @@ -104,2 +107,3 @@ class OPrivateIOCTL : public QObject u_int16_t _setargs; + }; diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index 2548a04..66fa215 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp @@ -54,2 +54,3 @@ #include <linux/sockios.h> +#include <stdarg.h> @@ -584,2 +585,34 @@ QString OWirelessNetworkInterface::nickName() const +void OWirelessNetworkInterface::setPrivate( const QString& call, int numargs, ... ) +{ + OPrivateIOCTL* priv = static_cast<OPrivateIOCTL*>( child( (const char*) call ) ); + if ( !priv ) + { + qDebug( "OWirelessNetworkInterface::setPrivate(): interface '%s' does not support private ioctl '%s'", name(), (const char*) call ); + return; + } + if ( priv->numberSetArgs() != numargs ) + { + qDebug( "OWirelessNetworkInterface::setPrivate(): parameter count not matching. '%s' expects %d arguments, but got %d", (const char*) call, priv->numberSetArgs(), numargs ); + return; + } + + qDebug( "OWirelessNetworkInterface::setPrivate(): about to call '%s' on interface '%s'", (const char*) call, name() ); + memset( &_iwr, 0, sizeof _iwr ); + va_list argp; + va_start( argp, numargs ); + for ( int i = 0; i < numargs; ++i ) + { + priv->setParameter( i, va_arg( argp, int ) ); + } + va_end( argp ); + priv->invoke(); +} + + +void OWirelessNetworkInterface::getPrivate( const QString& call ) +{ +} + + QString OWirelessNetworkInterface::SSID() const diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index acf2f69..7c70873 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h @@ -185,2 +185,4 @@ class OWirelessNetworkInterface : public ONetworkInterface + friend class OPrivateIOCTL; + public: @@ -209,2 +211,5 @@ class OWirelessNetworkInterface : public ONetworkInterface + virtual void setPrivate( const QString&, int, ... ); + virtual void getPrivate( const QString& ); + virtual bool isAssociated() const {}; |