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.

206 lines
8.5 KiB

  1. /***************************************************************************
  2. Name : T30.H
  3. Comment : Main include file for T30 driver.
  4. All common structire defns etc.
  5. Functions: (see Prototypes just below)
  6. Revision Log
  7. Date Name Description
  8. -------- ----- ---------------------------------------------------------
  9. ***************************************************************************/
  10. #include "timeouts.h"
  11. /**---------------------- #define of sizes of things ---------------------
  12. Frames can be at most 2.55 secs (sent) or 3.45 secs (recvd) long, or
  13. 2.55 * 300/8 = 96 bytes and 132 bytes long respectively
  14. For clumps of received frames, we collect them in a GlobalAlloced
  15. space for passing to teh WhatNext callback function. We arbitrarily
  16. decide to allow at most 10 frames and at most 500 bytes at a time.
  17. (500 bytes = 500/(300/8) = 13.33 secs, so that should be quite enough)
  18. ---------------------- #define of sizes of things ---------------------**/
  19. //#define ECM_TOTALFRAMESIZE (ECM_FRAME_SIZE + 4)
  20. // Used for calling ModemSync(). The shorter one during calls,
  21. // the longer one only on hangup and stuff
  22. #define RESYNC_TIMEOUT1 1100
  23. #define RESYNC_TIMEOUT2 500
  24. // This are way too long. We have built-in delays anyway, so don't need
  25. // the full time, and the recvrs have to recv from other fax machines
  26. // so take it easy here
  27. // #define PHASEC_PAUSE 100 // how long to pause before TCF/phase C
  28. #define RECV_PHASEC_PAUSE 55 // used by RecvSil() before TCF/phase C
  29. #define SEND_PHASEC_PAUSE 75 // used by SendSil() before TCF/phase C
  30. // ModemRecvSilence() always waits a bit longer than the amount requested
  31. // so to get it right we ask for the minimum required, i.e. 55ms
  32. // However ModemSendSilence() is pretty accurate, so ask for teh exact
  33. // nominal amount, i.e. 75ms
  34. // How long to try for AT+FRM before timing out and trying
  35. // for an AT+FRH instead. Must be 100% *sure* to get page if there
  36. // is one, because there's no recovery after missing that. But must
  37. // also be sure to get the 2nd CTC if there is one.
  38. // Other critical situations:- MCF is missed, and sender resends MPS
  39. // We miss this because we're in FRM, but we mustn't miss the 3rd one!
  40. // Ditto with DCS-TCF-missedCFR. Can't get 2nd, but we'll get 3rd
  41. // #define PHASEC_TIMEOUT 2800L // 2.8s
  42. // increase this to 3200. Limit is 3550, but we need 200ms or so to restart
  43. // receiving FRH=3
  44. #ifdef MDDI
  45. // if we are on an IFAX we can DEPEND on teh RECV_WRONGMODE code
  46. // being correctly implemented. In fact we need to because to handle
  47. // satelite delays, echos etc this timeout need to be LONG (equal
  48. // to T2 in fact), so we cant wait to timeout before recving V21
  49. // so the only way we're going to handle eth above situations is
  50. // if we always get the +FCERROR/WRONGMODE resp at the right time
  51. # define PHASEC_TIMEOUT 6000L // 6secs
  52. #else
  53. # define PHASEC_TIMEOUT 3300L // 3.3s
  54. #endif
  55. // How long to try for AT+FRM in TCF before timing out and trying
  56. // +FRH. Mustn't miss TCF, but if we do, must catch next DCS
  57. // increase this to 3200. Limit is 3550, but we need 200ms or so to restart
  58. // receiving FRH=3
  59. #define TCF_TIMEOUT 3300L // 3.3s
  60. // don't need this one. Besides don't want to send it at startup when
  61. // we're already transmitting HDLC. This can cause problems, if we already
  62. // have a delay (example after TCF, sending CFR. Delay is now 115, it will
  63. // become 180 or so).
  64. // #define LOWSPEED_PAUSE 60 // how long to pause before HDLC
  65. // reduce this too
  66. #define RECV_LOWSPEED_PAUSE 55 // used by RecvSil() before HDLC
  67. #define SEND_LOWSPEED_PAUSE 75 // used by SendSil() before HDLC
  68. // ModemRecvSilence() always waits a bit longer than the amount requested
  69. // so to get it right we ask for the minimum required, i.e. 55ms
  70. // However ModemSendSilence() is pretty accurate, so ask for teh exact
  71. // nominal amount, i.e. 75ms
  72. // How long of silence to look for before sending V.21. (IFAX/MDDI only)
  73. // Use LOWSPEED_PAUSE defined above.
  74. // How long of silence to look for before sending PhaseC. (IFAX/MDDI only)
  75. // use 40ms or more (want to be pretty sure we got silenec)
  76. // ---> we use PHASEC_PAUSE which is OK
  77. // How long to look for silence before sending high-speed.
  78. // If this fails we go ahead and send anyway, so we don't want
  79. // it too long. But we want to try pretty hard to get silence,
  80. // because otherwise the other side will miss my training.
  81. // 3secs is about how long a NSF-DIS takes. If we hit one
  82. // we want to wait until it's done, not timeout??
  83. #define LONG_RECVSILENCE_TIMEOUT 3000 // how long to wait for silence before send HDLC or PIX
  84. // when sending DIS, DCS or DTC we may collide with DCS, DIS or DIS coming
  85. // from the other side. This can be really long (preamble+2NSFs+CSI+DIS > 5secs)
  86. // so wait for upto 6 secs (preamble + 150+ bytes)
  87. #define REALLY_LONG_RECVSILENCE_TIMEOUT 6000 // how long to wait for silence before send DIS/DCS/DTC
  88. // Used before TCF
  89. #define SHORT_SENDSILENCE_TIMEOUT 100 // how long to wait for send-silence before TCF
  90. #define ECHOPROTECT(ifr, mode) { pTG->EchoProtect.ifrLastSent=ifr; pTG->EchoProtect.modePrevRecv=mode; pTG->EchoProtect.fGotWrongMode=0; }
  91. /*****
  92. // INI file settings related stuff
  93. typedef struct
  94. {
  95. USHORT uIgnoreDIS; // non-zero==number of DIS to be ignored
  96. USHORT uRecvT1Timer; // 0==default otherwise==number of seconds
  97. USHORT uSendT1Timer; // 0==default otherwise==number of seconds
  98. // BOOL fTotalErrsOnly; // 0==burst 1==total
  99. // BOOL fNo999; // can't dial 999
  100. // USHORT uCSICompare; // 0==no compare 1==just existence of CSI
  101. // 2==4 digits 3==8 digits
  102. }
  103. ET30INISETTINGS;
  104. *****/
  105. #define ECM_NEWPAGE 2
  106. #define ECM_NEWBLOCK 1
  107. #define ECM_RETRANSMIT 0
  108. extern USHORT TCFLen[];
  109. #define BadAction(pTG, a) (ERRMSG((SZMOD "<<ERROR>> BadAction %d\r\n", a)), ICommFailureCode(pTG, T30FAIL_BUG0), BG_CHK(FALSE), actionERROR)
  110. #define GetResponse(pTG, ifr) GetCmdResp(pTG, FALSE, ifr)
  111. #define GetCommand(pTG, ifr) GetCmdResp(pTG, TRUE, ifr)
  112. #define GetSendBuf(pTG, lplpbf, slOffset) ICommGetSendBuf(pTG, lplpbf, slOffset)
  113. #define PutRecvBuf(pTG, lpbf, slOffset) ICommPutRecvBuf(pTG, lpbf, slOffset)
  114. /****************** begin prototypes from ecm.c *****************/
  115. ET30ACTION ECMPhaseC(PThrdGlbl pTG, BOOL fReTx);
  116. // ET30ACTION ECMPhaseCRetrans(void);
  117. ET30ACTION ECMPhaseD(PThrdGlbl pTG);
  118. ET30ACTION ECMSendEOR_EOP(PThrdGlbl pTG);
  119. ET30ACTION ECMRecvPhaseD(PThrdGlbl pTG);
  120. ET30ACTION ECMRecvPhaseC(PThrdGlbl pTG, BOOL);
  121. /***************** end of prototypes from ecm.c *****************/
  122. /****************** begin prototypes from hdlc.c *****************/
  123. USHORT ModemRecvBuf(PThrdGlbl pTG, HMODEM hModem, BOOL fECM, LPBUFFER far* lplpbf, ULONG ulTimeout);
  124. /***************** end of prototypes from hdlc.c *****************/
  125. /****************** begin prototypes from t30.c *****************/
  126. IFR GetCmdResp(PThrdGlbl pTG, BOOL fCommand, USHORT ifrResp);
  127. /***************** end of prototypes from t30.c *****************/
  128. /****************** begin prototypes from t30main.c *****************/
  129. USHORT T30MainBody(PThrdGlbl pTG, BOOL fCaller, ET30ACTION actionInitial, HLINE hLine, HMODEM hModem);
  130. // BOOL GetDev(USHORT uPort);
  131. // BOOL FreeDev(void);
  132. /***************** end of prototypes from t30main.c *****************/
  133. #define GetDevAndDial(pTG, port, phone) (GetDev(pTG, port) && Dial(pTG, phone))
  134. #define GetDevAndAnswer(pTG, port) (GetDev(pTG, port) && Answer(pTG))
  135. #ifdef SWECM
  136. # pragma message ("--------- WARNING: Software ECM ENABLED ----------")
  137. USHORT ModemECMRecvMode(PThrdGlbl pTG, HMODEM h, USHORT uMod, ULONG ulTimeout);
  138. BOOL SWECMSendSetup(PThrdGlbl pTG, BOOL fOn);
  139. BOOL SWECMRecvSetup(PThrdGlbl pTG, BOOL fOn);
  140. USHORT SWECMRecvFrame(PThrdGlbl pTG, HMODEM hModem, LPBYTE lpb, USHORT cbMax, ULONG ulTimeout, USHORT far* lpcbRecv);
  141. void D_HexPrint(LPB b1, UWORD incnt);
  142. /***************** end of prototypes from swecm.c *****************/
  143. #else
  144. # define ModemECMRecvMode(pTG, h, mod, t) ModemRecvMode(pTG, h, mod, TRUE, t, ifrECMPIX)
  145. #endif