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.

170 lines
6.8 KiB

  1. //*********************************************************************
  2. //* Microsoft Windows **
  3. //* Copyright(c) Microsoft Corp., 1994 **
  4. //*********************************************************************
  5. //
  6. // RNACALL.H - header file for RNA functions
  7. //
  8. // HISTORY:
  9. //
  10. // 1/20/95 jeremys Created (mostly cloned from RNA UI code)
  11. // 96/01/31 markdu Renamed CONNENTDLG to OLDCONNENTDLG to avoid
  12. // conflicts with RNAP.H.
  13. // 96/02/23 markdu Replaced RNAValidateEntryName with
  14. // RASValidateEntryName
  15. // 96/02/24 markdu Re-wrote the definition of ENUM_MODEM to
  16. // use RASEnumDevices() instead of RNAEnumDevices().
  17. // Also removed RNAGetDeviceInfo().
  18. // 96/02/24 markdu Re-wrote the definition of ENUM_CONNECTOID to
  19. // use RASEnumEntries() instead of RNAEnumConnEntries().
  20. // 96/02/26 markdu Replaced all remaining internal RNA APIs.
  21. // Also copied two structures (tagPhoneNum and tapIPData)
  22. // from rnap.h and tagIAddr from rnaphint.h for internal use only.
  23. // 96/03/07 markdu Extend ENUM_MODEM class
  24. // 96/03/08 markdu Added ENUM_MODEM::VerifyDeviceNameAndType
  25. // 96/03/09 markdu Moved all function prototypes here from wizard.h
  26. // 96/03/09 markdu Added LPRASENTRY parameter to CreateConnectoid()
  27. // 96/03/09 markdu Moved all references to 'need terminal window after
  28. // dial' into RASENTRY.dwfOptions.
  29. // Also no longer need GetConnectoidPhoneNumber function.
  30. // 96/03/10 markdu Moved all references to modem name into RASENTRY.
  31. // 96/03/10 markdu Moved all references to phone number into RASENTRY.
  32. // Moved tagPhoneNum to inetapi.h
  33. // 96/03/11 markdu Moved code to set username and password out of
  34. // CreateConnectoid into SetConnectoidUsername so it can be reused.
  35. // 96/03/13 markdu Change ValidateConncectoidName to take LPCSTR.
  36. // 96/03/16 markdu Added ReInit member function to re-enumerate modems.
  37. // 96/03/25 markdu Removed GetIPInfo and SetIPInfo.
  38. // 96/04/04 markdu Added phonebook name param to CreateConnectoid,
  39. // ValidateConnectoidName, and SetConnectoidUsername.
  40. // 96/05/16 markdu NASH BUG 21810 Added function for IP address validation.
  41. //
  42. #ifndef _RNACALL_H_
  43. #define _RNACALL_H_
  44. // function pointer typedefs for RNA apis from rnaph.dll and rasapi32.dll
  45. typedef DWORD (WINAPI * RASGETCOUNTRYINFO) (LPRASCTRYINFO, LPDWORD);
  46. typedef DWORD (WINAPI * RASENUMDEVICES) (LPRASDEVINFO, LPDWORD, LPDWORD);
  47. typedef DWORD (WINAPI * RASVALIDATEENTRYNAME) (LPCTSTR, LPTSTR);
  48. typedef DWORD (WINAPI * RASGETERRORSTRING) (UINT, LPTSTR, DWORD);
  49. typedef DWORD (WINAPI * RASGETENTRYDIALPARAMS) (LPCTSTR, LPRASDIALPARAMS, LPBOOL);
  50. typedef DWORD (WINAPI * RASSETENTRYDIALPARAMS) (LPCTSTR, LPRASDIALPARAMS, BOOL);
  51. typedef DWORD (WINAPI * RASSETENTRYPROPERTIES) (LPCTSTR, LPCTSTR, LPBYTE, DWORD, LPBYTE, DWORD);
  52. typedef DWORD (WINAPI * RASGETENTRYPROPERTIES) (LPTSTR, LPCTSTR, LPBYTE, LPDWORD, LPBYTE, LPDWORD);
  53. typedef DWORD (WINAPI * RASENUMENTRIES) (LPTSTR,LPTSTR,LPRASENTRYNAME,LPDWORD,LPDWORD);
  54. typedef DWORD (WINAPI * RASSETCREDENTIALS) (LPTSTR,LPTSTR,LPRASCREDENTIALS,BOOL);
  55. typedef struct tagCountryCode
  56. {
  57. DWORD dwCountryID;
  58. DWORD dwCountryCode;
  59. } COUNTRYCODE, *PCOUNTRYCODE, FAR* LPCOUNTRYCODE;
  60. // Taken from rnap.h
  61. typedef struct tagIPData {
  62. DWORD dwSize;
  63. DWORD fdwTCPIP;
  64. DWORD dwIPAddr;
  65. DWORD dwDNSAddr;
  66. DWORD dwDNSAddrAlt;
  67. DWORD dwWINSAddr;
  68. DWORD dwWINSAddrAlt;
  69. } IPDATA, *PIPDATA, FAR *LPIPDATA;
  70. // start (taken from rnaphint.h)
  71. // IP Addresses
  72. #define MAX_IP_FIELDS 4
  73. #define MIN_IP_FIELD1 1u // min allowed value for field 1
  74. #define MAX_IP_FIELD1 255u // max allowed value for field 1
  75. #define MIN_IP_FIELD2 0u // min for field 2
  76. #define MAX_IP_FIELD2 255u // max for field 2
  77. #define MIN_IP_FIELD3 0u // min for field 3
  78. #define MAX_IP_FIELD3 254u // max for field 3
  79. #define MIN_IP_FIELD4 1u // 0 is reserved for broadcast
  80. #define MAX_IP_FIELD4 254u // max for field 4
  81. #define MIN_IP_VALUE 0u // default minimum allowable field value
  82. #define MAX_IP_VALUE 255u // default maximum allowable field value
  83. // used to fix byte ordering
  84. typedef struct tagIAddr {
  85. union {
  86. RASIPADDR ia;
  87. DWORD dw;
  88. };
  89. } IADDR;
  90. typedef IADDR * PIADDR;
  91. typedef IADDR * LPIADDR;
  92. #define FValidIaOrZero(pia) ((((PIADDR) (pia))->dw == 0) || FValidIa(pia))
  93. // end (taken from rnaphint.h)
  94. #define MAX_COUNTRY 512
  95. #define DEF_COUNTRY_INFO_SIZE 1024
  96. #define MAX_COUNTRY_NAME 36
  97. #define MAX_AREA_LIST 20
  98. #define MAX_DISPLAY_NAME 36
  99. class ENUM_MODEM
  100. {
  101. private:
  102. DWORD m_dwError;
  103. DWORD m_dwNumEntries;
  104. DWORD m_dwIndex;
  105. LPRASDEVINFO m_lpData;
  106. public:
  107. ENUM_MODEM();
  108. ~ENUM_MODEM();
  109. DWORD ReInit();
  110. TCHAR * Next();
  111. TCHAR * GetDeviceTypeFromName(LPTSTR szDeviceName);
  112. TCHAR * GetDeviceNameFromType(LPTSTR szDeviceType);
  113. BOOL VerifyDeviceNameAndType(LPTSTR szDeviceName, LPTSTR szDeviceType);
  114. DWORD GetNumDevices() { return m_dwNumEntries; }
  115. DWORD GetError() { return m_dwError; }
  116. void ResetIndex() { m_dwIndex = 0; }
  117. };
  118. class ENUM_CONNECTOID
  119. {
  120. private:
  121. DWORD m_dwError;
  122. DWORD m_dwNumEntries;
  123. DWORD m_dwIndex;
  124. LPRASENTRYNAME m_lpData;
  125. public:
  126. ENUM_CONNECTOID();
  127. ~ENUM_CONNECTOID();
  128. TCHAR * Next();
  129. DWORD NumEntries();
  130. DWORD GetError() { return m_dwError; }
  131. };
  132. // function prototypes
  133. DWORD CreateConnectoid(LPCTSTR pszPhonebook, LPCTSTR pszConnectionName,
  134. LPRASENTRY lpRasEntry, LPCTSTR pszUserName,LPCTSTR pszPassword);
  135. BOOL InitRNA(HWND hWnd);
  136. VOID DeInitRNA();
  137. DWORD EnsureRNALoaded(VOID);
  138. HRESULT InitModemList(HWND hCB);
  139. VOID InitConnectoidList(HWND hCB, LPTSTR lpszSelect);
  140. VOID InitCountryCodeList(HWND hLB);
  141. VOID FillCountryCodeList(HWND hLB);
  142. VOID GetCountryCodeSelection(HWND hLB,LPCOUNTRYCODE* plpCountryCode);
  143. BOOL SetCountryIDSelection(HWND hwndCB,DWORD dwCountryCode);
  144. VOID DeInitCountryCodeList(VOID);
  145. DWORD ValidateConnectoidName(LPCTSTR pszPhonebook, LPCTSTR pszConnectoidName);
  146. BOOL GetConnectoidUsername(TCHAR * pszConnectoidName,TCHAR * pszUserName,
  147. DWORD cbUserName,TCHAR * pszPassword,DWORD cbPassword);
  148. DWORD SetConnectoidUsername(LPCTSTR pszPhonebook, LPCTSTR pszConnectoidName,
  149. LPCTSTR pszUserName, LPCTSTR pszPassword);
  150. void InitRasEntry(LPRASENTRY lpEntry);
  151. DWORD GetEntry(LPRASENTRY *lplpEntry, LPDWORD lpdwEntrySize, LPCTSTR szEntryName);
  152. VOID CopyDw2Ia(DWORD dw, RASIPADDR* pia);
  153. DWORD DwFromIa(RASIPADDR *pia);
  154. BOOL FValidIa(RASIPADDR *pia);
  155. #endif // _RNACALL_H_