home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_08_11 / 8n11072a < prev    next >
Text File  |  1990-09-23  |  2KB  |  54 lines

  1. /****************** LISTING 1 - ipc.h ******************/
  2.  
  3. #include <stdio.h>
  4. #include <descrip.h>  /* Pass-by-descriptor structures   */
  5. #include <ssdef.h>    /* System services definitions     */
  6. #include <psldef.h>   /* Processor status longword def's */
  7. #include <iodef.h>    /* I/O services definitions        */
  8.  
  9. #define ADDMBX      0    /* Add server-client mailbox    */
  10. #define DELMBX      1    /* Delete server-client mailbox */
  11. #define PASSTHRU    2    /* Pass message to other client */
  12. #define BROADCAST   3    /* Broadcast to all clients     */
  13. #define SHUTDOWN    4    /* Shutdown                     */
  14.  
  15. #define MAX_NO_PROCESS     10          /* maximum clients */
  16. #define QSIZE  (2 * MAX_NO_PROCESS)    /* Rcv queue size  */
  17. #define RCVEF       1               /* Receive event flag */
  18.  
  19. /*====== structure for final I/O completion (QIO) ========*/
  20.  
  21. typedef struct { 
  22.                USHORT   status;    /* completion status   */
  23.                USHORT   bytcnt;    /* bytes transferred   */
  24.                ULONG    sndPID;    /* sender's PID        */
  25.                } IO_STATUS_BLOCK;
  26.  
  27. /*================ Message buffer ========================*/
  28.  
  29. typedef union {
  30.               int    array[100]; 
  31.               char   text[100];
  32.               } MSG;
  33.  
  34. typedef struct {
  35.          int   cmdtyp;     /* server command type         */
  36.          int   msgtyp;     /* message type                */
  37.          int   xmt_prcnum; /* sender's process number     */
  38.          int   rcv_prcnum; /* receiver's process number   */
  39.          MSG   msg;        /* msg buffer: int or text     */
  40.          } MSGBUF;
  41.  
  42. typedef struct {
  43.         IO_STATUS_BLOCK iosb;  
  44.         MSGBUF msg;            
  45.         } RCVBUF;
  46.  
  47. /*================= Process buffer =======================*/
  48.  
  49. typedef struct {
  50.            ULONG     prcnum;       /* process number */
  51.            USHORT    mbxid;        /* mailbox id     */
  52.            struct    CLIENT *link; /* next in list   */
  53.            } CLIENT;
  54.