actube/src/wtp/wtp_interface.c

101 lines
1.9 KiB
C
Raw Normal View History

#include <string.h>
#include "capwap/wtpinfo.h"
#include "capwap/acinfo.h"
#include "capwap/conn.h"
#include "capwap/capwap_ieee80211.h"
#include "wtp_conf.h"
#include "wtp_interface.h"
struct wtpinfo * get_wtpinfo()
{
struct wtpinfo * wtpinfo;
wtpinfo=malloc(sizeof(struct wtpinfo));
memset(wtpinfo,0,sizeof(struct wtpinfo));
wtpinfo->name = conf_wtpname;
wtpinfo->location = (uint8_t*)"default location";
wtpinfo->max_radios=wtpdrv_get_num_radios();
int i;
for (i=0; i<wtpdrv_get_num_radios(); i++){
wtpdrv_get_radioinfo(i,&(wtpinfo->radioinfo[i]));
}
wtpinfo->encryption_cap=1;
wtpinfo->serial_no=conf_serial_no;
wtpinfo->vendor_id=conf_vendor_id;
wtpinfo->model_no=conf_model_no;
wtpinfo->bootloader_version="";
wtpinfo->bootloader_vendor_id=CW_VENDOR_ID_CISCO;
wtpinfo->hardware_version="\0\0";
wtpinfo->hardware_vendor_id=CW_VENDOR_ID_CISCO;
wtpinfo->software_version=conf_software_version;
wtpinfo->hardware_version=conf_hardware_version;
wtpinfo->bootloader_version=conf_bootloader_version;
wtpinfo->board_id = conf_board_id;
wtpinfo->board_revision = conf_board_revision;
wtpinfo->software_vendor_id=CW_VENDOR_ID_CISCO;
wtpinfo->macaddress=conf_macaddress;
wtpinfo->macaddress_len=conf_macaddress_len;
wtpinfo->mac_type=0;
// wtpinfo->session_id = malloc(8);
// wtpinfo->session_id_len = cw_rand(wtpinfo->session_id,8);
uint8_t sessid[4];
int sidl = cw_rand(sessid,4);
wtpinfo->session_id = bstr_create(sessid,sidl);
wtpinfo->frame_tunnel_mode=1;
return wtpinfo;
}
void destroy_wtpinfo(struct wtpinfo* wtpinfo)
{
}
ACIPLIST * order_aciplist(ACIPLIST *aciplistin)
{
// ACIPLIST * aciplist = aciplist_create();
// aciplist_foreach(aciplistin);
return aciplistin;
}
static struct conn * conn=0;
struct conn * get_conn()
{
if (!conn){
conn = conn_create_noq(-1,0);
if (conf_mtu){
conn->mtu=conf_mtu;
}
conn->mtu_discovery=conf_mtu_discovery;
}
return conn;
}