File Coverage

VXI11.xs
Criterion Covered Total %
statement 0 94 0.0
branch 0 56 0.0
condition n/a
subroutine n/a
pod n/a
total 0 150 0.0


line stmt bran cond sub pod time code
1             #define PERL_NO_GET_CONTEXT
2             #include "EXTERN.h"
3             #include "perl.h"
4             #include "XSUB.h"
5              
6             #include "ppport.h"
7              
8             #include
9              
10             #include "const-c.inc"
11              
12             typedef CLIENT *Lab__VXI11;
13              
14             static void
15 0           do_not_warn_unused(void *x __attribute__((__unused__)))
16             {
17 0           }
18              
19             static void
20 0           set_clnt_timeout(CLIENT *client, u_long timeout)
21             {
22             struct timeval tv;
23 0           tv.tv_sec = timeout / 1000;
24 0           tv.tv_usec = (timeout % 1000) * 1000;
25 0           clnt_control(client, CLSET_TIMEOUT, (char *) &tv);
26 0           }
27              
28             static void
29 0           check_resp(CLIENT *client, void *resp)
30             {
31 0 0         if (resp == NULL) {
32             struct rpc_err err;
33 0           clnt_geterr(client, &err);
34 0           char *msg = clnt_sperrno(err.re_status);
35 0           croak("RPC client failure: %s", msg);
36             }
37 0           }
38              
39              
40             MODULE = Lab::VXI11 PACKAGE = Lab::VXI11
41              
42             INCLUDE: const-xs.inc
43              
44             Lab::VXI11
45             new(char *class, char *host, unsigned long prog, unsigned long vers, char *proto)
46             CODE:
47 0           do_not_warn_unused(class);
48 0           RETVAL = clnt_create(host, prog, vers, proto);
49 0 0         if (RETVAL == NULL)
50 0           clnt_pcreateerror("Failed to create RPC client:");
51             OUTPUT:
52             RETVAL
53              
54              
55             void
56             DESTROY(Lab::VXI11 client)
57             CODE:
58 0           clnt_destroy(client);
59              
60              
61             void
62             create_link(Lab::VXI11 client, long clientId, bool_t lockDevice, u_long lock_timeout, char *device)
63             PPCODE:
64 0           Create_LinkParms link_parms = {clientId, lockDevice, lock_timeout, device};
65            
66             Create_LinkResp *link_resp;
67 0           link_resp = create_link_1(&link_parms, client);
68 0           check_resp(client, link_resp);
69 0 0         mXPUSHi(link_resp->error);
70 0 0         mXPUSHi(link_resp->lid);
71 0 0         mXPUSHu(link_resp->abortPort);
72 0 0         mXPUSHu(link_resp->maxRecvSize);
73              
74              
75              
76             void
77             device_write(Lab::VXI11 client, Device_Link lid, u_long io_timeout, u_long lock_timeout, Device_Flags flags, SV *data)
78             PPCODE:
79             const char *bytes;
80             STRLEN len;
81 0 0         bytes = SvPV(data, len);
82 0           Device_WriteParms write_parms = {lid, io_timeout, lock_timeout, flags, {len, (char *) bytes}};
83              
84             Device_WriteResp *write_resp;
85 0           set_clnt_timeout(client, io_timeout);
86 0           write_resp = device_write_1(&write_parms, client);
87 0           check_resp(client, write_resp);
88 0 0         mXPUSHi(write_resp->error);
89 0 0         mXPUSHu(write_resp->size);
90              
91              
92             void
93             device_read(Lab::VXI11 client, Device_Link lid, u_long requestSize, u_long io_timeout, u_long lock_timeout, Device_Flags flags, char termChar)
94             PPCODE:
95 0           Device_ReadParms read_parms = {lid, requestSize, io_timeout, lock_timeout, flags, termChar};
96              
97             Device_ReadResp *read_resp;
98 0           set_clnt_timeout(client, io_timeout);
99 0           read_resp = device_read_1(&read_parms, client);
100 0           check_resp(client, read_resp);
101 0 0         mXPUSHi(read_resp->error);
102 0 0         mXPUSHi(read_resp->reason);
103 0 0         mXPUSHp(read_resp->data.data_val, read_resp->data.data_len);
104            
105            
106              
107            
108             void
109             device_readstb(Lab::VXI11 client, Device_Link lid, Device_Flags flags, u_long lock_timeout, u_long io_timeout)
110             PPCODE:
111 0           Device_GenericParms parms = {lid, flags, lock_timeout, io_timeout};
112             Device_ReadStbResp *resp;
113 0           set_clnt_timeout(client, io_timeout);
114 0           resp = device_readstb_1(&parms, client);
115 0           check_resp(client, resp);
116 0 0         mXPUSHi(resp->error);
117 0 0         mXPUSHu(resp->stb);
118              
119              
120             void
121             device_trigger(Lab::VXI11 client, Device_Link lid, Device_Flags flags, u_long lock_timeout, u_long io_timeout)
122             PPCODE:
123 0           Device_GenericParms parms = {lid, flags, lock_timeout, io_timeout};
124             Device_Error *resp;
125 0           set_clnt_timeout(client, io_timeout);
126 0           resp = device_trigger_1(&parms, client);
127 0           check_resp(client, resp);
128 0 0         mXPUSHi(resp->error);
129              
130              
131             void
132             device_clear(Lab::VXI11 client, Device_Link lid, Device_Flags flags, u_long lock_timeout, u_long io_timeout)
133             PPCODE:
134 0           Device_GenericParms parms = {lid, flags, lock_timeout, io_timeout};
135             Device_Error *resp;
136 0           set_clnt_timeout(client, io_timeout);
137 0           resp = device_clear_1(&parms, client);
138 0           check_resp(client, resp);
139 0 0         mXPUSHi(resp->error);
140              
141              
142             void
143             device_remote(Lab::VXI11 client, Device_Link lid, Device_Flags flags, u_long lock_timeout, u_long io_timeout)
144             PPCODE:
145 0           Device_GenericParms parms = {lid, flags, lock_timeout, io_timeout};
146             Device_Error *resp;
147 0           set_clnt_timeout(client, io_timeout);
148 0           resp = device_remote_1(&parms, client);
149 0           check_resp(client, resp);
150 0 0         mXPUSHi(resp->error);
151              
152              
153              
154             void
155             device_local(Lab::VXI11 client, Device_Link lid, Device_Flags flags, u_long lock_timeout, u_long io_timeout)
156             PPCODE:
157 0           Device_GenericParms parms = {lid, flags, lock_timeout, io_timeout};
158             Device_Error *resp;
159 0           set_clnt_timeout(client, io_timeout);
160 0           resp = device_local_1(&parms, client);
161 0           check_resp(client, resp);
162 0 0         mXPUSHi(resp->error);
163              
164              
165              
166             void
167             device_lock(Lab::VXI11 client, Device_Link lid, Device_Flags flags, u_long lock_timeout)
168             PPCODE:
169 0           Device_LockParms parms = {lid, flags, lock_timeout};
170             Device_Error *resp;
171 0           resp = device_lock_1(&parms, client);
172 0           check_resp(client, resp);
173 0 0         mXPUSHi(resp->error);
174              
175              
176              
177             void
178             device_unlock(Lab::VXI11 client, Device_Link lid)
179             PPCODE:
180             Device_Error *resp;
181 0           resp = device_unlock_1(&lid, client);
182 0           check_resp(client, resp);
183 0 0         mXPUSHi(resp->error);
184              
185              
186              
187             void
188             device_enable_srq(Lab::VXI11 client, Device_Link lid, bool_t enable, SV *handle)
189             PPCODE:
190             const char *bytes;
191             STRLEN len;
192 0 0         bytes = SvPV(handle, len);
193 0           Device_EnableSrqParms parms = {lid, enable, {len, (char *) bytes}};
194             Device_Error *resp;
195 0           resp = device_enable_srq_1(&parms, client);
196 0           check_resp(client, resp);
197 0 0         mXPUSHi(resp->error);
198              
199              
200              
201             void
202             device_docmd(Lab::VXI11 client, Device_Link lid, Device_Flags flags, u_long io_timeout, u_long lock_timeout, long cmd, bool_t network_order, long datasize, SV *data_in)
203             PPCODE:
204             const char *bytes;
205             STRLEN len;
206 0 0         bytes = SvPV(data_in, len);
207 0           Device_DocmdParms parms = {lid, flags, io_timeout, lock_timeout, cmd, network_order, datasize, {len, (char *) bytes}};
208             Device_DocmdResp *resp;
209 0           set_clnt_timeout(client, io_timeout);
210 0           resp = device_docmd_1(&parms, client);
211 0           check_resp(client, resp);
212 0 0         mXPUSHi(resp->error);
213 0 0         mXPUSHp(resp->data_out.data_out_val, resp->data_out.data_out_len);
214              
215              
216              
217             void
218             destroy_link(Lab::VXI11 client, Device_Link lid)
219             PPCODE:
220             Device_Error *resp;
221 0           resp = destroy_link_1(&lid, client);
222 0           check_resp(client, resp);
223 0 0         mXPUSHi(resp->error);
224              
225              
226             void
227             create_intr_chan(Lab::VXI11 client, u_long hostAddr, u_short hostPort, u_long progNum, u_long progVers, Device_AddrFamily progFamily)
228             PPCODE:
229 0           Device_RemoteFunc parms = {hostAddr, hostPort, progNum, progVers, progFamily};
230             Device_Error *resp;
231 0           resp = create_intr_chan_1(&parms, client);
232 0           check_resp(client, resp);
233 0 0         mXPUSHi(resp->error);
234              
235              
236             void
237             destroy_intr_chan(Lab::VXI11 client);
238             PPCODE:
239             Device_Error *resp;
240 0           resp = destroy_intr_chan_1(NULL, client);
241 0           check_resp(client, resp);
242 0 0         mXPUSHi(resp->error);