2014-07-11 22:12:11 +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/>.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2014-07-25 00:27:44 +02:00
|
|
|
|
2014-07-11 22:12:11 +02:00
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "capwap.h"
|
2014-08-14 17:19:15 +02:00
|
|
|
#include "capwap_cisco.h"
|
|
|
|
|
2014-07-11 22:12:11 +02:00
|
|
|
#include "conn.h"
|
|
|
|
#include "cwmsg.h"
|
2014-08-14 23:20:31 +02:00
|
|
|
#include "sock.h"
|
2014-07-11 22:12:11 +02:00
|
|
|
|
2014-07-26 17:45:30 +02:00
|
|
|
#include "cw_log.h"
|
|
|
|
|
2015-03-17 01:10:08 +01:00
|
|
|
void cwsend_discovery_response(struct conn *conn, int seqnum, struct radioinfo *radioinfo,
|
|
|
|
struct ac_info *acinfo, struct wtpinfo *wtpinfo)
|
2014-07-11 22:12:11 +02:00
|
|
|
{
|
2015-03-28 12:51:34 +01:00
|
|
|
cw_dbg(DBG_MSG, "Sending discovery response to %s, seq = %d", sock_addr2str(&conn->addr),
|
2015-03-17 01:10:08 +01:00
|
|
|
seqnum);
|
2014-07-26 17:45:30 +02:00
|
|
|
|
2015-03-17 01:10:08 +01:00
|
|
|
struct cwmsg *cwmsg = &conn->resp_msg;
|
2015-03-29 15:36:23 +02:00
|
|
|
cwmsg_init(cwmsg, conn->resp_buffer, CW_MSG_DISCOVERY_RESPONSE, seqnum, NULL);
|
2015-03-15 20:53:21 +01:00
|
|
|
cwmsg->capwap_mode = conn->capwap_mode;
|
2014-08-14 17:19:15 +02:00
|
|
|
|
2014-07-28 07:03:55 +02:00
|
|
|
|
2015-03-17 01:10:08 +01:00
|
|
|
cwmsg_addelem_ac_descriptor(cwmsg, acinfo,wtpinfo);
|
2015-03-23 07:48:27 +01:00
|
|
|
cwmsg_addelem(cwmsg, CW_ELEM_AC_NAME, (uint8_t *) acinfo->ac_name,
|
2015-03-17 01:10:08 +01:00
|
|
|
strlen((char *) acinfo->ac_name));
|
|
|
|
|
|
|
|
cwmsg_addelem_wtp_radio_infos(cwmsg, acinfo->radioinfos);
|
|
|
|
cwmsg_addelem_ctrl_ip_addrs(cwmsg, acinfo);
|
2014-07-11 22:12:11 +02:00
|
|
|
|
2014-08-14 17:19:15 +02:00
|
|
|
|
2015-01-08 21:20:34 +01:00
|
|
|
/* Send Cisco-specific message elements if needed */
|
2015-03-15 20:53:21 +01:00
|
|
|
switch (cwmsg->capwap_mode) {
|
|
|
|
case CWMODE_CISCO:
|
|
|
|
case CWMODE_CIPWAP:
|
2015-03-23 07:48:27 +01:00
|
|
|
{
|
2015-03-23 22:26:05 +01:00
|
|
|
cwmsg_addelem_cisco_ap_timesync(cwmsg,time(NULL),0);
|
|
|
|
//uint8_t mwtype=1;
|
|
|
|
//cwmsg_addelem_vendor_s_payload(cwmsg,CW_VENDOR_ID_CISCO,CW_CISCO_MWAR_TYPE,&mwtype,1);
|
2015-03-15 20:53:21 +01:00
|
|
|
break;
|
2015-03-23 07:48:27 +01:00
|
|
|
}
|
2015-03-15 20:53:21 +01:00
|
|
|
default:
|
|
|
|
break;
|
2015-03-17 01:10:08 +01:00
|
|
|
|
2015-03-15 20:53:21 +01:00
|
|
|
}
|
2014-08-17 18:33:17 +02:00
|
|
|
|
|
|
|
|
2014-07-11 22:12:11 +02:00
|
|
|
|
2015-03-17 01:10:08 +01:00
|
|
|
conn_send_response(conn, cwmsg, seqnum);
|
|
|
|
}
|