summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root@avtech.domain.avtechpulse.com>1999-12-31 19:03:59 -0500
committerroot <root@avtech.domain.avtechpulse.com>1999-12-31 19:03:59 -0500
commite153488780f86cf6f647b814f8ff6f3a535a0d7e (patch)
tree456c0f07f0d973cfc92dae357cdfb03309f5efa3
parent60c5196e62175458615117aab397aaac9ccda5a1 (diff)
astyle fixes
-rw-r--r--bus.c4
-rw-r--r--device-functions.c4
-rw-r--r--flash.c21
-rw-r--r--globals.c2
-rw-r--r--globals.h28
-rw-r--r--gpib.c12
-rw-r--r--instr-daemon.c8
-rw-r--r--string_utils.c8
-rw-r--r--[l---------]vxi11.h343
-rw-r--r--[l---------]vxi11_clnt.c266
-rw-r--r--vxi11_server.c224
-rw-r--r--vxi11_svc.c217
-rw-r--r--[l---------]vxi11_xdr.c566
13 files changed, 1454 insertions, 249 deletions
diff --git a/bus.c b/bus.c
index b3ac833..bf3ef02 100644
--- a/bus.c
+++ b/bus.c
@@ -357,7 +357,7 @@ static unsigned gpio_pins[] = { GPIO0_X + 22, // i.e., GPIO0_22
GPIO1_X + 14,
GPIO0_X + 27,
GPIO1_X + 12,
- GPIO2_X + 1
+ GPIO2_X + 1
};
@@ -391,7 +391,7 @@ void bus_init()
gpio_changedirection(gpio_pins[POWER_FAIL], false);
// reset the TNT4882 chip
- bus_setpin(RST_GPIB, 0);
+ bus_setpin(RST_GPIB, 0);
g_usleep(10);
bus_setpin(RST_GPIB, 1);
g_usleep(10);
diff --git a/device-functions.c b/device-functions.c
index 203af45..a804879 100644
--- a/device-functions.c
+++ b/device-functions.c
@@ -2723,8 +2723,8 @@ int Set_VI_Control(int parameter,int channel,float new_ampl,int *point_found,int
if (max2 > max1) {
max1 = max2;
}
- if ((use_ampl * use_atten) >
- (globals.Flash.atten_percent_max_ampl[channel] * max1)) {
+ if ((use_ampl * use_atten) >
+ (globals.Flash.atten_percent_max_ampl[channel] * max1)) {
continue;
}
}
diff --git a/flash.c b/flash.c
index 1282eff..6379d3b 100644
--- a/flash.c
+++ b/flash.c
@@ -31,7 +31,7 @@
// flash writing queue bits
#define MAXQUEUEDJOBS 1 // This makes the queue a little bit pointless
- // but you might want to queue a few more
+// but you might want to queue a few more
typedef struct {
FlashStruct *mem;
@@ -347,7 +347,8 @@ void writeUserBlockNow(FlashStruct *mem, int addr, int numbytes)
g_static_mutex_unlock (&mutex);
}
-void writeUserBlock(FlashStruct *mem, int addr, int numbytes) {
+void writeUserBlock(FlashStruct *mem, int addr, int numbytes)
+{
if (alive) {
g_mutex_lock(&writermutex);
if (g_async_queue_length(userflashwritequeue) >= MAXQUEUEDJOBS) {
@@ -770,7 +771,7 @@ static void initFlashValues(FlashStruct *mem)
mem->use_high_ampl_ranges_for_high_pw_ranges[i]=0;
mem->couple_first_N_pw_ranges_to_ampl_ranges[i]=0;
- for (j=0;j<max_attens;j++) {
+ for (j=0; j<max_attens; j++) {
mem->attenuators[i][j] = 0.0;
}
@@ -817,16 +818,16 @@ static void initFlashValues(FlashStruct *mem)
}
-static gpointer userflashwritethreadfunc(gpointer data) {
+static gpointer userflashwritethreadfunc(gpointer data)
+{
//printf("userflash write thread start\n");
while (alive || g_async_queue_length(userflashwritequeue) > 0) { // make sure the last job in the queue gets written
- if (g_async_queue_length(userflashwritequeue) == 0){ // go into a sleep
+ if (g_async_queue_length(userflashwritequeue) == 0) { // go into a sleep
g_mutex_lock(&writermutex);
g_cond_wait(&writerwakeup, &writermutex);
g_mutex_unlock(&writermutex);
- }
- else {
+ } else {
userflashjob* job = (userflashjob*) g_async_queue_pop(userflashwritequeue);
if (job != NULL ) {
// process job
@@ -850,7 +851,8 @@ static gpointer userflashwritethreadfunc(gpointer data) {
return NULL ;
}
-void startFlashWriterThread(){
+void startFlashWriterThread()
+{
alive= true;
userflashwritequeue = g_async_queue_new();
userflashwritethread = g_thread_create(userflashwritethreadfunc, NULL, true, NULL);
@@ -890,7 +892,8 @@ void initFlash(FlashStruct *mem, gboolean reset_to_defaults, int starting_locati
}
}
-void stopFlashWriterThread(){
+void stopFlashWriterThread()
+{
alive = false;
g_cond_broadcast(&writerwakeup);
g_thread_join(userflashwritethread); // block until the write thread is totally finished.
diff --git a/globals.c b/globals.c
index f216697..d2a5eea 100644
--- a/globals.c
+++ b/globals.c
@@ -19,7 +19,7 @@ GlobalStruct globals = {
.Registers.pending_output_message = NULL,
.VxiLocks.locked_network_server = NO_SERVER_LOCKED,
-
+
.MenuStatus.Nonstd_Display = YES
};
diff --git a/globals.h b/globals.h
index ca50fdf..ebf7f4e 100644
--- a/globals.h
+++ b/globals.h
@@ -695,21 +695,21 @@ typedef struct {
char use_high_ampl_ranges_for_high_pw_ranges[max_channels]; /* addr 10066 - for AVMP-4 */
char couple_first_N_pw_ranges_to_ampl_ranges[max_channels]; // addr 10068
- // for example, if N = 2 (as for AVR-E3-B-R5-N-M5)
- // PG A = pw range 0, ampl range 0
- // PG B = pw range 1, ampl range 1
- // PG C = pw range 2+, ampl range 2
+ // for example, if N = 2 (as for AVR-E3-B-R5-N-M5)
+ // PG A = pw range 0, ampl range 0
+ // PG B = pw range 1, ampl range 1
+ // PG C = pw range 2+, ampl range 2
float attenuators[max_channels][max_attens]; // addr 10070
- // smallest attenuators first
- // value = magnitude of attenuation.
- // for example, for 20 dB, use 10.0
- // for 15 dB, use 5.62
- // for 10 dB, use 3.16
+ // smallest attenuators first
+ // value = magnitude of attenuation.
+ // for example, for 20 dB, use 10.0
+ // for 15 dB, use 5.62
+ // for 10 dB, use 3.16
float atten_percent_max_ampl[max_channels]; // addr 10134 - normally 0.93
- // don't use higher ampls in AVPs,
- // where PW shifts near max ampl
+ // don't use higher ampls in AVPs,
+ // where PW shifts near max ampl
char spare_end;
@@ -773,9 +773,9 @@ typedef struct {
// These flags are NOT reset by Main_Rst, and default to 0
typedef struct {
- int shutdown_started;
- int flash_write_in_progress;
- int startup_complete;
+ int shutdown_started;
+ int flash_write_in_progress;
+ int startup_complete;
} SysFlagStruct;
diff --git a/gpib.c b/gpib.c
index 46b1e14..4eeaa9b 100644
--- a/gpib.c
+++ b/gpib.c
@@ -589,9 +589,9 @@ static unsigned long int TNT_DATA_COUNT()
static void TNT_Out(int reg, unsigned int byte)
{
- if (!globals.HWDetect.gpib) {
- return;
- }
+ if (!globals.HWDetect.gpib) {
+ return;
+ }
bus_writebyte ((uint8_t) (TNT_Port + reg), (uint8_t) byte);
}
@@ -599,9 +599,9 @@ static void TNT_Out(int reg, unsigned int byte)
static unsigned char TNT_In(int reg)
{
- if (!globals.HWDetect.gpib) {
- return (unsigned char) 0;
- }
+ if (!globals.HWDetect.gpib) {
+ return (unsigned char) 0;
+ }
return (unsigned char) bus_readbyte ((uint8_t) (TNT_Port + reg));
}
diff --git a/instr-daemon.c b/instr-daemon.c
index e71b5f2..19536d3 100644
--- a/instr-daemon.c
+++ b/instr-daemon.c
@@ -190,7 +190,8 @@ handler (GThreadedSocketService *service,
extern void vxi_main ();
-static gpointer vxithreadfunc (gpointer data){
+static gpointer vxithreadfunc (gpointer data)
+{
vxi_main ();
return NULL;
}
@@ -292,8 +293,9 @@ int main(int argc, char **argv)
if (globals.Flash.vxi_enabled) {
GThread *vxithread =g_thread_create(vxithreadfunc, NULL, FALSE, NULL);
- if(vxithread == NULL)
+ if(vxithread == NULL) {
printf("Couldn't create vxi thread\n");
+ }
}
g_main_loop_run (loop);
@@ -416,7 +418,7 @@ static gboolean periodic_poll (void)
// or is currently handling a command
if ((globals.VxiLocks.locked_network_server == NO_SERVER_LOCKED) &&
- (globals.VxiLocks.command_in_progress == FALSE)) {
+ (globals.VxiLocks.command_in_progress == FALSE)) {
// tell VXI servers that the 4882 subsystem is busy
globals.VxiLocks.command_in_progress = TRUE;
diff --git a/string_utils.c b/string_utils.c
index 77765d2..7fba9bb 100644
--- a/string_utils.c
+++ b/string_utils.c
@@ -155,12 +155,12 @@ gchar* conditional_regex_replace (gboolean do_it, gchar* in_string, gchar* regex
gchar *out;
if (do_it) {
- GRegex *regex = g_regex_new (regex_string, 0, 0, NULL);
- out = g_regex_replace_literal (regex, in_string, -1, 0, replace_with, 0, NULL);
- g_regex_unref (regex);
+ GRegex *regex = g_regex_new (regex_string, 0, 0, NULL);
+ out = g_regex_replace_literal (regex, in_string, -1, 0, replace_with, 0, NULL);
+ g_regex_unref (regex);
} else {
out = g_strdup (in_string);
}
- return out;
+ return out;
}
diff --git a/vxi11.h b/vxi11.h
index 5e8fa4f..093b6ae 120000..100644
--- a/vxi11.h
+++ b/vxi11.h
@@ -1 +1,342 @@
-libvxi11client/vxi11.h \ No newline at end of file
+/*
+ * 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/vxi11_clnt.c b/vxi11_clnt.c
index 320589b..9c7e29f 120000..100644
--- a/vxi11_clnt.c
+++ b/vxi11_clnt.c
@@ -1 +1,265 @@
-libvxi11client/vxi11_clnt.c \ No newline at end of file
+/*
+ * 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/vxi11_server.c b/vxi11_server.c
index 878f4aa..c5024a7 100644
--- a/vxi11_server.c
+++ b/vxi11_server.c
@@ -56,11 +56,13 @@ static ActiveLink* links[MAX_SESSIONS] = { NULL };
static void freelink(ActiveLink* link);
-static void touchlink(int lid) {
+static void touchlink(int lid)
+{
g_get_current_time(&(links[lid]->lastactivity));
}
-static bool isValidLink(int linkid) {
+static bool isValidLink(int linkid)
+{
if (linkid > MAX_SESSIONS - 1) {
#ifdef DEBUG
printf("Crazy link id %d\n", linkid);
@@ -71,7 +73,8 @@ static bool isValidLink(int linkid) {
}
// test if a link has expired, this is to avoid dead locks
-static bool linkexpired(ActiveLink* link) {
+static bool linkexpired(ActiveLink* link)
+{
GTimeVal cutoff;
g_get_current_time(&cutoff);
g_time_val_add(&cutoff, -LINKLONGSINCEDEADTIMEOUT);
@@ -81,29 +84,33 @@ static bool linkexpired(ActiveLink* link) {
#endif
freelink(link);
return true;
- }
- else
+ } else {
return false;
+ }
}
// locking wrappers
-static void lock(int lid) {
+static void lock(int lid)
+{
globals.VxiLocks.locked_network_server = lid;
}
-static void unlock() {
+static void unlock()
+{
globals.VxiLocks.locked_network_server = NO_SERVER_LOCKED;
}
-static bool haveLock(int lid) {
+static bool haveLock(int lid)
+{
return globals.VxiLocks.locked_network_server == lid;
}
-static bool isLocked() {
- if (globals.VxiLocks.locked_network_server == NO_SERVER_LOCKED)
+static bool isLocked()
+{
+ if (globals.VxiLocks.locked_network_server == NO_SERVER_LOCKED) {
return false;
- else {
+ } else {
ActiveLink* link = links[globals.VxiLocks.locked_network_server];
return !(linkexpired(link));
}
@@ -112,15 +119,18 @@ static bool isLocked() {
#define FLAG_WAITLOCK 1
// todo
-static bool waitForLock(Device_Flags flags, long timeout) {
- if (!(flags & FLAG_WAITLOCK))
+static bool waitForLock(Device_Flags flags, long timeout)
+{
+ if (!(flags & FLAG_WAITLOCK)) {
return false;
+ }
return false;
}
//
-static void freelink(ActiveLink* link) {
+static void freelink(ActiveLink* link)
+{
links[link->lid] = NULL;
globals.Remote.vxi_connections--;
@@ -142,7 +152,8 @@ static void freelink(ActiveLink* link) {
g_free(link);
}
-void vxi11_deadsocketcallback(int socket) {
+void vxi11_deadsocketcallback(int socket)
+{
int linkid;
for (linkid = 0; linkid < SIZEOFARRAY(links); linkid++) {
if (links[linkid] != NULL ) {
@@ -156,10 +167,12 @@ void vxi11_deadsocketcallback(int socket) {
}
}
-static bool waitforio(long timeout) {
+static bool waitforio(long timeout)
+{
do {
- if (!globals.VxiLocks.command_in_progress)
+ if (!globals.VxiLocks.command_in_progress) {
return true;
+ }
usleep(250);
timeout -= 250;
} while (timeout < 0);
@@ -170,14 +183,15 @@ static bool waitforio(long timeout) {
}
Device_Error *
-device_abort_1_svc(Device_Link *argp, struct svc_req *rqstp) {
+device_abort_1_svc(Device_Link *argp, struct svc_req *rqstp)
+{
static Device_Error result;
#ifdef DEBUG
printf("device_abort_1_svc()\n");
#endif
- if (!isValidLink(*argp))
+ if (!isValidLink(*argp)) {
result.error = ERR_INVALIDLINKINDENTIFIER;
- else {
+ } else {
links[*argp]->aborted = true;
result.error = 0;
}
@@ -185,7 +199,8 @@ device_abort_1_svc(Device_Link *argp, struct svc_req *rqstp) {
}
Create_LinkResp *
-create_link_1_svc(Create_LinkParms *argp, struct svc_req *rqstp) {
+create_link_1_svc(Create_LinkParms *argp, struct svc_req *rqstp)
+{
static Create_LinkResp result;
memset(&result, 0, sizeof(result));
#ifdef DEBUG
@@ -193,20 +208,18 @@ create_link_1_svc(Create_LinkParms *argp, struct svc_req *rqstp) {
#endif
if (globals.Remote.vxi_connections == MAX_SESSIONS) {
result.error = ERR_OUTOFRESOURCES;
- }
- else if (argp->lockDevice && isLocked() && !waitForLock(FLAG_WAITLOCK, argp->lock_timeout)) {
+ } else if (argp->lockDevice && isLocked() && !waitForLock(FLAG_WAITLOCK, argp->lock_timeout)) {
result.error = ERR_DEVICELOCKEDBYANOTHERLINK;
- }
- else {
+ } else {
ActiveLink* link = g_malloc(sizeof(ActiveLink));
if (link == NULL ) {
result.error = ERR_OUTOFRESOURCES;
- }
- else {
+ } else {
int linkid;
for (linkid = 0; linkid < SIZEOFARRAY(links); linkid++) {
- if (links[linkid] != NULL ) // clean up any dead links
+ if (links[linkid] != NULL ) { // clean up any dead links
linkexpired(links[linkid]);
+ }
if (links[linkid] == NULL ) {
links[linkid] = link;
break;
@@ -239,29 +252,32 @@ create_link_1_svc(Create_LinkParms *argp, struct svc_req *rqstp) {
}
Device_WriteResp *
-device_write_1_svc(Device_WriteParms *argp, struct svc_req *rqstp) {
+device_write_1_svc(Device_WriteParms *argp, struct svc_req *rqstp)
+{
static Device_WriteResp result;
memset(&result, 0, sizeof(result));
#ifdef DEBUG
printf("device_write_1_svc()\n");
#endif
- if (!isValidLink(argp->lid))
+ if (!isValidLink(argp->lid)) {
result.error = ERR_INVALIDLINKINDENTIFIER;
- else if (isLocked() && !haveLock(argp->lid) && !waitForLock(argp->flags, argp->lock_timeout))
+ } else if (isLocked() && !haveLock(argp->lid) && !waitForLock(argp->flags, argp->lock_timeout)) {
result.error = ERR_DEVICELOCKEDBYANOTHERLINK;
- else if (!waitforio(argp->io_timeout))
+ } else if (!waitforio(argp->io_timeout)) {
result.error = ERR_IOTIMEOUT;
- else {
+ } else {
touchlink(argp->lid);
links[argp->lid]->aborted = false;
gchar* str = NULL;
- if (argp->data.data_val != NULL )
+ if (argp->data.data_val != NULL ) {
str = g_strndup(argp->data.data_val, argp->data.data_len);
+ }
if (str != NULL ) {
#ifdef DEBUG
int n;
- for (n = 0; str[n] != '\0'; n++)
+ for (n = 0; str[n] != '\0'; n++) {
printf("%02x ", (unsigned char) str[n]);
+ }
printf("\n");
printf("got <<%s>> (reported length %d)on link %d.\n", str, (int) argp->data.data_len, (int) argp->lid);
#endif
@@ -275,26 +291,27 @@ device_write_1_svc(Device_WriteParms *argp, struct svc_req *rqstp) {
}
Device_ReadResp *
-device_read_1_svc(Device_ReadParms *argp, struct svc_req *rqstp) {
+device_read_1_svc(Device_ReadParms *argp, struct svc_req *rqstp)
+{
static Device_ReadResp result;
#ifdef DEBUG
printf("device_read_1_svc()\n");
#endif
// this free's the data from the last call
- if (result.data.data_val != NULL )
+ if (result.data.data_val != NULL ) {
g_free(result.data.data_val);
+ }
memset(&result, 0, sizeof(result));
- if (!isValidLink(argp->lid))
+ if (!isValidLink(argp->lid)) {
result.error = ERR_INVALIDLINKINDENTIFIER;
- else if (isLocked() && !haveLock(argp->lid) && !waitForLock(argp->flags, argp->lock_timeout))
+ } else if (isLocked() && !haveLock(argp->lid) && !waitForLock(argp->flags, argp->lock_timeout)) {
result.error = ERR_DEVICELOCKEDBYANOTHERLINK;
- else if (!waitforio(argp->io_timeout)) {
+ } else if (!waitforio(argp->io_timeout)) {
result.error = ERR_IOTIMEOUT;
- }
- else {
+ } else {
touchlink(argp->lid);
if (globals.Registers.pending_output_message != NULL ) {
result.data.data_len = strlen(globals.Registers.pending_output_message);
@@ -304,9 +321,9 @@ device_read_1_svc(Device_ReadParms *argp, struct svc_req *rqstp) {
#ifdef DEBUG
printf("sending ---%s---\n", result.data.data_val);
#endif
- }
- else
+ } else {
result.data.data_val = NULL;
+ }
if (links[argp->lid]->aborted) {
result.error = ERR_ABORT;
@@ -319,17 +336,18 @@ device_read_1_svc(Device_ReadParms *argp, struct svc_req *rqstp) {
}
Device_ReadStbResp *
-device_readstb_1_svc(Device_GenericParms *argp, struct svc_req *rqstp) {
+device_readstb_1_svc(Device_GenericParms *argp, struct svc_req *rqstp)
+{
static Device_ReadStbResp result;
memset(&result, 0, sizeof(result));
#ifdef DEBUG
printf("device_readstb_1_svc()\n");
#endif
- if (!isValidLink(argp->lid))
+ if (!isValidLink(argp->lid)) {
result.error = ERR_INVALIDLINKINDENTIFIER;
- else if (isLocked() && !haveLock(argp->lid) && !waitForLock(argp->flags, argp->lock_timeout))
+ } else if (isLocked() && !haveLock(argp->lid) && !waitForLock(argp->flags, argp->lock_timeout)) {
result.error = ERR_DEVICELOCKEDBYANOTHERLINK;
- else {
+ } else {
touchlink(argp->lid);
result.stb = GPIB_and_VXI_get_STB();
}
@@ -337,16 +355,17 @@ device_readstb_1_svc(Device_GenericParms *argp, struct svc_req *rqstp) {
}
Device_Error *
-device_trigger_1_svc(Device_GenericParms *argp, struct svc_req *rqstp) {
+device_trigger_1_svc(Device_GenericParms *argp, struct svc_req *rqstp)
+{
static Device_Error result;
#ifdef DEBUG
printf("device_trigger_1_svc()\n");
#endif
- if (!isValidLink(argp->lid))
+ if (!isValidLink(argp->lid)) {
result.error = ERR_INVALIDLINKINDENTIFIER;
- else if (isLocked() && !haveLock(argp->lid) && !waitForLock(argp->flags, argp->lock_timeout))
+ } else if (isLocked() && !haveLock(argp->lid) && !waitForLock(argp->flags, argp->lock_timeout)) {
result.error = ERR_DEVICELOCKEDBYANOTHERLINK;
- else {
+ } else {
touchlink(argp->lid);
result.error = ERR_OPERATIONNOTSUPPORTED;
}
@@ -354,16 +373,17 @@ device_trigger_1_svc(Device_GenericParms *argp, struct svc_req *rqstp) {
}
Device_Error *
-device_clear_1_svc(Device_GenericParms *argp, struct svc_req *rqstp) {
+device_clear_1_svc(Device_GenericParms *argp, struct svc_req *rqstp)
+{
static Device_Error result;
#ifdef DEBUG
printf("device_clear_1_svc()\n");
#endif
- if (!isValidLink(argp->lid))
+ if (!isValidLink(argp->lid)) {
result.error = ERR_INVALIDLINKINDENTIFIER;
- else if (isLocked() && !haveLock(argp->lid) && !waitForLock(argp->flags, argp->lock_timeout))
+ } else if (isLocked() && !haveLock(argp->lid) && !waitForLock(argp->flags, argp->lock_timeout)) {
result.error = ERR_DEVICELOCKEDBYANOTHERLINK;
- else {
+ } else {
touchlink(argp->lid);
result.error = 0;
GPIB_and_VXI_device_clear();
@@ -372,19 +392,20 @@ device_clear_1_svc(Device_GenericParms *argp, struct svc_req *rqstp) {
}
Device_Error *
-device_remote_1_svc(Device_GenericParms *argp, struct svc_req *rqstp) {
+device_remote_1_svc(Device_GenericParms *argp, struct svc_req *rqstp)
+{
static Device_Error result;
#ifdef DEBUG
printf("device_remote_1_svc()\n");
#endif
- if (!isValidLink(argp->lid))
+ if (!isValidLink(argp->lid)) {
result.error = ERR_INVALIDLINKINDENTIFIER;
- else if (isLocked() && !haveLock(argp->lid) && !waitForLock(argp->flags, argp->lock_timeout))
+ } else if (isLocked() && !haveLock(argp->lid) && !waitForLock(argp->flags, argp->lock_timeout)) {
result.error = ERR_DEVICELOCKEDBYANOTHERLINK;
- else {
- if (isLocked() && !haveLock(argp->lid))
+ } else {
+ if (isLocked() && !haveLock(argp->lid)) {
result.error = ERR_DEVICELOCKEDBYANOTHERLINK;
- else {
+ } else {
touchlink(argp->lid);
result.error = 0;
globals.Remote.vxi_panel_lock = 1;
@@ -394,19 +415,20 @@ device_remote_1_svc(Device_GenericParms *argp, struct svc_req *rqstp) {
}
Device_Error *
-device_local_1_svc(Device_GenericParms *argp, struct svc_req *rqstp) {
+device_local_1_svc(Device_GenericParms *argp, struct svc_req *rqstp)
+{
static Device_Error result;
#ifdef DEBUG
printf("device_local_1_svc()\n");
#endif
- if (!isValidLink(argp->lid))
+ if (!isValidLink(argp->lid)) {
result.error = ERR_INVALIDLINKINDENTIFIER;
- else if (isLocked() && !haveLock(argp->lid) && !waitForLock(argp->flags, argp->lock_timeout))
+ } else if (isLocked() && !haveLock(argp->lid) && !waitForLock(argp->flags, argp->lock_timeout)) {
result.error = ERR_DEVICELOCKEDBYANOTHERLINK;
- else {
- if (isLocked() && !haveLock(argp->lid))
+ } else {
+ if (isLocked() && !haveLock(argp->lid)) {
result.error = ERR_DEVICELOCKEDBYANOTHERLINK;
- else {
+ } else {
touchlink(argp->lid);
result.error = 0;
globals.Remote.vxi_panel_lock = 0;
@@ -416,21 +438,21 @@ device_local_1_svc(Device_GenericParms *argp, struct svc_req *rqstp) {
}
Device_Error *
-device_lock_1_svc(Device_LockParms *argp, struct svc_req *rqstp) {
+device_lock_1_svc(Device_LockParms *argp, struct svc_req *rqstp)
+{
static Device_Error result;
#ifdef DEBUG
printf("device_lock_1_svc()\n");
#endif
- if (!isValidLink(argp->lid))
+ if (!isValidLink(argp->lid)) {
result.error = ERR_INVALIDLINKINDENTIFIER;
- else {
+ } else {
if (isLocked(argp->lid)) {
result.error = ERR_DEVICELOCKEDBYANOTHERLINK;
if (haveLock(argp->lid)) {
// maybe do something here to warn about a device trying to lock multiple times?
}
- }
- else {
+ } else {
touchlink(argp->lid);
lock(argp->lid);
result.error = 0;
@@ -440,17 +462,18 @@ device_lock_1_svc(Device_LockParms *argp, struct svc_req *rqstp) {
}
Device_Error *
-device_unlock_1_svc(Device_Link *argp, struct svc_req *rqstp) {
+device_unlock_1_svc(Device_Link *argp, struct svc_req *rqstp)
+{
static Device_Error result;
#ifdef DEBUG
printf("device_unlock_1_svc()\n");
#endif
- if (!isValidLink(*argp))
+ if (!isValidLink(*argp)) {
result.error = ERR_INVALIDLINKINDENTIFIER;
- else {
- if (!isLocked(*argp) || !haveLock(*argp))
+ } else {
+ if (!isLocked(*argp) || !haveLock(*argp)) {
result.error = ERR_NOLOCKHELDBYTHISLINK;
- else {
+ } else {
touchlink(*argp);
result.error = 0;
unlock();
@@ -459,7 +482,8 @@ device_unlock_1_svc(Device_Link *argp, struct svc_req *rqstp) {
return &result;
}
-void vxi11_fireinterrupt() {
+void vxi11_fireinterrupt()
+{
#ifdef DEBUG
printf("vxi11_fireinterrupt()\n");
#endif
@@ -472,14 +496,15 @@ void vxi11_fireinterrupt() {
}
Device_Error *
-device_enable_srq_1_svc(Device_EnableSrqParms *argp, struct svc_req *rqstp) {
+device_enable_srq_1_svc(Device_EnableSrqParms *argp, struct svc_req *rqstp)
+{
static Device_Error result;
#ifdef DEBUG
printf("device_enable_srq_1_svc()\n");
#endif
- if (!isValidLink(argp->lid))
+ if (!isValidLink(argp->lid)) {
result.error = ERR_INVALIDLINKINDENTIFIER;
- else {
+ } else {
touchlink(argp->lid);
if (inthandler != NULL ) {
g_free(inthandler);
@@ -506,17 +531,18 @@ device_enable_srq_1_svc(Device_EnableSrqParms *argp, struct svc_req *rqstp) {
}
Device_DocmdResp *
-device_docmd_1_svc(Device_DocmdParms *argp, struct svc_req *rqstp) {
+device_docmd_1_svc(Device_DocmdParms *argp, struct svc_req *rqstp)
+{
static Device_DocmdResp result;
memset(&result, 0, sizeof(result));
#ifdef DEBUG
printf("device_docmd_1_svc()\n");
#endif
- if (!isValidLink(argp->lid))
+ if (!isValidLink(argp->lid)) {
result.error = ERR_INVALIDLINKINDENTIFIER;
- else if (isLocked() && !haveLock(argp->lid) && !waitForLock(argp->flags, argp->lock_timeout))
+ } else if (isLocked() && !haveLock(argp->lid) && !waitForLock(argp->flags, argp->lock_timeout)) {
result.error = ERR_DEVICELOCKEDBYANOTHERLINK;
- else {
+ } else {
touchlink(argp->lid);
result.error = ERR_OPERATIONNOTSUPPORTED;
}
@@ -524,15 +550,16 @@ device_docmd_1_svc(Device_DocmdParms *argp, struct svc_req *rqstp) {
}
Device_Error *
-destroy_link_1_svc(Device_Link *argp, struct svc_req *rqstp) {
+destroy_link_1_svc(Device_Link *argp, struct svc_req *rqstp)
+{
static Device_Error result;
#ifdef DEBUG
printf("destroy_link_1_svc()\n");
#endif
int lid = *argp;
- if (!isValidLink(lid))
+ if (!isValidLink(lid)) {
result.error = ERR_INVALIDLINKINDENTIFIER;
- else {
+ } else {
freelink(links[lid]);
result.error = 0;
}
@@ -541,7 +568,8 @@ destroy_link_1_svc(Device_Link *argp, struct svc_req *rqstp) {
}
Device_Error *
-create_intr_chan_1_svc(Device_RemoteFunc *argp, struct svc_req *rqstp) {
+create_intr_chan_1_svc(Device_RemoteFunc *argp, struct svc_req *rqstp)
+{
static Device_Error result;
in_port_t port = htons(argp->hostPort);
@@ -569,15 +597,14 @@ create_intr_chan_1_svc(Device_RemoteFunc *argp, struct svc_req *rqstp) {
}
}
- if (argp->progFamily != DEVICE_TCP || argp->progNum != DEVICE_INTR || argp->progVers != DEVICE_INTR_VERSION)
+ if (argp->progFamily != DEVICE_TCP || argp->progNum != DEVICE_INTR || argp->progVers != DEVICE_INTR_VERSION) {
result.error = ERR_OPERATIONNOTSUPPORTED;
- else if (intclient != NULL ) {
+ } else if (intclient != NULL ) {
#ifdef DEBUG
printf("Not creating interrupt channel, already exists\n");
#endif
result.error = ERR_CHANNELALREADYESTABLISHED;
- }
- else {
+ } else {
struct sockaddr_in clientaddr;
clientaddr.sin_family = AF_INET;
clientaddr.sin_port = port;
@@ -589,8 +616,7 @@ create_intr_chan_1_svc(Device_RemoteFunc *argp, struct svc_req *rqstp) {
printf("Couldn't create interrupt channel client\n");
#endif
result.error = ERR_CHANNELNOTESTABLISHED;
- }
- else {
+ } else {
intclient = clnt;
result.error = 0;
#ifdef DEBUG
@@ -602,15 +628,15 @@ create_intr_chan_1_svc(Device_RemoteFunc *argp, struct svc_req *rqstp) {
}
Device_Error *
-destroy_intr_chan_1_svc(void *argp, struct svc_req *rqstp) {
+destroy_intr_chan_1_svc(void *argp, struct svc_req *rqstp)
+{
static Device_Error result;
#ifdef DEBUG
printf("destroy_intr_chan_1_svc()\n");
#endif
if (intclient == NULL ) {
result.error = ERR_CHANNELNOTESTABLISHED;
- }
- else {
+ } else {
clnt_destroy(intclient);
intclient = NULL;
result.error = 0;
diff --git a/vxi11_svc.c b/vxi11_svc.c
index e5c4b38..3ead3b1 100644
--- a/vxi11_svc.c
+++ b/vxi11_svc.c
@@ -17,7 +17,8 @@
#define SIG_PF void(*)(int)
#endif
-static void device_async_1(struct svc_req *rqstp, register SVCXPRT *transp) {
+static void device_async_1(struct svc_req *rqstp, register SVCXPRT *transp)
+{
union {
Device_Link device_abort_1_arg;
} argument;
@@ -26,19 +27,19 @@ static void device_async_1(struct svc_req *rqstp, register SVCXPRT *transp) {
char *(*local)(char *, struct svc_req *);
switch (rqstp->rq_proc) {
- case NULLPROC:
- (void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *) NULL);
- return;
-
- case device_abort:
- _xdr_argument = (xdrproc_t) xdr_Device_Link;
- _xdr_result = (xdrproc_t) xdr_Device_Error;
- local = (char *(*)(char *, struct svc_req *)) device_abort_1_svc;
- break;
+ case NULLPROC:
+ (void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *) NULL);
+ return;
- default:
- svcerr_noproc(transp);
- return;
+ case device_abort:
+ _xdr_argument = (xdrproc_t) xdr_Device_Link;
+ _xdr_result = (xdrproc_t) xdr_Device_Error;
+ local = (char *(*)(char *, struct svc_req *)) device_abort_1_svc;
+ break;
+
+ default:
+ svcerr_noproc(transp);
+ return;
}
memset((char *) &argument, 0, sizeof(argument));
if (!svc_getargs(transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
@@ -56,7 +57,8 @@ static void device_async_1(struct svc_req *rqstp, register SVCXPRT *transp) {
return;
}
-static void device_core_1(struct svc_req *rqstp, register SVCXPRT *transp) {
+static void device_core_1(struct svc_req *rqstp, register SVCXPRT *transp)
+{
union {
Create_LinkParms create_link_1_arg;
Device_WriteParms device_write_1_arg;
@@ -78,103 +80,103 @@ static void device_core_1(struct svc_req *rqstp, register SVCXPRT *transp) {
char *(*local)(char *, struct svc_req *);
switch (rqstp->rq_proc) {
- case NULLPROC:
- (void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *) NULL);
- return;
-
- case create_link:
- _xdr_argument = (xdrproc_t) xdr_Create_LinkParms;
- _xdr_result = (xdrproc_t) xdr_Create_LinkResp;
- local = (char *(*)(char *, struct svc_req *)) create_link_1_svc;
- break;
+ case NULLPROC:
+ (void) svc_sendreply(transp, (xdrproc_t) xdr_void, (char *) NULL);
+ return;
- case device_write:
- _xdr_argument = (xdrproc_t) xdr_Device_WriteParms;
- _xdr_result = (xdrproc_t) xdr_Device_WriteResp;
- local = (char *(*)(char *, struct svc_req *)) device_write_1_svc;
- break;
+ case create_link:
+ _xdr_argument = (xdrproc_t) xdr_Create_LinkParms;
+ _xdr_result = (xdrproc_t) xdr_Create_LinkResp;
+ local = (char *(*)(char *, struct svc_req *)) create_link_1_svc;
+ break;
- case device_read:
- _xdr_argument = (xdrproc_t) xdr_Device_ReadParms;
- _xdr_result = (xdrproc_t) xdr_Device_ReadResp;
- local = (char *(*)(char *, struct svc_req *)) device_read_1_svc;
- break;
+ case device_write:
+ _xdr_argument = (xdrproc_t) xdr_Device_WriteParms;
+ _xdr_result = (xdrproc_t) xdr_Device_WriteResp;
+ local = (char *(*)(char *, struct svc_req *)) device_write_1_svc;
+ break;
- case device_readstb:
- _xdr_argument = (xdrproc_t) xdr_Device_GenericParms;
- _xdr_result = (xdrproc_t) xdr_Device_ReadStbResp;
- local = (char *(*)(char *, struct svc_req *)) device_readstb_1_svc;
- break;
+ case device_read:
+ _xdr_argument = (xdrproc_t) xdr_Device_ReadParms;
+ _xdr_result = (xdrproc_t) xdr_Device_ReadResp;
+ local = (char *(*)(char *, struct svc_req *)) device_read_1_svc;
+ break;
- case device_trigger:
- _xdr_argument = (xdrproc_t) xdr_Device_GenericParms;
- _xdr_result = (xdrproc_t) xdr_Device_Error;
- local = (char *(*)(char *, struct svc_req *)) device_trigger_1_svc;
- break;
+ case device_readstb:
+ _xdr_argument = (xdrproc_t) xdr_Device_GenericParms;
+ _xdr_result = (xdrproc_t) xdr_Device_ReadStbResp;
+ local = (char *(*)(char *, struct svc_req *)) device_readstb_1_svc;
+ break;
- case device_clear:
- _xdr_argument = (xdrproc_t) xdr_Device_GenericParms;
- _xdr_result = (xdrproc_t) xdr_Device_Error;
- local = (char *(*)(char *, struct svc_req *)) device_clear_1_svc;
- break;
+ case device_trigger:
+ _xdr_argument = (xdrproc_t) xdr_Device_GenericParms;
+ _xdr_result = (xdrproc_t) xdr_Device_Error;
+ local = (char *(*)(char *, struct svc_req *)) device_trigger_1_svc;
+ break;
- case device_remote:
- _xdr_argument = (xdrproc_t) xdr_Device_GenericParms;
- _xdr_result = (xdrproc_t) xdr_Device_Error;
- local = (char *(*)(char *, struct svc_req *)) device_remote_1_svc;
- break;
+ case device_clear:
+ _xdr_argument = (xdrproc_t) xdr_Device_GenericParms;
+ _xdr_result = (xdrproc_t) xdr_Device_Error;
+ local = (char *(*)(char *, struct svc_req *)) device_clear_1_svc;
+ break;
- case device_local:
- _xdr_argument = (xdrproc_t) xdr_Device_GenericParms;
- _xdr_result = (xdrproc_t) xdr_Device_Error;
- local = (char *(*)(char *, struct svc_req *)) device_local_1_svc;
- break;
+ case device_remote:
+ _xdr_argument = (xdrproc_t) xdr_Device_GenericParms;
+ _xdr_result = (xdrproc_t) xdr_Device_Error;
+ local = (char *(*)(char *, struct svc_req *)) device_remote_1_svc;
+ break;
- case device_lock:
- _xdr_argument = (xdrproc_t) xdr_Device_LockParms;
- _xdr_result = (xdrproc_t) xdr_Device_Error;
- local = (char *(*)(char *, struct svc_req *)) device_lock_1_svc;
- break;
+ case device_local:
+ _xdr_argument = (xdrproc_t) xdr_Device_GenericParms;
+ _xdr_result = (xdrproc_t) xdr_Device_Error;
+ local = (char *(*)(char *, struct svc_req *)) device_local_1_svc;
+ break;
- case device_unlock:
- _xdr_argument = (xdrproc_t) xdr_Device_Link;
- _xdr_result = (xdrproc_t) xdr_Device_Error;
- local = (char *(*)(char *, struct svc_req *)) device_unlock_1_svc;
- break;
+ case device_lock:
+ _xdr_argument = (xdrproc_t) xdr_Device_LockParms;
+ _xdr_result = (xdrproc_t) xdr_Device_Error;
+ local = (char *(*)(char *, struct svc_req *)) device_lock_1_svc;
+ break;
- case device_enable_srq:
- _xdr_argument = (xdrproc_t) xdr_Device_EnableSrqParms;
- _xdr_result = (xdrproc_t) xdr_Device_Error;
- local = (char *(*)(char *, struct svc_req *)) device_enable_srq_1_svc;
- break;
+ case device_unlock:
+ _xdr_argument = (xdrproc_t) xdr_Device_Link;
+ _xdr_result = (xdrproc_t) xdr_Device_Error;
+ local = (char *(*)(char *, struct svc_req *)) device_unlock_1_svc;
+ break;
- case device_docmd:
- _xdr_argument = (xdrproc_t) xdr_Device_DocmdParms;
- _xdr_result = (xdrproc_t) xdr_Device_DocmdResp;
- local = (char *(*)(char *, struct svc_req *)) device_docmd_1_svc;
- break;
+ case device_enable_srq:
+ _xdr_argument = (xdrproc_t) xdr_Device_EnableSrqParms;
+ _xdr_result = (xdrproc_t) xdr_Device_Error;
+ local = (char *(*)(char *, struct svc_req *)) device_enable_srq_1_svc;
+ break;
- case destroy_link:
- _xdr_argument = (xdrproc_t) xdr_Device_Link;
- _xdr_result = (xdrproc_t) xdr_Device_Error;
- local = (char *(*)(char *, struct svc_req *)) destroy_link_1_svc;
- break;
+ case device_docmd:
+ _xdr_argument = (xdrproc_t) xdr_Device_DocmdParms;
+ _xdr_result = (xdrproc_t) xdr_Device_DocmdResp;
+ local = (char *(*)(char *, struct svc_req *)) device_docmd_1_svc;
+ break;
- case create_intr_chan:
- _xdr_argument = (xdrproc_t) xdr_Device_RemoteFunc;
- _xdr_result = (xdrproc_t) xdr_Device_Error;
- local = (char *(*)(char *, struct svc_req *)) create_intr_chan_1_svc;
- break;
+ case destroy_link:
+ _xdr_argument = (xdrproc_t) xdr_Device_Link;
+ _xdr_result = (xdrproc_t) xdr_Device_Error;
+ local = (char *(*)(char *, struct svc_req *)) destroy_link_1_svc;
+ break;
- case destroy_intr_chan:
- _xdr_argument = (xdrproc_t) xdr_void;
- _xdr_result = (xdrproc_t) xdr_Device_Error;
- local = (char *(*)(char *, struct svc_req *)) destroy_intr_chan_1_svc;
- break;
+ case create_intr_chan:
+ _xdr_argument = (xdrproc_t) xdr_Device_RemoteFunc;
+ _xdr_result = (xdrproc_t) xdr_Device_Error;
+ local = (char *(*)(char *, struct svc_req *)) create_intr_chan_1_svc;
+ break;
- default:
- svcerr_noproc(transp);
- return;
+ case destroy_intr_chan:
+ _xdr_argument = (xdrproc_t) xdr_void;
+ _xdr_result = (xdrproc_t) xdr_Device_Error;
+ local = (char *(*)(char *, struct svc_req *)) destroy_intr_chan_1_svc;
+ break;
+
+ default:
+ svcerr_noproc(transp);
+ return;
}
memset((char *) &argument, 0, sizeof(argument));
if (!svc_getargs(transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
@@ -192,7 +194,8 @@ static void device_core_1(struct svc_req *rqstp, register SVCXPRT *transp) {
return;
}
-void vxi_main() {
+void vxi_main()
+{
printf("VXI service started\n");
@@ -235,8 +238,9 @@ void vxi_main() {
while (1) {
int max_pollfd = svc_max_pollfd;
- if (max_pollfd == 0 && svc_pollfd == NULL)
+ if (max_pollfd == 0 && svc_pollfd == NULL) {
break;
+ }
if (last_max_pollfd != max_pollfd) {
struct pollfd *new_pollfd = realloc(my_pollfd, sizeof(struct pollfd) * max_pollfd);
@@ -258,18 +262,19 @@ void vxi_main() {
j = poll(my_pollfd, max_pollfd, VXI11_DEFAULT_TIMEOUT);
for (i = 0; i < max_pollfd; i++) {
- if (my_pollfd[i].revents & POLLRDHUP)
+ if (my_pollfd[i].revents & POLLRDHUP) {
vxi11_deadsocketcallback(my_pollfd[i].fd);
+ }
}
switch (j) {
- case -1:
- break;
- case 0:
- continue;
- default:
- svc_getreq_poll(my_pollfd, i);
- continue;
+ case -1:
+ break;
+ case 0:
+ continue;
+ default:
+ svc_getreq_poll(my_pollfd, i);
+ continue;
}
break;
}
diff --git a/vxi11_xdr.c b/vxi11_xdr.c
index e6cf799..c65c9db 120000..100644
--- a/vxi11_xdr.c
+++ b/vxi11_xdr.c
@@ -1 +1,565 @@
-libvxi11client/vxi11_xdr.c \ No newline at end of file
+/*
+ * 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;
+}