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.

407 lines
13 KiB

  1. /* smint.h v0.10
  2. // Copyright (C) 1992-1995, All Rights Reserved, by
  3. // Digital Equipment Corporation, Maynard, Mass.
  4. //
  5. // This software is furnished under a license and may be used and copied
  6. // only in accordance with the terms of such license and with the
  7. // inclusion of the above copyright notice. This software or any other
  8. // copies thereof may not be provided or otherwise made available to any
  9. // other person. No title to and ownership of the software is hereby
  10. // transferred.
  11. //
  12. // The information in this software is subject to change without notice
  13. // and should not be construed as a commitment by Digital Equipment
  14. // Corporation.
  15. //
  16. // Digital assumes no responsibility for the use or reliability of its
  17. // software on equipment which is not supplied by Digital.
  18. */
  19. /*
  20. * Facility:
  21. *
  22. * SNMP Extension Agent
  23. *
  24. * Abstract:
  25. *
  26. * This module contains the native data type definitions. This file
  27. * is taken from the Calaveras Project's system management work done by
  28. * Wayne Duso. By using these native data types (Structure of Management
  29. * Information (SMI)) it is intended to align the management APIs on
  30. * the Windows NT and UNIX platforms as closely as possible.
  31. */
  32. #if !defined(_SMINT_H_)
  33. #define _SMINT_H_
  34. #if !defined(lint) && defined(INCLUDE_ALL_RCSID)
  35. static char smitydef_h_rcsid[] = "$Header: /calsrv/usr/cal10/duso/calaveras/RCS/smint.h,v 1.6 1993/08/13 15:29:49 duso Exp $";
  36. #endif
  37. /*
  38. // FACILITY:
  39. //
  40. // Calaveras System Management
  41. //
  42. // ABSTRACT:
  43. //
  44. // Structure Of Management Information (SMI) support. Specifically, type
  45. // declarations targeted for Management Agent use.
  46. //
  47. // AUTHORS:
  48. //
  49. // Wayne W. Duso
  50. //
  51. // CREATION DATE:
  52. //
  53. // 25-November-1992
  54. //
  55. // MODIFICATION HISTORY:
  56. //
  57. // $Log: smitydef.h,v $
  58. * Revision 1.7 1994/03/23 14:02:00 miriam
  59. * Modifications for Windows NT platform
  60. *
  61. * Revision 1.6 1993/08/13 15:29:49 duso
  62. * Housekeeping.
  63. *
  64. * Revision 1.5 1993/03/11 21:26:51 duso
  65. * Modify interface types to reflect CA X1.1.1 changes.
  66. *
  67. * Revision 1.4 1993/03/10 17:36:26 duso
  68. * Fix free bug resulting from using MOSS to create opaque structures and not
  69. * using MOSS to free said structures. Manipulation of MOSS opaque structures
  70. * now done using MOSS supplied routines exclusively. In the spirit of
  71. * providing opaque types with a 'complete' API, a create() operations has been
  72. * added to each SMI supported type.
  73. *
  74. * Revision 1.3 1993/02/22 18:12:58 duso
  75. * Support for all SNMP SMI types now in place. Also exclusive copy passed from
  76. * avlToLocal; not reference copy. This 'inefficiency' was needed to support
  77. * structure types (length, value). Said types could not be mutated from an
  78. * avl octet to their true form using references.
  79. *
  80. * Revision 1.2 1993/01/28 21:45:24 duso
  81. * Major clean up and completion to support SNMP centered MOMStub and class
  82. * Simple test MOC.
  83. */
  84. /*
  85. // TABLE OF CONTENTS
  86. //
  87. // Associated Documents
  88. //
  89. // Usage/Design Notes
  90. //
  91. // Include Files
  92. //
  93. // SMI Supported Types (typedef(s))
  94. // BIDT_ENUMERATION
  95. // ConstructionStart
  96. // ConstructionEnd
  97. // Counter
  98. // Gauge
  99. // Integer
  100. // IpAddress
  101. // Null
  102. // ObjectIdentifier
  103. // OctetString
  104. // Opaque
  105. // TimeTicks
  106. */
  107. /*
  108. // Associated Documents
  109. //
  110. // [1] Calaveras Managed Object Module Framework Design Specification
  111. // [2] smidbty.h: Declares the pseudo abstract base psuedo class DtEntry and
  112. // its API.
  113. // [3] smitypes.h: Declares actual instances of DtEntry, one for each typed
  114. // delcared in this file.
  115. */
  116. /*
  117. // Usage/Design Notes
  118. //
  119. // 1. Each type declared in this file has an accompanying API. The APIs
  120. // are declared in [2,3]. It is strongly recommended that type instances
  121. // be accessed through their API, not through direct manipulation of
  122. // their internal format [NB: Additional operations must be added to the
  123. // API set to make the type's concrete/indiginous-like. Specifically,
  124. // there currently is no 'compare' interface; this must/will be corrected].
  125. //
  126. // 2. For each SMI type supported - those being any type defined by either
  127. // RFC 1155 or by additions to said RFC accepted by the IETF - there is a
  128. // typedef defining its 'in-memory' or 'local' representation. This
  129. // information is made available to the SMI type database, the managed
  130. // object module stub, and managed object classes (management agents)
  131. // through this module.
  132. */
  133. /*
  134. // Include Files
  135. */
  136. #include <snmp.h>
  137. /*
  138. // SMI Supported Types (typedef(s))
  139. */
  140. typedef enum
  141. {
  142. nsm_true = 1 ,
  143. nsm_false = 2
  144. } NSM_Boolean ;
  145. typedef int BIDT_ENUMERATION;
  146. /* Signed 32 bit integer is the base data construct used by the MIR to
  147. // represent integer enumerations.
  148. */
  149. typedef unsigned long int Counter;
  150. /* Unsigned 32 bit integer is the base data construct.
  151. */
  152. typedef unsigned long int Gauge;
  153. /* Unsigned 32 bit integer is the base data construct.
  154. */
  155. typedef int Integer;
  156. /* Signed 32 bit integer is the base data construct.
  157. */
  158. typedef unsigned long int IpAddress;
  159. /* Unsigned 32 bit integer is the base data construct. Interpret as
  160. // a 4 octet hex value.
  161. */
  162. typedef char Null;
  163. /* The semantics of Null are that it should always be a 0 constant.
  164. */
  165. typedef AsnObjectIdentifier ObjectIdentifier;
  166. /*
  167. // Aggregate type: Note that this is typedef to the Windows NT's version
  168. // of an object identifier to enable use with the Windows NT SNMP routines.
  169. // The Common Agent's MOSS library is not available for use on Windows NT.
  170. //
  171. // The fields for the object identifier are:
  172. // UINT idLength ; // number of integers in the oid's int array
  173. // UINT *ids ; // address of the oid's int array
  174. */
  175. typedef struct
  176. /*
  177. // This one is used to minimize differences across platforms and because
  178. // Windows NT has no support routines for manipulating an octet string.
  179. // Should that change consideration should be given to using the native
  180. // for as the Common Agent is not available on Windows NT.
  181. // Aggregate type: Note that this is structured exactly as the CA MOSS
  182. // definition octet_string found in moss.h. As such, it should either be
  183. // removed in favor of that definition or its synchronization must be
  184. // ensured.
  185. */
  186. {
  187. int length; /* length of string */
  188. unsigned long int dataType; /* ASN.1 data type tag (currently optional)*/
  189. char* string; /* pointer to counted string */
  190. } OctetString;
  191. typedef struct
  192. /*
  193. // Aggregate type
  194. */
  195. {
  196. int length; /* length of string */
  197. char* string; /* pointer to counted entity */
  198. } Opaque;
  199. typedef unsigned long int TimeTicks;
  200. /* Unsigned 32 bit integer is the base data construct.
  201. */
  202. typedef OctetString Simple_DisplayString ;
  203. /* Included here as oppose to in the simpleema.hxx file on Calaveras to
  204. // reduce the number of header files.
  205. */
  206. typedef int Access_Credential ;
  207. /* This is a dummy place holder for use in the future
  208. */
  209. typedef struct
  210. {
  211. unsigned int count ; /* number of identifying variables for an instance */
  212. char **array ; /* array of pointers to variables' data */
  213. } InstanceName ;
  214. /* This is a flexible structure for passing the ordered native datatypes
  215. // that compose the instance name. For example,
  216. // tcpConnEntry from RFC 1213 p. 49 (MIB-II) is identified by
  217. //
  218. // INDEX {
  219. // tcpConnLocalAddress,
  220. // tcpConnLocalPort,
  221. // tcpConnRemAddress,
  222. // tcpConnRemPort
  223. // }
  224. //
  225. // The instance name would be an ordered set :
  226. //
  227. // count = 4
  228. // array[ 0 ] = address of an IP Address (the local ip address)
  229. // array[ 1 ] = address of an Integer (the local port)
  230. // array[ 2 ] = address of an IP Address (the remote ip address)
  231. // array[ 3 ] = address of an Integer (the remote port)
  232. */
  233. #define MAX_OCTET_STRING 256
  234. UINT
  235. SMIGetInteger( IN OUT RFC1157VarBind *VarBind , // Variable Binding for get
  236. IN unsigned long int cindex ,
  237. IN unsigned long int vindex ,
  238. IN InstanceName *instance );
  239. UINT
  240. SMIGetNSMBoolean( IN OUT RFC1157VarBind *VarBind , // Variable Binding for get
  241. IN unsigned long int cindex ,
  242. IN unsigned long int vindex ,
  243. IN InstanceName *instance );
  244. UINT
  245. SMIGetBIDTEnum( IN OUT RFC1157VarBind *VarBind , // Variable Binding for get
  246. IN unsigned long int cindex ,
  247. IN unsigned long int vindex ,
  248. IN InstanceName *instance );
  249. UINT
  250. SMIGetOctetString( IN OUT RFC1157VarBind *VarBind , // Variable Binding for get
  251. IN unsigned long int cindex ,
  252. IN unsigned long int vindex ,
  253. IN InstanceName *instance );
  254. UINT
  255. SMIGetObjectId( IN OUT RFC1157VarBind *VarBind , // Variable Binding for get
  256. IN unsigned long int cindex ,
  257. IN unsigned long int vindex ,
  258. IN InstanceName *instance );
  259. UINT
  260. SMIGetCounter( IN OUT RFC1157VarBind *VarBind , // Variable Binding for get
  261. IN unsigned long int cindex ,
  262. IN unsigned long int vindex ,
  263. IN InstanceName *instance );
  264. UINT
  265. SMIGetGauge( IN OUT RFC1157VarBind *VarBind , // Variable Binding for get
  266. IN unsigned long int cindex ,
  267. IN unsigned long int vindex ,
  268. IN InstanceName *instance );
  269. UINT
  270. SMIGetTimeTicks( IN OUT RFC1157VarBind *VarBind , // Variable Binding for get
  271. IN unsigned long int cindex ,
  272. IN unsigned long int vindex ,
  273. IN InstanceName *instance );
  274. UINT
  275. SMIGetIpAddress( IN OUT RFC1157VarBind *VarBind , // Variable Binding for get
  276. IN unsigned long int cindex ,
  277. IN unsigned long int vindex ,
  278. IN InstanceName *instance );
  279. UINT
  280. SMIGetDispString( IN OUT RFC1157VarBind *VarBind , // Variable Binding for get
  281. IN unsigned long int cindex ,
  282. IN unsigned long int vindex ,
  283. IN InstanceName *instance );
  284. UINT
  285. SMISetInteger( IN OUT RFC1157VarBind *VarBind , // Variable Binding for set
  286. IN unsigned long int cindex ,
  287. IN unsigned long int vindex ,
  288. IN InstanceName *instance );
  289. UINT
  290. SMISetNSMBoolean( IN OUT RFC1157VarBind *VarBind , // Variable Binding for set
  291. IN unsigned long int cindex ,
  292. IN unsigned long int vindex ,
  293. IN InstanceName *instance );
  294. UINT
  295. SMISetBIDTEnum( IN OUT RFC1157VarBind *VarBind , // Variable Binding for set
  296. IN unsigned long int cindex ,
  297. IN unsigned long int vindex ,
  298. IN InstanceName *instance );
  299. UINT
  300. SMISetOctetString( IN OUT RFC1157VarBind *VarBind , // Variable Binding for set
  301. IN unsigned long int cindex ,
  302. IN unsigned long int vindex ,
  303. IN InstanceName *instance );
  304. UINT
  305. SMISetObjectId( IN OUT RFC1157VarBind *VarBind , // Variable Binding for set
  306. IN unsigned long int cindex ,
  307. IN unsigned long int vindex ,
  308. IN InstanceName *instance );
  309. UINT
  310. SMISetCounter( IN OUT RFC1157VarBind *VarBind , // Variable Binding for set
  311. IN unsigned long int cindex ,
  312. IN unsigned long int vindex ,
  313. IN InstanceName *instance );
  314. UINT
  315. SMISetGauge( IN OUT RFC1157VarBind *VarBind , // Variable Binding for set
  316. IN unsigned long int cindex ,
  317. IN unsigned long int vindex ,
  318. IN InstanceName *instance );
  319. UINT
  320. SMISetTimeTicks( IN OUT RFC1157VarBind *VarBind , // Variable Binding for set
  321. IN unsigned long int cindex ,
  322. IN unsigned long int vindex ,
  323. IN InstanceName *instance );
  324. UINT
  325. SMISetIpAddress( IN OUT RFC1157VarBind *VarBind , // Variable Binding for set
  326. IN unsigned long int cindex ,
  327. IN unsigned long int vindex ,
  328. IN InstanceName *instance );
  329. UINT
  330. SMISetDispString( IN OUT RFC1157VarBind *VarBind , // Variable Binding for set
  331. IN unsigned long int cindex ,
  332. IN unsigned long int vindex ,
  333. IN InstanceName *instance );
  334. UINT
  335. SMIBuildInteger( IN OUT RFC1157VarBind *VarBind ,
  336. IN char *invalue );
  337. UINT
  338. SMIBuildOctetString( IN OUT RFC1157VarBind *VarBind ,
  339. IN char *invalue );
  340. UINT
  341. SMIBuildObjectId( IN OUT RFC1157VarBind *VarBind ,
  342. IN char *invalue );
  343. UINT
  344. SMIBuildCounter( IN OUT RFC1157VarBind *VarBind ,
  345. IN char *invalue );
  346. UINT
  347. SMIBuildGauge( IN OUT RFC1157VarBind *VarBind ,
  348. IN char *invalue );
  349. UINT
  350. SMIBuildTimeTicks( IN OUT RFC1157VarBind *VarBind ,
  351. IN char *invalue );
  352. UINT
  353. SMIBuildIpAddress( IN OUT RFC1157VarBind *VarBind ,
  354. IN char *invalue );
  355. UINT
  356. SMIBuildDispString( IN OUT RFC1157VarBind *VarBind ,
  357. IN char *invalue );
  358. void
  359. SMIFree( IN AsnAny *invalue );
  360. #endif /*_SMINT_H_*/