Listing 1 Base class and interface definitions for IPC architecture
namespace Jitsu.Ipc { public interface IMessageSink { void AcceptMessage(byte[] payload); } public abstract class IpcEndpoint { // Create a client-side connection to the IPC endpoint. public abstract IpcClient Connect(); // Create the server-side of an IPC endpoint, and // begin listening for messages. public abstract IpcServer Listen(); } public abstract class IpcClient : IMessageSink, IDisposable { // Send a message to the IPC endpoint (implements IMessageSink). public abstract void SendMessage(byte[] payload); // Close the client-side of the connection // (implements IDisposable). public abstract void Close(); } public abstract class IpcServer : IDisposable { // Begin listening for messages (blocks until StopListening // is called). Incoming messages are routed to the app's // IMessageSink callback. public abstract void StartListening(IMessageSink callback); // Shuts down the IPC endpoint (implements IDisposable). public abstract void StopListening(); } }