diff options
author | daniel <danieruru@gmail.com> | 2013-01-10 17:56:04 +0900 |
---|---|---|
committer | daniel <danieruru@gmail.com> | 2013-01-10 17:56:04 +0900 |
commit | bd451ce0f4855bc2dfd8c19b1f17a5cd60eb6650 (patch) | |
tree | a3a739c7e70bbf9473af42217ee7e911f810df99 /vxi11_server.c | |
parent | 54329a7c7f740171d1594c6c6195277c2924f31f (diff) |
add some more code to the server side
Diffstat (limited to 'vxi11_server.c')
-rw-r--r-- | vxi11_server.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/vxi11_server.c b/vxi11_server.c index 906613f..06a8c44 100644 --- a/vxi11_server.c +++ b/vxi11_server.c @@ -224,15 +224,41 @@ create_intr_chan_1_svc(Device_RemoteFunc *argp, struct svc_req *rqstp) { printf("Client %s is asking for an interrupt connection on port %u\n", clientaddressstring, ntohs(argp->hostPort)); #endif - result.error = 0; + bool alreadyhavechannel = false; + if (alreadyhavechannel) { + result.error = ERR_CHANNELALREADYESTABLISHED; + } + else { + struct sockaddr_in clientaddr; + clientaddr.sin_family = AF_INET; + clientaddr.sin_port = argp->hostPort; + clientaddr.sin_addr.s_addr = argp->hostAddr; + int sock = RPC_ANYSOCK; + CLIENT* clnt = clnttcp_create(&clientaddr, DEVICE_INTR, DEVICE_INTR_VERSION, &sock, 0, 0); + if (clnt == NULL) { +#ifdef DEBUG + printf("Couldn't create interrupt channel client\n"); +#endif + result.error = ERR_CHANNELNOTESTABLISHED; + } + else { + result.error = 0; + } + } return &result; } Device_Error * destroy_intr_chan_1_svc(void *argp, struct svc_req *rqstp) { - printf("destroy_intr_chan_1_svc()\n"); static Device_Error result; - result.error = 0; + printf("destroy_intr_chan_1_svc()\n"); + bool havechannel = false; + if (!havechannel) { + result.error = ERR_CHANNELNOTESTABLISHED; + } + else { + result.error = 0; + } return &result; } |