author | mickeyl <mickeyl> | 2005-05-17 16:57:08 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-05-17 16:57:08 (UTC) |
commit | d2ae68c413873e234b34f733818427902e738948 (patch) (unidiff) | |
tree | f5748014d7b1785302c167c6f43fbd0622bf1019 /libopie2 | |
parent | cce15d6b9a27880df72ea2638f9295900ea6c21e (diff) | |
download | opie-d2ae68c413873e234b34f733818427902e738948.zip opie-d2ae68c413873e234b34f733818427902e738948.tar.gz opie-d2ae68c413873e234b34f733818427902e738948.tar.bz2 |
libopienet API cleanups
-rw-r--r-- | libopie2/opienet/onetutils.cpp | 19 | ||||
-rw-r--r-- | libopie2/opienet/onetutils.h | 8 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.cpp | 43 | ||||
-rw-r--r-- | libopie2/opienet/onetwork.h | 7 |
4 files changed, 39 insertions, 38 deletions
diff --git a/libopie2/opienet/onetutils.cpp b/libopie2/opienet/onetutils.cpp index c8c494a..9c3e650 100644 --- a/libopie2/opienet/onetutils.cpp +++ b/libopie2/opienet/onetutils.cpp | |||
@@ -1,17 +1,15 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | =. (C) 2003-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> | |
4 | (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de> | ||
5 | =. | ||
6 | .=l. | 4 | .=l. |
7 | .>+-= | 5 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; version 2 of the License. | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
13 | ._= =} : | 11 | ._= =} : |
14 | .%`+i> _;_. | 12 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
@@ -127,24 +125,39 @@ QString OMacAddress::manufacturer() const | |||
127 | 125 | ||
128 | 126 | ||
129 | bool operator==( const OMacAddress &m1, const OMacAddress &m2 ) | 127 | bool operator==( const OMacAddress &m1, const OMacAddress &m2 ) |
130 | { | 128 | { |
131 | return memcmp( &m1._bytes, &m2._bytes, 6 ) == 0; | 129 | return memcmp( &m1._bytes, &m2._bytes, 6 ) == 0; |
132 | } | 130 | } |
133 | 131 | ||
134 | 132 | ||
135 | /*====================================================================================== | 133 | /*====================================================================================== |
136 | * OHostAddress | 134 | * OHostAddress |
137 | *======================================================================================*/ | 135 | *======================================================================================*/ |
138 | 136 | ||
137 | OHostAddress::OHostAddress() | ||
138 | :QHostAddress() | ||
139 | { | ||
140 | } | ||
141 | |||
142 | |||
143 | OHostAddress::OHostAddress( Q_UINT32 ip4Addr ) | ||
144 | :QHostAddress( ip4Addr ) | ||
145 | { | ||
146 | } | ||
147 | |||
148 | |||
149 | OHostAddress::~OHostAddress() | ||
150 | { | ||
151 | } | ||
139 | 152 | ||
140 | /*====================================================================================== | 153 | /*====================================================================================== |
141 | * OPrivateIOCTL | 154 | * OPrivateIOCTL |
142 | *======================================================================================*/ | 155 | *======================================================================================*/ |
143 | 156 | ||
144 | OPrivateIOCTL::OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ) | 157 | OPrivateIOCTL::OPrivateIOCTL( QObject* parent, const char* name, int cmd, int getargs, int setargs ) |
145 | :QObject( parent, name ), _ioctl( cmd ), _getargs( getargs ), _setargs( setargs ) | 158 | :QObject( parent, name ), _ioctl( cmd ), _getargs( getargs ), _setargs( setargs ) |
146 | { | 159 | { |
147 | } | 160 | } |
148 | 161 | ||
149 | 162 | ||
150 | OPrivateIOCTL::~OPrivateIOCTL() | 163 | OPrivateIOCTL::~OPrivateIOCTL() |
diff --git a/libopie2/opienet/onetutils.h b/libopie2/opienet/onetutils.h index 25c9238..f08738c 100644 --- a/libopie2/opienet/onetutils.h +++ b/libopie2/opienet/onetutils.h | |||
@@ -1,16 +1,15 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | (C) 2003-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | =. (C) 2003-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> |
4 | =. | ||
5 | .=l. | 4 | .=l. |
6 | .>+-= | 5 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; version 2 of the License. | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
12 | ._= =} : | 11 | ._= =} : |
13 | .%`+i> _;_. | 12 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
@@ -80,28 +79,29 @@ class OMacAddress | |||
80 | 79 | ||
81 | }; | 80 | }; |
82 | 81 | ||
83 | bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); | 82 | bool operator==( const OMacAddress &m1, const OMacAddress &m2 ); |
84 | 83 | ||
85 | 84 | ||
86 | /*====================================================================================== | 85 | /*====================================================================================== |
87 | * OHostAddress | 86 | * OHostAddress |
88 | *======================================================================================*/ | 87 | *======================================================================================*/ |
89 | 88 | ||
90 | class OHostAddress : public QHostAddress | 89 | class OHostAddress : public QHostAddress |
91 | { | 90 | { |
92 | /*public: | 91 | public: |
93 | OHostAddress(); | 92 | OHostAddress(); |
93 | OHostAddress( Q_UINT32 ip4Addr ); | ||
94 | ~OHostAddress(); | 94 | ~OHostAddress(); |
95 | */ | 95 | |
96 | private: | 96 | private: |
97 | class Private; | 97 | class Private; |
98 | Private *d; | 98 | Private *d; |
99 | }; | 99 | }; |
100 | 100 | ||
101 | 101 | ||
102 | /*====================================================================================== | 102 | /*====================================================================================== |
103 | * ONetworkInterfaceDriverInfo | 103 | * ONetworkInterfaceDriverInfo |
104 | *======================================================================================*/ | 104 | *======================================================================================*/ |
105 | 105 | ||
106 | class ONetworkInterfaceDriverInfo | 106 | class ONetworkInterfaceDriverInfo |
107 | { | 107 | { |
diff --git a/libopie2/opienet/onetwork.cpp b/libopie2/opienet/onetwork.cpp index 1deb051..0649ca2 100644 --- a/libopie2/opienet/onetwork.cpp +++ b/libopie2/opienet/onetwork.cpp | |||
@@ -1,16 +1,15 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2003-2005 by Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | =. Copyright (C) 2003-2005 by Michael 'Mickey' Lauer <mickey@Vanille.de> |
4 | =. | ||
5 | .=l. | 4 | .=l. |
6 | .>+-= | 5 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; version 2 of the License. | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
12 | ._= =} : | 11 | ._= =} : |
13 | .%`+i> _;_. | 12 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
@@ -76,28 +75,24 @@ namespace Net { | |||
76 | ONetwork* ONetwork::_instance = 0; | 75 | ONetwork* ONetwork::_instance = 0; |
77 | 76 | ||
78 | ONetwork::ONetwork() | 77 | ONetwork::ONetwork() |
79 | { | 78 | { |
80 | odebug << "ONetwork::ONetwork()" << oendl; | 79 | odebug << "ONetwork::ONetwork()" << oendl; |
81 | odebug << "ONetwork: This code has been compiled against Wireless Extensions V" << WIRELESS_EXT << oendl; | 80 | odebug << "ONetwork: This code has been compiled against Wireless Extensions V" << WIRELESS_EXT << oendl; |
82 | synchronize(); | 81 | synchronize(); |
83 | } | 82 | } |
84 | 83 | ||
85 | void ONetwork::synchronize() | 84 | void ONetwork::synchronize() |
86 | { | 85 | { |
87 | // gather available interfaces by inspecting /proc/net/dev | 86 | // gather available interfaces by inspecting /proc/net/dev |
88 | //FIXME: we could use SIOCGIFCONF here, but we aren't interested in virtual (e.g. eth0:0) devices | ||
89 | //FIXME: Use SIOCGIFCONF anway, because we can disable listing of aliased devices | ||
90 | //FIXME: Best is use SIOCGIFCONF and if this doesn't work (result=-1), then fallback to parsing /proc/net/dev | ||
91 | |||
92 | _interfaces.clear(); | 87 | _interfaces.clear(); |
93 | QString str; | 88 | QString str; |
94 | QFile f( "/proc/net/dev" ); | 89 | QFile f( "/proc/net/dev" ); |
95 | bool hasFile = f.open( IO_ReadOnly ); | 90 | bool hasFile = f.open( IO_ReadOnly ); |
96 | if ( !hasFile ) | 91 | if ( !hasFile ) |
97 | { | 92 | { |
98 | odebug << "ONetwork: /proc/net/dev not existing. No network devices available" << oendl; | 93 | odebug << "ONetwork: /proc/net/dev not existing. No network devices available" << oendl; |
99 | return; | 94 | return; |
100 | } | 95 | } |
101 | QTextStream s( &f ); | 96 | QTextStream s( &f ); |
102 | s.readLine(); | 97 | s.readLine(); |
103 | s.readLine(); | 98 | s.readLine(); |
@@ -193,25 +188,24 @@ ONetworkInterface::ONetworkInterface( QObject* parent, const char* name ) | |||
193 | } | 188 | } |
194 | 189 | ||
195 | 190 | ||
196 | struct ifreq& ONetworkInterface::ifr() const | 191 | struct ifreq& ONetworkInterface::ifr() const |
197 | { | 192 | { |
198 | return _ifr; | 193 | return _ifr; |
199 | } | 194 | } |
200 | 195 | ||
201 | 196 | ||
202 | void ONetworkInterface::init() | 197 | void ONetworkInterface::init() |
203 | { | 198 | { |
204 | odebug << "ONetworkInterface::init()" << oendl; | 199 | odebug << "ONetworkInterface::init()" << oendl; |
205 | |||
206 | memset( &_ifr, 0, sizeof( struct ifreq ) ); | 200 | memset( &_ifr, 0, sizeof( struct ifreq ) ); |
207 | 201 | ||
208 | if ( _sfd == -1 ) | 202 | if ( _sfd == -1 ) |
209 | { | 203 | { |
210 | odebug << "ONetworkInterface::init(): Warning - can't get socket for device '" << name() << "'" << oendl; | 204 | odebug << "ONetworkInterface::init(): Warning - can't get socket for device '" << name() << "'" << oendl; |
211 | return; | 205 | return; |
212 | } | 206 | } |
213 | } | 207 | } |
214 | 208 | ||
215 | 209 | ||
216 | bool ONetworkInterface::ioctl( int call, struct ifreq& ifreq ) const | 210 | bool ONetworkInterface::ioctl( int call, struct ifreq& ifreq ) const |
217 | { | 211 | { |
@@ -261,35 +255,28 @@ bool ONetworkInterface::isUp() const | |||
261 | 255 | ||
262 | 256 | ||
263 | void ONetworkInterface::setIPV4Address( const QHostAddress& addr ) | 257 | void ONetworkInterface::setIPV4Address( const QHostAddress& addr ) |
264 | { | 258 | { |
265 | struct sockaddr_in *sa = (struct sockaddr_in *) &_ifr.ifr_addr; | 259 | struct sockaddr_in *sa = (struct sockaddr_in *) &_ifr.ifr_addr; |
266 | sa->sin_family = AF_INET; | 260 | sa->sin_family = AF_INET; |
267 | sa->sin_port = 0; | 261 | sa->sin_port = 0; |
268 | sa->sin_addr.s_addr = htonl( addr.ip4Addr() ); | 262 | sa->sin_addr.s_addr = htonl( addr.ip4Addr() ); |
269 | ioctl( SIOCSIFADDR ); | 263 | ioctl( SIOCSIFADDR ); |
270 | } | 264 | } |
271 | 265 | ||
272 | 266 | ||
273 | QString ONetworkInterface::ipV4Address() const | 267 | OHostAddress ONetworkInterface::ipV4Address() const |
274 | { | 268 | { |
275 | if ( ioctl( SIOCGIFADDR ) ) | 269 | struct sockaddr_in* sa = (struct sockaddr_in *) &_ifr.ifr_addr; |
276 | { | 270 | return ioctl( SIOCGIFADDR ) ? OHostAddress( ntohl( sa->sin_addr.s_addr ) ) : OHostAddress(); |
277 | struct sockaddr_in* sa = (struct sockaddr_in *) &_ifr.ifr_addr; | ||
278 | //FIXME: Use QHostAddress here | ||
279 | return QString( inet_ntoa( sa->sin_addr ) ); | ||
280 | } | ||
281 | else | ||
282 | return "<unknown>"; | ||
283 | |||
284 | } | 271 | } |
285 | 272 | ||
286 | 273 | ||
287 | void ONetworkInterface::setMacAddress( const OMacAddress& addr ) | 274 | void ONetworkInterface::setMacAddress( const OMacAddress& addr ) |
288 | { | 275 | { |
289 | _ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER; | 276 | _ifr.ifr_hwaddr.sa_family = ARPHRD_ETHER; |
290 | memcpy( &_ifr.ifr_hwaddr.sa_data, addr.native(), 6 ); | 277 | memcpy( &_ifr.ifr_hwaddr.sa_data, addr.native(), 6 ); |
291 | ioctl( SIOCSIFHWADDR ); | 278 | ioctl( SIOCSIFHWADDR ); |
292 | } | 279 | } |
293 | 280 | ||
294 | 281 | ||
295 | OMacAddress ONetworkInterface::macAddress() const | 282 | OMacAddress ONetworkInterface::macAddress() const |
@@ -306,34 +293,28 @@ OMacAddress ONetworkInterface::macAddress() const | |||
306 | 293 | ||
307 | 294 | ||
308 | void ONetworkInterface::setIPV4Netmask( const QHostAddress& addr ) | 295 | void ONetworkInterface::setIPV4Netmask( const QHostAddress& addr ) |
309 | { | 296 | { |
310 | struct sockaddr_in *sa = (struct sockaddr_in *) &_ifr.ifr_addr; | 297 | struct sockaddr_in *sa = (struct sockaddr_in *) &_ifr.ifr_addr; |
311 | sa->sin_family = AF_INET; | 298 | sa->sin_family = AF_INET; |
312 | sa->sin_port = 0; | 299 | sa->sin_port = 0; |
313 | sa->sin_addr.s_addr = htonl( addr.ip4Addr() ); | 300 | sa->sin_addr.s_addr = htonl( addr.ip4Addr() ); |
314 | ioctl( SIOCSIFNETMASK ); | 301 | ioctl( SIOCSIFNETMASK ); |
315 | } | 302 | } |
316 | 303 | ||
317 | 304 | ||
318 | QString ONetworkInterface::ipV4Netmask() const | 305 | OHostAddress ONetworkInterface::ipV4Netmask() const |
319 | { | 306 | { |
320 | if ( ioctl( SIOCGIFNETMASK ) ) | 307 | struct sockaddr_in* sa = (struct sockaddr_in *) &_ifr.ifr_addr; |
321 | { | 308 | return ioctl( SIOCGIFNETMASK ) ? OHostAddress( ntohl( sa->sin_addr.s_addr ) ) : OHostAddress(); |
322 | struct sockaddr_in* sa = (struct sockaddr_in *) &_ifr.ifr_addr; | ||
323 | //FIXME: Use QHostAddress here | ||
324 | return QString( inet_ntoa( sa->sin_addr ) ); | ||
325 | } | ||
326 | else | ||
327 | return "<unknown>"; | ||
328 | } | 309 | } |
329 | 310 | ||
330 | 311 | ||
331 | int ONetworkInterface::dataLinkType() const | 312 | int ONetworkInterface::dataLinkType() const |
332 | { | 313 | { |
333 | if ( ioctl( SIOCGIFHWADDR ) ) | 314 | if ( ioctl( SIOCGIFHWADDR ) ) |
334 | { | 315 | { |
335 | return _ifr.ifr_hwaddr.sa_family; | 316 | return _ifr.ifr_hwaddr.sa_family; |
336 | } | 317 | } |
337 | else | 318 | else |
338 | { | 319 | { |
339 | return -1; | 320 | return -1; |
@@ -538,25 +519,33 @@ void OWirelessNetworkInterface::buildInformation() | |||
538 | //ML: driver pollutes this extra space. The complaint will be made on stdout, | 519 | //ML: driver pollutes this extra space. The complaint will be made on stdout, |
539 | //ML: so please forward this... | 520 | //ML: so please forward this... |
540 | 521 | ||
541 | struct iwreq wrq; | 522 | struct iwreq wrq; |
542 | int len = sizeof( struct iw_range )*2; | 523 | int len = sizeof( struct iw_range )*2; |
543 | char buffer[len]; | 524 | char buffer[len]; |
544 | memset( buffer, 0, len ); | 525 | memset( buffer, 0, len ); |
545 | memcpy( wrq.ifr_name, name(), IFNAMSIZ); | 526 | memcpy( wrq.ifr_name, name(), IFNAMSIZ); |
546 | wrq.u.data.pointer = (caddr_t) buffer; | 527 | wrq.u.data.pointer = (caddr_t) buffer; |
547 | wrq.u.data.length = sizeof buffer; | 528 | wrq.u.data.length = sizeof buffer; |
548 | wrq.u.data.flags = 0; | 529 | wrq.u.data.flags = 0; |
549 | 530 | ||
550 | if ( ::ioctl( _sfd, SIOCGIWRANGE, &wrq ) == -1 ) | 531 | int result = ::ioctl( _sfd, SIOCGIWRANGE, &wrq ); |
532 | if ( result == -1 ) | ||
533 | { | ||
534 | owarn << "OWirelessNetworkInterface::buildInformation(): SIOCGIWRANGE failed (" << strerror( errno ) << ") - retrying with smaller buffer..." << oendl; | ||
535 | wrq.u.data.length = sizeof( struct iw_range ); | ||
536 | result = ::ioctl( _sfd, SIOCGIWRANGE, &wrq ); | ||
537 | } | ||
538 | |||
539 | if ( result == -1 ) | ||
551 | { | 540 | { |
552 | owarn << "OWirelessNetworkInterface::buildInformation(): Can't get driver information (" << strerror( errno ) << ") - using default values." << oendl; | 541 | owarn << "OWirelessNetworkInterface::buildInformation(): Can't get driver information (" << strerror( errno ) << ") - using default values." << oendl; |
553 | _channels.insert( 2412, 1 ); // 2.412 GHz | 542 | _channels.insert( 2412, 1 ); // 2.412 GHz |
554 | _channels.insert( 2417, 2 ); // 2.417 GHz | 543 | _channels.insert( 2417, 2 ); // 2.417 GHz |
555 | _channels.insert( 2422, 3 ); // 2.422 GHz | 544 | _channels.insert( 2422, 3 ); // 2.422 GHz |
556 | _channels.insert( 2427, 4 ); // 2.427 GHz | 545 | _channels.insert( 2427, 4 ); // 2.427 GHz |
557 | _channels.insert( 2432, 5 ); // 2.432 GHz | 546 | _channels.insert( 2432, 5 ); // 2.432 GHz |
558 | _channels.insert( 2437, 6 ); // 2.437 GHz | 547 | _channels.insert( 2437, 6 ); // 2.437 GHz |
559 | _channels.insert( 2442, 7 ); // 2.442 GHz | 548 | _channels.insert( 2442, 7 ); // 2.442 GHz |
560 | _channels.insert( 2447, 8 ); // 2.447 GHz | 549 | _channels.insert( 2447, 8 ); // 2.447 GHz |
561 | _channels.insert( 2452, 9 ); // 2.452 GHz | 550 | _channels.insert( 2452, 9 ); // 2.452 GHz |
562 | _channels.insert( 2457, 10 ); // 2.457 GHz | 551 | _channels.insert( 2457, 10 ); // 2.457 GHz |
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index f0c4450..b13c7a3 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h | |||
@@ -1,16 +1,15 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2003-2005 by Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | =. Copyright (C) 2003-2005 by Michael 'Mickey' Lauer <mickey@Vanille.de> |
4 | =. | ||
5 | .=l. | 4 | .=l. |
6 | .>+-= | 5 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; version 2 of the License. | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
12 | ._= =} : | 11 | ._= =} : |
13 | .%`+i> _;_. | 12 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
@@ -189,44 +188,44 @@ class ONetworkInterface : public QObject | |||
189 | bool isLoopback() const; | 188 | bool isLoopback() const; |
190 | /** | 189 | /** |
191 | * @returns true if the interface is featuring supports the wireless extension protocol. | 190 | * @returns true if the interface is featuring supports the wireless extension protocol. |
192 | */ | 191 | */ |
193 | bool isWireless() const; | 192 | bool isWireless() const; |
194 | /** | 193 | /** |
195 | * Associate the IP address @ addr with the interface. | 194 | * Associate the IP address @ addr with the interface. |
196 | */ | 195 | */ |
197 | void setIPV4Address( const QHostAddress& addr ); | 196 | void setIPV4Address( const QHostAddress& addr ); |
198 | /** | 197 | /** |
199 | * @returns the IPv4 address associated with the interface. | 198 | * @returns the IPv4 address associated with the interface. |
200 | */ | 199 | */ |
201 | QString ipV4Address() const; //TODO: make this return an OHostAddress | 200 | OHostAddress ipV4Address() const; |
202 | /** | 201 | /** |
203 | * Associate the MAC address @a addr with the interface. | 202 | * Associate the MAC address @a addr with the interface. |
204 | * @note It can be necessary to shut down the interface prior to calling this method. | 203 | * @note It can be necessary to shut down the interface prior to calling this method. |
205 | * @note This operation needs root privileges | 204 | * @note This operation needs root privileges |
206 | * @warning This is not supported by all drivers. | 205 | * @warning This is not supported by all drivers. |
207 | */ | 206 | */ |
208 | void setMacAddress( const OMacAddress& addr ); | 207 | void setMacAddress( const OMacAddress& addr ); |
209 | /** | 208 | /** |
210 | * @returns the MAC address associated with the interface. | 209 | * @returns the MAC address associated with the interface. |
211 | */ | 210 | */ |
212 | OMacAddress macAddress() const; | 211 | OMacAddress macAddress() const; |
213 | /** | 212 | /** |
214 | * Associate the IPv4 @a netmask with the interface. | 213 | * Associate the IPv4 @a netmask with the interface. |
215 | */ | 214 | */ |
216 | void setIPV4Netmask( const QHostAddress& netmask ); | 215 | void setIPV4Netmask( const QHostAddress& netmask ); |
217 | /** | 216 | /** |
218 | * @returns the IPv4 netmask associated with the interface. | 217 | * @returns the IPv4 netmask associated with the interface. |
219 | */ | 218 | */ |
220 | QString ipV4Netmask() const; //TODO: make this return an OHostAddress | 219 | OHostAddress ipV4Netmask() const; |
221 | /** | 220 | /** |
222 | * @returns the data link type currently associated with the interface. | 221 | * @returns the data link type currently associated with the interface. |
223 | * @see #include <net/if_arp.h> for possible values. | 222 | * @see #include <net/if_arp.h> for possible values. |
224 | */ | 223 | */ |
225 | int dataLinkType() const; | 224 | int dataLinkType() const; |
226 | /** | 225 | /** |
227 | * @returns a ONetworkInterfaceDriverInfo driver information block | 226 | * @returns a ONetworkInterfaceDriverInfo driver information block |
228 | * @note This operation needs root privileges | 227 | * @note This operation needs root privileges |
229 | * @warning This is not supported by all drivers | 228 | * @warning This is not supported by all drivers |
230 | */ | 229 | */ |
231 | ONetworkInterfaceDriverInfo driverInfo() const; | 230 | ONetworkInterfaceDriverInfo driverInfo() const; |
232 | 231 | ||