2016-03-11 23:03:25 +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.
|
|
|
|
|
|
|
|
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/>.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "log.h"
|
|
|
|
|
|
|
|
#include "capwap_items.h"
|
|
|
|
#include "action.h"
|
|
|
|
|
|
|
|
#include "cw.h"
|
|
|
|
|
|
|
|
|
2016-03-12 22:32:00 +01:00
|
|
|
int cw_out_wtp_reboot_statistics(struct conn *conn, struct cw_action_out *a,
|
|
|
|
uint8_t * dst)
|
2016-03-11 23:03:25 +01:00
|
|
|
{
|
|
|
|
|
2016-03-12 22:32:00 +01:00
|
|
|
if (!a->get) {
|
|
|
|
cw_log(LOG_ERROR, "Can't set WTP resboot stats. No get method");
|
2016-03-11 23:03:25 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-03-12 22:32:00 +01:00
|
|
|
|
|
|
|
struct mbag_item *i = a->get(conn, a);
|
|
|
|
|
|
|
|
|
|
|
|
if (!i) {
|
|
|
|
if (a->mand) {
|
|
|
|
cw_log(LOG_ERR,
|
|
|
|
"Can't put mandatory element WTP_REBOOT_STATISTICS");
|
2016-03-11 23:03:25 +01:00
|
|
|
return 0;
|
|
|
|
}
|
2016-03-12 22:32:00 +01:00
|
|
|
return 0;
|
|
|
|
}
|
2016-03-11 23:03:25 +01:00
|
|
|
|
2016-03-12 22:32:00 +01:00
|
|
|
mbag_t rs = (mbag_t) i->data;
|
2016-03-11 23:03:25 +01:00
|
|
|
|
|
|
|
uint8_t *d = dst + 4;
|
2016-03-12 22:32:00 +01:00
|
|
|
d += cw_put_word(d, mbag_get_word(rs, CW_ITEM_REBOOT_COUNT, 0));
|
|
|
|
d += cw_put_word(d, mbag_get_word(rs, CW_ITEM_REBOOT_AC_INITIATED_COUNT, 0));
|
|
|
|
d += cw_put_word(d, mbag_get_word(rs, CW_ITEM_REBOOT_LINK_FAILURE_COUNT, 0));
|
|
|
|
d += cw_put_word(d, mbag_get_word(rs, CW_ITEM_REBOOT_SW_FAILURE_COUNT, 0));
|
|
|
|
d += cw_put_word(d, mbag_get_word(rs, CW_ITEM_REBOOT_HW_FAILURE_COUNT, 0));
|
|
|
|
d += cw_put_word(d, mbag_get_word(rs, CW_ITEM_REBOOT_OTHER_FAILURE_COUNT, 0));
|
|
|
|
d += cw_put_word(d, mbag_get_word(rs, CW_ITEM_REBOOT_UNKNOWN_FAILURE_COUNT, 0));
|
|
|
|
d += cw_put_byte(d, mbag_get_byte(rs, CW_ITEM_REBOOT_LAST_FAILURE_TYPE, 255));
|
|
|
|
|
|
|
|
int l = d - dst - 4;
|
|
|
|
return l + cw_put_elem_hdr(dst, a->elem_id, l);
|
2016-03-11 23:03:25 +01:00
|
|
|
}
|