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.

285 lines
7.4 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 <limits.h> // for UINT_MAX
  31. #include "snmpevts.h"
  32. #include "args.h"
  33. #include "mem.h"
  34. ///////////////////////////////////////////////////////////////////////////////
  35. // //
  36. // Private definitions //
  37. // //
  38. ///////////////////////////////////////////////////////////////////////////////
  39. #define SHUTDOWN_WAIT_HINT 5000
  40. ///////////////////////////////////////////////////////////////////////////////
  41. // //
  42. // Global variables //
  43. // //
  44. ///////////////////////////////////////////////////////////////////////////////
  45. extern DWORD g_dwUpTimeReference;
  46. extern HANDLE g_hTerminationEvent;
  47. extern HANDLE g_hRegistryEvent;
  48. extern HANDLE g_hDefaultRegNotifier;
  49. extern HKEY g_hDefaultKey;
  50. extern HANDLE g_hPolicyRegNotifier;
  51. extern HKEY g_hPolicyKey;
  52. extern LIST_ENTRY g_Subagents;
  53. extern LIST_ENTRY g_SupportedRegions;
  54. extern LIST_ENTRY g_ValidCommunities;
  55. extern LIST_ENTRY g_TrapDestinations;
  56. extern LIST_ENTRY g_PermittedManagers;
  57. extern LIST_ENTRY g_IncomingTransports;
  58. extern LIST_ENTRY g_OutgoingTransports;
  59. extern CRITICAL_SECTION g_RegCriticalSectionA;
  60. extern CRITICAL_SECTION g_RegCriticalSectionB;
  61. extern CRITICAL_SECTION g_RegCriticalSectionC;
  62. extern CMD_LINE_ARGUMENTS g_CmdLineArguments;
  63. ///////////////////////////////////////////////////////////////////////////////
  64. // //
  65. // Registry definitions //
  66. // //
  67. ///////////////////////////////////////////////////////////////////////////////
  68. #define REG_POLICY_ROOT \
  69. TEXT("SOFTWARE\\Policies")
  70. #define REG_POLICY_PARAMETERS \
  71. TEXT("SOFTWARE\\Policies\\SNMP\\Parameters")
  72. #define REG_POLICY_VALID_COMMUNITIES \
  73. REG_POLICY_PARAMETERS TEXT("\\ValidCommunities")
  74. #define REG_POLICY_TRAP_DESTINATIONS \
  75. REG_POLICY_PARAMETERS TEXT("\\TrapConfiguration")
  76. #define REG_POLICY_PERMITTED_MANAGERS \
  77. REG_POLICY_PARAMETERS TEXT("\\PermittedManagers")
  78. #define REG_KEY_SNMP_PARAMETERS \
  79. TEXT("SYSTEM\\CurrentControlSet\\Services\\SNMP\\Parameters")
  80. #define REG_KEY_EXTENSION_AGENTS \
  81. REG_KEY_SNMP_PARAMETERS TEXT("\\ExtensionAgents")
  82. #define REG_KEY_VALID_COMMUNITIES \
  83. REG_KEY_SNMP_PARAMETERS TEXT("\\ValidCommunities")
  84. #define REG_KEY_TRAP_DESTINATIONS \
  85. REG_KEY_SNMP_PARAMETERS TEXT("\\TrapConfiguration")
  86. #define REG_KEY_PERMITTED_MANAGERS \
  87. REG_KEY_SNMP_PARAMETERS TEXT("\\PermittedManagers")
  88. #define REG_KEY_MIB2 \
  89. REG_KEY_SNMP_PARAMETERS TEXT("\\RFC1156Agent")
  90. #define REG_VALUE_SUBAGENT_PATH "Pathname"
  91. #define REG_VALUE_AUTH_TRAPS TEXT("EnableAuthenticationTraps")
  92. #define REG_VALUE_MGRRES_COUNTER TEXT("NameResolutionRetries")
  93. #define REG_VALUE_SYS_OBJECTID TEXT("sysObjectID")
  94. #define MAX_VALUE_NAME_LEN 256
  95. #define MAX_VALUE_DATA_LEN 256
  96. ///////////////////////////////////////////////////////////////////////////////
  97. // //
  98. // Miscellaneous definitions //
  99. // //
  100. ///////////////////////////////////////////////////////////////////////////////
  101. #define PDUTYPESTRING(nPduType) \
  102. ((nPduType == SNMP_PDU_GETNEXT) \
  103. ? "getnext" \
  104. : (nPduType == SNMP_PDU_GETBULK) \
  105. ? "getbulk" \
  106. : (nPduType == SNMP_PDU_GET) \
  107. ? "get" \
  108. : (nPduType == SNMP_PDU_SET) \
  109. ? "set" \
  110. : "unknown")
  111. #define SNMPERRORSTRING(nErr) \
  112. ((nErr == SNMP_ERRORSTATUS_NOERROR) \
  113. ? "NOERROR" \
  114. : (nErr == SNMP_ERRORSTATUS_GENERR) \
  115. ? "GENERR" \
  116. : (nErr == SNMP_ERRORSTATUS_NOSUCHNAME) \
  117. ? "NOSUCHNAME" \
  118. : (nErr == SNMP_ERRORSTATUS_NOTWRITABLE) \
  119. ? "NOTWRITABLE" \
  120. : (nErr == SNMP_ERRORSTATUS_TOOBIG) \
  121. ? "TOOBIG" \
  122. : (nErr == SNMP_ERRORSTATUS_BADVALUE) \
  123. ? "BADVALUE" \
  124. : (nErr == SNMP_ERRORSTATUS_READONLY) \
  125. ? "READONLY" \
  126. : (nErr == SNMP_ERRORSTATUS_WRONGTYPE) \
  127. ? "WRONGTYPE" \
  128. : (nErr == SNMP_ERRORSTATUS_WRONGLENGTH) \
  129. ? "WRONGLENGTH" \
  130. : (nErr == SNMP_ERRORSTATUS_WRONGENCODING) \
  131. ? "WRONGENCODING" \
  132. : (nErr == SNMP_ERRORSTATUS_WRONGVALUE) \
  133. ? "WRONGVALUE" \
  134. : (nErr == SNMP_ERRORSTATUS_NOCREATION) \
  135. ? "NOCREATION" \
  136. : (nErr == SNMP_ERRORSTATUS_INCONSISTENTVALUE) \
  137. ? "INCONSISTENTVALUE" \
  138. : (nErr == SNMP_ERRORSTATUS_RESOURCEUNAVAILABLE) \
  139. ? "RESOURCEUNAVAILABLE" \
  140. : (nErr == SNMP_ERRORSTATUS_COMMITFAILED) \
  141. ? "COMMITFAILED" \
  142. : (nErr == SNMP_ERRORSTATUS_UNDOFAILED) \
  143. ? "UNDOFAILED" \
  144. : (nErr == SNMP_ERRORSTATUS_AUTHORIZATIONERROR) \
  145. ? "AUTHORIZATIONERROR" \
  146. : (nErr == SNMP_ERRORSTATUS_NOACCESS) \
  147. ? "NOACCESS" \
  148. : (nErr == SNMP_ERRORSTATUS_INCONSISTENTNAME) \
  149. ? "INCONSISTENTNAME" \
  150. : "unknown")
  151. #endif // _GLOBALS_H_