reg domain, cisco

FossilOrigin-Name: 4e4c68a554b8198a10b2233e2d9165587fdf909ee3d20943cdcafcaf3f05b7eb
This commit is contained in:
7u83@mail.ru
2018-04-13 22:50:58 +00:00
parent f996e52776
commit 7968096687
11 changed files with 120 additions and 20 deletions

View File

@ -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);*/

View File

@ -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);

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
/**
* @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;
}