Some work on WTP.
FossilOrigin-Name: 6ec1370311c5b83dc78adbfb75f8241e0916b171a9c0f939d24ec28ebdf908c8
This commit is contained in:
@ -95,6 +95,7 @@ OBJS += join.o
|
||||
OBJS += run.o
|
||||
OBJS += sulking.o
|
||||
OBJS += configure.o
|
||||
OBJS += changestate.o
|
||||
OBJS += $(CONFOBJS)
|
||||
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "jsmn.h"
|
||||
#include "wtp.h"
|
||||
#include "capwap/bstr.h"
|
||||
#include "capwap/radio.h"
|
||||
|
||||
struct cw_itemdef {
|
||||
int item_id;
|
||||
@ -95,6 +96,41 @@ printf("GET BYTE\n");
|
||||
}
|
||||
|
||||
|
||||
int vendorstr_local(struct cw_itemdef *idef,char *js, jsmntok_t *t)
|
||||
{
|
||||
int item_id = idef->item_id;
|
||||
struct conn * conn = get_conn();
|
||||
|
||||
*(js+t->end)=0;
|
||||
char *str = js+t->start;
|
||||
if (t->type != JSMN_ARRAY || t->type!=2){
|
||||
printf("Error: No ARRAY or to short: %s\n",str);
|
||||
exit(1);
|
||||
|
||||
}
|
||||
// *(js+t->end)=0;
|
||||
|
||||
char * val = js+(t+1)->start;
|
||||
*(js+(t+1)->end)=0;
|
||||
printf("Val: %s\n",val);
|
||||
|
||||
uint32_t vendor_id = atoi(val);
|
||||
|
||||
str = (uint8_t*)js+(t+2)->start;
|
||||
|
||||
*((t+2)->end+js)=0;
|
||||
bstr16_t v = bstr16cfgstr(str);
|
||||
|
||||
printf("Vendor: %d %s\n",vendor_id,str);
|
||||
|
||||
cw_itemstore_set_vendorstr(conn->local,item_id,vendor_id,bstr16_data(v),bstr16_len(v));
|
||||
free(v);
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -116,6 +152,31 @@ int bstr16_local(struct cw_itemdef *idef,char *js, jsmntok_t *t)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bstr_local(struct cw_itemdef *idef,char *js, jsmntok_t *t)
|
||||
{
|
||||
int item_id = idef->item_id;
|
||||
struct conn * conn = get_conn();
|
||||
|
||||
*(js+t->end)=0;
|
||||
char *str = js+t->start;
|
||||
if (t->type != JSMN_STRING){
|
||||
printf("Error: No Str: %s\n",str);
|
||||
return 1;
|
||||
|
||||
}
|
||||
// *(js+t->end)=0;
|
||||
printf("Set str: %d %s\n", item_id,str);
|
||||
|
||||
bstr16_t v = bstr16cfgstr(str);
|
||||
|
||||
cw_itemstore_set_bstrn(conn->local,item_id,bstr16_data(v),bstr16_len(v)); //(uint8_t*)js+t->start,t->end-t->start);
|
||||
free (v);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int wtp_board_data_local(struct cw_itemdef *idef,char *js, jsmntok_t *t);
|
||||
|
||||
|
||||
@ -123,13 +184,17 @@ int wtp_board_data_local(struct cw_itemdef *idef,char *js, jsmntok_t *t);
|
||||
|
||||
|
||||
struct cw_itemdef general_cfg[] = {
|
||||
{CW_ITEM_WTP_HARDWARE_VERSION, "hardware_version",bstr16_local},
|
||||
{CW_ITEM_WTP_SOFTWARE_VERSION, "software_version",bstr16_local},
|
||||
{CW_ITEM_AC_NAME, "ac_name",bstr16_local},
|
||||
{CW_ITEM_WTP_NAME, "wtp_name",bstr16_local},
|
||||
{CW_ITEM_WTP_HARDWARE_VERSION, "hardware_version",vendorstr_local},
|
||||
{CW_ITEM_WTP_SOFTWARE_VERSION, "software_version",vendorstr_local},
|
||||
{CW_ITEM_WTP_BOARD_MODELNO, "modelno",bstr16_local},
|
||||
{CW_ITEM_WTP_BOARD_DATA,"wtp_board_data",wtp_board_data_local},
|
||||
{CW_ITEM_WTP_FRAME_TUNNEL_MODE,"frame_tunnel_mode",byte_local},
|
||||
{CW_ITEM_WTP_MAC_TYPE,"mac_type",byte_local},
|
||||
{CW_ITEM_LOCATION_DATA,"location_data",bstr16_local},
|
||||
{CW_ITEM_WTP_GROUP_NAME,"group_name",bstr16_local},
|
||||
{CW_RADIO_BSSID,"bssid",bstr_local},
|
||||
|
||||
{0, 0, 0}
|
||||
};
|
||||
@ -289,8 +354,9 @@ int setup_conf(struct conn *conn)
|
||||
|
||||
|
||||
|
||||
void dbg_istore_dmp(cw_itemstore_t s);
|
||||
|
||||
|
||||
dbg_istore_dmp(conn->local);
|
||||
|
||||
|
||||
|
||||
|
@ -2,22 +2,27 @@
|
||||
|
||||
|
||||
"dbg":[o1,o2,o3],
|
||||
"Tube" : "tabbe",
|
||||
|
||||
"hardware_version": "12345",
|
||||
"software_version": "98765",
|
||||
"hardware_version": ["4232704",".x01000000"],
|
||||
"software_version": ["4232704",".x08006E00"],
|
||||
|
||||
"comment": "** The following is debug info **",
|
||||
"location_data": "Berlin",
|
||||
"location_data": "China",
|
||||
|
||||
"frame_tunnel_mode": "4",
|
||||
"mac_type": 2,
|
||||
|
||||
|
||||
"group_name" : "XGroup",
|
||||
|
||||
"wtp_name" : "TubeWTP",
|
||||
"ac_name" : "LAC_AC",
|
||||
|
||||
"bssid": ".x003a9902fac0",
|
||||
|
||||
"wtp_board_data" : {
|
||||
"vendor_id": 4232704,
|
||||
"model_no": "Moodle",
|
||||
"serial_no": "2045",
|
||||
"vendor_id": "4232704",
|
||||
"model_no": "AIR-LAP1131AG-E-K9",
|
||||
"serial_no": "2045"
|
||||
},
|
||||
|
||||
|
||||
@ -36,6 +41,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
"radios": {
|
||||
"1": {
|
||||
"domain"
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
#include <stdlib.h> //Tube
|
||||
|
||||
#include "capwap/capwap.h"
|
||||
#include "capwap/conn.h"
|
||||
|
@ -64,7 +64,7 @@ cw_aciplist_t cw_select_ac(struct conn *conn, cw_itemstore_t dis)
|
||||
avliter_foreach(&i){
|
||||
cw_itemstore_t ac = ((cw_item_t *) (avliter_get(&i)))->data;
|
||||
|
||||
char *ac_name = cw_itemstore_get_str(ac, CW_ITEM_AC_NAME);
|
||||
char *ac_name = cw_itemstore_get_str(ac, CW_ITEM_AC_NAME,NULL);
|
||||
|
||||
int prio = 256;
|
||||
if (ac_name) {
|
||||
|
@ -14,6 +14,80 @@
|
||||
|
||||
#include "wtp_conf.h"
|
||||
|
||||
|
||||
#include "capwap/timer.h"
|
||||
|
||||
|
||||
|
||||
#include "capwap/capwap.h"
|
||||
#include "capwap/conn.h"
|
||||
#include "wtp_interface.h"
|
||||
|
||||
|
||||
int run()
|
||||
{
|
||||
|
||||
|
||||
|
||||
struct conn *conn = get_conn();
|
||||
conn->capwap_state = CW_STATE_RUN;
|
||||
|
||||
do {
|
||||
time_t timer = cw_timer_start(25);
|
||||
int rc;
|
||||
|
||||
|
||||
|
||||
|
||||
while (!cw_timer_timeout(timer) && conn->capwap_state == CW_STATE_RUN) {
|
||||
rc = cw_read_messages(conn);
|
||||
if (rc < 0 && errno == EAGAIN) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( !cw_rcok(rc))
|
||||
break;
|
||||
|
||||
}
|
||||
if (rc<0 && errno == EAGAIN){
|
||||
rc = cw_send_request(conn,CW_MSG_ECHO_REQUEST);
|
||||
|
||||
if (!cw_rcok(rc)) {
|
||||
cw_log(LOG_ERR,"Error in run state: %d %s",rc,cw_strrc(rc));
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!cw_rcok(rc)) {
|
||||
cw_log(LOG_ERR,"Error in run state: %d %s",rc,cw_strrc(rc));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} while (conn->capwap_state == CW_STATE_RUN);
|
||||
|
||||
|
||||
|
||||
// int rc = cw_send_request(conn,CW_MSG_CHANGE_STATE_EVENT_REQUEST);
|
||||
|
||||
// if ( !cw_rcok(rc) ) {
|
||||
// cw_strresult(rc);
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
static int echo_interval_timer;
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include "capwap/log.h"
|
||||
#include "capwap/dtls.h"
|
||||
#include "capwap/acpriolist.h"
|
||||
#include "capwap/capwap_80211.h"
|
||||
#include "capwap/radio.h"
|
||||
|
||||
#include "wtp.h"
|
||||
#include "wtp_conf.h"
|
||||
@ -63,8 +65,26 @@ int main()
|
||||
the_conn = conn_create_noq(-1, NULL);
|
||||
struct conn *conn = the_conn;
|
||||
|
||||
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);
|
||||
|
||||
|
||||
|
||||
|
||||
cw_register_actions_cipwap_wtp(&capwap_actions);
|
||||
cw_register_actions_capwap_80211_wtp(&capwap_actions);
|
||||
|
||||
////cw_register_actions_capwap_80211_wtp(&capwap_actions);
|
||||
|
||||
conn->actions = &capwap_actions;
|
||||
@ -101,7 +121,7 @@ int main()
|
||||
cw_itemstore_set_avltree(conn->local,CW_ITEM_AC_PRIO_LIST,acprios);
|
||||
|
||||
cw_itemstore_set_str(conn->local,CW_ITEM_LOCATION_DATA,"Berlin");
|
||||
cw_itemstore_set_str(conn->local,CW_ITEM_WTP_NAME,"WTP Tube");
|
||||
// cw_itemstore_set_str(conn->local,CW_ITEM_WTP_NAME,"WTP Tube");
|
||||
|
||||
cw_itemstore_set_byte(conn->local,CW_ITEM_WTP_MAC_TYPE,0);
|
||||
cw_itemstore_set_byte(conn->local,CW_ITEM_WTP_FRAME_TUNNEL_MODE,0);
|
||||
@ -111,6 +131,9 @@ int main()
|
||||
discovery();
|
||||
join();
|
||||
configure();
|
||||
changestate();
|
||||
run();
|
||||
|
||||
//image_update();
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user