Work on val guards

FossilOrigin-Name: 69426308a4a2eea0651e3ce9ae81e01ae283cb271ec61f5386b04a686bed9fae
This commit is contained in:
7u83@mail.ru 2018-04-25 05:54:09 +00:00
parent 06ff52d5e3
commit 98c682e7e6
4 changed files with 146 additions and 29 deletions

View File

@ -44,6 +44,9 @@ struct cw_KTV {
};
typedef struct cw_KTV cw_KTV_t;
/**
* @class cw_Type
* @author 7u83
@ -93,6 +96,31 @@ struct cw_KTVStruct {
int position;
};
enum cw_Types {
CW_BYTE,
CW_WORD,
CW_DWORD,
CW_STR
};
struct cw_KTVValRange {
int min,max;
const char * name;
};
typedef struct cw_KTVValRange cw_KTVValRange_t;
struct cw_KTVData {
int position;
uint8_t type;
const char *key;
int len;
struct cw_KTVValRange *ranges;
};
typedef struct cw_KTVData cw_KTVData_t;
typedef struct cw_KTVStruct cw_KTVStruct_t;
#define CW_KTVSTRUCT_L16 -2

View File

@ -494,6 +494,80 @@ static cw_KTVStruct_t cisco_ssc_hash[]={
};
static cw_KTVValRange_t range_bool[] = {
{0,0,"false"},
{1,65536, "true"},
{0,0,NULL}
};
static cw_KTVValRange_t range_operstate[] = {
{1,1,"Disabled"},
{2,2,"Enabled"},
{0,0,NULL}
};
static cw_KTVValRange_t range_cause[] = {
{0,0,"Normal"},
{1,1,"Radio Failure"},
{2,2,"Software Failure"},
{3,3,"Administratively Set"},
{0,0,NULL}
};
static cw_KTVData_t radio_operational_state[] = {
{0, CW_BYTE, "state", 1, range_operstate},
{0, CW_BYTE, "cause", 1, range_cause},
{0,0,NULL,0}
};
static cw_KTVData_t radio_admin_state[] = {
{0, CW_BYTE, "state", 1, range_operstate},
{0, CW_BYTE, "cause", 1, range_cause},
{0,0,NULL,0}
};
static const char * get_name(cw_KTVValRange_t *range,int x)
{
}
static int read_struct(cw_KTVData_t *stru, const char *parentkey)
{
char key[CW_KTV_MAX_KEY_LEN];
int pos;
pos = 0;
while (stru->key != NULL){
if (stru->position!=-1)
pos = stru->position;
}
return 0;
}
static int cisco_data(struct cw_ElemHandler *eh,
struct cw_ElemHandlerParams *params,
uint8_t * data, int len)
{
int wlan_id, radio_id;
char key[CW_KTV_MAX_KEY_LEN];
radio_id=cw_get_byte(data);
wlan_id=cw_get_word(data+1);
sprintf(key,"radio.%d/wlan.%d",radio_id,wlan_id);
read_struct(eh->type,key);
cw_dbg(DBG_INFO,"Del WLAN rid=%d, id=%d",wlan_id);
return 0;
}
static struct cw_ElemHandler handlers73[] = {
{
@ -1140,7 +1214,33 @@ static struct cw_ElemHandler handlers73[] = {
NULL
}
,
{
"Radio Operational State Cisco", /* name */
CAPWAP_ELEM_RADIO_OPERATIONAL_STATE, /* Element ID */
0,0, /* Vendor / Proto */
3,3, /* min/max length */
radio_operational_state, /* type */
"radio_operational_state", /* Key */
cisco_data, /* get */
NULL, /* put */
NULL
}
,
{
"Radio Administrative State Cisco", /* name */
CAPWAP_ELEM_RADIO_ADMINISTRATIVE_STATE, /* Element ID */
0,0, /* Vendor / Proto */
2,2, /* min/max length */
radio_admin_state, /* type */
"radio_admin_state", /* Key */
cisco_data, /* get */
NULL, /* put */
NULL
}
,
{0,0,0,0,0,0,0,0}

View File

@ -1,3 +1,4 @@
ac-descriptor/active-wtps :Word: 1
ac-descriptor/dtls-policy :Byte: 0
ac-descriptor/hardware/vendor :Dword: 4232704
ac-descriptor/hardware/version :Bstr16: .x01000001
@ -15,19 +16,20 @@ ac-name-with-index.1 :Bstr16: nudelnudel
ac-name-with-index.2 :Bstr16: nadelnalde
ac-name-with-priority/X1 :Byte: 3
ac-name-with-priority/ac2 :Byte: 5
capwap-control-ip-address/address.0 :IPAddress: 192.168.0.175
capwap-control-ip-address/address.1 :IPAddress: 192.168.0.175
capwap-control-ip-address/address.2 :IPAddress: 192.168.0.173
capwap-control-ip-address/wtps.0 :Word: 1
capwap-control-ip-address/wtps.1 :Word: 2
capwap-control-ip-address/wtps.2 :Word: 2
capwap-local-ip-address :IPAddress: 172.16.66.50
capwap-control-ip-address/address.0 :IPAddress: 192.168.56.175
capwap-control-ip-address/address.1 :IPAddress: 192.168.56.175
capwap-control-ip-address/address.2 :IPAddress: 192.168.56.173
capwap-control-ip-address/wtps.0 :Word: 0
capwap-control-ip-address/wtps.1 :Word: 1
capwap-control-ip-address/wtps.2 :Word: 1
capwap-local-ip-address :IPAddress: 192.168.56.1
capwap-timers/echo-interval :Byte: 30
capwap-timers/max-discovery-interval :Byte: 10
capwap-timers/min-discovery-interval :Byte: 0
cisco/ac-ip-addr-with-index.0 :IPAddress: 1.1.1.1
cisco/ac-ip-addr-with-index.1 :IPAddress: 9.9.9.9
cisco/ac-ip-addr-with-index.2 :IPAddress: 3.3.3.3
cisco/ap-core-dump/compression :Bool: false
cisco/ap-core-dump/enable :Bool: false
cisco/ap-core-dump/filename :Str: 7.7.7.7
cisco/ap-core-dump/tftp-server :IPAddress: 7.7.7.7
@ -56,7 +58,7 @@ cisco/ap-regulatory-domain.1/slot :Byte: 1
cisco/ap-sub-mode :Byte: 0
cisco/ap-telnet-ssh/ssh :Bool: false
cisco/ap-telnet-ssh/telnet :Bool: false
cisco/ap-timesync/timestamp :Dword: 1524549734
cisco/ap-timesync/timestamp :Dword: 1524598078
cisco/ap-timesync/type :Byte: 0
cisco/ap-username-and-password/802.1x-credentials/option :Word: 2
cisco/ap-username-and-password/802.1x-credentials/password :Str:
@ -66,11 +68,11 @@ cisco/ap-username-and-password/login-credentials/option :Word: 1025
cisco/ap-username-and-password/login-credentials/password :Str: $1$R1hh$.3Jgrg.1DHuxmiQVDNqxB.
cisco/ap-username-and-password/login-credentials/username :Str: admin
cisco/ap-venue-settings/group :Word: 2
cisco/ap-venue-settings/language :Str: en
cisco/ap-venue-settings/language :Str: de
cisco/ap-venue-settings/name :Str:
cisco/ap-venue-settings/type :Byte: 1
cisco/board-data-options :Dword: 16777217
cisco/hash/hash :Bstr16: 88ba29f4725fcbc8fd02843186b94692f107ecb0
cisco/hash/hash :Bstr16: d8e176aae5120af7477c67939c43a31dd714fcbc
cisco/hash/validate :Bool: true
cisco/loghost-config/last-joined-ap :Str:
cisco/loghost-config/loghost.0 :IPAddress: 7.7.1.3
@ -82,8 +84,8 @@ cisco/lw_path_mtu/max :Word: 1485
cisco/mwar-addr/address :IPAddress: 192.168.0.180
cisco/mwar-addr/mwar-type :Byte: 1
cisco/mwar-addr/unknown :Word: 0
cisco/mwar-hash-value :Bstr16: 88ba29f4725fcbc8fd02843186b94692f107ecb0
cisco/mwar-type :Byte: 1
cisco/mwar-hash-value :Bstr16: d8e176aae5120af7477c67939c43a31dd714fcbc
cisco/mwar-type :Byte: 0
cisco/rouge-and-mss/enable :Bool: false
cisco/rouge-and-mss/mss :Word: 666
cisco/rouge-and-mss/roge-detection :Bool: true
@ -159,7 +161,7 @@ radio.0/wlan.0/ssid-a :Str: Schlosspark
radio.0/wlan.0/wep-key :Bstr16: .xaa0c0a02000000000000000000
radio.0/wlan.0/wlan-capability :Word: 1057
radio.0/wlan.0/wlan-id :Byte: 0
radio.0/wtp-radio-information :Dword: 1
radio.0/wtp-radio-information :Dword: 3
radio.1/admin-state :Byte: 1
radio.1/cisco-multi-domain-capability/first-channel :Word: 36
radio.1/cisco-multi-domain-capability/max-tx-power-level :Word: 65535
@ -195,19 +197,6 @@ radio.1/decryption-error-report-period :Word: 120
radio.1/operational-state/cause :Byte: 0
radio.1/operational-state/state :Byte: 2
radio.1/rate_set :Bstr16: .x8c129824b048606c
radio.1/wlan.0/allow-aaa-override :Byte: 1
radio.1/wlan.0/broadcast-ssid :Bool: true
radio.1/wlan.0/dtim-period :Byte: 99
radio.1/wlan.0/encryption :Byte: 0
radio.1/wlan.0/encryption-policy :Dword: 16777216
radio.1/wlan.0/max-stations :Byte: 155
radio.1/wlan.0/radio-id :Byte: 1
radio.1/wlan.0/session-timout :Word: 0
radio.1/wlan.0/ssid :Str: Schlosspark
radio.1/wlan.0/ssid-a :Str: Schlosspark
radio.1/wlan.0/wep-key :Bstr16: .xaa0c0a02000000000000000000
radio.1/wlan.0/wlan-capability :Word: 1
radio.1/wlan.0/wlan-id :Byte: 0
radio.1/wtp-radio-information :Dword: 2
radio.255/admin-state :Byte: 1
radio.255/operational-state/cause :Byte: 0
@ -223,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 :Bstr16: .x00006215
session-id: .x00006215
statistics-timer :Word: 60
tube.0/main :Byte: 12
tube.0/zumsel :Byte: 12

View File

@ -192,8 +192,8 @@ exit(0);
cw_discovery_init_results(&dis);
/* cw_run_discovery(conn, "255.255.255.255","172.16.66.100", &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 ===");
/*