1xpanslookup(3)                SAORD Documentation               xpanslookup(3)
2
3
4

NAME

6       XPANSLookup: lookup registered XPA access points
7

SYNOPSIS

9         #include <xpa.h>
10
11         int XPANSLookup(XPA xpa,
12                         char *template, char type,
13                         char ***classes, char ***names,
14                         char ***methods, char ***infos)
15

DESCRIPTION

17       XPA routines act on a class:name identifier in such a way that all
18       access points that match the identifier are processed.  It is sometimes
19       desirable to choose specific access points from the candidates that
20       match the template.  In order to do this, the XPANSLookup routine can
21       be called to return a list of matches, so that specific class:name
22       instances can then be fed to XPAGet(), XPASet(), etc.
23
24        The first argument is an optional XPA struct. If non-NULL, the
25       existing name server connection associated with the specified xpa is
26       used to query the xpans name server for matching templates. Otherwise,
27       a new (temporary) connection is established with the name server.
28
29       The second argument to XPANSLookup is the class:name template to match.
30
31       The third argument for XPANSLookup() is the type of access and can be
32       any combination of:
33
34         type          explanation
35         ------        -----------
36         g             xpaget calls can be made on this access point
37         s             xpaset calls can be made on this access point
38         i             xpainfo calls can be made on this access point
39
40       The call typically specifies only one of these at a time.
41
42       The final arguments are pointers to arrays that will be filled in and
43       returned by the name server. The name server will allocate and return
44       arrays filled with the classes, names, and methods of all XPA access
45       points that match the template and have the specified type. Also
46       returned are info strings, which generally are used internally by the
47       client routines. These can be ignored (but the strings must be freed).
48       The function returns the number of matches. The returned value can be
49       used to loop through the matches:
50
51       Example:
52
53         #include <xpa.h>
54
55         char **classes;
56         char **names;
57         char **methods;
58         char **infos;
59         int i, n;
60         n = XPANSLookup(NULL, "foo*", "g", &classes, &names, &methods, &infos);
61         for(i=0; i<n; i++){
62           [more specific checks on possibilities ...]
63           [perhaps a call to XPAGet for those that pass, etc. ...]
64           /* don't forget to free alloc'ed strings when done */
65           free(classes[i]);
66           free(names[i]);
67           free(methods[i]);
68           free(infos[i]);
69         }
70         /* free up arrays alloc'ed by names server */
71         if( n > 0 ){
72           free(classes);
73           free(names);
74           free(methods);
75           free(infos);
76         }
77
78       The specified template also can be a host:port specification, for
79       example:
80
81         myhost:12345
82
83       In this case, no connection is made to the name server. Instead, the
84       call will return one entry such that the ip array contains the ip for
85       the specified host and the port array contains the port.  The class and
86       name entries are set to the character "?", since the class and name of
87       the access point are not known.
88

SEE ALSO

90       See xpa(n) for a list of XPA help pages
91
92
93
94version 2.1.15                   July 23, 2013                  xpanslookup(3)
Impressum