Skip to content

Commit ce6e136

Browse files
committed
Merge branch 'fix/esp_netif_ip_events' into 'master'
fix(esp_netif): Rename IP_EVENT_AP_STAIPASSIGNED to generic name Closes IDFGH-14957 See merge request espressif/esp-idf!39425
2 parents b6ea70c + 63acb01 commit ce6e136

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

components/esp_netif/include/esp_netif_types.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -98,7 +98,11 @@ typedef enum{
9898
typedef enum {
9999
IP_EVENT_STA_GOT_IP, /*!< station got IP from connected AP */
100100
IP_EVENT_STA_LOST_IP, /*!< station lost IP and the IP is reset to 0 */
101-
IP_EVENT_AP_STAIPASSIGNED, /*!< soft-AP assign an IP to a connected station */
101+
IP_EVENT_ASSIGNED_IP_TO_CLIENT, /*!< DHCP server assigned an IP to a connected client */
102+
IP_EVENT_AP_STAIPASSIGNED __attribute__((deprecated("Use IP_EVENT_ASSIGNED_IP_TO_CLIENT instead")))
103+
= IP_EVENT_ASSIGNED_IP_TO_CLIENT, /*!< compatibility enum,
104+
soft-AP assign an IP to a connected station
105+
@deprecated Use IP_EVENT_ASSIGNED_IP_TO_CLIENT instead */
102106
IP_EVENT_GOT_IP6, /*!< station or ap or ethernet interface v6IP addr is preferred */
103107
IP_EVENT_ETH_GOT_IP, /*!< ethernet got IP from connected AP */
104108
IP_EVENT_ETH_LOST_IP, /*!< ethernet lost IP and the IP is reset to 0 */
@@ -148,12 +152,17 @@ typedef struct {
148152
bool preferred; /*!< The default preference of the address */
149153
} ip_event_add_ip6_t;
150154

151-
/** Event structure for IP_EVENT_AP_STAIPASSIGNED event */
155+
/** Event structure for IP_EVENT_ASSIGNED_IP_TO_CLIENT event */
152156
typedef struct {
153157
esp_netif_t *esp_netif; /*!< Pointer to the associated netif handle */
154158
esp_ip4_addr_t ip; /*!< IP address which was assigned to the station */
155159
uint8_t mac[6]; /*!< MAC address of the connected client */
156-
} ip_event_ap_staipassigned_t;
160+
} ip_event_assigned_ip_to_client_t;
161+
162+
/** Compatibility event structure for ip_event_ap_staipassigned_t event
163+
* @deprecated Use ip_event_assigned_ip_to_client_t instead */
164+
__attribute__((deprecated("Use ip_event_assigned_ip_to_client_t instead of ip_event_ap_staipassigned_t")))
165+
typedef ip_event_assigned_ip_to_client_t ip_event_ap_staipassigned_t;
157166

158167
typedef enum {
159168
ESP_NETIF_TX = 0, // Data is being transmitted.

components/esp_netif/lwip/esp_netif_lwip.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,15 +1123,15 @@ static void esp_netif_dhcps_cb(void* arg, uint8_t ip[4], uint8_t mac[6])
11231123
{
11241124
esp_netif_t *esp_netif = arg;
11251125
ESP_LOGD(TAG, "%s esp_netif:%p", __func__, esp_netif);
1126-
ip_event_ap_staipassigned_t evt = { .esp_netif = esp_netif };
1126+
ip_event_assigned_ip_to_client_t evt = { .esp_netif = esp_netif };
11271127
memcpy((char *)&evt.ip.addr, (char *)ip, sizeof(evt.ip.addr));
11281128
memcpy((char *)&evt.mac, mac, sizeof(evt.mac));
11291129
ESP_LOGI(TAG, "DHCP server assigned IP to a client, IP is: " IPSTR, IP2STR(&evt.ip));
11301130
ESP_LOGD(TAG, "Client's MAC: %x:%x:%x:%x:%x:%x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
11311131

1132-
int ret = esp_event_post(IP_EVENT, IP_EVENT_AP_STAIPASSIGNED, &evt, sizeof(evt), 0);
1132+
int ret = esp_event_post(IP_EVENT, IP_EVENT_ASSIGNED_IP_TO_CLIENT, &evt, sizeof(evt), 0);
11331133
if (ESP_OK != ret) {
1134-
ESP_LOGE(TAG, "dhcps cb: failed to post IP_EVENT_AP_STAIPASSIGNED (%x)", ret);
1134+
ESP_LOGE(TAG, "dhcps cb: failed to post IP_EVENT_ASSIGNED_IP_TO_CLIENT (%x)", ret);
11351135
}
11361136
}
11371137
#endif

0 commit comments

Comments
 (0)