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.

317 lines
12 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1999 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // common.h
  7. //
  8. // Implementation File:
  9. // util.cpp
  10. //
  11. // Description:
  12. // Definition of the CDnsbase class.
  13. //
  14. // Author:
  15. // Henry Wang (Henrywa) March 8, 2000
  16. //
  17. // Notes:
  18. //
  19. /////////////////////////////////////////////////////////////////////////////
  20. #pragma once
  21. #include <wbemprov.h>
  22. #include <objbase.h>
  23. #include "ntrkcomm.h"
  24. #include <string>
  25. #include <list>
  26. #include <memory>
  27. using namespace std;
  28. class CDnsBase;
  29. class CDnsRpcNode;
  30. class CObjPath;
  31. class CDomainNode;
  32. class CWbemInstanceMgr;
  33. typedef LPVOID * PPVOID;
  34. typedef SCODE (*FILTER) (
  35. CDomainNode&,
  36. //CObjPath*,
  37. PVOID,
  38. CDnsRpcNode*,
  39. IWbemClassObject* ,
  40. CWbemInstanceMgr&
  41. );
  42. typedef CDnsBase* (*FPNEW) (
  43. const WCHAR*,
  44. CWbemServices*,
  45. const char*
  46. );
  47. SCODE CreateClass(
  48. const WCHAR* ,
  49. CWbemServices* p,
  50. void** );
  51. //string convertion
  52. BSTR
  53. AllocBstr(const WCHAR* );
  54. int
  55. CharToWchar(
  56. LPCSTR,
  57. LPWSTR*
  58. );
  59. wstring
  60. CharToWstring(
  61. LPCSTR ,
  62. DWORD
  63. );
  64. wstring IpAddressToString(DWORD ip);
  65. int
  66. WcharToChar(
  67. LPCWSTR ,
  68. LPSTR*
  69. );
  70. int
  71. WcharToString(
  72. LPCWSTR,
  73. string&
  74. );
  75. //WBEM_CLASSS
  76. extern const WCHAR* const PVD_CLASS_SERVER;
  77. extern const WCHAR* const PVD_CLASS_DOMAIN;
  78. extern const WCHAR* const PVD_CLASS_ZONE;
  79. extern const WCHAR* const PVD_CLASS_CACHE;
  80. extern const WCHAR* const PVD_CLASS_ROOTHINTS;
  81. extern const WCHAR* const PVD_CLASS_RESOURCERECORD;
  82. extern const WCHAR* const PVD_CLASS_RR_A;
  83. extern const WCHAR* const PVD_CLASS_RR_SOA;
  84. extern const WCHAR* const PVD_CLASS_RR_PTR;
  85. extern const WCHAR* const PVD_CLASS_RR_NS ;
  86. extern const WCHAR* const PVD_CLASS_RR_CNAME;
  87. extern const WCHAR* const PVD_CLASS_RR_MB;
  88. extern const WCHAR* const PVD_CLASS_RR_MD;
  89. extern const WCHAR* const PVD_CLASS_RR_MF;
  90. extern const WCHAR* const PVD_CLASS_RR_MG;
  91. extern const WCHAR* const PVD_CLASS_RR_MR;
  92. extern const WCHAR* const PVD_CLASS_RR_MINFO;
  93. extern const WCHAR* const PVD_CLASS_RR_RP;
  94. extern const WCHAR* const PVD_CLASS_RR_MX;
  95. extern const WCHAR* const PVD_CLASS_RR_AFSDB;
  96. extern const WCHAR* const PVD_CLASS_RR_RT;
  97. extern const WCHAR* const PVD_CLASS_RR_HINFO;
  98. extern const WCHAR* const PVD_CLASS_RR_ISDN;
  99. extern const WCHAR* const PVD_CLASS_RR_TXT;
  100. extern const WCHAR* const PVD_CLASS_RR_X25;
  101. extern const WCHAR* const PVD_CLASS_RR_NULL;
  102. extern const WCHAR* const PVD_CLASS_RR_WKS;
  103. extern const WCHAR* const PVD_CLASS_RR_AAAA;
  104. extern const WCHAR* const PVD_CLASS_RR_SRV;
  105. extern const WCHAR* const PVD_CLASS_RR_ATMA;
  106. extern const WCHAR* const PVD_CLASS_RR_WINS;
  107. extern const WCHAR* const PVD_CLASS_RR_WINSR;
  108. extern const WCHAR* const PVD_CLASS_SERVERDOMAIN;
  109. extern const WCHAR* const PVD_CLASS_DOMAINDOMAIN;
  110. extern const WCHAR* const PVD_CLASS_DOMAINRESOURCERECORD;
  111. // server
  112. extern const WCHAR* const PVD_SRV_ADDRESS_ANSWER_LIMIT;
  113. extern const WCHAR* const PVD_SRV_BOOT_METHOD;
  114. extern const WCHAR* const PVD_SRV_DS_POLLING_INTERVAL;
  115. extern const WCHAR* const PVD_SRV_EVENT_LOG_LEVEL;
  116. extern const WCHAR* const PVD_SRV_ALLOW_UPDATE;
  117. extern const WCHAR* const PVD_SRV_AUTO_CACHE_UPDATE;
  118. extern const WCHAR* const PVD_SRV_AUTO_REVERSE_ZONES;
  119. extern const WCHAR* const PVD_SRV_BIND_SECONDARIES;
  120. extern const WCHAR* const PVD_SRV_DISJOINT_NETS;
  121. extern const WCHAR* const PVD_SRV_DS_AVAILABLE;
  122. extern const WCHAR* const PVD_SRV_FORWARD_DELEGATION;
  123. extern const WCHAR* const PVD_SRV_LOCAL_NETPRIORITY;
  124. extern const WCHAR* const PVD_SRV_LOOSE_WILDCARDING;
  125. extern const WCHAR* const PVD_SRV_NO_RECURSION;
  126. extern const WCHAR* const PVD_SRV_FORWARDERS_IPADDRESSES_ARRAY;
  127. extern const WCHAR* const PVD_SRV_FORWARD_TIMEOUT;
  128. extern const WCHAR* const PVD_SRV_ROUND_ROBIN;
  129. extern const WCHAR* const PVD_SRV_SECURE_RESPONSES;
  130. extern const WCHAR* const PVD_SRV_SLAVE;
  131. extern const WCHAR* const PVD_SRV_STRICT_FILE_PARSING;
  132. extern const WCHAR* const PVD_SRV_AUTO_CONFIG_FILE_ZONES;
  133. extern const WCHAR* const PVD_SRV_DEFAULT_AGING_STATE;
  134. extern const WCHAR* const PVD_SRV_DEFAULT_REFRESH_INTERVAL;
  135. extern const WCHAR* const PVD_SRV_DEFAULT_NOREFRESH_INTERVAL;
  136. extern const WCHAR* const PVD_SRV_ENABLE_EDNS;
  137. extern const WCHAR* const PVD_SRV_EDNS_CACHE_TIMEOUT;
  138. extern const WCHAR* const PVD_SRV_MAX_UDP_PACKET_SIZE;
  139. extern const WCHAR* const PVD_SRV_ENABLE_DNSSEC;
  140. extern const WCHAR* const PVD_SRV_ENABLE_DP;
  141. extern const WCHAR* const PVD_SRV_WRITE_AUTHORITY_NS;
  142. extern const WCHAR* const PVD_SRV_LISTEN_IP_ADDRESSES_ARRAY;
  143. extern const WCHAR* const PVD_SRV_LOG_LEVEL;
  144. extern const WCHAR* const PVD_SRV_MAX_CACHE_TTL;
  145. extern const WCHAR* const PVD_SRV_NAME_CHECK_FLAG;
  146. extern const WCHAR* const PVD_SRV_RECURSION_RETRY;
  147. extern const WCHAR* const PVD_SRV_RECURSION_TIMEOUT;
  148. extern const WCHAR* const PVD_SRV_RPC_PROTOCOL;
  149. extern const WCHAR* const PVD_SRV_SEND_ON_NON_DNS_PORT;
  150. extern const WCHAR* const PVD_SRV_SERVER_IP_ADDRESSES_ARRAY;
  151. extern const WCHAR* const PVD_SRV_SERVER_NAME;
  152. extern const WCHAR* const PVD_SRV_VERSION;
  153. extern const WCHAR* const PVD_SRV_STARTED;
  154. extern const WCHAR* const PVD_SRV_STARTMODE;
  155. // resource record
  156. extern const WCHAR* const PVD_REC_CONTAINER_NAME;
  157. extern const WCHAR* const PVD_REC_SERVER_NAME;
  158. extern const WCHAR* const PVD_REC_DOMAIN_NAME;
  159. extern const WCHAR* const PVD_REC_OWNER_NAME;
  160. extern const WCHAR* const PVD_REC_CLASS;
  161. extern const WCHAR* const PVD_REC_RDATA;
  162. extern const WCHAR* const PVD_REC_TXT_REP;
  163. extern const WCHAR* const PVD_REC_TTL;
  164. extern const WCHAR* const PVD_REC_TYPE;
  165. extern const WCHAR* const PVD_REC_AAAA_IP;
  166. extern const WCHAR* const PVD_REC_AFSBD_SERVER_NAME;
  167. extern const WCHAR* const PVD_REC_AFSBD_SUB_TYPE;
  168. extern const WCHAR* const PVD_REC_ATMA_FORMAT;
  169. extern const WCHAR* const PVD_REC_ATMA_ATM_ADDRESS;
  170. extern const WCHAR* const PVD_REC_A_IP;
  171. extern const WCHAR* const PVD_REC_CNAME_PRIMARY_NAME;
  172. extern const WCHAR* const PVD_REC_HINFO_CPU;
  173. extern const WCHAR* const PVD_REC_HINFO_OS;
  174. extern const WCHAR* const PVD_REC_ISDN_ISDN_NUM;
  175. extern const WCHAR* const PVD_REC_ISDN_SUB_ADDRESS;
  176. extern const WCHAR* const PVD_REC_MB_MBHOST;
  177. extern const WCHAR* const PVD_REC_MD_MDHOST;
  178. extern const WCHAR* const PVD_REC_MF_MFHOST;
  179. extern const WCHAR* const PVD_REC_MG_MGMAILBOX;
  180. extern const WCHAR* const PVD_REC_MINFO_ERROR_MAILBOX;
  181. extern const WCHAR* const PVD_REC_MINFO_RESP_MAILBOX;
  182. extern const WCHAR* const PVD_REC_MR_MRMAILBOX;
  183. extern const WCHAR* const PVD_REC_MX_MAIL_EXCHANGE;
  184. extern const WCHAR* const PVD_REC_MX_PREFERENCE;
  185. extern const WCHAR* const PVD_REC_NS_NSHOST;
  186. extern const WCHAR* const PVD_REC_NULL_NULLDATA;
  187. extern const WCHAR* const PVD_REC_PTR_PTRDOMAIN_NAME;
  188. extern const WCHAR* const PVD_REC_RP_RPMAILBOX;
  189. extern const WCHAR* const PVD_REC_RP_TXT_DOMAIN_NAME;
  190. extern const WCHAR* const PVD_REC_RT_HOST;
  191. extern const WCHAR* const PVD_REC_RT_PREFERENCE;
  192. extern const WCHAR* const PVD_REC_SOA_EXPIRE_LIMIT;
  193. extern const WCHAR* const PVD_REC_SOA_TTL;
  194. extern const WCHAR* const PVD_REC_SOA_PRIMARY_SERVER;
  195. extern const WCHAR* const PVD_REC_SOA_REFRESH;
  196. extern const WCHAR* const PVD_REC_SOA_RESPONSIBLE;
  197. extern const WCHAR* const PVD_REC_SOA_RETRY_DELAY;
  198. extern const WCHAR* const PVD_REC_SOA_SERIAL_NUMBER;
  199. extern const WCHAR* const PVD_REC_SRV_PORT;
  200. extern const WCHAR* const PVD_REC_SRV_PRIORITY;
  201. extern const WCHAR* const PVD_REC_SRV_WEIGHT;
  202. extern const WCHAR* const PVD_REC_SRV_DOMAINNAME;
  203. extern const WCHAR* const PVD_REC_TXT_TEXT;
  204. extern const WCHAR* const PVD_REC_WINSR_TIMEOUT;
  205. extern const WCHAR* const PVD_REC_WINSR_MAPPING_FLAG;
  206. extern const WCHAR* const PVD_REC_WINSR_RESULT_DOMAIN;
  207. extern const WCHAR* const PVD_REC_WINSR_CACHE_TIMEOUT;
  208. extern const WCHAR* const PVD_REC_WINS_TIMEOUT;
  209. extern const WCHAR* const PVD_REC_WINS_MAPPING_FLAG;
  210. extern const WCHAR* const PVD_REC_WINS_WINS_SERVER;
  211. extern const WCHAR* const PVD_REC_WINS_CACHE_TIMEOUT;
  212. extern const WCHAR* const PVD_REC_WKS_INTERNET_ADDRESS;
  213. extern const WCHAR* const PVD_REC_WKS_IP_PROTOCOL;
  214. extern const WCHAR* const PVD_REC_WKS_BIT_MASK;
  215. extern const WCHAR* const PVD_REC_X25_PSDNADDRESS;
  216. // domain
  217. extern const WCHAR* const PVD_DOMAIN_CONTAINER_NAME;
  218. extern const WCHAR* const PVD_DOMAIN_FQDN;
  219. extern const WCHAR* const PVD_DOMAIN_SERVER_NAME;
  220. //
  221. // Zone properties
  222. //
  223. extern const WCHAR* const PVD_ZONE_ALLOW_UPDATE;
  224. extern const WCHAR* const PVD_ZONE_AUTO_CREATED;
  225. extern const WCHAR* const PVD_ZONE_DISABLE_WIN_SRECORD_REPLICATION;
  226. extern const WCHAR* const PVD_ZONE_NOTIFY;
  227. extern const WCHAR* const PVD_ZONE_PAUSED;
  228. extern const WCHAR* const PVD_ZONE_REVERSE;
  229. extern const WCHAR* const PVD_ZONE_AGING;
  230. extern const WCHAR* const PVD_ZONE_SECURE_SECONDARIES;
  231. extern const WCHAR* const PVD_ZONE_SHUTDOWN;
  232. extern const WCHAR* const PVD_ZONE_USE_WINS;
  233. extern const WCHAR* const PVD_ZONE_MASTERS_IP_ADDRESSES_ARRAY;
  234. extern const WCHAR* const PVD_ZONE_LOCAL_MASTERS_IP_ADDRESSES_ARRAY;
  235. extern const WCHAR* const PVD_ZONE_DATA_FILE;
  236. extern const WCHAR* const PVD_ZONE_SECONDARIES_IP_ADDRESSES_ARRAY;
  237. extern const WCHAR* const PVD_ZONE_NOTIFY_IPADDRESSES_ARRAY;
  238. extern const WCHAR* const PVD_ZONE_ZONE_TYPE;
  239. extern const WCHAR* const PVD_ZONE_DS_INTEGRATED;
  240. extern const WCHAR* const PVD_ZONE_AVAIL_FOR_SCAVENGE_TIME;
  241. extern const WCHAR* const PVD_ZONE_REFRESH_INTERVAL;
  242. extern const WCHAR* const PVD_ZONE_NOREFRESH_INTERVAL;
  243. extern const WCHAR* const PVD_ZONE_SCAVENGE_SERVERS;
  244. extern const WCHAR* const PVD_ZONE_FORWARDER_SLAVE;
  245. extern const WCHAR* const PVD_ZONE_FORWARDER_TIMEOUT;
  246. extern const WCHAR* const PVD_ZONE_LAST_SOA_CHECK;
  247. extern const WCHAR* const PVD_ZONE_LAST_GOOD_XFR;
  248. //domaindomain
  249. //domain resource record containment
  250. // server domain containment
  251. extern const WCHAR* const PVD_ASSOC_CHILD;
  252. extern const WCHAR* const PVD_ASSOC_PARENT;
  253. // method
  254. extern const WCHAR* const PVD_MTH_SRV_RESTART;
  255. extern const WCHAR* const PVD_MTH_SRV_START_SERVICE;
  256. extern const WCHAR* const PVD_MTH_SRV_STOP_SERVICE;
  257. extern const WCHAR* const PVD_MTH_ZONE_RESUMEZONE;
  258. extern const WCHAR* const PVD_MTH_ZONE_PAUSEZONE;
  259. extern const WCHAR* const PVD_MTH_ZONE_RELOADZONE;
  260. extern const WCHAR* const PVD_MTH_ZONE_FORCEREFRESH;
  261. extern const WCHAR* const PVD_MTH_ZONE_UPDATEFROMDS;
  262. extern const WCHAR* const PVD_MTH_ZONE_WRITEBACKZONETOFILE;
  263. extern const WCHAR* const PVD_MTH_ZONE_CHANGEZONETYPE;
  264. extern const WCHAR* const PVD_MTH_ZONE_CREATEZONE;
  265. extern const WCHAR* const PVD_MTH_ZONE_RESETNOTIFYIPARRAY;
  266. extern const WCHAR* const PVD_MTH_ZONE_RESETSECONDARYIPARRAY;
  267. extern const WCHAR* const PVD_MTH_ZONE_GETDISTINGUISHEDNAME;
  268. extern const WCHAR* const PVD_MTH_ZONE_ARG_ZONENAME;
  269. extern const WCHAR* const PVD_MTH_ZONE_ARG_ZONETYPE;
  270. extern const WCHAR* const PVD_MTH_ZONE_ARG_DATAFILENAME;
  271. extern const WCHAR* const PVD_MTH_ZONE_ARG_IPADDRARRAY;
  272. extern const WCHAR* const PVD_MTH_ZONE_ARG_ADMINEMAILNAME;
  273. extern const WCHAR* const PVD_MTH_ZONE_ARG_SECURITY;
  274. extern const WCHAR* const PVD_MTH_ZONE_ARG_NOTIFY;
  275. extern const WCHAR* const PVD_MTH_ZONE_ARG_MASTERIPARRAY;
  276. extern const WCHAR* const PVD_MTH_ZONE_ARG_MASTERSLOCAL;
  277. extern const WCHAR* const PVD_MTH_ZONE_ARG_SECONDARYIPARRAY;
  278. extern const WCHAR* const PVD_MTH_ZONE_ARG_NOTIFYIPARRAY;
  279. extern const WCHAR* const PVD_MTH_REC_CREATEINSTANCEFROMTEXTREPRESENTATION;
  280. extern const WCHAR* const PVD_MTH_REC_MODIFY;
  281. extern const WCHAR* const PVD_MTH_REC_CREATEINSTANCEFROMPROPERTYDATA;
  282. extern const WCHAR* const PVD_MTH_REC_GETOBJECTBYTEXT;
  283. extern const WCHAR* const PVD_MTH_REC_ARG_DNSSERVER_NAME;
  284. extern const WCHAR* const PVD_MTH_REC_ARG_CONTAINER_NAME;
  285. extern const WCHAR* const PVD_MTH_REC_ARG_TEXTREP;
  286. extern const WCHAR* const PVD_MTH_REC_ARG_RR;
  287. extern const WCHAR* const PVD_MTH_RH_WRITEBACKROOTHINTDATAFILE;
  288. extern const WCHAR* const PVD_MTH_CACHE_CLEARDNSSERVERCACHE;
  289. //general
  290. extern const WCHAR* const PVD_DNS_CACHE;
  291. extern const WCHAR* const PVD_DNS_ROOTHINTS;
  292. extern const WCHAR* const PVD_DNS_LOCAL_SERVER;
  293. extern const WCHAR* const PVD_DNS_RETURN_VALUE;