home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 200-299 / ff290.lzh / IPC / IPC_Lib_Sources / IPCStruct.h < prev    next >
C/C++ Source or Header  |  1989-12-11  |  6KB  |  146 lines

  1. /*******************************************************************
  2.  *                                                                 *
  3.  *               IPCStruct.h                                       *
  4.  *                                                                 *
  5.  *              PPIPC Release  2.0 -- 1989 March 25                *
  6.  *                                                                 *
  7.  *  This contains just the IPC structures (Shared Library version) *
  8.  *  (No IPC Flags or function prototypes)                          *
  9.  *                                                                 *
  10.  *                                                                 *
  11.  *                                                                 *
  12.  *              Copyright 1988,1989 Peter Goodeve                  *
  13.  *                                                                 *
  14.  *  This source is freely distributable, and may be used freely    *
  15.  *  in any program,  but the structures should not be modified.    *
  16.  *                                                                 *
  17.  *******************************************************************/
  18.  
  19. #ifndef EXEC_TYPES_H
  20. #include "exec/types.h"
  21. #endif
  22.  
  23. #ifndef EXEC_PORTS_H
  24. #include "exec/ports.h"
  25. #endif
  26.  
  27. /*** Item Reference block -- an arbitrary number of these may be
  28.    put in an IPCMessage ***/
  29.  
  30. struct IPCItem {
  31.     ULONG   ii_Id;      /* four character ID (normally);
  32.                            determines exact meaning of IPCItem IDs */
  33.     ULONG   ii_Flags;   /* upper 16 bits have standard meaning;
  34.                            lower 16 bits are message dependent */
  35.     ULONG   ii_Size;    /* size of data structure (zero if ii_Ptr is not
  36.                            actually a pointer to data) */
  37.     void   *ii_Ptr;     /* points to defined data structure (could be within
  38.                            message block if IE_Flags says so) -- also may be
  39.                            recast to other 32-bit value (e.g. Lock) */
  40.     };
  41.  
  42.  
  43.  
  44. /*** The basic IPCMessage block ***/
  45.  
  46. struct IPCMessage {
  47.     struct Message  ipc_Msg;
  48.         /* ..ln_Name field should be NULL
  49.             mn_Length will include IPC_Items array and any in-line data
  50.         */
  51.     ULONG   ipc_Id,                /* four character (or other) ID */
  52.             ipc_Flags;
  53.     UWORD   ipc_ItemCount;         /* number of items in array */
  54.     struct  IPCItem ipc_Items[1];  /* .. actual size as needed */
  55.     };
  56.  
  57.  
  58. /*************************************************************/
  59.  
  60. #ifndef IPC_PORTS_H
  61. #define IPC_PORTS_H
  62.  
  63.  
  64. /*******************************************************************
  65.  *                                                                 *
  66.  *  88:7:22     ipp_BrokerInfo added to IPCPort                    *
  67.  *                                                                 *
  68.  *  89:3:25     IPCBasePort removed for shared library             *
  69.  *                                                                 *
  70.  *******************************************************************/
  71.  
  72.  
  73. /*******************************************************************
  74.  *                                                                 *
  75.  *  IPC Ports are essentially standard Exec message Ports except   *
  76.  *  for added fields to keep track of their usage.  Also they      *
  77.  *  are kept on their own list.                                    *
  78.  *                                                                 *
  79.  *  Note that the port name has to be kept WITHIN the structure    *
  80.  *  also, as the process that created it may go away.  The size    *
  81.  *  field holds the size of the structure including the name, so   *
  82.  *  it may be deleted safely when no longer needed.                *
  83.  *                                                                 *
  84.  *******************************************************************/
  85.  
  86. struct IPCPort {
  87.     struct MsgPort  ipp_Port;
  88.     ULONG           ipp_Id;         /* for future use */
  89.     UWORD           ipp_UseCount,   /* number of connections to the port */
  90.                     ipp_Flags,      /* internal information */
  91.                     ipp_Size;       /* size of the WHOLE structure */
  92.     void          * ipp_Broker_Info;  /* pointer to private information */
  93.     char            ipp_Name[1];    /* where name is actually kept! */
  94.     };
  95.  
  96.  
  97. /*******************************************************************
  98.  *                                                                 *
  99.  *  Note that the Shared Library version does not use an           *
  100.  *  "IPCBasePort" structure in the public Exec Port list.          *
  101.  *  All data structures are maintained internally to the           *
  102.  *  library.                                                       *
  103.  *                                                                 *
  104.  *******************************************************************/
  105.  
  106.  
  107. #endif
  108.  
  109.  
  110.  
  111. /* System IPCPort flags: */
  112.  
  113. #define IPP_SERVED 0x8000
  114.     /* port currently has a server */
  115. #define IPP_SHUT 0x4000
  116.     /* port is no longer open for new messages (server still attached) */
  117. #define IPP_REOPEN 0x2000
  118.     /* set (by "Port Broker") to request that server reopen service
  119.        to this port after it has completed Shut/Leave sequence
  120.        in progress */
  121. #define IPP_LOADING 0x1000
  122.     /* set (by "Port Broker") to indicate that a server is being loaded
  123.        for this port (cleared by ServeIPCPort()) */
  124.  
  125.  
  126. /* Server settable Port flags: */
  127.  
  128. #define IPP_SERVER_FLAGS 0x00FF
  129.  
  130.  
  131. #define IPP_NOTIFY 0x0001
  132.     /* server wants to be signalled if connection is added or
  133.        dropped (the port sigbit is used to signal the task,
  134.        but no message is sent) */
  135.  
  136. /*************************************************************/
  137.  
  138. /*
  139.    For convenience in creating IDs:
  140. */
  141.  
  142. #define MAKE_ID(a,b,c,d) ((a)<<24L | (b)<<16L | (c)<<8 | (d))
  143.  
  144.  
  145.  
  146.