cisco stuff

FossilOrigin-Name: 28919aeeb55dff78c49d2d6a1d41c4cee67a936d6e17abc352927c8911e368ea
This commit is contained in:
7u83@mail.ru 2018-04-20 03:46:50 +00:00
parent fd9f71d99c
commit 80239758e7
12 changed files with 209 additions and 20 deletions

View File

@ -290,6 +290,8 @@
<File Name="src/cw/cw_out_radio_generic_struct.c"/>
<File Name="src/cw/cw_ktv_base_exists.c"/>
<File Name="src/cw/cw_ktv_save.c"/>
<File Name="src/cw/cw_in_generic_with_index.c"/>
<File Name="src/cw/cw_out_generic_with_index.c"/>
</VirtualDirectory>
</VirtualDirectory>
<Description/>

View File

@ -38,7 +38,7 @@ result-code :Dword: 0
ac-name:Bstr16:"CiscoAC73"
ac-name:Bstr16:"X1"
#capwap-control-ip-address/address.0:IPAddress:1192.168.0.14
capwap-control-ip-address/address.0:IPAddress:192.168.0.14

View File

@ -58,6 +58,7 @@ CWSRC=\
cw_in_check_join_req.c\
cw_in_check_join_resp.c\
cw_in_generic.c\
cw_in_generic_with_index.c\
cw_in_generic_struct.c\
cw_in_radio_generic_struct.c\
cw_in_idx_generic.c\
@ -71,6 +72,7 @@ CWSRC=\
cw_is_printable.c\
cw_load_file.c\
cw_out_generic.c\
cw_out_generic_with_index.c\
cw_out_radio_administrative_states.c\
cw_process_element.c\
cw_put_elem_radio_administrative_state.c\

View File

@ -198,14 +198,14 @@
#define CAPWAP_ELEM_AC_IPV4_LIST 2 /**< AC IP V4 List */
#define CAPWAP_ELEM_AC_IPV6_LIST 3 /**< AC IP V6 List */
#define CAPWAP_ELEM_AC_NAME 4 /**< AC Name */
#define CW_ELEM_AC_NAME_WITH_PRIORITY 5
#define CAPWAP_ELEM_AC_NAME_WITH_PRIORITY 5 /**< AC Name with Priority */
/**
* In CAPWAP RFC draft 7 the message element 5 was named
* AC Name With Index. So we define it here with this name
* to be compatible.
* @see CW_ELEM_AC_NAME_WITH_PRIORITY */
#define CW_ELEM_AC_NAME_WITH_INDEX CW_ELEM_AC_NAME_WITH_PRIORITY
#define CW_ELEM_AC_NAME_WITH_INDEX CAPWAP_ELEM_AC_NAME_WITH_PRIORITY
#define CAPWAP_ELEM_AC_TIMESTAMP 6
/**@{

View File

@ -7,7 +7,7 @@ struct cw_StrListElem capwap_strings_elem[] = {
{CAPWAP_ELEM_AC_IPV4_LIST, "AC IPv4 List"},
{CAPWAP_ELEM_AC_IPV6_LIST, "AC IPv6 List"},
{CAPWAP_ELEM_AC_NAME, "AC Name"},
{CW_ELEM_AC_NAME_WITH_PRIORITY, "AC Name with Priority"},
{CAPWAP_ELEM_AC_NAME_WITH_PRIORITY, "AC Name with Priority"},
/* {CW_ELEM_AC_NAME_WITH_INDEX, "AC Name with Index"}, */
{CAPWAP_ELEM_AC_TIMESTAMP, "AC Timestamp"},
{CW_ELEM_ADD_MAC_ACL_ENTRY, "Add MAC ACL Entry"},

View File

@ -390,6 +390,13 @@ int cw_setup_dtls(struct conn * conn, mavl_t cfg, const char *prefix, char * de
int cw_in_idx_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,
uint8_t * elem_data, int elem_len);
int cw_in_generic_with_index(struct cw_ElemHandler *eh,
struct cw_ElemHandlerParams *params,
uint8_t * data, int len);
int cw_out_generic_with_index(struct cw_ElemHandler * eh,
struct cw_ElemHandlerParams * params, uint8_t * dst);
int cw_in_idx_generic_struct(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,
uint8_t * elem_data, int elem_len);

View File

@ -0,0 +1,14 @@
#include "cw.h"
int cw_in_generic_with_index(struct cw_ElemHandler *eh,
struct cw_ElemHandlerParams *params,
uint8_t * data, int len)
{
char key[CW_KTV_MAX_KEY_LEN];
int idx;
idx = cw_get_byte(data);
sprintf(key,"%s.%d",eh->key,idx);
cw_ktv_add(params->conn->remote_cfg,key,eh->type,data+1,len-1);
return 1;
}

View File

@ -0,0 +1,40 @@
#include "cw.h"
int cw_out_generic_with_index(struct cw_ElemHandler * eh,
struct cw_ElemHandlerParams * params, uint8_t * dst)
{
char key[CW_KTV_MAX_KEY_LEN];
int idx;
cw_KTV_t * result, search;
int len,start;
uint8_t * ob;
idx = 0;
ob = dst;
do {
sprintf(key,"%s.%d",eh->key,idx);
search.key=key;
result = mavl_get_first(params->conn->local_cfg,&search);
if (result==NULL)
break;
if (strncmp(result->key,key,strlen(key))!=0)
break;
start = params->conn->header_len(eh);
len = cw_put_byte(ob+start,idx);
len += result->type->put(result,ob+start+len);
ob += params->conn->write_header(eh,ob,len);
idx++;
}while(1);
return ob-dst;
}

View File

@ -371,7 +371,17 @@ static struct cw_ElemHandler handlers[] = {
}
,
{
"AC Name with Priority", /* name */
CAPWAP_ELEM_AC_NAME_WITH_PRIORITY, /* Element ID */
0,0, /* Vendor / Proto */
1,513, /* min/max length */
CW_TYPE_BSTR16, /* type */
"ac-name-with-index", /* Key */
cw_in_generic_with_index, /* get */
cw_out_generic_with_index /* put */
}
,
{0,0,0,0,0,0,0,0}
};
@ -446,6 +456,7 @@ static struct cw_ElemDef configuration_status_request_elements[] ={
{0,0,CAPWAP_ELEM_STATISTICS_TIMER, 1, 0},
{0,0,CAPWAP_ELEM_WTP_REBOOT_STATISTICS, 1, 0},
{0,0,CAPWAP_ELEM_AC_NAME_WITH_PRIORITY, 0, 0},
{0,0,CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD, 0, CW_IGNORE},
{0,0,0,0,0}
};
@ -473,6 +484,9 @@ static struct cw_ElemDef configuration_update_request_elements[] ={
{0,0,0,0,0}
};
static int configuration_update_response_states[] = {CAPWAP_STATE_RUN,0};
static struct cw_ElemDef configuration_update_response_elements[] ={
{0,0,CAPWAP_ELEM_RESULT_CODE, 1, 0},
@ -480,6 +494,35 @@ static struct cw_ElemDef configuration_update_response_elements[] ={
{0,0,0,0,0}
};
static int change_state_event_request_states[] = {CAPWAP_STATE_JOIN,0};
static struct cw_ElemDef change_state_event_request_elements[] ={
{0,0,CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD, 0, CW_IGNORE},
{0,0,0,0,0}
};
static int change_state_event_response_states[] = {CAPWAP_STATE_JOIN,0};
static struct cw_ElemDef change_state_event_response_elements[] ={
{0,0,CAPWAP_ELEM_RESULT_CODE, 1, 0},
{0,0,0,0,0}
};
static int wtp_event_request_states[] = {CAPWAP_STATE_JOIN,0};
static struct cw_ElemDef wtp_event_request_elements[] ={
{0,0,CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD, 0, CW_IGNORE},
{0,0,0,0,0}
};
static int wtp_event_response_states[] = {CAPWAP_STATE_JOIN,0};
static struct cw_ElemDef wtp_event_response_elements[] ={
{0,0,CAPWAP_ELEM_RESULT_CODE, 1, 0},
{0,0,0,0,0}
};
static int echo_request_states[] = {CAPWAP_STATE_RUN,0};
static struct cw_ElemDef echo_request_elements[] ={
@ -560,6 +603,38 @@ static struct cw_MsgDef messages[] = {
configuration_update_response_elements /* msg elements */
},
{
"Change State Event Request", /* name */
CAPWAP_MSG_CHANGE_STATE_EVENT_REQUEST, /* msg type */
CW_ROLE_AC, /* role */
change_state_event_request_states, /* allowed states */
change_state_event_request_elements /* msg elements */
},
{
"Change State Event Reponse", /* name */
CAPWAP_MSG_CHANGE_STATE_EVENT_RESPONSE, /* msg type */
CW_ROLE_WTP, /* role */
change_state_event_response_states, /* allowed states */
change_state_event_response_elements /* msg elements */
},
{
"WTP Event Request", /* name */
CAPWAP_MSG_WTP_EVENT_REQUEST, /* msg type */
CW_ROLE_AC, /* role */
wtp_event_request_states, /* allowed states */
wtp_event_request_elements /* msg elements */
},
{
"WTP Event Reponse", /* name */
CAPWAP_MSG_WTP_EVENT_RESPONSE, /* msg type */
CW_ROLE_WTP, /* role */
wtp_event_response_states, /* allowed states */
wtp_event_response_elements /* msg elements */
},
{
"Echo Request", /* name */

View File

@ -319,7 +319,6 @@ int cisco_in_with_index(struct cw_ElemHandler *eh,
sprintf(key,"%s.%d",eh->key,idx);
cw_ktv_add(params->conn->remote_cfg,key,eh->type,data+1,len-1);
return 1;
}
@ -868,9 +867,9 @@ static struct cw_ElemHandler handlers[] = {
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
1,513, /* min/max length */
CW_TYPE_BSTR16, /* type */
"cisco/ac-name-with-index", /* Key */
cisco_in_with_index, /* get */
cisco_out_with_index /* put */
"ac-name-with-index", /* Key */
cw_in_generic_with_index, /* get */
cw_out_generic_with_index /* put */
}
,
@ -881,8 +880,8 @@ static struct cw_ElemHandler handlers[] = {
5,5, /* min/max length */
CW_TYPE_IPADDRESS, /* type */
"cisco/ac-ip-addr-with-index", /* Key */
cisco_in_with_index, /* get */
cisco_out_with_index /* put */
cw_in_generic_with_index, /* get */
cw_out_generic_with_index /* put */
}
,
{
@ -897,6 +896,20 @@ static struct cw_ElemHandler handlers[] = {
}
,
{
"LWAPP 20", /* name */
CISCO_LWELEM_20, /* Element ID */
CW_VENDOR_ID_CISCO,CW_PROTO_LWAPP, /* Vendor / Proto */
1,11, /* min/max length */
CW_TYPE_BSTR16, /* type */
"lwapp20", /* Key */
cw_in_generic, /* get */
cw_out_generic /* put */
}
,
{0,0,0,0,0,0,0,0}
};
@ -958,7 +971,8 @@ static struct cw_ElemDef join_response_elements[] ={
static int configuration_status_request_states[] = {CAPWAP_STATE_JOIN,0};
static struct cw_ElemDef configuration_status_request_elements[] ={
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_SPAM_VENDOR_SPECIFIC,0, CW_IGNORE},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_UPTIME, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_LED_STATE_CONFIG, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_LOG_FACILITY, 0, 0},
@ -975,7 +989,7 @@ static struct cw_ElemDef configuration_status_request_elements[] ={
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_MODEL, 1, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_RESET_BUTTON_STATE, 1, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_WTP_RADIO_CONFIGURATION, 1, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AC_NAME_WITH_INDEX, 0, 0},
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_AC_NAME_WITH_INDEX, 0, CW_IGNORE},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_USERNAME_PASSWORD, 1, 0},
@ -985,7 +999,8 @@ static struct cw_ElemDef configuration_status_request_elements[] ={
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_ETHERNET_PORT_SUBTYPE, 1, 0},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AC_IP_ADDR_WITH_INDEX, 0, 0},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_AP_FAILOVER_PRIORITY, 1, 0},
{CW_PROTO_LWAPP, CW_VENDOR_ID_CISCO, CISCO_LWELEM_20, 1, 0},
{0,0,0,00}
};
@ -1050,7 +1065,19 @@ static struct cw_ElemDef configuration_update_request_elements[] ={
};
static int wtp_event_request_states[] = {CAPWAP_STATE_JOIN,0};
static struct cw_ElemDef wtp_event_request_elements[] ={
{0, CW_VENDOR_ID_CISCO, CISCO_ELEM_SPAM_VENDOR_SPECIFIC,0, CW_IGNORE},
{0,0,0,0,0}
};
static int wtp_event_response_states[] = {CAPWAP_STATE_JOIN,0};
static struct cw_ElemDef wtp_event_response_elements[] ={
/* {0,0,CAPWAP_ELEM_RESULT_CODE, 1, 0},*/
{0,0,0,0,0}
};
static struct cw_MsgDef messages[] = {
{
@ -1114,6 +1141,21 @@ static struct cw_MsgDef messages[] = {
},
{
NULL, /* name */
CAPWAP_MSG_WTP_EVENT_REQUEST, /* msg type */
CW_ROLE_AC, /* role */
wtp_event_request_states, /* allowed states */
wtp_event_request_elements /* msg elements */
},
{
NULL, /* name */
CAPWAP_MSG_WTP_EVENT_RESPONSE, /* msg type */
CW_ROLE_WTP, /* role */
wtp_event_response_states, /* allowed states */
wtp_event_response_elements /* msg elements */
},
{0,0,0,0}

View File

@ -30,6 +30,7 @@
#define CISCO_LWELEM_AP_USERNAME_PASSWORD 18
#define LW_CISCO_MANAGER_IP_ADDR 19
#define CISCO_LWELEM_20 20
#define LW_CISCO_RADIO_MODULE_INFO 21
#define CISCO_LWELEM_AC_IP_ADDR_WITH_INDEX 32
#define CISCO_LWELEM_AP_ETHERNET_PORT_SUBTYPE 34

View File

@ -10,7 +10,10 @@ ac-descriptor/software/version :Bstr16: .x07036500
ac-descriptor/station-limit :Word: 1000
ac-descriptor/stations :Word: 0
ac-name :Bstr16: CiscoAC73
ac-name-with-priority/TubesAC :Byte: 3
ac-name-with-index.0 :Bstr16: CiscoAC73
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.173
capwap-control-ip-address/address.1 :IPAddress: d96c:4c0a:da6c:4c0a:db6c:4c0a:dc6c:4c0a
@ -25,10 +28,7 @@ capwap-timers/min-discovery-interval :Byte: 0
cisco/ac-ip-addr-with-index.0 :IPAddress: 0.0.0.0
cisco/ac-ip-addr-with-index.1 :IPAddress: 9.9.9.9
cisco/ac-ip-addr-with-index.2 :IPAddress: 8.8.8.8
cisco/ac-name-with-index.0 :Bstr16: CiscoAC73
cisco/ac-name-with-index.1 :Bstr16: nudelnudel
cisco/ac-name-with-index.2 :Bstr16: nadelnalde
cisco/ap-failover-priority :Byte: 4
cisco/ap-failover-priority :Byte: 2
cisco/ap-group-name :Bstr16: default-group
cisco/ap-led-state-config/led-state :Byte: 1
cisco/ap-led-state-config/save-flag :Byte: 1
@ -43,9 +43,14 @@ cisco/ap-regulatory-domain.1/set :Bool: true
cisco/ap-regulatory-domain.1/slot :Byte: 1
cisco/ap-telnet-ssh/ssh :Bool: false
cisco/ap-telnet-ssh/telnet :Bool: false
cisco/ap-timesync/timestamp :Dword: 1524133283
cisco/ap-timesync/timestamp :Dword: 1524181577
cisco/ap-timesync/type :Byte: 0
cisco/board-data-options :Dword: 16777217
cisco/loghost-config/last-joined-ap :Str:
cisco/loghost-config/loghost.0 :IPAddress: 7.7.1.3
cisco/loghost-config/loghost.1 :IPAddress: 0.0.0.0
cisco/loghost-config/loghost.2 :IPAddress: 0.0.0.0
cisco/loghost-config/loghost.3 :IPAddress: 0.0.0.0
cisco/lw_path_mtu/len :Word: 1095
cisco/lw_path_mtu/max :Word: 1485
cisco/mwar-addr/address :IPAddress: 192.168.0.180
@ -59,6 +64,7 @@ cisco/ssl-keyfile :Str: ../../ssl/certs/wtpc.key
discovery-type :Byte: 0
idle-timeout :Dword: 300
location-data :Bstr16: "superposition\"tobias"
lwapp20 :Bstr16: .x000001
maximum-message-length :Word: 4096
radio.0/admin-state :Byte: 1
radio.0/cisco-multi-domain-capability/first-channel :Word: 1