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

xpagetfd(3)							SAORD Documentation						       xpagetfd(3)

NAME
XPAGetFd - retrieve data from one or more XPA servers and write to files SYNOPSIS
#include <xpa.h> int XPAGetFd(XPA xpa, char *template, char *paramlist, char *mode, int *fds, char **names, char **messages, int n); DESCRIPTION
Retrieve data from one or more XPA servers whose class:name identifier matches the specified template and write it to files associated with one or more standard I/O fds (i.e, handles returned by open()). A template of the form "class1:name1" is sent to the XPA name server, which returns a list of at most ABS(n) matching XPA servers. A con- nection is established with each of these servers and the paramlist string is passed to the server as the data transfer request is initi- ated. If an XPA struct is passed to the call, then the persistent connections are updated as described above. Otherwise, temporary connec- tions are made to the servers (which will be closed when the call completes). The XPAGetFd() routine then retrieves data from the XPA servers, and write these data to the fds associated with one or more fds (i.e., results from open). Is n is positive, then there will be n fds and the data from each server will be sent to a separate fd. If n is nega- tive, then there is only 1 fd and all data is sent to this single fd. (The latter is how xpaget is implemented.) A string containing the class:name and ip:port is stored in the name array. 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) or XPA$MESSAGE message (class:name ip:port) Note that when there is an error stored in an messages entry, the corresponding bufs and lens entry may or may not be NULL and 0 (respec- tively), depending on the particularities of the server. The return value will contain the actual number of servers that were processed. This value thus will hold the number of valid entries in the bufs, lens, names, and messages arrays, and can be used to loop through these arrays. In names and/or messages is NULL, no information is passed back in that array. The mode string 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). Example - #include <xpa.h> #define NXPA 10 int i, got; int fds[NXPA]; char *names[NXPA]; char *messages[NXPA]; for(i=0; i<NXPA; i++) fds[i] = open(...); got = XPAGetFd(NULL, "ds9", "file", NULL, fds, names, messages, NXPA); for(i=0; i<got; i++){ if( messages[i] != NULL ){ /* error processing */ fprintf(stderr, "ERROR: %s (%s) ", messages[i], names[i]); } if( names[i] ) free(names[i]); if( messages[i] ) free(messages[i]); } SEE ALSO
See xpa(7) for a list of XPA help pages version 2.1.14 June 7, 2012 xpagetfd(3)
Man Page