2014-08-14 18:23:17 +02:00
|
|
|
/*
|
|
|
|
This file is part of libcapwap.
|
|
|
|
|
|
|
|
libcapwap 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/>.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2015-03-16 02:41:35 +01:00
|
|
|
/**
|
|
|
|
* @file
|
2015-03-23 19:40:39 +01:00
|
|
|
* @brief Cisco specific CAPWAP definitions
|
2015-03-16 02:41:35 +01:00
|
|
|
*/
|
|
|
|
|
2014-08-14 17:18:19 +02:00
|
|
|
#ifndef __CAPWAP_CISCO_H
|
|
|
|
#define __CAPWAP_CISCO_H
|
|
|
|
|
2015-03-14 10:15:12 +01:00
|
|
|
#include <string.h>
|
2015-03-23 19:40:39 +01:00
|
|
|
#include <time.h>
|
2015-03-14 10:15:12 +01:00
|
|
|
|
2015-03-15 20:53:21 +01:00
|
|
|
#include "lwapp.h"
|
2015-03-23 19:40:39 +01:00
|
|
|
#include "capwap.h"
|
2015-03-14 10:15:12 +01:00
|
|
|
|
2015-03-29 15:36:23 +02:00
|
|
|
#define CW_CISCO_MWAR_ADDR LW_ELEM_AC_ADDRESS /* 2 */
|
2015-03-28 18:32:03 +01:00
|
|
|
#define CW_CISCO_RAD 3
|
|
|
|
#define CW_CISCO_RAD_SLOT 4
|
|
|
|
#define CW_CISCO_RAD_NAME LW_ELEM_WTP_NAME /* 5 */
|
|
|
|
#define CW_CISCO_MWAR LW_ELEM_AC_DESCRIPTOR /* 6 */
|
2015-03-29 15:36:23 +02:00
|
|
|
#define CW_CISCO_ADD_WLAN LW_ELEM_80211_ADD_WLAN /* 7 */
|
2015-03-29 01:55:06 +01:00
|
|
|
#define CW_CISCO_WTP_RADIO_CFG 8
|
2014-08-14 17:18:19 +02:00
|
|
|
|
2015-03-28 18:32:03 +01:00
|
|
|
#define CW_CISCO_MULTI_DOMAIN_CAPAB LW_ELEM_80211_MULTI_DOMAIN_CAPABILITY /* 10 */
|
2015-03-29 15:36:23 +02:00
|
|
|
#define CW_CISCO_MAC_OPERATION LW_ELEM_80211_MAC_OPERATION /* 11 */
|
|
|
|
|
|
|
|
#define CW_CISCO_TX_POWER LW_ELEM_80211_TX_POWER /* 12 */
|
|
|
|
#define CW_CISCO_TX_POWER_LEVELS LW_ELEM_80211_TX_POWER_LEVELS /* 13 */
|
|
|
|
#define CW_CISCO_DIRECT_SEQUENCE_CONTROL LW_ELEM_DIRECT_SEQUENCE_CONTROL /* 14 */
|
|
|
|
#define CW_CISCO_SUPPORTED_RATES LW_ELEM_80211_RATE_SET /* 16 */
|
|
|
|
|
|
|
|
|
2015-03-29 01:55:06 +01:00
|
|
|
#define CW_CISCO_LOCATION_DATA LW_ELEM_LOCATION_DATA /* 35 */
|
|
|
|
#define CW_CISCO_STATISTICS_TIMER LW_ELEM_STATISTICS_TIMER /* 37 */
|
2015-03-15 20:53:21 +01:00
|
|
|
|
2015-03-29 15:36:23 +02:00
|
|
|
#define CW_CISCO_ANTENNA_PAYLOAD 41
|
|
|
|
|
2015-03-28 18:32:03 +01:00
|
|
|
#define CW_CISCO_CERTIFICATE LW_ELEM_CERTIFICATE /* 44 */
|
|
|
|
#define CW_CISCO_WTP_BOARD_DATA LW_ELEM_WTP_BOARD_DATA /* 50 */
|
|
|
|
#define CW_CISCO_AP_MODE_AND_TYPE LW_ELEM_80211_WTP_MODE_AND_TYPE /* 54 */
|
2015-03-16 02:41:35 +01:00
|
|
|
|
2015-03-29 01:55:06 +01:00
|
|
|
#define CW_CISCO_AC_IPV4_LIST LW_ELEM_AC_IPV4_LIST /* 59 */
|
|
|
|
|
|
|
|
|
|
|
|
#define CW_CISCO_AP_STATIC_IP_ADDR 83
|
|
|
|
|
|
|
|
#define CW_CISCO_AC_NAME_WITH_INDEX 91
|
2015-03-15 20:53:21 +01:00
|
|
|
|
2015-03-28 18:32:03 +01:00
|
|
|
#define CW_CISCO_SPAM_VENDOR_SPECIFIC 104
|
2015-03-15 20:53:21 +01:00
|
|
|
|
2015-03-28 18:32:03 +01:00
|
|
|
#define CW_CISCO_AP_GROUP_NAME 123
|
2015-03-29 15:36:23 +02:00
|
|
|
#define CW_CISCO_AP_MODEL 127
|
|
|
|
#define CW_CISCO_AP_RESET_BUTTON_STATE 128
|
2015-03-15 20:53:21 +01:00
|
|
|
|
2015-03-28 18:32:03 +01:00
|
|
|
#define CW_CISCO_AP_LED_STATE_CONFIG 125
|
|
|
|
#define CW_CISCO_AP_REGULATORY_DOMAIN 126
|
2015-03-15 20:53:21 +01:00
|
|
|
|
2015-03-29 15:36:23 +02:00
|
|
|
#define CW_CISCO_LWAPP_CHANNEL_POWER 134
|
2015-03-28 18:32:03 +01:00
|
|
|
#define CW_CISCO_AP_PRE_STD_SWITCH_CONFIG 137
|
|
|
|
#define CW_CISCO_AP_POWER_INJECTOR_CONFIG 138
|
|
|
|
|
2015-03-29 15:36:23 +02:00
|
|
|
#define CW_CISCO_AP_MINIOS_VERSION 149
|
2015-03-28 18:32:03 +01:00
|
|
|
#define CW_CISCO_AP_TIMESYNC 151
|
2015-03-29 01:55:06 +01:00
|
|
|
#define CW_CISCO_AP_DOMAIN 169
|
|
|
|
#define CW_CISCO_AP_DNS 170
|
|
|
|
|
2015-03-28 18:32:03 +01:00
|
|
|
|
|
|
|
#define CW_CISCO_BOARD_DATA_OPTIONS 207
|
|
|
|
#define CW_CISCO_MWAR_TYPE 208
|
2015-03-16 02:41:35 +01:00
|
|
|
|
2015-03-14 21:41:50 +01:00
|
|
|
|
2014-08-14 17:18:19 +02:00
|
|
|
|
2015-03-23 19:40:39 +01:00
|
|
|
/**
|
|
|
|
* Add a Cisco AP Timesync message element to a buffer
|
|
|
|
* @param dst destination buffer
|
|
|
|
* @param time a unix timestamp
|
|
|
|
* @param type of time
|
|
|
|
* @return number of bytes put (15)
|
|
|
|
*/
|
|
|
|
static inline int cw_addelem_cisco_ap_timesync(uint8_t * dst, time_t time, uint8_t type)
|
|
|
|
{
|
|
|
|
cw_put_dword(dst + 10, time);
|
|
|
|
cw_put_byte(dst + 14, type);
|
|
|
|
return 5 + cw_put_elem_vendor_hdr(dst, CW_VENDOR_ID_CISCO, CW_CISCO_AP_TIMESYNC, 5);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a Cisco RAD Name message element to buffer
|
|
|
|
* @param dst destination buffer
|
|
|
|
* @param name RAD name, zero terminated
|
|
|
|
* @return number of bytes put
|
|
|
|
*/
|
|
|
|
static inline int cw_addelem_cisco_rad_name(uint8_t * dst, uint8_t * name)
|
|
|
|
{
|
|
|
|
return cw_addelem_vendor_specific_payload(dst, CW_VENDOR_ID_CISCO, CW_CISCO_RAD_NAME, name,
|
|
|
|
strlen((char *) name));
|
|
|
|
}
|
2014-08-14 17:18:19 +02:00
|
|
|
|
2015-03-23 19:40:39 +01:00
|
|
|
/**
|
|
|
|
* Add a Cisco Group Name message element to buffer
|
|
|
|
* @param dst destination buffer
|
|
|
|
* @param name Group name, zero terminated
|
|
|
|
* @return number of bytes put
|
|
|
|
*/
|
2015-03-28 08:29:59 +01:00
|
|
|
static inline int cw_addelem_cisco_ap_group_name(uint8_t * dst, uint8_t * name){
|
2015-03-23 19:40:39 +01:00
|
|
|
return cw_addelem_vendor_specific_payload(dst, CW_VENDOR_ID_CISCO, CW_CISCO_AP_GROUP_NAME, name,
|
|
|
|
strlen((char *) name));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-03-28 08:29:59 +01:00
|
|
|
|
|
|
|
static inline int cw_addelem_cisco_ap_regulatory_domain(uint8_t *dst, struct radioinfo * ri){
|
|
|
|
uint8_t *d=dst+10;
|
|
|
|
|
|
|
|
d+=cw_put_byte(d,ri->rid); /* Band ID */
|
|
|
|
d+=cw_put_byte(d,1); /* Set True/False */
|
|
|
|
d+=cw_put_byte(d,ri->rid); /* Slot ID */
|
|
|
|
d+=cw_put_word(d,ri->regDomain);
|
|
|
|
return 5 + cw_put_elem_vendor_hdr(dst, CW_VENDOR_ID_CISCO, CW_CISCO_AP_REGULATORY_DOMAIN, 5);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-03-23 19:40:39 +01:00
|
|
|
/**
|
|
|
|
* Add a Cisco MWAR message element.
|
|
|
|
* @param dst destinnation buffer
|
|
|
|
* @param acinfo AC data
|
|
|
|
* @return number of bytes put
|
|
|
|
*
|
|
|
|
* This message elemet is basically an LWAPP AC Descriptor
|
|
|
|
* encapsulated in a CAPWAP vendor specific payload message
|
|
|
|
*/
|
|
|
|
static inline int cw_addelem_cisco_mwar(uint8_t *dst, struct ac_info *acinfo){
|
|
|
|
int l = lw_put_ac_descriptor(dst+10,acinfo);
|
|
|
|
return l+cw_put_elem_vendor_hdr(dst,CW_VENDOR_ID_CISCO,CW_CISCO_MWAR,l);
|
|
|
|
}
|
|
|
|
|
2015-03-28 08:29:59 +01:00
|
|
|
/**
|
|
|
|
* Add a Cisco Certificate payload message element
|
|
|
|
* @param dst destination buffer
|
|
|
|
* @param src pointer to DER certificate
|
|
|
|
* @param len length of certificate
|
|
|
|
* @return number of bytes put
|
|
|
|
*/
|
|
|
|
static inline int cw_addelem_cisco_certificate(uint8_t*dst,uint8_t*src,int len){
|
|
|
|
int l = lw_put_certificate(dst+10,src,len);
|
|
|
|
return l+cw_put_elem_vendor_hdr(dst,CW_VENDOR_ID_CISCO,CW_CISCO_CERTIFICATE,l);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-03-29 01:55:06 +01:00
|
|
|
/*
|
|
|
|
static inline int cw_addelem_cisco_wtp_radio_cfg(uint8_t * dst,struct radioinfo *ri){
|
2015-03-28 08:29:59 +01:00
|
|
|
int l = lw_put_80211_wtp_wlan_radio_configuration(dst+10,ri);
|
|
|
|
return l+cw_put_elem_vendor_hdr(dst,CW_VENDOR_ID_CISCO,CW_CISCO_STATION_CFG,l);
|
|
|
|
}
|
2015-03-29 01:55:06 +01:00
|
|
|
*/
|
|
|
|
|
2015-03-28 08:29:59 +01:00
|
|
|
|
2015-03-28 18:32:03 +01:00
|
|
|
static inline int cw_readelem_cisco_station_cfg(uint8_t *src,int len){
|
|
|
|
|
|
|
|
// lw_readelem_
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-03-29 01:55:06 +01:00
|
|
|
extern const char * cw_cisco_id_to_str(int elem_id);
|
|
|
|
|
|
|
|
int cw_readelem_cisco_wtp_radio_cfg(int elem_id,uint8_t *elem, int len,struct radioinfo *ri);
|
|
|
|
int cw_addelem_cisco_wtp_radio_cfg(uint8_t*dst,struct radioinfo * ri);
|
2015-03-28 18:32:03 +01:00
|
|
|
|
2015-03-23 19:40:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
#define cw_addelem_cisco_rad(dst,acinfo)\
|
|
|
|
lw_put_ac_descriptor(dst+10,acinfo)
|
|
|
|
cw_put_elem_vedor_hdr(dst,CW_VENDOR_ID_CISCO,CW_CISCO_RAD,
|
2015-03-16 02:41:35 +01:00
|
|
|
*/
|
2015-03-23 19:40:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* cwmsg methods */
|
|
|
|
#define cwmsg_addelem_cisco_ap_timesync(cwmsg,time,type)\
|
|
|
|
(cwmsg)->pos+=cw_addelem_cisco_ap_timesync(((cwmsg)->msgelems+(cwmsg)->pos),time,type)
|
|
|
|
|
|
|
|
#define cwmsg_addelem_cisco_rad_name(cwmsg,name)\
|
|
|
|
(cwmsg)->pos+=cw_addelem_cisco_rad_name(((cwmsg)->msgelems+(cwmsg)->pos),(name))
|
|
|
|
|
|
|
|
#define cwmsg_addelem_cisco_ap_grpoup_name(cwmsg,name)\
|
|
|
|
(cwmsg)->pos+=cw_addelem_ap_group_name(((cwmsg)->msgelems+(cwmsg)->pos),(name))
|
|
|
|
|
|
|
|
#define cwmsg_addelem_cisco_mwar(cwmsg,acinfo)\
|
|
|
|
(cwmsg)->pos+=cw_addelem_cisco_mwar(((cwmsg)->msgelems+(cwmsg)->pos),(acinfo))
|
|
|
|
|
2015-03-28 08:29:59 +01:00
|
|
|
#define cwmsg_addelem_cisco_certificate(cwmsg,crt,len)\
|
|
|
|
(cwmsg)->pos+=cw_addelem_cisco_certificate(((cwmsg)->msgelems+(cwmsg)->pos),crt,len)
|
|
|
|
|
|
|
|
#define cwmsg_addelem_cisco_ap_regulatory_domain(cwmsg,radioinfo)\
|
|
|
|
(cwmsg)->pos+=cw_addelem_cisco_ap_regulatory_domain(((cwmsg)->msgelems+(cwmsg)->pos),radioinfo)
|
2015-03-14 21:41:50 +01:00
|
|
|
|
2015-03-29 01:55:06 +01:00
|
|
|
#define cwmsg_addelem_cisco_wtp_radio_cfg(cwmsg,radioinfo)\
|
|
|
|
(cwmsg)->pos+=cw_addelem_cisco_wtp_radio_cfg(((cwmsg)->msgelems+(cwmsg)->pos),radioinfo)
|
2015-03-14 10:15:12 +01:00
|
|
|
|
|
|
|
|
2014-08-14 17:18:19 +02:00
|
|
|
#endif
|