1xpasetfd(3) SAORD Documentation xpasetfd(3)
2
3
4
6 XPASetFd: send data from stdin to one or more XPA servers
7
9 #include <xpa.h>
10
11 int XPASetFd(XPA xpa,
12 char *template, char *paramlist, char *mode,
13 int fd, char **names, char **messages, int n)
14
16 Read data from a standard I/O fd and send it to one or more XPA servers
17 whose class:name identifier matches the specified template.
18
19 A template of the form "class1:name1" is sent to the XPA name server,
20 which returns a list of at most n matching XPA servers. A connection
21 is established with each of these servers and the paramlist string is
22 passed to the server as the data transfer request is initiated. If an
23 XPA struct is passed to the call, then the persistent connections are
24 updated as described above. Otherwise, temporary connections are made
25 to the servers (which will be closed when the call completes).
26
27 The XPASetFd() routine then reads bytes from the specified fd until EOF
28 and sends these bytes to the XPA servers. The final parameter n speci‐
29 fies the maximum number of servers to contact. A string containing the
30 class:name and ip:port of each server is returned in the name array.
31 If a given server returned an error, then the error message will be
32 stored in the associated element of the messages array. NB: if speci‐
33 fied, the name and messages arrays must be of size n or greater.
34
35 The return value will contain the actual number of servers that were
36 processed. This value thus will hold the number of valid entries in
37 the names and messages arrays, and can be used to loop through these
38 arrays. In names and/or messages is NULL, no information is passed
39 back in that array.
40
41 The mode string is of the form: "key1=value1,key2=value2,..." The fol‐
42 lowing keywords are recognized:
43
44 key value default explanation
45 ------ -------- -------- -----------
46 ack true/false true if false, don't wait for ack from server (after callback completes)
47 verify true/false false send buf from XPASet[Fd] to stdout
48
49 The ack keyword is useful in cases where one does not want to wait for
50 the server to complete, e.g. is a lot of processing needs to be done on
51 the passed data or when the success of the server operation is not rel‐
52 evant to the client.
53
54 Example:
55
56 #include <xpa.h>
57
58 #define NXPA 10
59 int i, got;
60 int fd;
61 char *names[NXPA];
62 char *messages[NXPA];
63 fd = open(...);
64 got = XPASetFd(NULL, "ds9", "fits", NULL, fd, names, messages, NXPA);
65 for(i=0; i<got; i++){
66 if( messages[i] != NULL ){
67 /* error processing */
68 fprintf(stderr, "ERROR: %s (%s)\n", messages[i], names[i]);
69 }
70 if( names[i] )
71 free(names[i]);
72 if( messages[i] )
73 free(messages[i]);
74 }
75
77 See xpa(n) for a list of XPA help pages
78
79
80
81version 2.1.12 January 26, 2010 xpasetfd(3)