From 31f06402630437312679131de83b219511d8469d Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 14 Mar 2015 16:58:21 -0700 Subject: [PATCH] monitor: Add decoding for extended index control messages --- monitor/control.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/monitor/control.c b/monitor/control.c index 44cc1daf9..f2698fbef 100644 --- a/monitor/control.c +++ b/monitor/control.c @@ -97,6 +97,40 @@ static void mgmt_unconf_index_removed(uint16_t len, const void *buf) packet_hexdump(buf, len); } +static void mgmt_ext_index_added(uint16_t len, const void *buf) +{ + const struct mgmt_ev_ext_index_added *ev = buf; + + if (len < sizeof(*ev)) { + printf("* Malformed Extended Index Added control\n"); + return; + } + + printf("@ Extended Index Added: %u (%u)\n", ev->type, ev->bus); + + buf += sizeof(*ev); + len -= sizeof(*ev); + + packet_hexdump(buf, len); +} + +static void mgmt_ext_index_removed(uint16_t len, const void *buf) +{ + const struct mgmt_ev_ext_index_removed *ev = buf; + + if (len < sizeof(*ev)) { + printf("* Malformed Extended Index Removed control\n"); + return; + } + + printf("@ Extended Index Removed: %u (%u)\n", ev->type, ev->bus); + + buf += sizeof(*ev); + len -= sizeof(*ev); + + packet_hexdump(buf, len); +} + static void mgmt_controller_error(uint16_t len, const void *buf) { const struct mgmt_ev_controller_error *ev = buf; @@ -794,6 +828,12 @@ void control_message(uint16_t opcode, const void *data, uint16_t size) case MGMT_EV_NEW_CONFIG_OPTIONS: mgmt_new_config_options(size, data); break; + case MGMT_EV_EXT_INDEX_ADDED: + mgmt_ext_index_added(size, data); + break; + case MGMT_EV_EXT_INDEX_REMOVED: + mgmt_ext_index_removed(size, data); + break; default: printf("* Unknown control (code %d len %d)\n", opcode, size); packet_hexdump(data, size); -- 2.47.3