Select one of the symbols to view example projects that use it.
 
Outline
#include <stdlib.h>
#include <string.h>
#include "esp_netif_br_glue.h"
#include "esp_eth_driver.h"
#include "esp_wifi.h"
#include "esp_event.h"
#include "esp_log.h"
#include "esp_check.h"
TAG
esp_netif_br_glue_t
ctx_handl_type_t
esp_netif_br_glue_t
esp_eth_post_attach_br(esp_netif_t *, void *)
start_br_if_stopped(esp_netif_br_glue_t *)
stop_br_if_started(esp_netif_br_glue_t *)
are_ports_disconnected(esp_netif_br_glue_t *)
port_action_start(void *, esp_event_base_t, int32_t, void *)
port_action_stop(void *, esp_event_base_t, int32_t, void *)
port_action_connected(void *, esp_event_base_t, int32_t, void *)
port_action_disconnected(void *, esp_event_base_t, int32_t, void *)
br_action_got_ip(void *, esp_event_base_t, int32_t, void *)
esp_netif_br_glue_clear_instance_handlers(esp_netif_br_glue_handle_t)
esp_netif_br_glue_set_instance_handlers(esp_netif_br_glue_handle_t)
esp_netif_br_glue_clear_instance_handlers_wifi(esp_netif_br_glue_handle_t)
esp_netif_br_glue_set_instance_handlers_wifi(esp_netif_br_glue_handle_t)
esp_netif_br_glue_add_port(esp_netif_br_glue_handle_t, esp_netif_t *)
esp_netif_br_glue_add_wifi_port(esp_netif_br_glue_handle_t, esp_netif_t *)
esp_netif_br_glue_new()
esp_netif_br_glue_del(esp_netif_br_glue_handle_t)
Files
loading...
SourceVuESP-IDF Framework and ExamplesESP-IDFcomponents/esp_netif/lwip/esp_netif_br_glue.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/* * SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 *//* ... */ #include <stdlib.h> #include <string.h> #include "esp_netif_br_glue.h" #include "esp_eth_driver.h" #include "esp_wifi.h" #include "esp_event.h" #include "esp_log.h" #include "esp_check.h"8 includes #if CONFIG_ESP_NETIF_BRIDGE_EN const static char *TAG = "esp_netif_br_glue"; typedef struct esp_netif_br_glue_t esp_netif_br_glue_t; typedef enum { START_CTX_HANDLER, STOP_CTX_HANDLER, CONNECT_CTX_HANDLER, DISCONNECT_CTX_HANDLER, CTX_HANDLERS_END_LIST }{ ... } ctx_handl_type_t; struct esp_netif_br_glue_t { esp_netif_driver_base_t base; bool br_started; esp_netif_t **ports_esp_netifs; esp_netif_t *wifi_esp_netif; uint8_t port_cnt; esp_event_handler_instance_t *eth_ctx_handlers; esp_event_handler_instance_t get_ip_ctx_handler; esp_event_handler_instance_t *wifi_ctx_handlers; }{ ... }; static esp_err_t esp_eth_post_attach_br(esp_netif_t *esp_netif, void *args) { uint8_t eth_mac[6]; esp_netif_br_glue_t *netif_glue = (esp_netif_br_glue_t *)args; netif_glue->base.netif = esp_netif; esp_netif_get_mac(esp_netif, eth_mac); ESP_LOGI(TAG, "%02x:%02x:%02x:%02x:%02x:%02x", eth_mac[0], eth_mac[1], eth_mac[2], eth_mac[3], eth_mac[4], eth_mac[5]); ESP_LOGI(TAG, "bridge netif glue attached"); return ESP_OK; }{ ... } static void start_br_if_stopped(esp_netif_br_glue_t *netif_glue) { if (netif_glue->br_started == false) { esp_netif_action_start(netif_glue->base.netif, 0, 0, NULL); // basically creates lwip_netif br instance netif_glue->br_started = true; ESP_LOGD(TAG, "bridge netif %p is started", netif_glue->base.netif); }{...} }{ ... } static void stop_br_if_started(esp_netif_br_glue_t *netif_glue) { if (netif_glue->br_started == true) { esp_netif_action_stop(netif_glue->base.netif, 0, 0, NULL); // basically removes lwip_netif br netif_glue->br_started = false; ESP_LOGD(TAG, "bridge netif %p is stopped", netif_glue->base.netif); }{...} }{ ... } static bool are_ports_disconnected(esp_netif_br_glue_t *netif_glue) { int disc_cnt; // check Ethernet ports at first for (disc_cnt = 0; disc_cnt < netif_glue->port_cnt; disc_cnt++) { if (esp_netif_is_netif_up(netif_glue->ports_esp_netifs[disc_cnt]) == true) { break; }{...} }{...} if (disc_cnt >= netif_glue->port_cnt) { // check WiFi port if is also registered if (netif_glue->wifi_esp_netif != NULL) { if (esp_netif_is_netif_up(netif_glue->wifi_esp_netif) == false) { return true; }{...} }{...} else { return true; }{...} }{...} return false; }{ ... } static void port_action_start(void *handler_args, esp_event_base_t base, int32_t event_id, void *event_data) { esp_netif_br_glue_t *netif_glue = handler_args; #if CONFIG_ESP_WIFI_ENABLED if (base == WIFI_EVENT) { ESP_LOGD(TAG, "wifi_action_start: %p, %p, %" PRId32 ", %p", netif_glue, base, event_id, event_data); start_br_if_stopped(netif_glue); esp_netif_bridge_add_port(netif_glue->base.netif, netif_glue->wifi_esp_netif); }{...} else/* ... */ #endif /* CONFIG_ESP_WIFI_ENABLED */ if (base == ETH_EVENT) { esp_eth_handle_t eth_handle = *(esp_eth_handle_t *)event_data; ESP_LOGD(TAG, "eth_action_start: %p, %p, %" PRId32 ", %p, %p", netif_glue, base, event_id, event_data, *(esp_eth_handle_t *)event_data); for (int i = 0; i < netif_glue->port_cnt; i++) { if (eth_handle == esp_netif_get_io_driver(netif_glue->ports_esp_netifs[i])) { start_br_if_stopped(netif_glue); esp_netif_bridge_add_port(netif_glue->base.netif, netif_glue->ports_esp_netifs[i]); }{...} }{...} }{...} }{ ... } static void port_action_stop(void *handler_args, esp_event_base_t base, int32_t event_id, void *event_data) { esp_netif_br_glue_t *netif_glue = handler_args; // if one of the bridge's ports is stopped, we need to stop the bridge too, since port's lwip_netif is removed and so it would become // an invalid reference in the bridge's internal structure (there is no way how to remove single port from bridge in current LwIP) #if CONFIG_ESP_WIFI_ENABLED if (base == WIFI_EVENT) { ESP_LOGD(TAG, "wifi_action_stop: %p, %p, %" PRId32 ", %p", netif_glue, base, event_id, event_data); stop_br_if_started(netif_glue); }{...} else/* ... */ #endif /* CONFIG_ESP_WIFI_ENABLED */ if (base == ETH_EVENT) { esp_eth_handle_t eth_handle = *(esp_eth_handle_t *)event_data; ESP_LOGD(TAG, "eth_action_stop: %p, %p, %" PRId32 ", %p, %p", netif_glue, base, event_id, event_data, *(esp_eth_handle_t *)event_data); for (int i = 0; i < netif_glue->port_cnt; i++) { if (eth_handle == esp_netif_get_io_driver(netif_glue->ports_esp_netifs[i])) { stop_br_if_started(netif_glue); }{...} }{...} }{...} }{ ... } static void port_action_connected(void *handler_args, esp_event_base_t base, int32_t event_id, void *event_data) { esp_netif_br_glue_t *netif_glue = handler_args; // if bridge interface is already up, do nothing if (esp_netif_is_netif_up(netif_glue->base.netif) == true) { ESP_LOGD(TAG, "action_connected, no action bridge is up"); return; }{...} #if CONFIG_ESP_WIFI_ENABLED if (base == WIFI_EVENT) { ESP_LOGD(TAG, "wifi_action_connected: %p, %p, %" PRId32 ", %p", netif_glue, base, event_id, event_data); esp_netif_action_connected(netif_glue->base.netif, 0, 0, NULL); }{...} else/* ... */ #endif /* CONFIG_ESP_WIFI_ENABLED */ if (base == ETH_EVENT) { esp_eth_handle_t eth_handle = *(esp_eth_handle_t *)event_data; ESP_LOGD(TAG, "eth_action_connected: %p, %p, %" PRId32 ", %p, %p", netif_glue, base, event_id, event_data, *(esp_eth_handle_t *)event_data); for (int i = 0; i < netif_glue->port_cnt; i++) { if (eth_handle == esp_netif_get_io_driver(netif_glue->ports_esp_netifs[i])) { esp_netif_action_connected(netif_glue->base.netif, 0, 0, NULL); ESP_LOGD(TAG, "bridge netif %p is connected", netif_glue->base.netif); break; }{...} }{...} }{...} if (esp_netif_is_netif_up(netif_glue->base.netif) == true && (esp_netif_get_flags(netif_glue->base.netif) & ESP_NETIF_DHCP_SERVER) == ESP_NETIF_DHCP_SERVER) { esp_netif_dhcps_start(netif_glue->base.netif); }{...} }{ ... } static void port_action_disconnected(void *handler_args, esp_event_base_t base, int32_t event_id, void *event_data) { esp_netif_br_glue_t *netif_glue = handler_args; ESP_LOGD(TAG, "action_disconnected: %p, %p, %" PRId32 ", %p", netif_glue, base, event_id, event_data); // if all ports are disconnected, set bridge as disconnected too if (are_ports_disconnected(netif_glue)) { esp_netif_action_disconnected(netif_glue->base.netif, base, event_id, event_data); ESP_LOGD(TAG, "bridge netif %p is disconnected", netif_glue->base.netif); }{...} }{ ... } static void br_action_got_ip(void *handler_args, esp_event_base_t base, int32_t event_id, void *event_data) { ip_event_got_ip_t *ip_event = (ip_event_got_ip_t *)event_data; esp_netif_br_glue_t *netif_glue = handler_args; ESP_LOGD(TAG, "br_action_got_ip: %p, %p, %" PRIu32 ", %p, %p", netif_glue, base, event_id, event_data, *(esp_eth_handle_t *)event_data); if (netif_glue->base.netif == ip_event->esp_netif) { esp_netif_action_got_ip(ip_event->esp_netif, base, event_id, event_data); }{...} }{ ... } static esp_err_t esp_netif_br_glue_clear_instance_handlers(esp_netif_br_glue_handle_t esp_netif_br_glue) { ESP_RETURN_ON_FALSE(esp_netif_br_glue, ESP_ERR_INVALID_ARG, TAG, "esp_netif_br_glue handle can't be null"); if (esp_netif_br_glue->eth_ctx_handlers[START_CTX_HANDLER]) { esp_event_handler_instance_unregister(ETH_EVENT, ETHERNET_EVENT_START, esp_netif_br_glue->eth_ctx_handlers[START_CTX_HANDLER]); }{...} if (esp_netif_br_glue->eth_ctx_handlers[STOP_CTX_HANDLER]) { esp_event_handler_instance_unregister(ETH_EVENT, ETHERNET_EVENT_STOP, esp_netif_br_glue->eth_ctx_handlers[STOP_CTX_HANDLER]); }{...} if (esp_netif_br_glue->eth_ctx_handlers[CONNECT_CTX_HANDLER]) { esp_event_handler_instance_unregister(ETH_EVENT, ETHERNET_EVENT_CONNECTED, esp_netif_br_glue->eth_ctx_handlers[CONNECT_CTX_HANDLER]); }{...} if (esp_netif_br_glue->eth_ctx_handlers[DISCONNECT_CTX_HANDLER]) { esp_event_handler_instance_unregister(ETH_EVENT, ETHERNET_EVENT_DISCONNECTED, esp_netif_br_glue->eth_ctx_handlers[DISCONNECT_CTX_HANDLER]); }{...} free(esp_netif_br_glue->eth_ctx_handlers); if (esp_netif_br_glue->get_ip_ctx_handler) { esp_event_handler_instance_unregister(IP_EVENT, IP_EVENT_ETH_GOT_IP, esp_netif_br_glue->get_ip_ctx_handler); esp_netif_br_glue->get_ip_ctx_handler = NULL; }{...} return ESP_OK; }{ ... } static esp_err_t esp_netif_br_glue_set_instance_handlers(esp_netif_br_glue_handle_t esp_netif_br_glue) { esp_err_t ret = ESP_OK; ESP_RETURN_ON_FALSE(esp_netif_br_glue, ESP_ERR_INVALID_ARG, TAG, "esp_netif_br_glue handle can't be null"); esp_netif_br_glue->eth_ctx_handlers = calloc(CTX_HANDLERS_END_LIST, sizeof(esp_event_handler_instance_t)); ESP_GOTO_ON_FALSE(esp_netif_br_glue->eth_ctx_handlers, ESP_ERR_NO_MEM, fail, TAG, "no memory for Ethernet event context handlers"); ret = esp_event_handler_instance_register(ETH_EVENT, ETHERNET_EVENT_START, port_action_start, esp_netif_br_glue, &esp_netif_br_glue->eth_ctx_handlers[START_CTX_HANDLER]); if (ret != ESP_OK) { goto fail; }{...} ret = esp_event_handler_instance_register(ETH_EVENT, ETHERNET_EVENT_STOP, port_action_stop, esp_netif_br_glue, &esp_netif_br_glue->eth_ctx_handlers[STOP_CTX_HANDLER]); if (ret != ESP_OK) { goto fail; }{...} ret = esp_event_handler_instance_register(ETH_EVENT, ETHERNET_EVENT_CONNECTED, port_action_connected, esp_netif_br_glue, &esp_netif_br_glue->eth_ctx_handlers[CONNECT_CTX_HANDLER]); if (ret != ESP_OK) { goto fail; }{...} ret = esp_event_handler_instance_register(ETH_EVENT, ETHERNET_EVENT_DISCONNECTED, port_action_disconnected, esp_netif_br_glue, &esp_netif_br_glue->eth_ctx_handlers[DISCONNECT_CTX_HANDLER]); if (ret != ESP_OK) { goto fail; }{...} ret = esp_event_handler_instance_register(IP_EVENT, IP_EVENT_ETH_GOT_IP, br_action_got_ip, esp_netif_br_glue, &esp_netif_br_glue->get_ip_ctx_handler); if (ret != ESP_OK) { goto fail; }{...} return ESP_OK; fail: esp_netif_br_glue_clear_instance_handlers(esp_netif_br_glue); return ret; }{ ... } #if CONFIG_ESP_WIFI_ENABLED static esp_err_t esp_netif_br_glue_clear_instance_handlers_wifi(esp_netif_br_glue_handle_t esp_netif_br_glue) { ESP_RETURN_ON_FALSE(esp_netif_br_glue, ESP_ERR_INVALID_ARG, TAG, "esp_netif_br_glue handle can't be null"); ESP_RETURN_ON_FALSE(esp_netif_br_glue->wifi_ctx_handlers, ESP_ERR_INVALID_STATE, TAG, "WiFi event handlers are empty"); if (esp_netif_br_glue->wifi_ctx_handlers[START_CTX_HANDLER]) { esp_event_handler_instance_unregister(WIFI_EVENT, WIFI_EVENT_AP_START, esp_netif_br_glue->wifi_ctx_handlers[START_CTX_HANDLER]); }{...} if (esp_netif_br_glue->wifi_ctx_handlers[STOP_CTX_HANDLER]) { esp_event_handler_instance_unregister(WIFI_EVENT, WIFI_EVENT_AP_STOP, esp_netif_br_glue->wifi_ctx_handlers[STOP_CTX_HANDLER]); }{...} if (esp_netif_br_glue->wifi_ctx_handlers[CONNECT_CTX_HANDLER]) { esp_event_handler_instance_unregister(WIFI_EVENT, WIFI_EVENT_AP_STACONNECTED, esp_netif_br_glue->wifi_ctx_handlers[CONNECT_CTX_HANDLER]); }{...} if (esp_netif_br_glue->wifi_ctx_handlers[DISCONNECT_CTX_HANDLER]) { esp_event_handler_instance_unregister(WIFI_EVENT, WIFI_EVENT_AP_STADISCONNECTED, esp_netif_br_glue->wifi_ctx_handlers[DISCONNECT_CTX_HANDLER]); }{...} free(esp_netif_br_glue->wifi_ctx_handlers); return ESP_OK; }{ ... } static esp_err_t esp_netif_br_glue_set_instance_handlers_wifi(esp_netif_br_glue_handle_t esp_netif_br_glue) { esp_err_t ret= ESP_OK; ESP_RETURN_ON_FALSE(esp_netif_br_glue, ESP_ERR_INVALID_ARG, TAG, "esp_netif_br_glue handle can't be null"); ESP_RETURN_ON_FALSE(esp_netif_br_glue->wifi_esp_netif, ESP_ERR_INVALID_ARG, TAG, "WiFi port esp_netif isn't registered"); esp_netif_br_glue->wifi_ctx_handlers = calloc(CTX_HANDLERS_END_LIST, sizeof(esp_event_handler_instance_t)); ESP_GOTO_ON_FALSE(esp_netif_br_glue->wifi_ctx_handlers, ESP_ERR_NO_MEM, fail, TAG, "no memory for WiFi event context handlers"); ret = esp_event_handler_instance_register(WIFI_EVENT, WIFI_EVENT_AP_START, port_action_start, esp_netif_br_glue, &esp_netif_br_glue->wifi_ctx_handlers[START_CTX_HANDLER]); if (ret != ESP_OK) { goto fail; }{...} ret = esp_event_handler_instance_register(WIFI_EVENT, WIFI_EVENT_AP_STOP, port_action_stop, esp_netif_br_glue, &esp_netif_br_glue->wifi_ctx_handlers[STOP_CTX_HANDLER]); if (ret != ESP_OK) { goto fail; }{...} ret = esp_event_handler_instance_register(WIFI_EVENT, WIFI_EVENT_AP_STACONNECTED, port_action_connected, esp_netif_br_glue, &esp_netif_br_glue->wifi_ctx_handlers[CONNECT_CTX_HANDLER]); if (ret != ESP_OK) { goto fail; }{...} ret = esp_event_handler_instance_register(WIFI_EVENT, WIFI_EVENT_AP_STADISCONNECTED, port_action_disconnected, esp_netif_br_glue, &esp_netif_br_glue->wifi_ctx_handlers[DISCONNECT_CTX_HANDLER]); if (ret != ESP_OK) { goto fail; }{...} return ESP_OK; fail: esp_netif_br_glue_clear_instance_handlers_wifi(esp_netif_br_glue); return ret; }{ ... } #endif/* ... */ /* CONFIG_ESP_WIFI_ENABLED */ esp_err_t esp_netif_br_glue_add_port(esp_netif_br_glue_handle_t netif_br_glue, esp_netif_t *esp_netif_port) { if (netif_br_glue->ports_esp_netifs == NULL) { netif_br_glue->ports_esp_netifs = malloc(sizeof(esp_netif_t *)); }{...} else { netif_br_glue->ports_esp_netifs = realloc(netif_br_glue->ports_esp_netifs, (netif_br_glue->port_cnt + 1) * sizeof(esp_netif_t *)); }{...} if (!netif_br_glue->ports_esp_netifs) { ESP_LOGE(TAG, "no memory to add br port"); return ESP_ERR_NO_MEM; }{...} netif_br_glue->ports_esp_netifs[netif_br_glue->port_cnt] = esp_netif_port; netif_br_glue->port_cnt++; return ESP_OK; }{ ... } esp_err_t esp_netif_br_glue_add_wifi_port(esp_netif_br_glue_handle_t netif_br_glue, esp_netif_t *esp_netif_port) { #if CONFIG_ESP_WIFI_ENABLED esp_err_t ret = ESP_OK; ESP_GOTO_ON_FALSE(netif_br_glue->wifi_esp_netif == NULL, ESP_ERR_INVALID_STATE, fail_ret, TAG, "WiFi interface already registered"); const char *if_desc = esp_netif_get_desc(esp_netif_port); ESP_GOTO_ON_FALSE(strcmp(if_desc, "ap") == 0, ESP_ERR_INVALID_ARG, fail_ret, TAG, "interface is not WiFi AP"); netif_br_glue->wifi_esp_netif = esp_netif_port; ESP_GOTO_ON_ERROR(esp_netif_br_glue_set_instance_handlers_wifi(netif_br_glue), fail, TAG, "failed to create WiFi event handlers"); return ESP_OK; fail: netif_br_glue->wifi_esp_netif = NULL; netif_br_glue->wifi_ctx_handlers = NULL; fail_ret: return ret;/* ... */ #else return ESP_ERR_NOT_SUPPORTED; #endif /* CONFIG_ESP_WIFI_ENABLED */ }{ ... } esp_netif_br_glue_handle_t esp_netif_br_glue_new(void) { esp_netif_br_glue_t *netif_glue = calloc(1, sizeof(esp_netif_br_glue_t)); if (!netif_glue) { ESP_LOGE(TAG, "create netif glue failed"); return NULL; }{...} netif_glue->base.post_attach = esp_eth_post_attach_br; if (esp_netif_br_glue_set_instance_handlers(netif_glue) != ESP_OK) { esp_netif_br_glue_del(netif_glue); return NULL; }{...} return netif_glue; }{ ... } esp_err_t esp_netif_br_glue_del(esp_netif_br_glue_handle_t netif_br_glue) { stop_br_if_started(netif_br_glue); esp_netif_br_glue_clear_instance_handlers(netif_br_glue); #if CONFIG_ESP_WIFI_ENABLED if (netif_br_glue->wifi_esp_netif != NULL) { esp_netif_br_glue_clear_instance_handlers_wifi(netif_br_glue); }{...} #endif/* ... */ /* CONFIG_ESP_WIFI_ENABLED */ free(netif_br_glue->ports_esp_netifs); free(netif_br_glue); netif_br_glue = NULL; return ESP_OK; }{ ... } /* ... */#endif // CONFIG_ESP_NETIF_BRIDGE_EN
Details
Show:
from
Types: Columns:
This file uses the notable symbols shown below. Click anywhere in the file to view more details.