Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

559 lines
22 KiB

  1. /*++
  2. Copyright (c) 1992-1996 Microsoft Corporation
  3. Module Name:
  4. mib.c
  5. Abstract:
  6. Contains definition of LAN Manager MIB.
  7. Environment:
  8. User Mode - Win32
  9. Revision History:
  10. 10-May-1996 DonRyan
  11. Removed banner from Technology Dynamics, Inc.
  12. --*/
  13. //--------------------------- WINDOWS DEPENDENCIES --------------------------
  14. //--------------------------- STANDARD DEPENDENCIES -- #include<xxxxx.h> ----
  15. //--------------------------- MODULE DEPENDENCIES -- #include"xxxxx.h" ------
  16. #include <snmp.h>
  17. #include "mibfuncs.h"
  18. #include "hash.h"
  19. //--------------------------- SELF-DEPENDENCY -- ONE #include"module.h" -----
  20. #include "mib.h"
  21. //--------------------------- PUBLIC VARIABLES --(same as in module.h file)--
  22. // If an addition or deletion to the MIB is necessary, there are several
  23. // places in the code that must be checked and possibly changed.
  24. //
  25. // 1. There are 4 constants that are used as indexes to the start of each
  26. // group in the MIB. These are defined in MIB.H and must be adjusted
  27. // to reflect any changes that affect them.
  28. //
  29. // 2. The last field in each MIB entry is used to point to the NEXT
  30. // leaf variable or table root. If an AGGREGATE is next in the MIB,
  31. // this pointer should skip it, because an AGGREGATE can never be
  32. // accessed. The last variable in the MIB is NULL. Using the constants
  33. // defined in step 1 above provides some flexibility.
  34. //
  35. // 3. Following the MIB is a table of TABLE pointers into the MIB. These
  36. // pointers must be updated to reflect any changes made to the MIB.
  37. // Each entry should point to the variable immediately below the table
  38. // root. (ie The entry in the table for "Session Table" should point
  39. // to the MIB variable { svSessionTable 1 } in the server group.)
  40. // The prefix to all of the LM mib names is 1.3.6.1.4.1.77.1
  41. UINT OID_Prefix[] = { 1, 3, 6, 1, 4, 1, 77, 1 };
  42. AsnObjectIdentifier MIB_OidPrefix = { sizeof OID_Prefix / sizeof(UINT),
  43. OID_Prefix };
  44. // OID definitions for MIB -- group partitions
  45. UINT MIB_common_group[] = { 1 };
  46. UINT MIB_server_group[] = { 2 };
  47. UINT MIB_wksta_group[] = { 3 };
  48. UINT MIB_domain_group[] = { 4 };
  49. // OID definitions for MIB -- COMMON group
  50. UINT MIB_comVersionMaj[] = { 1, 1, 0 };
  51. UINT MIB_comVersionMin[] = { 1, 2, 0 };
  52. UINT MIB_comType[] = { 1, 3, 0 };
  53. UINT MIB_comStatStart[] = { 1, 4, 0 };
  54. UINT MIB_comStatNumNetIOs[] = { 1, 5, 0 };
  55. UINT MIB_comStatFiNetIOs[] = { 1, 6, 0 };
  56. UINT MIB_comStatFcNetIOs[] = { 1, 7, 0 };
  57. // OID definitions for MIB -- SERVER group
  58. UINT MIB_svDescription[] = { 2, 1, 0 };
  59. UINT MIB_svSvcNumber[] = { 2, 2, 0 };
  60. UINT MIB_svSvcTable[] = { 2, 3 };
  61. UINT MIB_svSvcEntry[] = { 2, 3, 1 };
  62. UINT MIB_svStatOpens[] = { 2, 4, 0 };
  63. UINT MIB_svStatDevOpens[] = { 2, 5, 0 };
  64. UINT MIB_svStatQueuedJobs[] = { 2, 6, 0 };
  65. UINT MIB_svStatSOpens[] = { 2, 7, 0 };
  66. UINT MIB_svStatErrorOuts[] = { 2, 8, 0 };
  67. UINT MIB_svStatPwErrors[] = { 2, 9, 0 };
  68. UINT MIB_svStatPermErrors[] = { 2, 10, 0 };
  69. UINT MIB_svStatSysErrors[] = { 2, 11, 0 };
  70. UINT MIB_svStatSentBytes[] = { 2, 12, 0 };
  71. UINT MIB_svStatRcvdBytes[] = { 2, 13, 0 };
  72. UINT MIB_svStatAvResponse[] = { 2, 14, 0 };
  73. UINT MIB_svSecurityMode[] = { 2, 15, 0 };
  74. UINT MIB_svUsers[] = { 2, 16, 0 };
  75. UINT MIB_svStatReqBufsNeeded[] = { 2, 17, 0 };
  76. UINT MIB_svStatBigBufsNeeded[] = { 2, 18, 0 };
  77. UINT MIB_svSessionNumber[] = { 2, 19, 0 };
  78. UINT MIB_svSessionTable[] = { 2, 20 };
  79. UINT MIB_svSessionEntry[] = { 2, 20, 1 };
  80. UINT MIB_svAutoDisconnects[] = { 2, 21, 0 };
  81. UINT MIB_svDisConTime[] = { 2, 22, 0 };
  82. UINT MIB_svAuditLogSize[] = { 2, 23, 0 };
  83. UINT MIB_svUserNumber[] = { 2, 24, 0 };
  84. UINT MIB_svUserTable[] = { 2, 25 };
  85. UINT MIB_svUserEntry[] = { 2, 25, 1 };
  86. UINT MIB_svShareNumber[] = { 2, 26, 0 };
  87. UINT MIB_svShareTable[] = { 2, 27 };
  88. UINT MIB_svShareEntry[] = { 2, 27, 1 };
  89. UINT MIB_svPrintQNumber[] = { 2, 28, 0 };
  90. UINT MIB_svPrintQTable[] = { 2, 29 };
  91. UINT MIB_svPrintQEntry[] = { 2, 29, 1 };
  92. // OID definitions for MIB - WORKSTATION group
  93. UINT MIB_wkstaStatSessStarts[] = { 3, 1, 0 };
  94. UINT MIB_wkstaStatSessFails[] = { 3, 2, 0 };
  95. UINT MIB_wkstaStatUses[] = { 3, 3, 0 };
  96. UINT MIB_wkstaStatUseFails[] = { 3, 4, 0 };
  97. UINT MIB_wkstaStatAutoRecs[] = { 3, 5, 0 };
  98. UINT MIB_wkstaErrorLogSize[] = { 3, 6, 0 };
  99. UINT MIB_wkstaUseNumber[] = { 3, 7, 0 };
  100. UINT MIB_wkstaUseTable[] = { 3, 8 };
  101. UINT MIB_wkstaUseEntry[] = { 3, 8, 1 };
  102. // OID definitions for MIB - DOMAIN group
  103. UINT MIB_domPrimaryDomain[] = { 4, 1, 0 };
  104. UINT MIB_domLogonDomain[] = { 4, 2, 0 };
  105. UINT MIB_domOtherDomainNumber[] = { 4, 3, 0 };
  106. UINT MIB_domOtherDomainTable[] = { 4, 4 };
  107. UINT MIB_domOtherDomainEntry[] = { 4, 4, 1 };
  108. UINT MIB_domServerNumber[] = { 4, 5, 0 };
  109. UINT MIB_domServerTable[] = { 4, 6 };
  110. UINT MIB_domServerEntry[] = { 4, 6, 1 };
  111. UINT MIB_domLogonNumber[] = { 4, 7, 0 };
  112. UINT MIB_domLogonTable[] = { 4, 8 };
  113. UINT MIB_domLogonEntry[] = { 4, 8, 1 };
  114. // LAN Manager MIB definiton
  115. MIB_ENTRY Mib[] = {
  116. // LAN MGR 2 Root
  117. { { 0, NULL }, MIB_AGGREGATE, // { lanmanager 1 }
  118. 0, 0, FALSE,
  119. NULL, NULL, 0,
  120. &Mib[MIB_COM_START] },
  121. // COMMON group
  122. { { 1, MIB_common_group }, MIB_AGGREGATE, // { lanmgr-2 1 }
  123. 0, 0, FALSE,
  124. NULL, NULL, 0,
  125. &Mib[MIB_COM_START] },
  126. { { 3, MIB_comVersionMaj }, ASN_OCTETSTRING, // { common 1 }
  127. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  128. MIB_common_func, MIB_leaf_func, MIB_LM_COMVERSIONMAJ,
  129. &Mib[MIB_COM_START+1] },
  130. { { 3, MIB_comVersionMin }, ASN_OCTETSTRING, // { common 2 }
  131. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  132. MIB_common_func, MIB_leaf_func, MIB_LM_COMVERSIONMIN,
  133. &Mib[MIB_COM_START+2] },
  134. { { 3, MIB_comType }, ASN_OCTETSTRING, // { common 3 }
  135. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  136. MIB_common_func, MIB_leaf_func, MIB_LM_COMTYPE,
  137. &Mib[MIB_COM_START+3] },
  138. { { 3, MIB_comStatStart }, ASN_INTEGER, // { common 4 }
  139. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  140. MIB_common_func, MIB_leaf_func, MIB_LM_COMSTATSTART,
  141. &Mib[MIB_COM_START+4] },
  142. { { 3, MIB_comStatNumNetIOs }, ASN_RFC1155_COUNTER, // { common 5 }
  143. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  144. MIB_common_func, MIB_leaf_func, MIB_LM_COMSTATNUMNETIOS,
  145. &Mib[MIB_COM_START+5] },
  146. { { 3, MIB_comStatFiNetIOs }, ASN_RFC1155_COUNTER, // { common 6 }
  147. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  148. MIB_common_func, MIB_leaf_func, MIB_LM_COMSTATFINETIOS,
  149. &Mib[MIB_COM_START+6] },
  150. { { 3, MIB_comStatFcNetIOs }, ASN_RFC1155_COUNTER, // { common 7 }
  151. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  152. MIB_common_func, MIB_leaf_func, MIB_LM_COMSTATFCNETIOS,
  153. &Mib[MIB_SV_START] },
  154. // SERVER group
  155. { { 1, MIB_server_group }, MIB_AGGREGATE, // { lanmgr-2 2 }
  156. 0, 0, FALSE,
  157. NULL, NULL, 0,
  158. &Mib[MIB_SV_START] },
  159. { { 3, MIB_svDescription }, ASN_RFC1213_DISPSTRING, // { Server 1 }
  160. MIB_ACCESS_READWRITE, MIB_STATUS_MANDATORY, TRUE,
  161. MIB_server_func, MIB_leaf_func, MIB_LM_SVDESCRIPTION,
  162. &Mib[MIB_SV_START+1] },
  163. { { 3, MIB_svSvcNumber }, ASN_INTEGER, // { Server 2 }
  164. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  165. MIB_server_func, MIB_leaf_func, MIB_LM_SVSVCNUMBER,
  166. &Mib[MIB_SV_START+3] },
  167. { { 2, MIB_svSvcTable }, MIB_AGGREGATE, // { Server 3 }
  168. MIB_ACCESS_NOT, MIB_STATUS_MANDATORY, FALSE,
  169. NULL, NULL, MIB_LM_SVSVCTABLE,
  170. &Mib[MIB_SV_START+3] },
  171. { { 3, MIB_svSvcEntry }, MIB_TABLE, // { svSvcTable 1 }
  172. MIB_ACCESS_NOT, MIB_STATUS_MANDATORY, FALSE,
  173. NULL, MIB_srvcs_func, MIB_LM_SVSVCENTRY,
  174. &Mib[MIB_SV_START+4] },
  175. { { 3, MIB_svStatOpens }, ASN_RFC1155_COUNTER, // { server 4 }
  176. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  177. MIB_server_func, MIB_leaf_func, MIB_LM_SVSTATOPENS,
  178. &Mib[MIB_SV_START+5] },
  179. { { 3, MIB_svStatDevOpens }, ASN_RFC1155_COUNTER, // { server 5 }
  180. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  181. MIB_server_func, MIB_leaf_func, MIB_LM_SVSTATDEVOPENS,
  182. &Mib[MIB_SV_START+6] },
  183. { { 3, MIB_svStatQueuedJobs }, ASN_RFC1155_COUNTER, // { server 6 }
  184. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  185. MIB_server_func, MIB_leaf_func, MIB_LM_SVSTATQUEUEDJOBS,
  186. &Mib[MIB_SV_START+7] },
  187. { { 3, MIB_svStatSOpens }, ASN_RFC1155_COUNTER, // { server 7 }
  188. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  189. MIB_server_func, MIB_leaf_func, MIB_LM_SVSTATSOPENS,
  190. &Mib[MIB_SV_START+8] },
  191. { { 3, MIB_svStatErrorOuts }, ASN_RFC1155_COUNTER, // { server 8 }
  192. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  193. MIB_server_func, MIB_leaf_func, MIB_LM_SVSTATERROROUTS,
  194. &Mib[MIB_SV_START+9] },
  195. { { 3, MIB_svStatPwErrors }, ASN_RFC1155_COUNTER, // { server 9 }
  196. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  197. MIB_server_func, MIB_leaf_func, MIB_LM_SVSTATPWERRORS,
  198. &Mib[MIB_SV_START+10] },
  199. { { 3, MIB_svStatPermErrors }, ASN_RFC1155_COUNTER, // { server 10 }
  200. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  201. MIB_server_func, MIB_leaf_func, MIB_LM_SVSTATPERMERRORS,
  202. &Mib[MIB_SV_START+11] },
  203. { { 3, MIB_svStatSysErrors }, ASN_RFC1155_COUNTER, // { server 11 }
  204. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  205. MIB_server_func, MIB_leaf_func, MIB_LM_SVSTATSYSERRORS,
  206. &Mib[MIB_SV_START+12] },
  207. { { 3, MIB_svStatSentBytes }, ASN_RFC1155_COUNTER, // { server 12 }
  208. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  209. MIB_server_func, MIB_leaf_func, MIB_LM_SVSTATSENTBYTES,
  210. &Mib[MIB_SV_START+13] },
  211. { { 3, MIB_svStatRcvdBytes }, ASN_RFC1155_COUNTER, // { server 13 }
  212. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  213. MIB_server_func, MIB_leaf_func, MIB_LM_SVSTATRCVDBYTES,
  214. &Mib[MIB_SV_START+14] },
  215. { { 3, MIB_svStatAvResponse }, ASN_INTEGER, // { server 14 }
  216. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  217. MIB_server_func, MIB_leaf_func, MIB_LM_SVSTATAVRESPONSE,
  218. &Mib[MIB_SV_START+15] },
  219. { { 3, MIB_svSecurityMode }, ASN_INTEGER, // { server 15 }
  220. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  221. MIB_server_func, MIB_leaf_func, MIB_LM_SVSECURITYMODE,
  222. &Mib[MIB_SV_START+16] },
  223. { { 3, MIB_svUsers }, ASN_INTEGER, // { server 16 }
  224. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  225. MIB_server_func, MIB_leaf_func, MIB_LM_SVUSERS,
  226. &Mib[MIB_SV_START+17] },
  227. { { 3, MIB_svStatReqBufsNeeded }, ASN_RFC1155_COUNTER, // { server 17}
  228. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  229. MIB_server_func, MIB_leaf_func, MIB_LM_SVSTATREQBUFSNEEDED,
  230. &Mib[MIB_SV_START+18] },
  231. { { 3, MIB_svStatBigBufsNeeded }, ASN_RFC1155_COUNTER, // { server 18}
  232. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  233. MIB_server_func, MIB_leaf_func, MIB_LM_SVSTATBIGBUFSNEEDED,
  234. &Mib[MIB_SV_START+19] },
  235. { { 3, MIB_svSessionNumber }, ASN_INTEGER, // { server 19 }
  236. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  237. MIB_server_func, MIB_leaf_func, MIB_LM_SVSESSIONNUMBER,
  238. &Mib[MIB_SV_START+21] },
  239. { { 2, MIB_svSessionTable }, MIB_AGGREGATE, // { server 20 }
  240. MIB_ACCESS_NOT, MIB_STATUS_MANDATORY, FALSE,
  241. NULL, NULL, MIB_LM_SVSESSIONTABLE,
  242. &Mib[MIB_SV_START+21] },
  243. { { 3, MIB_svSessionEntry }, MIB_TABLE, // { svSessionTable 1 }
  244. MIB_ACCESS_NOT, MIB_STATUS_MANDATORY, FALSE,
  245. NULL, MIB_sess_func, MIB_LM_SVSESSIONENTRY,
  246. &Mib[MIB_SV_START+22] },
  247. { { 3, MIB_svAutoDisconnects }, ASN_INTEGER, // { server 21 }
  248. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  249. MIB_server_func, MIB_leaf_func, MIB_LM_SVAUTODISCONNECTS,
  250. &Mib[MIB_SV_START+23] },
  251. { { 3, MIB_svDisConTime }, ASN_INTEGER, // { server 22 }
  252. MIB_ACCESS_READWRITE, MIB_STATUS_MANDATORY, TRUE,
  253. MIB_server_func, MIB_leaf_func, MIB_LM_SVDISCONTIME,
  254. #if 0
  255. &Mib[MIB_SV_START+24] },
  256. #else
  257. &Mib[MIB_SV_START+25] },
  258. #endif
  259. { { 3, MIB_svAuditLogSize }, ASN_INTEGER, // { server 23 }
  260. MIB_ACCESS_NOT, MIB_STATUS_MANDATORY, TRUE,
  261. MIB_server_func, MIB_leaf_func, MIB_LM_SVAUDITLOGSIZE,
  262. &Mib[MIB_SV_START+25] },
  263. { { 3, MIB_svUserNumber }, ASN_INTEGER, // { server 24 }
  264. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  265. MIB_server_func, MIB_leaf_func, MIB_LM_SVUSERNUMBER,
  266. &Mib[MIB_SV_START+27] },
  267. { { 2, MIB_svUserTable }, MIB_AGGREGATE, // { server 25 }
  268. MIB_ACCESS_NOT, MIB_STATUS_MANDATORY, FALSE,
  269. NULL, NULL, MIB_LM_SVUSERTABLE,
  270. &Mib[MIB_SV_START+27] },
  271. { { 3, MIB_svUserEntry }, MIB_TABLE, // { svUserTable 1 }
  272. MIB_ACCESS_NOT, MIB_STATUS_MANDATORY, FALSE,
  273. NULL, MIB_users_func, MIB_LM_SVUSERENTRY,
  274. &Mib[MIB_SV_START+28] },
  275. { { 3, MIB_svShareNumber }, ASN_INTEGER, // { server 26 }
  276. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  277. MIB_server_func, MIB_leaf_func, MIB_LM_SVSHARENUMBER,
  278. &Mib[MIB_SV_START+30] },
  279. { { 2, MIB_svShareTable }, MIB_AGGREGATE, // { server 27 }
  280. MIB_ACCESS_NOT, MIB_STATUS_MANDATORY, FALSE,
  281. NULL, NULL, MIB_LM_SVSHARETABLE,
  282. &Mib[MIB_SV_START+30] },
  283. { { 3, MIB_svShareEntry }, MIB_TABLE, // { svShareTable 1 }
  284. MIB_ACCESS_NOT, MIB_STATUS_MANDATORY, FALSE,
  285. NULL, MIB_shares_func, MIB_LM_SVSHAREENTRY,
  286. &Mib[MIB_SV_START+31] },
  287. { { 3, MIB_svPrintQNumber }, ASN_INTEGER, // { server 28 }
  288. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  289. MIB_server_func, MIB_leaf_func, MIB_LM_SVPRINTQNUMBER,
  290. &Mib[MIB_SV_START+33] },
  291. { { 2, MIB_svPrintQTable }, MIB_AGGREGATE, // { server 29 }
  292. MIB_ACCESS_NOT, MIB_STATUS_MANDATORY, FALSE,
  293. NULL, NULL, MIB_LM_SVPRINTQTABLE,
  294. &Mib[MIB_SV_START+33] },
  295. { { 3, MIB_svPrintQEntry }, MIB_TABLE, // { svPrintQTable 1 }
  296. MIB_ACCESS_NOT, MIB_STATUS_MANDATORY, FALSE,
  297. NULL, MIB_prntq_func, MIB_LM_SVPRINTQENTRY,
  298. &Mib[MIB_WKSTA_START] },
  299. // WORKSTATION group
  300. { { 1, MIB_wksta_group }, MIB_AGGREGATE, // { lanmgr-2 3 }
  301. 0, 0, FALSE,
  302. NULL, NULL, 0,
  303. &Mib[MIB_WKSTA_START] },
  304. { { 3, MIB_wkstaStatSessStarts }, ASN_RFC1155_COUNTER, // { wrksta 1 }
  305. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  306. MIB_workstation_func, MIB_leaf_func, MIB_LM_WKSTASTATSESSSTARTS,
  307. &Mib[MIB_WKSTA_START+1] },
  308. { { 3, MIB_wkstaStatSessFails }, ASN_RFC1155_COUNTER, // { wrksta 2 }
  309. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  310. MIB_workstation_func, MIB_leaf_func, MIB_LM_WKSTASTATSESSFAILS,
  311. &Mib[MIB_WKSTA_START+2] },
  312. { { 3, MIB_wkstaStatUses }, ASN_RFC1155_COUNTER, // { wrksta 3 }
  313. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  314. MIB_workstation_func, MIB_leaf_func, MIB_LM_WKSTASTATUSES,
  315. &Mib[MIB_WKSTA_START+3] },
  316. { { 3, MIB_wkstaStatUseFails }, ASN_RFC1155_COUNTER, // { wrksta 4 }
  317. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  318. MIB_workstation_func, MIB_leaf_func, MIB_LM_WKSTASTATUSEFAILS,
  319. &Mib[MIB_WKSTA_START+4] },
  320. { { 3, MIB_wkstaStatAutoRecs }, ASN_RFC1155_COUNTER, // { wrksta 5 }
  321. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  322. MIB_workstation_func, MIB_leaf_func, MIB_LM_WKSTASTATAUTORECS,
  323. #if 0
  324. &Mib[MIB_WKSTA_START+5] },
  325. #else
  326. &Mib[MIB_WKSTA_START+6] },
  327. #endif
  328. { { 3, MIB_wkstaErrorLogSize }, ASN_INTEGER, // { wrksta 6 }
  329. MIB_ACCESS_NOT, MIB_STATUS_MANDATORY, TRUE,
  330. MIB_workstation_func, MIB_leaf_func, MIB_LM_WKSTAERRORLOGSIZE,
  331. &Mib[MIB_WKSTA_START+6] },
  332. { { 3, MIB_wkstaUseNumber }, ASN_INTEGER, // { wrksta 7 }
  333. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  334. MIB_workstation_func, MIB_leaf_func, MIB_LM_WKSTAUSENUMBER,
  335. &Mib[MIB_WKSTA_START+8] },
  336. { { 2, MIB_wkstaUseTable }, MIB_AGGREGATE, // { wrksta 8 }
  337. MIB_ACCESS_NOT, MIB_STATUS_MANDATORY, FALSE,
  338. NULL, NULL, MIB_LM_WKSTAUSETABLE,
  339. &Mib[MIB_WKSTA_START+8] },
  340. { { 3, MIB_wkstaUseEntry }, MIB_TABLE, // { wrkstaUseTable 1 }
  341. MIB_ACCESS_NOT, MIB_STATUS_MANDATORY, FALSE,
  342. NULL, MIB_wsuses_func, MIB_LM_WKSTAUSEENTRY,
  343. &Mib[MIB_DOM_START] },
  344. // DOMAIN group
  345. { { 1, MIB_domain_group }, MIB_AGGREGATE, // { lanmgr-2 4 }
  346. 0, 0, FALSE,
  347. NULL, NULL, 0,
  348. &Mib[MIB_DOM_START] },
  349. { { 3, MIB_domPrimaryDomain }, ASN_RFC1213_DISPSTRING, // { domain 1 }
  350. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  351. MIB_domain_func, MIB_leaf_func, MIB_LM_DOMPRIMARYDOMAIN,
  352. #if 0
  353. &Mib[MIB_DOM_START+1] },
  354. #else
  355. NULL },
  356. #endif
  357. { { 3, MIB_domLogonDomain }, ASN_RFC1213_DISPSTRING, // { domain 2 }
  358. #if 0
  359. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  360. #else
  361. MIB_ACCESS_NOT, MIB_STATUS_MANDATORY, TRUE,
  362. #endif
  363. MIB_domain_func, MIB_leaf_func, MIB_LM_DOMLOGONDOMAIN,
  364. &Mib[MIB_DOM_START+2] },
  365. { { 3, MIB_domOtherDomainNumber }, ASN_INTEGER, // { domain 3 }
  366. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  367. MIB_domain_func, MIB_leaf_func, MIB_LM_DOMOTHERDOMAINNUMBER,
  368. &Mib[MIB_DOM_START+4] },
  369. { { 2, MIB_domOtherDomainTable }, MIB_AGGREGATE, // { domain 4 }
  370. MIB_ACCESS_NOT, MIB_STATUS_MANDATORY, FALSE,
  371. NULL, NULL, MIB_LM_DOMOTHERDOMAINTABLE,
  372. &Mib[MIB_DOM_START+4] },
  373. { { 3, MIB_domOtherDomainEntry }, MIB_TABLE, // { domOtherDomTable 1 }
  374. MIB_ACCESS_NOT, MIB_STATUS_MANDATORY, FALSE,
  375. NULL, MIB_odoms_func, MIB_LM_DOMOTHERDOMAINENTRY,
  376. &Mib[MIB_DOM_START+5] },
  377. { { 3, MIB_domServerNumber }, ASN_INTEGER, // { domain 5 }
  378. MIB_ACCESS_READ, MIB_STATUS_MANDATORY, TRUE,
  379. MIB_domain_func, MIB_leaf_func, MIB_LM_DOMSERVERNUMBER,
  380. &Mib[MIB_DOM_START+7] },
  381. { { 2, MIB_domServerTable }, MIB_AGGREGATE, // { domain 6 }
  382. MIB_ACCESS_NOT, MIB_STATUS_MANDATORY, FALSE,
  383. NULL, NULL, MIB_LM_DOMSERVERTABLE,
  384. &Mib[MIB_DOM_START+7] },
  385. { { 3, MIB_domServerEntry }, MIB_TABLE, // { domServerTable 1 }
  386. MIB_ACCESS_NOT, MIB_STATUS_MANDATORY, FALSE,
  387. NULL, MIB_svsond_func, MIB_LM_DOMSERVERENTRY,
  388. NULL }
  389. };
  390. UINT MIB_num_variables = sizeof Mib / sizeof( MIB_ENTRY );
  391. //
  392. // List of table pointers - References must agree with MIB
  393. //
  394. MIB_ENTRY *MIB_Tables[] = {
  395. &Mib[MIB_SV_START+3], // Service
  396. &Mib[MIB_SV_START+21], // Session
  397. &Mib[MIB_SV_START+27], // User
  398. &Mib[MIB_SV_START+30], // Share
  399. &Mib[MIB_SV_START+33], // Print Queue
  400. &Mib[MIB_WKSTA_START+8], // Uses
  401. &Mib[MIB_DOM_START+4], // Other domain
  402. &Mib[MIB_DOM_START+7] // Server
  403. };
  404. UINT MIB_table_list_size = sizeof MIB_Tables / sizeof( MIB_ENTRY * );
  405. //--------------------------- PRIVATE CONSTANTS -----------------------------
  406. //--------------------------- PRIVATE STRUCTS -------------------------------
  407. //--------------------------- PRIVATE VARIABLES -----------------------------
  408. //--------------------------- PRIVATE PROTOTYPES ----------------------------
  409. //--------------------------- PRIVATE PROCEDURES ----------------------------
  410. //--------------------------- PUBLIC PROCEDURES -----------------------------
  411. //
  412. // MIB_get_entry
  413. // Lookup OID in MIB, and return pointer to its entry.
  414. //
  415. // Notes:
  416. //
  417. // Return Codes:
  418. //
  419. // Error Codes:
  420. // SNMP_MIB_UNKNOWN_OID
  421. //
  422. MIB_ENTRY *MIB_get_entry(
  423. IN AsnObjectIdentifier *Oid
  424. )
  425. {
  426. AsnObjectIdentifier TempOid;
  427. UINT I;
  428. MIB_ENTRY *pResult;
  429. // Check prefix
  430. if ( SnmpUtilOidNCmp(&MIB_OidPrefix, Oid, MIB_PREFIX_LEN) )
  431. {
  432. pResult = NULL;
  433. goto Exit;
  434. }
  435. // Strip prefix by placing in temp
  436. TempOid.idLength = Oid->idLength - MIB_PREFIX_LEN;
  437. TempOid.ids = &Oid->ids[MIB_PREFIX_LEN];
  438. // Get pointer into MIB
  439. pResult = MIB_HashLookup( &TempOid );
  440. // Check for possible table entry
  441. if ( pResult == NULL )
  442. {
  443. for ( I=0;I < MIB_table_list_size;I++ )
  444. {
  445. if ( !SnmpUtilOidNCmp(&TempOid, &MIB_Tables[I]->Oid,
  446. MIB_Tables[I]->Oid.idLength) )
  447. {
  448. pResult = MIB_Tables[I];
  449. goto Exit;
  450. }
  451. }
  452. }
  453. Exit:
  454. return pResult;
  455. } // MIB_get_entry
  456. //
  457. // MakeOidFromStr
  458. // Makes an OID out of string so a table can be indexed.
  459. //
  460. // Notes:
  461. //
  462. // Return Codes:
  463. //
  464. // Error Codes:
  465. // None.
  466. //
  467. SNMPAPI MakeOidFromStr(
  468. IN AsnDisplayString *Str, // String to make OID
  469. OUT AsnObjectIdentifier *Oid // Resulting OID
  470. )
  471. {
  472. UINT I;
  473. SNMPAPI nResult;
  474. if ( NULL == (Oid->ids = SnmpUtilMemAlloc((Str->length+1) * sizeof(UINT))) )
  475. {
  476. nResult = SNMP_MEM_ALLOC_ERROR;
  477. goto Exit;
  478. }
  479. // Place length as first OID sub-id
  480. Oid->ids[0] = Str->length;
  481. // Place each character of string as sub-id
  482. for ( I=0;I < Str->length;I++ )
  483. {
  484. Oid->ids[I+1] = Str->stream[I];
  485. }
  486. Oid->idLength = Str->length + 1;
  487. Exit:
  488. return nResult;
  489. } // MakeOidFromStr
  490. //-------------------------------- END --------------------------------------