author | mickeyl <mickeyl> | 2003-04-03 23:46:04 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-04-03 23:46:04 (UTC) |
commit | 487971af0c1b70babcc39fd549dc0d8142cd4865 (patch) (unidiff) | |
tree | e317df1359a20686ba35b17309a8b82386108fb3 /libopie2/opienet/onetutils.cpp | |
parent | 934e4d81bc078c704a39f02663607a6c16a5b29f (diff) | |
download | opie-487971af0c1b70babcc39fd549dc0d8142cd4865.zip opie-487971af0c1b70babcc39fd549dc0d8142cd4865.tar.gz opie-487971af0c1b70babcc39fd549dc0d8142cd4865.tar.bz2 |
first part of private IOCTL API for OWirelessNetworkInterface implemented
Diffstat (limited to 'libopie2/opienet/onetutils.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opienet/onetutils.cpp | 33 |
1 files changed, 29 insertions, 4 deletions
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 | |||
@@ -21,24 +21,25 @@ | |||
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
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> |
35 | 36 | ||
36 | #include <cstdio> | 37 | #include <cstdio> |
37 | using namespace std; | 38 | using namespace std; |
38 | 39 | ||
39 | #define IW_PRIV_TYPE_MASK 0x7000 | 40 | #define IW_PRIV_TYPE_MASK 0x7000 |
40 | #define IW_PRIV_TYPE_NONE 0x0000 | 41 | #define IW_PRIV_TYPE_NONE 0x0000 |
41 | #define IW_PRIV_TYPE_BYTE 0x1000 | 42 | #define IW_PRIV_TYPE_BYTE 0x1000 |
42 | #define IW_PRIV_TYPE_CHAR 0x2000 | 43 | #define IW_PRIV_TYPE_CHAR 0x2000 |
43 | #define IW_PRIV_TYPE_INT 0x4000 | 44 | #define IW_PRIV_TYPE_INT 0x4000 |
44 | #define IW_PRIV_TYPE_FLOAT 0x5000 | 45 | #define IW_PRIV_TYPE_FLOAT 0x5000 |
@@ -109,48 +110,72 @@ bool operator==( const OMacAddress &m1, const OMacAddress &m2 ) | |||
109 | 110 | ||
110 | OPrivateIOCTL::OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ) | 111 | OPrivateIOCTL::OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ) |
111 | :QObject( parent, name ), _ioctl( cmd ), _getargs( getargs ), _setargs( setargs ) | 112 | :QObject( parent, name ), _ioctl( cmd ), _getargs( getargs ), _setargs( setargs ) |
112 | { | 113 | { |
113 | } | 114 | } |
114 | 115 | ||
115 | 116 | ||
116 | OPrivateIOCTL::~OPrivateIOCTL() | 117 | OPrivateIOCTL::~OPrivateIOCTL() |
117 | { | 118 | { |
118 | } | 119 | } |
119 | 120 | ||
120 | 121 | ||
121 | inline int OPrivateIOCTL::numberGetArgs() const | 122 | #ifdef QT_NO_DEBUG |
123 | inline | ||
124 | #endif | ||
125 | int OPrivateIOCTL::numberGetArgs() const | ||
122 | { | 126 | { |
123 | return _getargs & IW_PRIV_SIZE_MASK; | 127 | return _getargs & IW_PRIV_SIZE_MASK; |
124 | } | 128 | } |
125 | 129 | ||
126 | 130 | ||
127 | inline int OPrivateIOCTL::typeGetArgs() const | 131 | #ifdef QT_NO_DEBUG |
132 | inline | ||
133 | #endif | ||
134 | int OPrivateIOCTL::typeGetArgs() const | ||
128 | { | 135 | { |
129 | return _getargs & IW_PRIV_TYPE_MASK >> 12; | 136 | return _getargs & IW_PRIV_TYPE_MASK >> 12; |
130 | } | 137 | } |
131 | 138 | ||
132 | 139 | ||
133 | inline int OPrivateIOCTL::numberSetArgs() const | 140 | #ifdef QT_NO_DEBUG |
141 | inline | ||
142 | #endif | ||
143 | int OPrivateIOCTL::numberSetArgs() const | ||
134 | { | 144 | { |
135 | return _setargs & IW_PRIV_SIZE_MASK; | 145 | return _setargs & IW_PRIV_SIZE_MASK; |
136 | } | 146 | } |
137 | 147 | ||
138 | 148 | ||
139 | inline int OPrivateIOCTL::typeSetArgs() const | 149 | #ifdef QT_NO_DEBUG |
150 | inline | ||
151 | #endif | ||
152 | int OPrivateIOCTL::typeSetArgs() const | ||
140 | { | 153 | { |
141 | return _setargs & IW_PRIV_TYPE_MASK >> 12; | 154 | return _setargs & IW_PRIV_TYPE_MASK >> 12; |
142 | } | 155 | } |
143 | 156 | ||
144 | 157 | ||
158 | void OPrivateIOCTL::invoke() const | ||
159 | { | ||
160 | ( (OWirelessNetworkInterface*) parent() )->wioctl( _ioctl ); | ||
161 | } | ||
162 | |||
163 | |||
164 | void 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 |
147 | *======================================================================================*/ | 172 | *======================================================================================*/ |
148 | 173 | ||
149 | void dumpBytes( const unsigned char* data, int num ) | 174 | void dumpBytes( const unsigned char* data, int num ) |
150 | { | 175 | { |
151 | printf( "Dumping %d bytes @ %0x", num, data ); | 176 | printf( "Dumping %d bytes @ %0x", num, data ); |
152 | printf( "-------------------------------------------\n" ); | 177 | printf( "-------------------------------------------\n" ); |
153 | 178 | ||
154 | for ( int i = 0; i < num; ++i ) | 179 | for ( int i = 0; i < num; ++i ) |
155 | { | 180 | { |
156 | printf( "%02x ", data[i] ); | 181 | printf( "%02x ", data[i] ); |