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.

302 lines
6.7 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1999 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // dnswrap.h
  7. //
  8. // Implementation File:
  9. // dnswrap.cpp
  10. //
  11. // Description:
  12. // Definition of the CDnsDomainDomainContainment class.
  13. //
  14. // Author:
  15. // Henry Wang (Henrywa) March 8, 2000
  16. //
  17. // Notes:
  18. //
  19. /////////////////////////////////////////////////////////////////////////////
  20. #pragma once
  21. #include <list>
  22. class CObjPath;
  23. class CDomainNode;
  24. class CWbemClassObject;
  25. using namespace std;
  26. /////////////////////////////////////////////////////////////////////////////
  27. //++
  28. //
  29. // class CDnsBase
  30. //
  31. // Description:
  32. // this is a wrap class for dns rpc API used in the provider. This class is
  33. // implemented as singlton class, that's at any time, there is only one instance
  34. // of this class.
  35. //
  36. //
  37. // Inheritance:
  38. //
  39. //
  40. //--
  41. /////////////////////////////////////////////////////////////////////////////
  42. class CDnsWrap
  43. {
  44. protected:
  45. // some def
  46. typedef SCODE (*FPDNSOPS)(
  47. const CHAR * pszZoneName,
  48. const WCHAR*,
  49. const CHAR*,
  50. CWbemClassObject&);
  51. //
  52. // map wbem property get and set to dns functions
  53. //
  54. typedef struct _table
  55. {
  56. const WCHAR* pwzProperty;//wbem property name
  57. CHAR* OperationName; // dns operation name
  58. FPDNSOPS fpOperationSet;
  59. FPDNSOPS fpOperationGet;
  60. } PropertyTable;
  61. //
  62. // dns server info class
  63. //
  64. class CServerInfo
  65. {
  66. public:
  67. CServerInfo();
  68. ~CServerInfo();
  69. PVOID m_pInfo;
  70. };
  71. // end def
  72. WCHAR* m_wszpServerName;
  73. PVOID GetPropertyTable(
  74. DWORD* pdwSize
  75. );
  76. public:
  77. typedef enum{
  78. DNS_WRAP_RELOAD_ZONE,
  79. DNS_WRAP_DS_UPDATE,
  80. DNS_WRAP_WRITE_BACK_ZONE,
  81. DNS_WRAP_REFRESH_SECONDARY,
  82. DNS_WRAP_RESUME_ZONE,
  83. DNS_WRAP_PAUSE_ZONE
  84. } OpsFlag;
  85. SCODE dnsClearCache(void);
  86. SCODE dnsResumeZone(
  87. const char* strZoneName
  88. );
  89. wstring GetServerName(void);
  90. SCODE dnsPauseZone(
  91. const char *strZoneName
  92. );
  93. static CDnsWrap& DnsObject(void);
  94. CDnsWrap();
  95. virtual ~CDnsWrap();
  96. SCODE dnsEnumRecordsForDomainEx(
  97. CDomainNode& objNode,
  98. PVOID pFilter,
  99. FILTER pfFilter,
  100. BOOL bRecursive,
  101. WORD wType,
  102. DWORD dwFlag,
  103. IWbemClassObject * pClass,
  104. CWbemInstanceMgr& InstMgr
  105. );
  106. SCODE dnsGetDomain(
  107. CObjPath& objParent,
  108. IWbemClassObject* pClass,
  109. IWbemObjectSink* pHandler
  110. );
  111. SCODE dnsEnumDomainForServer(
  112. list<CObjPath>* pList
  113. );
  114. SCODE dnsEnumDomainForServer(
  115. list<CDomainNode>* pList
  116. );
  117. SCODE dnsDeleteDomain(
  118. char * pszContainer,
  119. char * pszDomain
  120. );
  121. SCODE dnsRestartServer(
  122. WCHAR* strServerName
  123. );
  124. SCODE dnsDsServerName(
  125. wstring&);
  126. SCODE dnsDsZoneName(
  127. wstring& wstrDsName,
  128. wstring& wstrInZone
  129. );
  130. SCODE dnsDsNodeName(
  131. wstring& wstrDsName,
  132. wstring& wstrInZone,
  133. wstring& wstrInNode
  134. );
  135. SCODE dnsServerPropertySet(
  136. CWbemClassObject& Inst,
  137. BOOL bGet
  138. );
  139. SCODE dnsServerPropertyGet(
  140. CWbemClassObject& Inst,
  141. BOOL bGet
  142. );
  143. SCODE dnsQueryServerInfo(
  144. const WCHAR* strServerName,
  145. CWbemClassObject& NewInst,
  146. IWbemObjectSink* pHandler
  147. );
  148. SCODE dnsDeleteZone(
  149. CObjPath& objZone
  150. );
  151. SCODE dnsGetZone(
  152. const WCHAR* wszServer,
  153. const WCHAR* wszZone,
  154. CWbemClassObject& Inst,
  155. IWbemObjectSink* pHandler
  156. );
  157. SCODE dnsQueryProperty(
  158. const WCHAR* wszZoneName,
  159. const WCHAR* wszPropertyName,
  160. DWORD* pdwResult
  161. );
  162. static SCODE dnsGetDwordProperty(
  163. const char * pszZoneName,
  164. const WCHAR* wszWbemProperty,
  165. const char* pszOperationName,
  166. CWbemClassObject& Inst
  167. );
  168. static SCODE dnsSetDwordProperty(
  169. const char * pszZoneName,
  170. const WCHAR* wszWbemProperty,
  171. const char* pszOperationName,
  172. CWbemClassObject& Inst
  173. );
  174. static SCODE
  175. dnsGetStringProperty(
  176. const char * pszZoneName,
  177. const WCHAR * wszWbemProperty,
  178. const char * pszDnssrvPropertyName,
  179. CWbemClassObject& Inst
  180. );
  181. static SCODE
  182. dnsSetStringProperty(
  183. const char * pszZoneName,
  184. const WCHAR * wszWbemProperty,
  185. const char * pszDnssrvPropertyName,
  186. CWbemClassObject& Inst
  187. );
  188. static SCODE
  189. dnsGetIPArrayProperty(
  190. const char * pszZoneName,
  191. const WCHAR * wszWbemProperty,
  192. const char * pszDnssrvPropertyName,
  193. CWbemClassObject& Inst
  194. );
  195. static SCODE
  196. dnsSetIPArrayProperty(
  197. const char * pszZoneName,
  198. const WCHAR * wszWbemProperty,
  199. const char * pszDnssrvPropertyName,
  200. CWbemClassObject& Inst
  201. );
  202. static SCODE dnsSetServerListenAddress(
  203. const char * pszZoneName,
  204. const WCHAR* wszWbemProperty,
  205. const char* pszOperationName,
  206. CWbemClassObject& Inst
  207. );
  208. static SCODE dnsSetServerForwarders(
  209. const char * pszZoneName,
  210. const WCHAR* wszWbemProperty,
  211. const char* pszOperationName,
  212. CWbemClassObject& Inst
  213. );
  214. SCODE dnsSetProperty(
  215. const WCHAR* wszZoneName,
  216. const char* pszPropertyName,
  217. DWORD dwValue
  218. );
  219. SCODE dnsSetProperty(
  220. const char* pszZoneName,
  221. const char* pszPropertyName,
  222. DWORD dwValue
  223. );
  224. SCODE ValidateServerName(
  225. const WCHAR* pwzStr
  226. );
  227. SCODE dnsOperation(
  228. string&, //zone name
  229. OpsFlag
  230. );
  231. SCODE dnsZoneCreate(
  232. string& strZoneName,
  233. DWORD dwZoneType,
  234. string& strDataFile,
  235. string& strAdmin,
  236. DWORD* pIp,
  237. DWORD cIp
  238. );
  239. SCODE dnsZoneChangeType(
  240. string& strZone,
  241. DWORD dwZoneType,
  242. string& strDataFile,
  243. string& strAdmin,
  244. DWORD* pIp,
  245. DWORD cIp
  246. );
  247. SCODE dnsZoneResetMaster(
  248. string& strZoneName,
  249. DWORD* pMasterIp,
  250. DWORD cMasterIp,
  251. DWORD dwLocal
  252. );
  253. SCODE dnsZoneResetSecondary(
  254. string& strZoneName,
  255. DWORD dwSecurity,
  256. DWORD* pSecondaryIp,
  257. DWORD cSecondaryIp,
  258. DWORD dwNotify,
  259. DWORD * pNotifyIp,
  260. DWORD cNotifyIp
  261. );
  262. SCODE dnsZonePut(
  263. CWbemClassObject& Inst
  264. );
  265. SCODE
  266. CDnsWrap::dnsGetStatistics(
  267. IWbemClassObject * pClass,
  268. IWbemObjectSink * pHandler,
  269. DWORD dwStatId = 0
  270. );
  271. static void ThrowException(
  272. LONG status
  273. );
  274. static void ThrowException(
  275. LPCSTR ErrString
  276. );
  277. };