home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0210 - 0219 / ibm0210-0219 / ibm0213.tar / ibm0213 / LS4APWAD.ZIP / LS40A.A12 / IBMLSA / IBM400R2 / OSLANAPI.ZIP / IBMLAN / NETSRC / H / NMPIPE.H < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-10  |  5.2 KB  |  147 lines

  1. /**************************************************************************/
  2. /*                                                                        */
  3. /*              IBM OS/2(tm) Local Area Network (LAN) Server              */
  4. /*                            Version 3.0                                 */
  5. /* (c) Copyright International Business Machines Corporation, 1988, 1992  */
  6. /*                                                                        */
  7. /**************************************************************************/
  8.  
  9. /********************************************************************
  10.  *                                    *
  11.  *  About this file ...  NMPIPE.H                    *
  12.  *                                    *
  13.  *  This file contains information about the Named Pipe APIs.        *
  14.  *                                    *
  15.  *    Function prototypes.                        *
  16.  *                                    *
  17.  *    Data structure templates.                    *
  18.  *                                    *
  19.  *    Definition of special values.                    *
  20.  *                                    *
  21.  ********************************************************************/
  22.  
  23.  
  24. /**************************************************************** 
  25.  *                                *
  26.  *          Function prototypes                 *
  27.  *                                *
  28.  ****************************************************************/
  29.  
  30. extern API_FUNCTION
  31.   DosMakeNmPipe(char far *, unsigned far *, unsigned short, unsigned short,
  32.                 unsigned short, unsigned short, long);
  33.  
  34. extern API_FUNCTION
  35.   DosQNmPipeInfo(unsigned, unsigned short, char far *, unsigned short);
  36.  
  37. extern API_FUNCTION
  38.   DosConnectNmPipe(unsigned);
  39.  
  40. extern API_FUNCTION
  41.   DosDisconnectNmPipe(unsigned);
  42.  
  43. extern API_FUNCTION
  44.   DosQNmpHandState(unsigned, unsigned short far *);
  45.  
  46. extern API_FUNCTION
  47.   DosSetNmpHandState(unsigned, unsigned short);
  48.  
  49. extern API_FUNCTION
  50.   DosPeekNmPipe(unsigned, char far *, unsigned short, unsigned short far *,
  51.                 unsigned short far *, unsigned short far *);
  52.  
  53. extern API_FUNCTION
  54.   DosWaitNmPipe(char far *, long);
  55.  
  56. extern API_FUNCTION
  57.   DosTransactNmPipe(unsigned, char far *, unsigned short, char far *,
  58.                 unsigned short, unsigned short far *);
  59.  
  60. extern API_FUNCTION
  61.   DosCallNmPipe(char far *, char far *, unsigned short, char far *,
  62.                 unsigned short, unsigned short far *, long);
  63.  
  64. extern API_FUNCTION
  65.   DosSetNmPipeSem(unsigned, long, unsigned short);
  66.  
  67. extern API_FUNCTION
  68.   DosQNmPipeSemState(long, char far *, unsigned short);
  69.  
  70.  
  71. /**************************************************************** 
  72.  *                                *
  73.  *          Data structure templates            *
  74.  *                                *
  75.  ****************************************************************/
  76.  
  77.  
  78. struct    npi_data1 {    /* PipeInfo data block (returned, level 1) */
  79.     unsigned short    npi_obuflen;    /* length of outgoing I/O buffer */
  80.     unsigned short    npi_ibuflen;    /* length of incoming I/O buffer */
  81.     unsigned char    npi_maxicnt;    /* maximum number of instances */
  82.     unsigned char    npi_curicnt;    /* current number of instances */
  83.     unsigned char    npi_namlen;    /* length of pipe name */
  84.     char    npi_name[1];        /* start of name */
  85. };    /* npi_data1 */
  86.  
  87. struct    npss    {    /* QNmPipeSemState information record */
  88.     unsigned char    npss_status;    /* type of record, 0 = EOI, 1 = read ok,
  89.                      *   2 = write ok, 3 = pipe closed */
  90.     unsigned char    npss_flag;    /* additional info, 01 = waiting thread */
  91.     unsigned short    npss_key;    /* user's key value */
  92.     unsigned short    npss_avail;    /* available data/space if status = 1/2 */
  93. };    /* npss */
  94.  
  95. /* values in npss_status */
  96. #define    NPSS_EOI    0    /* End Of Information */
  97. #define    NPSS_RDATA    1    /* read data available */
  98. #define    NPSS_WSPACE    2    /* write space available */
  99. #define    NPSS_CLOSE    3    /* pipe in CLOSING state */
  100.  
  101. /* values in npss_flag */
  102. #define    NPSS_WAIT    0x01    /* waiting thread on other end of pipe */
  103.  
  104.  
  105. /**************************************************************** 
  106.  *                                *
  107.  *          Special values and constants            *
  108.  *                                *
  109.  ****************************************************************/
  110.  
  111. /* defined bits in pipe mode */
  112. #define    NP_NBLK        0x8000            /* non-blocking read/write */
  113. #define    NP_SERVER    0x4000            /* set if server end */
  114. #define    NP_WMESG    0x0400            /* write messages */
  115. #define    NP_RMESG    0x0100            /* read as messages */
  116. #define    NP_ICOUNT    0x00FF            /* instance count field */
  117.  
  118.  
  119. /*    Named pipes may be in one of several states depending on the actions
  120.  *    that have been taken on it by the server end and client end.  The
  121.  *    following state/action table summarizes the valid state transitions:
  122.  *
  123.  *    Current state        Action            Next state
  124.  *
  125.  *     <none>            server DosMakeNmPipe    DISCONNECTED
  126.  *     DISCONNECTED        server connect        LISTENING
  127.  *     LISTENING        client open            CONNECTED
  128.  *     CONNECTED        server disconn        DISCONNECTED
  129.  *     CONNECTED        client close        CLOSING
  130.  *     CLOSING        server disconn        DISCONNECTED
  131.  *     CONNECTED        server close        CLOSING
  132.  *     <any other>        server close        <pipe deallocated>
  133.  *
  134.  *    If a server disconnects his end of the pipe, the client end will enter a
  135.  *    special state in which any future operations (except close) on the file
  136.  *    descriptor associated with the pipe will return an error.
  137.  */
  138.  
  139. /*
  140.  *    Values for named pipe state
  141.  */
  142.  
  143. #define    NP_DISCONNECTED    1        /* after pipe creation or Disconnect */
  144. #define    NP_LISTENING    2        /* after DosNmPipeConnect */
  145. #define    NP_CONNECTED    3        /* after Client open */
  146. #define    NP_CLOSING    4        /* after Client or Server close */
  147.