1xpaset(3) SAORD Documentation xpaset(3)
2
3
4
6 XPASet: send data to one or more XPA servers
7
9 #include <xpa.h>
10
11 int XPASet(XPA xpa,
12 char *template, char *paramlist, char *mode,
13 char *buf, int len, char **names, char **messages,
14 int n);
15
17 Send data to 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, 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 XPASet() routine transfers data from buf to the XPA servers. The
29 length of buf (in bytes) should be placed in the len variable.
30
31 A string containing the class:name and ip:port of each of these server
32 is returned in the name array. If a given server returned an error or
33 the server callback sends a message back to the client, then the mes‐
34 sage will be stored in the associated element of the messages array.
35 The returned message string will be of the form:
36
37 XPA$ERROR [error] (class:name ip:port)
38
39 or
40
41 XPA$MESSAGE [message] (class:name ip:port)
42
43 The return value will contain the actual number of servers that were
44 processed. This value thus will hold the number of valid entries in
45 the names and messages arrays, and can be used to loop through these
46 arrays. In names and/or messages is NULL, no information is passed
47 back in that particular array.
48
49 The mode string is of the form: "key1=value1,key2=value2,..." The fol‐
50 lowing keywords are recognized:
51
52 key value default explanation
53 ------ -------- -------- -----------
54 ack true/false true if false, don't wait for ack from server (after callback completes)
55 verify true/false false send buf from XPASet[Fd] to stdout
56 doxpa true/false true client processes xpa requests
57
58 The ack keyword is useful in cases where one does not want to wait for
59 the server to complete, e.g. if a lot of processing needs to be done by
60 the server on the passed data or when the success of the server opera‐
61 tion is not relevant to the client.
62
63 Normally, an XPA client will process incoming XPA server requests while
64 awaiting the completion of the client request. Setting this variable
65 to "false" will prevent XPA server requests from being processed by the
66 client.
67
68 Example:
69
70 #include <xpa.h>
71
72 #define NXPA 10
73 int i, got;
74 int len;
75 char *buf;
76 char *names[NXPA];
77 char *messages[NXPA];
78 ...
79 [fill buf with data and set len to the length, in bytes, of the data]
80 ...
81 /* send data to all access points */
82 got = XPASet(NULL, "ds9", "fits", NULL, buf, len, names, messages, NXPA);
83 /* error processing */
84 for(i=0; i<got; i++){
85 if( messages[i] ){
86 fprintf(stderr, "ERROR: %s (%s)\n", messages[i], names[i]);
87 }
88 if( names[i] ) free(names[i]);
89 if( messages[i] ) free(messages[i]);
90 }
91
93 See xpa(n) for a list of XPA help pages
94
95
96
97version 2.1.8 November 1, 2007 xpaset(3)