From d420f572ee8471106d4d3a4de63a813795c5b4af Mon Sep 17 00:00:00 2001
From: "7u83@mail.ru" <7u83@mail.ru@noemail.net>
Date: Sun, 25 Mar 2018 19:39:31 +0000
Subject: [PATCH] Cisco AP Timesyn added
FossilOrigin-Name: 3f96b2b7c402a1b314c88a9573b26bd5296faa27a3ad50bf37fda9021b83f120
---
actube.workspace | 4 +--
src/cw/bstr.h | 2 +-
src/cw/msgset.h | 6 ++++
src/mod/cisco/Makefile | 2 +-
src/mod/cisco/capwap_cisco.h | 2 +-
src/mod/cisco/cisco_actions_ac.c | 44 +++++++++++++++++++++++---
src/mod/cisco/cisco_in_ac_descriptor.c | 13 +++++---
src/mod/cisco/mod_cisco.h | 4 +++
src/mod/fortinet/fortinet_actions_ac.c | 4 +--
9 files changed, 64 insertions(+), 17 deletions(-)
diff --git a/actube.workspace b/actube.workspace
index c63c2d68..e0162c79 100644
--- a/actube.workspace
+++ b/actube.workspace
@@ -4,8 +4,8 @@
-
-
+
+
diff --git a/src/cw/bstr.h b/src/cw/bstr.h
index 8ae05b46..2feff0ca 100644
--- a/src/cw/bstr.h
+++ b/src/cw/bstr.h
@@ -197,4 +197,4 @@ uint8_t * bstrv_create(uint32_t vendor_id, uint8_t *data, uint8_t len);
/**
* @} AGLOS
- */
\ No newline at end of file
+ */
diff --git a/src/cw/msgset.h b/src/cw/msgset.h
index d379bed3..d1f0068a 100644
--- a/src/cw/msgset.h
+++ b/src/cw/msgset.h
@@ -40,6 +40,11 @@ struct cw_ElemHandlerParams {
char * debug_details;
};
+union handlerType{
+ const struct cw_Type type;
+ int x;
+};
+
struct cw_ElemHandler {
const char * name;
int id;
@@ -48,6 +53,7 @@ struct cw_ElemHandler {
int min_len;
int max_len;
const struct cw_Type * type;
+/* union handlerType type; */
const char * key;
int (*get)(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,
uint8_t*data, int len);
diff --git a/src/mod/cisco/Makefile b/src/mod/cisco/Makefile
index b4056bc0..e1835181 100644
--- a/src/mod/cisco/Makefile
+++ b/src/mod/cisco/Makefile
@@ -7,6 +7,7 @@ OBJS=\
cisco_actions_ac.o \
cisco_in_wtp_descriptor.o \
cisco_out_wtp_descriptor.o \
+ cisco_in_ac_descriptor.o\
# cisco80211.o \
# cisco_out_radio_administrative_state.o \
@@ -17,7 +18,6 @@ OBJS=\
# cisco_out_ac_descriptor.o \
# cisco_out_telnet_ssh.o \
cisco_in_telnet_ssh.o \
- cisco_in_ac_descriptor.o\
cisco80211_in_mac_operation.o \
cisco80211_in_wtp_radio_configuration.o \
cisco80211_out_wtp_radio_configuration.o \
diff --git a/src/mod/cisco/capwap_cisco.h b/src/mod/cisco/capwap_cisco.h
index b2714fe4..ac2095e3 100644
--- a/src/mod/cisco/capwap_cisco.h
+++ b/src/mod/cisco/capwap_cisco.h
@@ -90,7 +90,7 @@
#define CW_CISCO_AP_POWER_INJECTOR_CONFIG 138
#define CW_CISCO_AP_MINIOS_VERSION 149
-#define CW_CISCO_AP_TIMESYNC 151
+#define CISCO_ELEM_AP_TIMESYNC 151
#define CW_CISCO_AP_DOMAIN 169
#define CW_CISCO_AP_DNS 170
diff --git a/src/mod/cisco/cisco_actions_ac.c b/src/mod/cisco/cisco_actions_ac.c
index 218c4306..e855631c 100644
--- a/src/mod/cisco/cisco_actions_ac.c
+++ b/src/mod/cisco/cisco_actions_ac.c
@@ -50,6 +50,17 @@ static struct cw_ElemHandler handlers[] = {
cisco_out_wtp_descriptor /* put */
}
,
+ {
+ "AC Descriptor (Cisco)", /* name */
+ CAPWAP_ELEM_AC_DESCRIPTOR, /* Element ID */
+ 0,0, /* Vendor / Proto */
+ 4,128, /* min/max length */
+ NULL, /* type */
+ "ac-descriptor", /* Key */
+ cisco_in_ac_descriptor, /* get */
+ NULL, /*cisco_out_ac_descriptor */ /* put */
+ }
+ ,
{
"RAD Name -> CAPWAP WTP Name", /* name */
CW_CISCO_RAD_NAME, /* Element ID */
@@ -60,7 +71,6 @@ static struct cw_ElemHandler handlers[] = {
cw_in_generic, /* get */
cw_out_generic /* put */
}
-
,
{
"Board Data Options", /* name */
@@ -73,6 +83,18 @@ static struct cw_ElemHandler handlers[] = {
cw_out_generic /* put */
}
,
+ {
+ "AP Time Sync", /* name */
+ CISCO_ELEM_AP_TIMESYNC, /* Element ID */
+ CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
+ 4,4, /* min/max length */
+ CW_TYPE_DWORD, /* type */
+ "cisco/ap-timesync", /* Key */
+ cw_in_generic, /* handler */
+ cw_out_generic /* put */
+ }
+ ,
+
{0,0,0,0,0,0,0,0}
};
@@ -88,6 +110,14 @@ static struct cw_ElemDef discovery_request_elements[] ={
};
+static int discovery_response_states[] = {CAPWAP_STATE_DISCOVERY,0};
+static struct cw_ElemDef discovery_response_elements[] ={
+ {0,CW_VENDOR_ID_CISCO, CISCO_ELEM_AP_TIMESYNC, 1, 0},
+ {0,0,0,00}
+
+};
+
+
static struct cw_MsgDef messages[] = {
{
"Discovery Request",
@@ -96,11 +126,15 @@ static struct cw_MsgDef messages[] = {
discovery_request_states,
discovery_request_elements
},
-
+ {
+ "Discovery Response",
+ CAPWAP_MSG_DISCOVERY_RESPONSE,
+ CW_RECEIVER_WTP,
+ discovery_response_states,
+ discovery_response_elements
+ },
{0,0,0,0}
-
-
-
+
};
diff --git a/src/mod/cisco/cisco_in_ac_descriptor.c b/src/mod/cisco/cisco_in_ac_descriptor.c
index d42bc32c..b1d12f0a 100644
--- a/src/mod/cisco/cisco_in_ac_descriptor.c
+++ b/src/mod/cisco/cisco_in_ac_descriptor.c
@@ -5,16 +5,19 @@
#include "cw/vendors.h"
-int cisco_in_ac_descriptor(struct conn *conn, struct cw_action_in *a, uint8_t * data,
- int len, struct sockaddr *from)
+int cisco_in_ac_descriptor(struct cw_ElemHandler *eh,
+ struct cw_ElemHandlerParams *params,
+ uint8_t * data, int len)
{
static struct cw_DescriptorSubelemDef allowed[] = {
- {CW_VENDOR_ID_CISCO,0, CW_ITEM_AC_HARDWARE_VERSION, 1024,1},
- {CW_VENDOR_ID_CISCO,1, CW_ITEM_AC_SOFTWARE_VERSION, 1024,1},
+ {CW_VENDOR_ID_CISCO,0, "hardware", 1024,1},
+ {CW_VENDOR_ID_CISCO,1, "software", 1024,1},
{0,0, NULL,0, 0}
};
+ return cw_read_ac_descriptor(params->conn->remote_cfg,eh,params,data,len,allowed);
- return cw_read_ac_descriptor(conn->config,data,len,allowed);
+
+ /*return cw_read_ac_descriptor(conn->config,data,len,allowed);*/
}
diff --git a/src/mod/cisco/mod_cisco.h b/src/mod/cisco/mod_cisco.h
index 59b6fcfa..8216a2c7 100644
--- a/src/mod/cisco/mod_cisco.h
+++ b/src/mod/cisco/mod_cisco.h
@@ -8,4 +8,8 @@ int cisco_in_wtp_descriptor(struct cw_ElemHandler *eh, struct cw_ElemHandlerPara
int cisco_out_wtp_descriptor(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params
, uint8_t * dst);
+int cisco_in_ac_descriptor(struct cw_ElemHandler *eh,
+ struct cw_ElemHandlerParams *params,
+ uint8_t * data, int len);
+
#endif
diff --git a/src/mod/fortinet/fortinet_actions_ac.c b/src/mod/fortinet/fortinet_actions_ac.c
index de45b994..cad4cb8d 100644
--- a/src/mod/fortinet/fortinet_actions_ac.c
+++ b/src/mod/fortinet/fortinet_actions_ac.c
@@ -185,7 +185,7 @@ static cw_action_out_t actions_out[]={
.msg_id = CAPWAP_MSG_DISCOVERY_RESPONSE,
.item_id = CW_ITEM_AC_TIMESTAMP,
.vendor_id = CW_VENDOR_ID_CISCO,
- .elem_id = CW_CISCO_AP_TIMESYNC,
+ .elem_id = CISCO_ELEM_AP_TIMESYNC,
.out = cisco_out_ap_timesync,
.mand = 1
}
@@ -229,7 +229,7 @@ static cw_action_out_t actions_out[]={
.msg_id = CAPWAP_MSG_ECHO_RESPONSE,
.vendor_id = CW_VENDOR_ID_CISCO,
.item_id = CW_ITEM_AC_TIMESTAMP,
- .elem_id = CW_CISCO_AP_TIMESYNC,
+ .elem_id = CISCO_ELEM_AP_TIMESYNC,
.out = cisco_out_ap_timesync,
.mand = 1
}