home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / oclsrc15.zip / OCL / Include / ONPipe.hpp < prev    next >
C/C++ Source or Header  |  1996-08-12  |  3KB  |  113 lines

  1. // OCL - OS/2 Class Library
  2. // (c) Cubus 1995
  3. // All Rights Reserved
  4. // ONPipe.hpp
  5.  
  6. /*
  7.  * Redistribution and use in source and binary forms, with or without
  8.  * modification, are permitted provided that the following conditions
  9.  * are met:
  10.  * 1. Redistributions of source code must retain the above copyright
  11.  *    notice, this list of conditions and the following disclaimer.
  12.  * 2. Neither the name Cubus nor the name Team OCL may be used to
  13.  *    endorse or promote products derived from this software
  14.  *    without specific prior written permission.
  15.  * 3. See OCL.INF for a detailed copyright notice.
  16.  *
  17.  *              THIS SOFTWARE IS PROVIDED ``AS IS'' AND
  18.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  19.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  20.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  21.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  22.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  23.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  24.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  25.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  26.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  27.  * SUCH DAMAGE.
  28.  */
  29.  
  30. // $Header: W:/Projects/OCL/Include/rcs/ONPipe.hpp 1.50 1996/08/11 23:47:23 B.STEIN Release $
  31.  
  32. #ifndef ONPIPE_INCLUDED
  33.   #define ONPIPE_INCLUDED
  34.  
  35. #ifndef OSTRING_INCLUDED
  36.   #include <OString.hpp>
  37. #endif
  38.  
  39. #ifndef OTHREAD_INCLUDED
  40.   #include <OThread.hpp>
  41. #endif
  42.  
  43. #ifndef OLIST_INCLUDED
  44.   #include <OList.hpp>
  45. #endif
  46.  
  47.  
  48. #define SVR_PIPE_OPEN_DEFAULT  NP_ACCESS_DUPLEX | \
  49.                                NP_NOINHERIT | \
  50.                                NP_WRITEBEHIND
  51.  
  52. #define SVR_PIPE_PIPE_DEFAULT  NP_NOWAIT | \
  53.                                NP_READMODE_MESSAGE | \
  54.                                NP_TYPE_MESSAGE
  55.  
  56. #define CLI_PIPE_OPEN_DEFAULT  OPEN_ACCESS_READWRITE | \
  57.                                OPEN_SHARE_DENYNONE | \
  58.                                OPEN_FLAGS_WRITE_THROUGH
  59.  
  60. #define PIPE_TIMEOUT_DEFAULT   1000  // milliseconds to pipe timeout
  61.  
  62.  
  63. typedef class ONPipe *pONPipe;       // pure base
  64.  
  65.  
  66. typedef struct _PipeStatus
  67. {
  68.  HPIPE pipe;       // pipe handle
  69.  BOOL connected;   // is pipe connected?
  70. } PipeStatus, *pPipeStatus;
  71.  
  72.  
  73. typedef OList<PipeStatus>  pipelist;
  74. typedef pipelist *ppipelist;
  75.  
  76. class __CPP_EXPORT__ ONPipe
  77.   : public OCLObject
  78. {
  79.  public:
  80.    ULONG           oMode;
  81.    ULONG           pMode;
  82.    ULONG           timeOut;
  83.    BOOL            close;
  84.    PVOID           Buffer;
  85.    ULONG           BufSize;
  86.  
  87.    ONPipe          ();
  88.  
  89.    virtual
  90.       ~ONPipe      ();
  91.  
  92.    virtual
  93.       PSZ isOfType () const;
  94.  
  95.    void
  96.       setOpenMode  (const ULONG mode),
  97.       setPipeMode  (const ULONG mode),
  98.       setTimeOut   (const ULONG timeout);
  99.  
  100.  
  101. // pure virtuals
  102.  
  103.    virtual BOOL
  104.       beginPiping  (PCSZ pipeName) = 0,
  105.       stopPiping   () = 0,
  106.       postPipe     (PVOID pvData, ULONG client) = 0;
  107. };
  108.  
  109.  
  110. #endif // OPIPE_INCLUDED
  111.  
  112. // end of source
  113.