use nvram binary only for 2.4.30 system at the moment
[openwrt.git] / package / net-snmp / patches / 750-ieee802dot11.patch
1 --- net-snmp-5.1.2-orig/agent/mibgroup/ieee802dot11.c 1970-01-01 01:00:00.000000000 +0100
2 +++ net-snmp-5.1.2-5/agent/mibgroup/ieee802dot11.c 2005-03-13 16:17:21.000000000 +0100
3 @@ -0,0 +1,4915 @@
4 +/****************************************************************************
5 +* *
6 +* File Name: ieee802dot11.c *
7 +* Used By: *
8 +* *
9 +* Operating System: *
10 +* Purpose: *
11 +* *
12 +* Comments: *
13 +* *
14 +* Author: Larry Simmons *
15 +* lsimmons@avantcom.com *
16 +* www.avantcom.com *
17 +* *
18 +* Creation Date: 09/02/03 *
19 +* *
20 +* Ver Date Inits Modification *
21 +* ----- -------- ----- ------------ *
22 +* 0.0.1 09/02/03 LRS created *
23 +* 0.0.2 09/24/03 LRS wouldn't build after fresh ./configure *
24 +****************************************************************************/
25 +/****************************************************************************
26 +* Includes *
27 +****************************************************************************/
28 +#include <net-snmp/net-snmp-config.h>
29 +#include <net-snmp/net-snmp-includes.h>
30 +#include <net-snmp/agent/net-snmp-agent-includes.h>
31 +#include "ieee802dot11.h"
32 +#include "iwlib.h"
33 +
34 +/****************************************************************************
35 +* Defines *
36 +****************************************************************************/
37 +#define DISPLAYWIEXT // display wireless ext info
38 +#define TABLE_SIZE 1
39 +//#define MINLOADFREQ 15 // min reload frequency in seconds
40 +#define MINLOADFREQ 5 // min reload frequency in seconds // for testing
41 +#define PROC_NET_DEV "/proc/net/dev"
42 +#define PROC_NET_WIRELESS "/proc/net/wireless"
43 +
44 +#ifndef UCHAR
45 + typedef unsigned char UCHAR;
46 +#endif
47 +
48 +/****************************************************************************
49 +* Private Functions *
50 +****************************************************************************/
51 +static void loadTables();
52 +static void loadWiExt ( int, char *, struct wireless_info * );
53 +static void load80211Structs ( int, char *, struct wireless_info * );
54 +static void initStructs();
55 +
56 +// Wireless Extensions Specific Functions
57 +static void loadWiExtTo80211Structs ( int, char *, struct wireless_info * );
58 +static void displayWiExt ( struct wireless_info );
59 +
60 +// Linked List Functions
61 +static void addList ( char *, char *, int );
62 +static void initLists(); // initialize all the linked lists
63 +static void flushLists(); // flush all the linked lists
64 +static void flushList ( char * ); // flush a single linked list
65 +
66 +// Utility Functions
67 +static int openSocket ( void );
68 +static int mWatt2dbm ( int );
69 +static char *htob ( char * );
70 +static int hasChanged ( char *, int );
71 +
72 +/****************************************************************************
73 +* Private Variables *
74 +****************************************************************************/
75 +static unsigned long lastLoad = 0; // ET in secs at last table load
76 +
77 +static struct avNode *lastNode, *newNode, *np;
78 +
79 +/****************************************************************************
80 +* External Functions *
81 +****************************************************************************/
82 +
83 +/****************************************************************************
84 +* ieee802dot11_variables_oid: *
85 +* this is the top level oid that we want to register under. This *
86 +* is essentially a prefix, with the suffix appearing in the *
87 +* variable below. *
88 +****************************************************************************/
89 +oid ieee802dot11_variables_oid[] = { 1,2,840,10036 };
90 +
91 +/****************************************************************************
92 +* variable7 ieee802dot11_variables: *
93 +* this variable defines function callbacks and type return information *
94 +* for the ieee802dot11 mib section *
95 +****************************************************************************/
96 +struct variable7 ieee802dot11_variables[] = {
97 +/* magic number , variable type , ro/rw , callback fn , L, oidsuffix */
98 +#define DOT11STATIONID 3
99 + { DOT11STATIONID , ASN_OCTET_STR , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,1 } },
100 +#define DOT11MEDIUMOCCUPANCYLIMIT 4
101 + { DOT11MEDIUMOCCUPANCYLIMIT, ASN_INTEGER , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,2 } },
102 +#define DOT11CFPOLLABLE 5
103 + { DOT11CFPOLLABLE , ASN_INTEGER , RONLY , var_dot11StationConfigTable, 4, { 1,1,1,3 } },
104 +#define DOT11CFPPERIOD 6
105 + { DOT11CFPPERIOD , ASN_INTEGER , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,4 } },
106 +#define DOT11CFPMAXDURATION 7
107 + { DOT11CFPMAXDURATION , ASN_INTEGER , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,5 } },
108 +#define DOT11AUTHENTICATIONRESPONSETIMEOUT 8
109 + { DOT11AUTHENTICATIONRESPONSETIMEOUT, ASN_INTEGER , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,6 } },
110 +#define DOT11PRIVACYOPTIONIMPLEMENTED 9
111 + { DOT11PRIVACYOPTIONIMPLEMENTED, ASN_INTEGER , RONLY , var_dot11StationConfigTable, 4, { 1,1,1,7 } },
112 +#define DOT11POWERMANAGEMENTMODE 10
113 + { DOT11POWERMANAGEMENTMODE, ASN_INTEGER , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,8 } },
114 +#define DOT11DESIREDSSID 11
115 + { DOT11DESIREDSSID , ASN_OCTET_STR , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,9 } },
116 +#define DOT11DESIREDBSSTYPE 12
117 + { DOT11DESIREDBSSTYPE , ASN_INTEGER , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,10 } },
118 +#define DOT11OPERATIONALRATESET 13
119 + { DOT11OPERATIONALRATESET, ASN_OCTET_STR , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,11 } },
120 +#define DOT11BEACONPERIOD 14
121 + { DOT11BEACONPERIOD , ASN_INTEGER , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,12 } },
122 +#define DOT11DTIMPERIOD 15
123 + { DOT11DTIMPERIOD , ASN_INTEGER , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,13 } },
124 +#define DOT11ASSOCIATIONRESPONSETIMEOUT 16
125 + { DOT11ASSOCIATIONRESPONSETIMEOUT, ASN_INTEGER , RWRITE, var_dot11StationConfigTable, 4, { 1,1,1,14 } },
126 +#define DOT11DISASSOCIATEREASON 17
127 + { DOT11DISASSOCIATEREASON, ASN_INTEGER , RONLY , var_dot11StationConfigTable, 4, { 1,1,1,15 } },
128 +#define DOT11DISASSOCIATESTATION 18
129 + { DOT11DISASSOCIATESTATION, ASN_OCTET_STR , RONLY , var_dot11StationConfigTable, 4, { 1,1,1,16 } },
130 +#define DOT11DEAUTHENTICATEREASON 19
131 + { DOT11DEAUTHENTICATEREASON, ASN_INTEGER , RONLY , var_dot11StationConfigTable, 4, { 1,1,1,17 } },
132 +#define DOT11DEAUTHENTICATESTATION 20
133 + { DOT11DEAUTHENTICATESTATION, ASN_OCTET_STR , RONLY , var_dot11StationConfigTable, 4, { 1,1,1,18 } },
134 +#define DOT11AUTHENTICATEFAILSTATUS 21
135 + { DOT11AUTHENTICATEFAILSTATUS, ASN_INTEGER , RONLY , var_dot11StationConfigTable, 4, { 1,1,1,19 } },
136 +#define DOT11AUTHENTICATEFAILSTATION 22
137 + { DOT11AUTHENTICATEFAILSTATION, ASN_OCTET_STR , RONLY , var_dot11StationConfigTable, 4, { 1,1,1,20 } },
138 +
139 +#define DOT11AUTHENTICATIONALGORITHM 26
140 + { DOT11AUTHENTICATIONALGORITHM, ASN_INTEGER , RONLY , var_dot11AuthenticationAlgorithmsTable, 4, { 1,2,1,2 } },
141 +#define DOT11AUTHENTICATIONALGORITHMSENABLE 27
142 + { DOT11AUTHENTICATIONALGORITHMSENABLE, ASN_INTEGER , RWRITE, var_dot11AuthenticationAlgorithmsTable, 4, { 1,2,1,3 } },
143 +
144 +#define DOT11WEPDEFAULTKEYVALUE 31
145 + { DOT11WEPDEFAULTKEYVALUE, ASN_OCTET_STR , RWRITE, var_dot11WEPDefaultKeysTable, 4, { 1,3,1,2 } },
146 +
147 +#define DOT11WEPKEYMAPPINGADDRESS 35
148 + { DOT11WEPKEYMAPPINGADDRESS, ASN_OCTET_STR , RWRITE, var_dot11WEPKeyMappingsTable, 4, { 1,4,1,2 } },
149 +#define DOT11WEPKEYMAPPINGWEPON 36
150 + { DOT11WEPKEYMAPPINGWEPON, ASN_INTEGER , RWRITE, var_dot11WEPKeyMappingsTable, 4, { 1,4,1,3 } },
151 +#define DOT11WEPKEYMAPPINGVALUE 37
152 + { DOT11WEPKEYMAPPINGVALUE, ASN_OCTET_STR , RWRITE, var_dot11WEPKeyMappingsTable, 4, { 1,4,1,4 } },
153 +#define DOT11WEPKEYMAPPINGSTATUS 38
154 + { DOT11WEPKEYMAPPINGSTATUS, ASN_INTEGER , RWRITE, var_dot11WEPKeyMappingsTable, 4, { 1,4,1,5 } },
155 +
156 +#define DOT11PRIVACYINVOKED 41
157 + { DOT11PRIVACYINVOKED , ASN_INTEGER , RWRITE, var_dot11PrivacyTable, 4, { 1,5,1,1 } },
158 +#define DOT11WEPDEFAULTKEYID 42
159 + { DOT11WEPDEFAULTKEYID, ASN_INTEGER , RWRITE, var_dot11PrivacyTable, 4, { 1,5,1,2 } },
160 +#define DOT11WEPKEYMAPPINGLENGTH 43
161 + { DOT11WEPKEYMAPPINGLENGTH, ASN_INTEGER , RWRITE, var_dot11PrivacyTable, 4, { 1,5,1,3 } },
162 +#define DOT11EXCLUDEUNENCRYPTED 44
163 + { DOT11EXCLUDEUNENCRYPTED, ASN_INTEGER , RWRITE, var_dot11PrivacyTable, 4, { 1,5,1,4 } },
164 +#define DOT11WEPICVERRORCOUNT 45
165 + { DOT11WEPICVERRORCOUNT, ASN_COUNTER , RONLY , var_dot11PrivacyTable, 4, { 1,5,1,5 } },
166 +#define DOT11WEPEXCLUDEDCOUNT 46
167 + { DOT11WEPEXCLUDEDCOUNT, ASN_COUNTER , RONLY , var_dot11PrivacyTable, 4, { 1,5,1,6 } },
168 +
169 +#define DOT11MACADDRESS 49
170 + { DOT11MACADDRESS , ASN_OCTET_STR , RONLY , var_dot11OperationTable, 4, { 2,1,1,1 } },
171 +#define DOT11RTSTHRESHOLD 50
172 + { DOT11RTSTHRESHOLD , ASN_INTEGER , RWRITE, var_dot11OperationTable, 4, { 2,1,1,2 } },
173 +#define DOT11SHORTRETRYLIMIT 51
174 + { DOT11SHORTRETRYLIMIT, ASN_INTEGER , RWRITE, var_dot11OperationTable, 4, { 2,1,1,3 } },
175 +#define DOT11LONGRETRYLIMIT 52
176 + { DOT11LONGRETRYLIMIT , ASN_INTEGER , RWRITE, var_dot11OperationTable, 4, { 2,1,1,4 } },
177 +#define DOT11FRAGMENTATIONTHRESHOLD 53
178 + { DOT11FRAGMENTATIONTHRESHOLD, ASN_INTEGER , RWRITE, var_dot11OperationTable, 4, { 2,1,1,5 } },
179 +#define DOT11MAXTRANSMITMSDULIFETIME 54
180 + { DOT11MAXTRANSMITMSDULIFETIME, ASN_INTEGER , RWRITE, var_dot11OperationTable, 4, { 2,1,1,6 } },
181 +#define DOT11MAXRECEIVELIFETIME 55
182 + { DOT11MAXRECEIVELIFETIME, ASN_INTEGER , RWRITE, var_dot11OperationTable, 4, { 2,1,1,7 } },
183 +#define DOT11MANUFACTURERID 56
184 + { DOT11MANUFACTURERID , ASN_OCTET_STR , RONLY , var_dot11OperationTable, 4, { 2,1,1,8 } },
185 +#define DOT11PRODUCTID 57
186 + { DOT11PRODUCTID , ASN_OCTET_STR , RONLY , var_dot11OperationTable, 4, { 2,1,1,9 } },
187 +
188 +#define DOT11TRANSMITTEDFRAGMENTCOUNT 60
189 + { DOT11TRANSMITTEDFRAGMENTCOUNT, ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,1 } },
190 +#define DOT11MULTICASTTRANSMITTEDFRAMECOUNT 61
191 + { DOT11MULTICASTTRANSMITTEDFRAMECOUNT, ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,2 } },
192 +#define DOT11FAILEDCOUNT 62
193 + { DOT11FAILEDCOUNT , ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,3 } },
194 +#define DOT11RETRYCOUNT 63
195 + { DOT11RETRYCOUNT , ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,4 } },
196 +#define DOT11MULTIPLERETRYCOUNT 64
197 + { DOT11MULTIPLERETRYCOUNT, ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,5 } },
198 +#define DOT11FRAMEDUPLICATECOUNT 65
199 + { DOT11FRAMEDUPLICATECOUNT, ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,6 } },
200 +#define DOT11RTSSUCCESSCOUNT 66
201 + { DOT11RTSSUCCESSCOUNT, ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,7 } },
202 +#define DOT11RTSFAILURECOUNT 67
203 + { DOT11RTSFAILURECOUNT, ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,8 } },
204 +#define DOT11ACKFAILURECOUNT 68
205 + { DOT11ACKFAILURECOUNT, ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,9 } },
206 +#define DOT11RECEIVEDFRAGMENTCOUNT 69
207 + { DOT11RECEIVEDFRAGMENTCOUNT, ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,10 } },
208 +#define DOT11MULTICASTRECEIVEDFRAMECOUNT 70
209 + { DOT11MULTICASTRECEIVEDFRAMECOUNT, ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,11 } },
210 +#define DOT11FCSERRORCOUNT 71
211 + { DOT11FCSERRORCOUNT , ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,12 } },
212 +#define DOT11TRANSMITTEDFRAMECOUNT 72
213 + { DOT11TRANSMITTEDFRAMECOUNT, ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,13 } },
214 +#define DOT11WEPUNDECRYPTABLECOUNT 73
215 + { DOT11WEPUNDECRYPTABLECOUNT, ASN_COUNTER , RONLY , var_dot11CountersTable, 4, { 2,2,1,14 } },
216 +
217 +#define DOT11ADDRESS 77
218 + { DOT11ADDRESS , ASN_OCTET_STR , RWRITE, var_dot11GroupAddressesTable, 4, { 2,3,1,2 } },
219 +#define DOT11GROUPADDRESSESSTATUS 78
220 + { DOT11GROUPADDRESSESSTATUS, ASN_INTEGER , RWRITE, var_dot11GroupAddressesTable, 4, { 2,3,1,3 } },
221 +
222 +#define DOT11RESOURCETYPEIDNAME 79
223 + { DOT11RESOURCETYPEIDNAME, ASN_OCTET_STR , RONLY , var_ieee802dot11, 3, { 3,1,1 } },
224 +#define DOT11MANUFACTUREROUI 82
225 + { DOT11MANUFACTUREROUI, ASN_OCTET_STR , RONLY , var_dot11ResourceInfoTable, 5, { 3,1,2,1,1 } },
226 +#define DOT11MANUFACTURERNAME 83
227 + { DOT11MANUFACTURERNAME, ASN_OCTET_STR , RONLY , var_dot11ResourceInfoTable, 5, { 3,1,2,1,2 } },
228 +#define DOT11MANUFACTURERPRODUCTNAME 84
229 + { DOT11MANUFACTURERPRODUCTNAME, ASN_OCTET_STR , RONLY , var_dot11ResourceInfoTable, 5, { 3,1,2,1,3 } },
230 +#define DOT11MANUFACTURERPRODUCTVERSION 85
231 + { DOT11MANUFACTURERPRODUCTVERSION, ASN_OCTET_STR , RONLY , var_dot11ResourceInfoTable, 5, { 3,1,2,1,4 } },
232 +
233 +#define DOT11PHYTYPE 88
234 + { DOT11PHYTYPE , ASN_INTEGER , RONLY , var_dot11PhyOperationTable, 4, { 4,1,1,1 } },
235 +#define DOT11CURRENTREGDOMAIN 89
236 + { DOT11CURRENTREGDOMAIN, ASN_INTEGER , RWRITE, var_dot11PhyOperationTable, 4, { 4,1,1,2 } },
237 +#define DOT11TEMPTYPE 90
238 + { DOT11TEMPTYPE , ASN_INTEGER , RONLY , var_dot11PhyOperationTable, 4, { 4,1,1,3 } },
239 +#define DOT11CURRENTTXANTENNA 93
240 + { DOT11CURRENTTXANTENNA, ASN_INTEGER , RWRITE, var_dot11PhyAntennaTable, 4, { 4,2,1,1 } },
241 +#define DOT11DIVERSITYSUPPORT 94
242 + { DOT11DIVERSITYSUPPORT, ASN_INTEGER , RONLY , var_dot11PhyAntennaTable, 4, { 4,2,1,2 } },
243 +#define DOT11CURRENTRXANTENNA 95
244 + { DOT11CURRENTRXANTENNA, ASN_INTEGER , RWRITE, var_dot11PhyAntennaTable, 4, { 4,2,1,3 } },
245 +#define DOT11NUMBERSUPPORTEDPOWERLEVELS 98
246 + { DOT11NUMBERSUPPORTEDPOWERLEVELS, ASN_INTEGER , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,1 } },
247 +#define DOT11TXPOWERLEVEL1 99
248 + { DOT11TXPOWERLEVEL1 , ASN_INTEGER , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,2 } },
249 +#define DOT11TXPOWERLEVEL2 100
250 + { DOT11TXPOWERLEVEL2 , ASN_INTEGER , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,3 } },
251 +#define DOT11TXPOWERLEVEL3 101
252 + { DOT11TXPOWERLEVEL3 , ASN_INTEGER , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,4 } },
253 +#define DOT11TXPOWERLEVEL4 102
254 + { DOT11TXPOWERLEVEL4 , ASN_INTEGER , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,5 } },
255 +#define DOT11TXPOWERLEVEL5 103
256 + { DOT11TXPOWERLEVEL5 , ASN_INTEGER , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,6 } },
257 +#define DOT11TXPOWERLEVEL6 104
258 + { DOT11TXPOWERLEVEL6 , ASN_INTEGER , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,7 } },
259 +#define DOT11TXPOWERLEVEL7 105
260 + { DOT11TXPOWERLEVEL7 , ASN_INTEGER , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,8 } },
261 +#define DOT11TXPOWERLEVEL8 106
262 + { DOT11TXPOWERLEVEL8 , ASN_INTEGER , RONLY , var_dot11PhyTxPowerTable, 4, { 4,3,1,9 } },
263 +#define DOT11CURRENTTXPOWERLEVEL 107
264 + { DOT11CURRENTTXPOWERLEVEL, ASN_INTEGER , RWRITE, var_dot11PhyTxPowerTable, 4, { 4,3,1,10 } },
265 +
266 +#define DOT11HOPTIME 110
267 + { DOT11HOPTIME , ASN_INTEGER , RONLY , var_dot11PhyFHSSTable, 4, { 4,4,1,1 } },
268 +#define DOT11CURRENTCHANNELNUMBER 111
269 + { DOT11CURRENTCHANNELNUMBER, ASN_INTEGER , RWRITE, var_dot11PhyFHSSTable, 4, { 4,4,1,2 } },
270 +#define DOT11MAXDWELLTIME 112
271 + { DOT11MAXDWELLTIME , ASN_INTEGER , RONLY , var_dot11PhyFHSSTable, 4, { 4,4,1,3 } },
272 +#define DOT11CURRENTDWELLTIME 113
273 + { DOT11CURRENTDWELLTIME, ASN_INTEGER , RWRITE, var_dot11PhyFHSSTable, 4, { 4,4,1,4 } },
274 +#define DOT11CURRENTSET 114
275 + { DOT11CURRENTSET , ASN_INTEGER , RWRITE, var_dot11PhyFHSSTable, 4, { 4,4,1,5 } },
276 +#define DOT11CURRENTPATTERN 115
277 + { DOT11CURRENTPATTERN , ASN_INTEGER , RWRITE, var_dot11PhyFHSSTable, 4, { 4,4,1,6 } },
278 +#define DOT11CURRENTINDEX 116
279 + { DOT11CURRENTINDEX , ASN_INTEGER , RWRITE, var_dot11PhyFHSSTable, 4, { 4,4,1,7 } },
280 +
281 +#define DOT11CURRENTCHANNEL 119
282 + { DOT11CURRENTCHANNEL , ASN_INTEGER , RWRITE, var_dot11PhyDSSSTable, 4, { 4,5,1,1 } },
283 +#define DOT11CCAMODESUPPORTED 120
284 + { DOT11CCAMODESUPPORTED, ASN_INTEGER , RONLY , var_dot11PhyDSSSTable, 4, { 4,5,1,2 } },
285 +#define DOT11CURRENTCCAMODE 121
286 + { DOT11CURRENTCCAMODE , ASN_INTEGER , RWRITE, var_dot11PhyDSSSTable, 4, { 4,5,1,3 } },
287 +#define DOT11EDTHRESHOLD 122
288 + { DOT11EDTHRESHOLD , ASN_INTEGER , RWRITE, var_dot11PhyDSSSTable, 4, { 4,5,1,4 } },
289 +
290 +#define DOT11CCAWATCHDOGTIMERMAX 125
291 + { DOT11CCAWATCHDOGTIMERMAX, ASN_INTEGER , RWRITE, var_dot11PhyIRTable, 4, { 4,6,1,1 } },
292 +#define DOT11CCAWATCHDOGCOUNTMAX 126
293 + { DOT11CCAWATCHDOGCOUNTMAX, ASN_INTEGER , RWRITE, var_dot11PhyIRTable, 4, { 4,6,1,2 } },
294 +#define DOT11CCAWATCHDOGTIMERMIN 127
295 + { DOT11CCAWATCHDOGTIMERMIN, ASN_INTEGER , RWRITE, var_dot11PhyIRTable, 4, { 4,6,1,3 } },
296 +#define DOT11CCAWATCHDOGCOUNTMIN 128
297 + { DOT11CCAWATCHDOGCOUNTMIN, ASN_INTEGER , RWRITE, var_dot11PhyIRTable, 4, { 4,6,1,4 } },
298 +
299 +#define DOT11REGDOMAINSSUPPORTVALUE 132
300 + { DOT11REGDOMAINSSUPPORTVALUE, ASN_INTEGER , RONLY , var_dot11RegDomainsSupportedTable, 4, { 4,7,1,2 } },
301 +
302 +#define DOT11SUPPORTEDTXANTENNA 136
303 + { DOT11SUPPORTEDTXANTENNA, ASN_INTEGER , RWRITE, var_dot11AntennasListTable, 4, { 4,8,1,2 } },
304 +#define DOT11SUPPORTEDRXANTENNA 137
305 + { DOT11SUPPORTEDRXANTENNA, ASN_INTEGER , RWRITE, var_dot11AntennasListTable, 4, { 4,8,1,3 } },
306 +#define DOT11DIVERSITYSELECTIONRX 138
307 + { DOT11DIVERSITYSELECTIONRX, ASN_INTEGER , RWRITE, var_dot11AntennasListTable, 4, { 4,8,1,4 } },
308 +
309 +#define DOT11SUPPORTEDDATARATESTXVALUE 142
310 + { DOT11SUPPORTEDDATARATESTXVALUE, ASN_INTEGER , RONLY , var_dot11SupportedDataRatesTxTable, 4, { 4,9,1,2 } },
311 +
312 +#define DOT11SUPPORTEDDATARATESRXVALUE 146
313 + { DOT11SUPPORTEDDATARATESRXVALUE, ASN_INTEGER , RONLY , var_dot11SupportedDataRatesRxTable, 4, { 4,10,1,2 } },
314 +};
315 +// ( L = length of the oidsuffix )
316 +
317 +/****************************************************************************
318 +* *
319 +* init_ieee802dot11() - perform any required initialization *
320 +* *
321 +****************************************************************************/
322 +void init_ieee802dot11 ( void ) {
323 +
324 + /* register ourselves with the agent to handle our mib tree */
325 + REGISTER_MIB("ieee802dot11", ieee802dot11_variables, variable7,
326 + ieee802dot11_variables_oid);
327 +
328 + initLists();
329 +}
330 +
331 +/****************************************************************************
332 +* *
333 +* shutdown_ieee802dot11() - perform any required cleanup @ shutdown *
334 +* *
335 +****************************************************************************/
336 +void shutdown_ieee802dot11 ( void )
337 +{
338 + flushLists();
339 +}
340 +
341 +/****************************************************************************
342 +* *
343 +* var_ieee802dot11() - *
344 +* *
345 +****************************************************************************/
346 +unsigned char *
347 +var_ieee802dot11 ( struct variable *vp,
348 + oid *name,
349 + size_t *length,
350 + int exact,
351 + size_t *var_len,
352 + WriteMethod **write_method)
353 +{
354 + loadTables();
355 +
356 + if ( header_generic ( vp, name, length, exact,var_len,write_method )
357 + == MATCH_FAILED )
358 + return NULL;
359 +
360 + switch ( vp->magic ) {
361 +
362 + case DOT11RESOURCETYPEIDNAME:
363 + if ( !haveResourceTypeIDName )
364 + return NULL;
365 + *var_len = strlen ( resourceTypeIDName );
366 + return ( UCHAR * ) resourceTypeIDName;
367 +
368 + default:
369 + ERROR_MSG ( "" );
370 + }
371 +
372 + return NULL;
373 +}
374 +
375 +/****************************************************************************
376 +* *
377 +* var_dot11StationConfigTable() - return a variable value from the table *
378 +* *
379 +****************************************************************************/
380 +unsigned char *
381 +var_dot11StationConfigTable ( struct variable *vp,
382 + oid *name,
383 + size_t *length,
384 + int exact,
385 + size_t *var_len,
386 + WriteMethod **write_method )
387 +{
388 + int found = FALSE;
389 + oid rName [ MAX_OID_LEN ]; // OID to be returned
390 + static char MACWork[17];
391 +
392 + loadTables();
393 + memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
394 + for ( np = LIST_FIRST ( &scList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
395 + sc = ( struct scTbl_data * ) np->data;
396 + rName[vp->namelen] = sc->ifIndex;
397 + if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) ||
398 + ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) > 0 ))) {
399 +
400 + switch ( vp->magic ) { // found requested OID, now check for requested variable
401 + case DOT11STATIONID:
402 + if ( sc->haveStationID ) found = TRUE; break;
403 + case DOT11MEDIUMOCCUPANCYLIMIT:
404 + if ( sc->haveMediumOccupancyLimit ) found = TRUE; break;
405 + case DOT11CFPOLLABLE:
406 + if ( sc->haveCFPPollable ) found = TRUE; break;
407 + case DOT11CFPPERIOD:
408 + if ( sc->haveCFPPeriod ) found = TRUE; break;
409 + case DOT11CFPMAXDURATION:
410 + if ( sc->haveMaxDuration ) found = TRUE; break;
411 + case DOT11AUTHENTICATIONRESPONSETIMEOUT:
412 + if ( sc->haveAuthenticationResponseTimeOut ) found = TRUE; break;
413 + case DOT11PRIVACYOPTIONIMPLEMENTED:
414 + if ( sc->havePrivacyOptionImplemented ) found = TRUE; break;
415 + case DOT11POWERMANAGEMENTMODE:
416 + if ( sc->havePowerManagementMode ) found = TRUE; break;
417 + case DOT11DESIREDSSID:
418 + if ( sc->haveDesiredSSID ) found = TRUE; break;
419 + case DOT11DESIREDBSSTYPE:
420 + if ( sc->haveDesiredBSSType ) found = TRUE; break;
421 + case DOT11OPERATIONALRATESET:
422 + if ( sc->haveOperationalRateSet ) found = TRUE; break;
423 + case DOT11BEACONPERIOD:
424 + if ( sc->haveBeaconPeriod ) found = TRUE; break;
425 + case DOT11DTIMPERIOD:
426 + if ( sc->haveDTIMPeriod ) found = TRUE; break;
427 + case DOT11ASSOCIATIONRESPONSETIMEOUT:
428 + if ( sc->haveAssociationResponseTimeOut ) found = TRUE; break;
429 + case DOT11DISASSOCIATEREASON:
430 + if ( sc->disAssociationReason ) found = TRUE; break;
431 + case DOT11DISASSOCIATESTATION:
432 + if ( sc->haveDisAssociationStation ) found = TRUE; break;
433 + case DOT11DEAUTHENTICATEREASON:
434 + if ( sc->deAuthenticationReason ) found = TRUE; break;
435 + case DOT11DEAUTHENTICATESTATION:
436 + if ( sc->haveDeAuthenticationStation ) found = TRUE; break;
437 + case DOT11AUTHENTICATEFAILSTATUS:
438 + if ( sc->authenticateFailStatus ) found = TRUE; break;
439 + case DOT11AUTHENTICATEFAILSTATION:
440 + if ( sc->haveAuthenticateFailStation ) found = TRUE; break;
441 + }
442 + }
443 + if ( found )
444 + break;
445 + }
446 +
447 + if ( !found )
448 + return NULL;
449 +
450 + memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid ));
451 + *length = vp->namelen + 1;
452 + *var_len = sizeof ( long );
453 + *write_method = NULL;
454 +
455 + switch ( vp->magic ) {
456 +
457 + case DOT11STATIONID:
458 +// *write_method = write_dot11StationID;
459 + MACWork[ 0] = sc->stationID [ 0];
460 + MACWork[ 1] = sc->stationID [ 1];
461 + MACWork[ 2] = sc->stationID [ 3];
462 + MACWork[ 3] = sc->stationID [ 4];
463 + MACWork[ 4] = sc->stationID [ 6];
464 + MACWork[ 5] = sc->stationID [ 7];
465 + MACWork[ 6] = sc->stationID [ 9];
466 + MACWork[ 7] = sc->stationID [10];
467 + MACWork[ 8] = sc->stationID [12];
468 + MACWork[ 9] = sc->stationID [13];
469 + MACWork[10] = sc->stationID [15];
470 + MACWork[11] = sc->stationID [16];
471 + MACWork[12] = '\0';
472 + *var_len = 6;
473 + return ( UCHAR * ) htob ( MACWork );
474 +
475 + case DOT11MEDIUMOCCUPANCYLIMIT:
476 +// *write_method = write_dot11MediumOccupancyLimit;
477 + sc->mediumOccupancyLimit = 5;
478 + return ( UCHAR * ) &sc->mediumOccupancyLimit;
479 +
480 + case DOT11CFPOLLABLE:
481 + return ( UCHAR * ) &sc->CFPPollable;
482 +
483 + case DOT11CFPPERIOD:
484 +// *write_method = write_dot11CFPPeriod;
485 + return ( UCHAR * ) &sc->CFPPeriod;
486 +
487 + case DOT11CFPMAXDURATION:
488 +// *write_method = write_dot11CFPMaxDuration;
489 + return ( UCHAR * ) &sc->maxDuration;
490 +
491 + case DOT11AUTHENTICATIONRESPONSETIMEOUT:
492 +// *write_method = write_dot11AuthenticationResponseTimeOut;
493 + return ( UCHAR * ) &sc->authenticationResponseTimeOut;
494 +
495 + case DOT11PRIVACYOPTIONIMPLEMENTED:
496 + return ( UCHAR * ) &sc->privacyOptionImplemented;
497 +
498 + case DOT11POWERMANAGEMENTMODE:
499 +// *write_method = write_dot11PowerManagementMode;
500 + return ( UCHAR * ) &sc->powerManagementMode;
501 +
502 + case DOT11DESIREDSSID:
503 +// *write_method = write_dot11DesiredSSID;
504 + *var_len = strlen ( sc->desiredSSID );
505 + return ( UCHAR * ) sc->desiredSSID;
506 +
507 + case DOT11DESIREDBSSTYPE:
508 +// *write_method = write_dot11DesiredBSSType;
509 + return ( UCHAR * ) &sc->desiredBSSType;
510 +
511 + case DOT11OPERATIONALRATESET:
512 +// *write_method = write_dot11OperationalRateSet;
513 + *var_len = strlen ( sc->operationalRateSet );
514 + return ( UCHAR * ) sc->operationalRateSet;
515 +
516 + case DOT11BEACONPERIOD:
517 +// *write_method = write_dot11BeaconPeriod;
518 + return ( UCHAR * ) &sc->beaconPeriod;
519 +
520 + case DOT11DTIMPERIOD:
521 +// *write_method = write_dot11DTIMPeriod;
522 + return ( UCHAR * ) &sc->DTIMPeriod;
523 +
524 + case DOT11ASSOCIATIONRESPONSETIMEOUT:
525 +// *write_method = write_dot11AssociationResponseTimeOut;
526 + return ( UCHAR * ) &sc->associationResponseTimeOut;
527 +
528 + case DOT11DISASSOCIATEREASON:
529 + return ( UCHAR * ) &sc->disAssociationReason;
530 +
531 + case DOT11DISASSOCIATESTATION:
532 + MACWork[ 0] = sc->disAssociationStation[ 0];
533 + MACWork[ 1] = sc->disAssociationStation[ 1];
534 + MACWork[ 2] = sc->disAssociationStation[ 3];
535 + MACWork[ 3] = sc->disAssociationStation[ 4];
536 + MACWork[ 4] = sc->disAssociationStation[ 6];
537 + MACWork[ 5] = sc->disAssociationStation[ 7];
538 + MACWork[ 6] = sc->disAssociationStation[ 9];
539 + MACWork[ 7] = sc->disAssociationStation[10];
540 + MACWork[ 8] = sc->disAssociationStation[12];
541 + MACWork[ 9] = sc->disAssociationStation[13];
542 + MACWork[10] = sc->disAssociationStation[15];
543 + MACWork[11] = sc->disAssociationStation[16];
544 + MACWork[12] = '\0';
545 + *var_len = 6;
546 + return ( UCHAR * ) htob ( MACWork );
547 +
548 + case DOT11DEAUTHENTICATEREASON:
549 + return ( UCHAR * ) &sc->deAuthenticationReason;
550 +
551 + case DOT11DEAUTHENTICATESTATION:
552 + MACWork[ 0] = sc->deAuthenticationStation[ 0];
553 + MACWork[ 1] = sc->deAuthenticationStation[ 1];
554 + MACWork[ 2] = sc->deAuthenticationStation[ 3];
555 + MACWork[ 3] = sc->deAuthenticationStation[ 4];
556 + MACWork[ 4] = sc->deAuthenticationStation[ 6];
557 + MACWork[ 5] = sc->deAuthenticationStation[ 7];
558 + MACWork[ 6] = sc->deAuthenticationStation[ 9];
559 + MACWork[ 7] = sc->deAuthenticationStation[10];
560 + MACWork[ 8] = sc->deAuthenticationStation[12];
561 + MACWork[ 9] = sc->deAuthenticationStation[13];
562 + MACWork[10] = sc->deAuthenticationStation[15];
563 + MACWork[11] = sc->deAuthenticationStation[16];
564 + MACWork[12] = '\0';
565 + *var_len = 6;
566 + return ( UCHAR * ) htob ( MACWork );
567 +
568 + case DOT11AUTHENTICATEFAILSTATUS:
569 + return ( UCHAR * ) &sc->authenticateFailStatus;
570 +
571 + case DOT11AUTHENTICATEFAILSTATION:
572 + MACWork[ 0] = sc->authenticateFailStation[ 0];
573 + MACWork[ 1] = sc->authenticateFailStation[ 1];
574 + MACWork[ 2] = sc->authenticateFailStation[ 3];
575 + MACWork[ 3] = sc->authenticateFailStation[ 4];
576 + MACWork[ 4] = sc->authenticateFailStation[ 6];
577 + MACWork[ 5] = sc->authenticateFailStation[ 7];
578 + MACWork[ 6] = sc->authenticateFailStation[ 9];
579 + MACWork[ 7] = sc->authenticateFailStation[10];
580 + MACWork[ 8] = sc->authenticateFailStation[12];
581 + MACWork[ 9] = sc->authenticateFailStation[13];
582 + MACWork[10] = sc->authenticateFailStation[15];
583 + MACWork[11] = sc->authenticateFailStation[16];
584 + MACWork[12] = '\0';
585 + *var_len = 6;
586 + return ( UCHAR * ) htob ( MACWork );
587 +
588 + default:
589 + ERROR_MSG ( "" );
590 + }
591 +
592 + return NULL;
593 +}
594 +
595 +/****************************************************************************
596 +* *
597 +* var_dot11AuthenticationAlgorithmsTable() - *
598 +* *
599 +****************************************************************************/
600 +unsigned char *
601 +var_dot11AuthenticationAlgorithmsTable ( struct variable *vp,
602 + oid *name,
603 + size_t *length,
604 + int exact,
605 + size_t *var_len,
606 + WriteMethod **write_method )
607 +{
608 + int found = FALSE;
609 + oid rName [ MAX_OID_LEN ]; // OID to be returned
610 +
611 + loadTables();
612 + memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
613 + for ( np = LIST_FIRST ( &aaList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
614 + aa = ( struct aaTbl_data * ) np->data;
615 + rName[vp->namelen + 0] = aa->ifIndex;
616 + rName[vp->namelen + 1] = aa->authenticationAlgorithmsIndex;
617 + if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) == 0 )) ||
618 + ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) > 0 ))) {
619 + switch ( vp->magic ) {
620 + case DOT11AUTHENTICATIONALGORITHM:
621 + if ( aa->haveAuthenticationAlgorithm ) found = TRUE; break;
622 + case DOT11AUTHENTICATIONALGORITHMSENABLE:
623 + if ( aa->authenticationAlgorithmsEnable ) found = TRUE; break;
624 + }
625 + }
626 + if ( found )
627 + break;
628 + }
629 +
630 + if ( !found )
631 + return NULL;
632 +
633 + memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 2 ) * sizeof ( oid ));
634 + *length = vp->namelen + 2;
635 + *var_len = sizeof ( long );
636 + *write_method = NULL;
637 +
638 + switch ( vp->magic ) {
639 +
640 + case DOT11AUTHENTICATIONALGORITHM:
641 + return ( UCHAR * ) &aa->authenticationAlgorithm;
642 +
643 + case DOT11AUTHENTICATIONALGORITHMSENABLE:
644 +// *write_method = write_dot11AuthenticationAlgorithmsEnable;
645 + return ( UCHAR * ) &aa->authenticationAlgorithmsEnable;
646 +
647 + default:
648 + ERROR_MSG ( "" );
649 + }
650 +
651 + return NULL;
652 +}
653 +
654 +/****************************************************************************
655 +* *
656 +* var_dot11WEPDefaultKeysTable() - *
657 +* *
658 +****************************************************************************/
659 +unsigned char *
660 +var_dot11WEPDefaultKeysTable ( struct variable *vp,
661 + oid *name,
662 + size_t *length,
663 + int exact,
664 + size_t *var_len,
665 + WriteMethod **write_method )
666 +{
667 + int found = FALSE;
668 + oid rName [ MAX_OID_LEN ]; // OID to be returned
669 +
670 + loadTables();
671 + memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
672 + for ( np = LIST_FIRST ( &dfList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
673 + df = ( struct dfTbl_data * ) np->data;
674 + rName[vp->namelen + 0] = df->ifIndex;
675 + rName[vp->namelen + 1] = df->WEPDefaultKeyIndex;
676 + if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) == 0 )) ||
677 + ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) > 0 ))) {
678 + switch ( vp->magic ) {
679 + case DOT11WEPDEFAULTKEYVALUE:
680 + if ( df->haveWEPDefaultKeyValue ) found = TRUE; break;
681 + }
682 + }
683 + if ( found )
684 + break;
685 + }
686 +
687 + if ( !found )
688 + return NULL;
689 +
690 + memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 2 ) * sizeof ( oid ));
691 + *length = vp->namelen + 2;
692 + *var_len = sizeof ( long );
693 + *write_method = NULL;
694 +
695 + switch ( vp->magic ) {
696 +
697 + case DOT11WEPDEFAULTKEYVALUE:
698 +// *write_method = write_dot11WEPDefaultKeyValue;
699 + *var_len = strlen ( df->WEPDefaultKeyValue );
700 + return ( UCHAR * ) df->WEPDefaultKeyValue;
701 +
702 + default:
703 + ERROR_MSG ( "" );
704 + }
705 +
706 + return NULL;
707 +}
708 +
709 +/****************************************************************************
710 +* *
711 +* var_dot11WEPKeyMappingsTable() - *
712 +* *
713 +****************************************************************************/
714 +unsigned char *
715 +var_dot11WEPKeyMappingsTable ( struct variable *vp,
716 + oid *name,
717 + size_t *length,
718 + int exact,
719 + size_t *var_len,
720 + WriteMethod **write_method)
721 +{
722 + static char MACWork[17];
723 + int found = FALSE;
724 + oid rName [ MAX_OID_LEN ]; // OID to be returned
725 +
726 + loadTables();
727 + memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
728 + for ( np = LIST_FIRST ( &kmList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
729 + km = ( struct kmTbl_data * ) np->data;
730 + rName[vp->namelen + 0] = km->ifIndex;
731 + rName[vp->namelen + 1] = km->WEPKeyMappingIndex;
732 + if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) == 0 )) ||
733 + ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) > 0 ))) {
734 + switch ( vp->magic ) {
735 + case DOT11WEPKEYMAPPINGADDRESS:
736 + if ( km->haveWEPKeyMappingAddress ) found = TRUE; break;
737 + case DOT11WEPKEYMAPPINGWEPON:
738 + if ( km->haveWEPKeyMappingWEPOn ) found = TRUE; break;
739 + case DOT11WEPKEYMAPPINGVALUE:
740 + if ( km->haveWEPKeyMappingValue ) found = TRUE; break;
741 + case DOT11WEPKEYMAPPINGSTATUS:
742 + if ( km->haveWEPKeyMappingStatus ) found = TRUE; break;
743 + }
744 + }
745 + if ( found )
746 + break;
747 + }
748 +
749 + if ( !found )
750 + return NULL;
751 +
752 + memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 2 ) * sizeof ( oid ));
753 + *length = vp->namelen + 2;
754 + *var_len = sizeof ( long );
755 + *write_method = NULL;
756 +
757 + switch ( vp->magic ) {
758 +
759 + case DOT11WEPKEYMAPPINGADDRESS:
760 +// *write_method = write_dot11WEPKeyMappingAddress;
761 + MACWork[ 0] = km->WEPKeyMappingAddress[ 0];
762 + MACWork[ 1] = km->WEPKeyMappingAddress[ 1];
763 + MACWork[ 2] = km->WEPKeyMappingAddress[ 3];
764 + MACWork[ 3] = km->WEPKeyMappingAddress[ 4];
765 + MACWork[ 4] = km->WEPKeyMappingAddress[ 6];
766 + MACWork[ 5] = km->WEPKeyMappingAddress[ 7];
767 + MACWork[ 6] = km->WEPKeyMappingAddress[ 9];
768 + MACWork[ 7] = km->WEPKeyMappingAddress[10];
769 + MACWork[ 8] = km->WEPKeyMappingAddress[12];
770 + MACWork[ 9] = km->WEPKeyMappingAddress[13];
771 + MACWork[10] = km->WEPKeyMappingAddress[15];
772 + MACWork[11] = km->WEPKeyMappingAddress[16];
773 + MACWork[12] = '\0';
774 + *var_len = 6;
775 + return ( UCHAR * ) htob ( MACWork );
776 +
777 + case DOT11WEPKEYMAPPINGWEPON:
778 +// *write_method = write_dot11WEPKeyMappingWEPOn;
779 + return ( UCHAR * ) &km->WEPKeyMappingWEPOn;
780 +
781 + case DOT11WEPKEYMAPPINGVALUE:
782 +// *write_method = write_dot11WEPKeyMappingValue;
783 + *var_len = strlen ( km->WEPKeyMappingValue );
784 + return ( UCHAR * ) km->WEPKeyMappingValue;
785 +
786 + case DOT11WEPKEYMAPPINGSTATUS:
787 +// *write_method = write_dot11WEPKeyMappingStatus;
788 + return ( UCHAR * ) &km->WEPKeyMappingStatus;
789 +
790 + default:
791 + ERROR_MSG ( "" );
792 + }
793 + return NULL;
794 +}
795 +
796 +/****************************************************************************
797 +* *
798 +* var_dot11PrivacyTable() - *
799 +* *
800 +****************************************************************************/
801 +unsigned char *
802 +var_dot11PrivacyTable ( struct variable *vp,
803 + oid *name,
804 + size_t *length,
805 + int exact,
806 + size_t *var_len,
807 + WriteMethod **write_method )
808 +{
809 + int found = FALSE;
810 + oid rName [ MAX_OID_LEN ]; // OID to be returned
811 +
812 + loadTables();
813 + memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
814 + for ( np = LIST_FIRST ( &prList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
815 + pr = ( struct prTbl_data * ) np->data;
816 + rName[vp->namelen] = pr->ifIndex;
817 + if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) ||
818 + ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) > 0 ))) {
819 + switch ( vp->magic ) {
820 + case DOT11PRIVACYINVOKED:
821 + if ( pr->havePrivacyInvoked ) found = TRUE; break;
822 + case DOT11WEPDEFAULTKEYID:
823 + if ( pr->haveWEPDefaultKeyID ) found = TRUE; break;
824 + case DOT11WEPKEYMAPPINGLENGTH:
825 + if ( pr->haveWEPKeyMappingLength ) found = TRUE; break;
826 + case DOT11EXCLUDEUNENCRYPTED:
827 + if ( pr->haveExcludeUnencrypted ) found = TRUE; break;
828 + case DOT11WEPICVERRORCOUNT:
829 + if ( pr->haveWEPICVErrorCount ) found = TRUE; break;
830 + case DOT11WEPEXCLUDEDCOUNT:
831 + if ( pr->haveWEPExcludedCount ) found = TRUE; break;
832 + }
833 + }
834 + if ( found )
835 + break;
836 + }
837 +
838 + if ( !found )
839 + return NULL;
840 +
841 + memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid ));
842 + *length = vp->namelen + 1;
843 + *var_len = sizeof ( long );
844 + *write_method = NULL;
845 +
846 + switch ( vp->magic ) {
847 +
848 + case DOT11PRIVACYINVOKED:
849 +// *write_method = write_dot11PrivacyInvoked;
850 + return ( UCHAR * ) &pr->privacyInvoked;
851 +
852 + case DOT11WEPDEFAULTKEYID:
853 +// *write_method = write_dot11WEPDefaultKeyID;
854 + return ( UCHAR * ) &pr->WEPDefaultKeyID;
855 +
856 + case DOT11WEPKEYMAPPINGLENGTH:
857 +// *write_method = write_dot11WEPKeyMappingLength;
858 + return ( UCHAR * ) &pr->WEPKeyMappingLength;
859 +
860 + case DOT11EXCLUDEUNENCRYPTED:
861 +// *write_method = write_dot11ExcludeUnencrypted;
862 + return ( UCHAR * ) &pr->excludeUnencrypted;
863 +
864 + case DOT11WEPICVERRORCOUNT:
865 + return ( UCHAR * ) &pr->WEPICVErrorCount;
866 +
867 + case DOT11WEPEXCLUDEDCOUNT:
868 + return ( UCHAR * ) &pr->WEPExcludedCount;
869 +
870 + default:
871 + ERROR_MSG ( "" );
872 + }
873 +
874 + return NULL;
875 +}
876 +
877 +/****************************************************************************
878 +* *
879 +* var_dot11OperationTable() - *
880 +* *
881 +****************************************************************************/
882 +unsigned char *
883 +var_dot11OperationTable ( struct variable *vp,
884 + oid *name,
885 + size_t *length,
886 + int exact,
887 + size_t *var_len,
888 + WriteMethod **write_method )
889 +{
890 + int found = FALSE;
891 + oid rName [ MAX_OID_LEN ]; // OID to be returned
892 + static char MACWork[17];
893 +
894 + loadTables();
895 + memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
896 + for ( np = LIST_FIRST ( &opList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
897 + op = ( struct opTbl_data * ) np->data;
898 + rName[vp->namelen] = op->ifIndex;
899 + if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) ||
900 + ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) > 0 ))) {
901 +
902 + switch ( vp->magic ) { // found requested OID, now check for requested variable
903 + case DOT11MACADDRESS:
904 + if ( op->haveMACAddress ) found = TRUE; break;
905 + case DOT11RTSTHRESHOLD:
906 + if ( op->haveRTSThreshold ) found = TRUE; break;
907 + case DOT11SHORTRETRYLIMIT:
908 + if ( op->haveShortRetryLimit ) found = TRUE; break;
909 + case DOT11LONGRETRYLIMIT:
910 + if ( op->haveLongRetryLimit ) found = TRUE; break;
911 + case DOT11FRAGMENTATIONTHRESHOLD:
912 + if ( op->haveFragmentationThreshold ) found = TRUE; break;
913 + case DOT11MAXTRANSMITMSDULIFETIME:
914 + if ( op->haveMaxTransmitMSDULifetime ) found = TRUE; break;
915 + case DOT11MAXRECEIVELIFETIME:
916 + if ( op->haveMaxReceiveLifetime ) found = TRUE; break;
917 + case DOT11MANUFACTURERID:
918 + if ( op->haveManufacturerID ) found = TRUE; break;
919 + case DOT11PRODUCTID:
920 + if ( op->haveProductID ) found = TRUE; break;
921 + }
922 + }
923 + if ( found )
924 + break;
925 + }
926 +
927 + if ( !found )
928 + return NULL;
929 +
930 + memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid ));
931 + *length = vp->namelen + 1;
932 + *var_len = sizeof ( long );
933 + *write_method = NULL;
934 +
935 + switch ( vp->magic ) {
936 +
937 + case DOT11MACADDRESS:
938 + MACWork[ 0] = op->MACAddress[ 0];
939 + MACWork[ 1] = op->MACAddress[ 1];
940 + MACWork[ 2] = op->MACAddress[ 3];
941 + MACWork[ 3] = op->MACAddress[ 4];
942 + MACWork[ 4] = op->MACAddress[ 6];
943 + MACWork[ 5] = op->MACAddress[ 7];
944 + MACWork[ 6] = op->MACAddress[ 9];
945 + MACWork[ 7] = op->MACAddress[10];
946 + MACWork[ 8] = op->MACAddress[12];
947 + MACWork[ 9] = op->MACAddress[13];
948 + MACWork[10] = op->MACAddress[15];
949 + MACWork[11] = op->MACAddress[16];
950 + MACWork[12] = '\0';
951 + *var_len = 6;
952 + return ( UCHAR * ) htob ( MACWork );
953 +
954 + case DOT11RTSTHRESHOLD:
955 +// *write_method = write_dot11RTSThreshold;
956 + return ( UCHAR * ) &op->RTSThreshold;
957 +
958 + case DOT11SHORTRETRYLIMIT:
959 +// *write_method = write_dot11ShortRetryLimit;
960 + return ( UCHAR * ) &op->shortRetryLimit;
961 +
962 + case DOT11LONGRETRYLIMIT:
963 +// *write_method = write_dot11LongRetryLimit;
964 + return ( UCHAR * ) &op->longRetryLimit;
965 +
966 + case DOT11FRAGMENTATIONTHRESHOLD:
967 +// *write_method = write_dot11FragmentationThreshold;
968 + return ( UCHAR * ) &op->fragmentationThreshold;
969 +
970 + case DOT11MAXTRANSMITMSDULIFETIME:
971 +// *write_method = write_dot11MaxTransmitMSDULifetime;
972 + return ( UCHAR * ) &op->maxTransmitMSDULifetime;
973 +
974 + case DOT11MAXRECEIVELIFETIME:
975 +// *write_method = write_dot11MaxReceiveLifetime;
976 + return ( UCHAR * ) &op->maxReceiveLifetime;
977 +
978 + case DOT11MANUFACTURERID:
979 + *var_len = strlen ( op->manufacturerID );
980 + return ( UCHAR * ) op->manufacturerID;
981 +
982 + case DOT11PRODUCTID:
983 + *var_len = strlen ( op->productID );
984 + return ( UCHAR * ) op->productID;
985 +
986 + default:
987 + ERROR_MSG ( "" );
988 + }
989 +
990 + return NULL;
991 +}
992 +
993 +/****************************************************************************
994 +* *
995 +* var_dot11CountersTable() - *
996 +* *
997 +****************************************************************************/
998 +unsigned char *
999 +var_dot11CountersTable(struct variable *vp,
1000 + oid *name,
1001 + size_t *length,
1002 + int exact,
1003 + size_t *var_len,
1004 + WriteMethod **write_method)
1005 +{
1006 + int found = FALSE;
1007 + oid rName [ MAX_OID_LEN ]; // OID to be returned
1008 +
1009 + loadTables();
1010 + memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
1011 + for ( np = LIST_FIRST ( &coList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
1012 + co = ( struct coTbl_data * ) np->data;
1013 + rName[vp->namelen] = co->ifIndex;
1014 + if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) ||
1015 + ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) > 0 ))) {
1016 + switch ( vp->magic ) {
1017 + case DOT11TRANSMITTEDFRAGMENTCOUNT:
1018 + if ( co->haveTransmittedFragmentCount ) found = TRUE; break;
1019 + case DOT11MULTICASTTRANSMITTEDFRAMECOUNT:
1020 + if ( co->haveTransmittedFrameCount ) found = TRUE; break;
1021 + case DOT11FAILEDCOUNT:
1022 + if ( co->haveFailedCount ) found = TRUE; break;
1023 + case DOT11RETRYCOUNT:
1024 + if ( co->haveRetryCount ) found = TRUE; break;
1025 + case DOT11MULTIPLERETRYCOUNT:
1026 + if ( co->haveMultipleRetryCount ) found = TRUE; break;
1027 + case DOT11FRAMEDUPLICATECOUNT:
1028 + if ( co->haveFrameDuplicateCount ) found = TRUE; break;
1029 + case DOT11RTSSUCCESSCOUNT:
1030 + if ( co->haveRTSSuccessCount ) found = TRUE; break;
1031 + case DOT11RTSFAILURECOUNT:
1032 + if ( co->haveRTSFailureCount ) found = TRUE; break;
1033 + case DOT11ACKFAILURECOUNT:
1034 + if ( co->haveACKFailureCount ) found = TRUE; break;
1035 + case DOT11RECEIVEDFRAGMENTCOUNT:
1036 + if ( co->haveReceivedFragmentCount ) found = TRUE; break;
1037 + case DOT11MULTICASTRECEIVEDFRAMECOUNT:
1038 + if ( co->haveMulticastReceivedFrameCount ) found = TRUE; break;
1039 + case DOT11FCSERRORCOUNT:
1040 + if ( co->haveFCSErrorCount ) found = TRUE; break;
1041 + case DOT11TRANSMITTEDFRAMECOUNT:
1042 + if ( co->haveTransmittedFrameCount ) found = TRUE; break;
1043 + case DOT11WEPUNDECRYPTABLECOUNT:
1044 + if ( co->haveWEPUndecryptableCount ) found = TRUE; break;
1045 + }
1046 + }
1047 + if ( found )
1048 + break;
1049 + }
1050 +
1051 + if ( !found )
1052 + return NULL;
1053 +
1054 + memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid ));
1055 + *length = vp->namelen + 1;
1056 + *var_len = sizeof ( long );
1057 + *write_method = NULL;
1058 +
1059 + switch ( vp->magic ) {
1060 +
1061 + case DOT11TRANSMITTEDFRAGMENTCOUNT: return ( UCHAR * ) &co->transmittedFragmentCount;
1062 + case DOT11MULTICASTTRANSMITTEDFRAMECOUNT: return ( UCHAR * ) &co->transmittedFrameCount;
1063 + case DOT11FAILEDCOUNT: return ( UCHAR * ) &co->failedCount;
1064 + case DOT11RETRYCOUNT: return ( UCHAR * ) &co->retryCount;
1065 + case DOT11MULTIPLERETRYCOUNT: return ( UCHAR * ) &co->multipleRetryCount;
1066 + case DOT11FRAMEDUPLICATECOUNT: return ( UCHAR * ) &co->frameDuplicateCount;
1067 + case DOT11RTSSUCCESSCOUNT: return ( UCHAR * ) &co->RTSSuccessCount;
1068 + case DOT11RTSFAILURECOUNT: return ( UCHAR * ) &co->RTSFailureCount;
1069 + case DOT11ACKFAILURECOUNT: return ( UCHAR * ) &co->ACKFailureCount;
1070 + case DOT11RECEIVEDFRAGMENTCOUNT: return ( UCHAR * ) &co->receivedFragmentCount;
1071 + case DOT11MULTICASTRECEIVEDFRAMECOUNT: return ( UCHAR * ) &co->multicastReceivedFrameCount;
1072 + case DOT11FCSERRORCOUNT: return ( UCHAR * ) &co->FCSErrorCount;
1073 + case DOT11TRANSMITTEDFRAMECOUNT: return ( UCHAR * ) &co->transmittedFrameCount;
1074 + case DOT11WEPUNDECRYPTABLECOUNT: return ( UCHAR * ) &co->WEPUndecryptableCount;
1075 +
1076 + default:
1077 + ERROR_MSG ( "" );
1078 + }
1079 +
1080 + return NULL;
1081 +}
1082 +
1083 +/****************************************************************************
1084 +* *
1085 +* var_dot11GroupAddressesTable() - *
1086 +* *
1087 +****************************************************************************/
1088 +unsigned char *
1089 +var_dot11GroupAddressesTable(struct variable *vp,
1090 + oid *name,
1091 + size_t *length,
1092 + int exact,
1093 + size_t *var_len,
1094 + WriteMethod **write_method)
1095 +{
1096 + static char MACWork[17];
1097 + int found = FALSE;
1098 + oid rName [ MAX_OID_LEN ]; // OID to be returned
1099 +
1100 + loadTables();
1101 + memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
1102 + for ( np = LIST_FIRST ( &gaList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
1103 + ga = ( struct gaTbl_data * ) np->data;
1104 + rName[vp->namelen + 0] = ga->ifIndex;
1105 + rName[vp->namelen + 1] = ga->groupAddressesIndex;
1106 + if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) == 0 )) ||
1107 + ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) > 0 ))) {
1108 + switch ( vp->magic ) {
1109 + case DOT11ADDRESS:
1110 + if ( ga->haveAddress ) found = TRUE; break;
1111 + case DOT11GROUPADDRESSESSTATUS:
1112 + if ( ga->haveGroupAddressesStatus ) found = TRUE; break;
1113 + }
1114 + }
1115 + if ( found )
1116 + break;
1117 + }
1118 +
1119 + if ( !found )
1120 + return NULL;
1121 +
1122 + memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 2 ) * sizeof ( oid ));
1123 + *length = vp->namelen + 2;
1124 + *var_len = sizeof ( long );
1125 + *write_method = NULL;
1126 +
1127 + switch ( vp->magic ) {
1128 +
1129 + case DOT11ADDRESS:
1130 +// *write_method = write_dot11Address;
1131 + MACWork[ 0] = ga->address[ 0];
1132 + MACWork[ 1] = ga->address[ 1];
1133 + MACWork[ 2] = ga->address[ 3];
1134 + MACWork[ 3] = ga->address[ 4];
1135 + MACWork[ 4] = ga->address[ 6];
1136 + MACWork[ 5] = ga->address[ 7];
1137 + MACWork[ 6] = ga->address[ 9];
1138 + MACWork[ 7] = ga->address[10];
1139 + MACWork[ 8] = ga->address[12];
1140 + MACWork[ 9] = ga->address[13];
1141 + MACWork[10] = ga->address[15];
1142 + MACWork[11] = ga->address[16];
1143 + MACWork[12] = '\0';
1144 + *var_len = 6;
1145 + return ( UCHAR * ) htob ( MACWork );
1146 +
1147 + case DOT11GROUPADDRESSESSTATUS:
1148 +// *write_method = write_dot11GroupAddressesStatus;
1149 + return ( UCHAR * ) &ga->groupAddressesStatus;
1150 +
1151 + default:
1152 + ERROR_MSG ( "" );
1153 + }
1154 + return NULL;
1155 +}
1156 +
1157 +/****************************************************************************
1158 +* *
1159 +* var_dot11ResourceInfoTable() - *
1160 +* *
1161 +****************************************************************************/
1162 +unsigned char *
1163 +var_dot11ResourceInfoTable ( struct variable *vp,
1164 + oid *name,
1165 + size_t *length,
1166 + int exact,
1167 + size_t *var_len,
1168 + WriteMethod **write_method )
1169 +{
1170 + int found = FALSE;
1171 + oid rName [ MAX_OID_LEN ]; // OID to be returned
1172 +
1173 + loadTables();
1174 + memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
1175 + for ( np = LIST_FIRST ( &riList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
1176 + ri = ( struct riTbl_data * ) np->data;
1177 + rName[vp->namelen] = ri->ifIndex;
1178 + if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) ||
1179 + ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) > 0 ))) {
1180 + switch ( vp->magic ) {
1181 + case DOT11MANUFACTUREROUI:
1182 + if ( ri->haveManufacturerOUI ) found = TRUE; break;
1183 + case DOT11MANUFACTURERNAME:
1184 + if ( ri->haveManufacturerName ) found = TRUE; break;
1185 + case DOT11MANUFACTURERPRODUCTNAME:
1186 + if ( ri->haveManufacturerProductName ) found = TRUE; break;
1187 + case DOT11MANUFACTURERPRODUCTVERSION:
1188 + if ( ri->haveManufacturerProductVersion ) found = TRUE; break;
1189 + }
1190 + }
1191 + if ( found )
1192 + break;
1193 + }
1194 +
1195 + if ( !found )
1196 + return NULL;
1197 +
1198 + memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid ));
1199 + *length = vp->namelen + 1;
1200 + *var_len = sizeof ( long );
1201 + *write_method = NULL;
1202 +
1203 + switch ( vp->magic ) {
1204 +
1205 + case DOT11MANUFACTUREROUI:
1206 + *var_len = strlen ( ri->manufacturerOUI );
1207 + return ( UCHAR * ) ri->manufacturerOUI;
1208 +
1209 + case DOT11MANUFACTURERNAME:
1210 + *var_len = strlen ( ri->manufacturerName );
1211 + return ( UCHAR * ) ri->manufacturerName;
1212 +
1213 + case DOT11MANUFACTURERPRODUCTNAME:
1214 + *var_len = strlen ( ri->manufacturerProductName );
1215 + return ( UCHAR * ) ri->manufacturerProductName;
1216 +
1217 + case DOT11MANUFACTURERPRODUCTVERSION:
1218 + *var_len = strlen ( ri->manufacturerProductVersion );
1219 + return ( UCHAR * ) ri->manufacturerProductVersion;
1220 +
1221 + default:
1222 + ERROR_MSG ( "" );
1223 + }
1224 +
1225 + return NULL;
1226 +}
1227 +
1228 +/****************************************************************************
1229 +* *
1230 +* var_dot11PhyOperationTable() - *
1231 +* *
1232 +****************************************************************************/
1233 +unsigned char *
1234 +var_dot11PhyOperationTable ( struct variable *vp,
1235 + oid *name,
1236 + size_t *length,
1237 + int exact,
1238 + size_t *var_len,
1239 + WriteMethod **write_method )
1240 +{
1241 + int found = FALSE;
1242 + oid rName [ MAX_OID_LEN ]; // OID to be returned
1243 +
1244 + loadTables();
1245 + memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
1246 + for ( np = LIST_FIRST ( &poList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
1247 + po = ( struct poTbl_data * ) np->data;
1248 + rName[vp->namelen] = po->ifIndex;
1249 + if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) ||
1250 + ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) > 0 ))) {
1251 + switch ( vp->magic ) {
1252 + case DOT11PHYTYPE:
1253 + if ( po->havePHYType ) found = TRUE; break;
1254 + case DOT11CURRENTREGDOMAIN:
1255 + if ( po->haveCurrentRegDomain ) found = TRUE; break;
1256 + case DOT11TEMPTYPE:
1257 + if ( po->haveTempType ) found = TRUE; break;
1258 + }
1259 + }
1260 + if ( found )
1261 + break;
1262 + }
1263 +
1264 + if ( !found )
1265 + return NULL;
1266 +
1267 + memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid ));
1268 + *length = vp->namelen + 1;
1269 + *var_len = sizeof ( long );
1270 + *write_method = NULL;
1271 +
1272 + switch ( vp->magic ) {
1273 +
1274 + case DOT11PHYTYPE:
1275 + return ( UCHAR * ) &po->PHYType;
1276 +
1277 + case DOT11CURRENTREGDOMAIN:
1278 +// *write_method = write_dot11CurrentRegDomain;
1279 + return ( UCHAR * ) &po->currentRegDomain;
1280 +
1281 + case DOT11TEMPTYPE:
1282 + return ( UCHAR * ) &po->tempType;
1283 +
1284 + default:
1285 + ERROR_MSG ( "" );
1286 + }
1287 +
1288 + return NULL;
1289 +}
1290 +
1291 +/****************************************************************************
1292 +* *
1293 +* var_dot11PhyAntennaTable() - *
1294 +* *
1295 +****************************************************************************/
1296 +unsigned char *
1297 +var_dot11PhyAntennaTable ( struct variable *vp,
1298 + oid *name,
1299 + size_t *length,
1300 + int exact,
1301 + size_t *var_len,
1302 + WriteMethod **write_method )
1303 +{
1304 + int found = FALSE;
1305 + oid rName [ MAX_OID_LEN ]; // OID to be returned
1306 +
1307 + loadTables();
1308 + memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
1309 + for ( np = LIST_FIRST ( &paList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
1310 + pa = ( struct paTbl_data * ) np->data;
1311 + rName[vp->namelen] = pa->ifIndex;
1312 + if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) ||
1313 + ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) > 0 ))) {
1314 + switch ( vp->magic ) {
1315 + case DOT11CURRENTTXANTENNA:
1316 + if ( pa->haveCurrentTxAntenna ) found = TRUE; break;
1317 + case DOT11DIVERSITYSUPPORT:
1318 + if ( pa->haveDiversitySupport ) found = TRUE; break;
1319 + case DOT11CURRENTRXANTENNA:
1320 + if ( pa->haveCurrentRxAntenna ) found = TRUE; break;
1321 + }
1322 + }
1323 + if ( found )
1324 + break;
1325 + }
1326 +
1327 + if ( !found )
1328 + return NULL;
1329 +
1330 + memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid ));
1331 + *length = vp->namelen + 1;
1332 + *var_len = sizeof ( long );
1333 + *write_method = NULL;
1334 +
1335 + switch ( vp->magic ) {
1336 +
1337 + case DOT11CURRENTTXANTENNA:
1338 +// *write_method = write_dot11CurrentTxAntenna;
1339 + return ( UCHAR * ) &pa->currentTxAntenna;
1340 +
1341 + case DOT11DIVERSITYSUPPORT:
1342 + return ( UCHAR * ) &pa->diversitySupport;
1343 +
1344 + case DOT11CURRENTRXANTENNA:
1345 +// *write_method = write_dot11CurrentRxAntenna;
1346 + return ( UCHAR * ) &pa->currentRxAntenna;
1347 +
1348 + default:
1349 + ERROR_MSG ( "" );
1350 + }
1351 + return NULL;
1352 +}
1353 +
1354 +/****************************************************************************
1355 +* *
1356 +* var_dot11PhyTxPowerTable() - *
1357 +* *
1358 +****************************************************************************/
1359 +unsigned char *
1360 +var_dot11PhyTxPowerTable ( struct variable *vp,
1361 + oid *name,
1362 + size_t *length,
1363 + int exact,
1364 + size_t *var_len,
1365 + WriteMethod **write_method )
1366 +{
1367 + int found = FALSE;
1368 + oid rName [ MAX_OID_LEN ]; // OID to be returned
1369 +
1370 + loadTables();
1371 + memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
1372 + for ( np = LIST_FIRST ( &ptList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
1373 + pt = ( struct ptTbl_data * ) np->data;
1374 + rName[vp->namelen] = pt->ifIndex;
1375 + if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) ||
1376 + ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) > 0 ))) {
1377 + switch ( vp->magic ) {
1378 + case DOT11NUMBERSUPPORTEDPOWERLEVELS:
1379 + if ( pt->haveNumberSupportedPowerLevels ) found = TRUE; break;
1380 + case DOT11TXPOWERLEVEL1:
1381 + if ( pt->haveTxPowerLevel1 ) found = TRUE; break;
1382 + case DOT11TXPOWERLEVEL2:
1383 + if ( pt->haveTxPowerLevel2 ) found = TRUE; break;
1384 + case DOT11TXPOWERLEVEL3:
1385 + if ( pt->haveTxPowerLevel3 ) found = TRUE; break;
1386 + case DOT11TXPOWERLEVEL4:
1387 + if ( pt->haveTxPowerLevel4 ) found = TRUE; break;
1388 + case DOT11TXPOWERLEVEL5:
1389 + if ( pt->haveTxPowerLevel5 ) found = TRUE; break;
1390 + case DOT11TXPOWERLEVEL6:
1391 + if ( pt->haveTxPowerLevel6 ) found = TRUE; break;
1392 + case DOT11TXPOWERLEVEL7:
1393 + if ( pt->haveTxPowerLevel7 ) found = TRUE; break;
1394 + case DOT11TXPOWERLEVEL8:
1395 + if ( pt->haveTxPowerLevel8 ) found = TRUE; break;
1396 + case DOT11CURRENTTXPOWERLEVEL:
1397 + if ( pt->currentTxPowerLevel ) found = TRUE; break;
1398 + }
1399 + }
1400 + if ( found )
1401 + break;
1402 + }
1403 +
1404 + if ( !found )
1405 + return NULL;
1406 +
1407 + memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid ));
1408 + *length = vp->namelen + 1;
1409 + *var_len = sizeof ( long );
1410 + *write_method = NULL;
1411 +
1412 + switch ( vp->magic ) {
1413 +
1414 + case DOT11NUMBERSUPPORTEDPOWERLEVELS:
1415 + return ( UCHAR * ) &pt->numberSupportedPowerLevels;
1416 +
1417 + case DOT11TXPOWERLEVEL1: return ( UCHAR * ) &pt->TxPowerLevel1;
1418 + case DOT11TXPOWERLEVEL2: return ( UCHAR * ) &pt->TxPowerLevel2;
1419 + case DOT11TXPOWERLEVEL3: return ( UCHAR * ) &pt->TxPowerLevel3;
1420 + case DOT11TXPOWERLEVEL4: return ( UCHAR * ) &pt->TxPowerLevel4;
1421 + case DOT11TXPOWERLEVEL5: return ( UCHAR * ) &pt->TxPowerLevel5;
1422 + case DOT11TXPOWERLEVEL6: return ( UCHAR * ) &pt->TxPowerLevel6;
1423 + case DOT11TXPOWERLEVEL7: return ( UCHAR * ) &pt->TxPowerLevel7;
1424 + case DOT11TXPOWERLEVEL8: return ( UCHAR * ) &pt->TxPowerLevel8;
1425 +
1426 + case DOT11CURRENTTXPOWERLEVEL:
1427 +// *write_method = write_dot11CurrentTxPowerLevel;
1428 + return ( UCHAR * ) &pt->currentTxPowerLevel;
1429 +
1430 + default:
1431 + ERROR_MSG ( "" );
1432 + }
1433 +
1434 + return NULL;
1435 +}
1436 +
1437 +/****************************************************************************
1438 +* *
1439 +* var_dot11PhyFHSSTable() - *
1440 +* *
1441 +****************************************************************************/
1442 +unsigned char *
1443 +var_dot11PhyFHSSTable ( struct variable *vp,
1444 + oid *name,
1445 + size_t *length,
1446 + int exact,
1447 + size_t *var_len,
1448 + WriteMethod **write_method )
1449 +{
1450 + int found = FALSE;
1451 + oid rName [ MAX_OID_LEN ]; // OID to be returned
1452 +
1453 + loadTables();
1454 + memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
1455 + for ( np = LIST_FIRST ( &pfList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
1456 + pf = ( struct pfTbl_data * ) np->data;
1457 + rName[vp->namelen] = pf->ifIndex;
1458 + if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) ||
1459 + ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) > 0 ))) {
1460 + switch ( vp->magic ) {
1461 + case DOT11HOPTIME:
1462 + if ( pf->haveHopTime ) found = TRUE; break;
1463 + case DOT11CURRENTCHANNELNUMBER:
1464 + if ( pf->haveCurrentChannelNumber ) found = TRUE; break;
1465 + case DOT11MAXDWELLTIME:
1466 + if ( pf->haveMaxDwellTime ) found = TRUE; break;
1467 + case DOT11CURRENTDWELLTIME:
1468 + if ( pf->haveCurrentDwellTime ) found = TRUE; break;
1469 + case DOT11CURRENTSET:
1470 + if ( pf->haveCurrentSet ) found = TRUE; break;
1471 + case DOT11CURRENTPATTERN:
1472 + if ( pf->haveCurrentPattern ) found = TRUE; break;
1473 + case DOT11CURRENTINDEX:
1474 + if ( pf->haveCurrentIndex ) found = TRUE; break;
1475 + }
1476 + }
1477 + if ( found )
1478 + break;
1479 + }
1480 +
1481 + if ( !found )
1482 + return NULL;
1483 +
1484 + memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid ));
1485 + *length = vp->namelen + 1;
1486 + *var_len = sizeof ( long );
1487 + *write_method = NULL;
1488 +
1489 + switch ( vp->magic ) {
1490 +
1491 + case DOT11HOPTIME:
1492 + return ( UCHAR * ) &pf->hopTime;
1493 +
1494 + case DOT11CURRENTCHANNELNUMBER:
1495 +// *write_method = write_dot11CurrentChannelNumber;
1496 + return ( UCHAR * ) &pf->currentChannelNumber;
1497 +
1498 + case DOT11MAXDWELLTIME:
1499 + return ( UCHAR * ) &pf->maxDwellTime;
1500 +
1501 + case DOT11CURRENTDWELLTIME:
1502 +// *write_method = write_dot11CurrentDwellTime;
1503 + return ( UCHAR * ) &pf->currentDwellTime;
1504 +
1505 + case DOT11CURRENTSET:
1506 +// *write_method = write_dot11CurrentSet;
1507 + return ( UCHAR * ) &pf->currentSet;
1508 +
1509 + case DOT11CURRENTPATTERN:
1510 +// *write_method = write_dot11CurrentPattern;
1511 + return ( UCHAR * ) &pf->currentPattern;
1512 +
1513 + case DOT11CURRENTINDEX:
1514 +// *write_method = write_dot11CurrentIndex;
1515 + return ( UCHAR * ) &pf->currentIndex;
1516 +
1517 + default:
1518 + ERROR_MSG ( "" );
1519 + }
1520 +
1521 + return NULL;
1522 +}
1523 +
1524 +/****************************************************************************
1525 +* *
1526 +* var_dot11PhyDSSSTable() - *
1527 +* *
1528 +****************************************************************************/
1529 +unsigned char *
1530 +var_dot11PhyDSSSTable ( struct variable *vp,
1531 + oid *name,
1532 + size_t *length,
1533 + int exact,
1534 + size_t *var_len,
1535 + WriteMethod **write_method )
1536 +{
1537 + int found = FALSE;
1538 + oid rName [ MAX_OID_LEN ]; // OID to be returned
1539 +
1540 + loadTables();
1541 + memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
1542 + for ( np = LIST_FIRST ( &pdList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
1543 + pd = ( struct pdTbl_data * ) np->data;
1544 + rName[vp->namelen] = pd->ifIndex;
1545 + if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) ||
1546 + ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) > 0 ))) {
1547 + switch ( vp->magic ) {
1548 + case DOT11CURRENTCHANNEL:
1549 + if ( pd->haveCurrentChannel ) found = TRUE; break;
1550 + case DOT11CCAMODESUPPORTED:
1551 + if ( pd->haveCCAModeSupported ) found = TRUE; break;
1552 + case DOT11CURRENTCCAMODE:
1553 + if ( pd->haveCurrentCCAMode ) found = TRUE; break;
1554 + case DOT11EDTHRESHOLD:
1555 + if ( pd->haveEDThreshold ) found = TRUE; break;
1556 + }
1557 + }
1558 + if ( found )
1559 + break;
1560 + }
1561 +
1562 + if ( !found )
1563 + return NULL;
1564 +
1565 + memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid ));
1566 + *length = vp->namelen + 1;
1567 + *var_len = sizeof ( long );
1568 + *write_method = NULL;
1569 +
1570 + switch ( vp->magic ) {
1571 +
1572 + case DOT11CURRENTCHANNEL:
1573 +// *write_method = write_dot11CurrentChannel;
1574 + return ( UCHAR * ) &pd->currentChannel;
1575 +
1576 + case DOT11CCAMODESUPPORTED:
1577 + return ( UCHAR * ) &pd->CCAModeSupported;
1578 +
1579 + case DOT11CURRENTCCAMODE:
1580 +// *write_method = write_dot11CurrentCCAMode;
1581 + return ( UCHAR * ) &pd->currentCCAMode;
1582 +
1583 + case DOT11EDTHRESHOLD:
1584 +// *write_method = write_dot11EDThreshold;
1585 + return ( UCHAR * ) &pd->EDThreshold;
1586 +
1587 + default:
1588 + ERROR_MSG ( "" );
1589 + }
1590 +
1591 + return NULL;
1592 +}
1593 +
1594 +/****************************************************************************
1595 +* *
1596 +* var_dot11PhyIRTable() - *
1597 +* *
1598 +****************************************************************************/
1599 +unsigned char *
1600 +var_dot11PhyIRTable ( struct variable *vp,
1601 + oid *name,
1602 + size_t *length,
1603 + int exact,
1604 + size_t *var_len,
1605 + WriteMethod **write_method)
1606 +{
1607 +
1608 + int found = FALSE;
1609 + oid rName [ MAX_OID_LEN ]; // OID to be returned
1610 +
1611 + loadTables();
1612 + memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
1613 + for ( np = LIST_FIRST ( &piList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
1614 + pi = ( struct piTbl_data * ) np->data;
1615 + rName[vp->namelen] = pi->ifIndex;
1616 + if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) == 0 )) ||
1617 + ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 1, name, *length ) > 0 ))) {
1618 + switch ( vp->magic ) {
1619 + case DOT11CCAWATCHDOGTIMERMAX:
1620 + if ( pi->CCAWatchdogTimerMax ) found = TRUE; break;
1621 + case DOT11CCAWATCHDOGCOUNTMAX:
1622 + if ( pi->CCAWatchdogCountMax ) found = TRUE; break;
1623 + case DOT11CCAWATCHDOGTIMERMIN:
1624 + if ( pi->CCAWatchdogTimerMin ) found = TRUE; break;
1625 + case DOT11CCAWATCHDOGCOUNTMIN:
1626 + if ( pi->CCAWatchdogCountMin ) found = TRUE; break;
1627 + }
1628 + }
1629 + if ( found )
1630 + break;
1631 + }
1632 +
1633 + if ( !found )
1634 + return NULL;
1635 +
1636 + memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 1 ) * sizeof ( oid ));
1637 + *length = vp->namelen + 1;
1638 + *var_len = sizeof ( long );
1639 + *write_method = NULL;
1640 +
1641 + switch ( vp->magic ) {
1642 +
1643 + case DOT11CCAWATCHDOGTIMERMAX:
1644 +// *write_method = write_dot11CCAWatchdogTimerMax;
1645 + return ( UCHAR * ) &pi->CCAWatchdogTimerMax;
1646 +
1647 + case DOT11CCAWATCHDOGCOUNTMAX:
1648 +// *write_method = write_dot11CCAWatchdogCountMax;
1649 + return ( UCHAR * ) &pi->CCAWatchdogCountMax;
1650 +
1651 + case DOT11CCAWATCHDOGTIMERMIN:
1652 +// *write_method = write_dot11CCAWatchdogTimerMin;
1653 + return ( UCHAR * ) &pi->CCAWatchdogTimerMin;
1654 +
1655 + case DOT11CCAWATCHDOGCOUNTMIN:
1656 +// *write_method = write_dot11CCAWatchdogCountMin;
1657 + return ( UCHAR * ) &pi->CCAWatchdogCountMin;
1658 +
1659 + default:
1660 + ERROR_MSG ( "" );
1661 + }
1662 +
1663 + return NULL;
1664 +}
1665 +
1666 +/****************************************************************************
1667 +* *
1668 +* var_dot11RegDomainsSupportedTable() - *
1669 +* *
1670 +****************************************************************************/
1671 +unsigned char *
1672 +var_dot11RegDomainsSupportedTable ( struct variable *vp,
1673 + oid *name,
1674 + size_t *length,
1675 + int exact,
1676 + size_t *var_len,
1677 + WriteMethod **write_method)
1678 +{
1679 + int found = FALSE;
1680 + oid rName [ MAX_OID_LEN ]; // OID to be returned
1681 +
1682 + loadTables();
1683 + memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
1684 + for ( np = LIST_FIRST ( &rdList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
1685 + rd = ( struct rdTbl_data * ) np->data;
1686 + rName[vp->namelen + 0] = rd->ifIndex;
1687 + rName[vp->namelen + 1] = rd->regDomainsSupportIndex;
1688 + if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) == 0 )) ||
1689 + ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) > 0 ))) {
1690 + switch ( vp->magic ) {
1691 + case DOT11REGDOMAINSSUPPORTVALUE:
1692 + if ( rd->haveRegDomainsSupportValue ) found = TRUE; break;
1693 + }
1694 + }
1695 + if ( found )
1696 + break;
1697 + }
1698 +
1699 + if ( !found )
1700 + return NULL;
1701 +
1702 + memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 2 ) * sizeof ( oid ));
1703 + *length = vp->namelen + 2;
1704 + *var_len = sizeof ( long );
1705 + *write_method = NULL;
1706 +
1707 + switch ( vp->magic ) {
1708 +
1709 + case DOT11REGDOMAINSSUPPORTVALUE:
1710 + return ( UCHAR * ) &rd->regDomainsSupportValue;
1711 +
1712 + default:
1713 + ERROR_MSG ( "" );
1714 + }
1715 +
1716 + return NULL;
1717 +}
1718 +
1719 +/****************************************************************************
1720 +* *
1721 +* var_dot11AntennasListTable() - *
1722 +* *
1723 +****************************************************************************/
1724 +unsigned char *
1725 +var_dot11AntennasListTable(struct variable *vp,
1726 + oid *name,
1727 + size_t *length,
1728 + int exact,
1729 + size_t *var_len,
1730 + WriteMethod **write_method)
1731 +{
1732 + int found = FALSE;
1733 + oid rName [ MAX_OID_LEN ]; // OID to be returned
1734 +
1735 + loadTables();
1736 + memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
1737 + for ( np = LIST_FIRST ( &alList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
1738 + al = ( struct alTbl_data * ) np->data;
1739 + rName[vp->namelen + 0] = al->ifIndex;
1740 + rName[vp->namelen + 1] = al->antennaListIndex;
1741 + if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) == 0 )) ||
1742 + ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) > 0 ))) {
1743 + switch ( vp->magic ) {
1744 + case DOT11SUPPORTEDTXANTENNA:
1745 + if ( al->haveSupportedTxAntenna ) found = TRUE; break;
1746 + case DOT11SUPPORTEDRXANTENNA:
1747 + if ( al->haveSupportedRxAntenna ) found = TRUE; break;
1748 + case DOT11DIVERSITYSELECTIONRX:
1749 + if ( al->haveDiversitySelectionRx ) found = TRUE; break;
1750 + }
1751 + }
1752 + if ( found )
1753 + break;
1754 + }
1755 +
1756 + if ( !found )
1757 + return NULL;
1758 +
1759 + memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 2 ) * sizeof ( oid ));
1760 + *length = vp->namelen + 2;
1761 + *var_len = sizeof ( long );
1762 + *write_method = NULL;
1763 +
1764 + switch ( vp->magic ) {
1765 +
1766 + case DOT11SUPPORTEDTXANTENNA:
1767 +// *write_method = write_dot11SupportedTxAntenna;
1768 + return ( UCHAR * ) &al->supportedTxAntenna;
1769 +
1770 + case DOT11SUPPORTEDRXANTENNA:
1771 +// *write_method = write_dot11SupportedRxAntenna;
1772 + return ( UCHAR * ) &al->supportedRxAntenna;
1773 +
1774 + case DOT11DIVERSITYSELECTIONRX:
1775 +// *write_method = write_dot11DiversitySelectionRx;
1776 + return ( UCHAR * ) &al->diversitySelectionRx;
1777 +
1778 + default:
1779 + ERROR_MSG ( "" );
1780 + }
1781 +
1782 + return NULL;
1783 +}
1784 +
1785 +/****************************************************************************
1786 +* *
1787 +* var_dot11SupportedDataRatesTxTable() - *
1788 +* *
1789 +****************************************************************************/
1790 +unsigned char *
1791 +var_dot11SupportedDataRatesTxTable ( struct variable *vp,
1792 + oid *name,
1793 + size_t *length,
1794 + int exact,
1795 + size_t *var_len,
1796 + WriteMethod **write_method )
1797 +{
1798 + int found = FALSE;
1799 + oid rName [ MAX_OID_LEN ]; // OID to be returned
1800 +
1801 + loadTables();
1802 + memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
1803 + for ( np = LIST_FIRST ( &rtList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
1804 + rt = ( struct rtTbl_data * ) np->data;
1805 + rName[vp->namelen + 0] = rt->ifIndex;
1806 + rName[vp->namelen + 1] = rt->supportedDataRatesTxIndex;
1807 + if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) == 0 )) ||
1808 + ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) > 0 ))) {
1809 + switch ( vp->magic ) {
1810 + case DOT11SUPPORTEDDATARATESTXVALUE:
1811 + if ( rt->haveSupportedDataRatesTxValue ) found = TRUE; break;
1812 + }
1813 + }
1814 + if ( found )
1815 + break;
1816 + }
1817 +
1818 + if ( !found )
1819 + return NULL;
1820 +
1821 + memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 2 ) * sizeof ( oid ));
1822 + *length = vp->namelen + 2;
1823 + *var_len = sizeof ( long );
1824 + *write_method = NULL;
1825 +
1826 + switch ( vp->magic ) {
1827 +
1828 + case DOT11SUPPORTEDDATARATESTXVALUE:
1829 + return ( UCHAR * ) &rt->supportedDataRatesTxValue;
1830 +
1831 + default:
1832 + ERROR_MSG ( "" );
1833 + }
1834 +
1835 + return NULL;
1836 +}
1837 +
1838 +/****************************************************************************
1839 +* *
1840 +* var_dot11SupportedDataRatesRxTable() - *
1841 +* *
1842 +****************************************************************************/
1843 +unsigned char *
1844 +var_dot11SupportedDataRatesRxTable ( struct variable *vp,
1845 + oid *name,
1846 + size_t *length,
1847 + int exact,
1848 + size_t *var_len,
1849 + WriteMethod **write_method )
1850 +{
1851 + int found = FALSE;
1852 + oid rName [ MAX_OID_LEN ]; // OID to be returned
1853 +
1854 + loadTables();
1855 + memcpy (( char * ) rName, ( char * ) vp->name, ( int ) vp->namelen * sizeof ( oid ));
1856 + for ( np = LIST_FIRST ( &rrList ); np != NULL; np = LIST_NEXT ( np, nodes )) {
1857 + rr = ( struct rrTbl_data * ) np->data;
1858 + rName[vp->namelen + 0] = rr->ifIndex;
1859 + rName[vp->namelen + 1] = rr->supportedDataRatesRxIndex;
1860 + if (( exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) == 0 )) ||
1861 + ( !exact && ( snmp_oid_compare ( rName, vp->namelen + 2, name, *length ) > 0 ))) {
1862 + switch ( vp->magic ) {
1863 + case DOT11SUPPORTEDDATARATESRXVALUE:
1864 + if ( rr->haveSupportedDataRatesRxValue ) found = TRUE; break;
1865 + }
1866 + }
1867 + if ( found )
1868 + break;
1869 + }
1870 +
1871 + if ( !found )
1872 + return NULL;
1873 +
1874 + memcpy (( char * ) name, ( char * ) rName, ( vp->namelen + 2 ) * sizeof ( oid ));
1875 + *length = vp->namelen + 2;
1876 + *var_len = sizeof ( long );
1877 + *write_method = NULL;
1878 +
1879 + switch ( vp->magic ) {
1880 +
1881 + case DOT11SUPPORTEDDATARATESRXVALUE:
1882 + return ( UCHAR * ) &rr->supportedDataRatesRxValue;
1883 +
1884 + default:
1885 + ERROR_MSG ( "" );
1886 + }
1887 +
1888 + return NULL;
1889 +}
1890 +
1891 +/****************************************************************************
1892 +* *
1893 +****************************************************************************/
1894 +int
1895 +write_dot11StationID(int action,
1896 + u_char *var_val,
1897 + u_char var_val_type,
1898 + size_t var_val_len,
1899 + u_char *statP,
1900 + oid *name,
1901 + size_t name_len)
1902 +{
1903 + static unsigned char string[SPRINT_MAX_LEN];
1904 + int size;
1905 +
1906 + switch ( action ) {
1907 +
1908 + case RESERVE1:
1909 + if ( var_val_type != ASN_OCTET_STR ) {
1910 + fprintf ( stderr, "write to dot11StationID not ASN_OCTET_STR\n" );
1911 + return SNMP_ERR_WRONGTYPE;
1912 + }
1913 + if ( var_val_len > sizeof ( string )) {
1914 + fprintf ( stderr,"write to dot11StationID: bad length\n" );
1915 + return SNMP_ERR_WRONGLENGTH;
1916 + }
1917 + break;
1918 +
1919 + case RESERVE2:
1920 + case FREE:
1921 + case ACTION:
1922 + case UNDO:
1923 + break;
1924 +
1925 + case COMMIT:
1926 + break;
1927 + }
1928 +
1929 + return SNMP_ERR_NOERROR;
1930 +}
1931 +
1932 +/****************************************************************************
1933 +* *
1934 +****************************************************************************/
1935 +int
1936 +write_dot11MediumOccupancyLimit(int action,
1937 + u_char *var_val,
1938 + u_char var_val_type,
1939 + size_t var_val_len,
1940 + u_char *statP,
1941 + oid *name,
1942 + size_t name_len)
1943 +{
1944 + static long *long_ret;
1945 + int size;
1946 +
1947 + switch ( action ) {
1948 +
1949 + case RESERVE1:
1950 + if ( var_val_type != ASN_INTEGER ) {
1951 + fprintf ( stderr, "write to dot11MediumOccupancyLimit not ASN_INTEGER\n" );
1952 + return SNMP_ERR_WRONGTYPE;
1953 + }
1954 + if ( var_val_len > sizeof ( long_ret )){
1955 + fprintf ( stderr,"write to dot11MediumOccupancyLimit: bad length\n" );
1956 + return SNMP_ERR_WRONGLENGTH;
1957 + }
1958 + break;
1959 +
1960 + case RESERVE2:
1961 + case FREE:
1962 + case ACTION:
1963 + case UNDO:
1964 + break;
1965 +
1966 + case COMMIT:
1967 + break;
1968 + }
1969 +
1970 + return SNMP_ERR_NOERROR;
1971 +}
1972 +
1973 +/****************************************************************************
1974 +* *
1975 +****************************************************************************/
1976 +int
1977 +write_dot11CFPPeriod(int action,
1978 + u_char *var_val,
1979 + u_char var_val_type,
1980 + size_t var_val_len,
1981 + u_char *statP,
1982 + oid *name,
1983 + size_t name_len)
1984 +{
1985 + static long *long_ret;
1986 + int size;
1987 +
1988 + switch ( action ) {
1989 +
1990 + case RESERVE1:
1991 + if ( var_val_type != ASN_INTEGER ) {
1992 + fprintf ( stderr, "write to dot11CFPPeriod not ASN_INTEGER\n" );
1993 + return SNMP_ERR_WRONGTYPE;
1994 + }
1995 + if ( var_val_len > sizeof ( long_ret )){
1996 + fprintf ( stderr, "write to dot11CFPPeriod: bad length\n" );
1997 + return SNMP_ERR_WRONGLENGTH;
1998 + }
1999 + break;
2000 +
2001 + case RESERVE2:
2002 + case FREE:
2003 + case ACTION:
2004 + case UNDO:
2005 + break;
2006 +
2007 + case COMMIT:
2008 + break;
2009 + }
2010 +
2011 + return SNMP_ERR_NOERROR;
2012 +}
2013 +
2014 +/****************************************************************************
2015 +* *
2016 +****************************************************************************/
2017 +int
2018 +write_dot11CFPMaxDuration(int action,
2019 + u_char *var_val,
2020 + u_char var_val_type,
2021 + size_t var_val_len,
2022 + u_char *statP,
2023 + oid *name,
2024 + size_t name_len)
2025 +{
2026 + static long *long_ret;
2027 + int size;
2028 +
2029 + switch ( action ) {
2030 +
2031 + case RESERVE1:
2032 + if ( var_val_type != ASN_INTEGER ) {
2033 + fprintf ( stderr, "write to dot11CFPMaxDuration not ASN_INTEGER\n" );
2034 + return SNMP_ERR_WRONGTYPE;
2035 + }
2036 + if ( var_val_len > sizeof ( long_ret )){
2037 + fprintf ( stderr, "write to dot11CFPMaxDuration: bad length\n" );
2038 + return SNMP_ERR_WRONGLENGTH;
2039 + }
2040 + break;
2041 +
2042 + case RESERVE2:
2043 + case FREE:
2044 + case ACTION:
2045 + case UNDO:
2046 + break;
2047 +
2048 + case COMMIT:
2049 + break;
2050 + }
2051 +
2052 + return SNMP_ERR_NOERROR;
2053 +}
2054 +
2055 +/****************************************************************************
2056 +* *
2057 +****************************************************************************/
2058 +int
2059 +write_dot11AuthenticationResponseTimeOut(int action,
2060 + u_char *var_val,
2061 + u_char var_val_type,
2062 + size_t var_val_len,
2063 + u_char *statP,
2064 + oid *name,
2065 + size_t name_len)
2066 +{
2067 + static long *long_ret;
2068 + int size;
2069 +
2070 + switch ( action ) {
2071 +
2072 + case RESERVE1:
2073 + if ( var_val_type != ASN_INTEGER ) {
2074 + fprintf ( stderr, "write to dot11AuthenticationResponseTimeOut not ASN_INTEGER\n" );
2075 + return SNMP_ERR_WRONGTYPE;
2076 + }
2077 + if ( var_val_len > sizeof ( long_ret )){
2078 + fprintf ( stderr, "write to dot11AuthenticationResponseTimeOut: bad length\n" );
2079 + return SNMP_ERR_WRONGLENGTH;
2080 + }
2081 + break;
2082 +
2083 + case RESERVE2:
2084 + case FREE:
2085 + case ACTION:
2086 + case UNDO:
2087 + break;
2088 +
2089 + case COMMIT:
2090 + break;
2091 + }
2092 +
2093 + return SNMP_ERR_NOERROR;
2094 +}
2095 +
2096 +/****************************************************************************
2097 +* *
2098 +****************************************************************************/
2099 +int
2100 +write_dot11PowerManagementMode(int action,
2101 + u_char *var_val,
2102 + u_char var_val_type,
2103 + size_t var_val_len,
2104 + u_char *statP,
2105 + oid *name,
2106 + size_t name_len)
2107 +{
2108 + static long *long_ret;
2109 + int size;
2110 +
2111 + switch ( action ) {
2112 +
2113 + case RESERVE1:
2114 + if ( var_val_type != ASN_INTEGER ) {
2115 + fprintf ( stderr, "write to dot11PowerManagementMode not ASN_INTEGER\n" );
2116 + return SNMP_ERR_WRONGTYPE;
2117 + }
2118 + if ( var_val_len > sizeof ( long_ret )) {
2119 + fprintf ( stderr, "write to dot11PowerManagementMode: bad length\n" );
2120 + return SNMP_ERR_WRONGLENGTH;
2121 + }
2122 + break;
2123 +
2124 + case RESERVE2:
2125 + case FREE:
2126 + case ACTION:
2127 + case UNDO:
2128 + break;
2129 +
2130 + case COMMIT:
2131 + break;
2132 + }
2133 +
2134 + return SNMP_ERR_NOERROR;
2135 +}
2136 +
2137 +/****************************************************************************
2138 +* *
2139 +****************************************************************************/
2140 +int
2141 +write_dot11DesiredSSID(int action,
2142 + u_char *var_val,
2143 + u_char var_val_type,
2144 + size_t var_val_len,
2145 + u_char *statP,
2146 + oid *name,
2147 + size_t name_len)
2148 +{
2149 + static unsigned char string[SPRINT_MAX_LEN];
2150 + int size;
2151 +
2152 + switch ( action ) {
2153 +
2154 + case RESERVE1:
2155 + if ( var_val_type != ASN_OCTET_STR ) {
2156 + fprintf ( stderr, "write to dot11DesiredSSID not ASN_OCTET_STR\n" );
2157 + return SNMP_ERR_WRONGTYPE;
2158 + }
2159 + if ( var_val_len > sizeof ( string )){
2160 + fprintf ( stderr, "write to dot11DesiredSSID: bad length\n" );
2161 + return SNMP_ERR_WRONGLENGTH;
2162 + }
2163 + break;
2164 +
2165 + case RESERVE2:
2166 + case FREE:
2167 + case ACTION:
2168 + case UNDO:
2169 + break;
2170 +
2171 + case COMMIT:
2172 + break;
2173 + }
2174 +
2175 + return SNMP_ERR_NOERROR;
2176 +}
2177 +
2178 +/****************************************************************************
2179 +* *
2180 +****************************************************************************/
2181 +int
2182 +write_dot11DesiredBSSType(int action,
2183 + u_char *var_val,
2184 + u_char var_val_type,
2185 + size_t var_val_len,
2186 + u_char *statP,
2187 + oid *name,
2188 + size_t name_len)
2189 +{
2190 + static long *long_ret;
2191 + int size;
2192 +
2193 + switch ( action ) {
2194 +
2195 + case RESERVE1:
2196 + if ( var_val_type != ASN_INTEGER ) {
2197 + fprintf ( stderr, "write to dot11DesiredBSSType not ASN_INTEGER\n" );
2198 + return SNMP_ERR_WRONGTYPE;
2199 + }
2200 + if ( var_val_len > sizeof ( long_ret )){
2201 + fprintf ( stderr, "write to dot11DesiredBSSType: bad length\n" );
2202 + return SNMP_ERR_WRONGLENGTH;
2203 + }
2204 + break;
2205 +
2206 + case RESERVE2:
2207 + case FREE:
2208 + case ACTION:
2209 + case UNDO:
2210 + break;
2211 +
2212 + case COMMIT:
2213 + break;
2214 + }
2215 +
2216 + return SNMP_ERR_NOERROR;
2217 +}
2218 +
2219 +/****************************************************************************
2220 +* *
2221 +****************************************************************************/
2222 +int
2223 +write_dot11OperationalRateSet(int action,
2224 + u_char *var_val,
2225 + u_char var_val_type,
2226 + size_t var_val_len,
2227 + u_char *statP,
2228 + oid *name,
2229 + size_t name_len)
2230 +{
2231 + static unsigned char string[SPRINT_MAX_LEN];
2232 + int size;
2233 +
2234 + switch ( action ) {
2235 +
2236 + case RESERVE1:
2237 + if ( var_val_type != ASN_OCTET_STR ) {
2238 + fprintf ( stderr, "write to dot11OperationalRateSet not ASN_OCTET_STR\n" );
2239 + return SNMP_ERR_WRONGTYPE;
2240 + }
2241 + if ( var_val_len > sizeof ( string )){
2242 + fprintf ( stderr, "write to dot11OperationalRateSet: bad length\n" );
2243 + return SNMP_ERR_WRONGLENGTH;
2244 + }
2245 + break;
2246 +
2247 + case RESERVE2:
2248 + case FREE:
2249 + case ACTION:
2250 + case UNDO:
2251 + break;
2252 +
2253 + case COMMIT:
2254 + break;
2255 + }
2256 +
2257 + return SNMP_ERR_NOERROR;
2258 +}
2259 +
2260 +/****************************************************************************
2261 +* *
2262 +****************************************************************************/
2263 +int
2264 +write_dot11BeaconPeriod(int action,
2265 + u_char *var_val,
2266 + u_char var_val_type,
2267 + size_t var_val_len,
2268 + u_char *statP,
2269 + oid *name,
2270 + size_t name_len)
2271 +{
2272 + static long *long_ret;
2273 + int size;
2274 +
2275 + switch ( action ) {
2276 +
2277 + case RESERVE1:
2278 + if ( var_val_type != ASN_INTEGER ) {
2279 + fprintf ( stderr, "write to dot11BeaconPeriod not ASN_INTEGER\n" );
2280 + return SNMP_ERR_WRONGTYPE;
2281 + }
2282 + if ( var_val_len > sizeof ( long_ret )){
2283 + fprintf ( stderr,"write to dot11BeaconPeriod: bad length\n" );
2284 + return SNMP_ERR_WRONGLENGTH;
2285 + }
2286 + break;
2287 +
2288 + case RESERVE2:
2289 + case FREE:
2290 + case ACTION:
2291 + case UNDO:
2292 + break;
2293 +
2294 + case COMMIT:
2295 + break;
2296 + }
2297 +
2298 + return SNMP_ERR_NOERROR;
2299 +}
2300 +
2301 +/****************************************************************************
2302 +* *
2303 +****************************************************************************/
2304 +int
2305 +write_dot11DTIMPeriod(int action,
2306 + u_char *var_val,
2307 + u_char var_val_type,
2308 + size_t var_val_len,
2309 + u_char *statP,
2310 + oid *name,
2311 + size_t name_len)
2312 +{
2313 + static long *long_ret;
2314 + int size;
2315 +
2316 + switch ( action ) {
2317 +
2318 + case RESERVE1:
2319 + if ( var_val_type != ASN_INTEGER ) {
2320 + fprintf ( stderr, "write to dot11DTIMPeriod not ASN_INTEGER\n" );
2321 + return SNMP_ERR_WRONGTYPE;
2322 + }
2323 + if ( var_val_len > sizeof ( long_ret )){
2324 + fprintf ( stderr,"write to dot11DTIMPeriod: bad length\n" );
2325 + return SNMP_ERR_WRONGLENGTH;
2326 + }
2327 + break;
2328 +
2329 + case RESERVE2:
2330 + case FREE:
2331 + case ACTION:
2332 + case UNDO:
2333 + break;
2334 +
2335 + case COMMIT:
2336 + break;
2337 + }
2338 +
2339 + return SNMP_ERR_NOERROR;
2340 +}
2341 +
2342 +/****************************************************************************
2343 +* *
2344 +****************************************************************************/
2345 +int
2346 +write_dot11AssociationResponseTimeOut(int action,
2347 + u_char *var_val,
2348 + u_char var_val_type,
2349 + size_t var_val_len,
2350 + u_char *statP,
2351 + oid *name,
2352 + size_t name_len)
2353 +{
2354 + static long *long_ret;
2355 + int size;
2356 +
2357 + switch ( action ) {
2358 +
2359 + case RESERVE1:
2360 + if ( var_val_type != ASN_INTEGER ) {
2361 + fprintf ( stderr, "write to dot11AssociationResponseTimeOut not ASN_INTEGER\n" );
2362 + return SNMP_ERR_WRONGTYPE;
2363 + }
2364 + if ( var_val_len > sizeof ( long_ret )) {
2365 + fprintf ( stderr,"write to dot11AssociationResponseTimeOut: bad length\n" );
2366 + return SNMP_ERR_WRONGLENGTH;
2367 + }
2368 + break;
2369 +
2370 + case RESERVE2:
2371 + case FREE:
2372 + case ACTION:
2373 + case UNDO:
2374 + break;
2375 +
2376 + case COMMIT:
2377 + break;
2378 + }
2379 +
2380 + return SNMP_ERR_NOERROR;
2381 +}
2382 +
2383 +/****************************************************************************
2384 +* *
2385 +****************************************************************************/
2386 +int
2387 +write_dot11AuthenticationAlgorithmsEnable(int action,
2388 + u_char *var_val,
2389 + u_char var_val_type,
2390 + size_t var_val_len,
2391 + u_char *statP,
2392 + oid *name,
2393 + size_t name_len)
2394 +{
2395 + static long *long_ret;
2396 + int size;
2397 +
2398 + switch ( action ) {
2399 +
2400 + case RESERVE1:
2401 + if ( var_val_type != ASN_INTEGER ) {
2402 + fprintf ( stderr, "write to dot11AuthenticationAlgorithmsEnable not ASN_INTEGER\n" );
2403 + return SNMP_ERR_WRONGTYPE;
2404 + }
2405 + if ( var_val_len > sizeof ( long_ret )){
2406 + fprintf ( stderr,"write to dot11AuthenticationAlgorithmsEnable: bad length\n" );
2407 + return SNMP_ERR_WRONGLENGTH;
2408 + }
2409 + break;
2410 +
2411 + case RESERVE2:
2412 + case FREE:
2413 + case ACTION:
2414 + case UNDO:
2415 + break;
2416 +
2417 + case COMMIT:
2418 + break;
2419 + }
2420 +
2421 + return SNMP_ERR_NOERROR;
2422 +}
2423 +
2424 +/****************************************************************************
2425 +* *
2426 +****************************************************************************/
2427 +int
2428 +write_dot11WEPDefaultKeyValue(int action,
2429 + u_char *var_val,
2430 + u_char var_val_type,
2431 + size_t var_val_len,
2432 + u_char *statP,
2433 + oid *name,
2434 + size_t name_len)
2435 +{
2436 + static unsigned char string[SPRINT_MAX_LEN];
2437 + int size;
2438 +
2439 + switch ( action ) {
2440 +
2441 + case RESERVE1:
2442 + if ( var_val_type != ASN_OCTET_STR ) {
2443 + fprintf ( stderr, "write to dot11WEPDefaultKeyValue not ASN_OCTET_STR\n" );
2444 + return SNMP_ERR_WRONGTYPE;
2445 + }
2446 + if ( var_val_len > sizeof ( string )){
2447 + fprintf ( stderr,"write to dot11WEPDefaultKeyValue: bad length\n" );
2448 + return SNMP_ERR_WRONGLENGTH;
2449 + }
2450 + break;
2451 +
2452 + case RESERVE2:
2453 + case FREE:
2454 + case ACTION:
2455 + case UNDO:
2456 + break;
2457 +
2458 + case COMMIT:
2459 + break;
2460 + }
2461 +
2462 + return SNMP_ERR_NOERROR;
2463 +}
2464 +
2465 +/****************************************************************************
2466 +* *
2467 +****************************************************************************/
2468 +int
2469 +write_dot11WEPKeyMappingAddress(int action,
2470 + u_char *var_val,
2471 + u_char var_val_type,
2472 + size_t var_val_len,
2473 + u_char *statP,
2474 + oid *name,
2475 + size_t name_len)
2476 +{
2477 + static unsigned char string[SPRINT_MAX_LEN];
2478 + int size;
2479 +
2480 + switch ( action ) {
2481 +
2482 + case RESERVE1:
2483 + if ( var_val_type != ASN_OCTET_STR ) {
2484 + fprintf ( stderr, "write to dot11WEPKeyMappingAddress not ASN_OCTET_STR\n" );
2485 + return SNMP_ERR_WRONGTYPE;
2486 + }
2487 + if ( var_val_len > sizeof ( string )) {
2488 + fprintf ( stderr,"write to dot11WEPKeyMappingAddress: bad length\n" );
2489 + return SNMP_ERR_WRONGLENGTH;
2490 + }
2491 + break;
2492 +
2493 + case RESERVE2:
2494 + case FREE:
2495 + case ACTION:
2496 + case UNDO:
2497 + break;
2498 +
2499 + case COMMIT:
2500 + break;
2501 + }
2502 +
2503 + return SNMP_ERR_NOERROR;
2504 +}
2505 +
2506 +/****************************************************************************
2507 +* *
2508 +****************************************************************************/
2509 +int
2510 +write_dot11WEPKeyMappingWEPOn(int action,
2511 + u_char *var_val,
2512 + u_char var_val_type,
2513 + size_t var_val_len,
2514 + u_char *statP,
2515 + oid *name,
2516 + size_t name_len)
2517 +{
2518 + static long *long_ret;
2519 + int size;
2520 +
2521 + switch ( action ) {
2522 +
2523 + case RESERVE1:
2524 + if ( var_val_type != ASN_INTEGER ) {
2525 + fprintf ( stderr, "write to dot11WEPKeyMappingWEPOn not ASN_INTEGER\n" );
2526 + return SNMP_ERR_WRONGTYPE;
2527 + }
2528 + if ( var_val_len > sizeof ( long_ret )){
2529 + fprintf ( stderr, "write to dot11WEPKeyMappingWEPOn: bad length\n" );
2530 + return SNMP_ERR_WRONGLENGTH;
2531 + }
2532 + break;
2533 +
2534 + case RESERVE2:
2535 + case FREE:
2536 + case ACTION:
2537 + case UNDO:
2538 + break;
2539 +
2540 + case COMMIT:
2541 + break;
2542 + }
2543 +
2544 + return SNMP_ERR_NOERROR;
2545 +}
2546 +
2547 +/****************************************************************************
2548 +* *
2549 +****************************************************************************/
2550 +int
2551 +write_dot11WEPKeyMappingValue(int action,
2552 + u_char *var_val,
2553 + u_char var_val_type,
2554 + size_t var_val_len,
2555 + u_char *statP,
2556 + oid *name,
2557 + size_t name_len)
2558 +{
2559 + static unsigned char string[SPRINT_MAX_LEN];
2560 + int size;
2561 +
2562 + switch ( action ) {
2563 +
2564 + case RESERVE1:
2565 + if ( var_val_type != ASN_OCTET_STR ) {
2566 + fprintf ( stderr, "write to dot11WEPKeyMappingValue not ASN_OCTET_STR\n" );
2567 + return SNMP_ERR_WRONGTYPE;
2568 + }
2569 + if ( var_val_len > sizeof ( string )) {
2570 + fprintf ( stderr, "write to dot11WEPKeyMappingValue: bad length\n" );
2571 + return SNMP_ERR_WRONGLENGTH;
2572 + }
2573 + break;
2574 +
2575 + case RESERVE2:
2576 + case FREE:
2577 + case ACTION:
2578 + case UNDO:
2579 + break;
2580 +
2581 + case COMMIT:
2582 + break;
2583 + }
2584 +
2585 + return SNMP_ERR_NOERROR;
2586 +}
2587 +
2588 +/****************************************************************************
2589 +* *
2590 +****************************************************************************/
2591 +int
2592 +write_dot11WEPKeyMappingStatus(int action,
2593 + u_char *var_val,
2594 + u_char var_val_type,
2595 + size_t var_val_len,
2596 + u_char *statP,
2597 + oid *name,
2598 + size_t name_len)
2599 +{
2600 + static long *long_ret;
2601 + int size;
2602 +
2603 + switch ( action ) {
2604 + case RESERVE1:
2605 + if ( var_val_type != ASN_INTEGER ) {
2606 + fprintf ( stderr, "write to dot11WEPKeyMappingStatus not ASN_INTEGER\n" );
2607 + return SNMP_ERR_WRONGTYPE;
2608 + }
2609 + if ( var_val_len > sizeof ( long_ret )){
2610 + fprintf ( stderr, "write to dot11WEPKeyMappingStatus: bad length\n" );
2611 + return SNMP_ERR_WRONGLENGTH;
2612 + }
2613 + break;
2614 +
2615 + case RESERVE2:
2616 + case FREE:
2617 + case ACTION:
2618 + case UNDO:
2619 + break;
2620 +
2621 + case COMMIT:
2622 + break;
2623 + }
2624 +
2625 + return SNMP_ERR_NOERROR;
2626 +}
2627 +
2628 +/****************************************************************************
2629 +* *
2630 +****************************************************************************/
2631 +int
2632 +write_dot11PrivacyInvoked(int action,
2633 + u_char *var_val,
2634 + u_char var_val_type,
2635 + size_t var_val_len,
2636 + u_char *statP,
2637 + oid *name,
2638 + size_t name_len)
2639 +{
2640 + static long *long_ret;
2641 + int size;
2642 +
2643 + switch ( action ) {
2644 +
2645 + case RESERVE1:
2646 + if ( var_val_type != ASN_INTEGER ) {
2647 + fprintf ( stderr, "write to dot11PrivacyInvoked not ASN_INTEGER\n" );
2648 + return SNMP_ERR_WRONGTYPE;
2649 + }
2650 + if ( var_val_len > sizeof ( long_ret )){
2651 + fprintf ( stderr, "write to dot11PrivacyInvoked: bad length\n" );
2652 + return SNMP_ERR_WRONGLENGTH;
2653 + }
2654 + break;
2655 +
2656 + case RESERVE2:
2657 + case FREE:
2658 + case ACTION:
2659 + case UNDO:
2660 + break;
2661 +
2662 + case COMMIT:
2663 + break;
2664 + }
2665 +
2666 + return SNMP_ERR_NOERROR;
2667 +}
2668 +
2669 +/****************************************************************************
2670 +* *
2671 +****************************************************************************/
2672 +int
2673 +write_dot11WEPDefaultKeyID(int action,
2674 + u_char *var_val,
2675 + u_char var_val_type,
2676 + size_t var_val_len,
2677 + u_char *statP,
2678 + oid *name,
2679 + size_t name_len)
2680 +{
2681 + static long *long_ret;
2682 + int size;
2683 +
2684 + switch ( action ) {
2685 +
2686 + case RESERVE1:
2687 + if ( var_val_type != ASN_INTEGER ) {
2688 + fprintf ( stderr, "write to dot11WEPDefaultKeyID not ASN_INTEGER\n" );
2689 + return SNMP_ERR_WRONGTYPE;
2690 + }
2691 + if ( var_val_len > sizeof ( long_ret )){
2692 + fprintf ( stderr, "write to dot11WEPDefaultKeyID: bad length\n" );
2693 + return SNMP_ERR_WRONGLENGTH;
2694 + }
2695 + break;
2696 +
2697 + case RESERVE2:
2698 + case FREE:
2699 + case ACTION:
2700 + case UNDO:
2701 + break;
2702 +
2703 + case COMMIT:
2704 + break;
2705 + }
2706 +
2707 + return SNMP_ERR_NOERROR;
2708 +}
2709 +
2710 +/****************************************************************************
2711 +* *
2712 +****************************************************************************/
2713 +int
2714 +write_dot11WEPKeyMappingLength(int action,
2715 + u_char *var_val,
2716 + u_char var_val_type,
2717 + size_t var_val_len,
2718 + u_char *statP,
2719 + oid *name,
2720 + size_t name_len)
2721 +{
2722 + static long *long_ret;
2723 + int size;
2724 +
2725 + switch ( action ) {
2726 +
2727 + case RESERVE1:
2728 + if ( var_val_type != ASN_INTEGER ) {
2729 + fprintf ( stderr, "write to dot11WEPKeyMappingLength not ASN_INTEGER\n" );
2730 + return SNMP_ERR_WRONGTYPE;
2731 + }
2732 + if ( var_val_len > sizeof ( long_ret )){
2733 + fprintf ( stderr, "write to dot11WEPKeyMappingLength: bad length\n" );
2734 + return SNMP_ERR_WRONGLENGTH;
2735 + }
2736 + break;
2737 +
2738 + case RESERVE2:
2739 + case FREE:
2740 + case ACTION:
2741 + case UNDO:
2742 + break;
2743 +
2744 + case COMMIT:
2745 + break;
2746 + }
2747 +
2748 + return SNMP_ERR_NOERROR;
2749 +}
2750 +
2751 +/****************************************************************************
2752 +* *
2753 +****************************************************************************/
2754 +int
2755 +write_dot11ExcludeUnencrypted(int action,
2756 + u_char *var_val,
2757 + u_char var_val_type,
2758 + size_t var_val_len,
2759 + u_char *statP,
2760 + oid *name,
2761 + size_t name_len)
2762 +{
2763 + static long *long_ret;
2764 + int size;
2765 +
2766 + switch ( action ) {
2767 +
2768 + case RESERVE1:
2769 + if ( var_val_type != ASN_INTEGER ) {
2770 + fprintf ( stderr, "write to dot11ExcludeUnencrypted not ASN_INTEGER\n" );
2771 + return SNMP_ERR_WRONGTYPE;
2772 + }
2773 + if ( var_val_len > sizeof ( long_ret )){
2774 + fprintf ( stderr,"write to dot11ExcludeUnencrypted: bad length\n" );
2775 + return SNMP_ERR_WRONGLENGTH;
2776 + }
2777 + break;
2778 +
2779 + case RESERVE2:
2780 + case FREE:
2781 + case ACTION:
2782 + case UNDO:
2783 + break;
2784 +
2785 + case COMMIT:
2786 + break;
2787 + }
2788 +
2789 + return SNMP_ERR_NOERROR;
2790 +}
2791 +
2792 +/****************************************************************************
2793 +* *
2794 +****************************************************************************/
2795 +int
2796 +write_dot11RTSThreshold(int action,
2797 + u_char *var_val,
2798 + u_char var_val_type,
2799 + size_t var_val_len,
2800 + u_char *statP,
2801 + oid *name,
2802 + size_t name_len)
2803 +{
2804 + static long *long_ret;
2805 + int size;
2806 +
2807 + switch ( action ) {
2808 +
2809 + case RESERVE1:
2810 + if ( var_val_type != ASN_INTEGER ){
2811 + fprintf ( stderr, "write to dot11RTSThreshold not ASN_INTEGER\n" );
2812 + return SNMP_ERR_WRONGTYPE;
2813 + }
2814 + if ( var_val_len > sizeof ( long_ret )){
2815 + fprintf ( stderr, "write to dot11RTSThreshold: bad length\n" );
2816 + return SNMP_ERR_WRONGLENGTH;
2817 + }
2818 + break;
2819 +
2820 + case RESERVE2:
2821 + case FREE:
2822 + case ACTION:
2823 + case UNDO:
2824 + break;
2825 +
2826 + case COMMIT:
2827 + break;
2828 + }
2829 +
2830 + return SNMP_ERR_NOERROR;
2831 +}
2832 +
2833 +/****************************************************************************
2834 +* *
2835 +****************************************************************************/
2836 +int
2837 +write_dot11ShortRetryLimit(int action,
2838 + u_char *var_val,
2839 + u_char var_val_type,
2840 + size_t var_val_len,
2841 + u_char *statP,
2842 + oid *name,
2843 + size_t name_len)
2844 +{
2845 + static long *long_ret;
2846 + int size;
2847 +
2848 + switch ( action ) {
2849 +
2850 + case RESERVE1:
2851 + if ( var_val_type != ASN_INTEGER ) {
2852 + fprintf ( stderr, "write to dot11ShortRetryLimit not ASN_INTEGER\n" );
2853 + return SNMP_ERR_WRONGTYPE;
2854 + }
2855 + if ( var_val_len > sizeof ( long_ret )){
2856 + fprintf ( stderr, "write to dot11ShortRetryLimit: bad length\n" );
2857 + return SNMP_ERR_WRONGLENGTH;
2858 + }
2859 + break;
2860 +
2861 + case RESERVE2:
2862 + case FREE:
2863 + case ACTION:
2864 + case UNDO:
2865 + break;
2866 +
2867 + case COMMIT:
2868 + break;
2869 + }
2870 +
2871 + return SNMP_ERR_NOERROR;
2872 +}
2873 +
2874 +/****************************************************************************
2875 +* *
2876 +****************************************************************************/
2877 +int
2878 +write_dot11LongRetryLimit(int action,
2879 + u_char *var_val,
2880 + u_char var_val_type,
2881 + size_t var_val_len,
2882 + u_char *statP,
2883 + oid *name,
2884 + size_t name_len)
2885 +{
2886 + static long *long_ret;
2887 + int size;
2888 +
2889 + switch ( action ) {
2890 +
2891 + case RESERVE1:
2892 + if ( var_val_type != ASN_INTEGER ) {
2893 + fprintf ( stderr, "write to dot11LongRetryLimit not ASN_INTEGER\n" );
2894 + return SNMP_ERR_WRONGTYPE;
2895 + }
2896 + if ( var_val_len > sizeof ( long_ret )){
2897 + fprintf ( stderr,"write to dot11LongRetryLimit: bad length\n" );
2898 + return SNMP_ERR_WRONGLENGTH;
2899 + }
2900 + break;
2901 +
2902 + case RESERVE2:
2903 + case FREE:
2904 + case ACTION:
2905 + case UNDO:
2906 + break;
2907 +
2908 + case COMMIT:
2909 + break;
2910 + }
2911 +
2912 + return SNMP_ERR_NOERROR;
2913 +}
2914 +
2915 +/****************************************************************************
2916 +* *
2917 +****************************************************************************/
2918 +int
2919 +write_dot11FragmentationThreshold(int action,
2920 + u_char *var_val,
2921 + u_char var_val_type,
2922 + size_t var_val_len,
2923 + u_char *statP,
2924 + oid *name,
2925 + size_t name_len)
2926 +{
2927 + static long *long_ret;
2928 + int size;
2929 +
2930 + switch ( action ) {
2931 +
2932 + case RESERVE1:
2933 + if ( var_val_type != ASN_INTEGER ) {
2934 + fprintf ( stderr, "write to dot11FragmentationThreshold not ASN_INTEGER\n" );
2935 + return SNMP_ERR_WRONGTYPE;
2936 + }
2937 + if ( var_val_len > sizeof ( long_ret )){
2938 + fprintf ( stderr,"write to dot11FragmentationThreshold: bad length\n" );
2939 + return SNMP_ERR_WRONGLENGTH;
2940 + }
2941 + break;
2942 +
2943 + case RESERVE2:
2944 + case FREE:
2945 + case ACTION:
2946 + case UNDO:
2947 + break;
2948 +
2949 + case COMMIT:
2950 + break;
2951 + }
2952 +
2953 + return SNMP_ERR_NOERROR;
2954 +}
2955 +
2956 +/****************************************************************************
2957 +* *
2958 +****************************************************************************/
2959 +int
2960 +write_dot11MaxTransmitMSDULifetime(int action,
2961 + u_char *var_val,
2962 + u_char var_val_type,
2963 + size_t var_val_len,
2964 + u_char *statP,
2965 + oid *name,
2966 + size_t name_len)
2967 +{
2968 + static long *long_ret;
2969 + int size;
2970 +
2971 + switch ( action ) {
2972 +
2973 + case RESERVE1:
2974 + if ( var_val_type != ASN_INTEGER ) {
2975 + fprintf ( stderr, "write to dot11MaxTransmitMSDULifetime not ASN_INTEGER\n" );
2976 + return SNMP_ERR_WRONGTYPE;
2977 + }
2978 + if ( var_val_len > sizeof ( long_ret )){
2979 + fprintf ( stderr, "write to dot11MaxTransmitMSDULifetime: bad length\n" );
2980 + return SNMP_ERR_WRONGLENGTH;
2981 + }
2982 + break;
2983 +
2984 + case RESERVE2:
2985 + case FREE:
2986 + case ACTION:
2987 + case UNDO:
2988 + break;
2989 +
2990 + case COMMIT:
2991 +
2992 + break;
2993 + }
2994 +
2995 + return SNMP_ERR_NOERROR;
2996 +}
2997 +
2998 +/****************************************************************************
2999 +* *
3000 +****************************************************************************/
3001 +int
3002 +write_dot11MaxReceiveLifetime(int action,
3003 + u_char *var_val,
3004 + u_char var_val_type,
3005 + size_t var_val_len,
3006 + u_char *statP,
3007 + oid *name,
3008 + size_t name_len)
3009 +{
3010 + static long *long_ret;
3011 + int size;
3012 +
3013 + switch ( action ) {
3014 +
3015 + case RESERVE1:
3016 + if ( var_val_type != ASN_INTEGER ) {
3017 + fprintf ( stderr, "write to dot11MaxReceiveLifetime not ASN_INTEGER\n" );
3018 + return SNMP_ERR_WRONGTYPE;
3019 + }
3020 + if ( var_val_len > sizeof ( long_ret )){
3021 + fprintf ( stderr, "write to dot11MaxReceiveLifetime: bad length\n" );
3022 + return SNMP_ERR_WRONGLENGTH;
3023 + }
3024 + break;
3025 +
3026 + case RESERVE2:
3027 + case FREE:
3028 + case ACTION:
3029 + case UNDO:
3030 + break;
3031 +
3032 + case COMMIT:
3033 + break;
3034 + }
3035 +
3036 + return SNMP_ERR_NOERROR;
3037 +}
3038 +
3039 +/****************************************************************************
3040 +* *
3041 +****************************************************************************/
3042 +int
3043 +write_dot11Address(int action,
3044 + u_char *var_val,
3045 + u_char var_val_type,
3046 + size_t var_val_len,
3047 + u_char *statP,
3048 + oid *name,
3049 + size_t name_len)
3050 +{
3051 + static unsigned char string[SPRINT_MAX_LEN];
3052 + int size;
3053 +
3054 + switch ( action ) {
3055 +
3056 + case RESERVE1:
3057 + if ( var_val_type != ASN_OCTET_STR ) {
3058 + fprintf ( stderr, "write to dot11Address not ASN_OCTET_STR\n" );
3059 + return SNMP_ERR_WRONGTYPE;
3060 + }
3061 + if ( var_val_len > sizeof ( string )){
3062 + fprintf ( stderr, "write to dot11Address: bad length\n" );
3063 + return SNMP_ERR_WRONGLENGTH;
3064 + }
3065 + break;
3066 +
3067 + case RESERVE2:
3068 + case FREE:
3069 + case ACTION:
3070 + case UNDO:
3071 + break;
3072 +
3073 + case COMMIT:
3074 + break;
3075 + }
3076 +
3077 + return SNMP_ERR_NOERROR;
3078 +}
3079 +
3080 +/****************************************************************************
3081 +* *
3082 +****************************************************************************/
3083 +int
3084 +write_dot11GroupAddressesStatus(int action,
3085 + u_char *var_val,
3086 + u_char var_val_type,
3087 + size_t var_val_len,
3088 + u_char *statP,
3089 + oid *name,
3090 + size_t name_len)
3091 +{
3092 + static long *long_ret;
3093 + int size;
3094 +
3095 + switch ( action ) {
3096 +
3097 + case RESERVE1:
3098 + if ( var_val_type != ASN_INTEGER ) {
3099 + fprintf ( stderr, "write to dot11GroupAddressesStatus not ASN_INTEGER\n" );
3100 + return SNMP_ERR_WRONGTYPE;
3101 + }
3102 + if ( var_val_len > sizeof ( long_ret )){
3103 + fprintf ( stderr,"write to dot11GroupAddressesStatus: bad length\n" );
3104 + return SNMP_ERR_WRONGLENGTH;
3105 + }
3106 + break;
3107 +
3108 + case RESERVE2:
3109 + case FREE:
3110 + case ACTION:
3111 + case UNDO:
3112 + break;
3113 +
3114 + case COMMIT:
3115 + break;
3116 + }
3117 +
3118 + return SNMP_ERR_NOERROR;
3119 +}
3120 +
3121 +/****************************************************************************
3122 +* *
3123 +****************************************************************************/
3124 +int
3125 +write_dot11CurrentRegDomain(int action,
3126 + u_char *var_val,
3127 + u_char var_val_type,
3128 + size_t var_val_len,
3129 + u_char *statP,
3130 + oid *name,
3131 + size_t name_len)
3132 +{
3133 + static long *long_ret;
3134 + int size;
3135 +
3136 + switch ( action ) {
3137 +
3138 + case RESERVE1:
3139 + if ( var_val_type != ASN_INTEGER ) {
3140 + fprintf ( stderr, "write to dot11CurrentRegDomain not ASN_INTEGER\n" );
3141 + return SNMP_ERR_WRONGTYPE;
3142 + }
3143 + if ( var_val_len > sizeof ( long_ret )){
3144 + fprintf ( stderr, "write to dot11CurrentRegDomain: bad length\n" );
3145 + return SNMP_ERR_WRONGLENGTH;
3146 + }
3147 + break;
3148 +
3149 + case RESERVE2:
3150 + case FREE:
3151 + case ACTION:
3152 + case UNDO:
3153 + break;
3154 +
3155 + case COMMIT:
3156 + break;
3157 + }
3158 +
3159 + return SNMP_ERR_NOERROR;
3160 +}
3161 +
3162 +/****************************************************************************
3163 +* *
3164 +****************************************************************************/
3165 +int
3166 +write_dot11CurrentTxAntenna(int action,
3167 + u_char *var_val,
3168 + u_char var_val_type,
3169 + size_t var_val_len,
3170 + u_char *statP,
3171 + oid *name,
3172 + size_t name_len)
3173 +{
3174 + static long *long_ret;
3175 + int size;
3176 +
3177 + switch ( action ) {
3178 +
3179 + case RESERVE1:
3180 + if ( var_val_type != ASN_INTEGER ) {
3181 + fprintf ( stderr, "write to dot11CurrentTxAntenna not ASN_INTEGER\n" );
3182 + return SNMP_ERR_WRONGTYPE;
3183 + }
3184 + if ( var_val_len > sizeof ( long_ret )){
3185 + fprintf ( stderr, "write to dot11CurrentTxAntenna: bad length\n" );
3186 + return SNMP_ERR_WRONGLENGTH;
3187 + }
3188 + break;
3189 +
3190 + case RESERVE2:
3191 + case FREE:
3192 + case ACTION:
3193 + case UNDO:
3194 + break;
3195 +
3196 + case COMMIT:
3197 + break;
3198 + }
3199 +
3200 + return SNMP_ERR_NOERROR;
3201 +}
3202 +
3203 +/****************************************************************************
3204 +* *
3205 +****************************************************************************/
3206 +int
3207 +write_dot11CurrentRxAntenna(int action,
3208 + u_char *var_val,
3209 + u_char var_val_type,
3210 + size_t var_val_len,
3211 + u_char *statP,
3212 + oid *name,
3213 + size_t name_len)
3214 +{
3215 + static long *long_ret;
3216 + int size;
3217 +
3218 + switch ( action ) {
3219 +
3220 + case RESERVE1:
3221 + if ( var_val_type != ASN_INTEGER ) {
3222 + fprintf ( stderr, "write to dot11CurrentRxAntenna not ASN_INTEGER\n" );
3223 + return SNMP_ERR_WRONGTYPE;
3224 + }
3225 + if ( var_val_len > sizeof ( long_ret )){
3226 + fprintf ( stderr,"write to dot11CurrentRxAntenna: bad length\n" );
3227 + return SNMP_ERR_WRONGLENGTH;
3228 + }
3229 + break;
3230 +
3231 + case RESERVE2:
3232 + case FREE:
3233 + case ACTION:
3234 + case UNDO:
3235 + break;
3236 +
3237 + case COMMIT:
3238 + break;
3239 +
3240 + }
3241 +
3242 + return SNMP_ERR_NOERROR;
3243 +}
3244 +
3245 +/****************************************************************************
3246 +* *
3247 +****************************************************************************/
3248 +int
3249 +write_dot11CurrentTxPowerLevel(int action,
3250 + u_char *var_val,
3251 + u_char var_val_type,
3252 + size_t var_val_len,
3253 + u_char *statP,
3254 + oid *name,
3255 + size_t name_len)
3256 +{
3257 + static long *long_ret;
3258 + int size;
3259 +
3260 + switch ( action ) {
3261 +
3262 + case RESERVE1:
3263 + if ( var_val_type != ASN_INTEGER ) {
3264 + fprintf ( stderr, "write to dot11CurrentTxPowerLevel not ASN_INTEGER\n" );
3265 + return SNMP_ERR_WRONGTYPE;
3266 + }
3267 + if ( var_val_len > sizeof ( long_ret )){
3268 + fprintf ( stderr, "write to dot11CurrentTxPowerLevel: bad length\n" );
3269 + return SNMP_ERR_WRONGLENGTH;
3270 + }
3271 + break;
3272 +
3273 + case RESERVE2:
3274 + case FREE:
3275 + case ACTION:
3276 + case UNDO:
3277 + break;
3278 +
3279 + case COMMIT:
3280 + break;
3281 + }
3282 +
3283 + return SNMP_ERR_NOERROR;
3284 +}
3285 +
3286 +/****************************************************************************
3287 +* *
3288 +****************************************************************************/
3289 +int
3290 +write_dot11CurrentChannelNumber(int action,
3291 + u_char *var_val,
3292 + u_char var_val_type,
3293 + size_t var_val_len,
3294 + u_char *statP,
3295 + oid *name,
3296 + size_t name_len)
3297 +{
3298 + static long *long_ret;
3299 + int size;
3300 +
3301 + switch ( action ) {
3302 +
3303 + case RESERVE1:
3304 + if ( var_val_type != ASN_INTEGER ) {
3305 + fprintf ( stderr, "write to dot11CurrentChannelNumber not ASN_INTEGER\n" );
3306 + return SNMP_ERR_WRONGTYPE;
3307 + }
3308 + if ( var_val_len > sizeof ( long_ret )){
3309 + fprintf ( stderr,"write to dot11CurrentChannelNumber: bad length\n" );
3310 + return SNMP_ERR_WRONGLENGTH;
3311 + }
3312 + break;
3313 +
3314 + case RESERVE2:
3315 + case FREE:
3316 + case ACTION:
3317 + case UNDO:
3318 + break;
3319 +
3320 + case COMMIT:
3321 + break;
3322 + }
3323 +
3324 + return SNMP_ERR_NOERROR;
3325 +}
3326 +
3327 +/****************************************************************************
3328 +* *
3329 +****************************************************************************/
3330 +int
3331 +write_dot11CurrentDwellTime(int action,
3332 + u_char *var_val,
3333 + u_char var_val_type,
3334 + size_t var_val_len,
3335 + u_char *statP,
3336 + oid *name,
3337 + size_t name_len)
3338 +{
3339 + static long *long_ret;
3340 + int size;
3341 +
3342 + switch ( action ) {
3343 +
3344 + case RESERVE1:
3345 + if ( var_val_type != ASN_INTEGER ) {
3346 + fprintf ( stderr, "write to dot11CurrentDwellTime not ASN_INTEGER\n" );
3347 + return SNMP_ERR_WRONGTYPE;
3348 + }
3349 + if ( var_val_len > sizeof ( long_ret )){
3350 + fprintf ( stderr, "write to dot11CurrentDwellTime: bad length\n" );
3351 + return SNMP_ERR_WRONGLENGTH;
3352 + }
3353 + break;
3354 +
3355 + case RESERVE2:
3356 + case FREE:
3357 + case ACTION:
3358 + case UNDO:
3359 + break;
3360 +
3361 + case COMMIT:
3362 + break;
3363 + }
3364 +
3365 + return SNMP_ERR_NOERROR;
3366 +}
3367 +
3368 +/****************************************************************************
3369 +* *
3370 +****************************************************************************/
3371 +int
3372 +write_dot11CurrentSet(int action,
3373 + u_char *var_val,
3374 + u_char var_val_type,
3375 + size_t var_val_len,
3376 + u_char *statP,
3377 + oid *name,
3378 + size_t name_len)
3379 +{
3380 + static long *long_ret;
3381 + int size;
3382 +
3383 + switch ( action ) {
3384 +
3385 + case RESERVE1:
3386 + if ( var_val_type != ASN_INTEGER ) {
3387 + fprintf ( stderr, "write to dot11CurrentSet not ASN_INTEGER\n" );
3388 + return SNMP_ERR_WRONGTYPE;
3389 + }
3390 + if ( var_val_len > sizeof ( long_ret )){
3391 + fprintf ( stderr, "write to dot11CurrentSet: bad length\n" );
3392 + return SNMP_ERR_WRONGLENGTH;
3393 + }
3394 + break;
3395 +
3396 + case RESERVE2:
3397 + case FREE:
3398 + case ACTION:
3399 + case UNDO:
3400 + break;
3401 +
3402 + case COMMIT:
3403 + break;
3404 + }
3405 +
3406 + return SNMP_ERR_NOERROR;
3407 +}
3408 +
3409 +/****************************************************************************
3410 +* *
3411 +****************************************************************************/
3412 +int
3413 +write_dot11CurrentPattern(int action,
3414 + u_char *var_val,
3415 + u_char var_val_type,
3416 + size_t var_val_len,
3417 + u_char *statP,
3418 + oid *name,
3419 + size_t name_len)
3420 +{
3421 + static long *long_ret;
3422 + int size;
3423 +
3424 + switch ( action ) {
3425 +
3426 + case RESERVE1:
3427 + if ( var_val_type != ASN_INTEGER ) {
3428 + fprintf ( stderr, "write to dot11CurrentPattern not ASN_INTEGER\n" );
3429 + return SNMP_ERR_WRONGTYPE;
3430 + }
3431 + if ( var_val_len > sizeof ( long_ret )){
3432 + fprintf ( stderr, "write to dot11CurrentPattern: bad length\n" );
3433 + return SNMP_ERR_WRONGLENGTH;
3434 + }
3435 + break;
3436 +
3437 + case RESERVE2:
3438 + case FREE:
3439 + case ACTION:
3440 + case UNDO:
3441 + break;
3442 +
3443 + case COMMIT:
3444 + break;
3445 + }
3446 +
3447 + return SNMP_ERR_NOERROR;
3448 +}
3449 +
3450 +/****************************************************************************
3451 +* *
3452 +****************************************************************************/
3453 +int
3454 +write_dot11CurrentIndex(int action,
3455 + u_char *var_val,
3456 + u_char var_val_type,
3457 + size_t var_val_len,
3458 + u_char *statP,
3459 + oid *name,
3460 + size_t name_len)
3461 +{
3462 + static long *long_ret;
3463 + int size;
3464 +
3465 + switch ( action ) {
3466 +
3467 + case RESERVE1:
3468 + if ( var_val_type != ASN_INTEGER ) {
3469 + fprintf ( stderr, "write to dot11CurrentIndex not ASN_INTEGER\n" );
3470 + return SNMP_ERR_WRONGTYPE;
3471 + }
3472 + if ( var_val_len > sizeof ( long_ret )){
3473 + fprintf ( stderr, "write to dot11CurrentIndex: bad length\n" );
3474 + return SNMP_ERR_WRONGLENGTH;
3475 + }
3476 + break;
3477 +
3478 + case RESERVE2:
3479 + case FREE:
3480 + case ACTION:
3481 + case UNDO:
3482 + break;
3483 +
3484 + case COMMIT:
3485 + break;
3486 + }
3487 +
3488 + return SNMP_ERR_NOERROR;
3489 +}
3490 +
3491 +/****************************************************************************
3492 +* *
3493 +****************************************************************************/
3494 +int
3495 +write_dot11CurrentChannel(int action,
3496 + u_char *var_val,
3497 + u_char var_val_type,
3498 + size_t var_val_len,
3499 + u_char *statP,
3500 + oid *name,
3501 + size_t name_len)
3502 +{
3503 + static long *long_ret;
3504 + int size;
3505 +
3506 + switch ( action ) {
3507 +
3508 + case RESERVE1:
3509 + if ( var_val_type != ASN_INTEGER ) {
3510 + fprintf ( stderr, "write to dot11CurrentChannel not ASN_INTEGER\n" );
3511 + return SNMP_ERR_WRONGTYPE;
3512 + }
3513 + if ( var_val_len > sizeof ( long_ret )){
3514 + fprintf ( stderr, "write to dot11CurrentChannel: bad length\n" );
3515 + return SNMP_ERR_WRONGLENGTH;
3516 + }
3517 + break;
3518 +
3519 + case RESERVE2:
3520 + case FREE:
3521 + case ACTION:
3522 + case UNDO:
3523 + break;
3524 +
3525 + case COMMIT:
3526 + break;
3527 + }
3528 +
3529 + return SNMP_ERR_NOERROR;
3530 +}
3531 +
3532 +/****************************************************************************
3533 +* *
3534 +****************************************************************************/
3535 +int
3536 +write_dot11CurrentCCAMode(int action,
3537 + u_char *var_val,
3538 + u_char var_val_type,
3539 + size_t var_val_len,
3540 + u_char *statP,
3541 + oid *name,
3542 + size_t name_len)
3543 +{
3544 + static long *long_ret;
3545 + int size;
3546 +
3547 + switch ( action ) {
3548 +
3549 + case RESERVE1:
3550 + if ( var_val_type != ASN_INTEGER ) {
3551 + fprintf ( stderr, "write to dot11CurrentCCAMode not ASN_INTEGER\n" );
3552 + return SNMP_ERR_WRONGTYPE;
3553 + }
3554 + if ( var_val_len > sizeof ( long_ret )){
3555 + fprintf ( stderr,"write to dot11CurrentCCAMode: bad length\n" );
3556 + return SNMP_ERR_WRONGLENGTH;
3557 + }
3558 + break;
3559 +
3560 + case RESERVE2:
3561 + case FREE:
3562 + case ACTION:
3563 + case UNDO:
3564 + break;
3565 +
3566 + case COMMIT:
3567 + break;
3568 + }
3569 +
3570 + return SNMP_ERR_NOERROR;
3571 +}
3572 +
3573 +/****************************************************************************
3574 +* *
3575 +****************************************************************************/
3576 +int
3577 +write_dot11EDThreshold(int action,
3578 + u_char *var_val,
3579 + u_char var_val_type,
3580 + size_t var_val_len,
3581 + u_char *statP,
3582 + oid *name,
3583 + size_t name_len)
3584 +{
3585 + static long *long_ret;
3586 + int size;
3587 +
3588 + switch ( action ) {
3589 +
3590 + case RESERVE1:
3591 + if ( var_val_type != ASN_INTEGER ) {
3592 + fprintf ( stderr, "write to dot11EDThreshold not ASN_INTEGER\n" );
3593 + return SNMP_ERR_WRONGTYPE;
3594 + }
3595 + if ( var_val_len > sizeof ( long_ret )){
3596 + fprintf ( stderr, "write to dot11EDThreshold: bad length\n" );
3597 + return SNMP_ERR_WRONGLENGTH;
3598 + }
3599 + break;
3600 +
3601 + case RESERVE2:
3602 + case FREE:
3603 + case ACTION:
3604 + case UNDO:
3605 + break;
3606 +
3607 + case COMMIT:
3608 + break;
3609 + }
3610 +
3611 + return SNMP_ERR_NOERROR;
3612 +}
3613 +
3614 +/****************************************************************************
3615 +* *
3616 +****************************************************************************/
3617 +int
3618 +write_dot11CCAWatchdogTimerMax(int action,
3619 + u_char *var_val,
3620 + u_char var_val_type,
3621 + size_t var_val_len,
3622 + u_char *statP,
3623 + oid *name,
3624 + size_t name_len)
3625 +{
3626 + static long *long_ret;
3627 + int size;
3628 +
3629 + switch ( action ) {
3630 +
3631 + case RESERVE1:
3632 + if ( var_val_type != ASN_INTEGER ) {
3633 + fprintf ( stderr, "write to dot11CCAWatchdogTimerMax not ASN_INTEGER\n" );
3634 + return SNMP_ERR_WRONGTYPE;
3635 + }
3636 + if ( var_val_len > sizeof ( long_ret )){
3637 + fprintf ( stderr, "write to dot11CCAWatchdogTimerMax: bad length\n" );
3638 + return SNMP_ERR_WRONGLENGTH;
3639 + }
3640 + break;
3641 +
3642 + case RESERVE2:
3643 + case FREE:
3644 + case ACTION:
3645 + case UNDO:
3646 + break;
3647 +
3648 + case COMMIT:
3649 + break;
3650 + }
3651 +
3652 + return SNMP_ERR_NOERROR;
3653 +}
3654 +
3655 +/****************************************************************************
3656 +* *
3657 +****************************************************************************/
3658 +int
3659 +write_dot11CCAWatchdogCountMax(int action,
3660 + u_char *var_val,
3661 + u_char var_val_type,
3662 + size_t var_val_len,
3663 + u_char *statP,
3664 + oid *name,
3665 + size_t name_len)
3666 +{
3667 + static long *long_ret;
3668 + int size;
3669 +
3670 + switch ( action ) {
3671 +
3672 + case RESERVE1:
3673 + if ( var_val_type != ASN_INTEGER ) {
3674 + fprintf ( stderr, "write to dot11CCAWatchdogCountMax not ASN_INTEGER\n" );
3675 + return SNMP_ERR_WRONGTYPE;
3676 + }
3677 + if ( var_val_len > sizeof ( long_ret )){
3678 + fprintf ( stderr, "write to dot11CCAWatchdogCountMax: bad length\n" );
3679 + return SNMP_ERR_WRONGLENGTH;
3680 + }
3681 + break;
3682 +
3683 + case RESERVE2:
3684 + case FREE:
3685 + case ACTION:
3686 + case UNDO:
3687 + break;
3688 +
3689 + case COMMIT:
3690 + break;
3691 + }
3692 +
3693 + return SNMP_ERR_NOERROR;
3694 +}
3695 +
3696 +/****************************************************************************
3697 +* *
3698 +****************************************************************************/
3699 +int
3700 +write_dot11CCAWatchdogTimerMin(int action,
3701 + u_char *var_val,
3702 + u_char var_val_type,
3703 + size_t var_val_len,
3704 + u_char *statP,
3705 + oid *name,
3706 + size_t name_len)
3707 +{
3708 + static long *long_ret;
3709 + int size;
3710 +
3711 + switch ( action ) {
3712 +
3713 + case RESERVE1:
3714 + if ( var_val_type != ASN_INTEGER ) {
3715 + fprintf ( stderr, "write to dot11CCAWatchdogTimerMin not ASN_INTEGER\n" );
3716 + return SNMP_ERR_WRONGTYPE;
3717 + }
3718 + if ( var_val_len > sizeof ( long_ret )){
3719 + fprintf ( stderr, "write to dot11CCAWatchdogTimerMin: bad length\n" );
3720 + return SNMP_ERR_WRONGLENGTH;
3721 + }
3722 + break;
3723 +
3724 + case RESERVE2:
3725 + case FREE:
3726 + case ACTION:
3727 + case UNDO:
3728 + break;
3729 +
3730 + case COMMIT:
3731 + break;
3732 + }
3733 +
3734 + return SNMP_ERR_NOERROR;
3735 +}
3736 +
3737 +/****************************************************************************
3738 +* *
3739 +****************************************************************************/
3740 +int
3741 +write_dot11CCAWatchdogCountMin(int action,
3742 + u_char *var_val,
3743 + u_char var_val_type,
3744 + size_t var_val_len,
3745 + u_char *statP,
3746 + oid *name,
3747 + size_t name_len)
3748 +{
3749 + static long *long_ret;
3750 + int size;
3751 +
3752 + switch ( action ) {
3753 +
3754 + case RESERVE1:
3755 + if ( var_val_type != ASN_INTEGER ) {
3756 + fprintf ( stderr, "write to dot11CCAWatchdogCountMin not ASN_INTEGER\n" );
3757 + return SNMP_ERR_WRONGTYPE;
3758 + }
3759 + if ( var_val_len > sizeof ( long_ret )){
3760 + fprintf ( stderr, "write to dot11CCAWatchdogCountMin: bad length\n" );
3761 + return SNMP_ERR_WRONGLENGTH;
3762 + }
3763 + break;
3764 +
3765 + case RESERVE2:
3766 + case FREE:
3767 + case ACTION:
3768 + case UNDO:
3769 + break;
3770 +
3771 + case COMMIT:
3772 + break;
3773 + }
3774 +
3775 + return SNMP_ERR_NOERROR;
3776 +}
3777 +
3778 +/****************************************************************************
3779 +* *
3780 +****************************************************************************/
3781 +int
3782 +write_dot11SupportedTxAntenna(int action,
3783 + u_char *var_val,
3784 + u_char var_val_type,
3785 + size_t var_val_len,
3786 + u_char *statP,
3787 + oid *name,
3788 + size_t name_len)
3789 +{
3790 + static long *long_ret;
3791 + int size;
3792 +
3793 + switch ( action ) {
3794 +
3795 + case RESERVE1:
3796 + if ( var_val_type != ASN_INTEGER ) {
3797 + fprintf ( stderr, "write to dot11SupportedTxAntenna not ASN_INTEGER\n" );
3798 + return SNMP_ERR_WRONGTYPE;
3799 + }
3800 + if ( var_val_len > sizeof ( long_ret )){
3801 + fprintf ( stderr, "write to dot11SupportedTxAntenna: bad length\n" );
3802 + return SNMP_ERR_WRONGLENGTH;
3803 + }
3804 + break;
3805 +
3806 + case RESERVE2:
3807 + case FREE:
3808 + case ACTION:
3809 + case UNDO:
3810 + break;
3811 +
3812 + case COMMIT:
3813 + break;
3814 + }
3815 +
3816 + return SNMP_ERR_NOERROR;
3817 +}
3818 +
3819 +/****************************************************************************
3820 +* *
3821 +****************************************************************************/
3822 +int
3823 +write_dot11SupportedRxAntenna(int action,
3824 + u_char *var_val,
3825 + u_char var_val_type,
3826 + size_t var_val_len,
3827 + u_char *statP,
3828 + oid *name,
3829 + size_t name_len)
3830 +{
3831 + static long *long_ret;
3832 + int size;
3833 +
3834 + switch ( action ) {
3835 +
3836 + case RESERVE1:
3837 + if ( var_val_type != ASN_INTEGER ) {
3838 + fprintf ( stderr, "write to dot11SupportedRxAntenna not ASN_INTEGER\n" );
3839 + return SNMP_ERR_WRONGTYPE;
3840 + }
3841 + if ( var_val_len > sizeof ( long_ret )){
3842 + fprintf ( stderr,"write to dot11SupportedRxAntenna: bad length\n" );
3843 + return SNMP_ERR_WRONGLENGTH;
3844 + }
3845 + break;
3846 +
3847 + case RESERVE2:
3848 + case FREE:
3849 + case ACTION:
3850 + case UNDO:
3851 + break;
3852 +
3853 + case COMMIT:
3854 + break;
3855 + }
3856 +
3857 + return SNMP_ERR_NOERROR;
3858 +}
3859 +
3860 +/****************************************************************************
3861 +* *
3862 +****************************************************************************/
3863 +int
3864 +write_dot11DiversitySelectionRx(int action,
3865 + u_char *var_val,
3866 + u_char var_val_type,
3867 + size_t var_val_len,
3868 + u_char *statP,
3869 + oid *name,
3870 + size_t name_len)
3871 +{
3872 + static long *long_ret;
3873 + int size;
3874 +
3875 + switch ( action ) {
3876 +
3877 + case RESERVE1:
3878 + if ( var_val_type != ASN_INTEGER ) {
3879 + fprintf ( stderr, "write to dot11DiversitySelectionRx not ASN_INTEGER\n" );
3880 + return SNMP_ERR_WRONGTYPE;
3881 + }
3882 + if ( var_val_len > sizeof ( long_ret )){
3883 + fprintf ( stderr, "write to dot11DiversitySelectionRx: bad length\n" );
3884 + return SNMP_ERR_WRONGLENGTH;
3885 + }
3886 + break;
3887 +
3888 + case RESERVE2:
3889 + case FREE:
3890 + case ACTION:
3891 + case UNDO:
3892 + break;
3893 +
3894 + case COMMIT:
3895 + break;
3896 + }
3897 +
3898 + return SNMP_ERR_NOERROR;
3899 +}
3900 +
3901 +/****************************************************************************
3902 +* *
3903 +* loadTables() - Load the Tables *
3904 +* *
3905 +****************************************************************************/
3906 +static void loadTables()
3907 +{
3908 + int skfd; // generic raw socket desc
3909 + struct iwreq wrq; // ioctl request structure
3910 + struct ifreq ifr;
3911 + struct timeval et; // elapsed time
3912 + struct wireless_info info; // workarea for wireless ioctl information
3913 + FILE *fp;
3914 + char bfr[1024], ifName[1024];
3915 + char *s, *t;
3916 +
3917 + gettimeofday ( &et, ( struct timezone * ) 0 ); // get time-of-day
3918 + if ( et.tv_sec < lastLoad + MINLOADFREQ ) // only reload so often
3919 + return;
3920 + lastLoad = et.tv_sec;
3921 +
3922 + skfd = openSocket(); // open socket
3923 + if ( skfd < 0 ) {
3924 + syslog ( LOG_ERR, "SNMP ieee802dot11.loadTables() - %s\n", "socket open failure" );
3925 + return;
3926 + }
3927 +
3928 + flushLists();
3929 +
3930 + // find interfaces in /proc/net/dev and find the wireless interfaces
3931 + fp = fopen ( PROC_NET_DEV, "r" );
3932 + if ( fp ) {
3933 + while ( fgets ( bfr, sizeof ( bfr ), fp )) {
3934 + if ( strstr ( bfr, ":" )) {
3935 + s = bfr; t = ifName;
3936 + while ( isspace ( *s )) // discard white space
3937 + *s++;
3938 + while ( *s != ':' ) // get interface name
3939 + *t++ = *s++;
3940 + *t = '\0';
3941 +
3942 + // verify as a wireless device
3943 + memset (( char * ) &info, 0, sizeof ( struct wireless_info ));
3944 + strncpy ( wrq.ifr_name, ifName, IFNAMSIZ );
3945 + if ( ioctl ( skfd, SIOCGIWNAME, &wrq ) >= 0 ) {
3946 + printf ( "%s ifName: %s\n", "loadTables() -", ifName );
3947 + initStructs();
3948 + loadWiExt( skfd, ifName, &info );
3949 + displayWiExt ( info );
3950 + load80211Structs ( skfd, ifName, &info );
3951 + }
3952 + }
3953 + }
3954 + fclose ( fp );
3955 + }
3956 +
3957 + close ( skfd );
3958 +}
3959 +
3960 +/****************************************************************************
3961 +* *
3962 +* load80211Structs() - load the 802.11 structures *
3963 +* *
3964 +****************************************************************************/
3965 +static void
3966 +load80211Structs ( int skfd, char *ifName, struct wireless_info *wi )
3967 +{
3968 + int rc, ifIndex = 0;
3969 + struct ifreq ifr;
3970 + char MACAddress [ MACADDR_LEN + 1 ];
3971 +
3972 + strcpy ( ifr.ifr_name, ifName );
3973 + rc = ioctl ( skfd, SIOCGIFHWADDR, &ifr );
3974 + if ( rc >= 0 ) {
3975 +
3976 + sprintf ( MACAddress, "%02X:%02X:%02X:%02X:%02X:%02X\0",
3977 + ( UCHAR ) ifr.ifr_hwaddr.sa_data[0], ( UCHAR ) ifr.ifr_hwaddr.sa_data[1],
3978 + ( UCHAR ) ifr.ifr_hwaddr.sa_data[2], ( UCHAR ) ifr.ifr_hwaddr.sa_data[3],
3979 + ( UCHAR ) ifr.ifr_hwaddr.sa_data[4], ( UCHAR ) ifr.ifr_hwaddr.sa_data[5] );
3980 +
3981 + nSc.haveStationID = TRUE;
3982 + strcpy ( nSc.stationID, MACAddress );
3983 + nOp.haveMACAddress = TRUE;
3984 + strcpy ( nOp.MACAddress, MACAddress );
3985 + nRi.haveManufacturerOUI = TRUE;
3986 + strncpy ( nRi.manufacturerOUI, MACAddress, MAN_OUI_LEN );
3987 +
3988 + ifIndex = if_nametoindex ( ifName );
3989 + if ( !ifIndex ) {
3990 + syslog ( LOG_ERR, "SNMP %s - %s %s\n",
3991 + "ieee802dot11.load80211Structs()", ifName, "has no ifIndex" );
3992 + return;
3993 + }
3994 +
3995 + loadWiExtTo80211Structs ( ifIndex, ifName, wi );
3996 +
3997 + if ( hasChanged (( char * ) &nSc, sizeof ( nSc ))) {
3998 + nSc.ifIndex = ifIndex;
3999 + sprintf ( nSc.UID, "%04d\0", nSc.ifIndex );
4000 + strcpy ( nSc.ifName, ifName );
4001 + addList (( char * ) &scList, ( char * ) &nSc, sizeof ( nSc ));
4002 + }
4003 +
4004 + if ( hasChanged (( char * ) &nPr, sizeof ( nPr ))) {
4005 + nPr.ifIndex = ifIndex;
4006 + sprintf ( nPr.UID, "%04d\0", nPr.ifIndex );
4007 + strcpy ( nPr.ifName, ifName );
4008 + addList (( char * ) &prList, ( char * ) &nPr, sizeof ( nPr ));
4009 + }
4010 +
4011 + if ( hasChanged (( char * ) &nOp, sizeof ( nOp ))) {
4012 + nOp.ifIndex = ifIndex;
4013 + sprintf ( nOp.UID, "%04d\0", nOp.ifIndex );
4014 + strcpy ( nOp.ifName, ifName );
4015 + addList (( char * ) &opList, ( char * ) &nOp, sizeof ( nOp ));
4016 + }
4017 +
4018 + if ( hasChanged (( char * ) &nCo, sizeof ( nCo ))) {
4019 + nCo.ifIndex = ifIndex;
4020 + sprintf ( nCo.UID, "%04d\0", nCo.ifIndex );
4021 + strcpy ( nCo.ifName, ifName );
4022 + addList (( char * ) &coList, ( char * ) &nCo, sizeof ( nCo ));
4023 + }
4024 +
4025 + if ( hasChanged (( char * ) &nRi, sizeof ( nRi ))) {
4026 + nRi.ifIndex = ifIndex;
4027 + sprintf ( nRi.UID, "%04d\0", nRi.ifIndex );
4028 + strcpy ( nRi.ifName, ifName );
4029 + addList (( char * ) &riList, ( char * ) &nRi, sizeof ( nRi ));
4030 + }
4031 +
4032 + if ( hasChanged (( char * ) &nPo, sizeof ( nPo ))) {
4033 + nPo.ifIndex = ifIndex;
4034 + sprintf ( nPo.UID, "%04d\0", nPo.ifIndex );
4035 + strcpy ( nPo.ifName, ifName );
4036 + addList (( char * ) &poList, ( char * ) &nPo, sizeof ( nPo ));
4037 + }
4038 +
4039 + if ( hasChanged (( char * ) &nPa, sizeof ( nPa ))) {
4040 + nPa.ifIndex = ifIndex;
4041 + sprintf ( nPa.UID, "%04d\0", nPa.ifIndex );
4042 + strcpy ( nPa.ifName, ifName );
4043 + addList (( char * ) &paList, ( char * ) &nPa, sizeof ( nPa ));
4044 + }
4045 +
4046 + if ( hasChanged (( char * ) &nPt, sizeof ( nPt ))) {
4047 + nPt.ifIndex = ifIndex;
4048 + sprintf ( nPt.UID, "%04d\0", nPt.ifIndex );
4049 + strcpy ( nPt.ifName, ifName );
4050 + addList (( char * ) &ptList, ( char * ) &nPt, sizeof ( nPt ));
4051 + }
4052 +
4053 + if ( hasChanged (( char * ) &nPf, sizeof ( nPf ))) {
4054 + nPf.ifIndex = ifIndex;
4055 + sprintf ( nPf.UID, "%04d\0", nPf.ifIndex );
4056 + strcpy ( nPf.ifName, ifName );
4057 + addList (( char * ) &pfList, ( char * ) &nPf, sizeof ( nPf ));
4058 + }
4059 +
4060 + if ( hasChanged (( char * ) &nPd, sizeof ( nPd ))) {
4061 + nPd.ifIndex = ifIndex;
4062 + sprintf ( nPd.UID, "%04d\0", nPd.ifIndex );
4063 + strcpy ( nPd.ifName, ifName );
4064 + addList (( char * ) &pdList, ( char * ) &nPd, sizeof ( nPd ));
4065 + }
4066 +
4067 + if ( hasChanged (( char * ) &nPi, sizeof ( nPi ))) {
4068 + nPi.ifIndex = ifIndex;
4069 + sprintf ( nPi.UID, "%04d\0", nPi.ifIndex );
4070 + strcpy ( nPi.ifName, ifName );
4071 + addList (( char * ) &piList, ( char * ) &nPi, sizeof ( nPi ));
4072 + }
4073 + }
4074 +
4075 +//printf ( "%s - ifIndex: %d ifName: %s UID: %s\n",
4076 +// "load80211Structs() - HASCHANGED", ifIndex, ifName, nSc.UID );
4077 +}
4078 +
4079 +/****************************************************************************
4080 +* *
4081 +* initStructs() - initialize structures *
4082 +* *
4083 +****************************************************************************/
4084 +static void initStructs()
4085 +{
4086 + int i;
4087 +
4088 + // 802.11 MIB Stuctures
4089 + memset (( char * ) &nSc, 0, sizeof ( nSc )); memset (( char * ) &nAa, 0, sizeof ( nAa ));
4090 + memset (( char * ) &nDf, 0, sizeof ( nDf )); memset (( char * ) &nKm, 0, sizeof ( nKm ));
4091 + memset (( char * ) &nPr, 0, sizeof ( nPr )); memset (( char * ) &nOp, 0, sizeof ( nOp ));
4092 + memset (( char * ) &nCo, 0, sizeof ( nCo )); memset (( char * ) &nGa, 0, sizeof ( nGa ));
4093 + memset (( char * ) &nRi, 0, sizeof ( nRi )); memset (( char * ) &nPo, 0, sizeof ( nPo ));
4094 + memset (( char * ) &nPa, 0, sizeof ( nPa )); memset (( char * ) &nPt, 0, sizeof ( nPt ));
4095 + memset (( char * ) &nPf, 0, sizeof ( nPf )); memset (( char * ) &nPd, 0, sizeof ( nPd ));
4096 + memset (( char * ) &nPi, 0, sizeof ( nPi )); memset (( char * ) &nRd, 0, sizeof ( nRd ));
4097 + memset (( char * ) &nAl, 0, sizeof ( nAl )); memset (( char * ) &nRt, 0, sizeof ( nRt ));
4098 + memset (( char * ) &nRr, 0, sizeof ( nRr ));
4099 +
4100 + // Wireless Extensions
4101 + wepCurrentKey = 0;
4102 + haveWepCurrentKey = FALSE;
4103 + for ( i = 0; i < MAX_WEP_KEYS; i++ ) {
4104 + wep[i].len = 0;
4105 + wep[i].key[0] = '\0';
4106 + wep[i].haveKey = FALSE;
4107 + }
4108 +}
4109 +
4110 +/****************************************************************************
4111 +* *
4112 +* Wireless Extensions Specific Functions *
4113 +* *
4114 +****************************************************************************/
4115 +/****************************************************************************
4116 +* *
4117 +* loadWiExtTo80211Structs() - load wireless extensions to 802.11 structures *
4118 +* *
4119 +****************************************************************************/
4120 +static void
4121 +loadWiExtTo80211Structs ( int ifIndex, char *ifName, struct wireless_info *wi )
4122 +{
4123 + int i, j = 0;
4124 +
4125 + // dot11Smt Group
4126 + // dot11StationConfigTable
4127 + nSc.havePrivacyOptionImplemented = TRUE;
4128 + nSc.privacyOptionImplemented = 1; // assume we support WEP
4129 +
4130 + if ( wi->has_power ) {
4131 + nSc.havePowerManagementMode = TRUE;
4132 + nSc.powerManagementMode = 1; // assume power is active
4133 + if ( !wi->power.disabled &&
4134 + wi->power.flags & IW_POWER_MIN )
4135 + nSc.powerManagementMode = 2; // power save mode
4136 + }
4137 +
4138 + if ( wi->has_essid && strlen ( wi->essid )) {
4139 + nSc.haveDesiredSSID = TRUE;
4140 + strcpy ( nSc.desiredSSID, wi->essid );
4141 + }
4142 +
4143 + if ( wi->has_mode ) {
4144 + nSc.haveDesiredBSSType = TRUE;
4145 + if ( wi->mode == IW_MODE_ADHOC )
4146 + nSc.desiredBSSType = 2; // independent
4147 + else if ( wi->has_ap_addr )
4148 + nSc.desiredBSSType = 1; // infrastructure
4149 + else
4150 + nSc.desiredBSSType = 3; // any
4151 + }
4152 +
4153 + if ( wi->has_range ) {
4154 + for ( i = 0; i < wi->range.num_bitrates && j < 126; i++ ) {
4155 + nSc.haveOperationalRateSet = TRUE;
4156 + nSc.operationalRateSet[j++] = ( char ) ( wi->range.bitrate[i] / 500000L );
4157 + }
4158 + }
4159 +
4160 + // dot11AuthenticationAlgorithmsTable
4161 + nAa.haveAuthenticationAlgorithm = TRUE; // it's a rule to always have
4162 + nAa.haveAuthenticationAlgorithmsEnable = TRUE; // 'open' supported
4163 + nAa.ifIndex = ifIndex;
4164 + nAa.authenticationAlgorithmsIndex = 1; // index number one
4165 + nAa.authenticationAlgorithm = 1; // 1 => open key
4166 + sprintf ( nAa.UID, "%04d%04d\0", nAa.ifIndex, nAa.authenticationAlgorithmsIndex );
4167 + nAa.authenticationAlgorithmsEnable = 1; // enabled by default
4168 + if ( ( wi->has_key ) &&
4169 + ( wi->key_size != 0 ) &&
4170 + !( wi->key_flags & IW_ENCODE_DISABLED ))
4171 + nAa.authenticationAlgorithmsEnable = 2;
4172 + addList (( char * ) &aaList, ( char * ) &nAa, sizeof ( nAa ));
4173 +
4174 + nAa.haveAuthenticationAlgorithm = TRUE; // I'm gonna assume we always support WEP
4175 + nAa.haveAuthenticationAlgorithmsEnable = TRUE;
4176 + nAa.ifIndex = ifIndex;
4177 + nAa.authenticationAlgorithmsIndex = 2; // index number 2
4178 + nAa.authenticationAlgorithm = 2; // 2 => shared key
4179 + sprintf ( nAa.UID, "%04d%04d\0", nAa.ifIndex, nAa.authenticationAlgorithmsIndex );
4180 + nAa.authenticationAlgorithmsEnable = 2;
4181 + if ( ( wi->has_key ) &&
4182 + ( wi->key_size != 0 ) &&
4183 + !( wi->key_flags & IW_ENCODE_DISABLED ))
4184 + nAa.authenticationAlgorithmsEnable = 1; // disabled by default
4185 + addList (( char * ) &aaList, ( char * ) &nAa, sizeof ( nAa ));
4186 +
4187 + //dot11WEPDefaultKeysTable
4188 + if ( wi->has_range ) {
4189 + for ( i = 0; i < MAX_WEP_KEYS; i++ ) {
4190 + nDf.haveWEPDefaultKeyValue = TRUE;
4191 + nDf.ifIndex = ifIndex;
4192 + nDf.WEPDefaultKeyIndex = i + 1; // index number
4193 + sprintf ( nDf.UID, "%04d%04d\0", nDf.ifIndex, nDf.WEPDefaultKeyIndex );
4194 + if ( wep[i].haveKey )
4195 + strcpy ( nDf.WEPDefaultKeyValue, "*****" );
4196 + else
4197 + nDf.WEPDefaultKeyValue[0] = '\0';
4198 + addList (( char * ) &dfList, ( char * ) &nDf, sizeof ( nDf ));
4199 + }
4200 + }
4201 +
4202 + // dot11PrivacyTable
4203 + nPr.havePrivacyInvoked = TRUE;
4204 + nPr.privacyInvoked = 2; // 2 => FALSE
4205 + nPr.haveWEPDefaultKeyID = TRUE;
4206 + nPr.WEPDefaultKeyID = 0;
4207 + nPr.haveExcludeUnencrypted = TRUE;
4208 + nPr.excludeUnencrypted = 2; // 2 => FALSE
4209 + if ( wi->has_range ) {
4210 + if ( ( wi->key_size != 0 ) &&
4211 + !( wi->key_flags & IW_ENCODE_DISABLED )) {
4212 + nPr.privacyInvoked = 1;
4213 + if ( wi->key_flags & IW_ENCODE_RESTRICTED )
4214 + nPr.excludeUnencrypted = 1;
4215 + nPr.WEPDefaultKeyID = wepCurrentKey;
4216 + }
4217 + }
4218 +
4219 + // dot11Mac Group
4220 + // dot11OperationTable
4221 + if ( wi->has_range ) {
4222 + nOp.haveRTSThreshold = TRUE;
4223 + nOp.RTSThreshold = wi->range.max_rts;
4224 + }
4225 +
4226 + if ( wi->has_frag && wi->frag.value ) {
4227 + nOp.haveFragmentationThreshold = TRUE;
4228 + nOp.fragmentationThreshold = wi->frag.value;
4229 + }
4230 +
4231 + // dot11Phy Group
4232 + // dot11PhyOperationTable
4233 + if ( strstr ( wi->name, "IEEE 802.11-FS" )) nPo.PHYType = 1; // So what if I
4234 + if ( strstr ( wi->name, "IEEE 802.11-DS" )) nPo.PHYType = 2; // made up a couple?
4235 + if ( strstr ( wi->name, "IEEE 802.11-IR" )) nPo.PHYType = 3;
4236 + if ( strstr ( wi->name, "IEEE 802.11-OFDM" )) nPo.PHYType = 4; // 802.11a
4237 + if ( strstr ( wi->name, "IEEE 802.11-OFDM/DS" )) nPo.PHYType = 5; // 802.11g
4238 + if ( strstr ( wi->name, "IEEE 802.11-TURBO" )) nPo.PHYType = 6; // Atheros TURBO mode
4239 + if ( nPo.PHYType ) nPo.havePHYType = TRUE;
4240 +
4241 + // dot11PhyDSSSTable
4242 + if ( wi->has_range ) { // && wi->freq <= ( double ) 2483000000 ) { // DSSS frequencies only
4243 + for ( i = 0; i < wi->range.num_frequency; i++ ) {
4244 + if ((( double ) ( wi->range.freq[i].e * 10 ) * ( double ) wi->range.freq[i].m ) == wi->freq ) {
4245 + nPd.haveCurrentChannel = TRUE;
4246 + nPd.currentChannel = wi->range.freq[i].i;
4247 + }
4248 + }
4249 + }
4250 +
4251 + // dot11SupportedDataRatesTxTable
4252 + if ( wi->has_range ) {
4253 + for ( i = 0; i < wi->range.num_bitrates; i++ ) {
4254 + nRt.ifIndex = ifIndex;
4255 + nRt.supportedDataRatesTxIndex = i + 1;
4256 + nRt.supportedDataRatesTxValue = wi->range.bitrate[i] / 500000L;
4257 + nRt.haveSupportedDataRatesTxValue = TRUE;
4258 + sprintf ( nRt.UID, "%04d%04d\0", nRt.ifIndex, nRt.supportedDataRatesTxIndex );
4259 + strcpy ( nRt.ifName, ifName );
4260 + addList (( char * ) &rtList, ( char * ) &nRt, sizeof ( nRt ));
4261 + }
4262 + }
4263 +
4264 + // dot11SupportedDataRatesRxTable
4265 + if ( wi->has_range ) {
4266 + for ( i = 0; i < wi->range.num_bitrates; i++ ) {
4267 + nRr.ifIndex = ifIndex;
4268 + nRr.supportedDataRatesRxIndex = i + 1;
4269 + nRr.supportedDataRatesRxValue = wi->range.bitrate[i] / 500000L;
4270 + nRr.haveSupportedDataRatesRxValue = TRUE;
4271 + sprintf ( nRr.UID, "%04d%04d\0", nRr.ifIndex, nRr.supportedDataRatesRxIndex );
4272 + strcpy ( nRr.ifName, ifName );
4273 + addList (( char * ) &rrList, ( char * ) &nRr, sizeof ( nRr ));
4274 + }
4275 + }
4276 +
4277 +//printf ( "%s max_encoding_tokens: %d\n",
4278 +// "loadWiExtTo80211Structs() - ", wi->range.max_encoding_tokens );
4279 +}
4280 +
4281 +/****************************************************************************
4282 +* *
4283 +* loadWiExt() - load wireless extensions structures; *
4284 +* use ioctl calls and read /proc/net/wireless *
4285 +* *
4286 +****************************************************************************/
4287 +static void loadWiExt ( int skfd, char *ifname, struct wireless_info *wi )
4288 +{
4289 + struct iwreq wrq; // ioctl request structure
4290 + FILE *fp;
4291 + char bfr[1024];
4292 + char buffer[sizeof ( iwrange ) * 2]; /* Large enough */
4293 + char *s, *t;
4294 + int i, j;
4295 +
4296 + strncpy ( wrq.ifr_name, ifname, IFNAMSIZ );
4297 +
4298 + /* Get wireless name */
4299 + if ( ioctl ( skfd, SIOCGIWNAME, &wrq ) >= 0 ) {
4300 + strncpy ( wi->name, wrq.u.name, IFNAMSIZ );
4301 + wi->name[IFNAMSIZ] = '\0';
4302 + }
4303 +
4304 + /* Get ranges */ // NOTE: some version checking in iwlib.c
4305 + memset ( buffer, 0, sizeof ( buffer ));
4306 + wrq.u.data.pointer = ( caddr_t ) &buffer;
4307 + wrq.u.data.length = sizeof ( buffer );
4308 + wrq.u.data.flags = 0;
4309 + if ( ioctl ( skfd, SIOCGIWRANGE, &wrq ) >= 0 ) {
4310 + memcpy (( char * ) &wi->range, buffer, sizeof ( iwrange ));
4311 + wi->has_range = 1;
4312 + }
4313 +
4314 + /* Get network ID */
4315 + if ( ioctl ( skfd, SIOCGIWNWID, &wrq ) >= 0 ) {
4316 + memcpy ( &wi->nwid, &wrq.u.nwid, sizeof ( iwparam ));
4317 + wi->has_nwid = 1;
4318 + }
4319 +
4320 + /* Get frequency / channel */ // THIS NUMBER LOOKS FUNNY
4321 + if ( ioctl ( skfd, SIOCGIWFREQ, &wrq ) >= 0 ) {
4322 + wi->has_freq = 1;
4323 + wi->freq = (( double ) wrq.u.freq.m ) * pow ( 10, wrq.u.freq.e );
4324 + }
4325 +
4326 + /* Get sensitivity */
4327 + if ( ioctl ( skfd, SIOCGIWSENS, &wrq ) >= 0 ) {
4328 + wi->has_sens = 1;
4329 + memcpy ( &wi->sens, &wrq.u.sens, sizeof ( iwparam ));
4330 + }
4331 +
4332 + /* Get encryption information */
4333 + wrq.u.data.pointer = ( caddr_t ) &wi->key;
4334 + wrq.u.data.length = IW_ENCODING_TOKEN_MAX;
4335 + wrq.u.data.flags = 0;
4336 + if ( ioctl ( skfd, SIOCGIWENCODE, &wrq ) >= 0 ) {
4337 + wi->has_key = 1;
4338 + wi->key_size = wrq.u.data.length;
4339 + wi->key_flags = wrq.u.data.flags;
4340 + wepCurrentKey = wrq.u.data.flags & IW_ENCODE_INDEX;
4341 + }
4342 +
4343 + for ( i = 0; i < wi->range.max_encoding_tokens; i++ ) {
4344 + wrq.u.data.pointer = ( caddr_t ) &wi->key;
4345 + wrq.u.data.length = IW_ENCODING_TOKEN_MAX;
4346 + wrq.u.data.flags = i;
4347 + if ( ioctl ( skfd, SIOCGIWENCODE, &wrq ) >= 0 ) {
4348 + if ( ( wrq.u.data.length != 0 ) &&
4349 + !( wrq.u.data.flags & IW_ENCODE_DISABLED )) {
4350 + wep[i].len = wrq.u.data.length;
4351 + wep[i].haveKey = TRUE;
4352 + t = wep[i].key;
4353 + for ( j = 0; j < wrq.u.data.length; j++ ) {
4354 + if (( j & 0x1 ) == 0 && j != 0 )
4355 + strcpy ( t++, "-");
4356 + sprintf ( t, "%.2X", wi->key[j] );
4357 + t += 2;
4358 + }
4359 + t = '\0';
4360 + }
4361 + }
4362 + }
4363 +
4364 + /* Get ESSID */
4365 + wrq.u.essid.pointer = ( caddr_t ) &wi->essid;
4366 + wrq.u.essid.length = IW_ESSID_MAX_SIZE + 1;
4367 + wrq.u.essid.flags = 0;
4368 + if ( ioctl ( skfd, SIOCGIWESSID, &wrq ) >= 0 ) {
4369 + wi->has_essid = 1;
4370 + wi->essid_on = wrq.u.data.flags;
4371 + }
4372 +
4373 + /* Get AP address */
4374 + if ( ioctl ( skfd, SIOCGIWAP, &wrq ) >= 0 ) {
4375 + wi->has_ap_addr = 1;
4376 + memcpy ( &wi->ap_addr, &wrq.u.ap_addr, sizeof ( sockaddr ));
4377 + }
4378 +
4379 + /* Get NickName */
4380 + wrq.u.essid.pointer = ( caddr_t ) &wi->nickname;
4381 + wrq.u.essid.length = IW_ESSID_MAX_SIZE + 1;
4382 + wrq.u.essid.flags = 0;
4383 + if ( ioctl ( skfd, SIOCGIWNICKN, &wrq ) >= 0 ) {
4384 + if ( wrq.u.data.length > 1 )
4385 + wi->has_nickname = 1;
4386 + }
4387 +
4388 + /* Get bit rate */
4389 + if ( ioctl ( skfd, SIOCGIWRATE, &wrq ) >= 0 ) {
4390 + wi->has_bitrate = 1;
4391 + memcpy ( &wi->bitrate, &wrq.u.bitrate, sizeof ( iwparam ));
4392 + }
4393 +
4394 + /* Get RTS threshold */
4395 + if ( ioctl ( skfd, SIOCGIWRTS, &wrq ) >= 0 ) {
4396 + wi->has_rts = 1;
4397 + memcpy ( &wi->rts, &wrq.u.rts, sizeof ( iwparam ));
4398 + }
4399 +
4400 + /* Get fragmentation threshold */
4401 + if ( ioctl ( skfd, SIOCGIWFRAG, &wrq ) >= 0 ) {
4402 + wi->has_frag = 1;
4403 + memcpy ( &wi->frag, &wrq.u.frag, sizeof ( iwparam ));
4404 + }
4405 +
4406 + /* Get operation mode */
4407 + if ( ioctl ( skfd, SIOCGIWMODE, &wrq ) >= 0 ) {
4408 + wi->mode = wrq.u.mode;
4409 + if ( wi->mode < IW_NUM_OPER_MODE && wi->mode >= 0 )
4410 + wi->has_mode = 1;
4411 + }
4412 +
4413 + /* Get Power Management settings */ // #if WIRELESS_EXT > 9
4414 + wrq.u.power.flags = 0;
4415 + if ( ioctl ( skfd, SIOCGIWPOWER, &wrq ) >= 0 ) {
4416 + wi->has_power = 1;
4417 + memcpy ( &wi->power, &wrq.u.power, sizeof ( iwparam ));
4418 + }
4419 +
4420 + /* Get retry limit/lifetime */ // #if WIRELESS_EXT > 10
4421 + if ( ioctl ( skfd, SIOCGIWRETRY, &wrq ) >= 0 ) {
4422 + wi->has_retry = 1;
4423 + memcpy ( &wi->retry, &wrq.u.retry, sizeof ( iwparam ));
4424 + }
4425 +
4426 + /* Get stats */ // #if WIRELESS_EXT > 11
4427 + wrq.u.data.pointer = ( caddr_t ) &wi->stats;
4428 + wrq.u.data.length = 0;
4429 + wrq.u.data.flags = 1; /* Clear updated flag */
4430 + if ( ioctl ( skfd, SIOCGIWSTATS, &wrq ) < 0 )
4431 + wi->has_stats = 1;
4432 +
4433 + if ( !wi->has_stats ) { // no ioctl support, go to file
4434 + fp = fopen ( PROC_NET_WIRELESS, "r" );
4435 + if ( fp ) {
4436 + while ( fgets ( bfr, sizeof ( bfr ), fp )) {
4437 + bfr [ sizeof ( bfr ) - 1 ] = '\0'; // no buffer overruns here!
4438 + strtok (( char * ) &bfr, "\n" ); // '\n' => '\0'
4439 + if ( strstr ( bfr, ifname ) && strstr ( bfr, ":" )) {
4440 + wi->has_stats = 1;
4441 + s = bfr;
4442 + s = strchr ( s, ':' ); s++; /* Skip ethX: */
4443 + s = strtok ( s, " " ); /* ' ' => '\0' */
4444 + sscanf ( s, "%X", &wi->stats.status ); // status
4445 +
4446 + s = strtok ( NULL, " " ); // link quality
4447 + if ( strchr ( s, '.' ) != NULL )
4448 + wi->stats.qual.updated |= 1;
4449 + sscanf ( s, "%d", &wi->stats.qual.qual );
4450 +
4451 + s = strtok ( NULL, " " ); // signal level
4452 + if ( strchr ( s,'.' ) != NULL )
4453 + wi->stats.qual.updated |= 2;
4454 + sscanf ( s, "%d", &wi->stats.qual.level );
4455 +
4456 + s = strtok ( NULL, " " ); // noise level
4457 + if ( strchr ( s, '.' ) != NULL )
4458 + wi->stats.qual.updated += 4;
4459 + sscanf ( s, "%d", &wi->stats.qual.noise );
4460 +
4461 + s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.discard.nwid );
4462 + s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.discard.code );
4463 + s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.discard.fragment );
4464 + s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.discard.retries );
4465 + s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.discard.misc );
4466 + s = strtok ( NULL, " " ); sscanf ( s, "%d", &wi->stats.miss.beacon );
4467 + }
4468 + }
4469 + fclose ( fp );
4470 + }
4471 + }
4472 +
4473 +// printf ( "%s bfr: %s\n", "loadTables()", bfr );
4474 +}
4475 +
4476 +/****************************************************************************
4477 +* *
4478 +* displayWiExt() - show what I got from Wireless Extensions *
4479 +* *
4480 +****************************************************************************/
4481 +static void displayWiExt ( struct wireless_info info )
4482 +{
4483 +#ifdef DISPLAYWIEXT
4484 + int i;
4485 + char title[] = "displayWiExt() -";
4486 +
4487 + printf ( "========================================\n" );
4488 + printf ( "===> Wireless Extension IOCTL calls <===\n" );
4489 + printf ( "========================================\n" );
4490 +
4491 + if ( strlen ( info.name ))
4492 + printf ( "%s name: %s\n", "SIOCGIWNAME", info.name );
4493 + else
4494 + printf ( "%s\n", "no info.name support" );
4495 +
4496 + if ( info.has_nickname = 1 )
4497 + printf ( "%s nickname: %s\n", "SIOCGIWNICKN", info.nickname );
4498 + else
4499 + printf ( "%s %s\n", "SIOCGIWNICKN", " ===> no info.nickname support" );
4500 +
4501 + if ( info.has_essid )
4502 + printf ( "%s essid_on: %d essid: %s\n", "SIOCGIWESSID", info.essid_on, info.essid );
4503 + else
4504 + printf ( "%s %s\n", "SIOCGIWESSID", " ===> no info.essid support" );
4505 +
4506 + if ( info.has_range ) {
4507 + printf ( "%s throughput: %d\n", "SIOCGIWRANGE", info.range.throughput );
4508 + printf ( "%s min_nwid: %d\n", "SIOCGIWRANGE", info.range.min_nwid );
4509 + printf ( "%s max_nwid: %d\n", "SIOCGIWRANGE", info.range.max_nwid );
4510 + printf ( "%s sensitivity: %d\n", "SIOCGIWRANGE", info.range.sensitivity );
4511 + printf ( "%s num_bitrates: %d\n", "SIOCGIWRANGE", info.range.num_bitrates );
4512 + for ( i = 0; i < info.range.num_bitrates; i++ )
4513 + printf ( "%s bitrate[%d]: %d\n", "SIOCGIWRANGE", i, info.range.bitrate[i] );
4514 + printf ( "%s min_rts: %d\n", "SIOCGIWRANGE", info.range.min_rts );
4515 + printf ( "%s max_rts: %d\n", "SIOCGIWRANGE", info.range.max_rts );
4516 + printf ( "%s min_frag: %d\n", "SIOCGIWRANGE", info.range.min_frag );
4517 + printf ( "%s max_frag: %d\n", "SIOCGIWRANGE", info.range.max_frag );
4518 + printf ( "%s min_pmp: %d\n", "SIOCGIWRANGE", info.range.min_pmp );
4519 + printf ( "%s max_pmp: %d\n", "SIOCGIWRANGE", info.range.max_pmp );
4520 + printf ( "%s min_pmt: %d\n", "SIOCGIWRANGE", info.range.min_pmt );
4521 + printf ( "%s max_pmt: %d\n", "SIOCGIWRANGE", info.range.max_pmt );
4522 + printf ( "%s pmp_flags: %d\n", "SIOCGIWRANGE", info.range.pmp_flags );
4523 + printf ( "%s pmt_flags: %d\n", "SIOCGIWRANGE", info.range.pmt_flags );
4524 + printf ( "%s pm_capa: %d\n", "SIOCGIWRANGE", info.range.pm_capa );
4525 + printf ( "%s num_encoding_sizes: %d\n", "SIOCGIWRANGE", info.range.num_encoding_sizes );
4526 + for ( i = 0; i < info.range.num_encoding_sizes; i++ )
4527 + printf ( "%s encoding_size[%d]: %d\n", "SIOCGIWRANGE", i, info.range.encoding_size[i] );
4528 + printf ( "%s max_encoding_tokens: %d\n", "SIOCGIWRANGE", info.range.max_encoding_tokens );
4529 +// printf ( "%s encoding_login_index: %d\n", "SIOCGIWRANGE", info.range.encoding_login_index );
4530 + printf ( "%s txpower_capa: %d\n", "SIOCGIWRANGE", info.range.txpower_capa );
4531 + printf ( "%s num_txpower: %d dBm\n", "SIOCGIWRANGE", info.range.num_txpower );
4532 + for ( i = 0; i < info.range.num_txpower; i++ )
4533 + printf ( "%s txpower[%d]: %d\n", "SIOCGIWRANGE", i, info.range.txpower[i] );
4534 + printf ( "%s we_version_compiled: %d\n", "SIOCGIWRANGE", info.range.we_version_compiled );
4535 + printf ( "%s we_version_source: %d\n", "SIOCGIWRANGE", info.range.we_version_source );
4536 + printf ( "%s retry_capa: %d\n", "SIOCGIWRANGE", info.range.retry_capa );
4537 + printf ( "%s retry_flags: %d\n", "SIOCGIWRANGE", info.range.retry_flags );
4538 + printf ( "%s r_time_flags: %d\n", "SIOCGIWRANGE", info.range.r_time_flags );
4539 + printf ( "%s min_retry: %d\n", "SIOCGIWRANGE", info.range.min_retry );
4540 + printf ( "%s max_retry: %d\n", "SIOCGIWRANGE", info.range.max_retry );
4541 + printf ( "%s min_r_time: %d\n", "SIOCGIWRANGE", info.range.min_r_time );
4542 + printf ( "%s max_r_time: %d\n", "SIOCGIWRANGE", info.range.max_r_time );
4543 + printf ( "%s num_channels: %d\n", "SIOCGIWRANGE", info.range.num_channels );
4544 + printf ( "%s num_frequency: %d\n", "SIOCGIWRANGE", info.range.num_frequency );
4545 + for ( i = 0; i < info.range.num_frequency; i++ )
4546 + printf ( "%s freq[%d].i: %d freq[%d].e: %d freq[%d].m: %d\n", "SIOCGIWRANGE",
4547 + i, info.range.freq[i].i, i, info.range.freq[i].e, i, info.range.freq[i].m );
4548 + }
4549 + else
4550 + printf ( "%s %s\n", "SIOCGIWRANGE", " ===> no info.range support" );
4551 +
4552 + if ( info.has_nwid )
4553 + printf ( "%s nwid - disabled: %d value: %X\n", "SIOCGIWNWID", info.nwid.disabled, info.nwid.value );
4554 + else
4555 + printf ( "%s %s\n", "SIOCGIWNWID", " ===> no info.nwid support" );
4556 +
4557 + if ( info.has_freq ) {
4558 +// printf ( "%s freq: %g\n", "SIOCGIWFREQ", info.freq / GIGA );
4559 + printf ( "%s freq: %g\n", "SIOCGIWFREQ", info.freq );
4560 + }
4561 + else
4562 + printf ( "%s %s\n", "SIOCGIWFREQ", " ===> no info.freq support" );
4563 +
4564 + if ( info.has_sens )
4565 + printf ( "%s sens: %d\n", "SIOCGIWSENS", info.sens );
4566 + else
4567 + printf ( "%s %s\n", "SIOCGIWSENS", " ===> no info.sens support" );
4568 +
4569 + if ( info.has_key ) {
4570 + printf ( "%s key_size: %d key_flags: %d wepCurrentKey: %d\n",
4571 + "SIOCGIWENCODE", info.key_size, info.key_flags, wepCurrentKey );
4572 + printf ( "%s MODE: %d DISABLED: %d INDEX: %d OPEN: %d RESTRICTED: %d NOKEY: %d TEMP: %d\n",
4573 + "SIOCGIWENCODE", info.key_flags & IW_ENCODE_MODE,
4574 + info.key_flags & IW_ENCODE_DISABLED ? 1:0, info.key_flags & IW_ENCODE_INDEX,
4575 + info.key_flags & IW_ENCODE_OPEN ? 1:0, info.key_flags & IW_ENCODE_RESTRICTED ? 1:0,
4576 + info.key_flags & IW_ENCODE_NOKEY ? 1:0, info.key_flags & IW_ENCODE_TEMP ? 1:0 );
4577 + }
4578 + else
4579 + printf ( "%s %s\n", "SIOCGIWENCODE", " ===> no info.key support" );
4580 +
4581 + for ( i = 0; i < MAX_WEP_KEYS; i++ ) {
4582 + if ( wep[i].haveKey )
4583 + printf ( "%s wep[%d].len: %d wep[%d].key: %s\n",
4584 + "SIOCGIWENCODE", i, wep[i].len, i, wep[i].key );
4585 + }
4586 +
4587 + if ( info.has_ap_addr )
4588 + printf ( "%s ap_addr.sa_data: %02X:%02X:%02X:%02X:%02X:%02X ap_addr.sa_family: %d\n",
4589 + "SIOCGIWAP", ( UCHAR ) info.ap_addr.sa_data[0], ( UCHAR ) info.ap_addr.sa_data[1],
4590 + ( UCHAR ) info.ap_addr.sa_data[2], ( UCHAR ) info.ap_addr.sa_data[3],
4591 + ( UCHAR ) info.ap_addr.sa_data[4], ( UCHAR ) info.ap_addr.sa_data[5],
4592 + info.ap_addr.sa_family );
4593 + else
4594 + printf ( "%s %s\n", "SIOCGIWAP", " ===> no ap_addr information" );
4595 +
4596 + if ( info.has_bitrate )
4597 + printf ( "%s bitrate: %d value: %d fixed: %d disabled: %d flags: %d\n",
4598 + "SIOCGIWRATE", info.bitrate, info.bitrate.value, info.bitrate.fixed,
4599 + info.bitrate.disabled, info.bitrate.flags );
4600 + else
4601 + printf ( "%s %s\n", "SIOCGIWRATE", " ===> no info.bitrate support" );
4602 +
4603 + if ( info.has_rts )
4604 + printf ( "%s rts: %d\n", "SIOCGIWRTS", info.rts );
4605 + else
4606 + printf ( "%s %s\n", "SIOCGIWRTS", " ===> no info.rts support" );
4607 +
4608 + if ( info.has_frag )
4609 + printf ( "%s frag: %d\n", "SIOCGIWFRAG", info.frag );
4610 + else
4611 + printf ( "%s %s\n", "SIOCGIWFRAG", " ===> no info.frag support" );
4612 +
4613 + if ( info.has_mode )
4614 + printf ( "%s mode: %d\n", "SIOCGIWMODE", info.mode );
4615 + else
4616 + printf ( "%s %s\n", "SIOCGIWMODE", " ===> no info.mode support" );
4617 +
4618 + if ( info.has_power ) {
4619 + printf ( "%s power: %d\n", "SIOCGIWPOWER", info.power );
4620 + printf ( "%s disabled: %d MIN: %d MAX: %d TIMEOUT: %d RELATIVE: %d\n",
4621 + "SIOCGIWPOWER",
4622 + info.power.disabled ? 1:0,
4623 + info.power.flags & IW_POWER_MIN ? 1:0,
4624 + info.power.flags & IW_POWER_MAX ? 1:0,
4625 + info.power.flags & IW_POWER_TIMEOUT ? 1:0,
4626 + info.power.flags & IW_POWER_RELATIVE ? 1:0 );
4627 + printf ( "%s UNICAST: %d MULTICAST: %d ALL: %d FORCE: %d REPEATER: %d\n",
4628 + "SIOCGIWPOWER",
4629 + info.power.flags & IW_POWER_UNICAST_R ? 1:0,
4630 + info.power.flags & IW_POWER_MULTICAST_R ? 1:0,
4631 + info.power.flags & IW_POWER_ALL_R ? 1:0,
4632 + info.power.flags & IW_POWER_FORCE_S ? 1:0,
4633 + info.power.flags & IW_POWER_REPEATER ? 1:0 );
4634 + }
4635 + else
4636 + printf ( "%s %s\n", "SIOCGIWPOWER", " ===> no info.power support" );
4637 +
4638 + if ( info.has_retry )
4639 + printf ( "%s retry: %d\n", "SIOCGIWRETRY", info.retry );
4640 + else
4641 + printf ( "%s %s\n", "SIOCGIWRETRY", " ===> no info.retry support" );
4642 +
4643 + if ( info.has_stats ) {
4644 + printf ( "%s status: %d\n", "SIOCGIWSTATS", info.stats.status );
4645 + printf ( "%s qual.level: %d\n", "SIOCGIWSTATS", info.stats.qual.level );
4646 + printf ( "%s qual.noise: %d\n", "SIOCGIWSTATS", info.stats.qual.noise );
4647 + printf ( "%s qual.qual: %d\n", "SIOCGIWSTATS", info.stats.qual.qual );
4648 + printf ( "%s qual.updated: %d\n", "SIOCGIWSTATS", info.stats.qual.updated );
4649 + printf ( "%s discard.code: %d\n", "SIOCGIWSTATS", info.stats.discard.code );
4650 + printf ( "%s discard.fragment: %d\n", "SIOCGIWSTATS", info.stats.discard.fragment );
4651 + printf ( "%s discard.misc: %d\n", "SIOCGIWSTATS", info.stats.discard.misc );
4652 + printf ( "%s discard.nwid: %d\n", "SIOCGIWSTATS", info.stats.discard.nwid );
4653 + printf ( "%s discard.retries: %d\n", "SIOCGIWSTATS", info.stats.discard.retries );
4654 + printf ( "%s miss.beacon: %d\n", "SIOCGIWSTATS", info.stats.miss.beacon );
4655 + }
4656 + else
4657 + printf ( "%s %s\n", "SIOCGIWSTATS", " ===> no info.stats support" );
4658 +
4659 + if ( info.txpower.flags & IW_TXPOW_MWATT )
4660 + printf ( "%s txpower1: %d dBm disabled: %d fixed: %d flags: %d\n", "SIOCGIWRANGE",
4661 + mWatt2dbm ( info.txpower.value ), info.txpower.disabled, info.txpower.fixed, info.txpower.flags);
4662 + else
4663 + printf ( "%s txpower2: %d dBm disabled: %d fixed: %d flags: %d\n", "SIOCGIWRANGE", info.txpower.value, info.txpower.disabled, info.txpower.fixed, info.txpower.flags );
4664 +
4665 + if ( info.has_range )
4666 + if ( info.sens.value < 0 )
4667 + printf ( "%s sens: %d dBm\n", "SIOCGIWRANGE", info.sens.value );
4668 + else
4669 + printf ( "%s sens: %d/%d\n", "SIOCGIWRANGE", info.sens.value, info.range.sensitivity );
4670 +
4671 + if ( info.has_range && ( info.stats.qual.level != 0 ))
4672 + if ( info.stats.qual.level > info.range.max_qual.level )
4673 + /* Statistics are in dBm (absolute power measurement) */
4674 + printf ( "%s Quality: %d/%d Signal level: %d dBm Noise level: %d dBm\n",
4675 + "SIOCGIWRANGE",
4676 + info.stats.qual.qual, info.range.max_qual.qual,
4677 + info.stats.qual.level - 0x100,
4678 + info.stats.qual.noise - 0x100 );
4679 + else
4680 + printf ( "%s Quality: %d/%d Signal level: %d/%d Noise level: %d/%d",
4681 + "SIOCGIWRANGE",
4682 + info.stats.qual.qual, info.range.max_qual.qual,
4683 + info.stats.qual.level, info.range.max_qual.level,
4684 + info.stats.qual.noise, info.range.max_qual.noise );
4685 +
4686 +#endif // #ifdef DISPLAYWIEXT
4687 +}
4688 +
4689 +/****************************************************************************
4690 +* *
4691 +* Linked List Functions *
4692 +* *
4693 +****************************************************************************/
4694 +/****************************************************************************
4695 +* *
4696 +* addList() - add an entry to a linked list *
4697 +* *
4698 +****************************************************************************/
4699 +static void
4700 +addList ( char *l, char *data, int len )
4701 +{
4702 + char uid[256];
4703 + LIST_HEAD ( , avNode ) *list;
4704 +
4705 + // NOTE: this assumes the UID is at the begining of the
4706 + // data structure and that UIDs are strings
4707 +
4708 + list = ( LIST_HEAD ( , avNode ) * ) l; // NOTE: don't know how to get
4709 + strcpy ( uid, data ); // rid of compiler warning on
4710 + // LISTHEAD typecast
4711 + // create a new node and the data that goes in it
4712 + newNode = malloc ( sizeof ( struct avNode ));
4713 + newNode->data = malloc ( len );
4714 + memcpy ( newNode->data, data, len );
4715 +
4716 + // this deals with an empty list
4717 + if ( LIST_EMPTY ( list )) {
4718 + LIST_INSERT_HEAD ( list, newNode, nodes );
4719 + return;
4720 + }
4721 +
4722 + // this deals with UIDs that match
4723 + for ( np = LIST_FIRST ( list ); np != NULL; np = LIST_NEXT ( np, nodes )) {
4724 + if ( strncmp ( uid, np->data, strlen ( uid )) == 0 ) { // found matching UID
4725 + LIST_INSERT_AFTER ( np, newNode, nodes );
4726 + if ( np->data )
4727 + free ( np->data );
4728 + LIST_REMOVE ( np, nodes );
4729 + free ( np );
4730 + return;
4731 + }
4732 + }
4733 +
4734 + // this deals with inserting a new UID in the list
4735 + for ( np = LIST_FIRST ( list ); np != NULL; np = LIST_NEXT ( np, nodes )) {
4736 + lastNode = np;
4737 + if ( strncmp ( np->data, uid, strlen ( uid )) > 0 ) { // old ID > new ID AND
4738 + LIST_INSERT_BEFORE ( np, newNode, nodes );
4739 + return;
4740 + }
4741 + }
4742 +
4743 + // this deals with a UID that needs to go on the end of the list
4744 + LIST_INSERT_AFTER ( lastNode, newNode, nodes );
4745 +
4746 + return;
4747 +}
4748 +
4749 +/****************************************************************************
4750 +* *
4751 +* initLists() - initialize all the linked lists *
4752 +* *
4753 +****************************************************************************/
4754 +static void initLists()
4755 +{
4756 + LIST_INIT ( &scList ); LIST_INIT ( &aaList ); LIST_INIT ( &dfList );
4757 + LIST_INIT ( &kmList ); LIST_INIT ( &prList );
4758 + LIST_INIT ( &opList ); LIST_INIT ( &coList );
4759 + LIST_INIT ( &gaList ); LIST_INIT ( &riList ); LIST_INIT ( &poList );
4760 + LIST_INIT ( &paList ); LIST_INIT ( &ptList ); LIST_INIT ( &pfList );
4761 + LIST_INIT ( &pdList ); LIST_INIT ( &piList ); LIST_INIT ( &rdList );
4762 + LIST_INIT ( &alList ); LIST_INIT ( &rtList ); LIST_INIT ( &rrList );
4763 +}
4764 +/****************************************************************************
4765 +* *
4766 +* flushLists() - flush all linked lists *
4767 +* *
4768 +****************************************************************************/
4769 +static void flushLists()
4770 +{
4771 + flushList (( char * ) &scList ); flushList (( char * ) &aaList );
4772 + flushList (( char * ) &dfList ); flushList (( char * ) &kmList );
4773 + flushList (( char * ) &prList );
4774 + flushList (( char * ) &opList ); flushList (( char * ) &coList );
4775 + flushList (( char * ) &gaList ); flushList (( char * ) &riList );
4776 + flushList (( char * ) &poList ); flushList (( char * ) &paList );
4777 + flushList (( char * ) &ptList ); flushList (( char * ) &pfList );
4778 + flushList (( char * ) &pdList ); flushList (( char * ) &piList );
4779 + flushList (( char * ) &rdList ); flushList (( char * ) &alList );
4780 + flushList (( char * ) &rtList ); flushList (( char * ) &rrList );
4781 +}
4782 +
4783 +/****************************************************************************
4784 +* *
4785 +* flushList() - flush a linked list *
4786 +* *
4787 +****************************************************************************/
4788 +static void flushList ( char *l )
4789 +{
4790 + LIST_HEAD ( , avNode ) *list;
4791 +
4792 + list = ( LIST_HEAD ( , avNode ) * ) l; // NOTE: don't know how to get
4793 + while ( !LIST_EMPTY ( list )) { // rid of compiler warning on
4794 + np = LIST_FIRST ( list ); // LISTHEAD typecast
4795 + if ( np->data )
4796 + free ( np->data );
4797 + LIST_REMOVE ( np, nodes );
4798 + free ( np );
4799 + }
4800 +}
4801 +
4802 +/****************************************************************************
4803 +* *
4804 +* Utility Functions *
4805 +* *
4806 +****************************************************************************/
4807 +/****************************************************************************
4808 +* *
4809 +* The following two routines were taken directly from iwlib.c *
4810 +* *
4811 +****************************************************************************/
4812 + /*
4813 + * Open a socket.
4814 + * Depending on the protocol present, open the right socket. The socket
4815 + * will allow us to talk to the driver.
4816 + */
4817 +static int openSocket ( void )
4818 +{
4819 + static const int families[] = {
4820 + AF_INET, AF_IPX, AF_AX25, AF_APPLETALK
4821 + };
4822 + unsigned int i;
4823 + int sock;
4824 +
4825 + /*
4826 + * Now pick any (exisiting) useful socket family for generic queries
4827 + * Note : don't open all the socket, only returns when one matches,
4828 + * all protocols might not be valid.
4829 + * Workaround by Jim Kaba <jkaba@sarnoff.com>
4830 + * Note : in 99% of the case, we will just open the inet_sock.
4831 + * The remaining 1% case are not fully correct...
4832 + */
4833 +
4834 + /* Try all families we support */
4835 + for(i = 0; i < sizeof(families)/sizeof(int); ++i) {
4836 + /* Try to open the socket, if success returns it */
4837 + sock = socket(families[i], SOCK_DGRAM, 0);
4838 + if(sock >= 0)
4839 + return sock;
4840 + }
4841 +
4842 + return -1;
4843 +}
4844 +
4845 +/*------------------------------------------------------------------*/
4846 +/*
4847 + * Convert a value in milliWatt to a value in dBm.
4848 + */
4849 +static int mWatt2dbm ( int in )
4850 +{
4851 +#ifdef WE_NOLIBM
4852 + /* Version without libm : slower */
4853 + double fin = (double) in;
4854 + int res = 0;
4855 +
4856 + /* Split integral and floating part to avoid accumulating rounding errors */
4857 + while(fin > 10.0)
4858 + {
4859 + res += 10;
4860 + fin /= 10.0;
4861 + }
4862 + while(fin > 1.000001) /* Eliminate rounding errors, take ceil */
4863 + {
4864 + res += 1;
4865 + fin /= LOG10_MAGIC;
4866 + }
4867 + return(res);
4868 +#else /* WE_NOLIBM */
4869 + /* Version with libm : faster */
4870 + return((int) (ceil(10.0 * log10((double) in))));
4871 +#endif /* WE_NOLIBM */
4872 +}
4873 +
4874 +/****************************************************************************
4875 +* *
4876 +* htob - converts hex string to binary *
4877 +* *
4878 +****************************************************************************/
4879 +static char *htob ( char *s )
4880 +{
4881 + char nibl, *byt;
4882 + static char bin[20];
4883 +
4884 + byt = bin;
4885 +
4886 + while ((nibl = *s++) && nibl != ' ') { /* While not end of string. */
4887 + nibl -= ( nibl > '9') ? ('A' - 10): '0';
4888 + *byt = nibl << 4; /* place high nibble */
4889 + if((nibl = *s++) && nibl != ' ') {
4890 + nibl -= ( nibl > '9') ? ('A' - 10): '0';
4891 + *byt |= nibl; /* place low nibble */
4892 + }
4893 + else break;
4894 + ++byt;
4895 + }
4896 + *++byt = '\0';
4897 + return ( bin );
4898 +}
4899 +
4900 +/****************************************************************************
4901 +* *
4902 +* hasChanged() - see if area has been changed from NULLs *
4903 +* *
4904 +****************************************************************************/
4905 +static int hasChanged ( char *loc, int len )
4906 +{
4907 + char *wrk;
4908 + int changed = TRUE;
4909 +
4910 + wrk = malloc ( len );
4911 + memset ( wrk, 0, len );
4912 + if ( memcmp ( loc, wrk, len ) == 0 )
4913 + changed = FALSE;
4914 + free ( wrk );
4915 +
4916 + return ( changed );
4917 +}
4918 +
4919 --- net-snmp-5.1.2-orig/agent/mibgroup/ieee802dot11.h 1970-01-01 01:00:00.000000000 +0100
4920 +++ net-snmp-5.1.2-5/agent/mibgroup/ieee802dot11.h 2005-03-13 16:17:21.000000000 +0100
4921 @@ -0,0 +1,730 @@
4922 +/****************************************************************************
4923 +* *
4924 +* File Name: ieee802dot11.h *
4925 +* Used By: *
4926 +* *
4927 +* Operating System: *
4928 +* Purpose: *
4929 +* *
4930 +* Comments: *
4931 +* *
4932 +* Author: Larry Simmons *
4933 +* lsimmons@avantcom.com *
4934 +* www.avantcom.com *
4935 +* *
4936 +* Creation Date: 09/02/03 *
4937 +* *
4938 +* Ver Date Inits Modification *
4939 +* ----- -------- ----- ------------ *
4940 +* 0.0.1 09/02/03 LRS created *
4941 +* 0.0.2 09/24/03 LRS wouldn't build after fresh ./configure *
4942 +****************************************************************************/
4943 +/* This file was generated by mib2c and is intended for use as a mib module
4944 + for the ucd-snmp snmpd agent. */
4945 +#ifndef _MIBGROUP_IEEE802DOT11_H
4946 +#define _MIBGROUP_IEEE802DOT11_H
4947 +/* we may use header_generic and header_simple_table from the util_funcs module */
4948 +
4949 +/****************************************************************************
4950 +* Includes *
4951 +****************************************************************************/
4952 +#include <sys/queue.h>
4953 +
4954 +/****************************************************************************
4955 +* Linked List Defines *
4956 +****************************************************************************/
4957 +// here are some Linked List MACROS I wanted to use,
4958 +// but curiously were not in /usr/includes/sys/queue.h
4959 +
4960 +#ifndef LIST_EMPTY
4961 + #define LIST_EMPTY(head) ((head)->lh_first == NULL)
4962 +#endif
4963 +
4964 +#ifndef LIST_NEXT
4965 + #define LIST_NEXT(elm, field) ((elm)->field.le_next)
4966 +#endif
4967 +
4968 +#ifndef LIST_INSERT_BEFORE
4969 + #define LIST_INSERT_BEFORE(listelm, elm, field) do { \
4970 + (elm)->field.le_prev = (listelm)->field.le_prev; \
4971 + LIST_NEXT((elm), field) = (listelm); \
4972 + *(listelm)->field.le_prev = (elm); \
4973 + (listelm)->field.le_prev = &LIST_NEXT((elm), field); \
4974 + } while (0)
4975 +#endif
4976 +
4977 +#ifndef LIST_FIRST
4978 + #define LIST_FIRST(head) ((head)->lh_first)
4979 +#endif
4980 +
4981 +/****************************************************************************
4982 +* 802.11 MIB Defines *
4983 +****************************************************************************/
4984 +#define SYS_STRING_LEN 256
4985 +#define MACADDR_LEN ( 6 * 2 ) + 5
4986 +#define OPER_RATE_SET_LEN 126
4987 +#define MAN_OUI_LEN ( 3 * 2 ) + 2
4988 +#define WEP_STR_LEN 64
4989 +#define SNMP_STR_LEN 128
4990 +#define TEXT_LEN 80
4991 +#define IFINDEX_LEN 4
4992 +#define IFNAME_LEN 16
4993 +#define MAX_WEP_KEYS 4
4994 +
4995 +#define AUTHENICATION_ALGORITHMS_INDEX_LEN 4
4996 +#define WEP_DEFAULT_KEY_INDEX_LEN 4
4997 +#define WEP_KEY_MAPPING_INDEX_LEN 4
4998 +#define GROUP_ADDRESS_INDEX_LEN 4
4999 +#define REG_DOMAIN_SUPPORT_INDEX_LEN 4
5000 +#define ANTENNA_LIST_INDEX_LEN 4
5001 +#define SUPPORTED_DATA_RATES_TX_INDEX_LEN 4
5002 +#define SUPPORTED_DATA_RATES_RX_INDEX_LEN 4
5003 +
5004 +#define SC_UID_LEN IFINDEX_LEN
5005 +#define AA_UID_LEN IFINDEX_LEN + AUTHENICATION_ALGORITHMS_INDEX_LEN
5006 +#define DF_UID_LEN IFINDEX_LEN + WEP_DEFAULT_KEY_INDEX_LEN
5007 +#define KM_UID_LEN IFINDEX_LEN + WEP_KEY_MAPPING_INDEX_LEN
5008 +#define PR_UID_LEN IFINDEX_LEN
5009 +#define OP_UID_LEN IFINDEX_LEN
5010 +#define CO_UID_LEN IFINDEX_LEN
5011 +#define GA_UID_LEN IFINDEX_LEN + GROUP_ADDRESS_INDEX_LEN
5012 +#define RI_UID_LEN IFINDEX_LEN
5013 +#define PO_UID_LEN IFINDEX_LEN
5014 +#define PA_UID_LEN IFINDEX_LEN
5015 +#define PT_UID_LEN IFINDEX_LEN
5016 +#define PF_UID_LEN IFINDEX_LEN
5017 +#define PD_UID_LEN IFINDEX_LEN
5018 +#define PI_UID_LEN IFINDEX_LEN
5019 +#define RD_UID_LEN IFINDEX_LEN + REG_DOMAIN_SUPPORT_INDEX_LEN
5020 +#define AL_UID_LEN IFINDEX_LEN + ANTENNA_LIST_INDEX_LEN
5021 +#define RT_UID_LEN IFINDEX_LEN + SUPPORTED_DATA_RATES_TX_INDEX_LEN
5022 +#define RR_UID_LEN IFINDEX_LEN + SUPPORTED_DATA_RATES_RX_INDEX_LEN
5023 +
5024 +/****************************************************************************
5025 +* Linked List Structure *
5026 +****************************************************************************/
5027 +static struct avNode {
5028 + LIST_ENTRY ( avNode ) nodes;
5029 + char *data; // pointer to data
5030 +};
5031 +
5032 +typedef LIST_HEAD ( , avNode ) avList_t;
5033 +
5034 +/****************************************************************************
5035 +* 802.11 MIB structures *
5036 +****************************************************************************/
5037 +/****************************************************************************
5038 +* dot11Smt Group *
5039 +****************************************************************************/
5040 +/****************************************************************************
5041 +* dot11StationConfigTable *
5042 +****************************************************************************/
5043 +static struct scTbl_data {
5044 +
5045 + char UID [ SC_UID_LEN + 1 ]; // unique ID
5046 + char ifName [ IFNAME_LEN + 1 ]; // ifName of card
5047 +
5048 + long ifIndex; // ifindex of card
5049 +
5050 + char stationID [ MACADDR_LEN + 1 ]; // Default actual MacAddr
5051 + long mediumOccupancyLimit;
5052 + long CFPPollable;
5053 + long CFPPeriod;
5054 + long maxDuration;
5055 + long authenticationResponseTimeOut;
5056 + long privacyOptionImplemented;
5057 + long powerManagementMode;
5058 + char desiredSSID [ SNMP_STR_LEN + 1 ];
5059 + long desiredBSSType;
5060 + char operationalRateSet [ OPER_RATE_SET_LEN + 1];
5061 + long beaconPeriod;
5062 + long DTIMPeriod;
5063 + long associationResponseTimeOut;
5064 + long disAssociationReason;
5065 + char disAssociationStation [ MACADDR_LEN + 1 ];
5066 + long deAuthenticationReason;
5067 + char deAuthenticationStation [ MACADDR_LEN + 1 ];
5068 + long authenticateFailStatus;
5069 + char authenticateFailStation [ MACADDR_LEN + 1 ];
5070 +
5071 + long haveStationID;
5072 + long haveMediumOccupancyLimit;
5073 + long haveCFPPollable;
5074 + long haveCFPPeriod;
5075 + long haveMaxDuration;
5076 + long haveAuthenticationResponseTimeOut;
5077 + long havePrivacyOptionImplemented;
5078 + long havePowerManagementMode;
5079 + long haveDesiredSSID;
5080 + long haveDesiredBSSType;
5081 + long haveOperationalRateSet;
5082 + long haveBeaconPeriod;
5083 + long haveDTIMPeriod;
5084 + long haveAssociationResponseTimeOut;
5085 + long haveDisAssociationReason;
5086 + long haveDisAssociationStation;
5087 + long haveDeAuthenticationReason;
5088 + long haveDeAuthenticationStation;
5089 + long haveAuthenticateFailStatus;
5090 + long haveAuthenticateFailStation;
5091 +
5092 +} nSc, *sc = &nSc;
5093 +
5094 +static avList_t scList;
5095 +
5096 +/****************************************************************************
5097 +* dot11AuthenticationAlgorithmsTable *
5098 +****************************************************************************/
5099 +static struct aaTbl_data {
5100 +
5101 + char UID [ AA_UID_LEN + 1 ];
5102 + char ifName [ IFNAME_LEN + 1 ]; // ifName of card
5103 +
5104 + long ifIndex; // ifindex of card
5105 + long authenticationAlgorithmsIndex;
5106 +
5107 + long authenticationAlgorithm;
5108 + long authenticationAlgorithmsEnable;
5109 +
5110 + long haveAuthenticationAlgorithm;
5111 + long haveAuthenticationAlgorithmsEnable;
5112 +
5113 +} nAa, *aa = &nAa;
5114 +
5115 +static avList_t aaList;
5116 +
5117 +/****************************************************************************
5118 +* dot11WEPDefaultKeysTable *
5119 +****************************************************************************/
5120 +static struct dfTbl_data {
5121 +
5122 + char UID [ DF_UID_LEN + 1 ];
5123 + char ifName [ IFNAME_LEN + 1 ];
5124 +
5125 + long ifIndex; // ifindex of card
5126 + long WEPDefaultKeyIndex;
5127 +
5128 + char WEPDefaultKeyValue [ WEP_STR_LEN + 1 ];
5129 + long haveWEPDefaultKeyValue;
5130 +
5131 +} nDf, *df = &nDf;
5132 +
5133 +static avList_t dfList;
5134 +
5135 +/****************************************************************************
5136 +* dot11WEPKeyMappingsTable *
5137 +****************************************************************************/
5138 +static struct kmTbl_data {
5139 +
5140 + char UID [ KM_UID_LEN + 1 ];
5141 + char ifName [ IFNAME_LEN + 1 ];
5142 +
5143 + long ifIndex;
5144 + long WEPKeyMappingIndex;
5145 +
5146 + char WEPKeyMappingAddress [ MACADDR_LEN + 1 ];
5147 + long WEPKeyMappingWEPOn;
5148 + char WEPKeyMappingValue [ WEP_STR_LEN + 1 ];
5149 + long WEPKeyMappingStatus;
5150 +
5151 + long haveWEPKeyMappingIndex;
5152 + long haveWEPKeyMappingAddress;
5153 + long haveWEPKeyMappingWEPOn;
5154 + long haveWEPKeyMappingValue;
5155 + long haveWEPKeyMappingStatus;
5156 +
5157 +} nKm, *km = &nKm;
5158 +
5159 +static avList_t kmList;
5160 +
5161 +/****************************************************************************
5162 +* dot11PrivacyTable *
5163 +****************************************************************************/
5164 +static struct prTbl_data {
5165 +
5166 + char UID [ PR_UID_LEN + 1 ];
5167 + char ifName [ IFNAME_LEN + 1 ];
5168 +
5169 + long ifIndex;
5170 +
5171 + long privacyInvoked;
5172 + long WEPDefaultKeyID;
5173 + long WEPKeyMappingLength;
5174 + long excludeUnencrypted;
5175 + unsigned long WEPICVErrorCount;
5176 + unsigned long WEPExcludedCount;
5177 +
5178 + long havePrivacyInvoked;
5179 + long haveWEPDefaultKeyID;
5180 + long haveWEPKeyMappingLength;
5181 + long haveExcludeUnencrypted;
5182 + long haveWEPICVErrorCount;
5183 + long haveWEPExcludedCount;
5184 +
5185 +} nPr, *pr = &nPr;
5186 +
5187 +static avList_t prList;
5188 +
5189 +/****************************************************************************
5190 +* dot11Mac Group *
5191 +****************************************************************************/
5192 +/****************************************************************************
5193 +* dot11OperationTable *
5194 +****************************************************************************/
5195 +static struct opTbl_data {
5196 +
5197 + char UID [ OP_UID_LEN + 1 ]; // unique ID
5198 + char ifName [ IFNAME_LEN + 1 ]; // ifName of card
5199 +
5200 + long ifIndex; // ifindex of card
5201 +
5202 + char MACAddress [ MACADDR_LEN + 1 ];
5203 + long RTSThreshold;
5204 + long shortRetryLimit;
5205 + long longRetryLimit;
5206 + long fragmentationThreshold;
5207 + long maxTransmitMSDULifetime;
5208 + long maxReceiveLifetime;
5209 + char manufacturerID [ SNMP_STR_LEN + 1 ];
5210 + char productID [ SNMP_STR_LEN + 1 ];
5211 +
5212 + long haveMACAddress;
5213 + long haveRTSThreshold;
5214 + long haveShortRetryLimit;
5215 + long haveLongRetryLimit;
5216 + long haveFragmentationThreshold;
5217 + long haveMaxTransmitMSDULifetime;
5218 + long haveMaxReceiveLifetime;
5219 + long haveManufacturerID;
5220 + long haveProductID;
5221 +
5222 +} nOp, *op = &nOp;
5223 +
5224 +static avList_t opList;
5225 +
5226 +/****************************************************************************
5227 +* dot11CountersTable *
5228 +****************************************************************************/
5229 +static struct coTbl_data {
5230 +
5231 + char UID [ CO_UID_LEN + 1 ]; // unique ID
5232 + char ifName [ IFNAME_LEN + 1 ]; // ifName of card
5233 +
5234 + long ifIndex; // ifindex of card
5235 +
5236 + unsigned long transmittedFragmentCount;
5237 + unsigned long multicastTransmittedFrameCount;
5238 + unsigned long failedCount;
5239 + unsigned long retryCount;
5240 + unsigned long multipleRetryCount;
5241 + unsigned long frameDuplicateCount;
5242 + unsigned long RTSSuccessCount;
5243 + unsigned long RTSFailureCount;
5244 + unsigned long ACKFailureCount;
5245 + unsigned long receivedFragmentCount;
5246 + unsigned long multicastReceivedFrameCount;
5247 + unsigned long FCSErrorCount;
5248 + unsigned long transmittedFrameCount;
5249 + unsigned long WEPUndecryptableCount;
5250 +
5251 + long haveTransmittedFragmentCount;
5252 + long haveMulticastTransmittedFrameCount;
5253 + long haveFailedCount;
5254 + long haveRetryCount;
5255 + long haveMultipleRetryCount;
5256 + long haveFrameDuplicateCount;
5257 + long haveRTSSuccessCount;
5258 + long haveRTSFailureCount;
5259 + long haveACKFailureCount;
5260 + long haveReceivedFragmentCount;
5261 + long haveMulticastReceivedFrameCount;
5262 + long haveFCSErrorCount;
5263 + long haveTransmittedFrameCount;
5264 + long haveWEPUndecryptableCount;
5265 +
5266 +} nCo, *co = &nCo;
5267 +
5268 +static avList_t coList;
5269 +
5270 +/****************************************************************************
5271 +* dot11GroupAddressesTable *
5272 +****************************************************************************/
5273 +static struct gaTbl_data {
5274 +
5275 + char UID [ GA_UID_LEN + 1 ];
5276 + char ifName [ IFNAME_LEN + 1 ];
5277 +
5278 + long ifIndex; // ifindex of card
5279 + long groupAddressesIndex;
5280 +
5281 + char address [ MACADDR_LEN + 1 ];
5282 + long groupAddressesStatus;
5283 +
5284 + long haveAddress;
5285 + long haveGroupAddressesStatus;
5286 +
5287 +} nGa, *ga = &nGa;
5288 +
5289 +static avList_t gaList;
5290 +
5291 +/****************************************************************************
5292 +* dot11Res Group *
5293 +****************************************************************************/
5294 +static char resourceTypeIDName[] = "RTID";
5295 +static long haveResourceTypeIDName = 1;
5296 +
5297 +/****************************************************************************
5298 +* dot11ResourceInfoTable *
5299 +****************************************************************************/
5300 +static struct riTbl_data {
5301 +
5302 + char UID [ RI_UID_LEN + 1 ]; // unique ID
5303 + char ifName [ IFNAME_LEN + 1 ]; // ifName of card
5304 +
5305 + long ifIndex; // ifindex of card
5306 +
5307 + char manufacturerOUI [ MAN_OUI_LEN + 1 ];
5308 + char manufacturerName [ SYS_STRING_LEN + 1 ];
5309 + char manufacturerProductName [ SYS_STRING_LEN + 1 ];
5310 + char manufacturerProductVersion [ SYS_STRING_LEN + 1 ];
5311 +
5312 + char haveManufacturerOUI;
5313 + char haveManufacturerName;
5314 + char haveManufacturerProductName;
5315 + char haveManufacturerProductVersion;
5316 +
5317 +} nRi, *ri = &nRi;
5318 +
5319 +static avList_t riList;
5320 +
5321 +/****************************************************************************
5322 +* dot11Phy Group *
5323 +****************************************************************************/
5324 +/****************************************************************************
5325 +* dot11PhyOperationTable *
5326 +****************************************************************************/
5327 +static struct poTbl_data {
5328 +
5329 + char UID [ PO_UID_LEN + 1 ]; // unique ID
5330 + char ifName [ IFNAME_LEN + 1 ]; // ifName of card
5331 +
5332 + long ifIndex; // ifindex of card
5333 +
5334 + long PHYType;
5335 + long currentRegDomain;
5336 + long tempType;
5337 +
5338 + long havePHYType;
5339 + long haveCurrentRegDomain;
5340 + long haveTempType;
5341 +
5342 +} nPo, *po = &nPo;
5343 +
5344 +static avList_t poList;
5345 +
5346 +/****************************************************************************
5347 +* dot11PhyAntennaEntry *
5348 +****************************************************************************/
5349 +static struct paTbl_data {
5350 +
5351 + char UID [ PA_UID_LEN + 1 ]; // unique ID
5352 + char ifName [ IFNAME_LEN + 1 ]; // ifName of card
5353 +
5354 + long ifIndex; // ifindex of card
5355 +
5356 + long currentTxAntenna;
5357 + long diversitySupport;
5358 + long currentRxAntenna;
5359 +
5360 + long haveCurrentTxAntenna;
5361 + long haveDiversitySupport;
5362 + long haveCurrentRxAntenna;
5363 +
5364 +} nPa, *pa = &nPa;
5365 +
5366 +static avList_t paList;
5367 +
5368 +/****************************************************************************
5369 +* dot11PhyTxPowerTable *
5370 +****************************************************************************/
5371 +static struct ptTbl_data {
5372 +
5373 + char UID [ PT_UID_LEN + 1 ]; // unique ID
5374 + char ifName [ IFNAME_LEN + 1 ]; // ifName of card
5375 +
5376 + long ifIndex; // ifindex of card
5377 +
5378 + long numberSupportedPowerLevels;
5379 + long TxPowerLevel1;
5380 + long TxPowerLevel2;
5381 + long TxPowerLevel3;
5382 + long TxPowerLevel4;
5383 + long TxPowerLevel5;
5384 + long TxPowerLevel6;
5385 + long TxPowerLevel7;
5386 + long TxPowerLevel8;
5387 + long currentTxPowerLevel;
5388 +
5389 + long haveNumberSupportedPowerLevels;
5390 + long haveTxPowerLevel1;
5391 + long haveTxPowerLevel2;
5392 + long haveTxPowerLevel3;
5393 + long haveTxPowerLevel4;
5394 + long haveTxPowerLevel5;
5395 + long haveTxPowerLevel6;
5396 + long haveTxPowerLevel7;
5397 + long haveTxPowerLevel8;
5398 + long haveCurrentTxPowerLevel ;
5399 +
5400 +} nPt, *pt = &nPt;
5401 +
5402 +static avList_t ptList;
5403 +
5404 +/****************************************************************************
5405 +* dot11PhyFHSSTable *
5406 +****************************************************************************/
5407 +static struct pfTbl_data {
5408 +
5409 + char UID [ PF_UID_LEN + 1 ]; // unique ID
5410 + char ifName [ IFNAME_LEN + 1 ]; // ifName of card
5411 +
5412 + long ifIndex; // ifindex of card
5413 +
5414 + long hopTime;
5415 + long currentChannelNumber;
5416 + long maxDwellTime;
5417 + long currentDwellTime;
5418 + long currentSet;
5419 + long currentPattern;
5420 + long currentIndex;
5421 +
5422 + long haveHopTime;
5423 + long haveCurrentChannelNumber;
5424 + long haveMaxDwellTime;
5425 + long haveCurrentDwellTime;
5426 + long haveCurrentSet;
5427 + long haveCurrentPattern;
5428 + long haveCurrentIndex;
5429 +
5430 +} nPf, *pf = &nPf;
5431 +
5432 +static avList_t pfList;
5433 +
5434 +/****************************************************************************
5435 +* dot11PhyDSSSTable *
5436 +****************************************************************************/
5437 +static struct pdTbl_data {
5438 +
5439 + char UID [ PD_UID_LEN + 1 ]; // unique ID
5440 + char ifName [ IFNAME_LEN + 1 ]; // ifName of card
5441 +
5442 + long ifIndex; // ifindex of card
5443 +
5444 + long currentChannel;
5445 + long CCAModeSupported;
5446 + long currentCCAMode;
5447 + long EDThreshold;
5448 +
5449 + long haveCurrentChannel;
5450 + long haveCCAModeSupported ;
5451 + long haveCurrentCCAMode;
5452 + long haveEDThreshold;
5453 +
5454 +} nPd, *pd = &nPd;
5455 +
5456 +static avList_t pdList;
5457 +
5458 +/****************************************************************************
5459 +* dot11PhyIRTable *
5460 +****************************************************************************/
5461 +static struct piTbl_data {
5462 +
5463 + char UID [ PI_UID_LEN + 1 ]; // unique ID
5464 + char ifName [ IFNAME_LEN + 1 ]; // ifName of card
5465 +
5466 + long ifIndex; // ifindex of card
5467 +
5468 + long CCAWatchdogTimerMax;
5469 + long CCAWatchdogCountMax;
5470 + long CCAWatchdogTimerMin;
5471 + long CCAWatchdogCountMin;
5472 +
5473 + long haveCCAWatchdogTimerMax;
5474 + long haveCCAWatchdogCountMax;
5475 + long haveCCAWatchdogTimerMin;
5476 + long haveCCAWatchdogCountMin;
5477 +
5478 +} nPi, *pi = &nPi;
5479 +
5480 +static avList_t piList;
5481 +
5482 +/****************************************************************************
5483 +* dot11RegDomainsSupportedTable *
5484 +****************************************************************************/
5485 +static struct rdTbl_data {
5486 +
5487 + char UID [ RD_UID_LEN + 1 ];
5488 + char ifName [ IFNAME_LEN + 1 ];
5489 +
5490 + long ifIndex; // ifindex of card
5491 + long regDomainsSupportIndex;
5492 +
5493 + long regDomainsSupportValue;
5494 + long haveRegDomainsSupportValue;
5495 +
5496 +} nRd, *rd = &nRd;
5497 +
5498 +static avList_t rdList;
5499 +
5500 +/****************************************************************************
5501 +* dot11AntennasListTable *
5502 +****************************************************************************/
5503 +static struct alTbl_data {
5504 +
5505 + char UID [ AL_UID_LEN + 1 ];
5506 + char ifName [ IFNAME_LEN + 1 ];
5507 +
5508 + long ifIndex; // ifindex of card
5509 + long antennaListIndex;
5510 +
5511 + long supportedTxAntenna;
5512 + long supportedRxAntenna;
5513 + long diversitySelectionRx ;
5514 +
5515 + long haveSupportedTxAntenna;
5516 + long haveSupportedRxAntenna;
5517 + long haveDiversitySelectionRx ;
5518 +
5519 +} nAl, *al = &nAl;
5520 +
5521 +static avList_t alList;
5522 +
5523 +/****************************************************************************
5524 +* dot11SupportedDataRatesTxTable *
5525 +****************************************************************************/
5526 +static struct rtTbl_data {
5527 +
5528 + char UID [ RT_UID_LEN + 1 ];
5529 + char ifName [ IFNAME_LEN + 1 ];
5530 +
5531 + long ifIndex; // ifindex of card
5532 + long supportedDataRatesTxIndex;
5533 +
5534 + long supportedDataRatesTxValue;
5535 + long haveSupportedDataRatesTxValue;
5536 +
5537 +} nRt, *rt = &nRt;
5538 +
5539 +static avList_t rtList;
5540 +
5541 +/****************************************************************************
5542 +* dot11SupportedDataRatesRxTable *
5543 +****************************************************************************/
5544 +static struct rrTbl_data {
5545 +
5546 + char UID [ RR_UID_LEN + 1 ];
5547 + char ifName [ IFNAME_LEN + 1 ];
5548 +
5549 + long ifIndex; // ifindex of card
5550 + long supportedDataRatesRxIndex;
5551 +
5552 + long supportedDataRatesRxValue;
5553 + long haveSupportedDataRatesRxValue;
5554 +
5555 +} nRr, *rr = &nRr;
5556 +
5557 +static avList_t rrList;
5558 +
5559 +/****************************************************************************
5560 +* Wireless Extensions Structures *
5561 +****************************************************************************/
5562 +static long wepCurrentKey;
5563 +static long haveWepCurrentKey;
5564 +static struct wepTbl_data {
5565 +
5566 + long len;
5567 + char key [ WEP_STR_LEN + 1 ];
5568 + long haveKey;
5569 +
5570 +} wep[4];
5571 +
5572 +/****************************************************************************
5573 +* *
5574 +****************************************************************************/
5575 +config_require(util_funcs)
5576 +
5577 +/* function prototypes */
5578 +
5579 +void init_ieee802dot11 ( void );
5580 +FindVarMethod var_ieee802dot11;
5581 +FindVarMethod var_dot11StationConfigTable;
5582 +FindVarMethod var_dot11AuthenticationAlgorithmsTable;
5583 +FindVarMethod var_dot11WEPDefaultKeysTable;
5584 +FindVarMethod var_dot11WEPKeyMappingsTable;
5585 +FindVarMethod var_dot11PrivacyTable;
5586 +FindVarMethod var_dot11OperationTable;
5587 +FindVarMethod var_dot11CountersTable;
5588 +FindVarMethod var_dot11GroupAddressesTable;
5589 +FindVarMethod var_dot11ResourceInfoTable;
5590 +FindVarMethod var_dot11PhyOperationTable;
5591 +FindVarMethod var_dot11PhyAntennaTable;
5592 +FindVarMethod var_dot11PhyTxPowerTable;
5593 +FindVarMethod var_dot11PhyFHSSTable;
5594 +FindVarMethod var_dot11PhyDSSSTable;
5595 +FindVarMethod var_dot11PhyIRTable;
5596 +FindVarMethod var_dot11RegDomainsSupportedTable;
5597 +FindVarMethod var_dot11AntennasListTable;
5598 +FindVarMethod var_dot11SupportedDataRatesTxTable;
5599 +FindVarMethod var_dot11SupportedDataRatesRxTable;
5600 +
5601 +WriteMethod write_dot11StationID;
5602 +WriteMethod write_dot11MediumOccupancyLimit;
5603 +WriteMethod write_dot11CFPPeriod;
5604 +WriteMethod write_dot11CFPMaxDuration;
5605 +WriteMethod write_dot11AuthenticationResponseTimeOut;
5606 +WriteMethod write_dot11PowerManagementMode;
5607 +WriteMethod write_dot11DesiredSSID;
5608 +WriteMethod write_dot11DesiredBSSType;
5609 +WriteMethod write_dot11OperationalRateSet;
5610 +WriteMethod write_dot11BeaconPeriod;
5611 +WriteMethod write_dot11DTIMPeriod;
5612 +WriteMethod write_dot11AssociationResponseTimeOut;
5613 +WriteMethod write_dot11AuthenticationAlgorithmsEnable;
5614 +WriteMethod write_dot11WEPDefaultKeyValue;
5615 +WriteMethod write_dot11WEPKeyMappingAddress;
5616 +WriteMethod write_dot11WEPKeyMappingWEPOn;
5617 +WriteMethod write_dot11WEPKeyMappingValue;
5618 +WriteMethod write_dot11WEPKeyMappingStatus;
5619 +WriteMethod write_dot11PrivacyInvoked;
5620 +WriteMethod write_dot11WEPDefaultKeyID;
5621 +WriteMethod write_dot11WEPKeyMappingLength;
5622 +WriteMethod write_dot11ExcludeUnencrypted;
5623 +WriteMethod write_dot11RTSThreshold;
5624 +WriteMethod write_dot11ShortRetryLimit;
5625 +WriteMethod write_dot11LongRetryLimit;
5626 +WriteMethod write_dot11FragmentationThreshold;
5627 +WriteMethod write_dot11MaxTransmitMSDULifetime;
5628 +WriteMethod write_dot11MaxReceiveLifetime;
5629 +WriteMethod write_dot11Address;
5630 +WriteMethod write_dot11GroupAddressesStatus;
5631 +WriteMethod write_dot11CurrentRegDomain;
5632 +WriteMethod write_dot11CurrentTxAntenna;
5633 +WriteMethod write_dot11CurrentRxAntenna;
5634 +WriteMethod write_dot11CurrentTxPowerLevel;
5635 +WriteMethod write_dot11CurrentChannelNumber;
5636 +WriteMethod write_dot11CurrentDwellTime;
5637 +WriteMethod write_dot11CurrentSet;
5638 +WriteMethod write_dot11CurrentPattern;
5639 +WriteMethod write_dot11CurrentIndex;
5640 +WriteMethod write_dot11CurrentChannel;
5641 +WriteMethod write_dot11CurrentCCAMode;
5642 +WriteMethod write_dot11EDThreshold;
5643 +WriteMethod write_dot11CCAWatchdogTimerMax;
5644 +WriteMethod write_dot11CCAWatchdogCountMax;
5645 +WriteMethod write_dot11CCAWatchdogTimerMin;
5646 +WriteMethod write_dot11CCAWatchdogCountMin;
5647 +WriteMethod write_dot11SupportedTxAntenna;
5648 +WriteMethod write_dot11SupportedRxAntenna;
5649 +WriteMethod write_dot11DiversitySelectionRx;
5650 +
5651 +#endif /* _MIBGROUP_IEEE802DOT11_H */
5652 --- net-snmp-5.1.2-orig/agent/mibgroup/iwlib.h 1970-01-01 01:00:00.000000000 +0100
5653 +++ net-snmp-5.1.2-5/agent/mibgroup/iwlib.h 2005-03-13 16:17:21.000000000 +0100
5654 @@ -0,0 +1,502 @@
5655 +/*
5656 + * Wireless Tools
5657 + *
5658 + * Jean II - HPLB 97->99 - HPL 99->02
5659 + *
5660 + * Common header for the Wireless Extension library...
5661 + *
5662 + * This file is released under the GPL license.
5663 + * Copyright (c) 1997-2002 Jean Tourrilhes <jt@hpl.hp.com>
5664 + */
5665 +
5666 +#ifndef IWLIB_H
5667 +#define IWLIB_H
5668 +
5669 +/*#include "CHANGELOG.h"*/
5670 +
5671 +/***************************** INCLUDES *****************************/
5672 +
5673 +/* Standard headers */
5674 +#include <sys/types.h>
5675 +#include <sys/ioctl.h>
5676 +#include <stdio.h>
5677 +#include <math.h>
5678 +#include <errno.h>
5679 +#include <fcntl.h>
5680 +#include <ctype.h>
5681 +#include <stdlib.h>
5682 +#include <string.h>
5683 +#include <unistd.h>
5684 +#include <netdb.h> /* gethostbyname, getnetbyname */
5685 +#include <net/ethernet.h> /* struct ether_addr */
5686 +#include <sys/time.h> /* struct timeval */
5687 +#include <unistd.h>
5688 +
5689 +/* This is our header selection. Try to hide the mess and the misery :-(
5690 + * Don't look, you would go blind ;-) */
5691 +
5692 +#ifndef LINUX_VERSION_CODE
5693 +#include <linux/version.h>
5694 +#endif
5695 +
5696 +/* Kernel headers 2.4.X + Glibc 2.2 - Mandrake 8.0, Debian 2.3, RH 7.1
5697 + * Kernel headers 2.2.X + Glibc 2.2 - Slackware 8.0 */
5698 +#if defined(__GLIBC__) \
5699 + && __GLIBC__ == 2 \
5700 + && __GLIBC_MINOR__ >= 2 \
5701 + && LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
5702 +//#define GLIBC22_HEADERS
5703 +#define GENERIC_HEADERS
5704 +
5705 +/* Kernel headers 2.4.X + Glibc 2.1 - Debian 2.2 upgraded, RH 7.0
5706 + * Kernel headers 2.2.X + Glibc 2.1 - Debian 2.2, RH 6.1 */
5707 +#elif defined(__GLIBC__) \
5708 + && __GLIBC__ == 2 \
5709 + && __GLIBC_MINOR__ == 1 \
5710 + && LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
5711 +//#define GLIBC_HEADERS
5712 +#define GENERIC_HEADERS
5713 +
5714 +/* Kernel headers 2.2.X + Glibc 2.0 - Debian 2.1 */
5715 +#elif defined(__GLIBC__) \
5716 + && __GLIBC__ == 2 \
5717 + && __GLIBC_MINOR__ == 0 \
5718 + && LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0) \
5719 + && LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0)
5720 +#define GLIBC_HEADERS
5721 +#define KLUDGE_HEADERS
5722 +
5723 +/* Note : is it really worth supporting kernel 2.0.X, knowing that
5724 + * we require WE v9, which is only available in 2.2.X and higher ?
5725 + * I guess one could use 2.0.x with an upgraded wireless.h... */
5726 +
5727 +/* Kernel headers 2.0.X + Glibc 2.0 - Debian 2.0, RH 5 */
5728 +#elif defined(__GLIBC__) \
5729 + && __GLIBC__ == 2 \
5730 + && __GLIBC_MINOR__ == 0 \
5731 + && LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0) \
5732 + && LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0)
5733 +#define GLIBC_HEADERS
5734 +
5735 +/* Kernel headers 2.0.X + libc5 - old systems */
5736 +#elif defined(_LINUX_C_LIB_VERSION_MAJOR) \
5737 + && _LINUX_C_LIB_VERSION_MAJOR == 5 \
5738 + && LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0) \
5739 + && LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0)
5740 +#define LIBC5_HEADERS
5741 +
5742 +/* Unsupported combination */
5743 +#else
5744 +#error "Your kernel/libc combination is not supported"
5745 +#endif
5746 +
5747 +#ifdef GENERIC_HEADERS
5748 +/* Proposed by Dr. Michael Rietz <rietz@mail.amps.de>, 27.3.2 */
5749 +/* If this works for all, it might be more stable on the long term - Jean II */
5750 +#include <net/if_arp.h> /* For ARPHRD_ETHER */
5751 +#include <sys/socket.h> /* For AF_INET & struct sockaddr */
5752 +#include <netinet/in.h> /* For struct sockaddr_in */
5753 +#include <netinet/if_ether.h>
5754 +#endif /* GENERIC_HEADERS */
5755 +
5756 +#ifdef GLIBC22_HEADERS
5757 +/* Added by Ross G. Miller <Ross_Miller@baylor.edu>, 3/28/01 */
5758 +#include <linux/if_arp.h> /* For ARPHRD_ETHER */
5759 +#include <linux/socket.h> /* For AF_INET & struct sockaddr */
5760 +#include <sys/socket.h>
5761 +#endif /* GLIBC22_HEADERS */
5762 +
5763 +#ifdef KLUDGE_HEADERS
5764 +#include <socketbits.h>
5765 +#endif /* KLUDGE_HEADERS */
5766 +
5767 +#ifdef GLIBC_HEADERS
5768 +#include <linux/if_arp.h> /* For ARPHRD_ETHER */
5769 +#include <linux/socket.h> /* For AF_INET & struct sockaddr */
5770 +#include <linux/in.h> /* For struct sockaddr_in */
5771 +#endif /* KLUDGE_HEADERS || GLIBC_HEADERS */
5772 +
5773 +#ifdef LIBC5_HEADERS
5774 +#include <sys/socket.h> /* For AF_INET & struct sockaddr & socket() */
5775 +#include <linux/if_arp.h> /* For ARPHRD_ETHER */
5776 +#include <linux/in.h> /* For struct sockaddr_in */
5777 +#endif /* LIBC5_HEADERS */
5778 +
5779 +/* Those 3 headers were previously included in wireless.h */
5780 +#include <linux/types.h> /* for "caddr_t" et al */
5781 +#include <linux/socket.h> /* for "struct sockaddr" et al */
5782 +#include <linux/if.h> /* for IFNAMSIZ and co... */
5783 +
5784 +#ifdef WEXT_HEADER
5785 +/* Private copy of Wireless extensions */
5786 +#include WEXT_HEADER
5787 +#else /* !WEXT_HEADER */
5788 +/* System wide Wireless extensions */
5789 +#include <linux/wireless.h>
5790 +#endif /* !WEXT_HEADER */
5791 +
5792 +#ifdef __cplusplus
5793 +extern "C" {
5794 +#endif
5795 +
5796 +/****************************** DEBUG ******************************/
5797 +
5798 +
5799 +/************************ CONSTANTS & MACROS ************************/
5800 +
5801 +/* Paths */
5802 +#define PROC_NET_WIRELESS "/proc/net/wireless"
5803 +#define PROC_NET_DEV "/proc/net/dev"
5804 +
5805 +/* Some usefull constants */
5806 +#define KILO 1e3
5807 +#define MEGA 1e6
5808 +#define GIGA 1e9
5809 +/* For doing log10/exp10 without libm */
5810 +#define LOG10_MAGIC 1.25892541179
5811 +
5812 +/* Backward compatibility for Wireless Extension 9 */
5813 +#ifndef IW_POWER_MODIFIER
5814 +#define IW_POWER_MODIFIER 0x000F /* Modify a parameter */
5815 +#define IW_POWER_MIN 0x0001 /* Value is a minimum */
5816 +#define IW_POWER_MAX 0x0002 /* Value is a maximum */
5817 +#define IW_POWER_RELATIVE 0x0004 /* Value is not in seconds/ms/us */
5818 +#endif /* IW_POWER_MODIFIER */
5819 +
5820 +#ifndef IW_ENCODE_NOKEY
5821 +#define IW_ENCODE_NOKEY 0x0800 /* Key is write only, so not here */
5822 +#define IW_ENCODE_MODE 0xF000 /* Modes defined below */
5823 +#endif /* IW_ENCODE_NOKEY */
5824 +#ifndef IW_ENCODE_TEMP
5825 +#define IW_ENCODE_TEMP 0x0400 /* Temporary key */
5826 +#endif /* IW_ENCODE_TEMP */
5827 +
5828 +/* More backward compatibility */
5829 +#ifndef SIOCSIWCOMMIT
5830 +#define SIOCSIWCOMMIT SIOCSIWNAME
5831 +#endif /* SIOCSIWCOMMIT */
5832 +
5833 +/****************************** TYPES ******************************/
5834 +
5835 +/* Shortcuts */
5836 +typedef struct iw_statistics iwstats;
5837 +typedef struct iw_range iwrange;
5838 +typedef struct iw_param iwparam;
5839 +typedef struct iw_freq iwfreq;
5840 +typedef struct iw_quality iwqual;
5841 +typedef struct iw_priv_args iwprivargs;
5842 +typedef struct sockaddr sockaddr;
5843 +
5844 +/* Structure for storing all wireless information for each device
5845 + * This is pretty exhaustive... */
5846 +typedef struct wireless_info
5847 +{
5848 + char name[IFNAMSIZ + 1]; /* Wireless/protocol name */
5849 + int has_nwid;
5850 + iwparam nwid; /* Network ID */
5851 + int has_freq;
5852 + double freq; /* Frequency/channel */
5853 + int has_sens;
5854 + iwparam sens; /* sensitivity */
5855 + int has_key;
5856 + unsigned char key[IW_ENCODING_TOKEN_MAX]; /* Encoding key used */
5857 + int key_size; /* Number of bytes */
5858 + int key_flags; /* Various flags */
5859 + int has_essid;
5860 + int essid_on;
5861 + char essid[IW_ESSID_MAX_SIZE + 1]; /* ESSID (extended network) */
5862 + int has_nickname;
5863 + char nickname[IW_ESSID_MAX_SIZE + 1]; /* NickName */
5864 + int has_ap_addr;
5865 + sockaddr ap_addr; /* Access point address */
5866 + int has_bitrate;
5867 + iwparam bitrate; /* Bit rate in bps */
5868 + int has_rts;
5869 + iwparam rts; /* RTS threshold in bytes */
5870 + int has_frag;
5871 + iwparam frag; /* Fragmentation threshold in bytes */
5872 + int has_mode;
5873 + int mode; /* Operation mode */
5874 + int has_power;
5875 + iwparam power; /* Power management parameters */
5876 + int has_txpower;
5877 + iwparam txpower; /* Transmit Power in dBm */
5878 + int has_retry;
5879 + iwparam retry; /* Retry limit or lifetime */
5880 +
5881 + /* Stats */
5882 + iwstats stats;
5883 + int has_stats;
5884 + iwrange range;
5885 + int has_range;
5886 +} wireless_info;
5887 +
5888 +/* Structure for storing all wireless information for each device
5889 + * This is a cut down version of the one above, containing only
5890 + * the things *truly* needed to configure a card.
5891 + * Don't add other junk, I'll remove it... */
5892 +typedef struct wireless_config
5893 +{
5894 + char name[IFNAMSIZ + 1]; /* Wireless/protocol name */
5895 + int has_nwid;
5896 + iwparam nwid; /* Network ID */
5897 + int has_freq;
5898 + double freq; /* Frequency/channel */
5899 + int has_key;
5900 + unsigned char key[IW_ENCODING_TOKEN_MAX]; /* Encoding key used */
5901 + int key_size; /* Number of bytes */
5902 + int key_flags; /* Various flags */
5903 + int has_essid;
5904 + int essid_on;
5905 + char essid[IW_ESSID_MAX_SIZE + 1]; /* ESSID (extended network) */
5906 + int has_mode;
5907 + int mode; /* Operation mode */
5908 +} wireless_config;
5909 +
5910 +typedef struct stream_descr
5911 +{
5912 + char * end; /* End of the stream */
5913 + char * current; /* Current event in stream of events */
5914 + char * value; /* Current value in event */
5915 +} stream_descr;
5916 +
5917 +/* Prototype for handling display of each single interface on the
5918 + * system - see iw_enum_devices() */
5919 +typedef int (*iw_enum_handler)(int skfd,
5920 + char * ifname,
5921 + char * args[],
5922 + int count);
5923 +
5924 +/**************************** PROTOTYPES ****************************/
5925 +/*
5926 + * All the functions in iwcommon.c
5927 + */
5928 +
5929 +/* ---------------------- SOCKET SUBROUTINES -----------------------*/
5930 +int
5931 + iw_sockets_open(void);
5932 +void
5933 + iw_enum_devices(int skfd,
5934 + iw_enum_handler fn,
5935 + char * args[],
5936 + int count);
5937 +/* --------------------- WIRELESS SUBROUTINES ----------------------*/
5938 +int
5939 + iw_get_range_info(int skfd,
5940 + char * ifname,
5941 + iwrange * range);
5942 +int
5943 + iw_print_version_info(char * toolname);
5944 +int
5945 + iw_get_priv_info(int skfd,
5946 + char * ifname,
5947 + iwprivargs * priv,
5948 + int maxpriv);
5949 +int
5950 + iw_get_basic_config(int skfd,
5951 + char * ifname,
5952 + wireless_config * info);
5953 +int
5954 + iw_set_basic_config(int skfd,
5955 + char * ifname,
5956 + wireless_config * info);
5957 +/* --------------------- PROTOCOL SUBROUTINES --------------------- */
5958 +int
5959 + iw_protocol_compare(char * protocol1,
5960 + char * protocol2);
5961 +/* -------------------- FREQUENCY SUBROUTINES --------------------- */
5962 +void
5963 + iw_float2freq(double in,
5964 + iwfreq * out);
5965 +double
5966 + iw_freq2float(iwfreq * in);
5967 +void
5968 + iw_print_freq(char * buffer,
5969 + double freq);
5970 +int
5971 + iw_freq_to_channel(double freq,
5972 + struct iw_range * range);
5973 +void
5974 + iw_print_bitrate(char * buffer,
5975 + int bitrate);
5976 +/* ---------------------- POWER SUBROUTINES ----------------------- */
5977 +int
5978 + iw_dbm2mwatt(int in);
5979 +int
5980 + iw_mwatt2dbm(int in);
5981 +/* -------------------- STATISTICS SUBROUTINES -------------------- */
5982 +int
5983 + iw_get_stats(int skfd,
5984 + char * ifname,
5985 + iwstats * stats);
5986 +void
5987 + iw_print_stats(char * buffer,
5988 + iwqual * qual,
5989 + iwrange * range,
5990 + int has_range);
5991 +/* --------------------- ENCODING SUBROUTINES --------------------- */
5992 +void
5993 + iw_print_key(char * buffer,
5994 + unsigned char * key,
5995 + int key_size,
5996 + int key_flags);
5997 +int
5998 + iw_in_key(char * input,
5999 + unsigned char * key);
6000 +int
6001 + iw_in_key_full(int skfd,
6002 + char * ifname,
6003 + char * input,
6004 + unsigned char * key,
6005 + __u16 * flags);
6006 +/* ----------------- POWER MANAGEMENT SUBROUTINES ----------------- */
6007 +void
6008 + iw_print_pm_value(char * buffer,
6009 + int value,
6010 + int flags);
6011 +void
6012 + iw_print_pm_mode(char * buffer,
6013 + int flags);
6014 +/* --------------- RETRY LIMIT/LIFETIME SUBROUTINES --------------- */
6015 +#if WIRELESS_EXT > 10
6016 +void
6017 + iw_print_retry_value(char * buffer,
6018 + int value,
6019 + int flags);
6020 +#endif
6021 +/* ----------------------- TIME SUBROUTINES ----------------------- */
6022 +void
6023 + iw_print_timeval(char * buffer,
6024 + const struct timeval * time);
6025 +/* --------------------- ADDRESS SUBROUTINES ---------------------- */
6026 +int
6027 + iw_check_mac_addr_type(int skfd,
6028 + char * ifname);
6029 +int
6030 + iw_check_if_addr_type(int skfd,
6031 + char * ifname);
6032 +#if 0
6033 +int
6034 + iw_check_addr_type(int skfd,
6035 + char * ifname);
6036 +#endif
6037 +void
6038 + iw_ether_ntop(const struct ether_addr* eth, char* buf);
6039 +char*
6040 + iw_ether_ntoa(const struct ether_addr* eth);
6041 +int
6042 + iw_ether_aton(const char* bufp, struct ether_addr* eth);
6043 +int
6044 + iw_in_inet(char *bufp, struct sockaddr *sap);
6045 +int
6046 + iw_in_addr(int skfd,
6047 + char * ifname,
6048 + char * bufp,
6049 + struct sockaddr * sap);
6050 +/* ----------------------- MISC SUBROUTINES ------------------------ */
6051 +int
6052 + iw_get_priv_size(int args);
6053 +
6054 +#if WIRELESS_EXT > 13
6055 +/* ---------------------- EVENT SUBROUTINES ---------------------- */
6056 +void
6057 + iw_init_event_stream(struct stream_descr * stream,
6058 + char * data,
6059 + int len);
6060 +int
6061 + iw_extract_event_stream(struct stream_descr * stream,
6062 + struct iw_event * iwe);
6063 +#endif /* WIRELESS_EXT > 13 */
6064 +
6065 +/**************************** VARIABLES ****************************/
6066 +
6067 +extern const char * const iw_operation_mode[];
6068 +#define IW_NUM_OPER_MODE 7
6069 +
6070 +/************************* INLINE FUNTIONS *************************/
6071 +/*
6072 + * Functions that are so simple that it's more efficient inlining them
6073 + */
6074 +
6075 +/*
6076 + * Note : I've defined wrapper for the ioctl request so that
6077 + * it will be easier to migrate to other kernel API if needed
6078 + */
6079 +
6080 +/*------------------------------------------------------------------*/
6081 +/*
6082 + * Wrapper to push some Wireless Parameter in the driver
6083 + */
6084 +static inline int
6085 +iw_set_ext(int skfd, /* Socket to the kernel */
6086 + char * ifname, /* Device name */
6087 + int request, /* WE ID */
6088 + struct iwreq * pwrq) /* Fixed part of the request */
6089 +{
6090 + /* Set device name */
6091 + strncpy(pwrq->ifr_name, ifname, IFNAMSIZ);
6092 + /* Do the request */
6093 + return(ioctl(skfd, request, pwrq));
6094 +}
6095 +
6096 +/*------------------------------------------------------------------*/
6097 +/*
6098 + * Wrapper to extract some Wireless Parameter out of the driver
6099 + */
6100 +static inline int
6101 +iw_get_ext(int skfd, /* Socket to the kernel */
6102 + char * ifname, /* Device name */
6103 + int request, /* WE ID */
6104 + struct iwreq * pwrq) /* Fixed part of the request */
6105 +{
6106 + /* Set device name */
6107 + strncpy(pwrq->ifr_name, ifname, IFNAMSIZ);
6108 + /* Do the request */
6109 + return(ioctl(skfd, request, pwrq));
6110 +}
6111 +
6112 +/*------------------------------------------------------------------*/
6113 +/* Backwards compatability
6114 + * Actually, those form are much easier to use when dealing with
6115 + * struct sockaddr... */
6116 +static inline char*
6117 +iw_pr_ether(char* bufp, const unsigned char* addr)
6118 +{
6119 + iw_ether_ntop((const struct ether_addr *) addr, bufp);
6120 + return bufp;
6121 +}
6122 +/* Backwards compatability */
6123 +static inline int
6124 +iw_in_ether(const char *bufp, struct sockaddr *sap)
6125 +{
6126 + sap->sa_family = ARPHRD_ETHER;
6127 + return iw_ether_aton(bufp, (struct ether_addr *) sap->sa_data) ? 0 : -1;
6128 +}
6129 +
6130 +/*------------------------------------------------------------------*/
6131 +/*
6132 + * Create an Ethernet broadcast address
6133 + */
6134 +static inline void
6135 +iw_broad_ether(struct sockaddr *sap)
6136 +{
6137 + sap->sa_family = ARPHRD_ETHER;
6138 + memset((char *) sap->sa_data, 0xFF, ETH_ALEN);
6139 +}
6140 +
6141 +/*------------------------------------------------------------------*/
6142 +/*
6143 + * Create an Ethernet NULL address
6144 + */
6145 +static inline void
6146 +iw_null_ether(struct sockaddr *sap)
6147 +{
6148 + sap->sa_family = ARPHRD_ETHER;
6149 + memset((char *) sap->sa_data, 0x00, ETH_ALEN);
6150 +}
6151 +
6152 +#ifdef __cplusplus
6153 +}
6154 +#endif
6155 +
6156 +#endif /* IWLIB_H */
This page took 0.284956 seconds and 5 git commands to generate.