next up previous contents index
Next: Creating and Controlling Remote Up: Internals Previous: Internals

Encoding Event Values


Communication between Glish and clients is handled by a data transport layer called SOS. SOS is a library which provides platform independent transport of binary data between different machines, e.g. data can be moved from a SPARC machine to an ALPHA machine transparently. Any necessary conversion is done at the receiving end of the communication. This avoids unnecessary conversion on some architectures. SOS is a reimplementation in C++ of a portion of another transport library called SDS (contact Chris Saltmarsh at for more information about SDS).

The header portion of each event encodes information such as the architecture of the machine which sent the event, a time stamp, length of the event, etc. The interface to the event header is defined in the C++ header file <sos/header.h>. The header is followed by the actual event data.

The header information and binary values are written to and read from SOS sinks and sources. These are C++ objects which provide an I/O abstraction which allows you to read and write values from and to file descriptors, e.g. the pipes or sockets which connect Glish to clients. The header file <sos/io.h> defines the interface for SOS sources and sinks.

For the most part, Glish's dependence on the transport layer is isolated in two functions send_event() and recv_event(). Both of which can be found in These routines are parameterized with SOS source and sink objects. This is necessary to allow events being sent by the interpreter to be non-blocking. When used by the interpreter, send_event() sends what it can and the returns under the assumption that it will resume later. This eliminates some deadlock situations.

Thu Nov 13 16:44:05 EST 1997