SYNOPSIS

A brief introduction to the \s-1XPA\s0 messaging system, which provides seamless communication between all kinds of Unix event-driven programs, including X programs, Tcl/Tk programs, and Perl programs.

DESCRIPTION

The \s-1XPA\s0 messaging system provides seamless communication between all kinds of Unix programs, including X programs, Tcl/Tk programs, and Perl programs. It also provides an easy way for users to communicate with these XPA-enabled programs by executing \s-1XPA\s0 client commands in the shell or by utilizing such commands in scripts. Because \s-1XPA\s0 works both at the programming level and the shell level, it is a powerful tool for unifying any analysis environment: users and programmers have great flexibility in choosing the best level or levels at which to access \s-1XPA\s0 services, and client access can be extended or modified easily at any time.

A program becomes an XPA-enabled server by defining named points of public access through which data and commands can be exchanged with other client programs (and users). Using standard \s-1TCP\s0 sockets as a transport mechanism, \s-1XPA\s0 supports both single-point and broadcast messaging to and from these servers. It supports direct communication between clients and servers, or indirect communication via an intermediate message bus emulation program. Host-based access control is implemented, as is as the ability to communicate with \s-1XPA\s0 servers across a network.

\s-1XPA\s0 implements a layered interface that is designed to be useful both to software developers and to users. The interface consists of a library of \s-1XPA\s0 client and server routines for use in programs and a suite of high-level user programs built on top of these libraries. Using the \s-1XPA\s0 library, access points can be added to Tcl/Tk programs, Xt programs, or to Unix programs that use the \s-1XPA\s0 event loop or any event loop based on select(). Client access subroutines can be added to any Tcl/Tk or Unix program. Client access also is supported at the command line via a suite of high-level programs.

The major components of the \s-1XPA\s0 layered interface are:

  • A set of \s-1XPA\s0 server routines, centered on XPANew(), which are used by \s-1XPA\s0 server programs to tag public access points with string identifiers and to register send and receive callbacks for these access points.

  • A set of \s-1XPA\s0 client routines, centered on the XPASet() and XPAGet(), which are used by external client applications to exchange data and commands with an \s-1XPA\s0 server.

  • High-level programs, centered on xpaset and xpaget, which allow data and information to be exchanged with \s-1XPA\s0 server programs from the command line and from scripts. These programs have the command syntax:

      [data] | xpaset  [qualifiers ...]
               xpaget  [qualifiers ...]
    
  • An \s-1XPA\s0 name server program, xpans, through which \s-1XPA\s0 access point names are registered by servers and distributed to clients.

Defining an \s-1XPA\s0 access point is easy: a server application calls XPANew(), XPACmdNew(), or the experimental XPAInfoNew() routine to create a named public access point. An \s-1XPA\s0 service can specify \*(L"send\*(R" and \*(L"receive\*(R" callback procedures (or an \*(L"info\*(R" procedure in the case of XPAInfoNew()) to be executed by the program when an external process either sends data or commands to this access point or requests data or information from this access point. Either of the callbacks can be omitted, so that a particular access point can be specified as read-only, read-write, or write-only. Application-specific client data can be associated with these callbacks. Having defined one or more public access points in this way, an \s-1XPA\s0 server program enters its usual event loop (or uses the standard \s-1XPA\s0 event loop).

Clients communicate with these \s-1XPA\s0 public access points using programs such as xpaget, xpaset, and xpainfo (at the command line), or routines such as XPAGet(), XPASet(), and XPAInfo() within a program. Both methods require specification of the name of the access point. The xpaget program returns data or other information from an \s-1XPA\s0 server to its standard output, while the xpaset program sends data or commands from its standard input to an \s-1XPA\s0 application. The corresponding \s-1API\s0 routines set/get data to/from memory, returning error messages and other info as needed. If a template is used to specify the access point name (e.g., \*(L"ds9*\*(R"), then communication will take place with all servers matching that template.

Please note that \s-1XPA\s0 currently is not thread-safe. All \s-1XPA\s0 calls must be in the same thread.

RELATED TO xpaintro…

See xpa(7) for a list of \s-1XPA\s0 help pages