mib.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  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. #ifndef __MIB_H__
  29. #define __MIB_H__
  30. #include "ttype.h"
  31. #include "tether.h"
  32. #include "desc.h"
  33. /*--------------------- Export Definitions -------------------------*/
  34. //
  35. // USB counter
  36. //
  37. typedef struct tagSUSBCounter {
  38. DWORD dwCrc;
  39. } SUSBCounter, *PSUSBCounter;
  40. //
  41. // 802.11 counter
  42. //
  43. typedef struct tagSDot11Counters {
  44. /* unsigned long Length; // Length of structure */
  45. unsigned long long TransmittedFragmentCount;
  46. unsigned long long MulticastTransmittedFrameCount;
  47. unsigned long long FailedCount;
  48. unsigned long long RetryCount;
  49. unsigned long long MultipleRetryCount;
  50. unsigned long long RTSSuccessCount;
  51. unsigned long long RTSFailureCount;
  52. unsigned long long ACKFailureCount;
  53. unsigned long long FrameDuplicateCount;
  54. unsigned long long ReceivedFragmentCount;
  55. unsigned long long MulticastReceivedFrameCount;
  56. unsigned long long FCSErrorCount;
  57. unsigned long long TKIPLocalMICFailures;
  58. unsigned long long TKIPRemoteMICFailures;
  59. unsigned long long TKIPICVErrors;
  60. unsigned long long TKIPCounterMeasuresInvoked;
  61. unsigned long long TKIPReplays;
  62. unsigned long long CCMPFormatErrors;
  63. unsigned long long CCMPReplays;
  64. unsigned long long CCMPDecryptErrors;
  65. unsigned long long FourWayHandshakeFailures;
  66. /*
  67. * unsigned long long WEPUndecryptableCount;
  68. * unsigned long long WEPICVErrorCount;
  69. * unsigned long long DecryptSuccessCount;
  70. * unsigned long long DecryptFailureCount;
  71. */
  72. } SDot11Counters, *PSDot11Counters;
  73. //
  74. // MIB2 counter
  75. //
  76. typedef struct tagSMib2Counter {
  77. signed long ifIndex;
  78. char ifDescr[256]; // max size 255 plus zero ending
  79. // e.g. "interface 1"
  80. signed long ifType;
  81. signed long ifMtu;
  82. DWORD ifSpeed;
  83. BYTE ifPhysAddress[ETH_ALEN];
  84. signed long ifAdminStatus;
  85. signed long ifOperStatus;
  86. DWORD ifLastChange;
  87. DWORD ifInOctets;
  88. DWORD ifInUcastPkts;
  89. DWORD ifInNUcastPkts;
  90. DWORD ifInDiscards;
  91. DWORD ifInErrors;
  92. DWORD ifInUnknownProtos;
  93. DWORD ifOutOctets;
  94. DWORD ifOutUcastPkts;
  95. DWORD ifOutNUcastPkts;
  96. DWORD ifOutDiscards;
  97. DWORD ifOutErrors;
  98. DWORD ifOutQLen;
  99. DWORD ifSpecific;
  100. } SMib2Counter, *PSMib2Counter;
  101. // Value in the ifType entry
  102. //#define ETHERNETCSMACD 6 //
  103. #define WIRELESSLANIEEE80211b 6 //
  104. // Value in the ifAdminStatus/ifOperStatus entry
  105. #define UP 1 //
  106. #define DOWN 2 //
  107. #define TESTING 3 //
  108. //
  109. // RMON counter
  110. //
  111. typedef struct tagSRmonCounter {
  112. signed long etherStatsIndex;
  113. DWORD etherStatsDataSource;
  114. DWORD etherStatsDropEvents;
  115. DWORD etherStatsOctets;
  116. DWORD etherStatsPkts;
  117. DWORD etherStatsBroadcastPkts;
  118. DWORD etherStatsMulticastPkts;
  119. DWORD etherStatsCRCAlignErrors;
  120. DWORD etherStatsUndersizePkts;
  121. DWORD etherStatsOversizePkts;
  122. DWORD etherStatsFragments;
  123. DWORD etherStatsJabbers;
  124. DWORD etherStatsCollisions;
  125. DWORD etherStatsPkt64Octets;
  126. DWORD etherStatsPkt65to127Octets;
  127. DWORD etherStatsPkt128to255Octets;
  128. DWORD etherStatsPkt256to511Octets;
  129. DWORD etherStatsPkt512to1023Octets;
  130. DWORD etherStatsPkt1024to1518Octets;
  131. DWORD etherStatsOwners;
  132. DWORD etherStatsStatus;
  133. } SRmonCounter, *PSRmonCounter;
  134. //
  135. // Custom counter
  136. //
  137. typedef struct tagSCustomCounters {
  138. unsigned long Length;
  139. unsigned long long ullTsrAllOK;
  140. unsigned long long ullRsr11M;
  141. unsigned long long ullRsr5M;
  142. unsigned long long ullRsr2M;
  143. unsigned long long ullRsr1M;
  144. unsigned long long ullRsr11MCRCOk;
  145. unsigned long long ullRsr5MCRCOk;
  146. unsigned long long ullRsr2MCRCOk;
  147. unsigned long long ullRsr1MCRCOk;
  148. unsigned long long ullRsr54M;
  149. unsigned long long ullRsr48M;
  150. unsigned long long ullRsr36M;
  151. unsigned long long ullRsr24M;
  152. unsigned long long ullRsr18M;
  153. unsigned long long ullRsr12M;
  154. unsigned long long ullRsr9M;
  155. unsigned long long ullRsr6M;
  156. unsigned long long ullRsr54MCRCOk;
  157. unsigned long long ullRsr48MCRCOk;
  158. unsigned long long ullRsr36MCRCOk;
  159. unsigned long long ullRsr24MCRCOk;
  160. unsigned long long ullRsr18MCRCOk;
  161. unsigned long long ullRsr12MCRCOk;
  162. unsigned long long ullRsr9MCRCOk;
  163. unsigned long long ullRsr6MCRCOk;
  164. } SCustomCounters, *PSCustomCounters;
  165. //
  166. // Custom counter
  167. //
  168. typedef struct tagSISRCounters {
  169. unsigned long Length;
  170. DWORD dwIsrTx0OK;
  171. DWORD dwIsrAC0TxOK;
  172. DWORD dwIsrBeaconTxOK;
  173. DWORD dwIsrRx0OK;
  174. DWORD dwIsrTBTTInt;
  175. DWORD dwIsrSTIMERInt;
  176. DWORD dwIsrWatchDog;
  177. DWORD dwIsrUnrecoverableError;
  178. DWORD dwIsrSoftInterrupt;
  179. DWORD dwIsrMIBNearfull;
  180. DWORD dwIsrRxNoBuf;
  181. DWORD dwIsrUnknown; // unknown interrupt count
  182. DWORD dwIsrRx1OK;
  183. DWORD dwIsrATIMTxOK;
  184. DWORD dwIsrSYNCTxOK;
  185. DWORD dwIsrCFPEnd;
  186. DWORD dwIsrATIMEnd;
  187. DWORD dwIsrSYNCFlushOK;
  188. DWORD dwIsrSTIMER1Int;
  189. /////////////////////////////////////
  190. } SISRCounters, *PSISRCounters;
  191. // Value in the etherStatsStatus entry
  192. #define VALID 1 //
  193. #define CREATE_REQUEST 2 //
  194. #define UNDER_CREATION 3 //
  195. #define INVALID 4 //
  196. //
  197. // Tx packet information
  198. //
  199. typedef struct tagSTxPktInfo {
  200. BYTE byBroadMultiUni;
  201. WORD wLength;
  202. WORD wFIFOCtl;
  203. BYTE abyDestAddr[ETH_ALEN];
  204. } STxPktInfo, *PSTxPktInfo;
  205. #define MAX_RATE 12
  206. //
  207. // statistic counter
  208. //
  209. typedef struct tagSStatCounter {
  210. //
  211. // ISR status count
  212. //
  213. SISRCounters ISRStat;
  214. // RSR status count
  215. //
  216. DWORD dwRsrFrmAlgnErr;
  217. DWORD dwRsrErr;
  218. DWORD dwRsrCRCErr;
  219. DWORD dwRsrCRCOk;
  220. DWORD dwRsrBSSIDOk;
  221. DWORD dwRsrADDROk;
  222. DWORD dwRsrBCNSSIDOk;
  223. DWORD dwRsrLENErr;
  224. DWORD dwRsrTYPErr;
  225. DWORD dwNewRsrDECRYPTOK;
  226. DWORD dwNewRsrCFP;
  227. DWORD dwNewRsrUTSF;
  228. DWORD dwNewRsrHITAID;
  229. DWORD dwNewRsrHITAID0;
  230. DWORD dwRsrLong;
  231. DWORD dwRsrRunt;
  232. DWORD dwRsrRxControl;
  233. DWORD dwRsrRxData;
  234. DWORD dwRsrRxManage;
  235. DWORD dwRsrRxPacket;
  236. DWORD dwRsrRxOctet;
  237. DWORD dwRsrBroadcast;
  238. DWORD dwRsrMulticast;
  239. DWORD dwRsrDirected;
  240. // 64-bit OID
  241. unsigned long long ullRsrOK;
  242. // for some optional OIDs (64 bits) and DMI support
  243. unsigned long long ullRxBroadcastBytes;
  244. unsigned long long ullRxMulticastBytes;
  245. unsigned long long ullRxDirectedBytes;
  246. unsigned long long ullRxBroadcastFrames;
  247. unsigned long long ullRxMulticastFrames;
  248. unsigned long long ullRxDirectedFrames;
  249. DWORD dwRsrRxFragment;
  250. DWORD dwRsrRxFrmLen64;
  251. DWORD dwRsrRxFrmLen65_127;
  252. DWORD dwRsrRxFrmLen128_255;
  253. DWORD dwRsrRxFrmLen256_511;
  254. DWORD dwRsrRxFrmLen512_1023;
  255. DWORD dwRsrRxFrmLen1024_1518;
  256. // TSR status count
  257. //
  258. DWORD dwTsrTotalRetry; // total collision retry count
  259. DWORD dwTsrOnceRetry; // this packet only occur one collision
  260. DWORD dwTsrMoreThanOnceRetry; // this packet occur more than one collision
  261. DWORD dwTsrRetry; // this packet has ever occur collision,
  262. // that is (dwTsrOnceCollision0 + dwTsrMoreThanOnceCollision0)
  263. DWORD dwTsrACKData;
  264. DWORD dwTsrErr;
  265. DWORD dwAllTsrOK;
  266. DWORD dwTsrRetryTimeout;
  267. DWORD dwTsrTransmitTimeout;
  268. DWORD dwTsrTxPacket;
  269. DWORD dwTsrTxOctet;
  270. DWORD dwTsrBroadcast;
  271. DWORD dwTsrMulticast;
  272. DWORD dwTsrDirected;
  273. // RD/TD count
  274. DWORD dwCntRxFrmLength;
  275. DWORD dwCntTxBufLength;
  276. BYTE abyCntRxPattern[16];
  277. BYTE abyCntTxPattern[16];
  278. // Software check....
  279. DWORD dwCntRxDataErr; // rx buffer data software compare CRC err count
  280. DWORD dwCntDecryptErr; // rx buffer data software compare CRC err count
  281. DWORD dwCntRxICVErr; // rx buffer data software compare CRC err count
  282. // 64-bit OID
  283. unsigned long long ullTsrOK;
  284. // for some optional OIDs (64 bits) and DMI support
  285. unsigned long long ullTxBroadcastFrames;
  286. unsigned long long ullTxMulticastFrames;
  287. unsigned long long ullTxDirectedFrames;
  288. unsigned long long ullTxBroadcastBytes;
  289. unsigned long long ullTxMulticastBytes;
  290. unsigned long long ullTxDirectedBytes;
  291. // for autorate
  292. DWORD dwTxOk[MAX_RATE+1];
  293. DWORD dwTxFail[MAX_RATE+1];
  294. DWORD dwTxRetryCount[8];
  295. STxPktInfo abyTxPktInfo[16];
  296. SUSBCounter USB_EP0Stat;
  297. SUSBCounter USB_BulkInStat;
  298. SUSBCounter USB_BulkOutStat;
  299. SUSBCounter USB_InterruptStat;
  300. SCustomCounters CustomStat;
  301. //Tx count:
  302. unsigned long TxNoRetryOkCount; /* success tx no retry ! */
  303. unsigned long TxRetryOkCount; /* success tx but retry ! */
  304. unsigned long TxFailCount; /* fail tx ? */
  305. //Rx count:
  306. unsigned long RxOkCnt; /* success rx ! */
  307. unsigned long RxFcsErrCnt; /* fail rx ? */
  308. //statistic
  309. unsigned long SignalStren;
  310. unsigned long LinkQuality;
  311. } SStatCounter, *PSStatCounter;
  312. /*--------------------- Export Classes ----------------------------*/
  313. /*--------------------- Export Variables --------------------------*/
  314. /*--------------------- Export Functions --------------------------*/
  315. void STAvClearAllCounter(PSStatCounter pStatistic);
  316. void STAvUpdateIsrStatCounter(PSStatCounter pStatistic,
  317. BYTE byIsr0,
  318. BYTE byIsr1);
  319. void STAvUpdateRDStatCounter(PSStatCounter pStatistic,
  320. BYTE byRSR, BYTE byNewRSR, BYTE byRxSts,
  321. BYTE byRxRate, PBYTE pbyBuffer,
  322. unsigned int cbFrameLength);
  323. void STAvUpdateRDStatCounterEx(PSStatCounter pStatistic,
  324. BYTE byRSR, BYTE byNewRSR, BYTE byRxSts,
  325. BYTE byRxRate, PBYTE pbyBuffer,
  326. unsigned int cbFrameLength);
  327. void STAvUpdateTDStatCounter(PSStatCounter pStatistic, BYTE byPktNum,
  328. BYTE byRate, BYTE byTSR);
  329. void
  330. STAvUpdate802_11Counter(
  331. PSDot11Counters p802_11Counter,
  332. PSStatCounter pStatistic,
  333. BYTE byRTSSuccess,
  334. BYTE byRTSFail,
  335. BYTE byACKFail,
  336. BYTE byFCSErr
  337. );
  338. void STAvClear802_11Counter(PSDot11Counters p802_11Counter);
  339. void STAvUpdateUSBCounter(PSUSBCounter pUsbCounter, int ntStatus);
  340. #endif /* __MIB_H__ */