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.

192 lines
6.9 KiB

  1. /* File: D:\WACKER\cncttapi\cncttapi.hh (Created: 10-Feb-1994)
  2. *
  3. * Copyright 1994 by Hilgraeve Inc. -- Monroe, MI
  4. * All rights reserved
  5. *
  6. * $Revision: 13 $
  7. * $Date: 5/15/02 4:24p $
  8. */
  9. #include <unimodem.h>
  10. typedef struct stCnctDrvPrivate *HHDRIVER;
  11. /* --- Macros --- */
  12. #define TAPI_VER (MAKELONG(4,1))
  13. // Required in lineGetDevConfig calls
  14. //
  15. #if !defined(szUMDEVCLASS_COMM_DATAMODEM)
  16. //
  17. // The following define is from unimodem.h
  18. //
  19. #define szUMDEVCLASS_COMM_DATAMODEM TEXT("comm/datamodem")
  20. #endif // !defined(szUMDEVCLASS_COMM_DATAMODEM)
  21. #define DEVCLASS szUMDEVCLASS_COMM_DATAMODEM
  22. #define REDIAL_MAX 40
  23. // Essentially, I picked what I hope is a permanent line ID a TAPI
  24. // service provider would never use. My odds are pretty good since
  25. // UNIMODEM numbers them from 1. - mrw
  26. //
  27. #define DIRECT_COM1 0x5A2175D1
  28. #define DIRECT_COM2 (DIRECT_COM1+1)
  29. #define DIRECT_COM3 (DIRECT_COM1+2)
  30. #define DIRECT_COM4 (DIRECT_COM1+3)
  31. #define DIRECT_COMWINSOCK (DIRECT_COM1+4)
  32. #define DIRECT_COM_DEVICE (DIRECT_COM1 - 1)
  33. #if defined(INCL_WINSOCK)
  34. #define MAX_IP_ADDR_LEN 128
  35. #endif
  36. // Trap is similar to assert except it displays the error return code.
  37. //
  38. #if defined(NDEBUG)
  39. #define TRAP(x) x
  40. #else
  41. #define TRAP(x) tapiTrap(x, __FILE__, __LINE__)
  42. #endif
  43. // Connection driver handle
  44. struct stCnctDrvPrivate
  45. {
  46. HCNCT hCnct; // public connection handle passed to create func
  47. HSESSION hSession; // public session handle passed to create func
  48. CRITICAL_SECTION cs; // critical section semaphore
  49. int iStatus; // connection status
  50. HLINEAPP hLineApp; // returned for lineInitialize(), main TAPI handle
  51. HLINE hLine; // handle to line we're using from lineOpen()
  52. HCALL hCall; // handle returned by lineMakeCall()
  53. LONG lMakeCallId; // ID returned by lineMakeCall() used in callback
  54. DWORD dwLineCnt; // number of available lines from lineInitialize
  55. DWORD dwLine; // current line we're using
  56. DWORD dwAPIVersion; // current api version
  57. DWORD dwCountryID; // internal TAPI ID for selected country
  58. DWORD dwCountryCode; // set in TranslateAddress()
  59. DWORD dwPermanentLineId; // identifies the modem as saved
  60. BOOL fMatchedPermanentLineID,
  61. fHotPhone; // TAPI for is it Direct Connect
  62. TCHAR achDest[(TAPIMAXDESTADDRESSSIZE/2)+1], // local portion of phone num.
  63. achAreaCode[10],
  64. achDefaultAreaCode[10],// As reported from TAPI
  65. achDialableDest[TAPIMAXDESTADDRESSSIZE+1],
  66. achDisplayableDest[TAPIMAXDESTADDRESSSIZE+1],
  67. achCanonicalDest[TAPIMAXDESTADDRESSSIZE+1];
  68. TCHAR achLineName[100]; // used in dialing dialog
  69. TCHAR achComDeviceName[256]; // used with enumerated ports.
  70. HWND hwndCnctDlg; // connection dialog handle
  71. HWND hwndTAPIWindow; // TAPI reinit
  72. HWND hwndPCMCIA; // valid only when PCMCIA dialog showing.
  73. LINECALLPARAMS stCallPar; // Call params used for lineMakeCall()
  74. BOOL fUseCCAC; // Use country code & area code flag.
  75. unsigned int uDiscnctFlags; // Used for asychronous disconnects.
  76. int iRedialCnt; // Counter for redials.
  77. int fRedialOnBusy; // TRUE, we redial
  78. int iRedialSecsRemaining; // seconds remaining to redial
  79. #if defined(INCL_WINSOCK)
  80. int iPort;
  81. TCHAR achDestAddr[MAX_IP_ADDR_LEN];
  82. #endif
  83. #ifdef INCL_CALL_ANSWERING
  84. int fAnswering; // Are we answering?
  85. int fRestoreSettings; // Do we need to restore our ASCII settings?
  86. int nSendCRLF; // Temporary storage for ASCII setting.
  87. int nLocalEcho; // Temporary storage for ASCII setting.
  88. int nAddLF; // Temporary storage for ASCII setting.
  89. int nEchoplex; // Temporary storage for ASCII setting.
  90. void *pvUnregister; // Un-registration data for CLoop callback.
  91. #endif
  92. BOOL fCarrierDetect; // Are we detecting loss of carrier?
  93. };
  94. /* --- Line id struct used to store info in combo boxes --- */
  95. struct _stLineIds
  96. {
  97. DWORD dwLineId;
  98. DWORD dwPermanentLineId;
  99. };
  100. typedef struct _stLineIds * PSTLINEIDS;
  101. /* --- Function Prototypes --- */
  102. void cnctdrvLock(const HHDRIVER hhDriver);
  103. void cnctdrvUnlock(const HHDRIVER hhDriver);
  104. INT_PTR CALLBACK ConfirmDlg(HWND hwnd, UINT uMsg, WPARAM wPar, LPARAM lPar);
  105. int CplConfigDlg(const HWND hwnd, const int ordinal);
  106. int EnumerateCountryCodes(const HHDRIVER hhDriver, const HWND hwndCB);
  107. int EnumerateAreaCodes(const HHDRIVER hhDriver, const HWND hwndCB);
  108. int EnumerateLines(const HHDRIVER hhDriver, const HWND hwndCB);
  109. int EnumerateLinesNT(const HHDRIVER hhDriver, const HWND hwndCB);
  110. long TranslateAddress(const HHDRIVER hhDriver);
  111. INT_PTR CALLBACK DialingDlg(HWND hwnd, UINT uMsg, WPARAM wPar, LPARAM lPar);
  112. void DialingMessage(const HHDRIVER hhDriver, const int resID);
  113. void CALLBACK lineCallbackFunc(DWORD hDevice, DWORD dwMsg, DWORD_PTR dwCallback,
  114. DWORD_PTR dwParm1, DWORD_PTR dwParm2, DWORD_PTR dwParm3);
  115. void PostDisconnect(const HHDRIVER hhDriver, const unsigned int uFlags);
  116. int Handoff(const HHDRIVER hhDriver);
  117. void SetStatus(const HHDRIVER hhDriver, const int iStatus);
  118. int DoLineGetCountry(const DWORD dwCountryID, const DWORD dwAPIVersion,
  119. LPLINECOUNTRYLIST *ppcl);
  120. int EnumerateTapiLocations(const HHDRIVER hhDriver, const HWND hwndCB,
  121. const HWND hwndTB);
  122. int CheckHotPhone(const HHDRIVER hhDriver, const DWORD dwLine, int *pfHotPhone);
  123. DWORD tapiTrap(const DWORD dw, const TCHAR *file, const int line);
  124. void EnableDialNow(const HWND hwndDlg, const int fEnable);
  125. #if defined(DEADWOOD)
  126. int fCountryUsesAreaCode(const DWORD dwCountryId, const DWORD dwAPIVersion);
  127. #endif // defined(DEADWOOD)
  128. INT_PTR CALLBACK PCMCIADlg(HWND hwnd, UINT uMsg, WPARAM wPar, LPARAM lPar);
  129. int fIsStringEmpty(LPTSTR ach);
  130. void EnableDial(const HWND hwndDlg, const BOOL fEnable);
  131. int cncttapiGetCOMSettings( const DWORD dwLineId, LPTSTR pachStr, const size_t cb );
  132. int cncttapiGetLineConfig( const DWORD dwLineId, VOID** ppvs );
  133. int cncttapiSetLineConfig( const DWORD dwLineId, const HCOM hCom );
  134. #if defined(INCL_WINSOCK)
  135. BOOL CALLBACK cnctwsNewPhoneDlg(HWND hwnd, UINT uMsg, WPARAM wPar, LPARAM lPar);
  136. #endif
  137. /* --- Driver entry points --- */
  138. HDRIVER WINAPI cnctdrvCreate(const HCNCT hCnct, const HSESSION hSession);
  139. int WINAPI cnctdrvDestroy(const HHDRIVER hhDriver);
  140. int WINAPI cnctdrvInit(const HHDRIVER hhDriver);
  141. int WINAPI cnctdrvLoad(const HHDRIVER hhDriver);
  142. int WINAPI cnctdrvSave(const HHDRIVER hhDriver);
  143. int WINAPI cnctdrvSetDestination(const HHDRIVER hhDriver, TCHAR * const ach,
  144. const size_t cb);
  145. int WINAPI cnctdrvQueryStatus(const HHDRIVER hhDriver);
  146. int WINAPI cnctdrvConnect(const HHDRIVER hhDriver, const unsigned int uFlags);
  147. int WINAPI cnctdrvDisconnect(const HHDRIVER hhDriver, const unsigned int uFlags);
  148. int WINAPI cnctdrvComEvent(const HHDRIVER hhDriver, const enum COM_EVENTS event);
  149. int cnctdrvGetComSettingsString(const HHDRIVER hhDriver, LPTSTR pachStr,
  150. const size_t cb);