Improve management SOAP request/response with Director
This commit is contained in:
parent
bb44612672
commit
f0c5146563
@ -106,7 +106,6 @@ struct ac_t {
|
|||||||
/* Backend Management */
|
/* Backend Management */
|
||||||
char* backendacid;
|
char* backendacid;
|
||||||
char* backendversion;
|
char* backendversion;
|
||||||
char* backendsessionid;
|
|
||||||
struct capwap_array* availablebackends;
|
struct capwap_array* availablebackends;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -22,6 +22,9 @@ struct ac_backend_t {
|
|||||||
int backendstatus;
|
int backendstatus;
|
||||||
int errorjoinbackend;
|
int errorjoinbackend;
|
||||||
|
|
||||||
|
/* Session */
|
||||||
|
char* backendsessionid;
|
||||||
|
|
||||||
/* Soap Request */
|
/* Soap Request */
|
||||||
struct ac_http_soap_request* soaprequest;
|
struct ac_http_soap_request* soaprequest;
|
||||||
};
|
};
|
||||||
@ -29,7 +32,8 @@ struct ac_backend_t {
|
|||||||
static struct ac_backend_t g_ac_backend;
|
static struct ac_backend_t g_ac_backend;
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
static void ac_backend_parsing_closewtpsession_event(int idevent, struct json_object* jsonparams) {
|
static int ac_backend_parsing_closewtpsession_event(struct json_object* jsonparams) {
|
||||||
|
int result = 0;
|
||||||
struct ac_session_t* session;
|
struct ac_session_t* session;
|
||||||
struct json_object* jsonvalue;
|
struct json_object* jsonvalue;
|
||||||
|
|
||||||
@ -52,12 +56,16 @@ static void ac_backend_parsing_closewtpsession_event(int idevent, struct json_ob
|
|||||||
/* Close session */
|
/* Close session */
|
||||||
ac_session_close(session);
|
ac_session_close(session);
|
||||||
ac_session_release_reference(session);
|
ac_session_release_reference(session);
|
||||||
}
|
result = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
static void ac_backend_parsing_resetwtp_event(int idevent, struct json_object* jsonparams) {
|
static int ac_backend_parsing_resetwtp_event(struct json_object* jsonparams) {
|
||||||
|
int result = 0;
|
||||||
struct ac_session_t* session;
|
struct ac_session_t* session;
|
||||||
struct json_object* jsonvalue;
|
struct json_object* jsonvalue;
|
||||||
struct json_object* jsonimage;
|
struct json_object* jsonimage;
|
||||||
@ -103,6 +111,7 @@ static void ac_backend_parsing_resetwtp_event(int idevent, struct json_object* j
|
|||||||
/* Notify Action */
|
/* Notify Action */
|
||||||
capwap_logging_debug("Receive reset request for WTP %s", session->wtpid);
|
capwap_logging_debug("Receive reset request for WTP %s", session->wtpid);
|
||||||
ac_session_send_action(session, AC_SESSION_ACTION_RESET_WTP, 0, (void*)reset, length);
|
ac_session_send_action(session, AC_SESSION_ACTION_RESET_WTP, 0, (void*)reset, length);
|
||||||
|
result = 1;
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
capwap_free(reset);
|
capwap_free(reset);
|
||||||
@ -113,18 +122,87 @@ static void ac_backend_parsing_resetwtp_event(int idevent, struct json_object* j
|
|||||||
ac_session_release_reference(session);
|
ac_session_release_reference(session);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
static void ac_backend_parsing_addwlan_event(int idevent, struct json_object* jsonparams) {
|
static int ac_backend_parsing_addwlan_event(struct json_object* jsonparams) {
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
static void ac_backend_parsing_updatewlan_event(int idevent, struct json_object* jsonparams) {
|
static int ac_backend_parsing_updatewlan_event(struct json_object* jsonparams) {
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
static void ac_backend_parsing_deletewlan_event(int idevent, struct json_object* jsonparams) {
|
static int ac_backend_parsing_deletewlan_event(struct json_object* jsonparams) {
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* */
|
||||||
|
static int ac_backend_soap_update_event(int idevent, int status) {
|
||||||
|
int result = 0;
|
||||||
|
char buffer[256];
|
||||||
|
struct ac_soap_request* request;
|
||||||
|
struct ac_http_soap_server* server;
|
||||||
|
|
||||||
|
ASSERT(g_ac_backend.soaprequest == NULL);
|
||||||
|
ASSERT(g_ac_backend.backendsessionid != NULL);
|
||||||
|
|
||||||
|
/* Get HTTP Soap Server */
|
||||||
|
server = *(struct ac_http_soap_server**)capwap_array_get_item_pointer(g_ac.availablebackends, g_ac_backend.activebackend);
|
||||||
|
|
||||||
|
/* Critical section */
|
||||||
|
capwap_lock_enter(&g_ac_backend.lock);
|
||||||
|
|
||||||
|
/* Build Soap Request */
|
||||||
|
if (!g_ac_backend.endthread) {
|
||||||
|
request = ac_soapclient_create_request("updateBackendEvent", SOAP_NAMESPACE_URI);
|
||||||
|
if (request) {
|
||||||
|
ac_soapclient_add_param(request, "xs:string", "idsession", g_ac_backend.backendsessionid);
|
||||||
|
ac_soapclient_add_param(request, "xs:int", "idevent", capwap_itoa(idevent, buffer));
|
||||||
|
ac_soapclient_add_param(request, "xs:int", "status", capwap_itoa(status, buffer));
|
||||||
|
g_ac_backend.soaprequest = ac_soapclient_prepare_request(request, server);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
capwap_lock_exit(&g_ac_backend.lock);
|
||||||
|
|
||||||
|
/* */
|
||||||
|
if (!g_ac_backend.soaprequest) {
|
||||||
|
if (request) {
|
||||||
|
ac_soapclient_free_request(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Send Request & Recv Response */
|
||||||
|
if (ac_soapclient_send_request(g_ac_backend.soaprequest, "")) {
|
||||||
|
struct ac_soap_response* response = ac_soapclient_recv_response(g_ac_backend.soaprequest);
|
||||||
|
if (response) {
|
||||||
|
ac_soapclient_free_response(response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Critical section */
|
||||||
|
capwap_lock_enter(&g_ac_backend.lock);
|
||||||
|
|
||||||
|
/* Free resource */
|
||||||
|
ac_soapclient_close_request(g_ac_backend.soaprequest, 1);
|
||||||
|
g_ac_backend.soaprequest = NULL;
|
||||||
|
|
||||||
|
capwap_lock_exit(&g_ac_backend.lock);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
@ -155,18 +233,23 @@ static void ac_backend_parsing_event(struct json_object* jsonitem) {
|
|||||||
if (action) {
|
if (action) {
|
||||||
jsonvalue = json_object_object_get(jsonitem, "Params");
|
jsonvalue = json_object_object_get(jsonitem, "Params");
|
||||||
if (jsonvalue && (json_object_get_type(jsonvalue) == json_type_object)) {
|
if (jsonvalue && (json_object_get_type(jsonvalue) == json_type_object)) {
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
/* Parsing params according to the action */
|
/* Parsing params according to the action */
|
||||||
if (!strcmp(action, "CloseWTPSession")) {
|
if (!strcmp(action, "CloseWTPSession")) {
|
||||||
ac_backend_parsing_closewtpsession_event(idevent, jsonvalue);
|
result = ac_backend_parsing_closewtpsession_event(jsonvalue);
|
||||||
} else if (!strcmp(action, "ResetWTP")) {
|
} else if (!strcmp(action, "ResetWTP")) {
|
||||||
ac_backend_parsing_resetwtp_event(idevent, jsonvalue);
|
result = ac_backend_parsing_resetwtp_event(jsonvalue);
|
||||||
} else if (!strcmp(action, "AddWLAN")) {
|
} else if (!strcmp(action, "AddWLAN")) {
|
||||||
ac_backend_parsing_addwlan_event(idevent, jsonvalue);
|
result = ac_backend_parsing_addwlan_event(jsonvalue);
|
||||||
} else if (!strcmp(action, "UpdateWLAN")) {
|
} else if (!strcmp(action, "UpdateWLAN")) {
|
||||||
ac_backend_parsing_updatewlan_event(idevent, jsonvalue);
|
result = ac_backend_parsing_updatewlan_event(jsonvalue);
|
||||||
} else if (!strcmp(action, "DeleteWLAN")) {
|
} else if (!strcmp(action, "DeleteWLAN")) {
|
||||||
ac_backend_parsing_deletewlan_event(idevent, jsonvalue);
|
result = ac_backend_parsing_deletewlan_event(jsonvalue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Notify result action */
|
||||||
|
ac_backend_soap_update_event(idevent, (result ? SOAP_EVENT_STATUS_RUNNING : SOAP_EVENT_STATUS_GENERIC_ERROR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,8 +262,8 @@ static int ac_backend_soap_join(int forcereset) {
|
|||||||
struct ac_soap_request* request;
|
struct ac_soap_request* request;
|
||||||
struct ac_http_soap_server* server;
|
struct ac_http_soap_server* server;
|
||||||
|
|
||||||
ASSERT(g_ac.backendsessionid == NULL);
|
|
||||||
ASSERT(g_ac_backend.soaprequest == NULL);
|
ASSERT(g_ac_backend.soaprequest == NULL);
|
||||||
|
ASSERT(g_ac_backend.backendsessionid == NULL);
|
||||||
|
|
||||||
/* Get HTTP Soap Server */
|
/* Get HTTP Soap Server */
|
||||||
server = *(struct ac_http_soap_server**)capwap_array_get_item_pointer(g_ac.availablebackends, g_ac_backend.activebackend);
|
server = *(struct ac_http_soap_server**)capwap_array_get_item_pointer(g_ac.availablebackends, g_ac_backend.activebackend);
|
||||||
@ -219,7 +302,7 @@ static int ac_backend_soap_join(int forcereset) {
|
|||||||
xmlChar* xmlResult = xmlNodeGetContent(response->xmlResponseReturn);
|
xmlChar* xmlResult = xmlNodeGetContent(response->xmlResponseReturn);
|
||||||
if (xmlStrlen(xmlResult)) {
|
if (xmlStrlen(xmlResult)) {
|
||||||
result = 1;
|
result = 1;
|
||||||
g_ac.backendsessionid = capwap_duplicate_string((const char*)xmlResult);
|
g_ac_backend.backendsessionid = capwap_duplicate_string((const char*)xmlResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
xmlFree(xmlResult);
|
xmlFree(xmlResult);
|
||||||
@ -247,9 +330,10 @@ static int ac_backend_soap_waitevent(void) {
|
|||||||
int result = -1;
|
int result = -1;
|
||||||
struct ac_soap_request* request;
|
struct ac_soap_request* request;
|
||||||
struct ac_http_soap_server* server;
|
struct ac_http_soap_server* server;
|
||||||
|
struct json_object* jsonroot = NULL;
|
||||||
|
|
||||||
ASSERT(g_ac_backend.soaprequest == NULL);
|
ASSERT(g_ac_backend.soaprequest == NULL);
|
||||||
ASSERT(g_ac.backendsessionid != NULL);
|
ASSERT(g_ac_backend.backendsessionid != NULL);
|
||||||
|
|
||||||
/* Get HTTP Soap Server */
|
/* Get HTTP Soap Server */
|
||||||
server = *(struct ac_http_soap_server**)capwap_array_get_item_pointer(g_ac.availablebackends, g_ac_backend.activebackend);
|
server = *(struct ac_http_soap_server**)capwap_array_get_item_pointer(g_ac.availablebackends, g_ac_backend.activebackend);
|
||||||
@ -261,7 +345,7 @@ static int ac_backend_soap_waitevent(void) {
|
|||||||
if (!g_ac_backend.endthread) {
|
if (!g_ac_backend.endthread) {
|
||||||
request = ac_soapclient_create_request("waitBackendEvent", SOAP_NAMESPACE_URI);
|
request = ac_soapclient_create_request("waitBackendEvent", SOAP_NAMESPACE_URI);
|
||||||
if (request) {
|
if (request) {
|
||||||
ac_soapclient_add_param(request, "xs:string", "idsession", g_ac.backendsessionid);
|
ac_soapclient_add_param(request, "xs:string", "idsession", g_ac_backend.backendsessionid);
|
||||||
g_ac_backend.soaprequest = ac_soapclient_prepare_request(request, server);
|
g_ac_backend.soaprequest = ac_soapclient_prepare_request(request, server);
|
||||||
|
|
||||||
/* Change result timeout */
|
/* Change result timeout */
|
||||||
@ -286,11 +370,9 @@ static int ac_backend_soap_waitevent(void) {
|
|||||||
if (response) {
|
if (response) {
|
||||||
/* Wait event result */
|
/* Wait event result */
|
||||||
if ((response->responsecode == HTTP_RESULT_OK) && response->xmlResponseReturn) {
|
if ((response->responsecode == HTTP_RESULT_OK) && response->xmlResponseReturn) {
|
||||||
int i;
|
|
||||||
int length;
|
int length;
|
||||||
char* json;
|
char* json;
|
||||||
xmlChar* xmlResult;
|
xmlChar* xmlResult;
|
||||||
struct json_object* jsonroot;
|
|
||||||
|
|
||||||
/* Decode base64 result */
|
/* Decode base64 result */
|
||||||
xmlResult = xmlNodeGetContent(response->xmlResponseReturn);
|
xmlResult = xmlNodeGetContent(response->xmlResponseReturn);
|
||||||
@ -312,25 +394,6 @@ static int ac_backend_soap_waitevent(void) {
|
|||||||
/* Parsing JSON result */
|
/* Parsing JSON result */
|
||||||
jsonroot = json_tokener_parse(json);
|
jsonroot = json_tokener_parse(json);
|
||||||
capwap_free(json);
|
capwap_free(json);
|
||||||
|
|
||||||
if (jsonroot) {
|
|
||||||
if (json_object_get_type(jsonroot) == json_type_array) {
|
|
||||||
/* Parsing every message into JSON result */
|
|
||||||
length = json_object_array_length(jsonroot);
|
|
||||||
for (i = 0; i < length; i++) {
|
|
||||||
struct json_object* jsonitem = json_object_array_get_idx(jsonroot, i);
|
|
||||||
if (jsonitem && (json_object_get_type(jsonitem) == json_type_object)) {
|
|
||||||
ac_backend_parsing_event(jsonitem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Parsing complete */
|
|
||||||
result = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free JSON */
|
|
||||||
json_object_put(jsonroot);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
@ -347,6 +410,29 @@ static int ac_backend_soap_waitevent(void) {
|
|||||||
|
|
||||||
capwap_lock_exit(&g_ac_backend.lock);
|
capwap_lock_exit(&g_ac_backend.lock);
|
||||||
|
|
||||||
|
/* Parsing JSON command after close event request */
|
||||||
|
if (jsonroot) {
|
||||||
|
if (json_object_get_type(jsonroot) == json_type_array) {
|
||||||
|
int i;
|
||||||
|
int length;
|
||||||
|
|
||||||
|
/* Parsing every message into JSON result */
|
||||||
|
length = json_object_array_length(jsonroot);
|
||||||
|
for (i = 0; i < length; i++) {
|
||||||
|
struct json_object* jsonitem = json_object_array_get_idx(jsonroot, i);
|
||||||
|
if (jsonitem && (json_object_get_type(jsonitem) == json_type_object)) {
|
||||||
|
ac_backend_parsing_event(jsonitem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Parsing complete */
|
||||||
|
result = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Free JSON */
|
||||||
|
json_object_put(jsonroot);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,7 +444,7 @@ static void ac_backend_soap_leave(void) {
|
|||||||
ASSERT(g_ac_backend.soaprequest == NULL);
|
ASSERT(g_ac_backend.soaprequest == NULL);
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
if (!g_ac_backend.backendstatus || !g_ac.backendsessionid) {
|
if (!g_ac_backend.backendstatus || !g_ac_backend.backendsessionid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,7 +457,7 @@ static void ac_backend_soap_leave(void) {
|
|||||||
/* Build Soap Request */
|
/* Build Soap Request */
|
||||||
request = ac_soapclient_create_request("leaveBackend", SOAP_NAMESPACE_URI);
|
request = ac_soapclient_create_request("leaveBackend", SOAP_NAMESPACE_URI);
|
||||||
if (request) {
|
if (request) {
|
||||||
ac_soapclient_add_param(request, "xs:string", "idsession", g_ac.backendsessionid);
|
ac_soapclient_add_param(request, "xs:string", "idsession", g_ac_backend.backendsessionid);
|
||||||
g_ac_backend.soaprequest = ac_soapclient_prepare_request(request, server);
|
g_ac_backend.soaprequest = ac_soapclient_prepare_request(request, server);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -426,8 +512,8 @@ static void ac_backend_run(void) {
|
|||||||
capwap_lock_enter(&g_ac_backend.backendlock);
|
capwap_lock_enter(&g_ac_backend.backendlock);
|
||||||
|
|
||||||
/* Lost session id */
|
/* Lost session id */
|
||||||
capwap_free(g_ac.backendsessionid);
|
capwap_free(g_ac_backend.backendsessionid);
|
||||||
g_ac.backendsessionid = NULL;
|
g_ac_backend.backendsessionid = NULL;
|
||||||
|
|
||||||
/* Change backend */
|
/* Change backend */
|
||||||
g_ac_backend.activebackend = (g_ac_backend.activebackend + 1) % g_ac.availablebackends->count;
|
g_ac_backend.activebackend = (g_ac_backend.activebackend + 1) % g_ac.availablebackends->count;
|
||||||
@ -471,9 +557,9 @@ static void ac_backend_run(void) {
|
|||||||
g_ac_backend.backendstatus = 0;
|
g_ac_backend.backendstatus = 0;
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
if (g_ac.backendsessionid) {
|
if (g_ac_backend.backendsessionid) {
|
||||||
capwap_free(g_ac.backendsessionid);
|
capwap_free(g_ac_backend.backendsessionid);
|
||||||
g_ac.backendsessionid = NULL;
|
g_ac_backend.backendsessionid = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
@ -499,19 +585,32 @@ int ac_backend_isconnect(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
struct ac_http_soap_server* ac_backend_gethttpsoapserver(void) {
|
struct ac_http_soap_request* ac_backend_createrequest_with_session(char* method, char* uri) {
|
||||||
struct ac_http_soap_server* result;
|
struct ac_http_soap_server* server;
|
||||||
|
struct ac_soap_request* request;
|
||||||
if (!ac_backend_isconnect()) {
|
struct ac_http_soap_request* soaprequest = NULL;
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get active connection only if Backend Management Thread is not trying to connect with a Backend Server */
|
/* Get active connection only if Backend Management Thread is not trying to connect with a Backend Server */
|
||||||
capwap_lock_enter(&g_ac_backend.backendlock);
|
capwap_lock_enter(&g_ac_backend.backendlock);
|
||||||
result = *(struct ac_http_soap_server**)capwap_array_get_item_pointer(g_ac.availablebackends, g_ac_backend.activebackend);
|
|
||||||
|
if (ac_backend_isconnect()) {
|
||||||
|
server = *(struct ac_http_soap_server**)capwap_array_get_item_pointer(g_ac.availablebackends, g_ac_backend.activebackend);
|
||||||
|
|
||||||
|
/* Build Soap Request */
|
||||||
|
request = ac_soapclient_create_request(method, SOAP_NAMESPACE_URI);
|
||||||
|
if (request) {
|
||||||
|
soaprequest = ac_soapclient_prepare_request(request, server);
|
||||||
|
if (soaprequest) {
|
||||||
|
ac_soapclient_add_param(request, "xs:string", "idsession", g_ac_backend.backendsessionid);
|
||||||
|
} else {
|
||||||
|
ac_soapclient_free_request(request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
capwap_lock_exit(&g_ac_backend.backendlock);
|
capwap_lock_exit(&g_ac_backend.backendlock);
|
||||||
|
|
||||||
return result;
|
return soaprequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
|
@ -4,6 +4,11 @@
|
|||||||
/* */
|
/* */
|
||||||
#define SOAP_NAMESPACE_URI "http://smartcapwap/namespace"
|
#define SOAP_NAMESPACE_URI "http://smartcapwap/namespace"
|
||||||
|
|
||||||
|
/* SOAP event status*/
|
||||||
|
#define SOAP_EVENT_STATUS_GENERIC_ERROR -1
|
||||||
|
#define SOAP_EVENT_STATUS_RUNNING 0
|
||||||
|
#define SOAP_EVENT_STATUS_COMPLETE 1
|
||||||
|
|
||||||
/* Reset notification */
|
/* Reset notification */
|
||||||
struct ac_notify_reset_t {
|
struct ac_notify_reset_t {
|
||||||
uint32_t vendor;
|
uint32_t vendor;
|
||||||
@ -16,6 +21,6 @@ void ac_backend_stop(void);
|
|||||||
|
|
||||||
/* */
|
/* */
|
||||||
int ac_backend_isconnect(void);
|
int ac_backend_isconnect(void);
|
||||||
struct ac_http_soap_server* ac_backend_gethttpsoapserver(void);
|
struct ac_http_soap_request* ac_backend_createrequest_with_session(char* method, char* uri);
|
||||||
|
|
||||||
#endif /* __AC_BACKEND_HEADER__ */
|
#endif /* __AC_BACKEND_HEADER__ */
|
||||||
|
@ -600,40 +600,19 @@ void ac_free_reference_last_response(struct ac_session_t* session) {
|
|||||||
struct ac_soap_response* ac_session_send_soap_request(struct ac_session_t* session, char* method, int numparam, ...) {
|
struct ac_soap_response* ac_session_send_soap_request(struct ac_session_t* session, char* method, int numparam, ...) {
|
||||||
int i;
|
int i;
|
||||||
va_list listparam;
|
va_list listparam;
|
||||||
struct ac_soap_request* request;
|
|
||||||
struct ac_http_soap_server* server;
|
|
||||||
struct ac_soap_response* response = NULL;
|
struct ac_soap_response* response = NULL;
|
||||||
|
|
||||||
ASSERT(session != NULL);
|
ASSERT(session != NULL);
|
||||||
ASSERT(session->soaprequest == NULL);
|
ASSERT(session->soaprequest == NULL);
|
||||||
ASSERT(method != NULL);
|
ASSERT(method != NULL);
|
||||||
|
|
||||||
/* Get HTTP Soap Server */
|
|
||||||
server = ac_backend_gethttpsoapserver();
|
|
||||||
if (!server) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Critical section */
|
|
||||||
capwap_lock_enter(&session->sessionlock);
|
|
||||||
|
|
||||||
ASSERT(g_ac.backendsessionid != NULL);
|
|
||||||
|
|
||||||
/* Build Soap Request */
|
/* Build Soap Request */
|
||||||
request = ac_soapclient_create_request(method, SOAP_NAMESPACE_URI);
|
capwap_lock_enter(&session->sessionlock);
|
||||||
if (request) {
|
session->soaprequest = ac_backend_createrequest_with_session(method, SOAP_NAMESPACE_URI);
|
||||||
ac_soapclient_add_param(request, "xs:string", "idsession", g_ac.backendsessionid);
|
|
||||||
session->soaprequest = ac_soapclient_prepare_request(request, server);
|
|
||||||
}
|
|
||||||
|
|
||||||
capwap_lock_exit(&session->sessionlock);
|
capwap_lock_exit(&session->sessionlock);
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
if (!session->soaprequest) {
|
if (!session->soaprequest) {
|
||||||
if (request) {
|
|
||||||
ac_soapclient_free_request(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -644,7 +623,7 @@ struct ac_soap_response* ac_session_send_soap_request(struct ac_session_t* sessi
|
|||||||
char* name = va_arg(listparam, char*);
|
char* name = va_arg(listparam, char*);
|
||||||
char* value = va_arg(listparam, char*);
|
char* value = va_arg(listparam, char*);
|
||||||
|
|
||||||
if (!ac_soapclient_add_param(request, type, name, value)) {
|
if (!ac_soapclient_add_param(session->soaprequest->request, type, name, value)) {
|
||||||
ac_soapclient_close_request(session->soaprequest, 1);
|
ac_soapclient_close_request(session->soaprequest, 1);
|
||||||
session->soaprequest = NULL;
|
session->soaprequest = NULL;
|
||||||
break;
|
break;
|
||||||
|
@ -79,6 +79,12 @@
|
|||||||
<wsdl:message name="getWTPConfigurationResponse">
|
<wsdl:message name="getWTPConfigurationResponse">
|
||||||
<wsdl:part name="return" type="xs:base64Binary"/>
|
<wsdl:part name="return" type="xs:base64Binary"/>
|
||||||
</wsdl:message>
|
</wsdl:message>
|
||||||
|
<wsdl:message name="updateBackendEvent">
|
||||||
|
<wsdl:part name="idsession" type="xs:string"/>
|
||||||
|
<wsdl:part name="idevent" type="xs:int"/>
|
||||||
|
<wsdl:part name="status" type="xs:int"/>
|
||||||
|
</wsdl:message>
|
||||||
|
<wsdl:message name="updateBackendEventResponse"/>
|
||||||
<wsdl:portType name="Presence">
|
<wsdl:portType name="Presence">
|
||||||
<wsdl:operation name="joinBackend">
|
<wsdl:operation name="joinBackend">
|
||||||
<wsdl:input message="tns:joinBackend"/>
|
<wsdl:input message="tns:joinBackend"/>
|
||||||
@ -94,6 +100,10 @@
|
|||||||
<wsdl:input message="tns:waitBackendEvent"/>
|
<wsdl:input message="tns:waitBackendEvent"/>
|
||||||
<wsdl:output message="tns:waitBackendEventResponse"/>
|
<wsdl:output message="tns:waitBackendEventResponse"/>
|
||||||
</wsdl:operation>
|
</wsdl:operation>
|
||||||
|
<wsdl:operation name="updateBackendEvent">
|
||||||
|
<wsdl:input message="tns:updateBackendEvent"/>
|
||||||
|
<wsdl:output message="tns:updateBackendEventResponse"/>
|
||||||
|
</wsdl:operation>
|
||||||
</wsdl:portType>
|
</wsdl:portType>
|
||||||
<wsdl:portType name="AccessControllerWTPSession">
|
<wsdl:portType name="AccessControllerWTPSession">
|
||||||
<wsdl:operation name="authorizeWTPSession">
|
<wsdl:operation name="authorizeWTPSession">
|
||||||
@ -163,6 +173,15 @@
|
|||||||
<soap:body use="literal"/>
|
<soap:body use="literal"/>
|
||||||
</wsdl:output>
|
</wsdl:output>
|
||||||
</wsdl:operation>
|
</wsdl:operation>
|
||||||
|
<wsdl:operation name="updateBackendEvent">
|
||||||
|
<soap:operation soapAction=""/>
|
||||||
|
<wsdl:input>
|
||||||
|
<soap:body use="literal"/>
|
||||||
|
</wsdl:input>
|
||||||
|
<wsdl:output>
|
||||||
|
<soap:body use="literal"/>
|
||||||
|
</wsdl:output>
|
||||||
|
</wsdl:operation>
|
||||||
</wsdl:binding>
|
</wsdl:binding>
|
||||||
<wsdl:binding name="AccessControllerWTPSession" type="tns:AccessControllerWTPSession">
|
<wsdl:binding name="AccessControllerWTPSession" type="tns:AccessControllerWTPSession">
|
||||||
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
|
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user