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

NAME

6       XPAGet: retrieve data from one or more XPA servers
7

SYNOPSIS

9         #include <xpa.h>
10
11         int XPAGet(XPA xpa,
12                    char *template, char *paramlist, char *mode,
13                    char **bufs, int *lens, char **names, char **messages,
14                    int n);
15

DESCRIPTION

17       Retrieve data from one or more XPA servers whose class:name identifier
18       matches the specified template.
19
20       A template of the form "class1:name1" is sent to the XPA name server,
21       which returns a list of at most n matching XPA servers.  A connection
22       is established with each of these servers and the paramlist string is
23       passed to the server as the data transfer request is initiated. If an
24       XPA struct is passed to the call, then the persistent connections are
25       updated as described above. Otherwise, temporary connections are made
26       to the servers (which will be closed when the call completes).
27
28       The XPAGet() routine then retrieves data from at most n XPA servers,
29       places these data into n allocated buffers and places the buffer point‐
30       ers in the bufs array. The length of each buffer is stored in the lens
31       array. A string containing the class:name and ip:port is stored in the
32       name array.  If a given server returned an error or the server callback
33       sends a message back to the client, then the message will be stored in
34       the associated element of the messages array.  The returned message
35       string will be of the form:
36
37         XPA$ERROR error-message (class:name ip:port)
38
39       or
40
41         XPA$MESSAGE message (class:name ip:port)
42
43       Note that when there is an error stored in an messages entry, the cor‐
44       responding bufs and lens entry may or may not be NULL and 0 (respec‐
45       tively), depending on the particularities of the server.
46
47       The return value will contain the actual number of servers that were
48       processed.  This value thus will hold the number of valid entries in
49       the bufs, lens, names, and messages arrays, and can be used to loop
50       through these arrays.  In names and/or messages is NULL, no information
51       is passed back in that array.
52
53       The bufs, names, and messages arrays should be freed upon completion
54       (if they are not NULL);
55
56       The mode string is of the form: "key1=value1,key2=value2,..."  The fol‐
57       lowing keywords are recognized:
58
59         key           value           default         explanation
60         ------        --------        --------        -----------
61         ack           true/false      true            if false, don't wait for ack from server (after callback completes)
62         doxpa         true/false      true            client processes xpa requests
63
64       The ack keyword is not very useful, since the server completes the
65       callback in order to return the data anyway.  It is here for completion
66       (and perhaps for future usefulness).
67
68       Normally, an XPA client will process incoming XPA server requests while
69       awaiting the completion of the client request.  Setting this variable
70       to "false" will prevent XPA server requests from being processed by the
71       client.
72
73       Example:
74
75         #include <xpa.h>
76
77         #define NXPA 10
78         int  i, got;
79         int  lens[NXPA];
80         char *bufs[NXPA];
81         char *names[NXPA];
82         char *messages[NXPA];
83         got = XPAGet(NULL, "ds9", "file", NULL, bufs, lens, names, messages,
84         NXPA);
85         for(i=0; i<got; i++){
86           if( messages[i] == NULL ){
87             /* process buf contents */
88             ProcessImage(bufs[i], ...);
89             free(bufs[i]);
90           }
91           else{
92             /* error processing */
93             fprintf(stderr, "ERROR: %s (%s)\n", messages[i], names[i]);
94           }
95           if( names[i] )
96             free(names[i]);
97           if( messages[i] )
98             free(messages[i]);
99         }
100

SEE ALSO

102       See xpa(n) for a list of XPA help pages
103
104
105
106version 2.1.8                  November 1, 2007                      xpaget(3)
Impressum