Source code of Windows XP (NT5)
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.

184 lines
7.4 KiB

  1. /***************************************************************************
  2. Name : MODEMINT.H
  3. Comment :
  4. Functions: (see Prototypes just below)
  5. Copyright (c) Microsoft Corp. 1991, 1992, 1993
  6. Revision Log
  7. Date Name Description
  8. -------- ----- ---------------------------------------------------------
  9. ***************************************************************************/
  10. /**---------------------- #define of sizes of things ---------------------
  11. Frames can be at most 2.55 secs (sent) or 3.45 secs (recvd) long, or
  12. 2.55 * 300/8 = 96 bytes and 132 bytes long respectively
  13. Dialstrings are limited to 60 bytes (arbitrarily)
  14. Commands (except dial) are never more than about 10-20 bytes long, so
  15. we use a buffer of 40 bytes. Replies are never big at all, but we
  16. might hold a frame in there, so keep it same size as a Framebuffer
  17. The Dial command is ATDT <string><CR>, so we use 60+10 bytes buffer
  18. ---------------------- #define of sizes of things ---------------------**/
  19. #define MAXPHONESIZE 60
  20. #define DIALBUFSIZE MAXPHONESIZE + 10
  21. #define MAXPROFILENAMESIZE 128
  22. /**---------------------- #define of other things ---------------------
  23. FAX_CLASSn is used in Modem.FaxClass.
  24. CHECK_PATTERN is used in the Guard elements.
  25. ECM_FRAMESIZE in T30.C
  26. ---------------------- #define of other things ---------------------**/
  27. #define CR 0x0d
  28. #define LF 0x0a
  29. #define DLE 0x10 // DLE = ^P = 16d = 10h
  30. #define ETX 0x03
  31. // The following bunch of defines allow us to combine detection
  32. // with pre-read settings (from unimodem, say).
  33. #define fGOTCMD_Reset (0x1)
  34. #define fGOTCMD_Setup (0x1<<1)
  35. #define fGOTCMD_PreAnswer (0x1<<2)
  36. #define fGOTCMD_PreDial (0x1<<3)
  37. #define fGOTCMD_PreExit (0x1<<4)
  38. #define fGOTCMDS \
  39. fGOTCMD_Reset \
  40. | fGOTCMD_Setup \
  41. | fGOTCMD_PreAnswer \
  42. | fGOTCMD_PreDial \
  43. | fGOTCMD_PreExit
  44. #define fGOTCAP_CLASSES (0x1<<10)
  45. #define fGOTCAP_SENDSPEEDS (0x1<<11)
  46. #define fGOTCAP_RECVSPEEDS (0x1<<12)
  47. #define fGOTCAPS \
  48. fGOTCAP_CLASSES \
  49. | fGOTCAP_SENDSPEEDS \
  50. | fGOTCAP_RECVSPEEDS
  51. #define fGOTPARM_PORTSPEED (0x1<<20)
  52. #define fGOTPARM_IDCMD (0x1<<21)
  53. #define fGOTPARM_ID (0x1<<22)
  54. #define fGOTPARMS \
  55. fGOTPARM_PORTSPEED \
  56. | fGOTPARM_IDCMD \
  57. | fGOTPARM_ID
  58. #define fGOTIDS \
  59. fGOTPARM_IDCMD \
  60. | fGOTPARM_ID
  61. #define fGOTFLAGS (0x1<<23)
  62. // Following structure has stuff which should ideally go into
  63. // MODEMCAPS, but we can't change that at this state (11/94).
  64. extern BOOL fMegaHertzHack;
  65. // used for Resync type stuff. RepeatCount = 2
  66. // This has to be multi-line too, because echo could be on and
  67. // we could get the command echoed back instead of response!
  68. // Looks like even 330 is too short for some modems..
  69. // 550 is too short for Sharad's PP9600FXMT & things
  70. // can get really messed up if this times out, so use
  71. // a nice large value
  72. #define iSyncModemDialog(pTG, s, l, w) \
  73. iiModemDialog(pTG, s, l, 990, TRUE, 2, TRUE, (CBPSTR)w, (CBPSTR)(NULL))
  74. // This version for dealing with possible NON-numeric responses as well...
  75. #define iSyncModemDialog2(pTG, s, l, w1, w2) \
  76. iiModemDialog(pTG, s, l, 990, TRUE, 2, TRUE, (CBPSTR)w1, (CBPSTR)w2, (CBPSTR)(NULL))
  77. // mostly use MultiLine instead because we may get asynchronous
  78. // RING responses at arbitrary times when on-hook
  79. // Non-sync related local stuff. SIngle line, single try
  80. // #define iLocalModemDialog(s, l, w) iiModemDialog(s, l, 950, FALSE, 1, (CBPSTR)w, (CBPSTR)(NULL))
  81. // Use these 3 *only* for GetCaps and ATI etc where we are initing
  82. // (*not* re-initing, which can happen while RING is coming in & so need
  83. // more than 1 try.
  84. // temporarily chnage this to 2 tries & see if it slows things down
  85. // too much.
  86. /****************************
  87. // used to get multi-line responses--single try
  88. #define iMultiLineModemDialog(s, l, w) \
  89. iiModemDialog(s, l, 900, TRUE, 2, (CBPSTR)w, (CBPSTR)(NULL))
  90. // used to get multi-line responses--single try
  91. #define iMultiLineModemDialog2(s, l, w1, w2) \
  92. iiModemDialog(s, l, 900, TRUE, 2, (CBPSTR)w1, (CBPSTR)w2, (CBPSTR)(NULL))
  93. // used for optional settings/commands. Single line, single try
  94. #define iOptionalModemDialog2(s, l, w1, w2) \
  95. iiModemDialog(s, l, 850, FALSE, 2, (CBPSTR)w1, (CBPSTR)w2, (CBPSTR)(NULL))
  96. // used to get multi-line responses--2 tries. Used when RING noises
  97. // can be coming in, and everywhere else off hook.
  98. #define i2xMultiLineModemDialog(s, l, w) \
  99. iiModemDialog(s, l, 950, TRUE, 2, (CBPSTR)w, (CBPSTR)(NULL))
  100. // used to get multi-line responses
  101. #define i2xMultiLineModemDialog2(s, l, w1, w2) \
  102. iiModemDialog(s, l, 950, TRUE, 2, (CBPSTR)w1, (CBPSTR)w2, (CBPSTR)(NULL))
  103. #define i2xMultiLineModemDialog2Long(s, l, w1, w2) \
  104. iiModemDialog(s, l, 1900, TRUE, 2, (CBPSTR)w1, (CBPSTR)w2, (CBPSTR)(NULL))
  105. ************************************/
  106. // These are used for offline things, so we make them all (a) multiline
  107. // (b) long timeout (c) 2 tries and (d) make sure they all look for ERROR
  108. // as a response, to speed things up
  109. #define OfflineDialog2(pTG, s,l,w1,w2) iiModemDialog(pTG, s, l, 5000, TRUE, 2, TRUE, (CBPSTR)w1, (CBPSTR)w2, (CBPSTR)(NULL))
  110. #define OfflineDialog3(pTG, s,l,w1,w2,w3) iiModemDialog(pTG, s, l, 5000, TRUE, 2, TRUE, (CBPSTR)w1, (CBPSTR)w2, (CBPSTR)w3, (CBPSTR)(NULL))
  111. // extern void TwiddleThumbs(ULONG ulTime);
  112. // #define OfflineDialog2(s,l,w1,w2) (TwiddleThumbs(100), iiModemDialog(s, l, 2000, TRUE, 2, (CBPSTR)w1, (CBPSTR)w2, (CBPSTR)(NULL)))
  113. #define GOCLASS2_0 3
  114. extern CBSZ cbszOK, cbszERROR;
  115. /****************** begin prototypes from modem.c *****************/
  116. SWORD iModemSync(PThrdGlbl pTG);
  117. SWORD iModemReset(PThrdGlbl pTG, CBPSTR szCmd);
  118. UWORD GetCap(PThrdGlbl pTG, CBPSTR cbpstrSend, UWORD uwLen);
  119. UWORD GetCapAux(PThrdGlbl pTG, CBPSTR cbpstrSend, UWORD uwLen);
  120. BOOL iModemGetCaps(PThrdGlbl pTG, LPMODEMCAPS lpMdmCaps,
  121. DWORD dwSpeed, LPSTR lpszReset, LPDWORD lpdwGot);
  122. void TwiddleThumbs(ULONG ulTime);
  123. BOOL iiModemGoClass(PThrdGlbl pTG, USHORT uClass, DWORD dwSpeed);
  124. LPSTR my_fstrstr( LPSTR sz1, LPSTR sz2);
  125. /***************** end of prototypes from modem.c *****************/
  126. /****************** begin prototypes from identify.c *****************/
  127. USHORT iModemGetCmdTab(PThrdGlbl pTG, DWORD dwLineID, DWORD dwLineIDType,
  128. LPCMDTAB lpCmdTab, LPMODEMCAPS lpMdmCaps, LPMODEMEXTCAPS lpMdmExtCaps,
  129. BOOL fInstall);
  130. USHORT iModemInstall(PThrdGlbl pTG, DWORD dwLineID, DWORD dwLineIDType, BOOL fDontPurge);
  131. USHORT iModemFigureOutCmds(PThrdGlbl pTG, LPCMDTAB lpCmdTab);
  132. USHORT iModemGetWriteCaps(PThrdGlbl pTG);
  133. /***************** end of prototypes from identify.c *****************/