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.

181 lines
7.1 KiB

  1. /***************************************************************************
  2. Name : PROTOCOL.H
  3. Comment : Data structure definitionc for protocol DLL
  4. Copyright (c) 1993 Microsoft Corp.
  5. Revision Log
  6. Date Name Description
  7. -------- ----- ---------------------------------------------------------
  8. ***************************************************************************/
  9. #include <fr.h>
  10. #include "oemint.h"
  11. /************************************
  12. This structure is meant to track the Group-3 FIF for DIS and DTC
  13. frames. The FIF is arranged so that the bits are numbered from
  14. 1 upward in teh order they are received. Since Modem/Comm
  15. behaviour puts received bits in a byte from low to high
  16. and the bytes into memory at increasing addresses, the bits
  17. need to run in memory from lowest bit of first byte through
  18. the highest bit and then on to the next address.
  19. Need to watch out for sudden reversal of the high-low order
  20. of bits and of bytes.
  21. The MS C7 compiler puts bit-fields into BYTES from low
  22. to high, so this should correspond. Don't change the BYTEs
  23. below to WORD as then we'll run into high-low byte flipping
  24. nonsense.
  25. If a bit-field crosses a byte boundary we're in trouble.
  26. *************************************/
  27. #define fsFreePtr(pTG, npfs) ((npfs)->b + (npfs)->uFreeSpaceOff)
  28. #define fsFreeSpace(pTG, npfs) (sizeof((npfs)->b) - (npfs)->uFreeSpaceOff)
  29. #define fsStart(pTG, npfs) ((npfs)->b)
  30. #define fsLim(pTG, npfs) (((npfs)->b) + sizeof((npfs)->b))
  31. #define fsSize(pTG, npfs) (sizeof((npfs)->b))
  32. #define BAUD_MASK 0xF // 4 bits wide
  33. #define WIDTH_SHIFT 4 // next item must be 2^this
  34. #define WIDTH_MASK 0xF3 // top 4 and bottom 3
  35. #define LENGTH_MASK 0x3
  36. #define MINSCAN_SUPER_HALF 8
  37. #define MINSCAN_MASK 0xF // actually 4 bits wide too
  38. #ifdef UECM
  39. # define NONEFAXECM 1
  40. #else
  41. # define NONEFAXECM 0
  42. #endif
  43. #define ZeroRFS(pTG, lp) _fmemset(lp, 0, sizeof(RFS))
  44. /****************** begin prototypes from sendfr.c *****************/
  45. VOID BCtoNSFCSIDIS(PThrdGlbl pTG, NPRFS npfs, NPBC npbc, NPLLPARAMS npll);
  46. VOID BCtoNSCCIGDTC(PThrdGlbl pTG, NPRFS npfs, NPBC npbc, NPLLPARAMS npll);
  47. // void CreateSEPPWDFrames(NPRFS npfs, NPBC npbc);
  48. void CreateNSForNSCorNSS(PThrdGlbl pTG, IFR ifr, NPRFS npfs, NPBC npbc, BOOL fSendID);
  49. void CreateIDFrame(PThrdGlbl pTG, IFR ifr, NPRFS npfs, LPSTR, BOOL fStrip);
  50. void CreateDISorDTC(PThrdGlbl pTG, IFR ifr, NPRFS npfs, NPBCFAX npbcFax, NPLLPARAMS npll);
  51. VOID CreateNSSTSIDCS(PThrdGlbl pTG, NPPROT npProt, NPRFS npfs, USHORT uWhichDCS);
  52. VOID CreateNSS(PThrdGlbl pTG, NPRFS npfs, NPBCSTD npbcStd);
  53. void CreateDCS(PThrdGlbl pTG, NPRFS, NPBCFAX npbcFax, NPLLPARAMS npll);
  54. /***************** end of prototypes from sendfr.c *****************/
  55. /****************** begin prototypes from recvfr.c *****************/
  56. BOOL AwaitSendParamsAndDoNegot(PThrdGlbl pTG, BOOL fSleep);
  57. void GotRecvCaps(PThrdGlbl pTG);
  58. void GotPollReq(PThrdGlbl pTG);
  59. void GotRecvParams(PThrdGlbl pTG);
  60. void AddNumIdToBC(PThrdGlbl pTG, LPSTR szId, LPBC lpbc, USHORT uMaxSize, BOOL fForce);
  61. /***************** end of prototypes from recvfr.c *****************/
  62. /****************** begin prototypes from dis.c *****************/
  63. USHORT SetupDISorDCSorDTC(PThrdGlbl pTG, NPDIS npdis, NPBCFAX npbcFax, NPLLPARAMS npll, BOOL fECM, BOOL f64);
  64. void ParseDISorDCSorDTC(PThrdGlbl pTG, NPDIS npDIS, NPBCFAX npbcFax, NPLLPARAMS npll, BOOL fParams);
  65. USHORT MinScanToBytesPerLine(PThrdGlbl pTG, BYTE Minscan, BYTE Baud);
  66. void NegotiateLowLevelParams(PThrdGlbl pTG, NPLLPARAMS npllRecv, NPLLPARAMS npllSend, DWORD AwRes, USHORT uEnc, NPLLPARAMS npllNegot);
  67. USHORT GetStupidReversedFIFs(PThrdGlbl pTG, LPSTR lpstr1, LPSTR lpstr2);
  68. void CreateStupidReversedFIFs(PThrdGlbl pTG, LPSTR lpstr1, LPSTR lpstr2);
  69. BOOL DropSendSpeed(PThrdGlbl pTG);
  70. USHORT CopyFrame(PThrdGlbl pTG, LPBYTE lpbDst, LPFR lpfr, USHORT uSize);
  71. void CopyRevIDFrame(PThrdGlbl pTG, LPBYTE lpbDst, LPFR lpfr);
  72. void EnforceMaxSpeed(PThrdGlbl pTG);
  73. /***************** end of prototypes from dis.c *****************/
  74. /****************** begin prototypes from whatnext.c *****************/
  75. ET30ACTION __cdecl FAR WhatNext(PThrdGlbl pTG, ET30EVENT event,
  76. WORD wArg1, DWORD lArg2, DWORD lArg3);
  77. /***************** end of prototypes from whatnext.c *****************/
  78. /****************** begin prototypes from protapi.c *****************/
  79. void GetRecvPageAck(PThrdGlbl pTG);
  80. /****************** end of prototypes from protapi.c *****************/
  81. /****************** begin prototypes from oem.c *****************/
  82. #ifdef OEMNSF
  83. WORD CreateOEMFrames(pTG, IFR ifr, WORD pos, NPBC npbcIn, NPLLPARAMS npllIn, NPRFS npfs);
  84. #else
  85. # define CreateOEMFrames(pTG, ifr, pos, npbcIn, npllIn, npfs) (0)
  86. #endif
  87. /****************** end prototypes from oem.c *****************/
  88. /**--------------------------- Debugging ------------------------**/
  89. #define SZMOD "Eprot: "
  90. #ifdef DEBUG
  91. extern DBGPARAM dpCurSettings;
  92. # define ZONE_PROTAPI ((1L << 6) & dpCurSettings.ulZoneMask)
  93. # define ZONE_WHATNEXT ((1L << 7) & dpCurSettings.ulZoneMask)
  94. # define ZONE_DIS ((1L << 8) & dpCurSettings.ulZoneMask)
  95. # define ZONE_RECVFR ((1L << 9) & dpCurSettings.ulZoneMask)
  96. # define ZONE_SENDFR ((1L << 10) & dpCurSettings.ulZoneMask)
  97. # define ZONE_OEM ((1L << 11) & dpCurSettings.ulZoneMask)
  98. extern void D_PrintBC(LPBC lpbc, LPSTR lpsz, LPLLPARAMS lpll);
  99. #else
  100. # define D_PrintBC(x, y, z)
  101. #endif
  102. #define MODID MODID_AWT30
  103. #define FILEID_DIS 31
  104. #define FILEID_PROTAPI 32
  105. #define FILEID_RECVFR 33
  106. #define FILEID_SENDFR 34
  107. #define FILEID_WHATNEXT 35
  108. #define FILEID_OEMNSF 36
  109. #ifdef NSF_TEST_HOOKS
  110. # define BC_TO_NSX(pTG, _ifr, _npbc, _ptr, _wcb, _lpw) \
  111. ((NSFTestGetNSx(pTG, _ifr, _npbc, _ptr, _wcb, _lpw)) \
  112. ? 0 : BCtoNSx(pTG, _ifr, _npbc, _ptr, _wcb, _lpw))
  113. # define NSX_TO_BC(pTG, _ifr, _lpfr, _wcbfr, _npbc, _wcbBC)\
  114. (NSFTestPutNSx(pTG, _ifr, _lpfr, _wcbfr, _npbc, _wcbBC), \
  115. NSxtoBC(pTG, _ifr, _lpfr, _wcbfr, _npbc, _wcbBC))
  116. BOOL NSFTestGetNSx (PThrdGlbl pTG, IFR ifr, LPBC lpbcIn,
  117. LPBYTE lpbOut, WORD wMaxOut, LPWORD lpwNumFrame);
  118. BOOL NSFTestPutNSx(PThrdGlbl pTG, IFR ifr, LPLPFR rglpfr, WORD wNumFrame,
  119. LPBC lpbcOut, WORD wBCSize);
  120. #else // !NSF_TEST_HOOKS
  121. # define BC_TO_NSX(pTG, _ifr, _npbc, _ptr, _wcb, _lpw) \
  122. BCtoNSx(pTG, _ifr, _npbc, _ptr, _wcb, _lpw)
  123. # define NSX_TO_BC(pTG, _ifr, _lpfr, _wcbfr, _npbc, _wcbBC)\
  124. NSxtoBC(pTG, _ifr, _lpfr, _wcbfr, _npbc, _wcbBC)
  125. #endif // !NSF_TEST_HOOKS