diff --git a/actube.workspace b/actube.workspace index 07586c53..c63c2d68 100644 --- a/actube.workspace +++ b/actube.workspace @@ -1,10 +1,10 @@ - + - + diff --git a/mod_cisco.project b/mod_cisco.project index 917d6863..437054b6 100644 --- a/mod_cisco.project +++ b/mod_cisco.project @@ -38,6 +38,7 @@ + diff --git a/src/cw/cw_ktv_idx_get.c b/src/cw/cw_ktv_idx_get.c index 526bf92b..c12f4dd0 100644 --- a/src/cw/cw_ktv_idx_get.c +++ b/src/cw/cw_ktv_idx_get.c @@ -46,7 +46,7 @@ void * ktvn(struct mavl *t ,const void *search) -int cw_ktv_idx_get(mavl_t ktv, const char *key, int idx, const cw_Type_t * type) +int cw_ktv_idx_get(mavl_t ktv, const char *key) { char ikey[CW_KTV_MAX_KEY_LEN]; cw_KTV_t search, * result; @@ -55,7 +55,9 @@ int cw_ktv_idx_get(mavl_t ktv, const char *key, int idx, const cw_Type_t * type) sprintf(ikey,"%s.%d",key,65536); search.key=ikey; - result = ktvn(ktv,&search); + /*//result = ktvn(ktv,&search);*/ + + result = mavl_get_last(ktv,&search); if (result == NULL){ return -1; diff --git a/src/cw/ktv.h b/src/cw/ktv.h index f0c5cdc2..510b45d5 100644 --- a/src/cw/ktv.h +++ b/src/cw/ktv.h @@ -169,7 +169,7 @@ uint32_t cw_ktv_get_dword(mavl_t ktv,const char *key, uint32_t def); void * cw_ktv_get_sysptr(mavl_t ktv,const char *key, void * def); char * cw_ktv_get_str(mavl_t ktv,const char *key, char * def); -int cw_ktv_idx_get(mavl_t ktv, const char *key, int idx, const cw_Type_t * type); +int cw_ktv_idx_get(mavl_t ktv, const char *key); extern const cw_Type_t * cw_ktv_std_types[]; diff --git a/src/cw/msgset.h b/src/cw/msgset.h index badbbd19..787910b2 100644 --- a/src/cw/msgset.h +++ b/src/cw/msgset.h @@ -4,7 +4,7 @@ #include "mlist.h" #include "sock.h" #include "mavl.h" -#include "conn.h" + #include "ktv.h" struct cw_MsgSet { diff --git a/src/mod/capwap/capwap_in_capwap_control_ip_address.c b/src/mod/capwap/capwap_in_capwap_control_ip_address.c index 0ba05537..0114d813 100644 --- a/src/mod/capwap/capwap_in_capwap_control_ip_address.c +++ b/src/mod/capwap/capwap_in_capwap_control_ip_address.c @@ -32,7 +32,7 @@ int capwap_in_capwap_control_ip_address(struct cw_ElemHandler *eh, int idx; sprintf(key,"%s/address",eh->key); - idx = cw_ktv_idx_get(params->conn->remote_cfg,key,0,CW_TYPE_IPADDRESS); + idx = cw_ktv_idx_get(params->conn->remote_cfg,key); /* printf("SKEY is %s , idx: %d\n",key,idx);*/ diff --git a/src/mod/cisco/cisco_actions_ac.c b/src/mod/cisco/cisco_actions_ac.c index aee92857..20e1685b 100644 --- a/src/mod/cisco/cisco_actions_ac.c +++ b/src/mod/cisco/cisco_actions_ac.c @@ -67,8 +67,8 @@ static cw_KTVStruct_t cisco_ap_username_and_password[] = { }; static cw_KTVStruct_t cisco_loghost_config[] = { - {CW_TYPE_IPADDRESS, "loghost", 4, -1 }, - {CW_TYPE_STR, "last-joined-ap", 32, -1 }, + {CW_TYPE_IPADDRESS, "loghost", 4, -1}, + {CW_TYPE_STR, "last-joined-ap", 32, -1}, {NULL,NULL,0,0} }; @@ -105,8 +105,8 @@ static cw_KTVStruct_t cisco_wtp_board_data[]={ }; static cw_KTVStruct_t cisco_ap_led_flash_config[]={ - {CW_TYPE_BYTE, "flahs-enable", 1, 0}, - {CW_TYPE_DWORD, "flsh-sec", 4, 4}, + {CW_TYPE_BYTE, "flash-enable", 1, 0}, + {CW_TYPE_DWORD, "flash-sec", 4, 4}, {CW_TYPE_BYTE, "save-flag", 4, 8}, {NULL,NULL,0,0} @@ -122,7 +122,7 @@ static cw_KTVStruct_t cisco_ap_static_ip_addr[]={ }; -static cw_KTVStruct_t cisco_ap_regulatory_domain[]={ +static cw_KTVStruct_t cisco_ap_regulatory_domain4[]={ {CW_TYPE_BOOL,"set",1,-1}, {CW_TYPE_BYTE,"slot",1,-1}, {CW_TYPE_BYTE,"code0",1,-1}, @@ -130,6 +130,42 @@ static cw_KTVStruct_t cisco_ap_regulatory_domain[]={ {NULL,NULL,0,0} }; +static cw_KTVStruct_t cisco_ap_regulatory_domain5[]={ + {CW_TYPE_BYTE,"band-id",1,-1}, + {CW_TYPE_BOOL,"set",1,-1}, + {CW_TYPE_BYTE,"slot",1,-1}, + {CW_TYPE_BYTE,"code0",1,-1}, + {CW_TYPE_BYTE,"code1",1,-1}, + {NULL,NULL,0,0} +}; + + +int cisco_in_ap_regulatory_domain(struct cw_ElemHandler *eh, + struct cw_ElemHandlerParams *params, + uint8_t * data, int len) +{ + char key[CW_KTV_MAX_KEY_LEN]; + int idx; + void * type; + + idx = cw_ktv_idx_get(params->conn->remote_cfg,eh->key); + + sprintf(key,"%s.%d",eh->key,idx+1); + + if(len==4) + type = cisco_ap_regulatory_domain4; + if(len==5) + type = cisco_ap_regulatory_domain5; + cw_ktv_read_struct(params->conn->remote_cfg,type,key,data,len); + + + + return 1; +} + + + + static struct cw_ElemHandler handlers[] = { { @@ -499,10 +535,10 @@ static struct cw_ElemHandler handlers[] = { CISCO_ELEM_AP_REGULATORY_DOMAIN, /* Element ID */ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */ 5,5, /* min/max length */ - cisco_ap_regulatory_domain, /* type */ - "cisco/regulatory-domain/%03d", /* Key */ - cw_in_idx_generic_struct, /* get */ - cw_out_idx_generic_struct /* put */ + cisco_ap_regulatory_domain4, /* type */ + "cisco/ap-regulatory-domain", /* Key */ + cisco_in_ap_regulatory_domain, /* get */ + NULL /*cw_out_idx_generic_struct*/ /* put */ }, {0,0,0,0,0,0,0,0} @@ -668,7 +704,8 @@ static void set_ac_version(struct conn * conn) } -static int postprocess_discovery(struct conn *conn){ +static int postprocess_discovery(struct conn *conn) +{ if (conn->role != CW_ROLE_AC ) return 0; set_ac_version(conn); diff --git a/src/mod/cisco/cisco_in_ap_regulatory_domain.c b/src/mod/cisco/cisco_in_ap_regulatory_domain.c new file mode 100644 index 00000000..08e16480 --- /dev/null +++ b/src/mod/cisco/cisco_in_ap_regulatory_domain.c @@ -0,0 +1,47 @@ +/* + This file is part of actube. + + actube is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + libcapwap is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Foobar. If not, see . + +*/ + +/** + * @file + * @brief Implements cw_in_capwap_control_ip_address + */ + +#include "mod_capwap.h" + + +int cisco_in_ap_regulatory_domain(struct cw_ElemHandler *eh, + struct cw_ElemHandlerParams *params, + uint8_t * data, int len) +{ + char key[CW_KTV_MAX_KEY_LEN]; + int idx; + + sprintf(key,"%s/address",eh->key); + idx = cw_ktv_idx_get(params->conn->remote_cfg,key); + +/* printf("SKEY is %s , idx: %d\n",key,idx);*/ + + sprintf(key,"%s/address.%d",eh->key,idx+1); + cw_ktv_add(params->conn->remote_cfg,key,CW_TYPE_IPADDRESS,data,len-2); + + sprintf(key,"%s/wtps.%d",eh->key,idx+1); + cw_ktv_add(params->conn->remote_cfg,key,CW_TYPE_WORD,data+len-2,2); + + return 1; +} + diff --git a/src/wtp/cisco.ktv b/src/wtp/cisco.ktv index 171e55d6..ac452ca7 100644 --- a/src/wtp/cisco.ktv +++ b/src/wtp/cisco.ktv @@ -70,3 +70,9 @@ cisco/regulatory-domain/001/code1 :Byte: 1 cisco/regulatory-domain/001/set :Bool: true cisco/regulatory-domain/001/slot :Byte: 1 + +tube.0/main : Byte : 12 +tube.0/zumsel : Byte : 12 +tube.1/main : Byte : 12 +tube.1/zumsel : Byte : 12 + diff --git a/src/wtp/wtp_main.c b/src/wtp/wtp_main.c index 43decbb3..aeafb9d6 100644 --- a/src/wtp/wtp_main.c +++ b/src/wtp/wtp_main.c @@ -95,6 +95,8 @@ int main (int argc, char **argv) + + bootcfg.nmods=0; /* read command line args, results are in bootcfg */ @@ -170,9 +172,14 @@ int main (int argc, char **argv) if (mod->setup_cfg) mod->setup_cfg(conn); } +{ +int idx; +cw_dbg_ktv_dump(conn->local_cfg,DBG_INFO,"head","BREP: ","bot"); +idx = cw_ktv_idx_get(conn->local_cfg,"tube",0,NULL); +printf("IDX: %d\n",idx); -/*cw_dbg_ktv_dump(conn->local_cfg,DBG_INFO,"head","BREP: ","bot");*/ - +exit(0); +} dtls_init(); conn->base_rmac = get_base_rmac(); diff --git a/wtp.project b/wtp.project index d5f197eb..21769f55 100644 --- a/wtp.project +++ b/wtp.project @@ -50,7 +50,7 @@ - +