summaryrefslogtreecommitdiff
path: root/libopie2
authormickeyl <mickeyl>2003-04-03 23:46:04 (UTC)
committer mickeyl <mickeyl>2003-04-03 23:46:04 (UTC)
commit487971af0c1b70babcc39fd549dc0d8142cd4865 (patch) (unidiff)
treee317df1359a20686ba35b17309a8b82386108fb3 /libopie2
parent934e4d81bc078c704a39f02663607a6c16a5b29f (diff)
downloadopie-487971af0c1b70babcc39fd549dc0d8142cd4865.zip
opie-487971af0c1b70babcc39fd549dc0d8142cd4865.tar.gz
opie-487971af0c1b70babcc39fd549dc0d8142cd4865.tar.bz2
first part of private IOCTL API for OWirelessNetworkInterface implemented
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp8
-rw-r--r--libopie2/opienet/onetutils.cpp33
-rw-r--r--libopie2/opienet/onetutils.h4
-rw-r--r--libopie2/opienet/onetwork.cpp33
-rw-r--r--libopie2/opienet/onetwork.h5
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
@@ -27,4 +27,12 @@ int main( int argc, char** argv )
27 //} 27 //}
28 28
29 // try to set monitor mode
30
31 // first some wrong calls to check if this is working
32 iface->setPrivate( "seppel", 10 );
33 iface->setPrivate( "monitor", 0 );
34
35 // now the real deal
36 iface->setPrivate( "monitor", 2, 2, 3 );
29 } 37 }
30 ++it; 38 ++it;
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
@@ -31,4 +31,5 @@
31 31
32#include <opie2/onetutils.h> 32#include <opie2/onetutils.h>
33#include <opie2/onetwork.h>
33 34
34#include <net/if.h> 35#include <net/if.h>
@@ -119,5 +120,8 @@ OPrivateIOCTL::~OPrivateIOCTL()
119 120
120 121
121inline int OPrivateIOCTL::numberGetArgs() const 122#ifdef QT_NO_DEBUG
123inline
124#endif
125int OPrivateIOCTL::numberGetArgs() const
122{ 126{
123 return _getargs & IW_PRIV_SIZE_MASK; 127 return _getargs & IW_PRIV_SIZE_MASK;
@@ -125,5 +129,8 @@ inline int OPrivateIOCTL::numberGetArgs() const
125 129
126 130
127inline int OPrivateIOCTL::typeGetArgs() const 131#ifdef QT_NO_DEBUG
132inline
133#endif
134int OPrivateIOCTL::typeGetArgs() const
128{ 135{
129 return _getargs & IW_PRIV_TYPE_MASK >> 12; 136 return _getargs & IW_PRIV_TYPE_MASK >> 12;
@@ -131,5 +138,8 @@ inline int OPrivateIOCTL::typeGetArgs() const
131 138
132 139
133inline int OPrivateIOCTL::numberSetArgs() const 140#ifdef QT_NO_DEBUG
141inline
142#endif
143int OPrivateIOCTL::numberSetArgs() const
134{ 144{
135 return _setargs & IW_PRIV_SIZE_MASK; 145 return _setargs & IW_PRIV_SIZE_MASK;
@@ -137,5 +147,8 @@ inline int OPrivateIOCTL::numberSetArgs() const
137 147
138 148
139inline int OPrivateIOCTL::typeSetArgs() const 149#ifdef QT_NO_DEBUG
150inline
151#endif
152int OPrivateIOCTL::typeSetArgs() const
140{ 153{
141 return _setargs & IW_PRIV_TYPE_MASK >> 12; 154 return _setargs & IW_PRIV_TYPE_MASK >> 12;
@@ -143,4 +156,16 @@ inline int OPrivateIOCTL::typeSetArgs() const
143 156
144 157
158void OPrivateIOCTL::invoke() const
159{
160 ( (OWirelessNetworkInterface*) parent() )->wioctl( _ioctl );
161}
162
163
164void OPrivateIOCTL::setParameter( int num, u_int32_t value )
165{
166 u_int32_t* arglist = (u_int32_t*) &( (OWirelessNetworkInterface*) parent() )->_iwr.u.name;
167 arglist[num] = value;
168}
169
145/*====================================================================================== 170/*======================================================================================
146 * assorted functions 171 * assorted functions
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
@@ -99,8 +99,12 @@ class OPrivateIOCTL : public QObject
99 int typeSetArgs() const; 99 int typeSetArgs() const;
100 100
101 void invoke() const;
102 void setParameter( int, u_int32_t );
103
101 private: 104 private:
102 u_int32_t _ioctl; 105 u_int32_t _ioctl;
103 u_int16_t _getargs; 106 u_int16_t _getargs;
104 u_int16_t _setargs; 107 u_int16_t _setargs;
108
105}; 109};
106 110
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
@@ -53,4 +53,5 @@
53#include <unistd.h> 53#include <unistd.h>
54#include <linux/sockios.h> 54#include <linux/sockios.h>
55#include <stdarg.h>
55 56
56using namespace std; 57using namespace std;
@@ -583,4 +584,36 @@ QString OWirelessNetworkInterface::nickName() const
583 584
584 585
586void OWirelessNetworkInterface::setPrivate( const QString& call, int numargs, ... )
587{
588 OPrivateIOCTL* priv = static_cast<OPrivateIOCTL*>( child( (const char*) call ) );
589 if ( !priv )
590 {
591 qDebug( "OWirelessNetworkInterface::setPrivate(): interface '%s' does not support private ioctl '%s'", name(), (const char*) call );
592 return;
593 }
594 if ( priv->numberSetArgs() != numargs )
595 {
596 qDebug( "OWirelessNetworkInterface::setPrivate(): parameter count not matching. '%s' expects %d arguments, but got %d", (const char*) call, priv->numberSetArgs(), numargs );
597 return;
598 }
599
600 qDebug( "OWirelessNetworkInterface::setPrivate(): about to call '%s' on interface '%s'", (const char*) call, name() );
601 memset( &_iwr, 0, sizeof _iwr );
602 va_list argp;
603 va_start( argp, numargs );
604 for ( int i = 0; i < numargs; ++i )
605 {
606 priv->setParameter( i, va_arg( argp, int ) );
607 }
608 va_end( argp );
609 priv->invoke();
610}
611
612
613void OWirelessNetworkInterface::getPrivate( const QString& call )
614{
615}
616
617
585QString OWirelessNetworkInterface::SSID() const 618QString OWirelessNetworkInterface::SSID() const
586{ 619{
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
@@ -184,4 +184,6 @@ class OWirelessNetworkInterface : public ONetworkInterface
184 friend class OOrinocoMonitoringInterface; 184 friend class OOrinocoMonitoringInterface;
185 185
186 friend class OPrivateIOCTL;
187
186 public: 188 public:
187 enum Mode { AdHoc, Managed, Monitor }; 189 enum Mode { AdHoc, Managed, Monitor };
@@ -208,4 +210,7 @@ class OWirelessNetworkInterface : public ONetworkInterface
208 virtual QString nickName() const; 210 virtual QString nickName() const;
209 211
212 virtual void setPrivate( const QString&, int, ... );
213 virtual void getPrivate( const QString& );
214
210 virtual bool isAssociated() const {}; 215 virtual bool isAssociated() const {};
211 virtual QString associatedAP() const; 216 virtual QString associatedAP() const;