diff options
author | daniel <danieruru@gmail.com> | 2013-01-11 13:38:40 +0900 |
---|---|---|
committer | daniel <danieruru@gmail.com> | 2013-01-11 13:38:40 +0900 |
commit | 939ce4d4b67c068055be6e2ab27cc6144a53d546 (patch) | |
tree | 188cc349bb49a4fc6d89a8849969a48c2b5c508a /vxi11_server.c | |
parent | 557169f71b442ff10406ed764200f95084816fa8 (diff) |
add the missing srq enable, disable checks in gpib for now
Diffstat (limited to 'vxi11_server.c')
-rw-r--r-- | vxi11_server.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/vxi11_server.c b/vxi11_server.c index e852855..2382966 100644 --- a/vxi11_server.c +++ b/vxi11_server.c @@ -33,6 +33,9 @@ static CLIENT* intclient = NULL; +static bool intenabled = false; +static char* inthandler = NULL; + typedef struct { } ActiveLink; @@ -122,6 +125,10 @@ create_link_1_svc(Create_LinkParms *argp, struct svc_req *rqstp) { break; } } + globals.Remote.vxi_connections++; +#ifdef DEBUG + printf("created link %d, %d active links\n", linkid, globals.Remote.vxi_connections); +#endif struct sockaddr_in sin; socklen_t len = sizeof(sin); @@ -129,7 +136,6 @@ create_link_1_svc(Create_LinkParms *argp, struct svc_req *rqstp) { result.error = 0; result.abortPort = ntohs(sin.sin_port); result.lid = linkid; - globals.Remote.vxi_connections++; } } return &result; @@ -327,7 +333,19 @@ device_enable_srq_1_svc(Device_EnableSrqParms *argp, struct svc_req *rqstp) { if (!isValidLink(argp->lid)) result.error = ERR_INVALIDLINKINDENTIFIER; else { + if (inthandler != NULL) + free(inthandler); + if (argp->enable) { + if (argp->handle.handle_val != NULL) { + inthandler = malloc(argp->handle.handle_len); + strncpy(inthandler, argp->handle.handle_val, argp->handle.handle_len); +#ifdef DEBUG + printf("Interrupt handle set to %s\n", inthandler); +#endif + } + } result.error = 0; + intenabled = argp->enable; } return &result; } @@ -360,14 +378,15 @@ destroy_link_1_svc(Device_Link *argp, struct svc_req *rqstp) { if (!isValidLink(lid)) result.error = ERR_INVALIDLINKINDENTIFIER; else { + globals.Remote.vxi_connections--; #ifdef DEBUG - printf("link %d destroyed\n", lid); + printf("link %d destroyed, %d active links\n", lid, globals.Remote.vxi_connections); #endif + result.error = 0; free(links[lid]); links[lid] = NULL; } - globals.Remote.vxi_connections--; return &result; } |