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.

104 lines
3.8 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 community name
  35. #define SEC_DEF_COMM_NAME L"public"
  36. #define SEC_DEF_COMM_VALUE SEC_READ_ONLY_VALUE
  37. //----------------- the "Traps" Panel ------------------
  38. // answer file keys
  39. #define AF_TRAPCOMMUNITY L"Community_Name"
  40. #define AF_TRAPDEST L"Traps"
  41. // registry keys
  42. #define REG_KEY_TRAP_DESTINATIONS REG_KEY_SNMP_PARAMETERS L"\\TrapConfiguration"
  43. //----------------- the "Agent" Panel ------------------
  44. // answer file keys
  45. #define AF_SYSNAME L"Contact_Name"
  46. #define AF_SYSLOCATION L"Location"
  47. #define AF_SYSSERVICES L"Service"
  48. // registry keys
  49. #define REG_KEY_AGENT REG_KEY_SNMP_PARAMETERS L"\\RFC1156Agent"
  50. #define SNMP_CONTACT L"sysContact"
  51. #define SNMP_LOCATION L"sysLocation"
  52. #define SNMP_SERVICES L"sysServices"
  53. #define SRV_AGNT_PHYSICAL_NAME L"Physical"
  54. #define SRV_AGNT_PHYSICAL_VALUE 0x00000001
  55. #define SRV_AGNT_DATALINK_NAME L"Datalink"
  56. #define SRV_AGNT_DATALINK_VALUE 0x00000002
  57. #define SRV_AGNT_INTERNET_NAME L"Internet"
  58. #define SRV_AGNT_INTERNET_VALUE 0x00000004
  59. #define SRV_AGNT_ENDTOEND_NAME L"End-to-End"
  60. #define SRV_AGNT_ENDTOEND_VALUE 0x00000008
  61. #define SRV_AGNT_APPLICATIONS_NAME L"Applications"
  62. #define SRV_AGNT_APPLICATIONS_VALUE 0x00000040
  63. //~~~~~~~~~~~~~~~~~ registry setting functions ~~~~~~~~~
  64. HRESULT
  65. SnmpRegWriteDword(PWSTR pRegKey,
  66. PWSTR pValueName,
  67. DWORD dwValueData);
  68. HRESULT
  69. SnmpRegUpgEnableAuthTraps();
  70. HRESULT
  71. SnmpRegWriteCommunities(PWSTR pCommArray);
  72. HRESULT
  73. SnmpRegWriteDefCommunity();
  74. HRESULT
  75. SnmpRegWritePermittedMgrs(BOOL bAnyHost,
  76. PWSTR pMgrsList);
  77. HRESULT
  78. SnmpRegWriteTraps(tstring tstrVariable,
  79. PWSTR pTstrArray);
  80. HRESULT
  81. SnmpRegWriteTstring(PWSTR pRegKey,
  82. PWSTR pValueName,
  83. tstring tstrValueData);
  84. DWORD
  85. SnmpStrArrayToServices(PWSTR pSrvArray);
  86. //~~~~~~~~~~~~~~~adding admin ACL to registry subkey~~~~~
  87. HRESULT SnmpAddAdminAclToKey(PWSTR pwszKey);
  88. #endif // _SNMPOCX_H