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