WTP work...

FossilOrigin-Name: c770fa37c379da9fb78feebb463e2843ba8179e3f9026687dcfb44b4c7c47388
This commit is contained in:
7u83@mail.ru 2015-04-18 09:20:24 +00:00
parent e963edb4ce
commit 5a80bdecea
17 changed files with 306 additions and 80 deletions

View File

@ -633,6 +633,8 @@ extern int cw_readmsg_configuration_update_request(uint8_t * elems, int elems_le
#define cw_set_hdr_preamble(th,v) ((*th)=v) #define cw_set_hdr_preamble(th,v) ((*th)=v)
/** /**
* Set the HLEN field of a CAWAP Header * Set the HLEN field of a CAWAP Header
* @param th pointer to the header * @param th pointer to the header
@ -726,6 +728,32 @@ static inline int cw_get_hdr_msg_total_len(uint8_t * rawmsg)
return offset + cw_get_msg_elems_len(rawmsg + offset) + 8; return offset + cw_get_msg_elems_len(rawmsg + offset) + 8;
} }
static inline int cw_set_hdr_rmac(uint8_t * th,bstr_t rmac)
{
if (!rmac){
cw_set_hdr_flags(th,CW_FLAG_HDR_M,0);
cw_set_hdr_hlen(th, 2);
return 0;
}
int rmac_len = bstr_len(rmac);
memcpy(cw_get_hdr_rmac(th),rmac,rmac_len+1);
cw_set_hdr_flags(th,CW_FLAG_HDR_M,1);
int hlen = 4+rmac_len/4;
if (rmac_len %4 != 0) {
hlen++;
}
cw_set_hdr_hlen(th,hlen);
return 1;
}
/** /**
* Get length of a CAPWAP message elemet * Get length of a CAPWAP message elemet
* @param e pointer to element (uint8_t*) * @param e pointer to element (uint8_t*)

View File

@ -38,11 +38,19 @@ struct cw_item *cw_out_get_local(struct conn *conn, struct cw_action_out *a)
struct cw_item * cw_out_get_session_id(struct conn *conn,struct cw_action_out * a) struct cw_item * cw_out_get_session_id(struct conn *conn,struct cw_action_out * a)
{ {
uint8_t session_id[16]; uint8_t session_id[16];
int l = cw_rand(session_id,16);
if ( l!=16 ) { int slen;
if ( conn->capwap_mode == CW_MODE_CISCO){
slen=4;
}
else
slen=16;
int l = cw_rand(session_id,slen);
if ( l!=slen ) {
cw_log(LOG_ERR,"Can't init session ID."); cw_log(LOG_ERR,"Can't init session ID.");
return NULL; return NULL;
} }
return cw_itemstore_set_bstrn(conn->local,CW_ITEM_SESSION_ID,session_id,16); return cw_itemstore_set_bstrn(conn->local,CW_ITEM_SESSION_ID,session_id,slen);
} }

View File

@ -111,13 +111,23 @@ cw_action_out_t capwap_actions_wtp_out[] = {
{CW_MSG_DISCOVERY_REQUEST, CW_ITEM_DISCOVERY_TYPE, 0, {CW_MSG_DISCOVERY_REQUEST, CW_ITEM_DISCOVERY_TYPE, 0,
CW_ELEM_DISCOVERY_TYPE, NULL,cw_out_generic, cw_out_get_outgoing} CW_ELEM_DISCOVERY_TYPE, NULL,cw_out_generic, cw_out_get_outgoing}
, ,
{CW_MSG_DISCOVERY_REQUEST, CW_ITEM_WTP_FRAME_TUNNEL_MODE, 0,
CW_ELEM_WTP_FRAME_TUNNEL_MODE, NULL,cw_out_generic, cw_out_get_local,1}
,
{CW_MSG_DISCOVERY_REQUEST, CW_ITEM_WTP_MAC_TYPE, 0,
CW_ELEM_WTP_MAC_TYPE, NULL,cw_out_generic, cw_out_get_local,1}
,
/* WTP Board Data */ /* WTP Board Data */
{CW_MSG_DISCOVERY_REQUEST, CW_ITEM_WTP_BOARD_DATA, 0, {CW_MSG_DISCOVERY_REQUEST, CW_ITEM_WTP_BOARD_DATA, 0,
CW_ELEM_WTP_BOARD_DATA, NULL,cw_out_wtp_board_data, cw_out_get_outgoing} CW_ELEM_WTP_BOARD_DATA, NULL,cw_out_wtp_board_data, cw_out_get_outgoing,1}
, ,
/* WTP Descriptor */
{CW_MSG_DISCOVERY_REQUEST, CW_ITEM_WTP_DESCRIPTOR, 0,
CW_ELEM_WTP_DESCRIPTOR, NULL,cw_out_wtp_descriptor, NULL,1}
,
/* ------------------------------------------------------------------------------- /* -------------------------------------------------------------------------------
* Join Request OUT * Join Request OUT

View File

@ -53,7 +53,7 @@ enum capwap_items {
/* Other Items */ /* Other Items */
CW_ITEM_AC_IMAGE_DIR, /* Path where WTP images are stored */ CW_ITEM_AC_IMAGE_DIR, /* Path where WTP images are stored */
CW_ITEM_IMAGE_FILENAME, /* Full path of image filename */ CW_ITEM_IMAGE_FILENAME, /* Full path of image filename */
CW_ITEM_DISCOVERIES, CW_ITEM_DISCOVERIES,
CW_ITEM_AC_PRIO_LIST, /* AC Name with Priority list */ CW_ITEM_AC_PRIO_LIST, /* AC Name with Priority list */
CW_ITEM_IMAGE_FILEHANDLE /* FILE handle for uploading and downloading images */ CW_ITEM_IMAGE_FILEHANDLE /* FILE handle for uploading and downloading images */

View File

@ -21,7 +21,7 @@
cw_in_cipwap_wtp_descriptor, 0, /* start/end callback */ \ cw_in_cipwap_wtp_descriptor, 0, /* start/end callback */ \
0, \ 0, \
CW_ITEM_WTP_DESCRIPTOR, \ CW_ITEM_WTP_DESCRIPTOR, \
0,0 8,1028
/* For CIPWAP we allow a /* For CIPWAP we allow a
Session ID with 4 .. 16 bytes length */ Session ID with 4 .. 16 bytes length */

View File

@ -53,6 +53,8 @@ struct conn {
cw_itemstore_t remote; cw_itemstore_t remote;
cw_itemstore_t local; cw_itemstore_t local;
/** base_mac */
bstr_t base_rmac;
/** Wireless Binding ID of this connection */ /** Wireless Binding ID of this connection */
uint8_t wbid; uint8_t wbid;

View File

@ -52,8 +52,14 @@ void cw_init_response(struct conn *conn, uint8_t * req)
int shbytes = cw_get_hdr_msg_offset(req); int shbytes = cw_get_hdr_msg_offset(req);
int dhbytes; int dhbytes;
memcpy(buffer, req, shbytes); memcpy(buffer, req, shbytes);
cw_set_hdr_hlen(buffer, 2);
cw_set_hdr_flags(buffer, CW_FLAG_HDR_M, 1);
cw_set_hdr_rmac(buffer,conn->base_rmac);
// cw_set_hdr_hlen(buffer, 2);
// cw_set_hdr_flags(buffer, CW_FLAG_HDR_M, 1);
dhbytes = cw_get_hdr_msg_offset(buffer); dhbytes = cw_get_hdr_msg_offset(buffer);
uint8_t *msgptr = req + shbytes; uint8_t *msgptr = req + shbytes;
@ -74,10 +80,15 @@ void cw_init_request(struct conn *conn, int msg_id)
/* unencrypted */ /* unencrypted */
cw_set_hdr_preamble(buffer, CAPWAP_VERSION << 4 | 0); cw_set_hdr_preamble(buffer, CAPWAP_VERSION << 4 | 0);
cw_set_hdr_rmac(buffer,conn->base_rmac);
//cw_set_hdr_hlen(buffer, 2);
cw_set_hdr_hlen(buffer, 2);
cw_set_hdr_wbid(buffer, 1); cw_set_hdr_wbid(buffer, 1);
cw_set_hdr_rid(buffer, 0); cw_set_hdr_rid(buffer, 0);
uint8_t *msgptr = cw_get_hdr_msg_offset(buffer) + buffer; uint8_t *msgptr = cw_get_hdr_msg_offset(buffer) + buffer;
cw_set_msg_type(msgptr, msg_id); cw_set_msg_type(msgptr, msg_id);
cw_set_msg_flags(msgptr, 0); cw_set_msg_flags(msgptr, 0);

View File

@ -36,6 +36,8 @@
static void readsubelems_wtp_board_data(cw_itemstore_t itemstore, uint8_t * msgelem, static void readsubelems_wtp_board_data(cw_itemstore_t itemstore, uint8_t * msgelem,
int len) int len)
{ {
if (len<4)
return;
int i = 0; int i = 0;
uint32_t val; uint32_t val;

View File

@ -32,7 +32,8 @@ static int cw_read_wtp_descriptor_versions(cw_itemstore_t itemstore, uint8_t * d
int len, int silent) int len, int silent)
{ {
int i = 0; int i = 0;
do { while (i<len) {
if (i + 8 > len) { if (i + 8 > len) {
if (!silent) if (!silent)
cw_dbg(DBG_ELEM_ERR, cw_dbg(DBG_ELEM_ERR,
@ -51,7 +52,7 @@ static int cw_read_wtp_descriptor_versions(cw_itemstore_t itemstore, uint8_t * d
if (sublen + i > len) { if (sublen + i > len) {
if (!silent) if (!silent)
cw_dbg(DBG_ELEM_ERR, cw_dbg(DBG_ELEM_ERR,
"WTP Descriptor subelement too long, length = %d", "WTP Descriptor sub-element too long, length = %d",
sublen); sublen);
return 0; return 0;
} }
@ -82,8 +83,9 @@ static int cw_read_wtp_descriptor_versions(cw_itemstore_t itemstore, uint8_t * d
break; break;
case CW_SUBELEM_WTP_SOFTWARE_VERSION: case CW_SUBELEM_WTP_SOFTWARE_VERSION:
cw_itemstore_set_vendorstr(itemstore,CW_ITEM_WTP_SOFTWARE_VERSION, cw_itemstore_set_vendorstr(itemstore,
vendor_id,data+i,sublen); CW_ITEM_WTP_SOFTWARE_VERSION,
vendor_id, data + i, sublen);
/* /*
cw_itemstore_set_dword(itemstore, cw_itemstore_set_dword(itemstore,
CW_ITEM_WTP_SOFTWARE_VENDOR, CW_ITEM_WTP_SOFTWARE_VENDOR,
@ -111,7 +113,7 @@ static int cw_read_wtp_descriptor_versions(cw_itemstore_t itemstore, uint8_t * d
} }
i += sublen; i += sublen;
} while (i < len); } //while (i < len);
return 1; return 1;

View File

@ -9,9 +9,9 @@
int cw_out_wtp_board_data(struct conn *conn, struct cw_action_out *a, uint8_t * dst) int cw_out_wtp_board_data(struct conn *conn, struct cw_action_out *a, uint8_t * dst)
{ {
cw_itemstore_t board_data = cw_itemstore_t board_data =
cw_itemstore_get_avltree(conn->outgoing, CW_ITEM_WTP_BOARD_DATA); cw_itemstore_get_avltree(conn->local, CW_ITEM_WTP_BOARD_DATA);
if (!board_data) { if (!board_data) {
cw_log(LOG_ERR, "Error: Can't send WTP Board Data element - not defined"); cw_log(LOG_ERR, "Error: Can't send WTP Board Data element. WTP Board Data is not defined.");
return 0; return 0;
} }
@ -33,7 +33,7 @@ int cw_out_wtp_board_data(struct conn *conn, struct cw_action_out *a, uint8_t *
d += cw_put_data(d, bstr16_data(i->data), bstr16_len(i->data)); d += cw_put_data(d, bstr16_data(i->data), bstr16_len(i->data));
} else { } else {
cw_log(LOG_ERR, cw_log(LOG_ERR,
"Error: Can't set sub-element \"Model No.\" in WTP Board Data."); "Error: Can't set sub-element \"WTP Model Number\" in WTP Board Data.");
} }
i = cw_itemstore_get(board_data, CW_ITEM_WTP_BOARD_SERIALNO); i = cw_itemstore_get(board_data, CW_ITEM_WTP_BOARD_SERIALNO);
@ -41,8 +41,12 @@ int cw_out_wtp_board_data(struct conn *conn, struct cw_action_out *a, uint8_t *
d += cw_put_word(d, CW_BOARDDATA_SERIALNO); d += cw_put_word(d, CW_BOARDDATA_SERIALNO);
d += cw_put_word(d, bstr16_len(i->data)); d += cw_put_word(d, bstr16_len(i->data));
d += cw_put_data(d, bstr16_data(i->data), bstr16_len(i->data)); d += cw_put_data(d, bstr16_data(i->data), bstr16_len(i->data));
}else {
cw_log(LOG_ERR,
"Error: Can't set sub-element \"WTP Serial Number\" in WTP Board Data.");
} }
i = cw_itemstore_get(board_data, CW_ITEM_WTP_BOARD_ID); i = cw_itemstore_get(board_data, CW_ITEM_WTP_BOARD_ID);
if (i) { if (i) {
d += cw_put_word(d, CW_BOARDDATA_BOARDID); d += cw_put_word(d, CW_BOARDDATA_BOARDID);

View File

@ -5,9 +5,11 @@
#include "capwap_items.h" #include "capwap_items.h"
#include "capwap.h" #include "capwap.h"
static int cw_put_encryption_subelems(uint8_t *dst)
static int cw_put_enc_subelems(uint8_t *dst)
{ {
cw_put_word(dst,0x01);
return 2;
int n=2; int n=2;
dst+=cw_put_byte(dst,n); dst+=cw_put_byte(dst,n);
@ -29,9 +31,9 @@ int cw_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a, uint8_t *
// XXX Dummy WTP Descriptor Header // XXX Dummy WTP Descriptor Header
uint8_t *d = dst+4; uint8_t *d = dst+4;
d+=cw_put_byte(d,2); d+=cw_put_byte(d,2); //max radios
d+=cw_put_byte(d,0); d+=cw_put_byte(d,0); //radios in use
d+=cw_put_enc_subelems(dst); d+=cw_put_encryption_subelems(d);
cw_item_t * i; cw_item_t * i;
i = cw_itemstore_get(conn->outgoing,CW_ITEM_WTP_HARDWARE_VERSION); i = cw_itemstore_get(conn->outgoing,CW_ITEM_WTP_HARDWARE_VERSION);

View File

@ -8,24 +8,99 @@
#include "jsmn.h" #include "jsmn.h"
#include "wtp.h" #include "wtp.h"
#include "capwap/bstr.h"
struct cw_itemdef { struct cw_itemdef {
int item_id; int item_id;
const char *cfgname; const char *cfgname;
int (*setfun) (struct cw_itemdef *,char *js,jsmntok_t *t); int (*setfun) (struct cw_itemdef *,char *,jsmntok_t *);
const char def;
}; };
typedef struct cw_itemdef cfg_item_t; typedef struct cw_itemdef cfg_item_t;
enum { enum {
CW_ITEMSPACE_DBG, CW_ITEMSPACE_DBG,
CW_ITEMSPACE_WTP CW_ITEMSPACE_WTP
}; };
int bstr16_local(struct cw_item_def *idef,char *js, jsmntok_t *t) static int scn_obj(char *js, jsmntok_t *t, int (vcb)(char*js,jsmntok_t*t) ) {
int i;
if (t->type!=JSMN_OBJECT){
printf("No object\n");
return 0;
}
/*
if (t->size<3) {
return 0;
}
*/
int j=1;
for (i = 0; i < t->size; i++) {
j+=vcb(js,t+j);
continue;
}
return 0;
}
static int skip(jsmntok_t *t)
{ {
int item_id = idef=item_id; switch (t->type){
case JSMN_OBJECT:
{
int e=t->end;
int n=1;
while (e>t->start) {
t++;n++;
}
return n;
}
default:
return t->size+2;
}
}
int byte_local(struct cw_itemdef *idef,char *js, jsmntok_t *t)
{
printf("GET BYTE\n");
// if (t->type != JSMN_STRING){
// printf("Error: No Str: %s\n",str);
// return 1;
// }
*(js+t->end)=0;
const char * val = js+t->start;
// *(js+(t+1)->end)=0;
// const char * val = js+(t+1)->start;
struct conn * conn = get_conn();
cw_itemstore_set_byte(conn->local,idef->item_id,atoi(val));
}
int bstr16_local(struct cw_itemdef *idef,char *js, jsmntok_t *t)
{
int item_id = idef->item_id;
struct conn * conn = get_conn(); struct conn * conn = get_conn();
*(js+t->end)=0; *(js+t->end)=0;
@ -37,14 +112,34 @@ int bstr16_local(struct cw_item_def *idef,char *js, jsmntok_t *t)
} }
// *(js+t->end)=0; // *(js+t->end)=0;
printf("Set str: %d %s\n", item_id,str); printf("Set str: %d %s\n", item_id,str);
cw_itemstore_set_bstr16n(conn->local,item_id,js+t->start,t->end-t->start); cw_itemstore_set_bstr16n(conn->local,item_id,(uint8_t*)js+t->start,t->end-t->start);
return 0;
} }
int wtp_board_data_local(struct cw_itemdef *idef,char *js, jsmntok_t *t);
struct cw_itemdef cfg[] = {
struct cw_itemdef general_cfg[] = {
{CW_ITEM_WTP_HARDWARE_VERSION, "hardware_version",bstr16_local}, {CW_ITEM_WTP_HARDWARE_VERSION, "hardware_version",bstr16_local},
{CW_ITEM_WTP_SOFTWARE_VERSION, "software_version",bstr16_local}, {CW_ITEM_WTP_SOFTWARE_VERSION, "software_version",bstr16_local},
{CW_ITEM_WTP_BOARD_MODELNO, "modelno",bstr16_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},
{0, 0, 0}
};
struct cw_itemdef board_data_cfg[] = {
{CW_ITEM_WTP_BOARD_MODELNO, "model_no",NULL},
{CW_ITEM_WTP_BOARD_SERIALNO, "serial_no",NULL},
{CW_ITEM_WTP_BOARD_VENDOR, "vendor_id",NULL},
{0, 0, 0} {0, 0, 0}
}; };
@ -54,7 +149,8 @@ struct cw_itemdef cfg[] = {
struct cw_itemdef * get_cfg(const char *key){
struct cw_itemdef * get_cfg(struct cw_itemdef *cfg,const char *key){
int i=0; int i=0;
for (i=0; cfg[i].item_id; i++){ for (i=0; cfg[i].item_id; i++){
if ( !strcmp(key,cfg[i].cfgname )) { if ( !strcmp(key,cfg[i].cfgname )) {
@ -64,61 +160,94 @@ struct cw_itemdef * get_cfg(const char *key){
return NULL; return NULL;
} }
static int wtp_board_data_cb(char *js,jsmntok_t *t)
int scn_obj(jsmntok_t *t, int i)
{ {
printf("VB BOARD DATA!!!\n");
struct conn * conn = get_conn();
cw_itemstore_t bd = cw_itemstore_get_avltree(conn->local,CW_ITEM_WTP_BOARD_DATA);
if (!bd){
bd = cw_itemstore_create();
if (!bd){
return skip(t+1);
}
cw_itemstore_set_avltree(conn->local,CW_ITEM_WTP_BOARD_DATA,bd);
}
*(js+t->end)=0;
const char * key = js+t->start;
*(js+(t+1)->end)=0;
const char * val = js+(t+1)->start;
struct conn *get_conn();
struct cw_itemdef * idef = get_cfg(board_data_cfg,key);
if (!idef){
return skip(t+1);
}
if (idef->item_id == CW_ITEM_WTP_BOARD_VENDOR){
cw_itemstore_set_dword(bd,CW_ITEM_WTP_BOARD_VENDOR,atoi(val));
}
else{
bstr16_t v = bstr16cfgstr(val);
cw_itemstore_set_bstr16n(bd,idef->item_id,bstr16_data(v),bstr16_len(v));
free(v);
}
return skip(t+1);
} }
int wtp_board_data_local(struct cw_itemdef *idef,char *js, jsmntok_t *t)
{
printf("Local board data\n");
if ( t->type != JSMN_OBJECT ) {
printf("Error: wtp_board_data is no object\n");
printf("Size: %d\n",t->size);
return 0;
}
printf("Scanni\n");
scn_obj(js, t,wtp_board_data_cb);
return skip(t+1);
}
static int set_cfg(char *js,jsmntok_t *t){ static int set_cfg(char *js,jsmntok_t *t){
*(js+t->end)=0; *(js+t->end)=0;
const char * key = js+t->start; const char * key = js+t->start;
*(js+(t+1)->end)=0;
//const char * val = js+(t+1)->start;
if ( t->type != JSMN_STRING ) {
printf("Error - No String: %s\n",key);
return 0;
}
struct cw_itemdef * idef = get_cfg(key);
if(!idef){ struct cw_itemdef * idef = get_cfg(general_cfg,key);
printf("Error - not found: %s\n",key);
return 0; // printf("Key: %s\n",key);
} // printf("Val: %s\n",val);
if(!idef)
return skip(t+1);
if ( !idef->setfun) { if ( !idef->setfun) {
printf("Error no setfun: %s\n",key); printf("Error no setfun: %s\n",key);
} }
else{ else{
idef->setfun(idef->item_id,js,t+1); idef->setfun(idef,js,t+1);
} }
return 1; return skip(t+1);
}
static int read_obj(char *js, jsmntok_t *t ) {
int i;
if (t->type!=JSMN_OBJECT){
return 0;
}
if (t->size<3) {
return 0;
}
for (i = 1; i < t->size; i++) {
i+=set_cfg(js,t+i);
continue;
}
return 0;
} }
@ -156,13 +285,7 @@ int setup_conf(struct conn *conn)
printf("Parser failed\n"); printf("Parser failed\n");
} }
read_obj(jstr, t); scn_obj(jstr, t,set_cfg);
int i;
@ -170,10 +293,16 @@ int setup_conf(struct conn *conn)
/*
for (i = 0; cfg[i].item_id != CW_ITEM_NONE; i++) { for (i = 0; cfg[i].item_id != CW_ITEM_NONE; i++) {
printf("ItemName: %s\n", cfg[i].cfgname); //.cfgname) printf("ItemName: %s\n", cfg[i].cfgname); //.cfgname)
} }
*/
return 0; return 0;
} }

View File

@ -1,15 +1,31 @@
{ {
"dbg":[o1,o2,o3],
"Tube" : "tabbe",
"hardware_version": "12345", "hardware_version": "12345",
"software_version": "98765", "software_version": "98765",
"vendor_id": 40909, "comment": "** The following is debug info **",
"modelno": "2045", "location_data": "Berlin",
"frame_tunnel_mode": "4",
"mac_type": 2,
"wtp_board_data" : {
"vendor_id": 4232704,
"model_no": "Tobias Herre",
"serial_no": "2045",
},
"acname_with_priority": { "acname_with_priority": {
"1":"Master-AC", "1":"Master-AC",
"2":"Cisco-AC" "2":"Cisco-AC"
}, },
"comment": "** The following is debug info **"
"dbg":[o1,o2,o3]
"ac": { "ac": {
"Master-AC": { "Master-AC": {
@ -19,6 +35,7 @@
} }
} }
} }

View File

@ -6,9 +6,9 @@
int configure() int configure()
{ {
/*
struct conn * conn = get_conn(); struct conn * conn = get_conn();
struct wtpinfo * wtpinfo = get_wtpinfo(); /* struct wtpinfo * wtpinfo = get_wtpinfo();
struct radioinfo *rip = &(wtpinfo->radioinfo[0]); struct radioinfo *rip = &(wtpinfo->radioinfo[0]);

View File

@ -32,7 +32,7 @@ int image_update()
return 0; return 0;
} }
cw_dbg(DBG_ELEM,"Ready to receive image ...\n"); cw_dbg(DBG_INFO,"Ready to receive image ...");
conn->capwap_state=CW_STATE_IMAGE_DATA; conn->capwap_state=CW_STATE_IMAGE_DATA;
rc=-11; rc=-11;

View File

@ -182,6 +182,8 @@ int run_join(struct conn * conn)
int join() int join()
{ {
struct conn * conn = get_conn(); struct conn * conn = get_conn();
conn->capwap_mode=CW_MODE_CISCO;
cw_aciplist_t iplist = cw_itemstore_get_avltree(conn->local,CW_ITEM_CAPWAP_CONTROL_IP_ADDRESS_LIST); cw_aciplist_t iplist = cw_itemstore_get_avltree(conn->local,CW_ITEM_CAPWAP_CONTROL_IP_ADDRESS_LIST);
if (!iplist){ if (!iplist){
cw_log(LOG_ERR,"No IPs to join controller."); cw_log(LOG_ERR,"No IPs to join controller.");

View File

@ -29,7 +29,13 @@ struct conn *the_conn;
struct cw_actiondef capwap_actions; struct cw_actiondef capwap_actions;
bstr_t get_base_rmac()
{
// static uint8_t rm[8]={0x00,0x4a,0x99,0x02,0xfa,0xc0};
static uint8_t rm[8]={0x00,0x3a,0x99,0x02,0xfa,0xc0};
return bstr_create(rm,6);
}
@ -64,11 +70,14 @@ int main()
conn->outgoing = cw_itemstore_create(); conn->outgoing = cw_itemstore_create();
conn->incomming = cw_itemstore_create(); conn->incomming = cw_itemstore_create();
conn->local = cw_itemstore_create(); conn->local = cw_itemstore_create();
conn->base_rmac=get_base_rmac();
conn->capwap_mode = CW_MODE_CISCO;
setup_conf(conn); setup_conf(conn);
/*
cw_itemstore_t board_data = cw_itemstore_create(); cw_itemstore_t board_data = cw_itemstore_create();
cw_itemstore_set_dword(board_data, CW_ITEM_WTP_BOARD_VENDOR, conf_vendor_id); cw_itemstore_set_dword(board_data, CW_ITEM_WTP_BOARD_VENDOR, conf_vendor_id);
@ -78,11 +87,11 @@ int main()
cw_itemstore_set_bstr16n(board_data, CW_ITEM_WTP_BOARD_SERIALNO, cw_itemstore_set_bstr16n(board_data, CW_ITEM_WTP_BOARD_SERIALNO,
bstr_data(conf_serial_no), bstr_len(conf_serial_no)); bstr_data(conf_serial_no), bstr_len(conf_serial_no));
*/
cw_itemstore_set_avltree(conn->outgoing, CW_ITEM_WTP_BOARD_DATA, board_data); // cw_itemstore_set_avltree(conn->outgoing, CW_ITEM_WTP_BOARD_DATA, board_data);
cw_acpriolist_t acprios = cw_acpriolist_create(); cw_acpriolist_t acprios = cw_acpriolist_create();
cw_acpriolist_set(acprios,"Master AC",strlen("Master AC"),1); cw_acpriolist_set(acprios,"Master AC",strlen("Master AC"),1);
@ -100,7 +109,7 @@ int main()
the_conn->strict_capwap=0; the_conn->strict_capwap=0;
discovery(); discovery();
join(); join();
image_update(); //image_update();
} }