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

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<CodeLite_Workspace Name="actube" Database="">
<Project Name="ac" Path="ac.project" Active="No"/>
<Project Name="wtp" Path="wtp.project" Active="Yes"/>
<Project Name="wtp" Path="wtp.project" Active="No"/>
<Project Name="mod_cipwap" Path="mod_cipwap.project" Active="No"/>
<Project Name="mod_capwap" Path="mod_capwap.project" Active="No"/>
<Project Name="mod_cisco" Path="mod_cisco.project" Active="No"/>
<Project Name="mod_cisco" Path="mod_cisco.project" Active="Yes"/>
<Project Name="libcw" Path="libcw.project" Active="No"/>
<Project Name="mod_capwap80211" Path="mod_capwap80211.project" Active="No"/>
<Project Name="mod_fortinet" Path="mod_fortinet.project" Active="No"/>

View File

@ -38,6 +38,7 @@
<File Name="src/mod/cisco/cisco_out_capwap_local_ip_address.c"/>
<File Name="src/mod/cisco/cisco_out_lw_path_mtu.c"/>
<File Name="src/mod/cisco/lwapp_cisco.h"/>
<File Name="src/mod/cisco/cisco_in_ap_regulatory_domain.c"/>
</VirtualDirectory>
</VirtualDirectory>
</VirtualDirectory>

View File

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

View File

@ -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[];

View File

@ -4,7 +4,7 @@
#include "mlist.h"
#include "sock.h"
#include "mavl.h"
#include "conn.h"
#include "ktv.h"
struct cw_MsgSet {

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;
}

View File

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

View File

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

View File

@ -50,7 +50,7 @@
</Compiler>
<Linker Options="" Required="yes"/>
<ResourceCompiler Options="" Required="no"/>
<General OutputFile="" IntermediateDirectory="./Debug" Command="$(WorkspacePath)/src/wtp/wtp" CommandArguments="-dall -mcisco -ccisco.ktv" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(WorkspacePath)/src/wtp/" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
<General OutputFile="" IntermediateDirectory="./Debug" Command="$(WorkspacePath)/src/wtp/wtp" CommandArguments="-dall -mcisco -ctest.ktv" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(WorkspacePath)/src/wtp/" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
<Environment EnvVarSetName="&lt;Use Defaults&gt;" DbgSetName="&lt;Use Defaults&gt;">
<![CDATA[LD_LIBRARY_PATH=../../lib]]>
</Environment>