#if !defined( callto_h ) #define callto_h //--------------------------------------------------------------------------// #include "call.h" #define strlen_literal( l ) ((sizeof( (l) ) / sizeof( TCHAR )) - 1) #define StrCmpNI_literal( str, l ) ((bool)(StrCmpNI( (str), (l), ((sizeof( (l) ) / sizeof( TCHAR )) - 1) ) == 0)) //--------------------------------------------------------------------------// // Public Methods. // //--------------------------------------------------------------------------// HRESULT DecimalStringToUINT ( const TCHAR * const pszDecimalString, // Pointer to string to convert... unsigned int & uiValue // out unsigned int reference to receive converted value... ); HRESULT GetIpAddress ( const TCHAR * const pszIpAddress, // pointer to dotted IP address string unsigned long & ulIpAddress // out unsigned long reference to receive IP address ); HRESULT GetIpAddressFromHostName ( const TCHAR * const pszName, // pointer to host name to get IP address of unsigned long & ulIpAddress // out unsigned long reference to receive IP address ); bool IsLocalIpAddress ( const unsigned long IpAddress // IP Address to verify is/not local ); bool IsPhoneNumber ( const TCHAR * pszPhone // string to check for invalid phone number characters ); bool bCanCallAsPhoneNumber ( const TCHAR * const pszPhone // string to check for call placement ); int TrimSzCallto ( TCHAR * const pszSrc // Pointer to string to trim blanks from in place... ); HRESULT Unescape ( TCHAR * const pszSrc // pointer to string to unescape in place ); //--------------------------------------------------------------------------// // class CCalltoParams. // //--------------------------------------------------------------------------// class CCalltoParams { public: CCalltoParams(void); virtual ~CCalltoParams(); HRESULT SetParams ( const TCHAR * const pszParams = NULL // pointer to string of "+name=value" pairs to parse ); const TCHAR * const GetParam ( const TCHAR * const pszName, // pointer to name of parameter to get const TCHAR * const pszDefaultValue = NULL // pointer to default value to return if "name" doesn't exist ) const; bool GetBooleanParam ( const TCHAR * const pszName, // pointer to name of parameter to evaluate as boolean const bool bDefaultValue = false // default value to return is "name" doesn't exist ) const; private: // private members ----------------------------------------// int m_iCount; TCHAR * m_pszNames[ 15 ]; TCHAR * m_pszValues[ 15 ]; TCHAR m_chNameDelimiter; TCHAR m_chValueDelimiter; TCHAR * m_pszParams; int m_iParamsLength; }; // End of class CCalltoParams. //--------------------------------------------------------------------------// // class CCallto. // //--------------------------------------------------------------------------// class CCallto { public: CCallto(void); virtual ~CCallto(void); public: virtual HRESULT Callto ( const TCHAR * const pszCallto, // pointer to the callto url to try to place the call with... const TCHAR * const pszDisplayName, // pointer to the display name to use... const NM_ADDR_TYPE nmType, // callto type to resolve this callto as... const bool bAddressOnly, // the pszCallto parameter is to be interpreted as a pre-unescaped addressing component vs a full callto... const bool * const pbSecurityPreference, // pointer to security preference, NULL for none. must be "compatible" with secure param if present... const bool bAddToMru, // whether or not save in mru... const bool bUIEnabled, // whether or not to perform user interaction on errors... const HWND hwndParent, // if bUIEnabled is true this is the window to parent error/status windows to... INmCall ** const ppInternalCall // out pointer to INmCall * to receive INmCall * generated by placing call... ); virtual void SetGatekeeperEnabled ( const bool bEnabled // new Gatekeeper state ); virtual HRESULT SetGatekeeperName ( const TCHAR * const pszGatekeeperName // new Gatekeeper name ); virtual void SetGatewayEnabled ( const bool bEnabled // new Gateway state ); virtual HRESULT SetGatewayName ( const TCHAR * const pszGatewayName // new Gateway name ); virtual HRESULT SetIlsServerName ( const TCHAR * const pszServerName // pointer to new default Ils server name ); static const int s_iMaxCalltoLength; static const int s_iMaxAddressLength; static bool DoUserValidation(const TCHAR * const pszCallto); private: HRESULT Parse ( const TCHAR * const pszCallto // pointer to the callto url to parse... ); HRESULT ParseAddress(void); HRESULT Resolve ( const NM_ADDR_TYPE nmType // callto type to resolve this callto as if no type specified in the pszCallto parameter... ); HRESULT PlaceCall ( const TCHAR * const pszCallto, // pointer to the callto url to try to place the call with... const bool bAddToMru, // whether or not save in mru... const bool bSecure, // whether or not to place the call securely... INmCall ** const ppInternalCall // out pointer to INmCall * to receive INmCall * generated by placing call... ); HRESULT GetValidatedSecurity ( const bool * const pbSecurityPreference, // pointer to security preference, NULL for none. must be "compatible" with secure param if present... bool & bValidatedSecurity // out bool reference to recieve validated security setting ); bool inGatekeeperMode(void); HRESULT GetGatekeeperIpAddress ( unsigned long & ulIpAddress // out unsigned long reference to receive gatekeeper IP address ); bool inGatewayMode(void); HRESULT GetGatewayIpAddress ( unsigned long & ulIpAddress // out unsigned long reference to receive gateway IP address ); HRESULT GetIpAddressFromIls ( unsigned long & ulIpAddress // out unsigned long reference to receive IP address ); private: HWND m_hwndParent; bool m_bUnescapedAddressOnly; bool m_bUIEnabled; unsigned long m_ulDestination; TCHAR * m_pszCalltoBuffer; TCHAR * m_pszAddress; TCHAR * m_pszParameters; TCHAR * m_pszParsePos; TCHAR * m_pszIlsServer; unsigned int m_uiIlsPort; bool m_bGatekeeperEnabled; TCHAR * m_pszGatekeeperName; unsigned long m_ulGatekeeperAddress; bool m_bGatewayEnabled; TCHAR * m_pszGatewayName; unsigned long m_ulGatewayAddress; TCHAR * m_pszDefaultIlsServerName; TCHAR * m_pszEmail; TCHAR * m_pszDisplayName; CCalltoParams m_Parameters; NM_ADDR_TYPE m_nmAddressType; }; // End of class CCallto. //--------------------------------------------------------------------------// #endif // !defined( callto_h )