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.

606 lines
30 KiB

  1. //--------------------------------------------------------------------------//
  2. // Application Header Files. //
  3. //--------------------------------------------------------------------------//
  4. #include "precomp.h"
  5. #include "callto.h"
  6. #include "calltoContext.h"
  7. #include "calltoResolver.h"
  8. #include "calltoDisambiguator.h"
  9. #include "calltoNM.h"
  10. //--------------------------------------------------------------------------//
  11. // CNMCallto::CNMCallto. //
  12. //--------------------------------------------------------------------------//
  13. CNMCallto::CNMCallto(void)
  14. {
  15. //tracec( assert( selfTest(), TEXT( "class CNMCallto failed self test..." ) ),
  16. // TEXT( "class CNMCallto passed self test...\r\n" ) );
  17. } // End of CNMCallto::CNMCallto.
  18. //--------------------------------------------------------------------------//
  19. // CNMCallto::~CNMCallto. //
  20. //--------------------------------------------------------------------------//
  21. CNMCallto::~CNMCallto(void)
  22. {
  23. } // End of CNMCallto::~CNMCallto.
  24. //--------------------------------------------------------------------------//
  25. // CNMCallto::callto. //
  26. //--------------------------------------------------------------------------//
  27. HRESULT
  28. CNMCallto::callto
  29. (
  30. const TCHAR * const url,
  31. const bool strict,
  32. const bool uiEnabled,
  33. INmCall** ppInternalCall
  34. ){
  35. CCalltoProperties calltoProperties;
  36. CCalltoCollection resolvedCalltoCollection;
  37. CCalltoCollection disambiguatedCalltoCollection;
  38. const ICallto * disambiguatedCallto = NULL;
  39. HRESULT result;
  40. if( url == NULL )
  41. {
  42. result = E_POINTER;
  43. }
  44. else if( url[ 0 ] == '\0' )
  45. {
  46. result = E_INVALIDARG;
  47. }
  48. else
  49. {
  50. result = m_resolver.resolve( this, &calltoProperties, &resolvedCalltoCollection, url, strict );
  51. if( resolvedCalltoCollection.get_count() > 0 )
  52. {
  53. result = m_disambiguator.disambiguate( this, &resolvedCalltoCollection, &disambiguatedCalltoCollection );
  54. if( (!uiEnabled) || (disambiguatedCalltoCollection.get_count() == 1) )
  55. {
  56. // Either there's only one choice or we've been instructed NOT to
  57. // present any ui... either way we just grab the first one...
  58. disambiguatedCallto = disambiguatedCalltoCollection.get_first();
  59. // and verify that it was really disambiguated...
  60. if( disambiguatedCallto->get_confidence() != S_UNDISAMBIGUATED )
  61. {
  62. result = S_OK;
  63. }
  64. else
  65. {
  66. disambiguatedCallto = NULL;
  67. }
  68. }
  69. }
  70. }
  71. CCallto emptyCallto;
  72. if( uiEnabled && (disambiguatedCallto == NULL) )
  73. {
  74. // the user must now make the decision...
  75. result = disambiguate( &disambiguatedCalltoCollection, &emptyCallto, &disambiguatedCallto );
  76. }
  77. if( (result == S_OK) && (disambiguatedCallto != NULL) )
  78. {
  79. calltoProperties.set_url( disambiguatedCallto->get_qualifiedName() );
  80. calltoProperties.set_destination( disambiguatedCallto->get_destination() );
  81. calltoProperties.set_type( disambiguatedCallto->get_type() );
  82. calltoProperties.set_alias( disambiguatedCallto->get_value() );
  83. if( StrCmpNI_literal( disambiguatedCallto->get_type(), TEXT( "phone" ) ) )
  84. {
  85. calltoProperties.set_E164( disambiguatedCallto->get_value() );
  86. }
  87. result = ((ICalltoContext *) this)->callto( &calltoProperties, ppInternalCall );
  88. }
  89. return( result );
  90. } // End of CNMCallto::callto.
  91. //--------------------------------------------------------------------------//
  92. // CNMCallto::get_mutableUIContext. //
  93. //--------------------------------------------------------------------------//
  94. IMutableUIContext * const
  95. CNMCallto::get_mutableUIContext(void) const
  96. {
  97. return( CCalltoContext::get_mutableUIContext() );
  98. } // End of CNMCallto::get_mutableUIContext.
  99. //--------------------------------------------------------------------------//
  100. // CNMCallto::get_mutableGatekeeperContext. //
  101. //--------------------------------------------------------------------------//
  102. IMutableGatekeeperContext * const
  103. CNMCallto::get_mutableGatekeeperContext(void) const
  104. {
  105. return( CCalltoContext::get_mutableGatekeeperContext() );
  106. } // End of CNMCallto::get_mutableGatekeeperContext.
  107. //--------------------------------------------------------------------------//
  108. // CNMCallto::get_mutableGatewayContext. //
  109. //--------------------------------------------------------------------------//
  110. IMutableGatewayContext * const
  111. CNMCallto::get_mutableGatewayContext(void) const
  112. {
  113. return( CCalltoContext::get_mutableGatewayContext() );
  114. } // End of CNMCallto::get_mutableGatewayContext.
  115. //--------------------------------------------------------------------------//
  116. // CNMCallto::get_mutableIlsContext. //
  117. //--------------------------------------------------------------------------//
  118. IMutableILSContext * const
  119. CNMCallto::get_mutableIlsContext(void) const
  120. {
  121. return( CCalltoContext::get_mutableIlsContext() );
  122. } // End of CNMCallto::get_mutableIlsContext.
  123. #if 0
  124. //--------------------------------------------------------------------------//
  125. // CNMCallto::selfTest. //
  126. //--------------------------------------------------------------------------//
  127. bool
  128. CNMCallto::selfTest(void)
  129. {
  130. static TCHAR buffer[ 2048 ];
  131. static LONG tested = -1;
  132. static HRESULT confidenceLevels[] =
  133. {
  134. S_CONFIDENCE_CERTITUDE,
  135. S_CONFIDENCE_HIGH,
  136. S_CONFIDENCE_MEDIUM,
  137. S_CONFIDENCE_LOW
  138. };
  139. static const TCHAR * testUrls[] =
  140. {
  141. TEXT( "callto:myGateway|email:[email protected]" ), // full
  142. TEXT( "callto:myGateway|email:jlemire" ),
  143. TEXT( "callto:myGateway|phone:1 (425) 703-9224" ),
  144. TEXT( "callto:myGateway|phone:1 (800) RU LEGIT" ),
  145. TEXT( "callto:myGateway|string:helpdesk" ),
  146. TEXT( "callto:myGateway|ils:[email protected]" ),
  147. TEXT( "callto:myGateway|ils:msils/[email protected]" ),
  148. TEXT( "callto:myGateway|ils:msils:80/[email protected]" ),
  149. TEXT( "callto:myGateway|ip:157.59.14.64" ),
  150. TEXT( "callto:myGateway|computer:JLEMIRE-2" ),
  151. TEXT( "callto:myGateway|computer:\\\\JLEMIRE-2" ),
  152. TEXT( "callto:email:[email protected]" ), // no gateway
  153. TEXT( "callto:email:jlemire" ),
  154. TEXT( "callto:phone:1 (425) 703-9224" ),
  155. TEXT( "callto:phone:1 (800) RU LEGIT" ),
  156. TEXT( "callto:string:helpdesk" ),
  157. TEXT( "callto:ils:[email protected]" ),
  158. TEXT( "callto:ils:msils/[email protected]" ),
  159. TEXT( "callto:ils:msils:80/[email protected]" ),
  160. TEXT( "callto:ip:157.59.14.64" ),
  161. TEXT( "callto:computer:JLEMIRE-2" ),
  162. TEXT( "callto:computer:\\\\JLEMIRE-2" ),
  163. TEXT( "callto:myGateway|[email protected]" ), // no type
  164. TEXT( "callto:myGateway|jlemire" ),
  165. TEXT( "callto:myGateway|1 (425) 703-9224" ),
  166. TEXT( "callto:myGateway|1 (800) RU LEGIT" ),
  167. TEXT( "callto:myGateway|helpdesk" ),
  168. TEXT( "callto:myGateway|[email protected]" ),
  169. TEXT( "callto:myGateway|msils/[email protected]" ),
  170. TEXT( "callto:myGateway|msils:80/[email protected]" ),
  171. TEXT( "callto:myGateway|157.59.14.64" ),
  172. TEXT( "callto:myGateway|JLEMIRE-2" ),
  173. TEXT( "callto:myGateway|\\\\JLEMIRE-2" ),
  174. TEXT( "callto:[email protected]" ), // no gateway + no type
  175. TEXT( "callto:jlemire" ),
  176. TEXT( "callto:1 (425) 703-9224" ),
  177. TEXT( "callto:1 (800) RU LEGIT" ),
  178. TEXT( "callto:helpdesk" ),
  179. TEXT( "callto:[email protected]" ),
  180. TEXT( "callto:msils/[email protected]" ),
  181. TEXT( "callto:msils:80/[email protected]" ),
  182. TEXT( "callto:msils:80/[email protected]" ),
  183. TEXT( "callto:157.59.14.64" ),
  184. TEXT( "callto:JLEMIRE-2" ),
  185. TEXT( "callto:\\\\JLEMIRE-2" ),
  186. // repeat with params
  187. TEXT( "callto:myGateway|email:[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ), // full
  188. TEXT( "callto:myGateway|email:jlemire+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  189. TEXT( "callto:myGateway|phone:1 (425) 703-9224+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  190. TEXT( "callto:myGateway|phone:1 (800) RU LEGIT+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  191. TEXT( "callto:myGateway|string:helpdesk+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  192. TEXT( "callto:myGateway|ils:[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  193. TEXT( "callto:myGateway|ils:msils/[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  194. TEXT( "callto:myGateway|ils:msils:80/[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  195. TEXT( "callto:myGateway|ip:157.59.14.64+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  196. TEXT( "callto:myGateway|computer:JLEMIRE-2+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  197. TEXT( "callto:myGateway|computer:\\\\JLEMIRE-2+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  198. TEXT( "callto:email:[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ), // no gateway
  199. TEXT( "callto:email:jlemire+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  200. TEXT( "callto:phone:1 (425) 703-9224+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  201. TEXT( "callto:phone:1 (800) RU LEGIT+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  202. TEXT( "callto:string:helpdesk+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  203. TEXT( "callto:ils:[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  204. TEXT( "callto:ils:msils/[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  205. TEXT( "callto:ils:msils:80/[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  206. TEXT( "callto:ip:157.59.14.64+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  207. TEXT( "callto:computer:JLEMIRE-2+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  208. TEXT( "callto:computer:\\\\JLEMIRE-2+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  209. TEXT( "callto:myGateway|[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ), // no type
  210. TEXT( "callto:myGateway|jlemire+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  211. TEXT( "callto:myGateway|1 (425) 703-9224+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  212. TEXT( "callto:myGateway|1 (800) RU LEGIT+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  213. TEXT( "callto:myGateway|helpdesk+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  214. TEXT( "callto:myGateway|[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  215. TEXT( "callto:myGateway|msils/[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  216. TEXT( "callto:myGateway|msils:80/[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  217. TEXT( "callto:myGateway|157.59.14.64+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  218. TEXT( "callto:myGateway|JLEMIRE-2+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  219. TEXT( "callto:myGateway|\\\\JLEMIRE-2+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  220. TEXT( "callto:[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ), // no gateway + no type
  221. TEXT( "callto:jlemire+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  222. TEXT( "callto:1 (425) 703-9224+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  223. TEXT( "callto:1 (800) RU LEGIT+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  224. TEXT( "callto:helpdesk+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  225. TEXT( "callto:[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  226. TEXT( "callto:msils/[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  227. TEXT( "callto:msils:80/[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  228. TEXT( "callto:msils:80/[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  229. TEXT( "callto:157.59.14.64+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  230. TEXT( "callto:JLEMIRE-2+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  231. TEXT( "callto:\\\\JLEMIRE-2+secure+certificate=NetMeeting Default Certificate+mysteryParam=" ),
  232. // repeat without callto:
  233. TEXT( "myGateway|email:[email protected]" ), // full
  234. TEXT( "myGateway|email:jlemire" ),
  235. TEXT( "myGateway|phone:1 (425) 703-9224" ),
  236. TEXT( "myGateway|phone:1 (800) RU LEGIT" ),
  237. TEXT( "myGateway|string:helpdesk" ),
  238. TEXT( "myGateway|ils:[email protected]" ),
  239. TEXT( "myGateway|ils:msils/[email protected]" ),
  240. TEXT( "myGateway|ils:msils:80/[email protected]" ),
  241. TEXT( "myGateway|ip:157.59.14.64" ),
  242. TEXT( "myGateway|computer:JLEMIRE-2" ),
  243. TEXT( "myGateway|computer:\\\\JLEMIRE-2" ),
  244. TEXT( "email:[email protected]" ), // no gateway
  245. TEXT( "email:jlemire" ),
  246. TEXT( "phone:1 (425) 703-9224" ),
  247. TEXT( "phone:1 (800) RU LEGIT" ),
  248. TEXT( "string:helpdesk" ),
  249. TEXT( "ils:[email protected]" ),
  250. TEXT( "ils:msils/[email protected]" ),
  251. TEXT( "ils:msils:80/[email protected]" ),
  252. TEXT( "ip:157.59.14.64" ),
  253. TEXT( "computer:JLEMIRE-2" ),
  254. TEXT( "computer:\\\\JLEMIRE-2" ),
  255. TEXT( "myGateway|[email protected]" ), // no type
  256. TEXT( "myGateway|jlemire" ),
  257. TEXT( "myGateway|1 (425) 703-9224" ),
  258. TEXT( "myGateway|1 (800) RU LEGIT" ),
  259. TEXT( "myGateway|helpdesk" ),
  260. TEXT( "myGateway|[email protected]" ),
  261. TEXT( "myGateway|msils/[email protected]" ),
  262. TEXT( "myGateway|msils:80/[email protected]" ),
  263. TEXT( "myGateway|157.59.14.64" ),
  264. TEXT( "myGateway|JLEMIRE-2" ),
  265. TEXT( "myGateway|\\\\JLEMIRE-2" ),
  266. TEXT( "[email protected]" ), // no gateway + no type
  267. TEXT( "jlemire" ),
  268. TEXT( "1 (425) 703-9224" ),
  269. TEXT( "1 (800) RU LEGIT" ),
  270. TEXT( "helpdesk" ),
  271. TEXT( "[email protected]" ),
  272. TEXT( "msils/[email protected]" ),
  273. TEXT( "msils:80/[email protected]" ),
  274. TEXT( "msils:80/[email protected]" ),
  275. TEXT( "157.59.14.64" ),
  276. TEXT( "JLEMIRE-2" ),
  277. TEXT( "\\\\JLEMIRE-2" ),
  278. TEXT( "callto:futuretype:aren't I nicely extensible?" ),
  279. TEXT( "callto:myGateway|futuretype:aren't I nicely extensible?" )
  280. };
  281. static TCHAR * expectedResults[ elementsof( testUrls ) ] =
  282. {
  283. TEXT( "callto:myGateway|email:[email protected]" ), // TEXT( "callto:myGateway|email:[email protected]" )
  284. TEXT( "" ), // TEXT( "callto:myGateway|email:jlemire" )
  285. TEXT( "" ), // TEXT( "callto:myGateway|phone:1 (425) 703-9224" )
  286. TEXT( "" ), // TEXT( "callto:myGateway|phone:1 (800) RU LEGIT" )
  287. TEXT( "" ), // TEXT( "callto:myGateway|string:helpdesk" )
  288. TEXT( "" ), // TEXT( "callto:myGateway|ils:[email protected]" )
  289. TEXT( "" ), // TEXT( "callto:myGateway|ils:msils/[email protected]" )
  290. TEXT( "" ), // TEXT( "callto:myGateway|ils:msils:80/[email protected]" )
  291. TEXT( "" ), // TEXT( "callto:myGateway|ip:157.59.14.64" )
  292. TEXT( "" ), // TEXT( "callto:myGateway|computer:JLEMIRE-2" )
  293. TEXT( "" ), // TEXT( "callto:myGateway|computer:\\\\JLEMIRE-2" )
  294. TEXT( "" ), // TEXT( "callto:email:[email protected]" ),
  295. TEXT( "" ), // TEXT( "callto:email:jlemire" )
  296. TEXT( "" ), // TEXT( "callto:phone:1 (425) 703-9224" )
  297. TEXT( "" ), // TEXT( "callto:phone:1 (800) RU LEGIT" )
  298. TEXT( "" ), // TEXT( "callto:string:helpdesk" )
  299. TEXT( "" ), // TEXT( "callto:ils:[email protected]" )
  300. TEXT( "" ), // TEXT( "callto:ils:msils/[email protected]" )
  301. TEXT( "" ), // TEXT( "callto:ils:msils:80/[email protected]" )
  302. TEXT( "" ), // TEXT( "callto:ip:157.59.14.64" )
  303. TEXT( "" ), // TEXT( "callto:computer:JLEMIRE-2" )
  304. TEXT( "" ), // TEXT( "callto:computer:\\\\JLEMIRE-2" )
  305. TEXT( "" ), // TEXT( "callto:myGateway|[email protected]" )
  306. TEXT( "" ), // TEXT( "callto:myGateway|jlemire" )
  307. TEXT( "" ), // TEXT( "callto:myGateway|1 (425) 703-9224" )
  308. TEXT( "" ), // TEXT( "callto:myGateway|1 (800) RU LEGIT" )
  309. TEXT( "" ), // TEXT( "callto:myGateway|helpdesk" )
  310. TEXT( "" ), // TEXT( "callto:myGateway|[email protected]" )
  311. TEXT( "" ), // TEXT( "callto:myGateway|msils/[email protected]" )
  312. TEXT( "" ), // TEXT( "callto:myGateway|msils:80/[email protected]" )
  313. TEXT( "" ), // TEXT( "callto:myGateway|157.59.14.64" )
  314. TEXT( "" ), // TEXT( "callto:myGateway|JLEMIRE-2" )
  315. TEXT( "" ), // TEXT( "callto:myGateway|\\\\JLEMIRE-2" )
  316. TEXT( "" ), // TEXT( "callto:[email protected]" )
  317. TEXT( "" ), // TEXT( "callto:jlemire" )
  318. TEXT( "" ), // TEXT( "callto:1 (425) 703-9224" )
  319. TEXT( "" ), // TEXT( "callto:1 (800) RU LEGIT" )
  320. TEXT( "" ), // TEXT( "callto:helpdesk" )
  321. TEXT( "" ), // TEXT( "callto:[email protected]" )
  322. TEXT( "" ), // TEXT( "callto:msils/[email protected]" )
  323. TEXT( "" ), // TEXT( "callto:msils:80/[email protected]" )
  324. TEXT( "" ), // TEXT( "callto:msils:80/[email protected]" )
  325. TEXT( "" ), // TEXT( "callto:157.59.14.64" )
  326. TEXT( "" ), // TEXT( "callto:JLEMIRE-2" )
  327. TEXT( "" ), // TEXT( "callto:\\\\JLEMIRE-2" )
  328. TEXT( "" ), // TEXT( "callto:myGateway|email:[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  329. TEXT( "" ), // TEXT( "callto:myGateway|email:jlemire+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  330. TEXT( "" ), // TEXT( "callto:myGateway|phone:1 (425) 703-9224+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  331. TEXT( "" ), // TEXT( "callto:myGateway|phone:1 (800) RU LEGIT+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  332. TEXT( "" ), // TEXT( "callto:myGateway|string:helpdesk+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  333. TEXT( "" ), // TEXT( "callto:myGateway|ils:[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  334. TEXT( "" ), // TEXT( "callto:myGateway|ils:msils/[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  335. TEXT( "" ), // TEXT( "callto:myGateway|ils:msils:80/[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  336. TEXT( "" ), // TEXT( "callto:myGateway|ip:157.59.14.64+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  337. TEXT( "" ), // TEXT( "callto:myGateway|computer:JLEMIRE-2+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  338. TEXT( "" ), // TEXT( "callto:myGateway|computer:\\\\JLEMIRE-2+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  339. TEXT( "" ), // TEXT( "callto:email:[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  340. TEXT( "" ), // TEXT( "callto:email:jlemire+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  341. TEXT( "" ), // TEXT( "callto:phone:1 (425) 703-9224+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  342. TEXT( "" ), // TEXT( "callto:phone:1 (800) RU LEGIT+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  343. TEXT( "" ), // TEXT( "callto:string:helpdesk+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  344. TEXT( "" ), // TEXT( "callto:ils:[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  345. TEXT( "" ), // TEXT( "callto:ils:msils/[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  346. TEXT( "" ), // TEXT( "callto:ils:msils:80/[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  347. TEXT( "" ), // TEXT( "callto:ip:157.59.14.64+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  348. TEXT( "" ), // TEXT( "callto:computer:JLEMIRE-2+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  349. TEXT( "" ), // TEXT( "callto:computer:\\\\JLEMIRE-2+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  350. TEXT( "" ), // TEXT( "callto:myGateway|[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  351. TEXT( "" ), // TEXT( "callto:myGateway|jlemire+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  352. TEXT( "" ), // TEXT( "callto:myGateway|1 (425) 703-9224+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  353. TEXT( "" ), // TEXT( "callto:myGateway|1 (800) RU LEGIT+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  354. TEXT( "" ), // TEXT( "callto:myGateway|helpdesk+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  355. TEXT( "" ), // TEXT( "callto:myGateway|[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  356. TEXT( "" ), // TEXT( "callto:myGateway|msils/[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  357. TEXT( "" ), // TEXT( "callto:myGateway|msils:80/[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  358. TEXT( "" ), // TEXT( "callto:myGateway|157.59.14.64+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  359. TEXT( "" ), // TEXT( "callto:myGateway|JLEMIRE-2+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  360. TEXT( "" ), // TEXT( "callto:myGateway|\\\\JLEMIRE-2+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  361. TEXT( "" ), // TEXT( "callto:[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  362. TEXT( "" ), // TEXT( "callto:jlemire+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  363. TEXT( "" ), // TEXT( "callto:1 (425) 703-9224+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  364. TEXT( "" ), // TEXT( "callto:1 (800) RU LEGIT+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  365. TEXT( "" ), // TEXT( "callto:helpdesk+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  366. TEXT( "" ), // TEXT( "callto:[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  367. TEXT( "" ), // TEXT( "callto:msils/[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  368. TEXT( "" ), // TEXT( "callto:msils:80/[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  369. TEXT( "" ), // TEXT( "callto:msils:80/[email protected]+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  370. TEXT( "" ), // TEXT( "callto:157.59.14.64+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  371. TEXT( "" ), // TEXT( "callto:JLEMIRE-2+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  372. TEXT( "" ), // TEXT( "callto:\\\\JLEMIRE-2+secure+certificate=NetMeeting Default Certificate+mysteryParam=" )
  373. TEXT( "" ), // TEXT( "myGateway|email:[email protected]" )
  374. TEXT( "" ), // TEXT( "myGateway|email:jlemire" )
  375. TEXT( "" ), // TEXT( "myGateway|phone:1 (425) 703-9224" )
  376. TEXT( "" ), // TEXT( "myGateway|phone:1 (800) RU LEGIT" )
  377. TEXT( "" ), // TEXT( "myGateway|string:helpdesk" )
  378. TEXT( "" ), // TEXT( "myGateway|ils:[email protected]" )
  379. TEXT( "" ), // TEXT( "myGateway|ils:msils/[email protected]" )
  380. TEXT( "" ), // TEXT( "myGateway|ils:msils:80/[email protected]" )
  381. TEXT( "" ), // TEXT( "myGateway|ip:157.59.14.64" )
  382. TEXT( "" ), // TEXT( "myGateway|computer:JLEMIRE-2" )
  383. TEXT( "" ), // TEXT( "myGateway|computer:\\\\JLEMIRE-2" )
  384. TEXT( "" ), // TEXT( "email:[email protected]" )
  385. TEXT( "" ), // TEXT( "email:jlemire" )
  386. TEXT( "" ), // TEXT( "phone:1 (425) 703-9224" )
  387. TEXT( "" ), // TEXT( "phone:1 (800) RU LEGIT" )
  388. TEXT( "" ), // TEXT( "string:helpdesk" )
  389. TEXT( "" ), // TEXT( "ils:[email protected]" )
  390. TEXT( "" ), // TEXT( "ils:msils/[email protected]" )
  391. TEXT( "" ), // TEXT( "ils:msils:80/[email protected]" )
  392. TEXT( "" ), // TEXT( "ip:157.59.14.64" )
  393. TEXT( "" ), // TEXT( "computer:JLEMIRE-2" )
  394. TEXT( "" ), // TEXT( "computer:\\\\JLEMIRE-2" )
  395. TEXT( "" ), // TEXT( "myGateway|[email protected]" )
  396. TEXT( "" ), // TEXT( "myGateway|jlemire" )
  397. TEXT( "" ), // TEXT( "myGateway|1 (425) 703-9224" )
  398. TEXT( "" ), // TEXT( "myGateway|1 (800) RU LEGIT" )
  399. TEXT( "" ), // TEXT( "myGateway|helpdesk" )
  400. TEXT( "" ), // TEXT( "myGateway|[email protected]" )
  401. TEXT( "" ), // TEXT( "myGateway|msils/[email protected]" )
  402. TEXT( "" ), // TEXT( "myGateway|msils:80/[email protected]" )
  403. TEXT( "" ), // TEXT( "myGateway|157.59.14.64" )
  404. TEXT( "" ), // TEXT( "myGateway|JLEMIRE-2" )
  405. TEXT( "" ), // TEXT( "myGateway|\\\\JLEMIRE-2" )
  406. TEXT( "" ), // TEXT( "[email protected]" )
  407. TEXT( "" ), // TEXT( "jlemire" )
  408. TEXT( "" ), // TEXT( "1 (425) 703-9224" )
  409. TEXT( "" ), // TEXT( "1 (800) RU LEGIT" )
  410. TEXT( "" ), // TEXT( "helpdesk" )
  411. TEXT( "" ), // TEXT( "[email protected]" )
  412. TEXT( "" ), // TEXT( "msils/[email protected]" )
  413. TEXT( "" ), // TEXT( "msils:80/[email protected]" )
  414. TEXT( "" ), // TEXT( "msils:80/[email protected]" )
  415. TEXT( "" ), // TEXT( "157.59.14.64" )
  416. TEXT( "" ), // TEXT( "JLEMIRE-2" )
  417. TEXT( "" ), // TEXT( "\\\\JLEMIRE-2" )
  418. TEXT( "" ), // TEXT( "callto:futuretype:aren't I nicely extensible?" )
  419. TEXT( "" ) // TEXT( "callto:myGateway|futuretype:aren't I nicely extensible?"
  420. };
  421. static int contexts[ 4 ];
  422. static TCHAR * actualResults[ elementsof( testUrls ) * elementsof( contexts ) ];
  423. HRESULT result = S_OK;
  424. if( InterlockedIncrement( &tested ) == 0 )
  425. {
  426. CCalltoProperties calltoProperties;
  427. CCalltoCollection resolvedCalltoCollection;
  428. CCalltoCollection disambiguatedCalltoCollection;
  429. for( int context = 0; context < elementsof( contexts ); context++ )
  430. {
  431. CGatekeeperContext::set_enabled( context == 0 );
  432. CGatewayContext::set_enabled( context == 1 );
  433. CILSContext::set_enabled( context == 2 );
  434. for( int nn = 0; nn < elementsof( testUrls ); nn++ )
  435. {
  436. HRESULT testResult = m_resolver.resolve( this, &calltoProperties, &resolvedCalltoCollection, testUrls[ nn ], false );
  437. if( testResult != S_OK )
  438. {
  439. wsprintf( buffer, TEXT( "NOT RESOLVED!!!\t\tresult:0x%08X:\r\n" ), testResult );
  440. if( FAILED( testResult ) && (!FAILED( result )) )
  441. {
  442. result = testResult;
  443. }
  444. else if( !FAILED( result ) )
  445. {
  446. result = MAKE_HRESULT( SEVERITY_ERROR, FACILITY_WIN32, nn );
  447. }
  448. }
  449. else
  450. {
  451. *buffer = NULL;
  452. for( int level = 0; level < elementsof( confidenceLevels ); level++ )
  453. {
  454. const ICallto * resolvedCallto;
  455. for( resolvedCallto = resolvedCalltoCollection.get_first();
  456. resolvedCallto != NULL;
  457. resolvedCallto = resolvedCalltoCollection.get_next() )
  458. {
  459. if( resolvedCallto->get_confidence() == confidenceLevels[ level ] )
  460. {
  461. wsprintf( &buffer[ lstrlen( buffer ) ], TEXT( "\t\t\t%9s: %s\r\n" ), ((confidenceLevels[ level ] == S_CONFIDENCE_CERTITUDE)? TEXT( "CERTITUDE" ): ((confidenceLevels[ level ] == S_CONFIDENCE_HIGH)? TEXT( "HIGH" ): ((confidenceLevels[ level ] == S_CONFIDENCE_MEDIUM)? TEXT( "MEDIUM" ): TEXT( "LOW" )))), resolvedCallto->get_qualifiedName() );
  462. }
  463. }
  464. }
  465. testResult = m_disambiguator.disambiguate( this, &calltoProperties, &resolvedCalltoCollection, &disambiguatedCalltoCollection );
  466. if( disambiguatedCalltoCollection.get_count() == 0 )
  467. {
  468. wsprintf( buffer, TEXT( "NOT DISAMBIGUATED!!!\t\tresult:0x%08X:\r\n" ), testResult );
  469. actualResults[ nn + (context * elementsof( testUrls )) ] = NULL;
  470. if( FAILED( testResult ) && (!FAILED( result )) )
  471. {
  472. result = testResult;
  473. }
  474. else if( !FAILED( result ) )
  475. {
  476. result = MAKE_HRESULT( SEVERITY_ERROR, FACILITY_WIN32, nn );
  477. }
  478. }
  479. else
  480. {
  481. const ICallto * disambiguatedCallto = disambiguatedCalltoCollection.get_first();
  482. level = disambiguatedCallto->get_confidence();
  483. wsprintf( &buffer[ lstrlen( buffer ) ], TEXT( "\r\n%9s:\t%s\tresult:0x%08X\r\n" ), ((level == S_CONFIDENCE_CERTITUDE)? TEXT( "CERTITUDE" ): ((level == S_CONFIDENCE_HIGH)? TEXT( "HIGH" ): ((level == S_CONFIDENCE_MEDIUM)? TEXT( "MEDIUM" ): TEXT( "LOW" )))), disambiguatedCallto->get_qualifiedName(), testResult );
  484. }
  485. }
  486. if( (actualResults[ nn + (context * elementsof( testUrls )) ] = new TCHAR [ lstrlen( buffer ) + 1 ]) != NULL )
  487. {
  488. lstrcpy( actualResults[ nn + (context * elementsof( testUrls )) ], buffer );
  489. }
  490. }
  491. }
  492. for( int nn = 0; nn < elementsof( actualResults ); nn++ )
  493. {
  494. trace( TEXT( "------------------------------------------------------------------------------\r\n" ) );
  495. trace( TEXT( "%03d:\tgatekeeper:%-5s\tgateway:%s\tils:%s\r\n\r\n" ), nn, (((nn / elementsof( testUrls )) == 0)? TEXT( "true" ): TEXT( "false" )), (((nn / elementsof( testUrls )) == 1)? TEXT( "true" ): TEXT( "false" )), (((nn / elementsof( testUrls )) == 2)? TEXT( "true" ): TEXT( "false" )) );
  496. trace( TEXT( "\t\t\t%s\r\n" ), testUrls[ nn % elementsof( testUrls ) ] );
  497. trace( TEXT( "%s" ), actualResults[ nn ] );
  498. trace( TEXT( "------------------------------------------------------------------------------\r\n\r\n" ) );
  499. delete [] actualResults[ nn ];
  500. }
  501. m_selfTestResult = result;
  502. }
  503. return( result == S_OK );
  504. } // End of CNMCallto::selfTest.
  505. //--------------------------------------------------------------------------//
  506. // Win32 console process entry point. //
  507. //--------------------------------------------------------------------------//
  508. int
  509. main
  510. (
  511. int ,//ArgC,
  512. const char * const //ArgV[]
  513. ){
  514. CNMCallto callto; // Just instantiating one of these will also cause CCalltoResolver::selfTest() to run...
  515. callto.callto( TEXT( "jlemire" ), false ); // not strict...
  516. return( (int) callto.m_selfTestResult );
  517. } // End of main.
  518. #endif // 0