Byte valguards fully implemented
FossilOrigin-Name: 06e14f6c3efc2ff16b87540ca719639accadd9c919e47ab08b2768fd87482722
This commit is contained in:
parent
33b736852b
commit
07f02708bb
@ -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="No"/>
|
||||
<Project Name="wtp" Path="wtp.project" Active="Yes"/>
|
||||
<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="Yes"/>
|
||||
<Project Name="mod_cisco" Path="mod_cisco.project" Active="No"/>
|
||||
<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"/>
|
||||
|
@ -136,6 +136,7 @@ strict_capwap = off
|
||||
#
|
||||
# Defalut:
|
||||
#listen = 192.168.0.14:1027
|
||||
listen = 192.168.56.1
|
||||
|
||||
# broadcast_listen - Broadcast listen address
|
||||
# If ommited, the boraadcast listen adresses a determined automatically
|
||||
|
@ -29,7 +29,7 @@ ac-descriptor/software/vendor :Dword: 4232704
|
||||
ac-descriptor/software/version :Bstr16: .x07036500
|
||||
ac-descriptor/station-limit :Word: 1000
|
||||
ac-descriptor/stations :Word: 0
|
||||
capwap-control-ip-address/address.0 :IPAddress: 192.168.0.14
|
||||
capwap-control-ip-address/address.0 :IPAddress: 192.168.56.1
|
||||
capwap-control-ip-address/wtps.0 :Word: 2
|
||||
cisco/mwar-type :Byte: 0
|
||||
maximum-message-length :Word: 4096
|
||||
@ -48,8 +48,8 @@ capwap-control-ip-address/wtps.0:Word:0
|
||||
#capwap-control-ip-address/wtps.1:Word:11
|
||||
|
||||
|
||||
cisco/ssl-keyfile:Str:"../../ssl/certs/ac-cisco.key"
|
||||
cisco/ssl-certfile:Str:"../../ssl/certs/ac-cisco.pem"
|
||||
cisco/ssl-keyfile:Str:"../../ssl/certs/cisco-ac.key"
|
||||
cisco/ssl-certfile:Str:"../../ssl/certs/cisco-ac.pem"
|
||||
cisco/ssl-cipher:Str:NORMAL
|
||||
#+DHE-RSA:+AES-256-CBC:+AES-128-CBC:+SHA1:+PSK
|
||||
cisco/ssl-dhbits:Word:2048
|
||||
|
@ -19,13 +19,28 @@ int cw_ktv_write_struct(mavl_t ktv, const cw_KTVStruct_t * stru, const char *pke
|
||||
memset(dst+pos,0,stru[i].len);
|
||||
|
||||
sprintf(key,"%s/%s",pkey,stru[i].key);
|
||||
result = cw_ktv_get(ktv,key,stru[i].type);
|
||||
result = cw_ktv_get(ktv,key,NULL);
|
||||
|
||||
|
||||
|
||||
if (result == NULL){
|
||||
cw_log(LOG_ERR,"Can't put %s, no value found, filling zero.",key);
|
||||
memset(dst+pos,0,stru[i].len);
|
||||
}
|
||||
else{
|
||||
result->valguard=stru[i].valguard;
|
||||
if (strcmp(stru[i].type->name,result->type->name)){
|
||||
printf("Type mismatch: %s != %s\n",stru[i].type->name,result->type->name);
|
||||
if (stru[i].type->cast != NULL){
|
||||
if (!stru[i].type->cast(result)){
|
||||
cw_log(LOG_ERR,"Can't cast from %s to %s",result->type->name,stru[i].type->name);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
result->type->put(result,dst+pos);
|
||||
}
|
||||
if (stru[i].len!=-1)
|
||||
|
@ -61,9 +61,31 @@ static int to_str(const cw_KTV_t *data, char *dst, int max_len)
|
||||
|
||||
}
|
||||
|
||||
static int get_guardval(const char *str, const cw_KTVValRange_t * valrange)
|
||||
{
|
||||
while(valrange->name!=NULL){
|
||||
if(strcmp(str,valrange->name)==0)
|
||||
return valrange->min;
|
||||
valrange++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static cw_KTV_t *from_str(cw_KTV_t * data, const char *src)
|
||||
{
|
||||
data->type = &cw_type_byte;
|
||||
if (data->valguard != NULL){
|
||||
int rc;
|
||||
rc = get_guardval(src,data->valguard);
|
||||
if (rc != -1){
|
||||
data->val.byte = rc;
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
data->val.byte = atoi(src);
|
||||
return data;
|
||||
}
|
||||
@ -86,6 +108,20 @@ static const char * get_type_name(cw_KTV_t *data)
|
||||
return CW_TYPE_BYTE->name;
|
||||
}
|
||||
|
||||
static int cast(cw_KTV_t * data)
|
||||
{
|
||||
if (strcmp(data->type->name,CW_TYPE_BYTE->name)==0)
|
||||
return 1;
|
||||
if (strcmp(data->type->name,CW_TYPE_STR->name)==0){
|
||||
char *src = data->val.ptr;
|
||||
CW_TYPE_BYTE->from_str(data,src);
|
||||
free(src);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
const struct cw_Type cw_type_byte = {
|
||||
"Byte", /* name */
|
||||
NULL, /* del */
|
||||
@ -95,5 +131,6 @@ const struct cw_Type cw_type_byte = {
|
||||
from_str, /* from_str */
|
||||
len, /* len */
|
||||
data, /* data */
|
||||
get_type_name /* get_type_name */
|
||||
get_type_name, /* get_type_name */
|
||||
cast
|
||||
};
|
||||
|
@ -20,7 +20,7 @@ int cw_write_descriptor_subelem (uint8_t *dst, mavl_t ktvstore,
|
||||
vendor = cw_ktv_get (ktvstore, key, CW_TYPE_DWORD);
|
||||
|
||||
if (vendor == NULL) {
|
||||
cw_log (LOG_ERR, "Can't put subelem %s, no value found.", key);
|
||||
cw_log (LOG_ERR, "Can't put subelem %s, no value of type Dword found.", key);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ int cw_write_descriptor_subelem (uint8_t *dst, mavl_t ktvstore,
|
||||
version = cw_ktv_get (ktvstore, key, CW_TYPE_BSTR16);
|
||||
|
||||
if (version == NULL) {
|
||||
cw_log (LOG_ERR, "Can't put subelem %s, no value found.", key);
|
||||
cw_log (LOG_ERR, "Can't put subelem %s, no value of type Bstr16 found.", key);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1200,7 +1200,7 @@ static struct cw_ElemHandler handlers73[] = {
|
||||
cisco_radio_oper_state, /* type */
|
||||
"operational-state", /* Key */
|
||||
cw_in_radio_generic_struct, /* get */
|
||||
NULL, /* put */
|
||||
cw_out_radio_generic_struct, /* put */
|
||||
NULL /* mkkey */
|
||||
}
|
||||
,
|
||||
@ -1258,7 +1258,7 @@ static struct cw_ElemDef join_request_elements[] ={
|
||||
{0,CW_VENDOR_ID_CISCO, CW_CISCO_BOARD_DATA_OPTIONS, 1, 0},
|
||||
{0,CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_GROUP_NAME, 1, 0},
|
||||
{0,CW_VENDOR_ID_CISCO, CISCO_ELEM_MWAR_ADDR, 1, 0},
|
||||
{0,CW_VENDOR_ID_CISCO, CISCO_ELEM_SPAM_VENDOR_SPECIFIC,1, CW_IGNORE},
|
||||
{0,CW_VENDOR_ID_CISCO, CISCO_ELEM_SPAM_VENDOR_SPECIFIC,0, CW_IGNORE},
|
||||
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_PATH_MTU, 0, 0},
|
||||
|
||||
|
||||
|
@ -146,8 +146,8 @@ radio.0/cisco/wtp-radio-config/occupancy-limit :Word: 100
|
||||
radio.0/cisco/wtp-radio-config/reg :Dword: 65536
|
||||
radio.0/cisco/wtp-radio-config/unknown75 :Byte: 0
|
||||
radio.0/decryption-error-report-period :Word: 120
|
||||
radio.0/operational-state/cause :Byte: 0
|
||||
radio.0/operational-state/state :Byte: 2
|
||||
radio.0/operational-state/cause :Str: 0
|
||||
radio.0/operational-state/state :Str: enabled
|
||||
radio.0/rate_set :Bstr16: .x82848b960c1218243048606c
|
||||
radio.0/wlan.0/allow-aaa-override :Byte: 1
|
||||
radio.0/wlan.0/broadcast-ssid :Bool: true
|
||||
@ -212,7 +212,7 @@ radio/wlan/radio-od :Byte: 1
|
||||
radio/wlan/wlan-capability :Word: 17
|
||||
radio/wlan/wlan-id :Byte: 0
|
||||
result-code :Dword: 0
|
||||
session-id: .x00006215
|
||||
session-id:Bstr16: .x00006215
|
||||
statistics-timer :Word: 60
|
||||
tube.0/main :Byte: 12
|
||||
tube.0/zumsel :Byte: 12
|
||||
|
@ -192,8 +192,8 @@ exit(0);
|
||||
|
||||
|
||||
cw_discovery_init_results(&dis);
|
||||
/*cw_run_discovery(conn, "255.255.255.255","192.168.56.1", &dis);*/
|
||||
cw_run_discovery(conn, "255.255.255.255",NULL, &dis);
|
||||
cw_run_discovery(conn, "255.255.255.255","192.168.56.1", &dis);
|
||||
/* cw_run_discovery(conn, "255.255.255.255",NULL, &dis);*/
|
||||
cw_dbg_ktv_dump(dis.prio_ip, DBG_INFO, "=== IP list ===", "IP", "=== END IP List ===");
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user