Mercurial > nomad > old-fuse
changeset 128:3e57d8dd41b5
client: provide a stub RPC handler for LOGIN
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Sun, 18 Oct 2015 09:43:04 -0400 |
parents | ed287ae023f2 |
children | 226dba00c5d1 |
files | src/client/CMakeLists.txt src/client/cmd_login.c src/client/cmds.c src/client/cmds.h |
diffstat | 4 files changed, 52 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/client/CMakeLists.txt Sun Oct 18 09:42:33 2015 -0400 +++ b/src/client/CMakeLists.txt Sun Oct 18 09:43:04 2015 -0400 @@ -25,6 +25,7 @@ cmds.c # assorted RPC handlers + cmd_login.c cmd_nop.c )
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/client/cmd_login.c Sun Oct 18 09:43:04 2015 -0400 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2015 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#include <nomad/error.h> + +#include "cmds.h" + +int cmd_login(union cmd *cmd) +{ + return ENOTSUP; +}
--- a/src/client/cmds.c Sun Oct 18 09:42:33 2015 -0400 +++ b/src/client/cmds.c Sun Oct 18 09:43:04 2015 -0400 @@ -20,6 +20,8 @@ * SOFTWARE. */ +#include <stddef.h> + #include <nomad/error.h> #include <nomad/rpc_fs.h> @@ -32,6 +34,17 @@ .handler = (hndlr), \ } +#define CMD_ARG_RET(op, what, hndlr) \ + { \ + .name = #op, \ + .opcode = (op), \ + .handler = (hndlr), \ + .reqoff = offsetof(union cmd, what.req),\ + .resoff = offsetof(union cmd, what.res),\ + .req = (void *) xdr_rpc_##what##_req, \ + .res = (void *) xdr_rpc_##what##_res, \ + } + static const struct cmdtbl { const char *name; uint16_t opcode; @@ -46,6 +59,7 @@ bool_t (*req)(XDR *, void *); bool_t (*res)(XDR *, void *); } cmdtbl[] = { + CMD_ARG_RET(NRPC_LOGIN, login, cmd_login), CMD (NRPC_NOP, nop, cmd_nop), };
--- a/src/client/cmds.h Sun Oct 18 09:42:33 2015 -0400 +++ b/src/client/cmds.h Sun Oct 18 09:43:04 2015 -0400 @@ -26,12 +26,19 @@ #include <nomad/rpc_fs.h> union cmd { + /* login */ + struct { + struct rpc_login_req req; + struct rpc_login_res res; + } login; + /* nop - no req & no res */ }; extern bool process_connection(int fd); /* RPC handlers */ +extern int cmd_login(union cmd *cmd); extern int cmd_nop(union cmd *cmd); #endif