From 9a3e78d1fc52a543308ad5421477502464f3fbd0 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 8 Sep 2015 20:45:52 -0500 Subject: [PATCH] wsc: Add extractor for ATTR_REQUEST_TYPE --- src/wsc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/wsc.c b/src/wsc.c index d705407c..27ba37dd 100644 --- a/src/wsc.c +++ b/src/wsc.c @@ -280,6 +280,22 @@ static bool extract_primary_device_type(struct wsc_attr_iter *iter, void *data) return true; } +static bool extract_request_type(struct wsc_attr_iter *iter, void *data) +{ + enum wsc_request_type *out = data; + uint8_t rt; + + if (!extract_uint8(iter, &rt)) + return false; + + /* WSC 2.0.5: Table 42 */ + if (rt > 3) + return false; + + *out = rt; + return true; +} + static bool extract_response_type(struct wsc_attr_iter *iter, void *data) { enum wsc_response_type *out = data; @@ -368,6 +384,8 @@ static attr_handler handler_for_type(enum wsc_attr type) return extract_primary_device_type; case WSC_ATTR_RF_BANDS: return extract_uint8; + case WSC_ATTR_REQUEST_TYPE: + return extract_request_type; case WSC_ATTR_RESPONSE_TYPE: return extract_response_type; case WSC_ATTR_SELECTED_REGISTRAR: