1 /* 2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. 3 * All rights reserved. 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License along 16 * with this program; if not, write to the Free Software Foundation, Inc., 17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * File: mib.h 20 * 21 * Purpose: Implement MIB Data Structure 22 * 23 * Author: Tevin Chen 24 * 25 * Date: May 21, 1996 26 * 27 */ 28 29 #ifndef __MIB_H__ 30 #define __MIB_H__ 31 32 #include "ttype.h" 33 #include "tether.h" 34 #include "desc.h" 35 36 // 37 // 802.11 counter 38 // 39 40 typedef struct tagSDot11Counters { 41 unsigned long Length; 42 unsigned long long TransmittedFragmentCount; 43 unsigned long long MulticastTransmittedFrameCount; 44 unsigned long long FailedCount; 45 unsigned long long RetryCount; 46 unsigned long long MultipleRetryCount; 47 unsigned long long RTSSuccessCount; 48 unsigned long long RTSFailureCount; 49 unsigned long long ACKFailureCount; 50 unsigned long long FrameDuplicateCount; 51 unsigned long long ReceivedFragmentCount; 52 unsigned long long MulticastReceivedFrameCount; 53 unsigned long long FCSErrorCount; 54 unsigned long long TKIPLocalMICFailures; 55 unsigned long long TKIPRemoteMICFailures; 56 unsigned long long TKIPICVErrors; 57 unsigned long long TKIPCounterMeasuresInvoked; 58 unsigned long long TKIPReplays; 59 unsigned long long CCMPFormatErrors; 60 unsigned long long CCMPReplays; 61 unsigned long long CCMPDecryptErrors; 62 unsigned long long FourWayHandshakeFailures; 63 } SDot11Counters, *PSDot11Counters; 64 65 // 66 // MIB2 counter 67 // 68 typedef struct tagSMib2Counter { 69 long ifIndex; 70 char ifDescr[256]; 71 long ifType; 72 long ifMtu; 73 unsigned long ifSpeed; 74 unsigned char ifPhysAddress[ETH_ALEN]; 75 long ifAdminStatus; 76 long ifOperStatus; 77 unsigned long ifLastChange; 78 unsigned long ifInOctets; 79 unsigned long ifInUcastPkts; 80 unsigned long ifInNUcastPkts; 81 unsigned long ifInDiscards; 82 unsigned long ifInErrors; 83 unsigned long ifInUnknownProtos; 84 unsigned long ifOutOctets; 85 unsigned long ifOutUcastPkts; 86 unsigned long ifOutNUcastPkts; 87 unsigned long ifOutDiscards; 88 unsigned long ifOutErrors; 89 unsigned long ifOutQLen; 90 unsigned long ifSpecific; 91 } SMib2Counter, *PSMib2Counter; 92 93 // Value in the ifType entry 94 #define WIRELESSLANIEEE80211b 6 95 96 // Value in the ifAdminStatus/ifOperStatus entry 97 #define UP 1 98 #define DOWN 2 99 #define TESTING 3 100 101 // 102 // RMON counter 103 // 104 typedef struct tagSRmonCounter { 105 long etherStatsIndex; 106 unsigned long etherStatsDataSource; 107 unsigned long etherStatsDropEvents; 108 unsigned long etherStatsOctets; 109 unsigned long etherStatsPkts; 110 unsigned long etherStatsBroadcastPkts; 111 unsigned long etherStatsMulticastPkts; 112 unsigned long etherStatsCRCAlignErrors; 113 unsigned long etherStatsUndersizePkts; 114 unsigned long etherStatsOversizePkts; 115 unsigned long etherStatsFragments; 116 unsigned long etherStatsJabbers; 117 unsigned long etherStatsCollisions; 118 unsigned long etherStatsPkt64Octets; 119 unsigned long etherStatsPkt65to127Octets; 120 unsigned long etherStatsPkt128to255Octets; 121 unsigned long etherStatsPkt256to511Octets; 122 unsigned long etherStatsPkt512to1023Octets; 123 unsigned long etherStatsPkt1024to1518Octets; 124 unsigned long etherStatsOwners; 125 unsigned long etherStatsStatus; 126 } SRmonCounter, *PSRmonCounter; 127 128 // 129 // Custom counter 130 // 131 typedef struct tagSCustomCounters { 132 unsigned long Length; 133 134 unsigned long long ullTsrAllOK; 135 136 unsigned long long ullRsr11M; 137 unsigned long long ullRsr5M; 138 unsigned long long ullRsr2M; 139 unsigned long long ullRsr1M; 140 141 unsigned long long ullRsr11MCRCOk; 142 unsigned long long ullRsr5MCRCOk; 143 unsigned long long ullRsr2MCRCOk; 144 unsigned long long ullRsr1MCRCOk; 145 146 unsigned long long ullRsr54M; 147 unsigned long long ullRsr48M; 148 unsigned long long ullRsr36M; 149 unsigned long long ullRsr24M; 150 unsigned long long ullRsr18M; 151 unsigned long long ullRsr12M; 152 unsigned long long ullRsr9M; 153 unsigned long long ullRsr6M; 154 155 unsigned long long ullRsr54MCRCOk; 156 unsigned long long ullRsr48MCRCOk; 157 unsigned long long ullRsr36MCRCOk; 158 unsigned long long ullRsr24MCRCOk; 159 unsigned long long ullRsr18MCRCOk; 160 unsigned long long ullRsr12MCRCOk; 161 unsigned long long ullRsr9MCRCOk; 162 unsigned long long ullRsr6MCRCOk; 163 } SCustomCounters, *PSCustomCounters; 164 165 // 166 // Custom counter 167 // 168 typedef struct tagSISRCounters { 169 unsigned long Length; 170 171 unsigned long dwIsrTx0OK; 172 unsigned long dwIsrAC0TxOK; 173 unsigned long dwIsrBeaconTxOK; 174 unsigned long dwIsrRx0OK; 175 unsigned long dwIsrTBTTInt; 176 unsigned long dwIsrSTIMERInt; 177 unsigned long dwIsrWatchDog; 178 unsigned long dwIsrUnrecoverableError; 179 unsigned long dwIsrSoftInterrupt; 180 unsigned long dwIsrMIBNearfull; 181 unsigned long dwIsrRxNoBuf; 182 183 unsigned long dwIsrUnknown; 184 185 unsigned long dwIsrRx1OK; 186 unsigned long dwIsrATIMTxOK; 187 unsigned long dwIsrSYNCTxOK; 188 unsigned long dwIsrCFPEnd; 189 unsigned long dwIsrATIMEnd; 190 unsigned long dwIsrSYNCFlushOK; 191 unsigned long dwIsrSTIMER1Int; 192 } SISRCounters, *PSISRCounters; 193 194 // Value in the etherStatsStatus entry 195 #define VALID 1 196 #define CREATE_REQUEST 2 197 #define UNDER_CREATION 3 198 #define INVALID 4 199 200 // 201 // statistic counter 202 // 203 typedef struct tagSStatCounter { 204 // RSR status count 205 // 206 unsigned long dwRsrFrmAlgnErr; 207 unsigned long dwRsrErr; 208 unsigned long dwRsrCRCErr; 209 unsigned long dwRsrCRCOk; 210 unsigned long dwRsrBSSIDOk; 211 unsigned long dwRsrADDROk; 212 unsigned long dwRsrBCNSSIDOk; 213 unsigned long dwRsrLENErr; 214 unsigned long dwRsrTYPErr; 215 216 unsigned long dwNewRsrDECRYPTOK; 217 unsigned long dwNewRsrCFP; 218 unsigned long dwNewRsrUTSF; 219 unsigned long dwNewRsrHITAID; 220 unsigned long dwNewRsrHITAID0; 221 222 unsigned long dwRsrLong; 223 unsigned long dwRsrRunt; 224 225 unsigned long dwRsrRxControl; 226 unsigned long dwRsrRxData; 227 unsigned long dwRsrRxManage; 228 229 unsigned long dwRsrRxPacket; 230 unsigned long dwRsrRxOctet; 231 unsigned long dwRsrBroadcast; 232 unsigned long dwRsrMulticast; 233 unsigned long dwRsrDirected; 234 // 64-bit OID 235 unsigned long long ullRsrOK; 236 237 // for some optional OIDs (64 bits) and DMI support 238 unsigned long long ullRxBroadcastBytes; 239 unsigned long long ullRxMulticastBytes; 240 unsigned long long ullRxDirectedBytes; 241 unsigned long long ullRxBroadcastFrames; 242 unsigned long long ullRxMulticastFrames; 243 unsigned long long ullRxDirectedFrames; 244 245 unsigned long dwRsrRxFragment; 246 unsigned long dwRsrRxFrmLen64; 247 unsigned long dwRsrRxFrmLen65_127; 248 unsigned long dwRsrRxFrmLen128_255; 249 unsigned long dwRsrRxFrmLen256_511; 250 unsigned long dwRsrRxFrmLen512_1023; 251 unsigned long dwRsrRxFrmLen1024_1518; 252 253 // TSR status count 254 // 255 unsigned long dwTsrTotalRetry[TYPE_MAXTD]; // total collision retry count 256 unsigned long dwTsrOnceRetry[TYPE_MAXTD]; // this packet only occur one collision 257 unsigned long dwTsrMoreThanOnceRetry[TYPE_MAXTD]; // this packet occur more than one collision 258 unsigned long dwTsrRetry[TYPE_MAXTD]; // this packet has ever occur collision, 259 // that is (dwTsrOnceCollision0 + dwTsrMoreThanOnceCollision0) 260 unsigned long dwTsrACKData[TYPE_MAXTD]; 261 unsigned long dwTsrErr[TYPE_MAXTD]; 262 unsigned long dwAllTsrOK[TYPE_MAXTD]; 263 unsigned long dwTsrRetryTimeout[TYPE_MAXTD]; 264 unsigned long dwTsrTransmitTimeout[TYPE_MAXTD]; 265 266 unsigned long dwTsrTxPacket[TYPE_MAXTD]; 267 unsigned long dwTsrTxOctet[TYPE_MAXTD]; 268 unsigned long dwTsrBroadcast[TYPE_MAXTD]; 269 unsigned long dwTsrMulticast[TYPE_MAXTD]; 270 unsigned long dwTsrDirected[TYPE_MAXTD]; 271 272 // RD/TD count 273 unsigned long dwCntRxFrmLength; 274 unsigned long dwCntTxBufLength; 275 276 unsigned char abyCntRxPattern[16]; 277 unsigned char abyCntTxPattern[16]; 278 279 // Software check.... 280 unsigned long dwCntRxDataErr; // rx buffer data software compare CRC err count 281 unsigned long dwCntDecryptErr; // rx buffer data software compare CRC err count 282 unsigned long dwCntRxICVErr; // rx buffer data software compare CRC err count 283 unsigned int idxRxErrorDesc[TYPE_MAXRD]; // index for rx data error RD 284 285 // 64-bit OID 286 unsigned long long ullTsrOK[TYPE_MAXTD]; 287 288 // for some optional OIDs (64 bits) and DMI support 289 unsigned long long ullTxBroadcastFrames[TYPE_MAXTD]; 290 unsigned long long ullTxMulticastFrames[TYPE_MAXTD]; 291 unsigned long long ullTxDirectedFrames[TYPE_MAXTD]; 292 unsigned long long ullTxBroadcastBytes[TYPE_MAXTD]; 293 unsigned long long ullTxMulticastBytes[TYPE_MAXTD]; 294 unsigned long long ullTxDirectedBytes[TYPE_MAXTD]; 295 296 SISRCounters ISRStat; 297 298 SCustomCounters CustomStat; 299 300 #ifdef Calcu_LinkQual 301 //Tx count: 302 unsigned long TxNoRetryOkCount; 303 unsigned long TxRetryOkCount; 304 unsigned long TxFailCount; 305 //Rx count: 306 unsigned long RxOkCnt; 307 unsigned long RxFcsErrCnt; 308 //statistic 309 unsigned long SignalStren; 310 unsigned long LinkQuality; 311 #endif 312 } SStatCounter, *PSStatCounter; 313 314 void STAvClearAllCounter(PSStatCounter pStatistic); 315 316 void STAvUpdateIsrStatCounter(PSStatCounter pStatistic, unsigned long dwIsr); 317 318 void STAvUpdateRDStatCounter(PSStatCounter pStatistic, 319 unsigned char byRSR, unsigned char byNewRSR, unsigned char byRxRate, 320 unsigned char *pbyBuffer, unsigned int cbFrameLength); 321 322 void STAvUpdateRDStatCounterEx(PSStatCounter pStatistic, 323 unsigned char byRSR, unsigned char byNewRsr, unsigned char byRxRate, 324 unsigned char *pbyBuffer, unsigned int cbFrameLength); 325 326 void STAvUpdateTDStatCounter(PSStatCounter pStatistic, unsigned char byTSR0, unsigned char byTSR1, 327 unsigned char *pbyBuffer, unsigned int cbFrameLength, unsigned int uIdx); 328 329 void STAvUpdateTDStatCounterEx( 330 PSStatCounter pStatistic, 331 unsigned char *pbyBuffer, 332 unsigned long cbFrameLength 333 ); 334 335 void STAvUpdate802_11Counter( 336 PSDot11Counters p802_11Counter, 337 PSStatCounter pStatistic, 338 unsigned long dwCounter 339 ); 340 341 void STAvClear802_11Counter(PSDot11Counters p802_11Counter); 342 343 #endif // __MIB_H__ 344