-rw-r--r-- | libopie2/opienet/onetwork.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libopie2/opienet/onetwork.h b/libopie2/opienet/onetwork.h index b13c7a3..370ad59 100644 --- a/libopie2/opienet/onetwork.h +++ b/libopie2/opienet/onetwork.h | |||
@@ -1,143 +1,144 @@ | |||
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 | .=l. | 4 | .=l. |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; version 2 of the License. | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
11 | ._= =} : | 11 | ._= =} : |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
18 | ..}^=.= = ; Library General Public License for more | 18 | ..}^=.= = ; Library General Public License for more |
19 | ++= -. .` .: details. | 19 | ++= -. .` .: details. |
20 | : = ...= . :.=- | 20 | : = ...= . :.=- |
21 | -. .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
22 | -_. . . )=. = Library General Public License along with | 22 | -_. . . )=. = Library General Public License along with |
23 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
24 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
25 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #ifndef ONETWORK_H | 30 | #ifndef ONETWORK_H |
31 | #define ONETWORK_H | 31 | #define ONETWORK_H |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie2/onetutils.h> | 34 | #include <opie2/onetutils.h> |
35 | #include <opie2/ostation.h> | 35 | #include <opie2/ostation.h> |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | #include <qvaluelist.h> | 38 | #include <qvaluelist.h> |
39 | #include <qdict.h> | 39 | #include <qdict.h> |
40 | #include <qmap.h> | 40 | #include <qmap.h> |
41 | #include <qobject.h> | 41 | #include <qobject.h> |
42 | #include <qhostaddress.h> | 42 | #include <qhostaddress.h> |
43 | 43 | ||
44 | /* STD */ | 44 | /* STD */ |
45 | // hacky workarounds until we have a true user space wireless.h | 45 | // hacky workarounds until we have a true user space wireless.h |
46 | #include <net/if.h> | 46 | #include <net/if.h> |
47 | #define _LINUX_IF_H | 47 | #define _LINUX_IF_H |
48 | #include <linux/types.h> | ||
48 | #include <linux/wireless.h> | 49 | #include <linux/wireless.h> |
49 | #ifndef IW_MAX_PRIV_DEF | 50 | #ifndef IW_MAX_PRIV_DEF |
50 | #define IW_MAX_PRIV_DEF 128 | 51 | #define IW_MAX_PRIV_DEF 128 |
51 | #endif | 52 | #endif |
52 | 53 | ||
53 | namespace Opie { | 54 | namespace Opie { |
54 | namespace Net { | 55 | namespace Net { |
55 | class ONetworkInterface; | 56 | class ONetworkInterface; |
56 | class OWirelessNetworkInterface; | 57 | class OWirelessNetworkInterface; |
57 | class OChannelHopper; | 58 | class OChannelHopper; |
58 | class OMonitoringInterface; | 59 | class OMonitoringInterface; |
59 | 60 | ||
60 | /*====================================================================================== | 61 | /*====================================================================================== |
61 | * ONetwork | 62 | * ONetwork |
62 | *======================================================================================*/ | 63 | *======================================================================================*/ |
63 | 64 | ||
64 | /** | 65 | /** |
65 | * @brief A container class for all network interfaces | 66 | * @brief A container class for all network interfaces |
66 | * | 67 | * |
67 | * This class provides access to all available network interfaces of your computer. | 68 | * This class provides access to all available network interfaces of your computer. |
68 | * | 69 | * |
69 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> | 70 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> |
70 | */ | 71 | */ |
71 | class ONetwork : public QObject | 72 | class ONetwork : public QObject |
72 | { | 73 | { |
73 | Q_OBJECT | 74 | Q_OBJECT |
74 | 75 | ||
75 | public: | 76 | public: |
76 | typedef QDict<ONetworkInterface> InterfaceMap; | 77 | typedef QDict<ONetworkInterface> InterfaceMap; |
77 | typedef QDictIterator<ONetworkInterface> InterfaceIterator; | 78 | typedef QDictIterator<ONetworkInterface> InterfaceIterator; |
78 | 79 | ||
79 | public: | 80 | public: |
80 | /** | 81 | /** |
81 | * @returns the number of available interfaces | 82 | * @returns the number of available interfaces |
82 | */ | 83 | */ |
83 | int count() const; | 84 | int count() const; |
84 | /** | 85 | /** |
85 | * @returns a pointer to the (one and only) @ref ONetwork instance. | 86 | * @returns a pointer to the (one and only) @ref ONetwork instance. |
86 | */ | 87 | */ |
87 | static ONetwork* instance(); | 88 | static ONetwork* instance(); |
88 | /** | 89 | /** |
89 | * @returns an iterator usable for iterating through all network interfaces. | 90 | * @returns an iterator usable for iterating through all network interfaces. |
90 | */ | 91 | */ |
91 | InterfaceIterator iterator() const; | 92 | InterfaceIterator iterator() const; |
92 | /** | 93 | /** |
93 | * @returns true, if the @a interface is present. | 94 | * @returns true, if the @a interface is present. |
94 | */ | 95 | */ |
95 | bool isPresent( const char* interface ) const; | 96 | bool isPresent( const char* interface ) const; |
96 | /** | 97 | /** |
97 | * @returns true, if the @a interface supports the wireless extension protocol. | 98 | * @returns true, if the @a interface supports the wireless extension protocol. |
98 | */ | 99 | */ |
99 | bool isWirelessInterface( const char* interface ) const; | 100 | bool isWirelessInterface( const char* interface ) const; |
100 | /** | 101 | /** |
101 | * @returns a pointer to the @ref ONetworkInterface object for the specified @a interface or 0, if not found. | 102 | * @returns a pointer to the @ref ONetworkInterface object for the specified @a interface or 0, if not found. |
102 | * @see ONetworkInterface | 103 | * @see ONetworkInterface |
103 | */ | 104 | */ |
104 | ONetworkInterface* interface( const QString& interface ) const; | 105 | ONetworkInterface* interface( const QString& interface ) const; |
105 | /** | 106 | /** |
106 | * @internal Rebuild the internal interface database | 107 | * @internal Rebuild the internal interface database |
107 | * @note Sometimes it might be useful to call this from client code, | 108 | * @note Sometimes it might be useful to call this from client code, |
108 | * e.g. after issuing a cardctl insert | 109 | * e.g. after issuing a cardctl insert |
109 | */ | 110 | */ |
110 | void synchronize(); | 111 | void synchronize(); |
111 | /** | 112 | /** |
112 | * @returns the wireless extension version used at compile time. | 113 | * @returns the wireless extension version used at compile time. |
113 | **/ | 114 | **/ |
114 | static short wirelessExtensionCompileVersion(); | 115 | static short wirelessExtensionCompileVersion(); |
115 | 116 | ||
116 | protected: | 117 | protected: |
117 | ONetwork(); | 118 | ONetwork(); |
118 | 119 | ||
119 | private: | 120 | private: |
120 | static ONetwork* _instance; | 121 | static ONetwork* _instance; |
121 | InterfaceMap _interfaces; | 122 | InterfaceMap _interfaces; |
122 | class Private; | 123 | class Private; |
123 | Private *d; | 124 | Private *d; |
124 | }; | 125 | }; |
125 | 126 | ||
126 | 127 | ||
127 | /*====================================================================================== | 128 | /*====================================================================================== |
128 | * ONetworkInterface | 129 | * ONetworkInterface |
129 | *======================================================================================*/ | 130 | *======================================================================================*/ |
130 | 131 | ||
131 | /** | 132 | /** |
132 | * @brief A network interface wrapper. | 133 | * @brief A network interface wrapper. |
133 | * | 134 | * |
134 | * This class provides a wrapper for a network interface. All the cumbersume details of | 135 | * This class provides a wrapper for a network interface. All the cumbersume details of |
135 | * Linux ioctls are hidden under a convenient high-level interface. | 136 | * Linux ioctls are hidden under a convenient high-level interface. |
136 | * @warning Most of the setting methods contained in this class require the appropriate | 137 | * @warning Most of the setting methods contained in this class require the appropriate |
137 | * process permissions to work. | 138 | * process permissions to work. |
138 | * | 139 | * |
139 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> | 140 | * @author Michael 'Mickey' Lauer <mickey@vanille.de> |
140 | */ | 141 | */ |
141 | class ONetworkInterface : public QObject | 142 | class ONetworkInterface : public QObject |
142 | { | 143 | { |
143 | friend class OMonitoringInterface; | 144 | friend class OMonitoringInterface; |