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

NAME

6       XPAGetFd: retrieve data from one or more XPA servers and write to files
7

SYNOPSIS

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

DESCRIPTION

16       Retrieve data from one or more XPA servers whose class:name identifier
17       matches the specified template and write it to files associated with
18       one or more standard I/O fds (i.e, handles returned by open()).
19
20       A template of the form "class1:name1" is sent to the XPA name server,
21       which returns a list of at most ABS(n) matching XPA servers.  A connec‐
22       tion is established with each of these servers and the paramlist string
23       is passed to the server as the data transfer request is initiated. If
24       an XPA struct is passed to the call, then the persistent connections
25       are updated as described above. Otherwise, temporary connections are
26       made to the servers (which will be closed when the call completes).
27
28       The XPAGetFd() routine then retrieves data from the XPA servers, and
29       write these data to the fds associated with one or more fds (i.e.,
30       results from open). Is n is positive, then there will be n fds and the
31       data from each server will be sent to a separate fd. If n is negative,
32       then there is only 1 fd and all data is sent to this single fd. (The
33       latter is how xpaget is implemented.)
34
35       A string containing the class:name and ip:port is stored in the name
36       array.  If a given server returned an error or the server callback
37       sends a message back to the client, then the message will be stored in
38       the associated element of the messages array.  The returned message
39       string will be of the form:
40
41         XPA$ERROR   error-message (class:name ip:port)
42
43       or
44
45         XPA$MESSAGE message     (class:name ip:port)
46
47       Note that when there is an error stored in an messages entry, the cor‐
48       responding bufs and lens entry may or may not be NULL and 0 (respec‐
49       tively), depending on the particularities of the server.
50
51       The return value will contain the actual number of servers that were
52       processed.  This value thus will hold the number of valid entries in
53       the bufs, lens, names, and messages arrays, and can be used to loop
54       through these arrays.  In names and/or messages is NULL, no information
55       is passed back in that array.
56
57       The mode string is of the form: "key1=value1,key2=value2,..."  The fol‐
58       lowing keywords are recognized:
59
60         key           value           default         explanation
61         ------        --------        --------        -----------
62         ack           true/false      true            if false, don't wait for ack from server (after callback completes)
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       Example:
69
70         #include <xpa.h>
71         #define NXPA 10
72         int  i, got;
73         int fds[NXPA];
74         char *names[NXPA];
75         char *messages[NXPA];
76         for(i=0; i<NXPA; i++)
77           fds[i] = open(...);
78         got = XPAGetFd(NULL, "ds9", "file", NULL, fds, names, messages, NXPA);
79         for(i=0; i<got; i++){
80           if( messages[i] != NULL ){
81             /* error processing */
82             fprintf(stderr, "ERROR: %s (%s)\n", messages[i], names[i]);
83           }
84           if( names[i] )
85             free(names[i]);
86           if( messages[i] )
87             free(messages[i]);
88         }
89

SEE ALSO

91       See xpa(n) for a list of XPA help pages
92
93
94
95version 2.1.8                  November 1, 2007                    xpagetfd(3)
Impressum