From 00785aba71d03da1a740b32e638258e9984bd69f Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 14 Nov 2009 14:08:58 +0200 Subject: [PATCH] WPS: Remove unused WFA WLANConfig Service actions This removes following WFA WLANConfig Service actions and the related state variables: GetAPSettings, SetAPSettings, DelAPSettings, GetSTASettings, SetSTASettings, DelSTASettings, RebootAP, ResetAP, RebootSTA, ResetSTA. While WFA WLANConfig Service version 1.0 claims that some of these are mandatory to implement for an AP, there are no known implementations supporting these actions neither in an AP/proxy or an External Registrar that would use them. These are unlikely to be supported in the future either and as such, it is just simpler to get rid of them to clean up the implementation and reduce code size. --- hostapd/wps_hostapd.c | 84 --------- src/wps/wps_upnp.h | 12 -- src/wps/wps_upnp_web.c | 374 ----------------------------------------- 3 files changed, 470 deletions(-) diff --git a/hostapd/wps_hostapd.c b/hostapd/wps_hostapd.c index 1e9aeae3a..5de4d3cb5 100644 --- a/hostapd/wps_hostapd.c +++ b/hostapd/wps_hostapd.c @@ -874,52 +874,6 @@ hostapd_rx_req_put_message(void *priv, struct upnp_wps_peer *peer, } -static struct wpabuf * -hostapd_rx_req_get_ap_settings(void *priv, const struct wpabuf *msg) -{ - wpa_printf(MSG_DEBUG, "WPS UPnP: TODO %s", __func__); - return NULL; -} - - -static int hostapd_rx_req_set_ap_settings(void *priv, const struct wpabuf *msg) -{ - wpa_printf(MSG_DEBUG, "WPS UPnP: TODO %s", __func__); - return -1; -} - - -static int hostapd_rx_req_del_ap_settings(void *priv, const struct wpabuf *msg) -{ - wpa_printf(MSG_DEBUG, "WPS UPnP: TODO %s", __func__); - return -1; -} - - -static struct wpabuf * -hostapd_rx_req_get_sta_settings(void *priv, const struct wpabuf *msg) -{ - wpa_printf(MSG_DEBUG, "WPS UPnP: TODO %s", __func__); - return NULL; -} - - -static int hostapd_rx_req_set_sta_settings(void *priv, - const struct wpabuf *msg) -{ - wpa_printf(MSG_DEBUG, "WPS UPnP: TODO %s", __func__); - return -1; -} - - -static int hostapd_rx_req_del_sta_settings(void *priv, - const struct wpabuf *msg) -{ - wpa_printf(MSG_DEBUG, "WPS UPnP: TODO %s", __func__); - return -1; -} - - static int hostapd_rx_req_put_wlan_response( void *priv, enum upnp_wps_wlanevent_type ev_type, const u8 *mac_addr, const struct wpabuf *msg, @@ -985,34 +939,6 @@ static int hostapd_rx_req_set_selected_registrar(void *priv, } -static int hostapd_rx_req_reboot_ap(void *priv, const struct wpabuf *msg) -{ - wpa_printf(MSG_DEBUG, "WPS UPnP: TODO %s", __func__); - return -1; -} - - -static int hostapd_rx_req_reset_ap(void *priv, const struct wpabuf *msg) -{ - wpa_printf(MSG_DEBUG, "WPS UPnP: TODO %s", __func__); - return -1; -} - - -static int hostapd_rx_req_reboot_sta(void *priv, const struct wpabuf *msg) -{ - wpa_printf(MSG_DEBUG, "WPS UPnP: TODO %s", __func__); - return -1; -} - - -static int hostapd_rx_req_reset_sta(void *priv, const struct wpabuf *msg) -{ - wpa_printf(MSG_DEBUG, "WPS UPnP: TODO %s", __func__); - return -1; -} - - static int hostapd_wps_upnp_init(struct hostapd_data *hapd, struct wps_context *wps) { @@ -1026,19 +952,9 @@ static int hostapd_wps_upnp_init(struct hostapd_data *hapd, ctx->rx_req_get_device_info = hostapd_rx_req_get_device_info; ctx->rx_req_put_message = hostapd_rx_req_put_message; - ctx->rx_req_get_ap_settings = hostapd_rx_req_get_ap_settings; - ctx->rx_req_set_ap_settings = hostapd_rx_req_set_ap_settings; - ctx->rx_req_del_ap_settings = hostapd_rx_req_del_ap_settings; - ctx->rx_req_get_sta_settings = hostapd_rx_req_get_sta_settings; - ctx->rx_req_set_sta_settings = hostapd_rx_req_set_sta_settings; - ctx->rx_req_del_sta_settings = hostapd_rx_req_del_sta_settings; ctx->rx_req_put_wlan_response = hostapd_rx_req_put_wlan_response; ctx->rx_req_set_selected_registrar = hostapd_rx_req_set_selected_registrar; - ctx->rx_req_reboot_ap = hostapd_rx_req_reboot_ap; - ctx->rx_req_reset_ap = hostapd_rx_req_reset_ap; - ctx->rx_req_reboot_sta = hostapd_rx_req_reboot_sta; - ctx->rx_req_reset_sta = hostapd_rx_req_reset_sta; hapd->wps_upnp = upnp_wps_device_init(ctx, wps, hapd); if (hapd->wps_upnp == NULL) { diff --git a/src/wps/wps_upnp.h b/src/wps/wps_upnp.h index 31b055628..063e68c75 100644 --- a/src/wps/wps_upnp.h +++ b/src/wps/wps_upnp.h @@ -30,24 +30,12 @@ struct upnp_wps_device_ctx { struct wpabuf * (*rx_req_put_message)( void *priv, struct upnp_wps_peer *peer, const struct wpabuf *msg); - struct wpabuf * (*rx_req_get_ap_settings)(void *priv, - const struct wpabuf *msg); - int (*rx_req_set_ap_settings)(void *priv, const struct wpabuf *msg); - int (*rx_req_del_ap_settings)(void *priv, const struct wpabuf *msg); - struct wpabuf * (*rx_req_get_sta_settings)(void *priv, - const struct wpabuf *msg); - int (*rx_req_set_sta_settings)(void *priv, const struct wpabuf *msg); - int (*rx_req_del_sta_settings)(void *priv, const struct wpabuf *msg); int (*rx_req_put_wlan_response)( void *priv, enum upnp_wps_wlanevent_type ev_type, const u8 *mac_addr, const struct wpabuf *msg, enum wps_msg_type msg_type); int (*rx_req_set_selected_registrar)(void *priv, const struct wpabuf *msg); - int (*rx_req_reboot_ap)(void *priv, const struct wpabuf *msg); - int (*rx_req_reset_ap)(void *priv, const struct wpabuf *msg); - int (*rx_req_reboot_sta)(void *priv, const struct wpabuf *msg); - int (*rx_req_reset_sta)(void *priv, const struct wpabuf *msg); }; struct upnp_wps_device_sm * diff --git a/src/wps/wps_upnp_web.c b/src/wps/wps_upnp_web.c index 07a004c68..4332ea3c7 100644 --- a/src/wps/wps_upnp_web.c +++ b/src/wps/wps_upnp_web.c @@ -73,76 +73,6 @@ static const char wps_scpd_xml[] = "\n" "\n" "\n" -"GetAPSettings\n" -"\n" -"\n" -"NewMessage\n" -"in\n" -"Message\n" -"\n" -"\n" -"NewAPSettings\n" -"out\n" -"APSettings\n" -"\n" -"\n" -"\n" -"\n" -"SetAPSettings\n" -"\n" -"\n" -"APSettings\n" -"in\n" -"APSettings\n" -"\n" -"\n" -"\n" -"\n" -"DelAPSettings\n" -"\n" -"\n" -"NewAPSettings\n" -"in\n" -"APSettings\n" -"\n" -"\n" -"\n" -"\n" -"GetSTASettings\n" -"\n" -"\n" -"NewMessage\n" -"in\n" -"Message\n" -"\n" -"\n" -"NewSTASettings\n" -"out\n" -"STASettings\n" -"\n" -"\n" -"\n" -"\n" -"SetSTASettings\n" -"\n" -"\n" -"NewSTASettings\n" -"out\n" -"STASettings\n" -"\n" -"\n" -"\n" -"\n" -"DelSTASettings\n" -"\n" -"\n" -"NewSTASettings\n" -"in\n" -"STASettings\n" -"\n" -"\n" -"\n" -"\n" "PutWLANResponse\n" "\n" "\n" @@ -172,46 +102,6 @@ static const char wps_scpd_xml[] = "\n" "\n" "\n" -"\n" -"RebootAP\n" -"\n" -"\n" -"NewAPSettings\n" -"in\n" -"APSettings\n" -"\n" -"\n" -"\n" -"\n" -"ResetAP\n" -"\n" -"\n" -"NewMessage\n" -"in\n" -"Message\n" -"\n" -"\n" -"\n" -"\n" -"RebootSTA\n" -"\n" -"\n" -"NewSTASettings\n" -"in\n" -"APSettings\n" -"\n" -"\n" -"\n" -"\n" -"ResetSTA\n" -"\n" -"\n" -"NewMessage\n" -"in\n" -"Message\n" -"\n" -"\n" -"\n" "\n" "\n" "\n" @@ -230,18 +120,10 @@ static const char wps_scpd_xml[] = "DeviceInfo\n" "bin.base64\n" "\n" -"\n" -"APSettings\n" -"bin.base64\n" -"\n" "\n" "APStatus\n" "ui1\n" "\n" -"\n" -"STASettings\n" -"bin.base64\n" -"\n" "\n" "STAStatus\n" "ui1\n" @@ -567,144 +449,6 @@ web_process_put_message(struct upnp_wps_device_sm *sm, char *data, } -static enum http_reply_code -web_process_get_ap_settings(struct upnp_wps_device_sm *sm, char *data, - struct wpabuf **reply, const char **replyname) -{ - struct wpabuf *msg; - static const char *name = "NewAPSettings"; - enum http_reply_code ret; - - wpa_printf(MSG_DEBUG, "WPS UPnP: GetAPSettings"); - if (sm->ctx->rx_req_get_ap_settings == NULL) - return HTTP_INTERNAL_SERVER_ERROR; - msg = xml_get_base64_item(data, "NewMessage", &ret); - if (msg == NULL) - return ret; - *reply = sm->ctx->rx_req_get_ap_settings(sm->priv, msg); - wpabuf_free(msg); - if (*reply == NULL) - return HTTP_INTERNAL_SERVER_ERROR; - *replyname = name; - return HTTP_OK; -} - - -static enum http_reply_code -web_process_set_ap_settings(struct upnp_wps_device_sm *sm, char *data, - struct wpabuf **reply, const char **replyname) -{ - struct wpabuf *msg; - enum http_reply_code ret; - - wpa_printf(MSG_DEBUG, "WPS UPnP: SetAPSettings"); - msg = xml_get_base64_item(data, "NewAPSettings", &ret); - if (msg == NULL) - return ret; - if (!sm->ctx->rx_req_set_ap_settings || - sm->ctx->rx_req_set_ap_settings(sm->priv, msg)) { - wpabuf_free(msg); - return HTTP_INTERNAL_SERVER_ERROR; - } - wpabuf_free(msg); - *replyname = NULL; - *reply = NULL; - return HTTP_OK; -} - - -static enum http_reply_code -web_process_del_ap_settings(struct upnp_wps_device_sm *sm, char *data, - struct wpabuf **reply, const char **replyname) -{ - struct wpabuf *msg; - enum http_reply_code ret; - - wpa_printf(MSG_DEBUG, "WPS UPnP: DelAPSettings"); - msg = xml_get_base64_item(data, "NewAPSettings", &ret); - if (msg == NULL) - return ret; - if (!sm->ctx->rx_req_del_ap_settings || - sm->ctx->rx_req_del_ap_settings(sm->priv, msg)) { - wpabuf_free(msg); - return HTTP_INTERNAL_SERVER_ERROR; - } - wpabuf_free(msg); - *replyname = NULL; - *reply = NULL; - return HTTP_OK; -} - - -static enum http_reply_code -web_process_get_sta_settings(struct upnp_wps_device_sm *sm, char *data, - struct wpabuf **reply, const char **replyname) -{ - struct wpabuf *msg; - static const char *name = "NewSTASettings"; - enum http_reply_code ret; - - wpa_printf(MSG_DEBUG, "WPS UPnP: GetSTASettings"); - if (sm->ctx->rx_req_get_sta_settings == NULL) - return HTTP_INTERNAL_SERVER_ERROR; - msg = xml_get_base64_item(data, "NewMessage", &ret); - if (msg == NULL) - return ret; - *reply = sm->ctx->rx_req_get_sta_settings(sm->priv, msg); - wpabuf_free(msg); - if (*reply == NULL) - return HTTP_INTERNAL_SERVER_ERROR; - *replyname = name; - return HTTP_OK; -} - - -static enum http_reply_code -web_process_set_sta_settings(struct upnp_wps_device_sm *sm, char *data, - struct wpabuf **reply, const char **replyname) -{ - struct wpabuf *msg; - enum http_reply_code ret; - - wpa_printf(MSG_DEBUG, "WPS UPnP: SetSTASettings"); - msg = xml_get_base64_item(data, "NewSTASettings", &ret); - if (msg == NULL) - return ret; - if (!sm->ctx->rx_req_set_sta_settings || - sm->ctx->rx_req_set_sta_settings(sm->priv, msg)) { - wpabuf_free(msg); - return HTTP_INTERNAL_SERVER_ERROR; - } - wpabuf_free(msg); - *replyname = NULL; - *reply = NULL; - return HTTP_OK; -} - - -static enum http_reply_code -web_process_del_sta_settings(struct upnp_wps_device_sm *sm, char *data, - struct wpabuf **reply, const char **replyname) -{ - struct wpabuf *msg; - enum http_reply_code ret; - - wpa_printf(MSG_DEBUG, "WPS UPnP: DelSTASettings"); - msg = xml_get_base64_item(data, "NewSTASettings", &ret); - if (msg == NULL) - return ret; - if (!sm->ctx->rx_req_del_sta_settings || - sm->ctx->rx_req_del_sta_settings(sm->priv, msg)) { - wpabuf_free(msg); - return HTTP_INTERNAL_SERVER_ERROR; - } - wpabuf_free(msg); - *replyname = NULL; - *reply = NULL; - return HTTP_OK; -} - - static enum http_reply_code web_process_put_wlan_response(struct upnp_wps_device_sm *sm, char *data, struct wpabuf **reply, const char **replyname) @@ -788,98 +532,6 @@ web_process_set_selected_registrar(struct upnp_wps_device_sm *sm, char *data, } -static enum http_reply_code -web_process_reboot_ap(struct upnp_wps_device_sm *sm, char *data, - struct wpabuf **reply, const char **replyname) -{ - struct wpabuf *msg; - enum http_reply_code ret; - - wpa_printf(MSG_DEBUG, "WPS UPnP: RebootAP"); - msg = xml_get_base64_item(data, "NewAPSettings", &ret); - if (msg == NULL) - return ret; - if (!sm->ctx->rx_req_reboot_ap || - sm->ctx->rx_req_reboot_ap(sm->priv, msg)) { - wpabuf_free(msg); - return HTTP_INTERNAL_SERVER_ERROR; - } - wpabuf_free(msg); - *replyname = NULL; - *reply = NULL; - return HTTP_OK; -} - - -static enum http_reply_code -web_process_reset_ap(struct upnp_wps_device_sm *sm, char *data, - struct wpabuf **reply, const char **replyname) -{ - struct wpabuf *msg; - enum http_reply_code ret; - - wpa_printf(MSG_DEBUG, "WPS UPnP: ResetAP"); - msg = xml_get_base64_item(data, "NewMessage", &ret); - if (msg == NULL) - return ret; - if (!sm->ctx->rx_req_reset_ap || - sm->ctx->rx_req_reset_ap(sm->priv, msg)) { - wpabuf_free(msg); - return HTTP_INTERNAL_SERVER_ERROR; - } - wpabuf_free(msg); - *replyname = NULL; - *reply = NULL; - return HTTP_OK; -} - - -static enum http_reply_code -web_process_reboot_sta(struct upnp_wps_device_sm *sm, char *data, - struct wpabuf **reply, const char **replyname) -{ - struct wpabuf *msg; - enum http_reply_code ret; - - wpa_printf(MSG_DEBUG, "WPS UPnP: RebootSTA"); - msg = xml_get_base64_item(data, "NewSTASettings", &ret); - if (msg == NULL) - return ret; - if (!sm->ctx->rx_req_reboot_sta || - sm->ctx->rx_req_reboot_sta(sm->priv, msg)) { - wpabuf_free(msg); - return HTTP_INTERNAL_SERVER_ERROR; - } - wpabuf_free(msg); - *replyname = NULL; - *reply = NULL; - return HTTP_OK; -} - - -static enum http_reply_code -web_process_reset_sta(struct upnp_wps_device_sm *sm, char *data, - struct wpabuf **reply, const char **replyname) -{ - struct wpabuf *msg; - enum http_reply_code ret; - - wpa_printf(MSG_DEBUG, "WPS UPnP: ResetSTA"); - msg = xml_get_base64_item(data, "NewMessage", &ret); - if (msg == NULL) - return ret; - if (!sm->ctx->rx_req_reset_sta || - sm->ctx->rx_req_reset_sta(sm->priv, msg)) { - wpabuf_free(msg); - return HTTP_INTERNAL_SERVER_ERROR; - } - wpabuf_free(msg); - *replyname = NULL; - *reply = NULL; - return HTTP_OK; -} - - static const char *soap_prefix = "\n" "