-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathall_rpc_methods.c
53 lines (45 loc) · 1.32 KB
/
all_rpc_methods.c
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
#include <stdio.h>
#include "log/uulog.h"
#include "base.h"
/**
* step:
* 1. encode into xml from struct(many ways);
* 2. send xml;
* 2.1. establish connection;
* 3. recv xml;
* 3.1. close connection;
* 4. decode into struct from xml(by using gsoap API).
* @param[in] acs_url: such as 'http://ip<:port>/cgi'
* @param[in] send: the struct that send to asc
* @param[out] recv: the struct that recv from acs
* @return: 0 - seccess; -1 - failed.
*/
static int _struct_comm_with_acs(char *acs_url, CpeRpcMsg* send, CpeRpcMsg **recv)
{
char *xml_send = NULL, *xml_recv = NULL;
handle = soap_create();
/* step 1. encode into xml */
xml_send = soap_parser_encode(handle, send);
/* step 2&3. send & recv xml */
http_comm_with_acs(acs_url, xml_send, &xml_recv);
/* step 4. decode string 'xml_recv' into struct 'recv' */
soap_parser_decode(handle, xml_recv, recv);
free(xml_send);
free(xml_recv);
}
/**
* launch a inform request to acs
* @param[in] url: acs's url
* @return: struct that received from acs
*/
CpeRpcMsg *rpc_inform_req(char *url)
{
CpeRpcMsg *send, *recv;
/* TODO: create_msg() - get device's events */
send = create_msg();
_struct_comm_with_acs(url, send, &recv);
return recv;
}
int rpc_set_param_values_rsp(ACS *acs, CARpcMsg* send, CARpcMsg **recv)
{
}