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.

174 lines
6.2 KiB

  1. README.txt
  2. Author: Murali R. Krishnan (MuraliK)
  3. Created: 23 Feb, 1995
  4. Revisions:
  5. Date By Comments
  6. ----------------- -------- -------------------------------------------
  7. Summary :
  8. This file describes the files in the directory nt\private\net\snmp\gophmib
  9. and details related to SNMP Extension Agent for Gopher Service
  10. File Description
  11. ----------------------------------------------------------------------
  12. README.txt This file.
  13. makefile NT build files
  14. sources NT build files
  15. main.c Defines the standard entry points for SNMP Extensions
  16. and the Gopher MIB object.
  17. mib.h Defines types for generic resolve code for passive GET
  18. and GET_NEXT verbs in MIB query. Also defined are a
  19. few macros.
  20. mib.c Functions required for generic MIB resolution.
  21. dbgutil.h Header file containing declarations for debugging purposes
  22. during development. It contains constants and macros.
  23. pudebug.h Header file detailing debugging structures and
  24. functions used by dbgutil.h
  25. pudebug.c Implements functions declared in pudebug.h
  26. During a -DDBG ( debug) build, we need pudebug.c to be included.
  27. For Non-Debug builds, we dont need the pudebug.c and dbgutil.h
  28. suitably modifies the declarations and macros for smoother compilation.
  29. Implementation Details
  30. -----------------------
  31. Contents:
  32. 1. Comments on SNMP Extension APIs.
  33. 2. Structure of MIB For Internet Services
  34. 3. Components For SNMP MIBs and Installation
  35. 4. How To Test the SNMP MIBs?
  36. 5. Why separate mib.c and mib.h ( Implementation perspective).
  37. 1. Comments on SNMP Extension APIs:
  38. In NT the SNMP Extension DLL should provide three entry points:
  39. SnmpExtensionInit()
  40. SnmpExtensionTrap()
  41. SnmpExtensionQuery()
  42. As to be expected :(, there is no SnmpExtensionCleanup() API, which means
  43. that there can be no cleanup supplied. And hence for sure we better refrain
  44. from using any dynamic memory, for cleanup is not possible. Maintaining state
  45. is only using static variables.
  46. Also as to be expected, there is no context information that gets circulated
  47. in the calls. Hence the state has to be maintained at the DLL level. There is
  48. no way of identifying the context of the call. Well, let us do it the Great
  49. OLD Way. Throw in global variables and maintain state! Also note that
  50. the DllInit function is not called, since the dll is loaded directly
  51. into memory. This means that we can't also stick init and cleanup
  52. code in the DllInit function.
  53. 2. Structure of MIB for Internet Services.
  54. iso(1)
  55. org(3)
  56. dod(6)
  57. internet(1)
  58. private(4)
  59. enterprises(1)
  60. microsoft(311)
  61. software(1)
  62. InternetServer(7)
  63. InetSrvCommon(1)
  64. InetServStatistics(1)
  65. FtpServer(2)
  66. FtpStatistics(1)
  67. HttpServer(3)
  68. HttpStatistics(1)
  69. GopherServer(4)
  70. GopherStatistics(1)
  71. For details about the counters under GopherServer, Please refer to
  72. ..\mibs\gophmib
  73. 3. Components For SNMP MIBs
  74. a) A MIB File used to map the OIDs ( Object Identifiers) to human
  75. readable strings. NT's mibs live in the directory
  76. \nt\private\net\snmp\mibs. You can find gopherd.mib there.
  77. b) A DLL that actually implements the MIBs. This DLL is responsible
  78. for mapping the request ( Eg: GET <mib oid>) into a real value ( the
  79. value of the object referenced by oid). This is alternatively called
  80. as the SNMP Extension agent, called by the Extendible agents. This DLL
  81. provides the SNMP Extension API entry points for calling. ( See
  82. section 1 for APIs defined). This directory contains the files for the
  83. gdmib.dll used as SNMP Extension agent ( Dir:
  84. \nt\private\net\snmp\gophmib\). This dll should copied to the
  85. directory specified in the registry entry specified below.
  86. c) Registry Entries.
  87. SNMP.EXE uses the registry entries to find the MIB DLLs. To
  88. enable SNMP to find the new mib, create a new registry entry value under:
  89. HKLM\System\CurrentControlSet\Services\SNMP\Parameters\ExtensionAgents
  90. on the local machine. The name of the registry entry value is
  91. irrelevant. The value of the entry created should point to another
  92. registry entry containing all the details for the MIB being installed.
  93. For Example: For the gdmib.dll, the entry created in above registry
  94. value may be:
  95. Server uses
  96. SOFTWARE\Microsoft\InternetServer\GopherServerMIBAgent\CurrentVersion.
  97. Under this entry create a REG_EXPAND_SZ value called "PathName" that
  98. contains the full path to the GDMIB.DLL.
  99. ** Note that "Pathname" is treated as case sensitive!! **
  100. 4. How To Test the SNMP MIBs?
  101. Build the SNMP Extension Agent DLL.
  102. Make entries in the Registry pointing to the location of the DLL.
  103. Start SNMP service.
  104. Use SNMPUTIL to query values from the mib.
  105. Syntax:
  106. snmputil get localhost public <oid>
  107. Eg:
  108. <oid> ::= ".iso.org.dod.internet.private.enterprises.\
  109. microsoft.software.InternetServer.GopherServer.\
  110. GopherStatistics.{variable_name}.0"
  111. or
  112. <oid> ::= ".1.3.6.1.4.1.311.1.7.4.1.{number}.0".
  113. Be sure to remember the trailing zero on either form. It's required.
  114. 5. Why separate mib.c and mib.h ( Implementation perspective).
  115. The files mib.h and mib.c implement functions useful for resolving
  116. MIB variable bindings for reading counter values from a standard
  117. structure. The function support PDU ( Protocol Data Unit) Actions for
  118. GET and GETNEXT. All other operations are unsupported. now.
  119. Initial motivation for rewriting the code is from two facts:
  120. 1) Avoid usage of global variables in the mib.c module
  121. ( so that some one else who need to implement similar
  122. functionality can use the same code.)
  123. 2) Eliminate the need and use of goto's. The code that existed
  124. in ..\ftpmib\mib.c as of 2/24/1995 had a few goto's and long
  125. winded code. This version hopefully addresses to remove some
  126. of these and provide a implementation using hungarian naming
  127. amongst other modifications.
  128.