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.

324 lines
8.1 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 dnsAgeAllRecords(
  87. const char * pszZoneName,
  88. const char * pszNodeName,
  89. BOOL bAgeSubtree
  90. );
  91. SCODE dnsResumeZone(
  92. const char* strZoneName
  93. );
  94. wstring GetServerName(void);
  95. SCODE dnsPauseZone(
  96. const char *strZoneName
  97. );
  98. static CDnsWrap& DnsObject(void);
  99. CDnsWrap();
  100. virtual ~CDnsWrap();
  101. SCODE dnsEnumRecordsForDomainEx(
  102. CDomainNode& objNode,
  103. PVOID pFilter,
  104. FILTER pfFilter,
  105. BOOL bRecursive,
  106. WORD wType,
  107. DWORD dwFlag,
  108. IWbemClassObject * pClass,
  109. CWbemInstanceMgr& InstMgr
  110. );
  111. SCODE dnsGetDomain(
  112. CObjPath& objParent,
  113. IWbemClassObject* pClass,
  114. IWbemObjectSink* pHandler
  115. );
  116. SCODE dnsEnumDomainForServer(
  117. list<CObjPath>* pList
  118. );
  119. SCODE dnsEnumDomainForServer(
  120. list<CDomainNode>* pList
  121. );
  122. SCODE dnsDeleteDomain(
  123. char * pszContainer,
  124. char * pszDomain
  125. );
  126. SCODE dnsRestartServer(
  127. WCHAR* strServerName
  128. );
  129. SCODE dnsDsServerName(
  130. wstring&);
  131. SCODE dnsDsZoneName(
  132. wstring& wstrDsName,
  133. wstring& wstrInZone
  134. );
  135. SCODE dnsDsNodeName(
  136. wstring& wstrDsName,
  137. wstring& wstrInZone,
  138. wstring& wstrInNode
  139. );
  140. SCODE dnsServerPropertySet(
  141. CWbemClassObject& Inst,
  142. BOOL bGet
  143. );
  144. SCODE dnsServerPropertyGet(
  145. CWbemClassObject& Inst,
  146. BOOL bGet
  147. );
  148. SCODE dnsQueryServerInfo(
  149. const WCHAR* strServerName,
  150. CWbemClassObject& NewInst,
  151. IWbemObjectSink* pHandler
  152. );
  153. SCODE dnsDeleteZone(
  154. CObjPath& objZone
  155. );
  156. SCODE dnsGetZone(
  157. const WCHAR* wszServer,
  158. const WCHAR* wszZone,
  159. CWbemClassObject& Inst,
  160. IWbemObjectSink* pHandler
  161. );
  162. SCODE dnsQueryProperty(
  163. const WCHAR* wszZoneName,
  164. const WCHAR* wszPropertyName,
  165. DWORD* pdwResult
  166. );
  167. static SCODE dnsGetDwordProperty(
  168. const char * pszZoneName,
  169. const WCHAR* wszWbemProperty,
  170. const char* pszOperationName,
  171. CWbemClassObject& Inst
  172. );
  173. static SCODE dnsSetDwordProperty(
  174. const char * pszZoneName,
  175. const WCHAR* wszWbemProperty,
  176. const char* pszOperationName,
  177. CWbemClassObject& Inst
  178. );
  179. static SCODE
  180. dnsGetStringProperty(
  181. const char * pszZoneName,
  182. const WCHAR * wszWbemProperty,
  183. const char * pszDnssrvPropertyName,
  184. CWbemClassObject& Inst
  185. );
  186. static SCODE
  187. dnsSetStringProperty(
  188. const char * pszZoneName,
  189. const WCHAR * wszWbemProperty,
  190. const char * pszDnssrvPropertyName,
  191. CWbemClassObject& Inst
  192. );
  193. static SCODE
  194. dnsGetIPArrayProperty(
  195. const char * pszZoneName,
  196. const WCHAR * wszWbemProperty,
  197. const char * pszDnssrvPropertyName,
  198. CWbemClassObject& Inst
  199. );
  200. static SCODE
  201. dnsSetIPArrayProperty(
  202. const char * pszZoneName,
  203. const WCHAR * wszWbemProperty,
  204. const char * pszDnssrvPropertyName,
  205. CWbemClassObject& Inst
  206. );
  207. static SCODE dnsSetServerListenAddress(
  208. const char * pszZoneName,
  209. const WCHAR* wszWbemProperty,
  210. const char* pszOperationName,
  211. CWbemClassObject& Inst
  212. );
  213. static SCODE dnsSetServerForwarders(
  214. const char * pszZoneName,
  215. const WCHAR* wszWbemProperty,
  216. const char* pszOperationName,
  217. CWbemClassObject& Inst
  218. );
  219. SCODE dnsSetProperty(
  220. const WCHAR* wszZoneName,
  221. const char* pszPropertyName,
  222. DWORD dwValue
  223. );
  224. SCODE dnsSetProperty(
  225. const char* pszZoneName,
  226. const char* pszPropertyName,
  227. DWORD dwValue
  228. );
  229. SCODE ValidateServerName(
  230. const WCHAR* pwzStr
  231. );
  232. SCODE dnsOperation(
  233. string&, //zone name
  234. OpsFlag
  235. );
  236. SCODE dnsZoneCreate(
  237. string & strZoneName,
  238. DWORD dwZoneType,
  239. BOOL DsIntegrated,
  240. string & strDataFile,
  241. string & strAdmin,
  242. DWORD * pIp,
  243. DWORD cIp
  244. );
  245. SCODE dnsZoneChangeType(
  246. string & strZone,
  247. DWORD dwZoneType,
  248. BOOL DsIntegrated,
  249. string & strDataFile,
  250. string & strAdmin,
  251. DWORD * pIp,
  252. DWORD cIp
  253. );
  254. SCODE dnsZoneResetMaster(
  255. string& strZoneName,
  256. DWORD* pMasterIp,
  257. DWORD cMasterIp,
  258. DWORD dwLocal
  259. );
  260. SCODE dnsZoneResetSecondary(
  261. string& strZoneName,
  262. DWORD dwSecurity,
  263. DWORD* pSecondaryIp,
  264. DWORD cSecondaryIp,
  265. DWORD dwNotify,
  266. DWORD * pNotifyIp,
  267. DWORD cNotifyIp
  268. );
  269. SCODE dnsZonePut(
  270. CWbemClassObject& Inst
  271. );
  272. SCODE
  273. CDnsWrap::dnsGetStatistics(
  274. IWbemClassObject * pClass,
  275. IWbemObjectSink * pHandler,
  276. DWORD dwStatId = 0
  277. );
  278. static void ThrowException(
  279. LONG status
  280. );
  281. static void ThrowException(
  282. LPCSTR ErrString
  283. );
  284. static SCODE
  285. buildIpArrayFromStringArrayProperty(
  286. CWbemClassObject & Inst,
  287. LPCWSTR wszWbemProperty,
  288. PIP_ARRAY * ppIpArray
  289. );
  290. };