summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2017-09-30 22:51:45 +0100
committerFreeArtMan <dos21h@gmail.com>2017-09-30 22:51:45 +0100
commit512f057166af84c11fc7ed5e4768b9dd2fe9f590 (patch)
treebe57349725502ad9ef14d70a4e32ff3ffb2bea94 /cmd
parent8c97104aa6fac4a7ed54d97bbcb1aed5e2398713 (diff)
downloadagni-512f057166af84c11fc7ed5e4768b9dd2fe9f590.tar.gz
agni-512f057166af84c11fc7ed5e4768b9dd2fe9f590.zip
comand rpc sends/recieves packets woohoo
Diffstat (limited to 'cmd')
-rw-r--r--cmd/cmd_todo.c68
-rw-r--r--cmd/cmd_todo.h1
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);