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.

183 lines
4.8 KiB

  1. /*++ BUILD Version: 001 // Increment this if a change has global effects
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name :
  4. mib.h
  5. Abstract:
  6. Generic Macros and Functions for SNMP Extension Agent for
  7. gathering statistics information for Internet Services on NT.
  8. Author:
  9. Murali R. Krishnan ( MuraliK ) 22-Feb-1995
  10. Environment:
  11. User Mode -- Win32
  12. Project:
  13. Gopher Server SNMP MIB DLL
  14. Revision History:
  15. --*/
  16. # ifndef _MIB_H_
  17. # define _MIB_H_
  18. /************************************************************
  19. * Include Headers
  20. ************************************************************/
  21. #include <windows.h>
  22. #include <snmp.h>
  23. #include <lm.h>
  24. #include <iisinfo.h>
  25. /************************************************************
  26. * Symbolic Constants
  27. ************************************************************/
  28. //
  29. // MIB function actions.
  30. //
  31. #define MIB_GET ( ASN_RFC1157_GETREQUEST)
  32. #define MIB_SET ( ASN_RFC1157_SETREQUEST)
  33. #define MIB_GETNEXT ( ASN_RFC1157_GETNEXTREQUEST)
  34. #define MIB_GETFIRST ( ASN_PRIVATE | ASN_CONSTRUCTOR | 0x0 )
  35. //
  36. // MIB Variable access privileges.
  37. //
  38. #define MIB_ACCESS_READ 0
  39. #define MIB_ACCESS_WRITE 1
  40. #define MIB_ACCESS_READWRITE 2
  41. #define MIB_NOACCESS 3
  42. /************************************************************
  43. * Type Definitions
  44. ************************************************************/
  45. typedef UINT ( * LPMIBFUNC)(
  46. RFC1157VarBind * pRfcVarBind,
  47. UINT Action,
  48. struct _MIB_ENTRY * pMibeCurrent,
  49. struct _MIB_ENTRIES* pMibEntries,
  50. LPVOID pStatistics
  51. );
  52. typedef struct _MIB_ENTRY {
  53. AsnObjectIdentifier asnOid; // OID for mib variable
  54. LONG lFieldOffset; // filed offset
  55. UINT uiAccess; // type of accesss( R, W, R/W, None)
  56. LPMIBFUNC pMibFunc; // ptr to function managing this var.
  57. BYTE bType; // Type( integer, counter, gauage).
  58. } MIB_ENTRY, FAR * LPMIB_ENTRY;
  59. typedef struct _MIB_ENTRIES {
  60. AsnObjectIdentifier * pOidPrefix; // Oid with prefix for MIB ENTRIES
  61. int cMibEntries; // count of MIB_ENTRIES in the array
  62. LPMIB_ENTRY prgMibEntry; // ptr to array of MIB_ENTRIES
  63. } MIB_ENTRIES, FAR * LPMIB_ENTRIES;
  64. /************************************************************
  65. * Macros convenient for defining above MIB_ENTRY objects
  66. ************************************************************/
  67. //
  68. // GET_OID_LENGTH( oid) gets the length of the oid.
  69. //
  70. # define GET_OID_LENGTH( oid) ((oid).idLength)
  71. //
  72. // Macro to determine number of sub-oid's in an array of UINTs.
  73. //
  74. #define OID_SIZEOF( uiArray ) ( sizeof( uiArray) / sizeof(UINT) )
  75. //
  76. // OID_FROM_UINT_ARRAY(): Macro to define OID from an Array of UINTs
  77. //
  78. # define OID_FROM_UINT_ARRAY( uiArray) { OID_SIZEOF( uiArray), uiArray }
  79. //
  80. // Macros for creating MIB Entries ( as specified in struct _MIB_ENTRY above)
  81. // MIB_ENTRY_HEADER: creates a generic MIB_ENTRY for a MIB group header.
  82. // MIB_ENTRY_ITEM: creates a generic MIB_ENTRY for a MIB variable.
  83. // MIB_COUNTER: creates a counter type MIB_ENTRY
  84. // MIB_INTEGER: creates an integer type MIB_ENTRY
  85. //
  86. # define MIB_ENTRY_HEADER( oid) \
  87. { oid, \
  88. -1, \
  89. MIB_NOACCESS, \
  90. NULL, \
  91. ASN_RFC1155_OPAQUE, \
  92. }
  93. # define MIB_ENTRY_ITEM( oid, offset, access, type, func) \
  94. { oid, \
  95. offset, \
  96. access, \
  97. ( func), \
  98. ( type), \
  99. }
  100. # define MIB_COUNTER( oid, field, func) \
  101. MIB_ENTRY_ITEM( oid, field, MIB_ACCESS_READ, ASN_RFC1155_COUNTER, func)
  102. # define MIB_INTEGER( oid, field, func) \
  103. MIB_ENTRY_ITEM( oid, field, MIB_ACCESS_READ, ASN_INTEGER, func)
  104. /************************************************************
  105. * Function Prototypes
  106. ************************************************************/
  107. UINT
  108. ResolveVarBinding(
  109. IN OUT RFC1157VarBind * pRfcVarBinding,
  110. IN BYTE pduAction,
  111. IN LPVOID pStatistics,
  112. IN LPMIB_ENTRIES pMibEntries
  113. );
  114. UINT
  115. MibStatisticsWorker(
  116. IN OUT RFC1157VarBind * pRfcVarBinding,
  117. IN UINT pduAction,
  118. IN struct _MIB_ENTRY * pMibeCurrent,
  119. IN struct _MIB_ENTRIES * pMibEntries,
  120. IN LPVOID pStatistics
  121. );
  122. # endif // _MIB_H_
  123. /************************ End of File ***********************/