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.

134 lines
4.2 KiB

  1. /***************************************************************************
  2. Name : RECVFR.C
  3. Comment :
  4. Functions: (see Prototypes just below)
  5. Copyright (c) 1993 Microsoft Corp.
  6. Revision Log
  7. Date Name Description
  8. -------- ----- ---------------------------------------------------------
  9. ***************************************************************************/
  10. #define USE_DEBUG_CONTEXT DEBUG_CONTEXT_T30_MAIN
  11. #include "prep.h"
  12. #include "efaxcb.h"
  13. #include "protocol.h"
  14. #include "glbproto.h"
  15. void GotRecvFrames
  16. (
  17. PThrdGlbl pTG,
  18. IFR ifr,
  19. NPDIS npdis,
  20. BCTYPE bctype,
  21. NPBC npbc,
  22. USHORT wBCSize,
  23. NPLLPARAMS npll
  24. )
  25. {
  26. DEBUG_FUNCTION_NAME(_T("GotRecvFrames"));
  27. InitBC(npbc, wBCSize, bctype);
  28. if(npdis)
  29. {
  30. // extract DIS caps into BC and LL
  31. // Here we parse the DCS we got into npbc {= (NPBC)&pTG->ProtInst.RecvParams}
  32. ParseDISorDCSorDTC(pTG, npdis, &(npbc->Fax), npll, (ifr==ifrNSS ? TRUE : FALSE));
  33. }
  34. }
  35. BOOL AwaitSendParamsAndDoNegot(PThrdGlbl pTG)
  36. {
  37. // This does actual negotiation & gets SENDPARAMS. It could potentially
  38. DEBUG_FUNCTION_NAME(_T("AwaitSendParamsAndDoNegot"));
  39. if(!ProtGetBC(pTG, SEND_PARAMS))
  40. {
  41. DebugPrintEx(DEBUG_WRN,"ATTENTION: pTG->ProtInst.fAbort = TRUE");
  42. pTG->ProtInst.fAbort = TRUE;
  43. return FALSE;
  44. }
  45. // negotiate low-level params here. (a) because this is where
  46. // high-level params are negotiated (b) because it's inefficient to
  47. // do it on each DCS (c) because RTN breaks otherwise--see bug#731
  48. // llRecvCaps and llSendParams are set only at startup
  49. // SendParams are set in ProtGetBC just above
  50. // llNegot is the return value. So this can be called
  51. // only at the end of this function
  52. // negot lowlevel params if we are sending and not polling
  53. if(!pTG->ProtInst.fAbort && pTG->ProtInst.fSendParamsInited)
  54. {
  55. NegotiateLowLevelParams( pTG,
  56. &pTG->ProtInst.llRecvCaps,
  57. &pTG->ProtInst.llSendParams,
  58. pTG->ProtInst.SendParams.Fax.AwRes,
  59. pTG->ProtInst.SendParams.Fax.Encoding,
  60. &pTG->ProtInst.llNegot);
  61. pTG->ProtInst.fllNegotiated = TRUE;
  62. // This chnages llNegot->Baud according to the MaxSpeed settings
  63. EnforceMaxSpeed(pTG);
  64. }
  65. return TRUE;
  66. }
  67. void GotRecvCaps(PThrdGlbl pTG)
  68. {
  69. DEBUG_FUNCTION_NAME(_T("GotRecvCaps"));
  70. pTG->ProtInst.RemoteDIS.ECM = 0;
  71. pTG->ProtInst.RemoteDIS.SmallFrame = 0;
  72. GotRecvFrames( pTG,
  73. ifrNSF,
  74. (pTG->ProtInst.fRecvdDIS ? &pTG->ProtInst.RemoteDIS : NULL),
  75. RECV_CAPS,
  76. (NPBC)&pTG->ProtInst.RecvCaps,
  77. sizeof(pTG->ProtInst.RecvCaps),
  78. &pTG->ProtInst.llRecvCaps);
  79. pTG->ProtInst.fRecvCapsGot = TRUE;
  80. pTG->ProtInst.fllRecvCapsGot = TRUE;
  81. // send off BC struct to higher level
  82. if(!ICommRecvCaps(pTG, (LPBC)&pTG->ProtInst.RecvCaps))
  83. {
  84. DebugPrintEx(DEBUG_WRN,"ATTENTION:pTG->ProtInst.fAbort = TRUE");
  85. pTG->ProtInst.fAbort = TRUE;
  86. }
  87. // This need to be moved into whatnext.NodeA so that we can set
  88. // param to FALSE (no sleep) and do the stall thing
  89. AwaitSendParamsAndDoNegot(pTG);
  90. }
  91. void GotRecvParams(PThrdGlbl pTG)
  92. {
  93. DEBUG_FUNCTION_NAME(_T("GotRecvParams"));
  94. GotRecvFrames( pTG,
  95. ifrNSS,
  96. (pTG->ProtInst.fRecvdDCS ? (&pTG->ProtInst.RemoteDCS) : NULL),
  97. RECV_PARAMS,
  98. (NPBC)&pTG->ProtInst.RecvParams,
  99. sizeof(pTG->ProtInst.RecvParams),
  100. &pTG->ProtInst.llRecvParams);
  101. pTG->ProtInst.fRecvParamsGot = TRUE;
  102. pTG->ProtInst.fllRecvParamsGot = TRUE;
  103. if(!ICommRecvParams(pTG, (LPBC)&pTG->ProtInst.RecvParams))
  104. {
  105. DebugPrintEx(DEBUG_WRN, "ATTENTION: pTG->ProtInst.fAbort = TRUE");
  106. pTG->ProtInst.fAbort = TRUE;
  107. }
  108. }