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.  NB: if specified, the
35       name and messages arrays must be of size n or greater.
36
37       The returned message string will be of the form:
38
39         XPA$ERROR error-message (class:name ip:port)
40
41       or
42
43         XPA$MESSAGE message (class:name ip:port)
44
45       Note that when there is an error stored in an messages entry, the cor‐
46       responding bufs and lens entry may or may not be NULL and 0 (respec‐
47       tively), depending on the particularities of the server.
48
49       The return value will contain the actual number of servers that were
50       processed.  This value thus will hold the number of valid entries in
51       the bufs, lens, names, and messages arrays, and can be used to loop
52       through these arrays.  In names and/or messages is NULL, no information
53       is passed back in that array.
54
55       The bufs, names, and messages arrays should be freed upon completion
56       (if they are not NULL);
57
58       The mode string is of the form: "key1=value1,key2=value2,..."  The fol‐
59       lowing keywords are recognized:
60
61         key           value           default         explanation
62         ------        --------        --------        -----------
63         ack           true/false      true            if false, don't wait for ack from server (after callback completes)
64         doxpa         true/false      true            client processes xpa requests
65
66       The ack keyword is not very useful, since the server completes the
67       callback in order to return the data anyway.  It is here for completion
68       (and perhaps for future usefulness).
69
70       Normally, an XPA client will process incoming XPA server requests while
71       awaiting the completion of the client request.  Setting this variable
72       to "false" will prevent XPA server requests from being processed by the
73       client.
74
75       Example:
76
77         #include <xpa.h>
78
79         #define NXPA 10
80         int  i, got;
81         int  lens[NXPA];
82         char *bufs[NXPA];
83         char *names[NXPA];
84         char *messages[NXPA];
85         got = XPAGet(NULL, "ds9", "file", NULL, bufs, lens, names, messages,
86         NXPA);
87         for(i=0; i<got; i++){
88           if( messages[i] == NULL ){
89             /* process buf contents */
90             ProcessImage(bufs[i], ...);
91             free(bufs[i]);
92           }
93           else{
94             /* error processing */
95             fprintf(stderr, "ERROR: %s (%s)\n", messages[i], names[i]);
96           }
97           if( names[i] )
98             free(names[i]);
99           if( messages[i] )
100             free(messages[i]);
101         }
102

SEE ALSO

104       See xpa(n) for a list of XPA help pages
105
106
107
108version 2.1.12                 January 26, 2010                      xpaget(3)
Impressum