home *** CD-ROM | disk | FTP | other *** search
- [ 4. Inter-Process Communication]
- EMBEDDED LAN INTER-PROCESS COMMUNICATION (IPC)
- ═════════════════════════════════════════════════════════════════════════
- The Embedded LAN Inter-Process Communication interface (IPC) allows the
- application to communicate with its peers via high-level software objects
- that promote efficient queueing and message passing. Using Embedded LAN
- IPC services, your application will be able to distribute its workload
- across the entire network. IPC also makes it easy to develop client-
- server-based applications to run embedded systems.
-
- QUEUES
-
- Embedded LAN IPC Queues are fast FIFO/LIFOs that allow any thread on
- the network to send a 32-bit token to a queue object or receive a token
- from a queue object. Any number of readers and writers are allowed on
- the network. Queues are simple, fast, synchronous, and inexpensive for
- transmitting short messages between applications on the network. When
- creating or opening queues, the syntax, "\\machinename\queuename" is
- used to specify the name.
-
- MESSAGE PORTS
-
- Embedded LAN IPC Message Ports are fast FIFOs that allow multiple readers
- and writers to asynchronously send and receive messages from 0-65535
- bytes in length. The Message Port system can automatically buffer the
- message data, or it can use the application's buffer for staging the
- I/O across the network. When creating or opening message portts, the
- syntax, "\\machinename\msgportname" is used to specify the name.
-
- IPC INTERFACE API:
-
- IPCAPI IpcCreateQueue(
- IN UCHAR *AsciizName,
- OUT PIPCHANDLE Handle);
-
- IPCAPI IpcOpenQueue(
- IN UCHAR *AsciizName,
- OUT PIPCHANDLE Handle);
-
- IPCAPI IpcCloseQueue(
- IN IPCHANDLE Handle);
-
- IPCAPI IpcPushQueue(
- IN IPCHANDLE Handle,
- IN ULONG Datum);
-
- IPCAPI IpcAppendQueue(
- IN IPCHANDLE Handle,
- IN ULONG Datum);
-
- IPCAPI IpcPopQueue(
- IN IPCHANDLE Handle,
- OUT ULONG *Datum);
-
- IPCAPI IpcCreateMsgPort(
- IN UCHAR *AsciizName,
- OUT PIPCHANDLE Handle);
-
- IPCAPI IpcOpenMsgPort(
- IN UCHAR *AsciizName,
- OUT PIPCHANDLE Handle);
-
- IPCAPI IpcCloseMsgPort(
- IN IPCHANDLE Handle);
-
- IPCAPI IpcSendMsg(
- IN IPCHANDLE Handle,
- IN PVOID Buffer,
- IN USHORT BufferLength,
- IN USHORT Flags,
- IN HANDLE Event);
-
- //
- // The following flags may be passed on IpcSendMsg &
- // IpcReceiveMsg requests. The WAIT option causes the
- // operation to block until the send or receive is
- // complete. The BUFFER option is only valid on SendMsg,
- // and causes the message system to automatically copy
- // the sender's data.
- //
-
- #define MSG_FLAGS_WAIT 0x0001 // block until operation complete.
- #define MSG_FLAGS_BUFFER 0x0002 // user buffer is buffered by system.
- #define MSG_FLAGS_USEREVENT 0x0004 // set user event when operation complete.
-
- IPCAPI IpcReceiveMsg(
- IN IPCHANDLE Handle,
- IN PVOID Buffer,
- IN USHORT BufferLength,
- OUT USHORT *BytesTransferred,
- IN USHORT Flags,
- IN HANDLE Event);
-
- IPCAPI IpcQueryInformation(
- IN IPCHANDLE Handle,
- IN USHORT InfoType,
- IN PVOID Buffer,
- IN USHORT BufferLength);
-
- IPCAPI IpcSetInformation(
- IN IPCHANDLE Handle,
- IN USHORT InfoType,
- IN PVOID Buffer,
- IN USHORT BufferLength);
-
- #define IPC_INFO_LOCAL_PROVIDER 0x201 // local objects.
- #define IPC_INFO_REMOTE_PROVIDER 0x202 // remote objects.
- #define IPC_INFO_OBJECT_STATISTICS 0x203 // msgport/queue.
-
- typedef struct _IPC_STATISTICS {
-
- //
- // Raw data transport statistics.
- //
-
- QUADINT MessageBytesSent;
- QUADINT MessageBytesReceived;
-
- //
- // Queue statistics.
- //
-
- QUADINT CreateQueueCount;
- QUADINT OpenQueueCount;
- QUADINT CloseQueueCount;
- QUADINT PushQueueCount;
- QUADINT AppendQueueCount;
- QUADINT PopQueueCount;
-
- //
- // Message Port statistics.
- //
-
- QUADINT CreateMsgPortCount;
- QUADINT OpenMsgPortCount;
- QUADINT CloseMsgPortCount;
- QUADINT SendMsgCount;
- QUADINT ReceiveMsgCount;
-
- //
- // Error statistics.
- //
-
- QUADINT TransmitErrors; // TdiSends that fail.
- QUADINT ReceiveErrors; // Tdi receive indications that fail.
- } IPC_STATISTICS, *PIPC_STATISTICS;
-
- typedef union _IPC_INFORMATION_BUFFER {
- IPC_STATISTICS ObjectStatistics; // single queue/msgport.
- IPC_STATISTICS LocalProviderStatistics; // local queues/msgports.
- IPC_STATISTICS RemoteProviderStatistics; // remote queues/msgports.
- } IPC_INFORMATION_BUFFER, *PIPC_INFORMATION_BUFFER;
-