2018-02-19 13:51:55 +01:00
|
|
|
/*
|
|
|
|
This file is part of actube.
|
|
|
|
|
|
|
|
actube 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.
|
|
|
|
|
|
|
|
actube 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/>.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2016-03-03 20:46:20 +01:00
|
|
|
#include "cw/log.h"
|
|
|
|
#include "cw/conn.h"
|
2015-04-05 20:26:33 +02:00
|
|
|
|
2018-03-19 20:00:58 +01:00
|
|
|
|
|
|
|
|
2016-03-11 22:23:00 +01:00
|
|
|
#include "cw/cw.h"
|
2015-04-05 20:26:33 +02:00
|
|
|
|
2018-02-19 03:31:56 +01:00
|
|
|
extern mbag_t cisco_config;
|
2015-04-05 20:26:33 +02:00
|
|
|
|
2016-02-29 08:18:14 +01:00
|
|
|
int cisco_out_ac_descriptor(struct conn *conn,struct cw_action_out * a,uint8_t *dst)
|
2015-04-05 20:26:33 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
uint8_t *d = dst+4;
|
2015-04-19 23:27:44 +02:00
|
|
|
struct mbag_item * i;
|
|
|
|
i = mbag_get(conn->local,CW_ITEM_AC_STATUS);
|
2015-04-05 20:26:33 +02:00
|
|
|
|
|
|
|
if (!i) {
|
|
|
|
cw_log(LOG_ERR,"Can't send AC Descriptor, no AC Status Item found");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-03-04 16:59:20 +01:00
|
|
|
d+=cw_put_ac_status(d ,(struct cw_ac_status*)(i->u2.data),conn);
|
2015-04-05 20:26:33 +02:00
|
|
|
|
2016-03-15 00:31:31 +01:00
|
|
|
|
2018-02-19 03:31:56 +01:00
|
|
|
i = mbag_get(cisco_config,CW_ITEM_AC_SOFTWARE_VERSION);
|
2018-02-19 10:48:54 +01:00
|
|
|
|
|
|
|
if (!i){
|
|
|
|
/* Send back the same software version as the WTP has,
|
|
|
|
otherwise the AP wants us to send an image */
|
|
|
|
i = mbag_get(conn->incomming,CW_ITEM_WTP_SOFTWARE_VERSION);
|
|
|
|
}
|
2018-03-12 11:22:06 +01:00
|
|
|
/*
|
2015-04-26 23:52:11 +02:00
|
|
|
if ( i ) {
|
2018-03-04 16:59:20 +01:00
|
|
|
d += cw_put_version(d,1,i->u2.data);
|
2015-04-26 23:52:11 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
cw_log(LOG_ERR, "Can't set Cisco Software Version in AC descriptor, No value defined.");
|
|
|
|
}
|
2015-04-05 20:26:33 +02:00
|
|
|
|
2018-02-19 03:31:56 +01:00
|
|
|
i = mbag_get(cisco_config, CW_ITEM_AC_HARDWARE_VERSION);
|
2015-04-05 20:26:33 +02:00
|
|
|
if ( i ) {
|
2018-03-04 16:59:20 +01:00
|
|
|
d += cw_put_version(d,0,i->u2.data);
|
2015-04-05 20:26:33 +02:00
|
|
|
}
|
|
|
|
else {
|
2015-04-26 23:52:11 +02:00
|
|
|
cw_log(LOG_ERR, "Can't set Cisco Hardware Version in AC descriptor, No value defined.");
|
2015-04-05 20:26:33 +02:00
|
|
|
}
|
2018-03-12 11:22:06 +01:00
|
|
|
*/
|
2015-04-26 23:52:11 +02:00
|
|
|
|
2015-04-05 20:26:33 +02:00
|
|
|
int len = d-dst-4;
|
|
|
|
|
|
|
|
return len + cw_put_elem_hdr(dst,a->elem_id,len);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|