Leaked source code of windows server 2003
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.

359 lines
12 KiB

  1. /*
  2. * HrSWInstalled.c v0.10
  3. * Generated in conjunction with Management Factory scripts:
  4. * script version: SNMPv1, 0.16, Apr 25, 1996
  5. * project: D:\TEMP\EXAMPLE\HOSTMIB
  6. ****************************************************************************
  7. * *
  8. * (C) Copyright 1995 DIGITAL EQUIPMENT CORPORATION *
  9. * *
  10. * This software is an unpublished work protected under the *
  11. * the copyright laws of the United States of America, all *
  12. * rights reserved. *
  13. * *
  14. * In the event this software is licensed for use by the United *
  15. * States Government, all use, duplication or disclosure by the *
  16. * United States Government is subject to restrictions as set *
  17. * forth in either subparagraph (c)(1)(ii) of the Rights in *
  18. * Technical Data And Computer Software Clause at DFARS *
  19. * 252.227-7013, or the Commercial Computer Software Restricted *
  20. * Rights Clause at FAR 52.221-19, whichever is applicable. *
  21. * *
  22. ****************************************************************************
  23. *
  24. * Facility:
  25. *
  26. * Windows NT SNMP Extension Agent
  27. *
  28. * Abstract:
  29. *
  30. * This module contains the code for dealing with the get, set, and
  31. * instance name routines for the HrSWInstalled. Actual instrumentation code is
  32. * supplied by the developer.
  33. *
  34. * Functions:
  35. *
  36. * A get and set routine for each attribute in the class.
  37. *
  38. * The routines for instances within the class.
  39. *
  40. * Author:
  41. *
  42. * D. D. Burns @ Webenable Inc
  43. *
  44. * Revision History:
  45. *
  46. * V1.00 - 04/27/97 D. D. Burns Genned: Thu Nov 07 16:48:30 1996
  47. *
  48. */
  49. #include <windows.h>
  50. #include <malloc.h>
  51. #include <snmp.h>
  52. #include "mib.h"
  53. #include "smint.h"
  54. #include "hostmsmi.h"
  55. #include "user.h" /* Developer supplied include file */
  56. /*
  57. * GetHrSWInstalledLastChange
  58. * The value of sysUpTime when an entry in the hrSWInstalledTable was last
  59. * added, renamed, or deleted. Because this table is likel
  60. *
  61. * Gets the value for HrSWInstalledLastChange.
  62. *
  63. * Arguments:
  64. *
  65. * outvalue address to return variable value
  66. * accesss Reserved for future security use
  67. * instance address of instance name as ordered native
  68. * data type(s)
  69. *
  70. * Return Codes:
  71. *
  72. * Standard PDU error codes.
  73. *
  74. * SNMP_ERRORSTATUS_NOERROR Successful get
  75. * SNMP_ERRORSTATUS_GENERR Catch-all failure code
  76. * mibtget.c v0.10
  77. *
  78. | =============== From WebEnable Design Spec Rev 3 04/11/97==================
  79. | hrSWInstalledLastChange
  80. |
  81. | ACCESS SYNTAX
  82. | read-only TimeTicks
  83. |
  84. | "The value of sysUpTime when an entry in the hrSWInstalledTable was last
  85. | added, renamed, or deleted. Because this table is likely to contain many
  86. | entries, polling of this object allows a management station to determine when
  87. | re-downloading of the table might be useful."
  88. |
  89. |============================================================================
  90. | Decision is made to report the current value of sysUpTime as a means of
  91. | signalling the SNMP Manager that "whatever he's got now, he should ask
  92. | for the latest". Our cache of installed software is never updated after
  93. | the agent comes up in the first release.
  94. |============================================================================
  95. | 1.3.6.1.2.1.25.6.1.0....
  96. | | |
  97. | | *hrSWInstalledLastChange
  98. | *-hrSWInstalled
  99. */
  100. UINT
  101. GetHrSWInstalledLastChange(
  102. OUT TimeTicks *outvalue ,
  103. IN Access_Credential *access ,
  104. IN InstanceName *instance )
  105. {
  106. *outvalue = SnmpSvcGetUptime();
  107. return SNMP_ERRORSTATUS_NOERROR ;
  108. } /* end of GetHrSWInstalledLastChange() */
  109. /*
  110. * GetHrSWInstalledLastUpdateTime
  111. * The value of sysUpTime when the hrSWInstalledTAble was last completely
  112. * updated. Because caching of this data will be a popular
  113. *
  114. * Gets the value for HrSWInstalledLastUpdateTime.
  115. *
  116. * Arguments:
  117. *
  118. * outvalue address to return variable value
  119. * accesss Reserved for future security use
  120. * instance address of instance name as ordered native
  121. * data type(s)
  122. *
  123. * Return Codes:
  124. *
  125. * Standard PDU error codes.
  126. *
  127. * SNMP_ERRORSTATUS_NOERROR Successful get
  128. * SNMP_ERRORSTATUS_GENERR Catch-all failure code
  129. * mibtget.c v0.10
  130. *
  131. | =============== From WebEnable Design Spec Rev 3 04/11/97==================
  132. | hrSWInstalledLastUpdateTime
  133. |
  134. | ACCESS SYNTAX
  135. | read-only TimeTicks
  136. |
  137. | "The value of sysUpTime when the hrSWInstalledTable was last completely
  138. | updated. Because caching of this data will be a popular implementation
  139. | strategy, retrieval of this object allows a management station to obtain a
  140. | guarantee that no data in this table is older than the indicated time."
  141. |
  142. |============================================================================
  143. | Decision is made to report the current value of sysUpTime as a means of
  144. | signalling the SNMP Manager that "whatever he's got now, he should ask
  145. | for the latest". Our cache of installed software is never updated after
  146. | the agent comes up in the first release.
  147. |============================================================================
  148. | 1.3.6.1.2.1.25.6.2.0....
  149. | | |
  150. | | *hrSWInstalledLastUpdateTime
  151. | *-hrSWInstalled
  152. */
  153. UINT
  154. GetHrSWInstalledLastUpdateTime(
  155. OUT TimeTicks *outvalue ,
  156. IN Access_Credential *access ,
  157. IN InstanceName *instance )
  158. {
  159. *outvalue = SnmpSvcGetUptime();
  160. return SNMP_ERRORSTATUS_NOERROR ;
  161. } /* end of GetHrSWInstalledLastUpdateTime() */
  162. /*
  163. * HrSWInstalledFindInstance
  164. *
  165. * This routine is used to verify that the specified instance is
  166. * valid.
  167. *
  168. * Arguments:
  169. *
  170. * FullOid Address for the full oid - group, variable,
  171. * and instance information
  172. * instance Address for instance specification as an oid
  173. *
  174. * Return Codes:
  175. *
  176. * SNMP_ERRORSTATUS_NOERROR Instance found and valid
  177. * SNMP_ERRORSTATUS_NOSUCHNAME Invalid instance
  178. *
  179. */
  180. UINT
  181. HrSWInstalledFindInstance( IN ObjectIdentifier *FullOid ,
  182. IN OUT ObjectIdentifier *instance )
  183. {
  184. UINT tmp_instance ;
  185. //
  186. // Developer instrumentation code to find appropriate instance goes here.
  187. // For non-tables, it is not necessary to modify this routine. However, if
  188. // there is any context that needs to be set, it can be done here.
  189. //
  190. if ( FullOid->idLength <= HRSWINSTALLED_VAR_INDEX )
  191. // No instance was specified
  192. return SNMP_ERRORSTATUS_NOSUCHNAME ;
  193. else if ( FullOid->idLength != HRSWINSTALLED_VAR_INDEX + 1 )
  194. // Instance length is more than 1
  195. return SNMP_ERRORSTATUS_NOSUCHNAME ;
  196. else
  197. // The only valid instance for a non-table are instance 0. If this
  198. // is a non-table, the following code validates the instances. If this
  199. // is a table, developer modification is necessary below.
  200. tmp_instance = FullOid->ids[ HRSWINSTALLED_VAR_INDEX ] ;
  201. if ( tmp_instance )
  202. return SNMP_ERRORSTATUS_NOSUCHNAME ;
  203. else
  204. {
  205. // the instance is valid. Create the instance portion of the OID
  206. // to be returned from this call.
  207. instance->ids[ 0 ] = tmp_instance ;
  208. instance->idLength = 1 ;
  209. }
  210. return SNMP_ERRORSTATUS_NOERROR ;
  211. } /* end of HrSWInstalledFindInstance() */
  212. /*
  213. * HrSWInstalledFindNextInstance
  214. *
  215. * This routine is called to get the next instance. If no instance
  216. * was passed than return the first instance (1).
  217. *
  218. * Arguments:
  219. *
  220. * FullOid Address for the full oid - group, variable,
  221. * and instance information
  222. * instance Address for instance specification as an oid
  223. *
  224. * Return Codes:
  225. *
  226. * SNMP_ERRORSTATUS_NOERROR Instance found and valid
  227. * SNMP_ERRORSTATUS_NOSUCHNAME Invalid instance
  228. *
  229. */
  230. UINT
  231. HrSWInstalledFindNextInstance( IN ObjectIdentifier *FullOid ,
  232. IN OUT ObjectIdentifier *instance )
  233. {
  234. //
  235. // Developer supplied code to find the next instance of class goes here.
  236. // If this is a class with cardinality 1, no modification of this routine
  237. // is necessary unless additional context needs to be set.
  238. // If the FullOid does not specify an instance, then the only instance
  239. // of the class is returned. If this is a table, the first row of the
  240. // table is returned.
  241. //
  242. // If an instance is specified and this is a non-table class, then NOSUCHNAME
  243. // is returned so that correct MIB rollover processing occurs. If this is
  244. // a table, then the next instance is the one following the current instance.
  245. // If there are no more instances in the table, return NOSUCHNAME.
  246. //
  247. if ( FullOid->idLength <= HRSWINSTALLED_VAR_INDEX )
  248. {
  249. instance->ids[ 0 ] = 0 ;
  250. instance->idLength = 1 ;
  251. }
  252. else
  253. return SNMP_ERRORSTATUS_NOSUCHNAME ;
  254. return SNMP_ERRORSTATUS_NOERROR ;
  255. } /* end of HrSWInstalledFindNextInstance() */
  256. /*
  257. * HrSWInstalledConvertInstance
  258. *
  259. * This routine is used to convert the object id specification of an
  260. * instance into an ordered native representation. The object id format
  261. * is that object identifier that is returned from the Find Instance
  262. * or Find Next Instance routines. It is NOT the full object identifier
  263. * that contains the group and variable object ids as well. The native
  264. * representation is an argc/argv-like structure that contains the
  265. * ordered variables that define the instance. This is specified by
  266. * the MIB's INDEX clause. See RFC 1212 for information about the INDEX
  267. * clause.
  268. *
  269. *
  270. * Arguments:
  271. *
  272. * oid_spec Address of the object id instance specification
  273. * native_spec Address to return the ordered native instance
  274. * specification
  275. *
  276. * Return Codes:
  277. *
  278. * SUCCESS Conversion complete successfully
  279. * FAILURE Unable to convert object id into native format
  280. *
  281. */
  282. UINT
  283. HrSWInstalledConvertInstance( IN ObjectIdentifier *oid_spec ,
  284. IN OUT InstanceName *native_spec )
  285. {
  286. //
  287. // Developer supplied code to convert instance identifer to native
  288. // specification of instance names goes here.
  289. //
  290. return SUCCESS ;
  291. } /* end of HrSWInstalledConvertInstance() */
  292. /*
  293. * HrSWInstalledFreeInstance
  294. *
  295. * This routine is used to free an ordered native representation of an
  296. * instance name.
  297. *
  298. * Arguments:
  299. *
  300. * instance Address to return the ordered native instance
  301. * specification
  302. *
  303. * Return Codes:
  304. *
  305. *
  306. */
  307. void
  308. HrSWInstalledFreeInstance( IN OUT InstanceName *instance )
  309. {
  310. //
  311. // Developer supplied code to free native representation of instance name goes here.
  312. //
  313. } /* end of HrSWInstalledFreeInstance() */