2014-07-11 22:12:11 +02:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
|
2015-04-07 07:42:36 +02:00
|
|
|
#include "capwap/capwap.h"
|
2015-04-18 12:02:58 +02:00
|
|
|
#include "capwap/cipwap.h"
|
2015-04-07 07:42:36 +02:00
|
|
|
#include "capwap/capwap_items.h"
|
2014-07-11 22:12:11 +02:00
|
|
|
#include "capwap/conn.h"
|
2015-04-10 17:52:01 +02:00
|
|
|
#include "capwap/log.h"
|
2015-04-07 07:42:36 +02:00
|
|
|
#include "capwap/dtls.h"
|
2015-04-10 17:14:55 +02:00
|
|
|
#include "capwap/acpriolist.h"
|
2015-04-19 16:44:20 +02:00
|
|
|
#include "capwap/capwap_80211.h"
|
|
|
|
#include "capwap/radio.h"
|
2014-07-11 22:12:11 +02:00
|
|
|
|
|
|
|
#include "wtp.h"
|
|
|
|
#include "wtp_conf.h"
|
|
|
|
|
2015-04-11 19:00:51 +02:00
|
|
|
#include "capwap/dbg.h"
|
|
|
|
|
2015-04-14 07:42:23 +02:00
|
|
|
#include "jsmn.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-07-11 22:12:11 +02:00
|
|
|
|
|
|
|
|
2015-04-07 07:42:36 +02:00
|
|
|
/** The one and only connection object */
|
|
|
|
struct conn *the_conn;
|
|
|
|
struct cw_actiondef capwap_actions;
|
2014-07-11 22:12:11 +02:00
|
|
|
|
|
|
|
|
2015-04-18 11:20:24 +02:00
|
|
|
bstr_t get_base_rmac()
|
|
|
|
{
|
|
|
|
// static uint8_t rm[8]={0x00,0x4a,0x99,0x02,0xfa,0xc0};
|
2014-07-11 22:12:11 +02:00
|
|
|
|
2015-04-18 11:20:24 +02:00
|
|
|
static uint8_t rm[8]={0x00,0x3a,0x99,0x02,0xfa,0xc0};
|
|
|
|
return bstr_create(rm,6);
|
|
|
|
}
|
2015-04-14 07:42:23 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2014-07-11 22:12:11 +02:00
|
|
|
int main()
|
|
|
|
{
|
2015-03-30 07:56:42 +02:00
|
|
|
|
2015-04-19 23:27:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2014-07-22 07:11:57 +02:00
|
|
|
wtpconf_preinit();
|
|
|
|
|
2015-04-07 07:42:36 +02:00
|
|
|
if (!read_config("./wtp_uci.conf")) {
|
2014-07-11 22:12:11 +02:00
|
|
|
return 1;
|
|
|
|
}
|
2014-07-22 07:11:57 +02:00
|
|
|
|
2015-04-12 10:19:02 +02:00
|
|
|
// cw_dbg_opt_level = conf_dbg_level;
|
2015-02-03 08:23:03 +01:00
|
|
|
|
2014-07-22 07:11:57 +02:00
|
|
|
wtpconf_init();
|
|
|
|
|
2015-04-11 19:00:51 +02:00
|
|
|
cw_dbg_opt_display = DBG_DISP_ASC_DMP | DBG_DISP_COLORS;
|
|
|
|
|
|
|
|
|
2014-09-14 22:46:14 +02:00
|
|
|
|
2015-04-19 23:27:44 +02:00
|
|
|
mbag_t b = mbag_create();
|
|
|
|
|
|
|
|
mbag_set_byte(b,1,99);
|
|
|
|
mbag_set_avltree(b,2,mbag_create());
|
|
|
|
mavl_destroy(b);
|
|
|
|
|
2014-09-14 22:46:14 +02:00
|
|
|
|
2015-04-07 07:42:36 +02:00
|
|
|
dtls_init();
|
2015-02-01 16:55:45 +01:00
|
|
|
|
2015-04-07 07:42:36 +02:00
|
|
|
the_conn = conn_create_noq(-1, NULL);
|
|
|
|
struct conn *conn = the_conn;
|
2014-08-03 21:42:37 +02:00
|
|
|
|
2015-04-19 16:44:20 +02:00
|
|
|
conn->radios = mbag_create();
|
|
|
|
mbag_set_mbag(conn->radios,0,mbag_create());
|
|
|
|
mbag_set_mbag(conn->radios,1,mbag_create());
|
|
|
|
// mbag_set_mbag(conn->radios,0xff,mbag_create());
|
|
|
|
|
|
|
|
|
|
|
|
mbag_t r;
|
|
|
|
r = mbag_get_mbag(conn->radios,0,NULL);
|
|
|
|
mbag_set_dword(r,CW_RADIO_TYPE,1);
|
|
|
|
r = mbag_get_mbag(conn->radios,1,NULL);
|
|
|
|
mbag_set_dword(r,CW_RADIO_TYPE,2);
|
|
|
|
// r = mbag_get_mbag(conn->radios,1,NULL);
|
|
|
|
// mbag_set_dword(r,CW_RADIO_TYPE,1);
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-08-03 21:42:37 +02:00
|
|
|
|
2015-04-18 12:02:58 +02:00
|
|
|
cw_register_actions_cipwap_wtp(&capwap_actions);
|
2015-04-19 16:44:20 +02:00
|
|
|
cw_register_actions_capwap_80211_wtp(&capwap_actions);
|
|
|
|
|
2015-04-10 17:14:55 +02:00
|
|
|
////cw_register_actions_capwap_80211_wtp(&capwap_actions);
|
|
|
|
|
2015-04-07 07:42:36 +02:00
|
|
|
conn->actions = &capwap_actions;
|
2015-04-19 23:27:44 +02:00
|
|
|
conn->outgoing = mbag_create();
|
|
|
|
conn->incomming = mbag_create();
|
|
|
|
conn->local = mbag_create();
|
2015-04-18 11:20:24 +02:00
|
|
|
conn->base_rmac=get_base_rmac();
|
|
|
|
conn->capwap_mode = CW_MODE_CISCO;
|
2014-08-03 21:42:37 +02:00
|
|
|
|
2015-04-19 23:27:44 +02:00
|
|
|
conn->config=mbag_create();
|
2015-04-14 07:42:23 +02:00
|
|
|
|
2015-04-17 07:38:44 +02:00
|
|
|
setup_conf(conn);
|
2015-04-14 07:42:23 +02:00
|
|
|
|
|
|
|
|
2015-04-18 11:20:24 +02:00
|
|
|
/*
|
2015-04-19 23:27:44 +02:00
|
|
|
mbag_t board_data = mbag_itemstore_create();
|
|
|
|
mbag_set_dword(board_data, CW_ITEM_WTP_BOARD_VENDOR, conf_vendor_id);
|
2014-07-11 22:12:11 +02:00
|
|
|
|
|
|
|
|
2015-04-19 23:27:44 +02:00
|
|
|
mbag_set_bstrn(board_data, CW_ITEM_WTP_BOARD_MACADDRESS, conf_macaddress,
|
2015-04-07 07:42:36 +02:00
|
|
|
conf_macaddress_len);
|
2015-04-19 23:27:44 +02:00
|
|
|
mbag_set_bstr16n(board_data, CW_ITEM_WTP_BOARD_SERIALNO,
|
2015-04-07 07:42:36 +02:00
|
|
|
bstr_data(conf_serial_no), bstr_len(conf_serial_no));
|
2014-07-11 22:12:11 +02:00
|
|
|
|
2015-04-18 11:20:24 +02:00
|
|
|
*/
|
2015-04-14 07:42:23 +02:00
|
|
|
|
2014-07-11 22:12:11 +02:00
|
|
|
|
|
|
|
|
2015-04-19 23:27:44 +02:00
|
|
|
// mbag_set_avltree(conn->outgoing, CW_ITEM_WTP_BOARD_DATA, board_data);
|
2015-04-10 17:14:55 +02:00
|
|
|
|
|
|
|
cw_acpriolist_t acprios = cw_acpriolist_create();
|
|
|
|
cw_acpriolist_set(acprios,"Master AC",strlen("Master AC"),1);
|
|
|
|
cw_acpriolist_set(acprios,"AC8new",strlen("AC8new"),12);
|
|
|
|
|
2015-04-19 23:27:44 +02:00
|
|
|
mbag_set_avltree(conn->local,CW_ITEM_AC_PRIO_LIST,acprios);
|
2015-04-10 17:14:55 +02:00
|
|
|
|
2015-04-19 23:27:44 +02:00
|
|
|
mbag_set_str(conn->local,CW_ITEM_LOCATION_DATA,"Berlin");
|
|
|
|
// mbag_set_str(conn->local,CW_ITEM_WTP_NAME,"WTP Tube");
|
2015-04-10 17:14:55 +02:00
|
|
|
|
2015-04-19 23:27:44 +02:00
|
|
|
mbag_set_byte(conn->local,CW_ITEM_WTP_MAC_TYPE,0);
|
|
|
|
mbag_set_byte(conn->local,CW_ITEM_WTP_FRAME_TUNNEL_MODE,0);
|
2015-04-11 19:00:51 +02:00
|
|
|
|
2014-07-11 22:12:11 +02:00
|
|
|
|
2015-04-12 19:19:29 +02:00
|
|
|
the_conn->strict_capwap=0;
|
2015-04-07 07:42:36 +02:00
|
|
|
discovery();
|
2015-04-10 17:14:55 +02:00
|
|
|
join();
|
2015-04-18 12:02:58 +02:00
|
|
|
configure();
|
2015-04-19 16:44:20 +02:00
|
|
|
changestate();
|
|
|
|
run();
|
|
|
|
|
2015-04-18 11:20:24 +02:00
|
|
|
//image_update();
|
2014-07-11 22:12:11 +02:00
|
|
|
|
|
|
|
|
2015-04-07 07:42:36 +02:00
|
|
|
}
|
2014-07-11 22:12:11 +02:00
|
|
|
|
|
|
|
|
2015-04-07 07:42:36 +02:00
|
|
|
struct conn *get_conn()
|
|
|
|
{
|
|
|
|
return the_conn;
|
2014-07-11 22:12:11 +02:00
|
|
|
}
|