| 1 |
|
| 2 |
<HTML> |
| 3 |
<HEAD> |
| 4 |
<TITLE>Introduction to XPA</TITLE> |
| 5 |
</HEAD> |
| 6 |
<BODY> |
| 7 |
|
| 8 |
|
| 9 |
<H2><A NAME="xpaintro">XPAIntro: Introduction to the XPA Messaging System</A></H2> |
| 10 |
|
| 11 |
|
| 12 |
<H2>Summary</H2> |
| 13 |
<P> |
| 14 |
A brief introduction to the XPA messaging system, which provides |
| 15 |
seamless communication between all kinds of Unix event-driven |
| 16 |
programs, including X programs, Tcl/Tk programs, and Perl programs. |
| 17 |
|
| 18 |
|
| 19 |
<H2>Description</H2> |
| 20 |
<P> |
| 21 |
The XPA messaging system provides seamless communication between all |
| 22 |
kinds of Unix programs, including X programs, Tcl/Tk programs, and |
| 23 |
Perl programs. It also provides an easy way for users to communicate |
| 24 |
with these XPA-enabled programs by executing XPA client commands in |
| 25 |
the shell or by utilizing such commands in scripts. Because XPA works |
| 26 |
both at the programming level and the shell level, it is a powerful |
| 27 |
tool for unifying any analysis environment: users and programmers have |
| 28 |
great flexibility in choosing the best level or levels at which to |
| 29 |
access XPA services, and client access can be extended or modified |
| 30 |
easily at any time. |
| 31 |
|
| 32 |
<P> |
| 33 |
A program becomes an XPA-enabled server by defining named points of |
| 34 |
public access through which data and commands can be exchanged with |
| 35 |
other client programs (and users). Using standard TCP sockets as |
| 36 |
a transport mechanism, XPA supports both single-point and broadcast |
| 37 |
messaging to and from these servers. It supports direct communication |
| 38 |
between clients and servers, or indirect communication via an |
| 39 |
intermediate message bus emulation program. Host-based access control |
| 40 |
is implemented, as is as the ability to communicate with XPA servers |
| 41 |
across a network. |
| 42 |
|
| 43 |
<P> |
| 44 |
XPA implements a layered interface that is designed to be useful both |
| 45 |
to software developers and to users. The interface consists of a |
| 46 |
library of XPA client and server routines for use in programs and a |
| 47 |
suite of high-level user programs built on top of these libraries. |
| 48 |
Using the XPA library, access points can be added to |
| 49 |
<A HREF="./tcl.html#">Tcl/Tk</A> |
| 50 |
programs, |
| 51 |
<A HREF="./xt.html#">Xt</A> |
| 52 |
programs, or to Unix programs that use the XPA event loop or any |
| 53 |
event loop based on select(). Client access subroutines can be added |
| 54 |
to any Tcl/Tk or Unix program. Client access also is supported at the |
| 55 |
command line via a suite of high-level programs. |
| 56 |
|
| 57 |
<P> |
| 58 |
The major components of the XPA layered interface are: |
| 59 |
<UL> |
| 60 |
<LI> |
| 61 |
A set of XPA server routines, centered on |
| 62 |
<A HREF="./server.html#xpanew">XPANew(),</A> |
| 63 |
which are used by XPA server programs to tag public access points with |
| 64 |
string identifiers and to register send and receive callbacks for |
| 65 |
these access points. |
| 66 |
|
| 67 |
<LI> |
| 68 |
A set of XPA client routines, centered on the |
| 69 |
<A HREF="./client.html#xpaset">XPASet()</A> |
| 70 |
and |
| 71 |
<A HREF="./client.html#xpaget">XPAGet(),</A> |
| 72 |
which are used by external client applications to exchange data and |
| 73 |
commands with an XPA server. |
| 74 |
|
| 75 |
<LI> |
| 76 |
High-level programs, centered on |
| 77 |
<A HREF="./programs.html#xpaset">xpaset</A> |
| 78 |
and |
| 79 |
<A HREF="./programs.html#xpaget">xpaget,</A> |
| 80 |
which allow data |
| 81 |
and information to be exchanged with XPA server programs from the |
| 82 |
command line and from scripts. These programs have the command syntax: |
| 83 |
<PRE> |
| 84 |
[data] | xpaset <XPA name> [qualifiers ...] |
| 85 |
xpaget <XPA name> [qualifiers ...] |
| 86 |
</PRE> |
| 87 |
<LI> |
| 88 |
An XPA name server program, |
| 89 |
<A HREF="./xpans.html">xpans,</A> |
| 90 |
through which XPA access point names are |
| 91 |
registered by servers and distributed to clients. |
| 92 |
</UL> |
| 93 |
|
| 94 |
<P> |
| 95 |
Defining an XPA access point is easy: a server application calls |
| 96 |
<A HREF="./server.html#xpanew">XPANew(),</A> |
| 97 |
<A HREF="./server.html#xpacmdnew">XPACmdNew(),</A> |
| 98 |
or the experimental |
| 99 |
<A HREF="./server.html#xpainfonew">XPAInfoNew()</A> |
| 100 |
routine to |
| 101 |
create a named public access point. An XPA service can specify "send" |
| 102 |
and "receive" callback procedures (or an "info" procedure in the case |
| 103 |
of XPAInfoNew()) to be executed by the program when an external |
| 104 |
process either sends data or commands to this access point or requests |
| 105 |
data or information from this access point. Either of the callbacks |
| 106 |
can be omitted, so that a particular access point can be specified as |
| 107 |
read-only, read-write, or write-only. Application-specific client |
| 108 |
data can be associated with these callbacks. Having defined one or |
| 109 |
more public access points in this way, an XPA server program enters |
| 110 |
its usual event loop (or uses the standard XPA event loop). |
| 111 |
|
| 112 |
<P> |
| 113 |
Clients communicate with these XPA public access points |
| 114 |
using programs such as |
| 115 |
<A HREF="./programs.html#xpaget">xpaget</A>, |
| 116 |
<A HREF="./programs.html#xpaset">xpaset</A>, and |
| 117 |
<A HREF="./programs.html#xpainfo">xpainfo</A> |
| 118 |
(at the command line), |
| 119 |
or routines such as |
| 120 |
<A HREF="./client.html#xpaget">XPAGet(),</A> |
| 121 |
<A HREF="./client.html#xpaset">XPASet(),</A> |
| 122 |
and |
| 123 |
<A HREF="./client.html#xpainfo">XPAInfo()</A> |
| 124 |
within a program. Both methods require specification of the name of |
| 125 |
the access point. The xpaget program returns data or other |
| 126 |
information from an XPA server to its standard output, while the |
| 127 |
xpaset program sends data or commands from its standard input to an |
| 128 |
XPA application. The corresponding API routines set/get data to/from |
| 129 |
memory, returning error messages and other info as needed. If a |
| 130 |
<A HREF="./template.html">template</A> |
| 131 |
is used to specify the access point name (e.g., "ds9*"), then |
| 132 |
communication will take place with all servers matching that template. |
| 133 |
|
| 134 |
<p> |
| 135 |
Please note that XPA currently is not thread-safe. All XPA calls must be |
| 136 |
in the same thread. |
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
<P> |
| 143 |
<A HREF="./help.html">Go to XPA Help Index</A> |
| 144 |
|
| 145 |
<H5>Last updated: March 10, 2007</H5> |
| 146 |
</BODY> |
| 147 |
</HTML> |
| 148 |
|