#include "cmd_todo.h" 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; } fret = rpc_call_req_unmarsh(nb_req, &req); if (fret != 0) { ERROR("Invalid request format\n"); return NULL; } //---------------------------------------------------------------------------- //main code PRINT("%s-%s-%s-%s-%s\n", req->method, req->params, req->user, req->mask, req->server); //---------------------------------------------------------------------------- //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 = (char *)nb_create(nb_resp); if (nb_buf) { ret = nb_buf; } nb_free(nb_resp); rpc_call_resp_free(resp); return ret; }