home *** CD-ROM | disk | FTP | other *** search
/ C/C++ User's Journal & Wi…eveloper's Journal Tools / C-C__Users_Journal_and_Windows_Developers_Journal_Tools_1997.iso / sysembed / ipc.elh < prev    next >
Encoding:
Text File  |  1995-03-30  |  4.5 KB  |  153 lines

  1. [ 4. Inter-Process Communication]
  2.               EMBEDDED LAN INTER-PROCESS COMMUNICATION (IPC)
  3. ═════════════════════════════════════════════════════════════════════════
  4. The Embedded LAN Inter-Process Communication interface (IPC) allows the
  5. application to communicate with its peers via high-level software objects
  6. that promote efficient queueing and message passing.  Using Embedded LAN
  7. IPC services, your application will be able to distribute its workload
  8. across the entire network.  IPC also makes it easy to develop client-
  9. server-based applications to run embedded systems.
  10.  
  11. QUEUES
  12.  
  13. Embedded LAN IPC Queues are fast FIFO/LIFOs that allow any thread on
  14. the network to send a 32-bit token to a queue object or receive a token
  15. from a queue object.  Any number of readers and writers are allowed on
  16. the network.  Queues are simple, fast, synchronous, and inexpensive for
  17. transmitting short messages between applications on the network.  When
  18. creating or opening queues, the syntax, "\\machinename\queuename" is
  19. used to specify the name.
  20.  
  21. MESSAGE PORTS
  22.  
  23. Embedded LAN IPC Message Ports are fast FIFOs that allow multiple readers
  24. and writers to asynchronously send and receive messages from 0-65535
  25. bytes in length.  The Message Port system can automatically buffer the
  26. message data, or it can use the application's buffer for staging the
  27. I/O across the network. When creating or opening message portts, the
  28. syntax, "\\machinename\msgportname" is used to specify the name.
  29.  
  30. IPC INTERFACE API:
  31.  
  32. IPCAPI IpcCreateQueue(
  33.     IN UCHAR *AsciizName,
  34.     OUT PIPCHANDLE Handle);
  35.  
  36. IPCAPI IpcOpenQueue(
  37.     IN UCHAR *AsciizName,
  38.     OUT PIPCHANDLE Handle);
  39.  
  40. IPCAPI IpcCloseQueue(
  41.     IN IPCHANDLE Handle);
  42.  
  43. IPCAPI IpcPushQueue(
  44.     IN IPCHANDLE Handle,
  45.     IN ULONG Datum);
  46.  
  47. IPCAPI IpcAppendQueue(
  48.     IN IPCHANDLE Handle,
  49.     IN ULONG Datum);
  50.  
  51. IPCAPI IpcPopQueue(
  52.     IN IPCHANDLE Handle,
  53.     OUT ULONG *Datum);
  54.  
  55. IPCAPI IpcCreateMsgPort(
  56.     IN UCHAR *AsciizName,
  57.     OUT PIPCHANDLE Handle);
  58.  
  59. IPCAPI IpcOpenMsgPort(
  60.     IN UCHAR *AsciizName,
  61.     OUT PIPCHANDLE Handle);
  62.  
  63. IPCAPI IpcCloseMsgPort(
  64.     IN IPCHANDLE Handle);
  65.  
  66. IPCAPI IpcSendMsg(
  67.     IN IPCHANDLE Handle,
  68.     IN PVOID Buffer,
  69.     IN USHORT BufferLength,
  70.     IN USHORT Flags,
  71.     IN HANDLE Event);
  72.  
  73. //
  74. // The following flags may be passed on IpcSendMsg &
  75. // IpcReceiveMsg requests.  The WAIT option causes the
  76. // operation to block until the send or receive is
  77. // complete.  The BUFFER option is only valid on SendMsg,
  78. // and causes the message system to automatically copy
  79. // the sender's data.
  80. //
  81.  
  82. #define MSG_FLAGS_WAIT          0x0001  // block until operation complete.
  83. #define MSG_FLAGS_BUFFER        0x0002  // user buffer is buffered by system.
  84. #define MSG_FLAGS_USEREVENT     0x0004  // set user event when operation complete.
  85.  
  86. IPCAPI IpcReceiveMsg(
  87.     IN IPCHANDLE Handle,
  88.     IN PVOID Buffer,
  89.     IN USHORT BufferLength,
  90.     OUT USHORT *BytesTransferred,
  91.     IN USHORT Flags,
  92.     IN HANDLE Event);
  93.  
  94. IPCAPI IpcQueryInformation(
  95.     IN IPCHANDLE Handle,
  96.     IN USHORT InfoType,
  97.     IN PVOID Buffer,
  98.     IN USHORT BufferLength);
  99.  
  100. IPCAPI IpcSetInformation(
  101.     IN IPCHANDLE Handle,
  102.     IN USHORT InfoType,
  103.     IN PVOID Buffer,
  104.     IN USHORT BufferLength);
  105.  
  106. #define IPC_INFO_LOCAL_PROVIDER         0x201  // local objects.
  107. #define IPC_INFO_REMOTE_PROVIDER        0x202  // remote objects.
  108. #define IPC_INFO_OBJECT_STATISTICS      0x203  // msgport/queue.
  109.  
  110. typedef struct _IPC_STATISTICS {
  111.  
  112.     //
  113.     // Raw data transport statistics.
  114.     //
  115.  
  116.     QUADINT MessageBytesSent;
  117.     QUADINT MessageBytesReceived;
  118.  
  119.     //
  120.     // Queue statistics.
  121.     //
  122.  
  123.     QUADINT CreateQueueCount;
  124.     QUADINT OpenQueueCount;
  125.     QUADINT CloseQueueCount;
  126.     QUADINT PushQueueCount;
  127.     QUADINT AppendQueueCount;
  128.     QUADINT PopQueueCount;
  129.  
  130.     //
  131.     // Message Port statistics.
  132.     //
  133.  
  134.     QUADINT CreateMsgPortCount;
  135.     QUADINT OpenMsgPortCount;
  136.     QUADINT CloseMsgPortCount;
  137.     QUADINT SendMsgCount;
  138.     QUADINT ReceiveMsgCount;
  139.  
  140.     //
  141.     // Error statistics.
  142.     //
  143.  
  144.     QUADINT TransmitErrors;             // TdiSends that fail.
  145.     QUADINT ReceiveErrors;              // Tdi receive indications that fail.
  146. } IPC_STATISTICS, *PIPC_STATISTICS;
  147.  
  148. typedef union _IPC_INFORMATION_BUFFER {
  149.     IPC_STATISTICS ObjectStatistics;            // single queue/msgport.
  150.     IPC_STATISTICS LocalProviderStatistics;     // local queues/msgports.
  151.     IPC_STATISTICS RemoteProviderStatistics;    // remote queues/msgports.
  152. } IPC_INFORMATION_BUFFER, *PIPC_INFORMATION_BUFFER;
  153.