VM
FossilOrigin-Name: 4bbb8402b5110003c6d19908b6fa9b4a7a6b5903ba1fa691eb93a49aa0f089f4
This commit is contained in:
@ -3,179 +3,71 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
//#include <iwlib.h>
|
||||
|
||||
#include "capwap/sock.h"
|
||||
#include "capwap/conn.h"
|
||||
#include "capwap/dtls.h"
|
||||
#include "capwap/avltree.h"
|
||||
#include "capwap/cw_log.h"
|
||||
#include "capwap/capwap.h"
|
||||
#include "capwap/cw_util.h"
|
||||
#include "capwap/wtpinfo.h"
|
||||
#include "capwap/capwap_items.h"
|
||||
#include "capwap/conn.h"
|
||||
#include "capwap/cw_log.h"
|
||||
#include "capwap/dtls.h"
|
||||
|
||||
#include "wtp.h"
|
||||
#include "wtp_conf.h"
|
||||
|
||||
|
||||
|
||||
struct wtpinfo wtpinfo;
|
||||
|
||||
//int conf_rids[2];
|
||||
//int conf_rids_len[2];
|
||||
|
||||
//int responses = 0;
|
||||
|
||||
struct avltree * aclist =0;
|
||||
/** The one and only connection object */
|
||||
struct conn *the_conn;
|
||||
struct cw_actiondef capwap_actions;
|
||||
|
||||
|
||||
extern struct wpa_driver_ops *wpa_drivers[];
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <ifaddrs.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
//struct sockaddr conf_preferred_ac;
|
||||
|
||||
|
||||
|
||||
static void * drv_priv[2];
|
||||
static void * drv_glob[2];
|
||||
|
||||
const char * interfaces[]={
|
||||
"wlan0",
|
||||
"wlan1-1"
|
||||
};
|
||||
|
||||
/*static int drv_init()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
*/
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
|
||||
|
||||
wtp_main();
|
||||
}
|
||||
|
||||
|
||||
#include <time.h>
|
||||
|
||||
int pmu;
|
||||
|
||||
//#include <openssl/ssl.h>
|
||||
|
||||
int do_connect(void *priv,void *data)
|
||||
{
|
||||
ACIP * ip = (ACIP*)data;
|
||||
// char str[100];
|
||||
// sock_addrtostr((struct sockaddr*)&ip->ip,str,100);
|
||||
|
||||
sock_setport(&ip->ip,atoi(conf_control_port));
|
||||
// printf("Would connect to %s\n",str);
|
||||
|
||||
|
||||
printf("Sleep 5000\n");
|
||||
printf("slept\n");
|
||||
|
||||
int rc;
|
||||
rc = join(&ip->ip);
|
||||
if (!rc)
|
||||
return 1;
|
||||
|
||||
printf("Sleep after oin\n");
|
||||
printf("Go conf\n");
|
||||
// extern struct conn * get_conn();
|
||||
// extern join_state(struct conn * conn);
|
||||
// struct conn * conn = get_conn();
|
||||
//printf("Join conn = %p\n",conn);
|
||||
|
||||
// join_state(conn);
|
||||
|
||||
|
||||
// rc = join(&ip->ip);
|
||||
// if (!rc)
|
||||
// return 1;
|
||||
|
||||
rc = configure();
|
||||
|
||||
run (get_conn());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#include "capwap/bstr.h"
|
||||
|
||||
int wtp_main(const char *ad)
|
||||
{
|
||||
wtpconf_preinit();
|
||||
|
||||
if (!read_config("./wtp_uci.conf")){
|
||||
if (!read_config("./wtp_uci.conf")) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
cw_dbg_opt_level = conf_dbg_level;
|
||||
|
||||
wtpconf_init();
|
||||
|
||||
cw_dbg_opt_detail=DBG_DETAIL_ASC_DMP;
|
||||
|
||||
|
||||
cw_dbg_opt_detail = DBG_DETAIL_ASC_DMP;
|
||||
|
||||
|
||||
|
||||
|
||||
// cw_log_debug_level=6; //conf_debug_level;
|
||||
|
||||
// conf_dtls_psk="Tube";
|
||||
// conf_sslkeyfilename="../../ssl/wtp.key";
|
||||
// conf_sslcertfilename="../../ssl/wtp.crt";
|
||||
// conf_dtls_psk=0;
|
||||
|
||||
// conf_sslkeyfilename="../../ssl/ac_cisco.key";
|
||||
// conf_sslcertfilename="../../ssl/ac_cisco.pem";
|
||||
conf_sslkeypass="Tube";
|
||||
|
||||
|
||||
|
||||
#ifdef WITH_DTLS
|
||||
dtls_init();
|
||||
#endif
|
||||
|
||||
//drv_init();
|
||||
|
||||
the_conn = conn_create_noq(-1, NULL);
|
||||
struct conn *conn = the_conn;
|
||||
|
||||
|
||||
while (1){
|
||||
ACIPLIST * aciplist=0;
|
||||
int i;
|
||||
cw_register_actions_capwap_wtp(&capwap_actions);
|
||||
conn->actions = &capwap_actions;
|
||||
conn->remote = cw_itemstore_create();
|
||||
conn->local = cw_itemstore_create();
|
||||
|
||||
cw_dbg(DBG_CW_INFO,"Entering discovery state");
|
||||
|
||||
do {
|
||||
for (i=0; i<conf_ac_list_len; i++){
|
||||
if ((aciplist = do_discovery(conf_ac_list[i])))
|
||||
break;
|
||||
}
|
||||
}while (!aciplist);
|
||||
|
||||
// cw_log_debug0("Entering join state");
|
||||
if (!aciplist){
|
||||
// cw_log_debug0("Don't got any discovery response");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
aciplist_foreach(aciplist,do_connect,0);
|
||||
|
||||
aciplist_destroy(aciplist);
|
||||
cw_itemstore_t board_data = cw_itemstore_create();
|
||||
cw_itemstore_set_dword(board_data, CW_ITEM_WTP_BOARD_VENDOR, conf_vendor_id);
|
||||
|
||||
|
||||
}
|
||||
exit(0);
|
||||
cw_itemstore_set_bstrn(board_data, CW_ITEM_WTP_BOARD_MACADDRESS, conf_macaddress,
|
||||
conf_macaddress_len);
|
||||
cw_itemstore_set_bstr16n(board_data, CW_ITEM_WTP_BOARD_SERIALNO,
|
||||
bstr_data(conf_serial_no), bstr_len(conf_serial_no));
|
||||
|
||||
|
||||
|
||||
|
||||
cw_itemstore_set_avltree(conn->local, CW_ITEM_WTP_BOARD_DATA, board_data);
|
||||
|
||||
discovery();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
struct conn *get_conn()
|
||||
{
|
||||
return the_conn;
|
||||
}
|
||||
|
Reference in New Issue
Block a user