3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-26 10:39:23 +01:00

wsc: Add initial parser for ProbeResponse messages

This commit is contained in:
Denis Kenzior 2015-07-17 14:53:48 -05:00
parent 2cc0be5482
commit fa9b0e721b
2 changed files with 69 additions and 0 deletions

View File

@ -530,3 +530,41 @@ done:
return 0;
}
int wsc_parse_probe_response(const unsigned char *pdu, unsigned int len,
struct wsc_probe_response *out)
{
int r;
struct wsc_wfa_ext_iter iter;
uint8_t version;
memset(out, 0, sizeof(struct wsc_probe_response));
r = wsc_parse_attrs(pdu, len, &out->version2, &iter,
WSC_ATTR_VERSION, ATTR_FLAG_REQUIRED, &version,
WSC_ATTR_WSC_STATE, ATTR_FLAG_REQUIRED, &out->config_state,
WSC_ATTR_AP_SETUP_LOCKED, 0, &out->ap_setup_locked,
WSC_ATTR_SELECTED_REGISTRAR, 0, &out->selected_registrar,
WSC_ATTR_DEVICE_PASSWORD_ID,
ATTR_FLAG_REGISTRAR, &out->device_password_id,
WSC_ATTR_SELECTED_REGISTRAR_CONFIGURATION_METHODS,
ATTR_FLAG_REGISTRAR, &out->selected_reg_config_methods,
WSC_ATTR_RESPONSE_TYPE, ATTR_FLAG_REQUIRED, &out->response_type,
WSC_ATTR_UUID_E, ATTR_FLAG_REQUIRED, &out->uuid_e,
WSC_ATTR_MANUFACTURER, ATTR_FLAG_REQUIRED, &out->manufacturer,
WSC_ATTR_MODEL_NAME, ATTR_FLAG_REQUIRED, &out->model_name,
WSC_ATTR_MODEL_NUMBER, ATTR_FLAG_REQUIRED, &out->model_number,
WSC_ATTR_SERIAL_NUMBER, ATTR_FLAG_REQUIRED, &out->serial_number,
WSC_ATTR_PRIMARY_DEVICE_TYPE,
ATTR_FLAG_REQUIRED, &out->primary_device_type,
WSC_ATTR_DEVICE_NAME, ATTR_FLAG_REQUIRED, &out->device_name,
WSC_ATTR_CONFIGURATION_METHODS,
ATTR_FLAG_REQUIRED, &out->config_methods,
WSC_ATTR_RF_BANDS, 0, &out->rf_bands,
WSC_ATTR_INVALID);
if (r < 0)
return r;
return 0;
}

View File

@ -319,3 +319,34 @@ static inline const unsigned char *wsc_attr_iter_get_data(
{
return iter->data;
}
struct wsc_primary_device_type {
uint16_t category;
uint8_t oui[3];
uint8_t oui_type;
uint16_t subcategory;
};
struct wsc_probe_response {
bool version2;
enum wsc_config_state config_state;
bool ap_setup_locked;
bool selected_registrar;
enum wsc_device_password_id device_password_id;
uint16_t selected_reg_config_methods;
enum wsc_response_type response_type;
uint8_t uuid_e[16];
char manufacturer[65];
char model_name[33];
char model_number[33];
char serial_number[33];
struct wsc_primary_device_type primary_device_type;
char device_name[33];
uint16_t config_methods;
uint8_t rf_bands;
uint8_t authorized_macs[30];
uint16_t reg_config_methods;
};
int wsc_parse_probe_response(const unsigned char *pdu, unsigned int len,
struct wsc_probe_response *out);