home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / src / turbo-tcp-20b4-cpp.hqx / TurboTCP / TurboTCP source / CTCPAsyncCall.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-03  |  2.0 KB  |  91 lines

  1. /*
  2. ** CTCPAsyncCall.h
  3. **
  4. **    TurboTCP support library
  5. **    TCP asynchronous call class
  6. **
  7. **    Copyright © 1993-94, FrostByte Design / Eric Scouten
  8. **
  9. */
  10.  
  11. #pragma once
  12.  
  13. #include "TCL.h"
  14. #include <TCPPB.h>
  15.  
  16. #include "CTCPDriver.h"
  17. #include "TCPCompletionProc.h"
  18.  
  19. class CTCPStream;
  20.  
  21.  
  22. /*______________________________________________________________________
  23. **
  24. ** CTCPAsyncCall
  25. **
  26. **    This object encapsulates each asynchronous call to MacTCP. This method is used so that
  27. **    the call’s I/O block may persist beyond the scope of the method call which originates the
  28. **    call (these methods are located in CTCPStream).
  29. **
  30. **    NOTE: All interaction with CTCPAsyncCalls should be through CTCPStream. No other class
  31. **    should have a reason to use this object, nor should this object be subclassed. Accordingly,
  32. **    all members of this class are declared private.
  33. **
  34. */
  35.  
  36. #if defined(powerc) || defined (__powerc)
  37. #pragma options align=mac68k
  38. #endif
  39.  
  40. class CTCPAsyncCall {
  41.  
  42.     friend class CTCPStream;
  43.     friend class CTCPDriver;
  44.  
  45.     TCL_DECLARE_CLASS;
  46.  
  47. private:
  48.     CTCPStream&        itsStream;            // the stream that requested this call
  49.     TurboTCPiopb        itsiopb;                // the TCP parm block, plus a few things (see "TCPCompletionProc.h")
  50.  
  51. #if USESROUTINEDESCRIPTORS
  52.     static UniversalProcPtr completionProcUPP;    // UPP for asynchronous completion proc
  53. #endif
  54.     
  55.  
  56.     // constructor
  57.     
  58.                     CTCPAsyncCall(CTCPStream& theStream)
  59.                         : itsStream(theStream)
  60.                         {
  61.                             itsiopb.itsQElem.qType = asyncCall;
  62.                             itsiopb.itsQElem.qSelfLink = this;
  63.                         }
  64.  
  65.  
  66.     // initiate, process TCP call
  67.  
  68.     OSErr            DoAsyncCall(short theCsCode, TCPiopb* theParamBlockPtr);
  69.     OSErr            DoAsyncCall(short theCsCode);
  70.     
  71.     void                ProcessCompletion();
  72.     Boolean            Dispatch();
  73.     Boolean            DispatchNoCopyRcv();
  74.  
  75.  
  76.     // completion procedure
  77.         
  78.     static void        GetCompletionProc();
  79.  
  80. #ifndef TCL_POWER_PC
  81.     static pascal void    CompletionProc();
  82. #else
  83.     static pascal void    CompletionProc(struct TurboTCPiopb* iopb);
  84. #endif
  85.  
  86. };
  87.  
  88. #if defined(powerc) || defined (__powerc)
  89. #pragma options align=reset
  90. #endif
  91.