handlers for header_len and write_headr in conn

FossilOrigin-Name: 672de93a2c0d038b6d8c9104a8e0b4fdacbe7f181485ee2f185cb81626876391
This commit is contained in:
7u83@mail.ru
2018-04-09 07:27:38 +00:00
parent ad07cbcf1c
commit 7bedc7659b
19 changed files with 167 additions and 64 deletions

View File

@ -32,7 +32,7 @@ endif
#SRC=$(wildcard *.c)
SRC=wtp_main.c discovery.c join.c
SRC=wtp_main.c discovery.c join.c configure.c
OBJS=$(patsubst %.c,%.o,$(SRC))
OBJS:=$(patsubst %.o,$(OBJDIR)/%.o,$(OBJS))

View File

@ -1,46 +1,37 @@
#include "cw/capwap.h"
#include "cw/conn.h"
#include "cw/log.h"
#include "cw/mbag.h"
#include "cw/capwap_items.h"
#include "cw/dbg.h"
#include "wtp_interface.h"
#include "cfg.h"
int configure()
int configure(struct conn * conn)
{
struct conn *conn = get_conn();
// mbag_del_all(conn->incomming);
conn->incomming=conn->config;
mbag_del(conn->incomming,CW_ITEM_RESULT_CODE);
mbag_set_str(conn->local,CW_ITEM_AC_NAME,"abc");
// mbag_set_byte(conn->config,CW_ITEM_WTP_MAC_TYPE,WTP_MAC_TYPE_BOTH);
// mbag_set_byte(conn->config,CW_ITEM_WTP_MAC_TYPE,CAPWAP_WTP_MAC_TYPE_SPLIT);
/* for config status request send the whole config */
mbag_t radios_upd = conn->radios_upd;
conn->radios_upd=conn->radios;
int rc = cw_send_request(conn, CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST);
conn->radios_upd=radios_upd;
char sockbuff[SOCK_ADDR_BUFSIZE];
cw_dbg_ktv_dump(conn->local_cfg,DBG_INFO,"KTV DUMP ----------------","LOCAL:", "DUMP done -------");
int rc;
rc = cw_send_request(conn, CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST);
if (!cw_result_is_ok(rc)) {
if (rc > 0) {
cw_log(LOG_ERR,
"Error sending Configuration Status Request to AC at %s, AC said: %d - %s.",
sock_addr2str(&conn->addr), rc, cw_strerror(rc));
sock_addr2str(&conn->addr,sockbuff), rc, cw_strerror(rc));
} else {
cw_log(LOG_ERR,
"Error sending Configuration Status Request to AC at %s: %d - %s.",
sock_addr2str(&conn->addr), errno, cw_strerror(rc));
sock_addr2str(&conn->addr,sockbuff), errno, cw_strerror(rc));
}
cfg_to_json();
/*cfg_to_json();*/
return 0;
}

View File

@ -208,7 +208,11 @@ int main (int argc, char **argv)
}
*/
join(conn,&dis);
mavl_merge(conn->local_cfg,conn->remote_cfg);
configure(conn);
cw_discovery_free_results(&dis);
return (EXIT_SUCCESS);