diff options
author | daniel <danieruru@gmail.com> | 2013-01-05 16:30:05 +0900 |
---|---|---|
committer | daniel <danieruru@gmail.com> | 2013-01-05 16:30:05 +0900 |
commit | c70c87d3865c9e591b08c2d49cccbc776a136fab (patch) | |
tree | be4b67b462d4238a94d09399855011390d2fc273 | |
parent | 42d30a78def5b5a0f48ce47f0e8cd77eaf8a2452 (diff) |
add a work in progress "vxi-11 client library" and test client.. this will become the perl module later
-rw-r--r-- | libvxi11client/Makefile | 21 | ||||
-rw-r--r-- | libvxi11client/client.c | 18 | ||||
-rw-r--r-- | libvxi11client/libvxi11client.c | 128 | ||||
-rw-r--r-- | libvxi11client/libvxi11client.h | 13 | ||||
-rw-r--r-- | libvxi11client/vxi11.h | 342 | ||||
-rw-r--r-- | libvxi11client/vxi11_clnt.c | 265 | ||||
-rw-r--r-- | libvxi11client/vxi11_xdr.c | 462 |
7 files changed, 1249 insertions, 0 deletions
diff --git a/libvxi11client/Makefile b/libvxi11client/Makefile new file mode 100644 index 0000000..2e3f129 --- /dev/null +++ b/libvxi11client/Makefile @@ -0,0 +1,21 @@ +all: client + +client: libvxi11client.o vxi11_clnt.o vxi11_xdr.o client.o + $(CC) -o $@ $^ + +client.o: client.c + $(CC) -c $^ + +libvxi11client.o: libvxi11client.c libvxi11client.h + $(CC) -c $< + +vxi11_clnt.o: vxi11_clnt.c + $(CC) -c $< + +vxi11_xdr.o: vxi11_xdr.c + $(CC) -c $^ + +.PHONY: clean perl + +clean: + -rm *.o client diff --git a/libvxi11client/client.c b/libvxi11client/client.c new file mode 100644 index 0000000..e25c037 --- /dev/null +++ b/libvxi11client/client.c @@ -0,0 +1,18 @@ +#include "vxi11.h" +#include <stdio.h> + +int main() { + printf("VXI-11 test client\n"); + CLIENT* clnt; + vxi11_open("192.168.2.250"); + vxi11_write(); + vxi11_read(); + vxi11_trigger(); + vxi11_clear(); + vxi11_abort(); + vxi11_lock(); + vxi11_unlock(); + vxi11_remote(); + vxi11_local(); + vxi11_close(); +} diff --git a/libvxi11client/libvxi11client.c b/libvxi11client/libvxi11client.c new file mode 100644 index 0000000..bfe56fa --- /dev/null +++ b/libvxi11client/libvxi11client.c @@ -0,0 +1,128 @@ +#include "vxi11.h" + +#define VXI11_DEFAULT_TIMEOUT 1000 + +static CLIENT* clnt = NULL; +static Device_Link link; + +void vxi11_open(char* address, char* device) { + clnt = clnt_create(address, DEVICE_CORE, DEVICE_CORE_VERSION, "tcp"); + if (clnt == NULL) { + printf("error creating client\n"); + } + else { + Create_LinkParms link_parms; + link_parms.clientId = (long) clnt; + link_parms.lockDevice = 0; + link_parms.lock_timeout = VXI11_DEFAULT_TIMEOUT; + link_parms.device = device; + + Create_LinkResp* linkresp = create_link_1(&link_parms, clnt); + link = linkresp->lid; + } +} + +void vxi11_readstatusbyte() { + +} + +void vxi11_write() { + if (clnt == NULL) { + return; + } + + char* IDENTIFY = "*IDN?"; + + Device_WriteParms + params = {.lid = link, .io_timeout = VXI11_DEFAULT_TIMEOUT, .lock_timeout = VXI11_DEFAULT_TIMEOUT, .flags = 0x0}; + params.data.data_len = sizeof(IDENTIFY); + params.data.data_val = IDENTIFY; + + Device_WriteResp* resp = device_write_1(¶ms, clnt); +} + +void vxi11_read() { + if (clnt == NULL) { + return; + } + + Device_ReadParms + params = {.lid = link, .requestSize = 256, .io_timeout = VXI11_DEFAULT_TIMEOUT, .lock_timeout = VXI11_DEFAULT_TIMEOUT, .flags = 0x0, .termChar = 0x0}; + + Device_ReadResp* resp = device_read_1(¶ms, clnt); +} + +void vxi11_docmd() { + +} + +void vxi11_trigger() { + if (clnt == NULL) + return; + + Device_GenericParms + params = {.lid = link, .flags = 0x0, .lock_timeout = VXI11_DEFAULT_TIMEOUT, .io_timeout=VXI11_DEFAULT_TIMEOUT}; + device_trigger_1(¶ms, clnt); +} + +void vxi11_clear() { + if (clnt == NULL) + return; + Device_GenericParms + params = {.lid = link, .flags = 0x0, .lock_timeout = VXI11_DEFAULT_TIMEOUT, .io_timeout=VXI11_DEFAULT_TIMEOUT}; + device_clear_1(¶ms, clnt); +} + +void vxi11_remote() { + if (clnt == NULL) + return; + Device_GenericParms + params = {.lid = link, .flags = 0x0, .lock_timeout = VXI11_DEFAULT_TIMEOUT, .io_timeout=VXI11_DEFAULT_TIMEOUT}; + device_remote_1(¶ms, clnt); +} + +void vxi11_local() { + if (clnt == NULL) + return; + Device_GenericParms + params = {.lid = link, .flags = 0x0, .lock_timeout = VXI11_DEFAULT_TIMEOUT, .io_timeout=VXI11_DEFAULT_TIMEOUT}; + device_local_1(¶ms, clnt); +} + +void vxi11_lock() { + if (clnt == NULL) + return; + Device_LockParms + params = {.lid = link, .flags = 0x0, .lock_timeout = VXI11_DEFAULT_TIMEOUT}; + device_lock_1(¶ms, clnt); +} + +void vxi11_unlock() { + if (clnt == NULL) + return; + device_unlock_1(&link, clnt); +} + +void vxi11_create_intr_chan() { + if (clnt == NULL) + return; + +} + +void vxi11_destroy_intr_chan() { + if (clnt == NULL) + return; + +} + +void vxi11_abort() { + if (clnt == NULL) + return; + device_abort_1(&link, clnt); +} + +void vxi11_close() { + destroy_link_1(&link, clnt); + clnt_destroy(clnt); + clnt = NULL; +} diff --git a/libvxi11client/libvxi11client.h b/libvxi11client/libvxi11client.h new file mode 100644 index 0000000..bf951dd --- /dev/null +++ b/libvxi11client/libvxi11client.h @@ -0,0 +1,13 @@ +#include "vxi11.h" +void vxi11_open(char* address, char* device); +void vxi11_abort(); +void vxi11_trigger(); +void vxi11_clear(); +void vxi11_write(); +void vxi11_read(); +void vxi11_lock(); +void vxi11_unlock(); +void vxi11_local(); +void vxi11_remote(); +void vxi11_close(); + diff --git a/libvxi11client/vxi11.h b/libvxi11client/vxi11.h new file mode 100644 index 0000000..c21d661 --- /dev/null +++ b/libvxi11client/vxi11.h @@ -0,0 +1,342 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _VXI11_H_RPCGEN +#define _VXI11_H_RPCGEN + +#include <rpc/rpc.h> + + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef long Device_Link; + +enum Device_AddrFamily { + DEVICE_TCP = 0, + DEVICE_UDP = 1, +}; +typedef enum Device_AddrFamily Device_AddrFamily; + +typedef long Device_Flags; + +typedef long Device_ErrorCode; + +struct Device_Error { + Device_ErrorCode error; +}; +typedef struct Device_Error Device_Error; + +struct Create_LinkParms { + long clientId; + bool_t lockDevice; + u_long lock_timeout; + char *device; +}; +typedef struct Create_LinkParms Create_LinkParms; + +struct Create_LinkResp { + Device_ErrorCode error; + Device_Link lid; + u_short abortPort; + u_long maxRecvSize; +}; +typedef struct Create_LinkResp Create_LinkResp; + +struct Device_WriteParms { + Device_Link lid; + u_long io_timeout; + u_long lock_timeout; + Device_Flags flags; + struct { + u_int data_len; + char *data_val; + } data; +}; +typedef struct Device_WriteParms Device_WriteParms; + +struct Device_WriteResp { + Device_ErrorCode error; + u_long size; +}; +typedef struct Device_WriteResp Device_WriteResp; + +struct Device_ReadParms { + Device_Link lid; + u_long requestSize; + u_long io_timeout; + u_long lock_timeout; + Device_Flags flags; + char termChar; +}; +typedef struct Device_ReadParms Device_ReadParms; + +struct Device_ReadResp { + Device_ErrorCode error; + long reason; + struct { + u_int data_len; + char *data_val; + } data; +}; +typedef struct Device_ReadResp Device_ReadResp; + +struct Device_ReadStbResp { + Device_ErrorCode error; + u_char stb; +}; +typedef struct Device_ReadStbResp Device_ReadStbResp; + +struct Device_GenericParms { + Device_Link lid; + Device_Flags flags; + u_long lock_timeout; + u_long io_timeout; +}; +typedef struct Device_GenericParms Device_GenericParms; + +struct Device_RemoteFunc { + u_long hostAddr; + u_long hostPort; + u_long progNum; + u_long progVers; + Device_AddrFamily progFamily; +}; +typedef struct Device_RemoteFunc Device_RemoteFunc; + +struct Device_EnableSrqParms { + Device_Link lid; + bool_t enable; + struct { + u_int handle_len; + char *handle_val; + } handle; +}; +typedef struct Device_EnableSrqParms Device_EnableSrqParms; + +struct Device_LockParms { + Device_Link lid; + Device_Flags flags; + u_long lock_timeout; +}; +typedef struct Device_LockParms Device_LockParms; + +struct Device_DocmdParms { + Device_Link lid; + Device_Flags flags; + u_long io_timeout; + u_long lock_timeout; + long cmd; + bool_t network_order; + long datasize; + struct { + u_int data_in_len; + char *data_in_val; + } data_in; +}; +typedef struct Device_DocmdParms Device_DocmdParms; + +struct Device_DocmdResp { + Device_ErrorCode error; + struct { + u_int data_out_len; + char *data_out_val; + } data_out; +}; +typedef struct Device_DocmdResp Device_DocmdResp; + +struct Device_SrqParms { + struct { + u_int handle_len; + char *handle_val; + } handle; +}; +typedef struct Device_SrqParms Device_SrqParms; + +#define DEVICE_ASYNC 0x0607B0 +#define DEVICE_ASYNC_VERSION 1 + +#if defined(__STDC__) || defined(__cplusplus) +#define device_abort 1 +extern Device_Error * device_abort_1(Device_Link *, CLIENT *); +extern Device_Error * device_abort_1_svc(Device_Link *, struct svc_req *); +extern int device_async_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* K&R C */ +#define device_abort 1 +extern Device_Error * device_abort_1(); +extern Device_Error * device_abort_1_svc(); +extern int device_async_1_freeresult (); +#endif /* K&R C */ + +#define DEVICE_CORE 0x0607AF +#define DEVICE_CORE_VERSION 1 + +#if defined(__STDC__) || defined(__cplusplus) +#define create_link 10 +extern Create_LinkResp * create_link_1(Create_LinkParms *, CLIENT *); +extern Create_LinkResp * create_link_1_svc(Create_LinkParms *, struct svc_req *); +#define device_write 11 +extern Device_WriteResp * device_write_1(Device_WriteParms *, CLIENT *); +extern Device_WriteResp * device_write_1_svc(Device_WriteParms *, struct svc_req *); +#define device_read 12 +extern Device_ReadResp * device_read_1(Device_ReadParms *, CLIENT *); +extern Device_ReadResp * device_read_1_svc(Device_ReadParms *, struct svc_req *); +#define device_readstb 13 +extern Device_ReadStbResp * device_readstb_1(Device_GenericParms *, CLIENT *); +extern Device_ReadStbResp * device_readstb_1_svc(Device_GenericParms *, struct svc_req *); +#define device_trigger 14 +extern Device_Error * device_trigger_1(Device_GenericParms *, CLIENT *); +extern Device_Error * device_trigger_1_svc(Device_GenericParms *, struct svc_req *); +#define device_clear 15 +extern Device_Error * device_clear_1(Device_GenericParms *, CLIENT *); +extern Device_Error * device_clear_1_svc(Device_GenericParms *, struct svc_req *); +#define device_remote 16 +extern Device_Error * device_remote_1(Device_GenericParms *, CLIENT *); +extern Device_Error * device_remote_1_svc(Device_GenericParms *, struct svc_req *); +#define device_local 17 +extern Device_Error * device_local_1(Device_GenericParms *, CLIENT *); +extern Device_Error * device_local_1_svc(Device_GenericParms *, struct svc_req *); +#define device_lock 18 +extern Device_Error * device_lock_1(Device_LockParms *, CLIENT *); +extern Device_Error * device_lock_1_svc(Device_LockParms *, struct svc_req *); +#define device_unlock 19 +extern Device_Error * device_unlock_1(Device_Link *, CLIENT *); +extern Device_Error * device_unlock_1_svc(Device_Link *, struct svc_req *); +#define device_enable_srq 20 +extern Device_Error * device_enable_srq_1(Device_EnableSrqParms *, CLIENT *); +extern Device_Error * device_enable_srq_1_svc(Device_EnableSrqParms *, struct svc_req *); +#define device_docmd 22 +extern Device_DocmdResp * device_docmd_1(Device_DocmdParms *, CLIENT *); +extern Device_DocmdResp * device_docmd_1_svc(Device_DocmdParms *, struct svc_req *); +#define destroy_link 23 +extern Device_Error * destroy_link_1(Device_Link *, CLIENT *); +extern Device_Error * destroy_link_1_svc(Device_Link *, struct svc_req *); +#define create_intr_chan 25 +extern Device_Error * create_intr_chan_1(Device_RemoteFunc *, CLIENT *); +extern Device_Error * create_intr_chan_1_svc(Device_RemoteFunc *, struct svc_req *); +#define destroy_intr_chan 26 +extern Device_Error * destroy_intr_chan_1(void *, CLIENT *); +extern Device_Error * destroy_intr_chan_1_svc(void *, struct svc_req *); +extern int device_core_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* K&R C */ +#define create_link 10 +extern Create_LinkResp * create_link_1(); +extern Create_LinkResp * create_link_1_svc(); +#define device_write 11 +extern Device_WriteResp * device_write_1(); +extern Device_WriteResp * device_write_1_svc(); +#define device_read 12 +extern Device_ReadResp * device_read_1(); +extern Device_ReadResp * device_read_1_svc(); +#define device_readstb 13 +extern Device_ReadStbResp * device_readstb_1(); +extern Device_ReadStbResp * device_readstb_1_svc(); +#define device_trigger 14 +extern Device_Error * device_trigger_1(); +extern Device_Error * device_trigger_1_svc(); +#define device_clear 15 +extern Device_Error * device_clear_1(); +extern Device_Error * device_clear_1_svc(); +#define device_remote 16 +extern Device_Error * device_remote_1(); +extern Device_Error * device_remote_1_svc(); +#define device_local 17 +extern Device_Error * device_local_1(); +extern Device_Error * device_local_1_svc(); +#define device_lock 18 +extern Device_Error * device_lock_1(); +extern Device_Error * device_lock_1_svc(); +#define device_unlock 19 +extern Device_Error * device_unlock_1(); +extern Device_Error * device_unlock_1_svc(); +#define device_enable_srq 20 +extern Device_Error * device_enable_srq_1(); +extern Device_Error * device_enable_srq_1_svc(); +#define device_docmd 22 +extern Device_DocmdResp * device_docmd_1(); +extern Device_DocmdResp * device_docmd_1_svc(); +#define destroy_link 23 +extern Device_Error * destroy_link_1(); +extern Device_Error * destroy_link_1_svc(); +#define create_intr_chan 25 +extern Device_Error * create_intr_chan_1(); +extern Device_Error * create_intr_chan_1_svc(); +#define destroy_intr_chan 26 +extern Device_Error * destroy_intr_chan_1(); +extern Device_Error * destroy_intr_chan_1_svc(); +extern int device_core_1_freeresult (); +#endif /* K&R C */ + +#define DEVICE_INTR 0x0607B1 +#define DEVICE_INTR_VERSION 1 + +#if defined(__STDC__) || defined(__cplusplus) +#define device_intr_srq 30 +extern void * device_intr_srq_1(Device_SrqParms *, CLIENT *); +extern void * device_intr_srq_1_svc(Device_SrqParms *, struct svc_req *); +extern int device_intr_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t); + +#else /* K&R C */ +#define device_intr_srq 30 +extern void * device_intr_srq_1(); +extern void * device_intr_srq_1_svc(); +extern int device_intr_1_freeresult (); +#endif /* K&R C */ + +/* the xdr functions */ + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t xdr_Device_Link (XDR *, Device_Link*); +extern bool_t xdr_Device_AddrFamily (XDR *, Device_AddrFamily*); +extern bool_t xdr_Device_Flags (XDR *, Device_Flags*); +extern bool_t xdr_Device_ErrorCode (XDR *, Device_ErrorCode*); +extern bool_t xdr_Device_Error (XDR *, Device_Error*); +extern bool_t xdr_Create_LinkParms (XDR *, Create_LinkParms*); +extern bool_t xdr_Create_LinkResp (XDR *, Create_LinkResp*); +extern bool_t xdr_Device_WriteParms (XDR *, Device_WriteParms*); +extern bool_t xdr_Device_WriteResp (XDR *, Device_WriteResp*); +extern bool_t xdr_Device_ReadParms (XDR *, Device_ReadParms*); +extern bool_t xdr_Device_ReadResp (XDR *, Device_ReadResp*); +extern bool_t xdr_Device_ReadStbResp (XDR *, Device_ReadStbResp*); +extern bool_t xdr_Device_GenericParms (XDR *, Device_GenericParms*); +extern bool_t xdr_Device_RemoteFunc (XDR *, Device_RemoteFunc*); +extern bool_t xdr_Device_EnableSrqParms (XDR *, Device_EnableSrqParms*); +extern bool_t xdr_Device_LockParms (XDR *, Device_LockParms*); +extern bool_t xdr_Device_DocmdParms (XDR *, Device_DocmdParms*); +extern bool_t xdr_Device_DocmdResp (XDR *, Device_DocmdResp*); +extern bool_t xdr_Device_SrqParms (XDR *, Device_SrqParms*); + +#else /* K&R C */ +extern bool_t xdr_Device_Link (); +extern bool_t xdr_Device_AddrFamily (); +extern bool_t xdr_Device_Flags (); +extern bool_t xdr_Device_ErrorCode (); +extern bool_t xdr_Device_Error (); +extern bool_t xdr_Create_LinkParms (); +extern bool_t xdr_Create_LinkResp (); +extern bool_t xdr_Device_WriteParms (); +extern bool_t xdr_Device_WriteResp (); +extern bool_t xdr_Device_ReadParms (); +extern bool_t xdr_Device_ReadResp (); +extern bool_t xdr_Device_ReadStbResp (); +extern bool_t xdr_Device_GenericParms (); +extern bool_t xdr_Device_RemoteFunc (); +extern bool_t xdr_Device_EnableSrqParms (); +extern bool_t xdr_Device_LockParms (); +extern bool_t xdr_Device_DocmdParms (); +extern bool_t xdr_Device_DocmdResp (); +extern bool_t xdr_Device_SrqParms (); + +#endif /* K&R C */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_VXI11_H_RPCGEN */ diff --git a/libvxi11client/vxi11_clnt.c b/libvxi11client/vxi11_clnt.c new file mode 100644 index 0000000..d8f339a --- /dev/null +++ b/libvxi11client/vxi11_clnt.c @@ -0,0 +1,265 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include <memory.h> /* for memset */ +#include "vxi11.h" + +/* Default timeout can be changed using clnt_control() */ +static struct timeval TIMEOUT = { 25, 0 }; + +Device_Error * +device_abort_1(Device_Link *argp, CLIENT *clnt) +{ + static Device_Error clnt_res; + + memset((char *)&clnt_res, 0, sizeof(clnt_res)); + if (clnt_call (clnt, device_abort, + (xdrproc_t) xdr_Device_Link, (caddr_t) argp, + (xdrproc_t) xdr_Device_Error, (caddr_t) &clnt_res, + TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&clnt_res); +} + +Create_LinkResp * +create_link_1(Create_LinkParms *argp, CLIENT *clnt) +{ + static Create_LinkResp clnt_res; + + memset((char *)&clnt_res, 0, sizeof(clnt_res)); + if (clnt_call (clnt, create_link, + (xdrproc_t) xdr_Create_LinkParms, (caddr_t) argp, + (xdrproc_t) xdr_Create_LinkResp, (caddr_t) &clnt_res, + TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&clnt_res); +} + +Device_WriteResp * +device_write_1(Device_WriteParms *argp, CLIENT *clnt) +{ + static Device_WriteResp clnt_res; + + memset((char *)&clnt_res, 0, sizeof(clnt_res)); + if (clnt_call (clnt, device_write, + (xdrproc_t) xdr_Device_WriteParms, (caddr_t) argp, + (xdrproc_t) xdr_Device_WriteResp, (caddr_t) &clnt_res, + TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&clnt_res); +} + +Device_ReadResp * +device_read_1(Device_ReadParms *argp, CLIENT *clnt) +{ + static Device_ReadResp clnt_res; + + memset((char *)&clnt_res, 0, sizeof(clnt_res)); + if (clnt_call (clnt, device_read, + (xdrproc_t) xdr_Device_ReadParms, (caddr_t) argp, + (xdrproc_t) xdr_Device_ReadResp, (caddr_t) &clnt_res, + TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&clnt_res); +} + +Device_ReadStbResp * +device_readstb_1(Device_GenericParms *argp, CLIENT *clnt) +{ + static Device_ReadStbResp clnt_res; + + memset((char *)&clnt_res, 0, sizeof(clnt_res)); + if (clnt_call (clnt, device_readstb, + (xdrproc_t) xdr_Device_GenericParms, (caddr_t) argp, + (xdrproc_t) xdr_Device_ReadStbResp, (caddr_t) &clnt_res, + TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&clnt_res); +} + +Device_Error * +device_trigger_1(Device_GenericParms *argp, CLIENT *clnt) +{ + static Device_Error clnt_res; + + memset((char *)&clnt_res, 0, sizeof(clnt_res)); + if (clnt_call (clnt, device_trigger, + (xdrproc_t) xdr_Device_GenericParms, (caddr_t) argp, + (xdrproc_t) xdr_Device_Error, (caddr_t) &clnt_res, + TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&clnt_res); +} + +Device_Error * +device_clear_1(Device_GenericParms *argp, CLIENT *clnt) +{ + static Device_Error clnt_res; + + memset((char *)&clnt_res, 0, sizeof(clnt_res)); + if (clnt_call (clnt, device_clear, + (xdrproc_t) xdr_Device_GenericParms, (caddr_t) argp, + (xdrproc_t) xdr_Device_Error, (caddr_t) &clnt_res, + TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&clnt_res); +} + +Device_Error * +device_remote_1(Device_GenericParms *argp, CLIENT *clnt) +{ + static Device_Error clnt_res; + + memset((char *)&clnt_res, 0, sizeof(clnt_res)); + if (clnt_call (clnt, device_remote, + (xdrproc_t) xdr_Device_GenericParms, (caddr_t) argp, + (xdrproc_t) xdr_Device_Error, (caddr_t) &clnt_res, + TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&clnt_res); +} + +Device_Error * +device_local_1(Device_GenericParms *argp, CLIENT *clnt) +{ + static Device_Error clnt_res; + + memset((char *)&clnt_res, 0, sizeof(clnt_res)); + if (clnt_call (clnt, device_local, + (xdrproc_t) xdr_Device_GenericParms, (caddr_t) argp, + (xdrproc_t) xdr_Device_Error, (caddr_t) &clnt_res, + TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&clnt_res); +} + +Device_Error * +device_lock_1(Device_LockParms *argp, CLIENT *clnt) +{ + static Device_Error clnt_res; + + memset((char *)&clnt_res, 0, sizeof(clnt_res)); + if (clnt_call (clnt, device_lock, + (xdrproc_t) xdr_Device_LockParms, (caddr_t) argp, + (xdrproc_t) xdr_Device_Error, (caddr_t) &clnt_res, + TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&clnt_res); +} + +Device_Error * +device_unlock_1(Device_Link *argp, CLIENT *clnt) +{ + static Device_Error clnt_res; + + memset((char *)&clnt_res, 0, sizeof(clnt_res)); + if (clnt_call (clnt, device_unlock, + (xdrproc_t) xdr_Device_Link, (caddr_t) argp, + (xdrproc_t) xdr_Device_Error, (caddr_t) &clnt_res, + TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&clnt_res); +} + +Device_Error * +device_enable_srq_1(Device_EnableSrqParms *argp, CLIENT *clnt) +{ + static Device_Error clnt_res; + + memset((char *)&clnt_res, 0, sizeof(clnt_res)); + if (clnt_call (clnt, device_enable_srq, + (xdrproc_t) xdr_Device_EnableSrqParms, (caddr_t) argp, + (xdrproc_t) xdr_Device_Error, (caddr_t) &clnt_res, + TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&clnt_res); +} + +Device_DocmdResp * +device_docmd_1(Device_DocmdParms *argp, CLIENT *clnt) +{ + static Device_DocmdResp clnt_res; + + memset((char *)&clnt_res, 0, sizeof(clnt_res)); + if (clnt_call (clnt, device_docmd, + (xdrproc_t) xdr_Device_DocmdParms, (caddr_t) argp, + (xdrproc_t) xdr_Device_DocmdResp, (caddr_t) &clnt_res, + TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&clnt_res); +} + +Device_Error * +destroy_link_1(Device_Link *argp, CLIENT *clnt) +{ + static Device_Error clnt_res; + + memset((char *)&clnt_res, 0, sizeof(clnt_res)); + if (clnt_call (clnt, destroy_link, + (xdrproc_t) xdr_Device_Link, (caddr_t) argp, + (xdrproc_t) xdr_Device_Error, (caddr_t) &clnt_res, + TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&clnt_res); +} + +Device_Error * +create_intr_chan_1(Device_RemoteFunc *argp, CLIENT *clnt) +{ + static Device_Error clnt_res; + + memset((char *)&clnt_res, 0, sizeof(clnt_res)); + if (clnt_call (clnt, create_intr_chan, + (xdrproc_t) xdr_Device_RemoteFunc, (caddr_t) argp, + (xdrproc_t) xdr_Device_Error, (caddr_t) &clnt_res, + TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&clnt_res); +} + +Device_Error * +destroy_intr_chan_1(void *argp, CLIENT *clnt) +{ + static Device_Error clnt_res; + + memset((char *)&clnt_res, 0, sizeof(clnt_res)); + if (clnt_call (clnt, destroy_intr_chan, + (xdrproc_t) xdr_void, (caddr_t) argp, + (xdrproc_t) xdr_Device_Error, (caddr_t) &clnt_res, + TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return (&clnt_res); +} + +void * +device_intr_srq_1(Device_SrqParms *argp, CLIENT *clnt) +{ + static char clnt_res; + + memset((char *)&clnt_res, 0, sizeof(clnt_res)); + if (clnt_call (clnt, device_intr_srq, + (xdrproc_t) xdr_Device_SrqParms, (caddr_t) argp, + (xdrproc_t) xdr_void, (caddr_t) &clnt_res, + TIMEOUT) != RPC_SUCCESS) { + return (NULL); + } + return ((void *)&clnt_res); +} diff --git a/libvxi11client/vxi11_xdr.c b/libvxi11client/vxi11_xdr.c new file mode 100644 index 0000000..29d9371 --- /dev/null +++ b/libvxi11client/vxi11_xdr.c @@ -0,0 +1,462 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include "vxi11.h" + +bool_t +xdr_Device_Link (XDR *xdrs, Device_Link *objp) +{ + register int32_t *buf; + + if (!xdr_long (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_Device_AddrFamily (XDR *xdrs, Device_AddrFamily *objp) +{ + register int32_t *buf; + + if (!xdr_enum (xdrs, (enum_t *) objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_Device_Flags (XDR *xdrs, Device_Flags *objp) +{ + register int32_t *buf; + + if (!xdr_long (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_Device_ErrorCode (XDR *xdrs, Device_ErrorCode *objp) +{ + register int32_t *buf; + + if (!xdr_long (xdrs, objp)) + return FALSE; + return TRUE; +} + +bool_t +xdr_Device_Error (XDR *xdrs, Device_Error *objp) +{ + register int32_t *buf; + + if (!xdr_Device_ErrorCode (xdrs, &objp->error)) + return FALSE; + return TRUE; +} + +bool_t +xdr_Create_LinkParms (XDR *xdrs, Create_LinkParms *objp) +{ + register int32_t *buf; + + + if (xdrs->x_op == XDR_ENCODE) { + buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT); + if (buf == NULL) { + if (!xdr_long (xdrs, &objp->clientId)) + return FALSE; + if (!xdr_bool (xdrs, &objp->lockDevice)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->lock_timeout)) + return FALSE; + + } else { + IXDR_PUT_LONG(buf, objp->clientId); + IXDR_PUT_BOOL(buf, objp->lockDevice); + IXDR_PUT_U_LONG(buf, objp->lock_timeout); + } + if (!xdr_string (xdrs, &objp->device, ~0)) + return FALSE; + return TRUE; + } else if (xdrs->x_op == XDR_DECODE) { + buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT); + if (buf == NULL) { + if (!xdr_long (xdrs, &objp->clientId)) + return FALSE; + if (!xdr_bool (xdrs, &objp->lockDevice)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->lock_timeout)) + return FALSE; + + } else { + objp->clientId = IXDR_GET_LONG(buf); + objp->lockDevice = IXDR_GET_BOOL(buf); + objp->lock_timeout = IXDR_GET_U_LONG(buf); + } + if (!xdr_string (xdrs, &objp->device, ~0)) + return FALSE; + return TRUE; + } + + if (!xdr_long (xdrs, &objp->clientId)) + return FALSE; + if (!xdr_bool (xdrs, &objp->lockDevice)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->lock_timeout)) + return FALSE; + if (!xdr_string (xdrs, &objp->device, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_Create_LinkResp (XDR *xdrs, Create_LinkResp *objp) +{ + register int32_t *buf; + + if (!xdr_Device_ErrorCode (xdrs, &objp->error)) + return FALSE; + if (!xdr_Device_Link (xdrs, &objp->lid)) + return FALSE; + if (!xdr_u_short (xdrs, &objp->abortPort)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->maxRecvSize)) + return FALSE; + return TRUE; +} + +bool_t +xdr_Device_WriteParms (XDR *xdrs, Device_WriteParms *objp) +{ + register int32_t *buf; + + if (!xdr_Device_Link (xdrs, &objp->lid)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->io_timeout)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->lock_timeout)) + return FALSE; + if (!xdr_Device_Flags (xdrs, &objp->flags)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_Device_WriteResp (XDR *xdrs, Device_WriteResp *objp) +{ + register int32_t *buf; + + if (!xdr_Device_ErrorCode (xdrs, &objp->error)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->size)) + return FALSE; + return TRUE; +} + +bool_t +xdr_Device_ReadParms (XDR *xdrs, Device_ReadParms *objp) +{ + register int32_t *buf; + + + if (xdrs->x_op == XDR_ENCODE) { + if (!xdr_Device_Link (xdrs, &objp->lid)) + return FALSE; + buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT); + if (buf == NULL) { + if (!xdr_u_long (xdrs, &objp->requestSize)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->io_timeout)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->lock_timeout)) + return FALSE; + + } else { + IXDR_PUT_U_LONG(buf, objp->requestSize); + IXDR_PUT_U_LONG(buf, objp->io_timeout); + IXDR_PUT_U_LONG(buf, objp->lock_timeout); + } + if (!xdr_Device_Flags (xdrs, &objp->flags)) + return FALSE; + if (!xdr_char (xdrs, &objp->termChar)) + return FALSE; + return TRUE; + } else if (xdrs->x_op == XDR_DECODE) { + if (!xdr_Device_Link (xdrs, &objp->lid)) + return FALSE; + buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT); + if (buf == NULL) { + if (!xdr_u_long (xdrs, &objp->requestSize)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->io_timeout)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->lock_timeout)) + return FALSE; + + } else { + objp->requestSize = IXDR_GET_U_LONG(buf); + objp->io_timeout = IXDR_GET_U_LONG(buf); + objp->lock_timeout = IXDR_GET_U_LONG(buf); + } + if (!xdr_Device_Flags (xdrs, &objp->flags)) + return FALSE; + if (!xdr_char (xdrs, &objp->termChar)) + return FALSE; + return TRUE; + } + + if (!xdr_Device_Link (xdrs, &objp->lid)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->requestSize)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->io_timeout)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->lock_timeout)) + return FALSE; + if (!xdr_Device_Flags (xdrs, &objp->flags)) + return FALSE; + if (!xdr_char (xdrs, &objp->termChar)) + return FALSE; + return TRUE; +} + +bool_t +xdr_Device_ReadResp (XDR *xdrs, Device_ReadResp *objp) +{ + register int32_t *buf; + + if (!xdr_Device_ErrorCode (xdrs, &objp->error)) + return FALSE; + if (!xdr_long (xdrs, &objp->reason)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->data.data_val, (u_int *) &objp->data.data_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_Device_ReadStbResp (XDR *xdrs, Device_ReadStbResp *objp) +{ + register int32_t *buf; + + if (!xdr_Device_ErrorCode (xdrs, &objp->error)) + return FALSE; + if (!xdr_u_char (xdrs, &objp->stb)) + return FALSE; + return TRUE; +} + +bool_t +xdr_Device_GenericParms (XDR *xdrs, Device_GenericParms *objp) +{ + register int32_t *buf; + + if (!xdr_Device_Link (xdrs, &objp->lid)) + return FALSE; + if (!xdr_Device_Flags (xdrs, &objp->flags)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->lock_timeout)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->io_timeout)) + return FALSE; + return TRUE; +} + +bool_t +xdr_Device_RemoteFunc (XDR *xdrs, Device_RemoteFunc *objp) +{ + register int32_t *buf; + + + if (xdrs->x_op == XDR_ENCODE) { + buf = XDR_INLINE (xdrs, 4 * BYTES_PER_XDR_UNIT); + if (buf == NULL) { + if (!xdr_u_long (xdrs, &objp->hostAddr)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->hostPort)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->progNum)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->progVers)) + return FALSE; + + } else { + IXDR_PUT_U_LONG(buf, objp->hostAddr); + IXDR_PUT_U_LONG(buf, objp->hostPort); + IXDR_PUT_U_LONG(buf, objp->progNum); + IXDR_PUT_U_LONG(buf, objp->progVers); + } + if (!xdr_Device_AddrFamily (xdrs, &objp->progFamily)) + return FALSE; + return TRUE; + } else if (xdrs->x_op == XDR_DECODE) { + buf = XDR_INLINE (xdrs, 4 * BYTES_PER_XDR_UNIT); + if (buf == NULL) { + if (!xdr_u_long (xdrs, &objp->hostAddr)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->hostPort)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->progNum)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->progVers)) + return FALSE; + + } else { + objp->hostAddr = IXDR_GET_U_LONG(buf); + objp->hostPort = IXDR_GET_U_LONG(buf); + objp->progNum = IXDR_GET_U_LONG(buf); + objp->progVers = IXDR_GET_U_LONG(buf); + } + if (!xdr_Device_AddrFamily (xdrs, &objp->progFamily)) + return FALSE; + return TRUE; + } + + if (!xdr_u_long (xdrs, &objp->hostAddr)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->hostPort)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->progNum)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->progVers)) + return FALSE; + if (!xdr_Device_AddrFamily (xdrs, &objp->progFamily)) + return FALSE; + return TRUE; +} + +bool_t +xdr_Device_EnableSrqParms (XDR *xdrs, Device_EnableSrqParms *objp) +{ + register int32_t *buf; + + if (!xdr_Device_Link (xdrs, &objp->lid)) + return FALSE; + if (!xdr_bool (xdrs, &objp->enable)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->handle.handle_val, (u_int *) &objp->handle.handle_len, 40)) + return FALSE; + return TRUE; +} + +bool_t +xdr_Device_LockParms (XDR *xdrs, Device_LockParms *objp) +{ + register int32_t *buf; + + if (!xdr_Device_Link (xdrs, &objp->lid)) + return FALSE; + if (!xdr_Device_Flags (xdrs, &objp->flags)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->lock_timeout)) + return FALSE; + return TRUE; +} + +bool_t +xdr_Device_DocmdParms (XDR *xdrs, Device_DocmdParms *objp) +{ + register int32_t *buf; + + + if (xdrs->x_op == XDR_ENCODE) { + if (!xdr_Device_Link (xdrs, &objp->lid)) + return FALSE; + if (!xdr_Device_Flags (xdrs, &objp->flags)) + return FALSE; + buf = XDR_INLINE (xdrs, 5 * BYTES_PER_XDR_UNIT); + if (buf == NULL) { + if (!xdr_u_long (xdrs, &objp->io_timeout)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->lock_timeout)) + return FALSE; + if (!xdr_long (xdrs, &objp->cmd)) + return FALSE; + if (!xdr_bool (xdrs, &objp->network_order)) + return FALSE; + if (!xdr_long (xdrs, &objp->datasize)) + return FALSE; + + } else { + IXDR_PUT_U_LONG(buf, objp->io_timeout); + IXDR_PUT_U_LONG(buf, objp->lock_timeout); + IXDR_PUT_LONG(buf, objp->cmd); + IXDR_PUT_BOOL(buf, objp->network_order); + IXDR_PUT_LONG(buf, objp->datasize); + } + if (!xdr_bytes (xdrs, (char **)&objp->data_in.data_in_val, (u_int *) &objp->data_in.data_in_len, ~0)) + return FALSE; + return TRUE; + } else if (xdrs->x_op == XDR_DECODE) { + if (!xdr_Device_Link (xdrs, &objp->lid)) + return FALSE; + if (!xdr_Device_Flags (xdrs, &objp->flags)) + return FALSE; + buf = XDR_INLINE (xdrs, 5 * BYTES_PER_XDR_UNIT); + if (buf == NULL) { + if (!xdr_u_long (xdrs, &objp->io_timeout)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->lock_timeout)) + return FALSE; + if (!xdr_long (xdrs, &objp->cmd)) + return FALSE; + if (!xdr_bool (xdrs, &objp->network_order)) + return FALSE; + if (!xdr_long (xdrs, &objp->datasize)) + return FALSE; + + } else { + objp->io_timeout = IXDR_GET_U_LONG(buf); + objp->lock_timeout = IXDR_GET_U_LONG(buf); + objp->cmd = IXDR_GET_LONG(buf); + objp->network_order = IXDR_GET_BOOL(buf); + objp->datasize = IXDR_GET_LONG(buf); + } + if (!xdr_bytes (xdrs, (char **)&objp->data_in.data_in_val, (u_int *) &objp->data_in.data_in_len, ~0)) + return FALSE; + return TRUE; + } + + if (!xdr_Device_Link (xdrs, &objp->lid)) + return FALSE; + if (!xdr_Device_Flags (xdrs, &objp->flags)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->io_timeout)) + return FALSE; + if (!xdr_u_long (xdrs, &objp->lock_timeout)) + return FALSE; + if (!xdr_long (xdrs, &objp->cmd)) + return FALSE; + if (!xdr_bool (xdrs, &objp->network_order)) + return FALSE; + if (!xdr_long (xdrs, &objp->datasize)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->data_in.data_in_val, (u_int *) &objp->data_in.data_in_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_Device_DocmdResp (XDR *xdrs, Device_DocmdResp *objp) +{ + register int32_t *buf; + + if (!xdr_Device_ErrorCode (xdrs, &objp->error)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->data_out.data_out_val, (u_int *) &objp->data_out.data_out_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_Device_SrqParms (XDR *xdrs, Device_SrqParms *objp) +{ + register int32_t *buf; + + if (!xdr_bytes (xdrs, (char **)&objp->handle.handle_val, (u_int *) &objp->handle.handle_len, ~0)) + return FALSE; + return TRUE; +} |