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.

230 lines
6.9 KiB

  1. #if !defined( callto_h )
  2. #define callto_h
  3. //--------------------------------------------------------------------------//
  4. #include "call.h"
  5. #define strlen_literal( l ) ((sizeof( (l) ) / sizeof( TCHAR )) - 1)
  6. #define StrCmpNI_literal( str, l ) ((bool)(StrCmpNI( (str), (l), ((sizeof( (l) ) / sizeof( TCHAR )) - 1) ) == 0))
  7. //--------------------------------------------------------------------------//
  8. // Public Methods. //
  9. //--------------------------------------------------------------------------//
  10. HRESULT DecimalStringToUINT
  11. (
  12. const TCHAR * const pszDecimalString, // Pointer to string to convert...
  13. unsigned int & uiValue // out unsigned int reference to receive converted value...
  14. );
  15. HRESULT GetIpAddress
  16. (
  17. const TCHAR * const pszIpAddress, // pointer to dotted IP address string
  18. unsigned long & ulIpAddress // out unsigned long reference to receive IP address
  19. );
  20. HRESULT GetIpAddressFromHostName
  21. (
  22. const TCHAR * const pszName, // pointer to host name to get IP address of
  23. unsigned long & ulIpAddress // out unsigned long reference to receive IP address
  24. );
  25. bool IsLocalIpAddress
  26. (
  27. const unsigned long IpAddress // IP Address to verify is/not local
  28. );
  29. bool IsPhoneNumber
  30. (
  31. const TCHAR * pszPhone // string to check for invalid phone number characters
  32. );
  33. bool bCanCallAsPhoneNumber
  34. (
  35. const TCHAR * const pszPhone // string to check for call placement
  36. );
  37. int TrimSzCallto
  38. (
  39. TCHAR * const pszSrc // Pointer to string to trim blanks from in place...
  40. );
  41. HRESULT Unescape
  42. (
  43. TCHAR * const pszSrc // pointer to string to unescape in place
  44. );
  45. //--------------------------------------------------------------------------//
  46. // class CCalltoParams. //
  47. //--------------------------------------------------------------------------//
  48. class CCalltoParams
  49. {
  50. public:
  51. CCalltoParams(void);
  52. virtual ~CCalltoParams();
  53. HRESULT SetParams
  54. (
  55. const TCHAR * const pszParams = NULL // pointer to string of "+name=value" pairs to parse
  56. );
  57. const TCHAR * const GetParam
  58. (
  59. const TCHAR * const pszName, // pointer to name of parameter to get
  60. const TCHAR * const pszDefaultValue = NULL // pointer to default value to return if "name" doesn't exist
  61. ) const;
  62. bool GetBooleanParam
  63. (
  64. const TCHAR * const pszName, // pointer to name of parameter to evaluate as boolean
  65. const bool bDefaultValue = false // default value to return is "name" doesn't exist
  66. ) const;
  67. private: // private members ----------------------------------------//
  68. int m_iCount;
  69. TCHAR * m_pszNames[ 15 ];
  70. TCHAR * m_pszValues[ 15 ];
  71. TCHAR m_chNameDelimiter;
  72. TCHAR m_chValueDelimiter;
  73. TCHAR * m_pszParams;
  74. int m_iParamsLength;
  75. }; // End of class CCalltoParams.
  76. //--------------------------------------------------------------------------//
  77. // class CCallto. //
  78. //--------------------------------------------------------------------------//
  79. class CCallto
  80. {
  81. public:
  82. CCallto(void);
  83. virtual ~CCallto(void);
  84. public:
  85. virtual HRESULT Callto
  86. (
  87. const TCHAR * const pszCallto, // pointer to the callto url to try to place the call with...
  88. const TCHAR * const pszDisplayName, // pointer to the display name to use...
  89. const NM_ADDR_TYPE nmType, // callto type to resolve this callto as...
  90. const bool bAddressOnly, // the pszCallto parameter is to be interpreted as a pre-unescaped addressing component vs a full callto...
  91. const bool * const pbSecurityPreference, // pointer to security preference, NULL for none. must be "compatible" with secure param if present...
  92. const bool bAddToMru, // whether or not save in mru...
  93. const bool bUIEnabled, // whether or not to perform user interaction on errors...
  94. const HWND hwndParent, // if bUIEnabled is true this is the window to parent error/status windows to...
  95. INmCall ** const ppInternalCall // out pointer to INmCall * to receive INmCall * generated by placing call...
  96. );
  97. virtual void SetGatekeeperEnabled
  98. (
  99. const bool bEnabled // new Gatekeeper state
  100. );
  101. virtual HRESULT SetGatekeeperName
  102. (
  103. const TCHAR * const pszGatekeeperName // new Gatekeeper name
  104. );
  105. virtual void SetGatewayEnabled
  106. (
  107. const bool bEnabled // new Gateway state
  108. );
  109. virtual HRESULT SetGatewayName
  110. (
  111. const TCHAR * const pszGatewayName // new Gateway name
  112. );
  113. virtual HRESULT SetIlsServerName
  114. (
  115. const TCHAR * const pszServerName // pointer to new default Ils server name
  116. );
  117. static const int s_iMaxCalltoLength;
  118. static const int s_iMaxAddressLength;
  119. static bool DoUserValidation(const TCHAR * const pszCallto);
  120. private:
  121. HRESULT Parse
  122. (
  123. const TCHAR * const pszCallto // pointer to the callto url to parse...
  124. );
  125. HRESULT ParseAddress(void);
  126. HRESULT Resolve
  127. (
  128. const NM_ADDR_TYPE nmType // callto type to resolve this callto as if no type specified in the pszCallto parameter...
  129. );
  130. HRESULT PlaceCall
  131. (
  132. const TCHAR * const pszCallto, // pointer to the callto url to try to place the call with...
  133. const bool bAddToMru, // whether or not save in mru...
  134. const bool bSecure, // whether or not to place the call securely...
  135. INmCall ** const ppInternalCall // out pointer to INmCall * to receive INmCall * generated by placing call...
  136. );
  137. HRESULT GetValidatedSecurity
  138. (
  139. const bool * const pbSecurityPreference, // pointer to security preference, NULL for none. must be "compatible" with secure param if present...
  140. bool & bValidatedSecurity // out bool reference to recieve validated security setting
  141. );
  142. bool inGatekeeperMode(void);
  143. HRESULT GetGatekeeperIpAddress
  144. (
  145. unsigned long & ulIpAddress // out unsigned long reference to receive gatekeeper IP address
  146. );
  147. bool inGatewayMode(void);
  148. HRESULT GetGatewayIpAddress
  149. (
  150. unsigned long & ulIpAddress // out unsigned long reference to receive gateway IP address
  151. );
  152. HRESULT GetIpAddressFromIls
  153. (
  154. unsigned long & ulIpAddress // out unsigned long reference to receive IP address
  155. );
  156. private:
  157. HWND m_hwndParent;
  158. bool m_bUnescapedAddressOnly;
  159. bool m_bUIEnabled;
  160. unsigned long m_ulDestination;
  161. TCHAR * m_pszCalltoBuffer;
  162. TCHAR * m_pszAddress;
  163. TCHAR * m_pszParameters;
  164. TCHAR * m_pszParsePos;
  165. TCHAR * m_pszIlsServer;
  166. unsigned int m_uiIlsPort;
  167. bool m_bGatekeeperEnabled;
  168. TCHAR * m_pszGatekeeperName;
  169. unsigned long m_ulGatekeeperAddress;
  170. bool m_bGatewayEnabled;
  171. TCHAR * m_pszGatewayName;
  172. unsigned long m_ulGatewayAddress;
  173. TCHAR * m_pszDefaultIlsServerName;
  174. TCHAR * m_pszEmail;
  175. TCHAR * m_pszDisplayName;
  176. CCalltoParams m_Parameters;
  177. NM_ADDR_TYPE m_nmAddressType;
  178. }; // End of class CCallto.
  179. //--------------------------------------------------------------------------//
  180. #endif // !defined( callto_h )