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.

284 lines
7.1 KiB

  1. /*++
  2. Copyright (c) 1992-1997 Microsoft Corporation
  3. Module Name:
  4. globals.h
  5. Abstract:
  6. Contains global definitions for SNMP master agent.
  7. Environment:
  8. User Mode - Win32
  9. Revision History:
  10. 10-Feb-1997 DonRyan
  11. Rewrote to implement SNMPv2 support.
  12. --*/
  13. #ifndef _GLOBALS_H_
  14. #define _GLOBALS_H_
  15. ///////////////////////////////////////////////////////////////////////////////
  16. // //
  17. // Include files //
  18. // //
  19. ///////////////////////////////////////////////////////////////////////////////
  20. #include <nt.h>
  21. #include <ntrtl.h>
  22. #include <nturtl.h>
  23. #include <tchar.h>
  24. #include <windef.h>
  25. #include <winsvc.h>
  26. #include <winsock2.h>
  27. #include <ws2tcpip.h>
  28. #include <wsipx.h>
  29. #include <snmputil.h>
  30. #include "snmpevts.h"
  31. #include "args.h"
  32. #include "mem.h"
  33. ///////////////////////////////////////////////////////////////////////////////
  34. // //
  35. // Private definitions //
  36. // //
  37. ///////////////////////////////////////////////////////////////////////////////
  38. #define SHUTDOWN_WAIT_HINT 5000
  39. ///////////////////////////////////////////////////////////////////////////////
  40. // //
  41. // Global variables //
  42. // //
  43. ///////////////////////////////////////////////////////////////////////////////
  44. extern DWORD g_dwUpTimeReference;
  45. extern HANDLE g_hTerminationEvent;
  46. extern HANDLE g_hRegistryEvent;
  47. extern HANDLE g_hDefaultRegNotifier;
  48. extern HKEY g_hDefaultKey;
  49. extern HANDLE g_hPolicyRegNotifier;
  50. extern HKEY g_hPolicyKey;
  51. extern LIST_ENTRY g_Subagents;
  52. extern LIST_ENTRY g_SupportedRegions;
  53. extern LIST_ENTRY g_ValidCommunities;
  54. extern LIST_ENTRY g_TrapDestinations;
  55. extern LIST_ENTRY g_PermittedManagers;
  56. extern LIST_ENTRY g_IncomingTransports;
  57. extern LIST_ENTRY g_OutgoingTransports;
  58. extern CRITICAL_SECTION g_RegCriticalSectionA;
  59. extern CRITICAL_SECTION g_RegCriticalSectionB;
  60. extern CRITICAL_SECTION g_RegCriticalSectionC;
  61. extern CMD_LINE_ARGUMENTS g_CmdLineArguments;
  62. ///////////////////////////////////////////////////////////////////////////////
  63. // //
  64. // Registry definitions //
  65. // //
  66. ///////////////////////////////////////////////////////////////////////////////
  67. #define REG_POLICY_ROOT \
  68. TEXT("SOFTWARE\\Policies")
  69. #define REG_POLICY_PARAMETERS \
  70. TEXT("SOFTWARE\\Policies\\SNMP\\Parameters")
  71. #define REG_POLICY_VALID_COMMUNITIES \
  72. REG_POLICY_PARAMETERS TEXT("\\ValidCommunities")
  73. #define REG_POLICY_TRAP_DESTINATIONS \
  74. REG_POLICY_PARAMETERS TEXT("\\TrapConfiguration")
  75. #define REG_POLICY_PERMITTED_MANAGERS \
  76. REG_POLICY_PARAMETERS TEXT("\\PermittedManagers")
  77. #define REG_KEY_SNMP_PARAMETERS \
  78. TEXT("SYSTEM\\CurrentControlSet\\Services\\SNMP\\Parameters")
  79. #define REG_KEY_EXTENSION_AGENTS \
  80. REG_KEY_SNMP_PARAMETERS TEXT("\\ExtensionAgents")
  81. #define REG_KEY_VALID_COMMUNITIES \
  82. REG_KEY_SNMP_PARAMETERS TEXT("\\ValidCommunities")
  83. #define REG_KEY_TRAP_DESTINATIONS \
  84. REG_KEY_SNMP_PARAMETERS TEXT("\\TrapConfiguration")
  85. #define REG_KEY_PERMITTED_MANAGERS \
  86. REG_KEY_SNMP_PARAMETERS TEXT("\\PermittedManagers")
  87. #define REG_KEY_MIB2 \
  88. REG_KEY_SNMP_PARAMETERS TEXT("\\RFC1156Agent")
  89. #define REG_VALUE_SUBAGENT_PATH "Pathname"
  90. #define REG_VALUE_AUTH_TRAPS TEXT("EnableAuthenticationTraps")
  91. #define REG_VALUE_MGRRES_COUNTER TEXT("NameResolutionRetries")
  92. #define REG_VALUE_SYS_OBJECTID TEXT("sysObjectID")
  93. #define MAX_VALUE_NAME_LEN 256
  94. #define MAX_VALUE_DATA_LEN 256
  95. ///////////////////////////////////////////////////////////////////////////////
  96. // //
  97. // Miscellaneous definitions //
  98. // //
  99. ///////////////////////////////////////////////////////////////////////////////
  100. #define PDUTYPESTRING(nPduType) \
  101. ((nPduType == SNMP_PDU_GETNEXT) \
  102. ? "getnext" \
  103. : (nPduType == SNMP_PDU_GETBULK) \
  104. ? "getbulk" \
  105. : (nPduType == SNMP_PDU_GET) \
  106. ? "get" \
  107. : (nPduType == SNMP_PDU_SET) \
  108. ? "set" \
  109. : "unknown")
  110. #define SNMPERRORSTRING(nErr) \
  111. ((nErr == SNMP_ERRORSTATUS_NOERROR) \
  112. ? "NOERROR" \
  113. : (nErr == SNMP_ERRORSTATUS_GENERR) \
  114. ? "GENERR" \
  115. : (nErr == SNMP_ERRORSTATUS_NOSUCHNAME) \
  116. ? "NOSUCHNAME" \
  117. : (nErr == SNMP_ERRORSTATUS_NOTWRITABLE) \
  118. ? "NOTWRITABLE" \
  119. : (nErr == SNMP_ERRORSTATUS_TOOBIG) \
  120. ? "TOOBIG" \
  121. : (nErr == SNMP_ERRORSTATUS_BADVALUE) \
  122. ? "BADVALUE" \
  123. : (nErr == SNMP_ERRORSTATUS_READONLY) \
  124. ? "READONLY" \
  125. : (nErr == SNMP_ERRORSTATUS_WRONGTYPE) \
  126. ? "WRONGTYPE" \
  127. : (nErr == SNMP_ERRORSTATUS_WRONGLENGTH) \
  128. ? "WRONGLENGTH" \
  129. : (nErr == SNMP_ERRORSTATUS_WRONGENCODING) \
  130. ? "WRONGENCODING" \
  131. : (nErr == SNMP_ERRORSTATUS_WRONGVALUE) \
  132. ? "WRONGVALUE" \
  133. : (nErr == SNMP_ERRORSTATUS_NOCREATION) \
  134. ? "NOCREATION" \
  135. : (nErr == SNMP_ERRORSTATUS_INCONSISTENTVALUE) \
  136. ? "INCONSISTENTVALUE" \
  137. : (nErr == SNMP_ERRORSTATUS_RESOURCEUNAVAILABLE) \
  138. ? "RESOURCEUNAVAILABLE" \
  139. : (nErr == SNMP_ERRORSTATUS_COMMITFAILED) \
  140. ? "COMMITFAILED" \
  141. : (nErr == SNMP_ERRORSTATUS_UNDOFAILED) \
  142. ? "UNDOFAILED" \
  143. : (nErr == SNMP_ERRORSTATUS_AUTHORIZATIONERROR) \
  144. ? "AUTHORIZATIONERROR" \
  145. : (nErr == SNMP_ERRORSTATUS_NOACCESS) \
  146. ? "NOACCESS" \
  147. : (nErr == SNMP_ERRORSTATUS_INCONSISTENTNAME) \
  148. ? "INCONSISTENTNAME" \
  149. : "unknown")
  150. #endif // _GLOBALS_H_