blob: e525d38cfe1e3acda36b7f1ed1be3d178b741e86 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
#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;
}
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;
}
|