XPAAccess(3) return XPA access points matching template (XPA 2.1 and above)

SYNOPSIS


#include <xpa.h>
int XPAAccess(XPA xpa,
char *template, char *paramlist, char *mode,
char **names, char **messages, int n);

DESCRIPTION

The XPAAccess routine returns the public access points that match the specified second argument template and have the specified access type.

A template of the form ``class1:name1'' is sent to the XPA name server, which returns a list of at most n matching XPA servers. A connection is established with each of these servers and the paramlist string is passed to the server as the data transfer request is initiated. If an XPA struct is passed to the call, then the persistent connections are updated as described above. Otherwise, temporary connections are made to the servers (which will be closed when the call completes).

The XPAAccess() routine retrieves names from at most n XPA servers that match the specified template and that were checked for access using the specified mode. The return string contains both the class:name and ip:port. If a given server returned an error or the server callback sends a message back to the client, then the message will be stored in the associated element of the messages array. NB: if specified, the name and messages arrays must be of size n or greater.

The returned message string will be of the form:

  XPA$ERROR error-message (class:name ip:port)

Note that names of matching registered access points are always returned but may not be valid; it is not sufficient to assume that the returned number of access points is the number of valid access points. Rather, it is essential to check the messages array for error messages. Any string in the messages array is an error message and indicated that the associated access point is not available.

For example, assume that a server registers a number of access points but delays entering its event loop. If a call to XPAAccess() is made before the event loop is entered, the call will timeout (after waiting for the long timeout period) and return an error of the form:

  XPA$ERROR: timeout waiting for server authentication (XPA:xpa1)

The error means that the XPA access point has been registered but is not yet available (because events are not being processed). When the server finally enters its event loop, subsequent calls to XPAAccess() will return successfully.

NB: This routine only works with XPA servers built with XPA 2.1.x and later. Servers with older versions of XPA will return the error message:

  XPA$ERROR invalid xpa command in initialization string

If you get this error message, then the old server actually is ready for access, since it got to the point of fielding the query! The xpaaccess program, for example, ignores this message in order to work properly with older servers.

The third argument for XPAAccess() is the type of access and can be any combination of:

  type          explanation
  ------        -----------
  g             xpaget calls can be made on this access point
  s             xpaset calls can be made on this access point
  i             xpainfo calls can be made on this access point

The mode string argument is of the form: ``key1=value1,key2=value2,...'' The following keywords are recognized:

  key           value           default         explanation
  ------        --------        --------        -----------
  ack           true/false      true            if false, don't wait for ack from server (after callback completes)

The ack keyword is not very useful, since the server completes the callback in order to return the data anyway. It is here for completion (and perhaps for future usefulness).