2015-03-28 12:51:34 +01:00
|
|
|
|
2018-04-09 09:27:38 +02:00
|
|
|
|
|
|
|
|
2016-03-03 19:51:42 +01:00
|
|
|
#include "cw/capwap.h"
|
|
|
|
#include "cw/conn.h"
|
2016-03-05 10:31:09 +01:00
|
|
|
#include "cw/log.h"
|
2018-04-09 09:27:38 +02:00
|
|
|
#include "cw/dbg.h"
|
2016-03-05 10:31:09 +01:00
|
|
|
|
2015-03-23 07:48:27 +01:00
|
|
|
#include "wtp_interface.h"
|
2022-08-19 22:23:55 +02:00
|
|
|
#include "wtp.h"
|
2014-07-19 13:25:42 +02:00
|
|
|
|
2016-03-07 18:56:02 +01:00
|
|
|
|
2022-08-17 18:41:17 +02:00
|
|
|
static int config_cb(struct cw_ElemHandlerParams * params, uint8_t * elems_ptr, int elems_len)
|
|
|
|
{
|
2022-08-19 22:23:55 +02:00
|
|
|
cw_dbg(DBG_X,"*** Configurations Status Response received ****");
|
2022-08-21 00:53:41 +02:00
|
|
|
cw_cfg_copy(params->cfg, params->conn->global_cfg,DBG_CFG_UPDATES,"GlbalCfg");
|
2022-08-19 22:23:55 +02:00
|
|
|
cw_cfg_save(bootcfg.cfgfilename, params->conn->global_cfg,
|
|
|
|
"#\n# This file is igenerated by WAT\n# If you edit this, your cahnges might be overwritten\n#\n");
|
|
|
|
cw_dbg(DBG_X,"*** Cnofig Saved ***");
|
|
|
|
|
2022-08-17 18:41:17 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-10 13:16:09 +02:00
|
|
|
int configure(struct cw_Conn * conn)
|
2018-04-09 09:27:38 +02:00
|
|
|
{
|
|
|
|
char sockbuff[SOCK_ADDR_BUFSIZE];
|
|
|
|
|
2022-08-17 18:41:17 +02:00
|
|
|
|
|
|
|
cw_conn_set_msg_cb(conn,CAPWAP_MSG_CONFIGURATION_STATUS_RESPONSE,config_cb);
|
2018-04-09 09:27:38 +02:00
|
|
|
|
|
|
|
int rc;
|
2022-08-21 00:53:41 +02:00
|
|
|
cw_cfg_copy(conn->global_cfg,conn->update_cfg,0,"");
|
2018-04-09 09:27:38 +02:00
|
|
|
rc = cw_send_request(conn, CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST);
|
2022-08-19 22:23:55 +02:00
|
|
|
cw_cfg_clear(conn->update_cfg);
|
2016-03-07 18:56:02 +01:00
|
|
|
|
2018-03-09 15:38:21 +01:00
|
|
|
if (!cw_result_is_ok(rc)) {
|
2016-03-05 10:31:09 +01:00
|
|
|
if (rc > 0) {
|
2016-03-05 11:22:10 +01:00
|
|
|
cw_log(LOG_ERR,
|
|
|
|
"Error sending Configuration Status Request to AC at %s, AC said: %d - %s.",
|
2018-04-09 09:27:38 +02:00
|
|
|
sock_addr2str(&conn->addr,sockbuff), rc, cw_strerror(rc));
|
2015-03-29 01:55:06 +01:00
|
|
|
|
2016-03-05 10:31:09 +01:00
|
|
|
} else {
|
2016-03-05 11:22:10 +01:00
|
|
|
cw_log(LOG_ERR,
|
|
|
|
"Error sending Configuration Status Request to AC at %s: %d - %s.",
|
2018-04-09 09:27:38 +02:00
|
|
|
sock_addr2str(&conn->addr,sockbuff), errno, cw_strerror(rc));
|
2016-03-05 10:31:09 +01:00
|
|
|
}
|
2016-03-05 22:32:52 +01:00
|
|
|
|
2018-04-09 09:27:38 +02:00
|
|
|
/*cfg_to_json();*/
|
2016-03-05 10:31:09 +01:00
|
|
|
return 0;
|
|
|
|
}
|
2018-04-18 09:40:37 +02:00
|
|
|
|
2016-03-05 10:31:09 +01:00
|
|
|
return 1;
|
2014-07-19 13:25:42 +02:00
|
|
|
}
|