diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/cmd_todo.c | 68 | ||||
-rw-r--r-- | cmd/cmd_todo.h | 1 |
2 files changed, 68 insertions, 1 deletions
diff --git a/cmd/cmd_todo.c b/cmd/cmd_todo.c index 0f3ae58..e525d38 100644 --- a/cmd/cmd_todo.c +++ b/cmd/cmd_todo.c @@ -3,8 +3,74 @@ void *cmd_todo(void *data) { char *ret = NULL; + char *req_data = NULL; + int fret; - + rpc_call_request *req = NULL; + rpc_call_response *resp = NULL; + netbyte_store *nb_req = NULL, *nb_resp=NULL; + char *nb_buf = NULL; + + PRINT("TODO\n"); + + req_data = (char *)data; + if (!req_data) + { + PERM(); + return NULL; + } + + //---------------------------------------------------------------------------- + //prepare request + nb_req = malloc(sizeof(netbyte_store)); + nb_init(nb_req); + nb_load(nb_req, req_data); + + if (nb_req == NULL) + { + ERROR("implement response\n"); + return NULL; + } + + PNL(); + fret = rpc_call_req_unmarsh(nb_req, &req); + PNL(); + if (fret != 0) + { + ERROR("Invalid request format\n"); + return NULL; + } + PNL(); + + //---------------------------------------------------------------------------- + //main code + + + //---------------------------------------------------------------------------- + //prepare response + nb_resp = malloc(sizeof(netbyte_store)); + nb_init(nb_resp); + + PNL(); + resp = rpc_call_resp_new("Success","None",1); + resp->user = alloc_new_str(""); + resp->server = alloc_new_str(""); + resp->mask = alloc_new_str(""); + PNL(); + rpc_call_resp_marsh(resp, &nb_resp); + + PNL(); + nb_buf = nb_create(nb_resp); + if (nb_buf) + { + ret = nb_buf; + } + + PNL(); + nb_free(nb_resp); + PNL(); + rpc_call_resp_free(resp); + PNL(); return ret; } diff --git a/cmd/cmd_todo.h b/cmd/cmd_todo.h index b5227e7..1e436ba 100644 --- a/cmd/cmd_todo.h +++ b/cmd/cmd_todo.h @@ -11,6 +11,7 @@ #include "util.h" #include "debug.h" +#include "nbrpc_call.h" void *cmd_todo(void *data); |