Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

xpanslookup(3) [debian man page]

xpanslookup(3)							SAORD Documentation						    xpanslookup(3)

NAME
XPANSLookup - lookup registered XPA access points SYNOPSIS
#include <xpa.h> int XPANSLookup(XPA xpa, char *template, char type, char ***classes, char ***names, char ***methods, char ***infos) DESCRIPTION
XPA routines act on a class:name identifier in such a way that all access points that match the identifier are processed. It is sometimes desirable to choose specific access points from the candidates that match the template. In order to do this, the XPANSLookup routine can be called to return a list of matches, so that specific class:name instances can then be fed to XPAGet(), XPASet(), etc. The first argument is an optional XPA struct. If non-NULL, the existing name server connection associated with the specified xpa is used to query the xpans name server for matching templates. Otherwise, a new (temporary) connection is established with the name server. The second argument to XPANSLookup is the class:name template to match. The third argument for XPANSLookup() 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 call typically specifies only one of these at a time. The final arguments are pointers to arrays that will be filled in and returned by the name server. The name server will allocate and return arrays filled with the classes, names, and methods of all XPA access points that match the template and have the specified type. Also returned are info strings, which generally are used internally by the client routines. These can be ignored (but the strings must be freed). The function returns the number of matches. The returned value can be used to loop through the matches: Example - #include <xpa.h> char **classes; char **names; char **methods; char **infos; int i, n; n = XPANSLookup(NULL, "foo*", "g", &classes, &names, &methods, &infos); for(i=0; i<n; i++){ [more specific checks on possibilities ...] [perhaps a call to XPAGet for those that pass, etc. ...] /* don't forget to free alloc'ed strings when done */ free(classes[i]); free(names[i]); free(methods[i]); free(infos[i]); } /* free up arrays alloc'ed by names server */ if( n > 0 ){ free(classes); free(names); free(methods); free(infos); } The specified template also can be a host:port specification, for example: myhost:12345 In this case, no connection is made to the name server. Instead, the call will return one entry such that the ip array contains the ip for the specified host and the port array contains the port. The class and name entries are set to the character "?", since the class and name of the access point are not known. SEE ALSO
See xpa(7) for a list of XPA help pages version 2.1.14 June 7, 2012 xpanslookup(3)

Check Out this Related Man Page

xpaaccess(3)							SAORD Documentation						      xpaaccess(3)

NAME
XPAAccess - 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 call- back sends a message back to the client, then the message will be stored in the associated element of the messages array. NB: if speci- fied, 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 mes- sages. 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 mes- sage: 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). SEE ALSO
See xpa(7) for a list of XPA help pages version 2.1.14 June 7, 2012 xpaaccess(3)
Man Page