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.

115 lines
4.6 KiB

  1. #ifndef _SNMPOCX_H
  2. #define _SNMPOCX_H
  3. //---------------- general defines ---------------------
  4. #define MAX_AF_STRING_LEN 1024
  5. #define MAX_REG_STRING_LEN 256
  6. // the section name expected to be found in the answer file
  7. #define AF_SECTION L"SNMP"
  8. // registry key
  9. #define REG_KEY_SNMP_PARAMETERS L"SYSTEM\\CurrentControlSet\\Services\\SNMP\\Parameters"
  10. //---------------- the "Security" Panel ----------------
  11. // answer file keys
  12. #define AF_ACCEPTCOMMNAME L"Accept_CommunityName"
  13. #define AF_SENDAUTH L"Send_Authentication"
  14. #define AF_ANYHOST L"Any_Host"
  15. #define AF_LIMITHOST L"Limit_Host"
  16. // registry keys
  17. #define REG_KEY_VALID_COMMUNITIES REG_KEY_SNMP_PARAMETERS L"\\ValidCommunities"
  18. #define REG_KEY_AUTHENTICATION_TRAPS REG_KEY_SNMP_PARAMETERS L"\\EnableAuthenticationTraps"
  19. #define REG_VALUE_SWITCH L"switch"
  20. #define REG_VALUE_AUTHENTICATION_TRAPS L"EnableAuthenticationTraps"
  21. #define REG_NAME_RESOLUTION_RETRIES L"NameResolutionRetries"
  22. #define REG_KEY_PERMITTED_MANAGERS REG_KEY_SNMP_PARAMETERS L"\\PermittedManagers"
  23. // security defines
  24. #define SEC_NONE_NAME L"NONE"
  25. #define SEC_NONE_VALUE 0x00000001
  26. #define SEC_NOTIFY_NAME L"NOTIFY"
  27. #define SEC_NOTIFY_VALUE 0x00000002
  28. #define SEC_READ_ONLY_NAME L"READ_ONLY"
  29. #define SEC_READ_ONLY_VALUE 0x00000004
  30. #define SEC_READ_WRITE_NAME L"READ_WRITE"
  31. #define SEC_READ_WRITE_VALUE 0x00000008
  32. #define SEC_READ_CREATE_NAME L"READ_CREATE"
  33. #define SEC_READ_CREATE_VALUE 0x00000010
  34. // default PermittedManagers
  35. #define SEC_DEF_PERMITTED_MANAGERS L"localhost\0" // multi_Sz value to SnmpRegWritePermittedMgrs
  36. //----------------- the "Traps" Panel ------------------
  37. // answer file keys
  38. #define AF_TRAPCOMMUNITY L"Community_Name"
  39. #define AF_TRAPDEST L"Traps"
  40. // registry keys
  41. #define REG_KEY_TRAP_DESTINATIONS REG_KEY_SNMP_PARAMETERS L"\\TrapConfiguration"
  42. //----------------- the "Agent" Panel ------------------
  43. // answer file keys
  44. #define AF_SYSNAME L"Contact_Name"
  45. #define AF_SYSLOCATION L"Location"
  46. #define AF_SYSSERVICES L"Service"
  47. // registry keys
  48. #define REG_KEY_AGENT REG_KEY_SNMP_PARAMETERS L"\\RFC1156Agent"
  49. #define SNMP_CONTACT L"sysContact"
  50. #define SNMP_LOCATION L"sysLocation"
  51. #define SNMP_SERVICES L"sysServices"
  52. #define SRV_AGNT_PHYSICAL_NAME L"Physical"
  53. #define SRV_AGNT_PHYSICAL_VALUE 0x00000001
  54. #define SRV_AGNT_DATALINK_NAME L"Datalink"
  55. #define SRV_AGNT_DATALINK_VALUE 0x00000002
  56. #define SRV_AGNT_INTERNET_NAME L"Internet"
  57. #define SRV_AGNT_INTERNET_VALUE 0x00000004
  58. #define SRV_AGNT_ENDTOEND_NAME L"End-to-End"
  59. #define SRV_AGNT_ENDTOEND_VALUE 0x00000008
  60. #define SRV_AGNT_APPLICATIONS_NAME L"Applications"
  61. #define SRV_AGNT_APPLICATIONS_VALUE 0x00000040
  62. #define REG_KEY_EXTENSION_AGENTS REG_KEY_SNMP_PARAMETERS L"\\ExtensionAgents"
  63. typedef BOOL (* LPFNFREMOVESUBAGENT)(void);
  64. typedef struct tagSubagentRemovalInfo
  65. {
  66. LPCWSTR pwszRegKey; // Subagent Registry Key to be removed
  67. LPCWSTR pwszRegValData; // Subagent value data under
  68. // REG_KEY_EXTENSION_AGENTS key
  69. LPFNFREMOVESUBAGENT pfnFRemoveSubagent;// function to tell if this subagent
  70. // needs to be removed
  71. } SUBAGENT_REMOVAL_INFO, * LPSUBAGENT_REMOVAL_INFO;
  72. //~~~~~~~~~~~~~~~~~ registry setting functions ~~~~~~~~~
  73. HRESULT
  74. SnmpRegWriteDword(PWSTR pRegKey,
  75. PWSTR pValueName,
  76. DWORD dwValueData);
  77. HRESULT
  78. SnmpRegUpgEnableAuthTraps();
  79. HRESULT
  80. SnmpRegWriteCommunities(PWSTR pCommArray);
  81. HRESULT
  82. SnmpRegWritePermittedMgrs(BOOL bAnyHost,
  83. PWSTR pMgrsList);
  84. HRESULT
  85. SnmpRegWriteTraps(tstring tstrVariable,
  86. PWSTR pTstrArray);
  87. HRESULT
  88. SnmpRegWriteTstring(PWSTR pRegKey,
  89. PWSTR pValueName,
  90. tstring tstrValueData);
  91. DWORD
  92. SnmpStrArrayToServices(PWSTR pSrvArray);
  93. //~~~~~~~~~~~~~~~adding admin ACL to registry subkey~~~~~
  94. HRESULT SnmpAddAdminAclToKey(PWSTR pwszKey);
  95. //~~~~~~~~~~~~~~~Removal of obsoleted subagents during upgrade~~~~~
  96. HRESULT SnmpRemoveSubAgents(
  97. const SUBAGENT_REMOVAL_INFO * prgSRI,
  98. UINT cParams);
  99. #endif // _SNMPOCX_H