diff options
Diffstat (limited to 'vxi11_server.c')
-rw-r--r-- | vxi11_server.c | 91 |
1 files changed, 50 insertions, 41 deletions
diff --git a/vxi11_server.c b/vxi11_server.c index cebff63..84a80d5 100644 --- a/vxi11_server.c +++ b/vxi11_server.c @@ -6,6 +6,52 @@ #include "vxi11.h" #include "stdio.h" +#include "globals.h" +#include <stdbool.h> + +#define ERR_SYNTAXERROR 1 +#define ERR_DEVICENOTACCESSIBLE 3 +#define ERR_INVALIDLINKINDENTIFIER 4 +#define ERR_PARAMETERERROR 5 +#define ERR_CHANNELNOTESTABLISHED 6 +#define ERR_OPERATIONNOTSUPPORTED 8 +#define ERR_OUTOFRESOURCES 9 +#define ERR_DEVICELOCKEDBYANOTHERLINK 11 +#define ERR_NOLOCKHELDBYTHISLINK 12 +#define ERR_IOTIMEOUT 15 +#define ERR_IOERROR 17 +#define ERR_INVALIDADDRESS 21 +#define ERR_ABORT 23 +#define ERR_CHANNELALREADYESTABLISHED 29 + +static bool isLocked() { + return globals.VxiLocks.locked_network_server != NO_SERVER_LOCKED; +} + +static bool haveLock(int lid) { + return globals.VxiLocks.locked_network_server == lid; +} + +static void waitForLock(long timeout) { + +} + +static bool lock(int lid) { + if (globals.VxiLocks.locked_network_server = NO_SERVER_LOCKED) + return false; + globals.VxiLocks.locked_network_server = lid; +} + +static bool unlock(int lid) { + if (globals.VxiLocks.locked_network_server = NO_SERVER_LOCKED) + return false; + else if (globals.VxiLocks.locked_network_server != lid) + return false; + else { + globals.VxiLocks.locked_network_server = NO_SERVER_LOCKED; + return true; + } +} Device_Error * device_abort_1_svc(Device_Link *argp, struct svc_req *rqstp) { @@ -23,10 +69,7 @@ Create_LinkResp * create_link_1_svc(Create_LinkParms *argp, struct svc_req *rqstp) { printf("create_link_1_svc()\n"); static Create_LinkResp result; - - /* - * insert server code here - */ + globals.Remote.vxi_connections++; result.error = 0; return &result; } @@ -35,7 +78,6 @@ Device_WriteResp * device_write_1_svc(Device_WriteParms *argp, struct svc_req *rqstp) { printf("device_write_1_svc()\n"); static Device_WriteResp result; - printf("%s\n", argp->data.data_val); /* @@ -68,11 +110,6 @@ Device_ReadStbResp * device_readstb_1_svc(Device_GenericParms *argp, struct svc_req *rqstp) { printf("device_readstb_1_svc()\n"); static Device_ReadStbResp result; - - /* - * insert server code here - */ - result.error = 0; result.stb = 0; return &result; @@ -132,11 +169,9 @@ device_local_1_svc(Device_GenericParms *argp, struct svc_req *rqstp) { Device_Error * device_lock_1_svc(Device_LockParms *argp, struct svc_req *rqstp) { printf("device_lock_1_svc()\n"); + static Device_Error result; - /* - * insert server code here - */ result.error = 0; return &result; } @@ -156,11 +191,6 @@ Device_Error * device_enable_srq_1_svc(Device_EnableSrqParms *argp, struct svc_req *rqstp) { printf("device_enable_srq_1_svc()\n"); static Device_Error result; - - /* - * insert server code here - */ - return &result; } @@ -168,11 +198,7 @@ Device_DocmdResp * device_docmd_1_svc(Device_DocmdParms *argp, struct svc_req *rqstp) { printf("device_docmd_1_svc()\n"); static Device_DocmdResp result; - - /* - * insert server code here - */ - result.error = 0; + result.error = ERR_OPERATIONNOTSUPPORTED; return &result; } @@ -180,11 +206,7 @@ Device_Error * destroy_link_1_svc(Device_Link *argp, struct svc_req *rqstp) { printf("destroy_link_1_svc()\n"); static Device_Error result; - - /* - * insert server code here - */ - + globals.Remote.vxi_connections--; return &result; } @@ -192,10 +214,6 @@ Device_Error * create_intr_chan_1_svc(Device_RemoteFunc *argp, struct svc_req *rqstp) { printf("create_intr_chan_1_svc()\n"); static Device_Error result; - - /* - * insert server code here - */ result.error = 0; return &result; } @@ -204,10 +222,6 @@ Device_Error * destroy_intr_chan_1_svc(void *argp, struct svc_req *rqstp) { printf("destroy_intr_chan_1_svc()\n"); static Device_Error result; - - /* - * insert server code here - */ result.error = 0; return &result; } @@ -216,10 +230,5 @@ void * device_intr_srq_1_svc(Device_SrqParms *argp, struct svc_req *rqstp) { printf("device_intr_srq_1_svc()\n"); static char * result; - - /* - * insert server code here - */ - return (void *) &result; } |